@luma.gl/engine 9.0.0-alpha.9 → 9.0.0-beta.2

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 (191) hide show
  1. package/LICENSE +3 -1
  2. package/dist/animation/key-frames.d.ts +1 -1
  3. package/dist/animation/key-frames.d.ts.map +1 -1
  4. package/dist/animation/key-frames.js +6 -27
  5. package/dist/animation/key-frames.js.map +1 -1
  6. package/dist/animation/timeline.d.ts +8 -8
  7. package/dist/animation/timeline.d.ts.map +1 -1
  8. package/dist/animation/timeline.js +18 -49
  9. package/dist/animation/timeline.js.map +1 -1
  10. package/dist/animation-loop/animation-loop-template.d.ts +23 -0
  11. package/dist/animation-loop/animation-loop-template.d.ts.map +1 -0
  12. package/dist/animation-loop/animation-loop-template.js +7 -0
  13. package/dist/animation-loop/animation-loop-template.js.map +1 -0
  14. package/dist/{lib → animation-loop}/animation-loop.d.ts +30 -22
  15. package/dist/animation-loop/animation-loop.d.ts.map +1 -0
  16. package/dist/{lib → animation-loop}/animation-loop.js +77 -192
  17. package/dist/animation-loop/animation-loop.js.map +1 -0
  18. package/dist/{lib → animation-loop}/animation-props.d.ts +2 -3
  19. package/dist/animation-loop/animation-props.d.ts.map +1 -0
  20. package/dist/animation-loop/animation-props.js.map +1 -0
  21. package/dist/animation-loop/make-animation-loop.d.ts +6 -0
  22. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -0
  23. package/dist/animation-loop/make-animation-loop.js +28 -0
  24. package/dist/animation-loop/make-animation-loop.js.map +1 -0
  25. package/dist/debug/copy-texture-to-image.d.ts +26 -0
  26. package/dist/debug/copy-texture-to-image.d.ts.map +1 -0
  27. package/dist/debug/copy-texture-to-image.js +46 -0
  28. package/dist/debug/copy-texture-to-image.js.map +1 -0
  29. package/dist/debug/debug-framebuffer.d.ts +11 -0
  30. package/dist/debug/debug-framebuffer.d.ts.map +1 -0
  31. package/dist/debug/debug-framebuffer.js +43 -0
  32. package/dist/debug/debug-framebuffer.js.map +1 -0
  33. package/dist/debug/debug-shader-layout.d.ts +9 -0
  34. package/dist/debug/debug-shader-layout.d.ts.map +1 -0
  35. package/dist/debug/debug-shader-layout.js +28 -0
  36. package/dist/debug/debug-shader-layout.js.map +1 -0
  37. package/dist/debug/pixel-data-utils.d.ts +24 -0
  38. package/dist/debug/pixel-data-utils.d.ts.map +1 -0
  39. package/dist/debug/pixel-data-utils.js +41 -0
  40. package/dist/debug/pixel-data-utils.js.map +1 -0
  41. package/dist/dist.dev.js +10073 -0
  42. package/dist/geometries/cone-geometry.d.ts +1 -1
  43. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  44. package/dist/geometries/cone-geometry.js +6 -5
  45. package/dist/geometries/cone-geometry.js.map +1 -1
  46. package/dist/geometries/cube-geometry.d.ts +2 -2
  47. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  48. package/dist/geometries/cube-geometry.js +16 -10
  49. package/dist/geometries/cube-geometry.js.map +1 -1
  50. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  51. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  52. package/dist/geometries/cylinder-geometry.js +6 -5
  53. package/dist/geometries/cylinder-geometry.js.map +1 -1
  54. package/dist/geometries/ico-sphere-geometry.d.ts +2 -2
  55. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  56. package/dist/geometries/ico-sphere-geometry.js +10 -19
  57. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  58. package/dist/geometries/plane-geometry.d.ts +2 -2
  59. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  60. package/dist/geometries/plane-geometry.js +14 -23
  61. package/dist/geometries/plane-geometry.js.map +1 -1
  62. package/dist/geometries/sphere-geometry.d.ts +2 -2
  63. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  64. package/dist/geometries/sphere-geometry.js +9 -13
  65. package/dist/geometries/sphere-geometry.js.map +1 -1
  66. package/dist/geometries/truncated-cone-geometry.d.ts +2 -4
  67. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  68. package/dist/geometries/truncated-cone-geometry.js +9 -25
  69. package/dist/geometries/truncated-cone-geometry.js.map +1 -1
  70. package/dist/geometry/geometry-table.d.ts +2 -2
  71. package/dist/geometry/geometry-table.d.ts.map +1 -1
  72. package/dist/geometry/geometry-table.js.map +1 -1
  73. package/dist/geometry/geometry-utils.d.ts.map +1 -1
  74. package/dist/geometry/geometry-utils.js +0 -9
  75. package/dist/geometry/geometry-utils.js.map +1 -1
  76. package/dist/geometry/geometry.d.ts +43 -43
  77. package/dist/geometry/geometry.d.ts.map +1 -1
  78. package/dist/geometry/geometry.js +20 -86
  79. package/dist/geometry/geometry.js.map +1 -1
  80. package/dist/geometry/gpu-geometry.d.ts +37 -0
  81. package/dist/geometry/gpu-geometry.d.ts.map +1 -0
  82. package/dist/geometry/gpu-geometry.js +110 -0
  83. package/dist/geometry/gpu-geometry.js.map +1 -0
  84. package/dist/geometry/gpu-table.d.ts +1 -0
  85. package/dist/geometry/gpu-table.d.ts.map +1 -0
  86. package/dist/geometry/gpu-table.js +2 -0
  87. package/dist/geometry/gpu-table.js.map +1 -0
  88. package/dist/index.cjs +3120 -0
  89. package/dist/index.d.ts +24 -8
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +23 -14
  92. package/dist/index.js.map +1 -1
  93. package/dist/lib/clip-space.d.ts +8 -0
  94. package/dist/lib/clip-space.d.ts.map +1 -1
  95. package/dist/lib/clip-space.js +47 -0
  96. package/dist/lib/clip-space.js.map +1 -1
  97. package/dist/lib/pipeline-factory.d.ts +12 -46
  98. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  99. package/dist/lib/pipeline-factory.js +36 -179
  100. package/dist/lib/pipeline-factory.js.map +1 -1
  101. package/dist/model/model.d.ts +206 -0
  102. package/dist/model/model.d.ts.map +1 -0
  103. package/dist/model/model.js +440 -0
  104. package/dist/model/model.js.map +1 -0
  105. package/dist/scenegraph/group-node.d.ts +21 -0
  106. package/dist/scenegraph/group-node.d.ts.map +1 -0
  107. package/dist/scenegraph/group-node.js +94 -0
  108. package/dist/scenegraph/group-node.js.map +1 -0
  109. package/dist/scenegraph/model-node.d.ts +18 -0
  110. package/dist/scenegraph/model-node.d.ts.map +1 -0
  111. package/dist/scenegraph/model-node.js +28 -0
  112. package/dist/scenegraph/model-node.js.map +1 -0
  113. package/dist/scenegraph/scenegraph-node.d.ts +56 -0
  114. package/dist/scenegraph/scenegraph-node.d.ts.map +1 -0
  115. package/dist/scenegraph/scenegraph-node.js +141 -0
  116. package/dist/scenegraph/scenegraph-node.js.map +1 -0
  117. package/dist/shader-inputs.d.ts +63 -0
  118. package/dist/shader-inputs.d.ts.map +1 -0
  119. package/dist/shader-inputs.js +66 -0
  120. package/dist/shader-inputs.js.map +1 -0
  121. package/dist/transform/buffer-transform.d.ts +35 -0
  122. package/dist/transform/buffer-transform.d.ts.map +1 -0
  123. package/dist/transform/buffer-transform.js +62 -0
  124. package/dist/transform/buffer-transform.js.map +1 -0
  125. package/dist/transform/texture-transform.d.ts +57 -0
  126. package/dist/transform/texture-transform.d.ts.map +1 -0
  127. package/dist/transform/texture-transform.js +122 -0
  128. package/dist/transform/texture-transform.js.map +1 -0
  129. package/dist.min.js +293 -0
  130. package/package.json +21 -12
  131. package/src/animation/timeline.ts +15 -14
  132. package/src/animation-loop/animation-loop-template.ts +23 -0
  133. package/src/{lib → animation-loop}/animation-loop.ts +99 -88
  134. package/src/{lib → animation-loop}/animation-props.ts +1 -1
  135. package/src/animation-loop/make-animation-loop.ts +44 -0
  136. package/src/debug/copy-texture-to-image.ts +72 -0
  137. package/src/debug/debug-framebuffer.ts +57 -0
  138. package/src/debug/debug-shader-layout.ts +38 -0
  139. package/src/debug/pixel-data-utils.ts +57 -0
  140. package/src/geometries/cone-geometry.ts +1 -1
  141. package/src/geometries/cube-geometry.ts +47 -45
  142. package/src/geometries/cylinder-geometry.ts +2 -2
  143. package/src/geometries/ico-sphere-geometry.ts +6 -5
  144. package/src/geometries/plane-geometry.ts +5 -4
  145. package/src/geometries/sphere-geometry.ts +4 -3
  146. package/src/geometries/truncated-cone-geometry.ts +4 -13
  147. package/src/geometry/geometry-table.ts +1 -1
  148. package/src/geometry/geometry-utils.ts +19 -3
  149. package/src/geometry/geometry.ts +65 -110
  150. package/src/geometry/gpu-geometry.ts +125 -0
  151. package/src/geometry/gpu-table.ts +41 -0
  152. package/src/index.ts +34 -10
  153. package/src/lib/clip-space.ts +22 -21
  154. package/src/lib/pipeline-factory.ts +48 -179
  155. package/src/model/model.ts +733 -0
  156. package/src/scenegraph/group-node.ts +103 -0
  157. package/src/scenegraph/model-node.ts +50 -0
  158. package/src/scenegraph/scenegraph-node.ts +204 -0
  159. package/src/shader-inputs.ts +150 -0
  160. package/src/transform/buffer-transform.ts +94 -0
  161. package/src/transform/texture-transform.ts +169 -0
  162. package/dist/bundle.d.ts +0 -2
  163. package/dist/bundle.d.ts.map +0 -1
  164. package/dist/bundle.js +0 -5
  165. package/dist/bundle.js.map +0 -1
  166. package/dist/geometry/primitive-utils.d.ts +0 -1
  167. package/dist/geometry/primitive-utils.d.ts.map +0 -1
  168. package/dist/geometry/primitive-utils.js +0 -2
  169. package/dist/geometry/primitive-utils.js.map +0 -1
  170. package/dist/lib/animation-loop.d.ts.map +0 -1
  171. package/dist/lib/animation-loop.js.map +0 -1
  172. package/dist/lib/animation-props.d.ts.map +0 -1
  173. package/dist/lib/animation-props.js.map +0 -1
  174. package/dist/lib/model-utils.d.ts +0 -5
  175. package/dist/lib/model-utils.d.ts.map +0 -1
  176. package/dist/lib/model-utils.js +0 -45
  177. package/dist/lib/model-utils.js.map +0 -1
  178. package/dist/lib/model.d.ts +0 -41
  179. package/dist/lib/model.d.ts.map +0 -1
  180. package/dist/lib/model.js +0 -182
  181. package/dist/lib/model.js.map +0 -1
  182. package/dist/lib/render-loop.d.ts +0 -14
  183. package/dist/lib/render-loop.d.ts.map +0 -1
  184. package/dist/lib/render-loop.js +0 -49
  185. package/dist/lib/render-loop.js.map +0 -1
  186. package/src/bundle.ts +0 -4
  187. package/src/geometry/primitive-utils.ts +0 -30
  188. package/src/lib/model-utils.ts +0 -124
  189. package/src/lib/model.ts +0 -183
  190. package/src/lib/render-loop.ts +0 -58
  191. /package/dist/{lib → animation-loop}/animation-props.js +0 -0
