@luma.gl/engine 9.0.0-alpha.9 → 9.0.0-beta.1
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.
- package/LICENSE +3 -1
- package/dist/animation/key-frames.d.ts +1 -1
- package/dist/animation/key-frames.d.ts.map +1 -1
- package/dist/animation/key-frames.js +6 -27
- package/dist/animation/key-frames.js.map +1 -1
- package/dist/animation/timeline.d.ts +8 -8
- package/dist/animation/timeline.d.ts.map +1 -1
- package/dist/animation/timeline.js +18 -49
- package/dist/animation/timeline.js.map +1 -1
- package/dist/animation-loop/animation-loop-template.d.ts +23 -0
- package/dist/animation-loop/animation-loop-template.d.ts.map +1 -0
- package/dist/animation-loop/animation-loop-template.js +7 -0
- package/dist/animation-loop/animation-loop-template.js.map +1 -0
- package/dist/{lib → animation-loop}/animation-loop.d.ts +30 -22
- package/dist/animation-loop/animation-loop.d.ts.map +1 -0
- package/dist/{lib → animation-loop}/animation-loop.js +77 -192
- package/dist/animation-loop/animation-loop.js.map +1 -0
- package/dist/{lib → animation-loop}/animation-props.d.ts +2 -3
- package/dist/animation-loop/animation-props.d.ts.map +1 -0
- package/dist/animation-loop/animation-props.js.map +1 -0
- package/dist/animation-loop/make-animation-loop.d.ts +6 -0
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -0
- package/dist/animation-loop/make-animation-loop.js +28 -0
- package/dist/animation-loop/make-animation-loop.js.map +1 -0
- package/dist/debug/copy-texture-to-image.d.ts +26 -0
- package/dist/debug/copy-texture-to-image.d.ts.map +1 -0
- package/dist/debug/copy-texture-to-image.js +46 -0
- package/dist/debug/copy-texture-to-image.js.map +1 -0
- package/dist/debug/debug-framebuffer.d.ts +11 -0
- package/dist/debug/debug-framebuffer.d.ts.map +1 -0
- package/dist/debug/debug-framebuffer.js +43 -0
- package/dist/debug/debug-framebuffer.js.map +1 -0
- package/dist/debug/debug-shader-layout.d.ts +9 -0
- package/dist/debug/debug-shader-layout.d.ts.map +1 -0
- package/dist/debug/debug-shader-layout.js +28 -0
- package/dist/debug/debug-shader-layout.js.map +1 -0
- package/dist/debug/pixel-data-utils.d.ts +24 -0
- package/dist/debug/pixel-data-utils.d.ts.map +1 -0
- package/dist/debug/pixel-data-utils.js +41 -0
- package/dist/debug/pixel-data-utils.js.map +1 -0
- package/dist/dist.dev.js +10081 -0
- package/dist/geometries/cone-geometry.d.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts.map +1 -1
- package/dist/geometries/cone-geometry.js +6 -5
- package/dist/geometries/cone-geometry.js.map +1 -1
- package/dist/geometries/cube-geometry.d.ts +2 -2
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +16 -10
- package/dist/geometries/cube-geometry.js.map +1 -1
- package/dist/geometries/cylinder-geometry.d.ts +1 -1
- package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
- package/dist/geometries/cylinder-geometry.js +6 -5
- package/dist/geometries/cylinder-geometry.js.map +1 -1
- package/dist/geometries/ico-sphere-geometry.d.ts +2 -2
- package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +10 -19
- package/dist/geometries/ico-sphere-geometry.js.map +1 -1
- package/dist/geometries/plane-geometry.d.ts +2 -2
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js +14 -23
- package/dist/geometries/plane-geometry.js.map +1 -1
- package/dist/geometries/sphere-geometry.d.ts +2 -2
- package/dist/geometries/sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/sphere-geometry.js +9 -13
- package/dist/geometries/sphere-geometry.js.map +1 -1
- package/dist/geometries/truncated-cone-geometry.d.ts +2 -4
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +9 -25
- package/dist/geometries/truncated-cone-geometry.js.map +1 -1
- package/dist/geometry/geometry-table.d.ts +2 -2
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-table.js.map +1 -1
- package/dist/geometry/geometry-utils.d.ts.map +1 -1
- package/dist/geometry/geometry-utils.js +0 -9
- package/dist/geometry/geometry-utils.js.map +1 -1
- package/dist/geometry/geometry.d.ts +43 -43
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +20 -86
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/geometry/gpu-geometry.d.ts +37 -0
- package/dist/geometry/gpu-geometry.d.ts.map +1 -0
- package/dist/geometry/gpu-geometry.js +110 -0
- package/dist/geometry/gpu-geometry.js.map +1 -0
- package/dist/geometry/gpu-table.d.ts +1 -0
- package/dist/geometry/gpu-table.d.ts.map +1 -0
- package/dist/geometry/gpu-table.js +2 -0
- package/dist/geometry/gpu-table.js.map +1 -0
- package/dist/index.cjs +3128 -0
- package/dist/index.d.ts +24 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/clip-space.d.ts +8 -0
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +47 -0
- package/dist/lib/clip-space.js.map +1 -1
- package/dist/lib/pipeline-factory.d.ts +12 -45
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +42 -168
- package/dist/lib/pipeline-factory.js.map +1 -1
- package/dist/model/model.d.ts +206 -0
- package/dist/model/model.d.ts.map +1 -0
- package/dist/model/model.js +435 -0
- package/dist/model/model.js.map +1 -0
- package/dist/scenegraph/group-node.d.ts +21 -0
- package/dist/scenegraph/group-node.d.ts.map +1 -0
- package/dist/scenegraph/group-node.js +94 -0
- package/dist/scenegraph/group-node.js.map +1 -0
- package/dist/scenegraph/model-node.d.ts +18 -0
- package/dist/scenegraph/model-node.d.ts.map +1 -0
- package/dist/scenegraph/model-node.js +28 -0
- package/dist/scenegraph/model-node.js.map +1 -0
- package/dist/scenegraph/scenegraph-node.d.ts +56 -0
- package/dist/scenegraph/scenegraph-node.d.ts.map +1 -0
- package/dist/scenegraph/scenegraph-node.js +141 -0
- package/dist/scenegraph/scenegraph-node.js.map +1 -0
- package/dist/shader-inputs.d.ts +63 -0
- package/dist/shader-inputs.d.ts.map +1 -0
- package/dist/shader-inputs.js +66 -0
- package/dist/shader-inputs.js.map +1 -0
- package/dist/transform/buffer-transform.d.ts +35 -0
- package/dist/transform/buffer-transform.d.ts.map +1 -0
- package/dist/transform/buffer-transform.js +62 -0
- package/dist/transform/buffer-transform.js.map +1 -0
- package/dist/transform/texture-transform.d.ts +57 -0
- package/dist/transform/texture-transform.d.ts.map +1 -0
- package/dist/transform/texture-transform.js +122 -0
- package/dist/transform/texture-transform.js.map +1 -0
- package/dist.min.js +293 -0
- package/package.json +21 -12
- package/src/animation/timeline.ts +15 -14
- package/src/animation-loop/animation-loop-template.ts +23 -0
- package/src/{lib → animation-loop}/animation-loop.ts +99 -88
- package/src/{lib → animation-loop}/animation-props.ts +1 -1
- package/src/animation-loop/make-animation-loop.ts +44 -0
- package/src/debug/copy-texture-to-image.ts +72 -0
- package/src/debug/debug-framebuffer.ts +57 -0
- package/src/debug/debug-shader-layout.ts +38 -0
- package/src/debug/pixel-data-utils.ts +57 -0
- package/src/geometries/cone-geometry.ts +1 -1
- package/src/geometries/cube-geometry.ts +47 -45
- package/src/geometries/cylinder-geometry.ts +2 -2
- package/src/geometries/ico-sphere-geometry.ts +6 -5
- package/src/geometries/plane-geometry.ts +5 -4
- package/src/geometries/sphere-geometry.ts +4 -3
- package/src/geometries/truncated-cone-geometry.ts +4 -13
- package/src/geometry/geometry-table.ts +1 -1
- package/src/geometry/geometry-utils.ts +3 -3
- package/src/geometry/geometry.ts +65 -110
- package/src/geometry/gpu-geometry.ts +125 -0
- package/src/geometry/gpu-table.ts +41 -0
- package/src/index.ts +34 -10
- package/src/lib/clip-space.ts +22 -21
- package/src/lib/pipeline-factory.ts +51 -168
- package/src/model/model.ts +726 -0
- package/src/scenegraph/group-node.ts +103 -0
- package/src/scenegraph/model-node.ts +50 -0
- package/src/scenegraph/scenegraph-node.ts +204 -0
- package/src/shader-inputs.ts +150 -0
- package/src/transform/buffer-transform.ts +94 -0
- package/src/transform/texture-transform.ts +169 -0
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/geometry/primitive-utils.d.ts +0 -1
- package/dist/geometry/primitive-utils.d.ts.map +0 -1
- package/dist/geometry/primitive-utils.js +0 -2
- package/dist/geometry/primitive-utils.js.map +0 -1
- package/dist/lib/animation-loop.d.ts.map +0 -1
- package/dist/lib/animation-loop.js.map +0 -1
- package/dist/lib/animation-props.d.ts.map +0 -1
- package/dist/lib/animation-props.js.map +0 -1
- package/dist/lib/model-utils.d.ts +0 -5
- package/dist/lib/model-utils.d.ts.map +0 -1
- package/dist/lib/model-utils.js +0 -45
- package/dist/lib/model-utils.js.map +0 -1
- package/dist/lib/model.d.ts +0 -41
- package/dist/lib/model.d.ts.map +0 -1
- package/dist/lib/model.js +0 -182
- package/dist/lib/model.js.map +0 -1
- package/dist/lib/render-loop.d.ts +0 -14
- package/dist/lib/render-loop.d.ts.map +0 -1
- package/dist/lib/render-loop.js +0 -49
- package/dist/lib/render-loop.js.map +0 -1
- package/src/bundle.ts +0 -4
- package/src/geometry/primitive-utils.ts +0 -30
- package/src/lib/model-utils.ts +0 -124
- package/src/lib/model.ts +0 -183
- package/src/lib/render-loop.ts +0 -58
- /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 df=Object.getOwnPropertyDescriptor;var mf=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 mf(e))!yf.call(t,i)&&i!==r&&en(t,i,{get:()=>e[i],enumerable:!(n=df(e,i))||n.enumerable});return t};var _f=t=>gf(en({},"__esModule",{value:!0}),t);var dv={};vf(dv,{AnimationLoop:()=>_r,AnimationLoopTemplate:()=>ci,BufferTransform:()=>iu,ClipSpace:()=>bu,ConeGeometry:()=>Lu,CubeGeometry:()=>Cu,CylinderGeometry:()=>Bu,GPUGeometry:()=>Fr,Geometry:()=>ut,GroupNode:()=>Su,IcoSphereGeometry:()=>Wu,KeyFrames:()=>si,Model:()=>bt,ModelNode:()=>Pu,PipelineFactory:()=>Je,PlaneGeometry:()=>Zu,ScenegraphNode:()=>Ht,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,m=p===void 0?1:p,g=Tf++,S={time:0,delay:o,duration:u,rate:f,repeat:m};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(_){o.e(_)}finally{o.f()}var s=this.animations.values(),f=rn(s),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,g=m.animation,S=m.channel;g.setTime(this.getTime(S))}}catch(_){f.e(_)}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 Wt(t){return Wt=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},Wt(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:M(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 m={};function g(){}function S(){}function _(){}var O={};s(O,o,function(){return this});var k=Object.getPrototypeOf,P=k&&k(k(z([])));P&&P!==e&&r.call(P,o)&&(O=P);var I=_.prototype=g.prototype=Object.create(O);function A(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,G=q.value;return G&&Wt(G)=="object"&&r.call(G,"__await")?c.resolve(G.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(G).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 M(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 B()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===m)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===m)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")),m;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,m;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,m):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,m)}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 F(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 z(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:B}}function B(){return{value:void 0,done:!0}}return S.prototype=_,n(I,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:S,configurable:!0}),S.displayName=s(_,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,_):(h.__proto__=_,s(h,u,"GeneratorFunction")),h.prototype=Object.create(I),h},t.awrap=function(h){return{__await:h}},A(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()})},A(I),s(I,u,"Generator"),s(I,o,function(){return this}),s(I,"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=z,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(F),!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,G){return T.type="throw",T.arg=c,l.next=q,G&&(l.method="next",l.arg=void 0),!!G}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,m):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),m},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),F(y),m}},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;F(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:z(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),m}},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 Wt(e)==="symbol"?e:String(e)}function Cf(t,e){if(Wt(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wt(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||{},Dt=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 di(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 mi(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 Ct(){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 Dt){var n;let i=Dt===null||Dt===void 0||(n=Dt.hrtime)===null||n===void 0?void 0:n.call(Dt);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},Tt=class{constructor(){let{id:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=cr,this._startTs=Ct(),this._deltaTs=Ct(),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")),mi(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((Ct()-this._startTs).toPrecision(10))}getDelta(){return Number((Ct()-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}):Wf({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=Ct();let a=o.tag||o.message;if(o.once&&a)if(!yi[a])yi[a]=Ct();else return pt;return r=Hf(this.id,o.message,o),n.bind(console,r,...o.args)}return pt}};Tt.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 Hf(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=di(e,r.color,r.background)}return e}function Wf(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 Tt({id:"@probe.gl/log"});var Y=new Tt({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 Ft=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 kt=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 Ft?i=e:i=new Ft(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 kt({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 dt(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 Ut=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)}();Ut.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=mc();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 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 dc(t)}function dc(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mc(){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)}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}(Ut);$.defaultProps=sn(sn({},Ut.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._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:M(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 m={};function g(){}function S(){}function _(){}var O={};s(O,o,function(){return this});var k=Object.getPrototypeOf,P=k&&k(k(z([])));P&&P!==e&&r.call(P,o)&&(O=P);var I=_.prototype=g.prototype=Object.create(O);function A(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,G=q.value;return G&&Jt(G)=="object"&&r.call(G,"__await")?c.resolve(G.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(G).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 M(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 B()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===m)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===m)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")),m;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,m;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,m):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,m)}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 F(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 z(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:B}}function B(){return{value:void 0,done:!0}}return S.prototype=_,n(I,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:S,configurable:!0}),S.displayName=s(_,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,_):(h.__proto__=_,s(h,u,"GeneratorFunction")),h.prototype=Object.create(I),h},t.awrap=function(h){return{__await:h}},A(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()})},A(I),s(I,u,"Generator"),s(I,o,function(){return this}),s(I,"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=z,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(F),!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,G){return T.type="throw",T.arg=c,l.next=q,G&&(l.method="next",l.arg=void 0),!!G}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,m):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),m},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),F(y),m}},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;F(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:z(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),m}},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 Gt=new Map,zt=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),Gt.set(o.type,o)}}catch(a){n.e(a)}finally{n.f()}},t.getAvailableDevices=function(){return Array.from(Gt).map(function(r){return r.type})},t.getSupportedDevices=function(){return Array.from(Gt).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=Gt.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=Gt.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=Gt.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=Gt.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)}();zt.stats=$t;zt.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=mr(t),i;if(e){var o=mr(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 mr(t){return mr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},mr(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}(Ut);te.defaultProps=zi(zi({},Ut.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 Hi(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 Hi(t,e)}}function Hi(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 Wi(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=Hc[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"},Hc={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};function Wc(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=Wc(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=Wi(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 m=(i=o.attributes)===null||i===void 0?void 0:i.find(function(g){return g.attribute===e});if(m)return{attributeName:m.attribute,bufferName:o.name,stepMode:o.stepMode,vertexFormat:m.format,byteOffset:m.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,m=f.components;n=Ji(n,m);var g=n;n+=m,this.layout[u]={type:p,size:m,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],m=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,_=g.size,O=g.offset,k=a[S];if(_===1){if(typeof m!="number"&&typeof m!="boolean"){Y.warn("Supplied value for single component uniform ".concat(p," is not a number: ").concat(m))();continue}k[O]=Number(m)}else{var P=dt(m);if(!P){Y.warn("Supplied value for multi component / array uniform ".concat(p," is not a numeric array: ").concat(m))();continue}k.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=dt(t);if(!n)return!1;var i=dt(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=dt(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)||ml(t,e)||fo(t,e)||dl()}function dl(){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 ml(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 dn=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,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,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 mn(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 dt(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:M(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 m={};function g(){}function S(){}function _(){}var O={};s(O,o,function(){return this});var k=Object.getPrototypeOf,P=k&&k(k(z([])));P&&P!==e&&r.call(P,o)&&(O=P);var I=_.prototype=g.prototype=Object.create(O);function A(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,G=q.value;return G&&ee(G)=="object"&&r.call(G,"__await")?c.resolve(G.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(G).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 M(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 B()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===m)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===m)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")),m;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,m;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,m):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,m)}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 F(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 z(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:B}}function B(){return{value:void 0,done:!0}}return S.prototype=_,n(I,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:S,configurable:!0}),S.displayName=s(_,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,_):(h.__proto__=_,s(h,u,"GeneratorFunction")),h.prototype=Object.create(I),h},t.awrap=function(h){return{__await:h}},A(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()})},A(I),s(I,u,"Generator"),s(I,o,function(){return this}),s(I,"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=z,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(F),!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,G){return T.type="throw",T.arg=c,l.next=q,G&&(l.method="next",l.arg=void 0),!!G}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,m):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),m},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),F(y),m}},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;F(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:z(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),m}},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:zt.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 kt({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:M(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 m={};function g(){}function S(){}function _(){}var O={};s(O,o,function(){return this});var k=Object.getPrototypeOf,P=k&&k(k(z([])));P&&P!==e&&r.call(P,o)&&(O=P);var I=_.prototype=g.prototype=Object.create(O);function A(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,G=q.value;return G&&re(G)=="object"&&r.call(G,"__await")?c.resolve(G.__await).then(function(K){l("next",K,T,R)},function(K){l("throw",K,T,R)}):c.resolve(G).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 M(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 B()}for(l.method=b,l.arg=v;;){var T=l.delegate;if(T){var R=j(T,l);if(R){if(R===m)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===m)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")),m;var b=p(y,h.iterator,c.arg);if(b.type==="throw")return c.method="throw",c.arg=b.arg,c.delegate=null,m;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,m):v:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,m)}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 F(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 z(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:B}}function B(){return{value:void 0,done:!0}}return S.prototype=_,n(I,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:S,configurable:!0}),S.displayName=s(_,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,_):(h.__proto__=_,s(h,u,"GeneratorFunction")),h.prototype=Object.create(I),h},t.awrap=function(h){return{__await:h}},A(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()})},A(I),s(I,u,"Generator"),s(I,o,function(){return this}),s(I,"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=z,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(F),!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,G){return T.type="throw",T.arg=c,l.next=q,G&&(l.method="next",l.arg=void 0),!!G}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,m):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),m},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),F(y),m}},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;F(y)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(c,l,y){return this.delegate={iterator:z(c),resultName:l,nextLoc:y},this.method==="next"&&(this.arg=void 0),m}},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||zt.createDevice(),o=new _r(Ao(Ao({},e),{},{device:i,onInitialize:function(u){return zl(bn().mark(function s(){var f;return bn().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return n=new t(u),m.next=3,(f=n)===null||f===void 0?void 0:f.onInitialize(u);case 3:return m.abrupt("return",m.sent);case 4:case"end":return m.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 Mt(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){Hl(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 Hl(t,e,r){return e=Wl(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wl(t){var e=Kl(t,"string");return It(e)==="symbol"?e:String(e)}function Kl(t,e){if(It(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(It(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 It(t){return It=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},It(t)}var wn={number:{type:"number",validate:function(e,r){return Number.isFinite(e)&&It(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 Mt(Mt({value:t},wn[e]),{},{type:e});if(It(t)==="object")return t?t.type!==void 0?Mt(Mt(Mt({},t),wn[t.type]),{},{type:t.type}):t.value===void 0?{type:"object",value:t}:(e=Io(t.value),Mt(Mt(Mt({},t),wn[e]),{},{type:e})):{type:"object",value:null};throw new Error("props")}function Io(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":It(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 m="".concat(xn.join(`
|
|
69
|
+
`),`
|
|
70
|
+
`);switch(a){case"vs:#decl":i&&(t=t.replace(De,m));break;case"vs:#main-start":i&&(t=t.replace(Go,function(g){return g+m}));break;case"vs:#main-end":i&&(t=t.replace(zo,function(g){return m+g}));break;case"fs:#decl":i||(t=t.replace(De,m));break;case"fs:#main-start":i||(t=t.replace(Go,function(g){return g+m}));break;case"fs:#main-end":i||(t=t.replace(zo,function(g){return m+g}));break;default:t=t.replace(a,function(g){return g+m})}};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,m=r.deprecations,g=m===void 0?[]:m,S=r.defines,_=S===void 0?{}:S,O=r.inject,k=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=_,this.injections=Bo(k),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 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 Ue(t){var e=br.instantiateModules(t);return sh(e)}function sh(t){var e={},r={};return Wo({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 Wo(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(m){o.e(m)}finally{o.f()}var s=qo(e),f;try{for(s.s();!(f=s.n()).done;){var p=f.value;p.dependencies&&Wo({modules:p.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}}catch(m){s.e(m)}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,dh),t;default:throw new Error(r)}case 100:switch(r){case"vertex":return t=Ge(t,mh),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"]]),dh=[].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("]],mh=[].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)||da(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=da(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 da(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],m=a.replace(/\(.+/,""),g=Object.assign(o,{signature:p});switch(f){case"vs":e.vertex[m]=g;break;case"fs":e.fragment[m]=g;break;default:throw new Error(f)}}}catch(S){r.e(S)}finally{r.f()}return e}function ma(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 Rt(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,Rt(Rt({},t),{},{source:e,stage:"vertex",modules:n})),fs:ba(t.platformInfo,Rt(Rt({},t),{},{source:r,stage:"fragment",modules:n})),getUniforms:wa(n)};case"wgsl":return{vs:_a(t.platformInfo,Rt(Rt({},t),{},{source:e,stage:"vertex",modules:n})),fs:_a(t.platformInfo,Rt(Rt({},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.defines,a=o===void 0?{}:o,u=e.hookFunctions,s=u===void 0?[]:u,f=e.inject,p=f===void 0?{}:f,m=e.log;yt(typeof r=="string","shader source must be a string");var g=r,S={};i.forEach(function(v){Object.assign(S,v.getDefines())}),Object.assign(S,a);var _="",O=On(s),k={},P={},I={};for(var A in p){var L=typeof p[A]=="string"?{injection:p[A],order:0}:p[A],M=/^(v|f)s:(#)?([\w-]+)$/.exec(A);if(M){var j=M[2],U=M[3];j?U==="decl"?P[A]=[L]:I[A]=[L]:k[A]=[L]}else I[A]=[L]}var F=Pn(i),V;try{for(F.s();!(V=F.n()).done;){var z=V.value;m&&z.checkDeprecations(g,m);var B=z.getModuleSource(n,"wgsl");_+=B;var h=z.injections[n];for(var c in h){var l=/^(v|f)s:#([\w-]+)$/.exec(c);if(l){var y=l[2],b=y==="decl"?P:I;b[c]=b[c]||[],b[c].push(h[c])}else k[c]=k[c]||[],k[c].push(h[c])}}}catch(v){F.e(v)}finally{F.f()}return _+=xa,_=Ce(_,n,P),_+=Sn(O[n],k),_+=g,_=Ce(_,n,I),_}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,m=p===void 0?[]:p,g=e.inject,S=g===void 0?{}:g,_=e.prologue,O=_===void 0?!0:_,k=e.log;yt(typeof n=="string","shader source must be a string");var P=a==="glsl"?ma(n).version:-1,I=t.shaderLanguageVersion,A=P===100?"#version 100":"#version 300 es",L=n.split(`
|
|
210
|
+
`),M=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(A,`
|
|
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(A,`
|
|
225
|
+
`);break}var F=On(m),V={},z={},B={};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"?z[h]=[c]:B[h]=[c]:V[h]=[c]}else B[h]=[c]}var v=Pn(u),T;try{for(v.s();!(T=v.n()).done;){var R=T.value;k&&R.checkDeprecations(M,k);var N=R.getModuleSource(i);U+=N;var q=R.injections[i];for(var G in q){var K=/^(v|f)s:#([\w-]+)$/.exec(G);if(K){var ct=K[2],lt=ct==="decl"?z:B;lt[G]=lt[G]||[],lt[G].push(q[G])}else V[G]=V[G]||[],V[G].push(q[G])}}}catch(Q){v.e(Q)}finally{v.f()}return U+="// ----- MAIN SHADER SOURCE -------------------------",U+=xa,U=Ce(U,i,z),U+=Sn(F[i],V),U+=M,U=Ce(U,i,B),a==="glsl"&&P!==I&&(U=ua(U,I,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 m=0,g=n.length;m<g;++m){var S=n[m],_=S.name;o[_]||(i[a++]=S,o[_]=!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 jt(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 H(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 W(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 Hh(this,i)}}function Hh(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 Wh(t)}function Wh(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}),Vt=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){H(r,t);var e=W(r);function r(){return C(this,r),e.call(this)}return D(r)}(Vt),Xa=function(t){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(r);function r(){return C(this,r),e.call(this)}return D(r,[{key:"astNodeType",get:function(){return"discard"}}]),r}(Z),cp=function(t){H(r,t);var e=W(r);function r(){return C(this,r),e.call(this)}return D(r,[{key:"astNodeType",get:function(){return"break"}}]),r}(Z),lp=function(t){H(r,t);var e=W(r);function r(){return C(this,r),e.call(this)}return D(r,[{key:"astNodeType",get:function(){return"continue"}}]),r}(Z),qt=function(t){H(r,t);var e=W(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),Bt=function(t){H(r,t);var e=W(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}(qt),Ja=function(t){H(r,t);var e=W(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}(qt),hp=function(t){H(r,t);var e=W(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}(qt),Qa=function(t){H(r,t);var e=W(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}(qt),He=function(t){H(r,t);var e=W(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}(qt),_t=function(t){H(r,t);var e=W(r);function r(){return C(this,r),e.call(this)}return D(r)}(Vt),Ua=function(t){H(r,t);var e=W(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),We=function(t){H(r,t);var e=W(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){H(r,t);var e=W(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),dp=function(t){H(r,t);var e=W(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){H(r,t);var e=W(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 We){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),m=p?.getMemberIndex(s);if(m!=-1){var g=this.initializer.args[m].evaluate(o);return g}console.log(m)}return this.initializer.evaluate(o)},D(r,[{key:"astNodeType",get:function(){return"constExpr"}}]),r}(_t),za=function(t){H(r,t);var e=W(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),mp=function(t){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(r);function r(){return C(this,r),e.call(this)}return D(r)}(_t),vp=function(t){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(r);function r(){return C(this,r),e.call(this)}return D(r)}(Vt),gp=function(t){H(r,t);var e=W(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){H(r,t);var e=W(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){H(r,t);var e=W(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}(Vt),wp=function(t){H(r,t);var e=W(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}(Vt),xp=function(t){H(r,t);var e=W(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}(Vt),Va=function(t){H(r,t);var e=W(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}(Vt),E,w;(function(t){t[t.token=0]="token",t[t.keyword=1]="keyword",t[t.reserved=2]="reserved"})(w||(w={}));var x=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)}(),d=D(function t(){C(this,t)});E=d;d.none=new x("",w.reserved,"");d.eof=new x("EOF",w.token,"");d.reserved={asm:new x("asm",w.reserved,"asm"),bf16:new x("bf16",w.reserved,"bf16"),do:new x("do",w.reserved,"do"),enum:new x("enum",w.reserved,"enum"),f16:new x("f16",w.reserved,"f16"),f64:new x("f64",w.reserved,"f64"),handle:new x("handle",w.reserved,"handle"),i8:new x("i8",w.reserved,"i8"),i16:new x("i16",w.reserved,"i16"),i64:new x("i64",w.reserved,"i64"),mat:new x("mat",w.reserved,"mat"),premerge:new x("premerge",w.reserved,"premerge"),regardless:new x("regardless",w.reserved,"regardless"),typedef:new x("typedef",w.reserved,"typedef"),u8:new x("u8",w.reserved,"u8"),u16:new x("u16",w.reserved,"u16"),u64:new x("u64",w.reserved,"u64"),unless:new x("unless",w.reserved,"unless"),using:new x("using",w.reserved,"using"),vec:new x("vec",w.reserved,"vec"),void:new x("void",w.reserved,"void")};d.keywords={array:new x("array",w.keyword,"array"),atomic:new x("atomic",w.keyword,"atomic"),bool:new x("bool",w.keyword,"bool"),f32:new x("f32",w.keyword,"f32"),i32:new x("i32",w.keyword,"i32"),mat2x2:new x("mat2x2",w.keyword,"mat2x2"),mat2x3:new x("mat2x3",w.keyword,"mat2x3"),mat2x4:new x("mat2x4",w.keyword,"mat2x4"),mat3x2:new x("mat3x2",w.keyword,"mat3x2"),mat3x3:new x("mat3x3",w.keyword,"mat3x3"),mat3x4:new x("mat3x4",w.keyword,"mat3x4"),mat4x2:new x("mat4x2",w.keyword,"mat4x2"),mat4x3:new x("mat4x3",w.keyword,"mat4x3"),mat4x4:new x("mat4x4",w.keyword,"mat4x4"),ptr:new x("ptr",w.keyword,"ptr"),sampler:new x("sampler",w.keyword,"sampler"),sampler_comparison:new x("sampler_comparison",w.keyword,"sampler_comparison"),struct:new x("struct",w.keyword,"struct"),texture_1d:new x("texture_1d",w.keyword,"texture_1d"),texture_2d:new x("texture_2d",w.keyword,"texture_2d"),texture_2d_array:new x("texture_2d_array",w.keyword,"texture_2d_array"),texture_3d:new x("texture_3d",w.keyword,"texture_3d"),texture_cube:new x("texture_cube",w.keyword,"texture_cube"),texture_cube_array:new x("texture_cube_array",w.keyword,"texture_cube_array"),texture_multisampled_2d:new x("texture_multisampled_2d",w.keyword,"texture_multisampled_2d"),texture_storage_1d:new x("texture_storage_1d",w.keyword,"texture_storage_1d"),texture_storage_2d:new x("texture_storage_2d",w.keyword,"texture_storage_2d"),texture_storage_2d_array:new x("texture_storage_2d_array",w.keyword,"texture_storage_2d_array"),texture_storage_3d:new x("texture_storage_3d",w.keyword,"texture_storage_3d"),texture_depth_2d:new x("texture_depth_2d",w.keyword,"texture_depth_2d"),texture_depth_2d_array:new x("texture_depth_2d_array",w.keyword,"texture_depth_2d_array"),texture_depth_cube:new x("texture_depth_cube",w.keyword,"texture_depth_cube"),texture_depth_cube_array:new x("texture_depth_cube_array",w.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new x("texture_depth_multisampled_2d",w.keyword,"texture_depth_multisampled_2d"),texture_external:new x("texture_external",w.keyword,"texture_external"),u32:new x("u32",w.keyword,"u32"),vec2:new x("vec2",w.keyword,"vec2"),vec3:new x("vec3",w.keyword,"vec3"),vec4:new x("vec4",w.keyword,"vec4"),bitcast:new x("bitcast",w.keyword,"bitcast"),block:new x("block",w.keyword,"block"),break:new x("break",w.keyword,"break"),case:new x("case",w.keyword,"case"),continue:new x("continue",w.keyword,"continue"),continuing:new x("continuing",w.keyword,"continuing"),default:new x("default",w.keyword,"default"),discard:new x("discard",w.keyword,"discard"),else:new x("else",w.keyword,"else"),enable:new x("enable",w.keyword,"enable"),fallthrough:new x("fallthrough",w.keyword,"fallthrough"),false:new x("false",w.keyword,"false"),fn:new x("fn",w.keyword,"fn"),for:new x("for",w.keyword,"for"),function:new x("function",w.keyword,"function"),if:new x("if",w.keyword,"if"),let:new x("let",w.keyword,"let"),const:new x("const",w.keyword,"const"),loop:new x("loop",w.keyword,"loop"),while:new x("while",w.keyword,"while"),private:new x("private",w.keyword,"private"),read:new x("read",w.keyword,"read"),read_write:new x("read_write",w.keyword,"read_write"),return:new x("return",w.keyword,"return"),storage:new x("storage",w.keyword,"storage"),switch:new x("switch",w.keyword,"switch"),true:new x("true",w.keyword,"true"),alias:new x("alias",w.keyword,"alias"),type:new x("type",w.keyword,"type"),uniform:new x("uniform",w.keyword,"uniform"),var:new x("var",w.keyword,"var"),override:new x("override",w.keyword,"override"),workgroup:new x("workgroup",w.keyword,"workgroup"),write:new x("write",w.keyword,"write"),r8unorm:new x("r8unorm",w.keyword,"r8unorm"),r8snorm:new x("r8snorm",w.keyword,"r8snorm"),r8uint:new x("r8uint",w.keyword,"r8uint"),r8sint:new x("r8sint",w.keyword,"r8sint"),r16uint:new x("r16uint",w.keyword,"r16uint"),r16sint:new x("r16sint",w.keyword,"r16sint"),r16float:new x("r16float",w.keyword,"r16float"),rg8unorm:new x("rg8unorm",w.keyword,"rg8unorm"),rg8snorm:new x("rg8snorm",w.keyword,"rg8snorm"),rg8uint:new x("rg8uint",w.keyword,"rg8uint"),rg8sint:new x("rg8sint",w.keyword,"rg8sint"),r32uint:new x("r32uint",w.keyword,"r32uint"),r32sint:new x("r32sint",w.keyword,"r32sint"),r32float:new x("r32float",w.keyword,"r32float"),rg16uint:new x("rg16uint",w.keyword,"rg16uint"),rg16sint:new x("rg16sint",w.keyword,"rg16sint"),rg16float:new x("rg16float",w.keyword,"rg16float"),rgba8unorm:new x("rgba8unorm",w.keyword,"rgba8unorm"),rgba8unorm_srgb:new x("rgba8unorm_srgb",w.keyword,"rgba8unorm_srgb"),rgba8snorm:new x("rgba8snorm",w.keyword,"rgba8snorm"),rgba8uint:new x("rgba8uint",w.keyword,"rgba8uint"),rgba8sint:new x("rgba8sint",w.keyword,"rgba8sint"),bgra8unorm:new x("bgra8unorm",w.keyword,"bgra8unorm"),bgra8unorm_srgb:new x("bgra8unorm_srgb",w.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new x("rgb10a2unorm",w.keyword,"rgb10a2unorm"),rg11b10float:new x("rg11b10float",w.keyword,"rg11b10float"),rg32uint:new x("rg32uint",w.keyword,"rg32uint"),rg32sint:new x("rg32sint",w.keyword,"rg32sint"),rg32float:new x("rg32float",w.keyword,"rg32float"),rgba16uint:new x("rgba16uint",w.keyword,"rgba16uint"),rgba16sint:new x("rgba16sint",w.keyword,"rgba16sint"),rgba16float:new x("rgba16float",w.keyword,"rgba16float"),rgba32uint:new x("rgba32uint",w.keyword,"rgba32uint"),rgba32sint:new x("rgba32sint",w.keyword,"rgba32sint"),rgba32float:new x("rgba32float",w.keyword,"rgba32float"),static_assert:new x("static_assert",w.keyword,"static_assert")};d.tokens={decimal_float_literal:new x("decimal_float_literal",w.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 x("hex_float_literal",w.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 x("int_literal",w.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new x("uint_literal",w.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new x("ident",w.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new x("and",w.token,"&"),and_and:new x("and_and",w.token,"&&"),arrow:new x("arrow ",w.token,"->"),attr:new x("attr",w.token,"@"),attr_left:new x("attr_left",w.token,"[["),attr_right:new x("attr_right",w.token,"]]"),forward_slash:new x("forward_slash",w.token,"/"),bang:new x("bang",w.token,"!"),bracket_left:new x("bracket_left",w.token,"["),bracket_right:new x("bracket_right",w.token,"]"),brace_left:new x("brace_left",w.token,"{"),brace_right:new x("brace_right",w.token,"}"),colon:new x("colon",w.token,":"),comma:new x("comma",w.token,","),equal:new x("equal",w.token,"="),equal_equal:new x("equal_equal",w.token,"=="),not_equal:new x("not_equal",w.token,"!="),greater_than:new x("greater_than",w.token,">"),greater_than_equal:new x("greater_than_equal",w.token,">="),shift_right:new x("shift_right",w.token,">>"),less_than:new x("less_than",w.token,"<"),less_than_equal:new x("less_than_equal",w.token,"<="),shift_left:new x("shift_left",w.token,"<<"),modulo:new x("modulo",w.token,"%"),minus:new x("minus",w.token,"-"),minus_minus:new x("minus_minus",w.token,"--"),period:new x("period",w.token,"."),plus:new x("plus",w.token,"+"),plus_plus:new x("plus_plus",w.token,"++"),or:new x("or",w.token,"|"),or_or:new x("or_or",w.token,"||"),paren_left:new x("paren_left",w.token,"("),paren_right:new x("paren_right",w.token,")"),semicolon:new x("semicolon",w.token,";"),star:new x("star",w.token,"*"),tilde:new x("tilde",w.token,"~"),underscore:new x("underscore",w.token,"_"),xor:new x("xor",w.token,"^"),plus_equal:new x("plus_equal",w.token,"+="),minus_equal:new x("minus_equal",w.token,"-="),times_equal:new x("times_equal",w.token,"*="),division_equal:new x("division_equal",w.token,"/="),modulo_equal:new x("modulo_equal",w.token,"%="),and_equal:new x("and_equal",w.token,"&="),or_equal:new x("or_equal",w.token,"|="),xor_equal:new x("xor_equal",w.token,"^="),shift_right_equal:new x("shift_right_equal",w.token,">>="),shift_left_equal:new x("shift_left_equal",w.token,"<<=")};d.storage_class=[E.keywords.function,E.keywords.private,E.keywords.workgroup,E.keywords.uniform,E.keywords.storage];d.access_mode=[E.keywords.read,E.keywords.write,E.keywords.read_write];d.sampler_type=[E.keywords.sampler,E.keywords.sampler_comparison];d.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];d.multisampled_texture_type=[E.keywords.texture_multisampled_2d];d.storage_texture_type=[E.keywords.texture_storage_1d,E.keywords.texture_storage_2d,E.keywords.texture_storage_2d_array,E.keywords.texture_storage_3d];d.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];d.texture_external_type=[E.keywords.texture_external];d.any_texture_type=[].concat(jt(E.sampled_texture_type),jt(E.multisampled_texture_type),jt(E.storage_texture_type),jt(E.depth_texture_type),jt(E.texture_external_type));d.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];d.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];d.literal_or_ident=[E.tokens.ident,E.tokens.int_literal,E.tokens.uint_literal,E.tokens.decimal_float_literal,E.tokens.hex_float_literal];d.element_count_expression=[E.tokens.int_literal,E.tokens.uint_literal,E.tokens.ident];d.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(jt(E.any_texture_type));d.attribute_name=[E.tokens.ident,E.keywords.block];d.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];d.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 d.template_types.indexOf(this.type)!=-1},e.isArrayType=function(){return this.type==d.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(d.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=d.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===d.tokens.less_than){f>0&&this._tokens[f-1].isArrayOrTemplateType()&&(s=!0);break}if(s)return this._addToken(a),!0}if(a===d.none){for(var m=n,g=0,S=2,_=0;_<S;++_)if(m+=this._peekAhead(_),a=this._findType(m),a!==d.none){g=_;break}if(a===d.none)return o===d.none?!1:(this._current--,this._addToken(o),!0);n=m,this._current+=g+1}if(o=a,this._isAtEnd())break;n+=this._advance()}return o===d.none?!1:(this._addToken(o),!0)},e._findType=function(n){for(var i in d.keywords){var o=d.keywords[i];if(this._match(n,o.rule))return o}for(var a in d.tokens){var u=d.tokens[a];if(this._match(n,u.rule))return u}return d.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==d.eof},e._match=function(n){if(n instanceof x)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(d.tokens.semicolon)&&!this._isAtEnd(););if(this._match(d.keywords.alias)){var n=this._type_alias();return this._consume(d.tokens.semicolon,"Expected ';'"),n}if(this._match(d.keywords.enable)){var i=this._enable_directive();return this._consume(d.tokens.semicolon,"Expected ';'"),i}var o=this._attribute();if(this._check(d.keywords.var)){var a=this._global_variable_decl();return a!=null&&(a.attributes=o),this._consume(d.tokens.semicolon,"Expected ';'."),a}if(this._check(d.keywords.override)){var u=this._override_variable_decl();return u!=null&&(u.attributes=o),this._consume(d.tokens.semicolon,"Expected ';'."),u}if(this._check(d.keywords.let)){var s=this._global_let_decl();return s!=null&&(s.attributes=o),this._consume(d.tokens.semicolon,"Expected ';'."),s}if(this._check(d.keywords.const)){var f=this._global_const_decl();return f!=null&&(f.attributes=o),this._consume(d.tokens.semicolon,"Expected ';'."),f}if(this._check(d.keywords.struct)){var p=this._struct_decl();return p!=null&&(p.attributes=o),p}if(this._check(d.keywords.fn)){var m=this._function_decl();return m!=null&&(m.attributes=o),m}return null},e._function_decl=function(){if(!this._match(d.keywords.fn))return null;var n=this._consume(d.tokens.ident,"Expected function name.").toString();this._consume(d.tokens.paren_left,"Expected '(' for function arguments.");var i=[];if(!this._check(d.tokens.paren_right))do{if(this._check(d.tokens.paren_right))break;var o=this._attribute(),a=this._consume(d.tokens.ident,"Expected argument name.").toString();this._consume(d.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(d.tokens.comma));this._consume(d.tokens.paren_right,"Expected ')' after function arguments.");var f=null;if(this._match(d.tokens.arrow)){var p=this._attribute();f=this._type_decl(),f!=null&&(f.attributes=p)}var m=this._compound_statement();return new Xa(n,i,f,m)},e._compound_statement=function(){var n=[];for(this._consume(d.tokens.brace_left,"Expected '{' for block.");!this._check(d.tokens.brace_right);){var i=this._statement();i!==null&&n.push(i)}return this._consume(d.tokens.brace_right,"Expected '}' for block."),n},e._statement=function(){for(;this._match(d.tokens.semicolon)&&!this._isAtEnd(););if(this._check(d.keywords.if))return this._if_statement();if(this._check(d.keywords.switch))return this._switch_statement();if(this._check(d.keywords.loop))return this._loop_statement();if(this._check(d.keywords.for))return this._for_statement();if(this._check(d.keywords.while))return this._while_statement();if(this._check(d.keywords.continuing))return this._continuing_statement();if(this._check(d.keywords.static_assert))return this._static_assert_statement();if(this._check(d.tokens.brace_left))return this._compound_statement();var n=null;return this._check(d.keywords.return)?n=this._return_statement():this._check([d.keywords.var,d.keywords.let,d.keywords.const])?n=this._variable_statement():this._match(d.keywords.discard)?n=new fp:this._match(d.keywords.break)?n=new cp:this._match(d.keywords.continue)?n=new lp:n=this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),n!=null&&this._consume(d.tokens.semicolon,"Expected ';' after statement."),n},e._static_assert_statement=function(){if(!this._match(d.keywords.static_assert))return null;var n=this._optional_paren_expression();return new Zh(n)},e._while_statement=function(){if(!this._match(d.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(d.keywords.continuing))return null;var n=this._compound_statement();return new Qh(n)},e._for_statement=function(){if(!this._match(d.keywords.for))return null;this._consume(d.tokens.paren_left,"Expected '('.");var n=this._check(d.tokens.semicolon)?null:this._for_init();this._consume(d.tokens.semicolon,"Expected ';'.");var i=this._check(d.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(d.tokens.semicolon,"Expected ';'.");var o=this._check(d.tokens.paren_right)?null:this._for_increment();this._consume(d.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(d.keywords.var)){var n=this._variable_decl();if(n===null)throw this._error(this._peek(),"Variable declaration expected.");var i=null;return this._match(d.tokens.equal)&&(i=this._short_circuit_or_expression()),new ie(n.name,n.type,n.storage,n.access,i)}if(this._match(d.keywords.let)){var o=this._consume(d.tokens.ident,"Expected name for let.").toString(),a=null;if(this._match(d.tokens.colon)){var u=this._attribute();a=this._type_decl(),a!=null&&(a.attributes=u)}this._consume(d.tokens.equal,"Expected '=' for let.");var s=this._short_circuit_or_expression();return new Ca(o,a,null,null,s)}if(this._match(d.keywords.const)){var f=this._consume(d.tokens.ident,"Expected name for const.").toString(),p=null;if(this._match(d.tokens.colon)){var m=this._attribute();p=this._type_decl(),p!=null&&(p.attributes=m)}this._consume(d.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(d.increment_operators))return this._current=n,null;var o=this._consume(d.increment_operators,"Expected increment operator");return new ep(o.type===d.tokens.plus_plus?se.increment:se.decrement,i)},e._assignment_statement=function(){var n=null;if(this._check(d.tokens.brace_right))return null;var i=this._match(d.tokens.underscore);if(i||(n=this._unary_expression()),!i&&n==null)return null;var o=this._consume(d.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(d.tokens.ident))return null;var n=this._current,i=this._consume(d.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(d.keywords.loop))return null;this._consume(d.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(d.keywords.continuing)&&(s=this._compound_statement()),this._consume(d.tokens.brace_right,"Expected '}' for loop."),new ip(n,s)},e._switch_statement=function(){if(!this._match(d.keywords.switch))return null;var n=this._optional_paren_expression();this._consume(d.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(d.tokens.brace_right,"Expected '}' for switch."),new op(n,i)},e._switch_body=function(){var n=[];if(this._match(d.keywords.case)){var i=this._case_selectors();this._match(d.tokens.colon),this._consume(d.tokens.brace_left,"Exected '{' for switch case.");var o=this._case_body();this._consume(d.tokens.brace_right,"Exected '}' for switch case."),n.push(new gp(i,o))}if(this._match(d.keywords.default)){this._match(d.tokens.colon),this._consume(d.tokens.brace_left,"Exected '{' for switch default.");var a=this._case_body();this._consume(d.tokens.brace_right,"Exected '}' for switch default."),n.push(new _p(a))}if(this._check([d.keywords.default,d.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(d.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(d.keywords.fallthrough))return this._consume(d.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(jt(n),[i[0]])},e._if_statement=function(){if(!this._match(d.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(d.keywords.else)&&(a=this._compound_statement()),new ap(n,i,o,a)},e._match_elseif=function(){return this._tokens[this._current].type===d.keywords.else&&this._tokens[this._current+1].type===d.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(d.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(d.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(d.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(d.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(d.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(d.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([d.tokens.equal_equal,d.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([d.tokens.less_than,d.tokens.greater_than,d.tokens.less_than_equal,d.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([d.tokens.shift_left,d.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([d.tokens.plus,d.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([d.tokens.star,d.tokens.forward_slash,d.tokens.modulo]);)n=new gt(this._previous().toString(),n,this._unary_expression());return n},e._unary_expression=function(){return this._match([d.tokens.minus,d.tokens.bang,d.tokens.tilde,d.tokens.star,d.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(d.tokens.bracket_left)){var n=this._short_circuit_or_expression();this._consume(d.tokens.bracket_right,"Expected ']'.");var i=this._postfix_expression();return i&&(n.postfix=i),n}if(this._match(d.tokens.period)){var o=this._consume(d.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(d.tokens.ident)){var n=this._previous().toString();if(this._check(d.tokens.paren_left)){var i=this._argument_expression_list(),o=this._getStruct(n);return o!=null?new We(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 dp(n)}if(this._match(d.const_literal))return new za(parseFloat(this._previous().toString()));if(this._check(d.tokens.paren_left))return this._paren_expression();if(this._match(d.keywords.bitcast)){this._consume(d.tokens.less_than,"Expected '<'.");var u=this._type_decl();this._consume(d.tokens.greater_than,"Expected '>'.");var s=this._paren_expression();return new mp(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(d.tokens.paren_left))return null;var n=[];do{if(this._check(d.tokens.paren_right))break;var i=this._short_circuit_or_expression();n.push(i)}while(this._match(d.tokens.comma));return this._consume(d.tokens.paren_right,"Expected ')' for agument list"),n},e._optional_paren_expression=function(){this._match(d.tokens.paren_left);var n=this._short_circuit_or_expression();return this._match(d.tokens.paren_right),new Ba([n])},e._paren_expression=function(){this._consume(d.tokens.paren_left,"Expected '('.");var n=this._short_circuit_or_expression();return this._consume(d.tokens.paren_right,"Expected ')'."),new Ba([n])},e._struct_decl=function(){if(!this._match(d.keywords.struct))return null;var n=this._consume(d.tokens.ident,"Expected name for struct.").toString();this._consume(d.tokens.brace_left,"Expected '{' for struct body.");for(var i=[];!this._check(d.tokens.brace_right);){var o=this._attribute(),a=this._consume(d.tokens.ident,"Expected variable name.").toString();this._consume(d.tokens.colon,"Expected ':' for struct member type.");var u=this._attribute(),s=this._type_decl();s!=null&&(s.attributes=u),this._check(d.tokens.brace_right)?this._match(d.tokens.comma):this._consume(d.tokens.comma,"Expected ',' for struct member."),i.push(new xp(a,s,o))}this._consume(d.tokens.brace_right,"Expected '}' after struct body.");var f=new Bt(n,i);return this._context.structs.set(n,f),f},e._global_variable_decl=function(){var n=this._variable_decl();return n&&this._match(d.tokens.equal)&&(n.value=this._const_expression()),n},e._override_variable_decl=function(){var n=this._override_decl();return n&&this._match(d.tokens.equal)&&(n.value=this._const_expression()),n},e._global_const_decl=function(){if(!this._match(d.keywords.const))return null;var n=this._consume(d.tokens.ident,"Expected variable name"),i=null;if(this._match(d.tokens.colon)){var o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}var a=null;if(this._match(d.tokens.equal)){var u=this._short_circuit_or_expression();if(u instanceof We)a=u;else if(u instanceof Ga&&u.initializer instanceof We)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(d.keywords.let))return null;var n=this._consume(d.tokens.ident,"Expected variable name"),i=null;if(this._match(d.tokens.colon)){var o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}var a=null;return this._match(d.tokens.equal)&&(a=this._const_expression()),new Ca(n.toString(),i,"","",a)},e._const_expression=function(){if(this._match(d.const_literal))return new Ua(this._previous().toString());var n=this._type_decl();this._consume(d.tokens.paren_left,"Expected '('.");for(var i=[];!this._check(d.tokens.paren_right)&&(i.push(this._const_expression()),!!this._check(d.tokens.comma));)this._advance();return this._consume(d.tokens.paren_right,"Expected ')'."),new We(n,i)},e._variable_decl=function(){if(!this._match(d.keywords.var))return null;var n="",i="";this._match(d.tokens.less_than)&&(n=this._consume(d.storage_class,"Expected storage_class.").toString(),this._match(d.tokens.comma)&&(i=this._consume(d.access_mode,"Expected access_mode.").toString()),this._consume(d.tokens.greater_than,"Expected '>'."));var o=this._consume(d.tokens.ident,"Expected variable name"),a=null;if(this._match(d.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(d.keywords.override))return null;var n=this._consume(d.tokens.ident,"Expected variable name"),i=null;if(this._match(d.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(d.tokens.ident,"identity expected.");return new up(n.toString())},e._type_alias=function(){var n=this._consume(d.tokens.ident,"identity expected.");this._consume(d.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([d.tokens.ident].concat(jt(d.texel_format),[d.keywords.bool,d.keywords.f32,d.keywords.i32,d.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 qt(n.toString())}var o=this._texture_sampler_types();if(o)return o;if(this._check(d.template_types)){var a=this._advance().toString(),u=null,s=null;return this._match(d.tokens.less_than)&&(u=this._type_decl(),s=null,this._match(d.tokens.comma)&&(s=this._consume(d.access_mode,"Expected access_mode for pointer").toString()),this._consume(d.tokens.greater_than,"Expected '>' for type.")),new Ja(a,u,s)}if(this._match(d.keywords.ptr)){var f=this._previous().toString();this._consume(d.tokens.less_than,"Expected '<' for pointer.");var p=this._consume(d.storage_class,"Expected storage_class for pointer");this._consume(d.tokens.comma,"Expected ',' for pointer.");var m=this._type_decl(),g=null;return this._match(d.tokens.comma)&&(g=this._consume(d.access_mode,"Expected access_mode for pointer").toString()),this._consume(d.tokens.greater_than,"Expected '>' for pointer."),new hp(f,p.toString(),m,g)}var S=this._attribute();if(this._match(d.keywords.array)){var _=null,O=-1,k=this._previous();if(this._match(d.tokens.less_than)){_=this._type_decl(),this._context.aliases.has(_.name)&&(_=this._context.aliases.get(_.name).type);var P="";if(this._match(d.tokens.comma)){var I=this._shift_expression();P=I.evaluate(this._context).toString()}this._consume(d.tokens.greater_than,"Expected '>' for array."),O=P?parseInt(P):0}return new Qa(k.toString(),S,_,O)}return null},e._texture_sampler_types=function(){if(this._match(d.sampler_type))return new He(this._previous().toString(),null,null);if(this._match(d.depth_texture_type))return new He(this._previous().toString(),null,null);if(this._match(d.sampled_texture_type)||this._match(d.multisampled_texture_type)){var n=this._previous();this._consume(d.tokens.less_than,"Expected '<' for sampler type.");var i=this._type_decl();return this._consume(d.tokens.greater_than,"Expected '>' for sampler type."),new He(n.toString(),i,null)}if(this._match(d.storage_texture_type)){var o=this._previous();this._consume(d.tokens.less_than,"Expected '<' for sampler type.");var a=this._consume(d.texel_format,"Invalid texel format.").toString();this._consume(d.tokens.comma,"Expected ',' after texel format.");var u=this._consume(d.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(d.tokens.greater_than,"Expected '>' for sampler type."),new He(o.toString(),a,u)}return null},e._attribute=function(){for(var n=[];this._match(d.tokens.attr);){var i=this._consume(d.attribute_name,"Expected attribute name"),o=new Va(i.toString(),null);if(this._match(d.tokens.paren_left)){if(o.value=this._consume(d.literal_or_ident,"Expected attribute value").toString(),this._check(d.tokens.comma)){this._advance();do{var a=this._consume(d.literal_or_ident,"Expected attribute value").toString();o.value instanceof Array||(o.value=[o.value]),o.value.push(a)}while(this._match(d.tokens.comma))}this._consume(d.tokens.paren_right,"Expected ')'")}n.push(o)}for(;this._match(d.tokens.attr_left);){if(!this._check(d.tokens.attr_right))do{var u=this._consume(d.attribute_name,"Expected attribute name"),s=new Va(u.toString(),null);if(this._match(d.tokens.paren_left)){if(s.value=[this._consume(d.literal_or_ident,"Expected attribute value").toString()],this._check(d.tokens.comma)){this._advance();do{var f=this._consume(d.literal_or_ident,"Expected attribute value").toString();s.value.push(f)}while(this._match(d.tokens.comma))}this._consume(d.tokens.paren_right,"Expected ')'")}n.push(s)}while(this._match(d.tokens.comma));this._consume(d.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}(),Ha=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){H(r,t);var e=W(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){H(r,t);var e=W(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),Wa=function(t){H(r,t);var e=W(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),Lt;(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"})(Lt||(Lt={}));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 Bt){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,m=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,m));continue}if(this._isUniformVar(s)){var S=s,_=this._getAttributeNum(S.attributes,"group",0),O=this._getAttributeNum(S.attributes,"binding",0),k=this._getTypeInfo(S.type,S.attributes),P=new Or(S.name,k,_,O,S.attributes,Lt.Uniform,S.access);this.uniforms.push(P);continue}if(this._isStorageVar(s)){var I=s,A=this._getAttributeNum(I.attributes,"group",0),L=this._getAttributeNum(I.attributes,"binding",0),M=this._getTypeInfo(I.type,I.attributes),j=this._isStorageTexture(M),U=new Or(I.name,M,A,L,I.attributes,j?Lt.StorageTexture:Lt.Storage,I.access);this.storage.push(U);continue}if(this._isTextureVar(s)){var F=s,V=this._getAttributeNum(F.attributes,"group",0),z=this._getAttributeNum(F.attributes,"binding",0),B=this._getTypeInfo(F.type,F.attributes),h=this._isStorageTexture(B),c=new Or(F.name,B,V,z,F.attributes,h?Lt.StorageTexture:Lt.Texture,F.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,Lt.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"),G=R||N||q;if(G){var K=new Ap(s.name,G.name);K.inputs=this._getInputs(s.args),K.outputs=this._getOutputs(s.returnType),this.entry[G.name].push(K)}continue}}}catch(ct){a.e(ct)}finally{a.f()}},e.getBindGroups=function(){var n=[];function i(M,j){M>=n.length&&(n.length=M+1),n[M]===void 0&&(n[M]=[]),j>=n[M].length&&(n[M].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(M){o.e(M)}finally{o.f()}var f=st(this.storage),p;try{for(f.s();!(p=f.n()).done;){var m=p.value;i(m.group,m.binding);var g=n[m.group];g[m.binding]=m}}catch(M){f.e(M)}finally{f.f()}var S=st(this.textures),_;try{for(S.s();!(_=S.n()).done;){var O=_.value;i(O.group,O.binding);var k=n[O.group];k[O.binding]=O}}catch(M){S.e(M)}finally{S.f()}var P=st(this.samplers),I;try{for(P.s();!(I=P.n()).done;){var A=I.value;i(A.group,A.binding);var L=n[A.group];L[A.binding]=A}}catch(M){P.e(M)}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 Bt)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 Bt)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),m=new Ka(u.name,f,s.name,p);i.push(m)}}}}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 Bt)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 Bt)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 Bt){var s=n,f=new Sr(s.name,i),p=st(s.members),m;try{for(p.s();!(m=p.n()).done;){var g=m.value,S=this._getTypeInfo(g.type,g.attributes);f.members.push(new Ha(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 He){var _=n,O=_.format instanceof qt,k=_.format?O?this._getTypeInfo(_.format,null):new oe(_.format,null):null,P=new Wa(_.name,k,i,_.access);return this._types.set(n,P),this._updateTypeInfo(P),P}if(n instanceof Ja){var I=n,A=I.format?this._getTypeInfo(I.format,null):null,L=new Wa(I.name,A,i,I.access);return this._types.set(n,L),this._updateTypeInfo(L),L}var M=new oe(n.name,i);return this._types.set(n,M),this._updateTypeInfo(M),M},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 m=n.members[f],g=this._getTypeSize(m);if(g){(i=this._getAlias(m.type.name))!==null&&i!==void 0||m.type;var S=g.align,_=g.size;o=this._roundUp(S,o+a),a=_,u=o,s=Math.max(s,S),m.offset=o,m.size=_,this._updateTypeInfo(m.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 Ha&&(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 m=n.name[n.name.length-1]==="h"?2:1;return new Pr(Math.max(a,p.align/m),Math.max(o,p.size/m))}}if(n instanceof En){var g=n,S=8,_=8,O=this._getTypeSize(g.format);O!==null&&(_=O.size,S=O.align);var k=g.count,P=this._getAttributeNum((i=n?.attributes)!==null&&i!==void 0?i:null,"stride",this._roundUp(S,_));return _=k*P,o&&(_=o),new Pr(Math.max(a,S),Math.max(o,_))}if(n instanceof Sr){var I=0,A=0,L=0,M=0,j=0,U=st(n.members),F;try{for(U.s();!(F=U.n()).done;){var V=F.value,z=this._getTypeSize(V.type);z!==null&&(I=Math.max(z.align,I),L=this._roundUp(z.align,L+M),M=z.size,j=L)}}catch(B){U.e(B)}finally{U.f()}return A=this._roundUp(I,j+M),new Pr(Math.max(a,I),Math.max(o,A))}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=d.any_texture_type.map(function(t){return t.name});Ye._samplerTypes=d.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],m=p.inputs.length,g=0;g<m;g++){var S=p.inputs[g];if(S.locationType==="location"){var _=is(S.type);e.attributes.push({name:S.name,location:S.location,type:_})}}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,m=o*u-n*f,g=n*s-i*u,S=i*g-o*m,_=o*p-n*g,O=n*m-i*p,k=a*2;return p*=k,m*=k,g*=k,S*=2,_*=2,O*=2,t[0]=u+p+S,t[1]=s+m+_,t[2]=f+g+O,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[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 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[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 ds(this,this,r,e),this.check()}rotateY({radians:e,origin:r=Rn}){return ms(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],m=e[9],g=e[10],S=e[11],_=e[12],O=e[13],k=e[14],P=e[15],I=r*u-n*a,A=r*s-i*a,L=r*f-o*a,M=n*s-i*u,j=n*f-o*u,U=i*f-o*s,F=p*O-m*_,V=p*k-g*_,z=p*P-S*_,B=m*k-g*O,h=m*P-S*O,c=g*P-S*k,l=I*c-A*h+L*B+M*z-j*V+U*F;return l?(l=1/l,t[0]=(u*c-s*h+f*B)*l,t[1]=(i*h-n*c-o*B)*l,t[2]=(O*U-k*j+P*M)*l,t[3]=(g*j-m*U-S*M)*l,t[4]=(s*z-a*c-f*V)*l,t[5]=(r*c-i*z+o*V)*l,t[6]=(k*L-_*U-P*A)*l,t[7]=(p*U-g*L+S*A)*l,t[8]=(a*h-u*z+f*F)*l,t[9]=(n*z-r*h-o*F)*l,t[10]=(_*j-O*L+P*I)*l,t[11]=(m*L-p*j-S*I)*l,t[12]=(u*V-a*B-s*F)*l,t[13]=(r*B-n*V+i*F)*l,t[14]=(O*A-_*M-k*I)*l,t[15]=(p*M-m*A+g*I)*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],m=t[10],g=t[11],S=t[12],_=t[13],O=t[14],k=t[15],P=e*a-r*o,I=e*u-n*o,A=r*u-n*a,L=f*_-p*S,M=f*O-m*S,j=p*O-m*_,U=e*j-r*M+n*L,F=o*j-a*M+u*L,V=f*A-p*I+m*P,z=S*A-_*I+O*P;return s*U-i*F+k*V-g*z}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],m=e[8],g=e[9],S=e[10],_=e[11],O=e[12],k=e[13],P=e[14],I=e[15],A=r[0],L=r[1],M=r[2],j=r[3];return t[0]=A*n+L*u+M*m+j*O,t[1]=A*i+L*s+M*g+j*k,t[2]=A*o+L*f+M*S+j*P,t[3]=A*a+L*p+M*_+j*I,A=r[4],L=r[5],M=r[6],j=r[7],t[4]=A*n+L*u+M*m+j*O,t[5]=A*i+L*s+M*g+j*k,t[6]=A*o+L*f+M*S+j*P,t[7]=A*a+L*p+M*_+j*I,A=r[8],L=r[9],M=r[10],j=r[11],t[8]=A*n+L*u+M*m+j*O,t[9]=A*i+L*s+M*g+j*k,t[10]=A*o+L*f+M*S+j*P,t[11]=A*a+L*p+M*_+j*I,A=r[12],L=r[13],M=r[14],j=r[15],t[12]=A*n+L*u+M*m+j*O,t[13]=A*i+L*s+M*g+j*k,t[14]=A*o+L*f+M*S+j*P,t[15]=A*a+L*p+M*_+j*I,t}function ws(t,e,r){let n=r[0],i=r[1],o=r[2],a,u,s,f,p,m,g,S,_,O,k,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],m=e[5],g=e[6],S=e[7],_=e[8],O=e[9],k=e[10],P=e[11],t[0]=a,t[1]=u,t[2]=s,t[3]=f,t[4]=p,t[5]=m,t[6]=g,t[7]=S,t[8]=_,t[9]=O,t[10]=k,t[11]=P,t[12]=a*n+p*i+_*o+e[12],t[13]=u*n+m*i+O*o+e[13],t[14]=s*n+g*i+k*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,m,g,S,_,O,k,P,I,A,L,M,j,U,F,V,z,B,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,m=e[0],g=e[1],S=e[2],_=e[3],O=e[4],k=e[5],P=e[6],I=e[7],A=e[8],L=e[9],M=e[10],j=e[11],U=i*i*p+s,F=o*i*p+a*f,V=a*i*p-o*f,z=i*o*p-a*f,B=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]=m*U+O*F+A*V,t[1]=g*U+k*F+L*V,t[2]=S*U+P*F+M*V,t[3]=_*U+I*F+j*V,t[4]=m*z+O*B+A*h,t[5]=g*z+k*B+L*h,t[6]=S*z+P*B+M*h,t[7]=_*z+I*B+j*h,t[8]=m*c+O*l+A*y,t[9]=g*c+k*l+L*y,t[10]=S*c+P*l+M*y,t[11]=_*c+I*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],m=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+m*n,t[7]=s*i+g*n,t[8]=f*i-o*n,t[9]=p*i-a*n,t[10]=m*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],m=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-m*n,t[3]=s*i-g*n,t[8]=o*n+f*i,t[9]=a*n+p*i,t[10]=u*n+m*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],m=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+m*n,t[3]=s*i+g*n,t[4]=f*i-o*n,t[5]=p*i-a*n,t[6]=m*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,m=n*u,g=i*a,S=i*u,_=i*s,O=o*a,k=o*u,P=o*s;return t[0]=1-m-_,t[1]=p+P,t[2]=g-k,t[3]=0,t[4]=p-P,t[5]=1-f-_,t[6]=S+O,t[7]=0,t[8]=g+k,t[9]=S-O,t[10]=1-f-m,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,m,g,S,_=e[0],O=e[1],k=e[2],P=n[0],I=n[1],A=n[2],L=r[0],M=r[1],j=r[2];return Math.abs(_-L)<1e-6&&Math.abs(O-M)<1e-6&&Math.abs(k-j)<1e-6?Up(t):(m=_-L,g=O-M,S=k-j,i=1/Math.sqrt(m*m+g*g+S*S),m*=i,g*=i,S*=i,o=I*S-A*g,a=A*m-P*S,u=P*g-I*m,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-m*u,p=m*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]=m,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*_+a*O+u*k),t[13]=-(s*_+f*O+p*k),t[14]=-(m*_+g*O+S*k),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,Hp=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),mt=class extends jr{static get IDENTITY(){return Kp()}static get ZERO(){return Wp()}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,m,g,S,_,O,k){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]=m,this[11]=g,this[12]=S,this[13]=_,this[14]=O,this[15]=k,this.check()}setRowMajor(e,r,n,i,o,a,u,s,f,p,m,g,S,_,O,k){return this[0]=e,this[1]=o,this[2]=f,this[3]=S,this[4]=r,this[5]=a,this[6]=p,this[7]=_,this[8]=n,this[9]=u,this[10]=m,this[11]=O,this[12]=i,this[13]=s,this[14]=g,this[15]=k,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(Hp)}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 Wp(){return Nr||(Nr=new mt([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 mt,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,m=-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]=m,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 td(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=ed(t,"string");return Xe(e)==="symbol"?e:String(e)}function ed(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 rd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Cr=function(){function t(r){rd(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 m=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({},m),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 m,g=Cn(p[f],2),S=g[0],_=g[1];n["".concat(u,".").concat(S)]={type:(m=this.modules[u].uniformTypes)===null||m===void 0?void 0:m[S],value:String(_)}}return n},td(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 nd(t,e){return sd(t)||ad(t,e)||od(t,e)||id()}function id(){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 od(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 ad(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 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,fd(n.key),n)}}function ud(t,e,r){return e&&Gs(t.prototype,e),r&&Gs(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fd(t){var e=cd(t,"string");return $e(e)==="symbol"?e:String(e)}function cd(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 ld(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Fr=function(){function t(r){ld(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},ud(t)}();function zs(t,e){if(e instanceof Fr)return e;var r=hd(t,e),n=pd(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 hd(t,e){if(e.indices){var r=e.indices.value;return t.createBuffer({usage:$.INDEX,data:r})}}function pd(t,e){for(var r=[],n={},i=0,o=Object.entries(e.attributes);i<o.length;i++){var a=nd(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,m=s.size,g=s.normalized;r.push({name:f,format:yn(p,m,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 Ot(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){dd(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 dd(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 md(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=yd(t,"string");return Ze(e)==="symbol"?e:String(e)}function yd(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 vd(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){vd(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=Ot(Ot({},t.defaultProps),n),o=this._hashRenderPipeline(Ot({},i));if(!this._pipelineCache[o]){var a=this.device.createRenderPipeline(Ot(Ot({},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._createRenderPipeline=function(n){if(!n.fs)throw new Error("fs");var i=this.device.createRenderPipeline(Ot(Ot({},n),{},{vs:this.device.createShader({stage:"vertex",source:n.vs}),fs:n.fs?this.device.createShader({stage:"fragment",source:n.fs}):null}));return 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]},md(t)}();Je.defaultProps=Ot(Ot({},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 Hs(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=gd(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 gd(t,e){if(t){if(typeof t=="string")return Ws(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 Ws(t,e)}}function Ws(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=_d(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _d(t){var e=bd(t,"string");return Qe(e)==="symbol"?e:String(e)}function bd(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=Hs(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=Hs(t.varyings||[]),p;try{for(f.s();!(p=f.n()).done;){var m=p.value,g="".concat(m.location," ").concat(m.name);n["out ".concat(g)]=Fn({},i,JSON.stringify(m.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 m=t.device.readPixelsToArrayWebGL(t),g=Un.createImageData(t.width,t.height),S=0,_=0;_<m.length;_+=4)g.data[S+_+0]=m[_+0]*p,g.data[S+_+1]=m[_+1]*p,g.data[S+_+2]=m[_+2]*p,g.data[S+_+3]=i?255:m[_+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 wd(t){return Od(t)||Sd(t)||zn(t)||xd()}function xd(){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 Sd(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Od(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 Ad(t)||Ed(t,e)||zn(t,e)||Pd()}function Pd(){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 Ed(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 Ad(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 Pt(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){Td(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 Td(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 kd(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=Md(t,"string");return er(e)==="symbol"?e:String(e)}function Md(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 Id(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var le=2,Rd=1e4,bt=function(){function t(r,n){var i,o,a;Id(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=Pt(Pt({},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 m=Ld(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(Pt(Pt({platformInfo:m},this.props),{},{modules:g})),_=S.vs,O=S.fs,k=S.getUniforms;if(this.vs=_,this.fs=O,this._getModuleUniforms=k,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),this.pipeline.draw({renderPass:n,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,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(this.bufferLayout,i.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i),i},e._setGeometryAttributes=function(n){for(var i=this,o=Pt({},n.attributes),a=function(){var p=tr(s[u],1),m=p[0];!i.pipeline.shaderLayout.attributes.find(function(g){return g.name===m})&&m!=="positions"&&delete o[m]},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 dn(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 m=i[p];return!dt(m)&&typeof m!="number"&&typeof m!="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 m=tr(s[u],2),g=m[0],S=m[1],_=o.bufferLayout.find(function(M){return Js(M).includes(g)});if(!_)return Y.warn("Model(".concat(o.id,'): Missing layout for buffer "').concat(g,'".'))(),"continue";for(var O=Js(_),k=!1,P=0,I=O;P<I.length;P++){var A=I[P],L=o._attributeInfos[A];L&&(o.vertexArray.setBuffer(L.location,S),k=!0)}!k&&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(Pt(Pt({},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:Rd;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=mn(i),a=n instanceof $?new o(n.debugData):n;return a.toString()},kd(t)}();bt.defaultProps=Pt(Pt({},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=wd(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 Ld(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 jd(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){Nd(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 Nd(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 Dd(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=Cd(t,"string");return rr(e)==="symbol"?e:String(e)}function Cd(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 Fd(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;Fd(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,jd({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)},Dd(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){Ud(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 Ud(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 Gd(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=zd(t,"string");return nr(e)==="symbol"?e:String(e)}function zd(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 Bd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Vd="transform_output",fu=function(){function t(r,n){Bd(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:Vd}),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},Gd(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 qd(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){Hd(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 Hd(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 Wd(t,e){return $d(t)||Xd(t,e)||Yd(t,e)||Kd()}function Kd(){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 Yd(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 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 $d(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 Zd(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=Jd(t,"string");return ir(e)==="symbol"?e:String(e)}function Jd(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 Qd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var ut=function(){function t(r){Qd(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 m=Wd(p[f],2),g=m[0],S=m[1],_=ArrayBuffer.isView(S)?{value:S}:S;et(ArrayBuffer.isView(_.value),"".concat(this._print(g),": must be typed array or object with value as typed array")),(g==="POSITION"||g==="positions")&&!_.size&&(_.size=3),g==="indices"?(et(!this.indices),this.indices=_):this.attributes[g]=_}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?qd({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,m=s.constant;!m&&f&&p>=1&&(o=Math.min(o,f.length/p))}return et(Number.isFinite(o)),o},Zd(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 du;function mu(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?mu(Object(r),!0).forEach(function(n){tm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mu(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function tm(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 em(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=rm(t,"string");return he(e)==="symbol"?e:String(e)}function rm(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 nm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function im(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 om(t){var e=um();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 am(this,i)}}function am(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 sm(t)}function sm(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function um(){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 fm(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var cm=go(du||(du=fm([`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){im(r,t);var e=om(r);function r(n,i){nm(this,r);var o=gu.map(function(a){return a===-1?0:a});return e.call(this,n,yu(yu({},i),{},{vs:cm,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 em(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,hm(n.key),n)}}function lm(t,e,r){return e&&wu(t.prototype,e),r&&wu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hm(t){var e=pm(t,"string");return or(e)==="symbol"?e:String(e)}function pm(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 dm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Ht=function(){function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dm(this,t),this.id=void 0,this.matrix=new mt,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 mt(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)},lm(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 mm(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Hn(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 ym(t){return _m(t)||gm(t)||Hn(t)||vm()}function vm(){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 gm(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function _m(t){if(Array.isArray(t))return Vn(t)}function bm(t,e){return Sm(t)||xm(t,e)||Hn(t,e)||wm()}function wm(){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 Hn(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 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 Sm(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,Pm(n.key),n)}}function Om(t,e,r){return e&&xu(t.prototype,e),r&&xu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Pm(t){var e=Em(t,"string");return pe(e)==="symbol"?e:String(e)}function Em(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 Am(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=Tm(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 Tm(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=de(t),t!==null););return t}function km(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 Mm(t){var e=Lm();return function(){var n=de(t),i;if(e){var o=de(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Im(this,i)}}function Im(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 Rm(t)}function Rm(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Lm(){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 de(t){return de=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},de(t)}var Su=function(t){km(r,t);var e=Mm(r);function r(){var i,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Am(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 Ht}),"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=bm(f,2),m=p[0],g=p[1],S=new at(m).add(g).divide([2,2,2]);s.transformAsPoint(S,S);var _=new at(g).subtract(m).divide([2,2,2]);s.transformAsVector(_,_);for(var O=0;O<8;O++)for(var k=new at(O&1?-1:1,O&2?-1:1,O&4?-1:1).multiply(_).add(S),P=0;P<3;P++)o[0][P]=Math.min(o[0][P],k[P]),o[1][P]=Math.max(o[1][P],k[P])}}),Number.isFinite(o[0][0])?o:null},n.destroy=function(){this.children.forEach(function(o){return o.destroy()}),this.removeAll(),Gr(de(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,ym(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 mt:u,f=new mt(s).multiplyRight(this.matrix),p=mm(this.children),m;try{for(p.s();!(m=p.n()).done;){var g=m.value;g instanceof r?g.traverse(o,{worldMatrix:f}):o(g,{worldMatrix:f})}}catch(S){p.e(S)}finally{p.f()}},Om(r)}(Ht);function me(t){return me=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},me(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,Nm(n.key),n)}}function jm(t,e,r){return e&&Ou(t.prototype,e),r&&Ou(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Nm(t){var e=Dm(t,"string");return me(e)==="symbol"?e:String(e)}function Dm(t,e){if(me(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(me(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Cm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fm(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&&Wn(t,e)}function Wn(t,e){return Wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Wn(t,e)}function Um(t){var e=Bm();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 Gm(this,i)}}function Gm(t,e){if(e&&(me(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zm(t)}function zm(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Bm(){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){Fm(r,t);var e=Um(r);function r(i){var o;return Cm(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)},jm(r)}(Ht);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){Vm(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 Vm(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 qm(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=Hm(t,"string");return ye(e)==="symbol"?e:String(e)}function Hm(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 Wm(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Km(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 Ym(t){var e=Zm();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 Xm(this,i)}}function Xm(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 $m(t)}function $m(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zm(){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 Jm={x:[2,0,1],y:[0,1,2],z:[1,2,0]},ve=function(t){Km(r,t);var e=Ym(r);function r(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wm(this,r);var i=n.id,o=i===void 0?X("truncated-code-geometry"):i,a=Qm(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 qm(r)}(ut);function Qm(){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,m=t.verticalAxis,g=m===void 0?"y":m,S=t.topCap,_=S===void 0?!1:S,O=t.bottomCap,k=O===void 0?!1:O,P=(_?2:0)+(k?2:0),I=(s+1)*(p+1+P),A=Math.atan2(r-i,a),L=Math.sin,M=Math.cos,j=Math.PI,U=M(A),F=L(A),V=_?-2:0,z=p+(k?2:0),B=s+1,h=new Uint16Array(s*(p+P)*6),c=Jm[g],l=new Float32Array(I*3),y=new Float32Array(I*3),b=new Float32Array(I*2),v=0,T=0,R=V;R<=z;R++){var N=R/p,q=a*N,G=void 0;R<0?(q=0,N=1,G=r):R>p?(q=a,N=1,G=i):G=r+(i-r)*(R/p),(R===-2||R===p+2)&&(G=0,N=0),q-=a/2;for(var K=0;K<B;K++){var ct=L(K*j*2/s),lt=M(K*j*2/s);l[v+c[0]]=ct*G,l[v+c[1]]=q,l[v+c[2]]=lt*G,y[v+c[0]]=R<0||R>p?0:ct*U,y[v+c[1]]=R<0?-1:R>p?1:F,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]=B*(Q+0)+0+ot,h[wt+1]=B*(Q+0)+1+ot,h[wt+2]=B*(Q+1)+1+ot,h[wt+3]=B*(Q+0)+0+ot,h[wt+4]=B*(Q+1)+1+ot,h[wt+5]=B*(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 Nt(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 dy(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 my(this,i)}}function my(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=dy(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?Nt(Nt({},n),{},{id:o,topology:"triangle-list",indices:{size:1,value:gy},attributes:Nt(Nt({},Py),n.attributes)}):Nt(Nt({},n),{},{id:o,topology:"triangle-list",indices:void 0,attributes:Nt(Nt({},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=Hr(t),i;if(e){var o=Hr(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 Hr(t){return Hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Hr(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 Wr(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=Hu(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,Hu(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 Hu(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 Hy=[-1,0,0,0,1,0,0,0,-1,0,0,1,0,-1,0,1,0,0],Wy=[3,4,5,3,5,1,3,1,0,3,0,4,4,0,2,4,2,5,2,0,1,5,2,1],Wu=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,Wr(Wr({},n),{},{id:o,topology:"triangle-list",indices:u,attributes:Wr(Wr({},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(Hy),a=[].concat(Wy);o.push(),a.push();for(var u=function(){var Jr={};return function(Et,At){Et*=3,At*=3;var af=Et<At?Et:At,sf=Et>At?Et:At,Qr="".concat(af,"|").concat(sf);if(Qr in Jr)return Jr[Qr];var uf=o[Et],ff=o[Et+1],cf=o[Et+2],lf=o[At],hf=o[At+1],pf=o[At+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 m=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],m,m,a[p+1],g,g,a[p+2],S,m,g,S)}a=f}for(var _=new Array(o.length),O=new Array(o.length/3*2),k=a.length,P=k-3;P>=0;P-=3){var I=a[P+0],A=a[P+1],L=a[P+2],M=I*3,j=A*3,U=L*3,F=I*2,V=A*2,z=L*2,B=o[M+0],h=o[M+1],c=o[M+2],l=Math.acos(c/Math.sqrt(B*B+h*h+c*c)),y=Math.atan2(h,B)+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)),G=Math.atan2(R,T)+n,K=q/n,ct=1-G/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=[B-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[M+0],o[M+1],o[M+2]),J=o.length/3-1,a.push(J),O[J*2+0]=1,O[J*2+1]=b,_[J*3+0]=ht.x,_[J*3+1]=ht.y,_[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,_[J*3+0]=ht.x,_[J*3+1]=ht.y,_[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,_[J*3+0]=ht.x,_[J*3+1]=ht.y,_[J*3+2]=ht.z),_[M+0]=_[j+0]=_[U+0]=ht.x,_[M+1]=_[j+1]=_[U+1]=ht.y,_[M+2]=_[j+2]=_[U+2]=ht.z,O[F+0]=v,O[F+1]=b,O[V+0]=ct,O[V+1]=K,O[z+0]=ar,O[z+1]=ei}return{indices:{size:1,value:new Uint16Array(a)},attributes:{POSITION:{size:3,value:new Float32Array(o)},NORMAL:{size:3,value:new Float32Array(_)},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),m=0;m<n;++m)for(var g=e.value[m],S=0;S<f;S++)p[m*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,m=t["".concat(f[1],"len")]||1,g=t["n".concat(f[0])]||1,S=t["n".concat(f[1])]||1,_=(g+1)*(S+1),O=new Float32Array(_*3),k=new Float32Array(_*3),P=new Float32Array(_*2);a&&(p=-p);for(var I=0,A=0,L=0;L<=S;L++)for(var M=0;M<=g;M++){var j=M/g,U=L/S;switch(P[I+0]=a?1-j:j,P[I+1]=U,r){case"x,y":O[A+0]=p*j-p*.5,O[A+1]=m*U-m*.5,O[A+2]=i,k[A+0]=0,k[A+1]=0,k[A+2]=a?1:-1;break;case"x,z":O[A+0]=p*j-p*.5,O[A+1]=i,O[A+2]=m*U-m*.5,k[A+0]=0,k[A+1]=a?1:-1,k[A+2]=0;break;case"y,z":O[A+0]=i,O[A+1]=p*j-p*.5,O[A+2]=m*U-m*.5,k[A+0]=a?1:-1,k[A+1]=0,k[A+2]=0;break;default:throw new Error("PlaneGeometry: unknown type")}I+=2,A+=3}for(var F=g+1,V=new Uint16Array(g*S*6),z=0;z<S;z++)for(var B=0;B<g;B++){var h=(z*g+B)*6;V[h+0]=(z+0)*F+B,V[h+1]=(z+1)*F+B,V[h+2]=(z+0)*F+B+1,V[h+3]=(z+1)*F+B,V[h+4]=(z+1)*F+B+1,V[h+5]=(z+0)*F+B+1}var c={indices:{size:1,value:V},attributes:{POSITION:{size:3,value:O},NORMAL:{size:3,value:k},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,m=(r+1)*(i+1),g=function(ct,lt,Q,ot,wt){return t.radius||1},S=new Float32Array(m*3),_=new Float32Array(m*3),O=new Float32Array(m*2),k=m>65535?Uint32Array:Uint16Array,P=new k(r*i*6),I=0;I<=r;I++)for(var A=0;A<=i;A++){var L=A/i,M=I/r,j=A+I*(i+1),U=j*2,F=j*3,V=p*L,z=u*M,B=Math.sin(V),h=Math.cos(V),c=Math.sin(z),l=Math.cos(z),y=h*c,b=l,v=B*c,T=g(y,b,v,L,M);S[F+0]=T*y,S[F+1]=T*b,S[F+2]=T*v,_[F+0]=y,_[F+1]=b,_[F+2]=v,O[U+0]=L,O[U+1]=1-M}for(var R=i+1,N=0;N<i;N++)for(var q=0;q<r;q++){var G=(N*r+q)*6;P[G+0]=q*R+N,P[G+1]=q*R+N+1,P[G+2]=(q+1)*R+N,P[G+3]=(q+1)*R+N,P[G+4]=q*R+N+1,P[G+5]=(q+1)*R+N+1}return{indices:{size:1,value:P},attributes:{POSITION:{size:3,value:S},NORMAL:{size:3,value:_},TEXCOORD_0:{size:2,value:O}}}}return _f(dv);})();
|
|
292
|
+
return __exports__;
|
|
293
|
+
});
|