@luma.gl/webgl 9.0.0-beta.1 → 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 (285) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  2. package/dist/adapter/converters/device-parameters.js +295 -156
  3. package/dist/adapter/converters/sampler-parameters.d.ts +0 -4
  4. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  5. package/dist/adapter/converters/sampler-parameters.js +73 -67
  6. package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
  7. package/dist/adapter/converters/shader-formats.js +53 -46
  8. package/dist/adapter/converters/texture-formats.d.ts +17 -21
  9. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  10. package/dist/adapter/converters/texture-formats.js +481 -879
  11. package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
  12. package/dist/adapter/converters/vertex-formats.js +53 -61
  13. package/dist/adapter/device-helpers/webgl-device-features.d.ts +20 -0
  14. package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -0
  15. package/dist/adapter/device-helpers/webgl-device-features.js +98 -0
  16. package/dist/adapter/device-helpers/webgl-device-info.d.ts +5 -0
  17. package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -0
  18. package/dist/adapter/device-helpers/webgl-device-info.js +90 -0
  19. package/dist/adapter/device-helpers/webgl-device-limits.d.ts +35 -0
  20. package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -0
  21. package/dist/adapter/device-helpers/webgl-device-limits.js +47 -0
  22. package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -1
  23. package/dist/adapter/helpers/decode-webgl-types.js +88 -76
  24. package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
  25. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  26. package/dist/adapter/helpers/get-shader-layout.js +261 -225
  27. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  28. package/dist/adapter/helpers/parse-shader-compiler-log.js +47 -37
  29. package/dist/adapter/helpers/set-uniform.d.ts +1 -1
  30. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  31. package/dist/adapter/helpers/set-uniform.js +68 -82
  32. package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
  33. package/dist/adapter/helpers/webgl-topology-utils.js +78 -93
  34. package/dist/adapter/objects/constants-to-keys.d.ts +1 -1
  35. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  36. package/dist/adapter/objects/constants-to-keys.js +19 -12
  37. package/dist/adapter/objects/webgl-renderbuffer.d.ts +2 -2
  38. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  39. package/dist/adapter/objects/webgl-renderbuffer.js +86 -77
  40. package/dist/adapter/objects/webgl-resource.d.ts +3 -25
  41. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  42. package/dist/adapter/objects/webgl-resource.js +102 -147
  43. package/dist/adapter/resources/webgl-buffer.d.ts +3 -4
  44. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  45. package/dist/adapter/resources/webgl-buffer.js +159 -117
  46. package/dist/adapter/resources/webgl-command-buffer.d.ts +1 -1
  47. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  48. package/dist/adapter/resources/webgl-command-buffer.js +266 -168
  49. package/dist/adapter/resources/webgl-command-encoder.d.ts +8 -3
  50. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  51. package/dist/adapter/resources/webgl-command-encoder.js +33 -39
  52. package/dist/adapter/resources/webgl-external-texture.js +93 -1
  53. package/dist/adapter/resources/webgl-framebuffer.d.ts +8 -12
  54. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  55. package/dist/adapter/resources/webgl-framebuffer.js +174 -139
  56. package/dist/adapter/resources/webgl-query-set.d.ts +44 -0
  57. package/dist/adapter/resources/webgl-query-set.d.ts.map +1 -0
  58. package/dist/adapter/resources/webgl-query-set.js +136 -0
  59. package/dist/adapter/resources/webgl-render-pass.d.ts +3 -1
  60. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  61. package/dist/adapter/resources/webgl-render-pass.js +124 -90
  62. package/dist/adapter/resources/webgl-render-pipeline.d.ts +15 -6
  63. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  64. package/dist/adapter/resources/webgl-render-pipeline.js +362 -221
  65. package/dist/adapter/resources/webgl-sampler.d.ts +1 -3
  66. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  67. package/dist/adapter/resources/webgl-sampler.js +43 -33
  68. package/dist/adapter/resources/webgl-shader.d.ts +12 -2
  69. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  70. package/dist/adapter/resources/webgl-shader.js +114 -47
  71. package/dist/adapter/resources/webgl-texture-view.d.ts +14 -0
  72. package/dist/adapter/resources/webgl-texture-view.d.ts.map +1 -0
  73. package/dist/adapter/resources/webgl-texture-view.js +18 -0
  74. package/dist/adapter/resources/webgl-texture.d.ts +8 -10
  75. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  76. package/dist/adapter/resources/webgl-texture.js +616 -694
  77. package/dist/adapter/resources/webgl-transform-feedback.d.ts +2 -2
  78. package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
  79. package/dist/adapter/resources/webgl-transform-feedback.js +141 -143
  80. package/dist/adapter/resources/webgl-vertex-array.d.ts +3 -3
  81. package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
  82. package/dist/adapter/resources/webgl-vertex-array.js +229 -157
  83. package/dist/adapter/webgl-canvas-context.d.ts +2 -2
  84. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  85. package/dist/adapter/webgl-canvas-context.js +58 -36
  86. package/dist/adapter/webgl-device.d.ts +50 -44
  87. package/dist/adapter/webgl-device.d.ts.map +1 -1
  88. package/dist/adapter/webgl-device.js +427 -352
  89. package/dist/classic/accessor.d.ts.map +1 -1
  90. package/dist/classic/accessor.js +132 -101
  91. package/dist/classic/clear.d.ts +2 -2
  92. package/dist/classic/clear.d.ts.map +1 -1
  93. package/dist/classic/clear.js +73 -72
  94. package/dist/classic/copy-and-blit.d.ts +1 -1
  95. package/dist/classic/copy-and-blit.d.ts.map +1 -1
  96. package/dist/classic/copy-and-blit.js +174 -175
  97. package/dist/classic/format-utils.d.ts +2 -2
  98. package/dist/classic/format-utils.d.ts.map +1 -1
  99. package/dist/classic/format-utils.js +39 -32
  100. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  101. package/dist/classic/typed-array-utils.js +96 -81
  102. package/dist/context/debug/spector.d.ts.map +1 -1
  103. package/dist/context/debug/spector.js +55 -50
  104. package/dist/context/debug/webgl-developer-tools.d.ts +1 -2
  105. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  106. package/dist/context/debug/webgl-developer-tools.js +104 -77
  107. package/dist/context/{context → helpers}/create-browser-context.d.ts +1 -6
  108. package/dist/context/helpers/create-browser-context.d.ts.map +1 -0
  109. package/dist/context/helpers/create-browser-context.js +67 -0
  110. package/dist/context/{polyfill/context-data.d.ts → helpers/webgl-context-data.d.ts} +2 -2
  111. package/dist/context/helpers/webgl-context-data.d.ts.map +1 -0
  112. package/dist/context/helpers/webgl-context-data.js +21 -0
  113. package/dist/context/helpers/webgl-extensions.d.ts +4 -0
  114. package/dist/context/helpers/webgl-extensions.d.ts.map +1 -0
  115. package/dist/context/helpers/webgl-extensions.js +10 -0
  116. package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
  117. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  118. package/dist/context/parameters/unified-parameter-api.js +92 -47
  119. package/dist/context/parameters/webgl-parameter-tables.d.ts +109 -99
  120. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  121. package/dist/context/parameters/webgl-parameter-tables.js +463 -404
  122. package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
  123. package/dist/context/state-tracker/deep-array-equal.js +19 -14
  124. package/dist/context/state-tracker/track-context-state.d.ts +4 -4
  125. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  126. package/dist/context/state-tracker/track-context-state.js +188 -123
  127. package/dist/context/state-tracker/with-parameters.d.ts +2 -3
  128. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  129. package/dist/context/state-tracker/with-parameters.js +42 -28
  130. package/dist/dist.dev.js +4465 -7235
  131. package/dist/dist.min.js +10 -0
  132. package/dist/index.cjs +2146 -3116
  133. package/dist/index.cjs.map +7 -0
  134. package/dist/index.d.ts +25 -31
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.js +19 -10
  137. package/dist/types.d.ts.map +1 -1
  138. package/dist/types.js +3 -1
  139. package/dist.min.js +9 -42
  140. package/package.json +10 -15
  141. package/src/adapter/converters/device-parameters.ts +114 -28
  142. package/src/adapter/converters/sampler-parameters.ts +12 -20
  143. package/src/adapter/converters/shader-formats.ts +47 -22
  144. package/src/adapter/converters/texture-formats.ts +183 -227
  145. package/src/adapter/converters/vertex-formats.ts +3 -3
  146. package/src/adapter/device-helpers/webgl-device-features.ts +121 -0
  147. package/src/adapter/device-helpers/{get-device-info.ts → webgl-device-info.ts} +30 -22
  148. package/src/adapter/device-helpers/webgl-device-limits.ts +53 -0
  149. package/src/adapter/helpers/decode-webgl-types.ts +13 -7
  150. package/src/adapter/helpers/get-shader-layout.ts +21 -31
  151. package/src/adapter/helpers/parse-shader-compiler-log.ts +10 -6
  152. package/src/adapter/helpers/set-uniform.ts +3 -4
  153. package/src/adapter/helpers/webgl-topology-utils.ts +10 -3
  154. package/src/adapter/objects/constants-to-keys.ts +3 -2
  155. package/src/adapter/objects/webgl-renderbuffer.ts +38 -16
  156. package/src/adapter/objects/webgl-resource.ts +8 -141
  157. package/src/adapter/resources/webgl-buffer.ts +10 -14
  158. package/src/adapter/resources/webgl-command-buffer.ts +24 -34
  159. package/src/adapter/resources/webgl-command-encoder.ts +14 -11
  160. package/src/adapter/resources/webgl-external-texture.ts +7 -7
  161. package/src/adapter/resources/webgl-framebuffer.ts +65 -58
  162. package/src/adapter/resources/webgl-query-set.ts +171 -0
  163. package/src/adapter/resources/webgl-render-pass.ts +27 -18
  164. package/src/adapter/resources/webgl-render-pipeline.ts +148 -73
  165. package/src/adapter/resources/webgl-sampler.ts +7 -10
  166. package/src/adapter/resources/webgl-shader.ts +65 -11
  167. package/src/adapter/resources/webgl-texture-view.ts +28 -0
  168. package/src/adapter/resources/webgl-texture.ts +43 -106
  169. package/src/adapter/resources/webgl-transform-feedback.ts +16 -22
  170. package/src/adapter/resources/webgl-vertex-array.ts +20 -21
  171. package/src/adapter/webgl-canvas-context.ts +7 -11
  172. package/src/adapter/webgl-device.ts +142 -162
  173. package/src/classic/accessor.ts +5 -4
  174. package/src/classic/clear.ts +25 -20
  175. package/src/classic/copy-and-blit.ts +12 -6
  176. package/src/classic/format-utils.ts +2 -1
  177. package/src/classic/typed-array-utils.ts +3 -7
  178. package/src/context/debug/spector.ts +9 -6
  179. package/src/context/debug/webgl-developer-tools.ts +31 -20
  180. package/src/context/{context → helpers}/create-browser-context.ts +9 -33
  181. package/src/context/{polyfill/context-data.ts → helpers/webgl-context-data.ts} +3 -2
  182. package/src/context/helpers/webgl-extensions.ts +17 -0
  183. package/src/context/parameters/unified-parameter-api.ts +6 -17
  184. package/src/context/parameters/webgl-parameter-tables.ts +118 -90
  185. package/src/context/state-tracker/deep-array-equal.ts +2 -1
  186. package/src/context/state-tracker/track-context-state.ts +29 -23
  187. package/src/context/state-tracker/with-parameters.ts +8 -8
  188. package/src/index.ts +16 -56
  189. package/src/types.ts +2 -1
  190. package/dist/adapter/converters/device-parameters.js.map +0 -1
  191. package/dist/adapter/converters/sampler-parameters.js.map +0 -1
  192. package/dist/adapter/converters/shader-formats.js.map +0 -1
  193. package/dist/adapter/converters/texture-formats.js.map +0 -1
  194. package/dist/adapter/converters/vertex-formats.js.map +0 -1
  195. package/dist/adapter/device-helpers/device-features.d.ts +0 -9
  196. package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
  197. package/dist/adapter/device-helpers/device-features.js +0 -96
  198. package/dist/adapter/device-helpers/device-features.js.map +0 -1
  199. package/dist/adapter/device-helpers/device-limits.d.ts +0 -52
  200. package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
  201. package/dist/adapter/device-helpers/device-limits.js +0 -87
  202. package/dist/adapter/device-helpers/device-limits.js.map +0 -1
  203. package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
  204. package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
  205. package/dist/adapter/device-helpers/get-device-info.js +0 -71
  206. package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
  207. package/dist/adapter/device-helpers/is-old-ie.d.ts +0 -2
  208. package/dist/adapter/device-helpers/is-old-ie.d.ts.map +0 -1
  209. package/dist/adapter/device-helpers/is-old-ie.js +0 -9
  210. package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
  211. package/dist/adapter/helpers/decode-webgl-types.js.map +0 -1
  212. package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
  213. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
  214. package/dist/adapter/helpers/set-uniform.js.map +0 -1
  215. package/dist/adapter/helpers/webgl-topology-utils.js.map +0 -1
  216. package/dist/adapter/objects/constants-to-keys.js.map +0 -1
  217. package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
  218. package/dist/adapter/objects/webgl-resource.js.map +0 -1
  219. package/dist/adapter/resources/webgl-buffer.js.map +0 -1
  220. package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
  221. package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
  222. package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
  223. package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
  224. package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
  225. package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
  226. package/dist/adapter/resources/webgl-sampler.js.map +0 -1
  227. package/dist/adapter/resources/webgl-shader.js.map +0 -1
  228. package/dist/adapter/resources/webgl-texture.js.map +0 -1
  229. package/dist/adapter/resources/webgl-transform-feedback.js.map +0 -1
  230. package/dist/adapter/resources/webgl-vertex-array.js.map +0 -1
  231. package/dist/adapter/webgl-canvas-context.js.map +0 -1
  232. package/dist/adapter/webgl-device.js.map +0 -1
  233. package/dist/classic/accessor.js.map +0 -1
  234. package/dist/classic/clear.js.map +0 -1
  235. package/dist/classic/copy-and-blit.js.map +0 -1
  236. package/dist/classic/format-utils.js.map +0 -1
  237. package/dist/classic/typed-array-utils.js.map +0 -1
  238. package/dist/context/context/create-browser-context.d.ts.map +0 -1
  239. package/dist/context/context/create-browser-context.js +0 -53
  240. package/dist/context/context/create-browser-context.js.map +0 -1
  241. package/dist/context/context/create-headless-context.d.ts +0 -9
  242. package/dist/context/context/create-headless-context.d.ts.map +0 -1
  243. package/dist/context/context/create-headless-context.js +0 -42
  244. package/dist/context/context/create-headless-context.js.map +0 -1
  245. package/dist/context/context/webgl-checks.d.ts +0 -13
  246. package/dist/context/context/webgl-checks.d.ts.map +0 -1
  247. package/dist/context/context/webgl-checks.js +0 -31
  248. package/dist/context/context/webgl-checks.js.map +0 -1
  249. package/dist/context/debug/spector.js.map +0 -1
  250. package/dist/context/debug/webgl-developer-tools.js.map +0 -1
  251. package/dist/context/parameters/unified-parameter-api.js.map +0 -1
  252. package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
  253. package/dist/context/polyfill/context-data.d.ts.map +0 -1
  254. package/dist/context/polyfill/context-data.js +0 -12
  255. package/dist/context/polyfill/context-data.js.map +0 -1
  256. package/dist/context/polyfill/get-parameter-polyfill.d.ts +0 -2
  257. package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +0 -1
  258. package/dist/context/polyfill/get-parameter-polyfill.js +0 -85
  259. package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
  260. package/dist/context/polyfill/polyfill-context.d.ts +0 -5
  261. package/dist/context/polyfill/polyfill-context.d.ts.map +0 -1
  262. package/dist/context/polyfill/polyfill-context.js +0 -87
  263. package/dist/context/polyfill/polyfill-context.js.map +0 -1
  264. package/dist/context/polyfill/polyfill-table.d.ts +0 -48
  265. package/dist/context/polyfill/polyfill-table.d.ts.map +0 -1
  266. package/dist/context/polyfill/polyfill-table.js +0 -137
  267. package/dist/context/polyfill/polyfill-table.js.map +0 -1
  268. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts +0 -2
  269. package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +0 -1
  270. package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -265
  271. package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
  272. package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
  273. package/dist/context/state-tracker/track-context-state.js.map +0 -1
  274. package/dist/context/state-tracker/with-parameters.js.map +0 -1
  275. package/dist/index.js.map +0 -1
  276. package/dist/types.js.map +0 -1
  277. package/src/adapter/device-helpers/device-features.ts +0 -161
  278. package/src/adapter/device-helpers/device-limits.ts +0 -155
  279. package/src/adapter/device-helpers/is-old-ie.ts +0 -14
  280. package/src/context/context/create-headless-context.ts +0 -51
  281. package/src/context/context/webgl-checks.ts +0 -51
  282. package/src/context/polyfill/get-parameter-polyfill.ts +0 -122
  283. package/src/context/polyfill/polyfill-context.ts +0 -104
  284. package/src/context/polyfill/polyfill-table.ts +0 -167
  285. package/src/context/polyfill/polyfill-vertex-array-object.ts +0 -365
package/dist.min.js CHANGED
@@ -4,49 +4,16 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- var __exports__=(()=>{var kn=Object.defineProperty;var Hc=Object.getOwnPropertyDescriptor;var Xc=Object.getOwnPropertyNames;var Vc=Object.prototype.hasOwnProperty;var kc=(e,t)=>{for(var r in t)kn(e,r,{get:t[r],enumerable:!0})},Lc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xc(t))!Vc.call(e,i)&&i!==r&&kn(e,i,{get:()=>t[i],enumerable:!(n=Hc(t,i))||n.enumerable});return e};var Kc=e=>Lc(kn({},"__esModule",{value:!0}),e);var em={};kc(em,{Accessor:()=>In,WEBGLBuffer:()=>pe,WEBGLCommandEncoder:()=>Dn,WEBGLFramebuffer:()=>Pe,WEBGLRenderPass:()=>wn,WEBGLRenderPipeline:()=>Cn,WEBGLRenderbuffer:()=>Tt,WEBGLResource:()=>hr,WEBGLSampler:()=>Ve,WEBGLShader:()=>On,WEBGLTexture:()=>se,WEBGLTransformFeedback:()=>Wn,WEBGLVertexArray:()=>Un,WebGLCanvasContext:()=>An,WebGLDevice:()=>le,WebGLResource:()=>hr,_TEXTURE_FORMATS:()=>He,_checkFloat32ColorAttachment:()=>un,assertWebGL2Context:()=>pf,assertWebGLContext:()=>en,clear:()=>Uc,convertGLToTextureFormat:()=>Xe,copyToTexture:()=>Cc,getGLParameters:()=>on,getShaderLayout:()=>Nn,getWebGL2Context:()=>Zt,isWebGL:()=>To,isWebGL2:()=>K,polyfillContext:()=>nn,popContextState:()=>ge,pushContextState:()=>Se,readPixelsToArray:()=>Hn,readPixelsToBuffer:()=>Xn,registerHeadlessGL:()=>di,resetGLParameters:()=>wf,setDeviceParameters:()=>ln,setGLParameters:()=>be,trackContextState:()=>rr,withDeviceParameters:()=>qf,withGLParameters:()=>ve});function Dt(e){return Dt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dt(e)}function li(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function pi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?li(Object(r),!0).forEach(function(n){Yc(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):li(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Yc(e,t,r){return t=zc(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zc(e){var t=$c(e,"string");return Dt(t)==="symbol"?t:String(t)}function $c(e,t){if(Dt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Dt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Zc="Failed to create WebGL context in Node.js, headless gl returned null",Qc=" luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server.",qc={width:1,height:1,debug:!0,throwOnError:!1},Sr=null;function di(e){Sr=e}function hi(){return Sr!==null}function yi(e){e=pi(pi({},qc),e);var t=e,r=t.width,n=t.height,i=t.webgl1,o=t.webgl2;if(o&&!i)throw new Error("headless-gl does not support WebGL2");if(!Sr)throw new Error(Qc);var a=Sr(r,n,e);if(!a)throw new Error(Zc);return a}function Mt(e){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 t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function G(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Mt()}var Jc=globalThis.self||globalThis.window||globalThis.global,Ye=globalThis.window||globalThis.self||globalThis.global,Gc=globalThis.document||{},Be=globalThis.process||{},es=globalThis.console,_i=globalThis.navigator||{};var Ar=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",um=G();var Ln=globalThis;function Rr(e){if(!e&&!G())return"Node";if(Mt(e))return"Electron";let t=e||_i.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Ln.chrome?"Chrome":Ln.safari?"Safari":Ln.mozInnerScreenX?"Firefox":"Unknown"}function ts(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Or=class{constructor(t,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=ts(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function bi(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function gi(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}function Er(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));let o=e.width*r,a=e.height*r,u=["font-size:1px;","padding:".concat(Math.floor(a/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(a,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(a,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),u]}var wr;(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"})(wr||(wr={}));var rs=10;function vi(e){return typeof e!="string"?e:(e=e.toUpperCase(),wr[e]||wr.WHITE)}function mi(e,t,r){if(!G&&typeof e=="string"){if(t){let n=vi(t);e="\x1B[".concat(n,"m").concat(e,"\x1B[39m")}if(r){let n=vi(r);e="\x1B[".concat(n+rs,"m").concat(e,"\x1B[49m")}}return e}function Ti(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let a=i[o];typeof a=="function"&&(t.find(u=>o===u)||(i[o]=a.bind(e)))}}function ze(e,t){if(!e)throw new Error(t||"Assertion failed")}function Fe(){let e;if(G()&&Ye.performance){var t,r;e=Ye===null||Ye===void 0||(t=Ye.performance)===null||t===void 0||(r=t.now)===null||r===void 0?void 0:r.call(t)}else if("hrtime"in Be){var n;let i=Be===null||Be===void 0||(n=Be.hrtime)===null||n===void 0?void 0:n.call(Be);e=i[0]*1e3+i[1]/1e6}else e=Date.now();return e}var $e={debug:G()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ns={enabled:!0,level:0};function ye(){}var Si={},Ai={once:!0},xe=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=Ar,this._startTs=Fe(),this._deltaTs=Fe(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Or("__probe-".concat(this.id,"__"),ns),this.timeStamp("".concat(this.id," started")),Ti(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((Fe()-this._startTs).toPrecision(10))}getDelta(){return Number((Fe()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!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,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){ze(t,r)}warn(t){return this._getLogFunction(0,t,$e.warn,arguments,Ai)}error(t){return this._getLogFunction(0,t,$e.error,arguments)}deprecated(t,r){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(t,r){return this.error("`".concat(t,"` has been removed. Use `").concat(r,"` instead"))}probe(t,r){return this._getLogFunction(t,r,$e.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,$e.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,$e.debug||$e.info,arguments,Ai)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||ye,n&&[n],{tag:fs(r)}):ye}image(t){let{logLevel:r,priority:n,image:i,message:o="",scale:a=1}=t;return this._shouldLog(r||n)?G()?as({image:i,message:o,scale:a}):is({image:i,message:o,scale:a}):ye}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||ye)}group(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=Ri({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||ye)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Oi(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=Ri({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,ze(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Fe();let a=o.tag||o.message;if(o.once&&a)if(!Si[a])Si[a]=Fe();else return ye;return r=os(this.id,o.message,o),n.bind(console,r,...o.args)}return ye}};xe.VERSION=Ar;function Oi(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 ze(Number.isFinite(t)&&t>=0),t}function Ri(e){let{logLevel:t,message:r}=e;e.logLevel=Oi(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return ze(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function os(e,t,r){if(typeof t=="string"){let n=r.time?gi(bi(r.total)):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),t=mi(t,r.color,r.background)}return t}function is(e){let{image:t,message:r="",scale:n=1}=e;return console.warn("removed"),ye}function as(e){let{image:t,message:r="",scale:n=1}=e;if(typeof t=="string"){let o=new Image;return o.onload=()=>{let a=Er(o,r,n);console.log(...a)},o.src=t,ye}let i=t.nodeName||"";if(i.toLowerCase()==="img")return console.log(...Er(t,r,n)),ye;if(i.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...Er(o,r,n)),o.src=t.toDataURL(),ye}return ye}function fs(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Wm=new xe({id:"@probe.gl/log"});var D=new xe({id:"luma.gl"});function Ut(){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 De=class{constructor(t,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=t,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(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=Ut(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ut()-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 Ze=class{constructor(t){this.id=void 0,this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:r})}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 r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof De?i=t:i=new De(r,n),this.stats[r]=i),i}};function jt(e){return jt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(e)}function Ei(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,cs(n.key),n)}}function us(e,t,r){return t&&Ei(e.prototype,t),r&&Ei(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function cs(e){var t=ss(e,"string");return jt(t)==="symbol"?t:String(t)}function ss(e,t){if(jt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(jt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ls(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ps=function(){function e(){ls(this,e),this.stats=new Map}var t=e.prototype;return t.getStats=function(n){return this.get(n)},t.get=function(n){return this.stats.has(n)||this.stats.set(n,new Ze({id:n})),this.stats.get(n)},us(e)}(),Pr=new ps;function ds(){var e=typeof __VERSION__<"u"?__VERSION__:"running from source",t="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==e)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(e));return globalThis.luma||(G()&&D.log(1,"".concat(e," - ").concat(t))(),globalThis.luma=globalThis.luma||{VERSION:e,version:e,log:D,stats:Pr}),e}var wi=ds();function hs(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)?e:null}function Pi(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number"?e:null:hs(e)}var Kn={};function Te(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Kn[e]=Kn[e]||1;var t=Kn[e]++;return"".concat(e,"-").concat(t)}function Ir(e){return e>0&&(e&e-1)===0}function Qe(e){var t=!0;for(var r in e){t=!1;break}return t}function Wt(e){return Wt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wt(e)}function Ii(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ys(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ii(Object(r),!0).forEach(function(n){_s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ii(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _s(e,t,r){return t=xi(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ni(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xi(n.key),n)}}function bs(e,t,r){return t&&Ni(e.prototype,t),r&&Ni(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xi(e){var t=gs(e,"string");return Wt(t)==="symbol"?t:String(t)}function gs(e,t){if(Wt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Wt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var $=function(){function e(r,n,i){if(vs(this,e),this.id=void 0,this.props=void 0,this.userData={},this.device=void 0,this._device=void 0,this.destroyed=!1,this.allocatedBytes=0,this._attachedResources=new Set,!r)throw new Error("no device");this._device=r,this.props=ms(n,i);var o=this.props.id!=="undefined"?this.props.id:Te(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}var t=e.prototype;return t.destroy=function(){this.destroyResource()},t.delete=function(){return this.destroy(),this},t.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},t.getProps=function(){return this.props},t.attachResource=function(n){this._attachedResources.add(n)},t.detachResource=function(n){this._attachedResources.delete(n)},t.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},t.destroyAttachedResources=function(){for(var n=0,i=Object.values(this._attachedResources);n<i.length;n++){var o=i[n];o.destroy()}this._attachedResources=new Set},t.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},t.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("".concat(i,"s Active")).decrementCount()},t.trackAllocatedMemory=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],o=this._device.statsManager.getStats("Resource Counts");o.get("GPU Memory").addCount(n),o.get("".concat(i," Memory")).addCount(n),this.allocatedBytes=n},t.trackDeallocatedMemory=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").subtractCount(this.allocatedBytes),i.get("".concat(n," Memory")).subtractCount(this.allocatedBytes),this.allocatedBytes=0},t.addStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("Resources Created").incrementCount(),n.get("".concat(i,"s Created")).incrementCount(),n.get("".concat(i,"s Active")).incrementCount()},bs(e)}();$.defaultProps={id:"undefined",handle:void 0,userData:void 0};function ms(e,t){var r=ys({},t);for(var n in e)e[n]!==void 0&&(r[n]=e[n]);return r}function qe(e){return qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qe(e)}var Fi;function Ci(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Yn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ci(Object(r),!0).forEach(function(n){Ts(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ci(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ts(e,t,r){return t=Di(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ss(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bi(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Di(n.key),n)}}function As(e,t,r){return t&&Bi(e.prototype,t),r&&Bi(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Di(e){var t=Rs(e,"string");return qe(t)==="symbol"?t:String(t)}function Rs(e,t){if(qe(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(qe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Os(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&zn(e,t)}function zn(e,t){return zn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},zn(e,t)}function Es(e){var t=Is();return function(){var n=Nr(e),i;if(t){var o=Nr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ws(this,i)}}function ws(e,t){if(t&&(qe(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ps(e)}function Ps(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Is(){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 Nr(e){return Nr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nr(e)}Fi=Symbol.toStringTag;var te=function(e){Os(r,e);var t=Es(r);function r(i,o){var a;Ss(this,r);var u=Yn({},o);return(o.usage||0)&r.INDEX&&!o.indexType&&(o.data instanceof Uint32Array?u.indexType="uint32":o.data instanceof Uint16Array&&(u.indexType="uint16")),a=t.call(this,i,u,r.defaultProps),a.usage=void 0,a.indexType=void 0,a.byteLength=void 0,a.debugData=new ArrayBuffer(0),a.usage=o.usage||0,a.indexType=u.indexType,a}var n=r.prototype;return n.readSyncWebGL2=function(o,a){throw new Error("not implemented")},n._setDebugData=function(o,a,u){var c=ArrayBuffer.isView(o)?o.buffer:o,p=Math.min(o?o.byteLength:u,r.DEBUG_DATA_MAX_LENGTH);o===null?this.debugData=new ArrayBuffer(p):a===0&&u===o.byteLength?this.debugData=c.slice(0,p):this.debugData=c.slice(a,a+p)},As(r,[{key:Fi,get:function(){return"Buffer"}}]),r}($);te.defaultProps=Yn(Yn({},$.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});te.MAP_READ=1;te.MAP_WRITE=2;te.COPY_SRC=4;te.COPY_DST=8;te.INDEX=16;te.VERTEX=32;te.UNIFORM=64;te.STORAGE=128;te.INDIRECT=256;te.QUERY_RESOLVE=512;te.DEBUG_DATA_MAX_LENGTH=32;function Ht(e){return Ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ht(e)}var ji;function Mi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mi(Object(r),!0).forEach(function(n){Ns(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ns(e,t,r){return t=Wi(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ui(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Wi(n.key),n)}}function Cs(e,t,r){return t&&Ui(e.prototype,t),r&&Ui(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wi(e){var t=Bs(e,"string");return Ht(t)==="symbol"?t:String(t)}function Bs(e,t){if(Ht(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ht(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}ji=Symbol.toStringTag;var Je=function(){function e(r){xs(this,e),this.id=void 0,this.statsManager=Pr,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=$n($n({},e.defaultProps),r),this.id=this.props.id||Te(this[Symbol.toStringTag].toLowerCase())}var t=e.prototype;return t.loseDevice=function(){return!1},t.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},t.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},t.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},t.readPixelsToArrayWebGL=function(n,i){throw new Error("not implemented")},t.readPixelsToBufferWebGL2=function(n,i){throw new Error("not implemented")},t._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var i=$n({},n);return(n.usage||0)&te.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?i.indexType="uint32":n.data instanceof Uint16Array?i.indexType="uint16":D.warn("indices buffer content must be of integer type")()),i},Cs(e,[{key:ji,get:function(){return"Device"}}]),e}();Je.defaultProps={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(D.get("debug")),break:[],gl:null};Je.VERSION=wi;function H(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}function Xt(e){return Xt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xt(e)}function xr(e,t){return Ms(e)||Ds(e,t)||Yi(e,t)||Fs()}function Fs(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
8
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ds(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Ms(e){if(Array.isArray(e))return e}function Us(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Yi(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
9
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Yi(e,t){if(e){if(typeof e=="string")return Hi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Hi(e,t)}}function Hi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Xi(Object(r),!0).forEach(function(n){js(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xi(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function js(e,t,r){return t=zi(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ws(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ki(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,zi(n.key),n)}}function Hs(e,t,r){return t&&ki(e.prototype,t),r&&ki(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function zi(e){var t=Xs(e,"string");return Xt(t)==="symbol"?t:String(t)}function Xs(e,t){if(Xt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Xt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Vs=G()&&typeof document<"u",Cr=function(){return Vs&&document.readyState==="complete"},ks={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Ge=function(){function e(r){var n=this;if(Ws(this,e),this.device=void 0,this.id=void 0,this.props=void 0,this.canvas=void 0,this.htmlCanvas=void 0,this.offscreenCanvas=void 0,this.type=void 0,this.width=1,this.height=1,this.resizeObserver=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this.props=Vi(Vi({},ks),r),r=this.props,!G()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(r.canvas)typeof r.canvas=="string"?this.canvas=Ys(r.canvas):this.canvas=r.canvas;else{var i,o,a=zs(r),u=Ks(((i=r)===null||i===void 0?void 0:i.container)||null);u.insertBefore(a,u.firstChild),this.canvas=a,(o=r)!==null&&o!==void 0&&o.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&r.autoResize&&(this.resizeObserver=new ResizeObserver(function(c){var p=Us(c),b;try{for(p.s();!(b=p.n()).done;){var g=b.value;g.target===n.canvas&&n.update()}}catch(v){p.e(v)}finally{p.f()}}),this.resizeObserver.observe(this.canvas))}var t=e.prototype;return t.getDevicePixelRatio=function(n){if(typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(n=n===void 0?this.props.useDevicePixels:n,!n||n<=0))return 1;if(n===!0){var i=typeof window<"u"&&window.devicePixelRatio;return i||1}return n},t.getPixelSize=function(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":var n=this.getDevicePixelRatio(),i=this.canvas;return i.parentElement?[i.clientWidth*n,i.clientHeight*n]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}},t.getAspect=function(){var n=this.getPixelSize(),i=xr(n,2),o=i[0],a=i[1];return o/a},t.cssToDeviceRatio=function(){try{var n=this.getDrawingBufferSize(),i=xr(n,1),o=i[0],a=this._canvasSizeInfo.clientWidth;return a?o/a:1}catch{return 1}},t.cssToDevicePixels=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,o=this.cssToDeviceRatio(),a=this.getDrawingBufferSize(),u=xr(a,2),c=u[0],p=u[1];return $s(n,o,c,p,i)},t.setDevicePixelRatio=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.htmlCanvas){var o="width"in i?i.width:this.htmlCanvas.clientWidth,a="height"in i?i.height:this.htmlCanvas.clientHeight;(!o||!a)&&(D.log(1,"Canvas clientWidth/clientHeight is 0")(),n=1,o=this.htmlCanvas.width||1,a=this.htmlCanvas.height||1);var u=this._canvasSizeInfo;if(u.clientWidth!==o||u.clientHeight!==a||u.devicePixelRatio!==n){var c=n,p=Math.floor(o*c),b=Math.floor(a*c);this.htmlCanvas.width=p,this.htmlCanvas.height=b;var g=this.getDrawingBufferSize(),v=xr(g,2),T=v[0],S=v[1];(T!==p||S!==b)&&(c=Math.min(T/o,S/a),this.htmlCanvas.width=Math.floor(o*c),this.htmlCanvas.height=Math.floor(a*c),D.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=o,this._canvasSizeInfo.clientHeight=a,this._canvasSizeInfo.devicePixelRatio=n}}},t.getDrawingBufferSize=function(){var n=this.device.gl;if(!n)throw new Error("canvas size");return[n.drawingBufferWidth,n.drawingBufferHeight]},t._setAutoCreatedCanvasId=function(n){var i;((i=this.htmlCanvas)===null||i===void 0?void 0:i.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=n)},Hs(e,null,[{key:"isPageLoaded",get:function(){return Cr()}}]),e}();Ge.pageLoaded=Ls();function Ls(){return Cr()||typeof window>"u"?Promise.resolve():new Promise(function(e){window.addEventListener("load",function(){return e()})})}function Ks(e){if(typeof e=="string"){var t=document.getElementById(e);if(!t&&!Cr())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!t)throw new Error("".concat(e," is not an HTML element"));return t}else if(e)return e;return document.body}function Ys(e){var t=document.getElementById(e);if(!t&&!Cr())throw new Error("Accessing '".concat(e,"' before page was loaded"));if(!(t instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return t}function zs(e){var t=e.width,r=e.height,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?"".concat(t,"px"):"100%",n.style.height=Number.isFinite(r)?"".concat(r,"px"):"100%",n}function $s(e,t,r,n,i){var o=e,a=Li(o[0],t,r),u=Ki(o[1],t,n,i),c=Li(o[0]+1,t,r),p=c===r-1?c:c-1;c=Ki(o[1]+1,t,n,i);var b;return i?(c=c===0?c:c+1,b=u,u=c):b=c===n-1?c:c-1,{x:a,y:u,width:Math.max(p-a+1,1),height:Math.max(b-u+1,1)}}function Li(e,t,r){var n=Math.min(Math.round(e*t),r-1);return n}function Ki(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}function et(e){return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(e)}var qi;function $i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Zi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$i(Object(r),!0).forEach(function(n){Zs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$i(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Zs(e,t,r){return t=Ji(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qi(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ji(n.key),n)}}function qs(e,t,r){return t&&Qi(e.prototype,t),r&&Qi(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ji(e){var t=Js(e,"string");return et(t)==="symbol"?t:String(t)}function Js(e,t){if(et(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(et(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Gs(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Zn(e,t)}function Zn(e,t){return Zn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Zn(e,t)}function el(e){var t=nl();return function(){var n=Br(e),i;if(t){var o=Br(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return tl(this,i)}}function tl(e,t){if(t&&(et(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return rl(e)}function rl(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nl(){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 Br(e){return Br=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Br(e)}qi=Symbol.toStringTag;var ae=function(e){Gs(r,e);var t=el(r);function r(n,i){var o,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r.defaultProps;return Qs(this,r),o=t.call(this,n,i,a),o.dimension=void 0,o.format=void 0,o.width=void 0,o.height=void 0,o.depth=void 0,o.sampler=void 0,o.dimension=o.props.dimension,o.format=o.props.format,o.width=o.props.width,o.height=o.props.height,o.depth=o.props.depth,o}return qs(r,[{key:qi,get:function(){return"Texture"}}]),r}($);ae.defaultProps=Zi(Zi({},$.defaultProps),{},{data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,sampler:{},compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0});ae.COPY_SRC=1;ae.COPY_DST=2;ae.TEXTURE_BINDING=4;ae.STORAGE_BINDING=8;ae.RENDER_ATTACHMENT=16;function Vt(e){return Vt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vt(e)}function ol(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=il(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
10
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function il(e,t){if(e){if(typeof e=="string")return Gi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gi(e,t)}}function Gi(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ea(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ta(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ea(Object(r),!0).forEach(function(n){al(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ea(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function al(e,t,r){return t=fl(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fl(e){var t=ul(e,"string");return Vt(t)==="symbol"?t:String(t)}function ul(e,t){if(Vt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Vt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function na(e,t,r){var n="",i=t.split(/\r?\n/),o=e.slice().sort(function(v,T){return v.lineNum-T.lineNum});switch(r?.showSourceCode||"no"){case"all":for(var a=0,u=1;u<=i.length;u++)for(n+=oa(i[u-1],u,r);o.length>a&&o[a].lineNum===u;){var c=o[a++];n+=ra(c,i,c.lineNum,ta(ta({},r),{},{inlineSource:!1}))}return n;case"issues":case"no":var p=ol(e),b;try{for(p.s();!(b=p.n()).done;){var g=b.value;n+=ra(g,i,g.lineNum,{inlineSource:r?.showSourceCode!=="no"})}}catch(v){p.e(v)}finally{p.f()}return n}}function ra(e,t,r,n){if(n!=null&&n.inlineSource){var i=cl(t,r),o=e.linePos>0?"".concat(" ".repeat(e.linePos+5),`^^^
11
- `):"";return`
12
- `.concat(i).concat(o).concat(e.type.toUpperCase(),": ").concat(e.message,`
7
+ var __exports__=(()=>{var ci=Object.create;var tt=Object.defineProperty;var li=Object.getOwnPropertyDescriptor;var fi=Object.getOwnPropertyNames;var di=Object.getPrototypeOf,mi=Object.prototype.hasOwnProperty;var hi=(t,e,r)=>e in t?tt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var pi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gi=(t,e)=>{for(var r in e)tt(t,r,{get:e[r],enumerable:!0})},Mr=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fi(e))!mi.call(t,i)&&i!==r&&tt(t,i,{get:()=>e[i],enumerable:!(n=li(e,i))||n.enumerable});return t};var y=(t,e,r)=>(r=t!=null?ci(di(t)):{},Mr(e||!t||!t.__esModule?tt(r,"default",{value:t,enumerable:!0}):r,t)),Ei=t=>Mr(tt({},"__esModule",{value:!0}),t);var E=(t,e,r)=>(hi(t,typeof e!="symbol"?e+"":e,r),r);var S=pi((Fc,fn)=>{fn.exports=globalThis.luma});var Ts={};gi(Ts,{Accessor:()=>ae,WEBGLBuffer:()=>H,WEBGLCommandEncoder:()=>je,WEBGLFramebuffer:()=>J,WEBGLRenderPass:()=>$e,WEBGLRenderPipeline:()=>ze,WEBGLResource:()=>Se,WEBGLSampler:()=>ce,WEBGLShader:()=>Ke,WEBGLTexture:()=>U,WEBGLTransformFeedback:()=>qe,WEBGLVertexArray:()=>Ee,WebGLCanvasContext:()=>Xe,WebGLDevice:()=>At,WebGLResource:()=>Se,_TEXTURE_FORMATS:()=>ge,_WEBGLRenderbuffer:()=>Rt,convertGLToTextureFormat:()=>Pn,getGLParameters:()=>Me,getShaderLayout:()=>Yt,popContextState:()=>q,pushContextState:()=>te,resetGLParameters:()=>En,setDeviceParameters:()=>Xt,setGLParameters:()=>X,trackContextState:()=>lt,withDeviceParameters:()=>wn,withGLParameters:()=>K});function rt(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 v(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||rt()}var bi=globalThis.self||globalThis.window||globalThis.global,St=globalThis.window||globalThis.self||globalThis.global,_i=globalThis.document||{},xt=globalThis.process||{},Ti=globalThis.console,Wr=globalThis.navigator||{};var yt="4.0.6",Cs=v();var Qt=globalThis;function Ct(t){if(!t&&!v())return"Node";if(rt(t))return"Electron";let e=t||Wr.userAgent||"";if(e.indexOf("Edge")>-1)return"Edge";let r=e.indexOf("MSIE ")!==-1,n=e.indexOf("Trident/")!==-1;return r||n?"IE":Qt.chrome?"Chrome":Qt.safari?"Safari":Qt.mozInnerScreenX?"Firefox":"Unknown"}function Li(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var Gt=class{constructor(e,r,n="sessionStorage"){this.storage=Li(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 Hr(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function kr(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}function Pt(t,e,r,n=600){let i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));let s=t.width*r,a=t.height*r,c=["font-size:1px;",`padding:${Math.floor(a/2)}px ${Math.floor(s/2)}px;`,`line-height:${a}px;`,`background:url(${i});`,`background-size:${s}px ${a}px;`,"color:transparent;"].join("");return[`${e} %c+`,c]}var Ft;(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"})(Ft||(Ft={}));var Ai=10;function Vr(t){return typeof t!="string"?t:(t=t.toUpperCase(),Ft[t]||Ft.WHITE)}function Xr(t,e,r){return!v&&typeof t=="string"&&(e&&(t=`\x1B[${Vr(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${Vr(r)+Ai}m${t}\x1B[49m`)),t}function Kr(t,e=["constructor"]){let r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),i=t;for(let s of n){let a=i[s];typeof a=="function"&&(e.find(c=>s===c)||(i[s]=a.bind(t)))}}function xe(t,e){if(!t)throw new Error(e||"Assertion failed")}function _e(){let t;if(v()&&St.performance)t=St?.performance?.now?.();else if("hrtime"in xt){let e=xt?.hrtime?.();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var ye={debug:v()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Ri={enabled:!0,level:0};function Q(){}var $r={},Yr={once:!0},de=class{constructor({id:e}={id:""}){this.VERSION=yt,this._startTs=_e(),this._deltaTs=_e(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Gt(`__probe-${this.id}__`,Ri),this.timeStamp(`${this.id} started`),Kr(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((_e()-this._startTs).toPrecision(10))}getDelta(){return Number((_e()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!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){xe(e,r)}warn(e){return this._getLogFunction(0,e,ye.warn,arguments,Yr)}error(e){return this._getLogFunction(0,e,ye.error,arguments)}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r){return this._getLogFunction(e,r,ye.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,ye.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,ye.debug||ye.info,arguments,Yr)}table(e,r,n){return r?this._getLogFunction(e,r,console.table||Q,n&&[n],{tag:Ci(r)}):Q}image({logLevel:e,priority:r,image:n,message:i="",scale:s=1}){return this._shouldLog(e||r)?v()?yi({image:n,message:i,scale:s}):xi({image:n,message:i,scale:s}):Q}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||Q)}group(e,r,n={collapsed:!1}){let i=zr({logLevel:e,message:r,opts:n}),{collapsed:s}=n;return i.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,r,n={}){return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Q)}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()>=jr(e)}_getLogFunction(e,r,n,i,s){if(this._shouldLog(e)){s=zr({logLevel:e,message:r,args:i,opts:s}),n=n||s.method,xe(n),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=_e();let a=s.tag||s.message;if(s.once&&a)if(!$r[a])$r[a]=_e();else return Q;return r=Si(this.id,s.message,s),n.bind(console,r,...s.args)}return Q}};de.VERSION=yt;function jr(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 xe(Number.isFinite(e)&&e>=0),e}function zr(t){let{logLevel:e,message:r}=t;t.logLevel=jr(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 xe(i==="string"||i==="object"),Object.assign(t,{args:n},t.opts)}function Si(t,e,r){if(typeof e=="string"){let n=r.time?kr(Hr(r.total)):"";e=r.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=Xr(e,r.color,r.background)}return e}function xi({image:t,message:e="",scale:r=1}){return console.warn("removed"),Q}function yi({image:t,message:e="",scale:r=1}){if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=Pt(i,e,r);console.log(...s)},i.src=t,Q}let n=t.nodeName||"";if(n.toLowerCase()==="img")return console.log(...Pt(t,e,r)),Q;if(n.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Pt(i,e,r)),i.src=t.toDataURL(),Q}return Q}function Ci(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe={};var ia=new de({id:"@probe.gl/log"});var f=new de({id:"luma.gl"});function nt(){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 Te=class{constructor(e,r){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=nt(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(nt()-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 Ce=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="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(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,i=this.stats[r];return i||(e instanceof Te?i=e:i=new Te(r,n),this.stats[r]=i),i}};var qt=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Ce({id:e})),this.stats.get(e)}},Bt=new qt;function Gi(){let t="9.0.0-beta.6",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(v()&&f.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:f,stats:Bt}),t}var Qr=Gi();function Pi(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function qr(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:Pi(t)}var Zt={};function ee(t="id"){Zt[t]=Zt[t]||1;let e=Zt[t]++;return`${t}-${e}`}function Ge(t){let e=!0;for(let r in t){e=!1;break}return e}var _=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,n){if(!e)throw new Error("no device");this._device=e,this.props=Fi(r,n);let i=this.props.id!=="undefined"?this.props.id:ee(this[Symbol.toStringTag]);this.props.id=i,this.id=i,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(e),n.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};E(_,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Fi(t,e){let r={...e};for(let n in t)t[n]!==void 0&&(r[n]=t[n]);return r}var it=class extends _{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let n={...r};(r.usage||0)&it.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?n.indexType="uint32":r.data instanceof Uint16Array&&(n.indexType="uint16")),super(e,n,it.defaultProps),this.usage=r.usage||0,this.indexType=n.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,n){let i=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:n,it.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(s):r===0&&n===e.byteLength?this.debugData=i.slice(0,s):this.debugData=i.slice(r,r+s)}},P=it;E(P,"defaultProps",{..._.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),E(P,"MAP_READ",1),E(P,"MAP_WRITE",2),E(P,"COPY_SRC",4),E(P,"COPY_DST",8),E(P,"INDEX",16),E(P,"VERTEX",32),E(P,"UNIFORM",64),E(P,"STORAGE",128),E(P,"INDIRECT",256),E(P,"QUERY_RESOLVE",512),E(P,"DEBUG_DATA_MAX_LENGTH",32);function It(t){let e=Zr[t],r=Bi(e),n=t.includes("norm"),i=!n&&!t.startsWith("float"),s=t.startsWith("s");return{dataType:Zr[t],byteLength:r,integer:i,signed:s,normalized:n}}function Bi(t){return Ii[t]}var Zr={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Ii={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Ni=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Di=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function Jr(t){return Ni.some(e=>t.startsWith(e))}function Nt(t){let e=Di.exec(t);if(e){let[,r,n,i,s,a]=e;if(r){let c=`${i}${n}`,l=It(c);return{format:r,components:r.length,srgb:s==="-srgb",unsized:a==="-unsized",webgl:a==="-webgl",...l}}}return wi(t)}var vi={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function wi(t){let e=vi[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var ot=class{},st=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},Jt=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...Jt.defaultProps,...e},this.id=this.props.id||ee(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=Bt;_lumaData={};isTextureFormatCompressed(e){return Jr(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&P.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":f.warn("indices buffer content must be of integer type")()),r}},me=Jt;E(me,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(f.get("debug")),spector:Boolean(f.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>f.error(e.message)}),E(me,"VERSION",Qr);function R(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var Oi=v()&&typeof document<"u",Dt=()=>Oi&&document.readyState==="complete",Ui={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},he=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return Dt()}constructor(e){if(this.props={...Ui,...e},e=this.props,!v()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Hi(e.canvas):this.canvas=e.canvas;else{let r=ki(e),n=Wi(e?.container||null);n.insertBefore(r,n.firstChild),this.canvas=r,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let n of r)n.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let n=this.cssToDeviceRatio(),[i,s]=this.getDrawingBufferSize();return Vi(e,n,i,s,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let n="width"in r?r.width:this.htmlCanvas.clientWidth,i="height"in r?r.height:this.htmlCanvas.clientHeight;(!n||!i)&&(f.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,n=this.htmlCanvas.width||1,i=this.htmlCanvas.height||1);let s=this._canvasSizeInfo;if(s.clientWidth!==n||s.clientHeight!==i||s.devicePixelRatio!==e){let a=e,c=Math.floor(n*a),l=Math.floor(i*a);this.htmlCanvas.width=c,this.htmlCanvas.height=l;let[d,m]=this.getDrawingBufferSize();(d!==c||m!==l)&&(a=Math.min(d/n,m/i),this.htmlCanvas.width=Math.floor(n*a),this.htmlCanvas.height=Math.floor(i*a),f.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=n,this._canvasSizeInfo.clientHeight=i,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};E(he,"pageLoaded",Mi());function Mi(){return Dt()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function Wi(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!Dt())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function Hi(t){let e=document.getElementById(t);if(!e&&!Dt())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function ki(t){let{width:e,height:r}=t,n=document.createElement("canvas");return n.id="lumagl-auto-created-canvas",n.width=e||1,n.height=r||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(r)?`${r}px`:"100%",n}function Vi(t,e,r,n,i){let s=t,a=en(s[0],e,r),c=tn(s[1],e,n,i),l=en(s[0]+1,e,r),d=l===r-1?l:l-1;l=tn(s[1]+1,e,n,i);let m;return i?(l=l===0?l:l+1,m=c,c=l):m=l===n-1?l:l-1,{x:a,y:c,width:Math.max(d-a+1,1),height:Math.max(m-c+1,1)}}function en(t,e,r){return Math.min(Math.round(t*e),r-1)}function tn(t,e,r,n){return n?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var er=class extends _{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,n=er.defaultProps){super(e,r,n),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}},I=er;E(I,"defaultProps",{..._.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),E(I,"COPY_SRC",1),E(I,"COPY_DST",2),E(I,"TEXTURE_BINDING",4),E(I,"STORAGE_BINDING",8),E(I,"RENDER_ATTACHMENT",16);var tr=class extends _{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,tr.defaultProps)}},Pe=tr;E(Pe,"defaultProps",{..._.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function nn(t,e,r){let n="",i=e.split(/\r?\n/),s=t.slice().sort((a,c)=>a.lineNum-c.lineNum);switch(r?.showSourceCode||"no"){case"all":let a=0;for(let c=1;c<=i.length;c++)for(n+=on(i[c-1],c,r);s.length>a&&s[a].lineNum===c;){let l=s[a++];n+=rn(l,i,l.lineNum,{...r,inlineSource:!1})}return n;case"issues":case"no":for(let c of t)n+=rn(c,i,c.lineNum,{inlineSource:r?.showSourceCode!=="no"});return n}}function rn(t,e,r,n){if(n?.inlineSource){let i=Xi(e,r),s=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
8
+ `:"";return`
9
+ ${i}${s}${t.type.toUpperCase()}: ${t.message}
13
10
 
14
- `)}return n!=null&&n.html?`<div class='luma-compiler-log-error' style="color:red;"><b> `.concat(e.type.toUpperCase(),": ").concat(e.message,"</b></div>"):"".concat(e.type.toUpperCase(),": ").concat(e.message)}function cl(e,t,r){for(var n="",i=t-2;i<=t;i++){var o=e[i-1];o!==void 0&&(n+=oa(o,t,r))}return n}function oa(e,t,r){return"".concat(sl(String(t),4),": ").concat(e).concat(r!=null&&r.html?"<br/>":`
15
- `)}function sl(e,t){for(var r="",n=e.length;n<t;++n)r+=" ";return r+e}function Qn(e,t){return{name:ll(e,t),language:"glsl",version:pl(e)}}function ll(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,n=r.exec(e);return n?n[1]:t}function pl(e){var t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){var n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}return t}function Me(e){return Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(e)}var ua;function qn(){"use strict";qn=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&Me(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function ia(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function dl(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){ia(o,n,i,a,u,"next",c)}function u(c){ia(o,n,i,a,u,"throw",c)}a(void 0)})}}function aa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Jn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?aa(Object(r),!0).forEach(function(n){hl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):aa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hl(e,t,r){return t=ca(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fa(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ca(n.key),n)}}function _l(e,t,r){return t&&fa(e.prototype,t),r&&fa(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ca(e){var t=bl(e,"string");return Me(t)==="symbol"?t:String(t)}function bl(e,t){if(Me(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gn(e,t)}function Gn(e,t){return Gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Gn(e,t)}function vl(e){var t=Sl();return function(){var n=Fr(e),i;if(t){var o=Fr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ml(this,i)}}function ml(e,t){if(t&&(Me(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tl(e)}function Tl(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sl(){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 Fr(e){return Fr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Fr(e)}ua=Symbol.toStringTag;var Dr=function(e){gl(r,e);var t=vl(r);function r(i,o){var a;return yl(this,r),a=t.call(this,i,Jn({id:Al(o)},o),r.defaultProps),a.stage=void 0,a.source=void 0,a.compilationStatus="pending",a.stage=a.props.stage,a.source=a.props.source,a}var n=r.prototype;return n.getCompilationInfoSync=function(){return null},n.debugShader=function(){var i=dl(qn().mark(function a(){var u;return qn().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:p.t0=this.props.debug,p.next=p.t0==="never"?3:p.t0==="errors"?4:p.t0==="warnings"||p.t0==="always"?7:8;break;case 3:return p.abrupt("return");case 4:if(this.compilationStatus!=="success"){p.next=6;break}return p.abrupt("return");case 6:return p.abrupt("break",8);case 7:return p.abrupt("break",8);case 8:return p.next=10,this.getCompilationInfo();case 10:if(u=p.sent,!(this.props.debug==="warnings"&&u?.length===0)){p.next=13;break}return p.abrupt("return");case 13:this._displayShaderLog(u);case 14:case"end":return p.stop()}},a,this)}));function o(){return i.apply(this,arguments)}return o}(),n._displayShaderLog=function(o){var a,u,c=this;if(!(typeof document>"u"||!((a=document)!==null&&a!==void 0&&a.createElement))){var p=Qn(this.source).name,b="".concat(this.stage," ").concat(p),g=na(o,this.source,{showSourceCode:"all",html:!0}),v=document.createElement("Button");v.innerHTML=`
16
- <h1>Shader Compilation Error in `.concat(b,`</h1><br /><br />
11
+ `}return n?.html?`<div class='luma-compiler-log-error' style="color:red;"><b> ${t.type.toUpperCase()}: ${t.message}</b></div>`:`${t.type.toUpperCase()}: ${t.message}`}function Xi(t,e,r){let n="";for(let i=e-2;i<=e;i++){let s=t[i-1];s!==void 0&&(n+=on(s,e,r))}return n}function on(t,e,r){let n=r?.html?$i(t):t;return`${Ki(String(e),4)}: ${n}${r?.html?"<br/>":`
12
+ `}`}function Ki(t,e){let r="";for(let n=t.length;n<e;++n)r+=" ";return r+t}function $i(t){return t.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#039;")}function rr(t,e){return{name:Yi(t,e),language:"glsl",version:zi(t)}}function Yi(t,e="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return n?n[1]:e}function zi(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)}return e}var nr=class extends _{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,r){super(e,{id:ji(r),...r},nr.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(e=this.props.debug){switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let r=await this.getCompilationInfo();this.props.debug==="warnings"&&r?.length===0||this._displayShaderLog(r)}_displayShaderLog(e){if(typeof document>"u"||!document?.createElement)return;let r=rr(this.source).name,n=`${this.stage} ${r}`,i=nn(e,this.source,{showSourceCode:"all",html:!0}),s=this.getTranslatedSource();s&&(i+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${s}</pre></code>`);let a=document.createElement("Button");a.innerHTML=`
13
+ <h1>Shader Compilation Error in ${n}</h1><br /><br />
17
14
  <code style="user-select:text;"><pre>
18
- `).concat(g,`
19
- </pre></code>`),v.style.top="10px",v.style.left="10px",v.style.position="absolute",v.style.zIndex="9999",v.style.width="100%",v.style.textAlign="left",document.body.appendChild(v);var T=document.getElementsByClassName("luma-compiler-log-error");(u=T[0])!==null&&u!==void 0&&u.scrollIntoView&&T[0].scrollIntoView(),v.onclick=function(){var S="data:text/plain,".concat(encodeURIComponent(c.source));navigator.clipboard.writeText(S)}}},_l(r,[{key:ua,get:function(){return"Shader"}}]),r}($);Dr.defaultProps=Jn(Jn({},$.defaultProps),{},{language:"auto",stage:"vertex",source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Al(e){return Qn(e.source).name||e.id||Te("unnamed ".concat(e.stage,"-shader"))}function tt(e){return tt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(e)}var da;function sa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function la(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sa(Object(r),!0).forEach(function(n){Rl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rl(e,t,r){return t=ha(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ol(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pa(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ha(n.key),n)}}function El(e,t,r){return t&&pa(e.prototype,t),r&&pa(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ha(e){var t=wl(e,"string");return tt(t)==="symbol"?t:String(t)}function wl(e,t){if(tt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(tt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&eo(e,t)}function eo(e,t){return eo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},eo(e,t)}function Il(e){var t=Cl();return function(){var n=Mr(e),i;if(t){var o=Mr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Nl(this,i)}}function Nl(e,t){if(t&&(tt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xl(e)}function xl(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cl(){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 Mr(e){return Mr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Mr(e)}da=Symbol.toStringTag;var Ur=function(e){Pl(r,e);var t=Il(r);function r(n,i){return Ol(this,r),t.call(this,n,i,r.defaultProps)}return El(r,[{key:da,get:function(){return"Sampler"}}]),r}($);Ur.defaultProps=la(la({},$.defaultProps),{},{type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});function nt(e){return nt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nt(e)}var ga;function ya(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ya(Object(r),!0).forEach(function(n){Bl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ya(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Bl(e,t,r){return t=va(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fl(e,t){return jl(e)||Ul(e,t)||Ml(e,t)||Dl()}function Dl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
20
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ml(e,t){if(e){if(typeof e=="string")return _a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _a(e,t)}}function _a(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ul(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function jl(e){if(Array.isArray(e))return e}function Wl(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ba(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,va(n.key),n)}}function Hl(e,t,r){return t&&ba(e.prototype,t),r&&ba(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function va(e){var t=Xl(e,"string");return nt(t)==="symbol"?t:String(t)}function Xl(e,t){if(nt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(nt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vl(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&to(e,t)}function to(e,t){return to=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},to(e,t)}function kl(e){var t=Yl();return function(){var n=jr(e),i;if(t){var o=jr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ll(this,i)}}function Ll(e,t){if(t&&(nt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Kl(e)}function Kl(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Yl(){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 jr(e){return jr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},jr(e)}ga=Symbol.toStringTag;var ot=function(e){Vl(r,e);var t=kl(r);function r(i){var o,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Wl(this,r),o=t.call(this,i,a,r.defaultProps),o.width=void 0,o.height=void 0,o.colorAttachments=[],o.depthStencilAttachment=null,o.width=o.props.width,o.height=o.props.height,o}var n=r.prototype;return n.resize=function(o){var a=!o;if(o){var u=Array.isArray(o)?o:[o.width,o.height],c=Fl(u,2),p=c[0],b=c[1];a=a||b!==this.height||p!==this.width,this.width=p,this.height=b}a&&(D.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(this.width,"x").concat(this.height))(),this.resizeAttachments(this.width,this.height))},n.autoCreateAttachmentTextures=function(){var o=this;if(this.colorAttachments=this.props.colorAttachments.map(function(u){if(typeof u=="string"){var c=o.createColorTexture(u);return o.attachResource(c),c}return u}),this.props.depthStencilAttachment)if(typeof this.props.depthStencilAttachment=="string"){var a=this.createDepthStencilTexture(this.props.depthStencilAttachment);this.attachResource(a),this.depthStencilAttachment=a}else this.depthStencilAttachment=this.props.depthStencilAttachment},n.createColorTexture=function(o){return this.device.createTexture({id:"color-attachment",usage:ae.RENDER_ATTACHMENT,format:o,width:this.width,height:this.height})},n.createDepthStencilTexture=function(o){return this.device.createTexture({id:"depth-stencil-attachment",usage:ae.RENDER_ATTACHMENT,format:o,width:this.width,height:this.height})},n.resizeAttachments=function(o,a){for(var u=0;u<this.colorAttachments.length;++u)if(this.colorAttachments[u]){var c=this.device._createTexture(rt(rt({},this.colorAttachments[u].props),{},{width:o,height:a}));this.destroyAttachedResource(this.colorAttachments[u]),this.colorAttachments[u]=c,this.attachResource(c)}if(this.depthStencilAttachment){var p=this.device._createTexture(rt(rt({},this.depthStencilAttachment.props),{},{width:o,height:a}));this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=p,this.attachResource(p)}},Hl(r,[{key:ga,get:function(){return"Framebuffer"}}]),r}($);ot.defaultProps=rt(rt({},$.defaultProps),{},{width:1,height:1,colorAttachments:[],depthStencilAttachment:null});function it(e){return it=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(e)}var Aa;function ma(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ta(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ma(Object(r),!0).forEach(function(n){zl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ma(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zl(e,t,r){return t=Ra(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sa(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ra(n.key),n)}}function Zl(e,t,r){return t&&Sa(e.prototype,t),r&&Sa(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ra(e){var t=Ql(e,"string");return it(t)==="symbol"?t:String(t)}function Ql(e,t){if(it(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(it(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ql(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ro(e,t)}function ro(e,t){return ro=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ro(e,t)}function Jl(e){var t=tp();return function(){var n=Wr(e),i;if(t){var o=Wr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Gl(this,i)}}function Gl(e,t){if(t&&(it(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ep(e)}function ep(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tp(){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 Wr(e){return Wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wr(e)}Aa=Symbol.toStringTag;var Hr=function(e){ql(r,e);var t=Jl(r);function r(n,i){var o;return $l(this,r),o=t.call(this,n,i,r.defaultProps),o.hash="",o.vs=void 0,o.fs=void 0,o.shaderLayout=void 0,o.bufferLayout=void 0,o.shaderLayout=o.props.shaderLayout,o.bufferLayout=o.props.bufferLayout||[],o}return Zl(r,[{key:Aa,get:function(){return"RenderPipeline"}}]),r}($);Hr.defaultProps=Ta(Ta({},$.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function at(e){return at=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},at(e)}var Pa;function Oa(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ea(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Oa(Object(r),!0).forEach(function(n){rp(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oa(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rp(e,t,r){return t=Ia(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wa(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ia(n.key),n)}}function op(e,t,r){return t&&wa(e.prototype,t),r&&wa(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ia(e){var t=ip(e,"string");return at(t)==="symbol"?t:String(t)}function ip(e,t){if(at(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(at(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ap(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&no(e,t)}function no(e,t){return no=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},no(e,t)}function fp(e){var t=sp();return function(){var n=Xr(e),i;if(t){var o=Xr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return up(this,i)}}function up(e,t){if(t&&(at(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cp(e)}function cp(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sp(){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 Xr(e){return Xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xr(e)}Pa=Symbol.toStringTag;var Vr=function(e){ap(r,e);var t=fp(r);function r(n,i){return np(this,r),t.call(this,n,i,r.defaultProps)}return op(r,[{key:Pa,get:function(){return"RenderPass"}}]),r}($);Vr.defaultProps=Ea(Ea({},$.defaultProps),{},{framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1});function ft(e){return ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(e)}var Ba;function Na(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Na(Object(r),!0).forEach(function(n){lp(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Na(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lp(e,t,r){return t=Fa(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ca(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Fa(n.key),n)}}function dp(e,t,r){return t&&Ca(e.prototype,t),r&&Ca(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Fa(e){var t=hp(e,"string");return ft(t)==="symbol"?t:String(t)}function hp(e,t){if(ft(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ft(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oo(e,t)}function oo(e,t){return oo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},oo(e,t)}function _p(e){var t=vp();return function(){var n=kr(e),i;if(t){var o=kr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return bp(this,i)}}function bp(e,t){if(t&&(ft(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gp(e)}function gp(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vp(){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 kr(e){return kr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},kr(e)}Ba=Symbol.toStringTag;var Lr=function(e){yp(r,e);var t=_p(r);function r(i,o){return pp(this,r),t.call(this,i,o,r.defaultProps)}var n=r.prototype;return n.pushDebugGroup=function(o){},n.popDebugGroup=function(){},n.insertDebugMarker=function(o){},dp(r,[{key:Ba,get:function(){return"CommandEncoder"}}]),r}($);Lr.defaultProps=xa(xa({},$.defaultProps),{},{measureExecutionTime:void 0});function ut(e){return ut=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ut(e)}var Ua;function Da(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function mp(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Da(Object(r),!0).forEach(function(n){Tp(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Da(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tp(e,t,r){return t=ja(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ma(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ja(n.key),n)}}function Ap(e,t,r){return t&&Ma(e.prototype,t),r&&Ma(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ja(e){var t=Rp(e,"string");return ut(t)==="symbol"?t:String(t)}function Rp(e,t){if(ut(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(ut(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Op(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&io(e,t)}function io(e,t){return io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},io(e,t)}function Ep(e){var t=Ip();return function(){var n=Kr(e),i;if(t){var o=Kr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return wp(this,i)}}function wp(e,t){if(t&&(ut(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pp(e)}function Pp(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ip(){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 Kr(e){return Kr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kr(e)}Ua=Symbol.toStringTag;var Yr=function(e){Op(r,e);var t=Ep(r);function r(n,i){return Sp(this,r),t.call(this,n,i,r.defaultProps)}return Ap(r,[{key:Ua,get:function(){return"CommandBuffer"}}]),r}($);Yr.defaultProps=mp({},$.defaultProps);function Np(e,t){return Fp(e)||Bp(e,t)||Cp(e,t)||xp()}function xp(){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 Cp(e,t){if(e){if(typeof e=="string")return Wa(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wa(e,t)}}function Wa(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Bp(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Fp(e){if(Array.isArray(e))return e}function Ha(e){var t=Np(Mp[e],2),r=t[0],n=t[1],i=r==="i32"||r==="u32",o=r!=="u32",a=Up[r]*n,u=Dp(r,n);return{dataType:r,components:n,defaultVertexFormat:u,byteLength:a,integer:i,signed:o}}function Dp(e,t){var r;switch(e){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return t===1?r:"".concat(r,"x").concat(t)}var Mp={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},Up={f32:4,f16:2,i32:4,u32:4};function zr(e){var t=Xa[e],r=jp(t),n=e.includes("norm"),i=!n&&!e.startsWith("float"),o=e.startsWith("s");return{dataType:Xa[e],byteLength:r,integer:i,signed:o,normalized:n}}function jp(e){var t=Wp[e];return t}var Xa={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Wp={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Hp(e,t){return Lp(e)||kp(e,t)||Vp(e,t)||Xp()}function Xp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
22
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vp(e,t){if(e){if(typeof e=="string")return Va(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Va(e,t)}}function Va(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function kp(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Lp(e){if(Array.isArray(e))return e}function ao(e){var t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);var r=e.split("x"),n=Hp(r,2),i=n[0],o=n[1],a=i,u=o?parseInt(o):1,c=zr(a),p={type:a,components:u,byteLength:c.byteLength*u,integer:c.integer,signed:c.signed,normalized:c.normalized};return t&&(p.webglOnly=!0),p}function kt(e){return kt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(e)}function ka(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ka(Object(r),!0).forEach(function(n){Kp(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ka(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kp(e,t,r){return t=Yp(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yp(e){var t=zp(e,"string");return kt(t)==="symbol"?t:String(t)}function zp(e,t){if(kt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(kt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ct(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=$p(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},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,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function $p(e,t){if(e){if(typeof e=="string")return La(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return La(e,t)}}function La(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ka(e,t){var r={},n=ct(e.attributes),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;r[o.name]=Zp(e,t,o.name)}}catch(a){n.e(a)}finally{n.f()}return r}function Ya(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16,n=Ka(e,t),i=new Array(r).fill(null),o=0,a=Object.values(n);o<a.length;o++){var u=a[o];i[u.location]=u}return i}function Zp(e,t,r){var n=Qp(e,r),i=qp(t,r);if(!n)return null;var o=Ha(n.type),a=i?.vertexFormat||o.defaultVertexFormat,u=ao(a);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:a,bufferDataType:u.type,bufferComponents:u.components,normalized:u.normalized,integer:o.integer,stepMode:i?.stepMode||n.stepMode,byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function Qp(e,t){var r=e.attributes.find(function(n){return n.name===t});return r||D.warn('shader layout attribute "'.concat(t,'" not present in shader')),r||null}function qp(e,t){Jp(e);var r=Gp(e,t);return r||(r=ed(e,t),r)?r:(D.warn('layout for attribute "'.concat(t,'" not present in buffer layout')),null)}function Jp(e){var t=ct(e),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&D.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(i){t.e(i)}finally{t.f()}}function Gp(e,t){var r=ct(e),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.format&&i.name===t)return{attributeName:i.name,bufferName:t,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0}}}catch(o){r.e(o)}finally{r.f()}return null}function ed(e,t){var r=ct(e),n;try{for(r.s();!(n=r.n()).done;){var i,o=n.value,a=o.byteStride;if(typeof o.byteStride!="number"){var u=ct(o.attributes||[]),c;try{for(u.s();!(c=u.n()).done;){var p=c.value,b=ao(p.format);a+=b.byteLength}}catch(v){u.e(v)}finally{u.f()}}var g=(i=o.attributes)===null||i===void 0?void 0:i.find(function(v){return v.attribute===t});if(g)return{attributeName:g.attribute,bufferName:o.name,stepMode:o.stepMode,vertexFormat:g.format,byteOffset:g.byteOffset,byteStride:a}}}catch(v){r.e(v)}finally{r.f()}return null}function uo(e,t){var r=fo(fo({},e),{},{attributes:e.attributes.map(function(a){return fo({},a)})}),n=ct(t?.attributes||[]),i;try{var o=function(){var u=i.value,c=r.attributes.find(function(p){return p.name===u.name});c?(c.type=u.type||c.type,c.stepMode=u.stepMode||c.stepMode):D.warn("shader layout attribute ".concat(u.name," not present in shader"))};for(n.s();!(i=n.n()).done;)o()}catch(a){n.e(a)}finally{n.f()}return r}function st(e){return st=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},st(e)}var Qa;function za(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function $a(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?za(Object(r),!0).forEach(function(n){td(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):za(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function td(e,t,r){return t=qa(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Za(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,qa(n.key),n)}}function nd(e,t,r){return t&&Za(e.prototype,t),r&&Za(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qa(e){var t=od(e,"string");return st(t)==="symbol"?t:String(t)}function od(e,t){if(st(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(st(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function id(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&co(e,t)}function co(e,t){return co=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},co(e,t)}function ad(e){var t=cd();return function(){var n=$r(e),i;if(t){var o=$r(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return fd(this,i)}}function fd(e,t){if(t&&(st(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ud(e)}function ud(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cd(){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 $r(e){return $r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$r(e)}Qa=Symbol.toStringTag;var Zr=function(e){id(r,e);var t=ad(r);function r(n,i){var o;return rd(this,r),o=t.call(this,n,i,r.defaultProps),o.maxVertexAttributes=void 0,o.attributeInfos=void 0,o.indexBuffer=null,o.attributes=void 0,o.maxVertexAttributes=n.limits.maxVertexAttributes,o.attributes=new Array(o.maxVertexAttributes).fill(null),o.attributeInfos=Ya(i.renderPipeline.shaderLayout,i.renderPipeline.bufferLayout,o.maxVertexAttributes),o}return nd(r,[{key:Qa,get:function(){return"VertexArray"}}]),r}($);Zr.defaultProps=$a($a({},$.defaultProps),{},{renderPipeline:null});function lt(e){return lt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lt(e)}var tf;function Ja(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ga(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ja(Object(r),!0).forEach(function(n){sd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ja(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sd(e,t,r){return t=rf(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ld(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ef(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,rf(n.key),n)}}function pd(e,t,r){return t&&ef(e.prototype,t),r&&ef(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function rf(e){var t=dd(e,"string");return lt(t)==="symbol"?t:String(t)}function dd(e,t){if(lt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(lt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&so(e,t)}function so(e,t){return so=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},so(e,t)}function yd(e){var t=gd();return function(){var n=Qr(e),i;if(t){var o=Qr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return _d(this,i)}}function _d(e,t){if(t&&(lt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bd(e)}function bd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gd(){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 Qr(e){return Qr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Qr(e)}tf=Symbol.toStringTag;var qr=function(e){hd(r,e);var t=yd(r);function r(n,i){return ld(this,r),t.call(this,n,i,r.defaultProps)}return pd(r,[{key:tf,get:function(){return"TransformFeedback"}}]),r}($);qr.defaultProps=Ga(Ga({},$.defaultProps),{},{layout:void 0,buffers:{}});var Jr;function nf(e){return(!Jr||Jr.byteLength<e)&&(Jr=new ArrayBuffer(e)),Jr}function lo(e,t){var r=nf(e.BYTES_PER_ELEMENT*t);return new e(r,0,t)}function po(e){for(var t=e.target,r=e.source,n=e.start,i=n===void 0?0:n,o=e.count,a=o===void 0?1:o,u=r.length,c=a*u,p=0,b=i;p<u;p++)t[b++]=r[p];for(;p<c;)p<c-p?(t.copyWithin(i+p,i,i+p),p*=2):(t.copyWithin(i+p,i,i+c-p),p=c);return e.target}function Lt(e){return Lt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lt(e)}function of(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?of(Object(r),!0).forEach(function(n){md(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):of(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function md(e,t,r){return t=Td(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Td(e){var t=Sd(e,"string");return Lt(t)==="symbol"?t:String(t)}function Sd(e,t){if(Lt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Lt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ad(e,t){return wd(e)||Ed(e,t)||Od(e,t)||Rd()}function Rd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
24
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Od(e,t){if(e){if(typeof e=="string")return af(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return af(e,t)}}function af(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ed(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function wd(e){if(Array.isArray(e))return e}var Pd=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function Gr(e){var t=Pd.exec(e);if(t){var r=Ad(t,6),n=r[1],i=r[2],o=r[3],a=r[4],u=r[5];if(n){var c="".concat(o).concat(i),p=zr(c);return vd({format:n,components:n.length,srgb:a==="-srgb",unsized:u==="-unsized",webgl:u==="-webgl"},p)}}return Nd(e)}var Id={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2unorm-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Nd(e){var t,r=Id[e];if(!r)throw new Error("Unknown format ".concat(e));return{format:r.format||"",components:r.components||((t=r.format)===null||t===void 0?void 0:t.length)||1,byteLength:r.bpp||1,srgb:!1,unsized:!1}}function ff(e){return Pi(e)!==null||typeof e=="number"||typeof e=="boolean"}function ho(e){var t={bindings:{},uniforms:{}};return Object.keys(e).forEach(function(r){var n=e[r];ff(n)?t.uniforms[r]=n:t.bindings[r]=n}),t}function yo(e,t,r,n){var i="See luma.gl ".concat(r," Upgrade Guide at https://luma.gl/docs/upgrade-guide"),o=Object.getPrototypeOf(e);n.forEach(function(a){o.methodName||(o[a]=function(){throw D.removed("Calling removed method ".concat(t,".").concat(a,": "),i)(),new Error(a)})})}function xd(e,t){return Dd(e)||Fd(e,t)||Bd(e,t)||Cd()}function Cd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
25
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bd(e,t){if(e){if(typeof e=="string")return uf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uf(e,t)}}function uf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Fd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Dd(e){if(Array.isArray(e))return e}function _o(e,t,r){var n=r.removedProps,i=n===void 0?{}:n,o=r.deprecatedProps,a=o===void 0?{}:o,u=r.replacedProps,c=u===void 0?{}:u;for(var p in i)if(p in t){var b=i[p],g=b?"".concat(e,".").concat(i[p]):"N/A";D.removed("".concat(e,".").concat(p),g)()}for(var v in a)if(v in t){var T=a[v];D.deprecated("".concat(e,".").concat(v),"".concat(e,".").concat(T))()}for(var S=null,E=0,P=Object.entries(c);E<P.length;E++){var O=xd(P[E],2),w=O[0],x=O[1];w in t&&(D.deprecated("".concat(e,".").concat(w),"".concat(e,".").concat(x))(),S=S||Object.assign({},t),S[x]=t[w],delete S[w])}return S||t}function bo(e){return bo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bo(e)}function Kt(){"use strict";Kt=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&bo(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function cf(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function sf(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){cf(o,n,i,a,u,"next",c)}function u(c){cf(o,n,i,a,u,"throw",c)}a(void 0)})}}var Md="";function mo(e,t){return go.apply(this,arguments)}function go(){return go=sf(Kt().mark(function e(t,r){return Kt().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",new Promise(function(o,a){try{var u=new Image;u.onload=function(){return o(u)},u.onerror=function(){return a(new Error("Could not load image ".concat(t,".")))},u.crossOrigin=r?.crossOrigin||"anonymous",u.src=t.startsWith("http")?t:Md+t}catch(c){a(c)}}));case 1:case"end":return i.stop()}},e)})),go.apply(this,arguments)}function Yt(e,t){return vo.apply(this,arguments)}function vo(){return vo=sf(Kt().mark(function e(t,r){var n,i;return Kt().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(n=document.getElementsByTagName("head")[0],n){a.next=3;break}throw new Error("loadScript");case 3:return i=document.createElement("script"),i.setAttribute("type","text/javascript"),i.setAttribute("src",t),r&&(i.id=r),a.abrupt("return",new Promise(function(u,c){i.onload=u,i.onerror=function(p){return c(new Error("Unable to load script '".concat(t,"': ").concat(p)))},n.appendChild(i)}));case 8:case"end":return a.stop()}},e)})),vo.apply(this,arguments)}var zt={};function Ud(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function jd(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function Wd(e,t){zt[e]=!0,t!==void 0&&Ud(t)}function Hd(e){var t=e.getError;e.getError=function(){var n;do n=t.apply(e),n!==0&&(zt[n]=!0);while(n!==0);for(n in zt)if(zt[n])return delete zt[n],parseInt(n,10);return 0}}var $t=function e(t){var r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(var n=0;n<this.attribs.length;n++){var i=new e.VertexAttrib(r);this.attribs[n]=i}this.maxAttrib=0};$t.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};$t.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var Ue=function(t){var r=this;this.gl=t,Hd(t);var n=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(o){return o===r.VERTEX_ARRAY_BINDING_OES?r.currentVertexArrayObject===r.defaultVertexArrayObject?null:r.currentVertexArrayObject:n.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(o){var a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);var u=a.attribs[o];return u.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(o){var a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);var u=a.attribs[o];return u.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(o,a){switch(o){case 34962:r.currentArrayBuffer=a;break;case 34963:r.currentVertexArrayObject.elementArrayBuffer=a;break;default:}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(o,a){var u=r.currentVertexArrayObject,c=u.attribs[o];switch(a){case 34975:return c.buffer;case 34338:return c.enabled;case 34339:return c.size;case 34340:return c.stride;case 34341:return c.type;case 34922:return c.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(o,a,u,c,p,b){var g=r.currentVertexArrayObject;g.maxAttrib=Math.max(g.maxAttrib,o);var v=g.attribs[o];return v.buffer=r.currentArrayBuffer,v.size=a,v.type=u,v.normalized=c,v.stride=p,v.offset=b,v.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",function(){jd("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};Ue.prototype.VERTEX_ARRAY_BINDING_OES=34229;Ue.prototype.reset_=function(){var t=this.vertexArrayObjects!==void 0;if(t)for(var r=0;r<this.vertexArrayObjects.length;++r)this.vertexArrayObjects.isAlive=!1;var n=this.gl;this.maxVertexAttribs=n.getParameter(34921),this.defaultVertexArrayObject=new $t(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};Ue.prototype.createVertexArrayOES=function(){var t=new $t(this);return this.vertexArrayObjects.push(t),t};Ue.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};Ue.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof $t&&t.hasBeenBound&&t.ext===this)};Ue.prototype.bindVertexArrayOES=function(t){var r=this.gl;if(t&&!t.isAlive){Wd(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}var n=this.original,i=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;var o=this.currentVertexArrayObject;if(i!==o){(!i||o.elementArrayBuffer!==i.elementArrayBuffer)&&n.bindBuffer.call(r,34963,o.elementArrayBuffer);for(var a=this.currentArrayBuffer,u=Math.max(i?i.maxAttrib:0,o.maxAttrib),c=0;c<=u;c++){var p=o.attribs[c],b=i?i.attribs[c]:null;if((!i||p.enabled!==b.enabled)&&(p.enabled?n.enableVertexAttribArray.call(r,c):n.disableVertexAttribArray.call(r,c)),p.enabled){var g=!1;(!i||p.buffer!==b.buffer)&&(a!==p.buffer&&(n.bindBuffer.call(r,34962,p.buffer),a=p.buffer),g=!0),(g||p.cached!==b.cached)&&n.vertexAttribPointer.call(r,c,p.size,p.type,p.normalized,p.stride,p.offset)}}this.currentArrayBuffer!==a&&n.bindBuffer.call(r,34962,this.currentArrayBuffer)}};function lf(e){if(typeof e.createVertexArray!="function"){var t=e.getSupportedExtensions;e.getSupportedExtensions=function(){var i=t.call(this)||[];return i.indexOf("OES_vertex_array_object")<0&&i.push("OES_vertex_array_object"),i};var r=e.getExtension;e.getExtension=function(i){var o=r.call(this,i);return o||(i!=="OES_vertex_array_object"?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new Ue(this)),this.__OESVertexArrayObject))}}}var Xd="Invalid WebGLRenderingContext";var Vd="Requires WebGL2";function To(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function K(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Zt(e){return K(e)?e:null}function en(e){return H(To(e),Xd),e}function pf(e){return H(K(e),Vd),e}var z;function Qt(e){return Qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qt(e)}function Z(e,t,r){return t=kd(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kd(e){var t=Ld(e,"string");return Qt(t)==="symbol"?t:String(t)}function Ld(e,t){if(Qt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Qt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var df="OES_element_index",hf="WEBGL_draw_buffers",Kd="EXT_disjoint_timer_query",Yd="EXT_disjoint_timer_query_webgl2",zd="EXT_texture_filter_anisotropic",yf="WEBGL_debug_renderer_info",$d=35723,Zd=4352,Qd=36795,qd=34047,Jd=37445,Gd=37446,J=function(t){return K(t)?void 0:0},eh=(z={},Z(z,3074,function(e){return K(e)?void 0:36064}),Z(z,$d,function(e){return K(e)?void 0:Zd}),Z(z,35977,J),Z(z,32937,J),Z(z,Qd,function(e,t){var r=K(e)?e.getExtension(Yd):e.getExtension(Kd);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0}),Z(z,Jd,function(e,t){var r=e.getExtension(yf);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)}),Z(z,Gd,function(e,t){var r=e.getExtension(yf);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)}),Z(z,qd,function(e,t){var r,n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[zd])||e.getExtension("EXT_texture_filter_anisotropic");return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1}),Z(z,32883,J),Z(z,35071,J),Z(z,37447,J),Z(z,36063,function(e,t){if(!K(e)){var r=e.getExtension(hf);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}}),Z(z,35379,J),Z(z,35374,J),Z(z,35377,J),Z(z,34852,function(e){if(!K(e)){var t=e.getExtension(hf);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}}),Z(z,36203,function(e){return e.getExtension(df)?2147483647:65535}),Z(z,33001,function(e){return e.getExtension(df)?16777216:65535}),Z(z,33e3,function(e){return 16777216}),Z(z,37157,J),Z(z,35373,J),Z(z,35657,J),Z(z,36183,J),Z(z,37137,J),Z(z,34045,J),Z(z,35978,J),Z(z,35979,J),Z(z,35968,J),Z(z,35376,J),Z(z,35375,J),Z(z,35659,J),Z(z,37154,J),Z(z,35371,J),Z(z,35658,J),Z(z,35076,J),Z(z,35077,J),Z(z,35380,J),z);function _f(e,t,r){var n=eh[r],i=typeof n=="function"?n(e,t,r):n,o=i!==void 0?i:t(r);return o}function pt(e){var t=e.luma;if(!t){var r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var dt;function qt(e){return qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qt(e)}function tn(e,t,r){return t=th(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function th(e){var t=rh(e,"string");return qt(t)==="symbol"?t:String(t)}function rh(e,t){if(qt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(qt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var nh="OES_vertex_array_object",bf="ANGLE_instanced_arrays",oh="WEBGL_draw_buffers",ih="EXT_disjoint_timer_query",ah="EXT_texture_filter_anisotropic",fh="VertexArray requires WebGL2 or OES_vertex_array_object extension";function uh(e,t){return{webgl2:K(e),ext:e.getExtension(t)}}var So=(dt={},tn(dt,nh,{meta:{suffix:"OES"},createVertexArray:function(){H(!1,fh)},deleteVertexArray:function(){},bindVertexArray:function(){},isVertexArray:function(){return!1}}),tn(dt,bf,{meta:{suffix:"ANGLE"},vertexAttribDivisor:function(t,r){H(r===0,"WebGL instanced rendering not supported")},drawElementsInstanced:function(){},drawArraysInstanced:function(){}}),tn(dt,oh,{meta:{suffix:"WEBGL"},drawBuffers:function(){H(!1)}}),tn(dt,ih,{meta:{suffix:"EXT"},createQuery:function(){H(!1)},deleteQuery:function(){H(!1)},beginQuery:function(){H(!1)},endQuery:function(){},getQuery:function(t,r){return this.getQueryObject(t,r)},getQueryParameter:function(t,r){return this.getQueryObject(t,r)},getQueryObject:function(t,r){}}),dt),rn={readBuffer:function(t,r,n){K(t)&&r(n)},getVertexAttrib:function(t,r,n,i){var o=uh(t,bf),a=o.webgl2,u=o.ext,c;switch(i){case 35069:c=a?void 0:!1;break;case 35070:c=!a&&!u?0:void 0;break;default:}return c!==void 0?c:r(n,i)},getProgramParameter:function(t,r,n,i){if(!K(t))switch(i){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return r(n,i)},getInternalformatParameter:function(t,r,n,i,o){if(!K(t))switch(o){case 32937:return new Int32Array([0]);default:}var a=t;return a.getInternalformatParameter(n,i,o)},getTexParameter:function(t,r,n,i){switch(i){case 34046:var o=pt(t),a=o._extensions,u=a[ah];i=u&&u.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return r(n,i)},getParameter:_f,hint:function(t,r,n,i){return r(n,i)}};function vf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ch(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
26
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function ch(e,t){if(e){if(typeof e=="string")return gf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gf(e,t)}}function gf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function nn(e){var t=pt(e);return t._polyfilled||(lf(e),sh(e),lh(e,So),dh(e,{target:t,target2:e}),t._polyfilled=!0),e}function sh(e){var t=pt(e),r=e.getSupportedExtensions()||[],n=["WEBGL_polygon_mode"],i=vf(r),o;try{for(i.s();!(o=i.n()).done;){var a=o.value;if(!n.includes(a)){var u=e.getExtension(a);t._extensions[a]=u}}}catch(c){i.e(c)}finally{i.f()}}function lh(e,t){var r=pt(e),n=vf(Object.getOwnPropertyNames(t)),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;o!=="overrides"&&ph(e,{extension:o,target:r,target2:e})}}catch(a){n.e(a)}finally{n.f()}}function ph(e,t){var r=t.extension,n=t.target,i=t.target2,o=So[r];H(o);for(var a=o.meta,u=a===void 0?{}:a,c=u.suffix,p=c===void 0?"":c,b=e.getExtension(r),g=function(){var E=T[v],P="".concat(E).concat(p),O=null;E==="meta"||typeof e[E]=="function"||(b&&typeof b[P]=="function"?O=function(){return b[P].apply(b,arguments)}:typeof o[E]=="function"&&(O=o[E].bind(n))),O&&(n[E]=O,i[E]=O)},v=0,T=Object.keys(o);v<T.length;v++)g()}function dh(e,t){var r=t.target,n=t.target2;Object.keys(rn).forEach(function(i){if(typeof rn[i]=="function"){var o=e[i]?e[i].bind(e):function(){},a=rn[i].bind(null,e,o);r[i]=a,n[i]=a}})}var B,I,_e;function Gt(e){return Gt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(e)}function Ao(e,t){return _h(e)||yh(e,t)||Sf(e,t)||hh()}function hh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
27
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yh(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function _h(e){if(Array.isArray(e))return e}function re(e){return vh(e)||gh(e)||Sf(e)||bh()}function bh(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
28
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sf(e,t){if(e){if(typeof e=="string")return Oo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Oo(e,t)}}function gh(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vh(e){if(Array.isArray(e))return Oo(e)}function Oo(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _(e,t,r){return t=mh(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mh(e){var t=Th(e,"string");return Gt(t)==="symbol"?t:String(t)}function Th(e,t){if(Gt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Gt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var er=(B={},_(B,3042,!1),_(B,32773,new Float32Array([0,0,0,0])),_(B,32777,32774),_(B,34877,32774),_(B,32969,1),_(B,32968,0),_(B,32971,1),_(B,32970,0),_(B,3106,new Float32Array([0,0,0,0])),_(B,3107,[!0,!0,!0,!0]),_(B,2884,!1),_(B,2885,1029),_(B,2929,!1),_(B,2931,1),_(B,2932,513),_(B,2928,new Float32Array([0,1])),_(B,2930,!0),_(B,3024,!0),_(B,35725,null),_(B,36006,null),_(B,36007,null),_(B,34229,null),_(B,34964,null),_(B,2886,2305),_(B,33170,4352),_(B,2849,1),_(B,32823,!1),_(B,32824,0),_(B,10752,0),_(B,32926,!1),_(B,32928,!1),_(B,32938,1),_(B,32939,!1),_(B,3089,!1),_(B,3088,new Int32Array([0,0,1024,1024])),_(B,2960,!1),_(B,2961,0),_(B,2968,4294967295),_(B,36005,4294967295),_(B,2962,519),_(B,2967,0),_(B,2963,4294967295),_(B,34816,519),_(B,36003,0),_(B,36004,4294967295),_(B,2964,7680),_(B,2965,7680),_(B,2966,7680),_(B,34817,7680),_(B,34818,7680),_(B,34819,7680),_(B,2978,[0,0,1024,1024]),_(B,3333,4),_(B,3317,4),_(B,37440,!1),_(B,37441,!1),_(B,37443,37444),_(B,36389,null),_(B,36662,null),_(B,36663,null),_(B,35053,null),_(B,35055,null),_(B,35723,4352),_(B,36010,null),_(B,35977,!1),_(B,3330,0),_(B,3332,0),_(B,3331,0),_(B,3314,0),_(B,32878,0),_(B,3316,0),_(B,3315,0),_(B,32877,0),B),Re=function(t,r,n){return r?t.enable(n):t.disable(n)},mf=function(t,r,n){return t.hint(n,r)},he=function(t,r,n){return t.pixelStorei(n,r)},Tf=function(t,r,n){var i;return n===36006?i=K(t)?36009:36160:i=36008,t.bindFramebuffer(i,r)},Jt=function(t,r,n){var i,o=(i={},_(i,34964,34962),_(i,36662,36662),_(i,36663,36663),_(i,35053,35051),_(i,35055,35052),i),a=o[n];t.bindBuffer(a,r)};function Ro(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var Af=(I={},_(I,3042,Re),_(I,32773,function(e,t){return e.blendColor.apply(e,re(t))}),_(I,32777,"blendEquation"),_(I,34877,"blendEquation"),_(I,32969,"blendFunc"),_(I,32968,"blendFunc"),_(I,32971,"blendFunc"),_(I,32970,"blendFunc"),_(I,3106,function(e,t){return e.clearColor.apply(e,re(t))}),_(I,3107,function(e,t){return e.colorMask.apply(e,re(t))}),_(I,2884,Re),_(I,2885,function(e,t){return e.cullFace(t)}),_(I,2929,Re),_(I,2931,function(e,t){return e.clearDepth(t)}),_(I,2932,function(e,t){return e.depthFunc(t)}),_(I,2928,function(e,t){return e.depthRange.apply(e,re(t))}),_(I,2930,function(e,t){return e.depthMask(t)}),_(I,3024,Re),_(I,35723,mf),_(I,35725,function(e,t){return e.useProgram(t)}),_(I,36007,function(e,t){return e.bindRenderbuffer(36161,t)}),_(I,36389,function(e,t){var r,n;return(r=(n=e).bindTransformFeedback)===null||r===void 0?void 0:r.call(n,36386,t)}),_(I,34229,function(e,t){return e.bindVertexArray(t)}),_(I,36006,Tf),_(I,36010,Tf),_(I,34964,Jt),_(I,36662,Jt),_(I,36663,Jt),_(I,35053,Jt),_(I,35055,Jt),_(I,2886,function(e,t){return e.frontFace(t)}),_(I,33170,mf),_(I,2849,function(e,t){return e.lineWidth(t)}),_(I,32823,Re),_(I,32824,"polygonOffset"),_(I,10752,"polygonOffset"),_(I,35977,Re),_(I,32926,Re),_(I,32928,Re),_(I,32938,"sampleCoverage"),_(I,32939,"sampleCoverage"),_(I,3089,Re),_(I,3088,function(e,t){return e.scissor.apply(e,re(t))}),_(I,2960,Re),_(I,2961,function(e,t){return e.clearStencil(t)}),_(I,2968,function(e,t){return e.stencilMaskSeparate(1028,t)}),_(I,36005,function(e,t){return e.stencilMaskSeparate(1029,t)}),_(I,2962,"stencilFuncFront"),_(I,2967,"stencilFuncFront"),_(I,2963,"stencilFuncFront"),_(I,34816,"stencilFuncBack"),_(I,36003,"stencilFuncBack"),_(I,36004,"stencilFuncBack"),_(I,2964,"stencilOpFront"),_(I,2965,"stencilOpFront"),_(I,2966,"stencilOpFront"),_(I,34817,"stencilOpBack"),_(I,34818,"stencilOpBack"),_(I,34819,"stencilOpBack"),_(I,2978,function(e,t){return e.viewport.apply(e,re(t))}),_(I,3333,he),_(I,3317,he),_(I,37440,he),_(I,37441,he),_(I,37443,he),_(I,3330,he),_(I,3332,he),_(I,3331,he),_(I,3314,he),_(I,32878,he),_(I,3316,he),_(I,3315,he),_(I,32877,he),_(I,"framebuffer",function(t,r){var n=r&&"handle"in r?r.handle:r;return t.bindFramebuffer(36160,n)}),_(I,"blend",function(t,r){return r?t.enable(3042):t.disable(3042)}),_(I,"blendColor",function(t,r){return t.blendColor.apply(t,re(r))}),_(I,"blendEquation",function(t,r){var n=typeof r=="number"?[r,r]:r;t.blendEquationSeparate.apply(t,re(n))}),_(I,"blendFunc",function(t,r){var n=r?.length===2?[].concat(re(r),re(r)):r;t.blendFuncSeparate.apply(t,re(n))}),_(I,"clearColor",function(t,r){return t.clearColor.apply(t,re(r))}),_(I,"clearDepth",function(t,r){return t.clearDepth(r)}),_(I,"clearStencil",function(t,r){return t.clearStencil(r)}),_(I,"colorMask",function(t,r){return t.colorMask.apply(t,re(r))}),_(I,"cull",function(t,r){return r?t.enable(2884):t.disable(2884)}),_(I,"cullFace",function(t,r){return t.cullFace(r)}),_(I,"depthTest",function(t,r){return r?t.enable(2929):t.disable(2929)}),_(I,"depthFunc",function(t,r){return t.depthFunc(r)}),_(I,"depthMask",function(t,r){return t.depthMask(r)}),_(I,"depthRange",function(t,r){return t.depthRange.apply(t,re(r))}),_(I,"dither",function(t,r){return r?t.enable(3024):t.disable(3024)}),_(I,"derivativeHint",function(t,r){t.hint(35723,r)}),_(I,"frontFace",function(t,r){return t.frontFace(r)}),_(I,"mipmapHint",function(t,r){return t.hint(33170,r)}),_(I,"lineWidth",function(t,r){return t.lineWidth(r)}),_(I,"polygonOffsetFill",function(t,r){return r?t.enable(32823):t.disable(32823)}),_(I,"polygonOffset",function(t,r){return t.polygonOffset.apply(t,re(r))}),_(I,"sampleCoverage",function(t,r){return t.sampleCoverage.apply(t,re(r))}),_(I,"scissorTest",function(t,r){return r?t.enable(3089):t.disable(3089)}),_(I,"scissor",function(t,r){return t.scissor.apply(t,re(r))}),_(I,"stencilTest",function(t,r){return r?t.enable(2960):t.disable(2960)}),_(I,"stencilMask",function(t,r){r=Ro(r)?r:[r,r];var n=r,i=Ao(n,2),o=i[0],a=i[1];t.stencilMaskSeparate(1028,o),t.stencilMaskSeparate(1029,a)}),_(I,"stencilFunc",function(t,r){r=Ro(r)&&r.length===3?[].concat(re(r),re(r)):r;var n=r,i=Ao(n,6),o=i[0],a=i[1],u=i[2],c=i[3],p=i[4],b=i[5];t.stencilFuncSeparate(1028,o,a,u),t.stencilFuncSeparate(1029,c,p,b)}),_(I,"stencilOp",function(t,r){r=Ro(r)&&r.length===3?[].concat(re(r),re(r)):r;var n=r,i=Ao(n,6),o=i[0],a=i[1],u=i[2],c=i[3],p=i[4],b=i[5];t.stencilOpSeparate(1028,o,a,u),t.stencilOpSeparate(1029,c,p,b)}),_(I,"viewport",function(t,r){return t.viewport.apply(t,re(r))}),I);function ne(e,t,r){return t[e]!==void 0?t[e]:r[e]}var Rf={blendEquation:function(t,r,n){return t.blendEquationSeparate(ne(32777,r,n),ne(34877,r,n))},blendFunc:function(t,r,n){return t.blendFuncSeparate(ne(32969,r,n),ne(32968,r,n),ne(32971,r,n),ne(32970,r,n))},polygonOffset:function(t,r,n){return t.polygonOffset(ne(32824,r,n),ne(10752,r,n))},sampleCoverage:function(t,r,n){return t.sampleCoverage(ne(32938,r,n),ne(32939,r,n))},stencilFuncFront:function(t,r,n){return t.stencilFuncSeparate(1028,ne(2962,r,n),ne(2967,r,n),ne(2963,r,n))},stencilFuncBack:function(t,r,n){return t.stencilFuncSeparate(1029,ne(34816,r,n),ne(36003,r,n),ne(36004,r,n))},stencilOpFront:function(t,r,n){return t.stencilOpSeparate(1028,ne(2964,r,n),ne(2965,r,n),ne(2966,r,n))},stencilOpBack:function(t,r,n){return t.stencilOpSeparate(1029,ne(34817,r,n),ne(34818,r,n),ne(34819,r,n))}},Eo={enable:function(t,r){return t(_({},r,!0))},disable:function(t,r){return t(_({},r,!1))},pixelStorei:function(t,r,n){return t(_({},r,n))},hint:function(t,r,n){return t(_({},r,n))},useProgram:function(t,r){return t(_({},35725,r))},bindRenderbuffer:function(t,r,n){return t(_({},36007,n))},bindTransformFeedback:function(t,r,n){return t(_({},36389,n))},bindVertexArray:function(t,r){return t(_({},34229,r))},bindFramebuffer:function(t,r,n){var i;switch(r){case 36160:return t((i={},_(i,36006,n),_(i,36010,n),i));case 36009:return t(_({},36006,n));case 36008:return t(_({},36010,n));default:return null}},bindBuffer:function(t,r,n){var i,o=(i={},_(i,34962,[34964]),_(i,36662,[36662]),_(i,36663,[36663]),_(i,35051,[35053]),_(i,35052,[35055]),i)[r];return o?t(_({},o,n)):{valueChanged:!0}},blendColor:function(t,r,n,i,o){return t(_({},32773,new Float32Array([r,n,i,o])))},blendEquation:function(t,r){var n;return t((n={},_(n,32777,r),_(n,34877,r),n))},blendEquationSeparate:function(t,r,n){var i;return t((i={},_(i,32777,r),_(i,34877,n),i))},blendFunc:function(t,r,n){var i;return t((i={},_(i,32969,r),_(i,32968,n),_(i,32971,r),_(i,32970,n),i))},blendFuncSeparate:function(t,r,n,i,o){var a;return t((a={},_(a,32969,r),_(a,32968,n),_(a,32971,i),_(a,32970,o),a))},clearColor:function(t,r,n,i,o){return t(_({},3106,new Float32Array([r,n,i,o])))},clearDepth:function(t,r){return t(_({},2931,r))},clearStencil:function(t,r){return t(_({},2961,r))},colorMask:function(t,r,n,i,o){return t(_({},3107,[r,n,i,o]))},cullFace:function(t,r){return t(_({},2885,r))},depthFunc:function(t,r){return t(_({},2932,r))},depthRange:function(t,r,n){return t(_({},2928,new Float32Array([r,n])))},depthMask:function(t,r){return t(_({},2930,r))},frontFace:function(t,r){return t(_({},2886,r))},lineWidth:function(t,r){return t(_({},2849,r))},polygonOffset:function(t,r,n){var i;return t((i={},_(i,32824,r),_(i,10752,n),i))},sampleCoverage:function(t,r,n){var i;return t((i={},_(i,32938,r),_(i,32939,n),i))},scissor:function(t,r,n,i,o){return t(_({},3088,new Int32Array([r,n,i,o])))},stencilMask:function(t,r){var n;return t((n={},_(n,2968,r),_(n,36005,r),n))},stencilMaskSeparate:function(t,r,n){return t(_({},r===1028?2968:36005,n))},stencilFunc:function(t,r,n,i){var o;return t((o={},_(o,2962,r),_(o,2967,n),_(o,2963,i),_(o,34816,r),_(o,36003,n),_(o,36004,i),o))},stencilFuncSeparate:function(t,r,n,i,o){var a;return t((a={},_(a,r===1028?2962:34816,n),_(a,r===1028?2967:36003,i),_(a,r===1028?2963:36004,o),a))},stencilOp:function(t,r,n,i){var o;return t((o={},_(o,2964,r),_(o,2965,n),_(o,2966,i),_(o,34817,r),_(o,34818,n),_(o,34819,i),o))},stencilOpSeparate:function(t,r,n,i,o){var a;return t((a={},_(a,r===1028?2964:34817,n),_(a,r===1028?2965:34818,i),_(a,r===1028?2966:34819,o),a))},viewport:function(t,r,n,i,o){return t(_({},2978,[r,n,i,o]))}},Oe=function(t,r){return t.isEnabled(r)},wo=(_e={},_(_e,3042,Oe),_(_e,2884,Oe),_(_e,2929,Oe),_(_e,3024,Oe),_(_e,32823,Oe),_(_e,32926,Oe),_(_e,32928,Oe),_(_e,3089,Oe),_(_e,2960,Oe),_(_e,35977,Oe),_e),Of=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Sh(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ah(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
29
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Ah(e,t){if(e){if(typeof e=="string")return Ef(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ef(e,t)}}function Ef(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function be(e,t){var r=le.attach(e),n=r.gl;if(!Rh(t)){var i={};for(var o in t){var a=Number(o),u=Af[o];u&&(typeof u=="string"?i[u]=!0:u(n,t[o],a))}var c=n.state&&n.state.cache;if(c)for(var p in i){var b=Rf[p];b(n,t,c)}}}function on(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:er,r=le.attach(e),n=r.gl;if(typeof t=="number"){var i=t,o=wo[i];return o?o(n,i):n.getParameter(i)}var a=Array.isArray(t)?t:Object.keys(t),u={},c=Sh(a),p;try{for(c.s();!(p=c.n()).done;){var b=p.value,g=wo[b];u[b]=g?g(n,Number(b)):n.getParameter(Number(b))}}catch(v){c.e(v)}finally{c.f()}return u}function wf(e){be(e,er)}function Rh(e){for(var t in e)return!1;return!0}function Pf(e,t){if(e===t)return!0;var r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(var i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}function tr(e){return tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tr(e)}function If(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Eh(n.key),n)}}function Oh(e,t,r){return t&&If(e.prototype,t),r&&If(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Eh(e){var t=wh(e,"string");return tr(t)==="symbol"?t:String(t)}function wh(e,t){if(tr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(tr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ph(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ih=function(){function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.copyState,o=i===void 0?!1:i,a=n.log,u=a===void 0?function(){}:a;Ph(this,e),this.gl=void 0,this.program=null,this.stateStack=[],this.enable=!0,this.cache=void 0,this.log=void 0,this.gl=r,this.cache=o?on(r):Object.assign({},er),this.log=u,this._updateCache=this._updateCache.bind(this),Object.seal(this)}var t=e.prototype;return t.push=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})},t.pop=function(){H(this.stateStack.length>0);var n=this.stateStack[this.stateStack.length-1];be(this.gl,n),this.stateStack.pop()},t._updateCache=function(n){var i=!1,o,a=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(var u in n){H(u!==void 0);var c=n[u],p=this.cache[u];Pf(c,p)||(i=!0,o=p,a&&!(u in a)&&(a[u]=p),this.cache[u]=c)}return{valueChanged:i,oldValue:o}},Oh(e)}();function je(e){return e.state}function rr(e,t){var r=t.enable,n=r===void 0?!0:r,i=t.copyState;if(H(i!==void 0),!e.state){e.state=new Ih(e,{copyState:i}),xh(e);for(var o in Eo){var a=Eo[o];Nh(e,o,a)}Nf(e,"getParameter"),Nf(e,"isEnabled")}var u=je(e);return u.enable=n,e}function Se(e){var t=je(e);t||(rr(e,{copyState:!1}),t=je(e)),t.push()}function ge(e){var t=je(e);H(t),t.pop()}function Nf(e,t){var r=e[t].bind(e);e[t]=function(i){if(i===void 0||Of.has(i))return r(i);var o=je(e);return i in o.cache||(o.cache[i]=r(i)),o.enable?o.cache[i]:r(i)},Object.defineProperty(e[t],"name",{value:"".concat(t,"-from-cache"),configurable:!1})}function Nh(e,t,r){if(e[t]){var n=e[t].bind(e);e[t]=function(){for(var o=je(e),a=arguments.length,u=new Array(a),c=0;c<a;c++)u[c]=arguments[c];var p=r.apply(void 0,[o._updateCache].concat(u)),b=p.valueChanged,g=p.oldValue;return b&&n.apply(void 0,u),g},Object.defineProperty(e[t],"name",{value:"".concat(t,"-to-cache"),configurable:!1})}}function xh(e){var t=e.useProgram.bind(e);e.useProgram=function(n){var i=je(e);i.program!==n&&(t(n),i.program=n)}}function nr(e){return nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nr(e)}function xf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xf(Object(r),!0).forEach(function(n){Ch(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ch(e,t,r){return t=Bh(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bh(e){var t=Fh(e,"string");return nr(t)==="symbol"?t:String(t)}function Fh(e,t){if(nr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(nr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Dh={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:function(){return console.error("WebGL context lost")},onContextRestored:function(){return console.info("WebGL context restored")}};function Cf(e,t){t=ht(ht({},Dh),t);var r=null,n=function(b){return r=b.statusMessage||r};e.addEventListener("webglcontextcreationerror",n,!1);var i=null;if(t.type==="webgl2"&&(t=ht(ht({},t),{},{webgl1:!1})),t.type==="webgl1"&&(t=ht(ht({},t),{},{webgl2:!1})),!i&&t.webgl2&&(i=e.getContext("webgl2",t)),!i&&t.webgl1&&(i=e.getContext("webgl",t)),e.removeEventListener("webglcontextcreationerror",n,!1),!i)throw new Error("Failed to create ".concat(t.webgl2&&!t.webgl1?"WebGL2":"WebGL"," context: ").concat(r||"Unknown error"));if(t.onContextLost){var o=t,a=o.onContextLost;e.addEventListener("webglcontextlost",function(p){return a(p)},!1)}if(t.onContextRestored){var u=t,c=u.onContextRestored;e.addEventListener("webglcontextrestored",function(p){return c(p)},!1)}return i}function Bf(e){var t=e.getParameter(7936),r=e.getParameter(7937),n=e.getExtension("WEBGL_debug_renderer_info"),i=e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),o=e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),a=i||t,u=o||r,c=e.getParameter(7938),p=Ff(a,u),b=Mh(a,u),g=Uh(a,u),v="glsl",T=K(e)?300:100;return{type:K(e)?"webgl2":"webgl",gpu:p,gpuType:g,gpuBackend:b,vendor:a,renderer:u,version:c,shadingLanguage:v,shadingLanguageVersion:T}}function Ff(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function Mh(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function Uh(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";var r=Ff(e,t);switch(r){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Df(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<"u"?window.navigator||{}:{},r=e.userAgent||t.userAgent||"",n=r.indexOf("MSIE ")!==-1,i=r.indexOf("Trident/")!==-1;return n||i}function an(e){switch(e){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(e))}var ce,Ee;function fr(e){return fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fr(e)}function jh(e,t){return Vh(e)||Xh(e,t)||Hh(e,t)||Wh()}function Wh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
30
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hh(e,t){if(e){if(typeof e=="string")return Mf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mf(e,t)}}function Mf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xh(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Vh(e){if(Array.isArray(e))return e}function oe(e,t,r){return t=kh(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kh(e){var t=Lh(e,"string");return fr(t)==="symbol"?t:String(t)}function Lh(e,t){if(fr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(fr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var fe="texture-compression-bc",Q="texture-compression-astc",we="texture-compression-etc2",Kh="texture-compression-etc1-webgl",fn="texture-compression-pvrtc-webgl",Po="texture-compression-atc-webgl",or="WEBGL_compressed_texture_s3tc",ir="WEBGL_compressed_texture_s3tc_srgb",yt="EXT_texture_compression_rgtc",ar="EXT_texture_compression_bptc",Yh="WEBGL_compressed_texture_etc",zh="WEBGL_compressed_texture_astc",$h="WEBGL_compressed_texture_etc1",Zh="WEBGL_compressed_texture_pvrtc",Qh="WEBGL_compressed_texture_atc",Uf="EXT_sRGB",Ie="EXT_texture_norm16",qh="WEBGL_color_buffer_float",Jh="EXT_color_buffer_float",Ae=function(t,r){return t.getExtension(r)},We=function(t,r){return r.every(function(n){return t.getExtension(n)})},Io={"texture-blend-float-webgl1":function(t){return K(t)?!0:Ae(t,"EXT_float_blend")},"texture-formats-srgb-webgl1":function(t){return K(t)?!0:Ae(t,Uf)},"texture-formats-depth-webgl1":function(t){return K(t)?!0:Ae(t,"WEBGL_depth_texture")},"texture-formats-float32-webgl1":function(t){return K(t)?!0:Ae(t,"OES_texture_float")},"texture-formats-float16-webgl1":function(t){return K(t)?!0:Ae(t,"OES_texture_half_float")},"texture-formats-norm16-webgl":function(t){return K(t)?Ae(t,Ie):!1},"texture-filter-linear-float32-webgl":function(t){return Ae(t,"OES_texture_float_linear")},"texture-filter-linear-float16-webgl":function(t){return Ae(t,"OES_texture_half_float_linear")},"texture-filter-anisotropic-webgl":function(t){return Ae(t,"EXT_texture_filter_anisotropic")},"texture-renderable-float32-webgl":function(t){return Ae(t,"EXT_color_buffer_float")},"texture-renderable-float16-webgl":function(t){return Ae(t,"EXT_color_buffer_half_float")},"texture-compression-bc":function(t){return We(t,[or,ir,yt,ar])},"texture-compression-bc5-webgl":function(t){return We(t,[yt])},"texture-compression-etc2":function(t){return We(t,[Yh])},"texture-compression-astc":function(t){return We(t,[zh])},"texture-compression-etc1-webgl":function(t){return We(t,[$h])},"texture-compression-pvrtc-webgl":function(t){return We(t,[Zh])},"texture-compression-atc-webgl":function(t){return We(t,[Qh])}};function Gh(e,t){var r;return((r=Io[t])===null||r===void 0?void 0:r.call(Io,e))||!1}function jf(e){var t=Object.keys(Io);return t.filter(function(r){return Gh(e,r)})}var He={"rgb8unorm-unsized":{gl:6407,gl1:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,gl1:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,renderbuffer:!0},r8snorm:{gl:36756,b:1,c:1},r8uint:{gl:33330,b:1,c:1,renderbuffer:!0},r8sint:{gl:33329,b:1,c:1,renderbuffer:!0},rg8unorm:{gl:33323,b:2,c:2,renderbuffer:!0},rg8snorm:{gl:36757,b:2,c:2},rg8uint:{gl:33336,b:2,c:2,renderbuffer:!0},rg8sint:{gl:33335,b:2,c:2,renderbuffer:!0},r16uint:{gl:33332,b:2,c:1,renderbuffer:!0},r16sint:{gl:33331,b:2,c:1,renderbuffer:!0},r16float:{gl:33325,b:2,c:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:Ie},"r16snorm-webgl":{gl:36760,b:2,c:1,f:"texture-formats-norm16-webgl",x:Ie},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,gl1:6408,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,gl1:35906,b:4,c:4,gl1ext:Uf,bpp:4},rgba8snorm:{gl:36759,b:4,c:4},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,f:"texture-formats-norm16-webgl",x:Ie},"rg16snorm-webgl":{gl:36761,b:2,c:2,f:"texture-formats-norm16-webgl",x:Ie},r32uint:{gl:33334,b:4,c:1,bpp:4,renderbuffer:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,renderbuffer:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl"},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:"texture-renderable-float32-webgl",renderbuffer:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,renderbuffer:!0},"rgb10a2unorm-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,renderbuffer:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:"texture-formats-norm16-webgl",x:Ie},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:"texture-formats-norm16-webgl",x:Ie},rg32uint:{gl:33340,b:8,c:2,renderbuffer:!0},rg32sint:{gl:33339,b:8,c:2,renderbuffer:!0},rg32float:{gl:33328,b:8,c:2,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},rgba16uint:{gl:36214,b:8,c:4,renderbuffer:!0},rgba16sint:{gl:36232,b:8,c:4,renderbuffer:!0},rgba16float:{gl:34842,gl1:6408,b:8,c:4,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},"rgba16unorm-webgl":{gl:32859,b:2,c:4,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:Ie},"rgba16snorm-webgl":{gl:36763,b:2,c:4,f:"texture-formats-norm16-webgl",x:Ie},"rgb32float-webgl":{gl:34837,gl1:6407,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",gl2ext:Jh,gl1ext:qh,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,renderbuffer:!0},rgba32sint:{gl:36226,b:16,c:4,renderbuffer:!0},rgba32float:{gl:34836,b:16,c:4,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},stencil8:{gl:36168,gl1:36168,b:1,c:1,attachment:36128,renderbuffer:!0},depth16unorm:{gl:33189,gl1:33189,b:2,c:1,attachment:36096,renderbuffer:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096},depth32float:{gl:36012,b:4,c:1,attachment:36096,renderbuffer:!0},"depth24plus-stencil8":{gl:34041,gl1:34041,b:4,c:2,p:1,attachment:33306,renderbuffer:!0,depthTexture:!0},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,renderbuffer:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,renderbuffer:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:or,f:fe},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:ir,f:fe},"bc1-rgba-unorm":{gl:33777,x:or,f:fe},"bc1-rgba-unorm-srgb":{gl:35916,x:ir,f:fe},"bc2-rgba-unorm":{gl:33778,x:or,f:fe},"bc2-rgba-unorm-srgb":{gl:35918,x:ir,f:fe},"bc3-rgba-unorm":{gl:33779,x:or,f:fe},"bc3-rgba-unorm-srgb":{gl:35919,x:ir,f:fe},"bc4-r-unorm":{gl:36283,x:yt,f:fe},"bc4-r-snorm":{gl:36284,x:yt,f:fe},"bc5-rg-unorm":{gl:36285,x:yt,f:fe},"bc5-rg-snorm":{gl:36286,x:yt,f:fe},"bc6h-rgb-ufloat":{gl:36495,x:ar,f:fe},"bc6h-rgb-float":{gl:36494,x:ar,f:fe},"bc7-rgba-unorm":{gl:36492,x:ar,f:fe},"bc7-rgba-unorm-srgb":{gl:36493,x:ar,f:fe},"etc2-rgb8unorm":{gl:37492,f:we},"etc2-rgb8unorm-srgb":{gl:37494,f:we},"etc2-rgb8a1unorm":{gl:37496,f:we},"etc2-rgb8a1unorm-srgb":{gl:37497,f:we},"etc2-rgba8unorm":{gl:37493,f:we},"etc2-rgba8unorm-srgb":{gl:37495,f:we},"eac-r11unorm":{gl:37488,f:we},"eac-r11snorm":{gl:37489,f:we},"eac-rg11unorm":{gl:37490,f:we},"eac-rg11snorm":{gl:37491,f:we},"astc-4x4-unorm":{gl:37808,f:Q},"astc-4x4-unorm-srgb":{gl:37840,f:Q},"astc-5x4-unorm":{gl:37809,f:Q},"astc-5x4-unorm-srgb":{gl:37841,f:Q},"astc-5x5-unorm":{gl:37810,f:Q},"astc-5x5-unorm-srgb":{gl:37842,f:Q},"astc-6x5-unorm":{gl:37811,f:Q},"astc-6x5-unorm-srgb":{gl:37843,f:Q},"astc-6x6-unorm":{gl:37812,f:Q},"astc-6x6-unorm-srgb":{gl:37844,f:Q},"astc-8x5-unorm":{gl:37813,f:Q},"astc-8x5-unorm-srgb":{gl:37845,f:Q},"astc-8x6-unorm":{gl:37814,f:Q},"astc-8x6-unorm-srgb":{gl:37846,f:Q},"astc-8x8-unorm":{gl:37815,f:Q},"astc-8x8-unorm-srgb":{gl:37847,f:Q},"astc-10x5-unorm":{gl:37819,f:Q},"astc-10x5-unorm-srgb":{gl:37851,f:Q},"astc-10x6-unorm":{gl:37817,f:Q},"astc-10x6-unorm-srgb":{gl:37849,f:Q},"astc-10x8-unorm":{gl:37818,f:Q},"astc-10x8-unorm-srgb":{gl:37850,f:Q},"astc-10x10-unorm":{gl:37819,f:Q},"astc-10x10-unorm-srgb":{gl:37851,f:Q},"astc-12x10-unorm":{gl:37820,f:Q},"astc-12x10-unorm-srgb":{gl:37852,f:Q},"astc-12x12-unorm":{gl:37821,f:Q},"astc-12x12-unorm-srgb":{gl:37853,f:Q},"pvrtc-rgb4unorm-webgl":{gl:35840,f:fn},"pvrtc-rgba4unorm-webgl":{gl:35842,f:fn},"pvrtc-rbg2unorm-webgl":{gl:35841,f:fn},"pvrtc-rgba2unorm-webgl":{gl:35843,f:fn},"etc1-rbg-unorm-webgl":{gl:36196,f:Kh},"atc-rgb-unorm-webgl":{gl:35986,f:Po},"atc-rgba-unorm-webgl":{gl:35986,f:Po},"atc-rgbai-unorm-webgl":{gl:34798,f:Po}},ey=(ce={},oe(ce,6403,1),oe(ce,36244,1),oe(ce,33319,2),oe(ce,33320,2),oe(ce,6407,3),oe(ce,36248,3),oe(ce,6408,4),oe(ce,36249,4),oe(ce,6402,1),oe(ce,34041,1),oe(ce,6406,1),oe(ce,6409,1),oe(ce,6410,2),ce),ty=(Ee={},oe(Ee,5126,4),oe(Ee,5125,4),oe(Ee,5124,4),oe(Ee,5123,2),oe(Ee,5122,2),oe(Ee,5131,2),oe(Ee,5120,1),oe(Ee,5121,1),Ee);function ur(e,t){var r=Xe(t),n=He[r];if(!n||(K(e)?n.gl===void 0:n.gl1===void 0))return!1;var i=n.x||K(e)&&n.gl2ext||n.gl1ext;return i?Boolean(e.getExtension(i)):!0}function Wf(e,t){var r;return ur(e,t)&&((r=He[t])===null||r===void 0?void 0:r.renderbuffer)}function Xe(e){if(typeof e=="string")return e;var t=Object.entries(He).find(function(r){var n=jh(r,2),i=n[1];return i.gl===e||i.gl1===e});if(!t)throw new Error("Unknown texture format ".concat(e));return t[0]}function cr(e,t){var r=He[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error("Unsupported texture format ".concat(e));return n}function Hf(e,t){var r=Xe(t);if(!ur(e,r))return!1;try{var n=Gr(r);if(n.signed)return!1}catch{return!1}return r.endsWith("32float")?Boolean(e.getExtension("OES_texture_float_linear")):r.endsWith("16float")?Boolean(e.getExtension("OES_texture_half_float_linear")):!0}function Xf(e,t){var r=Xe(t);return!(!ur(e,r)||typeof r=="number")}function _t(e,t){var r=Xe(e),n=cr(r,t),i=Gr(r);return{format:n,dataFormat:ry(i.format,i.integer,i.normalized,n),type:i.dataType?an(i.dataType):5121,compressed:i.compressed}}function Vf(e){var t=He[e];if(!(t!=null&&t.attachment))throw new Error("".concat(e," is not a depth stencil format"));return t.attachment}function un(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6408,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6408,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5121,i=null,o=null;try{i=e.createTexture(),e.bindTexture(3553,i);var a=0,u=1,c=1,p=0,b=new Uint8Array([0,0,255,255]);e.texImage2D(3553,a,t,u,c,p,r,n,b),o=e.createFramebuffer(),e.bindFramebuffer(36160,o),e.framebufferTexture2D(36160,36064,3553,i,0);var g=e.checkFramebufferStatus(36160)===36053;return e.bindTexture(3553,null),g}finally{e.deleteTexture(i),e.deleteFramebuffer(o)}}function sr(e,t){var r=Xe(e),n=_t(r,t),i=ey[n.dataFormat]||4,o=ty[n.type]||1;return i*o}function ry(e,t,r,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;default:return 6408}}function ny(e,t){return ay(e)||iy(e,t)||Lf(e,t)||oy()}function oy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
31
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iy(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function ay(e){if(Array.isArray(e))return e}function fy(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Lf(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
32
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Lf(e,t){if(e){if(typeof e=="string")return kf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kf(e,t)}}function kf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kf(e){var t=uy(e),r=fy(jf(e)),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;t.add(i)}}catch(o){r.e(o)}finally{r.f()}return t}function uy(e){e.getExtension("EXT_color_buffer_float"),e.getExtension("WEBGL_color_buffer_float"),e.getExtension("EXT_float_blend");for(var t=new Set,r=0,n=Object.keys(Yf);r<n.length;r++){var i=n[r];cy(e,i)&&t.add(i)}return t}function cy(e,t){var r=Yf[t];if(!r)return!1;var n=r||[],i=ny(n,2),o=i[0],a=i[1],u=K(e)?a:o;if(typeof u=="boolean")return u;switch(t){case"texture-renderable-rgba32float-webgl":return K(e)?Boolean(e.getExtension(u)):un(e);case"glsl-derivatives":return xo(e,u);case"glsl-frag-data":return xo(e,u,{behavior:"require"});case"glsl-frag-depth":return xo(e,u);default:return Boolean(e.getExtension(u))}}var No={};function xo(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!Df(r))return!0;if(t in No)return No[t];var n=r.behavior||"enable",i="#extension GL_".concat(t," : ").concat(n,`
33
- void main(void) {}`),o=e.createShader(35633);if(!o)throw new Error("shader");e.shaderSource(o,i),e.compileShader(o);var a=e.getShaderParameter(o,35713);return e.deleteShader(o),No[t]=a,a}var Yf={webgl:[!0,!0],webgl2:[!1,!0],"timer-query-webgl":["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],"transform-feedback-webgl2":[!1,!0],"vertex-array-object-webgl1":["OES_vertex_array_object",!0],"instanced-rendering-webgl1":["ANGLE_instanced_arrays",!0],"multiple-render-targets-webgl1":["WEBGL_draw_buffers",!0],"index-uint32-webgl1":["OES_element_index_uint",!0],"blend-minmax-webgl1":["EXT_blend_minmax",!0],"texture-blend-float-webgl1":["EXT_float_blend","EXT_float_blend"],"texture-formats-srgb-webgl1":["EXT_sRGB",!0],"texture-formats-depth-webgl1":["WEBGL_depth_texture",!0],"texture-formats-float32-webgl1":["OES_texture_float",!0],"texture-formats-float16-webgl1":["OES_texture_half_float",!0],"texture-filter-linear-float32-webgl":["OES_texture_float_linear","OES_texture_float_linear"],"texture-filter-linear-float16-webgl":["OES_texture_half_float_linear","OES_texture_half_float_linear"],"texture-filter-anisotropic-webgl":["EXT_texture_filter_anisotropic","EXT_texture_filter_anisotropic"],"texture-renderable-rgba32float-webgl":["WEBGL_color_buffer_float","EXT_color_buffer_float"],"texture-renderable-float32-webgl":[!1,"EXT_color_buffer_float"],"texture-renderable-float16-webgl":["EXT_color_buffer_half_float","EXT_color_buffer_half_float"],"glsl-frag-data":["WEBGL_draw_buffers",!0],"glsl-frag-depth":["EXT_frag_depth",!0],"glsl-derivatives":["OES_standard_derivatives",!0],"glsl-texture-lod":["EXT_shader_texture_lod",!0]};function lr(e){return lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lr(e)}function k(e,t,r){return t=sy(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sy(e){var t=ly(e,"string");return lr(t)==="symbol"?t:String(t)}function ly(e,t){if(lr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(lr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zf(e){var t=Zt(e);return{maxTextureDimension1D:0,maxTextureDimension2D:e.getParameter(3379),maxTextureDimension3D:t?t.getParameter(32883):0,maxTextureArrayLayers:t?t.getParameter(35071):0,maxBindGroups:1,maxDynamicUniformBuffersPerPipelineLayout:0,maxDynamicStorageBuffersPerPipelineLayout:0,maxSampledTexturesPerShaderStage:e.getParameter(35660),maxSamplersPerShaderStage:e.getParameter(35661),maxStorageBuffersPerShaderStage:0,maxStorageTexturesPerShaderStage:0,maxUniformBuffersPerShaderStage:t?t.getParameter(35375):0,maxUniformBufferBindingSize:t?t.getParameter(35376):0,maxStorageBufferBindingSize:0,minUniformBufferOffsetAlignment:t?t.getParameter(35380):0,minStorageBufferOffsetAlignment:0,maxVertexBuffers:0,maxVertexAttributes:e.getParameter(34921),maxVertexBufferArrayStride:2048,maxInterStageShaderComponents:t?t.getParameter(35659):0,maxComputeWorkgroupStorageSize:0,maxComputeInvocationsPerWorkgroup:0,maxComputeWorkgroupSizeX:0,maxComputeWorkgroupSizeY:0,maxComputeWorkgroupSizeZ:0,maxComputeWorkgroupsPerDimension:0}}function $f(e){var t,r=Zt(e);function n(o){return e.getParameter(o)}function i(o,a){return r?r.getParameter(o):a||0}return t={},k(t,33902,n(33902)),k(t,33901,n(33901)),k(t,3379,n(3379)),k(t,34076,n(34076)),k(t,34930,n(34930)),k(t,35661,n(35661)),k(t,35660,n(35660)),k(t,34024,n(34024)),k(t,36348,n(36348)),k(t,34921,n(34921)),k(t,36347,n(36347)),k(t,36349,n(36349)),k(t,3386,n(3386)),k(t,34047,n(34047)),k(t,32883,i(32883)),k(t,35071,i(35071)),k(t,37447,i(37447)),k(t,36063,i(36063)),k(t,35379,i(35379)),k(t,35374,i(35374)),k(t,35377,i(35377)),k(t,34852,i(34852)),k(t,36203,i(36203)),k(t,33001,i(33001)),k(t,33e3,i(33e3)),k(t,37157,i(37157)),k(t,35373,i(35373)),k(t,35657,i(35657)),k(t,36183,i(36183)),k(t,37137,i(37137)),k(t,34045,i(34045)),k(t,35978,i(35978)),k(t,35979,i(35979)),k(t,35968,i(35968)),k(t,35376,i(35376)),k(t,35375,i(35375)),k(t,35659,i(35659)),k(t,37154,i(37154)),k(t,35371,i(35371)),k(t,35658,i(35658)),k(t,35076,i(35076)),k(t,35077,i(35077)),k(t,35380,i(35380)),t}function ve(e,t,r){var n=le.attach(e),i=n.gl;if(py(t))return r(e);var o=t.nocatch,a=o===void 0?!0:o;Se(i),be(i,t);var u;if(a)u=r(i),ge(i);else try{u=r(i)}finally{ge(i)}return u}function py(e){for(var t in e)return!1;return!0}function Qf(e,t,r,n){if(Qe(t))return n(e);Se(e.gl);try{return ln(e,t),be(e,r),n(e)}finally{ge(e.gl)}}function qf(e,t,r){if(Qe(t))return r(e);Se(e.gl);try{return ln(e,t),r(e)}finally{ge(e.gl)}}function ln(e,t){var r=le.attach(e),n=r.gl;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(pr("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(hy("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(sn("depthCompare",t.depthCompare))),t.stencilWriteMask){var i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&D.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){var o=t.stencilReadMask||4294967295,a=sn("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,a,0,o),n.stencilFuncSeparate(1029,a,0,o)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){var u=Co("stencilPassOperation",t.stencilPassOperation),c=Co("stencilFailOperation",t.stencilFailOperation),p=Co("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,c,p,u),n.stencilOpSeparate(1029,c,p,u)}if(t.blendColorOperation||t.blendAlphaOperation){n.enable(3042);var b=Zf("blendColorOperation",t.blendColorOperation||"add"),g=Zf("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(b,g);var v=cn("blendColorSrcFactor",t.blendColorSrcFactor||"one"),T=cn("blendColorDstFactor",t.blendColorDstFactor||"zero"),S=cn("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),E=cn("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(v,T,S,E)}}function sn(e,t){return pr(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Co(e,t){return pr(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Zf(e,t){return pr(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function cn(e,t){return pr(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773})}function dy(e,t){return"Illegal parameter ".concat(t," for ").concat(e)}function pr(e,t,r){if(!(t in r))throw new Error(dy(e,t));return r[t]}function hy(e,t){return t}function dr(e){return dr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dr(e)}function Jf(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function yy(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jf(Object(r),!0).forEach(function(n){_y(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _y(e,t,r){return t=by(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function by(e){var t=gy(e,"string");return dr(t)==="symbol"?t:String(t)}function gy(e,t){if(dr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(dr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pn(e){var t={};return e.addressModeU&&(t[10242]=Bo(e.addressModeU)),e.addressModeV&&(t[10243]=Bo(e.addressModeV)),e.addressModeW&&(t[32882]=Bo(e.addressModeW)),e.magFilter&&(t[10240]=eu(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=vy(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=sn("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function Gf(e){var t=yy({},e);return e[10241]!==9728&&(t[10241]=9729),t[10242]=33071,t[10243]=33071,t}function Bo(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function eu(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function vy(e,t){if(!t)return eu(e);switch(e){case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}function Fo(){"use strict";Fo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&Ne(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function tu(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function my(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){tu(o,n,i,a,u,"next",c)}function u(c){tu(o,n,i,a,u,"throw",c)}a(void 0)})}}function ru(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function nu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ru(Object(r),!0).forEach(function(n){Ty(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ru(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ty(e,t,r){return t=iu(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ne(e){return Ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(e)}function ou(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,iu(n.key),n)}}function Sy(e,t,r){return t&&ou(e.prototype,t),r&&ou(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function iu(e){var t=Ay(e,"string");return Ne(t)==="symbol"?t:String(t)}function Ay(e,t){if(Ne(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ne(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ry(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Oy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Do(e,t)}function Do(e,t){return Do=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Do(e,t)}function Ey(e){var t=Iy();return function(){var n=dn(e),i;if(t){var o=dn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return wy(this,i)}}function wy(e,t){if(t&&(Ne(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Py(e)}function Py(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Iy(){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 dn(e){return dn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dn(e)}var pe=function(e){Oy(r,e);var t=Ey(r);function r(i){var o,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ry(this,r),o=t.call(this,i,a),o.device=void 0,o.gl=void 0,o.gl2=void 0,o.handle=void 0,o.glTarget=void 0,o.glUsage=void 0,o.glIndexType=5123,o.byteLength=void 0,o.bytesUsed=void 0,o.device=i,o.gl=o.device.gl,o.gl2=o.device.gl2;var u=Ne(a)==="object"?a.handle:void 0;return o.handle=u||o.gl.createBuffer(),i.setSpectorMetadata(o.handle,nu(nu({},o.props),{},{data:Ne(o.props.data)})),o.glTarget=Ny(o.props.usage),o.glUsage=xy(o.props.usage),o.glIndexType=o.props.indexType==="uint32"?5125:5123,a.data?o._initWithData(a.data,a.byteOffset,a.byteLength):o._initWithByteLength(a.byteLength||0),o}var n=r.prototype;return n._initWithData=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:o.byteLength+a,c=this.glTarget;this.gl.bindBuffer(c,this.handle),this.gl.bufferData(c,u,this.glUsage),this.gl.bufferSubData(c,a,o),this.gl.bindBuffer(c,null),this.bytesUsed=u,this.byteLength=u,this._setDebugData(o,a,u),this.trackAllocatedMemory(u)},n._initWithByteLength=function(o){H(o>=0);var a=o;o===0&&(a=new Float32Array(0));var u=this.glTarget;return this.gl.bindBuffer(u,this.handle),this.gl.bufferData(u,a,this.glUsage),this.gl.bindBuffer(u,null),this.bytesUsed=o,this.byteLength=o,this._setDebugData(null,0,o),this.trackAllocatedMemory(o),this},n.destroy=function(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)},n.write=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,u=0,c=void 0,p=this.device.isWebGL2?36663:this.glTarget;this.gl.bindBuffer(p,this.handle),u!==0||c!==void 0?(this.device.assertWebGL2(),this.gl2.bufferSubData(p,a,o,u,c)):this.gl.bufferSubData(p,a,o),this.gl.bindBuffer(p,null),this._setDebugData(o,a,o.byteLength)},n.readAsync=function(){var i=my(Fo().mark(function a(){var u,c,p=arguments;return Fo().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return u=p.length>0&&p[0]!==void 0?p[0]:0,c=p.length>1?p[1]:void 0,g.abrupt("return",this.readSyncWebGL2(u,c));case 3:case"end":return g.stop()}},a,this)}));function o(){return i.apply(this,arguments)}return o}(),n.readSyncWebGL2=function(){var o,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,u=arguments.length>1?arguments[1]:void 0;this.device.assertWebGL2(),u=(o=u)!==null&&o!==void 0?o:this.byteLength-a;var c=new Uint8Array(u),p=0;return this.gl.bindBuffer(36662,this.handle),this.gl2.getBufferSubData(36662,a,c,p,u),this.gl.bindBuffer(36662,null),this._setDebugData(c,a,u),c},Sy(r)}(te);function Ny(e){return e&te.INDEX?34963:e&te.VERTEX?34962:e&te.UNIFORM?35345:34962}function xy(e){return e&te.INDEX||e&te.VERTEX?35044:e&te.UNIFORM?35048:35044}function bt(e){return bt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bt(e)}function Cy(e,t){return My(e)||Dy(e,t)||Fy(e,t)||By()}function By(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
34
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fy(e,t){if(e){if(typeof e=="string")return au(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return au(e,t)}}function au(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Dy(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function My(e){if(Array.isArray(e))return e}function fu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,jy(n.key),n)}}function Uy(e,t,r){return t&&fu(e.prototype,t),r&&fu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function jy(e){var t=Wy(e,"string");return bt(t)==="symbol"?t:String(t)}function Wy(e,t){if(bt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(bt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Mo(e,t)}function Mo(e,t){return Mo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Mo(e,t)}function Vy(e){var t=Ky();return function(){var n=hn(e),i;if(t){var o=hn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ky(this,i)}}function ky(e,t){if(t&&(bt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ly(e)}function Ly(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ky(){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 hn(e){return hn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},hn(e)}var Ve=function(e){Xy(r,e);var t=Vy(r);function r(i,o){var a;return Hy(this,r),a=t.call(this,i,o),a.device=void 0,a.handle=void 0,a.parameters=void 0,a.device=i,a.parameters=pn(o),a.device.isWebGL2&&(a.handle=a.handle||a.device.gl2.createSampler(),a._setSamplerParameters(a.parameters)),a}var n=r.prototype;return n.destroy=function(){this.handle&&(this.device.gl2.deleteSampler(this.handle),this.handle=void 0)},n.toString=function(){return"Sampler(".concat(this.id,",").concat(JSON.stringify(this.props),")")},n._setSamplerParameters=function(o){for(var a=0,u=Object.entries(o);a<u.length;a++){var c=Cy(u[a],2),p=c[0],b=c[1],g=Number(p);switch(g){case 33082:case 33083:this.device.gl2.samplerParameterf(this.handle,g,b);break;default:this.device.gl2.samplerParameteri(this.handle,g,b);break}}},Uy(r)}(Ur);function Uo(){"use strict";Uo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&Ce(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function uu(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function Yy(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){uu(o,n,i,a,u,"next",c)}function u(c){uu(o,n,i,a,u,"throw",c)}a(void 0)})}}function cu(e,t){return Zy(e)||$y(e,t)||du(e,t)||zy()}function zy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
35
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $y(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Zy(e){if(Array.isArray(e))return e}function Qy(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=du(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
36
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function du(e,t){if(e){if(typeof e=="string")return su(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return su(e,t)}}function su(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ce(e){return Ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ce(e)}function lu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function yn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?lu(Object(r),!0).forEach(function(n){qy(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qy(e,t,r){return t=hu(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,hu(n.key),n)}}function Jy(e,t,r){return t&&pu(e.prototype,t),r&&pu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hu(e){var t=Gy(e,"string");return Ce(t)==="symbol"?t:String(t)}function Gy(e,t){if(Ce(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ce(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function e_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jo(e,t)}function jo(e,t){return jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},jo(e,t)}function r_(e){var t=o_();return function(){var n=bn(e),i;if(t){var o=bn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return n_(this,i)}}function n_(e,t){if(t&&(Ce(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yu(e)}function yu(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o_(){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 bn(e){return bn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},bn(e)}var i_={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},se=function(e){t_(r,e);var t=r_(r);function r(i,o){var a,u;return e_(this,r),u=t.call(this,i,yn(yn({},i_),{},{format:"rgba8unorm"},o)),u.MAX_ATTRIBUTES=void 0,u.device=void 0,u.gl=void 0,u.gl2=void 0,u.handle=void 0,u.sampler=void 0,u.glFormat=void 0,u.type=void 0,u.dataFormat=void 0,u.mipmaps=void 0,u.target=void 0,u.textureUnit=void 0,u.loaded=!1,u._video=void 0,u.device=i,u.gl=u.device.gl,u.gl2=u.device.gl2,u.handle=u.props.handle||u.gl.createTexture(),u.device.setSpectorMetadata(u.handle,yn(yn({},u.props),{},{data:Ce(u.props.data)})),u.glFormat=6408,u.target=a_(u.props),u.loaded=!1,typeof((a=u.props)===null||a===void 0?void 0:a.data)=="string"&&Object.assign(u.props,{data:mo(u.props.data)}),u.initialize(u.props),Object.seal(yu(u)),u}var n=r.prototype;return n.destroy=function(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)},n.toString=function(){return"Texture(".concat(this.id,",").concat(this.width,"x").concat(this.height,")")},n.initialize=function(){var o=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.props.dimension==="cube")return this.initializeCube(a);var u=a.data;if(u instanceof Promise)return u.then(function(f){return o.initialize(Object.assign({},a,{pixels:f,data:f}))}),this;var c=typeof HTMLVideoElement<"u"&&u instanceof HTMLVideoElement;if(c&&u.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,u.addEventListener("loadeddata",function(){return o.initialize(a)}),this;var p=a.parameters,b=p===void 0?{}:p,g=a.pixels,v=g===void 0?null:g,T=a.pixelStore,S=T===void 0?{}:T,E=a.textureUnit,P=E===void 0?void 0:E;u||(u=v);var O=a.width,w=a.height,x=a.dataFormat,N=a.type,X=a.compressed,M=X===void 0?!1:X,Y=a.mipmaps,W=Y===void 0?!0:Y,V=a.depth,j=V===void 0?0:V,L=cr(a.format,this.device.isWebGL2),l=this._deduceParameters({format:a.format,type:N,dataFormat:x,compressed:M,data:u,width:O,height:w});return O=l.width,w=l.height,M=l.compressed,x=l.dataFormat,N=l.type,this.width=O,this.height=w,this.glFormat=L,this.type=N,this.dataFormat=x,this.textureUnit=P,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),W&&this.device.isWebGL1&&_n(this.width,this.height)&&(D.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaps"))(),W=!1),this.mipmaps=W,this.setImageData({data:u,width:O,height:w,depth:j,format:L,type:N,dataFormat:x,parameters:S,compressed:M}),this.setSampler(a.sampler),this._setSamplerParameters(b),W&&this.generateMipmap(),c&&(this._video={video:u,parameters:b,lastTime:u.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?u.currentTime:-1}),this},n.initializeCube=function(o){var a=this,u=o.mipmaps,c=u===void 0?!0:u,p=o.parameters,b=p===void 0?{}:p;return this.setCubeMapImageData(o).then(function(){a.loaded=!0,c&&a.generateMipmap(o),a.setSampler(o.sampler),a._setSamplerParameters(b)}),this},n.setSampler=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a;o instanceof Ve?(this.sampler=o,a=o.props):(this.sampler=new Ve(this.device,o),a=o);var u=pn(a);return this._setSamplerParameters(u),this},n.resize=function(o){var a=o.height,u=o.width,c=o.mipmaps,p=c===void 0?!1:c;return u!==this.width||a!==this.height?this.initialize({width:u,height:a,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:p}):this},n.update=function(){if(this._video){var o=this._video,a=o.video,u=o.parameters,c=o.lastTime;if(c===a.currentTime||a.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:a,parameters:u}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=a.currentTime}},n.generateMipmap=function(){var o=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.device.isWebGL1&&_n(this.width,this.height)?(D.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),ve(this.gl,a,function(){o.gl.generateMipmap(o.target)}),this.gl.bindTexture(this.target,null),this)},n.setImageData=function(o){var a=this;if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(o);this.trackDeallocatedMemory("Texture");var u=o.target,c=u===void 0?this.target:u,p=o.pixels,b=p===void 0?null:p,g=o.level,v=g===void 0?0:g,T=o.glFormat,S=T===void 0?this.glFormat:T,E=o.offset,P=E===void 0?0:E,O=o.parameters,w=O===void 0?{}:O,x=o.data,N=x===void 0?null:x,X=o.type,M=X===void 0?this.type:X,Y=o.width,W=Y===void 0?this.width:Y,V=o.height,j=V===void 0?this.height:V,L=o.dataFormat,l=L===void 0?this.dataFormat:L,f=o.compressed,s=f===void 0?!1:f;N||(N=b);var d=this._deduceParameters({format:this.props.format,type:M,dataFormat:l,compressed:s,data:N,width:W,height:j});M=d.type,l=d.dataFormat,s=d.compressed,W=d.width,j=d.height;var y=this.gl;y.bindTexture(this.target,this.handle);var h=null,m=this._getDataType({data:N,compressed:s});N=m.data,h=m.dataType;var A;if(ve(this.gl,w,function(){switch(h){case"null":y.texImage2D(c,v,S,W,j,0,l,M,N);break;case"typed-array":y.texImage2D(c,v,S,W,j,0,l,M,N,P);break;case"buffer":A=a.device.assertWebGL2(),A.bindBuffer(35052,N.handle||N),A.texImage2D(c,v,S,W,j,0,l,M,P),A.bindBuffer(35052,null);break;case"browser-object":a.device.isWebGL2?y.texImage2D(c,v,S,W,j,0,l,M,N):y.texImage2D(c,v,S,l,M,N);break;case"compressed":var F=Qy(N.entries()),C;try{for(F.s();!(C=F.n()).done;){var U=cu(C.value,2),jc=U[0],Tr=U[1];y.compressedTexImage2D(c,jc,Tr.format,Tr.width,Tr.height,0,Tr.data)}}catch(Wc){F.e(Wc)}finally{F.f()}break;default:H(!1,"Unknown image data type")}}),N&&N.byteLength)this.trackAllocatedMemory(N.byteLength,"Texture");else{var R=sr(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*R,"Texture")}return this.loaded=!0,this},n.setSubImageData=function(o){var a=this,u=o.target,c=u===void 0?this.target:u,p=o.pixels,b=p===void 0?null:p,g=o.data,v=g===void 0?null:g,T=o.x,S=T===void 0?0:T,E=o.y,P=E===void 0?0:E,O=o.width,w=O===void 0?this.width:O,x=o.height,N=x===void 0?this.height:x,X=o.level,M=X===void 0?0:X,Y=o.glFormat,W=Y===void 0?this.glFormat:Y,V=o.type,j=V===void 0?this.type:V,L=o.dataFormat,l=L===void 0?this.dataFormat:L,f=o.compressed,s=f===void 0?!1:f,d=o.offset,y=d===void 0?0:d,h=o.parameters,m=h===void 0?{}:h,A=this._deduceParameters({format:this.props.format,type:j,dataFormat:l,compressed:s,data:v,width:w,height:N});if(j=A.type,l=A.dataFormat,s=A.compressed,w=A.width,N=A.height,H(this.depth===1,"texSubImage not supported for 3D textures"),v||(v=b),v&&v.data){var R=v;v=R.data,w=R.shape[0],N=R.shape[1]}v instanceof pe&&(v=v.handle),this.gl.bindTexture(this.target,this.handle),ve(this.gl,m,function(){if(s)a.gl.compressedTexSubImage2D(c,M,S,P,w,N,W,v);else if(v===null)a.gl.texSubImage2D(c,M,S,P,w,N,l,j,null);else if(ArrayBuffer.isView(v))a.gl.texSubImage2D(c,M,S,P,w,N,l,j,v,y);else if(typeof WebGLBuffer<"u"&&v instanceof WebGLBuffer){var F=a.device.assertWebGL2();F.bindBuffer(35052,v),F.texSubImage2D(c,M,S,P,w,N,l,j,y),F.bindBuffer(35052,null)}else if(a.device.isWebGL2){var C=a.device.assertWebGL2();C.texSubImage2D(c,M,S,P,w,N,l,j,v)}else a.gl.texSubImage2D(c,M,S,P,l,j,v)}),this.gl.bindTexture(this.target,null)},n.copyFramebuffer=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return D.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null},n.getActiveUnit=function(){return this.gl.getParameter(34016)-33984},n.bind=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,a=this.gl;return o!==void 0&&(this.textureUnit=o,a.activeTexture(33984+o)),a.bindTexture(this.target,this.handle),o},n.unbind=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,a=this.gl;return o!==void 0&&(this.textureUnit=o,a.activeTexture(33984+o)),a.bindTexture(this.target,null),o},n._getDataType=function(o){var a=o.data,u=o.compressed,c=u===void 0?!1:u;return c?{data:a,dataType:"compressed"}:a===null?{data:a,dataType:"null"}:ArrayBuffer.isView(a)?{data:a,dataType:"typed-array"}:a instanceof pe?{data:a.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&a instanceof WebGLBuffer?{data:a,dataType:"buffer"}:{data:a,dataType:"browser-object"}},n._deduceParameters=function(o){var a=o.format,u=o.data,c=o.width,p=o.height,b=o.dataFormat,g=o.type,v=o.compressed,T=_t(a,this.device.isWebGL2);b=b||T.dataFormat,g=g||T.type,v=v||T.compressed;var S=this._deduceImageSize(u,c,p);return c=S.width,p=S.height,{dataFormat:b,type:g,compressed:v,width:c,height:p,format:a,data:u}},n._deduceImageSize=function(o,a,u){var c;return typeof ImageData<"u"&&o instanceof ImageData?c={width:o.width,height:o.height}:typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement?c={width:o.naturalWidth,height:o.naturalHeight}:typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement?c={width:o.width,height:o.height}:typeof ImageBitmap<"u"&&o instanceof ImageBitmap?c={width:o.width,height:o.height}:typeof HTMLVideoElement<"u"&&o instanceof HTMLVideoElement?c={width:o.videoWidth,height:o.videoHeight}:o?c={width:a,height:u}:c={width:a>=0?a:1,height:u>=0?u:1},H(c,"Could not deduced texture size"),H(a===void 0||c.width===a,"Deduced texture width does not match supplied width"),H(u===void 0||c.height===u,"Deduced texture height does not match supplied height"),c},n.setCubeMapImageData=function(){var i=Yy(Uo().mark(function a(u){var c=this,p,b,g,v,T,S,E,P,O,w,x;return Uo().wrap(function(X){for(;;)switch(X.prev=X.next){case 0:return p=this.gl,b=u.width,g=u.height,v=u.pixels,T=u.data,S=u.format,E=S===void 0?6408:S,P=u.type,O=P===void 0?5121:P,w=v||T,X.next=5,Promise.all(r.FACES.map(function(M){var Y=w[M];return Promise.all(Array.isArray(Y)?Y:[Y])}));case 5:x=X.sent,this.bind(),r.FACES.forEach(function(M,Y){x[Y].length>1&&c.props.mipmaps!==!1&&D.warn("".concat(c.id," has mipmap and multiple LODs."))(),x[Y].forEach(function(W,V){b&&g?p.texImage2D(M,V,E,b,g,0,E,O,W):p.texImage2D(M,V,E,E,O,W)})}),this.unbind();case 9:case"end":return X.stop()}},a,this)}));function o(a){return i.apply(this,arguments)}return o}(),n.setImageDataForFace=function(o){var a=this,u=o.face,c=o.width,p=o.height,b=o.pixels,g=o.data,v=o.format,T=v===void 0?6408:v,S=o.type,E=S===void 0?5121:S,P=this.gl,O=b||g;return this.bind(),O instanceof Promise?O.then(function(w){return a.setImageDataForFace(Object.assign({},o,{face:u,data:w,pixels:w}))}):this.width||this.height?P.texImage2D(u,0,T,c,p,0,T,E,O):P.texImage2D(u,0,T,T,E,O),this},n.setImageData3D=function(o){var a=this,u=o.level,c=u===void 0?0:u,p=o.dataFormat,b=o.format,g=o.type,v=o.width,T=o.height,S=o.depth,E=S===void 0?1:S,P=o.offset,O=P===void 0?0:P,w=o.data,x=o.parameters,N=x===void 0?{}:x;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);var X=_t(b,this.device.isWebGL2);if(ve(this.gl,N,function(){ArrayBuffer.isView(w)&&a.gl.texImage3D(a.target,c,X.format,v,T,E,0,X.dataFormat,X.type,w),w instanceof pe&&(a.gl.bindBuffer(35052,w.handle),a.gl.texImage3D(a.target,c,p,v,T,E,0,b,g,O))}),w&&w.byteLength)this.trackAllocatedMemory(w.byteLength,"Texture");else{var M=sr(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*this.depth*M,"Texture")}return this.loaded=!0,this},n._setSamplerParameters=function(o){if(this.device.isWebGL1&&_n(this.width,this.height)&&(o=Gf(o)),!Qe(o)){f_(o),this.gl.bindTexture(this.target,this.handle);for(var a=0,u=Object.entries(o);a<u.length;a++){var c=cu(u[a],2),p=c[0],b=c[1],g=Number(p),v=b;switch(g){case 33082:case 33083:this.gl.texParameterf(this.target,g,v);break;default:this.gl.texParameteri(this.target,g,v);break}}this.gl.bindTexture(this.target,null)}},n._getWebGL1NPOTParameterOverride=function(o,a){var u=this.device.isWebGL1&&_n(this.width,this.height);if(u)switch(o){case 10241:if(a!==9729&&a!==9728)return 9729;break;case 10242:case 10243:return 33071;default:break}return a},Jy(r)}(ae);se.FACES=[34069,34070,34071,34072,34073,34074];function a_(e){switch(e.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(e.dimension)}}function _n(e,t){return!e||!t?!1:!Ir(e)||!Ir(t)}function f_(e){D.log(1,"texture sampler parameters",e)()}function gn(e,t){if(typeof t!="string")return t;var r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\./,"");var n=e[t];return H(n!==void 0,"Accessing undefined constant GL.".concat(t)),n}function vt(e){return vt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vt(e)}function u_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
37
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function c_(e,t){if(e){if(typeof e=="string")return _u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _u(e,t)}}function _u(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function s_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p_(n.key),n)}}function l_(e,t,r){return t&&bu(e.prototype,t),r&&bu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function p_(e){var t=d_(e,"string");return vt(t)==="symbol"?t:String(t)}function d_(e,t){if(vt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(vt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function h_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Wo(e,t)}function Wo(e,t){return Wo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Wo(e,t)}function y_(e){var t=g_();return function(){var n=vn(e),i;if(t){var o=vn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return __(this,i)}}function __(e,t){if(t&&(vt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return b_(e)}function b_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g_(){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 vn(e){return vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vn(e)}var gt="Resource subclass must define virtual methods",hr=function(e){h_(r,e);var t=y_(r);function r(i,o,a){var u;s_(this,r),u=t.call(this,i,o,a),u.device=void 0,u.gl=void 0,u.gl2=void 0,u._handle=void 0,u._bound=!1,u.byteLength=0,u.device=le.attach(i);var c=u.device.gl;en(c);var p=o||{},b=p.id;return u.gl=c,u.gl2=c,u.id=b||Te(u.constructor.name),u._handle=o?.handle,u._handle===void 0&&(u._handle=u._createHandle()),u.byteLength=0,u}var n=r.prototype;return n.toString=function(){return"".concat(this.constructor.name,"(").concat(this.id,")")},n.delete=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=o.deleteChildren,u=a===void 0?!1:a,c=this._handle&&this._deleteHandle(this._handle);return this._handle&&this.removeStats(),this._handle=null,c&&u&&c.filter(Boolean).forEach(function(p){return p.destroy()}),this},n.bind=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof o!="function")return this._bindHandle(o),this;var a;return this._bound?a=o():(this._bindHandle(this.handle),this._bound=!0,a=o(),this._bound=!1,this._bindHandle(null)),a},n.unbind=function(){this.bind(null)},n.getParameter=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};o=gn(this.gl,o),H(o);var u=this.constructor.PARAMETERS||{},c=u[o];if(c){var p=K(this.gl),b=(!("webgl2"in c)||p)&&(!("extension"in c)||this.gl.getExtension(c.extension));if(!b){var g=c.webgl1,v="webgl2"in c?c.webgl2:c.webgl1,T=p?v:g;return T}}return this._getParameter(o,a)},n.getParameters=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=o.parameters,u=o.keys,c=this.constructor.PARAMETERS||{},p=K(this.gl),b={},g=a||Object.keys(c),v=u_(g),T;try{for(v.s();!(T=v.n()).done;){var S=T.value,E=c[S],P=E&&(!("webgl2"in E)||p)&&(!("extension"in E)||this.gl.getExtension(E.extension));if(P){var O=u?this.device.getGLKey(S):S;b[O]=this.getParameter(S,o),u&&E.type==="GLenum"&&(b[O]=this.device.getGLKey(b[O]))}}}catch(w){v.e(w)}finally{v.f()}return b},n.setParameter=function(o,a){o=gn(this.gl,o),H(o);var u=this.constructor.PARAMETERS||{},c=u[o];if(c){var p=K(this.gl),b=(!("webgl2"in c)||p)&&(!("extension"in c)||this.gl.getExtension(c.extension));if(!b)throw new Error("Parameter not available on this platform");c.type==="GLenum"&&(a=gn(a))}return this._setParameter(o,a),this},n.setParameters=function(o){for(var a in o)this.setParameter(a,o[a]);return this},n.stubRemovedMethods=function(o,a,u){return yo(this,o,a,u)},n.initialize=function(o){},n._createHandle=function(){throw new Error(gt)},n._deleteHandle=function(){throw new Error(gt)},n._bindHandle=function(o){throw new Error(gt)},n._getOptsFromHandle=function(){throw new Error(gt)},n._getParameter=function(o,a){throw new Error(gt)},n._setParameter=function(o,a){throw new Error(gt)},l_(r,[{key:"handle",get:function(){return this._handle}}]),r}($);function mt(e){return mt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(e)}var Tu;function gu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function vu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gu(Object(r),!0).forEach(function(n){v_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function v_(e,t,r){return t=Su(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Su(n.key),n)}}function T_(e,t,r){return t&&mu(e.prototype,t),r&&mu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Su(e){var t=S_(e,"string");return mt(t)==="symbol"?t:String(t)}function S_(e,t){if(mt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(mt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function A_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ho(e,t)}function Ho(e,t){return Ho=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ho(e,t)}function R_(e){var t=w_();return function(){var n=mn(e),i;if(t){var o=mn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return O_(this,i)}}function O_(e,t){if(t&&(mt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return E_(e)}function E_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w_(){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 mn(e){return mn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mn(e)}Tu=Symbol.toStringTag;var Tt=function(e){A_(r,e);var t=R_(r);r.isTextureFormatSupported=function(o,a){return Wf(o.gl,a)};function r(i,o){var a;if(m_(this,r),typeof o.format=="number")throw new Error("Renderbuffer");return a=t.call(this,i,o,r.defaultProps),a.glFormat=void 0,a.glFormat=cr(a.props.format,i.isWebGL2),a._initialize(a.props),a}var n=r.prototype;return n.resize=function(o){(o.width!==this.width||o.height!==this.height)&&(Object.assign(this.props,vu(vu({},o),{},{format:this.format,samples:this.samples})),this._initialize(this.props))},n._initialize=function(o){var a=o.format,u=o.width,c=o.height,p=o.samples;H(a,"Needs format"),this.trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),p!==0&&this.device.isWebGL2?this.gl2.renderbufferStorageMultisample(36161,p,this.glFormat,u,c):this.gl.renderbufferStorage(36161,this.glFormat,u,c),this.gl.bindRenderbuffer(36161,null),this.trackAllocatedMemory(u*c*(p||1)*sr(this.glFormat,this.device.isWebGL2))},n._createHandle=function(){return this.gl.createRenderbuffer()},n._deleteHandle=function(){this.gl.deleteRenderbuffer(this.handle),this.trackDeallocatedMemory()},n._bindHandle=function(o){this.gl.bindRenderbuffer(36161,o)},T_(r,[{key:Tu,get:function(){return"Renderbuffer"}},{key:"width",get:function(){return this.props.width}},{key:"height",get:function(){return this.props.height}},{key:"format",get:function(){return this.props.format}},{key:"samples",get:function(){return this.props.samples}},{key:"attachment",get:function(){}}]),r}(hr);Tt.defaultProps={id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0};function St(e){return St=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St(e)}function P_(e,t){return x_(e)||N_(e,t)||Ou(e,t)||I_()}function I_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
38
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function x_(e){if(Array.isArray(e))return e}function C_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ou(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
39
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Ou(e,t){if(e){if(typeof e=="string")return Au(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Au(e,t)}}function Au(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function B_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ru(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,D_(n.key),n)}}function F_(e,t,r){return t&&Ru(e.prototype,t),r&&Ru(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function D_(e){var t=M_(e,"string");return St(t)==="symbol"?t:String(t)}function M_(e,t){if(St(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(St(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tn(){return typeof Reflect<"u"&&Reflect.get?Tn=Reflect.get.bind():Tn=function(t,r,n){var i=U_(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Tn.apply(this,arguments)}function U_(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=At(e),e!==null););return e}function j_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xo(e,t)}function Xo(e,t){return Xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Xo(e,t)}function W_(e){var t=V_();return function(){var n=At(e),i;if(t){var o=At(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return H_(this,i)}}function H_(e,t){if(t&&(St(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return X_(e)}function X_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V_(){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 At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},At(e)}var Pe=function(e){j_(r,e);var t=W_(r);function r(i,o){var a;B_(this,r),a=t.call(this,i,o),a.device=void 0,a.gl=void 0,a.handle=void 0;var u=o.handle===null;if(a.device=i,a.gl=i.gl,a.handle=a.props.handle||u?a.props.handle:a.gl.createFramebuffer(),!u){i.setSpectorMetadata(a.handle,{id:a.props.id,props:a.props}),a.autoCreateAttachmentTextures(),a.gl.bindFramebuffer(36160,a.handle);for(var c=0;c<a.colorAttachments.length;++c){var p=a.colorAttachments[c],b=36064+c;p&&a._attachOne(b,p)}a.depthStencilAttachment&&a._attachOne(Vf(a.depthStencilAttachment.format),a.depthStencilAttachment),a.gl.bindFramebuffer(36160,null)}return o.check!==!1&&a._checkStatus(),a}var n=r.prototype;return n.destroy=function(){Tn(At(r.prototype),"destroy",this).call(this),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)},n._checkStatus=function(){var o=this.gl,a=o.bindFramebuffer(36160,this.handle),u=o.checkFramebufferStatus(36160);if(o.bindFramebuffer(36160,a||null),u!==36053)throw new Error("Framebuffer ".concat(L_(u)))},n.createDepthStencilTexture=function(o){return new Tt(this.device,{id:"".concat(this.id,"-depth-stencil"),format:o,width:this.width,height:this.height})},n.resizeAttachments=function(o,a){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;o===void 0&&(o=this.gl.drawingBufferWidth),a===void 0&&(a=this.gl.drawingBufferHeight);var u=C_(this.colorAttachments),c;try{for(u.s();!(c=u.n()).done;){var p=c.value;p.resize({width:o,height:a})}}catch(b){u.e(b)}finally{u.f()}return this.depthStencilAttachment&&this.depthStencilAttachment.resize({width:o,height:a}),this},n._attachOne=function(o,a){if(a instanceof Tt)return this._attachWEBGLRenderbuffer(o,a),a;if(Array.isArray(a)){var u=P_(a,3),c=u[0],p=u[1],b=p===void 0?0:p,g=u[2],v=g===void 0?0:g;return this._attachTexture(o,c,b,v),c}else if(a instanceof se)return this._attachTexture(o,a,0,0),a;throw new Error("attach")},n._attachWEBGLRenderbuffer=function(o,a){this.gl.framebufferRenderbuffer(36160,o,36161,a.handle)},n._attachTexture=function(o,a,u,c){var p=this.device,b=p.gl,g=p.gl2;switch(b.bindTexture(a.target,a.handle),a.target){case 35866:case 32879:this.device.assertWebGL2(),g?.framebufferTextureLayer(36160,o,a.target,c,u);break;case 34067:var v=k_(u);b.framebufferTexture2D(36160,o,v,a.handle,c);break;case 3553:b.framebufferTexture2D(36160,o,3553,a.handle,c);break;default:H(!1,"Illegal texture type")}b.bindTexture(a.target,null)},F_(r,[{key:"texture",get:function(){return this.colorAttachments[0]}}]),r}(ot);function k_(e){return e<34069?e+34069:e}function L_(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return"".concat(e)}}function Rt(e){return Rt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(e)}function Eu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Y_(n.key),n)}}function K_(e,t,r){return t&&Eu(e.prototype,t),r&&Eu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Y_(e){var t=z_(e,"string");return Rt(t)==="symbol"?t:String(t)}function z_(e,t){if(Rt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Rt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vo(e,t)}function Vo(e,t){return Vo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Vo(e,t)}function Q_(e){var t=G_();return function(){var n=Sn(e),i;if(t){var o=Sn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return q_(this,i)}}function q_(e,t){if(t&&(Rt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return J_(e)}function J_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G_(){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 Sn(e){return Sn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Sn(e)}var An=function(e){Z_(r,e);var t=Q_(r);function r(i,o){var a;return $_(this,r),a=t.call(this,o),a.device=void 0,a.presentationSize=void 0,a._framebuffer=null,a.device=i,a.presentationSize=[-1,-1],a._setAutoCreatedCanvasId("".concat(a.device.id,"-canvas")),a.update(),a}var n=r.prototype;return n.getCurrentFramebuffer=function(){return this.update(),this._framebuffer=this._framebuffer||new Pe(this.device,{handle:null}),this._framebuffer},n.update=function(){var o=this.getPixelSize(),a=o[0]!==this.presentationSize[0]||o[1]!==this.presentationSize[1];a&&(this.presentationSize=o,this.resize())},n.resize=function(o){if(this.device.gl){if(this.canvas){var a=this.getDevicePixelRatio(o?.useDevicePixels);this.setDevicePixelRatio(a,o);return}var u=this.device.gl.getExtension("STACKGL_resize_drawingbuffer");u&&o&&"width"in o&&"height"in o&&u.resize(o.width,o.height)}},n.commit=function(){},K_(r)}(Ge);function Ot(e){return Ot=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ot(e)}function ko(){"use strict";ko=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&Ot(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function wu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Pu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(r),!0).forEach(function(n){eb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function eb(e,t,r){return t=tb(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tb(e){var t=rb(e,"string");return Ot(t)==="symbol"?t:String(t)}function rb(e,t){if(Ot(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ot(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Iu(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function nb(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){Iu(o,n,i,a,u,"next",c)}function u(c){Iu(o,n,i,a,u,"throw",c)}a(void 0)})}}var ob={spector:D.get("spector")||D.get("inspect")},ib="https://spectorcdn.babylonjs.com/spector.bundle.js",ab=1,de=null,Nu=!1;function xu(e){return Lo.apply(this,arguments)}function Lo(){return Lo=nb(ko().mark(function e(t){return ko().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(globalThis.SPECTOR){n.next=9;break}return n.prev=1,n.next=4,Yt(ib);case 4:n.next=9;break;case 6:n.prev=6,n.t0=n.catch(1),D.warn(String(n.t0));case 9:case"end":return n.stop()}},e,null,[[1,6]])})),Lo.apply(this,arguments)}function Cu(e){var t,r;if(e=Pu(Pu({},ob),e),!((t=e)!==null&&t!==void 0&&t.spector)||(!de&&globalThis.SPECTOR&&(D.probe(ab,"SPECTOR found and initialized")(),de=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=de)),!de))return null;if(!Nu){var n,i;Nu=!0,de.spyCanvases(),(n=de)===null||n===void 0||n.onCaptureStarted.add(function(u){return D.info("Spector capture started:",u)()}),(i=de)===null||i===void 0||i.onCapture.add(function(u){var c,p,b;D.info("Spector capture complete:",u)(),(c=de)===null||c===void 0||c.getResultUI(),(p=de)===null||p===void 0||p.resultView.display(),(b=de)===null||b===void 0||b.resultView.addCapture(u)})}if((r=e)!==null&&r!==void 0&&r.canvas){var o,a;if(typeof e.spector=="string"&&e.spector!==e.canvas.id)return de;(o=de)===null||o===void 0||o.startCapture((a=e)===null||a===void 0?void 0:a.canvas,500),new Promise(function(u){return setTimeout(u,2e3)}).then(function(u){var c;D.info("Spector capture stopped after 2 seconds")(),(c=de)===null||c===void 0||c.stopCapture()})}return de}var ke=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e}(ke||{});function Et(e){return Et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Et(e)}function Yo(){"use strict";Yo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&Et(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function fb(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ub(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},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,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function ub(e,t){if(e){if(typeof e=="string")return Bu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bu(e,t)}}function Bu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Fu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ju(n.key),n)}}function cb(e,t,r){return t&&Fu(e.prototype,t),r&&Fu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function sb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Du(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Mu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Du(Object(r),!0).forEach(function(n){lb(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Du(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lb(e,t,r){return t=ju(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ju(e){var t=pb(e,"string");return Et(t)==="symbol"?t:String(t)}function pb(e,t){if(Et(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Et(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Uu(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function db(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){Uu(o,n,i,a,u,"next",c)}function u(c){Uu(o,n,i,a,u,"throw",c)}a(void 0)})}}var hb="https://unpkg.com/webgl-debug@2.0.1/index.js";function Wu(e){return e.luma=e.luma||{},e.luma}function Hu(){return zo.apply(this,arguments)}function zo(){return zo=db(Yo().mark(function e(){return Yo().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!(G()&&!globalThis.WebGLDebugUtils)){r.next=5;break}return globalThis.global=globalThis.global||globalThis,globalThis.global.module={},r.next=5,Yt(hb);case 5:case"end":return r.stop()}},e)})),zo.apply(this,arguments)}function Xu(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?_b(e,t):yb(e):null}function yb(e){var t=Wu(e);return t.realContext?t.realContext:e}function _b(e,t){if(!globalThis.WebGLDebugUtils)return D.warn("webgl-debug not loaded")(),e;var r=Wu(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init(Mu(Mu({},ke),e));var n=globalThis.WebGLDebugUtils.makeDebugContext(e,bb.bind(null,t),gb.bind(null,t));for(var i in ke)!(i in n)&&typeof ke[i]=="number"&&(n[i]=ke[i]);var o=cb(function u(){sb(this,u)});Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(o,n);var a=Object.create(o);return r.realContext=e,r.debugContext=a,a.debug=!0,a}function Ko(e,t){t=Array.from(t).map(function(n){return n===void 0?"undefined":n});var r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r="".concat(r.slice(0,100)).concat(r.length>100?"...":""),"gl.".concat(e,"(").concat(r,")")}function bb(e,t,r,n){n=Array.from(n).map(function(c){return c===void 0?"undefined":c});var i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),a=e.webgl2?"gl2":"gl1",u="".concat(i," in ").concat(a,".").concat(r,"(").concat(o,")");D.error(u)();debugger;if(e.throwOnError)throw new Error(u)}function gb(e,t,r){var n="";if(D.level>=1&&(n=Ko(t,r),D.log(1,n)()),e.break&&e.break.length>0){n=n||Ko(t,r);var i=e.break.every(function(c){return n.indexOf(c)!==-1});if(i)debugger}var o=fb(r),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;if(u===void 0){if(n=n||Ko(t,r),e.throwOnError)throw new Error("Undefined argument: ".concat(n));D.error("Undefined argument: ".concat(n))();debugger}}}catch(c){o.e(c)}finally{o.f()}}function vb(e){return Ku(e)||mb(e)||$o(e)||Lu()}function mb(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Tb(e,t){return Ku(e)||Sb(e,t)||$o(e,t)||Lu()}function Lu(){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 Sb(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Ku(e){if(Array.isArray(e))return e}function Ab(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=$o(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},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,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function $o(e,t){if(e){if(typeof e=="string")return Vu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vu(e,t)}}function Vu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Yu(e){var t=e.split(/\r?\n/),r=[],n=Ab(t),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;if(!(o.length<=1)){var a=o.split(":");if(a.length===2){var u=Tb(a,2),c=u[0],p=u[1];r.push({message:p.trim(),type:ku(c),lineNum:0,linePos:0});continue}var b=vb(a),g=b[0],v=b[1],T=b[2],S=b.slice(3),E=parseInt(T,10);isNaN(E)&&(E=0);var P=parseInt(v,10);isNaN(P)&&(P=0),r.push({message:S.join(":").trim(),type:ku(g),lineNum:E,linePos:P})}}}catch(O){n.e(O)}finally{n.f()}return r}function ku(e){var t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}function Le(e){return Le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Le(e)}function Zo(){"use strict";Zo=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&Le(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function zu(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function Rb(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){zu(o,n,i,a,u,"next",c)}function u(c){zu(o,n,i,a,u,"throw",c)}a(void 0)})}}function $u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Eb(n.key),n)}}function Ob(e,t,r){return t&&$u(e.prototype,t),r&&$u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Eb(e){var t=wb(e,"string");return Le(t)==="symbol"?t:String(t)}function wb(e,t){if(Le(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Le(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ib(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qo(e,t)}function Qo(e,t){return Qo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Qo(e,t)}function Nb(e){var t=Bb();return function(){var n=Rn(e),i;if(t){var o=Rn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return xb(this,i)}}function xb(e,t){if(t&&(Le(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cb(e)}function Cb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bb(){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 Rn(e){return Rn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Rn(e)}var On=function(e){Ib(r,e);var t=Nb(r);function r(i,o){var a;switch(Pb(this,r),a=t.call(this,i,o),a.device=void 0,a.handle=void 0,a.device=i,a.props.stage){case"vertex":a.handle=a.props.handle||a.device.gl.createShader(35633);break;case"fragment":a.handle=a.props.handle||a.device.gl.createShader(35632);break;default:throw new Error(a.props.stage)}return a._compile(a.source),a}var n=r.prototype;return n.destroy=function(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)},n.getCompilationInfo=function(){var i=Rb(Zo().mark(function a(){return Zo().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return c.abrupt("return",this.getCompilationInfoSync());case 1:case"end":return c.stop()}},a,this)}));function o(){return i.apply(this,arguments)}return o}(),n.getCompilationInfoSync=function(){var o=this.device.gl.getShaderInfoLog(this.handle);return Yu(o)},n._compile=function(o){var a=function(p){return p.startsWith("#version ")?p:`#version 100
43
- `.concat(p)};o=a(o);var u=this.device.gl;if(u.shaderSource(this.handle,o),u.compileShader(this.handle),this.compilationStatus=u.getShaderParameter(this.handle,35713)?"success":"error",this.debugShader(),this.compilationStatus==="error")throw new Error("GLSL compilation errors in ".concat(this.props.stage," shader ").concat(this.props.id))},Ob(r)}(Dr);function wt(e){return wt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wt(e)}function Zu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Fb(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(r),!0).forEach(function(n){Db(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Db(e,t,r){return t=qu(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,qu(n.key),n)}}function Mb(e,t,r){return t&&Qu(e.prototype,t),r&&Qu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qu(e){var t=Ub(e,"string");return wt(t)==="symbol"?t:String(t)}function Ub(e,t){if(wt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(wt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wb(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jo(e,t)}function Jo(e,t){return Jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Jo(e,t)}function Hb(e){var t=kb();return function(){var n=En(e),i;if(t){var o=En(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Xb(this,i)}}function Xb(e,t){if(t&&(wt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vb(e)}function Vb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kb(){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 En(e){return En=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},En(e)}var Lb=256,Kb=1024,Yb=16384,qo=6144,wn=function(e){Wb(r,e);var t=Hb(r);function r(i,o){var a;return jb(this,r),a=t.call(this,i,o),a.device=void 0,a.glParameters=void 0,a.device=i,Se(a.device.gl),a.setParameters(a.props.parameters),a.clear(),a}var n=r.prototype;return n.end=function(){ge(this.device.gl),this.props.framebuffer&&be(this.device,{framebuffer:null})},n.pushDebugGroup=function(o){},n.popDebugGroup=function(){},n.insertDebugMarker=function(o){},n.setParameters=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a={};this.props.framebuffer&&(a.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(a.depthMask=!this.props.depthReadOnly),a.stencilMask=this.props.stencilReadOnly?0:1,a[35977]=this.props.discard,o.viewport&&(o.viewport.length>=6?(a.viewport=o.viewport.slice(0,4),a.depthRange=[o.viewport[4],o.viewport[5]]):a.viewport=o.viewport),a.scissorTest=Boolean(o.scissorRect),o.scissorRect&&(a.scissor=o.scissorRect),o.blendConstant&&(a.blendColor=o.blendConstant),o.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),o[2967]=o.stencilReference),this.glParameters=a,be(this.device,a)},n.clear=function(){var o=this,a=Fb({},this.glParameters),u=0;this.props.clearColor!==!1&&(u|=Yb,a.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(u|=Lb,a.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(u|=Kb,a.clearStencil=this.props.clearStencil),u!==0&&ve(this.device,a,function(){o.device.gl.clear(u)})},n.clearColorBuffer=function(){var o=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];ve(this.device.gl2,{framebuffer:this.props.framebuffer},function(){switch(u.constructor){case Int32Array:o.device.gl2.clearBufferiv(qo,a,u);break;case Uint32Array:o.device.gl2.clearBufferuiv(qo,a,u);break;case Float32Array:default:o.device.gl2.clearBufferfv(qo,a,u);break}})},Mb(r)}(Vr);var zb="Failed to deduce GL constant from typed array";function Ju(e){var t=ArrayBuffer.isView(e)?e.constructor:e;switch(t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(zb)}}function yr(e,t){var r=t||{},n=r.clamped,i=n===void 0?!0:n;switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return i?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function _r(e){return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function Pn(e,t,r){return $b()?Pn=Reflect.construct.bind():Pn=function(i,o,a){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),p=new c;return a&&Go(p,a.prototype),p},Pn.apply(null,arguments)}function $b(){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 Go(e,t){return Go=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Go(e,t)}function Zb(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Gu(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,qb(n.key),n)}}function Qb(e,t,r){return t&&Gu(e.prototype,t),r&&Gu(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qb(e){var t=Jb(e,"string");return _r(t)==="symbol"?t:String(t)}function Jb(e,t){if(_r(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(_r(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gb={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},eg={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},In=function(){e.getBytesPerElement=function(n){var i=yr(n.type||5126);return i.BYTES_PER_ELEMENT},e.getBytesPerVertex=function(n){H(n.size);var i=yr(n.type||5126);return i.BYTES_PER_ELEMENT*n.size},e.resolve=function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return Pn(e,[Gb].concat(i))};function e(){var r=this;Zb(this,e),this.offset=void 0,this.stride=void 0,this.type=void 0,this.size=void 0,this.divisor=void 0,this.normalized=void 0,this.integer=void 0,this.buffer=void 0,this.index=void 0;for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];i.forEach(function(a){return r._assign(a)}),Object.freeze(this)}var t=e.prototype;return t.toString=function(){return JSON.stringify(this)},t._assign=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n=_o("Accessor",n,eg),n.type!==void 0&&(this.type=n.type,(n.type===5124||n.type===5125)&&(this.integer=!0)),n.size!==void 0&&(this.size=n.size),n.offset!==void 0&&(this.offset=n.offset),n.stride!==void 0&&(this.stride=n.stride),n.normalize!==void 0&&(this.normalized=n.normalize),n.normalized!==void 0&&(this.normalized=n.normalized),n.integer!==void 0&&(this.integer=n.integer),n.divisor!==void 0&&(this.divisor=n.divisor),n.buffer!==void 0&&(this.buffer=n.buffer),n.index!==void 0&&(typeof n.index=="boolean"?this.index=n.index?1:0:this.index=n.index),n.instanced!==void 0&&(this.divisor=n.instanced?1:0),n.isInstanced!==void 0&&(this.divisor=n.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this},Qb(e,[{key:"BYTES_PER_ELEMENT",get:function(){return e.getBytesPerElement(this)}},{key:"BYTES_PER_VERTEX",get:function(){return e.getBytesPerVertex(this)}}]),e}();var q;function br(e){return br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},br(e)}function tc(e,t){return og(e)||ng(e,t)||rg(e,t)||tg()}function tg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
44
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rg(e,t){if(e){if(typeof e=="string")return ec(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ec(e,t)}}function ec(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ng(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function og(e){if(Array.isArray(e))return e}function ee(e,t,r){return t=ig(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ig(e){var t=ag(e,"string");return br(t)==="symbol"?t:String(t)}function ag(e,t){if(br(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(br(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rc(e){return fg.includes(e)}var fg=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],nc=(q={},ee(q,5126,[5126,1,"float","f32","float32"]),ee(q,35664,[5126,2,"vec2","vec2<f32>","float32x2"]),ee(q,35665,[5126,3,"vec3","vec3<f32>","float32x3"]),ee(q,35666,[5126,4,"vec4","vec4<f32>","float32x4"]),ee(q,5124,[5124,1,"int","i32","sint32"]),ee(q,35667,[5124,2,"ivec2","vec2<i32>","sint32x2"]),ee(q,35668,[5124,3,"ivec3","vec3<i32>","sint32x3"]),ee(q,35669,[5124,4,"ivec4","vec4<i32>","sint32x4"]),ee(q,5125,[5125,1,"uint","u32","uint32"]),ee(q,36294,[5125,2,"uvec2","vec2<u32>","uint32x2"]),ee(q,36295,[5125,3,"uvec3","vec3<u32>","uint32x3"]),ee(q,36296,[5125,4,"uvec4","vec4<u32>","uint32x4"]),ee(q,35670,[5126,1,"bool","f32","float32"]),ee(q,35671,[5126,2,"bvec2","vec2<f32>","float32x2"]),ee(q,35672,[5126,3,"bvec3","vec3<f32>","float32x3"]),ee(q,35673,[5126,4,"bvec4","vec4<f32>","float32x4"]),ee(q,35674,[5126,8,"mat2","mat2x2<f32>"]),ee(q,35685,[5126,8,"mat2x3","mat2x3<f32>"]),ee(q,35686,[5126,8,"mat2x4","mat2x4<f32>"]),ee(q,35687,[5126,12,"mat3x2","mat3x2<f32>"]),ee(q,35675,[5126,12,"mat3","mat3x3<f32>"]),ee(q,35688,[5126,12,"mat3x4","mat3x4<f32>"]),ee(q,35689,[5126,16,"mat4x2","mat4x2<f32>"]),ee(q,35690,[5126,16,"mat4x3","mat4x3<f32>"]),ee(q,35676,[5126,16,"mat4","mat4x4<f32>"]),q);function ei(e){var t=nc[e];if(!t)throw new Error("uniform");var r=tc(t,4),n=r[0],i=r[1],o=r[3];return{format:o,components:i,glType:n}}function oc(e){var t=nc[e];if(!t)throw new Error("attribute");var r=tc(t,5),n=r[1],i=r[3],o=r[4],a=i;return{attributeType:a,vertexFormat:o,components:n}}var ie;function gr(e){return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gr(e)}function ug(e,t){return pg(e)||lg(e,t)||sg(e,t)||cg()}function cg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
45
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sg(e,t){if(e){if(typeof e=="string")return ic(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ic(e,t)}}function ic(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function lg(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function pg(e){if(Array.isArray(e))return e}function ac(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function fc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ac(Object(r),!0).forEach(function(n){ue(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ac(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ue(e,t,r){return t=dg(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dg(e){var t=hg(e,"string");return gr(t)==="symbol"?t:String(t)}function hg(e,t){if(gr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(gr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nn(e,t){var r={attributes:[],bindings:[]};r.attributes=yg(e,t);for(var n=gg(e,t),i=0,o=n;i<o.length;i++){var a=o[i],u=a.uniforms.map(function(O){return{name:O.name,format:O.format,byteOffset:O.byteOffset,byteStride:O.byteStride,arrayLength:O.arrayLength}});r.bindings.push({type:"uniform",name:a.name,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:u})}for(var c=bg(e,t),p=0,b=0,g=c;b<g.length;b++){var v=g[b];if(rc(v.type)){var T=mg(v.type),S=T.viewDimension,E=T.sampleType;r.bindings.push({type:"texture",name:v.name,location:p,viewDimension:S,sampleType:E}),v.textureUnit=p,p+=1}}c.length&&(r.uniforms=c);var P=_g(e,t);return P!=null&&P.length&&(r.varyings=P),r}function yg(e,t){for(var r=[],n=e.getProgramParameter(t,35721),i=0;i<n;i++){var o=e.getActiveAttrib(t,i);if(!o)throw new Error("activeInfo");var a=o.name,u=o.type,c=e.getAttribLocation(t,a);if(c>=0){var p=oc(u),b=p.attributeType,g=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:c,stepMode:g,type:b})}}return r.sort(function(v,T){return v.location-T.location}),r}function _g(e,t){if(!K(e))return[];for(var r=e,n=[],i=e.getProgramParameter(t,35971),o=0;o<i;o++){var a=r.getTransformFeedbackVarying(t,o);if(!a)throw new Error("activeInfo");var u=a.name,c=a.type,p=a.size,b=ei(c),g=b.glType,v=b.components,T=new In({type:g,size:p*v}),S={location:o,name:u,accessor:T};n.push(S)}return n.sort(function(E,P){return E.location-P.location}),n}function bg(e,t){for(var r=[],n=e.getProgramParameter(t,35718),i=0;i<n;i++){var o=e.getActiveUniform(t,i);if(!o)throw new Error("activeInfo");var a=o.name,u=o.size,c=o.type,p=Tg(a),b=p.name,g=p.isArray,v=e.getUniformLocation(t,b),T={location:v,name:b,size:u,type:c,isArray:g};if(r.push(T),T.size>1)for(var S=0;S<T.size;S++){var E="".concat(b,"[").concat(S,"]");v=e.getUniformLocation(t,E);var P=fc(fc({},T),{},{name:E,location:v});r.push(P)}}return r}function gg(e,t){if(!K(e))return[];for(var r=e,n=function(P,O){return r.getActiveUniformBlockParameter(t,P,O)},i=[],o=r.getProgramParameter(t,35382),a=0;a<o;a++){for(var u={name:r.getActiveUniformBlockName(t,a)||"",location:n(a,35391),byteLength:n(a,35392),vertex:n(a,35396),fragment:n(a,35398),uniformCount:n(a,35394),uniforms:[]},c=n(a,35395)||[],p=r.getActiveUniforms(t,c,35383),b=r.getActiveUniforms(t,c,35384),g=r.getActiveUniforms(t,c,35387),v=r.getActiveUniforms(t,c,35388),T=0;T<u.uniformCount;++T){var S=r.getActiveUniform(t,c[T]);if(!S)throw new Error("activeInfo");u.uniforms.push({name:S.name,format:ei(p[T]).format,type:p[T],arrayLength:b[T],byteOffset:g[T],byteStride:v[T]})}i.push(u)}return i.sort(function(E,P){return E.location-P.location}),i}var vg=(ie={},ue(ie,35678,["2d","float"]),ue(ie,35680,["cube","float"]),ue(ie,35679,["3d","float"]),ue(ie,35682,["3d","depth"]),ue(ie,36289,["2d-array","float"]),ue(ie,36292,["2d-array","depth"]),ue(ie,36293,["cube","float"]),ue(ie,36298,["2d","sint"]),ue(ie,36299,["3d","sint"]),ue(ie,36300,["cube","sint"]),ue(ie,36303,["2d-array","uint"]),ue(ie,36306,["2d","uint"]),ue(ie,36307,["3d","uint"]),ue(ie,36308,["cube","uint"]),ue(ie,36311,["2d-array","uint"]),ie);function mg(e){var t=vg[e];if(!t)throw new Error("sampler");var r=ug(t,2),n=r[0],i=r[1];return{viewDimension:n,sampleType:i}}function Tg(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};var t=/([^[]*)(\[[0-9]+\])?/,r=t.exec(e);if(!r||r.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(e));return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function uc(e,t,r,n){var i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);var a=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,a);case 35664:return e.uniform2fv(t,a);case 35665:return e.uniform3fv(t,a);case 35666:return e.uniform4fv(t,a);case 5124:return e.uniform1iv(t,a);case 35667:return e.uniform2iv(t,a);case 35668:return e.uniform3iv(t,a);case 35669:return e.uniform4iv(t,a);case 35670:return e.uniform1iv(t,a);case 35671:return e.uniform2iv(t,a);case 35672:return e.uniform3iv(t,a);case 35673:return e.uniform4iv(t,a);case 5125:return i.uniform1uiv(t,a,1);case 36294:return i.uniform2uiv(t,a,2);case 36295:return i.uniform3uiv(t,a,3);case 36296:return i.uniform4uiv(t,a,4);case 35674:return e.uniformMatrix2fv(t,!1,a);case 35675:return e.uniformMatrix3fv(t,!1,a);case 35676:return e.uniformMatrix4fv(t,!1,a);case 35685:return i.uniformMatrix2x3fv(t,!1,a);case 35686:return i.uniformMatrix2x4fv(t,!1,a);case 35687:return i.uniformMatrix3x2fv(t,!1,a);case 35688:return i.uniformMatrix3x4fv(t,!1,a);case 35689:return i.uniformMatrix4x2fv(t,!1,a);case 35690:return i.uniformMatrix4x3fv(t,!1,a)}throw new Error("Illegal uniform")}function cc(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(e)}}function sc(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(e)}}function Pt(e){return Pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pt(e)}function lc(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_c(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
46
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function pc(e,t){return Rg(e)||Ag(e,t)||_c(e,t)||Sg()}function Sg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
47
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _c(e,t){if(e){if(typeof e=="string")return dc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dc(e,t)}}function dc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ag(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Rg(e){if(Array.isArray(e))return e}function hc(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Eg(n.key),n)}}function Og(e,t,r){return t&&hc(e.prototype,t),r&&hc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Eg(e){var t=wg(e,"string");return Pt(t)==="symbol"?t:String(t)}function wg(e,t){if(Pt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Pt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Pg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ig(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ti(e,t)}function ti(e,t){return ti=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ti(e,t)}function Ng(e){var t=Bg();return function(){var n=xn(e),i;if(t){var o=xn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return xg(this,i)}}function xg(e,t){if(t&&(Pt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Cg(e)}function Cg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bg(){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 xn(e){return xn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xn(e)}var yc=4,Cn=function(e){Ig(r,e);var t=Ng(r);function r(i,o){var a;Pg(this,r),a=t.call(this,i,o),a.device=void 0,a.handle=void 0,a.vs=void 0,a.fs=void 0,a.introspectedLayout=void 0,a.uniforms={},a.bindings={},a.varyings=null,a._uniformCount=0,a._uniformSetters={},a.device=i,a.handle=a.props.handle||a.device.gl.createProgram(),a.device.setSpectorMetadata(a.handle,{id:a.props.id}),a.vs=o.vs,a.fs=o.fs;var u=o.varyings,c=o.bufferMode,p=c===void 0?35981:c;if(u&&u.length>0){var b;a.device.assertWebGL2(),a.varyings=u,(b=a.device.gl2)===null||b===void 0||b.transformFeedbackVaryings(a.handle,u,p)}switch(a._compileAndLink(),a.introspectedLayout=Nn(a.device.gl,a.handle),a.shaderLayout=uo(a.introspectedLayout,o.shaderLayout),a.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":D.warn("Primitive topology ".concat(a.props.topology," is deprecated and will be removed in v9.1"));break;default:}return a}var n=r.prototype;return n.destroy=function(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)},n.setBindings=function(o){for(var a=this,u=function(){var v=pc(p[c],2),T=v[0],S=v[1],E=a.shaderLayout.bindings.find(function(O){return O.name===T})||a.shaderLayout.bindings.find(function(O){return O.name==="".concat(T,"Uniforms")});if(!E){var P=a.shaderLayout.bindings.map(function(O){return'"'.concat(O.name,'"')}).join(", ");return D.warn('Unknown binding "'.concat(T,'" in render pipeline "').concat(a.id,'", expected one of ').concat(P))(),"continue"}switch(S||D.warn('Unsetting binding "'.concat(T,'" in render pipeline "').concat(a.id,'"'))(),E.type){case"uniform":if(!(S instanceof pe)&&!(S.buffer instanceof pe))throw new Error("buffer value");break;case"texture":if(!(S instanceof se||S instanceof Pe))throw new Error("texture value");break;case"sampler":D.warn("Ignoring sampler ".concat(T))();break;default:throw new Error(E.type)}a.bindings[T]=S},c=0,p=Object.entries(o);c<p.length;c++)var b=u()},n.setUniforms=function(o){var a=ho(o),u=a.bindings;Object.keys(u).forEach(function(c){D.warn('Unsupported value "'.concat(JSON.stringify(u[c]),'" used in setUniforms() for key ').concat(c,". Use setBindings() instead?"))()}),Object.assign(this.uniforms,o)},n.draw=function(o){var a,u=this,c=o.renderPass,p=o.vertexArray,b=o.vertexCount,g=o.instanceCount,v=o.firstVertex,T=v===void 0?0:v,S=o.transformFeedback,E=cc(this.props.topology),P=Boolean(p.indexBuffer),O=(a=p.indexBuffer)===null||a===void 0?void 0:a.glIndexType,w=Number(g)>0;if(!this._areTexturesRenderable()||b===0)return!1;this.device.gl.useProgram(this.handle),p.bindBeforeRender(c),S&&S.begin(this.props.topology),this._applyBindings(),this._applyUniforms();var x=c;return Qf(this.device,this.props.parameters,x.glParameters,function(){if(P&&w){var N;(N=u.device.gl2)===null||N===void 0||N.drawElementsInstanced(E,b||0,O,T,g||0)}else if(P)u.device.gl.drawElements(E,b||0,O,T);else if(w){var X;(X=u.device.gl2)===null||X===void 0||X.drawArraysInstanced(E,T,b||0,g||0)}else u.device.gl.drawArrays(E,T,b||0);S&&S.end()}),p.unbindAfterRender(c),!0},n._compileAndLink=function(){var o=this.device.gl;o.attachShader(this.handle,this.vs.handle),o.attachShader(this.handle,this.fs.handle),D.time(yc,"linkProgram for ".concat(this.id))(),o.linkProgram(this.handle),D.timeEnd(yc,"linkProgram for ".concat(this.id))(),!o.debug&&D.level;var a=o.getProgramParameter(this.handle,35714);if(!a)throw new Error("Error linking: ".concat(o.getProgramInfoLog(this.handle)));o.validateProgram(this.handle);var u=o.getProgramParameter(this.handle,35715);if(!u)throw new Error("Error validating: ".concat(o.getProgramInfoLog(this.handle)))},n._areTexturesRenderable=function(){for(var o=!0,a=0,u=Object.entries(this.bindings);a<u.length;a++){var c=pc(u[a],2),p=c[1];p instanceof se&&(p.update(),o=o&&p.loaded)}return o},n._applyBindings=function(){this.device.gl.useProgram(this.handle);var o=this.device.gl2;if(!o)throw new Error("bindings");var a=0,u=0,c=lc(this.shaderLayout.bindings),p;try{for(c.s();!(p=c.n()).done;){var b=p.value,g=this.bindings[b.name]||this.bindings[b.name.replace(/Uniforms$/,"")];if(!g)throw new Error("No value for binding ".concat(b.name," in ").concat(this.id));switch(b.type){case"uniform":var v=b.name,T=o.getUniformBlockIndex(this.handle,v);if(T===4294967295)throw new Error("Invalid uniform block name ".concat(v));o.uniformBlockBinding(this.handle,u,T),g instanceof pe?o.bindBufferBase(35345,u,g.handle):o.bindBufferRange(35345,u,g.buffer.handle,g.offset||0,g.size||g.buffer.byteLength-g.offset),u+=1;break;case"texture":if(!(g instanceof se||g instanceof Pe))throw new Error("texture");var S=void 0;if(g instanceof se)S=g;else if(g instanceof Pe&&g.colorAttachments[0]instanceof se)D.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),S=g.colorAttachments[0];else throw new Error("No texture");o.activeTexture(33984+a),o.bindTexture(S.target,S.handle),a+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error("binding type '".concat(b.type,"' not supported in WebGL"))}}}catch(E){c.e(E)}finally{c.f()}},n._applyUniforms=function(){var o=lc(this.shaderLayout.uniforms||[]),a;try{for(o.s();!(a=o.n()).done;){var u,c=a.value,p=c.name,b=c.location,g=c.type,v=c.textureUnit,T=(u=this.uniforms[p])!==null&&u!==void 0?u:v;T!==void 0&&uc(this.device.gl,b,g,T)}}catch(S){o.e(S)}finally{o.f()}},Og(r)}(Hr);function It(e){return It=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(e)}function Fg(e,t){return Ug(e)||Mg(e,t)||vc(e,t)||Dg()}function Dg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
48
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mg(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,i,o,a,u=[],c=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);c=!0);}catch(b){p=!0,i=b}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(p)throw i}}return u}}function Ug(e){if(Array.isArray(e))return e}function jg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=vc(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
49
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function vc(e,t){if(e){if(typeof e=="string")return bc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bc(e,t)}}function bc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gc(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hg(n.key),n)}}function Wg(e,t,r){return t&&gc(e.prototype,t),r&&gc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hg(e){var t=Xg(e,"string");return It(t)==="symbol"?t:String(t)}function Xg(e,t){if(It(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(It(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ri(e,t)}function ri(e,t){return ri=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ri(e,t)}function Lg(e){var t=zg();return function(){var n=Bn(e),i;if(t){var o=Bn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Kg(this,i)}}function Kg(e,t){if(t&&(It(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Yg(e)}function Yg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function zg(){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 Bn(e){return Bn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Bn(e)}var mc=function(e){kg(r,e);var t=Lg(r);function r(i){var o;return Vg(this,r),o=t.call(this,i,{}),o.device=void 0,o.commands=[],o.device=i,o}var n=r.prototype;return n.submitCommands=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.commands,a=jg(o),u;try{for(a.s();!(u=a.n()).done;){var c=u.value;switch(c.name){case"copy-buffer-to-buffer":$g(this.device,c.options);break;case"copy-buffer-to-texture":Zg(this.device,c.options);break;case"copy-texture-to-buffer":Qg(this.device,c.options);break;case"copy-texture-to-texture":qg(this.device,c.options);break}}}catch(p){a.e(p)}finally{a.f()}},Wg(r)}(Yr);function $g(e,t){var r=t.source,n=t.destination,i=e.assertWebGL2();if(i){var o,a;i.bindBuffer(36662,r.handle),i.bindBuffer(36663,n.handle),i.copyBufferSubData(36662,36663,(o=t.sourceOffset)!==null&&o!==void 0?o:0,(a=t.destinationOffset)!==null&&a!==void 0?a:0,t.size),i.bindBuffer(36662,null),i.bindBuffer(36663,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function Zg(e,t){throw new Error("Not implemented")}function Qg(e,t){var r=t.source,n=t.mipLevel,i=n===void 0?0:n,o=t.aspect,a=o===void 0?"all":o,u=t.width,c=u===void 0?t.source.width:u,p=t.height,b=p===void 0?t.source.height:p,g=t.depthOrArrayLayers,v=g===void 0?0:g,T=t.origin,S=T===void 0?[0,0]:T,E=t.destination,P=t.byteOffset,O=P===void 0?0:P,w=t.bytesPerRow,x=t.rowsPerImage;if(a!=="all")throw new Error("not supported");if(i!==0||v!==0||w||x)throw new Error("not implemented");var N=e.assertWebGL2(),X=Tc(r),M=X.framebuffer,Y=X.destroyFramebuffer;try{var W=E,V=c||M.width,j=b||M.height,L=_t(M.texture.format,!0),l=L.dataFormat,f=L.type;N.bindBuffer(35051,W.handle),N.bindFramebuffer(36160,M.handle),N.readPixels(S[0],S[1],V,j,l,f,O)}finally{N.bindBuffer(35051,null),N.bindFramebuffer(36160,null),Y&&M.destroy()}}function qg(e,t){var r=t.source,n=t.origin,i=n===void 0?[0,0]:n,o=t.destination,a=t.width,u=a===void 0?t.destination.width:a,c=t.height,p=c===void 0?t.destination.width:c,b=0,g=6408,v=Tc(r),T=v.framebuffer,S=v.destroyFramebuffer,E=Fg(i,2),P=E[0],O=E[1],w=!1;e.gl.bindFramebuffer(36160,T.handle);var x=null,N;if(o instanceof se)x=o,u=Number.isFinite(u)?u:x.width,p=Number.isFinite(p)?p:x.height,x.bind(0),N=x.destination;else throw new Error("whoops");return w||e.gl.copyTexImage2D(N,b,g,P,O,u,p,0),x&&x.unbind(),S&&T.destroy(),x}function Tc(e){if(e instanceof ae){var t=e.width,r=e.height,n=e.id,i=e.device.createFramebuffer({id:"framebuffer-for-".concat(n),width:t,height:r,colorAttachments:[e]});return{framebuffer:i,destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}function Nt(e){return Nt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nt(e)}function Sc(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Gg(n.key),n)}}function Jg(e,t,r){return t&&Sc(e.prototype,t),r&&Sc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gg(e){var t=ev(e,"string");return Nt(t)==="symbol"?t:String(t)}function ev(e,t){if(Nt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Nt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rv(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ni(e,t)}function ni(e,t){return ni=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ni(e,t)}function nv(e){var t=av();return function(){var n=Fn(e),i;if(t){var o=Fn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ov(this,i)}}function ov(e,t){if(t&&(Nt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iv(e)}function iv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function av(){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(e){return Fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Fn(e)}var Dn=function(e){rv(r,e);var t=nv(r);function r(i,o){var a;return tv(this,r),a=t.call(this,i,o),a.device=void 0,a.commandBuffer=void 0,a.device=i,a.commandBuffer=new mc(i),a}var n=r.prototype;return n.destroy=function(){},n.finish=function(){this.commandBuffer.submitCommands()},n.copyBufferToBuffer=function(o){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:o})},n.copyBufferToTexture=function(o){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:o})},n.copyTextureToBuffer=function(o){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:o})},n.copyTextureToTexture=function(o){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:o})},n.pushDebugGroup=function(o){},n.popDebugGroup=function(){},n.insertDebugMarker=function(o){},Jg(r)}(Lr);function xt(e){return xt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(e)}var Rc;function fv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ac(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,cv(n.key),n)}}function uv(e,t,r){return t&&Ac(e.prototype,t),r&&Ac(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function cv(e){var t=sv(e,"string");return xt(t)==="symbol"?t:String(t)}function sv(e,t){if(xt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(xt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mn(){return typeof Reflect<"u"&&Reflect.get?Mn=Reflect.get.bind():Mn=function(t,r,n){var i=lv(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},Mn.apply(this,arguments)}function lv(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ct(e),e!==null););return e}function pv(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&oi(e,t)}function oi(e,t){return oi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},oi(e,t)}function dv(e){var t=_v();return function(){var n=Ct(e),i;if(t){var o=Ct(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return hv(this,i)}}function hv(e,t){if(t&&(xt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yv(e)}function yv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _v(){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(e){return Ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ct(e)}Rc=Symbol.toStringTag;var Un=function(e){pv(r,e);var t=dv(r);r.isConstantAttributeZeroSupported=function(o){return o.info.type==="webgl2"||Rr()==="Chrome"};function r(i,o){var a;return fv(this,r),a=t.call(this,i,o),a.device=void 0,a.handle=void 0,a.buffer=null,a.bufferValue=null,a.init=!1,a.device=i,a.handle=a.device.gl2.createVertexArray(),a}var n=r.prototype;return n.destroy=function(){if(Mn(Ct(r.prototype),"destroy",this).call(this),this.buffer){var o;(o=this.buffer)===null||o===void 0||o.destroy()}this.handle&&(this.device.gl2.deleteVertexArray(this.handle),this.handle=void 0)},n.setIndexBuffer=function(o){var a=o;if(a&&a.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl2.bindVertexArray(this.handle),this.device.gl2.bindBuffer(34963,a?a.handle:null),this.indexBuffer=a},n.setBuffer=function(o,a){var u=a;if(u.glTarget===34963)throw new Error("Use .setIndexBuffer()");var c=this._getAccessor(o),p=c.size,b=c.type,g=c.stride,v=c.offset,T=c.normalized,S=c.integer,E=c.divisor;this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,u.handle),S?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(o,p,b,g,v)):this.device.gl.vertexAttribPointer(o,p,b,T,g,v),this.device.gl.enableVertexAttribArray(o),this.device.gl2.vertexAttribDivisor(o,E||0),this.attributes[o]=u},n.setConstant=function(o,a){this._enable(o,!1),this.attributes[o]=a},n.bindBeforeRender=function(){if(this.device.gl2.bindVertexArray(this.handle),!this.init){var o=this.indexBuffer;this.device.gl2.bindBuffer(34963,o?.handle||null),this.init=!0}this._applyConstantAttributes()},n.unbindAfterRender=function(){this.device.gl2.bindVertexArray(null)},n._applyConstantAttributes=function(){for(var o=0;o<this.maxVertexAttributes;++o){var a=this.attributes[o];ArrayBuffer.isView(a)&&this.device.setConstantAttribute(o,a)}},n._getAccessor=function(o){var a=this.attributeInfos[o];if(!a)throw new Error("Unknown attribute location ".concat(o));var u=an(a.bufferDataType);return{size:a.bufferComponents,type:u,stride:a.byteStride,offset:a.byteOffset,normalized:a.normalized,integer:a.integer,divisor:a.stepMode==="instance"?1:0}},n._enable=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,u=r.isConstantAttributeZeroSupported(this.device),c=u||o!==0;(a||c)&&(o=Number(o),this.device.gl2.bindVertexArray(this.handle),a?this.device.gl.enableVertexAttribArray(o):this.device.gl.disableVertexAttribArray(o),this.device.gl2.bindVertexArray(null))},n.getConstantBuffer=function(o,a){var u=bv(a),c=u.byteLength*o,p=u.length*o;if(this.buffer&&c!==this.buffer.byteLength)throw new Error("Buffer size is immutable, byte length ".concat(c," !== ").concat(this.buffer.byteLength,"."));var b=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:c}),b=b||!gv(u,this.bufferValue),b){var g=lo(a.constructor,p);po({target:g,source:u,start:0,count:p}),this.buffer.write(g),this.bufferValue=a}return this.buffer},uv(r,[{key:Rc,get:function(){return"VertexArray"}}]),r}(Zr);function bv(e){return Array.isArray(e)?new Float32Array(e):e}function gv(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}function Bt(e){return Bt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bt(e)}function vv(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=mv(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(p){throw p},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
50
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,u;return{s:function(){r=r.call(e)},n:function(){var p=r.next();return o=p.done,p},e:function(p){a=!0,u=p},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function mv(e,t){if(e){if(typeof e=="string")return Oc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Oc(e,t)}}function Oc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ec(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Sv(n.key),n)}}function Tv(e,t,r){return t&&Ec(e.prototype,t),r&&Ec(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sv(e){var t=Av(e,"string");return Bt(t)==="symbol"?t:String(t)}function Av(e,t){if(Bt(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Bt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jn(){return typeof Reflect<"u"&&Reflect.get?jn=Reflect.get.bind():jn=function(t,r,n){var i=Ov(t,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?t:n):o.value}},jn.apply(this,arguments)}function Ov(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ft(e),e!==null););return e}function Ev(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ii(e,t)}function ii(e,t){return ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ii(e,t)}function wv(e){var t=Iv();return function(){var n=Ft(e),i;if(t){var o=Ft(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pv(this,i)}}function Pv(e,t){if(t&&(Bt(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pc(e)}function Pc(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Iv(){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 Ft(e){return Ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ft(e)}var Wn=function(e){Ev(r,e);var t=wv(r);function r(i,o){var a;return Rv(this,r),a=t.call(this,i,o),a.device=void 0,a.gl2=void 0,a.handle=void 0,a.layout=void 0,a.buffers={},a.unusedBuffers={},a.bindOnUse=!0,a._bound=!1,i.assertWebGL2(),a.device=i,a.gl2=i.gl2,a.handle=a.props.handle||a.gl2.createTransformFeedback(),a.layout=a.props.layout,o.buffers&&a.setBuffers(o.buffers),Object.seal(Pc(a)),a}var n=r.prototype;return n.destroy=function(){this.gl2.deleteTransformFeedback(this.handle),jn(Ft(r.prototype),"destroy",this).call(this)},n.begin=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"point-list";this.gl2.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl2.beginTransformFeedback(sc(o))},n.end=function(){this.gl2.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl2.bindTransformFeedback(36386,null)},n.setBuffers=function(o){var a=this;this.buffers={},this.unusedBuffers={},this.bind(function(){for(var u in o)a.setBuffer(u,o[u])})},n.setBuffer=function(o,a){var u=this._getVaryingIndex(o),c=this._getBufferRange(a),p=c.buffer,b=c.byteLength,g=c.byteOffset;if(u<0){this.unusedBuffers[o]=p,D.warn("".concat(this.id," unusedBuffers varying buffer ").concat(o))();return}this.buffers[u]={buffer:p,byteLength:b,byteOffset:g},this.bindOnUse||this._bindBuffer(u,p,g,b)},n.getBuffer=function(o){if(wc(o))return this.buffers[o]||null;var a=this._getVaryingIndex(o);return a>=0?this.buffers[a]:null},n.bind=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof o!="function")return this.gl2.bindTransformFeedback(36386,o),this;var a;return this._bound?a=o():(this.gl2.bindTransformFeedback(36386,this.handle),this._bound=!0,a=o(),this._bound=!1,this.gl2.bindTransformFeedback(36386,null)),a},n.unbind=function(){this.bind(null)},n._getBufferRange=function(o){if(o instanceof pe)return{buffer:o,byteOffset:0,byteLength:o.byteLength};var a=o.buffer,u=o.byteOffset,c=u===void 0?0:u,p=o.byteLength,b=p===void 0?o.buffer.byteLength:p;return{buffer:a,byteOffset:c,byteLength:b}},n._getVaryingIndex=function(o){if(wc(o))return Number(o);var a=vv(this.layout.varyings),u;try{for(a.s();!(u=a.n()).done;){var c=u.value;if(o===c.name)return c.location}}catch(p){a.e(p)}finally{a.f()}return-1},n._bindBuffers=function(){for(var o in this.buffers){var a=this._getBufferRange(this.buffers[o]),u=a.buffer,c=a.byteLength,p=a.byteOffset;this._bindBuffer(Number(o),u,p,c)}},n._unbindBuffers=function(){for(var o in this.buffers)this.gl2.bindBufferBase(35982,Number(o),null)},n._bindBuffer=function(o,a){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,c=arguments.length>3?arguments[3]:void 0,p=a&&a.handle;!p||c===void 0?this.gl2.bindBufferBase(35982,o,p):this.gl2.bindBufferRange(35982,o,p,u,c)},Tv(r)}(qr);function wc(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}function ai(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return H(!1),0}}function Ic(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return H(!1),0}}function vr(e){return vr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vr(e)}function Nc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nc(Object(r),!0).forEach(function(n){Nv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Nv(e,t,r){return t=xv(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xv(e){var t=Cv(e,"string");return vr(t)==="symbol"?t:String(t)}function Cv(e,t){if(vr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(vr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hn(e,t){var r,n=t||{},i=n.sourceX,o=i===void 0?0:i,a=n.sourceY,u=a===void 0?0:a,c=n.sourceFormat,p=c===void 0?6408:c,b=n.sourceAttachment,g=b===void 0?36064:b,v=t||{},T=v.target,S=T===void 0?null:T,E=v.sourceWidth,P=v.sourceHeight,O=v.sourceType,w=fi(e),x=w.framebuffer,N=w.deleteFramebuffer;H(x);var X=x,M=X.gl,Y=X.handle;E=E||x.width,P=P||x.height;var W=g-36064;O=O||((r=x.colorAttachments[W])===null||r===void 0?void 0:r.type)||5121,S=Fv(S,O,p,E,P),O=O||Ju(S);var V=M.bindFramebuffer(36160,Y);return M.readPixels(o,u,E,P,p,O,S),M.bindFramebuffer(36160,V||null),N&&x.destroy(),S}function Xn(e,t){var r=t||{},n=r.target,i=r.sourceX,o=i===void 0?0:i,a=r.sourceY,u=a===void 0?0:a,c=r.sourceFormat,p=c===void 0?6408:c,b=r.targetByteOffset,g=b===void 0?0:b,v=t||{},T=v.sourceWidth,S=v.sourceHeight,E=v.sourceType,P=fi(e),O=P.framebuffer,w=P.deleteFramebuffer;H(O),T=T||O.width,S=S||O.height;var x=O;E=E||5121;var N=n;if(!N){var X=ai(p),M=Ic(E),Y=g+T*S*X*M;N=x.device.createBuffer({byteLength:Y})}var W=e.device.createCommandEncoder();return W.copyTextureToBuffer({source:e,width:T,height:S,origin:[o,u],destination:N,byteOffset:g}),W.destroy(),w&&O.destroy(),N}function Cc(e,t,r){var n=r||{},i=n.sourceX,o=i===void 0?0:i,a=n.sourceY,u=a===void 0?0:a,c=n.targetMipmaplevel,p=c===void 0?0:c,b=n.targetInternalFormat,g=b===void 0?6408:b,v=r||{},T=v.targetX,S=v.targetY,E=v.targetZ,P=v.width,O=v.height,w=fi(e),x=w.framebuffer,N=w.deleteFramebuffer;H(x);var X=x,M=X.device,Y=X.handle,W=typeof T<"u"||typeof S<"u"||typeof E<"u";T=T||0,S=S||0,E=E||0;var V=M.gl.bindFramebuffer(36160,Y);H(t);var j=null,L;if(t instanceof ae?(j=t,P=Number.isFinite(P)?P:j.width,O=Number.isFinite(O)?O:j.height,j.bind(0),L=j.target):L=t,!W)M.gl.copyTexImage2D(L,p,g,o,u,P,O,0);else switch(L){case 3553:case 34067:M.gl.copyTexSubImage2D(L,p,T,S,o,u,P,O);break;case 35866:case 32879:M.assertWebGL2(),M.gl2.copyTexSubImage3D(L,p,T,S,E,o,u,P,O);break;default:}return j&&j.unbind(),M.gl.bindFramebuffer(36160,V||null),N&&x.destroy(),j}function fi(e){return e instanceof ot?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:Bv(e),deleteFramebuffer:!0}}function Bv(e,t){var r=e.device,n=e.width,i=e.height,o=e.id,a=r.createFramebuffer(xc(xc({},t),{},{id:"framebuffer-for-".concat(o),width:n,height:i,colorAttachments:[e]}));return a}function Fv(e,t,r,n,i){if(e)return e;t=t||5121;var o=yr(t,{clamped:!1}),a=ai(r);return new o(n*i*a)}function Ke(e){return Ke=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ke(e)}function Bc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function me(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bc(Object(r),!0).forEach(function(n){Dv(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dv(e,t,r){return t=Mc(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ui(){"use strict";ui=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(l,f,s){l[f]=s.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(l,f,s){return Object.defineProperty(l,f,{value:s,enumerable:!0,configurable:!0,writable:!0}),l[f]}try{c({},"")}catch{c=function(s,d,y){return s[d]=y}}function p(l,f,s,d){var y=f&&f.prototype instanceof v?f:v,h=Object.create(y.prototype),m=new V(d||[]);return n(h,"_invoke",{value:X(l,s,m)}),h}function b(l,f,s){try{return{type:"normal",arg:l.call(f,s)}}catch(d){return{type:"throw",arg:d}}}e.wrap=p;var g={};function v(){}function T(){}function S(){}var E={};c(E,o,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(j([])));O&&O!==t&&r.call(O,o)&&(E=O);var w=S.prototype=v.prototype=Object.create(E);function x(l){["next","throw","return"].forEach(function(f){c(l,f,function(s){return this._invoke(f,s)})})}function N(l,f){function s(y,h,m,A){var R=b(l[y],l,h);if(R.type!=="throw"){var F=R.arg,C=F.value;return C&&Ke(C)=="object"&&r.call(C,"__await")?f.resolve(C.__await).then(function(U){s("next",U,m,A)},function(U){s("throw",U,m,A)}):f.resolve(C).then(function(U){F.value=U,m(F)},function(U){return s("throw",U,m,A)})}A(R.arg)}var d;n(this,"_invoke",{value:function(h,m){function A(){return new f(function(R,F){s(h,m,R,F)})}return d=d?d.then(A,A):A()}})}function X(l,f,s){var d="suspendedStart";return function(y,h){if(d==="executing")throw new Error("Generator is already running");if(d==="completed"){if(y==="throw")throw h;return L()}for(s.method=y,s.arg=h;;){var m=s.delegate;if(m){var A=M(m,s);if(A){if(A===g)continue;return A}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(d==="suspendedStart")throw d="completed",s.arg;s.dispatchException(s.arg)}else s.method==="return"&&s.abrupt("return",s.arg);d="executing";var R=b(l,f,s);if(R.type==="normal"){if(d=s.done?"completed":"suspendedYield",R.arg===g)continue;return{value:R.arg,done:s.done}}R.type==="throw"&&(d="completed",s.method="throw",s.arg=R.arg)}}}function M(l,f){var s=f.method,d=l.iterator[s];if(d===void 0)return f.delegate=null,s==="throw"&&l.iterator.return&&(f.method="return",f.arg=void 0,M(l,f),f.method==="throw")||s!=="return"&&(f.method="throw",f.arg=new TypeError("The iterator does not provide a '"+s+"' method")),g;var y=b(d,l.iterator,f.arg);if(y.type==="throw")return f.method="throw",f.arg=y.arg,f.delegate=null,g;var h=y.arg;return h?h.done?(f[l.resultName]=h.value,f.next=l.nextLoc,f.method!=="return"&&(f.method="next",f.arg=void 0),f.delegate=null,g):h:(f.method="throw",f.arg=new TypeError("iterator result is not an object"),f.delegate=null,g)}function Y(l){var f={tryLoc:l[0]};1 in l&&(f.catchLoc=l[1]),2 in l&&(f.finallyLoc=l[2],f.afterLoc=l[3]),this.tryEntries.push(f)}function W(l){var f=l.completion||{};f.type="normal",delete f.arg,l.completion=f}function V(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Y,this),this.reset(!0)}function j(l){if(l){var f=l[o];if(f)return f.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,d=function y(){for(;++s<l.length;)if(r.call(l,s))return y.value=l[s],y.done=!1,y;return y.value=void 0,y.done=!0,y};return d.next=d}}return{next:L}}function L(){return{value:void 0,done:!0}}return T.prototype=S,n(w,"constructor",{value:S,configurable:!0}),n(S,"constructor",{value:T,configurable:!0}),T.displayName=c(S,u,"GeneratorFunction"),e.isGeneratorFunction=function(l){var f=typeof l=="function"&&l.constructor;return!!f&&(f===T||(f.displayName||f.name)==="GeneratorFunction")},e.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,S):(l.__proto__=S,c(l,u,"GeneratorFunction")),l.prototype=Object.create(w),l},e.awrap=function(l){return{__await:l}},x(N.prototype),c(N.prototype,a,function(){return this}),e.AsyncIterator=N,e.async=function(l,f,s,d,y){y===void 0&&(y=Promise);var h=new N(p(l,f,s,d),y);return e.isGeneratorFunction(f)?h:h.next().then(function(m){return m.done?m.value:h.next()})},x(w),c(w,u,"Generator"),c(w,o,function(){return this}),c(w,"toString",function(){return"[object Generator]"}),e.keys=function(l){var f=Object(l),s=[];for(var d in f)s.push(d);return s.reverse(),function y(){for(;s.length;){var h=s.pop();if(h in f)return y.value=h,y.done=!1,y}return y.done=!0,y}},e.values=j,V.prototype={constructor:V,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(W),!f)for(var s in this)s.charAt(0)==="t"&&r.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=void 0)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var s=this;function d(F,C){return m.type="throw",m.arg=f,s.next=F,C&&(s.method="next",s.arg=void 0),!!C}for(var y=this.tryEntries.length-1;y>=0;--y){var h=this.tryEntries[y],m=h.completion;if(h.tryLoc==="root")return d("end");if(h.tryLoc<=this.prev){var A=r.call(h,"catchLoc"),R=r.call(h,"finallyLoc");if(A&&R){if(this.prev<h.catchLoc)return d(h.catchLoc,!0);if(this.prev<h.finallyLoc)return d(h.finallyLoc)}else if(A){if(this.prev<h.catchLoc)return d(h.catchLoc,!0)}else{if(!R)throw new Error("try statement without catch or finally");if(this.prev<h.finallyLoc)return d(h.finallyLoc)}}}},abrupt:function(f,s){for(var d=this.tryEntries.length-1;d>=0;--d){var y=this.tryEntries[d];if(y.tryLoc<=this.prev&&r.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var h=y;break}}h&&(f==="break"||f==="continue")&&h.tryLoc<=s&&s<=h.finallyLoc&&(h=null);var m=h?h.completion:{};return m.type=f,m.arg=s,h?(this.method="next",this.next=h.finallyLoc,g):this.complete(m)},complete:function(f,s){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&s&&(this.next=s),g},finish:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.finallyLoc===f)return this.complete(d.completion,d.afterLoc),W(d),g}},catch:function(f){for(var s=this.tryEntries.length-1;s>=0;--s){var d=this.tryEntries[s];if(d.tryLoc===f){var y=d.completion;if(y.type==="throw"){var h=y.arg;W(d)}return h}}throw new Error("illegal catch attempt")},delegateYield:function(f,s,d){return this.delegate={iterator:j(f),resultName:s,nextLoc:d},this.method==="next"&&(this.arg=void 0),g}},e}function Fc(e,t,r,n,i,o,a){try{var u=e[o](a),c=u.value}catch(p){r(p);return}u.done?t(c):Promise.resolve(c).then(n,i)}function Mv(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(c){Fc(o,n,i,a,u,"next",c)}function u(c){Fc(o,n,i,a,u,"throw",c)}a(void 0)})}}function Uv(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dc(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Mc(n.key),n)}}function jv(e,t,r){return t&&Dc(e.prototype,t),r&&Dc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mc(e){var t=Wv(e,"string");return Ke(t)==="symbol"?t:String(t)}function Wv(e,t){if(Ke(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ke(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hv(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ci(e,t)}function ci(e,t){return ci=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ci(e,t)}function Xv(e){var t=kv();return function(){var n=Vn(e),i;if(t){var o=Vn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Vv(this,i)}}function Vv(e,t){if(t&&(Ke(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return si(e)}function si(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kv(){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 Vn(e){return Vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vn(e)}var mr=1,le=function(e){Hv(r,e);var t=Xv(r);r.isSupported=function(){return typeof WebGLRenderingContext<"u"||hi()},r.attach=function(o){if(o instanceof r)return o;if(o?.device instanceof Je)return o.device;if(!Lv(o))throw new Error("Invalid WebGLRenderingContext");return new r({gl:o})},r.create=function(){var i=Mv(ui().mark(function a(){var u,c,p,b,g=arguments;return ui().wrap(function(T){for(;;)switch(T.prev=T.next){case 0:if(u=g.length>0&&g[0]!==void 0?g[0]:{},D.groupCollapsed(mr,"WebGLDevice created")(),typeof u.canvas!="string"){T.next=5;break}return T.next=5,Ge.pageLoaded;case 5:if(!(D.get("debug")||u.debug)){T.next=8;break}return T.next=8,Hu();case 8:if(c=u.spector,!(D.get("spector")||c)){T.next=12;break}return T.next=12,xu();case 12:if(D.probe(mr+1,"DOM is loaded")(),!(u.gl&&u.gl.device)){T.next=15;break}return T.abrupt("return",r.attach(u.gl));case 15:return p=new r(u),b="Created ".concat(p.info.type).concat(p.debug?" debug":""," context: ").concat(p.info.vendor,", ").concat(p.info.renderer," for canvas: ").concat(p.canvasContext.id),D.probe(mr,b)(),D.table(mr,p.info)(),D.groupEnd(mr)(),T.abrupt("return",p);case 21:case"end":return T.stop()}},a)}));function o(){return i.apply(this,arguments)}return o}();function r(i){var o,a,u;Uv(this,r),u=t.call(this,me(me({},i),{},{id:i.id||Te("webgl-device")})),u.info=void 0,u.canvasContext=void 0,u.handle=void 0,u.lost=void 0,u._resolveContextLost=void 0,u._features=void 0,u._limits=void 0,u.renderPass=null,u.gl=void 0,u.gl2=null,u.debug=!1,u.isWebGL1=void 0,u.isWebGL2=void 0,u._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},u._extensions={},u._polyfilled=!1,u.spector=void 0,u._webglLimits=void 0,u._constants=void 0;var c=(o=i.gl)===null||o===void 0?void 0:o.device;if(c)throw new Error("WebGL context already attached to device ".concat(c.id));var p=i.canvas||((a=i.gl)===null||a===void 0?void 0:a.canvas);u.canvasContext=new An(si(u),me(me({},i),{},{canvas:p})),u.lost=new Promise(function(O){u._resolveContextLost=O});var b=function(w){var x,N;return(x=(N=u)._resolveContextLost)===null||x===void 0?void 0:x.call(N,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},g=i.gl||null;if(g=g||(G()?Cf(u.canvasContext.canvas,me(me({},i),{},{onContextLost:b})):null),g=g||(G()?null:yi(me(me({},i),{},{onContextLost:b}))),!g)throw new Error("WebGL context creation failed");u.handle=g,u.gl=u.handle,u.gl2=u.gl,u.isWebGL2=Kv(u.gl),u.isWebGL1=!u.isWebGL2,u.canvasContext.resize(),u.info=Bf(u.gl),u.gl.device=si(u),u.gl._version=u.isWebGL2?2:1,nn(u.gl);var v=i.enable,T=v===void 0?!0:v,S=i.copyState,E=S===void 0?!1:S;if(rr(u.gl,{enable:T,copyState:E,log:function(){for(var w=arguments.length,x=new Array(w),N=0;N<w;N++)x[N]=arguments[N];return D.log.apply(D,[1].concat(x))()}}),G()&&i.debug&&(u.gl=Xu(u.gl,me(me({},i),{},{webgl2:u.isWebGL2,throwOnError:!0})),u.gl2=u.gl,u.debug=!0,D.level=Math.max(D.level,1),D.warn("WebGL debug mode activated. Performance reduced.")()),G()&&i.spector){var P=u.handle.canvas||i.canvas;u.spector=Cu(me(me({},u.props),{},{canvas:P}))}return u}var n=r.prototype;return n.destroy=function(){var o=this.gl.getExtension("STACKGL_destroy_context");o&&o.destroy()},n.getSize=function(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]},n.isTextureFormatSupported=function(o){return ur(this.gl,o)},n.isTextureFormatFilterable=function(o){return Hf(this.gl,o)},n.isTextureFormatRenderable=function(o){return Xf(this.gl,o)},n.assertWebGL2=function(){if(!this.gl2)throw new Error("Requires WebGL2");return this.gl2},n.createCanvasContext=function(o){throw new Error("WebGL only supports a single canvas")},n.createBuffer=function(o){var a=this._getBufferProps(o);return new pe(this,a)},n._createTexture=function(o){return new se(this,o)},n.createExternalTexture=function(o){throw new Error("createExternalTexture() not implemented")},n.createSampler=function(o){return new Ve(this,o)},n.createShader=function(o){return new On(this,o)},n.createFramebuffer=function(o){return new Pe(this,o)},n.createRenderPipeline=function(o){return new Cn(this,o)},n.createVertexArray=function(o){return new Un(this,o)},n.beginRenderPass=function(o){return new wn(this,o)},n.createComputePipeline=function(o){throw new Error("ComputePipeline not supported in WebGL")},n.beginComputePass=function(o){throw new Error("ComputePass not supported in WebGL")},n.createTransformFeedback=function(o){return new Wn(this,o)},n.getDefaultRenderPass=function(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass},n.createCommandEncoder=function(o){return new Dn(this,o)},n.submit=function(){var o;(o=this.renderPass)===null||o===void 0||o.end(),this.renderPass=null},n.readPixelsToArrayWebGL=function(o,a){return Hn(o,a)},n.readPixelsToBufferWebGL2=function(o,a){return Xn(o,a)},n.loseDevice=function(){var o,a=!1,u=this.gl.getExtension("WEBGL_lose_context");return u&&(a=!0,u.loseContext()),(o=this._resolveContextLost)===null||o===void 0||o.call(this,{reason:"destroyed",message:"Application triggered context loss"}),a},n.pushState=function(){Se(this.gl)},n.popState=function(){ge(this.gl)},n.setSpectorMetadata=function(o,a){o.__SPECTOR_Metadata=a},n.getGLKey=function(o,a){a=a||this.gl2||this.gl;var u=Number(o);for(var c in a)if(a[c]===u)return"GL.".concat(c);return String(o)},n.setConstantAttribute=function(o,a){this._constants=this._constants||new Array(this.limits.maxVertexAttributes).fill(null);var u=this._constants[o];switch(u&&Zv(u,a)&&D.info(1,"setConstantAttribute(".concat(o,") could have been skipped, value unchanged"))(),this._constants[o]=a,a.constructor){case Float32Array:Yv(this,o,a);break;case Int32Array:zv(this,o,a);break;case Uint32Array:$v(this,o,a);break;default:H(!1)}},jv(r,[{key:"features",get:function(){return this._features=this._features||Kf(this.gl),this._features}},{key:"limits",get:function(){return this._limits=this._limits||zf(this.gl),this._limits}},{key:"isLost",get:function(){return this.gl.isContextLost()}},{key:"webglLimits",get:function(){return this._webglLimits=this._webglLimits||$f(this.gl),this._webglLimits}}]),r}(Je);le.type="webgl";function Lv(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function Kv(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Yv(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:H(!1)}}function zv(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function $v(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function Zv(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Qv=256,qv=1024,Jv=16384;var Gv="clear: bad arguments";function Uc(e,t){var r=le.attach(e),n=t||{},i=n.framebuffer,o=i===void 0?null:i,a=n.color,u=a===void 0?null:a,c=n.depth,p=c===void 0?null:c,b=n.stencil,g=b===void 0?null:b,v={};o&&(v.framebuffer=o);var T=0;u&&(T|=Jv,u!==!0&&(v.clearColor=u)),p&&(T|=Qv,p!==!0&&(v.clearDepth=p)),g&&(T|=qv,p!==!0&&(v.clearStencil=p)),H(T!==0,Gv),ve(r.gl,v,function(){r.gl.clear(T)})}return Kc(em);})();
15
+ ${i}
16
+ </pre></code>`,a.style.top="10px",a.style.left="10px",a.style.position="absolute",a.style.zIndex="9999",a.style.width="100%",a.style.textAlign="left",document.body.appendChild(a);let c=document.getElementsByClassName("luma-compiler-log-error");c[0]?.scrollIntoView&&c[0].scrollIntoView(),a.onclick=()=>{let l=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(l)}}},Fe=nr;E(Fe,"defaultProps",{..._.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function ji(t){return rr(t.source).name||t.id||ee(`unnamed ${t.stage}-shader`)}var ir=class extends _{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,ir.defaultProps)}},Be=ir;E(Be,"defaultProps",{..._.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var or=class extends _{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,or.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[n,i]=Array.isArray(e)?e:[e.width,e.height];r=r||i!==this.height||n!==this.width,this.width=n,this.height=i}r&&(f.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(r=>{if(typeof r=="string"){let n=this.createColorTexture(r);return this.attachResource(n),n.view}return r instanceof I?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof I?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:I.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:I.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let i=this.device._createTexture({...this.colorAttachments[n].props,width:e,height:r});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=i.view,this.attachResource(i.view)}if(this.depthStencilAttachment){let n=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}}},pe=or;E(pe,"defaultProps",{..._.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var sr=class extends _{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,sr.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},Ie=sr;E(Ie,"defaultProps",{..._.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});var ar=class extends _{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){super(e,r,ar.defaultProps)}},Ne=ar;E(Ne,"defaultProps",{..._.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var ur=class extends _{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,r){super(e,r,ur.defaultProps)}},De=ur;E(De,"defaultProps",{..._.defaultProps,measureExecutionTime:void 0});var cr=class extends _{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,r){super(e,r,cr.defaultProps)}},ve=cr;E(ve,"defaultProps",{..._.defaultProps});function sn(t){let[e,r]=qi[t],n=e==="i32"||e==="u32",i=e!=="u32",s=Zi[e]*r,a=Qi(e,r);return{dataType:e,components:r,defaultVertexFormat:a,byteLength:s,integer:n,signed:i}}function Qi(t,e){let r;switch(t){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?r:`${r}x${e}`}var qi={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},Zi={f32:4,f16:2,i32:4,u32:4};function lr(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,n]=t.split("x"),i=r,s=n?parseInt(n):1,a=It(i),c={type:i,components:s,byteLength:a.byteLength*s,integer:a.integer,signed:a.signed,normalized:a.normalized};return e&&(c.webglOnly=!0),c}function an(t,e){let r={};for(let n of t.attributes)r[n.name]=Ji(t,e,n.name);return r}function un(t,e,r=16){let n=an(t,e),i=new Array(r).fill(null);for(let s of Object.values(n))i[s.location]=s;return i}function Ji(t,e,r){let n=eo(t,r),i=to(e,r);if(!n)return null;let s=sn(n.type),a=i?.vertexFormat||s.defaultVertexFormat,c=lr(a);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:s.dataType,shaderComponents:s.components,vertexFormat:a,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:s.integer,stepMode:i?.stepMode||n.stepMode,byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function eo(t,e){let r=t.attributes.find(n=>n.name===e);return r||f.warn(`shader layout attribute "${e}" not present in shader`),r||null}function to(t,e){ro(t);let r=no(t,e);return r||(r=io(t,e),r)?r:(f.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function ro(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&f.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function no(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function io(t,e){for(let r of t){let n=r.byteStride;if(typeof r.byteStride!="number")for(let s of r.attributes||[]){let a=lr(s.format);n+=a.byteLength}let i=r.attributes?.find(s=>s.attribute===e);if(i)return{attributeName:i.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:i.format,byteOffset:i.byteOffset,byteStride:n}}return null}function fr(t,e){let r={...t,attributes:t.attributes.map(n=>({...n}))};for(let n of e?.attributes||[]){let i=r.attributes.find(s=>s.name===n.name);i?(i.type=n.type||i.type,i.stepMode=n.stepMode||i.stepMode):f.warn(`shader layout attribute ${n.name} not present in shader`)}return r}var dr=class extends _{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,dr.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=un(r.renderPipeline.shaderLayout,r.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,r){throw new Error("constant attributes not supported")}},we=dr;E(we,"defaultProps",{..._.defaultProps,renderPipeline:null});var mr=class extends _{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,mr.defaultProps)}},Oe=mr;E(Oe,"defaultProps",{..._.defaultProps,layout:void 0,buffers:{}});var hr=class extends _{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,hr.defaultProps)}},Ue=hr;E(Ue,"defaultProps",{..._.defaultProps,type:void 0,count:void 0});var vt;function cn(t){return(!vt||vt.byteLength<t)&&(vt=new ArrayBuffer(t)),vt}function pr(t,e){let r=cn(t.BYTES_PER_ELEMENT*e);return new t(r,0,e)}function gr(t){let{target:e,source:r,start:n=0,count:i=1}=t,s=r.length,a=i*s,c=0;for(let l=n;c<s;c++)e[l++]=r[c];for(;c<a;)c<a-c?(e.copyWithin(n+c,n,n+c),c*=2):(e.copyWithin(n+c,n,n+a-c),c=a);return t.target}function ln(t){return qr(t)!==null||typeof t=="number"||typeof t=="boolean"}function Er(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let n=t[r];ln(n)?e.uniforms[r]=n:e.bindings[r]=n}),e}function br(t,e,r,n){let i=`See luma.gl ${r} Upgrade Guide at https://luma.gl/docs/upgrade-guide`,s=Object.getPrototypeOf(t);n.forEach(a=>{s.methodName||(s[a]=()=>{throw f.removed(`Calling removed method ${e}.${a}: `,i)(),new Error(a)})})}function _r(t,e,r){let{removedProps:n={},deprecatedProps:i={},replacedProps:s={}}=r;for(let c in n)if(c in e){let d=n[c]?`${t}.${n[c]}`:"N/A";f.removed(`${t}.${c}`,d)()}for(let c in i)if(c in e){let l=i[c];f.deprecated(`${t}.${c}`,`${t}.${l}`)()}let a=null;for(let[c,l]of Object.entries(s))c in e&&(f.deprecated(`${t}.${c}`,`${t}.${l}`)(),a=a||Object.assign({},e),a[l]=e[c],delete a[c]);return a||e}var oo="";async function Tr(t,e){return await new Promise((r,n)=>{try{let i=new Image;i.onload=()=>r(i),i.onerror=()=>n(new Error(`Could not load image ${t}.`)),i.crossOrigin=e?.crossOrigin||"anonymous",i.src=t.startsWith("http")?t:oo+t}catch(i){n(i)}})}async function at(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",t),e&&(n.id=e),new Promise((i,s)=>{n.onload=i,n.onerror=a=>s(new Error(`Unable to load script '${t}': ${a}`)),r.appendChild(n)})}var o=y(S(),1),ct={[o.GL.BLEND]:!1,[o.GL.BLEND_COLOR]:new Float32Array([0,0,0,0]),[o.GL.BLEND_EQUATION_RGB]:o.GL.FUNC_ADD,[o.GL.BLEND_EQUATION_ALPHA]:o.GL.FUNC_ADD,[o.GL.BLEND_SRC_RGB]:o.GL.ONE,[o.GL.BLEND_DST_RGB]:o.GL.ZERO,[o.GL.BLEND_SRC_ALPHA]:o.GL.ONE,[o.GL.BLEND_DST_ALPHA]:o.GL.ZERO,[o.GL.COLOR_CLEAR_VALUE]:new Float32Array([0,0,0,0]),[o.GL.COLOR_WRITEMASK]:[!0,!0,!0,!0],[o.GL.CULL_FACE]:!1,[o.GL.CULL_FACE_MODE]:o.GL.BACK,[o.GL.DEPTH_TEST]:!1,[o.GL.DEPTH_CLEAR_VALUE]:1,[o.GL.DEPTH_FUNC]:o.GL.LESS,[o.GL.DEPTH_RANGE]:new Float32Array([0,1]),[o.GL.DEPTH_WRITEMASK]:!0,[o.GL.DITHER]:!0,[o.GL.CURRENT_PROGRAM]:null,[o.GL.FRAMEBUFFER_BINDING]:null,[o.GL.RENDERBUFFER_BINDING]:null,[o.GL.VERTEX_ARRAY_BINDING]:null,[o.GL.ARRAY_BUFFER_BINDING]:null,[o.GL.FRONT_FACE]:o.GL.CCW,[o.GL.GENERATE_MIPMAP_HINT]:o.GL.DONT_CARE,[o.GL.LINE_WIDTH]:1,[o.GL.POLYGON_OFFSET_FILL]:!1,[o.GL.POLYGON_OFFSET_FACTOR]:0,[o.GL.POLYGON_OFFSET_UNITS]:0,[o.GL.SAMPLE_ALPHA_TO_COVERAGE]:!1,[o.GL.SAMPLE_COVERAGE]:!1,[o.GL.SAMPLE_COVERAGE_VALUE]:1,[o.GL.SAMPLE_COVERAGE_INVERT]:!1,[o.GL.SCISSOR_TEST]:!1,[o.GL.SCISSOR_BOX]:new Int32Array([0,0,1024,1024]),[o.GL.STENCIL_TEST]:!1,[o.GL.STENCIL_CLEAR_VALUE]:0,[o.GL.STENCIL_WRITEMASK]:4294967295,[o.GL.STENCIL_BACK_WRITEMASK]:4294967295,[o.GL.STENCIL_FUNC]:o.GL.ALWAYS,[o.GL.STENCIL_REF]:0,[o.GL.STENCIL_VALUE_MASK]:4294967295,[o.GL.STENCIL_BACK_FUNC]:o.GL.ALWAYS,[o.GL.STENCIL_BACK_REF]:0,[o.GL.STENCIL_BACK_VALUE_MASK]:4294967295,[o.GL.STENCIL_FAIL]:o.GL.KEEP,[o.GL.STENCIL_PASS_DEPTH_FAIL]:o.GL.KEEP,[o.GL.STENCIL_PASS_DEPTH_PASS]:o.GL.KEEP,[o.GL.STENCIL_BACK_FAIL]:o.GL.KEEP,[o.GL.STENCIL_BACK_PASS_DEPTH_FAIL]:o.GL.KEEP,[o.GL.STENCIL_BACK_PASS_DEPTH_PASS]:o.GL.KEEP,[o.GL.VIEWPORT]:[0,0,1024,1024],[o.GL.TRANSFORM_FEEDBACK_BINDING]:null,[o.GL.COPY_READ_BUFFER_BINDING]:null,[o.GL.COPY_WRITE_BUFFER_BINDING]:null,[o.GL.PIXEL_PACK_BUFFER_BINDING]:null,[o.GL.PIXEL_UNPACK_BUFFER_BINDING]:null,[o.GL.FRAGMENT_SHADER_DERIVATIVE_HINT]:o.GL.DONT_CARE,[o.GL.READ_FRAMEBUFFER_BINDING]:null,[o.GL.RASTERIZER_DISCARD]:!1,[o.GL.PACK_ALIGNMENT]:4,[o.GL.UNPACK_ALIGNMENT]:4,[o.GL.UNPACK_FLIP_Y_WEBGL]:!1,[o.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]:!1,[o.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]:o.GL.BROWSER_DEFAULT_WEBGL,[o.GL.PACK_ROW_LENGTH]:0,[o.GL.PACK_SKIP_PIXELS]:0,[o.GL.PACK_SKIP_ROWS]:0,[o.GL.UNPACK_ROW_LENGTH]:0,[o.GL.UNPACK_IMAGE_HEIGHT]:0,[o.GL.UNPACK_SKIP_PIXELS]:0,[o.GL.UNPACK_SKIP_ROWS]:0,[o.GL.UNPACK_SKIP_IMAGES]:0},w=(t,e,r)=>e?t.enable(r):t.disable(r),dn=(t,e,r)=>t.hint(r,e),Y=(t,e,r)=>t.pixelStorei(r,e),mn=(t,e,r)=>{let n=r===o.GL.FRAMEBUFFER_BINDING?o.GL.DRAW_FRAMEBUFFER:o.GL.READ_FRAMEBUFFER;return t.bindFramebuffer(n,e)},ut=(t,e,r)=>{let i={[o.GL.ARRAY_BUFFER_BINDING]:o.GL.ARRAY_BUFFER,[o.GL.COPY_READ_BUFFER_BINDING]:o.GL.COPY_READ_BUFFER,[o.GL.COPY_WRITE_BUFFER_BINDING]:o.GL.COPY_WRITE_BUFFER,[o.GL.PIXEL_PACK_BUFFER_BINDING]:o.GL.PIXEL_PACK_BUFFER,[o.GL.PIXEL_UNPACK_BUFFER_BINDING]:o.GL.PIXEL_UNPACK_BUFFER}[r];t.bindBuffer(i,e)};function Lr(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var hn={[o.GL.BLEND]:w,[o.GL.BLEND_COLOR]:(t,e)=>t.blendColor(...e),[o.GL.BLEND_EQUATION_RGB]:"blendEquation",[o.GL.BLEND_EQUATION_ALPHA]:"blendEquation",[o.GL.BLEND_SRC_RGB]:"blendFunc",[o.GL.BLEND_DST_RGB]:"blendFunc",[o.GL.BLEND_SRC_ALPHA]:"blendFunc",[o.GL.BLEND_DST_ALPHA]:"blendFunc",[o.GL.COLOR_CLEAR_VALUE]:(t,e)=>t.clearColor(...e),[o.GL.COLOR_WRITEMASK]:(t,e)=>t.colorMask(...e),[o.GL.CULL_FACE]:w,[o.GL.CULL_FACE_MODE]:(t,e)=>t.cullFace(e),[o.GL.DEPTH_TEST]:w,[o.GL.DEPTH_CLEAR_VALUE]:(t,e)=>t.clearDepth(e),[o.GL.DEPTH_FUNC]:(t,e)=>t.depthFunc(e),[o.GL.DEPTH_RANGE]:(t,e)=>t.depthRange(...e),[o.GL.DEPTH_WRITEMASK]:(t,e)=>t.depthMask(e),[o.GL.DITHER]:w,[o.GL.FRAGMENT_SHADER_DERIVATIVE_HINT]:dn,[o.GL.CURRENT_PROGRAM]:(t,e)=>t.useProgram(e),[o.GL.RENDERBUFFER_BINDING]:(t,e)=>t.bindRenderbuffer(o.GL.RENDERBUFFER,e),[o.GL.TRANSFORM_FEEDBACK_BINDING]:(t,e)=>t.bindTransformFeedback?.(o.GL.TRANSFORM_FEEDBACK,e),[o.GL.VERTEX_ARRAY_BINDING]:(t,e)=>t.bindVertexArray(e),[o.GL.FRAMEBUFFER_BINDING]:mn,[o.GL.READ_FRAMEBUFFER_BINDING]:mn,[o.GL.ARRAY_BUFFER_BINDING]:ut,[o.GL.COPY_READ_BUFFER_BINDING]:ut,[o.GL.COPY_WRITE_BUFFER_BINDING]:ut,[o.GL.PIXEL_PACK_BUFFER_BINDING]:ut,[o.GL.PIXEL_UNPACK_BUFFER_BINDING]:ut,[o.GL.FRONT_FACE]:(t,e)=>t.frontFace(e),[o.GL.GENERATE_MIPMAP_HINT]:dn,[o.GL.LINE_WIDTH]:(t,e)=>t.lineWidth(e),[o.GL.POLYGON_OFFSET_FILL]:w,[o.GL.POLYGON_OFFSET_FACTOR]:"polygonOffset",[o.GL.POLYGON_OFFSET_UNITS]:"polygonOffset",[o.GL.RASTERIZER_DISCARD]:w,[o.GL.SAMPLE_ALPHA_TO_COVERAGE]:w,[o.GL.SAMPLE_COVERAGE]:w,[o.GL.SAMPLE_COVERAGE_VALUE]:"sampleCoverage",[o.GL.SAMPLE_COVERAGE_INVERT]:"sampleCoverage",[o.GL.SCISSOR_TEST]:w,[o.GL.SCISSOR_BOX]:(t,e)=>t.scissor(...e),[o.GL.STENCIL_TEST]:w,[o.GL.STENCIL_CLEAR_VALUE]:(t,e)=>t.clearStencil(e),[o.GL.STENCIL_WRITEMASK]:(t,e)=>t.stencilMaskSeparate(o.GL.FRONT,e),[o.GL.STENCIL_BACK_WRITEMASK]:(t,e)=>t.stencilMaskSeparate(o.GL.BACK,e),[o.GL.STENCIL_FUNC]:"stencilFuncFront",[o.GL.STENCIL_REF]:"stencilFuncFront",[o.GL.STENCIL_VALUE_MASK]:"stencilFuncFront",[o.GL.STENCIL_BACK_FUNC]:"stencilFuncBack",[o.GL.STENCIL_BACK_REF]:"stencilFuncBack",[o.GL.STENCIL_BACK_VALUE_MASK]:"stencilFuncBack",[o.GL.STENCIL_FAIL]:"stencilOpFront",[o.GL.STENCIL_PASS_DEPTH_FAIL]:"stencilOpFront",[o.GL.STENCIL_PASS_DEPTH_PASS]:"stencilOpFront",[o.GL.STENCIL_BACK_FAIL]:"stencilOpBack",[o.GL.STENCIL_BACK_PASS_DEPTH_FAIL]:"stencilOpBack",[o.GL.STENCIL_BACK_PASS_DEPTH_PASS]:"stencilOpBack",[o.GL.VIEWPORT]:(t,e)=>t.viewport(...e),[o.GL.DEPTH_CLAMP_EXT]:w,[o.GL.POLYGON_OFFSET_LINE_WEBGL]:w,[o.GL.CLIP_DISTANCE0_WEBGL]:w,[o.GL.CLIP_DISTANCE1_WEBGL]:w,[o.GL.CLIP_DISTANCE2_WEBGL]:w,[o.GL.CLIP_DISTANCE3_WEBGL]:w,[o.GL.CLIP_DISTANCE4_WEBGL]:w,[o.GL.CLIP_DISTANCE5_WEBGL]:w,[o.GL.CLIP_DISTANCE6_WEBGL]:w,[o.GL.CLIP_DISTANCE7_WEBGL]:w,[o.GL.PACK_ALIGNMENT]:Y,[o.GL.UNPACK_ALIGNMENT]:Y,[o.GL.UNPACK_FLIP_Y_WEBGL]:Y,[o.GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]:Y,[o.GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]:Y,[o.GL.PACK_ROW_LENGTH]:Y,[o.GL.PACK_SKIP_PIXELS]:Y,[o.GL.PACK_SKIP_ROWS]:Y,[o.GL.UNPACK_ROW_LENGTH]:Y,[o.GL.UNPACK_IMAGE_HEIGHT]:Y,[o.GL.UNPACK_SKIP_PIXELS]:Y,[o.GL.UNPACK_SKIP_ROWS]:Y,[o.GL.UNPACK_SKIP_IMAGES]:Y,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(o.GL.FRAMEBUFFER,r)},blend:(t,e)=>e?t.enable(o.GL.BLEND):t.disable(o.GL.BLEND),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(o.GL.CULL_FACE):t.disable(o.GL.CULL_FACE),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(o.GL.DEPTH_TEST):t.disable(o.GL.DEPTH_TEST),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(o.GL.DITHER):t.disable(o.GL.DITHER),derivativeHint:(t,e)=>{t.hint(o.GL.FRAGMENT_SHADER_DERIVATIVE_HINT,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(o.GL.GENERATE_MIPMAP_HINT,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(o.GL.POLYGON_OFFSET_FILL):t.disable(o.GL.POLYGON_OFFSET_FILL),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(o.GL.SCISSOR_TEST):t.disable(o.GL.SCISSOR_TEST),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(o.GL.STENCIL_TEST):t.disable(o.GL.STENCIL_TEST),stencilMask:(t,e)=>{e=Lr(e)?e:[e,e];let[r,n]=e;t.stencilMaskSeparate(o.GL.FRONT,r),t.stencilMaskSeparate(o.GL.BACK,n)},stencilFunc:(t,e)=>{e=Lr(e)&&e.length===3?[...e,...e]:e;let[r,n,i,s,a,c]=e;t.stencilFuncSeparate(o.GL.FRONT,r,n,i),t.stencilFuncSeparate(o.GL.BACK,s,a,c)},stencilOp:(t,e)=>{e=Lr(e)&&e.length===3?[...e,...e]:e;let[r,n,i,s,a,c]=e;t.stencilOpSeparate(o.GL.FRONT,r,n,i),t.stencilOpSeparate(o.GL.BACK,s,a,c)},viewport:(t,e)=>t.viewport(...e)};function F(t,e,r){return e[t]!==void 0?e[t]:r[t]}var pn={blendEquation:(t,e,r)=>t.blendEquationSeparate(F(o.GL.BLEND_EQUATION_RGB,e,r),F(o.GL.BLEND_EQUATION_ALPHA,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(F(o.GL.BLEND_SRC_RGB,e,r),F(o.GL.BLEND_DST_RGB,e,r),F(o.GL.BLEND_SRC_ALPHA,e,r),F(o.GL.BLEND_DST_ALPHA,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(F(o.GL.POLYGON_OFFSET_FACTOR,e,r),F(o.GL.POLYGON_OFFSET_UNITS,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(F(o.GL.SAMPLE_COVERAGE_VALUE,e,r),F(o.GL.SAMPLE_COVERAGE_INVERT,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(o.GL.FRONT,F(o.GL.STENCIL_FUNC,e,r),F(o.GL.STENCIL_REF,e,r),F(o.GL.STENCIL_VALUE_MASK,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(o.GL.BACK,F(o.GL.STENCIL_BACK_FUNC,e,r),F(o.GL.STENCIL_BACK_REF,e,r),F(o.GL.STENCIL_BACK_VALUE_MASK,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(o.GL.FRONT,F(o.GL.STENCIL_FAIL,e,r),F(o.GL.STENCIL_PASS_DEPTH_FAIL,e,r),F(o.GL.STENCIL_PASS_DEPTH_PASS,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(o.GL.BACK,F(o.GL.STENCIL_BACK_FAIL,e,r),F(o.GL.STENCIL_BACK_PASS_DEPTH_FAIL,e,r),F(o.GL.STENCIL_BACK_PASS_DEPTH_PASS,e,r))},Ar={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({[o.GL.CURRENT_PROGRAM]:e}),bindRenderbuffer:(t,e,r)=>t({[o.GL.RENDERBUFFER_BINDING]:r}),bindTransformFeedback:(t,e,r)=>t({[o.GL.TRANSFORM_FEEDBACK_BINDING]:r}),bindVertexArray:(t,e)=>t({[o.GL.VERTEX_ARRAY_BINDING]:e}),bindFramebuffer:(t,e,r)=>{switch(e){case o.GL.FRAMEBUFFER:return t({[o.GL.DRAW_FRAMEBUFFER_BINDING]:r,[o.GL.READ_FRAMEBUFFER_BINDING]:r});case o.GL.DRAW_FRAMEBUFFER:return t({[o.GL.DRAW_FRAMEBUFFER_BINDING]:r});case o.GL.READ_FRAMEBUFFER:return t({[o.GL.READ_FRAMEBUFFER_BINDING]:r});default:return null}},bindBuffer:(t,e,r)=>{let n={[o.GL.ARRAY_BUFFER]:[o.GL.ARRAY_BUFFER_BINDING],[o.GL.COPY_READ_BUFFER]:[o.GL.COPY_READ_BUFFER_BINDING],[o.GL.COPY_WRITE_BUFFER]:[o.GL.COPY_WRITE_BUFFER_BINDING],[o.GL.PIXEL_PACK_BUFFER]:[o.GL.PIXEL_PACK_BUFFER_BINDING],[o.GL.PIXEL_UNPACK_BUFFER]:[o.GL.PIXEL_UNPACK_BUFFER_BINDING]}[e];return n?t({[n]:r}):{valueChanged:!0}},blendColor:(t,e,r,n,i)=>t({[o.GL.BLEND_COLOR]:new Float32Array([e,r,n,i])}),blendEquation:(t,e)=>t({[o.GL.BLEND_EQUATION_RGB]:e,[o.GL.BLEND_EQUATION_ALPHA]:e}),blendEquationSeparate:(t,e,r)=>t({[o.GL.BLEND_EQUATION_RGB]:e,[o.GL.BLEND_EQUATION_ALPHA]:r}),blendFunc:(t,e,r)=>t({[o.GL.BLEND_SRC_RGB]:e,[o.GL.BLEND_DST_RGB]:r,[o.GL.BLEND_SRC_ALPHA]:e,[o.GL.BLEND_DST_ALPHA]:r}),blendFuncSeparate:(t,e,r,n,i)=>t({[o.GL.BLEND_SRC_RGB]:e,[o.GL.BLEND_DST_RGB]:r,[o.GL.BLEND_SRC_ALPHA]:n,[o.GL.BLEND_DST_ALPHA]:i}),clearColor:(t,e,r,n,i)=>t({[o.GL.COLOR_CLEAR_VALUE]:new Float32Array([e,r,n,i])}),clearDepth:(t,e)=>t({[o.GL.DEPTH_CLEAR_VALUE]:e}),clearStencil:(t,e)=>t({[o.GL.STENCIL_CLEAR_VALUE]:e}),colorMask:(t,e,r,n,i)=>t({[o.GL.COLOR_WRITEMASK]:[e,r,n,i]}),cullFace:(t,e)=>t({[o.GL.CULL_FACE_MODE]:e}),depthFunc:(t,e)=>t({[o.GL.DEPTH_FUNC]:e}),depthRange:(t,e,r)=>t({[o.GL.DEPTH_RANGE]:new Float32Array([e,r])}),depthMask:(t,e)=>t({[o.GL.DEPTH_WRITEMASK]:e}),frontFace:(t,e)=>t({[o.GL.FRONT_FACE]:e}),lineWidth:(t,e)=>t({[o.GL.LINE_WIDTH]:e}),polygonOffset:(t,e,r)=>t({[o.GL.POLYGON_OFFSET_FACTOR]:e,[o.GL.POLYGON_OFFSET_UNITS]:r}),sampleCoverage:(t,e,r)=>t({[o.GL.SAMPLE_COVERAGE_VALUE]:e,[o.GL.SAMPLE_COVERAGE_INVERT]:r}),scissor:(t,e,r,n,i)=>t({[o.GL.SCISSOR_BOX]:new Int32Array([e,r,n,i])}),stencilMask:(t,e)=>t({[o.GL.STENCIL_WRITEMASK]:e,[o.GL.STENCIL_BACK_WRITEMASK]:e}),stencilMaskSeparate:(t,e,r)=>t({[e===o.GL.FRONT?o.GL.STENCIL_WRITEMASK:o.GL.STENCIL_BACK_WRITEMASK]:r}),stencilFunc:(t,e,r,n)=>t({[o.GL.STENCIL_FUNC]:e,[o.GL.STENCIL_REF]:r,[o.GL.STENCIL_VALUE_MASK]:n,[o.GL.STENCIL_BACK_FUNC]:e,[o.GL.STENCIL_BACK_REF]:r,[o.GL.STENCIL_BACK_VALUE_MASK]:n}),stencilFuncSeparate:(t,e,r,n,i)=>t({[e===o.GL.FRONT?o.GL.STENCIL_FUNC:o.GL.STENCIL_BACK_FUNC]:r,[e===o.GL.FRONT?o.GL.STENCIL_REF:o.GL.STENCIL_BACK_REF]:n,[e===o.GL.FRONT?o.GL.STENCIL_VALUE_MASK:o.GL.STENCIL_BACK_VALUE_MASK]:i}),stencilOp:(t,e,r,n)=>t({[o.GL.STENCIL_FAIL]:e,[o.GL.STENCIL_PASS_DEPTH_FAIL]:r,[o.GL.STENCIL_PASS_DEPTH_PASS]:n,[o.GL.STENCIL_BACK_FAIL]:e,[o.GL.STENCIL_BACK_PASS_DEPTH_FAIL]:r,[o.GL.STENCIL_BACK_PASS_DEPTH_PASS]:n}),stencilOpSeparate:(t,e,r,n,i)=>t({[e===o.GL.FRONT?o.GL.STENCIL_FAIL:o.GL.STENCIL_BACK_FAIL]:r,[e===o.GL.FRONT?o.GL.STENCIL_PASS_DEPTH_FAIL:o.GL.STENCIL_BACK_PASS_DEPTH_FAIL]:n,[e===o.GL.FRONT?o.GL.STENCIL_PASS_DEPTH_PASS:o.GL.STENCIL_BACK_PASS_DEPTH_PASS]:i}),viewport:(t,e,r,n,i)=>t({[o.GL.VIEWPORT]:[e,r,n,i]})},ie=(t,e)=>t.isEnabled(e),Rr={[o.GL.BLEND]:ie,[o.GL.CULL_FACE]:ie,[o.GL.DEPTH_TEST]:ie,[o.GL.DITHER]:ie,[o.GL.POLYGON_OFFSET_FILL]:ie,[o.GL.SAMPLE_ALPHA_TO_COVERAGE]:ie,[o.GL.SAMPLE_COVERAGE]:ie,[o.GL.SCISSOR_TEST]:ie,[o.GL.STENCIL_TEST]:ie,[o.GL.RASTERIZER_DISCARD]:ie},gn=new Set([o.GL.ACTIVE_TEXTURE,o.GL.TRANSFORM_FEEDBACK_ACTIVE,o.GL.TRANSFORM_FEEDBACK_PAUSED,o.GL.TRANSFORM_FEEDBACK_BUFFER_BINDING,o.GL.UNIFORM_BUFFER_BINDING,o.GL.ELEMENT_ARRAY_BUFFER_BINDING,o.GL.IMPLEMENTATION_COLOR_READ_FORMAT,o.GL.IMPLEMENTATION_COLOR_READ_TYPE,o.GL.READ_BUFFER,o.GL.DRAW_BUFFER0,o.GL.DRAW_BUFFER1,o.GL.DRAW_BUFFER2,o.GL.DRAW_BUFFER3,o.GL.DRAW_BUFFER4,o.GL.DRAW_BUFFER5,o.GL.DRAW_BUFFER6,o.GL.DRAW_BUFFER7,o.GL.DRAW_BUFFER8,o.GL.DRAW_BUFFER9,o.GL.DRAW_BUFFER10,o.GL.DRAW_BUFFER11,o.GL.DRAW_BUFFER12,o.GL.DRAW_BUFFER13,o.GL.DRAW_BUFFER14,o.GL.DRAW_BUFFER15,o.GL.SAMPLER_BINDING,o.GL.TEXTURE_BINDING_2D,o.GL.TEXTURE_BINDING_2D_ARRAY,o.GL.TEXTURE_BINDING_3D,o.GL.TEXTURE_BINDING_CUBE_MAP]);function X(t,e){if(so(e))return;let r={};for(let i in e){let s=Number(i),a=hn[i];a&&(typeof a=="string"?r[a]=!0:a(t,e[i],s))}let n=t.state&&t.state.cache;if(n)for(let i in r){let s=pn[i];s(t,e,n)}}function Me(t,e=ct){if(typeof e=="number"){let i=e,s=Rr[i];return s?s(t,i):t.getParameter(i)}let r=Array.isArray(e)?e:Object.keys(e),n={};for(let i of r){let s=Rr[i];n[i]=s?s(t,Number(i)):t.getParameter(Number(i))}return n}function En(t){X(t,ct)}function so(t){for(let e in t)return!1;return!0}function bn(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),n=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&n&&t.length===e.length){for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}return!1}var Sr=class{gl;program=null;stateStack=[];enable=!0;cache;log;constructor(e,{copyState:r=!1,log:n=()=>{}}={}){this.gl=e,this.cache=r?Me(e):Object.assign({},ct),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){R(this.stateStack.length>0);let e=this.stateStack[this.stateStack.length-1];X(this.gl,e),this.stateStack.pop()}_updateCache(e){let r=!1,n,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let s in e){R(s!==void 0);let a=e[s],c=this.cache[s];bn(a,c)||(r=!0,n=c,i&&!(s in i)&&(i[s]=c),this.cache[s]=a)}return{valueChanged:r,oldValue:n}}};function Le(t){return t.state}function lt(t,e){let{enable:r=!0,copyState:n}=e;if(R(n!==void 0),!t.state){t.state=new Sr(t,{copyState:n}),uo(t);for(let s in Ar){let a=Ar[s];ao(t,s,a)}_n(t,"getParameter"),_n(t,"isEnabled")}let i=Le(t);return i.enable=r,t}function te(t){let e=Le(t);e||(lt(t,{copyState:!1}),e=Le(t)),e.push()}function q(t){let e=Le(t);R(e),e.pop()}function _n(t,e){let r=t[e].bind(t);t[e]=function(i){if(i===void 0||gn.has(i))return r(i);let s=Le(t);return i in s.cache||(s.cache[i]=r(i)),s.enable?s.cache[i]:r(i)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function ao(t,e,r){if(!t[e])return;let n=t[e].bind(t);t[e]=function(...s){let a=Le(t),{valueChanged:c,oldValue:l}=r(a._updateCache,...s);return c&&n(...s),l},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function uo(t){let e=t.useProgram.bind(t);t.useProgram=function(n){let i=Le(t);i.program!==n&&(e(n),i.program=n)}}var co={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function Tn(t,e){e={...co,...e};let r=null,n=s=>r=s.statusMessage||r;t.addEventListener("webglcontextcreationerror",n,!1);let i=null;if(i||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",n,!1),!i)throw new Error(`Failed to create WebGL context: ${r||"Unknown error"}`);if(e.onContextLost){let{onContextLost:s}=e;t.addEventListener("webglcontextlost",a=>s(a),!1)}if(e.onContextRestored){let{onContextRestored:s}=e;t.addEventListener("webglcontextrestored",a=>s(a),!1)}return i}var We=y(S(),1);function Z(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function Ln(t,e){let r=t.getParameter(We.GL.VENDOR),n=t.getParameter(We.GL.RENDERER);Z(t,"WEBGL_debug_renderer_info",e);let i=e.WEBGL_debug_renderer_info,s=t.getParameter(i?i.UNMASKED_VENDOR_WEBGL:We.GL.VENDOR),a=t.getParameter(i?i.UNMASKED_RENDERER_WEBGL:We.GL.RENDERER),c=s||r,l=a||n,d=t.getParameter(We.GL.VERSION),m=An(c,l),b=lo(c,l),g=fo(c,l);return{type:"webgl",gpu:m,gpuType:g,gpuBackend:b,vendor:c,renderer:l,version:d,shadingLanguage:"glsl",shadingLanguageVersion:300}}function An(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function lo(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function fo(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(An(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}var u=y(S(),1);var z=y(S(),1);function wt(t){switch(t){case"uint8":return z.GL.UNSIGNED_BYTE;case"sint8":return z.GL.BYTE;case"unorm8":return z.GL.UNSIGNED_BYTE;case"snorm8":return z.GL.BYTE;case"uint16":return z.GL.UNSIGNED_SHORT;case"sint16":return z.GL.SHORT;case"unorm16":return z.GL.UNSIGNED_SHORT;case"snorm16":return z.GL.SHORT;case"uint32":return z.GL.UNSIGNED_INT;case"sint32":return z.GL.INT;case"float16":return z.GL.HALF_FLOAT;case"float32":return z.GL.FLOAT}throw new Error(String(t))}var M="texture-compression-bc",C="texture-compression-astc",oe="texture-compression-etc2",mo="texture-compression-etc1-webgl",Ot="texture-compression-pvrtc-webgl",xr="texture-compression-atc-webgl",ft="float32-renderable-webgl",yr="float16-renderable-webgl",ho="rgb9e5ufloat_renderable-webgl",Cr="snorm8-renderable-webgl",dt="norm16-renderable-webgl",Gr="snorm16-renderable-webgl",Ut="float32-filterable",Rn="float16-filterable-webgl",mt="WEBGL_compressed_texture_s3tc",ht="WEBGL_compressed_texture_s3tc_srgb",He="EXT_texture_compression_rgtc",ke="EXT_texture_compression_bptc",po="WEBGL_compressed_texture_etc",go="WEBGL_compressed_texture_astc",Eo="WEBGL_compressed_texture_etc1",bo="WEBGL_compressed_texture_pvrtc",_o="WEBGL_compressed_texture_atc",Sn="EXT_texture_norm16",xn="EXT_render_snorm",To="EXT_color_buffer_float",Mt={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat_renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[xn],"norm16-renderable-webgl":[Sn],"snorm16-renderable-webgl":[Sn,xn],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[mt,ht,He,ke],"texture-compression-bc5-webgl":[He],"texture-compression-bc7-webgl":[ke],"texture-compression-etc2":[po],"texture-compression-astc":[go],"texture-compression-etc1-webgl":[Eo],"texture-compression-pvrtc-webgl":[bo],"texture-compression-atc-webgl":[_o]};function yn(t){return t in Mt}function Cn(t,e,r){return(Mt[e]||[]).every(i=>Z(t,i,r))}var ge={"rgb8unorm-unsized":{gl:u.GL.RGB,b:4,c:2,bpp:4,dataFormat:u.GL.RGB,types:[u.GL.UNSIGNED_BYTE,u.GL.UNSIGNED_SHORT_5_6_5]},"rgba8unorm-unsized":{gl:u.GL.RGBA,b:4,c:2,bpp:4,dataFormat:u.GL.RGBA,types:[u.GL.UNSIGNED_BYTE,u.GL.UNSIGNED_SHORT_4_4_4_4,u.GL.UNSIGNED_SHORT_5_5_5_1]},r8unorm:{gl:u.GL.R8,b:1,c:1,rb:!0},r8snorm:{gl:u.GL.R8_SNORM,b:1,c:1,render:Cr},r8uint:{gl:u.GL.R8UI,b:1,c:1,rb:!0},r8sint:{gl:u.GL.R8I,b:1,c:1,rb:!0},rg8unorm:{gl:u.GL.RG8,b:2,c:2,rb:!0},rg8snorm:{gl:u.GL.RG8_SNORM,b:2,c:2,render:Cr},rg8uint:{gl:u.GL.RG8UI,b:2,c:2,rb:!0},rg8sint:{gl:u.GL.RG8I,b:2,c:2,rb:!0},r16uint:{gl:u.GL.R16UI,b:2,c:1,rb:!0},r16sint:{gl:u.GL.R16I,b:2,c:1,rb:!0},r16float:{gl:u.GL.R16F,b:2,c:1,render:yr,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:u.GL.R16_EXT,b:2,c:1,f:dt,rb:!0},"r16snorm-webgl":{gl:u.GL.R16_SNORM_EXT,b:2,c:1,f:Gr},"rgba4unorm-webgl":{gl:u.GL.RGBA4,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:u.GL.RGB565,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:u.GL.RGB5_A1,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:u.GL.RGB8,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:u.GL.RGB8_SNORM,b:3,c:3,wgpu:!1},rgba8unorm:{gl:u.GL.RGBA8,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:u.GL.SRGB8_ALPHA8,b:4,c:4,bpp:4},rgba8snorm:{gl:u.GL.RGBA8_SNORM,b:4,c:4,render:Cr},rgba8uint:{gl:u.GL.RGBA8UI,b:4,c:4,bpp:4},rgba8sint:{gl:u.GL.RGBA8I,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:u.GL.RG16UI,b:4,c:1,bpp:4},rg16sint:{gl:u.GL.RG16I,b:4,c:2,bpp:4},rg16float:{gl:u.GL.RG16F,bpp:4,b:4,c:2,render:yr,filter:Rn,rb:!0},"rg16unorm-webgl":{gl:u.GL.RG16_EXT,b:2,c:2,render:dt},"rg16snorm-webgl":{gl:u.GL.RG16_SNORM_EXT,b:2,c:2,render:Gr},r32uint:{gl:u.GL.R32UI,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:u.GL.R32I,b:4,c:1,bpp:4,rb:!0},r32float:{gl:u.GL.R32F,bpp:4,b:4,c:1,render:ft,filter:Ut},rgb9e5ufloat:{gl:u.GL.RGB9_E5,b:4,c:3,p:1,render:ho},rg11b10ufloat:{gl:u.GL.R11F_G11F_B10F,b:4,c:3,p:1,render:ft,rb:!0},rgb10a2unorm:{gl:u.GL.RGB10_A2,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:u.GL.RGB10_A2UI,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:u.GL.RGB16_EXT,b:2,c:3,f:dt},"rgb16snorm-webgl":{gl:u.GL.RGB16_SNORM_EXT,b:2,c:3,f:dt},rg32uint:{gl:u.GL.RG32UI,b:8,c:2,rb:!0},rg32sint:{gl:u.GL.RG32I,b:8,c:2,rb:!0},rg32float:{gl:u.GL.RG32F,b:8,c:2,render:ft,filter:Ut,rb:!0},rgba16uint:{gl:u.GL.RGBA16UI,b:8,c:4,rb:!0},rgba16sint:{gl:u.GL.RGBA16I,b:8,c:4,rb:!0},rgba16float:{gl:u.GL.RGBA16F,b:8,c:4,render:yr,filter:Rn},"rgba16unorm-webgl":{gl:u.GL.RGBA16_EXT,b:2,c:4,render:dt,rb:!0},"rgba16snorm-webgl":{gl:u.GL.RGBA16_SNORM_EXT,b:2,c:4,render:Gr},"rgb32float-webgl":{gl:u.GL.RGB32F,render:ft,filter:Ut,gl2ext:To,dataFormat:u.GL.RGB,types:[u.GL.FLOAT]},rgba32uint:{gl:u.GL.RGBA32UI,b:16,c:4,rb:!0},rgba32sint:{gl:u.GL.RGBA32I,b:16,c:4,rb:!0},rgba32float:{gl:u.GL.RGBA32F,b:16,c:4,render:ft,filter:Ut,rb:!0},stencil8:{gl:u.GL.STENCIL_INDEX8,b:1,c:1,attachment:u.GL.STENCIL_ATTACHMENT,rb:!0},depth16unorm:{gl:u.GL.DEPTH_COMPONENT16,b:2,c:1,attachment:u.GL.DEPTH_ATTACHMENT,dataFormat:u.GL.DEPTH_COMPONENT,types:[u.GL.UNSIGNED_SHORT],rb:!0},depth24plus:{gl:u.GL.DEPTH_COMPONENT24,b:3,c:1,attachment:u.GL.DEPTH_ATTACHMENT,dataFormat:u.GL.DEPTH_COMPONENT,types:[u.GL.UNSIGNED_INT]},depth32float:{gl:u.GL.DEPTH_COMPONENT32F,b:4,c:1,attachment:u.GL.DEPTH_ATTACHMENT,dataFormat:u.GL.DEPTH_COMPONENT,types:[u.GL.FLOAT],rb:!0},"depth24plus-stencil8":{gl:u.GL.DEPTH24_STENCIL8,b:4,c:2,p:1,attachment:u.GL.DEPTH_STENCIL_ATTACHMENT,rb:!0,depthTexture:!0,dataFormat:u.GL.DEPTH_STENCIL,types:[u.GL.UNSIGNED_INT_24_8]},"depth24unorm-stencil8":{gl:u.GL.DEPTH24_STENCIL8,b:4,c:2,p:1,attachment:u.GL.DEPTH_STENCIL_ATTACHMENT,dataFormat:u.GL.DEPTH_STENCIL,types:[u.GL.UNSIGNED_INT_24_8],rb:!0},"depth32float-stencil8":{gl:u.GL.DEPTH32F_STENCIL8,b:5,c:2,p:1,attachment:u.GL.DEPTH_STENCIL_ATTACHMENT,dataFormat:u.GL.DEPTH_STENCIL,types:[u.GL.FLOAT_32_UNSIGNED_INT_24_8_REV],rb:!0},"bc1-rgb-unorm-webgl":{gl:u.GL.COMPRESSED_RGB_S3TC_DXT1_EXT,x:mt,f:M},"bc1-rgb-unorm-srgb-webgl":{gl:u.GL.COMPRESSED_SRGB_S3TC_DXT1_EXT,x:ht,f:M},"bc1-rgba-unorm":{gl:u.GL.COMPRESSED_RGBA_S3TC_DXT1_EXT,x:mt,f:M},"bc1-rgba-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB_S3TC_DXT1_EXT,x:ht,f:M},"bc2-rgba-unorm":{gl:u.GL.COMPRESSED_RGBA_S3TC_DXT3_EXT,x:mt,f:M},"bc2-rgba-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,x:ht,f:M},"bc3-rgba-unorm":{gl:u.GL.COMPRESSED_RGBA_S3TC_DXT5_EXT,x:mt,f:M},"bc3-rgba-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,x:ht,f:M},"bc4-r-unorm":{gl:u.GL.COMPRESSED_RED_RGTC1_EXT,x:He,f:M},"bc4-r-snorm":{gl:u.GL.COMPRESSED_SIGNED_RED_RGTC1_EXT,x:He,f:M},"bc5-rg-unorm":{gl:u.GL.COMPRESSED_RED_GREEN_RGTC2_EXT,x:He,f:M},"bc5-rg-snorm":{gl:u.GL.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,x:He,f:M},"bc6h-rgb-ufloat":{gl:u.GL.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,x:ke,f:M},"bc6h-rgb-float":{gl:u.GL.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,x:ke,f:M},"bc7-rgba-unorm":{gl:u.GL.COMPRESSED_RGBA_BPTC_UNORM_EXT,x:ke,f:M},"bc7-rgba-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,x:ke,f:M},"etc2-rgb8unorm":{gl:u.GL.COMPRESSED_RGB8_ETC2,f:oe},"etc2-rgb8unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ETC2,f:oe},"etc2-rgb8a1unorm":{gl:u.GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,f:oe},"etc2-rgb8a1unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,f:oe},"etc2-rgba8unorm":{gl:u.GL.COMPRESSED_RGBA8_ETC2_EAC,f:oe},"etc2-rgba8unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,f:oe},"eac-r11unorm":{gl:u.GL.COMPRESSED_R11_EAC,f:oe},"eac-r11snorm":{gl:u.GL.COMPRESSED_SIGNED_R11_EAC,f:oe},"eac-rg11unorm":{gl:u.GL.COMPRESSED_RG11_EAC,f:oe},"eac-rg11snorm":{gl:u.GL.COMPRESSED_SIGNED_RG11_EAC,f:oe},"astc-4x4-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_4x4_KHR,f:C},"astc-4x4-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,f:C},"astc-5x4-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_5x4_KHR,f:C},"astc-5x4-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,f:C},"astc-5x5-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_5x5_KHR,f:C},"astc-5x5-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,f:C},"astc-6x5-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_6x5_KHR,f:C},"astc-6x5-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,f:C},"astc-6x6-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_6x6_KHR,f:C},"astc-6x6-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,f:C},"astc-8x5-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_8x5_KHR,f:C},"astc-8x5-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,f:C},"astc-8x6-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_8x6_KHR,f:C},"astc-8x6-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,f:C},"astc-8x8-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_8x8_KHR,f:C},"astc-8x8-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,f:C},"astc-10x5-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_10x10_KHR,f:C},"astc-10x5-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,f:C},"astc-10x6-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_10x6_KHR,f:C},"astc-10x6-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,f:C},"astc-10x8-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_10x8_KHR,f:C},"astc-10x8-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,f:C},"astc-10x10-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_10x10_KHR,f:C},"astc-10x10-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,f:C},"astc-12x10-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_12x10_KHR,f:C},"astc-12x10-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,f:C},"astc-12x12-unorm":{gl:u.GL.COMPRESSED_RGBA_ASTC_12x12_KHR,f:C},"astc-12x12-unorm-srgb":{gl:u.GL.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,f:C},"pvrtc-rgb4unorm-webgl":{gl:u.GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,f:Ot},"pvrtc-rgba4unorm-webgl":{gl:u.GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,f:Ot},"pvrtc-rbg2unorm-webgl":{gl:u.GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,f:Ot},"pvrtc-rgba2unorm-webgl":{gl:u.GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,f:Ot},"etc1-rbg-unorm-webgl":{gl:u.GL.COMPRESSED_RGB_ETC1_WEBGL,f:mo},"atc-rgb-unorm-webgl":{gl:u.GL.COMPRESSED_RGB_ATC_WEBGL,f:xr},"atc-rgba-unorm-webgl":{gl:u.GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,f:xr},"atc-rgbai-unorm-webgl":{gl:u.GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,f:xr}},Lo={[u.GL.RED]:1,[u.GL.RED_INTEGER]:1,[u.GL.RG]:2,[u.GL.RG_INTEGER]:2,[u.GL.RGB]:3,[u.GL.RGB_INTEGER]:3,[u.GL.RGBA]:4,[u.GL.RGBA_INTEGER]:4,[u.GL.DEPTH_COMPONENT]:1,[u.GL.DEPTH_STENCIL]:1,[u.GL.ALPHA]:1,[u.GL.LUMINANCE]:1,[u.GL.LUMINANCE_ALPHA]:2},Ao={[u.GL.FLOAT]:4,[u.GL.UNSIGNED_INT]:4,[u.GL.INT]:4,[u.GL.UNSIGNED_SHORT]:2,[u.GL.SHORT]:2,[u.GL.HALF_FLOAT]:2,[u.GL.BYTE]:1,[u.GL.UNSIGNED_BYTE]:1};function pt(t,e,r){let n=ge[e];if(!n||n.gl===void 0)return!1;let i=n.x||n.gl2ext;return i?Boolean(Z(t,i,r)):!0}function Gn(t,e,r){return pt(t,e,r)&&ge[e]?.rb}function Pn(t){if(typeof t=="string")return t;let e=Object.entries(ge).find(([,r])=>r.gl===t);if(!e)throw new Error(`Unknown texture format ${t}`);return e[0]}function gt(t){let r=ge[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}function Fn(t,e,r){if(!pt(t,e,r)||e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(Nt(e).signed)return!1}catch{return!1}return e.endsWith("32float")?Boolean(Z(t,"OES_texture_float_linear, extensions",r)):e.endsWith("16float")?Boolean(Z(t,"OES_texture_half_float_linear, extensions",r)):!0}function Bn(t,e,r){return!(!pt(t,e,r)||typeof e=="number")}function Ve(t){let e=ge[t],r=gt(t),n=Nt(t);return{format:r,dataFormat:e?.dataFormat||Ro(n.format,n.integer,n.normalized,r),type:n.dataType?wt(n.dataType):e?.types?.[0]||u.GL.UNSIGNED_BYTE,compressed:n.compressed}}function In(t){let e=ge[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}function Et(t){let e=Ve(t),r=Lo[e.dataFormat]||4,n=Ao[e.type]||1;return r*n}function Ro(t,e,r,n){if(n===u.GL.RGBA||n===u.GL.RGB)return n;switch(t){case"r":return e&&!r?u.GL.RED_INTEGER:u.GL.RED;case"rg":return e&&!r?u.GL.RG_INTEGER:u.GL.RG;case"rgb":return e&&!r?u.GL.RGB_INTEGER:u.GL.RGB;case"rgba":return e&&!r?u.GL.RGBA_INTEGER:u.GL.RGBA;default:return u.GL.RGBA}}var Nn={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},Wt=class extends st{gl;extensions;testedFeatures=new Set;constructor(e,r,n){super([],n),this.gl=e,this.extensions=r,Z(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){for(let e of Object.keys(Nn))this.has(e)&&(yield e);for(let e of Object.keys(Mt))this.has(e)&&(yield e);return[]}has(e){return this.disabledFeatures[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),yn(e)&&Cn(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){for(let e of this);}getWebGLFeature(e){let r=Nn[e];return Boolean(typeof r=="string"?Z(this.gl,r,this.extensions):r)}};var re=y(S(),1),Ht=class extends ot{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(re.GL.MAX_TEXTURE_SIZE)}get maxTextureDimension3D(){return this.getParameter(re.GL.MAX_3D_TEXTURE_SIZE)}get maxTextureArrayLayers(){return this.getParameter(re.GL.MAX_ARRAY_TEXTURE_LAYERS)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(re.GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS)}get maxSamplersPerShaderStage(){return this.getParameter(re.GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(re.GL.MAX_UNIFORM_BUFFER_BINDINGS)}get maxUniformBufferBindingSize(){return this.getParameter(re.GL.MAX_UNIFORM_BLOCK_SIZE)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(re.GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(re.GL.MAX_VERTEX_ATTRIBS)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(re.GL.MAX_VARYING_COMPONENTS)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]}};var B=y(S(),1);var G=y(S(),1);function K(t,e,r){if(So(e))return r(t);let{nocatch:n=!0}=e;te(t),X(t,e);let i;if(n)i=r(t),q(t);else try{i=r(t)}finally{q(t)}return i}function So(t){for(let e in t)return!1;return!0}var N=y(S(),1);var h=y(S(),1);function vn(t,e,r,n){if(Ge(e))return n(t);let i=t;te(i.gl);try{return Xt(t,e),X(i.gl,r),n(t)}finally{q(i.gl)}}function wn(t,e,r){if(Ge(e))return r(t);te(t.gl);try{return Xt(t,e),r(t)}finally{q(t.gl)}}function Xt(t,e){let r=t,{gl:n}=r;if(e.cullMode)switch(e.cullMode){case"none":n.disable(h.GL.CULL_FACE);break;case"front":n.enable(h.GL.CULL_FACE),n.cullFace(h.GL.FRONT);break;case"back":n.enable(h.GL.CULL_FACE),n.cullFace(h.GL.BACK);break}if(e.frontFace&&n.frontFace(Ae("frontFace",e.frontFace,{ccw:h.GL.CCW,cw:h.GL.CW})),e.unclippedDepth&&t.features.has("depth-clip-control")&&n.enable(h.GL.DEPTH_CLAMP_EXT),e.depthBias!==void 0&&n.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0),t.features.has("provoking-vertex-webgl")){let s=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex;if(e.provokingVertex){let a=Ae("provokingVertex",e.provokingVertex,{first:h.GL.FIRST_VERTEX_CONVENTION_WEBGL,last:h.GL.LAST_VERTEX_CONVENTION_WEBGL});s?.provokingVertexWEBGL(a)}}if(t.features.has("polygon-mode-webgl")){let s=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode;if(e.polygonMode){let a=Ae("polygonMode",e.provokingVertex,{fill:h.GL.FILL_WEBGL,lint:h.GL.LINE_WEBGL});s?.polygonModeWEBGL(h.GL.FRONT,a),s?.polygonModeWEBGL(h.GL.BACK,a)}e.polygonOffsetLine&&n.enable(h.GL.POLYGON_OFFSET_LINE_WEBGL)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&n.enable(h.GL.CLIP_DISTANCE0_WEBGL),e.clipDistance1&&n.enable(h.GL.CLIP_DISTANCE1_WEBGL),e.clipDistance2&&n.enable(h.GL.CLIP_DISTANCE2_WEBGL),e.clipDistance3&&n.enable(h.GL.CLIP_DISTANCE3_WEBGL),e.clipDistance4&&n.enable(h.GL.CLIP_DISTANCE4_WEBGL),e.clipDistance5&&n.enable(h.GL.CLIP_DISTANCE5_WEBGL),e.clipDistance6&&n.enable(h.GL.CLIP_DISTANCE6_WEBGL),e.clipDistance7&&n.enable(h.GL.CLIP_DISTANCE7_WEBGL)),e.depthWriteEnabled!==void 0&&n.depthMask(yo("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(h.GL.DEPTH_TEST):n.disable(h.GL.DEPTH_TEST),n.depthFunc(Vt("depthCompare",e.depthCompare))),e.stencilWriteMask){let i=e.stencilWriteMask;n.stencilMaskSeparate(h.GL.FRONT,i),n.stencilMaskSeparate(h.GL.BACK,i)}if(e.stencilReadMask&&f.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let i=e.stencilReadMask||4294967295,s=Vt("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?n.enable(h.GL.STENCIL_TEST):n.disable(h.GL.STENCIL_TEST),n.stencilFuncSeparate(h.GL.FRONT,s,0,i),n.stencilFuncSeparate(h.GL.BACK,s,0,i)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let i=Pr("stencilPassOperation",e.stencilPassOperation),s=Pr("stencilFailOperation",e.stencilFailOperation),a=Pr("stencilDepthFailOperation",e.stencilDepthFailOperation);n.stencilOpSeparate(h.GL.FRONT,s,a,i),n.stencilOpSeparate(h.GL.BACK,s,a,i)}if(e.blendColorOperation||e.blendAlphaOperation){n.enable(h.GL.BLEND);let i=Dn("blendColorOperation",e.blendColorOperation||"add"),s=Dn("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(i,s);let a=kt("blendColorSrcFactor",e.blendColorSrcFactor||"one"),c=kt("blendColorDstFactor",e.blendColorDstFactor||"zero"),l=kt("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),d=kt("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(a,c,l,d)}}function Vt(t,e){return Ae(t,e,{never:h.GL.NEVER,less:h.GL.LESS,equal:h.GL.EQUAL,"less-equal":h.GL.LEQUAL,greater:h.GL.GREATER,"not-equal":h.GL.NOTEQUAL,"greater-equal":h.GL.GEQUAL,always:h.GL.ALWAYS})}function Pr(t,e){return Ae(t,e,{keep:h.GL.KEEP,zero:h.GL.ZERO,replace:h.GL.REPLACE,invert:h.GL.INVERT,"increment-clamp":h.GL.INCR,"decrement-clamp":h.GL.DECR,"increment-wrap":h.GL.INCR_WRAP,"decrement-wrap":h.GL.DECR_WRAP})}function Dn(t,e){return Ae(t,e,{add:h.GL.FUNC_ADD,subtract:h.GL.FUNC_SUBTRACT,"reverse-subtract":h.GL.FUNC_REVERSE_SUBTRACT,min:h.GL.MIN,max:h.GL.MAX})}function kt(t,e){return Ae(t,e,{one:h.GL.ONE,zero:h.GL.ZERO,"src-color":h.GL.SRC_COLOR,"one-minus-src-color":h.GL.ONE_MINUS_SRC_COLOR,"dst-color":h.GL.DST_COLOR,"one-minus-dst-color":h.GL.ONE_MINUS_DST_COLOR,"src-alpha":h.GL.SRC_ALPHA,"one-minus-src-alpha":h.GL.ONE_MINUS_SRC_ALPHA,"dst-alpha":h.GL.DST_ALPHA,"one-minus-dst-alpha":h.GL.ONE_MINUS_DST_ALPHA})}function xo(t,e){return`Illegal parameter ${e} for ${t}`}function Ae(t,e,r){if(!(e in r))throw new Error(xo(t,e));return r[e]}function yo(t,e){return e}function Kt(t){let e={};return t.addressModeU&&(e[N.GL.TEXTURE_WRAP_S]=Fr(t.addressModeU)),t.addressModeV&&(e[N.GL.TEXTURE_WRAP_T]=Fr(t.addressModeV)),t.addressModeW&&(e[N.GL.TEXTURE_WRAP_R]=Fr(t.addressModeW)),t.magFilter&&(e[N.GL.TEXTURE_MAG_FILTER]=On(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[N.GL.TEXTURE_MIN_FILTER]=Co(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[N.GL.TEXTURE_MIN_LOD]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[N.GL.TEXTURE_MAX_LOD]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[N.GL.TEXTURE_COMPARE_MODE]=N.GL.COMPARE_REF_TO_TEXTURE),t.compare&&(e[N.GL.TEXTURE_COMPARE_FUNC]=Vt("compare",t.compare)),t.maxAnisotropy&&(e[N.GL.TEXTURE_MAX_ANISOTROPY_EXT]=t.maxAnisotropy),e}function Fr(t){switch(t){case"clamp-to-edge":return N.GL.CLAMP_TO_EDGE;case"repeat":return N.GL.REPEAT;case"mirror-repeat":return N.GL.MIRRORED_REPEAT}}function On(t){switch(t){case"nearest":return N.GL.NEAREST;case"linear":return N.GL.LINEAR}}function Co(t,e){if(!e)return On(t);switch(t){case"nearest":return e==="nearest"?N.GL.NEAREST_MIPMAP_NEAREST:N.GL.NEAREST_MIPMAP_LINEAR;case"linear":return e==="nearest"?N.GL.LINEAR_MIPMAP_NEAREST:N.GL.LINEAR_MIPMAP_LINEAR}}var W=y(S(),1),H=class extends P{device;gl;handle;glTarget;glUsage;glIndexType=W.GL.UNSIGNED_SHORT;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Go(this.props.usage),this.glUsage=Po(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?W.GL.UNSIGNED_INT:W.GL.UNSIGNED_SHORT,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(e,r=0,n=e.byteLength+r){let i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,r,e),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(e,r,n),this.trackAllocatedMemory(n)}_initWithByteLength(e){R(e>=0);let r=e;e===0&&(r=new Float32Array(0));let n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){let s=W.GL.COPY_WRITE_BUFFER;this.gl.bindBuffer(s,this.handle),this.gl.bufferSubData(s,r,e),this.gl.bindBuffer(s,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let n=new Uint8Array(r),i=0;return this.gl.bindBuffer(W.GL.COPY_READ_BUFFER,this.handle),this.gl.getBufferSubData(W.GL.COPY_READ_BUFFER,e,n,i,r),this.gl.bindBuffer(W.GL.COPY_READ_BUFFER,null),this._setDebugData(n,e,r),n}};function Go(t){return t&P.INDEX?W.GL.ELEMENT_ARRAY_BUFFER:t&P.VERTEX?W.GL.ARRAY_BUFFER:t&P.UNIFORM?W.GL.UNIFORM_BUFFER:W.GL.ARRAY_BUFFER}function Po(t){return t&P.INDEX?W.GL.STATIC_DRAW:t&P.VERTEX?W.GL.STATIC_DRAW:t&P.UNIFORM?W.GL.DYNAMIC_DRAW:W.GL.STATIC_DRAW}var Br=y(S(),1);var ce=class extends Be{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=Kt(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,n]of Object.entries(e)){let i=Number(r);switch(i){case Br.GL.TEXTURE_MIN_LOD:case Br.GL.TEXTURE_MAX_LOD:this.device.gl.samplerParameterf(this.handle,i,n);break;default:this.device.gl.samplerParameteri(this.handle,i,n);break}}}};var se=class extends Pe{device;gl;handle;texture;constructor(e,r){super(e,{...I.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var Fo={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},$t=class extends I{MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(e,r){super(e,{...Fo,format:"rgba8unorm",...r}),this.device=e,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=G.GL.RGBA,this.target=Bo(this.props),this.loaded=!1,typeof this.props?.data=="string"&&Object.assign(this.props,{data:Tr(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(e){return new se(this.device,{...e,texture:this})}initialize(e={}){if(this.props.dimension==="cube")return this.initializeCube(e);let r=e.data;if(r instanceof Promise)return r.then(ne=>this.initialize(Object.assign({},e,{pixels:ne,data:ne}))),this;let n=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(e)),this;let{parameters:i={}}=e,{pixels:s=null,pixelStore:a={},textureUnit:c=void 0,mipmaps:l=!0}=e;r||(r=s);let{width:d,height:m,dataFormat:b,type:g,compressed:L=!1}=e,{depth:A=0}=e,D=gt(e.format);return{width:d,height:m,compressed:L,dataFormat:b,type:g}=this._deduceParameters({format:e.format,type:g,dataFormat:b,compressed:L,data:r,width:d,height:m}),this.width=d,this.height=m,this.glFormat=D,this.type=g,this.dataFormat=b,this.textureUnit=c,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(G.GL.TEXTURE0+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=l,this.setImageData({data:r,width:d,height:m,depth:A,format:D,type:g,dataFormat:b,parameters:a,compressed:L}),this.setSampler(e.sampler),this._setSamplerParameters(i),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),l&&this.device.isTextureFormatFilterable(e.format)&&this.generateMipmap(),n&&(this._video={video:r,parameters:i,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(e){let{mipmaps:r=!0,parameters:n={}}=e;return this.setCubeMapImageData(e).then(()=>{this.loaded=!0,r&&this.generateMipmap(e),this.setSampler(e.sampler),this._setSamplerParameters(n)}),this}setSampler(e={}){let r;e instanceof ce?(this.sampler=e,r=e.props):(this.sampler=new ce(this.device,e),r=e);let n=Kt(r);return this._setSamplerParameters(n),this}resize(e){let{height:r,width:n,mipmaps:i=!1}=e;return n!==this.width||r!==this.height?this.initialize({width:n,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:i}):this}update(){if(this._video){let{video:e,parameters:r,lastTime:n}=this._video;if(n===e.currentTime||e.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:e,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=e.currentTime}}generateMipmap(e={}){return this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),K(this.gl,e,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this}setImageData(e){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(e);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:n=null,level:i=0,glFormat:s=this.glFormat,offset:a=0,parameters:c={}}=e,{data:l=null,type:d=this.type,width:m=this.width,height:b=this.height,dataFormat:g=this.dataFormat,compressed:L=!1}=e;l||(l=n),{type:d,dataFormat:g,compressed:L,width:m,height:b}=this._deduceParameters({format:this.props.format,type:d,dataFormat:g,compressed:L,data:l,width:m,height:b});let{gl:A}=this;A.bindTexture(this.target,this.handle);let D=null;if({data:l,dataType:D}=this._getDataType({data:l,compressed:L}),K(this.gl,c,()=>{switch(D){case"null":A.texImage2D(r,i,s,m,b,0,g,d,l);break;case"typed-array":A.texImage2D(r,i,s,m,b,0,g,d,l,a);break;case"buffer":this.device.gl.bindBuffer(G.GL.PIXEL_UNPACK_BUFFER,l.handle||l),this.device.gl.texImage2D(r,i,s,m,b,0,g,d,a),this.device.gl.bindBuffer(G.GL.PIXEL_UNPACK_BUFFER,null);break;case"browser-object":A.texImage2D(r,i,s,m,b,0,g,d,l);break;case"compressed":for(let[ne,fe]of l.entries())A.compressedTexImage2D(r,ne,fe.format,fe.width,fe.height,0,fe.data);break;default:R(!1,"Unknown image data type")}}),l&&l.byteLength)this.trackAllocatedMemory(l.byteLength,"Texture");else{let ne=Et(this.props.format);this.trackAllocatedMemory(this.width*this.height*ne,"Texture")}return this.loaded=!0,this}setSubImageData({target:e=this.target,pixels:r=null,data:n=null,x:i=0,y:s=0,width:a=this.width,height:c=this.height,level:l=0,glFormat:d=this.glFormat,type:m=this.type,dataFormat:b=this.dataFormat,compressed:g=!1,offset:L=0,parameters:A={}}){if({type:m,dataFormat:b,compressed:g,width:a,height:c}=this._deduceParameters({format:this.props.format,type:m,dataFormat:b,compressed:g,data:n,width:a,height:c}),R(this.depth===1,"texSubImage not supported for 3D textures"),n||(n=r),n&&n.data){let D=n;n=D.data,a=D.shape[0],c=D.shape[1]}n instanceof H&&(n=n.handle),this.gl.bindTexture(this.target,this.handle),K(this.gl,A,()=>{g?this.gl.compressedTexSubImage2D(e,l,i,s,a,c,d,n):n===null?this.gl.texSubImage2D(e,l,i,s,a,c,b,m,null):ArrayBuffer.isView(n)?this.gl.texSubImage2D(e,l,i,s,a,c,b,m,n,L):typeof WebGLBuffer<"u"&&n instanceof WebGLBuffer?(this.device.gl.bindBuffer(G.GL.PIXEL_UNPACK_BUFFER,n),this.device.gl.texSubImage2D(e,l,i,s,a,c,b,m,L),this.device.gl.bindBuffer(G.GL.PIXEL_UNPACK_BUFFER,null)):this.device.gl.texSubImage2D(e,l,i,s,a,c,b,m,n)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(e={}){return f.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(G.GL.ACTIVE_TEXTURE)-G.GL.TEXTURE0}bind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(this.target,this.handle),e}unbind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(this.target,null),e}_getDataType({data:e,compressed:r=!1}){return r?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof H?{data:e.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(e){let{format:r,data:n}=e,{width:i,height:s,dataFormat:a,type:c,compressed:l}=e,d=Ve(r);return a=a||d.dataFormat,c=c||d.type,l=l||d.compressed,{width:i,height:s}=this._deduceImageSize(n,i,s),{dataFormat:a,type:c,compressed:l,width:i,height:s,format:r,data:n}}_deduceImageSize(e,r,n){let i;return typeof ImageData<"u"&&e instanceof ImageData?i={width:e.width,height:e.height}:typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?i={width:e.naturalWidth,height:e.naturalHeight}:typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement?i={width:e.width,height:e.height}:typeof ImageBitmap<"u"&&e instanceof ImageBitmap?i={width:e.width,height:e.height}:typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?i={width:e.videoWidth,height:e.videoHeight}:e?i={width:r,height:n}:i={width:r>=0?r:1,height:n>=0?n:1},R(i,"Could not deduced texture size"),R(r===void 0||i.width===r,"Deduced texture width does not match supplied width"),R(n===void 0||i.height===n,"Deduced texture height does not match supplied height"),i}async setCubeMapImageData(e){let{gl:r}=this,{width:n,height:i,pixels:s,data:a,format:c=G.GL.RGBA,type:l=G.GL.UNSIGNED_BYTE}=e,d=s||a,m=await Promise.all($t.FACES.map(b=>{let g=d[b];return Promise.all(Array.isArray(g)?g:[g])}));this.bind(),$t.FACES.forEach((b,g)=>{m[g].length>1&&this.props.mipmaps!==!1&&f.warn(`${this.id} has mipmap and multiple LODs.`)(),m[g].forEach((L,A)=>{n&&i?r.texImage2D(b,A,c,n,i,0,c,l,L):r.texImage2D(b,A,c,c,l,L)})}),this.unbind()}setImageDataForFace(e){let{face:r,width:n,height:i,pixels:s,data:a,format:c=G.GL.RGBA,type:l=G.GL.UNSIGNED_BYTE}=e,{gl:d}=this,m=s||a;return this.bind(),m instanceof Promise?m.then(b=>this.setImageDataForFace(Object.assign({},e,{face:r,data:b,pixels:b}))):this.width||this.height?d.texImage2D(r,0,c,n,i,0,c,l,m):d.texImage2D(r,0,c,c,l,m),this}setImageData3D(e){let{level:r=0,dataFormat:n,format:i,type:s,width:a,height:c,depth:l=1,offset:d=0,data:m,parameters:b={}}=e;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let g=Ve(i);if(K(this.gl,b,()=>{ArrayBuffer.isView(m)&&this.gl.texImage3D(this.target,r,g.format,a,c,l,0,g.dataFormat,g.type,m),m instanceof H&&(this.gl.bindBuffer(G.GL.PIXEL_UNPACK_BUFFER,m.handle),this.gl.texImage3D(this.target,r,n,a,c,l,0,i,s,d))}),m&&m.byteLength)this.trackAllocatedMemory(m.byteLength,"Texture");else{let L=Et(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*L,"Texture")}return this.loaded=!0,this}_setSamplerParameters(e){if(!Ge(e)){Io(e),this.gl.bindTexture(this.target,this.handle);for(let[r,n]of Object.entries(e)){let i=Number(r),s=n;switch(i){case G.GL.TEXTURE_MIN_LOD:case G.GL.TEXTURE_MAX_LOD:this.gl.texParameterf(this.target,i,s);break;default:this.gl.texParameteri(this.target,i,s);break}}this.gl.bindTexture(this.target,null)}}},U=$t;E(U,"FACES",[G.GL.TEXTURE_CUBE_MAP_POSITIVE_X,G.GL.TEXTURE_CUBE_MAP_NEGATIVE_X,G.GL.TEXTURE_CUBE_MAP_POSITIVE_Y,G.GL.TEXTURE_CUBE_MAP_NEGATIVE_Y,G.GL.TEXTURE_CUBE_MAP_POSITIVE_Z,G.GL.TEXTURE_CUBE_MAP_NEGATIVE_Z]);function Bo(t){switch(t.dimension){case"2d":return G.GL.TEXTURE_2D;case"cube":return G.GL.TEXTURE_CUBE_MAP;case"2d-array":return G.GL.TEXTURE_2D_ARRAY;case"3d":return G.GL.TEXTURE_3D;case"1d":case"cube-array":default:throw new Error(t.dimension)}}function Io(t){f.log(1,"texture sampler parameters",t)()}var J=class extends pe{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(e,r){super(e,r);let n=r.handle===null;if(this.device=e,this.gl=e.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),!n){e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.gl.bindFramebuffer(B.GL.FRAMEBUFFER,this.handle);for(let i=0;i<this.colorAttachments.length;++i){let s=this.colorAttachments[i],a=B.GL.COLOR_ATTACHMENT0+i;s&&this._attachOne(a,s)}if(this.depthStencilAttachment&&this._attachOne(In(this.depthStencilAttachment.props.format),this.depthStencilAttachment),r.check!==!1){let i=this.gl.checkFramebufferStatus(B.GL.FRAMEBUFFER);if(i!==B.GL.FRAMEBUFFER_COMPLETE)throw new Error(`Framebuffer ${Do(i)}`)}this.gl.bindFramebuffer(B.GL.FRAMEBUFFER,null)}}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}createDepthStencilTexture(e){return new U(this.device,{id:`${this.id}-depth-stencil`,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;e===void 0&&(e=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let n of this.colorAttachments)n.texture.resize({width:e,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.texture.resize({width:e,height:r}),this}_attachOne(e,r){if(Array.isArray(r)){let[n,i=0,s=0]=r;return this._attachTexture(e,n,i,s),n}if(r instanceof U)return this._attachTexture(e,r,0,0),r;if(r instanceof se){let n=r;return this._attachTexture(e,n.texture,n.props.baseMipLevel,n.props.baseArrayLayer),r.texture}throw new Error("attach")}_attachTexture(e,r,n,i){let{gl:s}=this.device;switch(s.bindTexture(r.target,r.handle),r.target){case B.GL.TEXTURE_2D_ARRAY:case B.GL.TEXTURE_3D:s.framebufferTextureLayer(B.GL.FRAMEBUFFER,e,r.target,i,n);break;case B.GL.TEXTURE_CUBE_MAP:let a=No(n);s.framebufferTexture2D(B.GL.FRAMEBUFFER,e,a,r.handle,i);break;case B.GL.TEXTURE_2D:s.framebufferTexture2D(B.GL.FRAMEBUFFER,e,B.GL.TEXTURE_2D,r.handle,i);break;default:R(!1,"Illegal texture type")}s.bindTexture(r.target,null)}};function No(t){return t<B.GL.TEXTURE_CUBE_MAP_POSITIVE_X?t+B.GL.TEXTURE_CUBE_MAP_POSITIVE_X:t}function Do(t){switch(t){case B.GL.FRAMEBUFFER_COMPLETE:return"success";case B.GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"Mismatched attachments";case B.GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"No attachments";case B.GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"Height/width mismatch";case B.GL.FRAMEBUFFER_UNSUPPORTED:return"Unsupported or split attachments";case B.GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:return"Samples mismatch";default:return`${t}`}}var Xe=class extends he{device;presentationSize;_framebuffer=null;constructor(e,r){super(r),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new J(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(r,e);return}}commit(){}};var vo={spector:f.get("spector")||f.get("inspect")},wo="https://spectorcdn.babylonjs.com/spector.bundle.js",Oo=1,$=null,Un=!1;async function Mn(t){if(!globalThis.SPECTOR)try{await at(wo)}catch(e){f.warn(String(e))}}function Wn(t){if(t={...vo,...t},!t?.spector||(!$&&globalThis.SPECTOR&&(f.probe(Oo,"SPECTOR found and initialized")(),$=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=$)),!$))return null;if(Un||(Un=!0,$.spyCanvases(),$?.onCaptureStarted.add(e=>f.info("Spector capture started:",e)()),$?.onCapture.add(e=>{f.info("Spector capture complete:",e)(),$?.getResultUI(),$?.resultView.display(),$?.resultView.addCapture(e)})),t?.canvas){if(typeof t.spector=="string"&&t.spector!==t.canvas.id)return $;$?.startCapture(t?.canvas,500),new Promise(e=>setTimeout(e,2e3)).then(e=>{f.info("Spector capture stopped after 2 seconds")(),$?.stopCapture()})}return $}var bt=y(S(),1);var Uo="https://unpkg.com/webgl-debug@2.0.1/index.js";function Hn(t){return t.luma=t.luma||{},t.luma}async function kn(){v()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await at(Uo))}function Vn(t,e={}){return t?e.debug?Wo(t,e):Mo(t):null}function Mo(t){let e=Hn(t);return e.realContext?e.realContext:t}function Wo(t,e){if(!globalThis.WebGLDebugUtils)return f.warn("webgl-debug not loaded")(),t;let r=Hn(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...bt.GL,...t});let n=globalThis.WebGLDebugUtils.makeDebugContext(t,Ho.bind(null,e),ko.bind(null,e));for(let a in bt.GL)!(a in n)&&typeof bt.GL[a]=="number"&&(n[a]=bt.GL[a]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(t)),Object.setPrototypeOf(i,n);let s=Object.create(i);return r.realContext=t,r.debugContext=s,s.debug=!0,s}function Ir(t,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function Ho(t,e,r,n){n=Array.from(n).map(c=>c===void 0?"undefined":c);let i=globalThis.WebGLDebugUtils.glEnumToString(e),s=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),a=`${i} in gl.${r}(${s})`;f.error(a)();debugger;if(t.throwOnError)throw new Error(a)}function ko(t,e,r){let n="";if(f.level>=1&&(n=Ir(e,r),f.log(1,n)()),t.break&&t.break.length>0&&(n=n||Ir(e,r),t.break.every(s=>n.indexOf(s)!==-1)))debugger;for(let i of r)if(i===void 0){if(n=n||Ir(e,r),t.throwOnError)throw new Error(`Undefined argument: ${n}`);f.error(`Undefined argument: ${n}`)();debugger}}var _t=y(S(),1);function Kn(t){let e=t.split(/\r?\n/),r=[];for(let n of e){if(n.length<=1)continue;let i=n.split(":");if(i.length===2){let[b,g]=i;r.push({message:g.trim(),type:Xn(b),lineNum:0,linePos:0});continue}let[s,a,c,...l]=i,d=parseInt(c,10);isNaN(d)&&(d=0);let m=parseInt(a,10);isNaN(m)&&(m=0),r.push({message:l.join(":").trim(),type:Xn(s),lineNum:d,linePos:m})}return r}function Xn(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var Ke=class extends Fe{device;handle;constructor(e,r){switch(super(e,r),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(_t.GL.VERTEX_SHADER);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(_t.GL.FRAGMENT_SHADER);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return Kn(e)}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)}async _compile(e){e=(i=>i.startsWith("#version ")?i:`#version 100
17
+ ${i}`)(e);let{gl:n}=this.device;if(n.shaderSource(this.handle,e),n.compileShader(this.handle),f.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);this.debugShader();return}f.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),f.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async i=>await new Promise(s=>setTimeout(s,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,_t.GL.COMPLETION_STATUS_KHR))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,_t.GL.COMPILE_STATUS)?"success":"error"}};var Dr=y(S(),1);var Vo=256,Xo=1024,Ko=16384,Nr=6144,$e=class extends Ne{device;glParameters;constructor(e,r){super(e,r),this.device=e,te(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){q(this.device.gl),this.props.framebuffer&&X(this.device.gl,{framebuffer:null})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[Dr.GL.RASTERIZER_DISCARD]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),r.scissorTest=Boolean(e.scissorRect),e.scissorRect&&(r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[Dr.GL.STENCIL_REF]=e.stencilReference),this.glParameters=r,X(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Ko,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Vo,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Xo,e.clearStencil=this.props.clearStencil),r!==0&&K(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){K(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(Nr,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(Nr,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(Nr,e,r);break}})}};var Re=y(S(),1);var x=y(S(),1);var Ye=y(S(),1);var O=y(S(),1),$o="Failed to deduce GL constant from typed array";function $n(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return O.GL.FLOAT;case Uint16Array:return O.GL.UNSIGNED_SHORT;case Uint32Array:return O.GL.UNSIGNED_INT;case Uint8Array:return O.GL.UNSIGNED_BYTE;case Uint8ClampedArray:return O.GL.UNSIGNED_BYTE;case Int8Array:return O.GL.BYTE;case Int16Array:return O.GL.SHORT;case Int32Array:return O.GL.INT;default:throw new Error($o)}}function Tt(t,e){let{clamped:r=!0}=e||{};switch(t){case O.GL.FLOAT:return Float32Array;case O.GL.UNSIGNED_SHORT:case O.GL.UNSIGNED_SHORT_5_6_5:case O.GL.UNSIGNED_SHORT_4_4_4_4:case O.GL.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;case O.GL.UNSIGNED_INT:return Uint32Array;case O.GL.UNSIGNED_BYTE:return r?Uint8ClampedArray:Uint8Array;case O.GL.BYTE:return Int8Array;case O.GL.SHORT:return Int16Array;case O.GL.INT:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var Yo={offset:0,stride:0,type:Ye.GL.FLOAT,size:1,divisor:0,normalized:!1,integer:!1},zo={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},ae=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return Tt(e.type||Ye.GL.FLOAT).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return R(e.size),Tt(e.type||Ye.GL.FLOAT).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new ae(Yo,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return ae.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return ae.getBytesPerVertex(this)}_assign(e={}){return e=_r("Accessor",e,zo),e.type!==void 0&&(this.type=e.type,(e.type===Ye.GL.INT||e.type===Ye.GL.UNSIGNED_INT)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};var p=y(S(),1);function Yn(t){return jo.includes(t)}var jo=[p.GL.SAMPLER_2D,p.GL.SAMPLER_CUBE,p.GL.SAMPLER_3D,p.GL.SAMPLER_2D_SHADOW,p.GL.SAMPLER_2D_ARRAY,p.GL.SAMPLER_2D_ARRAY_SHADOW,p.GL.SAMPLER_CUBE_SHADOW,p.GL.INT_SAMPLER_2D,p.GL.INT_SAMPLER_3D,p.GL.INT_SAMPLER_CUBE,p.GL.INT_SAMPLER_2D_ARRAY,p.GL.UNSIGNED_INT_SAMPLER_2D,p.GL.UNSIGNED_INT_SAMPLER_3D,p.GL.UNSIGNED_INT_SAMPLER_CUBE,p.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY],zn={[p.GL.FLOAT]:[p.GL.FLOAT,1,"float","f32","float32"],[p.GL.FLOAT_VEC2]:[p.GL.FLOAT,2,"vec2","vec2<f32>","float32x2"],[p.GL.FLOAT_VEC3]:[p.GL.FLOAT,3,"vec3","vec3<f32>","float32x3"],[p.GL.FLOAT_VEC4]:[p.GL.FLOAT,4,"vec4","vec4<f32>","float32x4"],[p.GL.INT]:[p.GL.INT,1,"int","i32","sint32"],[p.GL.INT_VEC2]:[p.GL.INT,2,"ivec2","vec2<i32>","sint32x2"],[p.GL.INT_VEC3]:[p.GL.INT,3,"ivec3","vec3<i32>","sint32x3"],[p.GL.INT_VEC4]:[p.GL.INT,4,"ivec4","vec4<i32>","sint32x4"],[p.GL.UNSIGNED_INT]:[p.GL.UNSIGNED_INT,1,"uint","u32","uint32"],[p.GL.UNSIGNED_INT_VEC2]:[p.GL.UNSIGNED_INT,2,"uvec2","vec2<u32>","uint32x2"],[p.GL.UNSIGNED_INT_VEC3]:[p.GL.UNSIGNED_INT,3,"uvec3","vec3<u32>","uint32x3"],[p.GL.UNSIGNED_INT_VEC4]:[p.GL.UNSIGNED_INT,4,"uvec4","vec4<u32>","uint32x4"],[p.GL.BOOL]:[p.GL.FLOAT,1,"bool","f32","float32"],[p.GL.BOOL_VEC2]:[p.GL.FLOAT,2,"bvec2","vec2<f32>","float32x2"],[p.GL.BOOL_VEC3]:[p.GL.FLOAT,3,"bvec3","vec3<f32>","float32x3"],[p.GL.BOOL_VEC4]:[p.GL.FLOAT,4,"bvec4","vec4<f32>","float32x4"],[p.GL.FLOAT_MAT2]:[p.GL.FLOAT,8,"mat2","mat2x2<f32>"],[p.GL.FLOAT_MAT2x3]:[p.GL.FLOAT,8,"mat2x3","mat2x3<f32>"],[p.GL.FLOAT_MAT2x4]:[p.GL.FLOAT,8,"mat2x4","mat2x4<f32>"],[p.GL.FLOAT_MAT3x2]:[p.GL.FLOAT,12,"mat3x2","mat3x2<f32>"],[p.GL.FLOAT_MAT3]:[p.GL.FLOAT,12,"mat3","mat3x3<f32>"],[p.GL.FLOAT_MAT3x4]:[p.GL.FLOAT,12,"mat3x4","mat3x4<f32>"],[p.GL.FLOAT_MAT4x2]:[p.GL.FLOAT,16,"mat4x2","mat4x2<f32>"],[p.GL.FLOAT_MAT4x3]:[p.GL.FLOAT,16,"mat4x3","mat4x3<f32>"],[p.GL.FLOAT_MAT4]:[p.GL.FLOAT,16,"mat4","mat4x4<f32>"]};function vr(t){let e=zn[t];if(!e)throw new Error("uniform");let[r,n,,i]=e;return{format:i,components:n,glType:r}}function jn(t){let e=zn[t];if(!e)throw new Error("attribute");let[,r,,n,i]=e;return{attributeType:n,vertexFormat:i,components:r}}function Yt(t,e){let r={attributes:[],bindings:[]};r.attributes=Qo(t,e);let n=Jo(t,e);for(let c of n){let l=c.uniforms.map(d=>({name:d.name,format:d.format,byteOffset:d.byteOffset,byteStride:d.byteStride,arrayLength:d.arrayLength}));r.bindings.push({type:"uniform",name:c.name,location:c.location,visibility:(c.vertex?1:0)&(c.fragment?2:0),minBindingSize:c.byteLength,uniforms:l})}let i=Zo(t,e),s=0;for(let c of i)if(Yn(c.type)){let{viewDimension:l,sampleType:d}=ts(c.type);r.bindings.push({type:"texture",name:c.name,location:s,viewDimension:l,sampleType:d}),c.textureUnit=s,s+=1}i.length&&(r.uniforms=i);let a=qo(t,e);return a?.length&&(r.varyings=a),r}function Qo(t,e){let r=[],n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){let s=t.getActiveAttrib(e,i);if(!s)throw new Error("activeInfo");let{name:a,type:c}=s,l=t.getAttribLocation(e,a);if(l>=0){let{attributeType:d}=jn(c),m=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:l,stepMode:m,type:d})}}return r.sort((i,s)=>i.location-s.location),r}function qo(t,e){let r=[],n=t.getProgramParameter(e,x.GL.TRANSFORM_FEEDBACK_VARYINGS);for(let i=0;i<n;i++){let s=t.getTransformFeedbackVarying(e,i);if(!s)throw new Error("activeInfo");let{name:a,type:c,size:l}=s,{glType:d,components:m}=vr(c),b=new ae({type:d,size:l*m}),g={location:i,name:a,accessor:b};r.push(g)}return r.sort((i,s)=>i.location-s.location),r}function Zo(t,e){let r=[],n=t.getProgramParameter(e,x.GL.ACTIVE_UNIFORMS);for(let i=0;i<n;i++){let s=t.getActiveUniform(e,i);if(!s)throw new Error("activeInfo");let{name:a,size:c,type:l}=s,{name:d,isArray:m}=rs(a),b=t.getUniformLocation(e,d),g={location:b,name:d,size:c,type:l,isArray:m};if(r.push(g),g.size>1)for(let L=0;L<g.size;L++){let A=`${d}[${L}]`;b=t.getUniformLocation(e,A);let D={...g,name:A,location:b};r.push(D)}}return r}function Jo(t,e){let r=(s,a)=>t.getActiveUniformBlockParameter(e,s,a),n=[],i=t.getProgramParameter(e,x.GL.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<i;s++){let a={name:t.getActiveUniformBlockName(e,s)||"",location:r(s,x.GL.UNIFORM_BLOCK_BINDING),byteLength:r(s,x.GL.UNIFORM_BLOCK_DATA_SIZE),vertex:r(s,x.GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),fragment:r(s,x.GL.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),uniformCount:r(s,x.GL.UNIFORM_BLOCK_ACTIVE_UNIFORMS),uniforms:[]},c=r(s,x.GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)||[],l=t.getActiveUniforms(e,c,x.GL.UNIFORM_TYPE),d=t.getActiveUniforms(e,c,x.GL.UNIFORM_SIZE),m=t.getActiveUniforms(e,c,x.GL.UNIFORM_OFFSET),b=t.getActiveUniforms(e,c,x.GL.UNIFORM_ARRAY_STRIDE);for(let g=0;g<a.uniformCount;++g){let L=t.getActiveUniform(e,c[g]);if(!L)throw new Error("activeInfo");a.uniforms.push({name:L.name,format:vr(l[g]).format,type:l[g],arrayLength:d[g],byteOffset:m[g],byteStride:b[g]})}n.push(a)}return n.sort((s,a)=>s.location-a.location),n}var es={[x.GL.SAMPLER_2D]:["2d","float"],[x.GL.SAMPLER_CUBE]:["cube","float"],[x.GL.SAMPLER_3D]:["3d","float"],[x.GL.SAMPLER_2D_SHADOW]:["3d","depth"],[x.GL.SAMPLER_2D_ARRAY]:["2d-array","float"],[x.GL.SAMPLER_2D_ARRAY_SHADOW]:["2d-array","depth"],[x.GL.SAMPLER_CUBE_SHADOW]:["cube","float"],[x.GL.INT_SAMPLER_2D]:["2d","sint"],[x.GL.INT_SAMPLER_3D]:["3d","sint"],[x.GL.INT_SAMPLER_CUBE]:["cube","sint"],[x.GL.INT_SAMPLER_2D_ARRAY]:["2d-array","uint"],[x.GL.UNSIGNED_INT_SAMPLER_2D]:["2d","uint"],[x.GL.UNSIGNED_INT_SAMPLER_3D]:["3d","uint"],[x.GL.UNSIGNED_INT_SAMPLER_CUBE]:["cube","uint"],[x.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY]:["2d-array","uint"]};function ts(t){let e=es[t];if(!e)throw new Error("sampler");let[r,n]=e;return{viewDimension:r,sampleType:n}}function rs(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}var T=y(S(),1);function Qn(t,e,r,n){let i=t,s=n;s===!0&&(s=1),s===!1&&(s=0);let a=typeof s=="number"?[s]:s;switch(r){case T.GL.SAMPLER_2D:case T.GL.SAMPLER_CUBE:case T.GL.SAMPLER_3D:case T.GL.SAMPLER_2D_SHADOW:case T.GL.SAMPLER_2D_ARRAY:case T.GL.SAMPLER_2D_ARRAY_SHADOW:case T.GL.SAMPLER_CUBE_SHADOW:case T.GL.INT_SAMPLER_2D:case T.GL.INT_SAMPLER_3D:case T.GL.INT_SAMPLER_CUBE:case T.GL.INT_SAMPLER_2D_ARRAY:case T.GL.UNSIGNED_INT_SAMPLER_2D:case T.GL.UNSIGNED_INT_SAMPLER_3D:case T.GL.UNSIGNED_INT_SAMPLER_CUBE:case T.GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:if(typeof n!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,n);case T.GL.FLOAT:return t.uniform1fv(e,a);case T.GL.FLOAT_VEC2:return t.uniform2fv(e,a);case T.GL.FLOAT_VEC3:return t.uniform3fv(e,a);case T.GL.FLOAT_VEC4:return t.uniform4fv(e,a);case T.GL.INT:return t.uniform1iv(e,a);case T.GL.INT_VEC2:return t.uniform2iv(e,a);case T.GL.INT_VEC3:return t.uniform3iv(e,a);case T.GL.INT_VEC4:return t.uniform4iv(e,a);case T.GL.BOOL:return t.uniform1iv(e,a);case T.GL.BOOL_VEC2:return t.uniform2iv(e,a);case T.GL.BOOL_VEC3:return t.uniform3iv(e,a);case T.GL.BOOL_VEC4:return t.uniform4iv(e,a);case T.GL.UNSIGNED_INT:return i.uniform1uiv(e,a,1);case T.GL.UNSIGNED_INT_VEC2:return i.uniform2uiv(e,a,2);case T.GL.UNSIGNED_INT_VEC3:return i.uniform3uiv(e,a,3);case T.GL.UNSIGNED_INT_VEC4:return i.uniform4uiv(e,a,4);case T.GL.FLOAT_MAT2:return t.uniformMatrix2fv(e,!1,a);case T.GL.FLOAT_MAT3:return t.uniformMatrix3fv(e,!1,a);case T.GL.FLOAT_MAT4:return t.uniformMatrix4fv(e,!1,a);case T.GL.FLOAT_MAT2x3:return i.uniformMatrix2x3fv(e,!1,a);case T.GL.FLOAT_MAT2x4:return i.uniformMatrix2x4fv(e,!1,a);case T.GL.FLOAT_MAT3x2:return i.uniformMatrix3x2fv(e,!1,a);case T.GL.FLOAT_MAT3x4:return i.uniformMatrix3x4fv(e,!1,a);case T.GL.FLOAT_MAT4x2:return i.uniformMatrix4x2fv(e,!1,a);case T.GL.FLOAT_MAT4x3:return i.uniformMatrix4x3fv(e,!1,a)}throw new Error("Illegal uniform")}var k=y(S(),1);function qn(t){switch(t){case"point-list":return k.GL.POINTS;case"line-list":return k.GL.LINES;case"line-strip":return k.GL.LINE_STRIP;case"line-loop-webgl":return k.GL.LINE_LOOP;case"triangle-list":return k.GL.TRIANGLES;case"triangle-strip":return k.GL.TRIANGLE_STRIP;case"triangle-fan-webgl":return k.GL.TRIANGLE_FAN;default:throw new Error(t)}}function Zn(t){switch(t){case"point-list":return k.GL.POINTS;case"line-list":return k.GL.LINES;case"line-strip":return k.GL.LINES;case"line-loop-webgl":return k.GL.LINES;case"triangle-list":return k.GL.TRIANGLES;case"triangle-strip":return k.GL.TRIANGLES;case"triangle-fan-webgl":return k.GL.TRIANGLES;default:throw new Error(t)}}var Jn=4,ze=class extends Ie{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:n,bufferMode:i=Re.GL.SEPARATE_ATTRIBS}=r;switch(n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,i)),this._linkShaders(),f.time(0,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Yt(this.device.gl,this.handle),f.timeEnd(0,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=fr(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":f.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e){for(let[r,n]of Object.entries(e)){let i=this.shaderLayout.bindings.find(s=>s.name===r)||this.shaderLayout.bindings.find(s=>s.name===`${r}Uniforms`);if(!i){let s=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");f.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${s}`)();continue}switch(n||f.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(n instanceof H)&&!(n.buffer instanceof H))throw new Error("buffer value");break;case"texture":if(!(n instanceof se||n instanceof U||n instanceof J))throw new Error("texture value");break;case"sampler":f.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(i.type)}this.bindings[r]=n}}draw(e){let{renderPass:r,vertexArray:n,vertexCount:i,instanceCount:s,firstVertex:a=0,transformFeedback:c}=e,l=qn(this.props.topology),d=Boolean(n.indexBuffer),m=n.indexBuffer?.glIndexType,b=Number(s)>0;if(this.linkStatus!=="success")return f.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||i===0)return f.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(i===0)return f.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),n.bindBeforeRender(r),c&&c.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let g=r;return vn(this.device,this.props.parameters,g.glParameters,()=>{d&&b?this.device.gl.drawElementsInstanced(l,i||0,m,a,s||0):d?this.device.gl.drawElements(l,i||0,m,a):b?this.device.gl.drawArraysInstanced(l,a,i||0,s||0):this.device.gl.drawArrays(l,a,i||0),c&&c.end()}),n.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=Er(e);Object.keys(r).forEach(n=>{f.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),f.time(Jn,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),f.timeEnd(Jn,`linkProgram for ${this.id}`)(),f.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}f.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),f.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,e.LINK_STATUS)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,e.VALIDATE_STATUS)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async i=>await new Promise(s=>setTimeout(s,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,Re.GL.COMPLETION_STATUS_KHR))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof U&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,n=0;for(let i of this.shaderLayout.bindings){let s=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!s)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:a}=i,c=e.getUniformBlockIndex(this.handle,a);if(c===Re.GL.INVALID_INDEX)throw new Error(`Invalid uniform block name ${a}`);e.uniformBlockBinding(this.handle,n,c),s instanceof H?e.bindBufferBase(Re.GL.UNIFORM_BUFFER,n,s.handle):e.bindBufferRange(Re.GL.UNIFORM_BUFFER,n,s.buffer.handle,s.offset||0,s.size||s.buffer.byteLength-s.offset),n+=1;break;case"texture":if(!(s instanceof se||s instanceof U||s instanceof J))throw new Error("texture");let l;if(s instanceof se)l=s.texture;else if(s instanceof U)l=s;else if(s instanceof J&&s.colorAttachments[0]instanceof U)f.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=s.colorAttachments[0];else throw new Error("No texture");e.activeTexture(Re.GL.TEXTURE0+r),e.bindTexture(l.target,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:n,type:i,textureUnit:s}=e,a=this.uniforms[r]??s;a!==void 0&&Qn(this.device.gl,n,i,a)}}};var j=y(S(),1);var zt=class extends ve{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":ns(this.device,r.options);break;case"copy-buffer-to-texture":is(this.device,r.options);break;case"copy-texture-to-buffer":os(this.device,r.options);break;case"copy-texture-to-texture":ss(this.device,r.options);break}}};function ns(t,e){let r=e.source,n=e.destination;t.gl.bindBuffer(j.GL.COPY_READ_BUFFER,r.handle),t.gl.bindBuffer(j.GL.COPY_WRITE_BUFFER,n.handle),t.gl.copyBufferSubData(j.GL.COPY_READ_BUFFER,j.GL.COPY_WRITE_BUFFER,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(j.GL.COPY_READ_BUFFER,null),t.gl.bindBuffer(j.GL.COPY_WRITE_BUFFER,null)}function is(t,e){throw new Error("Not implemented")}function os(t,e){let{source:r,mipLevel:n=0,aspect:i="all",width:s=e.source.width,height:a=e.source.height,depthOrArrayLayers:c=0,origin:l=[0,0],destination:d,byteOffset:m=0,bytesPerRow:b,rowsPerImage:g}=e;if(i!=="all")throw new Error("not supported");if(n!==0||c!==0||b||g)throw new Error("not implemented");let{framebuffer:L,destroyFramebuffer:A}=ei(r);try{let D=d,ne=s||L.width,fe=a||L.height,Ur=Ve(L.texture.props.format),ai=Ur.dataFormat,ui=Ur.type;t.gl.bindBuffer(j.GL.PIXEL_PACK_BUFFER,D.handle),t.gl.bindFramebuffer(j.GL.FRAMEBUFFER,L.handle),t.gl.readPixels(l[0],l[1],ne,fe,ai,ui,m)}finally{t.gl.bindBuffer(j.GL.PIXEL_PACK_BUFFER,null),t.gl.bindFramebuffer(j.GL.FRAMEBUFFER,null),A&&L.destroy()}}function ss(t,e){let{source:r,origin:n=[0,0],destination:i}=e,{width:s=e.destination.width,height:a=e.destination.width}=e,c=0,l=j.GL.RGBA,{framebuffer:d,destroyFramebuffer:m}=ei(r),[b,g]=n,L=!1;t.gl.bindFramebuffer(j.GL.FRAMEBUFFER,d.handle);let A=null,D;if(i instanceof U)A=i,s=Number.isFinite(s)?s:A.width,a=Number.isFinite(a)?a:A.height,A.bind(0),D=A.destination;else throw new Error("whoops");return L||t.gl.copyTexImage2D(D,c,l,b,g,s,a,0),A&&A.unbind(),m&&d.destroy(),A}function ei(t){if(t instanceof I){let{width:e,height:r,id:n}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${n}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var je=class extends De{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new zt(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,n){}};var Qe=y(S(),1);var Ee=class extends we{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return Ct()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==Qe.GL.ELEMENT_ARRAY_BUFFER)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(Qe.GL.ELEMENT_ARRAY_BUFFER,r?r.handle:null),this.indexBuffer=r}setBuffer(e,r){let n=r;if(n.glTarget===Qe.GL.ELEMENT_ARRAY_BUFFER)throw new Error("Use .setIndexBuffer()");let{size:i,type:s,stride:a,offset:c,normalized:l,integer:d,divisor:m}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(Qe.GL.ARRAY_BUFFER,n.handle),d?this.device.gl.vertexAttribIPointer(e,i,s,a,c):this.device.gl.vertexAttribPointer(e,i,s,l,a,c),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,m||0),this.attributes[e]=n}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}init=!1;bindBeforeRender(){if(this.device.gl.bindVertexArray(this.handle),!this.init){let e=this.indexBuffer;this.device.gl.bindBuffer(Qe.GL.ELEMENT_ARRAY_BUFFER,e?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let n=wt(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let i=Ee.isConstantAttributeZeroSupported(this.device)||e!==0;(r||i)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let n=as(r),i=n.byteLength*e,s=n.length*e;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let a=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),a=a||!us(n,this.bufferValue),a){let c=pr(r.constructor,s);gr({target:c,source:n,start:0,count:s}),this.buffer.write(c),this.bufferValue=r}return this.buffer}};function as(t){return Array.isArray(t)?new Float32Array(t):t}function us(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var le=y(S(),1);var qe=class extends Oe{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(le.GL.TRANSFORM_FEEDBACK,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(Zn(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(le.GL.TRANSFORM_FEEDBACK,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let n=this._getVaryingIndex(e),{buffer:i,byteLength:s,byteOffset:a}=this._getBufferRange(r);if(n<0){this.unusedBuffers[e]=i,f.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[n]={buffer:i,byteLength:s,byteOffset:a},this.bindOnUse||this._bindBuffer(n,i,a,s)}getBuffer(e){if(ti(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(le.GL.TRANSFORM_FEEDBACK,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(le.GL.TRANSFORM_FEEDBACK,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(le.GL.TRANSFORM_FEEDBACK,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof H)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=e.buffer.byteLength}=e;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(e){if(ti(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,i,n)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(le.GL.TRANSFORM_FEEDBACK_BUFFER,Number(e),null)}_bindBuffer(e,r,n=0,i){let s=r&&r.handle;!s||i===void 0?this.gl.bindBufferBase(le.GL.TRANSFORM_FEEDBACK_BUFFER,e,s):this.gl.bindBufferRange(le.GL.TRANSFORM_FEEDBACK_BUFFER,e,s,n,i)}};function ti(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var be=y(S(),1),jt=class extends Ue{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(be.GL.TIME_ELAPSED_EXT)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?be.GL.ANY_SAMPLES_PASSED_CONSERVATIVE:be.GL.ANY_SAMPLES_PASSED)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(be.GL.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,be.GL.QUERY_RESULT_AVAILABLE);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(be.GL.GPU_DISJOINT_EXT)}getResult(){return this.device.gl.getQueryParameter(this.handle,be.GL.QUERY_RESULT)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((n,i)=>{let s=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):r++>e?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(s)};requestAnimationFrame(s)}),this._pollingPromise}};var ue=y(S(),1);var V=y(S(),1);function wr(t){switch(t){case V.GL.ALPHA:case V.GL.R32F:case V.GL.RED:return 1;case V.GL.RG32F:case V.GL.RG:return 2;case V.GL.RGB:case V.GL.RGB32F:return 3;case V.GL.RGBA:case V.GL.RGBA32F:return 4;default:return R(!1),0}}function ri(t){switch(t){case V.GL.UNSIGNED_BYTE:return 1;case V.GL.UNSIGNED_SHORT_5_6_5:case V.GL.UNSIGNED_SHORT_4_4_4_4:case V.GL.UNSIGNED_SHORT_5_5_5_1:return 2;case V.GL.FLOAT:return 4;default:return R(!1),0}}function ni(t,e){let{sourceX:r=0,sourceY:n=0,sourceFormat:i=ue.GL.RGBA,sourceAttachment:s=ue.GL.COLOR_ATTACHMENT0}=e||{},{target:a=null,sourceWidth:c,sourceHeight:l,sourceType:d}=e||{},{framebuffer:m,deleteFramebuffer:b}=oi(t);R(m);let{gl:g,handle:L}=m;c=c||m.width,l=l||m.height;let A=s-ue.GL.COLOR_ATTACHMENT0;d=d||m.colorAttachments[A]?.texture?.type||ue.GL.UNSIGNED_BYTE,a=ls(a,d,i,c,l),d=d||$n(a);let D=g.bindFramebuffer(ue.GL.FRAMEBUFFER,L);return g.readPixels(r,n,c,l,i,d,a),g.bindFramebuffer(ue.GL.FRAMEBUFFER,D||null),b&&m.destroy(),a}function ii(t,e){let{target:r,sourceX:n=0,sourceY:i=0,sourceFormat:s=ue.GL.RGBA,targetByteOffset:a=0}=e||{},{sourceWidth:c,sourceHeight:l,sourceType:d}=e||{},{framebuffer:m,deleteFramebuffer:b}=oi(t);R(m),c=c||m.width,l=l||m.height;let g=m;d=d||ue.GL.UNSIGNED_BYTE;let L=r;if(!L){let D=wr(s),ne=ri(d),fe=a+c*l*D*ne;L=g.device.createBuffer({byteLength:fe})}let A=t.device.createCommandEncoder();return A.copyTextureToBuffer({source:t,width:c,height:l,origin:[n,i],destination:L,byteOffset:a}),A.destroy(),b&&m.destroy(),L}function oi(t){return t instanceof pe?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:cs(t),deleteFramebuffer:!0}}function cs(t,e){let{device:r,width:n,height:i,id:s}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${s}`,width:n,height:i,colorAttachments:[t]})}function ls(t,e,r,n,i){if(t)return t;e=e||ue.GL.UNSIGNED_BYTE;let s=Tt(e,{clamped:!1}),a=wr(r);return new s(n*i*a)}var fs=256,ds=1024,ms=16384;var hs="clear: bad arguments";function si(t,e){let{framebuffer:r=null,color:n=null,depth:i=null,stencil:s=null}=e||{},a={};r&&(a.framebuffer=r);let c=0;n&&(c|=ms,n!==!0&&(a.clearColor=n)),i&&(c|=fs,i!==!0&&(a.clearDepth=i)),s&&(c|=ds,i!==!0&&(a.clearStencil=i)),R(c!==0,hs);let l=t.gl;K(l,a,()=>{l.clear(c)})}var Lt=1,Ze=class extends me{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof Ze)return e;if(e?.device instanceof me)return e.device;if(!ps(e))throw new Error("Invalid WebGL2RenderingContext");return new Ze({gl:e})}static async create(e={}){f.groupCollapsed(Lt,"WebGLDevice created")();let r=[];e.debug&&r.push(kn()),e.spector&&r.push(Mn()),typeof e.canvas=="string"&&r.push(he.pageLoaded);let n=await Promise.allSettled(r);for(let a of n)a.status==="rejected"&&f.error(`Failed to initialize debug libraries ${a.reason}`)();if(f.probe(Lt+1,"DOM is loaded")(),e.gl?.device)return f.warn("reattaching existing device")(),Ze.attach(e.gl);let i=new Ze(e),s=`Created ${i.type}${i.debug?" debug":""} context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return f.probe(Lt,s)(),f.table(Lt,i.info)(),f.groupEnd(Lt)(),i}constructor(e){super({...e,id:e.id||ee("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let n=e.gl?.canvas||e.canvas;this.canvasContext=new Xe(this,{...e,canvas:n}),this.lost=new Promise(c=>{this._resolveContextLost=c});let i=e.gl||null;if(i||=Tn(this.canvasContext.canvas,{...e,onContextLost:c=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!i)throw new Error("WebGL context creation failed");this.handle=i,this.gl=i,this.gl.device=this,this.gl._version=2,this.info=Ln(this.gl,this._extensions),this.limits=new Ht(this.gl),this.features=new Wt(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:s=!0,copyState:a=!1}=e;lt(this.gl,{enable:s,copyState:a,log:(...c)=>f.log(1,...c)()}),e.debug&&(this.gl=Vn(this.gl,{...e,throwOnError:!0}),this.debug=!0,f.level=Math.max(f.level,1),f.warn("WebGL debug mode activated. Performance reduced.")()),e.spector&&(this.spectorJS=Wn({...this.props,canvas:this.handle.canvas}))}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return pt(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return Fn(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return Bn(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new H(this,r)}_createTexture(e){return new U(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new ce(this,e)}createShader(e){return new Ke(this,e)}createFramebuffer(e){return new J(this,e)}createVertexArray(e){return new Ee(this,e)}createTransformFeedback(e){return new qe(this,e)}createQuerySet(e){return new jt(this,e)}createRenderPipeline(e){return new ze(this,e)}beginRenderPass(e){return new $e(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e){return new je(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return ni(e,r)}readPixelsToBufferWebGL(e,r){return ii(e,r)}setParametersWebGL(e){X(this.gl,e)}getParametersWebGL(e){return Me(this.gl,e)}withParametersWebGL(e,r){K(this.gl,e,r)}clearWebGL(e){si(this,e)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(e=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){te(this.gl)}popState(){q(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let n=Number(e);for(let i in r)if(r[i]===n)return`GL.${i}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let i=this._constants[e];switch(i&&_s(i,r)&&f.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:gs(this,e,r);break;case Int32Array:Es(this,e,r);break;case Uint32Array:bs(this,e,r);break;default:R(!1)}}getExtension(e){return Z(this.gl,e,this._extensions),this._extensions}},At=Ze;E(At,"type","webgl");function ps(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function gs(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:R(!1)}}function Es(t,e,r){t.gl.vertexAttribI4iv(e,r)}function bs(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function _s(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var Je="Resource subclass must define virtual methods",Se=class extends _{device;gl;gl2;_handle;_bound=!1;byteLength=0;constructor(e,r,n){super(e,r,n),this.device=e;let i=this.device.gl,{id:s}=r||{};this.gl=i,this.gl2=i,this.id=s||ee(this.constructor.name),this._handle=r?.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0}toString(){return`${this.constructor.name}(${this.id})`}get handle(){return this._handle}delete({deleteChildren:e=!1}={}){let r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this.removeStats(),this._handle=null,r&&e&&r.filter(Boolean).forEach(n=>n.destroy()),this}bind(e=this.handle){if(typeof e!="function")return this._bindHandle(e),this;let r;return this._bound?r=e():(this._bindHandle(this.handle),this._bound=!0,r=e(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}stubRemovedMethods(e,r,n){return br(this,e,r,n)}initialize(e){}_createHandle(){throw new Error(Je)}_deleteHandle(){throw new Error(Je)}_bindHandle(e){throw new Error(Je)}_getOptsFromHandle(){throw new Error(Je)}_getParameter(e,r){throw new Error(Je)}_setParameter(e,r){throw new Error(Je)}};var et=y(S(),1);var Or=class extends Se{get[Symbol.toStringTag](){return"Renderbuffer"}get width(){return this.props.width}get height(){return this.props.height}get format(){return this.props.format}get samples(){return this.props.samples}get attachment(){}glFormat;static isTextureFormatSupported(e,r){return Gn(e.gl,r,e._extensions)}constructor(e,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(e,r,Or.defaultProps),this.glFormat=gt(this.props.format),this._initialize(this.props)}resize(e){(e.width!==this.width||e.height!==this.height)&&(Object.assign(this.props,{...e,format:this.format,samples:this.samples}),this._initialize(this.props))}_initialize(e){let{format:r,width:n,height:i,samples:s}=e;R(r,"Needs format"),this.trackDeallocatedMemory(),this.gl.bindRenderbuffer(et.GL.RENDERBUFFER,this.handle),s!==0?this.gl.renderbufferStorageMultisample(et.GL.RENDERBUFFER,s,this.glFormat,n,i):this.gl.renderbufferStorage(et.GL.RENDERBUFFER,this.glFormat,n,i),this.gl.bindRenderbuffer(et.GL.RENDERBUFFER,null),this.trackAllocatedMemory(n*i*(s||1)*Et(this.format))}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this.trackDeallocatedMemory()}_bindHandle(e){this.gl.bindRenderbuffer(et.GL.RENDERBUFFER,e)}},Rt=Or;E(Rt,"defaultProps",{id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0});return Ei(Ts);})();
51
18
  return __exports__;
52
19
  });