package/dist.min.js ADDED
@@ -0,0 +1,293 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if (typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if (typeof define === 'function' && define.amd) define([], factory);
5
+ else if (typeof exports === 'object') exports['luma'] = factory();
6
+ else root['luma'] = factory();})(globalThis, function () {
7
+ "use strict";var __exports__=(()=>{var en=Object.defineProperty;var mf=Object.getOwnPropertyDescriptor;var df=Object.getOwnPropertyNames;var yf=Object.prototype.hasOwnProperty;var vf=(t,e)=>{for(var r in e)en(t,r,{get:e[r],enumerable:!0})},gf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of df(e))!yf.call(t,i)&&i!==r&&en(t,i,{get:()=>e[i],enumerable:!(n=mf(e,i))||n.enumerable});return t};var _f=t=>gf(en({},"__esModule",{value:!0}),t);var mv={};vf(mv,{AnimationLoop:()=>_r,AnimationLoopTemplate:()=>ci,BufferTransform:()=>iu,ClipSpace:()=>bu,ConeGeometry:()=>Lu,CubeGeometry:()=>Cu,CylinderGeometry:()=>Bu,GPUGeometry:()=>Fr,Geometry:()=>ut,GroupNode:()=>Su,IcoSphereGeometry:()=>Hu,KeyFrames:()=>si,Model:()=>bt,ModelNode:()=>Pu,PipelineFactory:()=>Je,PlaneGeometry:()=>Zu,ScenegraphNode:()=>Wt,SphereGeometry:()=>ef,TextureTransform:()=>fu,Timeline:()=>oi,TruncatedConeGeometry:()=>ve,_ShaderInputs:()=>Cr,makeAnimationLoop:()=>To});function Oe(t){return Oe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oe(t)}function bf(t,e){return Sf(t)||xf(t,e)||ii(t,e)||wf()}function wf(){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 xf(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function Sf(t){if(Array.isArray(t))return t}function rn(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ii(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function ii(t,e){if(t){if(typeof t=="string")return ri(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ri(t,e)}}function ri(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ni(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pf(n.key),n)}}function Of(t,e,r){return e&&ni(t.prototype,e),r&&ni(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pf(t){var e=Ef(t,"string");return Oe(e)==="symbol"?e:String(e)}function Ef(t,e){if(Oe(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Oe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Af(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Tf=1,kf=1,oi=function(){function t(){Af(this,t),this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}var e=t.prototype;return e.addChannel=function(n){var i=n.delay,o=i===void 0?0:i,a=n.duration,u=a===void 0?Number.POSITIVE_INFINITY:a,s=n.rate,f=s===void 0?1:s,p=n.repeat,d=p===void 0?1:p,g=Tf++,S={time:0,delay:o,duration:u,rate:f,repeat:d};return this._setChannelTime(S,this.time),this.channels.set(g,S),g},e.removeChannel=function(n){this.channels.delete(n);var i=rn(this.animations),o;try{for(i.s();!(o=i.n()).done;){var a=bf(o.value,2),u=a[0],s=a[1];s.channel===n&&this.detachAnimation(u)}}catch(f){i.e(f)}finally{i.f()}},e.isFinished=function(n){var i=this.channels.get(n);return i===void 0?!1:this.time>=i.delay+i.duration*i.repeat},e.getTime=function(n){if(n===void 0)return this.time;var i=this.channels.get(n);return i===void 0?-1:i.time},e.setTime=function(n){this.time=Math.max(0,n);var i=this.channels.values(),o=rn(i),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;this._setChannelTime(u,this.time)}}catch(x){o.e(x)}finally{o.f()}var s=this.animations.values(),f=rn(s),p;try{for(f.s();!(p=f.n()).done;){var d=p.value,g=d.animation,S=d.channel;g.setTime(this.getTime(S))}}catch(x){f.e(x)}finally{f.f()}},e.play=function(){this.playing=!0},e.pause=function(){this.playing=!1,this.lastEngineTime=-1},e.reset=function(){this.setTime(0)},e.attachAnimation=function(n,i){var o=kf++;return this.animations.set(o,{animation:n,channel:i}),n.setTime(this.getTime(i)),o},e.detachAnimation=function(n){this.animations.delete(n)},e.update=function(n){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=n),this.setTime(this.time+(n-this.lastEngineTime)),this.lastEngineTime=n)},e._setChannelTime=function(n,i){var o=i-n.delay,a=n.duration*n.repeat;o>=a?n.time=n.duration*n.rate:(n.time=Math.max(0,o)%n.duration,n.time*=n.rate)},Of(t)}();function Pe(t){return Pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pe(t)}function ai(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,If(n.key),n)}}function Mf(t,e,r){return e&&ai(t.prototype,e),r&&ai(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function If(t){var e=Rf(t,"string");return Pe(e)==="symbol"?e:String(e)}function Rf(t,e){if(Pe(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Lf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var si=function(){function t(r){Lf(this,t),this.startIndex=-1,this.endIndex=-1,this.factor=0,this.times=[],this.values=[],this._lastTime=-1,this.setKeyFrames(r),this.setTime(0)}var e=t.prototype;return e.setKeyFrames=function(n){var i=n.length;this.times.length=i,this.values.length=i;for(var o=0;o<i;++o)this.times[o]=n[o][0],this.values[o]=n[o][1];this._calculateKeys(this._lastTime)},e.setTime=function(n){n=Math.max(0,n),n!==this._lastTime&&(this._calculateKeys(n),this._lastTime=n)},e.getStartTime=function(){return this.times[this.startIndex]},e.getEndTime=function(){return this.times[this.endIndex]},e.getStartData=function(){return this.values[this.startIndex]},e.getEndData=function(){return this.values[this.endIndex]},e._calculateKeys=function(n){var i=0,o=this.times.length;for(i=0;i<o-2&&!(this.times[i+1]>n);++i);this.startIndex=i,this.endIndex=i+1;var a=this.times[this.startIndex],u=this.times[this.endIndex];this.factor=Math.min(Math.max(0,(n-a)/(u-a)),1)},Mf(t)}();function Ht(t){return Ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ht(t)}function nn(){"use strict";nn=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(h,c,l){h[c]=l.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(h,c,l){return Object.defineProperty(h,c,{value:l,enumerable:!0,configurable:!0,writable:!0}),h[c]}try{s({},"")}catch{s=function(l,y,b){return l[y]=b}}function f(h,c,l,y){var b=c&&c.prototype instanceof g?c:g,v=Object.create(b.prototype),T=new V(y||[]);return n(v,"_invoke",{value:I(h,l,T)}),v}function p(h,c,l){try{return{type:"normal",arg:h.call(c,l)}}catch(y){return{type:"throw",arg:y}}}t.wrap=f;var d={};function g(){}function S(){}function x(){}var O={};s(O,o,function(){return this});var A=Object.getPrototypeOf,P=A&&A(A(B([])));P&&P!==e&&r.call(P,o)&&(O=P);var M=x.prototype=g.prototype=Object.create(O);function k(h){["next","throw","return"].forEach(function(c){s(h,c,function(l){return this._invoke(c,l)})})}function L(h,c){function l(b,v,T,R){var N=p(h[b],h,v);if(N.type!=="throw"){var q=N.arg,z=q.value;return z&&Ht(z)=="object"&&r.call(z,"__await")?c.resolve(z.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(z).then(function(K){q.value=K,T(q)},function(K){return l("throw",K,T,R)})}R(N.arg)}var y;n(this,"_invoke",{value:function(v,T){function R(){return new c(function(N,q){l(v,T,N,q)})}return y=y?y.then(R,R):R()}})}function I(h,c,l){var y="suspendedStart";return function(b,v){if(y==="executing")throw new Error("Generator is already running");if(y==="completed"){if(b==="throw")throw v;return F()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===d)continue;return R}}if(l.method==="next")l.sent=l._sent=l.arg;else if(l.method==="throw"){if(y==="suspendedStart")throw y="completed",l.arg;l.dispatchException(l.arg)}else l.method==="return"&&l.abrupt("return",l.arg);y="executing";var N=p(h,c,l);if(N.type==="normal"){if(y=l.done?"completed":"suspendedYield",N.arg===d)continue;return{value:N.arg,done:l.done}}N.type==="throw"&&(y="completed",l.method="throw",l.arg=N.arg)}}}function j(h,c){var l=c.method,y=h.iterator[l];if(y===void 0)return c.delegate=null,l==="throw"&&h.iterator.return&&(c.method="return",c.arg=void 0,j(h,c),c.method==="throw")||l!=="return"&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+l+"' method")),d;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,d;var v=b.arg;return v?v.done?(c[h.resultName]=v.value,c.next=h.nextLoc,c.method!=="return"&&(c.method="next",c.arg=void 0),c.delegate=null,d):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,d)}function U(h){var c={tryLoc:h[0]};1 in h&&(c.catchLoc=h[1]),2 in h&&(c.finallyLoc=h[2],c.afterLoc=h[3]),this.tryEntries.push(c)}function G(h){var c=h.completion||{};c.type="normal",delete c.arg,h.completion=c}function V(h){this.tryEntries=[{tryLoc:"root"}],h.forEach(U,this),this.reset(!0)}function B(h){if(h){var c=h[o];if(c)return c.call(h);if(typeof h.next=="function")return h;if(!isNaN(h.length)){var l=-1,y=function b(){for(;++l<h.length;)if(r.call(h,l))return b.value=h[l],b.done=!1,b;return b.value=void 0,b.done=!0,b};return y.next=y}}return{next:F}}function F(){return{value:void 0,done:!0}}return S.prototype=x,n(M,"constructor",{value:x,configurable:!0}),n(x,"constructor",{value:S,configurable:!0}),S.displayName=s(x,u,"GeneratorFunction"),t.isGeneratorFunction=function(h){var c=typeof h=="function"&&h.constructor;return!!c&&(c===S||(c.displayName||c.name)==="GeneratorFunction")},t.mark=function(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,x):(h.__proto__=x,s(h,u,"GeneratorFunction")),h.prototype=Object.create(M),h},t.awrap=function(h){return{__await:h}},k(L.prototype),s(L.prototype,a,function(){return this}),t.AsyncIterator=L,t.async=function(h,c,l,y,b){b===void 0&&(b=Promise);var v=new L(f(h,c,l,y),b);return t.isGeneratorFunction(c)?v:v.next().then(function(T){return T.done?T.value:v.next()})},k(M),s(M,u,"Generator"),s(M,o,function(){return this}),s(M,"toString",function(){return"[object Generator]"}),t.keys=function(h){var c=Object(h),l=[];for(var y in c)l.push(y);return l.reverse(),function b(){for(;l.length;){var v=l.pop();if(v in c)return b.value=v,b.done=!1,b}return b.done=!0,b}},t.values=B,V.prototype={constructor:V,reset:function(c){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(G),!c)for(var l in this)l.charAt(0)==="t"&&r.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=void 0)},stop:function(){this.done=!0;var c=this.tryEntries[0].completion;if(c.type==="throw")throw c.arg;return this.rval},dispatchException:function(c){if(this.done)throw c;var l=this;function y(q,z){return T.type="throw",T.arg=c,l.next=q,z&&(l.method="next",l.arg=void 0),!!z}for(var b=this.tryEntries.length-1;b>=0;--b){var v=this.tryEntries[b],T=v.completion;if(v.tryLoc==="root")return y("end");if(v.tryLoc<=this.prev){var R=r.call(v,"catchLoc"),N=r.call(v,"finallyLoc");if(R&&N){if(this.prev<v.catchLoc)return y(v.catchLoc,!0);if(this.prev<v.finallyLoc)return y(v.finallyLoc)}else if(R){if(this.prev<v.catchLoc)return y(v.catchLoc,!0)}else{if(!N)throw new Error("try statement without catch or finally");if(this.prev<v.finallyLoc)return y(v.finallyLoc)}}}},abrupt:function(c,l){for(var y=this.tryEntries.length-1;y>=0;--y){var b=this.tryEntries[y];if(b.tryLoc<=this.prev&&r.call(b,"finallyLoc")&&this.prev<b.finallyLoc){var v=b;break}}v&&(c==="break"||c==="continue")&&v.tryLoc<=l&&l<=v.finallyLoc&&(v=null);var T=v?v.completion:{};return T.type=c,T.arg=l,v?(this.method="next",this.next=v.finallyLoc,d):this.complete(T)},complete:function(c,l){if(c.type==="throw")throw c.arg;return c.type==="break"||c.type==="continue"?this.next=c.arg:c.type==="return"?(this.rval=this.arg=c.arg,this.method="return",this.next="end"):c.type==="normal"&&l&&(this.next=l),d},finish:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.finallyLoc===c)return this.complete(y.completion,y.afterLoc),G(y),d}},catch:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.tryLoc===c){var b=y.completion;if(b.type==="throw"){var v=b.arg;G(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:B(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),d}},t}function ui(t,e,r,n,i,o,a){try{var u=t[o](a),s=u.value}catch(f){r(f);return}u.done?e(s):Promise.resolve(s).then(n,i)}function jf(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(s){ui(o,n,i,a,u,"next",s)}function u(s){ui(o,n,i,a,u,"throw",s)}a(void 0)})}}function fi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Df(n.key),n)}}function Nf(t,e,r){return e&&fi(t.prototype,e),r&&fi(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Df(t){var e=Cf(t,"string");return Ht(e)==="symbol"?e:String(e)}function Cf(t,e){if(Ht(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ht(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ff(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var ci=function(){function t(r){Ff(this,t)}var e=t.prototype;return e.onInitialize=function(){var r=jf(nn().mark(function i(o){return nn().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.abrupt("return",null);case 1:case"end":return u.stop()}},i)}));function n(i){return r.apply(this,arguments)}return n}(),Nf(t)}();function on(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 ft(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||on()}var Uf=globalThis.self||globalThis.window||globalThis.global,Kt=globalThis.window||globalThis.self||globalThis.global,Gf=globalThis.document||{},Nt=globalThis.process||{},zf=globalThis.console,xv=globalThis.navigator||{};var cr=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Pv=ft();function Bf(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var lr=class{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=Bf(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 li(t){let e;return t<10?e="".concat(t.toFixed(2),"ms"):t<100?e="".concat(t.toFixed(1),"ms"):t<1e3?e="".concat(t.toFixed(0),"ms"):e="".concat((t/1e3).toFixed(2),"s"),e}function hi(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}function hr(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));let o=t.width*r,a=t.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(e," %c+"),u]}var pr;(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"})(pr||(pr={}));var Vf=10;function pi(t){return typeof t!="string"?t:(t=t.toUpperCase(),pr[t]||pr.WHITE)}function mi(t,e,r){if(!ft&&typeof t=="string"){if(e){let n=pi(e);t="\x1B[".concat(n,"m").concat(t,"\x1B[39m")}if(r){let n=pi(r);t="\x1B[".concat(n+Vf,"m").concat(t,"\x1B[49m")}}return t}function di(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),i=t;for(let o of n){let a=i[o];typeof a=="function"&&(e.find(u=>o===u)||(i[o]=a.bind(t)))}}function Yt(t,e){if(!t)throw new Error(e||"Assertion failed")}function Dt(){let t;if(ft()&&Kt.performance){var e,r;t=Kt===null||Kt===void 0||(e=Kt.performance)===null||e===void 0||(r=e.now)===null||r===void 0?void 0:r.call(e)}else if("hrtime"in Nt){var n;let i=Nt===null||Nt===void 0||(n=Nt.hrtime)===null||n===void 0?void 0:n.call(Nt);t=i[0]*1e3+i[1]/1e6}else t=Date.now();return t}var Xt={debug:ft()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},qf={enabled:!0,level:0};function pt(){}var yi={},vi={once:!0},At=class{constructor(){let{id:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=cr,this._startTs=Dt(),this._deltaTs=Dt(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new lr("__probe-".concat(this.id,"__"),qf),this.timeStamp("".concat(this.id," started")),di(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((Dt()-this._startTs).toPrecision(10))}getDelta(){return Number((Dt()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){Yt(e,r)}warn(e){return this._getLogFunction(0,e,Xt.warn,arguments,vi)}error(e){return this._getLogFunction(0,e,Xt.error,arguments)}deprecated(e,r){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(e,r){return this.error("`".concat(e,"` has been removed. Use `").concat(r,"` instead"))}probe(e,r){return this._getLogFunction(e,r,Xt.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,Xt.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,Xt.debug||Xt.info,arguments,vi)}table(e,r,n){return r?this._getLogFunction(e,r,console.table||pt,n&&[n],{tag:Yf(r)}):pt}image(e){let{logLevel:r,priority:n,image:i,message:o="",scale:a=1}=e;return this._shouldLog(r||n)?ft()?Kf({image:i,message:o,scale:a}):Hf({image:i,message:o,scale:a}):pt}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||pt)}group(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=gi({logLevel:e,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||pt)}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()>=_i(e)}_getLogFunction(e,r,n,i,o){if(this._shouldLog(e)){o=gi({logLevel:e,message:r,args:i,opts:o}),n=n||o.method,Yt(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=Dt();let a=o.tag||o.message;if(o.once&&a)if(!yi[a])yi[a]=Dt();else return pt;return r=Wf(this.id,o.message,o),n.bind(console,r,...o.args)}return pt}};At.VERSION=cr;function _i(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 Yt(Number.isFinite(e)&&e>=0),e}function gi(t){let{logLevel:e,message:r}=t;t.logLevel=_i(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 Yt(i==="string"||i==="object"),Object.assign(t,{args:n},t.opts)}function Wf(t,e,r){if(typeof e=="string"){let n=r.time?hi(li(r.total)):"";e=r.time?"".concat(t,": ").concat(n," ").concat(e):"".concat(t,": ").concat(e),e=mi(e,r.color,r.background)}return e}function Hf(t){let{image:e,message:r="",scale:n=1}=t;return console.warn("removed"),pt}function Kf(t){let{image:e,message:r="",scale:n=1}=t;if(typeof e=="string"){let o=new Image;return o.onload=()=>{let a=hr(o,r,n);console.log(...a)},o.src=e,pt}let i=e.nodeName||"";if(i.toLowerCase()==="img")return console.log(...hr(e,r,n)),pt;if(i.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...hr(o,r,n)),o.src=e.toDataURL(),pt}return pt}function Yf(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}var $v=new At({id:"@probe.gl/log"});var Y=new At({id:"luma.gl"});function Ee(){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 Ct=class{constructor(e,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Ee(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ee()-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 Tt=class{constructor(e){this.id=void 0,this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,i=this.stats[r];return i||(e instanceof Ct?i=e:i=new Ct(r,n),this.stats[r]=i),i}};function Ae(t){return Ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(t)}function bi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$f(n.key),n)}}function Xf(t,e,r){return e&&bi(t.prototype,e),r&&bi(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function $f(t){var e=Zf(t,"string");return Ae(e)==="symbol"?e:String(e)}function Zf(t,e){if(Ae(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ae(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Jf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Qf=function(){function t(){Jf(this,t),this.stats=new Map}var e=t.prototype;return e.getStats=function(n){return this.get(n)},e.get=function(n){return this.stats.has(n)||this.stats.set(n,new Tt({id:n})),this.stats.get(n)},Xf(t)}(),$t=new Qf;function tc(){var t=typeof __VERSION__<"u"?__VERSION__:"running from source",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: ".concat(globalThis.luma.VERSION," vs ").concat(t));return globalThis.luma||(ft()&&Y.log(1,"".concat(t," - ").concat(e))(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:Y,stats:$t}),t}var wi=tc();function xi(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function mt(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:xi(t)}var an={};function X(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";an[t]=an[t]||1;var e=an[t]++;return"".concat(t,"-").concat(e)}function Te(t){return Te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Te(t)}function Si(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ec(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Si(Object(r),!0).forEach(function(n){rc(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Si(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function rc(t,e,r){return e=Pi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Oi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pi(n.key),n)}}function nc(t,e,r){return e&&Oi(t.prototype,e),r&&Oi(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pi(t){var e=ic(t,"string");return Te(e)==="symbol"?e:String(e)}function ic(t,e){if(Te(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Te(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Ft=function(){function t(r,n,i){if(oc(this,t),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=ac(n,i);var o=this.props.id!=="undefined"?this.props.id:X(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}var e=t.prototype;return e.destroy=function(){this.destroyResource()},e.delete=function(){return this.destroy(),this},e.toString=function(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")},e.getProps=function(){return this.props},e.attachResource=function(n){this._attachedResources.add(n)},e.detachResource=function(n){this._attachedResources.delete(n)},e.destroyAttachedResource=function(n){this._attachedResources.delete(n)&&n.destroy()},e.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},e.destroyResource=function(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0},e.removeStats=function(){var n=this._device.statsManager.getStats("Resource Counts"),i=this[Symbol.toStringTag];n.get("".concat(i,"s Active")).decrementCount()},e.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},e.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},e.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()},nc(t)}();Ft.defaultProps={id:"undefined",handle:void 0,userData:void 0};function ac(t,e){var r=ec({},e);for(var n in t)t[n]!==void 0&&(r[n]=t[n]);return r}function Zt(t){return Zt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zt(t)}var Ti;function Ei(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function sn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ei(Object(r),!0).forEach(function(n){sc(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ei(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function sc(t,e,r){return e=ki(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function uc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ai(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ki(n.key),n)}}function fc(t,e,r){return e&&Ai(t.prototype,e),r&&Ai(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ki(t){var e=cc(t,"string");return Zt(e)==="symbol"?e:String(e)}function cc(t,e){if(Zt(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Zt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lc(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&un(t,e)}function un(t,e){return un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},un(t,e)}function hc(t){var e=dc();return function(){var n=mr(t),i;if(e){var o=mr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return pc(this,i)}}function pc(t,e){if(e&&(Zt(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mc(t)}function mc(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function dc(){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(t){return mr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mr(t)}Ti=Symbol.toStringTag;var $=function(t){lc(r,t);var e=hc(r);function r(i,o){var a;uc(this,r);var u=sn({},o);return(o.usage||0)&r.INDEX&&!o.indexType&&(o.data instanceof Uint32Array?u.indexType="uint32":o.data instanceof Uint16Array&&(u.indexType="uint16")),a=e.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 s=ArrayBuffer.isView(o)?o.buffer:o,f=Math.min(o?o.byteLength:u,r.DEBUG_DATA_MAX_LENGTH);o===null?this.debugData=new ArrayBuffer(f):a===0&&u===o.byteLength?this.debugData=s.slice(0,f):this.debugData=s.slice(a,a+f)},fc(r,[{key:Ti,get:function(){return"Buffer"}}]),r}(Ft);$.defaultProps=sn(sn({},Ft.defaultProps),{},{usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1});$.MAP_READ=1;$.MAP_WRITE=2;$.COPY_SRC=4;$.COPY_DST=8;$.INDEX=16;$.VERTEX=32;$.UNIFORM=64;$.STORAGE=128;$.INDIRECT=256;$.QUERY_RESOLVE=512;$.DEBUG_DATA_MAX_LENGTH=32;function ke(t){return ke=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(t)}var Ri;function Mi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mi(Object(r),!0).forEach(function(n){yc(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yc(t,e,r){return e=Li(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ii(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Li(n.key),n)}}function gc(t,e,r){return e&&Ii(t.prototype,e),r&&Ii(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Li(t){var e=_c(t,"string");return ke(e)==="symbol"?e:String(e)}function _c(t,e){if(ke(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ke(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}Ri=Symbol.toStringTag;var Me=function(){function t(r){vc(this,t),this.id=void 0,this.statsManager=$t,this.props=void 0,this.userData={},this._lumaData={},this.info=void 0,this.lost=void 0,this.canvasContext=void 0,this.props=fn(fn({},t.defaultProps),r),this.id=this.props.id||X(this[Symbol.toStringTag].toLowerCase())}var e=t.prototype;return e.loseDevice=function(){return!1},e.getCanvasContext=function(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext},e.createTexture=function(n){return(n instanceof Promise||typeof n=="string")&&(n={data:n}),this._createTexture(n)},e.createCommandEncoder=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("not implemented")},e.readPixelsToArrayWebGL=function(n,i){throw new Error("not implemented")},e.readPixelsToBufferWebGL2=function(n,i){throw new Error("not implemented")},e.setParametersWebGL=function(n){throw new Error("not implemented")},e.withParametersWebGL=function(n,i){throw new Error("not implemented")},e.clearWebGL=function(n){throw new Error("not implemented")},e._getBufferProps=function(n){(n instanceof ArrayBuffer||ArrayBuffer.isView(n))&&(n={data:n});var i=fn({},n);return(n.usage||0)&$.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?i.indexType="uint32":n.data instanceof Uint16Array?i.indexType="uint16":Y.warn("indices buffer content must be of integer type")()),i},gc(t,[{key:Ri,get:function(){return"Device"}}]),t}();Me.defaultProps={id:null,type:"best-available",canvas:null,container:null,webgl2:!0,webgl1:!0,manageState:!0,width:800,height:600,debug:Boolean(Y.get("debug")),break:[],gl:null};Me.VERSION=wi;function et(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}function Jt(t){return Jt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jt(t)}function cn(){"use strict";cn=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(h,c,l){h[c]=l.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(h,c,l){return Object.defineProperty(h,c,{value:l,enumerable:!0,configurable:!0,writable:!0}),h[c]}try{s({},"")}catch{s=function(l,y,b){return l[y]=b}}function f(h,c,l,y){var b=c&&c.prototype instanceof g?c:g,v=Object.create(b.prototype),T=new V(y||[]);return n(v,"_invoke",{value:I(h,l,T)}),v}function p(h,c,l){try{return{type:"normal",arg:h.call(c,l)}}catch(y){return{type:"throw",arg:y}}}t.wrap=f;var d={};function g(){}function S(){}function x(){}var O={};s(O,o,function(){return this});var A=Object.getPrototypeOf,P=A&&A(A(B([])));P&&P!==e&&r.call(P,o)&&(O=P);var M=x.prototype=g.prototype=Object.create(O);function k(h){["next","throw","return"].forEach(function(c){s(h,c,function(l){return this._invoke(c,l)})})}function L(h,c){function l(b,v,T,R){var N=p(h[b],h,v);if(N.type!=="throw"){var q=N.arg,z=q.value;return z&&Jt(z)=="object"&&r.call(z,"__await")?c.resolve(z.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(z).then(function(K){q.value=K,T(q)},function(K){return l("throw",K,T,R)})}R(N.arg)}var y;n(this,"_invoke",{value:function(v,T){function R(){return new c(function(N,q){l(v,T,N,q)})}return y=y?y.then(R,R):R()}})}function I(h,c,l){var y="suspendedStart";return function(b,v){if(y==="executing")throw new Error("Generator is already running");if(y==="completed"){if(b==="throw")throw v;return F()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===d)continue;return R}}if(l.method==="next")l.sent=l._sent=l.arg;else if(l.method==="throw"){if(y==="suspendedStart")throw y="completed",l.arg;l.dispatchException(l.arg)}else l.method==="return"&&l.abrupt("return",l.arg);y="executing";var N=p(h,c,l);if(N.type==="normal"){if(y=l.done?"completed":"suspendedYield",N.arg===d)continue;return{value:N.arg,done:l.done}}N.type==="throw"&&(y="completed",l.method="throw",l.arg=N.arg)}}}function j(h,c){var l=c.method,y=h.iterator[l];if(y===void 0)return c.delegate=null,l==="throw"&&h.iterator.return&&(c.method="return",c.arg=void 0,j(h,c),c.method==="throw")||l!=="return"&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+l+"' method")),d;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,d;var v=b.arg;return v?v.done?(c[h.resultName]=v.value,c.next=h.nextLoc,c.method!=="return"&&(c.method="next",c.arg=void 0),c.delegate=null,d):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,d)}function U(h){var c={tryLoc:h[0]};1 in h&&(c.catchLoc=h[1]),2 in h&&(c.finallyLoc=h[2],c.afterLoc=h[3]),this.tryEntries.push(c)}function G(h){var c=h.completion||{};c.type="normal",delete c.arg,h.completion=c}function V(h){this.tryEntries=[{tryLoc:"root"}],h.forEach(U,this),this.reset(!0)}function B(h){if(h){var c=h[o];if(c)return c.call(h);if(typeof h.next=="function")return h;if(!isNaN(h.length)){var l=-1,y=function b(){for(;++l<h.length;)if(r.call(h,l))return b.value=h[l],b.done=!1,b;return b.value=void 0,b.done=!0,b};return y.next=y}}return{next:F}}function F(){return{value:void 0,done:!0}}return S.prototype=x,n(M,"constructor",{value:x,configurable:!0}),n(x,"constructor",{value:S,configurable:!0}),S.displayName=s(x,u,"GeneratorFunction"),t.isGeneratorFunction=function(h){var c=typeof h=="function"&&h.constructor;return!!c&&(c===S||(c.displayName||c.name)==="GeneratorFunction")},t.mark=function(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,x):(h.__proto__=x,s(h,u,"GeneratorFunction")),h.prototype=Object.create(M),h},t.awrap=function(h){return{__await:h}},k(L.prototype),s(L.prototype,a,function(){return this}),t.AsyncIterator=L,t.async=function(h,c,l,y,b){b===void 0&&(b=Promise);var v=new L(f(h,c,l,y),b);return t.isGeneratorFunction(c)?v:v.next().then(function(T){return T.done?T.value:v.next()})},k(M),s(M,u,"Generator"),s(M,o,function(){return this}),s(M,"toString",function(){return"[object Generator]"}),t.keys=function(h){var c=Object(h),l=[];for(var y in c)l.push(y);return l.reverse(),function b(){for(;l.length;){var v=l.pop();if(v in c)return b.value=v,b.done=!1,b}return b.done=!0,b}},t.values=B,V.prototype={constructor:V,reset:function(c){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(G),!c)for(var l in this)l.charAt(0)==="t"&&r.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=void 0)},stop:function(){this.done=!0;var c=this.tryEntries[0].completion;if(c.type==="throw")throw c.arg;return this.rval},dispatchException:function(c){if(this.done)throw c;var l=this;function y(q,z){return T.type="throw",T.arg=c,l.next=q,z&&(l.method="next",l.arg=void 0),!!z}for(var b=this.tryEntries.length-1;b>=0;--b){var v=this.tryEntries[b],T=v.completion;if(v.tryLoc==="root")return y("end");if(v.tryLoc<=this.prev){var R=r.call(v,"catchLoc"),N=r.call(v,"finallyLoc");if(R&&N){if(this.prev<v.catchLoc)return y(v.catchLoc,!0);if(this.prev<v.finallyLoc)return y(v.finallyLoc)}else if(R){if(this.prev<v.catchLoc)return y(v.catchLoc,!0)}else{if(!N)throw new Error("try statement without catch or finally");if(this.prev<v.finallyLoc)return y(v.finallyLoc)}}}},abrupt:function(c,l){for(var y=this.tryEntries.length-1;y>=0;--y){var b=this.tryEntries[y];if(b.tryLoc<=this.prev&&r.call(b,"finallyLoc")&&this.prev<b.finallyLoc){var v=b;break}}v&&(c==="break"||c==="continue")&&v.tryLoc<=l&&l<=v.finallyLoc&&(v=null);var T=v?v.completion:{};return T.type=c,T.arg=l,v?(this.method="next",this.next=v.finallyLoc,d):this.complete(T)},complete:function(c,l){if(c.type==="throw")throw c.arg;return c.type==="break"||c.type==="continue"?this.next=c.arg:c.type==="return"?(this.rval=this.arg=c.arg,this.method="return",this.next="end"):c.type==="normal"&&l&&(this.next=l),d},finish:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.finallyLoc===c)return this.complete(y.completion,y.afterLoc),G(y),d}},catch:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.tryLoc===c){var b=y.completion;if(b.type==="throw"){var v=b.arg;G(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:B(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),d}},t}function ji(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ni(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ji(Object(r),!0).forEach(function(n){bc(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ji(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function bc(t,e,r){return e=Ui(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Di(t,e,r,n,i,o,a){try{var u=t[o](a),s=u.value}catch(f){r(f);return}u.done?e(s):Promise.resolve(s).then(n,i)}function wc(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(s){Di(o,n,i,a,u,"next",s)}function u(s){Di(o,n,i,a,u,"throw",s)}a(void 0)})}}function xc(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Sc(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Sc(t,e){if(t){if(typeof t=="string")return Ci(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ci(t,e)}}function Ci(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Fi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ui(n.key),n)}}function Oc(t,e,r){return e&&Fi(t.prototype,e),r&&Fi(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ui(t){var e=Pc(t,"string");return Jt(e)==="symbol"?e:String(e)}function Pc(t,e){if(Jt(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Jt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ec(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Ut=new Map,Gt=function(){function t(){Ec(this,t)}return t.registerDevices=function(r){var n=xc(r),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;et(o.type&&o.isSupported&&o.create),Ut.set(o.type,o)}}catch(a){n.e(a)}finally{n.f()}},t.getAvailableDevices=function(){return Array.from(Ut).map(function(r){return r.type})},t.getSupportedDevices=function(){return Array.from(Ut).filter(function(r){return r.isSupported()}).map(function(r){return r.type})},t.setDefaultDeviceProps=function(r){Object.assign(Me.defaultProps,r)},t.createDevice=function(){var e=wc(cn().mark(function n(){var i,o,a=arguments;return cn().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:i=a.length>0&&a[0]!==void 0?a[0]:{},i=Ni(Ni({},Me.defaultProps),i),i.gl&&(i.type="webgl"),s.t0=i.type,s.next=s.t0==="webgpu"?6:s.t0==="webgl"||s.t0==="webgl1"||s.t0==="webgl2"?12:s.t0==="best-available"?18:29;break;case 6:if(o=Ut.get("webgpu"),!o){s.next=11;break}return s.next=10,o.create(i);case 10:return s.abrupt("return",s.sent);case 11:return s.abrupt("break",29);case 12:if(o=Ut.get("webgl"),!o){s.next=17;break}return s.next=16,o.create(i);case 16:return s.abrupt("return",s.sent);case 17:return s.abrupt("break",29);case 18:if(o=Ut.get("webgpu"),!(o&&o.isSupported())){s.next=23;break}return s.next=22,o.create(i);case 22:return s.abrupt("return",s.sent);case 23:if(o=Ut.get("webgl"),!(o&&o.isSupported())){s.next=28;break}return s.next=27,o.create(i);case 27:return s.abrupt("return",s.sent);case 28:return s.abrupt("break",29);case 29:throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.");case 30:case"end":return s.stop()}},n)}));function r(){return e.apply(this,arguments)}return r}(),Oc(t)}();Gt.stats=$t;Gt.log=Y;function Qt(t){return Qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qt(t)}var Vi;function Gi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function zi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gi(Object(r),!0).forEach(function(n){Ac(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ac(t,e,r){return e=qi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Tc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qi(n.key),n)}}function kc(t,e,r){return e&&Bi(t.prototype,e),r&&Bi(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function qi(t){var e=Mc(t,"string");return Qt(e)==="symbol"?e:String(e)}function Mc(t,e){if(Qt(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Qt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ic(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ln(t,e)}function ln(t,e){return ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ln(t,e)}function Rc(t){var e=Nc();return function(){var n=dr(t),i;if(e){var o=dr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Lc(this,i)}}function Lc(t,e){if(e&&(Qt(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jc(t)}function jc(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Nc(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function dr(t){return dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dr(t)}Vi=Symbol.toStringTag;var te=function(t){Ic(r,t);var e=Rc(r);function r(n,i){var o;return Tc(this,r),o=e.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 kc(r,[{key:Vi,get:function(){return"RenderPipeline"}}]),r}(Ft);te.defaultProps=zi(zi({},Ft.defaultProps),{},{vs:null,vsEntryPoint:"",vsConstants:{},fs:null,fsEntryPoint:"",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});function Dc(t,e){return Gc(t)||Uc(t,e)||Fc(t,e)||Cc()}function Cc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
11
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fc(t,e){if(t){if(typeof t=="string")return Wi(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wi(t,e)}}function Wi(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Uc(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function Gc(t){if(Array.isArray(t))return t}function Hi(t){var e=Dc(Bc[t],2),r=e[0],n=e[1],i=r==="i32"||r==="u32",o=r!=="u32",a=Vc[r]*n,u=zc(r,n);return{dataType:r,components:n,defaultVertexFormat:u,byteLength:a,integer:i,signed:o}}function zc(t,e){var 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:"".concat(r,"x").concat(e)}var Bc={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]},Vc={f32:4,f16:2,i32:4,u32:4};function Yi(t){var e=Ki[t],r=qc(e),n=t.includes("norm"),i=!n&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:Ki[t],byteLength:r,integer:i,signed:o,normalized:n}}function qc(t){var e=Wc[t];return e}var Ki={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Wc={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Hc(t,e){return $c(t)||Xc(t,e)||Yc(t,e)||Kc()}function Kc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
12
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yc(t,e){if(t){if(typeof t=="string")return Xi(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xi(t,e)}}function Xi(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Xc(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function $c(t){if(Array.isArray(t))return t}function hn(t){var e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);var r=t.split("x"),n=Hc(r,2),i=n[0],o=n[1],a=i,u=o?parseInt(o):1,s=Yi(a),f={type:a,components:u,byteLength:s.byteLength*u,integer:s.integer,signed:s.signed,normalized:s.normalized};return e&&(f.webglOnly=!0),f}function Ie(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Zc(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
13
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Zc(t,e){if(t){if(typeof t=="string")return $i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $i(t,e)}}function $i(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function pn(t,e){var r={},n=Ie(t.attributes),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;r[o.name]=Jc(t,e,o.name)}}catch(a){n.e(a)}finally{n.f()}return r}function Jc(t,e,r){var n=Qc(t,r),i=tl(e,r);if(!n)return null;var o=Hi(n.type),a=i?.vertexFormat||o.defaultVertexFormat,u=hn(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 Qc(t,e){var r=t.attributes.find(function(n){return n.name===e});return r||Y.warn('shader layout attribute "'.concat(e,'" not present in shader')),r||null}function tl(t,e){el(t);var r=rl(t,e);return r||(r=nl(t,e),r)?r:(Y.warn('layout for attribute "'.concat(e,'" not present in buffer layout')),null)}function el(t){var e=Ie(t),r;try{for(e.s();!(r=e.n()).done;){var n=r.value;(n.attributes&&n.format||!n.attributes&&!n.format)&&Y.warn("BufferLayout ".concat(name," must have either 'attributes' or 'format' field"))}}catch(i){e.e(i)}finally{e.f()}}function rl(t,e){var r=Ie(t),n;try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.format&&i.name===e)return{attributeName:i.name,bufferName:e,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0}}}catch(o){r.e(o)}finally{r.f()}return null}function nl(t,e){var r=Ie(t),n;try{for(r.s();!(n=r.n()).done;){var i,o=n.value,a=o.byteStride;if(typeof o.byteStride!="number"){var u=Ie(o.attributes||[]),s;try{for(u.s();!(s=u.n()).done;){var f=s.value,p=hn(f.format);a+=p.byteLength}}catch(g){u.e(g)}finally{u.f()}}var d=(i=o.attributes)===null||i===void 0?void 0:i.find(function(g){return g.attribute===e});if(d)return{attributeName:d.attribute,bufferName:o.name,stepMode:o.stepMode,vertexFormat:d.format,byteOffset:d.byteOffset,byteStride:a}}}catch(g){r.e(g)}finally{r.f()}return null}var il={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function Zi(t){var e=il[t];return et(t),e}function Ji(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var yr;function Qi(t){return(!yr||yr.byteLength<t)&&(yr=new ArrayBuffer(t)),yr}function Re(t){return Re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Re(t)}function to(t,e){return ul(t)||sl(t,e)||al(t,e)||ol()}function ol(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
14
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function al(t,e){if(t){if(typeof t=="string")return eo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eo(t,e)}}function eo(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function sl(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function ul(t){if(Array.isArray(t))return t}function ro(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,cl(n.key),n)}}function fl(t,e,r){return e&&ro(t.prototype,e),r&&ro(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cl(t){var e=ll(t,"string");return Re(e)==="symbol"?e:String(e)}function ll(t,e){if(Re(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var no=1024,io=function(){function t(r){hl(this,t),this.layout={},this.byteLength=void 0;for(var n=0,i=0,o=Object.entries(r);i<o.length;i++){var a=to(o[i],2),u=a[0],s=a[1],f=Zi(s),p=f.type,d=f.components;n=Ji(n,d);var g=n;n+=d,this.layout[u]={type:p,size:d,offset:g}}n+=(4-n%4)%4;var S=n*4;this.byteLength=Math.max(S,no)}var e=t.prototype;return e.getData=function(n){for(var i=Math.max(this.byteLength,no),o=Qi(i),a={i32:new Int32Array(o),u32:new Uint32Array(o),f32:new Float32Array(o),f16:new Uint16Array(o)},u=0,s=Object.entries(n);u<s.length;u++){var f=to(s[u],2),p=f[0],d=f[1],g=this.layout[p];if(!g){Y.warn("Supplied uniform value ".concat(p," not present in uniform block layout"))();continue}var S=g.type,x=g.size,O=g.offset,A=a[S];if(x===1){if(typeof d!="number"&&typeof d!="boolean"){Y.warn("Supplied value for single component uniform ".concat(p," is not a number: ").concat(d))();continue}A[O]=Number(d)}else{var P=mt(d);if(!P){Y.warn("Supplied value for multi component / array uniform ".concat(p," is not a numeric array: ").concat(d))();continue}A.set(P,O)}}return new Uint8Array(o)},e.has=function(n){return Boolean(this.layout[n])},e.get=function(n){var i=this.layout[n];return i},fl(t)}();function oo(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:16;if(t!==e)return!1;var n=mt(t);if(!n)return!1;var i=mt(e);if(i&&n.length===i.length){for(var o=0;o<n.length;++o)if(i[o]!==n[o])return!1}return!0}function ao(t){var e=mt(t);return e?e.slice():t}function Le(t){return Le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Le(t)}function pl(t,e){return yl(t)||dl(t,e)||fo(t,e)||ml()}function ml(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
15
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dl(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function yl(t){if(Array.isArray(t))return t}function vl(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=fo(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
16
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function fo(t,e){if(t){if(typeof t=="string")return so(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return so(t,e)}}function so(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function uo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_l(n.key),n)}}function gl(t,e,r){return e&&uo(t.prototype,e),r&&uo(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _l(t){var e=bl(t,"string");return Le(e)==="symbol"?e:String(e)}function bl(t,e){if(Le(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Le(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var co=function(){function t(r){if(wl(this,t),this.name=void 0,this.uniforms={},this.modifiedUniforms={},this.modified=!0,this.bindingLayout={},this.needsRedraw="initialized",this.name=r?.name,r!=null&&r.name&&r!==null&&r!==void 0&&r.shaderLayout){var n,i=r==null||(n=r.shaderLayout.bindings)===null||n===void 0?void 0:n.find(function(f){return f.type==="uniform"&&f.name===r?.name});if(!i)throw new Error(r?.name);var o=i,a=vl(o.uniforms||[]),u;try{for(a.s();!(u=a.n()).done;){var s=u.value;this.bindingLayout[s.name]=s}}catch(f){a.e(f)}finally{a.f()}}}var e=t.prototype;return e.setUniforms=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var a=pl(o[i],2),u=a[0],s=a[1];this._setUniform(u,s),this.needsRedraw||this.setNeedsRedraw("".concat(this.name,".").concat(u,"=").concat(s))}},e.setNeedsRedraw=function(n){this.needsRedraw=this.needsRedraw||n},e.getAllUniforms=function(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}},e._setUniform=function(n,i){oo(this.uniforms[n],i)||(this.uniforms[n]=ao(i),this.modifiedUniforms[n]=!0,this.modified=!0)},gl(t)}();function je(t){return je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},je(t)}function xl(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=mo(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
17
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function lo(t,e){return Pl(t)||Ol(t,e)||mo(t,e)||Sl()}function Sl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mo(t,e){if(t){if(typeof t=="string")return ho(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ho(t,e)}}function ho(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ol(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function Pl(t){if(Array.isArray(t))return t}function po(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Al(n.key),n)}}function El(t,e,r){return e&&po(t.prototype,e),r&&po(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Al(t){var e=Tl(t,"string");return je(e)==="symbol"?e:String(e)}function Tl(t,e){if(je(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(je(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function kl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var mn=function(){function t(r){kl(this,t),this.uniformBlocks=new Map,this.uniformBufferLayouts=new Map,this.uniformBuffers=new Map;for(var n=0,i=Object.entries(r);n<i.length;n++){var o=lo(i[n],2),a=o[0],u=o[1],s=a,f=new io(u.uniformTypes||{});this.uniformBufferLayouts.set(s,f);var p=new co({name:a});p.setUniforms(u.defaultUniforms||{}),this.uniformBlocks.set(s,p)}}var e=t.prototype;return e.destroy=function(){for(var n=0,i=Object.values(this.uniformBuffers);n<i.length;n++){var o=i[n];o.destroy()}},e.setUniforms=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var a=lo(o[i],2),u=a[0],s=a[1];this.uniformBlocks.get(u).setUniforms(s)}this.updateUniformBuffers()},e.getUniformBufferByteLength=function(n){return this.uniformBufferLayouts.get(n).byteLength},e.getUniformBufferData=function(n){var i=this.uniformBlocks.get(n).getAllUniforms();return this.uniformBufferLayouts.get(n).getData(i)},e.createUniformBuffer=function(n,i,o){o&&this.setUniforms(o);var a=this.getUniformBufferByteLength(i),u=n.createBuffer({usage:$.UNIFORM|$.COPY_DST,byteLength:a}),s=this.getUniformBufferData(i);return u.write(s),u},e.getManagedUniformBuffer=function(n,i){if(!this.uniformBuffers.get(i)){var o=this.getUniformBufferByteLength(i),a=n.createBuffer({usage:$.UNIFORM|$.COPY_DST,byteLength:o});this.uniformBuffers.set(i,a)}return this.uniformBuffers.get(i)},e.updateUniformBuffers=function(){var n=!1,i=xl(this.uniformBlocks.keys()),o;try{for(i.s();!(o=i.n()).done;){var a=o.value,u=this.updateUniformBuffer(a);n||(n=u)}}catch(s){i.e(s)}finally{i.f()}return n&&Y.log(3,"UniformStore.updateUniformBuffers(): ".concat(n))(),n},e.updateUniformBuffer=function(n){var i=this.uniformBlocks.get(n),o=this.uniformBuffers.get(n),a=!1;if(o&&i.needsRedraw){a||(a=i.needsRedraw);var u=this.getUniformBufferData(n),s=this.uniformBuffers.get(n);s.write(u);var f=this.uniformBlocks.get(n).getAllUniforms();Y.log(4,"Writing to uniform buffer ".concat(String(n)),u,f)()}return a},El(t)}();function yo(t){var e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function dn(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function yn(t,e,r){if(!e||e>4)throw new Error("size ".concat(e));var n=e,i=yo(t);if(i==="uint8"||i==="sint8"){if(n===1||n===3)throw new Error("size: ".concat(e));return r&&(i=i.replace("int","norm")),"".concat(i,"x").concat(n)}if(i==="uint16"||i==="sint16"){if(n===1||n===3)throw new Error("size: ".concat(e));return r&&(i=i.replace("int","norm")),"".concat(i,"x").concat(n)}return n===1?i:"".concat(i,"x").concat(n)}function vo(t){return mt(t)!==null||typeof t=="number"||typeof t=="boolean"}function vn(t){var e={bindings:{},uniforms:{}};return Object.keys(t).forEach(function(r){var n=t[r];vo(n)?e.uniforms[r]=n:e.bindings[r]=n}),e}function vr(t){return vr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vr(t)}function Ne(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!Ne(t[n],e[n],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(vr(t)==="object"&&vr(e)==="object"){var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(var a=0,u=i;a<u.length;a++){var s=u[a];if(!e.hasOwnProperty(s)||!Ne(t[s],e[s],r-1))return!1}return!0}return!1}function gn(t){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function _n(t){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}var go=function(e){return"".concat(e)};function ee(t){return ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(t)}function Ml(t,e){return jl(t)||Ll(t,e)||Rl(t,e)||Il()}function Il(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
19
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rl(t,e){if(t){if(typeof t=="string")return _o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _o(t,e)}}function _o(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ll(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function jl(t){if(Array.isArray(t))return t}function bo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bo(Object(r),!0).forEach(function(n){Nl(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bo(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Nl(t,e,r){return e=Oo(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Oo(n.key),n)}}function Dl(t,e,r){return e&&xo(t.prototype,e),r&&xo(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Oo(t){var e=Cl(t,"string");return ee(e)==="symbol"?e:String(e)}function Cl(t,e){if(ee(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ee(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xt(){"use strict";xt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(h,c,l){h[c]=l.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(h,c,l){return Object.defineProperty(h,c,{value:l,enumerable:!0,configurable:!0,writable:!0}),h[c]}try{s({},"")}catch{s=function(l,y,b){return l[y]=b}}function f(h,c,l,y){var b=c&&c.prototype instanceof g?c:g,v=Object.create(b.prototype),T=new V(y||[]);return n(v,"_invoke",{value:I(h,l,T)}),v}function p(h,c,l){try{return{type:"normal",arg:h.call(c,l)}}catch(y){return{type:"throw",arg:y}}}t.wrap=f;var d={};function g(){}function S(){}function x(){}var O={};s(O,o,function(){return this});var A=Object.getPrototypeOf,P=A&&A(A(B([])));P&&P!==e&&r.call(P,o)&&(O=P);var M=x.prototype=g.prototype=Object.create(O);function k(h){["next","throw","return"].forEach(function(c){s(h,c,function(l){return this._invoke(c,l)})})}function L(h,c){function l(b,v,T,R){var N=p(h[b],h,v);if(N.type!=="throw"){var q=N.arg,z=q.value;return z&&ee(z)=="object"&&r.call(z,"__await")?c.resolve(z.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(z).then(function(K){q.value=K,T(q)},function(K){return l("throw",K,T,R)})}R(N.arg)}var y;n(this,"_invoke",{value:function(v,T){function R(){return new c(function(N,q){l(v,T,N,q)})}return y=y?y.then(R,R):R()}})}function I(h,c,l){var y="suspendedStart";return function(b,v){if(y==="executing")throw new Error("Generator is already running");if(y==="completed"){if(b==="throw")throw v;return F()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===d)continue;return R}}if(l.method==="next")l.sent=l._sent=l.arg;else if(l.method==="throw"){if(y==="suspendedStart")throw y="completed",l.arg;l.dispatchException(l.arg)}else l.method==="return"&&l.abrupt("return",l.arg);y="executing";var N=p(h,c,l);if(N.type==="normal"){if(y=l.done?"completed":"suspendedYield",N.arg===d)continue;return{value:N.arg,done:l.done}}N.type==="throw"&&(y="completed",l.method="throw",l.arg=N.arg)}}}function j(h,c){var l=c.method,y=h.iterator[l];if(y===void 0)return c.delegate=null,l==="throw"&&h.iterator.return&&(c.method="return",c.arg=void 0,j(h,c),c.method==="throw")||l!=="return"&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+l+"' method")),d;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,d;var v=b.arg;return v?v.done?(c[h.resultName]=v.value,c.next=h.nextLoc,c.method!=="return"&&(c.method="next",c.arg=void 0),c.delegate=null,d):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,d)}function U(h){var c={tryLoc:h[0]};1 in h&&(c.catchLoc=h[1]),2 in h&&(c.finallyLoc=h[2],c.afterLoc=h[3]),this.tryEntries.push(c)}function G(h){var c=h.completion||{};c.type="normal",delete c.arg,h.completion=c}function V(h){this.tryEntries=[{tryLoc:"root"}],h.forEach(U,this),this.reset(!0)}function B(h){if(h){var c=h[o];if(c)return c.call(h);if(typeof h.next=="function")return h;if(!isNaN(h.length)){var l=-1,y=function b(){for(;++l<h.length;)if(r.call(h,l))return b.value=h[l],b.done=!1,b;return b.value=void 0,b.done=!0,b};return y.next=y}}return{next:F}}function F(){return{value:void 0,done:!0}}return S.prototype=x,n(M,"constructor",{value:x,configurable:!0}),n(x,"constructor",{value:S,configurable:!0}),S.displayName=s(x,u,"GeneratorFunction"),t.isGeneratorFunction=function(h){var c=typeof h=="function"&&h.constructor;return!!c&&(c===S||(c.displayName||c.name)==="GeneratorFunction")},t.mark=function(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,x):(h.__proto__=x,s(h,u,"GeneratorFunction")),h.prototype=Object.create(M),h},t.awrap=function(h){return{__await:h}},k(L.prototype),s(L.prototype,a,function(){return this}),t.AsyncIterator=L,t.async=function(h,c,l,y,b){b===void 0&&(b=Promise);var v=new L(f(h,c,l,y),b);return t.isGeneratorFunction(c)?v:v.next().then(function(T){return T.done?T.value:v.next()})},k(M),s(M,u,"Generator"),s(M,o,function(){return this}),s(M,"toString",function(){return"[object Generator]"}),t.keys=function(h){var c=Object(h),l=[];for(var y in c)l.push(y);return l.reverse(),function b(){for(;l.length;){var v=l.pop();if(v in c)return b.value=v,b.done=!1,b}return b.done=!0,b}},t.values=B,V.prototype={constructor:V,reset:function(c){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(G),!c)for(var l in this)l.charAt(0)==="t"&&r.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=void 0)},stop:function(){this.done=!0;var c=this.tryEntries[0].completion;if(c.type==="throw")throw c.arg;return this.rval},dispatchException:function(c){if(this.done)throw c;var l=this;function y(q,z){return T.type="throw",T.arg=c,l.next=q,z&&(l.method="next",l.arg=void 0),!!z}for(var b=this.tryEntries.length-1;b>=0;--b){var v=this.tryEntries[b],T=v.completion;if(v.tryLoc==="root")return y("end");if(v.tryLoc<=this.prev){var R=r.call(v,"catchLoc"),N=r.call(v,"finallyLoc");if(R&&N){if(this.prev<v.catchLoc)return y(v.catchLoc,!0);if(this.prev<v.finallyLoc)return y(v.finallyLoc)}else if(R){if(this.prev<v.catchLoc)return y(v.catchLoc,!0)}else{if(!N)throw new Error("try statement without catch or finally");if(this.prev<v.finallyLoc)return y(v.finallyLoc)}}}},abrupt:function(c,l){for(var y=this.tryEntries.length-1;y>=0;--y){var b=this.tryEntries[y];if(b.tryLoc<=this.prev&&r.call(b,"finallyLoc")&&this.prev<b.finallyLoc){var v=b;break}}v&&(c==="break"||c==="continue")&&v.tryLoc<=l&&l<=v.finallyLoc&&(v=null);var T=v?v.completion:{};return T.type=c,T.arg=l,v?(this.method="next",this.next=v.finallyLoc,d):this.complete(T)},complete:function(c,l){if(c.type==="throw")throw c.arg;return c.type==="break"||c.type==="continue"?this.next=c.arg:c.type==="return"?(this.rval=this.arg=c.arg,this.method="return",this.next="end"):c.type==="normal"&&l&&(this.next=l),d},finish:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.finallyLoc===c)return this.complete(y.completion,y.afterLoc),G(y),d}},catch:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.tryLoc===c){var b=y.completion;if(b.type==="throw"){var v=b.arg;G(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:B(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),d}},t}function So(t,e,r,n,i,o,a){try{var u=t[o](a),s=u.value}catch(f){r(f);return}u.done?e(s):Promise.resolve(s).then(n,i)}function gr(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(s){So(o,n,i,a,u,"next",s)}function u(s){So(o,n,i,a,u,"throw",s)}a(void 0)})}}var Ul=0,Gl={device:null,onAddHTML:function(){return""},onInitialize:function(){var t=gr(xt().mark(function r(){return xt().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",null);case 1:case"end":return i.stop()}},r)}));function e(){return t.apply(this,arguments)}return e}(),onRender:function(){},onFinalize:function(){},onError:function(e){return console.error(e)},stats:Gt.stats.get("animation-loop-".concat(Ul++)),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},_r=function(){function t(r){if(Fl(this,t),this.device=null,this.canvas=null,this.props=void 0,this.animationProps=null,this.timeline=null,this.stats=void 0,this.cpuTime=void 0,this.gpuTime=void 0,this.frameRate=void 0,this.display=void 0,this.needsRedraw="initialized",this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.props=wo(wo({},Gl),r),r=this.props,!r.device)throw new Error("No device provided");var n=this.props.useDevicePixels,i=n===void 0?!0:n;this.stats=r.stats||new Tt({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:r.autoResizeViewport,autoResizeDrawingBuffer:r.autoResizeDrawingBuffer,useDevicePixels:i}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}var e=t.prototype;return e.destroy=function(){this.stop(),this._setDisplay(null)},e.delete=function(){this.destroy()},e.setNeedsRedraw=function(n){return this.needsRedraw=this.needsRedraw||n,this},e.setProps=function(n){return"autoResizeViewport"in n&&(this.props.autoResizeViewport=n.autoResizeViewport||!1),"autoResizeDrawingBuffer"in n&&(this.props.autoResizeDrawingBuffer=n.autoResizeDrawingBuffer||!1),"useDevicePixels"in n&&(this.props.useDevicePixels=n.useDevicePixels||!1),this},e.start=function(){var r=gr(xt().mark(function i(){var o,a;return xt().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!this._running){s.next=2;break}return s.abrupt("return",this);case 2:if(this._running=!0,s.prev=3,this._initialized){s.next=11;break}return this._initialized=!0,s.next=8,this._initDevice();case 8:return this._initialize(),s.next=11,this.props.onInitialize(this._getAnimationProps());case 11:if(this._running){s.next=13;break}return s.abrupt("return",null);case 13:return o!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),s.abrupt("return",this);case 17:throw s.prev=17,s.t0=s.catch(3),a=s.t0 instanceof Error?s.t0:new Error("Unknown error"),this.props.onError(a),a;case 22:case"end":return s.stop()}},i,this,[[3,17]])}));function n(){return r.apply(this,arguments)}return n}(),e.stop=function(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this},e.redraw=function(){var n;return(n=this.device)!==null&&n!==void 0&&n.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)},e.attachTimeline=function(n){return this.timeline=n,this.timeline},e.detachTimeline=function(){this.timeline=null},e.waitForRender=function(){var n=this;return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(function(i){n._resolveNextFrame=i})),this._nextFramePromise},e.toDataURL=function(){var r=gr(xt().mark(function i(){return xt().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return this.setNeedsRedraw("toDataURL"),a.next=3,this.waitForRender();case 3:if(!(this.canvas instanceof HTMLCanvasElement)){a.next=5;break}return a.abrupt("return",this.canvas.toDataURL());case 5:throw new Error("OffscreenCanvas");case 6:case"end":return a.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),e._initialize=function(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()},e._setDisplay=function(n){this.display&&(this.display.destroy(),this.display.animationLoop=null),n&&(n.animationLoop=this),this.display=n},e._requestAnimationFrame=function(){this._running&&(this._animationFrameId=gn(this._animationFrame.bind(this)))},e._cancelAnimationFrame=function(){this._animationFrameId!==null&&(_n(this._animationFrameId),this._animationFrameId=null)},e._animationFrame=function(){this._running&&(this.redraw(),this._requestAnimationFrame())},e._renderFrame=function(n){if(this.display){this.display._renderFrame(n);return}this.props.onRender(this._getAnimationProps()),this.device.submit()},e._clearNeedsRedraw=function(){this.needsRedraw=!1},e._setupFrame=function(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()},e._initializeAnimationProps=function(){var n;if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}},e._getAnimationProps=function(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps},e._updateAnimationProps=function(){if(this.animationProps){var n=this._getSizeAndAspect(),i=n.width,o=n.height,a=n.aspect;(i!==this.animationProps.width||o!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),a!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=i,this.animationProps.height=o,this.animationProps.aspect=a,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}},e._initDevice=function(){var r=gr(xt().mark(function i(){var o;return xt().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return u.next=2,this.props.device;case 2:if(this.device=u.sent,this.device){u.next=5;break}throw new Error("No device provided");case 5:this.canvas=((o=this.device.canvasContext)===null||o===void 0?void 0:o.canvas)||null;case 6:case"end":return u.stop()}},i,this)}));function n(){return r.apply(this,arguments)}return n}(),e._createInfoDiv=function(){if(this.canvas&&this.props.onAddHTML){var n=document.createElement("div");document.body.appendChild(n),n.style.position="relative";var i=document.createElement("div");i.style.position="absolute",i.style.left="10px",i.style.bottom="10px",i.style.width="300px",i.style.background="white",this.canvas instanceof HTMLCanvasElement&&n.appendChild(this.canvas),n.appendChild(i);var o=this.props.onAddHTML(i);o&&(i.innerHTML=o)}},e._getSizeAndAspect=function(){var n,i;if(!this.device)return{width:1,height:1,aspect:1};var o=((n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0?void 0:n.getPixelSize())||[1,1],a=Ml(o,2),u=a[0],s=a[1],f=1,p=(i=this.device)===null||i===void 0||(i=i.canvasContext)===null||i===void 0?void 0:i.canvas;return p&&p.clientHeight?f=p.clientWidth/p.clientHeight:u>0&&s>0&&(f=u/s),{width:u,height:s,aspect:f}},e._resizeViewport=function(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)},e._resizeCanvasDrawingBuffer=function(){if(this.props.autoResizeDrawingBuffer){var n;(n=this.device)===null||n===void 0||(n=n.canvasContext)===null||n===void 0||n.resize({useDevicePixels:this.props.useDevicePixels})}},e._beginFrameTimers=function(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()},e._endFrameTimers=function(){this.cpuTime.timeEnd()},e._startEventHandling=function(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))},e._onMousemove=function(n){n instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[n.offsetX,n.offsetY])},e._onMouseleave=function(n){this._getAnimationProps()._mousePosition=null},Dl(t)}();function re(t){return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},re(t)}function bn(){"use strict";bn=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(h,c,l){h[c]=l.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(h,c,l){return Object.defineProperty(h,c,{value:l,enumerable:!0,configurable:!0,writable:!0}),h[c]}try{s({},"")}catch{s=function(l,y,b){return l[y]=b}}function f(h,c,l,y){var b=c&&c.prototype instanceof g?c:g,v=Object.create(b.prototype),T=new V(y||[]);return n(v,"_invoke",{value:I(h,l,T)}),v}function p(h,c,l){try{return{type:"normal",arg:h.call(c,l)}}catch(y){return{type:"throw",arg:y}}}t.wrap=f;var d={};function g(){}function S(){}function x(){}var O={};s(O,o,function(){return this});var A=Object.getPrototypeOf,P=A&&A(A(B([])));P&&P!==e&&r.call(P,o)&&(O=P);var M=x.prototype=g.prototype=Object.create(O);function k(h){["next","throw","return"].forEach(function(c){s(h,c,function(l){return this._invoke(c,l)})})}function L(h,c){function l(b,v,T,R){var N=p(h[b],h,v);if(N.type!=="throw"){var q=N.arg,z=q.value;return z&&re(z)=="object"&&r.call(z,"__await")?c.resolve(z.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(z).then(function(K){q.value=K,T(q)},function(K){return l("throw",K,T,R)})}R(N.arg)}var y;n(this,"_invoke",{value:function(v,T){function R(){return new c(function(N,q){l(v,T,N,q)})}return y=y?y.then(R,R):R()}})}function I(h,c,l){var y="suspendedStart";return function(b,v){if(y==="executing")throw new Error("Generator is already running");if(y==="completed"){if(b==="throw")throw v;return F()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===d)continue;return R}}if(l.method==="next")l.sent=l._sent=l.arg;else if(l.method==="throw"){if(y==="suspendedStart")throw y="completed",l.arg;l.dispatchException(l.arg)}else l.method==="return"&&l.abrupt("return",l.arg);y="executing";var N=p(h,c,l);if(N.type==="normal"){if(y=l.done?"completed":"suspendedYield",N.arg===d)continue;return{value:N.arg,done:l.done}}N.type==="throw"&&(y="completed",l.method="throw",l.arg=N.arg)}}}function j(h,c){var l=c.method,y=h.iterator[l];if(y===void 0)return c.delegate=null,l==="throw"&&h.iterator.return&&(c.method="return",c.arg=void 0,j(h,c),c.method==="throw")||l!=="return"&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+l+"' method")),d;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,d;var v=b.arg;return v?v.done?(c[h.resultName]=v.value,c.next=h.nextLoc,c.method!=="return"&&(c.method="next",c.arg=void 0),c.delegate=null,d):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,d)}function U(h){var c={tryLoc:h[0]};1 in h&&(c.catchLoc=h[1]),2 in h&&(c.finallyLoc=h[2],c.afterLoc=h[3]),this.tryEntries.push(c)}function G(h){var c=h.completion||{};c.type="normal",delete c.arg,h.completion=c}function V(h){this.tryEntries=[{tryLoc:"root"}],h.forEach(U,this),this.reset(!0)}function B(h){if(h){var c=h[o];if(c)return c.call(h);if(typeof h.next=="function")return h;if(!isNaN(h.length)){var l=-1,y=function b(){for(;++l<h.length;)if(r.call(h,l))return b.value=h[l],b.done=!1,b;return b.value=void 0,b.done=!0,b};return y.next=y}}return{next:F}}function F(){return{value:void 0,done:!0}}return S.prototype=x,n(M,"constructor",{value:x,configurable:!0}),n(x,"constructor",{value:S,configurable:!0}),S.displayName=s(x,u,"GeneratorFunction"),t.isGeneratorFunction=function(h){var c=typeof h=="function"&&h.constructor;return!!c&&(c===S||(c.displayName||c.name)==="GeneratorFunction")},t.mark=function(h){return Object.setPrototypeOf?Object.setPrototypeOf(h,x):(h.__proto__=x,s(h,u,"GeneratorFunction")),h.prototype=Object.create(M),h},t.awrap=function(h){return{__await:h}},k(L.prototype),s(L.prototype,a,function(){return this}),t.AsyncIterator=L,t.async=function(h,c,l,y,b){b===void 0&&(b=Promise);var v=new L(f(h,c,l,y),b);return t.isGeneratorFunction(c)?v:v.next().then(function(T){return T.done?T.value:v.next()})},k(M),s(M,u,"Generator"),s(M,o,function(){return this}),s(M,"toString",function(){return"[object Generator]"}),t.keys=function(h){var c=Object(h),l=[];for(var y in c)l.push(y);return l.reverse(),function b(){for(;l.length;){var v=l.pop();if(v in c)return b.value=v,b.done=!1,b}return b.done=!0,b}},t.values=B,V.prototype={constructor:V,reset:function(c){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(G),!c)for(var l in this)l.charAt(0)==="t"&&r.call(this,l)&&!isNaN(+l.slice(1))&&(this[l]=void 0)},stop:function(){this.done=!0;var c=this.tryEntries[0].completion;if(c.type==="throw")throw c.arg;return this.rval},dispatchException:function(c){if(this.done)throw c;var l=this;function y(q,z){return T.type="throw",T.arg=c,l.next=q,z&&(l.method="next",l.arg=void 0),!!z}for(var b=this.tryEntries.length-1;b>=0;--b){var v=this.tryEntries[b],T=v.completion;if(v.tryLoc==="root")return y("end");if(v.tryLoc<=this.prev){var R=r.call(v,"catchLoc"),N=r.call(v,"finallyLoc");if(R&&N){if(this.prev<v.catchLoc)return y(v.catchLoc,!0);if(this.prev<v.finallyLoc)return y(v.finallyLoc)}else if(R){if(this.prev<v.catchLoc)return y(v.catchLoc,!0)}else{if(!N)throw new Error("try statement without catch or finally");if(this.prev<v.finallyLoc)return y(v.finallyLoc)}}}},abrupt:function(c,l){for(var y=this.tryEntries.length-1;y>=0;--y){var b=this.tryEntries[y];if(b.tryLoc<=this.prev&&r.call(b,"finallyLoc")&&this.prev<b.finallyLoc){var v=b;break}}v&&(c==="break"||c==="continue")&&v.tryLoc<=l&&l<=v.finallyLoc&&(v=null);var T=v?v.completion:{};return T.type=c,T.arg=l,v?(this.method="next",this.next=v.finallyLoc,d):this.complete(T)},complete:function(c,l){if(c.type==="throw")throw c.arg;return c.type==="break"||c.type==="continue"?this.next=c.arg:c.type==="return"?(this.rval=this.arg=c.arg,this.method="return",this.next="end"):c.type==="normal"&&l&&(this.next=l),d},finish:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.finallyLoc===c)return this.complete(y.completion,y.afterLoc),G(y),d}},catch:function(c){for(var l=this.tryEntries.length-1;l>=0;--l){var y=this.tryEntries[l];if(y.tryLoc===c){var b=y.completion;if(b.type==="throw"){var v=b.arg;G(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:B(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),d}},t}function Po(t,e,r,n,i,o,a){try{var u=t[o](a),s=u.value}catch(f){r(f);return}u.done?e(s):Promise.resolve(s).then(n,i)}function zl(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(s){Po(o,n,i,a,u,"next",s)}function u(s){Po(o,n,i,a,u,"throw",s)}a(void 0)})}}function Eo(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ao(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Eo(Object(r),!0).forEach(function(n){Bl(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Eo(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bl(t,e,r){return e=Vl(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vl(t){var e=ql(t,"string");return re(e)==="symbol"?e:String(e)}function ql(t,e){if(re(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(re(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function To(t,e){var r=this,n=null,i=e?.device||Gt.createDevice(),o=new _r(Ao(Ao({},e),{},{device:i,onInitialize:function(u){return zl(bn().mark(function s(){var f;return bn().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return n=new t(u),d.next=3,(f=n)===null||f===void 0?void 0:f.onInitialize(u);case 3:return d.abrupt("return",d.sent);case 4:case"end":return d.stop()}},s)}))()},onRender:function(u){var s;return(s=n)===null||s===void 0?void 0:s.onRender(u)},onFinalize:function(u){var s;return(s=n)===null||s===void 0?void 0:s.onFinalize(u)}}));return o.getInfo=function(){return r.AnimationLoopTemplateCtor.info},o}var tt=function(e){return"".concat(e)};function yt(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}function ko(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function kt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ko(Object(r),!0).forEach(function(n){Wl(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ko(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Wl(t,e,r){return e=Hl(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Hl(t){var e=Kl(t,"string");return Mt(e)==="symbol"?e:String(e)}function Kl(t,e){if(Mt(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Mt(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ro(t,e){return Zl(t)||$l(t,e)||Xl(t,e)||Yl()}function Yl(){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 Xl(t,e){if(t){if(typeof t=="string")return Mo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mo(t,e)}}function Mo(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $l(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function Zl(t){if(Array.isArray(t))return t}function Mt(t){return Mt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mt(t)}var wn={number:{type:"number",validate:function(e,r){return Number.isFinite(e)&&Mt(r)==="object"&&(r.max===void 0||e<=r.max)&&(r.min===void 0||e>=r.min)}},array:{type:"array",validate:function(e,r){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function Lo(t){for(var e={},r=0,n=Object.entries(t);r<n.length;r++){var i=Ro(n[r],2),o=i[0],a=i[1];e[o]=Jl(a)}return e}function jo(t,e,r){for(var n={},i=0,o=Object.entries(e);i<o.length;i++){var a=Ro(o[i],2),u=a[0],s=a[1];t&&u in t&&!s.private?(s.validate&&yt(s.validate(t[u],s),"".concat(r,": invalid ").concat(u)),n[u]=t[u]):n[u]=s.value}return n}function Jl(t){var e=Io(t);if(e!=="object")return kt(kt({value:t},wn[e]),{},{type:e});if(Mt(t)==="object")return t?t.type!==void 0?kt(kt(kt({},t),wn[t.type]),{},{type:t.type}):t.value===void 0?{type:"object",value:t}:(e=Io(t.value),kt(kt(kt({},t),wn[e]),{},{type:e})):{type:"object",value:null};throw new Error("props")}function Io(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":Mt(t)}var No,Do;function Co(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var Fo=tt(No||(No=Co([`#ifdef MODULE_LOGDEPTH
21
+ logdepth_adjustPosition(gl_Position);
22
+ #endif
23
+ `],[`\\
24
+ #ifdef MODULE_LOGDEPTH
25
+ logdepth_adjustPosition(gl_Position);
26
+ #endif
27
+ `]))),Uo=tt(Do||(Do=Co([`#ifdef MODULE_MATERIAL
28
+ gl_FragColor = material_filterColor(gl_FragColor);
29
+ #endif
30
+
31
+ #ifdef MODULE_LIGHTING
32
+ gl_FragColor = lighting_filterColor(gl_FragColor);
33
+ #endif
34
+
35
+ #ifdef MODULE_FOG
36
+ gl_FragColor = fog_filterColor(gl_FragColor);
37
+ #endif
38
+
39
+ #ifdef MODULE_PICKING
40
+ gl_FragColor = picking_filterHighlightColor(gl_FragColor);
41
+ gl_FragColor = picking_filterPickingColor(gl_FragColor);
42
+ #endif
43
+
44
+ #ifdef MODULE_LOGDEPTH
45
+ logdepth_setFragDepth();
46
+ #endif
47
+ `],[`\\
48
+ #ifdef MODULE_MATERIAL
49
+ gl_FragColor = material_filterColor(gl_FragColor);
50
+ #endif
51
+
52
+ #ifdef MODULE_LIGHTING
53
+ gl_FragColor = lighting_filterColor(gl_FragColor);
54
+ #endif
55
+
56
+ #ifdef MODULE_FOG
57
+ gl_FragColor = fog_filterColor(gl_FragColor);
58
+ #endif
59
+
60
+ #ifdef MODULE_PICKING
61
+ gl_FragColor = picking_filterHighlightColor(gl_FragColor);
62
+ gl_FragColor = picking_filterPickingColor(gl_FragColor);
63
+ #endif
64
+
65
+ #ifdef MODULE_LOGDEPTH
66
+ logdepth_setFragDepth();
67
+ #endif
68
+ `])));var Ql={vertex:Fo,fragment:Uo},Go=/void\s+main\s*\([^)]*\)\s*\{\n?/,zo=/}\n?[^{}]*$/,xn=[],De="__LUMA_INJECT_DECLARATIONS__";function Bo(t){var e={vertex:{},fragment:{}};for(var r in t){var n=t[r],i=th(r);typeof n=="string"&&(n={order:0,injection:n}),e[i][r]=n}return e}function th(t){var e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function Ce(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=e==="vertex",o=function(){var s=r[a];s.sort(function(g,S){return g.order-S.order}),xn.length=s.length;for(var f=0,p=s.length;f<p;++f)xn[f]=s[f].injection;var d="".concat(xn.join(`
69
+ `),`
70
+ `);switch(a){case"vs:#decl":i&&(t=t.replace(De,d));break;case"vs:#main-start":i&&(t=t.replace(Go,function(g){return g+d}));break;case"vs:#main-end":i&&(t=t.replace(zo,function(g){return d+g}));break;case"fs:#decl":i||(t=t.replace(De,d));break;case"fs:#main-start":i||(t=t.replace(Go,function(g){return g+d}));break;case"fs:#main-end":i||(t=t.replace(zo,function(g){return d+g}));break;default:t=t.replace(a,function(g){return g+d})}};for(var a in r)o();return t=t.replace(De,""),n&&(t=t.replace(/\}\s*$/,function(u){return u+Ql[e]})),t}function Fe(t){return Fe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fe(t)}function Vo(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rh(n.key),n)}}function eh(t,e,r){return e&&Vo(t.prototype,e),r&&Vo(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rh(t){var e=nh(t,"string");return Fe(e)==="symbol"?e:String(e)}function nh(t,e){if(Fe(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Fe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ih(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var oh=1,br=function(){t.instantiateModules=function(n){return n.map(function(i){if(i instanceof t)return i;yt(typeof i!="string","Shader module use by name is deprecated. Import shader module '".concat(JSON.stringify(i),"' and use it directly.")),i.name||(console.warn("shader module has no name"),i.name="shader-module-".concat(oh++));var o=new t(i);return o.dependencies=t.instantiateModules(i.dependencies||[]),o})};function t(r){ih(this,t),this.name=void 0,this.vs=void 0,this.fs=void 0,this.getModuleUniforms=void 0,this.dependencies=void 0,this.deprecations=void 0,this.defines=void 0,this.injections=void 0,this.uniforms={},this.uniformTypes={};var n=r.name,i=r.vs,o=r.fs,a=r.dependencies,u=a===void 0?[]:a,s=r.uniformPropTypes,f=s===void 0?{}:s,p=r.getUniforms,d=r.deprecations,g=d===void 0?[]:d,S=r.defines,x=S===void 0?{}:S,O=r.inject,A=O===void 0?{}:O;yt(typeof n=="string"),this.name=n,this.vs=i,this.fs=o,this.getModuleUniforms=p,this.dependencies=t.instantiateModules(u),this.deprecations=this._parseDeprecationDefinitions(g),this.defines=x,this.injections=Bo(A),f&&(this.uniforms=Lo(f))}var e=t.prototype;return e.getModuleSource=function(n){var i;switch(n){case"vertex":i=this.vs||"";break;case"fragment":i=this.fs||"";break;default:yt(!1)}var o=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return"// ----- MODULE ".concat(this.name,` ---------------
71
+
72
+ #define MODULE_`).concat(o,`
73
+ `).concat(i,`
74
+
75
+ `)},e.getUniforms=function(n,i){return this.getModuleUniforms?this.getModuleUniforms(n,i):jo(n,this.uniforms,this.name)},e.getDefines=function(){return this.defines},e.checkDeprecations=function(n,i){this.deprecations.forEach(function(o){var a;(a=o.regex)!==null&&a!==void 0&&a.test(n)&&(o.deprecated?i.deprecated(o.old,o.new)():i.removed(o.old,o.new)())})},e._parseDeprecationDefinitions=function(n){return n.forEach(function(i){switch(i.type){case"function":i.regex=new RegExp("\\b".concat(i.old,"\\("));break;default:i.regex=new RegExp("".concat(i.type," ").concat(i.old,";"))}}),n},e._defaultGetUniforms=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={},o=this.uniforms;for(var a in o){var u=o[a];a in n&&!u.private?(u.validate&&yt(u.validate(n[a],u),"".concat(this.name,": invalid ").concat(a)),i[a]=n[a]):i[a]=u.value}return i},eh(t)}();function qo(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ah(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
76
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function ah(t,e){if(t){if(typeof t=="string")return Wo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Wo(t,e)}}function Wo(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ue(t){var e=br.instantiateModules(t);return sh(e)}function sh(t){var e={},r={};return Ho({modules:t,level:0,moduleMap:e,moduleDepth:r}),Object.keys(r).sort(function(n,i){return r[i]-r[n]}).map(function(n){return e[n]})}function Ho(t){var e=t.modules,r=t.level,n=t.moduleMap,i=t.moduleDepth;if(r>=5)throw new Error("Possible loop in shader dependency graph");var o=qo(e),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;n[u.name]=u,(i[u.name]===void 0||i[u.name]<r)&&(i[u.name]=r)}}catch(d){o.e(d)}finally{o.f()}var s=qo(e),f;try{for(s.s();!(f=s.n()).done;){var p=f.value;p.dependencies&&Ho({modules:p.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}}catch(d){s.e(d)}finally{s.f()}}var Ko,Yo,Xo,$o,Zo,Jo,Qo,ta,ea,ra;function vt(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function na(t){switch(t?.gpu.toLowerCase()){case"apple":return tt(Ko||(Ko=vt([`#define APPLE_GPU
77
+ // Apple optimizes away the calculation necessary for emulated fp64
78
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
79
+ #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
80
+ // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
81
+ #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
82
+ `],[`\\
83
+ #define APPLE_GPU
84
+ // Apple optimizes away the calculation necessary for emulated fp64
85
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
86
+ #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
87
+ // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
88
+ #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
89
+ `])));case"nvidia":return tt(Yo||(Yo=vt([`#define NVIDIA_GPU
90
+ // Nvidia optimizes away the calculation necessary for emulated fp64
91
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
92
+ `],[`\\
93
+ #define NVIDIA_GPU
94
+ // Nvidia optimizes away the calculation necessary for emulated fp64
95
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
96
+ `])));case"intel":return tt(Xo||(Xo=vt([`#define INTEL_GPU
97
+ // Intel optimizes away the calculation necessary for emulated fp64
98
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
99
+ // Intel's built-in 'tan' function doesn't have acceptable precision
100
+ #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
101
+ // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
102
+ #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
103
+ `],[`\\
104
+ #define INTEL_GPU
105
+ // Intel optimizes away the calculation necessary for emulated fp64
106
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
107
+ // Intel's built-in 'tan' function doesn't have acceptable precision
108
+ #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
109
+ // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
110
+ #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
111
+ `])));case"amd":return tt($o||($o=vt([`#define AMD_GPU
112
+ `],[`\\
113
+ #define AMD_GPU
114
+ `])));default:return tt(Zo||(Zo=vt([`#define DEFAULT_GPU
115
+ // Prevent driver from optimizing away the calculation necessary for emulated fp64
116
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
117
+ // Headless Chrome's software shader 'tan' function doesn't have acceptable precision
118
+ #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
119
+ // If the GPU doesn't have full 32 bits precision, will causes overflow
120
+ #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
121
+ `],[`\\
122
+ #define DEFAULT_GPU
123
+ // Prevent driver from optimizing away the calculation necessary for emulated fp64
124
+ #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
125
+ // Headless Chrome's software shader 'tan' function doesn't have acceptable precision
126
+ #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
127
+ // If the GPU doesn't have full 32 bits precision, will causes overflow
128
+ #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
129
+ `])))}}function ia(t){var e="";return t.features.has("webgl2")&&(e+=tt(Jo||(Jo=vt([`# define FEATURE_GLSL_DERIVATIVES
130
+ # define FEATURE_GLSL_DRAW_BUFFERS
131
+ # define FEATURE_GLSL_FRAG_DEPTH
132
+ # define FEATURE_GLSL_TEXTURE_LOD
133
+ `],[`\\
134
+ # define FEATURE_GLSL_DERIVATIVES
135
+ # define FEATURE_GLSL_DRAW_BUFFERS
136
+ # define FEATURE_GLSL_FRAG_DEPTH
137
+ # define FEATURE_GLSL_TEXTURE_LOD
138
+ `])))),t.features.has("webgl2")||(t.features.has("glsl-frag-depth")&&(e+=tt(Qo||(Qo=vt([`
139
+ // FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
140
+ #ifdef GL_EXT_frag_depth
141
+ # extension GL_EXT_frag_depth : enable
142
+ # define FEATURE_GLSL_FRAG_DEPTH
143
+ # define FRAG_DEPTH
144
+ # define gl_FragDepth gl_FragDepthEXT
145
+ #endif
146
+ `],[`\\
147
+
148
+ // FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
149
+ #ifdef GL_EXT_frag_depth
150
+ # extension GL_EXT_frag_depth : enable
151
+ # define FEATURE_GLSL_FRAG_DEPTH
152
+ # define FRAG_DEPTH
153
+ # define gl_FragDepth gl_FragDepthEXT
154
+ #endif
155
+ `])))),t!=null&&t.features.has("glsl-derivatives")&&(e+=tt(ta||(ta=vt([`
156
+ // FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available
157
+ #if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
158
+ # extension GL_OES_standard_derivatives : enable
159
+ # define FEATURE_GLSL_DERIVATIVES
160
+ #endif
161
+ `],[`\\
162
+
163
+ // FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available
164
+ #if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
165
+ # extension GL_OES_standard_derivatives : enable
166
+ # define FEATURE_GLSL_DERIVATIVES
167
+ #endif
168
+ `])))),t!=null&&t.features.has("glsl-frag-data")&&(e+=tt(ea||(ea=vt([`
169
+ // FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available
170
+ #ifdef GL_EXT_draw_buffers
171
+ # extension GL_EXT_draw_buffers : require
172
+ # define FEATURE_GLSL_DRAW_BUFFERS
173
+ #endif
174
+ `],[`\\
175
+
176
+ // FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available
177
+ #ifdef GL_EXT_draw_buffers
178
+ # extension GL_EXT_draw_buffers : require
179
+ # define FEATURE_GLSL_DRAW_BUFFERS
180
+ #endif
181
+ `])))),t!=null&&t.features.has("glsl-texture-lod")&&(e+=tt(ra||(ra=vt([`// TEXTURE_LOD => texture2DLod etc are available
182
+ #ifdef GL_EXT_shader_texture_lod
183
+ # extension GL_EXT_shader_texture_lod : enable
184
+ # define FEATURE_GLSL_TEXTURE_LOD
185
+ # define TEXTURE_LOD
186
+ #endif
187
+ `],[`\\
188
+ // TEXTURE_LOD => texture2DLod etc are available
189
+ #ifdef GL_EXT_shader_texture_lod
190
+ # extension GL_EXT_shader_texture_lod : enable
191
+ # define FEATURE_GLSL_TEXTURE_LOD
192
+ # define TEXTURE_LOD
193
+ #endif
194
+ `]))))),e}function uh(t,e){return lh(t)||ch(t,e)||sa(t,e)||fh()}function fh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
195
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ch(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function lh(t){if(Array.isArray(t))return t}function hh(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=sa(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
196
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function sa(t,e){if(t){if(typeof t=="string")return oa(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return oa(t,e)}}function oa(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ua(t,e,r){var n,i=Number(((n=t.match(/^#version[ \t]+(\d+)/m))===null||n===void 0?void 0:n[1])||100);if(i!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(e){case 300:switch(r){case"vertex":return t=Ge(t,ph),t;case"fragment":return t=Ge(t,mh),t;default:throw new Error(r)}case 100:switch(r){case"vertex":return t=Ge(t,dh),t;case"fragment":return t=Ge(t,la),t=vh(t),t;default:throw new Error(r)}default:throw new Error(String(e))}}var fa=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
197
+ `],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],ph=[].concat(fa,[[ne("attribute"),"in $1"],[ne("varying"),"out $1"]]),mh=[].concat(fa,[[ne("varying"),"in $1"]]),ca=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],dh=[].concat(ca,[[ne("in"),"attribute $1"],[ne("out"),"varying $1"]]),la=[].concat(ca,[[ne("in"),"varying $1"]]),yh="gl_FragColor",aa=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function Ge(t,e){var r=hh(e),n;try{for(r.s();!(n=r.n()).done;){var i=uh(n.value,2),o=i[0],a=i[1];t=t.replace(o,a)}}catch(u){r.e(u)}finally{r.f()}return t}function vh(t){t=Ge(t,la);var e=aa.exec(t);if(e){var r=e[1];t=t.replace(aa,"").replace(new RegExp("\\b".concat(r,"\\b"),"g"),yh)}return t}function ne(t){return new RegExp("\\b".concat(t,"[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"),"g")}function gh(t,e){return wh(t)||bh(t,e)||ma(t,e)||_h()}function _h(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
198
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bh(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function wh(t){if(Array.isArray(t))return t}function pa(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ma(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
199
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function ma(t,e){if(t){if(typeof t=="string")return ha(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ha(t,e)}}function ha(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Sn(t,e){var r="";for(var n in t){var i=t[n];if(r+="void ".concat(i.signature,` {
200
+ `),i.header&&(r+=" ".concat(i.header)),e[n]){var o=e[n];o.sort(function(f,p){return f.order-p.order});var a=pa(o),u;try{for(a.s();!(u=a.n()).done;){var s=u.value;r+=" ".concat(s.injection,`
201
+ `)}}catch(f){a.e(f)}finally{a.f()}}i.footer&&(r+=" ".concat(i.footer)),r+=`}
202
+ `}return r}function On(t){var e={vertex:{},fragment:{}},r=pa(t),n;try{for(r.s();!(n=r.n()).done;){var i=n.value,o=void 0,a=void 0;typeof i!="string"?(o=i,a=o.hook):(o={},a=i),a=a.trim();var u=a.split(":"),s=gh(u,2),f=s[0],p=s[1],d=a.replace(/\(.+/,""),g=Object.assign(o,{signature:p});switch(f){case"vs":e.vertex[d]=g;break;case"fs":e.fragment[d]=g;break;default:throw new Error(f)}}}catch(S){r.e(S)}finally{r.f()}return e}function da(t,e){return{name:xh(t,e),language:"glsl",version:Sh(t)}}function xh(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",r=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/,n=r.exec(t);return n?n[1]:e}function Sh(t){var e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){var n=parseInt(r[1],10);Number.isFinite(n)&&(e=n)}if(e!==100&&e!==300)throw new Error("Invalid GLSL version ".concat(e));return e}function ze(t){return ze=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ze(t)}var ya;function Pn(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Oh(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
203
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Oh(t,e){if(t){if(typeof t=="string")return va(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return va(t,e)}}function va(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ga(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function It(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(r),!0).forEach(function(n){Ph(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ga(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ph(t,e,r){return e=Eh(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Eh(t){var e=Ah(t,"string");return ze(e)==="symbol"?e:String(e)}function Ah(t,e){if(ze(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ze(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Th(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var xa=`
204
+
205
+ `.concat(De,`
206
+ `),kh=tt(ya||(ya=Th([`precision highp float;
207
+ `],[`\\
208
+ precision highp float;
209
+ `])));function Sa(t){var e=t.vs,r=t.fs,n=Ue(t.modules||[]);switch(t.platformInfo.shaderLanguage){case"glsl":return{vs:ba(t.platformInfo,It(It({},t),{},{source:e,stage:"vertex",modules:n})),fs:ba(t.platformInfo,It(It({},t),{},{source:r,stage:"fragment",modules:n})),getUniforms:wa(n)};case"wgsl":return{vs:_a(t.platformInfo,It(It({},t),{},{source:e,stage:"vertex",modules:n})),fs:_a(t.platformInfo,It(It({},t),{},{source:r,stage:"fragment",modules:n})),getUniforms:wa(n)}}}function _a(t,e){var r=e.source,n=e.stage,i=e.modules,o=e.hookFunctions,a=o===void 0?[]:o,u=e.inject,s=u===void 0?{}:u,f=e.log;yt(typeof r=="string","shader source must be a string");var p=r,d="",g=On(a),S={},x={},O={};for(var A in s){var P=typeof s[A]=="string"?{injection:s[A],order:0}:s[A],M=/^(v|f)s:(#)?([\w-]+)$/.exec(A);if(M){var k=M[2],L=M[3];k?L==="decl"?x[A]=[P]:O[A]=[P]:S[A]=[P]}else O[A]=[P]}var I=t.type!=="webgpu"?i:[],j=Pn(I),U;try{for(j.s();!(U=j.n()).done;){var G=U.value;f&&G.checkDeprecations(p,f);var V=G.getModuleSource(n,"wgsl");d+=V;var B=G.injections[n];for(var F in B){var h=/^(v|f)s:#([\w-]+)$/.exec(F);if(h){var c=h[2],l=c==="decl"?x:O;l[F]=l[F]||[],l[F].push(B[F])}else S[F]=S[F]||[],S[F].push(B[F])}}}catch(y){j.e(y)}finally{j.f()}return d+=xa,d=Ce(d,n,x),d+=Sn(g[n],S),d+=p,d=Ce(d,n,O),d}function ba(t,e){var r=e.id,n=e.source,i=e.stage,o=e.language,a=o===void 0?"glsl":o,u=e.modules,s=e.defines,f=s===void 0?{}:s,p=e.hookFunctions,d=p===void 0?[]:p,g=e.inject,S=g===void 0?{}:g,x=e.prologue,O=x===void 0?!0:x,A=e.log;yt(typeof n=="string","shader source must be a string");var P=a==="glsl"?da(n).version:-1,M=t.shaderLanguageVersion,k=P===100?"#version 100":"#version 300 es",L=n.split(`
210
+ `),I=L.slice(1).join(`
211
+ `),j={};u.forEach(function(Q){Object.assign(j,Q.getDefines())}),Object.assign(j,f);var U="";switch(a){case"wgsl":break;case"glsl":U=O?"".concat(k,`
212
+
213
+ // ----- PROLOGUE -------------------------
214
+ `).concat(Mh({id:r,source:n,stage:i}),`
215
+ `,"#define SHADER_TYPE_".concat(i.toUpperCase()),`
216
+ `).concat(na(t),`
217
+ `).concat(ia(t),`
218
+ `).concat(i==="fragment"?kh:"",`
219
+
220
+ // ----- APPLICATION DEFINES -------------------------
221
+
222
+ `).concat(Ih(j),`
223
+
224
+ `):"".concat(k,`
225
+ `);break}var G=On(d),V={},B={},F={};for(var h in S){var c=typeof S[h]=="string"?{injection:S[h],order:0}:S[h],l=/^(v|f)s:(#)?([\w-]+)$/.exec(h);if(l){var y=l[2],b=l[3];y?b==="decl"?B[h]=[c]:F[h]=[c]:V[h]=[c]}else F[h]=[c]}var v=Pn(u),T;try{for(v.s();!(T=v.n()).done;){var R=T.value;A&&R.checkDeprecations(I,A);var N=R.getModuleSource(i);U+=N;var q=R.injections[i];for(var z in q){var K=/^(v|f)s:#([\w-]+)$/.exec(z);if(K){var ct=K[2],lt=ct==="decl"?B:F;lt[z]=lt[z]||[],lt[z].push(q[z])}else V[z]=V[z]||[],V[z].push(q[z])}}}catch(Q){v.e(Q)}finally{v.f()}return U+="// ----- MAIN SHADER SOURCE -------------------------",U+=xa,U=Ce(U,i,B),U+=Sn(G[i],V),U+=I,U=Ce(U,i,F),a==="glsl"&&P!==M&&(U=ua(U,M,i)),U.trim()}function wa(t){return function(r){var n={},i=Pn(t),o;try{for(i.s();!(o=i.n()).done;){var a=o.value,u=a.getUniforms(r,n);Object.assign(n,u)}}catch(s){i.e(s)}finally{i.f()}return n}}function Mh(t){var e=t.id,r=t.source,n=t.stage,i=e&&r.indexOf("SHADER_NAME")===-1;return i?`
226
+ #define SHADER_NAME `.concat(e,"_").concat(n,`
227
+
228
+ `):""}function Ih(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e="";for(var r in t){var n=t[r];(n||Number.isFinite(n))&&(e+="#define ".concat(r.toUpperCase()," ").concat(t[r],`
229
+ `))}return e}function Be(t){return Be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(t)}function Oa(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Pa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Oa(Object(r),!0).forEach(function(n){Rh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Oa(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Rh(t,e,r){return e=Lh(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Lh(t){var e=jh(t,"string");return Be(e)==="symbol"?e:String(e)}function jh(t,e){if(Be(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Aa(t){if(!t.vs)throw new Error("no vertex shader");var e=Ea(t.platformInfo,t.vs),r;return t.fs&&(r=Ea(t.platformInfo,t.fs)),Pa(Pa({},t),{},{vs:e,fs:r})}function Ea(t,e){if(typeof e=="string")return e;switch(t.type){case"webgpu":if(e!=null&&e.wgsl)return e.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(e!=null&&e.glsl)return e.glsl;throw new Error("WebGL does not support WGSL shaders")}}function Ve(t){return Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ve(t)}function Ta(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(r),!0).forEach(function(n){Nh(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ta(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Nh(t,e,r){return e=Ma(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ka(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ma(n.key),n)}}function Dh(t,e,r){return e&&ka(t.prototype,e),r&&ka(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ma(t){var e=Ch(t,"string");return Ve(e)==="symbol"?e:String(e)}function Ch(t,e){if(Ve(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ve(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fh(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var xr=function(){function t(){Fh(this,t),this._hookFunctions=[],this._defaultModules=[]}t.getDefaultShaderAssembler=function(){return t.defaultShaderAssembler=t.defaultShaderAssembler||new t,t.defaultShaderAssembler};var e=t.prototype;return e.addDefaultModule=function(n){this._defaultModules.find(function(i){return i.name===(typeof n=="string"?n:n.name)})||this._defaultModules.push(n)},e.removeDefaultModule=function(n){var i=typeof n=="string"?n:n.name;this._defaultModules=this._defaultModules.filter(function(o){return o.name!==i})},e.addShaderHook=function(n,i){i&&(n=Object.assign(i,{hook:n})),this._hookFunctions.push(n)},e.assembleShaders=function(n){var i=this._getModuleList(n.modules),o=this._hookFunctions,a=Aa(n),u=Sa(wr(wr({platformInfo:n.platformInfo},a),{},{modules:i,hookFunctions:o}));return wr(wr({},u),{},{modules:i})},e._getModuleList=function(){for(var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],i=new Array(this._defaultModules.length+n.length),o={},a=0,u=0,s=this._defaultModules.length;u<s;++u){var f=this._defaultModules[u],p=f.name;i[a++]=f,o[p]=!0}for(var d=0,g=n.length;d<g;++d){var S=n[d],x=S.name;o[x]||(i[a++]=S,o[x]=!0)}return i.length=a,br.instantiateModules(i)},Dh(t)}();xr.defaultShaderAssembler=void 0;var Ia,Ra;function La(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var Uh=tt(Ia||(Ia=La(["void main() {gl_FragColor = vec4(0);}"]))),ja=tt(Ra||(Ra=La([`out vec4 transform_output;
230
+ void main() {
231
+ transform_output = vec4(0);
232
+ }`],[`\\
233
+ out vec4 transform_output;
234
+ void main() {
235
+ transform_output = vec4(0);
236
+ }`]))),Gh=`#version 300 es
237
+ `.concat(ja);function qe(t){var e=t||{},r=e.version,n=r===void 0?100:r,i=e.input,o=e.inputChannels,a=e.output;if(!i)return n===300?Gh:n>300?"#version ".concat(n,`
238
+ `).concat(ja):Uh;if(!o)throw new Error("inputChannels");var u=zh(o),s=Na(i,o);return n>=300?"#version ".concat(n," ").concat(n===300?"es":"",`
239
+ in `).concat(u," ").concat(i,`;
240
+ out vec4 `).concat(a,`;
241
+ void main() {
242
+ `).concat(a," = ").concat(s,`;
243
+ }`):"varying ".concat(u," ").concat(i,`;
244
+ void main() {
245
+ gl_FragColor = `).concat(s,`;
246
+ }`)}function zh(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error("invalid channels: ".concat(t))}}function Na(t,e){switch(e){case 1:return"vec4(".concat(t,", 0.0, 0.0, 1.0)");case 2:return"vec4(".concat(t,", 0.0, 1.0)");case 3:return"vec4(".concat(t,", 1.0)");case 4:return t;default:throw new Error("invalid channels: ".concat(e))}}function ae(t){return ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae(t)}function st(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ya(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
247
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Lt(t){return qh(t)||Vh(t)||Ya(t)||Bh()}function Bh(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
248
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ya(t,e){if(t){if(typeof t=="string")return An(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return An(t,e)}}function Vh(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function qh(t){if(Array.isArray(t))return An(t)}function An(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tn(t,e)}function Tn(t,e){return Tn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Tn(t,e)}function H(t){var e=Kh();return function(){var n=Er(t),i;if(e){var o=Er(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Wh(this,i)}}function Wh(t,e){if(e&&(ae(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hh(t)}function Hh(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Kh(){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 Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Er(t)}function Da(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Yh(n.key),n)}}function D(t,e,r){return e&&Da(t.prototype,e),r&&Da(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yh(t){var e=Xh(t,"string");return ae(e)==="symbol"?e:String(e)}function Xh(t,e){if(ae(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ae(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function C(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var $h=D(function t(){C(this,t),this.constants=new Map,this.aliases=new Map,this.structs=new Map}),Bt=function(){function t(){C(this,t)}var e=t.prototype;return e.evaluate=function(n){throw new Error("Cannot evaluate node")},e.evaluateString=function(n){return this.evaluate(n).toString()},D(t,[{key:"isAstNode",get:function(){return!0}},{key:"astNodeType",get:function(){return""}}]),t}(),Z=function(t){W(r,t);var e=H(r);function r(){return C(this,r),e.call(this)}return D(r)}(Bt),Xa=function(t){W(r,t);var e=H(r);function r(n,i,o,a){var u;return C(this,r),u=e.call(this),u.name=n,u.args=i,u.returnType=o,u.body=a,u}return D(r,[{key:"astNodeType",get:function(){return"function"}}]),r}(Z),Zh=function(t){W(r,t);var e=H(r);function r(n){var i;return C(this,r),i=e.call(this),i.expression=n,i}return D(r,[{key:"astNodeType",get:function(){return"staticAssert"}}]),r}(Z),Jh=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.condition=n,o.body=i,o}return D(r,[{key:"astNodeType",get:function(){return"while"}}]),r}(Z),Qh=function(t){W(r,t);var e=H(r);function r(n){var i;return C(this,r),i=e.call(this),i.body=n,i}return D(r,[{key:"astNodeType",get:function(){return"continuing"}}]),r}(Z),tp=function(t){W(r,t);var e=H(r);function r(n,i,o,a){var u;return C(this,r),u=e.call(this),u.init=n,u.condition=i,u.increment=o,u.body=a,u}return D(r,[{key:"astNodeType",get:function(){return"for"}}]),r}(Z),ie=function(t){W(r,t);var e=H(r);function r(n,i,o,a,u){var s;return C(this,r),s=e.call(this),s.name=n,s.type=i,s.storage=o,s.access=a,s.value=u,s}return D(r,[{key:"astNodeType",get:function(){return"var"}}]),r}(Z),$a=function(t){W(r,t);var e=H(r);function r(n,i,o){var a;return C(this,r),a=e.call(this),a.name=n,a.type=i,a.value=o,a}return D(r,[{key:"astNodeType",get:function(){return"override"}}]),r}(Z),Ca=function(t){W(r,t);var e=H(r);function r(n,i,o,a,u){var s;return C(this,r),s=e.call(this),s.name=n,s.type=i,s.storage=o,s.access=a,s.value=u,s}return D(r,[{key:"astNodeType",get:function(){return"let"}}]),r}(Z),Fa=function(t){W(r,t);var e=H(r);function r(i,o,a,u,s){var f;return C(this,r),f=e.call(this),f.name=i,f.type=o,f.storage=a,f.access=u,f.value=s,f}var n=r.prototype;return n.evaluate=function(o){return this.value.evaluate(o)},D(r,[{key:"astNodeType",get:function(){return"const"}}]),r}(Z),se;(function(t){t.increment="++",t.decrement="--"})(se||(se={}));(function(t){function e(r){var n=r;if(n=="parse")throw new Error("Invalid value for IncrementOperator");return t[n]}t.parse=e})(se||(se={}));var ep=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.operator=n,o.variable=i,o}return D(r,[{key:"astNodeType",get:function(){return"increment"}}]),r}(Z),Ke;(function(t){t.assign="=",t.addAssign="+=",t.subtractAssin="-=",t.multiplyAssign="*=",t.divideAssign="/=",t.moduloAssign="%=",t.andAssign="&=",t.orAssign="|=",t.xorAssign="^=",t.shiftLeftAssign="<<=",t.shiftRightAssign=">>="})(Ke||(Ke={}));(function(t){function e(r){var n=r;if(n=="parse")throw new Error("Invalid value for AssignOperator");return t[n]}t.parse=e})(Ke||(Ke={}));var rp=function(t){W(r,t);var e=H(r);function r(n,i,o){var a;return C(this,r),a=e.call(this),a.operator=n,a.variable=i,a.value=o,a}return D(r,[{key:"astNodeType",get:function(){return"assign"}}]),r}(Z),np=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.name=n,o.args=i,o}return D(r,[{key:"astNodeType",get:function(){return"call"}}]),r}(Z),ip=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.body=n,o.continuing=i,o}return D(r,[{key:"astNodeType",get:function(){return"loop"}}]),r}(Z),op=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.condition=n,o.body=i,o}return D(r,[{key:"astNodeType",get:function(){return"body"}}]),r}(Z),ap=function(t){W(r,t);var e=H(r);function r(n,i,o,a){var u;return C(this,r),u=e.call(this),u.condition=n,u.body=i,u.elseif=o,u.else=a,u}return D(r,[{key:"astNodeType",get:function(){return"if"}}]),r}(Z),sp=function(t){W(r,t);var e=H(r);function r(n){var i;return C(this,r),i=e.call(this),i.value=n,i}return D(r,[{key:"astNodeType",get:function(){return"return"}}]),r}(Z),up=function(t){W(r,t);var e=H(r);function r(n){var i;return C(this,r),i=e.call(this),i.name=n,i}return D(r,[{key:"astNodeType",get:function(){return"enable"}}]),r}(Z),Za=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.name=n,o.type=i,o}return D(r,[{key:"astNodeType",get:function(){return"alias"}}]),r}(Z),fp=function(t){W(r,t);var e=H(r);function r(){return C(this,r),e.call(this)}return D(r,[{key:"astNodeType",get:function(){return"discard"}}]),r}(Z),cp=function(t){W(r,t);var e=H(r);function r(){return C(this,r),e.call(this)}return D(r,[{key:"astNodeType",get:function(){return"break"}}]),r}(Z),lp=function(t){W(r,t);var e=H(r);function r(){return C(this,r),e.call(this)}return D(r,[{key:"astNodeType",get:function(){return"continue"}}]),r}(Z),Vt=function(t){W(r,t);var e=H(r);function r(n){var i;return C(this,r),i=e.call(this),i.name=n,i}return D(r,[{key:"astNodeType",get:function(){return"type"}},{key:"isStruct",get:function(){return!1}},{key:"isArray",get:function(){return!1}}]),r}(Z),zt=function(t){W(r,t);var e=H(r);function r(i,o){var a;return C(this,r),a=e.call(this,i),a.members=o,a}var n=r.prototype;return n.getMemberIndex=function(o){for(var a=0;a<this.members.length;a++)if(this.members[a].name==o)return a;return-1},D(r,[{key:"astNodeType",get:function(){return"struct"}},{key:"isStruct",get:function(){return!0}}]),r}(Vt),Ja=function(t){W(r,t);var e=H(r);function r(n,i,o){var a;return C(this,r),a=e.call(this,n),a.format=i,a.access=o,a}return D(r,[{key:"astNodeType",get:function(){return"template"}}]),r}(Vt),hp=function(t){W(r,t);var e=H(r);function r(n,i,o,a){var u;return C(this,r),u=e.call(this,n),u.storage=i,u.type=o,u.access=a,u}return D(r,[{key:"astNodeType",get:function(){return"pointer"}}]),r}(Vt),Qa=function(t){W(r,t);var e=H(r);function r(n,i,o,a){var u;return C(this,r),u=e.call(this,n),u.attributes=i,u.format=o,u.count=a,u}return D(r,[{key:"astNodeType",get:function(){return"array"}},{key:"isArray",get:function(){return!0}}]),r}(Vt),We=function(t){W(r,t);var e=H(r);function r(n,i,o){var a;return C(this,r),a=e.call(this,n),a.format=i,a.access=o,a}return D(r,[{key:"astNodeType",get:function(){return"sampler"}}]),r}(Vt),_t=function(t){W(r,t);var e=H(r);function r(){return C(this,r),e.call(this)}return D(r)}(Bt),Ua=function(t){W(r,t);var e=H(r);function r(i){var o;return C(this,r),o=e.call(this),o.value=i,o}var n=r.prototype;return n.toString=function(){return this.value},n.evaluateString=function(){return this.value},D(r,[{key:"astNodeType",get:function(){return"stringExpr"}}]),r}(_t),He=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.type=n,o.args=i,o}return D(r,[{key:"astNodeType",get:function(){return"createExpr"}}]),r}(_t),pp=function(t){W(r,t);var e=H(r);function r(i,o){var a;return C(this,r),a=e.call(this),a.name=i,a.args=o,a}var n=r.prototype;return n.evaluate=function(o){switch(this.name){case"abs":return Math.abs(this.args[0].evaluate(o));case"acos":return Math.acos(this.args[0].evaluate(o));case"acosh":return Math.acosh(this.args[0].evaluate(o));case"asin":return Math.asin(this.args[0].evaluate(o));case"asinh":return Math.asinh(this.args[0].evaluate(o));case"atan":return Math.atan(this.args[0].evaluate(o));case"atan2":return Math.atan2(this.args[0].evaluate(o),this.args[1].evaluate(o));case"atanh":return Math.atanh(this.args[0].evaluate(o));case"ceil":return Math.ceil(this.args[0].evaluate(o));case"clamp":return Math.min(Math.max(this.args[0].evaluate(o),this.args[1].evaluate(o)),this.args[2].evaluate(o));case"cos":return Math.cos(this.args[0].evaluate(o));case"degrees":return this.args[0].evaluate(o)*180/Math.PI;case"distance":return Math.sqrt(Math.pow(this.args[0].evaluate(o)-this.args[1].evaluate(o),2));case"dot":case"exp":return Math.exp(this.args[0].evaluate(o));case"exp2":return Math.pow(2,this.args[0].evaluate(o));case"floor":return Math.floor(this.args[0].evaluate(o));case"fma":return this.args[0].evaluate(o)*this.args[1].evaluate(o)+this.args[2].evaluate(o);case"fract":return this.args[0].evaluate(o)-Math.floor(this.args[0].evaluate(o));case"inverseSqrt":return 1/Math.sqrt(this.args[0].evaluate(o));case"log":return Math.log(this.args[0].evaluate(o));case"log2":return Math.log2(this.args[0].evaluate(o));case"max":return Math.max(this.args[0].evaluate(o),this.args[1].evaluate(o));case"min":return Math.min(this.args[0].evaluate(o),this.args[1].evaluate(o));case"mix":return this.args[0].evaluate(o)*(1-this.args[2].evaluate(o))+this.args[1].evaluate(o)*this.args[2].evaluate(o);case"modf":return this.args[0].evaluate(o)-Math.floor(this.args[0].evaluate(o));case"pow":return Math.pow(this.args[0].evaluate(o),this.args[1].evaluate(o));case"radians":return this.args[0].evaluate(o)*Math.PI/180;case"round":return Math.round(this.args[0].evaluate(o));case"sign":return Math.sign(this.args[0].evaluate(o));case"sin":return Math.sin(this.args[0].evaluate(o));case"sinh":return Math.sinh(this.args[0].evaluate(o));case"saturate":return Math.min(Math.max(this.args[0].evaluate(o),0),1);case"smoothstep":return this.args[0].evaluate(o)*this.args[0].evaluate(o)*(3-2*this.args[0].evaluate(o));case"sqrt":return Math.sqrt(this.args[0].evaluate(o));case"step":return this.args[0].evaluate(o)<this.args[1].evaluate(o)?0:1;case"tan":return Math.tan(this.args[0].evaluate(o));case"tanh":return Math.tanh(this.args[0].evaluate(o));case"trunc":return Math.trunc(this.args[0].evaluate(o));default:throw new Error("Non const function: "+this.name)}},D(r,[{key:"astNodeType",get:function(){return"callExpr"}}]),r}(_t),mp=function(t){W(r,t);var e=H(r);function r(n){var i;return C(this,r),i=e.call(this),i.name=n,i}return D(r,[{key:"astNodeType",get:function(){return"varExpr"}}]),r}(_t),Ga=function(t){W(r,t);var e=H(r);function r(i,o){var a;return C(this,r),a=e.call(this),a.name=i,a.initializer=o,a}var n=r.prototype;return n.evaluate=function(o){var a,u;if(this.initializer instanceof He){var s=(a=this.postfix)===null||a===void 0?void 0:a.evaluateString(o),f=(u=this.initializer.type)===null||u===void 0?void 0:u.name,p=o.structs.get(f),d=p?.getMemberIndex(s);if(d!=-1){var g=this.initializer.args[d].evaluate(o);return g}console.log(d)}return this.initializer.evaluate(o)},D(r,[{key:"astNodeType",get:function(){return"constExpr"}}]),r}(_t),za=function(t){W(r,t);var e=H(r);function r(i){var o;return C(this,r),o=e.call(this),o.value=i,o}var n=r.prototype;return n.evaluate=function(){return this.value},D(r,[{key:"astNodeType",get:function(){return"literalExpr"}}]),r}(_t),dp=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.type=n,o.value=i,o}return D(r,[{key:"astNodeType",get:function(){return"bitcastExpr"}}]),r}(_t),yp=function(t){W(r,t);var e=H(r);function r(i,o){var a;return C(this,r),a=e.call(this),a.type=i,a.args=o,a}var n=r.prototype;return n.evaluate=function(o){return this.args[0].evaluate(o)},D(r,[{key:"astNodeType",get:function(){return"typecastExpr"}}]),r}(_t),Ba=function(t){W(r,t);var e=H(r);function r(i){var o;return C(this,r),o=e.call(this),o.contents=i,o}var n=r.prototype;return n.evaluate=function(o){return this.contents[0].evaluate(o)},D(r,[{key:"astNodeType",get:function(){return"groupExpr"}}]),r}(_t),ts=function(t){W(r,t);var e=H(r);function r(){return C(this,r),e.call(this)}return D(r)}(_t),vp=function(t){W(r,t);var e=H(r);function r(i,o){var a;return C(this,r),a=e.call(this),a.operator=i,a.right=o,a}var n=r.prototype;return n.evaluate=function(o){switch(this.operator){case"+":return this.right.evaluate(o);case"-":return-this.right.evaluate(o);case"!":return this.right.evaluate(o)?0:1;case"~":return~this.right.evaluate(o);default:throw new Error("Unknown unary operator: "+this.operator)}},D(r,[{key:"astNodeType",get:function(){return"unaryOp"}}]),r}(ts),gt=function(t){W(r,t);var e=H(r);function r(i,o,a){var u;return C(this,r),u=e.call(this),u.operator=i,u.left=o,u.right=a,u}var n=r.prototype;return n.evaluate=function(o){switch(this.operator){case"+":return this.left.evaluate(o)+this.right.evaluate(o);case"-":return this.left.evaluate(o)-this.right.evaluate(o);case"*":return this.left.evaluate(o)*this.right.evaluate(o);case"/":return this.left.evaluate(o)/this.right.evaluate(o);case"%":return this.left.evaluate(o)%this.right.evaluate(o);case"==":return this.left.evaluate(o)==this.right.evaluate(o)?1:0;case"!=":return this.left.evaluate(o)!=this.right.evaluate(o)?1:0;case"<":return this.left.evaluate(o)<this.right.evaluate(o)?1:0;case">":return this.left.evaluate(o)>this.right.evaluate(o)?1:0;case"<=":return this.left.evaluate(o)<=this.right.evaluate(o)?1:0;case">=":return this.left.evaluate(o)>=this.right.evaluate(o)?1:0;case"&&":return this.left.evaluate(o)&&this.right.evaluate(o)?1:0;case"||":return this.left.evaluate(o)||this.right.evaluate(o)?1:0;default:throw new Error("Unknown operator ".concat(this.operator))}},D(r,[{key:"astNodeType",get:function(){return"binaryOp"}}]),r}(ts),es=function(t){W(r,t);var e=H(r);function r(){return C(this,r),e.call(this)}return D(r)}(Bt),gp=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.selector=n,o.body=i,o}return D(r,[{key:"astNodeType",get:function(){return"case"}}]),r}(es),_p=function(t){W(r,t);var e=H(r);function r(n){var i;return C(this,r),i=e.call(this),i.body=n,i}return D(r,[{key:"astNodeType",get:function(){return"default"}}]),r}(es),bp=function(t){W(r,t);var e=H(r);function r(n,i,o){var a;return C(this,r),a=e.call(this),a.name=n,a.type=i,a.attributes=o,a}return D(r,[{key:"astNodeType",get:function(){return"argument"}}]),r}(Bt),wp=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.condition=n,o.body=i,o}return D(r,[{key:"astNodeType",get:function(){return"elseif"}}]),r}(Bt),xp=function(t){W(r,t);var e=H(r);function r(n,i,o){var a;return C(this,r),a=e.call(this),a.name=n,a.type=i,a.attributes=o,a}return D(r,[{key:"astNodeType",get:function(){return"member"}}]),r}(Bt),Va=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this),o.name=n,o.value=i,o}return D(r,[{key:"astNodeType",get:function(){return"attribute"}}]),r}(Bt),E,_;(function(t){t[t.token=0]="token",t[t.keyword=1]="keyword",t[t.reserved=2]="reserved"})(_||(_={}));var w=function(){function t(r,n,i){C(this,t),this.name=r,this.type=n,this.rule=i}var e=t.prototype;return e.toString=function(){return this.name},D(t)}(),m=D(function t(){C(this,t)});E=m;m.none=new w("",_.reserved,"");m.eof=new w("EOF",_.token,"");m.reserved={asm:new w("asm",_.reserved,"asm"),bf16:new w("bf16",_.reserved,"bf16"),do:new w("do",_.reserved,"do"),enum:new w("enum",_.reserved,"enum"),f16:new w("f16",_.reserved,"f16"),f64:new w("f64",_.reserved,"f64"),handle:new w("handle",_.reserved,"handle"),i8:new w("i8",_.reserved,"i8"),i16:new w("i16",_.reserved,"i16"),i64:new w("i64",_.reserved,"i64"),mat:new w("mat",_.reserved,"mat"),premerge:new w("premerge",_.reserved,"premerge"),regardless:new w("regardless",_.reserved,"regardless"),typedef:new w("typedef",_.reserved,"typedef"),u8:new w("u8",_.reserved,"u8"),u16:new w("u16",_.reserved,"u16"),u64:new w("u64",_.reserved,"u64"),unless:new w("unless",_.reserved,"unless"),using:new w("using",_.reserved,"using"),vec:new w("vec",_.reserved,"vec"),void:new w("void",_.reserved,"void")};m.keywords={array:new w("array",_.keyword,"array"),atomic:new w("atomic",_.keyword,"atomic"),bool:new w("bool",_.keyword,"bool"),f32:new w("f32",_.keyword,"f32"),i32:new w("i32",_.keyword,"i32"),mat2x2:new w("mat2x2",_.keyword,"mat2x2"),mat2x3:new w("mat2x3",_.keyword,"mat2x3"),mat2x4:new w("mat2x4",_.keyword,"mat2x4"),mat3x2:new w("mat3x2",_.keyword,"mat3x2"),mat3x3:new w("mat3x3",_.keyword,"mat3x3"),mat3x4:new w("mat3x4",_.keyword,"mat3x4"),mat4x2:new w("mat4x2",_.keyword,"mat4x2"),mat4x3:new w("mat4x3",_.keyword,"mat4x3"),mat4x4:new w("mat4x4",_.keyword,"mat4x4"),ptr:new w("ptr",_.keyword,"ptr"),sampler:new w("sampler",_.keyword,"sampler"),sampler_comparison:new w("sampler_comparison",_.keyword,"sampler_comparison"),struct:new w("struct",_.keyword,"struct"),texture_1d:new w("texture_1d",_.keyword,"texture_1d"),texture_2d:new w("texture_2d",_.keyword,"texture_2d"),texture_2d_array:new w("texture_2d_array",_.keyword,"texture_2d_array"),texture_3d:new w("texture_3d",_.keyword,"texture_3d"),texture_cube:new w("texture_cube",_.keyword,"texture_cube"),texture_cube_array:new w("texture_cube_array",_.keyword,"texture_cube_array"),texture_multisampled_2d:new w("texture_multisampled_2d",_.keyword,"texture_multisampled_2d"),texture_storage_1d:new w("texture_storage_1d",_.keyword,"texture_storage_1d"),texture_storage_2d:new w("texture_storage_2d",_.keyword,"texture_storage_2d"),texture_storage_2d_array:new w("texture_storage_2d_array",_.keyword,"texture_storage_2d_array"),texture_storage_3d:new w("texture_storage_3d",_.keyword,"texture_storage_3d"),texture_depth_2d:new w("texture_depth_2d",_.keyword,"texture_depth_2d"),texture_depth_2d_array:new w("texture_depth_2d_array",_.keyword,"texture_depth_2d_array"),texture_depth_cube:new w("texture_depth_cube",_.keyword,"texture_depth_cube"),texture_depth_cube_array:new w("texture_depth_cube_array",_.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new w("texture_depth_multisampled_2d",_.keyword,"texture_depth_multisampled_2d"),texture_external:new w("texture_external",_.keyword,"texture_external"),u32:new w("u32",_.keyword,"u32"),vec2:new w("vec2",_.keyword,"vec2"),vec3:new w("vec3",_.keyword,"vec3"),vec4:new w("vec4",_.keyword,"vec4"),bitcast:new w("bitcast",_.keyword,"bitcast"),block:new w("block",_.keyword,"block"),break:new w("break",_.keyword,"break"),case:new w("case",_.keyword,"case"),continue:new w("continue",_.keyword,"continue"),continuing:new w("continuing",_.keyword,"continuing"),default:new w("default",_.keyword,"default"),discard:new w("discard",_.keyword,"discard"),else:new w("else",_.keyword,"else"),enable:new w("enable",_.keyword,"enable"),fallthrough:new w("fallthrough",_.keyword,"fallthrough"),false:new w("false",_.keyword,"false"),fn:new w("fn",_.keyword,"fn"),for:new w("for",_.keyword,"for"),function:new w("function",_.keyword,"function"),if:new w("if",_.keyword,"if"),let:new w("let",_.keyword,"let"),const:new w("const",_.keyword,"const"),loop:new w("loop",_.keyword,"loop"),while:new w("while",_.keyword,"while"),private:new w("private",_.keyword,"private"),read:new w("read",_.keyword,"read"),read_write:new w("read_write",_.keyword,"read_write"),return:new w("return",_.keyword,"return"),storage:new w("storage",_.keyword,"storage"),switch:new w("switch",_.keyword,"switch"),true:new w("true",_.keyword,"true"),alias:new w("alias",_.keyword,"alias"),type:new w("type",_.keyword,"type"),uniform:new w("uniform",_.keyword,"uniform"),var:new w("var",_.keyword,"var"),override:new w("override",_.keyword,"override"),workgroup:new w("workgroup",_.keyword,"workgroup"),write:new w("write",_.keyword,"write"),r8unorm:new w("r8unorm",_.keyword,"r8unorm"),r8snorm:new w("r8snorm",_.keyword,"r8snorm"),r8uint:new w("r8uint",_.keyword,"r8uint"),r8sint:new w("r8sint",_.keyword,"r8sint"),r16uint:new w("r16uint",_.keyword,"r16uint"),r16sint:new w("r16sint",_.keyword,"r16sint"),r16float:new w("r16float",_.keyword,"r16float"),rg8unorm:new w("rg8unorm",_.keyword,"rg8unorm"),rg8snorm:new w("rg8snorm",_.keyword,"rg8snorm"),rg8uint:new w("rg8uint",_.keyword,"rg8uint"),rg8sint:new w("rg8sint",_.keyword,"rg8sint"),r32uint:new w("r32uint",_.keyword,"r32uint"),r32sint:new w("r32sint",_.keyword,"r32sint"),r32float:new w("r32float",_.keyword,"r32float"),rg16uint:new w("rg16uint",_.keyword,"rg16uint"),rg16sint:new w("rg16sint",_.keyword,"rg16sint"),rg16float:new w("rg16float",_.keyword,"rg16float"),rgba8unorm:new w("rgba8unorm",_.keyword,"rgba8unorm"),rgba8unorm_srgb:new w("rgba8unorm_srgb",_.keyword,"rgba8unorm_srgb"),rgba8snorm:new w("rgba8snorm",_.keyword,"rgba8snorm"),rgba8uint:new w("rgba8uint",_.keyword,"rgba8uint"),rgba8sint:new w("rgba8sint",_.keyword,"rgba8sint"),bgra8unorm:new w("bgra8unorm",_.keyword,"bgra8unorm"),bgra8unorm_srgb:new w("bgra8unorm_srgb",_.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new w("rgb10a2unorm",_.keyword,"rgb10a2unorm"),rg11b10float:new w("rg11b10float",_.keyword,"rg11b10float"),rg32uint:new w("rg32uint",_.keyword,"rg32uint"),rg32sint:new w("rg32sint",_.keyword,"rg32sint"),rg32float:new w("rg32float",_.keyword,"rg32float"),rgba16uint:new w("rgba16uint",_.keyword,"rgba16uint"),rgba16sint:new w("rgba16sint",_.keyword,"rgba16sint"),rgba16float:new w("rgba16float",_.keyword,"rgba16float"),rgba32uint:new w("rgba32uint",_.keyword,"rgba32uint"),rgba32sint:new w("rgba32sint",_.keyword,"rgba32sint"),rgba32float:new w("rgba32float",_.keyword,"rgba32float"),static_assert:new w("static_assert",_.keyword,"static_assert")};m.tokens={decimal_float_literal:new w("decimal_float_literal",_.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new w("hex_float_literal",_.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new w("int_literal",_.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new w("uint_literal",_.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new w("ident",_.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new w("and",_.token,"&"),and_and:new w("and_and",_.token,"&&"),arrow:new w("arrow ",_.token,"->"),attr:new w("attr",_.token,"@"),attr_left:new w("attr_left",_.token,"[["),attr_right:new w("attr_right",_.token,"]]"),forward_slash:new w("forward_slash",_.token,"/"),bang:new w("bang",_.token,"!"),bracket_left:new w("bracket_left",_.token,"["),bracket_right:new w("bracket_right",_.token,"]"),brace_left:new w("brace_left",_.token,"{"),brace_right:new w("brace_right",_.token,"}"),colon:new w("colon",_.token,":"),comma:new w("comma",_.token,","),equal:new w("equal",_.token,"="),equal_equal:new w("equal_equal",_.token,"=="),not_equal:new w("not_equal",_.token,"!="),greater_than:new w("greater_than",_.token,">"),greater_than_equal:new w("greater_than_equal",_.token,">="),shift_right:new w("shift_right",_.token,">>"),less_than:new w("less_than",_.token,"<"),less_than_equal:new w("less_than_equal",_.token,"<="),shift_left:new w("shift_left",_.token,"<<"),modulo:new w("modulo",_.token,"%"),minus:new w("minus",_.token,"-"),minus_minus:new w("minus_minus",_.token,"--"),period:new w("period",_.token,"."),plus:new w("plus",_.token,"+"),plus_plus:new w("plus_plus",_.token,"++"),or:new w("or",_.token,"|"),or_or:new w("or_or",_.token,"||"),paren_left:new w("paren_left",_.token,"("),paren_right:new w("paren_right",_.token,")"),semicolon:new w("semicolon",_.token,";"),star:new w("star",_.token,"*"),tilde:new w("tilde",_.token,"~"),underscore:new w("underscore",_.token,"_"),xor:new w("xor",_.token,"^"),plus_equal:new w("plus_equal",_.token,"+="),minus_equal:new w("minus_equal",_.token,"-="),times_equal:new w("times_equal",_.token,"*="),division_equal:new w("division_equal",_.token,"/="),modulo_equal:new w("modulo_equal",_.token,"%="),and_equal:new w("and_equal",_.token,"&="),or_equal:new w("or_equal",_.token,"|="),xor_equal:new w("xor_equal",_.token,"^="),shift_right_equal:new w("shift_right_equal",_.token,">>="),shift_left_equal:new w("shift_left_equal",_.token,"<<=")};m.storage_class=[E.keywords.function,E.keywords.private,E.keywords.workgroup,E.keywords.uniform,E.keywords.storage];m.access_mode=[E.keywords.read,E.keywords.write,E.keywords.read_write];m.sampler_type=[E.keywords.sampler,E.keywords.sampler_comparison];m.sampled_texture_type=[E.keywords.texture_1d,E.keywords.texture_2d,E.keywords.texture_2d_array,E.keywords.texture_3d,E.keywords.texture_cube,E.keywords.texture_cube_array];m.multisampled_texture_type=[E.keywords.texture_multisampled_2d];m.storage_texture_type=[E.keywords.texture_storage_1d,E.keywords.texture_storage_2d,E.keywords.texture_storage_2d_array,E.keywords.texture_storage_3d];m.depth_texture_type=[E.keywords.texture_depth_2d,E.keywords.texture_depth_2d_array,E.keywords.texture_depth_cube,E.keywords.texture_depth_cube_array,E.keywords.texture_depth_multisampled_2d];m.texture_external_type=[E.keywords.texture_external];m.any_texture_type=[].concat(Lt(E.sampled_texture_type),Lt(E.multisampled_texture_type),Lt(E.storage_texture_type),Lt(E.depth_texture_type),Lt(E.texture_external_type));m.texel_format=[E.keywords.r8unorm,E.keywords.r8snorm,E.keywords.r8uint,E.keywords.r8sint,E.keywords.r16uint,E.keywords.r16sint,E.keywords.r16float,E.keywords.rg8unorm,E.keywords.rg8snorm,E.keywords.rg8uint,E.keywords.rg8sint,E.keywords.r32uint,E.keywords.r32sint,E.keywords.r32float,E.keywords.rg16uint,E.keywords.rg16sint,E.keywords.rg16float,E.keywords.rgba8unorm,E.keywords.rgba8unorm_srgb,E.keywords.rgba8snorm,E.keywords.rgba8uint,E.keywords.rgba8sint,E.keywords.bgra8unorm,E.keywords.bgra8unorm_srgb,E.keywords.rgb10a2unorm,E.keywords.rg11b10float,E.keywords.rg32uint,E.keywords.rg32sint,E.keywords.rg32float,E.keywords.rgba16uint,E.keywords.rgba16sint,E.keywords.rgba16float,E.keywords.rgba32uint,E.keywords.rgba32sint,E.keywords.rgba32float];m.const_literal=[E.tokens.int_literal,E.tokens.uint_literal,E.tokens.decimal_float_literal,E.tokens.hex_float_literal,E.keywords.true,E.keywords.false];m.literal_or_ident=[E.tokens.ident,E.tokens.int_literal,E.tokens.uint_literal,E.tokens.decimal_float_literal,E.tokens.hex_float_literal];m.element_count_expression=[E.tokens.int_literal,E.tokens.uint_literal,E.tokens.ident];m.template_types=[E.keywords.vec2,E.keywords.vec3,E.keywords.vec4,E.keywords.mat2x2,E.keywords.mat2x3,E.keywords.mat2x4,E.keywords.mat3x2,E.keywords.mat3x3,E.keywords.mat3x4,E.keywords.mat4x2,E.keywords.mat4x3,E.keywords.mat4x4,E.keywords.atomic,E.keywords.bitcast].concat(Lt(E.any_texture_type));m.attribute_name=[E.tokens.ident,E.keywords.block];m.assignment_operators=[E.tokens.equal,E.tokens.plus_equal,E.tokens.minus_equal,E.tokens.times_equal,E.tokens.division_equal,E.tokens.modulo_equal,E.tokens.and_equal,E.tokens.or_equal,E.tokens.xor_equal,E.tokens.shift_right_equal,E.tokens.shift_left_equal];m.increment_operators=[E.tokens.plus_plus,E.tokens.minus_minus];var qa=function(){function t(r,n,i){C(this,t),this.type=r,this.lexeme=n,this.line=i}var e=t.prototype;return e.toString=function(){return this.lexeme},e.isTemplateType=function(){return m.template_types.indexOf(this.type)!=-1},e.isArrayType=function(){return this.type==m.keywords.array},e.isArrayOrTemplateType=function(){return this.isArrayType()||this.isTemplateType()},D(t)}(),Sp=function(){function t(r){C(this,t),this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=r??""}var e=t.prototype;return e.scanTokens=function(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw"Invalid syntax at line ".concat(this._line);return this._tokens.push(new qa(m.eof,"",this._line)),this._tokens},e.scanToken=function(){var n=this._advance();if(n==`
249
+ `)return this._line++,!0;if(this._isWhitespace(n))return!0;if(n=="/"){if(this._peekAhead()=="/"){for(;n!=`
250
+ `;){if(this._isAtEnd())return!0;n=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();for(var i=1;i>0;){if(this._isAtEnd())return!0;if(n=this._advance(),n==`
251
+ `)this._line++;else if(n=="*"){if(this._peekAhead()=="/"&&(this._advance(),i--,i==0))return!0}else n=="/"&&this._peekAhead()=="*"&&(this._advance(),i++)}return!0}}for(var o=m.none;;){var a=this._findType(n),u=this._peekAhead();if(n==">"&&(u==">"||u=="=")){for(var s=!1,f=this._tokens.length-1,p=0;p<5&&f>=0;++p,--f)if(this._tokens[f].type===m.tokens.less_than){f>0&&this._tokens[f-1].isArrayOrTemplateType()&&(s=!0);break}if(s)return this._addToken(a),!0}if(a===m.none){for(var d=n,g=0,S=2,x=0;x<S;++x)if(d+=this._peekAhead(x),a=this._findType(d),a!==m.none){g=x;break}if(a===m.none)return o===m.none?!1:(this._current--,this._addToken(o),!0);n=d,this._current+=g+1}if(o=a,this._isAtEnd())break;n+=this._advance()}return o===m.none?!1:(this._addToken(o),!0)},e._findType=function(n){for(var i in m.keywords){var o=m.keywords[i];if(this._match(n,o.rule))return o}for(var a in m.tokens){var u=m.tokens[a];if(this._match(n,u.rule))return u}return m.none},e._match=function(n,i){if(typeof i=="string"){if(i==n)return!0}else{var o=i.exec(n);if(o&&o.index==0&&o[0]==n)return!0}return!1},e._isAtEnd=function(){return this._current>=this._source.length},e._isWhitespace=function(n){return n==" "||n==" "||n=="\r"},e._advance=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,i=this._source[this._current];return n=n||0,n++,this._current+=n,i},e._peekAhead=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return n=n||0,this._current+n>=this._source.length?"\0":this._source[this._current+n]},e._addToken=function(n){var i=this._source.substring(this._start,this._current);this._tokens.push(new qa(n,i,this._line))},D(t)}(),Op=function(){function t(){C(this,t),this._tokens=[],this._current=0,this._context=new $h}var e=t.prototype;return e.parse=function(n){this._initialize(n);for(var i=[];!this._isAtEnd();){var o=this._global_decl_or_directive();if(!o)break;i.push(o)}return i},e._initialize=function(n){if(n)if(typeof n=="string"){var i=new Sp(n);this._tokens=i.scanTokens()}else this._tokens=n;else this._tokens=[];this._current=0},e._error=function(n,i){return console.error(n,i),{token:n,message:i,toString:function(){return"".concat(i)}}},e._isAtEnd=function(){return this._current>=this._tokens.length||this._peek().type==m.eof},e._match=function(n){if(n instanceof w)return this._check(n)?(this._advance(),!0):!1;for(var i=0,o=n.length;i<o;++i){var a=n[i];if(this._check(a))return this._advance(),!0}return!1},e._consume=function(n,i){if(this._check(n))return this._advance();throw this._error(this._peek(),i)},e._check=function(n){if(this._isAtEnd())return!1;var i=this._peek();if(n instanceof Array){var o=i.type,a=n.indexOf(o);return a!=-1}return i.type==n},e._advance=function(){return this._isAtEnd()||this._current++,this._previous()},e._peek=function(){return this._tokens[this._current]},e._previous=function(){return this._tokens[this._current-1]},e._global_decl_or_directive=function(){for(;this._match(m.tokens.semicolon)&&!this._isAtEnd(););if(this._match(m.keywords.alias)){var n=this._type_alias();return this._consume(m.tokens.semicolon,"Expected ';'"),n}if(this._match(m.keywords.enable)){var i=this._enable_directive();return this._consume(m.tokens.semicolon,"Expected ';'"),i}var o=this._attribute();if(this._check(m.keywords.var)){var a=this._global_variable_decl();return a!=null&&(a.attributes=o),this._consume(m.tokens.semicolon,"Expected ';'."),a}if(this._check(m.keywords.override)){var u=this._override_variable_decl();return u!=null&&(u.attributes=o),this._consume(m.tokens.semicolon,"Expected ';'."),u}if(this._check(m.keywords.let)){var s=this._global_let_decl();return s!=null&&(s.attributes=o),this._consume(m.tokens.semicolon,"Expected ';'."),s}if(this._check(m.keywords.const)){var f=this._global_const_decl();return f!=null&&(f.attributes=o),this._consume(m.tokens.semicolon,"Expected ';'."),f}if(this._check(m.keywords.struct)){var p=this._struct_decl();return p!=null&&(p.attributes=o),p}if(this._check(m.keywords.fn)){var d=this._function_decl();return d!=null&&(d.attributes=o),d}return null},e._function_decl=function(){if(!this._match(m.keywords.fn))return null;var n=this._consume(m.tokens.ident,"Expected function name.").toString();this._consume(m.tokens.paren_left,"Expected '(' for function arguments.");var i=[];if(!this._check(m.tokens.paren_right))do{if(this._check(m.tokens.paren_right))break;var o=this._attribute(),a=this._consume(m.tokens.ident,"Expected argument name.").toString();this._consume(m.tokens.colon,"Expected ':' for argument type.");var u=this._attribute(),s=this._type_decl();s!=null&&(s.attributes=u,i.push(new bp(a,s,o)))}while(this._match(m.tokens.comma));this._consume(m.tokens.paren_right,"Expected ')' after function arguments.");var f=null;if(this._match(m.tokens.arrow)){var p=this._attribute();f=this._type_decl(),f!=null&&(f.attributes=p)}var d=this._compound_statement();return new Xa(n,i,f,d)},e._compound_statement=function(){var n=[];for(this._consume(m.tokens.brace_left,"Expected '{' for block.");!this._check(m.tokens.brace_right);){var i=this._statement();i!==null&&n.push(i)}return this._consume(m.tokens.brace_right,"Expected '}' for block."),n},e._statement=function(){for(;this._match(m.tokens.semicolon)&&!this._isAtEnd(););if(this._check(m.keywords.if))return this._if_statement();if(this._check(m.keywords.switch))return this._switch_statement();if(this._check(m.keywords.loop))return this._loop_statement();if(this._check(m.keywords.for))return this._for_statement();if(this._check(m.keywords.while))return this._while_statement();if(this._check(m.keywords.continuing))return this._continuing_statement();if(this._check(m.keywords.static_assert))return this._static_assert_statement();if(this._check(m.tokens.brace_left))return this._compound_statement();var n=null;return this._check(m.keywords.return)?n=this._return_statement():this._check([m.keywords.var,m.keywords.let,m.keywords.const])?n=this._variable_statement():this._match(m.keywords.discard)?n=new fp:this._match(m.keywords.break)?n=new cp:this._match(m.keywords.continue)?n=new lp:n=this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),n!=null&&this._consume(m.tokens.semicolon,"Expected ';' after statement."),n},e._static_assert_statement=function(){if(!this._match(m.keywords.static_assert))return null;var n=this._optional_paren_expression();return new Zh(n)},e._while_statement=function(){if(!this._match(m.keywords.while))return null;var n=this._optional_paren_expression(),i=this._compound_statement();return new Jh(n,i)},e._continuing_statement=function(){if(!this._match(m.keywords.continuing))return null;var n=this._compound_statement();return new Qh(n)},e._for_statement=function(){if(!this._match(m.keywords.for))return null;this._consume(m.tokens.paren_left,"Expected '('.");var n=this._check(m.tokens.semicolon)?null:this._for_init();this._consume(m.tokens.semicolon,"Expected ';'.");var i=this._check(m.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(m.tokens.semicolon,"Expected ';'.");var o=this._check(m.tokens.paren_right)?null:this._for_increment();this._consume(m.tokens.paren_right,"Expected ')'.");var a=this._compound_statement();return new tp(n,i,o,a)},e._for_init=function(){return this._variable_statement()||this._func_call_statement()||this._assignment_statement()},e._for_increment=function(){return this._func_call_statement()||this._increment_decrement_statement()||this._assignment_statement()},e._variable_statement=function(){if(this._check(m.keywords.var)){var n=this._variable_decl();if(n===null)throw this._error(this._peek(),"Variable declaration expected.");var i=null;return this._match(m.tokens.equal)&&(i=this._short_circuit_or_expression()),new ie(n.name,n.type,n.storage,n.access,i)}if(this._match(m.keywords.let)){var o=this._consume(m.tokens.ident,"Expected name for let.").toString(),a=null;if(this._match(m.tokens.colon)){var u=this._attribute();a=this._type_decl(),a!=null&&(a.attributes=u)}this._consume(m.tokens.equal,"Expected '=' for let.");var s=this._short_circuit_or_expression();return new Ca(o,a,null,null,s)}if(this._match(m.keywords.const)){var f=this._consume(m.tokens.ident,"Expected name for const.").toString(),p=null;if(this._match(m.tokens.colon)){var d=this._attribute();p=this._type_decl(),p!=null&&(p.attributes=d)}this._consume(m.tokens.equal,"Expected '=' for const.");var g=this._short_circuit_or_expression();return new Fa(f,p,null,null,g)}return null},e._increment_decrement_statement=function(){var n=this._current,i=this._unary_expression();if(i==null)return null;if(!this._check(m.increment_operators))return this._current=n,null;var o=this._consume(m.increment_operators,"Expected increment operator");return new ep(o.type===m.tokens.plus_plus?se.increment:se.decrement,i)},e._assignment_statement=function(){var n=null;if(this._check(m.tokens.brace_right))return null;var i=this._match(m.tokens.underscore);if(i||(n=this._unary_expression()),!i&&n==null)return null;var o=this._consume(m.assignment_operators,"Expected assignment operator."),a=this._short_circuit_or_expression();return new rp(Ke.parse(o.lexeme),n,a)},e._func_call_statement=function(){if(!this._check(m.tokens.ident))return null;var n=this._current,i=this._consume(m.tokens.ident,"Expected function name."),o=this._argument_expression_list();return o===null?(this._current=n,null):new np(i.lexeme,o)},e._loop_statement=function(){if(!this._match(m.keywords.loop))return null;this._consume(m.tokens.brace_left,"Expected '{' for loop.");for(var n=[],i=this._statement();i!==null;){if(Array.isArray(i)){var o=st(i),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;n.push(u)}}catch(f){o.e(f)}finally{o.f()}}else n.push(i);i=this._statement()}var s=null;return this._match(m.keywords.continuing)&&(s=this._compound_statement()),this._consume(m.tokens.brace_right,"Expected '}' for loop."),new ip(n,s)},e._switch_statement=function(){if(!this._match(m.keywords.switch))return null;var n=this._optional_paren_expression();this._consume(m.tokens.brace_left,"Expected '{' for switch.");var i=this._switch_body();if(i==null||i.length==0)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(m.tokens.brace_right,"Expected '}' for switch."),new op(n,i)},e._switch_body=function(){var n=[];if(this._match(m.keywords.case)){var i=this._case_selectors();this._match(m.tokens.colon),this._consume(m.tokens.brace_left,"Exected '{' for switch case.");var o=this._case_body();this._consume(m.tokens.brace_right,"Exected '}' for switch case."),n.push(new gp(i,o))}if(this._match(m.keywords.default)){this._match(m.tokens.colon),this._consume(m.tokens.brace_left,"Exected '{' for switch default.");var a=this._case_body();this._consume(m.tokens.brace_right,"Exected '}' for switch default."),n.push(new _p(a))}if(this._check([m.keywords.default,m.keywords.case])){var u=this._switch_body();n.push(u[0])}return n},e._case_selectors=function(){for(var n,i,o,a,u=[(i=(n=this._shift_expression())===null||n===void 0?void 0:n.evaluate(this._context).toString())!==null&&i!==void 0?i:""];this._match(m.tokens.comma);)u.push((a=(o=this._shift_expression())===null||o===void 0?void 0:o.evaluate(this._context).toString())!==null&&a!==void 0?a:"");return u},e._case_body=function(){if(this._match(m.keywords.fallthrough))return this._consume(m.tokens.semicolon,"Expected ';'"),[];var n=this._statement();if(n==null)return[];n instanceof Array||(n=[n]);var i=this._case_body();return i.length==0?n:[].concat(Lt(n),[i[0]])},e._if_statement=function(){if(!this._match(m.keywords.if))return null;var n=this._optional_paren_expression(),i=this._compound_statement(),o=[];this._match_elseif()&&(o=this._elseif_statement(o));var a=null;return this._match(m.keywords.else)&&(a=this._compound_statement()),new ap(n,i,o,a)},e._match_elseif=function(){return this._tokens[this._current].type===m.keywords.else&&this._tokens[this._current+1].type===m.keywords.if?(this._advance(),this._advance(),!0):!1},e._elseif_statement=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],i=this._optional_paren_expression(),o=this._compound_statement();return n.push(new wp(i,o)),this._match_elseif()&&this._elseif_statement(n),n},e._return_statement=function(){if(!this._match(m.keywords.return))return null;var n=this._short_circuit_or_expression();return new sp(n)},e._short_circuit_or_expression=function(){for(var n=this._short_circuit_and_expr();this._match(m.tokens.or_or);)n=new gt(this._previous().toString(),n,this._short_circuit_and_expr());return n},e._short_circuit_and_expr=function(){for(var n=this._inclusive_or_expression();this._match(m.tokens.and_and);)n=new gt(this._previous().toString(),n,this._inclusive_or_expression());return n},e._inclusive_or_expression=function(){for(var n=this._exclusive_or_expression();this._match(m.tokens.or);)n=new gt(this._previous().toString(),n,this._exclusive_or_expression());return n},e._exclusive_or_expression=function(){for(var n=this._and_expression();this._match(m.tokens.xor);)n=new gt(this._previous().toString(),n,this._and_expression());return n},e._and_expression=function(){for(var n=this._equality_expression();this._match(m.tokens.and);)n=new gt(this._previous().toString(),n,this._equality_expression());return n},e._equality_expression=function(){var n=this._relational_expression();return this._match([m.tokens.equal_equal,m.tokens.not_equal])?new gt(this._previous().toString(),n,this._relational_expression()):n},e._relational_expression=function(){for(var n=this._shift_expression();this._match([m.tokens.less_than,m.tokens.greater_than,m.tokens.less_than_equal,m.tokens.greater_than_equal]);)n=new gt(this._previous().toString(),n,this._shift_expression());return n},e._shift_expression=function(){for(var n=this._additive_expression();this._match([m.tokens.shift_left,m.tokens.shift_right]);)n=new gt(this._previous().toString(),n,this._additive_expression());return n},e._additive_expression=function(){for(var n=this._multiplicative_expression();this._match([m.tokens.plus,m.tokens.minus]);)n=new gt(this._previous().toString(),n,this._multiplicative_expression());return n},e._multiplicative_expression=function(){for(var n=this._unary_expression();this._match([m.tokens.star,m.tokens.forward_slash,m.tokens.modulo]);)n=new gt(this._previous().toString(),n,this._unary_expression());return n},e._unary_expression=function(){return this._match([m.tokens.minus,m.tokens.bang,m.tokens.tilde,m.tokens.star,m.tokens.and])?new vp(this._previous().toString(),this._unary_expression()):this._singular_expression()},e._singular_expression=function(){var n=this._primary_expression(),i=this._postfix_expression();return i&&(n.postfix=i),n},e._postfix_expression=function(){if(this._match(m.tokens.bracket_left)){var n=this._short_circuit_or_expression();this._consume(m.tokens.bracket_right,"Expected ']'.");var i=this._postfix_expression();return i&&(n.postfix=i),n}if(this._match(m.tokens.period)){var o=this._consume(m.tokens.ident,"Expected member name."),a=this._postfix_expression(),u=new Ua(o.lexeme);return a&&(u.postfix=a),u}return null},e._getStruct=function(n){if(this._context.aliases.has(n)){var i=this._context.aliases.get(n).type;return i}if(this._context.structs.has(n)){var o=this._context.structs.get(n);return o}return null},e._primary_expression=function(){if(this._match(m.tokens.ident)){var n=this._previous().toString();if(this._check(m.tokens.paren_left)){var i=this._argument_expression_list(),o=this._getStruct(n);return o!=null?new He(o,i):new pp(n,i)}if(this._context.constants.has(n)){var a=this._context.constants.get(n);return new Ga(n,a.value)}return new mp(n)}if(this._match(m.const_literal))return new za(parseFloat(this._previous().toString()));if(this._check(m.tokens.paren_left))return this._paren_expression();if(this._match(m.keywords.bitcast)){this._consume(m.tokens.less_than,"Expected '<'.");var u=this._type_decl();this._consume(m.tokens.greater_than,"Expected '>'.");var s=this._paren_expression();return new dp(u,s)}var f=this._type_decl(),p=this._argument_expression_list();return new yp(f,p)},e._argument_expression_list=function(){if(!this._match(m.tokens.paren_left))return null;var n=[];do{if(this._check(m.tokens.paren_right))break;var i=this._short_circuit_or_expression();n.push(i)}while(this._match(m.tokens.comma));return this._consume(m.tokens.paren_right,"Expected ')' for agument list"),n},e._optional_paren_expression=function(){this._match(m.tokens.paren_left);var n=this._short_circuit_or_expression();return this._match(m.tokens.paren_right),new Ba([n])},e._paren_expression=function(){this._consume(m.tokens.paren_left,"Expected '('.");var n=this._short_circuit_or_expression();return this._consume(m.tokens.paren_right,"Expected ')'."),new Ba([n])},e._struct_decl=function(){if(!this._match(m.keywords.struct))return null;var n=this._consume(m.tokens.ident,"Expected name for struct.").toString();this._consume(m.tokens.brace_left,"Expected '{' for struct body.");for(var i=[];!this._check(m.tokens.brace_right);){var o=this._attribute(),a=this._consume(m.tokens.ident,"Expected variable name.").toString();this._consume(m.tokens.colon,"Expected ':' for struct member type.");var u=this._attribute(),s=this._type_decl();s!=null&&(s.attributes=u),this._check(m.tokens.brace_right)?this._match(m.tokens.comma):this._consume(m.tokens.comma,"Expected ',' for struct member."),i.push(new xp(a,s,o))}this._consume(m.tokens.brace_right,"Expected '}' after struct body.");var f=new zt(n,i);return this._context.structs.set(n,f),f},e._global_variable_decl=function(){var n=this._variable_decl();return n&&this._match(m.tokens.equal)&&(n.value=this._const_expression()),n},e._override_variable_decl=function(){var n=this._override_decl();return n&&this._match(m.tokens.equal)&&(n.value=this._const_expression()),n},e._global_const_decl=function(){if(!this._match(m.keywords.const))return null;var n=this._consume(m.tokens.ident,"Expected variable name"),i=null;if(this._match(m.tokens.colon)){var o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}var a=null;if(this._match(m.tokens.equal)){var u=this._short_circuit_or_expression();if(u instanceof He)a=u;else if(u instanceof Ga&&u.initializer instanceof He)a=u.initializer;else try{var s=u.evaluate(this._context);a=new za(s)}catch{a=u}}var f=new Fa(n.toString(),i,"","",a);return this._context.constants.set(f.name,f),f},e._global_let_decl=function(){if(!this._match(m.keywords.let))return null;var n=this._consume(m.tokens.ident,"Expected variable name"),i=null;if(this._match(m.tokens.colon)){var o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}var a=null;return this._match(m.tokens.equal)&&(a=this._const_expression()),new Ca(n.toString(),i,"","",a)},e._const_expression=function(){if(this._match(m.const_literal))return new Ua(this._previous().toString());var n=this._type_decl();this._consume(m.tokens.paren_left,"Expected '('.");for(var i=[];!this._check(m.tokens.paren_right)&&(i.push(this._const_expression()),!!this._check(m.tokens.comma));)this._advance();return this._consume(m.tokens.paren_right,"Expected ')'."),new He(n,i)},e._variable_decl=function(){if(!this._match(m.keywords.var))return null;var n="",i="";this._match(m.tokens.less_than)&&(n=this._consume(m.storage_class,"Expected storage_class.").toString(),this._match(m.tokens.comma)&&(i=this._consume(m.access_mode,"Expected access_mode.").toString()),this._consume(m.tokens.greater_than,"Expected '>'."));var o=this._consume(m.tokens.ident,"Expected variable name"),a=null;if(this._match(m.tokens.colon)){var u=this._attribute();a=this._type_decl(),a!=null&&(a.attributes=u)}return new ie(o.toString(),a,n,i,null)},e._override_decl=function(){if(!this._match(m.keywords.override))return null;var n=this._consume(m.tokens.ident,"Expected variable name"),i=null;if(this._match(m.tokens.colon)){var o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}return new $a(n.toString(),i,null)},e._enable_directive=function(){var n=this._consume(m.tokens.ident,"identity expected.");return new up(n.toString())},e._type_alias=function(){var n=this._consume(m.tokens.ident,"identity expected.");this._consume(m.tokens.equal,"Expected '=' for type alias.");var i=this._type_decl();if(i===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(i.name)&&(i=this._context.aliases.get(i.name).type);var o=new Za(n.toString(),i);return this._context.aliases.set(o.name,o),o},e._type_decl=function(){if(this._check([m.tokens.ident].concat(Lt(m.texel_format),[m.keywords.bool,m.keywords.f32,m.keywords.i32,m.keywords.u32]))){var n=this._advance(),i=n.toString();return this._context.structs.has(i)?this._context.structs.get(i):this._context.aliases.has(i)?this._context.aliases.get(i).type:new Vt(n.toString())}var o=this._texture_sampler_types();if(o)return o;if(this._check(m.template_types)){var a=this._advance().toString(),u=null,s=null;return this._match(m.tokens.less_than)&&(u=this._type_decl(),s=null,this._match(m.tokens.comma)&&(s=this._consume(m.access_mode,"Expected access_mode for pointer").toString()),this._consume(m.tokens.greater_than,"Expected '>' for type.")),new Ja(a,u,s)}if(this._match(m.keywords.ptr)){var f=this._previous().toString();this._consume(m.tokens.less_than,"Expected '<' for pointer.");var p=this._consume(m.storage_class,"Expected storage_class for pointer");this._consume(m.tokens.comma,"Expected ',' for pointer.");var d=this._type_decl(),g=null;return this._match(m.tokens.comma)&&(g=this._consume(m.access_mode,"Expected access_mode for pointer").toString()),this._consume(m.tokens.greater_than,"Expected '>' for pointer."),new hp(f,p.toString(),d,g)}var S=this._attribute();if(this._match(m.keywords.array)){var x=null,O=-1,A=this._previous();if(this._match(m.tokens.less_than)){x=this._type_decl(),this._context.aliases.has(x.name)&&(x=this._context.aliases.get(x.name).type);var P="";if(this._match(m.tokens.comma)){var M=this._shift_expression();P=M.evaluate(this._context).toString()}this._consume(m.tokens.greater_than,"Expected '>' for array."),O=P?parseInt(P):0}return new Qa(A.toString(),S,x,O)}return null},e._texture_sampler_types=function(){if(this._match(m.sampler_type))return new We(this._previous().toString(),null,null);if(this._match(m.depth_texture_type))return new We(this._previous().toString(),null,null);if(this._match(m.sampled_texture_type)||this._match(m.multisampled_texture_type)){var n=this._previous();this._consume(m.tokens.less_than,"Expected '<' for sampler type.");var i=this._type_decl();return this._consume(m.tokens.greater_than,"Expected '>' for sampler type."),new We(n.toString(),i,null)}if(this._match(m.storage_texture_type)){var o=this._previous();this._consume(m.tokens.less_than,"Expected '<' for sampler type.");var a=this._consume(m.texel_format,"Invalid texel format.").toString();this._consume(m.tokens.comma,"Expected ',' after texel format.");var u=this._consume(m.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(m.tokens.greater_than,"Expected '>' for sampler type."),new We(o.toString(),a,u)}return null},e._attribute=function(){for(var n=[];this._match(m.tokens.attr);){var i=this._consume(m.attribute_name,"Expected attribute name"),o=new Va(i.toString(),null);if(this._match(m.tokens.paren_left)){if(o.value=this._consume(m.literal_or_ident,"Expected attribute value").toString(),this._check(m.tokens.comma)){this._advance();do{var a=this._consume(m.literal_or_ident,"Expected attribute value").toString();o.value instanceof Array||(o.value=[o.value]),o.value.push(a)}while(this._match(m.tokens.comma))}this._consume(m.tokens.paren_right,"Expected ')'")}n.push(o)}for(;this._match(m.tokens.attr_left);){if(!this._check(m.tokens.attr_right))do{var u=this._consume(m.attribute_name,"Expected attribute name"),s=new Va(u.toString(),null);if(this._match(m.tokens.paren_left)){if(s.value=[this._consume(m.literal_or_ident,"Expected attribute value").toString()],this._check(m.tokens.comma)){this._advance();do{var f=this._consume(m.literal_or_ident,"Expected attribute value").toString();s.value.push(f)}while(this._match(m.tokens.comma))}this._consume(m.tokens.paren_right,"Expected ')'")}n.push(s)}while(this._match(m.tokens.comma));this._consume(m.tokens.attr_right,"Expected ']]' after attribute declarations")}return n.length==0?null:n},D(t)}(),oe=function(){function t(e,r){C(this,t),this.name=e,this.attributes=r,this.size=0}return D(t,[{key:"isArray",get:function(){return!1}},{key:"isStruct",get:function(){return!1}},{key:"isTemplate",get:function(){return!1}}]),t}(),Wa=function(){function t(e,r,n){C(this,t),this.name=e,this.type=r,this.attributes=n,this.offset=0,this.size=0}return D(t,[{key:"isArray",get:function(){return this.type.isArray}},{key:"isStruct",get:function(){return this.type.isStruct}},{key:"isTemplate",get:function(){return this.type.isTemplate}},{key:"align",get:function(){return this.type.isStruct?this.type.align:0}},{key:"members",get:function(){return this.type.isStruct?this.type.members:null}},{key:"format",get:function(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}},{key:"count",get:function(){return this.type.isArray?this.type.count:0}},{key:"stride",get:function(){return this.type.isArray?this.type.stride:this.size}}]),t}(),Sr=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this,n,i),o.members=[],o.align=0,o}return D(r,[{key:"isStruct",get:function(){return!0}}]),r}(oe),En=function(t){W(r,t);var e=H(r);function r(n,i){var o;return C(this,r),o=e.call(this,n,i),o.count=0,o.stride=0,o}return D(r,[{key:"isArray",get:function(){return!0}}]),r}(oe),Ha=function(t){W(r,t);var e=H(r);function r(n,i,o,a){var u;return C(this,r),u=e.call(this,n,o),u.format=i,u.access=a,u}return D(r,[{key:"isTemplate",get:function(){return!0}}]),r}(oe),Rt;(function(t){t[t.Uniform=0]="Uniform",t[t.Storage=1]="Storage",t[t.Texture=2]="Texture",t[t.Sampler=3]="Sampler",t[t.StorageTexture=4]="StorageTexture"})(Rt||(Rt={}));var Or=function(){function t(e,r,n,i,o,a,u){C(this,t),this.name=e,this.type=r,this.group=n,this.binding=i,this.attributes=o,this.resourceType=a,this.access=u}return D(t,[{key:"isArray",get:function(){return this.type.isArray}},{key:"isStruct",get:function(){return this.type.isStruct}},{key:"isTemplate",get:function(){return this.type.isTemplate}},{key:"size",get:function(){return this.type.size}},{key:"align",get:function(){return this.type.isStruct?this.type.align:0}},{key:"members",get:function(){return this.type.isStruct?this.type.members:null}},{key:"format",get:function(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}},{key:"count",get:function(){return this.type.isArray?this.type.count:0}},{key:"stride",get:function(){return this.type.isArray?this.type.stride:this.size}}]),t}(),Pp=D(function t(e,r){C(this,t),this.name=e,this.type=r}),Pr=D(function t(e,r){C(this,t),this.align=e,this.size=r}),Ep=D(function t(e,r,n,i){C(this,t),this.name=e,this.type=r,this.locationType=n,this.location=i,this.interpolation=null}),Ka=D(function t(e,r,n,i){C(this,t),this.name=e,this.type=r,this.locationType=n,this.location=i}),Ap=D(function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;C(this,t),this.stage=null,this.inputs=[],this.outputs=[],this.name=e,this.stage=r}),Tp=D(function t(){C(this,t),this.vertex=[],this.fragment=[],this.compute=[]}),kp=D(function t(e,r,n,i){C(this,t),this.name=e,this.type=r,this.attributes=n,this.id=i}),Ye=function(){function t(r){C(this,t),this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new Tp,this._types=new Map,r&&this.update(r)}var e=t.prototype;return e._isStorageTexture=function(n){return n.name=="texture_storage_1d"||n.name=="texture_storage_2d"||n.name=="texture_storage_2d_array"||n.name=="texture_storage_3d"},e.update=function(n){var i=new Op,o=i.parse(n),a=st(o),u;try{for(a.s();!(u=a.n()).done;){var s=u.value;if(s instanceof zt){var f=this._getTypeInfo(s,null);f instanceof Sr&&this.structs.push(f);continue}if(s instanceof Za){this.aliases.push(this._getAliasInfo(s));continue}if(s instanceof $a){var p=s,d=this._getAttributeNum(p.attributes,"id",0),g=p.type!=null?this._getTypeInfo(p.type,p.attributes):null;this.overrides.push(new kp(p.name,g,p.attributes,d));continue}if(this._isUniformVar(s)){var S=s,x=this._getAttributeNum(S.attributes,"group",0),O=this._getAttributeNum(S.attributes,"binding",0),A=this._getTypeInfo(S.type,S.attributes),P=new Or(S.name,A,x,O,S.attributes,Rt.Uniform,S.access);this.uniforms.push(P);continue}if(this._isStorageVar(s)){var M=s,k=this._getAttributeNum(M.attributes,"group",0),L=this._getAttributeNum(M.attributes,"binding",0),I=this._getTypeInfo(M.type,M.attributes),j=this._isStorageTexture(I),U=new Or(M.name,I,k,L,M.attributes,j?Rt.StorageTexture:Rt.Storage,M.access);this.storage.push(U);continue}if(this._isTextureVar(s)){var G=s,V=this._getAttributeNum(G.attributes,"group",0),B=this._getAttributeNum(G.attributes,"binding",0),F=this._getTypeInfo(G.type,G.attributes),h=this._isStorageTexture(F),c=new Or(G.name,F,V,B,G.attributes,h?Rt.StorageTexture:Rt.Texture,G.access);h?this.storage.push(c):this.textures.push(c);continue}if(this._isSamplerVar(s)){var l=s,y=this._getAttributeNum(l.attributes,"group",0),b=this._getAttributeNum(l.attributes,"binding",0),v=this._getTypeInfo(l.type,l.attributes),T=new Or(l.name,v,y,b,l.attributes,Rt.Sampler,l.access);this.samplers.push(T);continue}if(s instanceof Xa){var R=this._getAttribute(s,"vertex"),N=this._getAttribute(s,"fragment"),q=this._getAttribute(s,"compute"),z=R||N||q;if(z){var K=new Ap(s.name,z.name);K.inputs=this._getInputs(s.args),K.outputs=this._getOutputs(s.returnType),this.entry[z.name].push(K)}continue}}}catch(ct){a.e(ct)}finally{a.f()}},e.getBindGroups=function(){var n=[];function i(I,j){I>=n.length&&(n.length=I+1),n[I]===void 0&&(n[I]=[]),j>=n[I].length&&(n[I].length=j+1)}var o=st(this.uniforms),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;i(u.group,u.binding);var s=n[u.group];s[u.binding]=u}}catch(I){o.e(I)}finally{o.f()}var f=st(this.storage),p;try{for(f.s();!(p=f.n()).done;){var d=p.value;i(d.group,d.binding);var g=n[d.group];g[d.binding]=d}}catch(I){f.e(I)}finally{f.f()}var S=st(this.textures),x;try{for(S.s();!(x=S.n()).done;){var O=x.value;i(O.group,O.binding);var A=n[O.group];A[O.binding]=O}}catch(I){S.e(I)}finally{S.f()}var P=st(this.samplers),M;try{for(P.s();!(M=P.n()).done;){var k=M.value;i(k.group,k.binding);var L=n[k.group];L[k.binding]=k}}catch(I){P.e(I)}finally{P.f()}return n},e._getOutputs=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;if(i===void 0&&(i=[]),n instanceof zt)this._getStructOutputs(n,i);else{var o=this._getOutputInfo(n);o!==null&&i.push(o)}return i},e._getStructOutputs=function(n,i){var o=st(n.members),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;if(u.type instanceof zt)this._getStructOutputs(u.type,i);else{var s=this._getAttribute(u,"location")||this._getAttribute(u,"builtin");if(s!==null){var f=this._getTypeInfo(u.type,u.type.attributes),p=this._parseInt(s.value),d=new Ka(u.name,f,s.name,p);i.push(d)}}}}catch(g){o.e(g)}finally{o.f()}},e._getOutputInfo=function(n){var i=this._getAttribute(n,"location")||this._getAttribute(n,"builtin");if(i!==null){var o=this._getTypeInfo(n,n.attributes),a=this._parseInt(i.value),u=new Ka("",o,i.name,a);return u}return null},e._getInputs=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;i===void 0&&(i=[]);var o=st(n),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;if(u.type instanceof zt)this._getStructInputs(u.type,i);else{var s=this._getInputInfo(u);s!==null&&i.push(s)}}}catch(f){o.e(f)}finally{o.f()}return i},e._getStructInputs=function(n,i){var o=st(n.members),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;if(u.type instanceof zt)this._getStructInputs(u.type,i);else{var s=this._getInputInfo(u);s!==null&&i.push(s)}}}catch(f){o.e(f)}finally{o.f()}},e._getInputInfo=function(n){var i=this._getAttribute(n,"location")||this._getAttribute(n,"builtin");if(i!==null){var o=this._getAttribute(n,"interpolation"),a=this._getTypeInfo(n.type,n.attributes),u=this._parseInt(i.value),s=new Ep(n.name,a,i.name,u);return o!==null&&(s.interpolation=this._parseString(o.value)),s}return null},e._parseString=function(n){return n instanceof Array&&(n=n[0]),n},e._parseInt=function(n){n instanceof Array&&(n=n[0]);var i=parseInt(n);return isNaN(i)?n:i},e._getAlias=function(n){var i=st(this.aliases),o;try{for(i.s();!(o=i.n()).done;){var a=o.value;if(a.name==n)return a.type}}catch(u){i.e(u)}finally{i.f()}return null},e._getAliasInfo=function(n){return new Pp(n.name,this._getTypeInfo(n.type,null))},e._getTypeInfo=function(n,i){if(this._types.has(n))return this._types.get(n);if(n instanceof Qa){var o=n,a=this._getTypeInfo(o.format,o.attributes),u=new En(o.name,i);return u.format=a,u.count=o.count,this._types.set(n,u),this._updateTypeInfo(u),u}if(n instanceof zt){var s=n,f=new Sr(s.name,i),p=st(s.members),d;try{for(p.s();!(d=p.n()).done;){var g=d.value,S=this._getTypeInfo(g.type,g.attributes);f.members.push(new Wa(g.name,S,g.attributes))}}catch(j){p.e(j)}finally{p.f()}return this._types.set(n,f),this._updateTypeInfo(f),f}if(n instanceof We){var x=n,O=x.format instanceof Vt,A=x.format?O?this._getTypeInfo(x.format,null):new oe(x.format,null):null,P=new Ha(x.name,A,i,x.access);return this._types.set(n,P),this._updateTypeInfo(P),P}if(n instanceof Ja){var M=n,k=M.format?this._getTypeInfo(M.format,null):null,L=new Ha(M.name,k,i,M.access);return this._types.set(n,L),this._updateTypeInfo(L),L}var I=new oe(n.name,i);return this._types.set(n,I),this._updateTypeInfo(I),I},e._updateTypeInfo=function(n){var i,o,a=this._getTypeSize(n);if(n.size=(i=a?.size)!==null&&i!==void 0?i:0,n instanceof En){var u=this._getTypeSize(n.format);n.stride=(o=u?.size)!==null&&o!==void 0?o:0,this._updateTypeInfo(n.format)}n instanceof Sr&&this._updateStructInfo(n)},e._updateStructInfo=function(n){for(var i,o=0,a=0,u=0,s=0,f=0,p=n.members.length;f<p;++f){var d=n.members[f],g=this._getTypeSize(d);if(g){(i=this._getAlias(d.type.name))!==null&&i!==void 0||d.type;var S=g.align,x=g.size;o=this._roundUp(S,o+a),a=x,u=o,s=Math.max(s,S),d.offset=o,d.size=x,this._updateTypeInfo(d.type)}}n.size=this._roundUp(s,u+a),n.align=s},e._getTypeSize=function(n){var i;if(n==null)return null;var o=this._getAttributeNum(n.attributes,"size",0),a=this._getAttributeNum(n.attributes,"align",0);if(n instanceof Wa&&(n=n.type),n instanceof oe){var u=this._getAlias(n.name);u!==null&&(n=u)}{var s=t._typeInfo[n.name];if(s!==void 0){var f=n.format==="f16"?2:1;return new Pr(Math.max(a,s.align/f),Math.max(o,s.size/f))}}{var p=t._typeInfo[n.name.substring(0,n.name.length-1)];if(p){var d=n.name[n.name.length-1]==="h"?2:1;return new Pr(Math.max(a,p.align/d),Math.max(o,p.size/d))}}if(n instanceof En){var g=n,S=8,x=8,O=this._getTypeSize(g.format);O!==null&&(x=O.size,S=O.align);var A=g.count,P=this._getAttributeNum((i=n?.attributes)!==null&&i!==void 0?i:null,"stride",this._roundUp(S,x));return x=A*P,o&&(x=o),new Pr(Math.max(a,S),Math.max(o,x))}if(n instanceof Sr){var M=0,k=0,L=0,I=0,j=0,U=st(n.members),G;try{for(U.s();!(G=U.n()).done;){var V=G.value,B=this._getTypeSize(V.type);B!==null&&(M=Math.max(B.align,M),L=this._roundUp(B.align,L+I),I=B.size,j=L)}}catch(F){U.e(F)}finally{U.f()}return k=this._roundUp(M,j+I),new Pr(Math.max(a,M),Math.max(o,k))}return null},e._isUniformVar=function(n){return n instanceof ie&&n.storage=="uniform"},e._isStorageVar=function(n){return n instanceof ie&&n.storage=="storage"},e._isTextureVar=function(n){return n instanceof ie&&n.type!==null&&t._textureTypes.indexOf(n.type.name)!=-1},e._isSamplerVar=function(n){return n instanceof ie&&n.type!==null&&t._samplerTypes.indexOf(n.type.name)!=-1},e._getAttribute=function(n,i){var o=n;if(!o||!o.attributes)return null;var a=o.attributes,u=st(a),s;try{for(u.s();!(s=u.n()).done;){var f=s.value;if(f.name==i)return f}}catch(p){u.e(p)}finally{u.f()}return null},e._getAttributeNum=function(n,i,o){if(n===null)return o;var a=st(n),u;try{for(a.s();!(u=a.n()).done;){var s=u.value;if(s.name==i){var f=s!==null&&s.value!==null?s.value:o;return f instanceof Array&&(f=f[0]),typeof f=="number"?f:typeof f=="string"?parseInt(f):o}}}catch(p){a.e(p)}finally{a.f()}return o},e._roundUp=function(n,i){return Math.ceil(i/n)*n},D(t)}();Ye._typeInfo={f16:{align:2,size:2},i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},atomic:{align:4,size:4},vec2:{align:8,size:8},vec3:{align:16,size:12},vec4:{align:16,size:16},mat2x2:{align:8,size:16},mat3x2:{align:8,size:24},mat4x2:{align:8,size:32},mat2x3:{align:16,size:32},mat3x3:{align:16,size:48},mat4x3:{align:16,size:64},mat2x4:{align:16,size:32},mat3x4:{align:16,size:48},mat4x4:{align:16,size:64}};Ye._textureTypes=m.any_texture_type.map(function(t){return t.name});Ye._samplerTypes=m.sampler_type.map(function(t){return t.name});function Ar(t){return Ar=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ar(t)}function rs(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Mp(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
252
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function Mp(t,e){if(t){if(typeof t=="string")return ns(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ns(t,e)}}function ns(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Tr(t){var e={attributes:[],bindings:[]},r=Ip(t),n=rs(r.uniforms),i;try{for(n.s();!(i=n.n()).done;){var o=i.value,a=[],u=rs(o.type.members),s;try{for(u.s();!(s=u.n()).done;){var f=s.value;a.push({name:f.name,type:is(f.type)})}}catch(O){u.e(O)}finally{u.f()}e.bindings.push({type:"uniform",name:o.name,location:o.binding,group:o.group,members:a})}}catch(O){n.e(O)}finally{n.f()}for(var p=r.entry.vertex[0],d=p.inputs.length,g=0;g<d;g++){var S=p.inputs[g];if(S.locationType==="location"){var x=is(S.type);e.attributes.push({name:S.name,location:S.location,type:x})}}return e}function is(t){return t.format?"".concat(t.name,"<").concat(t.format.name,">"):t.name}function Ip(t){try{return new Ye(t)}catch(r){if(r instanceof Error)throw r;var e="WGSL parse error";throw Ar(r)==="object"&&r!==null&&r!==void 0&&r.message&&(e+=": ".concat(r.message," ")),Ar(r)==="object"&&r!==null&&r!==void 0&&r.token&&(e+=r.token.line||""),new Error(e,{cause:r})}}var bb=1/Math.PI*180,wb=1/180*Math.PI,Rp={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...Rp}};var nt=globalThis.mathgl.config;function os(t,{precision:e=nt.precision}={}){return t=Lp(t),"".concat(parseFloat(t.toPrecision(e)))}function ue(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function kn(t,e,r){let n=nt.EPSILON;r&&(nt.EPSILON=r);try{if(t===e)return!0;if(ue(t)&&ue(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(!kn(t[i],e[i]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=nt.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{nt.EPSILON=n}}function Lp(t){return Math.round(t/nt.EPSILON)*nt.EPSILON}function jp(t){function e(){var r=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var fe=class extends jp(Array){clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:ue(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(nt)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+os(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!kn(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let i=0;i<this.ELEMENTS;++i){let o=e[i],a=typeof r=="number"?r:r[i];this[i]=o+n*(a-o)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(nt.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function Np(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function it(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(JSON.stringify(t)));return t}function kr(t,e,r=""){if(nt.debug&&!Np(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}function Mn(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}var Mr=class extends fe{get x(){return this[0]}set x(e){this[0]=it(e)}get y(){return this[1]}set y(e){this[1]=it(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-e[n];r+=i*i}return it(r)}dot(e){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*e[n];return it(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return Mn(e>=0&&e<this.ELEMENTS,"index is out of range"),it(this[e])}setComponent(e,r){return Mn(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var St=typeof Float32Array<"u"?Float32Array:Array;var Rb=Math.PI/180;function Dp(){let t=new St(2);return St!=Float32Array&&(t[0]=0,t[1]=0),t}function us(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}var Lb=function(){let t=Dp();return function(e,r,n,i,o,a){let u,s;for(r||(r=2),n||(n=0),i?s=Math.min(i*r+n,e.length):s=e.length,u=n;u<s;u+=r)t[0]=e[u],t[1]=e[u+1],o(t,t,a),e[u]=t[0],e[u+1]=t[1];return e}}();function fs(t,e,r){let n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}function Ir(t,e,r){let n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/a,t[1]=(r[1]*n+r[5]*i+r[9]*o)/a,t[2]=(r[2]*n+r[6]*i+r[10]*o)/a,t}function cs(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2],t}function Cp(){let t=new St(3);return St!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Fp(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ls(t,e,r){let n=e[0],i=e[1],o=e[2],a=r[0],u=r[1],s=r[2];return t[0]=i*s-o*u,t[1]=o*a-n*s,t[2]=n*u-i*a,t}function Rr(t,e,r){let n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/a,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t}function hs(t,e,r){let n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}function ps(t,e,r){let n=r[0],i=r[1],o=r[2],a=r[3],u=e[0],s=e[1],f=e[2],p=i*f-o*s,d=o*u-n*f,g=n*s-i*u,S=i*g-o*d,x=o*p-n*g,O=n*d-i*p,A=a*2;return p*=A,d*=A,g*=A,S*=2,x*=2,O*=2,t[0]=u+p+S,t[1]=s+d+x,t[2]=f+g+O,t}function ms(t,e,r,n){let i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function ds(t,e,r,n){let i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function ys(t,e,r,n){let i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function vs(t,e){let r=t[0],n=t[1],i=t[2],o=e[0],a=e[1],u=e[2],s=Math.sqrt((r*r+n*n+i*i)*(o*o+a*a+u*u)),f=s&&Fp(t,e)/s;return Math.acos(Math.min(Math.max(f,-1),1))}var Db=function(){let t=Cp();return function(e,r,n,i,o,a){let u,s;for(r||(r=3),n||(n=0),i?s=Math.min(i*r+n,e.length):s=e.length,u=n;u<s;u+=r)t[0]=e[u],t[1]=e[u+1],t[2]=e[u+2],o(t,t,a),e[u]=t[0],e[u+1]=t[1],e[u+2]=t[2];return e}}();var Rn=[0,0,0],Lr,at=class extends Mr{static get ZERO(){return Lr||(Lr=new at(0,0,0),Object.freeze(Lr)),Lr}constructor(e=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&ue(e)?this.copy(e):(nt.debug&&(it(e),it(r),it(n)),this[0]=e,this[1]=r,this[2]=n)}set(e,r,n){return this[0]=e,this[1]=r,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return nt.debug&&(it(e.x),it(e.y),it(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=it(e)}angle(e){return vs(this,e)}cross(e){return ls(this,this,e),this.check()}rotateX({radians:e,origin:r=Rn}){return ms(this,this,r,e),this.check()}rotateY({radians:e,origin:r=Rn}){return ds(this,this,r,e),this.check()}rotateZ({radians:e,origin:r=Rn}){return ys(this,this,r,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Rr(this,this,e),this.check()}transformAsVector(e){return Ir(this,this,e),this.check()}transformByMatrix3(e){return hs(this,this,e),this.check()}transformByMatrix2(e){return cs(this,this,e),this.check()}transformByQuaternion(e){return ps(this,this,e),this.check()}};var jr=class extends fe{toString(){let e="[";if(nt.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=" ".concat(this[n*this.RANK+r])}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=" ".concat(this[r])}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=it(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(e,r){let n=e*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function Up(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function gs(t,e){if(t===e){let r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],u=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=u}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function _s(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],u=e[5],s=e[6],f=e[7],p=e[8],d=e[9],g=e[10],S=e[11],x=e[12],O=e[13],A=e[14],P=e[15],M=r*u-n*a,k=r*s-i*a,L=r*f-o*a,I=n*s-i*u,j=n*f-o*u,U=i*f-o*s,G=p*O-d*x,V=p*A-g*x,B=p*P-S*x,F=d*A-g*O,h=d*P-S*O,c=g*P-S*A,l=M*c-k*h+L*F+I*B-j*V+U*G;return l?(l=1/l,t[0]=(u*c-s*h+f*F)*l,t[1]=(i*h-n*c-o*F)*l,t[2]=(O*U-A*j+P*I)*l,t[3]=(g*j-d*U-S*I)*l,t[4]=(s*B-a*c-f*V)*l,t[5]=(r*c-i*B+o*V)*l,t[6]=(A*L-x*U-P*k)*l,t[7]=(p*U-g*L+S*k)*l,t[8]=(a*h-u*B+f*G)*l,t[9]=(n*B-r*h-o*G)*l,t[10]=(x*j-O*L+P*M)*l,t[11]=(d*L-p*j-S*M)*l,t[12]=(u*V-a*F-s*G)*l,t[13]=(r*F-n*V+i*G)*l,t[14]=(O*k-x*I-A*M)*l,t[15]=(p*I-d*k+g*M)*l,t):null}function bs(t){let e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],u=t[6],s=t[7],f=t[8],p=t[9],d=t[10],g=t[11],S=t[12],x=t[13],O=t[14],A=t[15],P=e*a-r*o,M=e*u-n*o,k=r*u-n*a,L=f*x-p*S,I=f*O-d*S,j=p*O-d*x,U=e*j-r*I+n*L,G=o*j-a*I+u*L,V=f*k-p*M+d*P,B=S*k-x*M+O*P;return s*U-i*G+A*V-g*B}function Ln(t,e,r){let n=e[0],i=e[1],o=e[2],a=e[3],u=e[4],s=e[5],f=e[6],p=e[7],d=e[8],g=e[9],S=e[10],x=e[11],O=e[12],A=e[13],P=e[14],M=e[15],k=r[0],L=r[1],I=r[2],j=r[3];return t[0]=k*n+L*u+I*d+j*O,t[1]=k*i+L*s+I*g+j*A,t[2]=k*o+L*f+I*S+j*P,t[3]=k*a+L*p+I*x+j*M,k=r[4],L=r[5],I=r[6],j=r[7],t[4]=k*n+L*u+I*d+j*O,t[5]=k*i+L*s+I*g+j*A,t[6]=k*o+L*f+I*S+j*P,t[7]=k*a+L*p+I*x+j*M,k=r[8],L=r[9],I=r[10],j=r[11],t[8]=k*n+L*u+I*d+j*O,t[9]=k*i+L*s+I*g+j*A,t[10]=k*o+L*f+I*S+j*P,t[11]=k*a+L*p+I*x+j*M,k=r[12],L=r[13],I=r[14],j=r[15],t[12]=k*n+L*u+I*d+j*O,t[13]=k*i+L*s+I*g+j*A,t[14]=k*o+L*f+I*S+j*P,t[15]=k*a+L*p+I*x+j*M,t}function ws(t,e,r){let n=r[0],i=r[1],o=r[2],a,u,s,f,p,d,g,S,x,O,A,P;return e===t?(t[12]=e[0]*n+e[4]*i+e[8]*o+e[12],t[13]=e[1]*n+e[5]*i+e[9]*o+e[13],t[14]=e[2]*n+e[6]*i+e[10]*o+e[14],t[15]=e[3]*n+e[7]*i+e[11]*o+e[15]):(a=e[0],u=e[1],s=e[2],f=e[3],p=e[4],d=e[5],g=e[6],S=e[7],x=e[8],O=e[9],A=e[10],P=e[11],t[0]=a,t[1]=u,t[2]=s,t[3]=f,t[4]=p,t[5]=d,t[6]=g,t[7]=S,t[8]=x,t[9]=O,t[10]=A,t[11]=P,t[12]=a*n+p*i+x*o+e[12],t[13]=u*n+d*i+O*o+e[13],t[14]=s*n+g*i+A*o+e[14],t[15]=f*n+S*i+P*o+e[15]),t}function xs(t,e,r){let n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Ss(t,e,r,n){let i=n[0],o=n[1],a=n[2],u=Math.sqrt(i*i+o*o+a*a),s,f,p,d,g,S,x,O,A,P,M,k,L,I,j,U,G,V,B,F,h,c,l,y;return u<1e-6?null:(u=1/u,i*=u,o*=u,a*=u,f=Math.sin(r),s=Math.cos(r),p=1-s,d=e[0],g=e[1],S=e[2],x=e[3],O=e[4],A=e[5],P=e[6],M=e[7],k=e[8],L=e[9],I=e[10],j=e[11],U=i*i*p+s,G=o*i*p+a*f,V=a*i*p-o*f,B=i*o*p-a*f,F=o*o*p+s,h=a*o*p+i*f,c=i*a*p+o*f,l=o*a*p-i*f,y=a*a*p+s,t[0]=d*U+O*G+k*V,t[1]=g*U+A*G+L*V,t[2]=S*U+P*G+I*V,t[3]=x*U+M*G+j*V,t[4]=d*B+O*F+k*h,t[5]=g*B+A*F+L*h,t[6]=S*B+P*F+I*h,t[7]=x*B+M*F+j*h,t[8]=d*c+O*l+k*y,t[9]=g*c+A*l+L*y,t[10]=S*c+P*l+I*y,t[11]=x*c+M*l+j*y,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Os(t,e,r){let n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],u=e[6],s=e[7],f=e[8],p=e[9],d=e[10],g=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+f*n,t[5]=a*i+p*n,t[6]=u*i+d*n,t[7]=s*i+g*n,t[8]=f*i-o*n,t[9]=p*i-a*n,t[10]=d*i-u*n,t[11]=g*i-s*n,t}function Ps(t,e,r){let n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],u=e[2],s=e[3],f=e[8],p=e[9],d=e[10],g=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-f*n,t[1]=a*i-p*n,t[2]=u*i-d*n,t[3]=s*i-g*n,t[8]=o*n+f*i,t[9]=a*n+p*i,t[10]=u*n+d*i,t[11]=s*n+g*i,t}function Es(t,e,r){let n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],u=e[2],s=e[3],f=e[4],p=e[5],d=e[6],g=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+f*n,t[1]=a*i+p*n,t[2]=u*i+d*n,t[3]=s*i+g*n,t[4]=f*i-o*n,t[5]=p*i-a*n,t[6]=d*i-u*n,t[7]=g*i-s*n,t}function As(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,u=n+n,s=i+i,f=r*a,p=n*a,d=n*u,g=i*a,S=i*u,x=i*s,O=o*a,A=o*u,P=o*s;return t[0]=1-d-x,t[1]=p+P,t[2]=g-A,t[3]=0,t[4]=p-P,t[5]=1-f-x,t[6]=S+O,t[7]=0,t[8]=g+A,t[9]=S-O,t[10]=1-f-d,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ts(t,e,r,n,i,o,a){let u=1/(r-e),s=1/(i-n),f=1/(o-a);return t[0]=o*2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*s,t[6]=0,t[7]=0,t[8]=(r+e)*u,t[9]=(i+n)*s,t[10]=(a+o)*f,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*f,t[15]=0,t}function Gp(t,e,r,n,i){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0){let a=1/(n-i);t[10]=(i+n)*a,t[14]=2*i*n*a}else t[10]=-1,t[14]=-2*n;return t}var ks=Gp;function zp(t,e,r,n,i,o,a){let u=1/(e-r),s=1/(n-i),f=1/(o-a);return t[0]=-2*u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(e+r)*u,t[13]=(i+n)*s,t[14]=(a+o)*f,t[15]=1,t}var Ms=zp;function Is(t,e,r,n){let i,o,a,u,s,f,p,d,g,S,x=e[0],O=e[1],A=e[2],P=n[0],M=n[1],k=n[2],L=r[0],I=r[1],j=r[2];return Math.abs(x-L)<1e-6&&Math.abs(O-I)<1e-6&&Math.abs(A-j)<1e-6?Up(t):(d=x-L,g=O-I,S=A-j,i=1/Math.sqrt(d*d+g*g+S*S),d*=i,g*=i,S*=i,o=M*S-k*g,a=k*d-P*S,u=P*g-M*d,i=Math.sqrt(o*o+a*a+u*u),i?(i=1/i,o*=i,a*=i,u*=i):(o=0,a=0,u=0),s=g*u-S*a,f=S*o-d*u,p=d*a-g*o,i=Math.sqrt(s*s+f*f+p*p),i?(i=1/i,s*=i,f*=i,p*=i):(s=0,f=0,p=0),t[0]=o,t[1]=s,t[2]=d,t[3]=0,t[4]=a,t[5]=f,t[6]=g,t[7]=0,t[8]=u,t[9]=p,t[10]=S,t[11]=0,t[12]=-(o*x+a*O+u*A),t[13]=-(s*x+f*O+p*A),t[14]=-(d*x+g*O+S*A),t[15]=1,t)}function Bp(){let t=new St(4);return St!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Rs(t,e,r){let n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}var Xb=function(){let t=Bp();return function(e,r,n,i,o,a){let u,s;for(r||(r=4),n||(n=0),i?s=Math.min(i*r+n,e.length):s=e.length,u=n;u<s;u+=r)t[0]=e[u],t[1]=e[u+1],t[2]=e[u+2],t[3]=e[u+3],o(t,t,a),e[u]=t[0],e[u+1]=t[1],e[u+2]=t[2],e[u+3]=t[3];return e}}();var Dn;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(Dn||(Dn={}));var Vp=45*Math.PI/180,qp=1,jn=.1,Nn=500,Wp=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),dt=class extends jr{static get IDENTITY(){return Kp()}static get ZERO(){return Hp()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Dn}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,i,o,a,u,s,f,p,d,g,S,x,O,A){return this[0]=e,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=a,this[6]=u,this[7]=s,this[8]=f,this[9]=p,this[10]=d,this[11]=g,this[12]=S,this[13]=x,this[14]=O,this[15]=A,this.check()}setRowMajor(e,r,n,i,o,a,u,s,f,p,d,g,S,x,O,A){return this[0]=e,this[1]=o,this[2]=f,this[3]=S,this[4]=r,this[5]=a,this[6]=p,this[7]=x,this[8]=n,this[9]=u,this[10]=d,this[11]=O,this[12]=i,this[13]=s,this[14]=g,this[15]=A,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(Wp)}fromObject(e){return this.check()}fromQuaternion(e){return As(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:i,top:o,near:a=jn,far:u=Nn}=e;return u===1/0?Yp(this,r,n,i,o,a):Ts(this,r,n,i,o,a,u),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=e;return Is(this,r,n,i),this.check()}ortho(e){let{left:r,right:n,bottom:i,top:o,near:a=jn,far:u=Nn}=e;return Ms(this,r,n,i,o,a,u),this.check()}orthographic(e){let{fovy:r=Vp,aspect:n=qp,focalDistance:i=1,near:o=jn,far:a=Nn}=e;Ls(r);let u=r/2,s=i*Math.tan(u),f=s*n;return this.ortho({left:-f,right:f,bottom:-s,top:s,near:o,far:a})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=e;return Ls(r),ks(this,r,n,i,o),this.check()}determinant(){return bs(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],a=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*o,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*o,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],a=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*a,e[3]=this[4]*i,e[4]=this[5]*o,e[5]=this[6]*a,e[6]=this[8]*i,e[7]=this[9]*o,e[8]=this[10]*a,e}transpose(){return gs(this,this),this.check()}invert(){return _s(this,this),this.check()}multiplyLeft(e){return Ln(this,e,this),this.check()}multiplyRight(e){return Ln(this,this,e),this.check()}rotateX(e){return Os(this,this,e),this.check()}rotateY(e){return Ps(this,this,e),this.check()}rotateZ(e){return Es(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return Ss(this,this,e,r),this.check()}scale(e){return xs(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return ws(this,this,e),this.check()}transform(e,r){return e.length===4?(r=Rs(r||[-0,-0,-0,-0],e,this),kr(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,i;switch(n){case 2:i=us(r||[-0,-0],e,this);break;case 3:i=Rr(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return kr(i,e.length),i}transformAsVector(e,r){let n;switch(e.length){case 2:n=fs(r||[-0,-0],e,this);break;case 3:n=Ir(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return kr(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},Nr,Dr;function Hp(){return Nr||(Nr=new dt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Nr)),Nr}function Kp(){return Dr||(Dr=new dt,Object.freeze(Dr)),Dr}function Ls(t){if(t>Math.PI*2)throw Error("expected radians")}function Yp(t,e,r,n,i,o){let a=2*o/(r-e),u=2*o/(i-n),s=(r+e)/(r-e),f=(i+n)/(i-n),p=-1,d=-1,g=-2*o;return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=s,t[9]=f,t[10]=p,t[11]=d,t[12]=0,t[13]=0,t[14]=g,t[15]=0,t}function Xe(t){return Xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xe(t)}function js(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ns(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?js(Object(r),!0).forEach(function(n){Xp(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):js(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Xp(t,e,r){return e=Fs(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cn(t,e){return Qp(t)||Jp(t,e)||Zp(t,e)||$p()}function $p(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
253
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zp(t,e){if(t){if(typeof t=="string")return Ds(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ds(t,e)}}function Ds(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Jp(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function Qp(t){if(Array.isArray(t))return t}function Cs(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Fs(n.key),n)}}function tm(t,e,r){return e&&Cs(t.prototype,e),r&&Cs(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Fs(t){var e=em(t,"string");return Xe(e)==="symbol"?e:String(e)}function em(t,e){if(Xe(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function rm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Cr=function(){function t(r){rm(this,t),this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;var n=Ue(Object.values(r));Y.log(1,"Creating ShaderInputs with modules",n.map(function(p){return p.name}))(),this.modules=r,this.moduleUniforms={},this.moduleBindings={};for(var i=0,o=Object.entries(r);i<o.length;i++){var a=Cn(o[i],2),u=a[0],s=a[1],f=u;this.moduleUniforms[f]=s.defaultUniforms||{},this.moduleBindings[f]={}}}var e=t.prototype;return e.destroy=function(){},e.setProps=function(n){for(var i=0,o=Object.keys(n);i<o.length;i++){var a,u=o[i],s=u,f=n[s],p=this.modules[s];if(!p){Y.warn("Module ".concat(u," not found"))();continue}var d=this.moduleUniforms[s],g=((a=p.getUniforms)===null||a===void 0?void 0:a.call(p,f,this.moduleUniforms[s]))||f;this.moduleUniforms[s]=Ns(Ns({},d),g)}},e.getModules=function(){return Object.values(this.modules)},e.getUniformValues=function(){return this.moduleUniforms},e.getBindings=function(){for(var n={},i=0,o=Object.values(this.moduleBindings);i<o.length;i++){var a=o[i];Object.assign(n,a)}return n},e.getDebugTable=function(){for(var n={},i=0,o=Object.entries(this.moduleUniforms);i<o.length;i++)for(var a=Cn(o[i],2),u=a[0],s=a[1],f=0,p=Object.entries(s);f<p.length;f++){var d,g=Cn(p[f],2),S=g[0],x=g[1];n["".concat(u,".").concat(S)]={type:(d=this.modules[u].uniformTypes)===null||d===void 0?void 0:d[S],value:String(x)}}return n},tm(t)}();function $e(t){return $e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$e(t)}function nm(t,e){return sm(t)||am(t,e)||om(t,e)||im()}function im(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
254
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function om(t,e){if(t){if(typeof t=="string")return Us(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Us(t,e)}}function Us(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function am(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function sm(t){if(Array.isArray(t))return t}function Gs(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fm(n.key),n)}}function um(t,e,r){return e&&Gs(t.prototype,e),r&&Gs(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fm(t){var e=cm(t,"string");return $e(e)==="symbol"?e:String(e)}function cm(t,e){if($e(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if($e(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function lm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Fr=function(){function t(r){lm(this,t),this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=r.id||X("geometry"),this.topology=r.topology,this.indices=r.indices||null,this.attributes=r.attributes,this.vertexCount=r.vertexCount,this.bufferLayout=r.bufferLayout||[],this.indices&&et(this.indices.usage===$.INDEX)}var e=t.prototype;return e.destroy=function(){var n;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(n=this.attributes.colors)===null||n===void 0||n.destroy()},e.getVertexCount=function(){return this.vertexCount},e.getAttributes=function(){return this.attributes},e.getIndexes=function(){return this.indices},e._calculateVertexCount=function(n){var i=n.byteLength/12;return i},um(t)}();function zs(t,e){if(e instanceof Fr)return e;var r=hm(t,e),n=pm(t,e),i=n.attributes,o=n.bufferLayout;return new Fr({topology:e.topology||"triangle-list",bufferLayout:o,vertexCount:e.vertexCount,indices:r,attributes:i})}function hm(t,e){if(e.indices){var r=e.indices.value;return t.createBuffer({usage:$.INDEX,data:r})}}function pm(t,e){for(var r=[],n={},i=0,o=Object.entries(e.attributes);i<o.length;i++){var a=nm(o[i],2),u=a[0],s=a[1],f=u;switch(u){case"POSITION":f="positions";break;case"NORMAL":f="normals";break;case"TEXCOORD_0":f="texCoords";break;case"COLOR_0":f="colors";break}n[f]=t.createBuffer({data:s.value,id:"".concat(u,"-buffer")});var p=s.value,d=s.size,g=s.normalized;r.push({name:f,format:yn(p,d,g)})}var S=e._calculateVertexCount(e.attributes,e.indices);return{attributes:n,bufferLayout:r,vertexCount:S}}function Ze(t){return Ze=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ze(t)}function Bs(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function qt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Bs(Object(r),!0).forEach(function(n){mm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bs(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function mm(t,e,r){return e=qs(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vs(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qs(n.key),n)}}function dm(t,e,r){return e&&Vs(t.prototype,e),r&&Vs(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function qs(t){var e=ym(t,"string");return Ze(e)==="symbol"?e:String(e)}function ym(t,e){if(Ze(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ze(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function vm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Je=function(){t.getDefaultPipelineFactory=function(n){return n._lumaData.defaultPipelineFactory=n._lumaData.defaultPipelineFactory||new t(n),n._lumaData.defaultPipelineFactory};function t(r){vm(this,t),this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=r}var e=t.prototype;return e.createRenderPipeline=function(n){var i=qt(qt({},t.defaultProps),n),o=this._hashRenderPipeline(qt({},i));if(!this._pipelineCache[o]){var a=this.device.createRenderPipeline(qt(qt({},i),{},{vs:this.device.createShader({stage:"vertex",source:i.vs}),fs:i.fs?this.device.createShader({stage:"fragment",source:i.fs}):null}));a.hash=o,this._pipelineCache[o]=a,this._useCounts[o]=0}return this._useCounts[o]++,this._pipelineCache[o]},e.release=function(n){var i=n.hash;this._useCounts[i]--,this._useCounts[i]===0&&(this._pipelineCache[i].destroy(),delete this._pipelineCache[i],delete this._useCounts[i])},e._hashRenderPipeline=function(n){var i=this._getHash(n.vs),o=n.fs?this._getHash(n.fs):0,a="-";switch(this.device.info.type){case"webgpu":var u=this._getHash(JSON.stringify(n.parameters)),s=this._getHash(JSON.stringify(n.bufferLayout));return"".concat(i,"/").concat(o,"V").concat(a,"T").concat(n.topology,"P").concat(u,"BL").concat(s,"}");default:return"".concat(i,"/").concat(o,"V").concat(a)}},e._getHash=function(n){return this._hashes[n]===void 0&&(this._hashes[n]=this._hashCounter++),this._hashes[n]},dm(t)}();Je.defaultProps=qt(qt({},te.defaultProps),{},{vs:void 0,fs:void 0});function Qe(t){return Qe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qe(t)}function Ws(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=gm(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
255
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function gm(t,e){if(t){if(typeof t=="string")return Hs(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Hs(t,e)}}function Hs(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Fn(t,e,r){return e=_m(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _m(t){var e=bm(t,"string");return Qe(e)==="symbol"?e:String(e)}function bm(t,e){if(Qe(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Qe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ks(t,e){var r,n={},i="Values";if(t.attributes.length===0&&!((r=t.varyings)!==null&&r!==void 0&&r.length))return{"No attributes or varyings":Fn({},i,"N/A")};var o=Ws(t.attributes),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;if(u){var s="".concat(u.location," ").concat(u.name,": ").concat(u.type);n["in ".concat(s)]=Fn({},i,u.stepMode||"vertex")}}}catch(S){o.e(S)}finally{o.f()}var f=Ws(t.varyings||[]),p;try{for(f.s();!(p=f.n()).done;){var d=p.value,g="".concat(d.location," ").concat(d.name);n["out ".concat(g)]=Fn({},i,JSON.stringify(d.accessor))}}catch(S){f.e(S)}finally{f.f()}return n}var rt=null,Un=null;function Ys(t,e){var r=e.id,n=e.minimap,i=e.opaque,o=e.top,a=o===void 0?"0":o,u=e.left,s=u===void 0?"0":u,f=e.rgbaScale,p=f===void 0?1:f;rt||(rt=document.createElement("canvas"),rt.id=r,rt.title=r,rt.style.zIndex="100",rt.style.position="absolute",rt.style.top=a,rt.style.left=s,rt.style.border="blue 1px solid",rt.style.transform="scaleY(-1)",document.body.appendChild(rt),Un=rt.getContext("2d")),(rt.width!==t.width||rt.height!==t.height)&&(rt.width=t.width/2,rt.height=t.height/2,rt.style.width="400px",rt.style.height="400px");for(var d=t.device.readPixelsToArrayWebGL(t),g=Un.createImageData(t.width,t.height),S=0,x=0;x<d.length;x+=4)g.data[S+x+0]=d[x+0]*p,g.data[S+x+1]=d[x+1]*p,g.data[S+x+2]=d[x+2]*p,g.data[S+x+3]=i?255:d[x+3]*p;Un.putImageData(g,0,0)}function er(t){return er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},er(t)}function wm(t){return Om(t)||Sm(t)||zn(t)||xm()}function xm(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
256
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sm(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Om(t){if(Array.isArray(t))return Gn(t)}function Qs(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=zn(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
257
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function tr(t,e){return Am(t)||Em(t,e)||zn(t,e)||Pm()}function Pm(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
258
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zn(t,e){if(t){if(typeof t=="string")return Gn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gn(t,e)}}function Gn(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Em(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function Am(t){if(Array.isArray(t))return t}function Xs(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ot(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Xs(Object(r),!0).forEach(function(n){Tm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xs(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Tm(t,e,r){return e=tu(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tu(n.key),n)}}function km(t,e,r){return e&&$s(t.prototype,e),r&&$s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tu(t){var e=Mm(t,"string");return er(e)==="symbol"?e:String(e)}function Mm(t,e){if(er(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(er(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Im(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var le=2,Rm=1e4,bt=function(){function t(r,n){var i,o,a;Im(this,t),this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.vertexArray=void 0,this.transformFeedback=null,this.pipeline=void 0,this.shaderInputs=void 0,this._uniformStore=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this._lastLogTime=0,this._logOpen=!1,this._drawCount=0,this.props=Ot(Ot({},t.defaultProps),n),n=this.props,this.id=n.id||X("model"),this.device=r,Object.assign(this.userData,n.userData);var u=Object.fromEntries(((i=this.props.modules)===null||i===void 0?void 0:i.map(function(P){return[P.name,P]}))||[]);this.setShaderInputs(n.shaderInputs||new Cr(u));var s=this.device.info.type==="webgpu";if(this.props.source){if(s){var f;(f=this.props).shaderLayout||(f.shaderLayout=Tr(this.props.source))}this.props.fs=this.props.source,this.props.vs=this.props.source}if(s&&typeof this.props.vs!="string"){var p;(p=this.props).shaderLayout||(p.shaderLayout=Tr(this.props.vs.wgsl))}var d=Lm(r),g=(((o=this.props.modules)===null||o===void 0?void 0:o.length)>0?this.props.modules:(a=this.shaderInputs)===null||a===void 0?void 0:a.getModules())||[],S=this.props.shaderAssembler.assembleShaders(Ot(Ot({platformInfo:d},this.props),{},{modules:g})),x=S.vs,O=S.fs,A=S.getUniforms;if(this.vs=x,this.fs=O,this._getModuleUniforms=A,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,n.geometry&&(this._gpuGeometry=this.setGeometry(n.geometry)),this.pipelineFactory=n.pipelineFactory||Je.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=r.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),n.vertexCount&&this.setVertexCount(n.vertexCount),n.instanceCount&&this.setInstanceCount(n.instanceCount),n.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");n.indexBuffer&&this.setIndexBuffer(n.indexBuffer),n.attributes&&this.setAttributes(n.attributes),n.constantAttributes&&this.setConstantAttributes(n.constantAttributes),n.bindings&&this.setBindings(n.bindings),n.uniforms&&this.setUniforms(n.uniforms),n.moduleSettings&&(Y.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")(),this.updateModuleSettings(n.moduleSettings)),n.transformFeedback&&(this.transformFeedback=n.transformFeedback),Object.seal(this)}var e=t.prototype;return e.destroy=function(){this.pipelineFactory.release(this.pipeline),this._uniformStore.destroy()},e.predraw=function(){this.updateShaderInputs()},e.draw=function(n){this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms);var i=this.vertexArray.indexBuffer,o=i?i.byteLength/(i.indexType==="uint32"?4:2):void 0;this.pipeline.draw({renderPass:n,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:o,transformFeedback:this.transformFeedback})}finally{this._logDrawCallEnd()}this._logFramebuffer(n)},e.setGeometry=function(n){var i=n&&zs(this.device,n);return this.setTopology(i.topology||"triangle-list"),this.bufferLayout=Zs(i.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i),i},e._setGeometryAttributes=function(n){for(var i=this,o=Ot({},n.attributes),a=function(){var p=tr(s[u],1),d=p[0];!i.pipeline.shaderLayout.attributes.find(function(g){return g.name===d})&&d!=="positions"&&delete o[d]},u=0,s=Object.entries(o);u<s.length;u++)a();this.vertexCount=n.vertexCount,this.setIndexBuffer(n.indices),this.setAttributes(n.attributes,"ignore-unknown"),this.setAttributes(o)},e.setTopology=function(n){n!==this.topology&&(this.topology=n,this._setPipelineNeedsUpdate("topology"))},e.setBufferLayout=function(n){this.bufferLayout=this._gpuGeometry?Zs(n,this._gpuGeometry.bufferLayout):n,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)},e.setParameters=function(n){Ne(n,this.parameters,2)||(this.parameters=n,this._setPipelineNeedsUpdate("parameters"))},e.setVertexCount=function(n){this.vertexCount=n},e.setInstanceCount=function(n){this.instanceCount=n},e.setShaderInputs=function(n){this.shaderInputs=n,this._uniformStore=new mn(this.shaderInputs.modules);for(var i=0,o=Object.keys(this.shaderInputs.modules);i<o.length;i++){var a=o[i],u=this._uniformStore.getManagedUniformBuffer(this.device,a);this.bindings["".concat(a,"Uniforms")]=u}},e.setShaderModuleProps=function(n){var i=this._getModuleUniforms(n),o=Object.keys(i).filter(function(p){var d=i[p];return!mt(d)&&typeof d!="number"&&typeof d!="boolean"}),a={},u=Qs(o),s;try{for(u.s();!(s=u.n()).done;){var f=s.value;a[f]=i[f],delete i[f]}}catch(p){u.e(p)}finally{u.f()}},e.updateShaderInputs=function(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues())},e.updateModuleSettings=function(n){Y.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();var i=vn(this._getModuleUniforms(n)),o=i.bindings,a=i.uniforms;Object.assign(this.bindings,o),Object.assign(this.uniforms,a)},e.setBindings=function(n){Object.assign(this.bindings,n)},e.setUniforms=function(n){this.pipeline.setUniforms(n),Object.assign(this.uniforms,n)},e.setIndexBuffer=function(n){this.vertexArray.setIndexBuffer(n)},e.setTransformFeedback=function(n){this.transformFeedback=n},e.setAttributes=function(n,i){var o=this;n.indices&&Y.warn("Model:".concat(this.id," setAttributes() - indexBuffer should be set using setIndexBuffer()"))();for(var a=function(){var d=tr(s[u],2),g=d[0],S=d[1],x=o.bufferLayout.find(function(I){return Js(I).includes(g)});if(!x)return Y.warn("Model(".concat(o.id,'): Missing layout for buffer "').concat(g,'".'))(),"continue";for(var O=Js(x),A=!1,P=0,M=O;P<M.length;P++){var k=M[P],L=o._attributeInfos[k];L&&(o.vertexArray.setBuffer(L.location,S),A=!0)}!A&&i!=="ignore-unknown"&&Y.warn("Model(".concat(o.id,'): Ignoring buffer "').concat(S.id,'" for unknown attribute "').concat(g,'"'))()},u=0,s=Object.entries(n);u<s.length;u++)var f=a()},e.setConstantAttributes=function(n){for(var i=0,o=Object.entries(n);i<o.length;i++){var a=tr(o[i],2),u=a[0],s=a[1],f=this._attributeInfos[u];f?this.vertexArray.setConstant(f.location,s):Y.warn('Model "'.concat(this.id,': Ignoring constant supplied for unknown attribute "').concat(u,'"'))()}},e._setPipelineNeedsUpdate=function(n){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||n},e._updatePipeline=function(){if(this._pipelineNeedsUpdate){this.pipeline&&Y.log(1,"Model ".concat(this.id,': Recreating pipeline because "').concat(this._pipelineNeedsUpdate,'".'))(),this._pipelineNeedsUpdate=!1;var n=this.device.createShader({id:"".concat(this.id,"-vertex"),stage:"vertex",source:this.vs}),i=this.fs?this.device.createShader({id:"".concat(this.id,"-fragment"),stage:"fragment",source:this.fs}):null;this.pipeline=this.device.createRenderPipeline(Ot(Ot({},this.props),{},{bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:n,fs:i})),this._attributeInfos=pn(this.pipeline.shaderLayout,this.bufferLayout)}return this.pipeline},e._logDrawCallStart=function(){var n=Y.level>3?0:Rm;Y.level<2||Date.now()-this._lastLogTime<n||(this._lastLogTime=Date.now(),this._logOpen=!0,Y.group(le,">>> DRAWING MODEL ".concat(this.id),{collapsed:Y.level<=2})())},e._logDrawCallEnd=function(){if(this._logOpen){var n=Ks(this.pipeline.shaderLayout,this.id);Y.table(le,n)();for(var i=this.shaderInputs.getDebugTable(),o=0,a=Object.entries(this.uniforms);o<a.length;o++){var u=tr(a[o],2),s=u[0],f=u[1];i[s]={value:f}}Y.table(le,i)();var p=this._getAttributeDebugTable();Y.table(le,this._attributeInfos)(),Y.table(le,p)(),Y.groupEnd(le)(),this._logOpen=!1}},e._logFramebuffer=function(n){var i=Y.get("framebuffer");if(this._drawCount++,!(!i||this._drawCount++>3&&this._drawCount%60)){var o=n.props.framebuffer;o&&Ys(o,{id:o.id,minimap:!0})}},e._getAttributeDebugTable=function(){for(var n={},i=0,o=Object.entries(this._attributeInfos);i<o.length;i++){var a=tr(o[i],2),u=a[0],s=a[1];n[s.location]={name:u,type:s.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[s.location],s.bufferDataType)}}if(this.vertexArray.indexBuffer){var f=this.vertexArray.indexBuffer,p=f.indexType==="uint32"?new Uint32Array(f.debugData):new Uint16Array(f.debugData);n.indices={name:"indices",type:f.indexType,values:p.toString()}}return n},e._getBufferOrConstantValues=function(n,i){var o=dn(i),a=n instanceof $?new o(n.debugData):n;return a.toString()},km(t)}();bt.defaultProps=Ot(Ot({},te.defaultProps),{},{source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:xr.getDefaultShaderAssembler()});function Zs(t,e){var r=wm(t),n=Qs(e),i;try{var o=function(){var u=i.value,s=r.findIndex(function(f){return f.name===u.name});s<0?r.push(u):r[s]=u};for(n.s();!(i=n.n()).done;)o()}catch(a){n.e(a)}finally{n.f()}return r}function Lm(t){return{type:t.info.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}function Js(t){var e;return t.attributes?(e=t.attributes)===null||e===void 0?void 0:e.map(function(r){return r.attribute}):[t.name]}function rr(t){return rr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rr(t)}function eu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function jm(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?eu(Object(r),!0).forEach(function(n){Nm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):eu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Nm(t,e,r){return e=nu(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ru(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,nu(n.key),n)}}function Dm(t,e,r){return e&&ru(t.prototype,e),r&&ru(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function nu(t){var e=Cm(t,"string");return rr(e)==="symbol"?e:String(e)}function Cm(t,e){if(rr(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(rr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var iu=function(){t.isSupported=function(n){return n.features.has("transform-feedback-webgl2")};function t(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bt.defaultProps;Fm(this,t),this.device=void 0,this.model=void 0,this.transformFeedback=void 0,et(r.features.has("transform-feedback-webgl2"),"Device must support transform feedback"),this.device=r,this.model=new bt(this.device,jm({id:n.id||"buffer-transform-model",fs:n.fs||qe({version:300}),topology:n.topology||"point-list"},n)),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:n.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}var e=t.prototype;return e.destroy=function(){this.model&&this.model.destroy()},e.delete=function(){this.destroy()},e.run=function(n){var i=this.device.beginRenderPass(n);this.model.draw(i),i.end()},e.update=function(){console.warn("TextureTransform#update() not implemented")},e.getBuffer=function(n){return this.transformFeedback.getBuffer(n)},e.readAsync=function(n){var i=this.getBuffer(n);if(i instanceof $)return i.readAsync();var o=i.buffer,a=i.byteOffset,u=a===void 0?0:a,s=i.byteLength,f=s===void 0?o.byteLength:s;return o.readAsync(u,f)},Dm(t)}();function nr(t){return nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nr(t)}function ou(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function au(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ou(Object(r),!0).forEach(function(n){Um(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ou(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Um(t,e,r){return e=uu(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function su(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,uu(n.key),n)}}function Gm(t,e,r){return e&&su(t.prototype,e),r&&su(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function uu(t){var e=zm(t,"string");return nr(e)==="symbol"?e:String(e)}function zm(t,e){if(nr(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(nr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Bm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Vm="transform_output",fu=function(){function t(r,n){Bm(this,t),this.device=void 0,this.model=void 0,this.sampler=void 0,this.currentIndex=0,this.samplerTextureMap=null,this.bindings=[],this.resources={},this.device=r,this.sampler=r.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new bt(this.device,au({id:n.id||"texture-transform-model",fs:n.fs||qe({version:300,input:n.targetTextureVarying,inputChannels:n.targetTextureChannels,output:Vm}),vertexCount:n.vertexCount},n)),this._initialize(n),Object.seal(this)}var e=t.prototype;return e.destroy=function(){},e.delete=function(){this.destroy()},e.run=function(n){var i=this.bindings[this.currentIndex].framebuffer,o=this.device.beginRenderPass(au({framebuffer:i},n));this.model.draw(o),o.end()},e.update=function(){console.warn("TextureTransform#update() not implemented")},e.getData=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.packed,o=i===void 0?!1:i;throw new Error("getData() not implemented")},e.getTargetTexture=function(){var n=this.bindings[this.currentIndex].targetTexture;return n},e.getFramebuffer=function(){var n=this.bindings[this.currentIndex];return n.framebuffer},e._initialize=function(n){this._updateBindings(n)},e._updateBindings=function(n){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],n)},e._updateBinding=function(n,i){var o=i.sourceBuffers,a=i.sourceTextures,u=i.targetTexture;if(n||(n={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(n.sourceTextures,a),Object.assign(n.sourceBuffers,o),u){n.targetTexture=u;var s=u.width,f=u.height;n.framebuffer&&n.framebuffer.destroy(),n.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:s,height:f,colorAttachments:[u]}),n.framebuffer.resize({width:s,height:f})}return n},e._setSourceTextureParameters=function(){var n=this.currentIndex,i=this.bindings[n].sourceTextures;for(var o in i)i[o].sampler=this.sampler},Gm(t)}();function ir(t){return ir=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ir(t)}function cu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function qm(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?cu(Object(r),!0).forEach(function(n){Wm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):cu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Wm(t,e,r){return e=pu(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Hm(t,e){return $m(t)||Xm(t,e)||Ym(t,e)||Km()}function Km(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
259
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ym(t,e){if(t){if(typeof t=="string")return lu(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lu(t,e)}}function lu(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Xm(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function $m(t){if(Array.isArray(t))return t}function hu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pu(n.key),n)}}function Zm(t,e,r){return e&&hu(t.prototype,e),r&&hu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function pu(t){var e=Jm(t,"string");return ir(e)==="symbol"?e:String(e)}function Jm(t,e){if(ir(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ir(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Qm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var ut=function(){function t(r){Qm(this,t),this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};var n=r.attributes,i=n===void 0?{}:n,o=r.indices,a=o===void 0?null:o,u=r.vertexCount,s=u===void 0?null:u;this.id=r.id||X("geometry"),this.topology=r.topology,a&&(this.indices=ArrayBuffer.isView(a)?{value:a,size:1}:a),this.attributes={};for(var f=0,p=Object.entries(i);f<p.length;f++){var d=Hm(p[f],2),g=d[0],S=d[1],x=ArrayBuffer.isView(S)?{value:S}:S;et(ArrayBuffer.isView(x.value),"".concat(this._print(g),": must be typed array or object with value as typed array")),(g==="POSITION"||g==="positions")&&!x.size&&(x.size=3),g==="indices"?(et(!this.indices),this.indices=x):this.attributes[g]=x}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=s||this._calculateVertexCount(this.attributes,this.indices)}var e=t.prototype;return e.getVertexCount=function(){return this.vertexCount},e.getAttributes=function(){return this.indices?qm({indices:this.indices},this.attributes):this.attributes},e._print=function(n){return"Geometry ".concat(this.id," attribute ").concat(n)},e._setAttributes=function(n,i){return this},e._calculateVertexCount=function(n,i){if(i)return i.value.length;for(var o=1/0,a=0,u=Object.values(n);a<u.length;a++){var s=u[a],f=s.value,p=s.size,d=s.constant;!d&&f&&p>=1&&(o=Math.min(o,f.length/p))}return et(Number.isFinite(o)),o},Zm(t)}();function he(t){return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},he(t)}var mu;function du(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function yu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?du(Object(r),!0).forEach(function(n){td(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):du(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function td(t,e,r){return e=_u(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_u(n.key),n)}}function ed(t,e,r){return e&&vu(t.prototype,e),r&&vu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _u(t){var e=rd(t,"string");return he(e)==="symbol"?e:String(e)}function rd(t,e){if(he(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(he(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function nd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function id(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Bn(t,e)}function Bn(t,e){return Bn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Bn(t,e)}function od(t){var e=ud();return function(){var n=Ur(t),i;if(e){var o=Ur(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ad(this,i)}}function ad(t,e){if(e&&(he(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sd(t)}function sd(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ud(){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 Ur(t){return Ur=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ur(t)}function fd(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var cd=go(mu||(mu=fd([`in vec2 aClipSpacePosition;
260
+ in vec2 aTexCoord;
261
+ in vec2 aCoordinate;
262
+
263
+ out vec2 position;
264
+ out vec2 coordinate;
265
+ out vec2 uv;
266
+
267
+ void main(void) {
268
+ gl_Position = vec4(aClipSpacePosition, 0., 1.);
269
+ position = aClipSpacePosition;
270
+ coordinate = aCoordinate;
271
+ uv = aTexCoord;
272
+ }
273
+ `],[`\\
274
+ in vec2 aClipSpacePosition;
275
+ in vec2 aTexCoord;
276
+ in vec2 aCoordinate;
277
+
278
+ out vec2 position;
279
+ out vec2 coordinate;
280
+ out vec2 uv;
281
+
282
+ void main(void) {
283
+ gl_Position = vec4(aClipSpacePosition, 0., 1.);
284
+ position = aClipSpacePosition;
285
+ coordinate = aCoordinate;
286
+ uv = aTexCoord;
287
+ }
288
+ `]))),gu=[-1,-1,1,-1,-1,1,1,1],bu=function(t){id(r,t);var e=od(r);function r(n,i){nd(this,r);var o=gu.map(function(a){return a===-1?0:a});return e.call(this,n,yu(yu({},i),{},{vs:cd,vertexCount:4,geometry:new ut({topology:"triangle-strip",vertexCount:4,attributes:{aClipSpacePosition:{size:2,value:new Float32Array(gu)},aTexCoord:{size:2,value:new Float32Array(o)},aCoordinate:{size:2,value:new Float32Array(o)}}})}))}return ed(r)}(bt);function or(t){return or=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},or(t)}function wu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hd(n.key),n)}}function ld(t,e,r){return e&&wu(t.prototype,e),r&&wu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hd(t){var e=pd(t,"string");return or(e)==="symbol"?e:String(e)}function pd(t,e){if(or(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(or(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function md(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Wt=function(){function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};md(this,t),this.id=void 0,this.matrix=new dt,this.display=!0,this.position=new at,this.rotation=new at,this.scale=new at(1,1,1),this.userData={},this.props={};var n=r.id;this.id=n||X(this.constructor.name),this._setScenegraphNodeProps(r)}var e=t.prototype;return e.getBounds=function(){return null},e.destroy=function(){},e.delete=function(){this.destroy()},e.setProps=function(n){return this._setScenegraphNodeProps(n),this},e.toString=function(){return"{type: ScenegraphNode, id: ".concat(this.id,")}")},e.setPosition=function(n){return et(n.length===3,"setPosition requires vector argument"),this.position=n,this},e.setRotation=function(n){return et(n.length===3,"setRotation requires vector argument"),this.rotation=n,this},e.setScale=function(n){return et(n.length===3,"setScale requires vector argument"),this.scale=n,this},e.setMatrix=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i?this.matrix.copy(n):this.matrix=n},e.setMatrixComponents=function(n){var i=n.position,o=n.rotation,a=n.scale,u=n.update,s=u===void 0?!0:u;return i&&this.setPosition(i),o&&this.setRotation(o),a&&this.setScale(a),s&&this.updateMatrix(),this},e.updateMatrix=function(){var n=this.position,i=this.rotation,o=this.scale;return this.matrix.identity(),this.matrix.translate(n),this.matrix.rotateXYZ(i),this.matrix.scale(o),this},e.update=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.position,o=n.rotation,a=n.scale;return i&&this.setPosition(i),o&&this.setRotation(o),a&&this.setScale(a),this.updateMatrix(),this},e.getCoordinateUniforms=function(n,i){et(n),i=i||this.matrix;var o=new dt(n).multiplyRight(i),a=o.invert(),u=a.transpose();return{viewMatrix:n,modelMatrix:i,objectMatrix:i,worldMatrix:o,worldInverseMatrix:a,worldInverseTransposeMatrix:u}},e._setScenegraphNodeProps=function(n){"display"in n&&(this.display=n.display),"position"in n&&this.setPosition(n.position),"rotation"in n&&this.setRotation(n.rotation),"scale"in n&&this.setScale(n.scale),"matrix"in n&&this.setMatrix(n.matrix),Object.assign(this.props,n)},ld(t)}();function pe(t){return pe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(t)}function dd(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Wn(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
289
+ 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(t)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,u=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}}}function yd(t){return _d(t)||gd(t)||Wn(t)||vd()}function vd(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
290
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _d(t){if(Array.isArray(t))return Vn(t)}function bd(t,e){return Sd(t)||xd(t,e)||Wn(t,e)||wd()}function wd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
291
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wn(t,e){if(t){if(typeof t=="string")return Vn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vn(t,e)}}function Vn(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function xd(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,o,a,u=[],s=!0,f=!1;try{if(o=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(p){f=!0,i=p}finally{try{if(!s&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return u}}function Sd(t){if(Array.isArray(t))return t}function xu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Pd(n.key),n)}}function Od(t,e,r){return e&&xu(t.prototype,e),r&&xu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pd(t){var e=Ed(t,"string");return pe(e)==="symbol"?e:String(e)}function Ed(t,e){if(pe(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(pe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ad(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gr(){return typeof Reflect<"u"&&Reflect.get?Gr=Reflect.get.bind():Gr=function(e,r,n){var i=Td(e,r);if(i){var o=Object.getOwnPropertyDescriptor(i,r);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Gr.apply(this,arguments)}function Td(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=me(t),t!==null););return t}function kd(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qn(t,e)}function qn(t,e){return qn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},qn(t,e)}function Md(t){var e=Ld();return function(){var n=me(t),i;if(e){var o=me(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Id(this,i)}}function Id(t,e){if(e&&(pe(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Rd(t)}function Rd(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ld(){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 me(t){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},me(t)}var Su=function(t){kd(r,t);var e=Md(r);function r(){var i,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ad(this,r),o=Array.isArray(o)?{children:o}:o;var a=o,u=a.children,s=u===void 0?[]:u;return Y.assert(s.every(function(f){return f instanceof Wt}),"every child must an instance of ScenegraphNode"),i=e.call(this,o),i.children=void 0,i.children=s,i}var n=r.prototype;return n.getBounds=function(){var o=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse(function(a,u){var s=u.worldMatrix,f=a.getBounds();if(f){var p=bd(f,2),d=p[0],g=p[1],S=new at(d).add(g).divide([2,2,2]);s.transformAsPoint(S,S);var x=new at(g).subtract(d).divide([2,2,2]);s.transformAsVector(x,x);for(var O=0;O<8;O++)for(var A=new at(O&1?-1:1,O&2?-1:1,O&4?-1:1).multiply(x).add(S),P=0;P<3;P++)o[0][P]=Math.min(o[0][P],A[P]),o[1][P]=Math.max(o[1][P],A[P])}}),Number.isFinite(o[0][0])?o:null},n.destroy=function(){this.children.forEach(function(o){return o.destroy()}),this.removeAll(),Gr(me(r.prototype),"destroy",this).call(this)},n.add=function(){for(var o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];for(var s=0,f=a;s<f.length;s++){var p=f[s];Array.isArray(p)?this.add.apply(this,yd(p)):this.children.push(p)}return this},n.remove=function(o){var a=this.children,u=a.indexOf(o);return u>-1&&a.splice(u,1),this},n.removeAll=function(){return this.children=[],this},n.traverse=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=a.worldMatrix,s=u===void 0?new dt:u,f=new dt(s).multiplyRight(this.matrix),p=dd(this.children),d;try{for(p.s();!(d=p.n()).done;){var g=d.value;g instanceof r?g.traverse(o,{worldMatrix:f}):o(g,{worldMatrix:f})}}catch(S){p.e(S)}finally{p.f()}},Od(r)}(Wt);function de(t){return de=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},de(t)}function Ou(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Nd(n.key),n)}}function jd(t,e,r){return e&&Ou(t.prototype,e),r&&Ou(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Nd(t){var e=Dd(t,"string");return de(e)==="symbol"?e:String(e)}function Dd(t,e){if(de(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(de(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fd(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hn(t,e)}function Hn(t,e){return Hn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Hn(t,e)}function Ud(t){var e=Bd();return function(){var n=zr(t),i;if(e){var o=zr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Gd(this,i)}}function Gd(t,e){if(e&&(de(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zd(t)}function zd(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Bd(){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 zr(t){return zr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zr(t)}var Pu=function(t){Fd(r,t);var e=Ud(r);function r(i){var o;return Cd(this,r),o=e.call(this,i),o.model=void 0,o.bounds=null,o.managedResources=void 0,o.model=i.model,o.managedResources=i.managedResources||[],o.bounds=i.bounds||null,o.setProps(i),o}var n=r.prototype;return n.getBounds=function(){return this.bounds},n.destroy=function(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(function(o){return o.destroy()}),this.managedResources=[]},n.draw=function(o){return this.model.draw(o)},jd(r)}(Wt);function ye(t){return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye(t)}function Eu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Kn(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Eu(Object(r),!0).forEach(function(n){Vd(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Eu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Vd(t,e,r){return e=Tu(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Au(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Tu(n.key),n)}}function qd(t,e,r){return e&&Au(t.prototype,e),r&&Au(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Tu(t){var e=Wd(t,"string");return ye(e)==="symbol"?e:String(e)}function Wd(t,e){if(ye(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ye(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kd(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Yn(t,e)}function Yn(t,e){return Yn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Yn(t,e)}function Yd(t){var e=Zd();return function(){var n=Br(t),i;if(e){var o=Br(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Xd(this,i)}}function Xd(t,e){if(e&&(ye(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $d(t)}function $d(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zd(){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(t){return Br=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Br(t)}var Jd={x:[2,0,1],y:[0,1,2],z:[1,2,0]},ve=function(t){Kd(r,t);var e=Yd(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hd(this,r);var i=n.id,o=i===void 0?X("truncated-code-geometry"):i,a=Qd(n),u=a.indices,s=a.attributes;return e.call(this,Kn(Kn({},n),{},{id:o,topology:"triangle-list",indices:u,attributes:Kn({POSITION:{size:3,value:s.POSITION},NORMAL:{size:3,value:s.NORMAL},TEXCOORD_0:{size:2,value:s.TEXCOORD_0}},n.attributes)}))}return qd(r)}(ut);function Qd(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.bottomRadius,r=e===void 0?0:e,n=t.topRadius,i=n===void 0?0:n,o=t.height,a=o===void 0?1:o,u=t.nradial,s=u===void 0?10:u,f=t.nvertical,p=f===void 0?10:f,d=t.verticalAxis,g=d===void 0?"y":d,S=t.topCap,x=S===void 0?!1:S,O=t.bottomCap,A=O===void 0?!1:O,P=(x?2:0)+(A?2:0),M=(s+1)*(p+1+P),k=Math.atan2(r-i,a),L=Math.sin,I=Math.cos,j=Math.PI,U=I(k),G=L(k),V=x?-2:0,B=p+(A?2:0),F=s+1,h=new Uint16Array(s*(p+P)*6),c=Jd[g],l=new Float32Array(M*3),y=new Float32Array(M*3),b=new Float32Array(M*2),v=0,T=0,R=V;R<=B;R++){var N=R/p,q=a*N,z=void 0;R<0?(q=0,N=1,z=r):R>p?(q=a,N=1,z=i):z=r+(i-r)*(R/p),(R===-2||R===p+2)&&(z=0,N=0),q-=a/2;for(var K=0;K<F;K++){var ct=L(K*j*2/s),lt=I(K*j*2/s);l[v+c[0]]=ct*z,l[v+c[1]]=q,l[v+c[2]]=lt*z,y[v+c[0]]=R<0||R>p?0:ct*U,y[v+c[1]]=R<0?-1:R>p?1:G,y[v+c[2]]=R<0||R>p?0:lt*U,b[T+0]=K/s,b[T+1]=N,T+=2,v+=3}}for(var Q=0;Q<p+P;Q++)for(var ot=0;ot<s;ot++){var wt=(Q*s+ot)*6;h[wt+0]=F*(Q+0)+0+ot,h[wt+1]=F*(Q+0)+1+ot,h[wt+2]=F*(Q+1)+1+ot,h[wt+3]=F*(Q+0)+0+ot,h[wt+4]=F*(Q+1)+1+ot,h[wt+5]=F*(Q+1)+0+ot}return{indices:h,attributes:{POSITION:l,NORMAL:y,TEXCOORD_0:b}}}function ge(t){return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ge(t)}function ku(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Mu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ku(Object(r),!0).forEach(function(n){ty(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ku(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ty(t,e,r){return e=Ru(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Iu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ru(n.key),n)}}function ey(t,e,r){return e&&Iu(t.prototype,e),r&&Iu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ru(t){var e=ry(t,"string");return ge(e)==="symbol"?e:String(e)}function ry(t,e){if(ge(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ge(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ny(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xn(t,e)}function Xn(t,e){return Xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Xn(t,e)}function oy(t){var e=uy();return function(){var n=Vr(t),i;if(e){var o=Vr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ay(this,i)}}function ay(t,e){if(e&&(ge(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sy(t)}function sy(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function uy(){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 Vr(t){return Vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vr(t)}var Lu=function(t){iy(r,t);var e=oy(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ny(this,r);var i=n.id,o=i===void 0?X("cone-geometry"):i,a=n.radius,u=a===void 0?1:a,s=n.cap,f=s===void 0?!0:s;return e.call(this,Mu(Mu({},n),{},{id:o,topRadius:0,topCap:Boolean(f),bottomCap:Boolean(f),bottomRadius:u}))}return ey(r)}(ve);function _e(t){return _e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_e(t)}function ju(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function jt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ju(Object(r),!0).forEach(function(n){fy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ju(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function fy(t,e,r){return e=Du(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Du(n.key),n)}}function cy(t,e,r){return e&&Nu(t.prototype,e),r&&Nu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Du(t){var e=ly(t,"string");return _e(e)==="symbol"?e:String(e)}function ly(t,e){if(_e(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(_e(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function py(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$n(t,e)}function $n(t,e){return $n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},$n(t,e)}function my(t){var e=vy();return function(){var n=qr(t),i;if(e){var o=qr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return dy(this,i)}}function dy(t,e){if(e&&(_e(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yy(t)}function yy(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function vy(){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(t){return qr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},qr(t)}var Cu=function(t){py(r,t);var e=my(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hy(this,r);var i=n.id,o=i===void 0?X("cube-geometry"):i,a=n.indices,u=a===void 0?!0:a;return e.call(this,u?jt(jt({},n),{},{id:o,topology:"triangle-list",indices:{size:1,value:gy},attributes:jt(jt({},Py),n.attributes)}):jt(jt({},n),{},{id:o,topology:"triangle-list",indices:void 0,attributes:jt(jt({},Ey),n.attributes)}))}return cy(r)}(ut),gy=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),_y=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),by=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),wy=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),xy=new Float32Array([1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1]),Sy=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),Oy=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),Py={POSITION:{size:3,value:_y},NORMAL:{size:3,value:by},TEXCOORD_0:{size:2,value:wy}},Ey={POSITION:{size:3,value:xy},TEXCOORD_0:{size:2,value:Sy},COLOR_0:{size:3,value:Oy}};function be(t){return be=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},be(t)}function Fu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Uu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fu(Object(r),!0).forEach(function(n){Ay(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ay(t,e,r){return e=zu(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,zu(n.key),n)}}function Ty(t,e,r){return e&&Gu(t.prototype,e),r&&Gu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function zu(t){var e=ky(t,"string");return be(e)==="symbol"?e:String(e)}function ky(t,e){if(be(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(be(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function My(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Iy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zn(t,e)}function Zn(t,e){return Zn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Zn(t,e)}function Ry(t){var e=Ny();return function(){var n=Wr(t),i;if(e){var o=Wr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ly(this,i)}}function Ly(t,e){if(e&&(be(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jy(t)}function jy(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ny(){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(t){return Wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wr(t)}var Bu=function(t){Iy(r,t);var e=Ry(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};My(this,r);var i=n.id,o=i===void 0?X("cylinder-geometry"):i,a=n.radius,u=a===void 0?1:a;return e.call(this,Uu(Uu({},n),{},{id:o,bottomRadius:u,topRadius:u}))}return Ty(r)}(ve);function we(t){return we=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},we(t)}function Vu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Hr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Vu(Object(r),!0).forEach(function(n){Dy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Dy(t,e,r){return e=Wu(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Wu(n.key),n)}}function Cy(t,e,r){return e&&qu(t.prototype,e),r&&qu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wu(t){var e=Fy(t,"string");return we(e)==="symbol"?e:String(e)}function Fy(t,e){if(we(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(we(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jn(t,e)}function Jn(t,e){return Jn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Jn(t,e)}function zy(t){var e=qy();return function(){var n=Kr(t),i;if(e){var o=Kr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return By(this,i)}}function By(t,e){if(e&&(we(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vy(t)}function Vy(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qy(){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(t){return Kr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kr(t)}var Wy=[-1,0,0,0,1,0,0,0,-1,0,0,1,0,-1,0,1,0,0],Hy=[3,4,5,3,5,1,3,1,0,3,0,4,4,0,2,4,2,5,2,0,1,5,2,1],Hu=function(t){Gy(r,t);var e=zy(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Uy(this,r);var i=n.id,o=i===void 0?X("ico-sphere-geometry"):i,a=Ky(n),u=a.indices,s=a.attributes;return e.call(this,Hr(Hr({},n),{},{id:o,topology:"triangle-list",indices:u,attributes:Hr(Hr({},s),n.attributes)}))}return Cy(r)}(ut);function Ky(t){var e=t.iterations,r=e===void 0?0:e,n=Math.PI,i=n*2,o=[].concat(Wy),a=[].concat(Hy);o.push(),a.push();for(var u=function(){var Jr={};return function(Pt,Et){Pt*=3,Et*=3;var af=Pt<Et?Pt:Et,sf=Pt>Et?Pt:Et,Qr="".concat(af,"|").concat(sf);if(Qr in Jr)return Jr[Qr];var uf=o[Pt],ff=o[Pt+1],cf=o[Pt+2],lf=o[Et],hf=o[Et+1],pf=o[Et+2],sr=(uf+lf)/2,ur=(ff+hf)/2,fr=(cf+pf)/2,tn=Math.sqrt(sr*sr+ur*ur+fr*fr);return sr/=tn,ur/=tn,fr/=tn,o.push(sr,ur,fr),Jr[Qr]=o.length/3-1}}(),s=0;s<r;s++){for(var f=[],p=0;p<a.length;p+=3){var d=u(a[p+0],a[p+1]),g=u(a[p+1],a[p+2]),S=u(a[p+2],a[p+0]);f.push(S,a[p+0],d,d,a[p+1],g,g,a[p+2],S,d,g,S)}a=f}for(var x=new Array(o.length),O=new Array(o.length/3*2),A=a.length,P=A-3;P>=0;P-=3){var M=a[P+0],k=a[P+1],L=a[P+2],I=M*3,j=k*3,U=L*3,G=M*2,V=k*2,B=L*2,F=o[I+0],h=o[I+1],c=o[I+2],l=Math.acos(c/Math.sqrt(F*F+h*h+c*c)),y=Math.atan2(h,F)+n,b=l/n,v=1-y/i,T=o[j+0],R=o[j+1],N=o[j+2],q=Math.acos(N/Math.sqrt(T*T+R*R+N*N)),z=Math.atan2(R,T)+n,K=q/n,ct=1-z/i,lt=o[U+0],Q=o[U+1],ot=o[U+2],wt=Math.acos(ot/Math.sqrt(lt*lt+Q*Q+ot*ot)),rf=Math.atan2(Q,lt)+n,ei=wt/n,ar=1-rf/i,nf=[lt-T,Q-R,ot-N],of=[F-T,h-R,c-N],ht=new at(nf).cross(of).normalize(),J=void 0;(v===0||ct===0||ar===0)&&(v===0||v>.5)&&(ct===0||ct>.5)&&(ar===0||ar>.5)&&(o.push(o[I+0],o[I+1],o[I+2]),J=o.length/3-1,a.push(J),O[J*2+0]=1,O[J*2+1]=b,x[J*3+0]=ht.x,x[J*3+1]=ht.y,x[J*3+2]=ht.z,o.push(o[j+0],o[j+1],o[j+2]),J=o.length/3-1,a.push(J),O[J*2+0]=1,O[J*2+1]=K,x[J*3+0]=ht.x,x[J*3+1]=ht.y,x[J*3+2]=ht.z,o.push(o[U+0],o[U+1],o[U+2]),J=o.length/3-1,a.push(J),O[J*2+0]=1,O[J*2+1]=ei,x[J*3+0]=ht.x,x[J*3+1]=ht.y,x[J*3+2]=ht.z),x[I+0]=x[j+0]=x[U+0]=ht.x,x[I+1]=x[j+1]=x[U+1]=ht.y,x[I+2]=x[j+2]=x[U+2]=ht.z,O[G+0]=v,O[G+1]=b,O[V+0]=ct,O[V+1]=K,O[B+0]=ar,O[B+1]=ei}return{indices:{size:1,value:new Uint16Array(a)},attributes:{POSITION:{size:3,value:new Float32Array(o)},NORMAL:{size:3,value:new Float32Array(x)},TEXCOORD_0:{size:2,value:new Float32Array(O)}}}}function Ku(t){var e=t.indices,r=t.attributes;if(!e)return t;var n=e.value.length,i={};for(var o in r){var a=r[o],u=a.constant,s=a.value,f=a.size;if(!(u||!f)){for(var p=new s.constructor(n*f),d=0;d<n;++d)for(var g=e.value[d],S=0;S<f;S++)p[d*f+S]=s[g*f+S];i[o]={size:f,value:p}}}return{attributes:Object.assign({},r,i)}}function xe(t){return xe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xe(t)}function Yu(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Yr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Yu(Object(r),!0).forEach(function(n){Yy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Yu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Yy(t,e,r){return e=$u(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Xu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,$u(n.key),n)}}function Xy(t,e,r){return e&&Xu(t.prototype,e),r&&Xu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function $u(t){var e=$y(t,"string");return xe(e)==="symbol"?e:String(e)}function $y(t,e){if(xe(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(xe(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Jy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qn(t,e)}function Qn(t,e){return Qn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Qn(t,e)}function Qy(t){var e=rv();return function(){var n=Xr(t),i;if(e){var o=Xr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return tv(this,i)}}function tv(t,e){if(e&&(xe(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ev(t)}function ev(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rv(){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(t){return Xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xr(t)}var Zu=function(t){Jy(r,t);var e=Qy(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zy(this,r);var i=n.id,o=i===void 0?X("plane-geometry"):i,a=nv(n),u=a.indices,s=a.attributes;return e.call(this,Yr(Yr({},n),{},{id:o,topology:"triangle-list",indices:u,attributes:Yr(Yr({},s),n.attributes)}))}return Xy(r)}(ut);function nv(t){var e=t.type,r=e===void 0?"x,y":e,n=t.offset,i=n===void 0?0:n,o=t.flipCull,a=o===void 0?!1:o,u=t.unpack,s=u===void 0?!1:u,f=r.split(","),p=t["".concat(f[0],"len")]||1,d=t["".concat(f[1],"len")]||1,g=t["n".concat(f[0])]||1,S=t["n".concat(f[1])]||1,x=(g+1)*(S+1),O=new Float32Array(x*3),A=new Float32Array(x*3),P=new Float32Array(x*2);a&&(p=-p);for(var M=0,k=0,L=0;L<=S;L++)for(var I=0;I<=g;I++){var j=I/g,U=L/S;switch(P[M+0]=a?1-j:j,P[M+1]=U,r){case"x,y":O[k+0]=p*j-p*.5,O[k+1]=d*U-d*.5,O[k+2]=i,A[k+0]=0,A[k+1]=0,A[k+2]=a?1:-1;break;case"x,z":O[k+0]=p*j-p*.5,O[k+1]=i,O[k+2]=d*U-d*.5,A[k+0]=0,A[k+1]=a?1:-1,A[k+2]=0;break;case"y,z":O[k+0]=i,O[k+1]=p*j-p*.5,O[k+2]=d*U-d*.5,A[k+0]=a?1:-1,A[k+1]=0,A[k+2]=0;break;default:throw new Error("PlaneGeometry: unknown type")}M+=2,k+=3}for(var G=g+1,V=new Uint16Array(g*S*6),B=0;B<S;B++)for(var F=0;F<g;F++){var h=(B*g+F)*6;V[h+0]=(B+0)*G+F,V[h+1]=(B+1)*G+F,V[h+2]=(B+0)*G+F+1,V[h+3]=(B+1)*G+F,V[h+4]=(B+1)*G+F+1,V[h+5]=(B+0)*G+F+1}var c={indices:{size:1,value:V},attributes:{POSITION:{size:3,value:O},NORMAL:{size:3,value:A},TEXCOORD_0:{size:2,value:P}}};return s?Ku(c):c}function Se(t){return Se=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Se(t)}function Ju(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function $r(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ju(Object(r),!0).forEach(function(n){iv(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ju(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function iv(t,e,r){return e=tf(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,tf(n.key),n)}}function ov(t,e,r){return e&&Qu(t.prototype,e),r&&Qu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tf(t){var e=av(t,"string");return Se(e)==="symbol"?e:String(e)}function av(t,e){if(Se(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Se(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sv(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uv(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ti(t,e)}function ti(t,e){return ti=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ti(t,e)}function fv(t){var e=hv();return function(){var n=Zr(t),i;if(e){var o=Zr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cv(this,i)}}function cv(t,e){if(e&&(Se(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lv(t)}function lv(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function hv(){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 Zr(t){return Zr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Zr(t)}var ef=function(t){uv(r,t);var e=fv(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};sv(this,r);var i=n.id,o=i===void 0?X("sphere-geometry"):i,a=pv(n),u=a.indices,s=a.attributes;return e.call(this,$r($r({},n),{},{id:o,topology:"triangle-list",indices:u,attributes:$r($r({},s),n.attributes)}))}return ov(r)}(ut);function pv(t){for(var e=t.nlat,r=e===void 0?10:e,n=t.nlong,i=n===void 0?10:n,o=0,a=Math.PI,u=a-o,s=0,f=2*Math.PI,p=f-s,d=(r+1)*(i+1),g=function(ct,lt,Q,ot,wt){return t.radius||1},S=new Float32Array(d*3),x=new Float32Array(d*3),O=new Float32Array(d*2),A=d>65535?Uint32Array:Uint16Array,P=new A(r*i*6),M=0;M<=r;M++)for(var k=0;k<=i;k++){var L=k/i,I=M/r,j=k+M*(i+1),U=j*2,G=j*3,V=p*L,B=u*I,F=Math.sin(V),h=Math.cos(V),c=Math.sin(B),l=Math.cos(B),y=h*c,b=l,v=F*c,T=g(y,b,v,L,I);S[G+0]=T*y,S[G+1]=T*b,S[G+2]=T*v,x[G+0]=y,x[G+1]=b,x[G+2]=v,O[U+0]=L,O[U+1]=1-I}for(var R=i+1,N=0;N<i;N++)for(var q=0;q<r;q++){var z=(N*r+q)*6;P[z+0]=q*R+N,P[z+1]=q*R+N+1,P[z+2]=(q+1)*R+N,P[z+3]=(q+1)*R+N,P[z+4]=q*R+N+1,P[z+5]=(q+1)*R+N+1}return{indices:{size:1,value:P},attributes:{POSITION:{size:3,value:S},NORMAL:{size:3,value:x},TEXCOORD_0:{size:2,value:O}}}}return _f(mv);})();
292
+ return __exports__;
293
+ });