@luma.gl/webgl 8.5.8 → 8.5.11

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/dist/dist.min.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=38)}([function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){var n=r(40),i=r(41),a=r(30),o=r(42);e.exports=function(e){return n(e)||i(e)||a(e)||o()}},function(e,t,r){var n=r(34);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},function(e,t,r){var n=r(11),i=r(9);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?i(e):t}},function(e,t,r){"use strict";r.d(t,"d",(function(){return i})),r.d(t,"e",(function(){return a})),r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return s}));var n=r(10);function i(e){return"undefined"!=typeof WebGLRenderingContext&&e instanceof WebGLRenderingContext||("undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||Boolean(e&&Number.isFinite(e._version)))}function a(e){return"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||Boolean(e&&2===e._version)}function o(e){return a(e)?e:null}function u(e){return Object(n.a)(i(e),"Invalid WebGLRenderingContext"),e}function s(e){return Object(n.a)(a(e),"Requires WebGL2"),e}},function(e,t,r){e.exports=r(44)},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,r){"use strict";function n(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}r.d(t,"a",(function(){return n}))},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},function(e,t,r){var n=r(46),i=r(47),a=r(30),o=r(48);e.exports=function(e,t){return n(e)||i(e,t)||a(e,t)||o()}},function(e,t,r){"use strict";(function(e,n){r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return u}));var i=r(11),a={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document,process:"object"===(void 0===n?"undefined":r.n(i)()(n))&&n},o=a.window||a.self||a.global,u=a.process||{};console}).call(this,r(20),r(17))},function(e,t,r){"use strict";r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return A})),r.d(t,"a",(function(){return x})),r.d(t,"b",(function(){return E})),r.d(t,"d",(function(){return O})),r.d(t,"f",(function(){return k}));var n,i,a,o=r(12),u=r.n(o),s=r(4),c=r.n(s),l=r(0),f=r.n(l),h=r(7),d=(n={},f()(n,3042,!1),f()(n,32773,new Float32Array([0,0,0,0])),f()(n,32777,32774),f()(n,34877,32774),f()(n,32969,1),f()(n,32968,0),f()(n,32971,1),f()(n,32970,0),f()(n,3106,new Float32Array([0,0,0,0])),f()(n,3107,[!0,!0,!0,!0]),f()(n,2884,!1),f()(n,2885,1029),f()(n,2929,!1),f()(n,2931,1),f()(n,2932,513),f()(n,2928,new Float32Array([0,1])),f()(n,2930,!0),f()(n,3024,!0),f()(n,35725,null),f()(n,36006,null),f()(n,36007,null),f()(n,34229,null),f()(n,34964,null),f()(n,32873,null),f()(n,34068,null),f()(n,2886,2305),f()(n,33170,4352),f()(n,2849,1),f()(n,32823,!1),f()(n,32824,0),f()(n,10752,0),f()(n,32926,!1),f()(n,32928,!1),f()(n,32938,1),f()(n,32939,!1),f()(n,3089,!1),f()(n,3088,new Int32Array([0,0,1024,1024])),f()(n,2960,!1),f()(n,2961,0),f()(n,2968,4294967295),f()(n,36005,4294967295),f()(n,2962,519),f()(n,2967,0),f()(n,2963,4294967295),f()(n,34816,519),f()(n,36003,0),f()(n,36004,4294967295),f()(n,2964,7680),f()(n,2965,7680),f()(n,2966,7680),f()(n,34817,7680),f()(n,34818,7680),f()(n,34819,7680),f()(n,2978,[0,0,1024,1024]),f()(n,3333,4),f()(n,3317,4),f()(n,37440,!1),f()(n,37441,!1),f()(n,37443,37444),f()(n,36389,null),f()(n,36662,null),f()(n,36663,null),f()(n,35053,null),f()(n,35055,null),f()(n,35869,null),f()(n,32874,null),f()(n,35723,4352),f()(n,36010,null),f()(n,35977,!1),f()(n,3330,0),f()(n,3332,0),f()(n,3331,0),f()(n,3314,0),f()(n,32878,0),f()(n,3316,0),f()(n,3315,0),f()(n,32877,0),n),v=function(e,t,r){return t?e.enable(r):e.disable(r)},g=function(e,t,r){return e.hint(r,t)},m=function(e,t,r){return e.pixelStorei(r,t)},y=function(e,t,r){var n;return n=36006===r?Object(h.e)(e)?36009:36160:36008,e.bindFramebuffer(n,t)},b=function(e,t,r){var n,i=(n={},f()(n,34964,[34962]),f()(n,36662,[36662]),f()(n,36663,[36663]),f()(n,35053,[35051]),f()(n,35055,[35052]),n)[r];e.bindBuffer(i,t)},p=function(e,t,r){var n,i=(n={},f()(n,32873,[3553]),f()(n,35869,[35866]),f()(n,32874,[32879]),f()(n,34068,[34067]),n)[r];e.bindTexture(i,t)};function _(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var A=(i={},f()(i,3042,v),f()(i,32773,(function(e,t){return e.blendColor.apply(e,c()(t))})),f()(i,32777,"blendEquation"),f()(i,34877,"blendEquation"),f()(i,32969,"blendFunc"),f()(i,32968,"blendFunc"),f()(i,32971,"blendFunc"),f()(i,32970,"blendFunc"),f()(i,3106,(function(e,t){return e.clearColor.apply(e,c()(t))})),f()(i,3107,(function(e,t){return e.colorMask.apply(e,c()(t))})),f()(i,2884,v),f()(i,2885,(function(e,t){return e.cullFace(t)})),f()(i,2929,v),f()(i,2931,(function(e,t){return e.clearDepth(t)})),f()(i,2932,(function(e,t){return e.depthFunc(t)})),f()(i,2928,(function(e,t){return e.depthRange.apply(e,c()(t))})),f()(i,2930,(function(e,t){return e.depthMask(t)})),f()(i,3024,v),f()(i,35723,g),f()(i,35725,(function(e,t){return e.useProgram(t)})),f()(i,36007,(function(e,t){return e.bindRenderbuffer(36161,t)})),f()(i,36389,(function(e,t){return e.bindTransformFeedback&&e.bindTransformFeedback(36386,t)})),f()(i,34229,(function(e,t){return e.bindVertexArray(t)})),f()(i,36006,y),f()(i,36010,y),f()(i,34964,b),f()(i,36662,b),f()(i,36663,b),f()(i,35053,b),f()(i,35055,b),f()(i,32873,p),f()(i,35869,p),f()(i,32874,p),f()(i,34068,p),f()(i,2886,(function(e,t){return e.frontFace(t)})),f()(i,33170,g),f()(i,2849,(function(e,t){return e.lineWidth(t)})),f()(i,32823,v),f()(i,32824,"polygonOffset"),f()(i,10752,"polygonOffset"),f()(i,35977,v),f()(i,32926,v),f()(i,32928,v),f()(i,32938,"sampleCoverage"),f()(i,32939,"sampleCoverage"),f()(i,3089,v),f()(i,3088,(function(e,t){return e.scissor.apply(e,c()(t))})),f()(i,2960,v),f()(i,2961,(function(e,t){return e.clearStencil(t)})),f()(i,2968,(function(e,t){return e.stencilMaskSeparate(1028,t)})),f()(i,36005,(function(e,t){return e.stencilMaskSeparate(1029,t)})),f()(i,2962,"stencilFuncFront"),f()(i,2967,"stencilFuncFront"),f()(i,2963,"stencilFuncFront"),f()(i,34816,"stencilFuncBack"),f()(i,36003,"stencilFuncBack"),f()(i,36004,"stencilFuncBack"),f()(i,2964,"stencilOpFront"),f()(i,2965,"stencilOpFront"),f()(i,2966,"stencilOpFront"),f()(i,34817,"stencilOpBack"),f()(i,34818,"stencilOpBack"),f()(i,34819,"stencilOpBack"),f()(i,2978,(function(e,t){return e.viewport.apply(e,c()(t))})),f()(i,3333,m),f()(i,3317,m),f()(i,37440,m),f()(i,37441,m),f()(i,37443,m),f()(i,3330,m),f()(i,3332,m),f()(i,3331,m),f()(i,3314,m),f()(i,32878,m),f()(i,3316,m),f()(i,3315,m),f()(i,32877,m),f()(i,"framebuffer",(function(e,t){var r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)})),f()(i,"blend",(function(e,t){return t?e.enable(3042):e.disable(3042)})),f()(i,"blendColor",(function(e,t){return e.blendColor.apply(e,c()(t))})),f()(i,"blendEquation",(function(e,t){t=_(t)?t:[t,t],e.blendEquationSeparate.apply(e,c()(t))})),f()(i,"blendFunc",(function(e,t){t=_(t)&&2===t.length?[].concat(c()(t),c()(t)):t,e.blendFuncSeparate.apply(e,c()(t))})),f()(i,"clearColor",(function(e,t){return e.clearColor.apply(e,c()(t))})),f()(i,"clearDepth",(function(e,t){return e.clearDepth(t)})),f()(i,"clearStencil",(function(e,t){return e.clearStencil(t)})),f()(i,"colorMask",(function(e,t){return e.colorMask.apply(e,c()(t))})),f()(i,"cull",(function(e,t){return t?e.enable(2884):e.disable(2884)})),f()(i,"cullFace",(function(e,t){return e.cullFace(t)})),f()(i,"depthTest",(function(e,t){return t?e.enable(2929):e.disable(2929)})),f()(i,"depthFunc",(function(e,t){return e.depthFunc(t)})),f()(i,"depthMask",(function(e,t){return e.depthMask(t)})),f()(i,"depthRange",(function(e,t){return e.depthRange.apply(e,c()(t))})),f()(i,"dither",(function(e,t){return t?e.enable(3024):e.disable(3024)})),f()(i,"derivativeHint",(function(e,t){e.hint(35723,t)})),f()(i,"frontFace",(function(e,t){return e.frontFace(t)})),f()(i,"mipmapHint",(function(e,t){return e.hint(33170,t)})),f()(i,"lineWidth",(function(e,t){return e.lineWidth(t)})),f()(i,"polygonOffsetFill",(function(e,t){return t?e.enable(32823):e.disable(32823)})),f()(i,"polygonOffset",(function(e,t){return e.polygonOffset.apply(e,c()(t))})),f()(i,"sampleCoverage",(function(e,t){return e.sampleCoverage.apply(e,c()(t))})),f()(i,"scissorTest",(function(e,t){return t?e.enable(3089):e.disable(3089)})),f()(i,"scissor",(function(e,t){return e.scissor.apply(e,c()(t))})),f()(i,"stencilTest",(function(e,t){return t?e.enable(2960):e.disable(2960)})),f()(i,"stencilMask",(function(e,t){var r=t=_(t)?t:[t,t],n=u()(r,2),i=n[0],a=n[1];e.stencilMaskSeparate(1028,i),e.stencilMaskSeparate(1029,a)})),f()(i,"stencilFunc",(function(e,t){var r=t=_(t)&&3===t.length?[].concat(c()(t),c()(t)):t,n=u()(r,6),i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],f=n[5];e.stencilFuncSeparate(1028,i,a,o),e.stencilFuncSeparate(1029,s,l,f)})),f()(i,"stencilOp",(function(e,t){var r=t=_(t)&&3===t.length?[].concat(c()(t),c()(t)):t,n=u()(r,6),i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],f=n[5];e.stencilOpSeparate(1028,i,a,o),e.stencilOpSeparate(1029,s,l,f)})),f()(i,"viewport",(function(e,t){return e.viewport.apply(e,c()(t))})),i);function w(e,t,r){return void 0!==t[e]?t[e]:r[e]}var x={blendEquation:function(e,t,r){return e.blendEquationSeparate(w(32777,t,r),w(34877,t,r))},blendFunc:function(e,t,r){return e.blendFuncSeparate(w(32969,t,r),w(32968,t,r),w(32971,t,r),w(32970,t,r))},polygonOffset:function(e,t,r){return e.polygonOffset(w(32824,t,r),w(10752,t,r))},sampleCoverage:function(e,t,r){return e.sampleCoverage(w(32938,t,r),w(32939,t,r))},stencilFuncFront:function(e,t,r){return e.stencilFuncSeparate(1028,w(2962,t,r),w(2967,t,r),w(2963,t,r))},stencilFuncBack:function(e,t,r){return e.stencilFuncSeparate(1029,w(34816,t,r),w(36003,t,r),w(36004,t,r))},stencilOpFront:function(e,t,r){return e.stencilOpSeparate(1028,w(2964,t,r),w(2965,t,r),w(2966,t,r))},stencilOpBack:function(e,t,r){return e.stencilOpSeparate(1029,w(34817,t,r),w(34818,t,r),w(34819,t,r))}},E={enable:function(e,t){return e(f()({},t,!0))},disable:function(e,t){return e(f()({},t,!1))},pixelStorei:function(e,t,r){return e(f()({},t,r))},hint:function(e,t,r){return e(f()({},t,r))},useProgram:function(e,t){return e(f()({},35725,t))},bindRenderbuffer:function(e,t,r){return e(f()({},36007,r))},bindTransformFeedback:function(e,t,r){return e(f()({},36389,r))},bindVertexArray:function(e,t){return e(f()({},34229,t))},bindFramebuffer:function(e,t,r){var n;switch(t){case 36160:return e((n={},f()(n,36006,r),f()(n,36010,r),n));case 36009:return e(f()({},36006,r));case 36008:return e(f()({},36010,r));default:return null}},bindBuffer:function(e,t,r){var n,i=(n={},f()(n,34962,[34964]),f()(n,36662,[36662]),f()(n,36663,[36663]),f()(n,35051,[35053]),f()(n,35052,[35055]),n)[t];return i?e(f()({},i,r)):{valueChanged:!0}},bindTexture:function(e,t,r){var n,i=(n={},f()(n,3553,[32873]),f()(n,35866,[35869]),f()(n,32879,[32874]),f()(n,34067,[34068]),n)[t];return i?e(f()({},i,r)):null},blendColor:function(e,t,r,n,i){return e(f()({},32773,new Float32Array([t,r,n,i])))},blendEquation:function(e,t){var r;return e((r={},f()(r,32777,t),f()(r,34877,t),r))},blendEquationSeparate:function(e,t,r){var n;return e((n={},f()(n,32777,t),f()(n,34877,r),n))},blendFunc:function(e,t,r){var n;return e((n={},f()(n,32969,t),f()(n,32968,r),f()(n,32971,t),f()(n,32970,r),n))},blendFuncSeparate:function(e,t,r,n,i){var a;return e((a={},f()(a,32969,t),f()(a,32968,r),f()(a,32971,n),f()(a,32970,i),a))},clearColor:function(e,t,r,n,i){return e(f()({},3106,new Float32Array([t,r,n,i])))},clearDepth:function(e,t){return e(f()({},2931,t))},clearStencil:function(e,t){return e(f()({},2961,t))},colorMask:function(e,t,r,n,i){return e(f()({},3107,[t,r,n,i]))},cullFace:function(e,t){return e(f()({},2885,t))},depthFunc:function(e,t){return e(f()({},2932,t))},depthRange:function(e,t,r){return e(f()({},2928,new Float32Array([t,r])))},depthMask:function(e,t){return e(f()({},2930,t))},frontFace:function(e,t){return e(f()({},2886,t))},lineWidth:function(e,t){return e(f()({},2849,t))},polygonOffset:function(e,t,r){var n;return e((n={},f()(n,32824,t),f()(n,10752,r),n))},sampleCoverage:function(e,t,r){var n;return e((n={},f()(n,32938,t),f()(n,32939,r),n))},scissor:function(e,t,r,n,i){return e(f()({},3088,new Int32Array([t,r,n,i])))},stencilMask:function(e,t){var r;return e((r={},f()(r,2968,t),f()(r,36005,t),r))},stencilMaskSeparate:function(e,t,r){return e(f()({},1028===t?2968:36005,r))},stencilFunc:function(e,t,r,n){var i;return e((i={},f()(i,2962,t),f()(i,2967,r),f()(i,2963,n),f()(i,34816,t),f()(i,36003,r),f()(i,36004,n),i))},stencilFuncSeparate:function(e,t,r,n,i){var a;return e((a={},f()(a,1028===t?2962:34816,r),f()(a,1028===t?2967:36003,n),f()(a,1028===t?2963:36004,i),a))},stencilOp:function(e,t,r,n){var i;return e((i={},f()(i,2964,t),f()(i,2965,r),f()(i,2966,n),f()(i,34817,t),f()(i,34818,r),f()(i,34819,n),i))},stencilOpSeparate:function(e,t,r,n,i){var a;return e((a={},f()(a,1028===t?2964:34817,r),f()(a,1028===t?2965:34818,n),f()(a,1028===t?2966:34819,i),a))},viewport:function(e,t,r,n,i){return e(f()({},2978,[t,r,n,i]))}},T=function(e,t){return e.isEnabled(t)},O=(a={},f()(a,3042,T),f()(a,2884,T),f()(a,2929,T),f()(a,3024,T),f()(a,32823,T),f()(a,32926,T),f()(a,32928,T),f()(a,3089,T),f()(a,2960,T),f()(a,35977,T),a),k=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097])},function(e,t,r){"use strict";(function(e){r.d(t,"c",(function(){return g})),r.d(t,"b",(function(){return m})),r.d(t,"a",(function(){return y}));var n=r(2),i=r.n(n),a=r(1),o=r.n(a),u=r(14),s=r(16),c=r(10),l=r(23);function f(e,t){var r=e[t].bind(e);e[t]=function(t){return void 0===t||u.f.has(t)?r(t):(t in e.state.cache||(e.state.cache[t]=r(t)),e.state.enable?e.state.cache[t]:r(t))},Object.defineProperty(e[t],"name",{value:"".concat(t,"-from-cache"),configurable:!1})}function h(e,t,r){if(e[t]){var n=e[t].bind(e);e[t]=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];var o=r.apply(void 0,[e.state._updateCache].concat(i)),u=o.valueChanged,s=o.oldValue;return u&&n.apply(void 0,i),s},Object.defineProperty(e[t],"name",{value:"".concat(t,"-to-cache"),configurable:!1})}}function d(e){var t=e.useProgram.bind(e);e.useProgram=function(r){e.state.program!==r&&(t(r),e.state.program=r)}}var v=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.copyState,a=void 0!==n&&n,o=r.log,c=void 0===o?function(){}:o;i()(this,e),this.gl=t,this.program=null,this.stateStack=[],this.enable=!0,this.cache=a?Object(s.a)(t):Object.assign({},u.c),this.log=c,this._updateCache=this._updateCache.bind(this),Object.seal(this)}return o()(e,[{key:"push",value:function(){this.stateStack.push({})}},{key:"pop",value:function(){Object(c.a)(this.stateStack.length>0);var e=this.stateStack[this.stateStack.length-1];Object(s.b)(this.gl,e),this.stateStack.pop()}},{key:"_updateCache",value:function(e){var t,r=!1,n=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(var i in e){Object(c.a)(void 0!==i);var a=e[i],o=this.cache[i];Object(l.a)(a,o)||(r=!0,t=o,n&&!(i in n)&&(n[i]=o),this.cache[i]=a)}return{valueChanged:r,oldValue:t}}}]),e}();function g(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.enable,i=void 0===n||n,a=r.copyState;if(Object(c.a)(void 0!==a),!t.state){var o=void 0!==e?e:window,s=o.polyfillContext;for(var l in s&&s(t),t.state=new v(t,{copyState:a}),d(t),u.b){var g=u.b[l];h(t,l,g)}f(t,"getParameter"),f(t,"isEnabled")}return t.state.enable=i,t}function m(e){e.state||g(e,{copyState:!1}),e.state.push()}function y(e){Object(c.a)(e.state),e.state.pop()}}).call(this,r(20))},function(e,t,r){"use strict";r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return f})),r.d(t,"c",(function(){return h}));var n=r(14),i=r(15),a=r(10),o=r(7),u=r(23);function s(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){if(Object(a.a)(Object(o.d)(e),"setParameters requires a WebGL context"),!Object(u.b)(t)){var r={};for(var i in t){var s=Number(i),c=n.e[i];c&&("string"==typeof c?r[c]=!0:c(e,t[i],s))}var l=e.state&&e.state.cache;if(l)for(var f in r){(0,n.a[f])(e,t,l)}}}function f(e,t){if("number"==typeof(t=t||n.c)){var r=t,i=n.d[r];return i?i(e,r):e.getParameter(r)}var a,o={},u=s(Array.isArray(t)?t:Object.keys(t));try{for(u.s();!(a=u.n()).done;){var c=a.value,l=n.d[c];o[c]=l?l(e,Number(c)):e.getParameter(Number(c))}}catch(e){u.e(e)}finally{u.f()}return o}function h(e,t,r){if(Object(u.b)(t))return r(e);var n,a=t.nocatch,o=void 0===a||a;if(Object(i.b)(e),l(e,t),o)n=r(e),Object(i.a)(e);else try{n=r(e)}finally{Object(i.a)(e)}return n}},function(e,t){var r,n,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,c=[],l=!1,f=-1;function h(){l&&s&&(l=!1,s.length?c=s.concat(c):f=-1,c.length&&d())}function d(){if(!l){var e=u(h);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f<t;)s&&s[f].run();f=-1,t=c.length}s=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new v(e,t)),1!==c.length||l||u(d)},v.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){var n=r(51);function i(t,r,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=i=Reflect.get:e.exports=i=function(e,t,r){var i=n(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(r):a.value}},i(t,r,a||t)}e.exports=i},function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return h}));var n,i,a=r(0),o=r.n(a),u=r(10),s=r(7),c=function(e){return Object(s.e)(e)?void 0:0},l=(n={},o()(n,3074,(function(e){return Object(s.e)(e)?void 0:36064})),o()(n,35723,(function(e){return Object(s.e)(e)?void 0:4352})),o()(n,35977,c),o()(n,32937,c),o()(n,36795,(function(e,t){var r=Object(s.e)(e)?e.getExtension("EXT_disjoint_timer_query_webgl2"):e.getExtension("EXT_disjoint_timer_query");return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0})),o()(n,37445,(function(e,t){var r=e.getExtension("WEBGL_debug_renderer_info");return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)})),o()(n,37446,(function(e,t){var r=e.getExtension("WEBGL_debug_renderer_info");return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)})),o()(n,34047,(function(e,t){var r=e.luma.extensions.EXT_texture_filter_anisotropic;return r?t(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1})),o()(n,32883,c),o()(n,35071,c),o()(n,37447,c),o()(n,36063,(function(e,t){if(!Object(s.e)(e)){var r=e.getExtension("WEBGL_draw_buffers");return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}})),o()(n,35379,c),o()(n,35374,c),o()(n,35377,c),o()(n,34852,(function(e){if(!Object(s.e)(e)){var t=e.getExtension("WEBGL_draw_buffers");return t?t.MAX_DRAW_BUFFERS_WEBGL:0}})),o()(n,36203,(function(e){return e.getExtension("OES_element_index")?2147483647:65535})),o()(n,33001,(function(e){return e.getExtension("OES_element_index")?16777216:65535})),o()(n,33e3,(function(e){return 16777216})),o()(n,37157,c),o()(n,35373,c),o()(n,35657,c),o()(n,36183,c),o()(n,37137,c),o()(n,34045,c),o()(n,35978,c),o()(n,35979,c),o()(n,35968,c),o()(n,35376,c),o()(n,35375,c),o()(n,35659,c),o()(n,37154,c),o()(n,35371,c),o()(n,35658,c),o()(n,35076,c),o()(n,35077,c),o()(n,35380,c),n);var f=(i={},o()(i,"OES_vertex_array_object",{meta:{suffix:"OES"},createVertexArray:function(){Object(u.a)(!1,"VertexArray requires WebGL2 or OES_vertex_array_object extension")},deleteVertexArray:function(){},bindVertexArray:function(){},isVertexArray:function(){return!1}}),o()(i,"ANGLE_instanced_arrays",{meta:{suffix:"ANGLE"},vertexAttribDivisor:function(e,t){Object(u.a)(0===t,"WebGL instanced rendering not supported")},drawElementsInstanced:function(){},drawArraysInstanced:function(){}}),o()(i,"WEBGL_draw_buffers",{meta:{suffix:"WEBGL"},drawBuffers:function(){Object(u.a)(!1)}}),o()(i,"EXT_disjoint_timer_query",{meta:{suffix:"EXT"},createQuery:function(){Object(u.a)(!1)},deleteQuery:function(){Object(u.a)(!1)},beginQuery:function(){Object(u.a)(!1)},endQuery:function(){},getQuery:function(e,t){return this.getQueryObject(e,t)},getQueryParameter:function(e,t){return this.getQueryObject(e,t)},getQueryObject:function(){}}),i),h={readBuffer:function(e,t,r){Object(s.e)(e)&&t(r)},getVertexAttrib:function(e,t,r,n){var i,a=function(e,t){return{webgl2:Object(s.e)(e),ext:e.getExtension(t)}}(e,"ANGLE_instanced_arrays"),o=a.webgl2,u=a.ext;switch(n){case 35069:i=!!o&&void 0;break;case 35070:i=o||u?void 0:0}return void 0!==i?i:t(r,n)},getProgramParameter:function(e,t,r,n){if(!Object(s.e)(e))switch(n){case 35967:return 35981;case 35971:case 35382:return 0}return t(r,n)},getInternalformatParameter:function(e,t,r,n,i){if(!Object(s.e)(e))switch(i){case 32937:return new Int32Array([0])}return e.getInternalformatParameter(r,n,i)},getTexParameter:function(e,t,r,n){switch(n){case 34046:var i=e.luma.extensions.EXT_texture_filter_anisotropic;n=i&&i.TEXTURE_MAX_ANISOTROPY_EXT||34046}return t(r,n)},getParameter:function(e,t,r){var n=l[r],i="function"==typeof n?n(e,t,r):n;return void 0!==i?i:t(r)},hint:function(e,t,r,n){return t(r,n)}}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,r){"use strict";(function(e){function n(){var t;if("undefined"!=typeof window&&window.performance)t=window.performance.now();else if(void 0!==e&&e.hrtime){var r=e.hrtime();t=1e3*r[0]+r[1]/1e6}else t=Date.now();return t}r.d(t,"a",(function(){return n}))}).call(this,r(17))},function(e,t,r){"use strict";function n(e){for(var t in e)return!1;return!0}function i(e,t){if(e===t)return!0;var r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(var i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return i}))},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return o}));var n=r(11),i=r.n(n),a=r(25);function o(){return!("object"===(void 0===e?"undefined":i()(e))&&"[object process]"===String(e)&&!e.browser)||Object(a.a)()}}).call(this,r(17))},function(e,t,r){"use strict";(function(e){r.d(t,"a",(function(){return a}));var n=r(11),i=r.n(n);function a(t){if("undefined"!=typeof window&&"object"===i()(window.process)&&"renderer"===window.process.type)return!0;if(void 0!==e&&"object"===i()(e.versions)&&Boolean(e.versions.electron))return!0;var r="object"===("undefined"==typeof navigator?"undefined":i()(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=t||r;return!!(n&&n.indexOf("Electron")>=0)}}).call(this,r(17))},function(e,t,r){"use strict";(function(e){var n=r(21);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){if("undefined"!=typeof window&&"object"===(0,i.default)(window.process)&&"renderer"===window.process.type)return!0;if(void 0!==e&&"object"===(0,i.default)(e.versions)&&Boolean(e.versions.electron))return!0;var r="object"===("undefined"==typeof navigator?"undefined":(0,i.default)(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=t||r;if(n&&n.indexOf("Electron")>=0)return!0;return!1};var i=n(r(11))}).call(this,r(17))},function(e,t,r){e.exports=r(50)},,function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},function(e,t,r){var n=r(29);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},function(e,t,r){"use strict";(function(e){var t=r(35),n=r(10),i=r(19);function a(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return u=e.done,e},e:function(e){s=!0,a=e},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){var r=t.extension,a=t.target,o=t.target2,u=i.b[r];Object(n.a)(u);for(var s=u.meta,c=(void 0===s?{}:s).suffix,l=void 0===c?"":c,f=e.getExtension(r),h=function(){var t=v[d],r="".concat(t).concat(l),n=null;"meta"===t||"function"==typeof e[t]||(f&&"function"==typeof f[r]?n=function(){return f[r].apply(f,arguments)}:"function"==typeof u[t]&&(n=u[t].bind(a))),n&&(a[t]=n,o[t]=n)},d=0,v=Object.keys(u);d<v.length;d++)h()}(void 0!==e?e:window).polyfillContext=function(e){e.luma=e.luma||{};var r=e.luma;return r.polyfilled||(Object(t.a)(e),function(e){e.luma.extensions={};var t,r=a(e.getSupportedExtensions()||[]);try{for(r.s();!(t=r.n()).done;){var n=t.value;e.luma[n]=e.getExtension(n)}}catch(e){r.e(e)}finally{r.f()}}(e),function(e,t){var r,n=a(Object.getOwnPropertyNames(t));try{for(n.s();!(r=n.n()).done;){var i=r.value;"overrides"!==i&&u(e,{extension:i,target:e.luma,target2:e})}}catch(e){n.e(e)}finally{n.f()}}(e,i.b),function(e,t){var r=t.target,n=t.target2;Object.keys(i.a).forEach((function(t){if("function"==typeof i.a[t]){var a=e[t]?e[t].bind(e):function(){},o=i.a[t].bind(null,e,a);r[t]=o,n[t]=o}}))}(e,{target:r,target2:e}),r.polyfilled=!0),e}}).call(this,r(20))},function(e,t,r){"use strict";(function(e,n){var i=r(21);Object.defineProperty(t,"__esModule",{value:!0}),t.console=t.process=t.document=t.global=t.window=t.self=void 0;var a=i(r(11)),o={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document,process:"object"===(void 0===n?"undefined":(0,a.default)(n))&&n},u=o.self||o.window||o.global;t.self=u;var s=o.window||o.self||o.global;t.window=s;var c=o.global||o.self||o.window;t.global=c;var l=o.document||{};t.document=l;var f=o.process||{};t.process=f;var h=console;t.console=h}).call(this,r(20),r(17))},function(e,t,r){"use strict";(function(e){var n=r(21);Object.defineProperty(t,"__esModule",{value:!0}),t.default=o,t.isBrowserMainThread=function(){return o()&&"undefined"!=typeof document};var i=n(r(11)),a=n(r(26));function o(){return!("object"===(void 0===e?"undefined":(0,i.default)(e))&&"[object process]"===String(e)&&!e.browser)||(0,a.default)()}}).call(this,r(17))},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(8),i={};function a(e,t){var r;i[e]=!0,void 0!==t&&(r=t,n.global.console&&n.global.console.error&&n.global.console.error(r))}var o=function e(t){var r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(var n=0;n<this.attribs.length;n++){var i=new e.VertexAttrib(r);this.attribs[n]=i}this.maxAttrib=0};(o.VertexAttrib=function(e){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()}).prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var u=function(e){var t=this;this.gl=e,function(e){var t=e.getError;e.getError=function(){var r;do{0!==(r=t.apply(e))&&(i[r]=!0)}while(0!==r);for(r in i)if(i[r])return delete i[r],parseInt(r,10);return 0}}(e);var r=this.original={getParameter:e.getParameter,enableVertexAttribArray:e.enableVertexAttribArray,disableVertexAttribArray:e.disableVertexAttribArray,bindBuffer:e.bindBuffer,getVertexAttrib:e.getVertexAttrib,vertexAttribPointer:e.vertexAttribPointer};e.getParameter=function(e){return e===t.VERTEX_ARRAY_BINDING_OES?t.currentVertexArrayObject===t.defaultVertexArrayObject?null:t.currentVertexArrayObject:r.getParameter.apply(this,arguments)},e.enableVertexAttribArray=function(e){var n=t.currentVertexArrayObject;n.maxAttrib=Math.max(n.maxAttrib,e);var i=n.attribs[e];return i.enabled=!0,r.enableVertexAttribArray.apply(this,arguments)},e.disableVertexAttribArray=function(e){var n=t.currentVertexArrayObject;n.maxAttrib=Math.max(n.maxAttrib,e);var i=n.attribs[e];return i.enabled=!1,r.disableVertexAttribArray.apply(this,arguments)},e.bindBuffer=function(e,n){switch(e){case 34962:t.currentArrayBuffer=n;break;case 34963:t.currentVertexArrayObject.elementArrayBuffer=n}return r.bindBuffer.apply(this,arguments)},e.getVertexAttrib=function(e,n){var i=t.currentVertexArrayObject,a=i.attribs[e];switch(n){case 34975:return a.buffer;case 34338:return a.enabled;case 34339:return a.size;case 34340:return a.stride;case 34341:return a.type;case 34922:return a.normalized;default:return r.getVertexAttrib.apply(this,arguments)}},e.vertexAttribPointer=function(e,n,i,a,o,u){var s=t.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,e);var c=s.attribs[e];return c.buffer=t.currentArrayBuffer,c.size=n,c.type=i,c.normalized=a,c.stride=o,c.offset=u,c.recache(),r.vertexAttribPointer.apply(this,arguments)},e.instrumentExtension&&e.instrumentExtension(this,"OES_vertex_array_object"),e.canvas&&e.canvas.addEventListener("webglcontextrestored",(function(){var e;e="OESVertexArrayObject emulation library context restored",n.global.console&&n.global.console.log&&n.global.console.log(e),t.reset_()}),!0),this.reset_()};function s(e){if("function"!=typeof e.createVertexArray){var t=e.getSupportedExtensions;e.getSupportedExtensions=function(){var e=t.call(this)||[];return e.indexOf("OES_vertex_array_object")<0&&e.push("OES_vertex_array_object"),e};var r=e.getExtension;e.getExtension=function(t){var n=r.call(this,t);return n||("OES_vertex_array_object"!==t?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new u(this)),this.__OESVertexArrayObject))}}}u.prototype.VERTEX_ARRAY_BINDING_OES=34229,u.prototype.reset_=function(){if(void 0!==this.vertexArrayObjects)for(var e=0;e<this.vertexArrayObjects.length;++e)this.vertexArrayObjects.isAlive=!1;var t=this.gl;this.maxVertexAttribs=t.getParameter(34921),this.defaultVertexArrayObject=new o(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)},u.prototype.createVertexArrayOES=function(){var e=new o(this);return this.vertexArrayObjects.push(e),e},u.prototype.deleteVertexArrayOES=function(e){e.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(e),1),this.currentVertexArrayObject===e&&this.bindVertexArrayOES(null)},u.prototype.isVertexArrayOES=function(e){return!!(e&&e instanceof o&&e.hasBeenBound&&e.ext===this)},u.prototype.bindVertexArrayOES=function(e){var t=this.gl;if(!e||e.isAlive){var r=this.original,n=this.currentVertexArrayObject;this.currentVertexArrayObject=e||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;var i=this.currentVertexArrayObject;if(n!==i){n&&i.elementArrayBuffer===n.elementArrayBuffer||r.bindBuffer.call(t,34963,i.elementArrayBuffer);for(var o=this.currentArrayBuffer,u=Math.max(n?n.maxAttrib:0,i.maxAttrib),s=0;s<=u;s++){var c=i.attribs[s],l=n?n.attribs[s]:null;if(n&&c.enabled===l.enabled||(c.enabled?r.enableVertexAttribArray.call(t,s):r.disableVertexAttribArray.call(t,s)),c.enabled){var f=!1;n&&c.buffer===l.buffer||(o!==c.buffer&&(r.bindBuffer.call(t,34962,c.buffer),o=c.buffer),f=!0),(f||c.cached!==l.cached)&&r.vertexAttribPointer.call(t,s,c.size,c.type,c.normalized,c.stride,c.offset)}}this.currentArrayBuffer!==o&&r.bindBuffer.call(t,34962,this.currentArrayBuffer)}}else a(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject")}},function(e,t,r){var n=r(34),i=r(49);function a(t,r,o){return i()?e.exports=a=Reflect.construct:e.exports=a=function(e,t,r){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return r&&n(a,r.prototype),a},a.apply(null,arguments)}e.exports=a},function(e,t){function r(e,t,r,n,i,a,o){try{var u=e[a](o),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function u(e){r(o,i,a,u,s,"next",e)}function s(e){r(o,i,a,u,s,"throw",e)}u(void 0)}))}}},function(e,t,r){(function(t){var n=r(52),i="undefined"==typeof window?t:window;i.luma=i.luma||{},e.exports=Object.assign(i.luma,n)}).call(this,r(20))},,function(e,t,r){var n=r(29);e.exports=function(e){if(Array.isArray(e))return n(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){},function(e,t,r){"use strict";var n=r(21),i=r(11);Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"self",{enumerable:!0,get:function(){return a.self}}),Object.defineProperty(t,"window",{enumerable:!0,get:function(){return a.window}}),Object.defineProperty(t,"global",{enumerable:!0,get:function(){return a.global}}),Object.defineProperty(t,"document",{enumerable:!0,get:function(){return a.document}}),Object.defineProperty(t,"process",{enumerable:!0,get:function(){return a.process}}),Object.defineProperty(t,"console",{enumerable:!0,get:function(){return a.console}}),Object.defineProperty(t,"isBrowser",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"isBrowserMainThread",{enumerable:!0,get:function(){return o.isBrowserMainThread}}),Object.defineProperty(t,"getBrowser",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"isMobile",{enumerable:!0,get:function(){return u.isMobile}}),Object.defineProperty(t,"isElectron",{enumerable:!0,get:function(){return s.default}});var a=r(32),o=l(r(33)),u=l(r(45)),s=n(r(26));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}function l(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var r=c(t);if(r&&r.has(e))return r.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var u=a?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(n,o,u):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}},function(e,t,r){"use strict";var n=r(21);Object.defineProperty(t,"__esModule",{value:!0}),t.isMobile=function(){return void 0!==i.window.orientation},t.default=function(e){if(!e&&!(0,a.default)())return"Node";if((0,o.default)(e))return"Electron";var t="undefined"!=typeof navigator?navigator:{},r=e||t.userAgent||"";if(r.indexOf("Edge")>-1)return"Edge";var n=-1!==r.indexOf("MSIE "),u=-1!==r.indexOf("Trident/");if(n||u)return"IE";if(i.window.chrome)return"Chrome";if(i.window.safari)return"Safari";if(i.window.mozInnerScreenX)return"Firefox";return"Unknown"};var i=r(32),a=n(r(33)),o=n(r(26))},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw a}}return r}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}},function(e,t,r){var n=function(e){"use strict";var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",o=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),o=new x(n||[]);return a._invoke=function(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return T()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var u=_(o,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),a}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function h(){}function d(){}var v={};v[i]=function(){return this};var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==t&&r.call(m,i)&&(v=m);var y=d.prototype=f.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function p(e,t){var n;this._invoke=function(i,a){function o(){return new t((function(n,o){!function n(i,a,o,u){var s=c(e[i],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,o,u)}),(function(e){n("throw",e,o,u)})):t.resolve(f).then((function(e){l.value=e,o(l)}),(function(e){return n("throw",e,o,u)}))}u(s.arg)}(i,a,n,o)}))}return n=n?n.then(o,o):o()}}function _(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function E(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:T}}function T(){return{value:void 0,done:!0}}return h.prototype=y.constructor=d,d.constructor=h,h.displayName=u(d,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,o,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(p.prototype),p.prototype[a]=function(){return this},e.AsyncIterator=p,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new p(s(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(y),u(y,o,"Generator"),y[i]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},function(e,t,r){var n=r(3);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=n(e)););return e}},function(e,t,r){"use strict";r.r(t),r.d(t,"lumaStats",(function(){return X})),r.d(t,"requestAnimationFrame",(function(){return W})),r.d(t,"cancelAnimationFrame",(function(){return Y})),r.d(t,"cloneTextureFrom",(function(){return Ct})),r.d(t,"getKeyValue",(function(){return ae})),r.d(t,"getKey",(function(){return oe})),r.d(t,"getContextInfo",(function(){return zt})),r.d(t,"getGLContextInfo",(function(){return Gt})),r.d(t,"getContextLimits",(function(){return Vt})),r.d(t,"FEATURES",(function(){return Ot})),r.d(t,"hasFeature",(function(){return Ft})),r.d(t,"hasFeatures",(function(){return jt})),r.d(t,"getFeatures",(function(){return Rt})),r.d(t,"canCompileGLGSExtension",(function(){return Wt})),r.d(t,"Accessor",(function(){return Te})),r.d(t,"Buffer",(function(){return Ie})),r.d(t,"Shader",(function(){return er})),r.d(t,"VertexShader",(function(){return tr})),r.d(t,"FragmentShader",(function(){return rr})),r.d(t,"Program",(function(){return Fr})),r.d(t,"Framebuffer",(function(){return Dt})),r.d(t,"Renderbuffer",(function(){return vt})),r.d(t,"Texture2D",(function(){return $e})),r.d(t,"TextureCube",(function(){return nt})),r.d(t,"clear",(function(){return gt})),r.d(t,"clearBuffer",(function(){return mt})),r.d(t,"readPixelsToArray",(function(){return bt})),r.d(t,"readPixelsToBuffer",(function(){return pt})),r.d(t,"copyToDataUrl",(function(){return _t})),r.d(t,"copyToImage",(function(){return At})),r.d(t,"copyToTexture",(function(){return wt})),r.d(t,"blit",(function(){return xt})),r.d(t,"Query",(function(){return Pr})),r.d(t,"Texture3D",(function(){return ot})),r.d(t,"TransformFeedback",(function(){return Mr})),r.d(t,"VertexArrayObject",(function(){return zr})),r.d(t,"VertexArray",(function(){return Wr})),r.d(t,"UniformBufferLayout",(function(){return Yr})),r.d(t,"setPathPrefix",(function(){return We})),r.d(t,"loadFile",(function(){return Ye})),r.d(t,"loadImage",(function(){return qe})),r.d(t,"getShaderName",(function(){return Yt})),r.d(t,"getShaderVersion",(function(){return qr})),r.d(t,"log",(function(){return M})),r.d(t,"assert",(function(){return ie})),r.d(t,"uid",(function(){return se})),r.d(t,"isObjectEmpty",(function(){return le})),r.d(t,"parseUniformName",(function(){return dr})),r.d(t,"getUniformSetter",(function(){return hr})),r.d(t,"getDebugTableForUniforms",(function(){return Zr})),r.d(t,"getDebugTableForVertexArray",(function(){return tn})),r.d(t,"getDebugTableForProgramConfiguration",(function(){return un}));var n=r(2),i=r.n(n),a=r(1),o=r.n(a),u=r(11),s=r.n(u),c=r(4),l=r.n(c),f=r(0),h=r.n(f),d=r(24),v=Object(d.a)();function g(e){try{var t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}var m=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";i()(this,e),this.storage=g(n),this.id=t,this.config={},Object.assign(this.config,r),this._loadConfiguration()}return o()(e,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(e){return this.config={},this.updateConfiguration(e)}},{key:"updateConfiguration",value:function(e){if(Object.assign(this.config,e),this.storage){var t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}},{key:"_loadConfiguration",value:function(){var e={};if(this.storage){var t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}]),e}();function y(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,i=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>n&&(r=Math.min(r,n/e.width));var a=e.width*r,o=e.height*r,u=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),u]}var b={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function p(e){return"string"==typeof e?b[e.toUpperCase()]||b.WHITE:e}function _(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function w(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),i=Object.getOwnPropertyNames(n),a=_(i);try{var o=function(){var n=t.value;"function"==typeof e[n]&&(r.find((function(e){return n===e}))||(e[n]=e[n].bind(e)))};for(a.s();!(t=a.n()).done;)o()}catch(e){a.e(e)}finally{a.f()}}function x(e,t){if(!e)throw new Error(t||"Assertion failed")}var E=r(13);function T(){var e;if(v&&E.b.performance)e=E.b.performance.now();else if(E.a.hrtime){var t=E.a.hrtime();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}var O={debug:v&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},k={enabled:!0,level:0};function S(){}var L={},F={once:!0};function j(e){for(var t in e)for(var r in e[t])return r||"untitled";return"empty"}var R=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},r=t.id;i()(this,e),this.id=r,this.VERSION="8.5.7",this._startTs=T(),this._deltaTs=T(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new m("__probe-".concat(this.id,"__"),k),this.userData={},this.timeStamp("".concat(this.id," started")),w(this),Object.seal(this)}return o()(e,[{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((T()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((T()-this._deltaTs).toPrecision(10))}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:e}),this}},{key:"setLevel",value:function(e){return this._storage.updateConfiguration({level:e}),this}},{key:"assert",value:function(e,t){x(e,t)}},{key:"warn",value:function(e){return this._getLogFunction(0,e,O.warn,arguments,F)}},{key:"error",value:function(e){return this._getLogFunction(0,e,O.error,arguments)}},{key:"deprecated",value:function(e,t){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(t,"` instead"))}},{key:"removed",value:function(e,t){return this.error("`".concat(e,"` has been removed. Use `").concat(t,"` instead"))}},{key:"probe",value:function(e,t){return this._getLogFunction(e,t,O.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(e,t){return this._getLogFunction(e,t,O.debug,arguments)}},{key:"info",value:function(e,t){return this._getLogFunction(e,t,console.info,arguments)}},{key:"once",value:function(e,t){return this._getLogFunction(e,t,O.debug||O.info,arguments,F)}},{key:"table",value:function(e,t,r){return t?this._getLogFunction(e,t,console.table||S,r&&[r],{tag:j(t)}):S}},{key:"image",value:function(e){var t=e.logLevel,n=e.priority,i=e.image,a=e.message,o=void 0===a?"":a,u=e.scale,s=void 0===u?1:u;return this._shouldLog(t||n)?v?function(e){var t=e.image,r=e.message,n=void 0===r?"":r,i=e.scale,a=void 0===i?1:i;if("string"==typeof t){var o=new Image;return o.onload=function(){var e,t=y(o,n,a);(e=console).log.apply(e,l()(t))},o.src=t,S}var u=t.nodeName||"";if("img"===u.toLowerCase()){var s;return(s=console).log.apply(s,l()(y(t,n,a))),S}if("canvas"===u.toLowerCase()){var c=new Image;return c.onload=function(){var e;return(e=console).log.apply(e,l()(y(c,n,a)))},c.src=t.toDataURL(),S}return S}({image:i,message:o,scale:s}):function(e){var t=e.image,n=(e.message,e.scale),i=void 0===n?1:n,a=null;try{a=r(43)}catch(e){}if(a)return function(){return a(t,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((function(e){return console.log(e)}))};return S}({image:i,message:o,scale:s}):S}},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"get",value:function(e){return this._storage.config[e]}},{key:"set",value:function(e,t){this._storage.updateConfiguration(h()({},e,t))}},{key:"time",value:function(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}},{key:"timeEnd",value:function(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}},{key:"timeStamp",value:function(e,t){return this._getLogFunction(e,t,console.timeStamp||S)}},{key:"group",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},n=r=P({logLevel:e,message:t,opts:r}),i=n.collapsed;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}},{key:"groupCollapsed",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(e,t,Object.assign({},r,{collapsed:!0}))}},{key:"groupEnd",value:function(e){return this._getLogFunction(e,"",console.groupEnd||S)}},{key:"withGroup",value:function(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(e){return this.isEnabled()&&this.getLevel()>=I(e)}},{key:"_getLogFunction",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4?arguments[4]:void 0;if(this._shouldLog(e)){var a;i=P({logLevel:e,message:t,args:n,opts:i}),x(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=T();var o=i.tag||i.message;if(i.once){if(L[o])return S;L[o]=T()}return t=B(this.id,i.message,i),(a=r).bind.apply(a,[console,t].concat(l()(i.args)))}return S}},{key:"level",set:function(e){this.setLevel(e)},get:function(){return this.getLevel()}},{key:"priority",set:function(e){this.level=e},get:function(){return this.level}}]),e}();function I(e){if(!e)return 0;var t;switch(s()(e)){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return x(Number.isFinite(t)&&t>=0),t}function P(e){var t=e.logLevel,r=e.message;e.logLevel=I(t);for(var n=e.args?Array.from(e.args):[];n.length&&n.shift()!==r;);switch(e.args=n,s()(t)){case"string":case"function":void 0!==r&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());var i=s()(e.message);return x("string"===i||"object"===i),Object.assign(e,e.opts)}function B(e,t,r){if("string"==typeof t){var n=r.time?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,r=Math.max(t-e.length,0);return"".concat(" ".repeat(r)).concat(e)}((u=r.total)<10?"".concat(u.toFixed(2),"ms"):u<100?"".concat(u.toFixed(1),"ms"):u<1e3?"".concat(u.toFixed(0),"ms"):"".concat((u/1e3).toFixed(2),"s")):"";t=r.time?"".concat(e,": ").concat(n," ").concat(t):"".concat(e,": ").concat(t),i=t,a=r.color,o=r.background,v||"string"!=typeof i||(a&&(a=p(a),i="[".concat(a,"m").concat(i,"")),o&&(a=p(o),i="[".concat(o+10,"m").concat(i,""))),t=i}var i,a,o,u;return t}R.VERSION="8.5.7";var M=new R({id:"luma.gl"}),D=r(7),N=(r(31),r(16)),C=(r(15),r(8));r(10);var U=Object(C.isBrowser)();function V(e){var t=e.getParameter(7936),r=e.getParameter(7937),n=e.getExtension("WEBGL_debug_renderer_info");return{vendor:n&&e.getParameter(n.UNMASKED_VENDOR_WEBGL||7936)||t,renderer:n&&e.getParameter(n.UNMASKED_RENDERER_WEBGL||7937)||r,vendorMasked:t,rendererMasked:r,version:e.getParameter(7938),shadingLanguageVersion:e.getParameter(35724)}}var G=r(22),z=function(){function e(t,r){i()(this,e),this.name=t,this.type=r,this.sampleSize=1,this.reset()}return o()(e,[{key:"setSampleSize",value:function(e){return this.sampleSize=e,this}},{key:"incrementCount",value:function(){return this.addCount(1),this}},{key:"decrementCount",value:function(){return this.subtractCount(1),this}},{key:"addCount",value:function(e){return this._count+=e,this._samples++,this._checkSampling(),this}},{key:"subtractCount",value:function(e){return this._count-=e,this._samples++,this._checkSampling(),this}},{key:"addTime",value:function(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}},{key:"timeStart",value:function(){return this._startTime=Object(G.a)(),this._timerPending=!0,this}},{key:"timeEnd",value:function(){return this._timerPending?(this.addTime(Object(G.a)()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}},{key:"getSampleAverageCount",value:function(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}},{key:"getSampleAverageTime",value:function(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}},{key:"getSampleHz",value:function(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}},{key:"getAverageCount",value:function(){return this.samples>0?this.count/this.samples:0}},{key:"getAverageTime",value:function(){return this.samples>0?this.time/this.samples:0}},{key:"getHz",value:function(){return this.time>0?this.samples/(this.time/1e3):0}},{key:"reset",value:function(){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}},{key:"_checkSampling",value:function(){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)}}]),e}(),H=function(){function e(t){var r=t.id,n=t.stats;i()(this,e),this.id=r,this.stats={},this._initializeStats(n),Object.seal(this)}return o()(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:e,type:t})}},{key:"reset",value:function(){for(var e in this.stats)this.stats[e].reset();return this}},{key:"forEach",value:function(e){for(var t in this.stats)e(this.stats[t])}},{key:"getTable",value:function(){var e={};return this.forEach((function(t){e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}})),e}},{key:"_initializeStats",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.forEach((function(t){return e._getOrCreate(t)}))}},{key:"_getOrCreate",value:function(e){if(!e||!e.name)return null;var t=e.name,r=e.type;return this.stats[t]||(this.stats[t]=e instanceof z?e:new z(t,r)),this.stats[t]}},{key:"size",get:function(){return Object.keys(this.stats).length}}]),e}(),X=new(function(){function e(){i()(this,e),this.stats=new Map}return o()(e,[{key:"get",value:function(e){return this.stats.has(e)||this.stats.set(e,new H({id:e})),this.stats.get(e)}}]),e}());if(C.global.luma&&"8.5.7"!==C.global.luma.VERSION)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(C.global.luma.VERSION," vs ").concat("8.5.7"));C.global.luma||(Object(C.isBrowser)()&&M.log(1,"luma.gl ".concat("8.5.7"," - ").concat("set luma.log.level=1 (or higher) to trace rendering"))(),C.global.luma=C.global.luma||{VERSION:"8.5.7",version:"8.5.7",log:M,stats:X,globals:{modules:{},nodeIO:{}}});C.global.luma;function W(e){return"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame(e):setTimeout(e,1e3/60)}function Y(e){return"undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e)}var q=r(9),Q=r.n(q),$=r(5),J=r.n($),K=r(6),Z=r.n(K),ee=r(3),te=r.n(ee),re=r(12),ne=r.n(re);function ie(e,t){if(!e)throw new Error(t||"luma.gl: assertion failed.")}function ae(e,t){if("string"!=typeof t)return t;var r=Number(t);if(!isNaN(r))return r;var n=e[t=t.replace(/^.*\./,"")];return ie(void 0!==n,"Accessing undefined constant GL.".concat(t)),n}function oe(e,t){for(var r in t=Number(t),e)if(e[r]===t)return"GL.".concat(r);return String(t)}var ue={};function se(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";ue[e]=ue[e]||1;var t=ue[e]++;return"".concat(e,"-").concat(t)}function ce(e){return ie("number"==typeof e,"Input must be a number"),e&&0==(e&e-1)}function le(e){var t=!0;for(var r in e){t=!1;break}return t}function fe(e,t,r,n){var i="See luma.gl ".concat(r," Upgrade Guide at https://luma.gl/docs/upgrade-guide"),a=Object.getPrototypeOf(e);n.forEach((function(e){a.methodName||(a[e]=function(){throw M.removed("Calling removed method ".concat(t,".").concat(e,": "),i)(),new Error(e)})}))}function he(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return de(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return de(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ve="Resource subclass must define virtual methods",ge=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,e),Object(D.b)(t);var n=r.id,a=r.userData,o=void 0===a?{}:a;this.gl=t,this.gl2=t,this.id=n||se(this.constructor.name),this.userData=o,this._bound=!1,this._handle=r.handle,void 0===this._handle&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}return o()(e,[{key:"toString",value:function(){return"".concat(this.constructor.name,"(").concat(this.id,")")}},{key:"delete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.deleteChildren,r=void 0!==t&&t,n=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,n&&r&&n.filter(Boolean).forEach((function(e){return e.delete()})),this}},{key:"bind",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.handle;return"function"!=typeof t?(this._bindHandle(t),this):(this._bound?e=t():(this._bindHandle(this.handle),this._bound=!0,e=t(),this._bound=!1,this._bindHandle(null)),e)}},{key:"unbind",value:function(){this.bind(null)}},{key:"getParameter",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ie(e=ae(this.gl,e));var r=this.constructor.PARAMETERS||{},n=r[e];if(n){var i=Object(D.e)(this.gl),a=(!("webgl2"in n)||i)&&(!("extension"in n)||this.gl.getExtension(n.extension));if(!a){var o=n.webgl1,u="webgl2"in n?n.webgl2:n.webgl1,s=i?u:o;return s}}return this._getParameter(e,t)}},{key:"getParameters",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.parameters,n=t.keys,i=this.constructor.PARAMETERS||{},a=Object(D.e)(this.gl),o={},u=r||Object.keys(i),s=he(u);try{for(s.s();!(e=s.n()).done;){var c=e.value,l=i[c],f=l&&(!("webgl2"in l)||a)&&(!("extension"in l)||this.gl.getExtension(l.extension));if(f){var h=n?oe(this.gl,c):c;o[h]=this.getParameter(c,t),n&&"GLenum"===l.type&&(o[h]=oe(this.gl,o[h]))}}}catch(e){s.e(e)}finally{s.f()}return o}},{key:"setParameter",value:function(e,t){ie(e=ae(this.gl,e));var r=(this.constructor.PARAMETERS||{})[e];if(r){var n=Object(D.e)(this.gl);if(!((!("webgl2"in r)||n)&&(!("extension"in r)||this.gl.getExtension(r.extension))))throw new Error("Parameter not available on this platform");"GLenum"===r.type&&(t=ae(t))}return this._setParameter(e,t),this}},{key:"setParameters",value:function(e){for(var t in e)this.setParameter(t,e[t]);return this}},{key:"stubRemovedMethods",value:function(e,t,r){return fe(this,e,t,r)}},{key:"initialize",value:function(e){}},{key:"_createHandle",value:function(){throw new Error(ve)}},{key:"_deleteHandle",value:function(){throw new Error(ve)}},{key:"_bindHandle",value:function(e){throw new Error(ve)}},{key:"_getOptsFromHandle",value:function(){throw new Error(ve)}},{key:"_getParameter",value:function(e,t){throw new Error(ve)}},{key:"_setParameter",value:function(e,t){throw new Error(ve)}},{key:"_context",value:function(){return this.gl.luma=this.gl.luma||{},this.gl.luma}},{key:"_addStats",value:function(){var e=this.constructor.name,t=X.get("Resource Counts");t.get("Resources Created").incrementCount(),t.get("".concat(e,"s Created")).incrementCount(),t.get("".concat(e,"s Active")).incrementCount()}},{key:"_removeStats",value:function(){var e=this.constructor.name;X.get("Resource Counts").get("".concat(e,"s Active")).decrementCount()}},{key:"_trackAllocatedMemory",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.name,r=X.get("Memory Usage");r.get("GPU Memory").addCount(e),r.get("".concat(t," Memory")).addCount(e),this.byteLength=e}},{key:"_trackDeallocatedMemory",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.constructor.name,t=X.get("Memory Usage");t.get("GPU Memory").subtractCount(this.byteLength),t.get("".concat(e," Memory")).subtractCount(this.byteLength),this.byteLength=0}},{key:"handle",get:function(){return this._handle}}]),e}(),me=r(36),ye=r.n(me);function be(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error("Failed to deduce GL constant from typed array")}}function pe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.clamped,n=void 0===r||r;switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return n?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function _e(e){var t=e.data,r=e.width,n=e.height,i=e.bytesPerPixel,a=void 0===i?4:i,o=e.temp,u=r*a;o=o||new Uint8Array(u);for(var s=0;s<n/2;++s){var c=s*u,l=(n-s-1)*u;o.set(t.subarray(c,c+u)),t.copyWithin(c,l,l+u),t.set(o,l)}}function Ae(e){for(var t=e.data,r=e.width,n=e.height,i=Math.round(r/2),a=Math.round(n/2),o=new Uint8Array(i*a*4),u=0;u<a;u++)for(var s=0;s<i;s++)for(var c=0;c<4;c++)o[4*(u*i+s)+c]=t[4*(2*u*r+2*s)+c];return{data:o,width:i,height:a}}function we(e,t,r){var n=r.removedProps,i=void 0===n?{}:n,a=r.deprecatedProps,o=void 0===a?{}:a,u=r.replacedProps,s=void 0===u?{}:u;for(var c in i)if(c in t){var l=i[c]?"".concat(e,".").concat(i[c]):"N/A";M.removed("".concat(e,".").concat(c),l)()}for(var f in o)if(f in t){var h=o[f];M.deprecated("".concat(e,".").concat(f),"".concat(e,".").concat(h))()}var d=null;for(var v in s)if(v in t){var g=s[v];M.deprecated("".concat(e,".").concat(v),"".concat(e,".").concat(g))(),(d=d||Object.assign({},t))[g]=t[v],delete d[v]}return d||t}var xe={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Ee={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Te=function(){function e(){var t=this;i()(this,e);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];n.forEach((function(e){return t._assign(e)})),Object.freeze(this)}return o()(e,null,[{key:"getBytesPerElement",value:function(e){return pe(e.type||5126).BYTES_PER_ELEMENT}},{key:"getBytesPerVertex",value:function(e){return ie(e.size),pe(e.type||5126).BYTES_PER_ELEMENT*e.size}},{key:"resolve",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return ye()(e,[xe].concat(r))}}]),o()(e,[{key:"toString",value:function(){return JSON.stringify(this)}},{key:"_assign",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0!==(e=we("Accessor",e,Ee)).type&&(this.type=e.type,5124!==e.type&&5125!==e.type||(this.integer=!0)),void 0!==e.size&&(this.size=e.size),void 0!==e.offset&&(this.offset=e.offset),void 0!==e.stride&&(this.stride=e.stride),void 0!==e.normalized&&(this.normalized=e.normalized),void 0!==e.integer&&(this.integer=e.integer),void 0!==e.divisor&&(this.divisor=e.divisor),void 0!==e.buffer&&(this.buffer=e.buffer),void 0!==e.index&&("boolean"==typeof e.index?this.index=e.index?1:0:this.index=e.index),void 0!==e.instanced&&(this.divisor=e.instanced?1:0),void 0!==e.isInstanced&&(this.divisor=e.isInstanced?1:0),this}},{key:"BYTES_PER_ELEMENT",get:function(){return e.getBytesPerElement(this)}},{key:"BYTES_PER_VERTEX",get:function(){return e.getBytesPerVertex(this)}}]),e}();function Oe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var ke,Se,Le,Fe={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},je={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:Fe},Re={removedProps:Fe},Ie=function(e){J()(r,e);var t=Oe(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=t.call(this,e,a)).stubRemovedMethods("Buffer","v6.0",["layout","setLayout","getIndexedParameter"]),n.target=a.target||(n.gl.webgl2?36662:34962),n.initialize(a),Object.seal(Q()(n)),n}return o()(r,[{key:"getElementCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/Te.getBytesPerElement(e))}},{key:"getVertexCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/Te.getBytesPerVertex(e))}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ArrayBuffer.isView(e)&&(e={data:e}),Number.isFinite(e)&&(e={byteLength:e}),e=we("Buffer",e,je),this.usage=e.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},e,e.accessor)),e.data?this._setData(e.data,e.offset,e.byteLength):this._setByteLength(e.byteLength||0),this}},{key:"setProps",value:function(e){return"accessor"in(e=we("Buffer",e,Re))&&this.setAccessor(e.accessor),this}},{key:"setAccessor",value:function(e){return delete(e=Object.assign({},e)).buffer,this.accessor=new Te(e),this}},{key:"reallocate",value:function(e){return e>this.byteLength?(this._setByteLength(e),!0):(this.bytesUsed=e,!1)}},{key:"setData",value:function(e){return this.initialize(e)}},{key:"subData",value:function(e){ArrayBuffer.isView(e)&&(e={data:e});var t=e,r=t.data,n=t.offset,i=void 0===n?0:n,a=t.srcOffset,o=void 0===a?0:a,u=e.byteLength||e.length;ie(r);var s=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(s,this.handle),0!==o||void 0!==u?(Object(D.a)(this.gl),this.gl.bufferSubData(this.target,i,r,o,u)):this.gl.bufferSubData(s,i,r),this.gl.bindBuffer(s,null),this.debugData=null,this._inferType(r),this}},{key:"copyData",value:function(e){var t=e.sourceBuffer,r=e.readOffset,n=void 0===r?0:r,i=e.writeOffset,a=void 0===i?0:i,o=e.size,u=this.gl;return Object(D.a)(u),u.bindBuffer(36662,t.handle),u.bindBuffer(36663,this.handle),u.copyBufferSubData(36662,36663,n,a,o),u.bindBuffer(36662,null),u.bindBuffer(36663,null),this.debugData=null,this}},{key:"getData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.dstData,r=void 0===t?null:t,n=e.srcByteOffset,i=void 0===n?0:n,a=e.dstOffset,o=void 0===a?0:a,u=e.length,s=void 0===u?0:u;Object(D.a)(this.gl);var c,l,f=pe(this.accessor.type||5126,{clamped:!1}),h=this._getAvailableElementCount(i),d=o;r?c=(l=r.length)-d:l=d+(c=Math.min(h,s||h));var v=Math.min(h,c);return ie((s=s||v)<=v),r=r||new f(l),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,i,r,o,s),this.gl.bindBuffer(36662,null),r}},{key:"bind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,r=void 0===t?this.target:t,n=e.index,i=void 0===n?this.accessor&&this.accessor.index:n,a=e.offset,o=void 0===a?0:a,u=e.size;return 35345===r||35982===r?void 0!==u?this.gl.bindBufferRange(r,i,this.handle,o,u):(ie(0===o),this.gl.bindBufferBase(r,i,this.handle)):this.gl.bindBuffer(r,this.handle),this}},{key:"unbind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,r=void 0===t?this.target:t,n=e.index,i=void 0===n?this.accessor&&this.accessor.index:n,a=35345===r||35982===r;return a?this.gl.bindBufferBase(r,i,null):this.gl.bindBuffer(r,null),this}},{key:"getDebugData",value:function(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(10,this.byteLength)}),{data:this.debugData,changed:!0})}},{key:"invalidateDebugData",value:function(){this.debugData=null}},{key:"_setData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.byteLength+t;ie(ArrayBuffer.isView(e)),this._trackDeallocatedMemory();var n=this._getTarget();this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.usage),this.gl.bufferSubData(n,t,e),this.gl.bindBuffer(n,null),this.debugData=e.slice(0,10),this.bytesUsed=r,this._trackAllocatedMemory(r);var i=be(e);return ie(i),this.setAccessor(new Te(this.accessor,{type:i})),this}},{key:"_setByteLength",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.usage;ie(e>=0),this._trackDeallocatedMemory();var r=e;0===e&&(r=new Float32Array(0));var n=this._getTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,t),this.gl.bindBuffer(n,null),this.usage=t,this.debugData=null,this.bytesUsed=e,this._trackAllocatedMemory(e),this}},{key:"_getTarget",value:function(){return this.gl.webgl2?36663:this.target}},{key:"_getAvailableElementCount",value:function(e){var t=e/pe(this.accessor.type||5126,{clamped:!1}).BYTES_PER_ELEMENT;return this.getElementCount()-t}},{key:"_inferType",value:function(e){this.accessor.type||this.setAccessor(new Te(this.accessor,{type:be(e)}))}},{key:"_createHandle",value:function(){return this.gl.createBuffer()}},{key:"_deleteHandle",value:function(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}},{key:"_getParameter",value:function(e){this.gl.bindBuffer(this.target,this.handle);var t=this.gl.getBufferParameter(this.target,e);return this.gl.bindBuffer(this.target,null),t}},{key:"setByteLength",value:function(e){return M.deprecated("setByteLength","reallocate")(),this.reallocate(e)}},{key:"updateAccessor",value:function(e){return M.deprecated("updateAccessor(...)","setAccessor(new Accessor(buffer.accessor, ...)")(),this.accessor=new Te(this.accessor,e),this}},{key:"type",get:function(){return M.deprecated("Buffer.type","Buffer.accessor.type")(),this.accessor.type}},{key:"bytes",get:function(){return M.deprecated("Buffer.bytes","Buffer.byteLength")(),this.byteLength}}]),r}(ge),Pe=(ke={},h()(ke,6407,{dataFormat:6407,types:[5121,33635]}),h()(ke,6408,{dataFormat:6408,types:[5121,32819,32820]}),h()(ke,6406,{dataFormat:6406,types:[5121]}),h()(ke,6409,{dataFormat:6409,types:[5121]}),h()(ke,6410,{dataFormat:6410,types:[5121]}),h()(ke,33326,{dataFormat:6403,types:[5126],gl2:!0}),h()(ke,33328,{dataFormat:33319,types:[5126],gl2:!0}),h()(ke,34837,{dataFormat:6407,types:[5126],gl2:!0}),h()(ke,34836,{dataFormat:6408,types:[5126],gl2:!0}),ke),Be=(Se={},h()(Se,6403,1),h()(Se,36244,1),h()(Se,33319,2),h()(Se,33320,2),h()(Se,6407,3),h()(Se,36248,3),h()(Se,6408,4),h()(Se,36249,4),h()(Se,6402,1),h()(Se,34041,1),h()(Se,6406,1),h()(Se,6409,1),h()(Se,6410,2),Se),Me=(Le={},h()(Le,5126,4),h()(Le,5125,4),h()(Le,5124,4),h()(Le,5123,2),h()(Le,5122,2),h()(Le,5131,2),h()(Le,5120,1),h()(Le,5121,1),Le);function De(e,t){var r=Pe[t];if(!r)return!1;if(void 0===r.gl1&&void 0===r.gl2)return!0;var n=Object(D.e)(e)&&r.gl2||r.gl1;return"string"==typeof n?e.getExtension(n):n}function Ne(e,t){var r=Pe[t];switch(r&&r.types[0]){case 5126:return e.getExtension("OES_texture_float_linear");case 5131:return e.getExtension("OES_texture_half_float_linear");default:return!0}}function Ce(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Ue(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ue(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var Ge=[9729,9728],ze=C.global.WebGLBuffer||function(){},He=function(e){J()(r,e);var t=Ve(r);function r(e,n){var a;i()(this,r);var o=n.id,u=void 0===o?se("texture"):o,s=n.handle,c=n.target;return(a=t.call(this,e,{id:u,handle:s})).target=c,a.textureUnit=void 0,a.loaded=!1,a.width=void 0,a.height=void 0,a.depth=void 0,a.format=void 0,a.type=void 0,a.dataFormat=void 0,a.border=void 0,a.textureUnit=void 0,a.mipmaps=void 0,a}return o()(r,null,[{key:"isSupported",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.format,n=t.linearFiltering,i=!0;return r&&(i=(i=i&&De(e,r))&&(!n||Ne(e,r))),i}}]),o()(r,[{key:"toString",value:function(){return"Texture(".concat(this.id,",").concat(this.width,"x").concat(this.height,")")}},{key:"initialize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.data;if(r instanceof Promise)return r.then((function(r){return e.initialize(Object.assign({},t,{pixels:r,data:r}))})),this;var n="undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",(function(){return e.initialize(t)})),this;var i=t.pixels,a=void 0===i?null:i,o=t.format,u=void 0===o?6408:o,s=t.border,c=void 0===s?0:s,l=t.recreate,f=void 0!==l&&l,h=t.parameters,d=void 0===h?{}:h,v=t.pixelStore,g=void 0===v?{}:v,m=t.textureUnit,y=void 0===m?void 0:m;r||(r=a);var b=t.width,p=t.height,_=t.dataFormat,A=t.type,w=t.compressed,x=void 0!==w&&w,E=t.mipmaps,T=void 0===E||E,O=t.depth,k=void 0===O?0:O,S=this._deduceParameters({format:u,type:A,dataFormat:_,compressed:x,data:r,width:b,height:p});return b=S.width,p=S.height,x=S.compressed,_=S.dataFormat,A=S.type,this.width=b,this.height=p,this.depth=k,this.format=u,this.type=A,this.dataFormat=_,this.border=c,this.textureUnit=y,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),T&&this._isNPOT()&&(M.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),T=!1,this._updateForNPOT(d)),this.mipmaps=T,this.setImageData({data:r,width:b,height:p,depth:k,format:u,type:A,dataFormat:_,border:c,mipmaps:T,parameters:g,compressed:x}),T&&this.generateMipmap(),this.setParameters(d),f&&(this.data=r),n&&(this._video={video:r,parameters:d,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}},{key:"update",value:function(){if(this._video){var e=this._video,t=e.video,r=e.parameters;if(e.lastTime===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}},{key:"resize",value:function(e){var t=e.height,r=e.width,n=e.mipmaps,i=void 0!==n&&n;return r!==this.width||t!==this.height?this.initialize({width:r,height:t,format:this.format,type:this.type,dataFormat:this.dataFormat,border:this.border,mipmaps:i}):this}},{key:"generateMipmap",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._isNPOT()?(M.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Object(N.c)(this.gl,t,(function(){e.gl.generateMipmap(e.target)})),this.gl.bindTexture(this.target,null),this)}},{key:"setImageData",value:function(e){this._trackDeallocatedMemory("Texture");var t=e.target,r=void 0===t?this.target:t,n=e.pixels,i=void 0===n?null:n,a=e.level,o=void 0===a?0:a,u=e.format,s=void 0===u?this.format:u,c=e.border,l=void 0===c?this.border:c,f=e.offset,h=void 0===f?0:f,d=e.parameters,v=void 0===d?{}:d,g=e.data,m=void 0===g?null:g,y=e.type,b=void 0===y?this.type:y,p=e.width,_=void 0===p?this.width:p,A=e.height,w=void 0===A?this.height:A,x=e.dataFormat,E=void 0===x?this.dataFormat:x,T=e.compressed,O=void 0!==T&&T;m||(m=i);var k=this._deduceParameters({format:s,type:b,dataFormat:E,compressed:O,data:m,width:_,height:w});b=k.type,E=k.dataFormat,O=k.compressed,_=k.width,w=k.height;var S=this.gl;S.bindTexture(this.target,this.handle);var L,F,j=this._getDataType({data:m,compressed:O});if(m=j.data,L=j.dataType,Object(N.c)(this.gl,v,(function(){switch(L){case"null":S.texImage2D(r,o,s,_,w,l,E,b,m);break;case"typed-array":S.texImage2D(r,o,s,_,w,l,E,b,m,h);break;case"buffer":(F=Object(D.a)(S)).bindBuffer(35052,m.handle||m),F.texImage2D(r,o,s,_,w,l,E,b,h),F.bindBuffer(35052,null);break;case"browser-object":Object(D.e)(S)?S.texImage2D(r,o,s,_,w,l,E,b,m):S.texImage2D(r,o,s,E,b,m);break;case"compressed":var e,t=Ce(m.entries());try{for(t.s();!(e=t.n()).done;){var n=ne()(e.value,2),i=n[0],a=n[1];S.compressedTexImage2D(r,i,a.format,a.width,a.height,l,a.data)}}catch(e){t.e(e)}finally{t.f()}break;default:ie(!1,"Unknown image data type")}})),m&&m.byteLength)this._trackAllocatedMemory(m.byteLength,"Texture");else{var R=Be[this.dataFormat]||4,I=Me[this.type]||1;this._trackAllocatedMemory(this.width*this.height*R*I,"Texture")}return this.loaded=!0,this}},{key:"setSubImageData",value:function(e){var t=this,r=e.target,n=void 0===r?this.target:r,i=e.pixels,a=void 0===i?null:i,o=e.data,u=void 0===o?null:o,s=e.x,c=void 0===s?0:s,l=e.y,f=void 0===l?0:l,h=e.width,d=void 0===h?this.width:h,v=e.height,g=void 0===v?this.height:v,m=e.level,y=void 0===m?0:m,b=e.format,p=void 0===b?this.format:b,_=e.type,A=void 0===_?this.type:_,w=e.dataFormat,x=void 0===w?this.dataFormat:w,E=e.compressed,T=void 0!==E&&E,O=e.offset,k=void 0===O?0:O,S=e.border,L=(void 0===S&&this.border,e.parameters),F=void 0===L?{}:L,j=this._deduceParameters({format:p,type:A,dataFormat:x,compressed:T,data:u,width:d,height:g});if(A=j.type,x=j.dataFormat,T=j.compressed,d=j.width,g=j.height,ie(0===this.depth,"texSubImage not supported for 3D textures"),u||(u=a),u&&u.data){var R=u;u=R.data,d=R.shape[0],g=R.shape[1]}u instanceof Ie&&(u=u.handle),this.gl.bindTexture(this.target,this.handle),Object(N.c)(this.gl,F,(function(){if(T)t.gl.compressedTexSubImage2D(n,y,c,f,d,g,p,u);else if(null===u)t.gl.texSubImage2D(n,y,c,f,d,g,x,A,null);else if(ArrayBuffer.isView(u))t.gl.texSubImage2D(n,y,c,f,d,g,x,A,u,k);else if(u instanceof ze){var e=Object(D.a)(t.gl);e.bindBuffer(35052,u),e.texSubImage2D(n,y,c,f,d,g,x,A,k),e.bindBuffer(35052,null)}else if(Object(D.e)(t.gl)){Object(D.a)(t.gl).texSubImage2D(n,y,c,f,d,g,x,A,u)}else t.gl.texSubImage2D(n,y,c,f,x,A,u)})),this.gl.bindTexture(this.target,null)}},{key:"copyFramebuffer",value:function(){return M.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}},{key:"getActiveUnit",value:function(){return this.gl.getParameter(34016)-33984}},{key:"bind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit,t=this.gl;return void 0!==e&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.target,this.handle),e}},{key:"unbind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit,t=this.gl;return void 0!==e&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.target,null),e}},{key:"_getDataType",value:function(e){var t=e.data,r=e.compressed;return void 0!==r&&r?{data:t,dataType:"compressed"}:null===t?{data:t,dataType:"null"}:ArrayBuffer.isView(t)?{data:t,dataType:"typed-array"}:t instanceof Ie?{data:t.handle,dataType:"buffer"}:t instanceof ze?{data:t,dataType:"buffer"}:{data:t,dataType:"browser-object"}}},{key:"_deduceParameters",value:function(e){var t=e.format,r=e.data,n=e.width,i=e.height,a=e.dataFormat,o=e.type,u=e.compressed,s=Pe[t];a=a||s&&s.dataFormat,o=o||s&&s.types[0],u=u||s&&s.compressed;var c=this._deduceImageSize(r,n,i);return{dataFormat:a,type:o,compressed:u,width:n=c.width,height:i=c.height,format:t,data:r}}},{key:"_deduceImageSize",value:function(e,t,r){var n;return ie(n="undefined"!=typeof ImageData&&e instanceof ImageData?{width:e.width,height:e.height}:"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?{width:e.naturalWidth,height:e.naturalHeight}:"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?{width:e.width,height:e.height}:"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e?{width:t,height:r}:{width:t>=0?t:1,height:r>=0?r:1},"Could not deduced texture size"),ie(void 0===t||n.width===t,"Deduced texture width does not match supplied width"),ie(void 0===r||n.height===r,"Deduced texture height does not match supplied height"),n}},{key:"_createHandle",value:function(){return this.gl.createTexture()}},{key:"_deleteHandle",value:function(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory("Texture")}},{key:"_getParameter",value:function(e){switch(e){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);var t=this.gl.getTexParameter(this.target,e);return this.gl.bindTexture(this.target,null),t}}},{key:"_setParameter",value:function(e,t){switch(this.gl.bindTexture(this.target,this.handle),t=this._getNPOTParam(e,t),e){case 33082:case 33083:this.gl.texParameterf(this.handle,e,t);break;case 4096:case 4097:ie(!1);break;default:this.gl.texParameteri(this.target,e,t)}return this.gl.bindTexture(this.target,null),this}},{key:"_isNPOT",value:function(){return!Object(D.e)(this.gl)&&(!(!this.width||!this.height)&&(!ce(this.width)||!ce(this.height)))}},{key:"_updateForNPOT",value:function(e){void 0===e[this.gl.TEXTURE_MIN_FILTER]&&(e[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),void 0===e[this.gl.TEXTURE_WRAP_S]&&(e[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),void 0===e[this.gl.TEXTURE_WRAP_T]&&(e[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}},{key:"_getNPOTParam",value:function(e,t){if(this._isNPOT())switch(e){case 10241:-1===Ge.indexOf(t)&&(t=9729);break;case 10242:case 10243:33071!==t&&(t=33071)}return t}}]),r}(ge),Xe="";function We(e){Xe=e}function Ye(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ie("string"==typeof e),e=Xe+e;var r=t.dataType||"text";return fetch(e,t).then((function(e){return e[r]()}))}function qe(e,t){return ie("string"==typeof e),e=Xe+e,new Promise((function(r,n){try{var i=new Image;i.onload=function(){return r(i)},i.onerror=function(){return n(new Error("Could not load image ".concat(e,".")))},i.crossOrigin=t&&t.crossOrigin||"anonymous",i.src=e}catch(e){n(e)}}))}function Qe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var $e=function(e){J()(r,e);var t=Qe(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),Object(D.b)(e),(a instanceof Promise||"string"==typeof a)&&(a={data:a}),"string"==typeof a.data&&(a=Object.assign({},a,{data:qe(a.data)})),(n=t.call(this,e,Object.assign({},a,{target:3553}))).initialize(a),Object.seal(Q()(n)),n}return o()(r,null,[{key:"isSupported",value:function(e,t){return He.isSupported(e,t)}}]),r}(He),Je=r(27),Ke=r.n(Je),Ze=r(37),et=r.n(Ze);function tt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var rt=[34069,34070,34071,34072,34073,34074],nt=function(e){J()(n,e);var t,r=tt(n);function n(e){var t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,n),Object(D.b)(e),(t=r.call(this,e,Object.assign({},a,{target:34067}))).initialize(a),Object.seal(Q()(t)),t}return o()(n,[{key:"initialize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.mipmaps,n=void 0===r||r,i=t.parameters,a=void 0===i?{}:i;return this.opts=t,this.setCubeMapImageData(t).then((function(){e.loaded=!0,n&&e.generateMipmap(t),e.setParameters(a)})),this}},{key:"subImage",value:function(e){var t=e.face,r=e.data,n=e.x,i=void 0===n?0:n,a=e.y,o=void 0===a?0:a,u=e.mipmapLevel,s=void 0===u?0:u;return this._subImage({target:t,data:r,x:i,y:o,mipmapLevel:s})}},{key:"setCubeMapImageData",value:(t=et()(Ke.a.mark((function e(t){var r,n,i,a,o,u,s,c,l,f,h,d,v,g=this;return Ke.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.width,n=t.height,i=t.pixels,a=t.data,o=t.border,u=void 0===o?0:o,s=t.format,c=void 0===s?6408:s,l=t.type,f=void 0===l?5121:l,h=this.gl,d=i||a,e.next=5,Promise.all(rt.map((function(e){var t=d[e];return Promise.all(Array.isArray(t)?t:[t])})));case 5:v=e.sent,this.bind(),rt.forEach((function(e,t){v[t].length>1&&!1!==g.opts.mipmaps&&M.warn("".concat(g.id," has mipmap and multiple LODs."))(),v[t].forEach((function(t,i){r&&n?h.texImage2D(e,i,c,r,n,u,c,f,t):h.texImage2D(e,i,c,c,f,t)}))})),this.unbind();case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setImageDataForFace",value:function(e){var t=this,r=e.face,n=e.width,i=e.height,a=e.pixels,o=e.data,u=e.border,s=void 0===u?0:u,c=e.format,l=void 0===c?6408:c,f=e.type,h=void 0===f?5121:f,d=this.gl,v=a||o;return this.bind(),v instanceof Promise?v.then((function(n){return t.setImageDataForFace(Object.assign({},e,{face:r,data:n,pixels:n}))})):this.width||this.height?d.texImage2D(r,0,l,n,i,s,l,h,v):d.texImage2D(r,0,l,l,h,v),this}}]),n}(He);function it(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}nt.FACES=rt;var at,ot=function(e){J()(r,e);var t=it(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),Object(D.a)(e),a=Object.assign({depth:1},a,{target:32879,unpackFlipY:!1}),(n=t.call(this,e,a)).initialize(a),Object.seal(Q()(n)),n}return o()(r,null,[{key:"isSupported",value:function(e){return Object(D.e)(e)}}]),o()(r,[{key:"setImageData",value:function(e){var t=this,r=e.level,n=void 0===r?0:r,i=e.dataFormat,a=void 0===i?6408:i,o=e.width,u=e.height,s=e.depth,c=void 0===s?1:s,l=e.border,f=void 0===l?0:l,h=e.format,d=e.type,v=void 0===d?5121:d,g=e.offset,m=void 0===g?0:g,y=e.data,b=e.parameters,p=void 0===b?{}:b;if(this._trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle),Object(N.c)(this.gl,p,(function(){ArrayBuffer.isView(y)&&t.gl.texImage3D(t.target,n,a,o,u,c,f,h,v,y),y instanceof Ie&&(t.gl.bindBuffer(35052,y.handle),t.gl.texImage3D(t.target,n,a,o,u,c,f,h,v,m))})),y&&y.byteLength)this._trackAllocatedMemory(y.byteLength,"Texture");else{var _=Be[this.dataFormat]||4,A=Me[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*_*A,"Texture")}return this.loaded=!0,this}}]),r}(He),ut=r(18),st=r.n(ut),ct="EXT_color_buffer_float",lt=(at={},h()(at,33189,{bpp:2}),h()(at,33190,{gl2:!0,bpp:3}),h()(at,36012,{gl2:!0,bpp:4}),h()(at,36168,{bpp:1}),h()(at,34041,{bpp:4}),h()(at,35056,{gl2:!0,bpp:4}),h()(at,36013,{gl2:!0,bpp:5}),h()(at,32854,{bpp:2}),h()(at,36194,{bpp:2}),h()(at,32855,{bpp:2}),h()(at,33321,{gl2:!0,bpp:1}),h()(at,33330,{gl2:!0,bpp:1}),h()(at,33329,{gl2:!0,bpp:1}),h()(at,33332,{gl2:!0,bpp:2}),h()(at,33331,{gl2:!0,bpp:2}),h()(at,33334,{gl2:!0,bpp:4}),h()(at,33333,{gl2:!0,bpp:4}),h()(at,33323,{gl2:!0,bpp:2}),h()(at,33336,{gl2:!0,bpp:2}),h()(at,33335,{gl2:!0,bpp:2}),h()(at,33338,{gl2:!0,bpp:4}),h()(at,33337,{gl2:!0,bpp:4}),h()(at,33340,{gl2:!0,bpp:8}),h()(at,33339,{gl2:!0,bpp:8}),h()(at,32849,{gl2:!0,bpp:3}),h()(at,32856,{gl2:!0,bpp:4}),h()(at,32857,{gl2:!0,bpp:4}),h()(at,36220,{gl2:!0,bpp:4}),h()(at,36238,{gl2:!0,bpp:4}),h()(at,36975,{gl2:!0,bpp:4}),h()(at,36214,{gl2:!0,bpp:8}),h()(at,36232,{gl2:!0,bpp:8}),h()(at,36226,{gl2:!0,bpp:16}),h()(at,36208,{gl2:!0,bpp:16}),h()(at,33325,{gl2:ct,bpp:2}),h()(at,33327,{gl2:ct,bpp:4}),h()(at,34842,{gl2:ct,bpp:8}),h()(at,33326,{gl2:ct,bpp:4}),h()(at,33328,{gl2:ct,bpp:8}),h()(at,34836,{gl2:ct,bpp:16}),h()(at,35898,{gl2:ct,bpp:4}),at);function ft(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}function ht(e,t,r){var n=r[t];if(!n)return!1;var i=Object(D.e)(e)&&n.gl2||n.gl1;return"string"==typeof i?e.getExtension(i):i}var dt,vt=function(e){J()(r,e);var t=ft(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=t.call(this,e,a)).initialize(a),Object.seal(Q()(n)),n}return o()(r,null,[{key:"isSupported",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{format:null},r=t.format;return!r||ht(e,r,lt)}},{key:"getSamplesForFormat",value:function(e,t){var r=t.format;return e.getInternalformatParameter(36161,r,32937)}}]),o()(r,[{key:"initialize",value:function(e){var t=e.format,r=e.width,n=void 0===r?1:r,i=e.height,a=void 0===i?1:i,o=e.samples,u=void 0===o?0:o;return ie(t,"Needs format"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),0!==u&&Object(D.e)(this.gl)?this.gl.renderbufferStorageMultisample(36161,u,t,n,a):this.gl.renderbufferStorage(36161,t,n,a),this.format=t,this.width=n,this.height=a,this.samples=u,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*lt[this.format].bpp),this}},{key:"resize",value:function(e){var t=e.width,r=e.height;return t!==this.width||r!==this.height?this.initialize({width:t,height:r,format:this.format,samples:this.samples}):this}},{key:"_createHandle",value:function(){return this.gl.createRenderbuffer()}},{key:"_deleteHandle",value:function(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}},{key:"_bindHandle",value:function(e){this.gl.bindRenderbuffer(36161,e)}},{key:"_syncHandle",value:function(e){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}},{key:"_getParameter",value:function(e){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,e)}}]),r}(ge);function gt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.framebuffer,n=void 0===r?null:r,i=t.color,a=void 0===i?null:i,o=t.depth,u=void 0===o?null:o,s=t.stencil,c=void 0===s?null:s,l={};n&&(l.framebuffer=n);var f=0;a&&(f|=16384,!0!==a&&(l.clearColor=a)),u&&(f|=256,!0!==u&&(l.clearDepth=u)),c&&(f|=1024,!0!==u&&(l.clearStencil=u)),ie(0!==f,"clear: bad arguments"),Object(N.c)(e,l,(function(){e.clear(f)}))}function mt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.framebuffer,n=void 0===r?null:r,i=t.buffer,a=void 0===i?6144:i,o=t.drawBuffer,u=void 0===o?0:o,s=t.value,c=void 0===s?[0,0,0,0]:s;Object(D.a)(e),Object(N.c)(e,{framebuffer:n},(function(){switch(a){case 6144:switch(c.constructor){case Int32Array:e.clearBufferiv(a,u,c);break;case Uint32Array:e.clearBufferuiv(a,u,c);break;case Float32Array:default:e.clearBufferfv(a,u,c)}break;case 6145:e.clearBufferfv(6145,0,[c]);break;case 6146:e.clearBufferiv(6146,0,[c]);break;case 34041:var t=ne()(c,2),r=t[0],n=t[1];e.clearBufferfi(34041,0,r,n);break;default:ie(!1,"clear: bad arguments")}}))}function yt(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return ie(!1),0}}function bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.sourceX,n=void 0===r?0:r,i=t.sourceY,a=void 0===i?0:i,o=t.sourceFormat,u=void 0===o?6408:o,s=t.sourceAttachment,c=void 0===s?36064:s,l=t.target,f=void 0===l?null:l,h=t.sourceWidth,d=t.sourceHeight,v=t.sourceType,g=Et(e),m=g.framebuffer,y=g.deleteFramebuffer;ie(m);var b=m.gl,p=m.handle,_=m.attachments;h=h||m.width,d=d||m.height,36064===c&&null===p&&(c=1028),ie(_[c]),f=Tt(f,v=v||_[c].type,u,h,d),v=v||be(f);var A=b.bindFramebuffer(36160,p);return b.readPixels(n,a,h,d,u,v,f),b.bindFramebuffer(36160,A||null),y&&m.delete(),f}function pt(e,t){var r=t.sourceX,n=void 0===r?0:r,i=t.sourceY,a=void 0===i?0:i,o=t.sourceFormat,u=void 0===o?6408:o,s=t.target,c=void 0===s?null:s,l=t.targetByteOffset,f=void 0===l?0:l,h=t.sourceWidth,d=t.sourceHeight,v=t.sourceType,g=Et(e),m=g.framebuffer,y=g.deleteFramebuffer;ie(m),h=h||m.width,d=d||m.height;var b=Object(D.a)(m.gl);if(v=v||(c?c.type:5121),!c){var p=yt(u),_=function(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return ie(!1),0}}(v);c=new Ie(b,{byteLength:f+h*d*p*_,accessor:{type:v,size:p}})}return c.bind({target:35051}),Object(N.c)(b,{framebuffer:m},(function(){b.readPixels(n,a,h,d,u,v,f)})),c.unbind({target:35051}),y&&m.delete(),c}function _t(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.sourceAttachment,n=void 0===r?36064:r,i=t.targetMaxHeight,a=void 0===i?Number.MAX_SAFE_INTEGER:i,o=bt(e,{sourceAttachment:n}),u=e.width,s=e.height;s>a;){var c=Ae({data:o,width:u,height:s});o=c.data,u=c.width,s=c.height}_e({data:o,width:u,height:s});var l=document.createElement("canvas");l.width=u,l.height=s;var f=l.getContext("2d"),h=f.createImageData(u,s);return h.data.set(o),f.putImageData(h,0,0),l.toDataURL()}function At(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.sourceAttachment,n=void 0===r?36064:r,i=t.targetImage,a=void 0===i?null:i,o=_t(e,{sourceAttachment:n});return(a=a||new Image).src=o,a}function wt(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.sourceX,i=void 0===n?0:n,a=r.sourceY,o=void 0===a?0:a,u=r.targetMipmaplevel,s=void 0===u?0:u,c=r.targetInternalFormat,l=void 0===c?6408:c,f=r.targetX,h=r.targetY,d=r.targetZ,v=r.width,g=r.height,m=Et(e),y=m.framebuffer,b=m.deleteFramebuffer;ie(y);var p=y.gl,_=y.handle,A=void 0!==f||void 0!==h||void 0!==d;f=f||0,h=h||0,d=d||0;var w=p.bindFramebuffer(36160,_);ie(t);var x=null;if(t instanceof He&&(x=t,v=Number.isFinite(v)?v:x.width,g=Number.isFinite(g)?g:x.height,x.bind(0),t=x.target),A)switch(t){case 3553:case 34067:p.copyTexSubImage2D(t,s,f,h,i,o,v,g);break;case 35866:case 32879:var E=Object(D.a)(p);E.copyTexSubImage3D(t,s,f,h,d,i,o,v,g)}else p.copyTexImage2D(t,s,l,i,o,v,g,0);return x&&x.unbind(),p.bindFramebuffer(36160,w||null),b&&y.delete(),x}function xt(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.sourceX0,i=void 0===n?0:n,a=r.sourceY0,o=void 0===a?0:a,u=r.targetX0,s=void 0===u?0:u,c=r.targetY0,l=void 0===c?0:c,f=r.color,h=void 0===f||f,d=r.depth,v=void 0!==d&&d,g=r.stencil,m=void 0!==g&&g,y=r.filter,b=void 0===y?9728:y,p=r.sourceX1,_=r.sourceY1,A=r.targetX1,w=r.targetY1,x=r.sourceAttachment,E=void 0===x?36064:x,T=r.mask,O=void 0===T?0:T,k=Et(e),S=k.framebuffer,L=k.deleteFramebuffer,F=Et(t),j=F.framebuffer,R=F.deleteFramebuffer;ie(S),ie(j);var I=j.gl,P=j.handle,B=j.width,N=j.height,C=j.readBuffer,U=Object(D.a)(I);S.handle||36064!==E||(E=1028),h&&(O|=16384),v&&(O|=256),m&&(O|=1024),(L||R)&&1280&O&&(O=16384,M.warn("Blitting from or into a Texture object, forcing mask to GL.COLOR_BUFFER_BIT")()),ie(O),p=void 0===p?S.width:p,_=void 0===_?S.height:_,A=void 0===A?B:A,w=void 0===w?N:w;var V=I.bindFramebuffer(36009,P),G=I.bindFramebuffer(36008,S.handle);return U.readBuffer(E),U.blitFramebuffer(i,o,p,_,s,l,A,w,O,b),U.readBuffer(C),U.bindFramebuffer(36008,G||null),U.bindFramebuffer(36009,V||null),L&&S.delete(),R&&j.delete(),j}function Et(e){return e instanceof Dt?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:(t=e,n=t.gl,i=t.width,a=t.height,o=t.id,u=new Dt(n,Object.assign({},r,{id:"framebuffer-for-".concat(o),width:i,height:a,attachments:h()({},36064,t)})),u),deleteFramebuffer:!0};var t,r,n,i,a,o,u}function Tt(e,t,r,n,i){return e||new(pe(t=t||5121,{clamped:!1}))(n*i*yt(r))}var Ot={WEBGL2:"WEBGL2",VERTEX_ARRAY_OBJECT:"VERTEX_ARRAY_OBJECT",TIMER_QUERY:"TIMER_QUERY",INSTANCED_RENDERING:"INSTANCED_RENDERING",MULTIPLE_RENDER_TARGETS:"MULTIPLE_RENDER_TARGETS",ELEMENT_INDEX_UINT32:"ELEMENT_INDEX_UINT32",BLEND_EQUATION_MINMAX:"BLEND_EQUATION_MINMAX",FLOAT_BLEND:"FLOAT_BLEND",COLOR_ENCODING_SRGB:"COLOR_ENCODING_SRGB",TEXTURE_DEPTH:"TEXTURE_DEPTH",TEXTURE_FLOAT:"TEXTURE_FLOAT",TEXTURE_HALF_FLOAT:"TEXTURE_HALF_FLOAT",TEXTURE_FILTER_LINEAR_FLOAT:"TEXTURE_FILTER_LINEAR_FLOAT",TEXTURE_FILTER_LINEAR_HALF_FLOAT:"TEXTURE_FILTER_LINEAR_HALF_FLOAT",TEXTURE_FILTER_ANISOTROPIC:"TEXTURE_FILTER_ANISOTROPIC",COLOR_ATTACHMENT_RGBA32F:"COLOR_ATTACHMENT_RGBA32F",COLOR_ATTACHMENT_FLOAT:"COLOR_ATTACHMENT_FLOAT",COLOR_ATTACHMENT_HALF_FLOAT:"COLOR_ATTACHMENT_HALF_FLOAT",GLSL_FRAG_DATA:"GLSL_FRAG_DATA",GLSL_FRAG_DEPTH:"GLSL_FRAG_DEPTH",GLSL_DERIVATIVES:"GLSL_DERIVATIVES",GLSL_TEXTURE_LOD:"GLSL_TEXTURE_LOD"};var kt=(dt={},h()(dt,Ot.WEBGL2,[!1,!0]),h()(dt,Ot.VERTEX_ARRAY_OBJECT,["OES_vertex_array_object",!0]),h()(dt,Ot.TIMER_QUERY,["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"]),h()(dt,Ot.INSTANCED_RENDERING,["ANGLE_instanced_arrays",!0]),h()(dt,Ot.MULTIPLE_RENDER_TARGETS,["WEBGL_draw_buffers",!0]),h()(dt,Ot.ELEMENT_INDEX_UINT32,["OES_element_index_uint",!0]),h()(dt,Ot.BLEND_EQUATION_MINMAX,["EXT_blend_minmax",!0]),h()(dt,Ot.FLOAT_BLEND,["EXT_float_blend"]),h()(dt,Ot.COLOR_ENCODING_SRGB,["EXT_sRGB",!0]),h()(dt,Ot.TEXTURE_DEPTH,["WEBGL_depth_texture",!0]),h()(dt,Ot.TEXTURE_FLOAT,["OES_texture_float",!0]),h()(dt,Ot.TEXTURE_HALF_FLOAT,["OES_texture_half_float",!0]),h()(dt,Ot.TEXTURE_FILTER_LINEAR_FLOAT,["OES_texture_float_linear"]),h()(dt,Ot.TEXTURE_FILTER_LINEAR_HALF_FLOAT,["OES_texture_half_float_linear"]),h()(dt,Ot.TEXTURE_FILTER_ANISOTROPIC,["EXT_texture_filter_anisotropic"]),h()(dt,Ot.COLOR_ATTACHMENT_RGBA32F,[function(e){var t=new $e(e,{format:6408,type:5126,dataFormat:6408}),r=new Dt(e,{id:"test-framebuffer",check:!1,attachments:h()({},36064,t)}),n=r.getStatus();return t.delete(),r.delete(),36053===n},"EXT_color_buffer_float"]),h()(dt,Ot.COLOR_ATTACHMENT_FLOAT,[!1,"EXT_color_buffer_float"]),h()(dt,Ot.COLOR_ATTACHMENT_HALF_FLOAT,["EXT_color_buffer_half_float"]),h()(dt,Ot.GLSL_FRAG_DATA,["WEBGL_draw_buffers",!0]),h()(dt,Ot.GLSL_FRAG_DEPTH,["EXT_frag_depth",!0]),h()(dt,Ot.GLSL_DERIVATIVES,["OES_standard_derivatives",!0]),h()(dt,Ot.GLSL_TEXTURE_LOD,["EXT_shader_texture_lod",!0]),dt);function St(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Lt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Lt(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ft(e,t){return jt(e,t)}function jt(e,t){return(t=Array.isArray(t)?t:[t]).every((function(t){return It(e,t)}))}function Rt(e){for(var t in e.luma=e.luma||{},e.luma.caps=e.luma.caps||{},kt)void 0===e.luma.caps[t]&&(e.luma.caps[t]=It(e,t));return e.luma.caps}function It(e,t){return e.luma=e.luma||{},e.luma.caps=e.luma.caps||{},void 0===e.luma.caps[t]&&(e.luma.caps[t]=function(e,t){var r,n=kt[t];ie(n,t);var i=Object(D.e)(e)&&n[1]||n[0];if("function"==typeof i)r=i(e);else if(Array.isArray(i)){r=!0;var a,o=St(i);try{for(o.s();!(a=o.n()).done;){var u=a.value;r=r&&Boolean(e.getExtension(u))}}catch(e){o.e(e)}finally{o.f()}}else"string"==typeof i?r=Boolean(e.getExtension(i)):"boolean"==typeof i?r=i:ie(!1);return r}(e,t)),e.luma.caps[t]||M.log(2,"Feature: ".concat(t," not supported"))(),e.luma.caps[t]}function Pt(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Bt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bt(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Mt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var Dt=function(e){J()(r,e);var t=Mt(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=t.call(this,e,a)).width=null,n.height=null,n.attachments={},n.readBuffer=36064,n.drawBuffers=[36064],n.ownResources=[],n.initialize(a),Object.seal(Q()(n)),n}return o()(r,[{key:"MAX_COLOR_ATTACHMENTS",get:function(){var e=Object(D.a)(this.gl);return e.getParameter(e.MAX_COLOR_ATTACHMENTS)}},{key:"MAX_DRAW_BUFFERS",get:function(){var e=Object(D.a)(this.gl);return e.getParameter(e.MAX_DRAW_BUFFERS)}}],[{key:"isSupported",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.colorBufferFloat,n=t.colorBufferHalfFloat,i=!0;return r&&(i=Boolean(e.getExtension("EXT_color_buffer_float")||e.getExtension("WEBGL_color_buffer_float")||e.getExtension("OES_texture_float"))),n&&(i=i&&Boolean(e.getExtension("EXT_color_buffer_float")||e.getExtension("EXT_color_buffer_half_float"))),i}},{key:"getDefaultFramebuffer",value:function(e){return e.luma=e.luma||{},e.luma.defaultFramebuffer=e.luma.defaultFramebuffer||new r(e,{id:"default-framebuffer",handle:null,attachments:{}}),e.luma.defaultFramebuffer}}]),o()(r,[{key:"initialize",value:function(e){var t=e.width,r=void 0===t?1:t,n=e.height,i=void 0===n?1:n,a=e.attachments,o=void 0===a?null:a,u=e.color,s=void 0===u||u,c=e.depth,l=void 0===c||c,f=e.stencil,h=void 0!==f&&f,d=e.check,v=void 0===d||d,g=e.readBuffer,m=void 0===g?void 0:g,y=e.drawBuffers,b=void 0===y?void 0:y;if(ie(r>=0&&i>=0,"Width and height need to be integers"),this.width=r,this.height=i,o)for(var p in o){var _=o[p];(Array.isArray(_)?_[0]:_).resize({width:r,height:i})}else o=this._createDefaultAttachments(s,l,h,r,i);this.update({clearAttachments:!0,attachments:o,readBuffer:m,drawBuffers:b}),o&&v&&this.checkStatus()}},{key:"delete",value:function(){var e,t=Pt(this.ownResources);try{for(t.s();!(e=t.n()).done;){e.value.delete()}}catch(e){t.e(e)}finally{t.f()}return st()(te()(r.prototype),"delete",this).call(this),this}},{key:"update",value:function(e){var t=e.attachments,r=void 0===t?{}:t,n=e.readBuffer,i=e.drawBuffers,a=e.clearAttachments,o=void 0!==a&&a,u=e.resizeAttachments,s=void 0===u||u;this.attach(r,{clearAttachments:o,resizeAttachments:s});var c=this.gl,l=c.bindFramebuffer(36160,this.handle);return n&&this._setReadBuffer(n),i&&this._setDrawBuffers(i),c.bindFramebuffer(36160,l||null),this}},{key:"resize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.width,r=e.height;if(null===this.handle)return ie(void 0===t&&void 0===r),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;for(var n in void 0===t&&(t=this.gl.drawingBufferWidth),void 0===r&&(r=this.gl.drawingBufferHeight),t!==this.width&&r!==this.height&&M.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(t,"x").concat(r))(),this.attachments)this.attachments[n].resize({width:t,height:r});return this.width=t,this.height=r,this}},{key:"attach",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clearAttachments,i=void 0!==n&&n,a=r.resizeAttachments,o=void 0===a||a,u={};i&&Object.keys(this.attachments).forEach((function(e){u[e]=null})),Object.assign(u,e);var s=this.gl.bindFramebuffer(36160,this.handle);for(var c in u){ie(void 0!==c,"Misspelled framebuffer binding point?");var l=Number(c),f=u[l],h=f;if(h)if(h instanceof vt)this._attachRenderbuffer({attachment:l,renderbuffer:h});else if(Array.isArray(f)){var d=ne()(f,3),v=d[0],g=d[1],m=void 0===g?0:g,y=d[2],b=void 0===y?0:y;h=v,this._attachTexture({attachment:l,texture:v,layer:m,level:b})}else this._attachTexture({attachment:l,texture:h,layer:0,level:0});else this._unattach(l);o&&h&&h.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,s||null),Object.assign(this.attachments,e),Object.keys(this.attachments).filter((function(e){return!t.attachments[e]})).forEach((function(e){delete t.attachments[e]}))}},{key:"checkStatus",value:function(){this.gl;var e=this.getStatus();if(36053!==e)throw new Error(function(e){return(Dt.STATUS||{})[e]||"Framebuffer error ".concat(e)}(e));return this}},{key:"getStatus",value:function(){var e=this.gl,t=e.bindFramebuffer(36160,this.handle),r=e.checkFramebufferStatus(36160);return e.bindFramebuffer(36160,t||null),r}},{key:"clear",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.color,n=t.depth,i=t.stencil,a=t.drawBuffers,o=void 0===a?[]:a,u=this.gl.bindFramebuffer(36160,this.handle);return(r||n||i)&&gt(this.gl,{color:r,depth:n,stencil:i}),o.forEach((function(t,r){mt(e.gl,{drawBuffer:r,value:t})})),this.gl.bindFramebuffer(36160,u||null),this}},{key:"readPixels",value:function(){return M.error("Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)")(),null}},{key:"readPixelsToBuffer",value:function(){return M.error("Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)")(),null}},{key:"copyToDataUrl",value:function(){return M.error("Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)")(),null}},{key:"copyToImage",value:function(){return M.error("Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)")(),null}},{key:"copyToTexture",value:function(){return M.error("Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}},{key:"blit",value:function(){return M.error("Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)")(),null}},{key:"invalidate",value:function(e){var t=e.attachments,r=void 0===t?[]:t,n=e.x,i=void 0===n?0:n,a=e.y,o=void 0===a?0:a,u=e.width,s=e.height,c=Object(D.a)(this.gl),l=c.bindFramebuffer(36008,this.handle);return 0===i&&0===o&&void 0===u&&void 0===s?c.invalidateFramebuffer(36008,r):c.invalidateFramebuffer(36008,r,i,o,u,s),c.bindFramebuffer(36008,l),this}},{key:"getAttachmentParameter",value:function(e,t,r){var n=this._getAttachmentParameterFallback(t);return null===n&&(this.gl.bindFramebuffer(36160,this.handle),n=this.gl.getFramebufferAttachmentParameter(36160,e,t),this.gl.bindFramebuffer(36160,null)),r&&n>1e3&&(n=oe(this.gl,n)),n}},{key:"getAttachmentParameters",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:36064,r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[],i={},a=Pt(n);try{for(a.s();!(e=a.n()).done;){var o=e.value,u=r?oe(this.gl,o):o;i[u]=this.getAttachmentParameter(t,o,r)}}catch(e){a.e(e)}finally{a.f()}return i}},{key:"getParameters",value:function(){for(var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=Object.keys(this.attachments),r={},n=0,i=t;n<i.length;n++){var a=i[n],o=Number(a),u=e?oe(this.gl,o):o;r[u]=this.getAttachmentParameters(o,e)}return r}},{key:"show",value:function(){return"undefined"!=typeof window&&window.open(_t(this),"luma-debug-texture"),this}},{key:"log",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(e>M.level||"undefined"==typeof window)return this;t=t||"Framebuffer ".concat(this.id);var r=_t(this,{targetMaxHeight:100});return M.image({logLevel:e,message:t,image:r},t)(),this}},{key:"bind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,r=void 0===t?36160:t;return this.gl.bindFramebuffer(r,this.handle),this}},{key:"unbind",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,r=void 0===t?36160:t;return this.gl.bindFramebuffer(r,null),this}},{key:"_createDefaultAttachments",value:function(e,t,r,n,i){var a,o=null;e&&((o=o||{})[36064]=new $e(this.gl,{id:"".concat(this.id,"-color0"),pixels:null,format:6408,type:5121,width:n,height:i,mipmaps:!1,parameters:(a={},h()(a,10241,9729),h()(a,10240,9729),h()(a,10242,33071),h()(a,10243,33071),a)}),this.ownResources.push(o[36064]));return t&&r?((o=o||{})[33306]=new vt(this.gl,{id:"".concat(this.id,"-depth-stencil"),format:35056,width:n,height:111}),this.ownResources.push(o[33306])):t?((o=o||{})[36096]=new vt(this.gl,{id:"".concat(this.id,"-depth"),format:33189,width:n,height:i}),this.ownResources.push(o[36096])):r&&ie(!1),o}},{key:"_unattach",value:function(e){var t=this.attachments[e];t&&(t instanceof vt?this.gl.framebufferRenderbuffer(36160,e,36161,null):this.gl.framebufferTexture2D(36160,e,3553,null,0),delete this.attachments[e])}},{key:"_attachRenderbuffer",value:function(e){var t=e.attachment,r=void 0===t?36064:t,n=e.renderbuffer;this.gl.framebufferRenderbuffer(36160,r,36161,n.handle),this.attachments[r]=n}},{key:"_attachTexture",value:function(e){var t=e.attachment,r=void 0===t?36064:t,n=e.texture,i=e.layer,a=e.level,o=this.gl;switch(o.bindTexture(n.target,n.handle),n.target){case 35866:case 32879:Object(D.a)(o).framebufferTextureLayer(36160,r,n.target,a,i);break;case 34067:var u=function(e){return e<34069?e+34069:e}(i);o.framebufferTexture2D(36160,r,u,n.handle,a);break;case 3553:o.framebufferTexture2D(36160,r,3553,n.handle,a);break;default:ie(!1,"Illegal texture type")}o.bindTexture(n.target,null),this.attachments[r]=n}},{key:"_setReadBuffer",value:function(e){var t=Object(D.c)(this.gl);t?t.readBuffer(e):ie(36064===e||1029===e,"Multiple render targets not supported"),this.readBuffer=e}},{key:"_setDrawBuffers",value:function(e){var t=this.gl,r=Object(D.a)(t);if(r)r.drawBuffers(e);else{var n=t.getExtension("WEBGL_draw_buffers");n?n.drawBuffersWEBGL(e):ie(1===e.length&&(36064===e[0]||1029===e[0]),"Multiple render targets not supported")}this.drawBuffers=e}},{key:"_getAttachmentParameterFallback",value:function(e){var t=Rt(this.gl);switch(e){case 36052:return t.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return t.WEBGL2?null:8;case 33297:return t.WEBGL2?null:5125;case 33296:return t.WEBGL2||t.EXT_sRGB?null:9729;default:return null}}},{key:"_createHandle",value:function(){return this.gl.createFramebuffer()}},{key:"_deleteHandle",value:function(){this.gl.deleteFramebuffer(this.handle)}},{key:"_bindHandle",value:function(e){return this.gl.bindFramebuffer(36160,e)}},{key:"color",get:function(){return this.attachments[36064]||null}},{key:"texture",get:function(){return this.attachments[36064]||null}},{key:"depth",get:function(){return this.attachments[36096]||this.attachments[33306]||null}},{key:"stencil",get:function(){return this.attachments[36128]||this.attachments[33306]||null}}]),r}(ge);var Nt;function Ct(e,t){ie(e instanceof $e||e instanceof nt||e instanceof ot);var r=e.constructor,n=e.gl,i=e.width,a=e.height,o=e.format,u=e.type,s=e.dataFormat,c=e.border,l=e.mipmaps;return new r(n,Object.assign({width:i,height:a,format:o,type:u,dataFormat:s,border:c,mipmaps:l},t))}Dt.ATTACHMENT_PARAMETERS=[36049,36048,33296,33298,33299,33300,33301,33302,33303];var Ut=(Nt={},h()(Nt,33902,{gl1:new Float32Array([1,1])}),h()(Nt,33901,{gl1:new Float32Array([1,1])}),h()(Nt,3379,{gl1:64,gl2:2048}),h()(Nt,34076,{gl1:16}),h()(Nt,34930,{gl1:8}),h()(Nt,35661,{gl1:8}),h()(Nt,35660,{gl1:0}),h()(Nt,34024,{gl1:1}),h()(Nt,36348,{gl1:8}),h()(Nt,34921,{gl1:8}),h()(Nt,36347,{gl1:128}),h()(Nt,36349,{gl1:16}),h()(Nt,3386,{gl1:new Int32Array([0,0])}),h()(Nt,32883,{gl1:0,gl2:256}),h()(Nt,35071,{gl1:0,gl2:256}),h()(Nt,37447,{gl1:0,gl2:0}),h()(Nt,36063,{gl1:0,gl2:4}),h()(Nt,35379,{gl1:0,gl2:0}),h()(Nt,35374,{gl1:0,gl2:0}),h()(Nt,35377,{gl1:0,gl2:0}),h()(Nt,34852,{gl1:0,gl2:4}),h()(Nt,36203,{gl1:0,gl2:0}),h()(Nt,33001,{gl1:0,gl2:0}),h()(Nt,33e3,{gl1:0,gl2:0}),h()(Nt,37157,{gl1:0,gl2:0}),h()(Nt,35373,{gl1:0,gl2:0}),h()(Nt,35657,{gl1:0,gl2:0}),h()(Nt,36183,{gl1:0,gl2:0}),h()(Nt,37137,{gl1:0,gl2:0}),h()(Nt,34045,{gl1:0,gl2:0}),h()(Nt,35978,{gl1:0,gl2:0}),h()(Nt,35979,{gl1:0,gl2:0}),h()(Nt,35968,{gl1:0,gl2:0}),h()(Nt,35376,{gl1:0,gl2:0}),h()(Nt,35375,{gl1:0,gl2:0}),h()(Nt,35659,{gl1:0,gl2:0}),h()(Nt,37154,{gl1:0,gl2:0}),h()(Nt,35371,{gl1:0,gl2:0}),h()(Nt,35658,{gl1:0,gl2:0}),h()(Nt,35076,{gl1:0,gl2:-8,negative:!0}),h()(Nt,35077,{gl1:0,gl2:7}),h()(Nt,35380,{gl1:0,gl2:0}),Nt);function Vt(e){if(e.luma=e.luma||{},!e.luma.limits){e.luma.limits={},e.luma.webgl1MinLimits={},e.luma.webgl2MinLimits={};var t=Object(D.e)(e);for(var r in Ut){var n=Ut[r],i=n.gl1,a="gl2"in n?n.gl2:n.gl1,o=t?a:i,u="gl2"in n&&!t||"extension"in n&&!e.getExtension(n.extension)?o:e.getParameter(r);e.luma.limits[r]=u,e.luma.webgl1MinLimits[r]=i,e.luma.webgl2MinLimits[r]=a}}return e.luma.limits}function Gt(e){e.luma=e.luma||{};var t,r=V(e);e.luma.info||(e.luma.info=(t={},h()(t,37445,r.vendor),h()(t,37446,r.renderer),h()(t,7936,r.vendorMasked),h()(t,7937,r.rendererMasked),h()(t,7938,r.version),h()(t,35724,r.shadingLanguageVersion),t));return e.luma.info}function zt(e){return Object.assign(V(e),{limits:Vt(e),info:Gt(e),webgl1MinLimits:e.luma.webgl1MinLimits,webgl2MinLimits:e.luma.webgl2MinLimits})}function Ht(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t="undefined"!=typeof window&&window.navigator||{},r=e.userAgent||t.userAgent||"",n=-1!==r.indexOf("MSIE "),i=-1!==r.indexOf("Trident/");return n||i}var Xt={};function Wt(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=kt[t];if(ie(n,t),!Ht(r))return!0;if(t in Xt)return Xt[t];var i=n[0],a="#extension GL_".concat(i," : enable\nvoid main(void) {}"),o=e.createShader(35633);e.shaderSource(o,a),e.compileShader(o);var u=e.getShaderParameter(o,35713);return e.deleteShader(o),Xt[t]=u,u}function Yt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unnamed",r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,n=e.match(r);return n?n[1]:t}function qt(e,t,r,n){for(var i=e.split(/\r?\n/),a={},o={},u=n||Yt(t)||"(unnamed)",s="".concat(function(e){switch(e){case 35632:return"fragment";case 35633:return"vertex";default:return"unknown type"}}(r)," shader ").concat(u),c=0;c<i.length;c++){var l=i[c];if(!(l.length<=1)){var f=l.split(":"),h=f[0],d=parseInt(f[2],10);if(isNaN(d))throw new Error("GLSL compilation error in ".concat(s,": ").concat(e));"WARNING"!==h?a[d]=l:o[d]=l}}var v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:": ",n=e.split(/\r?\n/),i=String(n.length+t-1).length;return n.map((function(e,n){var a=String(n+t),o=a.length;return $t(a,i-o)+r+e}))}(t);return{shaderName:s,errors:Qt(a,v),warnings:Qt(o,v)}}function Qt(e,t){for(var r="",n=0;n<t.length;n++){var i=t[n];if((e[n+3]||e[n+2]||e[n+1])&&(r+="".concat(i,"\n"),e[n+1])){var a=e[n+1],o=a.split(":",3),u=o[0],s=parseInt(o[1],10)||0,c=a.substring(o.join(":").length+1).trim();r+=$t("^^^ ".concat(u,": ").concat(c,"\n\n"),s)}}return r}function $t(e,t){for(var r="",n=0;n<t;++n)r+=" ";return"".concat(r).concat(e)}function Jt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var Kt,Zt,er=function(e){J()(r,e);var t=Jt(r);function r(e,n){var a;i()(this,r),Object(D.b)(e),ie("string"==typeof n.source,"Shader: GLSL source code must be a JavaScript string");var o=Yt(n.source,null)||n.id||se("unnamed ".concat(r.getTypeName(n.shaderType)));return(a=t.call(this,e,{id:o})).shaderType=n.shaderType,a.source=n.source,a.initialize(n),a}return o()(r,null,[{key:"getTypeName",value:function(e){switch(e){case 35633:return"vertex-shader";case 35632:return"fragment-shader";default:return ie(!1),"unknown"}}}]),o()(r,[{key:"initialize",value:function(e){var t=e.source,r=Yt(t,null);r&&(this.id=se(r)),this._compile(t)}},{key:"getParameter",value:function(e){return this.gl.getShaderParameter(this.handle,e)}},{key:"toString",value:function(){return"".concat(r.getTypeName(this.shaderType),":").concat(this.id)}},{key:"getName",value:function(){return Yt(this.source)||"unnamed-shader"}},{key:"getSource",value:function(){return this.gl.getShaderSource(this.handle)}},{key:"getTranslatedSource",value:function(){var e=this.gl.getExtension("WEBGL_debug_shaders");return e?e.getTranslatedShaderSource(this.handle):"No translated source available. WEBGL_debug_shaders not implemented"}},{key:"_compile",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.source;e.startsWith("#version ")||(e="#version 100\n".concat(e)),this.source=e,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle);var t=this.getParameter(35713);if(!t){var r=this.gl.getShaderInfoLog(this.handle),n=qt(r,this.source,this.shaderType,this.id),i=n.shaderName,a=n.errors,o=n.warnings;throw M.error("GLSL compilation errors in ".concat(i,"\n").concat(a))(),M.warn("GLSL compilation warnings in ".concat(i,"\n").concat(o))(),new Error("GLSL compilation errors in ".concat(i))}}},{key:"_deleteHandle",value:function(){this.gl.deleteShader(this.handle)}},{key:"_getOptsFromHandle",value:function(){return{type:this.getParameter(35663),source:this.getSource()}}}]),r}(ge),tr=function(e){J()(r,e);var t=Jt(r);function r(e,n){return i()(this,r),"string"==typeof n&&(n={source:n}),t.call(this,e,Object.assign({},n,{shaderType:35633}))}return o()(r,[{key:"_createHandle",value:function(){return this.gl.createShader(35633)}}]),r}(er),rr=function(e){J()(r,e);var t=Jt(r);function r(e,n){return i()(this,r),"string"==typeof n&&(n={source:n}),t.call(this,e,Object.assign({},n,{shaderType:35632}))}return o()(r,[{key:"_createHandle",value:function(){return this.gl.createShader(35632)}}]),r}(er),nr=(Kt={},h()(Kt,5126,br.bind(null,"uniform1fv",cr,1,pr)),h()(Kt,35664,br.bind(null,"uniform2fv",cr,2,pr)),h()(Kt,35665,br.bind(null,"uniform3fv",cr,3,pr)),h()(Kt,35666,br.bind(null,"uniform4fv",cr,4,pr)),h()(Kt,5124,br.bind(null,"uniform1iv",lr,1,pr)),h()(Kt,35667,br.bind(null,"uniform2iv",lr,2,pr)),h()(Kt,35668,br.bind(null,"uniform3iv",lr,3,pr)),h()(Kt,35669,br.bind(null,"uniform4iv",lr,4,pr)),h()(Kt,35670,br.bind(null,"uniform1iv",lr,1,pr)),h()(Kt,35671,br.bind(null,"uniform2iv",lr,2,pr)),h()(Kt,35672,br.bind(null,"uniform3iv",lr,3,pr)),h()(Kt,35673,br.bind(null,"uniform4iv",lr,4,pr)),h()(Kt,35674,br.bind(null,"uniformMatrix2fv",cr,4,_r)),h()(Kt,35675,br.bind(null,"uniformMatrix3fv",cr,9,_r)),h()(Kt,35676,br.bind(null,"uniformMatrix4fv",cr,16,_r)),h()(Kt,35678,yr),h()(Kt,35680,yr),h()(Kt,5125,br.bind(null,"uniform1uiv",fr,1,pr)),h()(Kt,36294,br.bind(null,"uniform2uiv",fr,2,pr)),h()(Kt,36295,br.bind(null,"uniform3uiv",fr,3,pr)),h()(Kt,36296,br.bind(null,"uniform4uiv",fr,4,pr)),h()(Kt,35685,br.bind(null,"uniformMatrix2x3fv",cr,6,_r)),h()(Kt,35686,br.bind(null,"uniformMatrix2x4fv",cr,8,_r)),h()(Kt,35687,br.bind(null,"uniformMatrix3x2fv",cr,6,_r)),h()(Kt,35688,br.bind(null,"uniformMatrix3x4fv",cr,12,_r)),h()(Kt,35689,br.bind(null,"uniformMatrix4x2fv",cr,8,_r)),h()(Kt,35690,br.bind(null,"uniformMatrix4x3fv",cr,12,_r)),h()(Kt,35678,yr),h()(Kt,35680,yr),h()(Kt,35679,yr),h()(Kt,35682,yr),h()(Kt,36289,yr),h()(Kt,36292,yr),h()(Kt,36293,yr),h()(Kt,36298,yr),h()(Kt,36299,yr),h()(Kt,36300,yr),h()(Kt,36303,yr),h()(Kt,36306,yr),h()(Kt,36307,yr),h()(Kt,36308,yr),h()(Kt,36311,yr),Kt),ir={},ar={},or={},ur=[0];function sr(e,t,r,n){1===t&&"boolean"==typeof e&&(e=e?1:0),Number.isFinite(e)&&(ur[0]=e,e=ur);var i=e.length;if(i%t&&M.warn("Uniform size should be multiples of ".concat(t),e)(),e instanceof r)return e;var a=n[i];a||(a=new r(i),n[i]=a);for(var o=0;o<i;o++)a[o]=e[o];return a}function cr(e,t){return sr(e,t,Float32Array,ir)}function lr(e,t){return sr(e,t,Int32Array,ar)}function fr(e,t){return sr(e,t,Uint32Array,or)}function hr(e,t,r){var n=nr[r.type];if(!n)throw new Error("Unknown GLSL uniform type ".concat(r.type));return n().bind(null,e,t)}function dr(e){if("]"!==e[e.length-1])return{name:e,length:1,isArray:!1};var t=e.match(/([^[]*)(\[[0-9]+\])?/);if(!t||t.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(e));return{name:t[1],length:t[2]||1,isArray:Boolean(t[2])}}function vr(e,t,r){for(var n in e){var i=e[n];if((!r||Boolean(r[n]))&&!gr(i))throw t=t?"".concat(t," "):"",console.error("".concat(t," Bad uniform ").concat(n),i),new Error("".concat(t," Bad uniform ").concat(n))}return!0}function gr(e){return Array.isArray(e)||ArrayBuffer.isView(e)?function(e){if(0===e.length)return!1;for(var t=Math.min(e.length,16),r=0;r<t;++r)if(!Number.isFinite(e[r]))return!1;return!0}(e):!!isFinite(e)||(!0===e||!1===e||(e instanceof He||(e instanceof vt||e instanceof Dt&&Boolean(e.texture))))}function mr(e,t,r){if(Array.isArray(r)||ArrayBuffer.isView(r))if(e[t])for(var n=e[t],i=0,a=r.length;i<a;++i)n[i]=r[i];else e[t]=r.slice();else e[t]=r}function yr(){var e=null;return function(t,r,n){var i=e!==n;return i&&(t.uniform1i(r,n),e=n),i}}function br(e,t,r,n){var i=null,a=null;return function(o,u,s){var c=t(s,r),l=c.length,f=!1;if(null===i)i=new Float32Array(l),a=l,f=!0;else{ie(a===l,"Uniform length cannot change.");for(var h=0;h<l;++h)if(c[h]!==i[h]){f=!0;break}}return f&&(n(o,e,u,c),i.set(c)),f}}function pr(e,t,r,n){e[t](r,n)}function _r(e,t,r,n){e[t](r,!1,n)}var Ar=(Zt={},h()(Zt,5126,[5126,1,"float"]),h()(Zt,35664,[5126,2,"vec2"]),h()(Zt,35665,[5126,3,"vec3"]),h()(Zt,35666,[5126,4,"vec4"]),h()(Zt,5124,[5124,1,"int"]),h()(Zt,35667,[5124,2,"ivec2"]),h()(Zt,35668,[5124,3,"ivec3"]),h()(Zt,35669,[5124,4,"ivec4"]),h()(Zt,5125,[5125,1,"uint"]),h()(Zt,36294,[5125,2,"uvec2"]),h()(Zt,36295,[5125,3,"uvec3"]),h()(Zt,36296,[5125,4,"uvec4"]),h()(Zt,35670,[5126,1,"bool"]),h()(Zt,35671,[5126,2,"bvec2"]),h()(Zt,35672,[5126,3,"bvec3"]),h()(Zt,35673,[5126,4,"bvec4"]),h()(Zt,35674,[5126,8,"mat2"]),h()(Zt,35685,[5126,8,"mat2x3"]),h()(Zt,35686,[5126,8,"mat2x4"]),h()(Zt,35675,[5126,12,"mat3"]),h()(Zt,35687,[5126,12,"mat3x2"]),h()(Zt,35688,[5126,12,"mat3x4"]),h()(Zt,35676,[5126,16,"mat4"]),h()(Zt,35689,[5126,16,"mat4x2"]),h()(Zt,35690,[5126,16,"mat4x3"]),Zt);function wr(e){switch(e){case 0:return 0;case 1:case 3:case 2:return 1;case 4:case 5:case 6:return 4;default:return ie(!1),0}}function xr(e){var t=Ar[e];if(!t)return null;var r=ne()(t,2);return{type:r[0],components:r[1]}}function Er(e,t){switch(e){case 5120:case 5121:case 5122:case 5123:e=5126}for(var r in Ar){var n=ne()(Ar[r],3),i=n[0],a=n[1],o=n[2];if(i===e&&a===t)return{glType:r,name:o}}return null}var Tr=function(){function e(t){i()(this,e),this.id=t.id,this.attributeInfos=[],this.attributeInfosByName={},this.attributeInfosByLocation=[],this.varyingInfos=[],this.varyingInfosByName={},Object.seal(this),this._readAttributesFromProgram(t),this._readVaryingsFromProgram(t)}return o()(e,[{key:"getAttributeInfo",value:function(e){var t=Number(e);return Number.isFinite(t)?this.attributeInfosByLocation[t]:this.attributeInfosByName[e]||null}},{key:"getAttributeLocation",value:function(e){var t=this.getAttributeInfo(e);return t?t.location:-1}},{key:"getAttributeAccessor",value:function(e){var t=this.getAttributeInfo(e);return t?t.accessor:null}},{key:"getVaryingInfo",value:function(e){var t=Number(e);return Number.isFinite(t)?this.varyingInfos[t]:this.varyingInfosByName[e]||null}},{key:"getVaryingIndex",value:function(e){var t=this.getVaryingInfo();return t?t.location:-1}},{key:"getVaryingAccessor",value:function(e){var t=this.getVaryingInfo();return t?t.accessor:null}},{key:"_readAttributesFromProgram",value:function(e){for(var t=e.gl,r=t.getProgramParameter(e.handle,35721),n=0;n<r;n++){var i=t.getActiveAttrib(e.handle,n),a=i.name,o=i.type,u=i.size,s=t.getAttribLocation(e.handle,a);s>=0&&this._addAttribute(s,a,o,u)}this.attributeInfos.sort((function(e,t){return e.location-t.location}))}},{key:"_readVaryingsFromProgram",value:function(e){var t=e.gl;if(Object(D.e)(t)){for(var r=t.getProgramParameter(e.handle,35971),n=0;n<r;n++){var i=t.getTransformFeedbackVarying(e.handle,n),a=i.name,o=i.type,u=i.size;this._addVarying(n,a,o,u)}this.varyingInfos.sort((function(e,t){return e.location-t.location}))}}},{key:"_addAttribute",value:function(e,t,r,n){var i=xr(r),a={type:i.type,size:n*i.components};this._inferProperties(e,t,a);var o={location:e,name:t,accessor:new Te(a)};this.attributeInfos.push(o),this.attributeInfosByLocation[e]=o,this.attributeInfosByName[o.name]=o}},{key:"_inferProperties",value:function(e,t,r){/instance/i.test(t)&&(r.divisor=1)}},{key:"_addVarying",value:function(e,t,r,n){var i=xr(r),a=i.type,o=i.components,u={location:e,name:t,accessor:new Te({type:a,size:n*o})};this.varyingInfos.push(u),this.varyingInfosByName[u.name]=u}}]),e}();function Or(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return kr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kr(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Sr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var Lr=["setVertexArray","setAttributes","setBuffers","unsetBuffers","use","getUniformCount","getUniformInfo","getUniformLocation","getUniformValue","getVarying","getFragDataLocation","getAttachedShaders","getAttributeCount","getAttributeLocation","getAttributeInfo"],Fr=function(e){J()(r,e);var t=Sr(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=t.call(this,e,a)).stubRemovedMethods("Program","v6.0",Lr),n._isCached=!1,n.initialize(a),Object.seal(Q()(n)),n._setId(a.id),n}return o()(r,[{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hash,r=e.vs,n=e.fs,i=e.varyings,a=e.bufferMode,o=void 0===a?35981:a;return this.hash=t||"",this.vs="string"==typeof r?new tr(this.gl,{id:"".concat(e.id,"-vs"),source:r}):r,this.fs="string"==typeof n?new rr(this.gl,{id:"".concat(e.id,"-fs"),source:n}):n,ie(this.vs instanceof tr),ie(this.fs instanceof rr),this.uniforms={},this._textureUniforms={},i&&i.length>0&&(Object(D.a)(this.gl),this.varyings=i,this.gl2.transformFeedbackVaryings(this.handle,i,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new Tr(this),this.setProps(e)}},{key:"delete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._isCached?this:st()(te()(r.prototype),"delete",this).call(this,e)}},{key:"setProps",value:function(e){return"uniforms"in e&&this.setUniforms(e.uniforms),this}},{key:"draw",value:function(e){var t=this,r=e.logPriority,n=e.drawMode,i=void 0===n?4:n,a=e.vertexCount,o=e.offset,u=void 0===o?0:o,s=e.start,c=e.end,l=e.isIndexed,f=void 0!==l&&l,h=e.indexType,d=void 0===h?5123:h,v=e.instanceCount,g=void 0===v?0:v,m=e.isInstanced,y=void 0===m?g>0:m,b=e.vertexArray,p=void 0===b?null:b,_=e.transformFeedback,A=e.framebuffer,w=e.parameters,x=void 0===w?{}:w,E=e.uniforms,T=e.samplers;if((E||T)&&(M.deprecated("Program.draw({uniforms})","Program.setUniforms(uniforms)")(),this.setUniforms(E||{})),M.priority>=r){var O=A?A.id:"default",k="mode=".concat(oe(this.gl,i)," verts=").concat(a," ")+"instances=".concat(g," indexType=").concat(oe(this.gl,d)," ")+"isInstanced=".concat(y," isIndexed=").concat(f," ")+"Framebuffer=".concat(O);M.log(r,k)()}return ie(p),this.gl.useProgram(this.handle),!(!this._areTexturesRenderable()||0===a||y&&0===g)&&(p.bindForDraw(a,g,(function(){if(void 0!==A&&(x=Object.assign({},x,{framebuffer:A})),_){var e=wr(i);_.begin(e)}t._bindTextures(),Object(N.c)(t.gl,x,(function(){f&&y?t.gl2.drawElementsInstanced(i,a,d,u,g):f&&Object(D.e)(t.gl)&&!isNaN(s)&&!isNaN(c)?t.gl2.drawRangeElements(i,s,c,a,d,u):f?t.gl.drawElements(i,a,d,u):y?t.gl2.drawArraysInstanced(i,u,a,g):t.gl.drawArrays(i,u,a)})),_&&_.end()})),!0)}},{key:"setUniforms",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in M.priority>=2&&vr(e,this.id,this._uniformSetters),this.gl.useProgram(this.handle),e){var r=e[t],n=this._uniformSetters[t];if(n){var i=r,a=!1;if(i instanceof Dt&&(i=i.texture),i instanceof He)if(a=this.uniforms[t]!==r){void 0===n.textureIndex&&(n.textureIndex=this._textureIndexCounter++);var o=i,u=n.textureIndex;o.bind(u),i=u,this._textureUniforms[t]=o}else i=n.textureIndex;else this._textureUniforms[t]&&delete this._textureUniforms[t];(n(i)||a)&&mr(this.uniforms,t,r)}}return this}},{key:"_areTexturesRenderable",value:function(){var e=!0;for(var t in this._textureUniforms){var r=this._textureUniforms[t];r.update(),e=e&&r.loaded}return e}},{key:"_bindTextures",value:function(){for(var e in this._textureUniforms){var t=this._uniformSetters[e].textureIndex;this._textureUniforms[e].bind(t)}}},{key:"_createHandle",value:function(){return this.gl.createProgram()}},{key:"_deleteHandle",value:function(){this.gl.deleteProgram(this.handle)}},{key:"_getOptionsFromHandle",value:function(e){var t,r={},n=Or(this.gl.getAttachedShaders(e));try{for(n.s();!(t=n.n()).done;){var i=t.value;switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:r.vs=new tr({handle:i});break;case 35632:r.fs=new rr({handle:i})}}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"_getParameter",value:function(e){return this.gl.getProgramParameter(this.handle,e)}},{key:"_setId",value:function(e){if(!e){var t=this._getName();this.id=se(t)}}},{key:"_getName",value:function(){var e=this.vs.getName()||this.fs.getName();return e=(e=e.replace(/shader/i,""))?"".concat(e,"-program"):"program"}},{key:"_compileAndLink",value:function(){var e=this.gl;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),M.time(4,"linkProgram for ".concat(this._getName()))(),e.linkProgram(this.handle),M.timeEnd(4,"linkProgram for ".concat(this._getName()))(),e.debug||M.level>0){if(!e.getProgramParameter(this.handle,35714))throw new Error("Error linking: ".concat(e.getProgramInfoLog(this.handle)));if(e.validateProgram(this.handle),!e.getProgramParameter(this.handle,35715))throw new Error("Error validating: ".concat(e.getProgramInfoLog(this.handle)))}}},{key:"_readUniformLocationsFromLinkedProgram",value:function(){var e=this.gl;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(var t=0;t<this._uniformCount;t++){var r=this.gl.getActiveUniform(this.handle,t),n=dr(r.name).name,i=e.getUniformLocation(this.handle,n);if(this._uniformSetters[n]=hr(e,i,r),r.size>1)for(var a=0;a<r.size;a++)i=e.getUniformLocation(this.handle,"".concat(n,"[").concat(a,"]")),this._uniformSetters["".concat(n,"[").concat(a,"]")]=hr(e,i,r)}this._textureIndexCounter=0}},{key:"getActiveUniforms",value:function(e,t){return this.gl2.getActiveUniforms(this.handle,e,t)}},{key:"getUniformBlockIndex",value:function(e){return this.gl2.getUniformBlockIndex(this.handle,e)}},{key:"getActiveUniformBlockParameter",value:function(e,t){return this.gl2.getActiveUniformBlockParameter(this.handle,e,t)}},{key:"uniformBlockBinding",value:function(e,t){this.gl2.uniformBlockBinding(this.handle,e,t)}}]),r}(ge);function jr(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Rr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Rr(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Rr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ir(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var Pr=function(e){J()(r,e);var t=Ir(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=t.call(this,e,a)).target=null,n._queryPending=!1,n._pollingPromise=null,Object.seal(Q()(n)),n}return o()(r,null,[{key:"isSupported",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=Object(D.e)(e),i=jt(e,Ot.TIMER_QUERY),a=n||i,o=jr(r);try{for(o.s();!(t=o.n()).done;){var u=t.value;switch(u){case"queries":a=a&&n;break;case"timers":a=a&&i;break;default:ie(!1)}}}catch(e){o.e(e)}finally{o.f()}return a}}]),o()(r,[{key:"beginTimeElapsedQuery",value:function(){return this.begin(35007)}},{key:"beginOcclusionQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.conservative,r=void 0!==t&&t;return this.begin(r?36202:35887)}},{key:"beginTransformFeedbackQuery",value:function(){return this.begin(35976)}},{key:"begin",value:function(e){return this._queryPending||(this.target=e,this.gl2.beginQuery(this.target,this.handle)),this}},{key:"end",value:function(){return this._queryPending||this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this}},{key:"isResultAvailable",value:function(){if(!this._queryPending)return!1;var e=this.gl2.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}},{key:"isTimerDisjoint",value:function(){return this.gl2.getParameter(36795)}},{key:"getResult",value:function(){return this.gl2.getQueryParameter(this.handle,34918)}},{key:"getTimerMilliseconds",value:function(){return this.getResult()/1e6}},{key:"createPoll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;var r=0;return this._pollingPromise=new Promise((function(n,i){requestAnimationFrame((function a(){e.isResultAvailable()?(n(e.getResult()),e._pollingPromise=null):r++>t?(i("Timed out"),e._pollingPromise=null):requestAnimationFrame(a)}))})),this._pollingPromise}},{key:"_createHandle",value:function(){return r.isSupported(this.gl)?this.gl2.createQuery():null}},{key:"_deleteHandle",value:function(){this.gl2.deleteQuery(this.handle)}}]),r}(ge);function Br(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var Mr=function(e){J()(r,e);var t=Br(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),Object(D.a)(e),(n=t.call(this,e,a)).initialize(a),n.stubRemovedMethods("TransformFeedback","v6.0",["pause","resume"]),Object.seal(Q()(n)),n}return o()(r,null,[{key:"isSupported",value:function(e){return Object(D.e)(e)}}]),o()(r,[{key:"initialize",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,le(this.buffers)||this.bind((function(){return e._unbindBuffers()})),this.setProps(t),this}},{key:"setProps",value:function(e){"program"in e&&(this.configuration=e.program&&e.program.configuration),"configuration"in e&&(this.configuration=e.configuration),"bindOnUse"in e&&(e=e.bindOnUse),"buffers"in e&&this.setBuffers(e.buffers)}},{key:"setBuffers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.bind((function(){for(var r in t)e.setBuffer(r,t[r])})),this}},{key:"setBuffer",value:function(e,t){var r=this,n=this._getVaryingIndex(e),i=this._getBufferParams(t),a=i.buffer,o=i.byteSize,u=i.byteOffset;return n<0?(this.unused[e]=a,M.warn((function(){return"".concat(r.id," unused varying buffer ").concat(e)}))(),this):(this.buffers[n]=t,this.bindOnUse||this._bindBuffer(n,a,u,o),this)}},{key:"begin",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(e),this}},{key:"end",value:function(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}},{key:"_getBufferParams",value:function(e){var t,r,n;return e instanceof Ie==!1?(n=e.buffer,r=e.byteSize,t=e.byteOffset):n=e,void 0===t&&void 0===r||(t=t||0,r=r||n.byteLength-t),{buffer:n,byteOffset:t,byteSize:r}}},{key:"_getVaryingInfo",value:function(e){return this.configuration&&this.configuration.getVaryingInfo(e)}},{key:"_getVaryingIndex",value:function(e){if(this.configuration)return this.configuration.getVaryingInfo(e).location;var t=Number(e);return Number.isFinite(t)?t:-1}},{key:"_bindBuffers",value:function(){if(this.bindOnUse)for(var e in this.buffers){var t=this._getBufferParams(this.buffers[e]),r=t.buffer,n=t.byteSize,i=t.byteOffset;this._bindBuffer(e,r,i,n)}}},{key:"_unbindBuffers",value:function(){if(this.bindOnUse)for(var e in this.buffers)this._bindBuffer(e,null)}},{key:"_bindBuffer",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0,i=t&&t.handle;return i&&void 0!==n?this.gl.bindBufferRange(35982,e,i,r,n):this.gl.bindBufferBase(35982,e,i),this}},{key:"_createHandle",value:function(){return this.gl.createTransformFeedback()}},{key:"_deleteHandle",value:function(){this.gl.deleteTransformFeedback(this.handle)}},{key:"_bindHandle",value:function(e){this.gl.bindTransformFeedback(36386,this.handle)}}]),r}(ge),Dr=null;function Nr(e,t){var r;return new e((r=e.BYTES_PER_ELEMENT*t,(!Dr||Dr.byteLength<r)&&(Dr=new ArrayBuffer(r)),Dr),0,t)}var Cr=r(25);function Ur(e){if(!e&&!Object(d.a)())return"Node";if(Object(Cr.a)(e))return"Electron";var t="undefined"!=typeof navigator?navigator:{},r=e||t.userAgent||"";if(r.indexOf("Edge")>-1)return"Edge";var n=-1!==r.indexOf("MSIE "),i=-1!==r.indexOf("Trident/");return n||i?"IE":E.b.chrome?"Chrome":E.b.safari?"Safari":E.b.mozInnerScreenX?"Firefox":"Unknown"}function Vr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=te()(e);if(t){var i=te()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Z()(this,r)}}var Gr="elements must be GL.ELEMENT_ARRAY_BUFFER",zr=function(e){J()(r,e);var t=Vr(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,r);var o=a.id||a.program&&a.program.id;return(n=t.call(this,e,Object.assign({},a,{id:o}))).buffer=null,n.bufferValue=null,n.isDefaultArray=a.isDefaultArray||!1,n.gl2=e,n.initialize(a),Object.seal(Q()(n)),n}return o()(r,null,[{key:"isSupported",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!t.constantAttributeZero||(Object(D.e)(e)||"Chrome"===Ur())}},{key:"getDefaultArray",value:function(e){return e.luma=e.luma||{},e.luma.defaultVertexArray||(e.luma.defaultVertexArray=new r(e,{handle:null,isDefaultArray:!0})),e.luma.defaultVertexArray}},{key:"getMaxAttributes",value:function(e){return r.MAX_ATTRIBUTES=r.MAX_ATTRIBUTES||e.getParameter(34921),r.MAX_ATTRIBUTES}},{key:"setConstant",value:function(e,t,n){switch(n.constructor){case Float32Array:r._setConstantFloatArray(e,t,n);break;case Int32Array:r._setConstantIntArray(e,t,n);break;case Uint32Array:r._setConstantUintArray(e,t,n);break;default:ie(!1)}}}]),o()(r,[{key:"delete",value:function(){return st()(te()(r.prototype),"delete",this).call(this),this.buffer&&this.buffer.delete(),this}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setProps(e)}},{key:"setProps",value:function(e){return this}},{key:"setElementBuffer",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return ie(!t||34963===t.target,Gr),this.bind((function(){e.gl.bindBuffer(34963,t?t.handle:null)})),this}},{key:"setBuffer",value:function(e,t,r){if(34963===t.target)return this.setElementBuffer(t,r);var n=r.size,i=r.type,a=r.stride,o=r.offset,u=r.normalized,s=r.integer,c=r.divisor,l=this.gl,f=this.gl2;return e=Number(e),this.bind((function(){l.bindBuffer(34962,t.handle),s?(ie(Object(D.e)(l)),f.vertexAttribIPointer(e,n,i,a,o)):l.vertexAttribPointer(e,n,i,u,a,o),l.enableVertexAttribArray(e),f.vertexAttribDivisor(e,c||0)})),this}},{key:"enable",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!n&&0===e&&!r.isSupported(this.gl,{constantAttributeZero:!0});return i||(e=Number(e),this.bind((function(){return n?t.gl.enableVertexAttribArray(e):t.gl.disableVertexAttribArray(e)}))),this}},{key:"getConstantBuffer",value:function(e,t){var r=this._normalizeConstantArrayValue(t),n=r.byteLength*e,i=r.length*e,a=!this.buffer;if(this.buffer=this.buffer||new Ie(this.gl,n),a=(a=a||this.buffer.reallocate(n))||!this._compareConstantArrayValues(r,this.bufferValue)){var o=Nr(t.constructor,i);!function(e){for(var t=e.target,r=e.source,n=e.start,i=void 0===n?0:n,a=e.count,o=void 0===a?1:a,u=r.length,s=o*u,c=0,l=i;c<u;c++)t[l++]=r[c];for(;c<s;)c<s-c?(t.copyWithin(i+c,i,i+c),c*=2):(t.copyWithin(i+c,i,i+s-c),c=s)}({target:o,source:r,start:0,count:i}),this.buffer.subData(o),this.bufferValue=t}return this.buffer}},{key:"_normalizeConstantArrayValue",value:function(e){return Array.isArray(e)?new Float32Array(e):e}},{key:"_compareConstantArrayValues",value:function(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(var r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}},{key:"_createHandle",value:function(){return this.gl.createVertexArray()}},{key:"_deleteHandle",value:function(e){return this.gl2.deleteVertexArray(e),[this.elements]}},{key:"_bindHandle",value:function(e){this.gl2.bindVertexArray(e)}},{key:"_getParameter",value:function(e,t){var r=this,n=t.location;return ie(Number.isFinite(n)),this.bind((function(){switch(e){case 34373:return r.gl.getVertexAttribOffset(n,e);default:return r.gl.getVertexAttrib(n,e)}}))}},{key:"MAX_ATTRIBUTES",get:function(){return r.getMaxAttributes(this.gl)}}],[{key:"_setConstantFloatArray",value:function(e,t,r){switch(r.length){case 1:e.vertexAttrib1fv(t,r);break;case 2:e.vertexAttrib2fv(t,r);break;case 3:e.vertexAttrib3fv(t,r);break;case 4:e.vertexAttrib4fv(t,r);break;default:ie(!1)}}},{key:"_setConstantIntArray",value:function(e,t,r){switch(ie(Object(D.e)(e)),r.length){case 1:e.vertexAttribI1iv(t,r);break;case 2:e.vertexAttribI2iv(t,r);break;case 3:e.vertexAttribI3iv(t,r);break;case 4:e.vertexAttribI4iv(t,r);break;default:ie(!1)}}},{key:"_setConstantUintArray",value:function(e,t,r){switch(ie(Object(D.e)(e)),r.length){case 1:e.vertexAttribI1uiv(t,r);break;case 2:e.vertexAttribI2uiv(t,r);break;case 3:e.vertexAttribI3uiv(t,r);break;case 4:e.vertexAttribI4uiv(t,r);break;default:ie(!1)}}}]),r}(ge),Hr=/^(.+)__LOCATION_([0-9]+)$/,Xr=["setBuffers","setGeneric","clearBindings","setLocations","setGenericValues","setDivisor","enable","disable"],Wr=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,e);var n=r.id||r.program&&r.program.id;this.id=n,this.gl=t,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new zr(t),fe(this,"VertexArray","v6.0",Xr),this.initialize(r),Object.seal(this)}return o()(e,[{key:"delete",value:function(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(e)}},{key:"reset",value:function(){this.elements=null,this.elementsAccessor=null;var e=this.vertexArrayObject.MAX_ATTRIBUTES;return this.values=new Array(e).fill(null),this.accessors=new Array(e).fill(null),this.unused={},this.drawParams=null,this}},{key:"setProps",value:function(e){return"program"in e&&(this.configuration=e.program&&e.program.configuration),"configuration"in e&&(this.configuration=e.configuration),"attributes"in e&&this.setAttributes(e.attributes),"elements"in e&&this.setElementBuffer(e.elements),"bindOnUse"in e&&(e=e.bindOnUse),this}},{key:"clearDrawParams",value:function(){this.drawParams=null}},{key:"getDrawParams",value:function(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}},{key:"setAttributes",value:function(e){var t=this;return Object.assign(this.attributes,e),this.vertexArrayObject.bind((function(){for(var r in e){var n=e[r];t._setAttribute(r,n)}t.gl.bindBuffer(34962,null)})),this}},{key:"setElementBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.elements=e,this.elementsAccessor=t,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(e,t),this}},{key:"setBuffer",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(34963===t.target)return this.setElementBuffer(t,r);var n=this._resolveLocationAndAccessor(e,t,t.accessor,r),i=n.location,a=n.accessor;return i>=0&&(this.values[i]=t,this.accessors[i]=a,this.clearDrawParams(),this.vertexArrayObject.setBuffer(i,t,a)),this}},{key:"setConstant",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._resolveLocationAndAccessor(e,t,Object.assign({size:t.length},r)),i=n.location,a=n.accessor;return i>=0&&(t=this.vertexArrayObject._normalizeConstantArrayValue(t),this.values[i]=t,this.accessors[i]=a,this.clearDrawParams(),this.vertexArrayObject.enable(i,!1)),this}},{key:"unbindBuffers",value:function(){var e=this;return this.vertexArrayObject.bind((function(){e.elements&&e.vertexArrayObject.setElementBuffer(null),e.buffer=e.buffer||new Ie(e.gl,{accessor:{size:4}});for(var t=0;t<e.vertexArrayObject.MAX_ATTRIBUTES;t++)e.values[t]instanceof Ie&&(e.gl.disableVertexAttribArray(t),e.gl.bindBuffer(34962,e.buffer.handle),e.gl.vertexAttribPointer(t,1,5126,!1,0,0))})),this}},{key:"bindBuffers",value:function(){var e=this;return this.vertexArrayObject.bind((function(){e.elements&&e.setElementBuffer(e.elements);for(var t=0;t<e.vertexArrayObject.MAX_ATTRIBUTES;t++){var r=e.values[t];r instanceof Ie&&e.setBuffer(t,r)}})),this}},{key:"bindForDraw",value:function(e,t,r){var n,i=this;return this.vertexArrayObject.bind((function(){i._setConstantAttributes(e,t),n=r()})),n}},{key:"_resolveLocationAndAccessor",value:function(e,t,r,n){var i=this,a={location:-1,accessor:null},o=this._getAttributeIndex(e),u=o.location,s=o.name;if(!Number.isFinite(u)||u<0)return this.unused[e]=t,M.once(3,(function(){return"unused value ".concat(e," in ").concat(i.id)}))(),a;var c=this._getAttributeInfo(s||u);if(!c)return a;var l=this.accessors[u]||{},f=Te.resolve(c.accessor,l,r,n),h=f.size,d=f.type;return ie(Number.isFinite(h)&&Number.isFinite(d)),{location:u,accessor:f}}},{key:"_getAttributeInfo",value:function(e){return this.configuration&&this.configuration.getAttributeInfo(e)}},{key:"_getAttributeIndex",value:function(e){var t=Number(e);if(Number.isFinite(t))return{location:t};var r=Hr.exec(e),n=r?r[1]:e,i=r?Number(r[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(n)+i,name:n}:{location:-1}}},{key:"_setAttribute",value:function(e,t){if(t instanceof Ie)this.setBuffer(e,t);else if(Array.isArray(t)&&t.length&&t[0]instanceof Ie){var r=t[0],n=t[1];this.setBuffer(e,r,n)}else if(ArrayBuffer.isView(t)||Array.isArray(t)){var i=t;this.setConstant(e,i)}else{if(!(t.buffer instanceof Ie))throw new Error("VertexArray: attributes must be Buffers or constants (i.e. typed array)");var a=t;this.setBuffer(e,a.buffer,a)}}},{key:"_setConstantAttributes",value:function(e,t){var r=Math.max(0|e,0|t),n=this.values[0];ArrayBuffer.isView(n)&&this._setConstantAttributeZero(n,r);for(var i=1;i<this.vertexArrayObject.MAX_ATTRIBUTES;i++)n=this.values[i],ArrayBuffer.isView(n)&&this._setConstantAttribute(i,n)}},{key:"_setConstantAttributeZero",value:function(e,t){if(zr.isSupported(this.gl,{constantAttributeZero:!0}))this._setConstantAttribute(0,e);else{var r=this.vertexArrayObject.getConstantBuffer(t,e);this.vertexArrayObject.setBuffer(0,r,this.accessors[0])}}},{key:"_setConstantAttribute",value:function(e,t){zr.setConstant(this.gl,e,t)}},{key:"_updateDrawParams",value:function(){for(var e={isIndexed:!1,isInstanced:!1,indexCount:1/0,vertexCount:1/0,instanceCount:1/0},t=0;t<this.vertexArrayObject.MAX_ATTRIBUTES;t++)this._updateDrawParamsForLocation(e,t);return this.elements&&(e.elementCount=this.elements.getElementCount(this.elements.accessor),e.isIndexed=!0,e.indexType=this.elementsAccessor.type||this.elements.accessor.type,e.indexOffset=this.elementsAccessor.offset||0),e.indexCount===1/0&&(e.indexCount=0),e.vertexCount===1/0&&(e.vertexCount=0),e.instanceCount===1/0&&(e.instanceCount=0),e}},{key:"_updateDrawParamsForLocation",value:function(e,t){var r=this.values[t],n=this.accessors[t];if(r){var i=n.divisor>0;if(e.isInstanced=e.isInstanced||i,r instanceof Ie){var a=r;if(i){var o=a.getVertexCount(n);e.instanceCount=Math.min(e.instanceCount,o)}else{var u=a.getVertexCount(n);e.vertexCount=Math.min(e.vertexCount,u)}}}}},{key:"setElements",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return M.deprecated("setElements","setElementBuffer")(),this.setElementBuffer(e,t)}}]),e}(),Yr=function(){function e(t){var r;for(var n in i()(this,e),this.layout={},this.size=0,t)this._addUniform(n,t[n]);this.size+=(4-this.size%4)%4;var a=new Float32Array(this.size);this.typedArray=(r={},h()(r,5126,a),h()(r,5124,new Int32Array(a.buffer)),h()(r,5125,new Uint32Array(a.buffer)),r)}return o()(e,[{key:"getBytes",value:function(){return 4*this.size}},{key:"getData",value:function(){return this.typedArray[5126]}},{key:"getSubData",value:function(e){var t,r;if(void 0===e)t=this.data,r=0;else{var n=this.offsets[e],i=n+this.sizes[e];t=this.data.subarray(n,i),r=4*n}return{data:t,offset:r}}},{key:"setUniforms",value:function(e){for(var t in e)this._setValue(t,e[t]);return this}},{key:"_setValue",value:function(e,t){var r=this.layout[e];ie(r,"UniformLayoutStd140 illegal argument");var n=this.typedArray[r.type];1===r.size?n[r.offset]=t:n.set(t,r.offset)}},{key:"_addUniform",value:function(e,t){var r=xr(t);ie(r,"UniformBufferLayout illegal argument");var n=r.type,i=r.components;this.size=this._alignTo(this.size,i);var a=this.size;this.size+=i,this.layout[e]={type:n,size:i,offset:a}}},{key:"_alignTo",value:function(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}}]),e}();function qr(e){var t=100,r=e.match(/[^\s]+/g);if(r.length>=2&&"#version"===r[0]){var n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}return t}function Qr(e,t){for(var r=t.maxElts,n=void 0===r?16:r,i=t.size,a=void 0===i?1:i,o="[",u=0;u<e.length&&u<n;++u)u>0&&(o+=",".concat(u%a==0?" ":"")),o+=$r(e[u],t);var s=e.length>n?"...":"]";return"".concat(o).concat(s)}function $r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=1e-16,n=t.isInteger,i=void 0!==n&&n;if(Array.isArray(e)||ArrayBuffer.isView(e))return Qr(e,t);if(!Number.isFinite(e))return String(e);if(Math.abs(e)<r)return i?"0":"0.";if(i)return e.toFixed(0);if(Math.abs(e)>100&&Math.abs(e)<1e4)return e.toFixed(0);var a=e.toPrecision(2),o=a.indexOf(".0");return o===a.length-2?a.slice(0,-1):a}function Jr(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Kr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Kr(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Kr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Zr(e){var t=e.header,r=void 0===t?"Uniforms":t,n=e.program,i=e.uniforms,a=e.undefinedOnly,o=void 0!==a&&a;ie(n);var u,s=n._uniformSetters,c={},l=Object.keys(s).sort(),f=0,d=Jr(l);try{for(d.s();!(u=d.n()).done;){var v=u.value;v.match(".*_.*")||v.match(".*Matrix")||en({table:c,header:r,uniforms:i,uniformName:v,undefinedOnly:o})&&f++}}catch(e){d.e(e)}finally{d.f()}var g,m=Jr(l);try{for(m.s();!(g=m.n()).done;){var y=g.value;y.match(".*Matrix")&&en({table:c,header:r,uniforms:i,uniformName:y,undefinedOnly:o})&&f++}}catch(e){m.e(e)}finally{m.f()}var b,p=Jr(l);try{for(p.s();!(b=p.n()).done;){var _=b.value;c[_]||en({table:c,header:r,uniforms:i,uniformName:_,undefinedOnly:o})&&f++}}catch(e){p.e(e)}finally{p.f()}var A=0,w={};if(!o)for(var x in i){var E=i[x];c[x]||(A++,w[x]=h()({Type:"NOT USED: ".concat(E)},r,$r(E)))}return{table:c,count:f,unusedTable:w,unusedCount:A}}function en(e){var t,r=e.table,n=e.header,i=e.uniforms,a=e.uniformName,o=e.undefinedOnly,u=i[a],s=function(e){return null!=e}(u);return(!o||!s)&&(r[a]=(t={},h()(t,n,s?$r(u):"N/A"),h()(t,"Uniform Type",s?u:"NOT PROVIDED"),t),!0)}function tn(e){var t=e.vertexArray,r=e.header,n=void 0===r?"Attributes":r;if(!t.configuration)return{};var i={};t.elements&&(i.ELEMENT_ARRAY_BUFFER=rn(t,t.elements,null,n));var a=t.values;for(var o in a){var u=t._getAttributeInfo(o);if(u){var s="".concat(o,": ").concat(u.name),c=t.accessors[u.location];c&&(s="".concat(o,": ").concat(nn(u.name,c))),i[s]=rn(t,a[o],c,n)}}return i}function rn(e,t,r,n){var i,a,o=e.gl;if(!t)return a={},h()(a,n,"null"),h()(a,"Format ","N/A"),a;var u,s,c,l="NOT PROVIDED",f=1,d=0,v=0;if(r&&(l=r.type,f=r.size,u=-1!==(l=String(l).replace("Array","")).indexOf("nt")),t instanceof Ie){var g,m,y=t,b=y.getDebugData(),p=b.data;if(s=b.changed?"*":"",c=p,d=(v=y.byteLength)/p.BYTES_PER_ELEMENT/f,r){var _=r.divisor>0;m="".concat(_?"I ":"P "," ").concat(d," (x").concat(f,"=").concat(v," bytes ").concat(oe(o,l),")")}else u=!0,m="".concat(v," bytes");return g={},h()(g,n,"".concat(s).concat($r(c,{size:f,isInteger:u}))),h()(g,"Format ",m),g}return c=t,f=t.length,u=-1!==(l=String(t.constructor.name).replace("Array","")).indexOf("nt"),i={},h()(i,n,"".concat($r(c,{size:f,isInteger:u})," (constant)")),h()(i,"Format ","".concat(f,"x").concat(l," (constant)")),i}function nn(e,t){var r=Er(t.type,t.size);return r?"".concat(e," (").concat(r.name,")"):e}function an(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return on(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return on(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function on(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function un(e){var t,r={},n="Accessors for ".concat(e.id),i=an(e.attributeInfos);try{for(i.s();!(t=i.n()).done;){var a=t.value;if(a){var o=sn(a);r["in ".concat(o)]=h()({},n,JSON.stringify(a.accessor))}}}catch(e){i.e(e)}finally{i.f()}var u,s=an(e.varyingInfos);try{for(s.s();!(u=s.n()).done;){var c=u.value;if(c){var l=sn(c);r["out ".concat(l)]=h()({},n,JSON.stringify(c.accessor))}}}catch(e){s.e(e)}finally{s.f()}return r}function sn(e){var t=e.accessor,r=Er(t.type,t.size);return r?"".concat(r.name," ").concat(e.name):e.name}}])}));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=24)}([function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},r(e)}t.exports=r},function(t,e,r){var n=r(27),i=r(28),a=r(19),o=r(29);t.exports=function(t){return n(t)||i(t)||a(t)||o()}},function(t,e,r){var n=r(20);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}},function(t,e,r){var n=r(8),i=r(7);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?i(t):e}},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t.exports=r=function(t){return typeof t}:t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(e)}t.exports=r},function(t,e,r){var n=r(32),i=r(33),a=r(19),o=r(34);t.exports=function(t,e){return n(t)||i(t,e)||a(t,e)||o()}},function(t,e,r){"use strict";(function(t,n){r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return u}));var i=r(8),a={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document,process:"object"===(void 0===n?"undefined":r.n(i)()(n))&&n},o=a.window||a.self||a.global,u=a.process||{};console}).call(this,r(30),r(11))},function(t,e){var r,n,i=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var s,c=[],l=!1,f=-1;function h(){l&&s&&(l=!1,s.length?c=s.concat(c):f=-1,c.length&&d())}function d(){if(!l){var t=u(h);l=!0;for(var e=c.length;e;){for(s=c,c=[];++f<e;)s&&s[f].run();f=-1,e=c.length}s=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function v(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new v(t,e)),1!==c.length||l||u(d)},v.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){var n=r(37);function i(e,r,a){return"undefined"!=typeof Reflect&&Reflect.get?t.exports=i=Reflect.get:t.exports=i=function(t,e,r){var i=n(t,e);if(i){var a=Object.getOwnPropertyDescriptor(i,e);return a.get?a.get.call(r):a.value}},i(e,r,a||e)}t.exports=i},function(t,e,r){"use strict";(function(t){function n(){var e;if("undefined"!=typeof window&&window.performance)e=window.performance.now();else if(void 0!==t&&t.hrtime){var r=t.hrtime();e=1e3*r[0]+r[1]/1e6}else e=Date.now();return e}r.d(e,"a",(function(){return n}))}).call(this,r(11))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return o}));var n=r(8),i=r.n(n),a=r(15);function o(){return!("object"===(void 0===t?"undefined":i()(t))&&"[object process]"===String(t)&&!t.browser)||Object(a.a)()}}).call(this,r(11))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return a}));var n=r(8),i=r.n(n);function a(e){if("undefined"!=typeof window&&"object"===i()(window.process)&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"===i()(t.versions)&&Boolean(t.versions.electron))return!0;var r="object"===("undefined"==typeof navigator?"undefined":i()(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||r;return!!(n&&n.indexOf("Electron")>=0)}}).call(this,r(11))},function(t,e,r){t.exports=r(36)},,function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}},function(t,e,r){var n=r(18);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},r(e,n)}t.exports=r},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return a}));var n=r(8),i=r.n(n);function a(e){if("undefined"!=typeof window&&"object"===i()(window.process)&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"===i()(t.versions)&&Boolean(t.versions.electron))return!0;var r="object"===("undefined"==typeof navigator?"undefined":i()(navigator))&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||r;return!!(n&&n.indexOf("Electron")>=0)}}).call(this,r(11))},function(t,e,r){var n=r(20),i=r(35);function a(e,r,o){return i()?t.exports=a=Reflect.construct:t.exports=a=function(t,e,r){var i=[null];i.push.apply(i,e);var a=new(Function.bind.apply(t,i));return r&&n(a,r.prototype),a},a.apply(null,arguments)}t.exports=a},function(t,e){function r(t,e,r,n,i,a,o){try{var u=t[a](o),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,i)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(i,a){var o=t.apply(e,n);function u(t){r(o,i,a,u,s,"next",t)}function s(t){r(o,i,a,u,s,"throw",t)}u(void 0)}))}}},function(t,e,r){var n=r(38);globalThis.luma=globalThis.luma||{},t.exports=Object.assign(globalThis.luma,n)},,,function(t,e,r){var n=r(18);t.exports=function(t){if(Array.isArray(t))return n(t)}},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e){},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(i)throw a}}return r}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e){t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}},function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",o=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof f?e:f,a=Object.create(i.prototype),o=new w(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return T()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var u=_(o,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,o),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function f(){}function h(){}function d(){}var v={};v[i]=function(){return this};var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==e&&r.call(m,i)&&(v=m);var y=d.prototype=f.prototype=Object.create(v);function p(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(i,a){function o(){return new e((function(n,o){!function n(i,a,o,u){var s=c(t[i],t,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,o,u)}),(function(t){n("throw",t,o,u)})):e.resolve(f).then((function(t){l.value=t,o(l)}),(function(t){return n("throw",t,o,u)}))}u(s.arg)}(i,a,n,o)}))}return n=n?n.then(o,o):o()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function w(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function E(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:T}}function T(){return{value:void 0,done:!0}}return h.prototype=y.constructor=d,d.constructor=h,h.displayName=u(d,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},p(b.prototype),b.prototype[a]=function(){return this},t.AsyncIterator=b,t.async=function(e,r,n,i,a){void 0===a&&(a=Promise);var o=new b(s(e,r,n,i),a);return t.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},p(y),u(y,o,"Generator"),y[i]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,w.prototype={constructor:w,reset:function(t){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(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return o.type="throw",o.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e,r){var n=r(3);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t}},function(t,e,r){"use strict";r.r(e),r.d(e,"lumaStats",(function(){return jt})),r.d(e,"requestAnimationFrame",(function(){return Nt})),r.d(e,"cancelAnimationFrame",(function(){return Ct})),r.d(e,"cloneTextureFrom",(function(){return Or})),r.d(e,"getKeyValue",(function(){return qt})),r.d(e,"getKey",(function(){return Qt})),r.d(e,"getContextInfo",(function(){return Ir})),r.d(e,"getGLContextInfo",(function(){return Rr})),r.d(e,"getContextLimits",(function(){return Fr})),r.d(e,"FEATURES",(function(){return gr})),r.d(e,"hasFeature",(function(){return br})),r.d(e,"hasFeatures",(function(){return _r})),r.d(e,"getFeatures",(function(){return Ar})),r.d(e,"canCompileGLGSExtension",(function(){return Dr})),r.d(e,"Accessor",(function(){return ve})),r.d(e,"Buffer",(function(){return xe})),r.d(e,"Shader",(function(){return zr})),r.d(e,"VertexShader",(function(){return Hr})),r.d(e,"FragmentShader",(function(){return Xr})),r.d(e,"Program",(function(){return _n})),r.d(e,"Framebuffer",(function(){return kr})),r.d(e,"Renderbuffer",(function(){return nr})),r.d(e,"Texture2D",(function(){return Me})),r.d(e,"TextureCube",(function(){return We})),r.d(e,"clear",(function(){return ir})),r.d(e,"clearBuffer",(function(){return ar})),r.d(e,"readPixelsToArray",(function(){return ur})),r.d(e,"readPixelsToBuffer",(function(){return sr})),r.d(e,"copyToDataUrl",(function(){return cr})),r.d(e,"copyToImage",(function(){return lr})),r.d(e,"copyToTexture",(function(){return fr})),r.d(e,"blit",(function(){return hr})),r.d(e,"Query",(function(){return En})),r.d(e,"Texture3D",(function(){return Qe})),r.d(e,"TransformFeedback",(function(){return kn})),r.d(e,"VertexArrayObject",(function(){return Bn})),r.d(e,"VertexArray",(function(){return jn})),r.d(e,"UniformBufferLayout",(function(){return Nn})),r.d(e,"setPathPrefix",(function(){return De})),r.d(e,"loadFile",(function(){return je})),r.d(e,"loadImage",(function(){return Ne})),r.d(e,"getShaderName",(function(){return jr})),r.d(e,"getShaderVersion",(function(){return Cn})),r.d(e,"log",(function(){return j})),r.d(e,"assert",(function(){return Yt})),r.d(e,"uid",(function(){return Jt})),r.d(e,"isObjectEmpty",(function(){return Zt})),r.d(e,"parseUniformName",(function(){return rn})),r.d(e,"getUniformSetter",(function(){return en})),r.d(e,"getDebugTableForUniforms",(function(){return zn})),r.d(e,"getDebugTableForVertexArray",(function(){return Xn})),r.d(e,"getDebugTableForProgramConfiguration",(function(){return $n}));var n=r(2),i=r.n(n),a=r(1),o=r.n(a),u=r(8),s=r.n(u),c=r(4),l=r.n(c),f=r(0),h=r.n(f),d=r(14),v=Object(d.a)();function g(t){try{var e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch(t){return null}}var m=function(){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";i()(this,t),this.storage=g(n),this.id=e,this.config={},Object.assign(this.config,r),this._loadConfiguration()}return o()(t,[{key:"getConfiguration",value:function(){return this.config}},{key:"setConfiguration",value:function(t){return this.config={},this.updateConfiguration(t)}},{key:"updateConfiguration",value:function(t){if(Object.assign(this.config,t),this.storage){var e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}return this}},{key:"_loadConfiguration",value:function(){var t={};if(this.storage){var e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}]),t}();function y(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600,i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));var a=t.width*r,o=t.height*r,u=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(a/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(i,");"),"background-size:".concat(a,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),u]}var p={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function b(t){return"string"==typeof t?p[t.toUpperCase()]||p.WHITE:t}function _(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return A(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"],n=Object.getPrototypeOf(t),i=Object.getOwnPropertyNames(n),a=_(i);try{var o=function(){var n=e.value;"function"==typeof t[n]&&(r.find((function(t){return n===t}))||(t[n]=t[n].bind(t)))};for(a.s();!(e=a.n()).done;)o()}catch(t){a.e(t)}finally{a.f()}}function w(t,e){if(!t)throw new Error(e||"Assertion failed")}var E=r(10);function T(){var t;if(v&&E.b.performance)t=E.b.performance.now();else if(E.a.hrtime){var e=E.a.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}var k={debug:v&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},S={enabled:!0,level:0};function O(){}var L={},F={once:!0};function R(t){for(var e in t)for(var r in t[e])return r||"untitled";return"empty"}var I=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""},r=e.id;i()(this,t),this.id=r,this.VERSION="8.5.10",this._startTs=T(),this._deltaTs=T(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new m("__probe-".concat(this.id,"__"),S),this.userData={},this.timeStamp("".concat(this.id," started")),x(this),Object.seal(this)}return o()(t,[{key:"isEnabled",value:function(){return this._storage.config.enabled}},{key:"getLevel",value:function(){return this._storage.config.level}},{key:"getTotal",value:function(){return Number((T()-this._startTs).toPrecision(10))}},{key:"getDelta",value:function(){return Number((T()-this._deltaTs).toPrecision(10))}},{key:"getPriority",value:function(){return this.level}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:t}),this}},{key:"setLevel",value:function(t){return this._storage.updateConfiguration({level:t}),this}},{key:"assert",value:function(t,e){w(t,e)}},{key:"warn",value:function(t){return this._getLogFunction(0,t,k.warn,arguments,F)}},{key:"error",value:function(t){return this._getLogFunction(0,t,k.error,arguments)}},{key:"deprecated",value:function(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}},{key:"removed",value:function(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}},{key:"probe",value:function(t,e){return this._getLogFunction(t,e,k.log,arguments,{time:!0,once:!0})}},{key:"log",value:function(t,e){return this._getLogFunction(t,e,k.debug,arguments)}},{key:"info",value:function(t,e){return this._getLogFunction(t,e,console.info,arguments)}},{key:"once",value:function(t,e){return this._getLogFunction(t,e,k.debug||k.info,arguments,F)}},{key:"table",value:function(t,e,r){return e?this._getLogFunction(t,e,console.table||O,r&&[r],{tag:R(e)}):O}},{key:"image",value:function(t){var e=t.logLevel,n=t.priority,i=t.image,a=t.message,o=void 0===a?"":a,u=t.scale,s=void 0===u?1:u;return this._shouldLog(e||n)?v?function(t){var e=t.image,r=t.message,n=void 0===r?"":r,i=t.scale,a=void 0===i?1:i;if("string"==typeof e){var o=new Image;return o.onload=function(){var t,e=y(o,n,a);(t=console).log.apply(t,l()(e))},o.src=e,O}var u=e.nodeName||"";if("img"===u.toLowerCase()){var s;return(s=console).log.apply(s,l()(y(e,n,a))),O}if("canvas"===u.toLowerCase()){var c=new Image;return c.onload=function(){var t;return(t=console).log.apply(t,l()(y(c,n,a)))},c.src=e.toDataURL(),O}return O}({image:i,message:o,scale:s}):function(t){var e=t.image,n=(t.message,t.scale),i=void 0===n?1:n,a=null;try{a=r(31)}catch(t){}if(a)return function(){return a(e,{fit:"box",width:"".concat(Math.round(80*i),"%")}).then((function(t){return console.log(t)}))};return O}({image:i,message:o,scale:s}):O}},{key:"settings",value:function(){console.table?console.table(this._storage.config):console.log(this._storage.config)}},{key:"get",value:function(t){return this._storage.config[t]}},{key:"set",value:function(t,e){this._storage.updateConfiguration(h()({},t,e))}},{key:"time",value:function(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}},{key:"timeEnd",value:function(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}},{key:"timeStamp",value:function(t,e){return this._getLogFunction(t,e,console.timeStamp||O)}},{key:"group",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1},n=r=P({logLevel:t,message:e,opts:r}),i=n.collapsed;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}},{key:"groupCollapsed",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},r,{collapsed:!0}))}},{key:"groupEnd",value:function(t){return this._getLogFunction(t,"",console.groupEnd||O)}},{key:"withGroup",value:function(t,e,r){this.group(t,e)();try{r()}finally{this.groupEnd(t)()}}},{key:"trace",value:function(){console.trace&&console.trace()}},{key:"_shouldLog",value:function(t){return this.isEnabled()&&this.getLevel()>=B(t)}},{key:"_getLogFunction",value:function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4?arguments[4]:void 0;if(this._shouldLog(t)){var a;i=P({logLevel:t,message:e,args:n,opts:i}),w(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=T();var o=i.tag||i.message;if(i.once){if(L[o])return O;L[o]=T()}return e=D(this.id,i.message,i),(a=r).bind.apply(a,[console,e].concat(l()(i.args)))}return O}},{key:"level",set:function(t){this.setLevel(t)},get:function(){return this.getLevel()}},{key:"priority",set:function(t){this.level=t},get:function(){return this.level}}]),t}();function B(t){if(!t)return 0;var e;switch(s()(t)){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return w(Number.isFinite(e)&&e>=0),e}function P(t){var e=t.logLevel,r=t.message;t.logLevel=B(e);for(var n=t.args?Array.from(t.args):[];n.length&&n.shift()!==r;);switch(t.args=n,s()(e)){case"string":case"function":void 0!==r&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());var i=s()(t.message);return w("string"===i||"object"===i),Object.assign(t,t.opts)}function D(t,e,r){if("string"==typeof e){var n=r.time?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}((u=r.total)<10?"".concat(u.toFixed(2),"ms"):u<100?"".concat(u.toFixed(1),"ms"):u<1e3?"".concat(u.toFixed(0),"ms"):"".concat((u/1e3).toFixed(2),"s")):"";e=r.time?"".concat(t,": ").concat(n," ").concat(e):"".concat(t,": ").concat(e),i=e,a=r.color,o=r.background,v||"string"!=typeof i||(a&&(a=b(a),i="[".concat(a,"m").concat(i,"")),o&&(a=b(o),i="[".concat(o+10,"m").concat(i,""))),e=i}var i,a,o,u;return e}I.VERSION="8.5.10";var j=new I({id:"luma.gl"});function N(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}function C(t){return"undefined"!=typeof WebGLRenderingContext&&t instanceof WebGLRenderingContext||("undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&Number.isFinite(t._version)))}function M(t){return"undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&2===t._version)}function U(t){return N(C(t),"Invalid WebGLRenderingContext"),t}function V(t){return N(M(t),"Requires WebGL2"),t}var G={};function z(t,e){var r;G[t]=!0,void 0!==e&&(r=e,globalThis.console&&globalThis.console.error&&globalThis.console.error(r))}var H=function t(e){var r=e.gl;this.ext=e,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(e.maxVertexAttribs);for(var n=0;n<this.attribs.length;n++){var i=new t.VertexAttrib(r);this.attribs[n]=i}this.maxAttrib=0};(H.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()}).prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var X,W=function(t){var e=this;this.gl=t,function(t){var e=t.getError;t.getError=function(){var r;do{0!==(r=e.apply(t))&&(G[r]=!0)}while(0!==r);for(r in G)if(G[r])return delete G[r],parseInt(r,10);return 0}}(t);var r=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(t){return t===e.VERTEX_ARRAY_BINDING_OES?e.currentVertexArrayObject===e.defaultVertexArrayObject?null:e.currentVertexArrayObject:r.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(t){var n=e.currentVertexArrayObject;n.maxAttrib=Math.max(n.maxAttrib,t);var i=n.attribs[t];return i.enabled=!0,r.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(t){var n=e.currentVertexArrayObject;n.maxAttrib=Math.max(n.maxAttrib,t);var i=n.attribs[t];return i.enabled=!1,r.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(t,n){switch(t){case 34962:e.currentArrayBuffer=n;break;case 34963:e.currentVertexArrayObject.elementArrayBuffer=n}return r.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(t,n){var i=e.currentVertexArrayObject,a=i.attribs[t];switch(n){case 34975:return a.buffer;case 34338:return a.enabled;case 34339:return a.size;case 34340:return a.stride;case 34341:return a.type;case 34922:return a.normalized;default:return r.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(t,n,i,a,o,u){var s=e.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,t);var c=s.attribs[t];return c.buffer=e.currentArrayBuffer,c.size=n,c.type=i,c.normalized=a,c.stride=o,c.offset=u,c.recache(),r.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",(function(){var t;t="OESVertexArrayObject emulation library context restored",globalThis.console&&globalThis.console.log&&globalThis.console.log(t),e.reset_()}),!0),this.reset_()};W.prototype.VERTEX_ARRAY_BINDING_OES=34229,W.prototype.reset_=function(){if(void 0!==this.vertexArrayObjects)for(var t=0;t<this.vertexArrayObjects.length;++t)this.vertexArrayObjects.isAlive=!1;var e=this.gl;this.maxVertexAttribs=e.getParameter(34921),this.defaultVertexArrayObject=new H(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)},W.prototype.createVertexArrayOES=function(){var t=new H(this);return this.vertexArrayObjects.push(t),t},W.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)},W.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof H&&t.hasBeenBound&&t.ext===this)},W.prototype.bindVertexArrayOES=function(t){var e=this.gl;if(!t||t.isAlive){var r=this.original,n=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;var i=this.currentVertexArrayObject;if(n!==i){n&&i.elementArrayBuffer===n.elementArrayBuffer||r.bindBuffer.call(e,34963,i.elementArrayBuffer);for(var a=this.currentArrayBuffer,o=Math.max(n?n.maxAttrib:0,i.maxAttrib),u=0;u<=o;u++){var s=i.attribs[u],c=n?n.attribs[u]:null;if(n&&s.enabled===c.enabled||(s.enabled?r.enableVertexAttribArray.call(e,u):r.disableVertexAttribArray.call(e,u)),s.enabled){var l=!1;n&&s.buffer===c.buffer||(a!==s.buffer&&(r.bindBuffer.call(e,34962,s.buffer),a=s.buffer),l=!0),(l||s.cached!==c.cached)&&r.vertexAttribPointer.call(e,u,s.size,s.type,s.normalized,s.stride,s.offset)}}this.currentArrayBuffer!==a&&r.bindBuffer.call(e,34962,this.currentArrayBuffer)}}else z(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject")};var Y,q=function(t){return M(t)?void 0:0},Q=(X={},h()(X,3074,(function(t){return M(t)?void 0:36064})),h()(X,35723,(function(t){return M(t)?void 0:4352})),h()(X,35977,q),h()(X,32937,q),h()(X,36795,(function(t,e){var r=M(t)?t.getExtension("EXT_disjoint_timer_query_webgl2"):t.getExtension("EXT_disjoint_timer_query");return r&&r.GPU_DISJOINT_EXT?e(r.GPU_DISJOINT_EXT):0})),h()(X,37445,(function(t,e){var r=t.getExtension("WEBGL_debug_renderer_info");return e(r&&r.UNMASKED_VENDOR_WEBGL||7936)})),h()(X,37446,(function(t,e){var r=t.getExtension("WEBGL_debug_renderer_info");return e(r&&r.UNMASKED_RENDERER_WEBGL||7937)})),h()(X,34047,(function(t,e){var r=t.luma.extensions.EXT_texture_filter_anisotropic;return r?e(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1})),h()(X,32883,q),h()(X,35071,q),h()(X,37447,q),h()(X,36063,(function(t,e){if(!M(t)){var r=t.getExtension("WEBGL_draw_buffers");return r?e(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}})),h()(X,35379,q),h()(X,35374,q),h()(X,35377,q),h()(X,34852,(function(t){if(!M(t)){var e=t.getExtension("WEBGL_draw_buffers");return e?e.MAX_DRAW_BUFFERS_WEBGL:0}})),h()(X,36203,(function(t){return t.getExtension("OES_element_index")?2147483647:65535})),h()(X,33001,(function(t){return t.getExtension("OES_element_index")?16777216:65535})),h()(X,33e3,(function(t){return 16777216})),h()(X,37157,q),h()(X,35373,q),h()(X,35657,q),h()(X,36183,q),h()(X,37137,q),h()(X,34045,q),h()(X,35978,q),h()(X,35979,q),h()(X,35968,q),h()(X,35376,q),h()(X,35375,q),h()(X,35659,q),h()(X,37154,q),h()(X,35371,q),h()(X,35658,q),h()(X,35076,q),h()(X,35077,q),h()(X,35380,q),X);var $=(Y={},h()(Y,"OES_vertex_array_object",{meta:{suffix:"OES"},createVertexArray:function(){N(!1,"VertexArray requires WebGL2 or OES_vertex_array_object extension")},deleteVertexArray:function(){},bindVertexArray:function(){},isVertexArray:function(){return!1}}),h()(Y,"ANGLE_instanced_arrays",{meta:{suffix:"ANGLE"},vertexAttribDivisor:function(t,e){N(0===e,"WebGL instanced rendering not supported")},drawElementsInstanced:function(){},drawArraysInstanced:function(){}}),h()(Y,"WEBGL_draw_buffers",{meta:{suffix:"WEBGL"},drawBuffers:function(){N(!1)}}),h()(Y,"EXT_disjoint_timer_query",{meta:{suffix:"EXT"},createQuery:function(){N(!1)},deleteQuery:function(){N(!1)},beginQuery:function(){N(!1)},endQuery:function(){},getQuery:function(t,e){return this.getQueryObject(t,e)},getQueryParameter:function(t,e){return this.getQueryObject(t,e)},getQueryObject:function(){}}),Y),J={readBuffer:function(t,e,r){M(t)&&e(r)},getVertexAttrib:function(t,e,r,n){var i,a=function(t,e){return{webgl2:M(t),ext:t.getExtension(e)}}(t,"ANGLE_instanced_arrays"),o=a.webgl2,u=a.ext;switch(n){case 35069:i=!!o&&void 0;break;case 35070:i=o||u?void 0:0}return void 0!==i?i:e(r,n)},getProgramParameter:function(t,e,r,n){if(!M(t))switch(n){case 35967:return 35981;case 35971:case 35382:return 0}return e(r,n)},getInternalformatParameter:function(t,e,r,n,i){if(!M(t))switch(i){case 32937:return new Int32Array([0])}return t.getInternalformatParameter(r,n,i)},getTexParameter:function(t,e,r,n){switch(n){case 34046:var i=t.luma.extensions.EXT_texture_filter_anisotropic;n=i&&i.TEXTURE_MAX_ANISOTROPY_EXT||34046}return e(r,n)},getParameter:function(t,e,r){var n=Q[r],i="function"==typeof n?n(t,e,r):n;return void 0!==i?i:e(r)},hint:function(t,e,r,n){return e(r,n)}};function K(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function tt(t,e){var r=e.extension,n=e.target,i=e.target2,a=$[r];N(a);for(var o=a.meta,u=(void 0===o?{}:o).suffix,s=void 0===u?"":u,c=t.getExtension(r),l=function(){var e=h[f],r="".concat(e).concat(s),o=null;"meta"===e||"function"==typeof t[e]||(c&&"function"==typeof c[r]?o=function(){return c[r].apply(c,arguments)}:"function"==typeof a[e]&&(o=a[e].bind(n))),o&&(n[e]=o,i[e]=o)},f=0,h=Object.keys(a);f<h.length;f++)l()}globalThis.polyfillContext=function(t){t.luma=t.luma||{};var e=t.luma;return e.polyfilled||(!function(t){if("function"!=typeof t.createVertexArray){var e=t.getSupportedExtensions;t.getSupportedExtensions=function(){var t=e.call(this)||[];return t.indexOf("OES_vertex_array_object")<0&&t.push("OES_vertex_array_object"),t};var r=t.getExtension;t.getExtension=function(e){var n=r.call(this,e);return n||("OES_vertex_array_object"!==e?null:(t.__OESVertexArrayObject||(this.__OESVertexArrayObject=new W(this)),this.__OESVertexArrayObject))}}}(t),function(t){t.luma.extensions={};var e,r=K(t.getSupportedExtensions()||[]);try{for(r.s();!(e=r.n()).done;){var n=e.value;t.luma[n]=t.getExtension(n)}}catch(t){r.e(t)}finally{r.f()}}(t),function(t,e){var r,n=K(Object.getOwnPropertyNames(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;"overrides"!==i&&tt(t,{extension:i,target:t.luma,target2:t})}}catch(t){n.e(t)}finally{n.f()}}(t,$),function(t,e){var r=e.target,n=e.target2;Object.keys(J).forEach((function(e){if("function"==typeof J[e]){var i=t[e]?t[e].bind(t):function(){},a=J[e].bind(null,t,i);r[e]=a,n[e]=a}}))}(t,{target:e,target2:t}),e.polyfilled=!0),t};var et,rt,nt,it=r(9),at=r.n(it),ot=(et={},h()(et,3042,!1),h()(et,32773,new Float32Array([0,0,0,0])),h()(et,32777,32774),h()(et,34877,32774),h()(et,32969,1),h()(et,32968,0),h()(et,32971,1),h()(et,32970,0),h()(et,3106,new Float32Array([0,0,0,0])),h()(et,3107,[!0,!0,!0,!0]),h()(et,2884,!1),h()(et,2885,1029),h()(et,2929,!1),h()(et,2931,1),h()(et,2932,513),h()(et,2928,new Float32Array([0,1])),h()(et,2930,!0),h()(et,3024,!0),h()(et,36006,null),h()(et,2886,2305),h()(et,33170,4352),h()(et,2849,1),h()(et,32823,!1),h()(et,32824,0),h()(et,10752,0),h()(et,32938,1),h()(et,32939,!1),h()(et,3089,!1),h()(et,3088,new Int32Array([0,0,1024,1024])),h()(et,2960,!1),h()(et,2961,0),h()(et,2968,4294967295),h()(et,36005,4294967295),h()(et,2962,519),h()(et,2967,0),h()(et,2963,4294967295),h()(et,34816,519),h()(et,36003,0),h()(et,36004,4294967295),h()(et,2964,7680),h()(et,2965,7680),h()(et,2966,7680),h()(et,34817,7680),h()(et,34818,7680),h()(et,34819,7680),h()(et,2978,[0,0,1024,1024]),h()(et,3333,4),h()(et,3317,4),h()(et,37440,!1),h()(et,37441,!1),h()(et,37443,37444),h()(et,35723,4352),h()(et,36010,null),h()(et,35977,!1),h()(et,3330,0),h()(et,3332,0),h()(et,3331,0),h()(et,3314,0),h()(et,32878,0),h()(et,3316,0),h()(et,3315,0),h()(et,32877,0),et),ut=function(t,e,r){return e?t.enable(r):t.disable(r)},st=function(t,e,r){return t.hint(r,e)},ct=function(t,e,r){return t.pixelStorei(r,e)};function lt(t){return Array.isArray(t)||ArrayBuffer.isView(t)}var ft=(rt={},h()(rt,3042,ut),h()(rt,32773,(function(t,e){return t.blendColor.apply(t,l()(e))})),h()(rt,32777,"blendEquation"),h()(rt,34877,"blendEquation"),h()(rt,32969,"blendFunc"),h()(rt,32968,"blendFunc"),h()(rt,32971,"blendFunc"),h()(rt,32970,"blendFunc"),h()(rt,3106,(function(t,e){return t.clearColor.apply(t,l()(e))})),h()(rt,3107,(function(t,e){return t.colorMask.apply(t,l()(e))})),h()(rt,2884,ut),h()(rt,2885,(function(t,e){return t.cullFace(e)})),h()(rt,2929,ut),h()(rt,2931,(function(t,e){return t.clearDepth(e)})),h()(rt,2932,(function(t,e){return t.depthFunc(e)})),h()(rt,2928,(function(t,e){return t.depthRange.apply(t,l()(e))})),h()(rt,2930,(function(t,e){return t.depthMask(e)})),h()(rt,3024,ut),h()(rt,35723,st),h()(rt,36006,(function(t,e){var r=M(t)?36009:36160;return t.bindFramebuffer(r,e)})),h()(rt,2886,(function(t,e){return t.frontFace(e)})),h()(rt,33170,st),h()(rt,2849,(function(t,e){return t.lineWidth(e)})),h()(rt,32823,ut),h()(rt,32824,"polygonOffset"),h()(rt,10752,"polygonOffset"),h()(rt,35977,ut),h()(rt,32938,"sampleCoverage"),h()(rt,32939,"sampleCoverage"),h()(rt,3089,ut),h()(rt,3088,(function(t,e){return t.scissor.apply(t,l()(e))})),h()(rt,2960,ut),h()(rt,2961,(function(t,e){return t.clearStencil(e)})),h()(rt,2968,(function(t,e){return t.stencilMaskSeparate(1028,e)})),h()(rt,36005,(function(t,e){return t.stencilMaskSeparate(1029,e)})),h()(rt,2962,"stencilFuncFront"),h()(rt,2967,"stencilFuncFront"),h()(rt,2963,"stencilFuncFront"),h()(rt,34816,"stencilFuncBack"),h()(rt,36003,"stencilFuncBack"),h()(rt,36004,"stencilFuncBack"),h()(rt,2964,"stencilOpFront"),h()(rt,2965,"stencilOpFront"),h()(rt,2966,"stencilOpFront"),h()(rt,34817,"stencilOpBack"),h()(rt,34818,"stencilOpBack"),h()(rt,34819,"stencilOpBack"),h()(rt,2978,(function(t,e){return t.viewport.apply(t,l()(e))})),h()(rt,3333,ct),h()(rt,3317,ct),h()(rt,37440,ct),h()(rt,37441,ct),h()(rt,37443,ct),h()(rt,3330,ct),h()(rt,3332,ct),h()(rt,3331,ct),h()(rt,36010,(function(t,e){return t.bindFramebuffer(36008,e)})),h()(rt,3314,ct),h()(rt,32878,ct),h()(rt,3316,ct),h()(rt,3315,ct),h()(rt,32877,ct),h()(rt,"framebuffer",(function(t,e){var r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)})),h()(rt,"blend",(function(t,e){return e?t.enable(3042):t.disable(3042)})),h()(rt,"blendColor",(function(t,e){return t.blendColor.apply(t,l()(e))})),h()(rt,"blendEquation",(function(t,e){e=lt(e)?e:[e,e],t.blendEquationSeparate.apply(t,l()(e))})),h()(rt,"blendFunc",(function(t,e){e=lt(e)&&2===e.length?[].concat(l()(e),l()(e)):e,t.blendFuncSeparate.apply(t,l()(e))})),h()(rt,"clearColor",(function(t,e){return t.clearColor.apply(t,l()(e))})),h()(rt,"clearDepth",(function(t,e){return t.clearDepth(e)})),h()(rt,"clearStencil",(function(t,e){return t.clearStencil(e)})),h()(rt,"colorMask",(function(t,e){return t.colorMask.apply(t,l()(e))})),h()(rt,"cull",(function(t,e){return e?t.enable(2884):t.disable(2884)})),h()(rt,"cullFace",(function(t,e){return t.cullFace(e)})),h()(rt,"depthTest",(function(t,e){return e?t.enable(2929):t.disable(2929)})),h()(rt,"depthFunc",(function(t,e){return t.depthFunc(e)})),h()(rt,"depthMask",(function(t,e){return t.depthMask(e)})),h()(rt,"depthRange",(function(t,e){return t.depthRange.apply(t,l()(e))})),h()(rt,"dither",(function(t,e){return e?t.enable(3024):t.disable(3024)})),h()(rt,"derivativeHint",(function(t,e){t.hint(35723,e)})),h()(rt,"frontFace",(function(t,e){return t.frontFace(e)})),h()(rt,"mipmapHint",(function(t,e){return t.hint(33170,e)})),h()(rt,"lineWidth",(function(t,e){return t.lineWidth(e)})),h()(rt,"polygonOffsetFill",(function(t,e){return e?t.enable(32823):t.disable(32823)})),h()(rt,"polygonOffset",(function(t,e){return t.polygonOffset.apply(t,l()(e))})),h()(rt,"sampleCoverage",(function(t,e){return t.sampleCoverage.apply(t,l()(e))})),h()(rt,"scissorTest",(function(t,e){return e?t.enable(3089):t.disable(3089)})),h()(rt,"scissor",(function(t,e){return t.scissor.apply(t,l()(e))})),h()(rt,"stencilTest",(function(t,e){return e?t.enable(2960):t.disable(2960)})),h()(rt,"stencilMask",(function(t,e){var r=e=lt(e)?e:[e,e],n=at()(r,2),i=n[0],a=n[1];t.stencilMaskSeparate(1028,i),t.stencilMaskSeparate(1029,a)})),h()(rt,"stencilFunc",(function(t,e){var r=e=lt(e)&&3===e.length?[].concat(l()(e),l()(e)):e,n=at()(r,6),i=n[0],a=n[1],o=n[2],u=n[3],s=n[4],c=n[5];t.stencilFuncSeparate(1028,i,a,o),t.stencilFuncSeparate(1029,u,s,c)})),h()(rt,"stencilOp",(function(t,e){var r=e=lt(e)&&3===e.length?[].concat(l()(e),l()(e)):e,n=at()(r,6),i=n[0],a=n[1],o=n[2],u=n[3],s=n[4],c=n[5];t.stencilOpSeparate(1028,i,a,o),t.stencilOpSeparate(1029,u,s,c)})),h()(rt,"viewport",(function(t,e){return t.viewport.apply(t,l()(e))})),rt);function ht(t,e,r){return void 0!==e[t]?e[t]:r[t]}var dt={blendEquation:function(t,e,r){return t.blendEquationSeparate(ht(32777,e,r),ht(34877,e,r))},blendFunc:function(t,e,r){return t.blendFuncSeparate(ht(32969,e,r),ht(32968,e,r),ht(32971,e,r),ht(32970,e,r))},polygonOffset:function(t,e,r){return t.polygonOffset(ht(32824,e,r),ht(10752,e,r))},sampleCoverage:function(t,e,r){return t.sampleCoverage(ht(32938,e,r),ht(32939,e,r))},stencilFuncFront:function(t,e,r){return t.stencilFuncSeparate(1028,ht(2962,e,r),ht(2967,e,r),ht(2963,e,r))},stencilFuncBack:function(t,e,r){return t.stencilFuncSeparate(1029,ht(34816,e,r),ht(36003,e,r),ht(36004,e,r))},stencilOpFront:function(t,e,r){return t.stencilOpSeparate(1028,ht(2964,e,r),ht(2965,e,r),ht(2966,e,r))},stencilOpBack:function(t,e,r){return t.stencilOpSeparate(1029,ht(34817,e,r),ht(34818,e,r),ht(34819,e,r))}},vt={enable:function(t,e){return t(h()({},e,!0))},disable:function(t,e){return t(h()({},e,!1))},pixelStorei:function(t,e,r){return t(h()({},e,r))},hint:function(t,e,r){return t(h()({},e,r))},bindFramebuffer:function(t,e,r){var n;switch(e){case 36160:return t((n={},h()(n,36006,r),h()(n,36010,r),n));case 36009:return t(h()({},36006,r));case 36008:return t(h()({},36010,r));default:return null}},blendColor:function(t,e,r,n,i){return t(h()({},32773,new Float32Array([e,r,n,i])))},blendEquation:function(t,e){var r;return t((r={},h()(r,32777,e),h()(r,34877,e),r))},blendEquationSeparate:function(t,e,r){var n;return t((n={},h()(n,32777,e),h()(n,34877,r),n))},blendFunc:function(t,e,r){var n;return t((n={},h()(n,32969,e),h()(n,32968,r),h()(n,32971,e),h()(n,32970,r),n))},blendFuncSeparate:function(t,e,r,n,i){var a;return t((a={},h()(a,32969,e),h()(a,32968,r),h()(a,32971,n),h()(a,32970,i),a))},clearColor:function(t,e,r,n,i){return t(h()({},3106,new Float32Array([e,r,n,i])))},clearDepth:function(t,e){return t(h()({},2931,e))},clearStencil:function(t,e){return t(h()({},2961,e))},colorMask:function(t,e,r,n,i){return t(h()({},3107,[e,r,n,i]))},cullFace:function(t,e){return t(h()({},2885,e))},depthFunc:function(t,e){return t(h()({},2932,e))},depthRange:function(t,e,r){return t(h()({},2928,new Float32Array([e,r])))},depthMask:function(t,e){return t(h()({},2930,e))},frontFace:function(t,e){return t(h()({},2886,e))},lineWidth:function(t,e){return t(h()({},2849,e))},polygonOffset:function(t,e,r){var n;return t((n={},h()(n,32824,e),h()(n,10752,r),n))},sampleCoverage:function(t,e,r){var n;return t((n={},h()(n,32938,e),h()(n,32939,r),n))},scissor:function(t,e,r,n,i){return t(h()({},3088,new Int32Array([e,r,n,i])))},stencilMask:function(t,e){var r;return t((r={},h()(r,2968,e),h()(r,36005,e),r))},stencilMaskSeparate:function(t,e,r){return t(h()({},1028===e?2968:36005,r))},stencilFunc:function(t,e,r,n){var i;return t((i={},h()(i,2962,e),h()(i,2967,r),h()(i,2963,n),h()(i,34816,e),h()(i,36003,r),h()(i,36004,n),i))},stencilFuncSeparate:function(t,e,r,n,i){var a;return t((a={},h()(a,1028===e?2962:34816,r),h()(a,1028===e?2967:36003,n),h()(a,1028===e?2963:36004,i),a))},stencilOp:function(t,e,r,n){var i;return t((i={},h()(i,2964,e),h()(i,2965,r),h()(i,2966,n),h()(i,34817,e),h()(i,34818,r),h()(i,34819,n),i))},stencilOpSeparate:function(t,e,r,n,i){var a;return t((a={},h()(a,1028===e?2964:34817,r),h()(a,1028===e?2965:34818,n),h()(a,1028===e?2966:34819,i),a))},viewport:function(t,e,r,n,i){return t(h()({},2978,[e,r,n,i]))}},gt=function(t,e){return t.isEnabled(e)},mt=(nt={},h()(nt,3042,gt),h()(nt,2884,gt),h()(nt,2929,gt),h()(nt,3024,gt),h()(nt,32823,gt),h()(nt,32926,gt),h()(nt,32928,gt),h()(nt,3089,gt),h()(nt,2960,gt),h()(nt,35977,gt),nt);function yt(t){for(var e in t)return!1;return!0}function pt(t,e){if(t===e)return!0;var r=Array.isArray(t)||ArrayBuffer.isView(t),n=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&n&&t.length===e.length){for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}return!1}function bt(t,e){var r=t[e].bind(t);t[e]=function(){var e=arguments.length<=0?void 0:arguments[0];return e in t.state.cache&&t.state.enable?t.state.cache[e]:r.apply(void 0,arguments)},Object.defineProperty(t[e],"name",{value:"".concat(e,"-from-cache"),configurable:!1})}function _t(t,e,r){var n=t[e].bind(t);t[e]=function(){for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];var o=r.apply(void 0,[t.state._updateCache].concat(i)),u=o.valueChanged,s=o.oldValue;return u&&n.apply(void 0,i),s},Object.defineProperty(t[e],"name",{value:"".concat(e,"-to-cache"),configurable:!1})}function At(t){var e=t.useProgram.bind(t);t.useProgram=function(r){t.state.program!==r&&(e(r),t.state.program=r)}}var xt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.copyState,a=void 0!==n&&n,o=r.log,u=void 0===o?function(){}:o;i()(this,t),this.gl=e,this.program=null,this.stateStack=[],this.enable=!0,this.cache=a?Ot(e):Object.assign({},ot),this.log=u,this._updateCache=this._updateCache.bind(this),Object.seal(this)}return o()(t,[{key:"push",value:function(){this.stateStack.push({})}},{key:"pop",value:function(){N(this.stateStack.length>0);var t=this.stateStack[this.stateStack.length-1];St(this.gl,t),this.stateStack.pop()}},{key:"_updateCache",value:function(t){var e,r=!1,n=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(var i in t){N(void 0!==i);var a=t[i],o=this.cache[i];pt(a,o)||(r=!0,e=o,n&&!(i in n)&&(n[i]=o),this.cache[i]=a)}return{valueChanged:r,oldValue:e}}}]),t}();function wt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.enable,n=void 0===r||r,i=e.copyState;if(N(void 0!==i),!t.state){var a=globalThis.polyfillContext;for(var o in a&&a(t),t.state=new xt(t,{copyState:i}),At(t),vt){var u=vt[o];_t(t,o,u)}bt(t,"getParameter"),bt(t,"isEnabled")}return t.state.enable=n,t}function Et(t){N(t.state),t.state.pop()}function Tt(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return kt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kt(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function kt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function St(t,e){if(N(C(t),"setParameters requires a WebGL context"),!yt(e)){var r={};for(var n in e){var i=Number(n),a=ft[n];a&&("string"==typeof a?r[a]=!0:a(t,e[n],i))}var o=t.state&&t.state.cache;if(o)for(var u in r){(0,dt[u])(t,e,o)}}}function Ot(t,e){if("number"==typeof(e=e||ot)){var r=e,n=mt[r];return n?n(t,r):t.getParameter(r)}var i,a={},o=Tt(Array.isArray(e)?e:Object.keys(e));try{for(o.s();!(i=o.n()).done;){var u=i.value,s=mt[u];a[u]=s?s(t,Number(u)):t.getParameter(Number(u))}}catch(t){o.e(t)}finally{o.f()}return a}function Lt(t,e,r){if(yt(e))return r(t);var n,i=e.nocatch,a=void 0===i||i;if(function(t){t.state||wt(t,{copyState:!1}),t.state.push()}(t),St(t,e),a)n=r(t),Et(t);else try{n=r(t)}finally{Et(t)}return n}var Ft=r(40);var Rt=Object(Ft.a)();function It(t){var e=t.getParameter(7936),r=t.getParameter(7937),n=t.getExtension("WEBGL_debug_renderer_info");return{vendor:n&&t.getParameter(n.UNMASKED_VENDOR_WEBGL||7936)||e,renderer:n&&t.getParameter(n.UNMASKED_RENDERER_WEBGL||7937)||r,vendorMasked:e,rendererMasked:r,version:t.getParameter(7938),shadingLanguageVersion:t.getParameter(35724)}}var Bt=r(13),Pt=function(){function t(e,r){i()(this,t),this.name=e,this.type=r,this.sampleSize=1,this.reset()}return o()(t,[{key:"setSampleSize",value:function(t){return this.sampleSize=t,this}},{key:"incrementCount",value:function(){return this.addCount(1),this}},{key:"decrementCount",value:function(){return this.subtractCount(1),this}},{key:"addCount",value:function(t){return this._count+=t,this._samples++,this._checkSampling(),this}},{key:"subtractCount",value:function(t){return this._count-=t,this._samples++,this._checkSampling(),this}},{key:"addTime",value:function(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}},{key:"timeStart",value:function(){return this._startTime=Object(Bt.a)(),this._timerPending=!0,this}},{key:"timeEnd",value:function(){return this._timerPending?(this.addTime(Object(Bt.a)()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}},{key:"getSampleAverageCount",value:function(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}},{key:"getSampleAverageTime",value:function(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}},{key:"getSampleHz",value:function(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}},{key:"getAverageCount",value:function(){return this.samples>0?this.count/this.samples:0}},{key:"getAverageTime",value:function(){return this.samples>0?this.time/this.samples:0}},{key:"getHz",value:function(){return this.time>0?this.samples/(this.time/1e3):0}},{key:"reset",value:function(){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}},{key:"_checkSampling",value:function(){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)}}]),t}(),Dt=function(){function t(e){var r=e.id,n=e.stats;i()(this,t),this.id=r,this.stats={},this._initializeStats(n),Object.seal(this)}return o()(t,[{key:"get",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}},{key:"reset",value:function(){for(var t in this.stats)this.stats[t].reset();return this}},{key:"forEach",value:function(t){for(var e in this.stats)t(this.stats[e])}},{key:"getTable",value:function(){var t={};return this.forEach((function(e){t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}},{key:"_initializeStats",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((function(e){return t._getOrCreate(e)}))}},{key:"_getOrCreate",value:function(t){if(!t||!t.name)return null;var e=t.name,r=t.type;return this.stats[e]||(this.stats[e]=t instanceof Pt?t:new Pt(e,r)),this.stats[e]}},{key:"size",get:function(){return Object.keys(this.stats).length}}]),t}(),jt=new(function(){function t(){i()(this,t),this.stats=new Map}return o()(t,[{key:"get",value:function(t){return this.stats.has(t)||this.stats.set(t,new Dt({id:t})),this.stats.get(t)}}]),t}());if(globalThis.luma&&"8.5.10"!==globalThis.luma.VERSION)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat("8.5.10"));globalThis.luma||(Object(Ft.a)()&&j.log(1,"luma.gl ".concat("8.5.10"," - ").concat("set luma.log.level=1 (or higher) to trace rendering"))(),globalThis.luma=globalThis.luma||{VERSION:"8.5.10",version:"8.5.10",log:j,stats:jt,globals:{modules:{},nodeIO:{}}});globalThis.luma;function Nt(t){return"undefined"!=typeof window&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function Ct(t){return"undefined"!=typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}var Mt=r(7),Ut=r.n(Mt),Vt=r(5),Gt=r.n(Vt),zt=r(6),Ht=r.n(zt),Xt=r(3),Wt=r.n(Xt);function Yt(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}function qt(t,e){if("string"!=typeof e)return e;var r=Number(e);if(!isNaN(r))return r;var n=t[e=e.replace(/^.*\./,"")];return Yt(void 0!==n,"Accessing undefined constant GL.".concat(e)),n}function Qt(t,e){for(var r in e=Number(e),t)if(t[r]===e)return"GL.".concat(r);return String(e)}var $t={};function Jt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";$t[t]=$t[t]||1;var e=$t[t]++;return"".concat(t,"-").concat(e)}function Kt(t){return Yt("number"==typeof t,"Input must be a number"),t&&0==(t&t-1)}function Zt(t){var e=!0;for(var r in t){e=!1;break}return e}function te(t,e,r,n){var i="See luma.gl ".concat(r," Upgrade Guide at https://luma.gl/docs/upgrade-guide"),a=Object.getPrototypeOf(t);n.forEach((function(t){a.methodName||(a[t]=function(){throw j.removed("Calling removed method ".concat(e,".").concat(t,": "),i)(),new Error(t)})}))}function ee(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return re(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return re(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function re(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var ne="Resource subclass must define virtual methods",ie=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,t),U(e);var n=r.id,a=r.userData,o=void 0===a?{}:a;this.gl=e,this.gl2=e,this.id=n||Jt(this.constructor.name),this.userData=o,this._bound=!1,this._handle=r.handle,void 0===this._handle&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}return o()(t,[{key:"toString",value:function(){return"".concat(this.constructor.name,"(").concat(this.id,")")}},{key:"delete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.deleteChildren,r=void 0!==e&&e,n=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,n&&r&&n.filter(Boolean).forEach((function(t){return t.delete()})),this}},{key:"bind",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.handle;return"function"!=typeof e?(this._bindHandle(e),this):(this._bound?t=e():(this._bindHandle(this.handle),this._bound=!0,t=e(),this._bound=!1,this._bindHandle(null)),t)}},{key:"unbind",value:function(){this.bind(null)}},{key:"getParameter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Yt(t=qt(this.gl,t));var r=this.constructor.PARAMETERS||{},n=r[t];if(n){var i=M(this.gl),a=(!("webgl2"in n)||i)&&(!("extension"in n)||this.gl.getExtension(n.extension));if(!a){var o=n.webgl1,u="webgl2"in n?n.webgl2:n.webgl1,s=i?u:o;return s}}return this._getParameter(t,e)}},{key:"getParameters",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.parameters,n=e.keys,i=this.constructor.PARAMETERS||{},a=M(this.gl),o={},u=r||Object.keys(i),s=ee(u);try{for(s.s();!(t=s.n()).done;){var c=t.value,l=i[c],f=l&&(!("webgl2"in l)||a)&&(!("extension"in l)||this.gl.getExtension(l.extension));if(f){var h=n?Qt(this.gl,c):c;o[h]=this.getParameter(c,e),n&&"GLenum"===l.type&&(o[h]=Qt(this.gl,o[h]))}}}catch(t){s.e(t)}finally{s.f()}return o}},{key:"setParameter",value:function(t,e){Yt(t=qt(this.gl,t));var r=(this.constructor.PARAMETERS||{})[t];if(r){var n=M(this.gl);if(!((!("webgl2"in r)||n)&&(!("extension"in r)||this.gl.getExtension(r.extension))))throw new Error("Parameter not available on this platform");"GLenum"===r.type&&(e=qt(e))}return this._setParameter(t,e),this}},{key:"setParameters",value:function(t){for(var e in t)this.setParameter(e,t[e]);return this}},{key:"stubRemovedMethods",value:function(t,e,r){return te(this,t,e,r)}},{key:"initialize",value:function(t){}},{key:"_createHandle",value:function(){throw new Error(ne)}},{key:"_deleteHandle",value:function(){throw new Error(ne)}},{key:"_bindHandle",value:function(t){throw new Error(ne)}},{key:"_getOptsFromHandle",value:function(){throw new Error(ne)}},{key:"_getParameter",value:function(t,e){throw new Error(ne)}},{key:"_setParameter",value:function(t,e){throw new Error(ne)}},{key:"_context",value:function(){return this.gl.luma=this.gl.luma||{},this.gl.luma}},{key:"_addStats",value:function(){var t=this.constructor.name,e=jt.get("Resource Counts");e.get("Resources Created").incrementCount(),e.get("".concat(t,"s Created")).incrementCount(),e.get("".concat(t,"s Active")).incrementCount()}},{key:"_removeStats",value:function(){var t=this.constructor.name;jt.get("Resource Counts").get("".concat(t,"s Active")).decrementCount()}},{key:"_trackAllocatedMemory",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.name,r=jt.get("Memory Usage");r.get("GPU Memory").addCount(t),r.get("".concat(e," Memory")).addCount(t),this.byteLength=t}},{key:"_trackDeallocatedMemory",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.constructor.name,e=jt.get("Memory Usage");e.get("GPU Memory").subtractCount(this.byteLength),e.get("".concat(t," Memory")).subtractCount(this.byteLength),this.byteLength=0}},{key:"handle",get:function(){return this._handle}}]),t}(),ae=r(22),oe=r.n(ae);function ue(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error("Failed to deduce GL constant from typed array")}}function se(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.clamped,n=void 0===r||r;switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return n?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function ce(t){var e=t.data,r=t.width,n=t.height,i=t.bytesPerPixel,a=void 0===i?4:i,o=t.temp,u=r*a;o=o||new Uint8Array(u);for(var s=0;s<n/2;++s){var c=s*u,l=(n-s-1)*u;o.set(e.subarray(c,c+u)),e.copyWithin(c,l,l+u),e.set(o,l)}}function le(t){for(var e=t.data,r=t.width,n=t.height,i=Math.round(r/2),a=Math.round(n/2),o=new Uint8Array(i*a*4),u=0;u<a;u++)for(var s=0;s<i;s++)for(var c=0;c<4;c++)o[4*(u*i+s)+c]=e[4*(2*u*r+2*s)+c];return{data:o,width:i,height:a}}function fe(t,e,r){var n=r.removedProps,i=void 0===n?{}:n,a=r.deprecatedProps,o=void 0===a?{}:a,u=r.replacedProps,s=void 0===u?{}:u;for(var c in i)if(c in e){var l=i[c]?"".concat(t,".").concat(i[c]):"N/A";j.removed("".concat(t,".").concat(c),l)()}for(var f in o)if(f in e){var h=o[f];j.deprecated("".concat(t,".").concat(f),"".concat(t,".").concat(h))()}var d=null;for(var v in s)if(v in e){var g=s[v];j.deprecated("".concat(t,".").concat(v),"".concat(t,".").concat(g))(),(d=d||Object.assign({},e))[g]=e[v],delete d[v]}return d||e}var he={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},de={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},ve=function(){function t(){var e=this;i()(this,t);for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];n.forEach((function(t){return e._assign(t)})),Object.freeze(this)}return o()(t,null,[{key:"getBytesPerElement",value:function(t){return se(t.type||5126).BYTES_PER_ELEMENT}},{key:"getBytesPerVertex",value:function(t){return Yt(t.size),se(t.type||5126).BYTES_PER_ELEMENT*t.size}},{key:"resolve",value:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return oe()(t,[he].concat(r))}}]),o()(t,[{key:"toString",value:function(){return JSON.stringify(this)}},{key:"_assign",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0!==(t=fe("Accessor",t,de)).type&&(this.type=t.type,5124!==t.type&&5125!==t.type||(this.integer=!0)),void 0!==t.size&&(this.size=t.size),void 0!==t.offset&&(this.offset=t.offset),void 0!==t.stride&&(this.stride=t.stride),void 0!==t.normalized&&(this.normalized=t.normalized),void 0!==t.integer&&(this.integer=t.integer),void 0!==t.divisor&&(this.divisor=t.divisor),void 0!==t.buffer&&(this.buffer=t.buffer),void 0!==t.index&&("boolean"==typeof t.index?this.index=t.index?1:0:this.index=t.index),void 0!==t.instanced&&(this.divisor=t.instanced?1:0),void 0!==t.isInstanced&&(this.divisor=t.isInstanced?1:0),this}},{key:"BYTES_PER_ELEMENT",get:function(){return t.getBytesPerElement(this)}},{key:"BYTES_PER_VERTEX",get:function(){return t.getBytesPerVertex(this)}}]),t}();function ge(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var me,ye,pe,be={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},_e={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:be},Ae={removedProps:be},xe=function(t){Gt()(r,t);var e=ge(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=e.call(this,t,a)).stubRemovedMethods("Buffer","v6.0",["layout","setLayout","getIndexedParameter"]),n.target=a.target||(n.gl.webgl2?36662:34962),n.initialize(a),Object.seal(Ut()(n)),n}return o()(r,[{key:"getElementCount",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/ve.getBytesPerElement(t))}},{key:"getVertexCount",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/ve.getBytesPerVertex(t))}},{key:"initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=fe("Buffer",t,_e),this.usage=t.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.offset,t.byteLength):this._setByteLength(t.byteLength||0),this}},{key:"setProps",value:function(t){return"accessor"in(t=fe("Buffer",t,Ae))&&this.setAccessor(t.accessor),this}},{key:"setAccessor",value:function(t){return delete(t=Object.assign({},t)).buffer,this.accessor=new ve(t),this}},{key:"reallocate",value:function(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}},{key:"setData",value:function(t){return this.initialize(t)}},{key:"subData",value:function(t){ArrayBuffer.isView(t)&&(t={data:t});var e=t,r=e.data,n=e.offset,i=void 0===n?0:n,a=e.srcOffset,o=void 0===a?0:a,u=t.byteLength||t.length;Yt(r);var s=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(s,this.handle),0!==o||void 0!==u?(V(this.gl),this.gl.bufferSubData(this.target,i,r,o,u)):this.gl.bufferSubData(s,i,r),this.gl.bindBuffer(s,null),this.debugData=null,this._inferType(r),this}},{key:"copyData",value:function(t){var e=t.sourceBuffer,r=t.readOffset,n=void 0===r?0:r,i=t.writeOffset,a=void 0===i?0:i,o=t.size,u=this.gl;return V(u),u.bindBuffer(36662,e.handle),u.bindBuffer(36663,this.handle),u.copyBufferSubData(36662,36663,n,a,o),u.bindBuffer(36662,null),u.bindBuffer(36663,null),this.debugData=null,this}},{key:"getData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.dstData,r=void 0===e?null:e,n=t.srcByteOffset,i=void 0===n?0:n,a=t.dstOffset,o=void 0===a?0:a,u=t.length,s=void 0===u?0:u;V(this.gl);var c,l,f=se(this.accessor.type||5126,{clamped:!1}),h=this._getAvailableElementCount(i),d=o;r?c=(l=r.length)-d:l=d+(c=Math.min(h,s||h));var v=Math.min(h,c);return Yt((s=s||v)<=v),r=r||new f(l),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,i,r,o,s),this.gl.bindBuffer(36662,null),r}},{key:"bind",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.target,r=void 0===e?this.target:e,n=t.index,i=void 0===n?this.accessor&&this.accessor.index:n,a=t.offset,o=void 0===a?0:a,u=t.size;return 35345===r||35982===r?void 0!==u?this.gl.bindBufferRange(r,i,this.handle,o,u):(Yt(0===o),this.gl.bindBufferBase(r,i,this.handle)):this.gl.bindBuffer(r,this.handle),this}},{key:"unbind",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.target,r=void 0===e?this.target:e,n=t.index,i=void 0===n?this.accessor&&this.accessor.index:n,a=35345===r||35982===r;return a?this.gl.bindBufferBase(r,i,null):this.gl.bindBuffer(r,null),this}},{key:"getDebugData",value:function(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(10,this.byteLength)}),{data:this.debugData,changed:!0})}},{key:"invalidateDebugData",value:function(){this.debugData=null}},{key:"_setData",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.byteLength+e;Yt(ArrayBuffer.isView(t)),this._trackDeallocatedMemory();var n=this._getTarget();this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.usage),this.gl.bufferSubData(n,e,t),this.gl.bindBuffer(n,null),this.debugData=t.slice(0,10),this.bytesUsed=r,this._trackAllocatedMemory(r);var i=ue(t);return Yt(i),this.setAccessor(new ve(this.accessor,{type:i})),this}},{key:"_setByteLength",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.usage;Yt(t>=0),this._trackDeallocatedMemory();var r=t;0===t&&(r=new Float32Array(0));var n=this._getTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,e),this.gl.bindBuffer(n,null),this.usage=e,this.debugData=null,this.bytesUsed=t,this._trackAllocatedMemory(t),this}},{key:"_getTarget",value:function(){return this.gl.webgl2?36663:this.target}},{key:"_getAvailableElementCount",value:function(t){var e=t/se(this.accessor.type||5126,{clamped:!1}).BYTES_PER_ELEMENT;return this.getElementCount()-e}},{key:"_inferType",value:function(t){this.accessor.type||this.setAccessor(new ve(this.accessor,{type:ue(t)}))}},{key:"_createHandle",value:function(){return this.gl.createBuffer()}},{key:"_deleteHandle",value:function(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}},{key:"_getParameter",value:function(t){this.gl.bindBuffer(this.target,this.handle);var e=this.gl.getBufferParameter(this.target,t);return this.gl.bindBuffer(this.target,null),e}},{key:"setByteLength",value:function(t){return j.deprecated("setByteLength","reallocate")(),this.reallocate(t)}},{key:"updateAccessor",value:function(t){return j.deprecated("updateAccessor(...)","setAccessor(new Accessor(buffer.accessor, ...)")(),this.accessor=new ve(this.accessor,t),this}},{key:"type",get:function(){return j.deprecated("Buffer.type","Buffer.accessor.type")(),this.accessor.type}},{key:"bytes",get:function(){return j.deprecated("Buffer.bytes","Buffer.byteLength")(),this.byteLength}}]),r}(ie),we=(me={},h()(me,6407,{dataFormat:6407,types:[5121,33635]}),h()(me,6408,{dataFormat:6408,types:[5121,32819,32820]}),h()(me,6406,{dataFormat:6406,types:[5121]}),h()(me,6409,{dataFormat:6409,types:[5121]}),h()(me,6410,{dataFormat:6410,types:[5121]}),h()(me,33326,{dataFormat:6403,types:[5126],gl2:!0}),h()(me,33328,{dataFormat:33319,types:[5126],gl2:!0}),h()(me,34837,{dataFormat:6407,types:[5126],gl2:!0}),h()(me,34836,{dataFormat:6408,types:[5126],gl2:!0}),me),Ee=(ye={},h()(ye,6403,1),h()(ye,36244,1),h()(ye,33319,2),h()(ye,33320,2),h()(ye,6407,3),h()(ye,36248,3),h()(ye,6408,4),h()(ye,36249,4),h()(ye,6402,1),h()(ye,34041,1),h()(ye,6406,1),h()(ye,6409,1),h()(ye,6410,2),ye),Te=(pe={},h()(pe,5126,4),h()(pe,5125,4),h()(pe,5124,4),h()(pe,5123,2),h()(pe,5122,2),h()(pe,5131,2),h()(pe,5120,1),h()(pe,5121,1),pe);function ke(t,e){var r=we[e];if(!r)return!1;if(void 0===r.gl1&&void 0===r.gl2)return!0;var n=M(t)&&r.gl2||r.gl1;return"string"==typeof n?t.getExtension(n):n}function Se(t,e){var r=we[e];switch(r&&r.types[0]){case 5126:return t.getExtension("OES_texture_float_linear");case 5131:return t.getExtension("OES_texture_half_float_linear");default:return!0}}function Oe(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Le(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Le(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Le(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Fe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var Re=[9729,9728],Ie=globalThis.WebGLBuffer||function(){},Be=function(t){Gt()(r,t);var e=Fe(r);function r(t,n){var a;i()(this,r);var o=n.id,u=void 0===o?Jt("texture"):o,s=n.handle,c=n.target;return(a=e.call(this,t,{id:u,handle:s})).target=c,a.textureUnit=void 0,a.loaded=!1,a.width=void 0,a.height=void 0,a.depth=void 0,a.format=void 0,a.type=void 0,a.dataFormat=void 0,a.border=void 0,a.textureUnit=void 0,a.mipmaps=void 0,a}return o()(r,null,[{key:"isSupported",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.format,n=e.linearFiltering,i=!0;return r&&(i=(i=i&&ke(t,r))&&(!n||Se(t,r))),i}}]),o()(r,[{key:"toString",value:function(){return"Texture(".concat(this.id,",").concat(this.width,"x").concat(this.height,")")}},{key:"initialize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.data;if(r instanceof Promise)return r.then((function(r){return t.initialize(Object.assign({},e,{pixels:r,data:r}))})),this;var n="undefined"!=typeof HTMLVideoElement&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",(function(){return t.initialize(e)})),this;var i=e.pixels,a=void 0===i?null:i,o=e.format,u=void 0===o?6408:o,s=e.border,c=void 0===s?0:s,l=e.recreate,f=void 0!==l&&l,h=e.parameters,d=void 0===h?{}:h,v=e.pixelStore,g=void 0===v?{}:v,m=e.textureUnit,y=void 0===m?void 0:m;r||(r=a);var p=e.width,b=e.height,_=e.dataFormat,A=e.type,x=e.compressed,w=void 0!==x&&x,E=e.mipmaps,T=void 0===E||E,k=e.depth,S=void 0===k?0:k,O=this._deduceParameters({format:u,type:A,dataFormat:_,compressed:w,data:r,width:p,height:b});return p=O.width,b=O.height,w=O.compressed,_=O.dataFormat,A=O.type,this.width=p,this.height=b,this.depth=S,this.format=u,this.type=A,this.dataFormat=_,this.border=c,this.textureUnit=y,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),T&&this._isNPOT()&&(j.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),T=!1,this._updateForNPOT(d)),this.mipmaps=T,this.setImageData({data:r,width:p,height:b,depth:S,format:u,type:A,dataFormat:_,border:c,mipmaps:T,parameters:g,compressed:w}),T&&this.generateMipmap(),this.setParameters(d),f&&(this.data=r),n&&(this._video={video:r,parameters:d,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}},{key:"update",value:function(){if(this._video){var t=this._video,e=t.video,r=t.parameters;if(t.lastTime===e.currentTime||e.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:e,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=e.currentTime}}},{key:"resize",value:function(t){var e=t.height,r=t.width,n=t.mipmaps,i=void 0!==n&&n;return r!==this.width||e!==this.height?this.initialize({width:r,height:e,format:this.format,type:this.type,dataFormat:this.dataFormat,border:this.border,mipmaps:i}):this}},{key:"generateMipmap",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._isNPOT()?(j.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Lt(this.gl,e,(function(){t.gl.generateMipmap(t.target)})),this.gl.bindTexture(this.target,null),this)}},{key:"setImageData",value:function(t){this._trackDeallocatedMemory("Texture");var e=t.target,r=void 0===e?this.target:e,n=t.pixels,i=void 0===n?null:n,a=t.level,o=void 0===a?0:a,u=t.format,s=void 0===u?this.format:u,c=t.border,l=void 0===c?this.border:c,f=t.offset,h=void 0===f?0:f,d=t.parameters,v=void 0===d?{}:d,g=t.data,m=void 0===g?null:g,y=t.type,p=void 0===y?this.type:y,b=t.width,_=void 0===b?this.width:b,A=t.height,x=void 0===A?this.height:A,w=t.dataFormat,E=void 0===w?this.dataFormat:w,T=t.compressed,k=void 0!==T&&T;m||(m=i);var S=this._deduceParameters({format:s,type:p,dataFormat:E,compressed:k,data:m,width:_,height:x});p=S.type,E=S.dataFormat,k=S.compressed,_=S.width,x=S.height;var O=this.gl;O.bindTexture(this.target,this.handle);var L,F,R=this._getDataType({data:m,compressed:k});if(m=R.data,L=R.dataType,Lt(this.gl,v,(function(){switch(L){case"null":O.texImage2D(r,o,s,_,x,l,E,p,m);break;case"typed-array":O.texImage2D(r,o,s,_,x,l,E,p,m,h);break;case"buffer":(F=V(O)).bindBuffer(35052,m.handle||m),F.texImage2D(r,o,s,_,x,l,E,p,h),F.bindBuffer(35052,null);break;case"browser-object":M(O)?O.texImage2D(r,o,s,_,x,l,E,p,m):O.texImage2D(r,o,s,E,p,m);break;case"compressed":var t,e=Oe(m.entries());try{for(e.s();!(t=e.n()).done;){var n=at()(t.value,2),i=n[0],a=n[1];O.compressedTexImage2D(r,i,a.format,a.width,a.height,l,a.data)}}catch(t){e.e(t)}finally{e.f()}break;default:Yt(!1,"Unknown image data type")}})),m&&m.byteLength)this._trackAllocatedMemory(m.byteLength,"Texture");else{var I=Ee[this.dataFormat]||4,B=Te[this.type]||1;this._trackAllocatedMemory(this.width*this.height*I*B,"Texture")}return this.loaded=!0,this}},{key:"setSubImageData",value:function(t){var e=this,r=t.target,n=void 0===r?this.target:r,i=t.pixels,a=void 0===i?null:i,o=t.data,u=void 0===o?null:o,s=t.x,c=void 0===s?0:s,l=t.y,f=void 0===l?0:l,h=t.width,d=void 0===h?this.width:h,v=t.height,g=void 0===v?this.height:v,m=t.level,y=void 0===m?0:m,p=t.format,b=void 0===p?this.format:p,_=t.type,A=void 0===_?this.type:_,x=t.dataFormat,w=void 0===x?this.dataFormat:x,E=t.compressed,T=void 0!==E&&E,k=t.offset,S=void 0===k?0:k,O=t.border,L=(void 0===O&&this.border,t.parameters),F=void 0===L?{}:L,R=this._deduceParameters({format:b,type:A,dataFormat:w,compressed:T,data:u,width:d,height:g});if(A=R.type,w=R.dataFormat,T=R.compressed,d=R.width,g=R.height,Yt(0===this.depth,"texSubImage not supported for 3D textures"),u||(u=a),u&&u.data){var I=u;u=I.data,d=I.shape[0],g=I.shape[1]}u instanceof xe&&(u=u.handle),this.gl.bindTexture(this.target,this.handle),Lt(this.gl,F,(function(){if(T)e.gl.compressedTexSubImage2D(n,y,c,f,d,g,b,u);else if(null===u)e.gl.texSubImage2D(n,y,c,f,d,g,w,A,null);else if(ArrayBuffer.isView(u))e.gl.texSubImage2D(n,y,c,f,d,g,w,A,u,S);else if(u instanceof Ie){var t=V(e.gl);t.bindBuffer(35052,u),t.texSubImage2D(n,y,c,f,d,g,w,A,S),t.bindBuffer(35052,null)}else if(M(e.gl)){V(e.gl).texSubImage2D(n,y,c,f,d,g,w,A,u)}else e.gl.texSubImage2D(n,y,c,f,w,A,u)})),this.gl.bindTexture(this.target,null)}},{key:"copyFramebuffer",value:function(){return j.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}},{key:"getActiveUnit",value:function(){return this.gl.getParameter(34016)-33984}},{key:"bind",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit,e=this.gl;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,this.handle),t}},{key:"unbind",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit,e=this.gl;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,null),t}},{key:"_getDataType",value:function(t){var e=t.data,r=t.compressed;return void 0!==r&&r?{data:e,dataType:"compressed"}:null===e?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof xe?{data:e.handle,dataType:"buffer"}:e instanceof Ie?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}},{key:"_deduceParameters",value:function(t){var e=t.format,r=t.data,n=t.width,i=t.height,a=t.dataFormat,o=t.type,u=t.compressed,s=we[e];a=a||s&&s.dataFormat,o=o||s&&s.types[0],u=u||s&&s.compressed;var c=this._deduceImageSize(r,n,i);return{dataFormat:a,type:o,compressed:u,width:n=c.width,height:i=c.height,format:e,data:r}}},{key:"_deduceImageSize",value:function(t,e,r){var n;return Yt(n="undefined"!=typeof ImageData&&t instanceof ImageData?{width:t.width,height:t.height}:"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?{width:t.naturalWidth,height:t.naturalHeight}:"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?{width:t.width,height:t.height}:"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t?{width:e,height:r}:{width:e>=0?e:1,height:r>=0?r:1},"Could not deduced texture size"),Yt(void 0===e||n.width===e,"Deduced texture width does not match supplied width"),Yt(void 0===r||n.height===r,"Deduced texture height does not match supplied height"),n}},{key:"_createHandle",value:function(){return this.gl.createTexture()}},{key:"_deleteHandle",value:function(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory("Texture")}},{key:"_getParameter",value:function(t){switch(t){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);var e=this.gl.getTexParameter(this.target,t);return this.gl.bindTexture(this.target,null),e}}},{key:"_setParameter",value:function(t,e){switch(this.gl.bindTexture(this.target,this.handle),e=this._getNPOTParam(t,e),t){case 33082:case 33083:this.gl.texParameterf(this.handle,t,e);break;case 4096:case 4097:Yt(!1);break;default:this.gl.texParameteri(this.target,t,e)}return this.gl.bindTexture(this.target,null),this}},{key:"_isNPOT",value:function(){return!M(this.gl)&&(!(!this.width||!this.height)&&(!Kt(this.width)||!Kt(this.height)))}},{key:"_updateForNPOT",value:function(t){void 0===t[this.gl.TEXTURE_MIN_FILTER]&&(t[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),void 0===t[this.gl.TEXTURE_WRAP_S]&&(t[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),void 0===t[this.gl.TEXTURE_WRAP_T]&&(t[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}},{key:"_getNPOTParam",value:function(t,e){if(this._isNPOT())switch(t){case 10241:-1===Re.indexOf(e)&&(e=9729);break;case 10242:case 10243:33071!==e&&(e=33071)}return e}}]),r}(ie),Pe="";function De(t){Pe=t}function je(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Yt("string"==typeof t),t=Pe+t;var r=e.dataType||"text";return fetch(t,e).then((function(t){return t[r]()}))}function Ne(t,e){return Yt("string"==typeof t),t=Pe+t,new Promise((function(r,n){try{var i=new Image;i.onload=function(){return r(i)},i.onerror=function(){return n(new Error("Could not load image ".concat(t,".")))},i.crossOrigin=e&&e.crossOrigin||"anonymous",i.src=t}catch(t){n(t)}}))}function Ce(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var Me=function(t){Gt()(r,t);var e=Ce(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),U(t),(a instanceof Promise||"string"==typeof a)&&(a={data:a}),"string"==typeof a.data&&(a=Object.assign({},a,{data:Ne(a.data)})),(n=e.call(this,t,Object.assign({},a,{target:3553}))).initialize(a),Object.seal(Ut()(n)),n}return o()(r,null,[{key:"isSupported",value:function(t,e){return Be.isSupported(t,e)}}]),r}(Be),Ue=r(16),Ve=r.n(Ue),Ge=r(23),ze=r.n(Ge);function He(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var Xe=[34069,34070,34071,34072,34073,34074],We=function(t){Gt()(n,t);var e,r=He(n);function n(t){var e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,n),U(t),(e=r.call(this,t,Object.assign({},a,{target:34067}))).initialize(a),Object.seal(Ut()(e)),e}return o()(n,[{key:"initialize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.mipmaps,n=void 0===r||r,i=e.parameters,a=void 0===i?{}:i;return this.opts=e,this.setCubeMapImageData(e).then((function(){t.loaded=!0,n&&t.generateMipmap(e),t.setParameters(a)})),this}},{key:"subImage",value:function(t){var e=t.face,r=t.data,n=t.x,i=void 0===n?0:n,a=t.y,o=void 0===a?0:a,u=t.mipmapLevel,s=void 0===u?0:u;return this._subImage({target:e,data:r,x:i,y:o,mipmapLevel:s})}},{key:"setCubeMapImageData",value:(e=ze()(Ve.a.mark((function t(e){var r,n,i,a,o,u,s,c,l,f,h,d,v,g=this;return Ve.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.width,n=e.height,i=e.pixels,a=e.data,o=e.border,u=void 0===o?0:o,s=e.format,c=void 0===s?6408:s,l=e.type,f=void 0===l?5121:l,h=this.gl,d=i||a,t.next=5,Promise.all(Xe.map((function(t){var e=d[t];return Promise.all(Array.isArray(e)?e:[e])})));case 5:v=t.sent,this.bind(),Xe.forEach((function(t,e){v[e].length>1&&!1!==g.opts.mipmaps&&j.warn("".concat(g.id," has mipmap and multiple LODs."))(),v[e].forEach((function(e,i){r&&n?h.texImage2D(t,i,c,r,n,u,c,f,e):h.texImage2D(t,i,c,c,f,e)}))})),this.unbind();case 9:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"setImageDataForFace",value:function(t){var e=this,r=t.face,n=t.width,i=t.height,a=t.pixels,o=t.data,u=t.border,s=void 0===u?0:u,c=t.format,l=void 0===c?6408:c,f=t.type,h=void 0===f?5121:f,d=this.gl,v=a||o;return this.bind(),v instanceof Promise?v.then((function(n){return e.setImageDataForFace(Object.assign({},t,{face:r,data:n,pixels:n}))})):this.width||this.height?d.texImage2D(r,0,l,n,i,s,l,h,v):d.texImage2D(r,0,l,l,h,v),this}}]),n}(Be);function Ye(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}We.FACES=Xe;var qe,Qe=function(t){Gt()(r,t);var e=Ye(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),V(t),a=Object.assign({depth:1},a,{target:32879,unpackFlipY:!1}),(n=e.call(this,t,a)).initialize(a),Object.seal(Ut()(n)),n}return o()(r,null,[{key:"isSupported",value:function(t){return M(t)}}]),o()(r,[{key:"setImageData",value:function(t){var e=this,r=t.level,n=void 0===r?0:r,i=t.dataFormat,a=void 0===i?6408:i,o=t.width,u=t.height,s=t.depth,c=void 0===s?1:s,l=t.border,f=void 0===l?0:l,h=t.format,d=t.type,v=void 0===d?5121:d,g=t.offset,m=void 0===g?0:g,y=t.data,p=t.parameters,b=void 0===p?{}:p;if(this._trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle),Lt(this.gl,b,(function(){ArrayBuffer.isView(y)&&e.gl.texImage3D(e.target,n,a,o,u,c,f,h,v,y),y instanceof xe&&(e.gl.bindBuffer(35052,y.handle),e.gl.texImage3D(e.target,n,a,o,u,c,f,h,v,m))})),y&&y.byteLength)this._trackAllocatedMemory(y.byteLength,"Texture");else{var _=Ee[this.dataFormat]||4,A=Te[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*_*A,"Texture")}return this.loaded=!0,this}}]),r}(Be),$e=r(12),Je=r.n($e),Ke="EXT_color_buffer_float",Ze=(qe={},h()(qe,33189,{bpp:2}),h()(qe,33190,{gl2:!0,bpp:3}),h()(qe,36012,{gl2:!0,bpp:4}),h()(qe,36168,{bpp:1}),h()(qe,34041,{bpp:4}),h()(qe,35056,{gl2:!0,bpp:4}),h()(qe,36013,{gl2:!0,bpp:5}),h()(qe,32854,{bpp:2}),h()(qe,36194,{bpp:2}),h()(qe,32855,{bpp:2}),h()(qe,33321,{gl2:!0,bpp:1}),h()(qe,33330,{gl2:!0,bpp:1}),h()(qe,33329,{gl2:!0,bpp:1}),h()(qe,33332,{gl2:!0,bpp:2}),h()(qe,33331,{gl2:!0,bpp:2}),h()(qe,33334,{gl2:!0,bpp:4}),h()(qe,33333,{gl2:!0,bpp:4}),h()(qe,33323,{gl2:!0,bpp:2}),h()(qe,33336,{gl2:!0,bpp:2}),h()(qe,33335,{gl2:!0,bpp:2}),h()(qe,33338,{gl2:!0,bpp:4}),h()(qe,33337,{gl2:!0,bpp:4}),h()(qe,33340,{gl2:!0,bpp:8}),h()(qe,33339,{gl2:!0,bpp:8}),h()(qe,32849,{gl2:!0,bpp:3}),h()(qe,32856,{gl2:!0,bpp:4}),h()(qe,32857,{gl2:!0,bpp:4}),h()(qe,36220,{gl2:!0,bpp:4}),h()(qe,36238,{gl2:!0,bpp:4}),h()(qe,36975,{gl2:!0,bpp:4}),h()(qe,36214,{gl2:!0,bpp:8}),h()(qe,36232,{gl2:!0,bpp:8}),h()(qe,36226,{gl2:!0,bpp:16}),h()(qe,36208,{gl2:!0,bpp:16}),h()(qe,33325,{gl2:Ke,bpp:2}),h()(qe,33327,{gl2:Ke,bpp:4}),h()(qe,34842,{gl2:Ke,bpp:8}),h()(qe,33326,{gl2:Ke,bpp:4}),h()(qe,33328,{gl2:Ke,bpp:8}),h()(qe,34836,{gl2:Ke,bpp:16}),h()(qe,35898,{gl2:Ke,bpp:4}),qe);function tr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}function er(t,e,r){var n=r[e];if(!n)return!1;var i=M(t)&&n.gl2||n.gl1;return"string"==typeof i?t.getExtension(i):i}var rr,nr=function(t){Gt()(r,t);var e=tr(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=e.call(this,t,a)).initialize(a),Object.seal(Ut()(n)),n}return o()(r,null,[{key:"isSupported",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{format:null},r=e.format;return!r||er(t,r,Ze)}},{key:"getSamplesForFormat",value:function(t,e){var r=e.format;return t.getInternalformatParameter(36161,r,32937)}}]),o()(r,[{key:"initialize",value:function(t){var e=t.format,r=t.width,n=void 0===r?1:r,i=t.height,a=void 0===i?1:i,o=t.samples,u=void 0===o?0:o;return Yt(e,"Needs format"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),0!==u&&M(this.gl)?this.gl.renderbufferStorageMultisample(36161,u,e,n,a):this.gl.renderbufferStorage(36161,e,n,a),this.format=e,this.width=n,this.height=a,this.samples=u,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*Ze[this.format].bpp),this}},{key:"resize",value:function(t){var e=t.width,r=t.height;return e!==this.width||r!==this.height?this.initialize({width:e,height:r,format:this.format,samples:this.samples}):this}},{key:"_createHandle",value:function(){return this.gl.createRenderbuffer()}},{key:"_deleteHandle",value:function(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}},{key:"_bindHandle",value:function(t){this.gl.bindRenderbuffer(36161,t)}},{key:"_syncHandle",value:function(t){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}},{key:"_getParameter",value:function(t){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,t)}}]),r}(ie);function ir(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.framebuffer,n=void 0===r?null:r,i=e.color,a=void 0===i?null:i,o=e.depth,u=void 0===o?null:o,s=e.stencil,c=void 0===s?null:s,l={};n&&(l.framebuffer=n);var f=0;a&&(f|=16384,!0!==a&&(l.clearColor=a)),u&&(f|=256,!0!==u&&(l.clearDepth=u)),c&&(f|=1024,!0!==u&&(l.clearStencil=u)),Yt(0!==f,"clear: bad arguments"),Lt(t,l,(function(){t.clear(f)}))}function ar(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.framebuffer,n=void 0===r?null:r,i=e.buffer,a=void 0===i?6144:i,o=e.drawBuffer,u=void 0===o?0:o,s=e.value,c=void 0===s?[0,0,0,0]:s;V(t),Lt(t,{framebuffer:n},(function(){switch(a){case 6144:switch(c.constructor){case Int32Array:t.clearBufferiv(a,u,c);break;case Uint32Array:t.clearBufferuiv(a,u,c);break;case Float32Array:default:t.clearBufferfv(a,u,c)}break;case 6145:t.clearBufferfv(6145,0,[c]);break;case 6146:t.clearBufferiv(6146,0,[c]);break;case 34041:var e=at()(c,2),r=e[0],n=e[1];t.clearBufferfi(34041,0,r,n);break;default:Yt(!1,"clear: bad arguments")}}))}function or(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return Yt(!1),0}}function ur(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.sourceX,n=void 0===r?0:r,i=e.sourceY,a=void 0===i?0:i,o=e.sourceFormat,u=void 0===o?6408:o,s=e.sourceAttachment,c=void 0===s?36064:s,l=e.target,f=void 0===l?null:l,h=e.sourceWidth,d=e.sourceHeight,v=e.sourceType,g=dr(t),m=g.framebuffer,y=g.deleteFramebuffer;Yt(m);var p=m.gl,b=m.handle,_=m.attachments;h=h||m.width,d=d||m.height,36064===c&&null===b&&(c=1028),Yt(_[c]),f=vr(f,v=v||_[c].type,u,h,d),v=v||ue(f);var A=p.bindFramebuffer(36160,b);return p.readPixels(n,a,h,d,u,v,f),p.bindFramebuffer(36160,A||null),y&&m.delete(),f}function sr(t,e){var r=e.sourceX,n=void 0===r?0:r,i=e.sourceY,a=void 0===i?0:i,o=e.sourceFormat,u=void 0===o?6408:o,s=e.target,c=void 0===s?null:s,l=e.targetByteOffset,f=void 0===l?0:l,h=e.sourceWidth,d=e.sourceHeight,v=e.sourceType,g=dr(t),m=g.framebuffer,y=g.deleteFramebuffer;Yt(m),h=h||m.width,d=d||m.height;var p=V(m.gl);if(v=v||(c?c.type:5121),!c){var b=or(u),_=function(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return Yt(!1),0}}(v);c=new xe(p,{byteLength:f+h*d*b*_,accessor:{type:v,size:b}})}return c.bind({target:35051}),Lt(p,{framebuffer:m},(function(){p.readPixels(n,a,h,d,u,v,f)})),c.unbind({target:35051}),y&&m.delete(),c}function cr(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.sourceAttachment,n=void 0===r?36064:r,i=e.targetMaxHeight,a=void 0===i?Number.MAX_SAFE_INTEGER:i,o=ur(t,{sourceAttachment:n}),u=t.width,s=t.height;s>a;){var c=le({data:o,width:u,height:s});o=c.data,u=c.width,s=c.height}ce({data:o,width:u,height:s});var l=document.createElement("canvas");l.width=u,l.height=s;var f=l.getContext("2d"),h=f.createImageData(u,s);return h.data.set(o),f.putImageData(h,0,0),l.toDataURL()}function lr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.sourceAttachment,n=void 0===r?36064:r,i=e.targetImage,a=void 0===i?null:i,o=cr(t,{sourceAttachment:n});return(a=a||new Image).src=o,a}function fr(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.sourceX,i=void 0===n?0:n,a=r.sourceY,o=void 0===a?0:a,u=r.targetMipmaplevel,s=void 0===u?0:u,c=r.targetInternalFormat,l=void 0===c?6408:c,f=r.targetX,h=r.targetY,d=r.targetZ,v=r.width,g=r.height,m=dr(t),y=m.framebuffer,p=m.deleteFramebuffer;Yt(y);var b=y.gl,_=y.handle,A=void 0!==f||void 0!==h||void 0!==d;f=f||0,h=h||0,d=d||0;var x=b.bindFramebuffer(36160,_);Yt(e);var w=null;if(e instanceof Be&&(w=e,v=Number.isFinite(v)?v:w.width,g=Number.isFinite(g)?g:w.height,w.bind(0),e=w.target),A)switch(e){case 3553:case 34067:b.copyTexSubImage2D(e,s,f,h,i,o,v,g);break;case 35866:case 32879:var E=V(b);E.copyTexSubImage3D(e,s,f,h,d,i,o,v,g)}else b.copyTexImage2D(e,s,l,i,o,v,g,0);return w&&w.unbind(),b.bindFramebuffer(36160,x||null),p&&y.delete(),w}function hr(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.sourceX0,i=void 0===n?0:n,a=r.sourceY0,o=void 0===a?0:a,u=r.targetX0,s=void 0===u?0:u,c=r.targetY0,l=void 0===c?0:c,f=r.color,h=void 0===f||f,d=r.depth,v=void 0!==d&&d,g=r.stencil,m=void 0!==g&&g,y=r.filter,p=void 0===y?9728:y,b=r.sourceX1,_=r.sourceY1,A=r.targetX1,x=r.targetY1,w=r.sourceAttachment,E=void 0===w?36064:w,T=r.mask,k=void 0===T?0:T,S=dr(t),O=S.framebuffer,L=S.deleteFramebuffer,F=dr(e),R=F.framebuffer,I=F.deleteFramebuffer;Yt(O),Yt(R);var B=R.gl,P=R.handle,D=R.width,N=R.height,C=R.readBuffer,M=V(B);O.handle||36064!==E||(E=1028),h&&(k|=16384),v&&(k|=256),m&&(k|=1024),(L||I)&&1280&k&&(k=16384,j.warn("Blitting from or into a Texture object, forcing mask to GL.COLOR_BUFFER_BIT")()),Yt(k),b=void 0===b?O.width:b,_=void 0===_?O.height:_,A=void 0===A?D:A,x=void 0===x?N:x;var U=B.bindFramebuffer(36009,P),G=B.bindFramebuffer(36008,O.handle);return M.readBuffer(E),M.blitFramebuffer(i,o,b,_,s,l,A,x,k,p),M.readBuffer(C),M.bindFramebuffer(36008,G||null),M.bindFramebuffer(36009,U||null),L&&O.delete(),I&&R.delete(),R}function dr(t){return t instanceof kr?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:(e=t,n=e.gl,i=e.width,a=e.height,o=e.id,u=new kr(n,Object.assign({},r,{id:"framebuffer-for-".concat(o),width:i,height:a,attachments:h()({},36064,e)})),u),deleteFramebuffer:!0};var e,r,n,i,a,o,u}function vr(t,e,r,n,i){return t||new(se(e=e||5121,{clamped:!1}))(n*i*or(r))}var gr={WEBGL2:"WEBGL2",VERTEX_ARRAY_OBJECT:"VERTEX_ARRAY_OBJECT",TIMER_QUERY:"TIMER_QUERY",INSTANCED_RENDERING:"INSTANCED_RENDERING",MULTIPLE_RENDER_TARGETS:"MULTIPLE_RENDER_TARGETS",ELEMENT_INDEX_UINT32:"ELEMENT_INDEX_UINT32",BLEND_EQUATION_MINMAX:"BLEND_EQUATION_MINMAX",FLOAT_BLEND:"FLOAT_BLEND",COLOR_ENCODING_SRGB:"COLOR_ENCODING_SRGB",TEXTURE_DEPTH:"TEXTURE_DEPTH",TEXTURE_FLOAT:"TEXTURE_FLOAT",TEXTURE_HALF_FLOAT:"TEXTURE_HALF_FLOAT",TEXTURE_FILTER_LINEAR_FLOAT:"TEXTURE_FILTER_LINEAR_FLOAT",TEXTURE_FILTER_LINEAR_HALF_FLOAT:"TEXTURE_FILTER_LINEAR_HALF_FLOAT",TEXTURE_FILTER_ANISOTROPIC:"TEXTURE_FILTER_ANISOTROPIC",COLOR_ATTACHMENT_RGBA32F:"COLOR_ATTACHMENT_RGBA32F",COLOR_ATTACHMENT_FLOAT:"COLOR_ATTACHMENT_FLOAT",COLOR_ATTACHMENT_HALF_FLOAT:"COLOR_ATTACHMENT_HALF_FLOAT",GLSL_FRAG_DATA:"GLSL_FRAG_DATA",GLSL_FRAG_DEPTH:"GLSL_FRAG_DEPTH",GLSL_DERIVATIVES:"GLSL_DERIVATIVES",GLSL_TEXTURE_LOD:"GLSL_TEXTURE_LOD"};var mr=(rr={},h()(rr,gr.WEBGL2,[!1,!0]),h()(rr,gr.VERTEX_ARRAY_OBJECT,["OES_vertex_array_object",!0]),h()(rr,gr.TIMER_QUERY,["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"]),h()(rr,gr.INSTANCED_RENDERING,["ANGLE_instanced_arrays",!0]),h()(rr,gr.MULTIPLE_RENDER_TARGETS,["WEBGL_draw_buffers",!0]),h()(rr,gr.ELEMENT_INDEX_UINT32,["OES_element_index_uint",!0]),h()(rr,gr.BLEND_EQUATION_MINMAX,["EXT_blend_minmax",!0]),h()(rr,gr.FLOAT_BLEND,["EXT_float_blend"]),h()(rr,gr.COLOR_ENCODING_SRGB,["EXT_sRGB",!0]),h()(rr,gr.TEXTURE_DEPTH,["WEBGL_depth_texture",!0]),h()(rr,gr.TEXTURE_FLOAT,["OES_texture_float",!0]),h()(rr,gr.TEXTURE_HALF_FLOAT,["OES_texture_half_float",!0]),h()(rr,gr.TEXTURE_FILTER_LINEAR_FLOAT,["OES_texture_float_linear"]),h()(rr,gr.TEXTURE_FILTER_LINEAR_HALF_FLOAT,["OES_texture_half_float_linear"]),h()(rr,gr.TEXTURE_FILTER_ANISOTROPIC,["EXT_texture_filter_anisotropic"]),h()(rr,gr.COLOR_ATTACHMENT_RGBA32F,[function(t){var e=new Me(t,{format:6408,type:5126,dataFormat:6408}),r=new kr(t,{id:"test-framebuffer",check:!1,attachments:h()({},36064,e)}),n=r.getStatus();return e.delete(),r.delete(),36053===n},"EXT_color_buffer_float"]),h()(rr,gr.COLOR_ATTACHMENT_FLOAT,[!1,"EXT_color_buffer_float"]),h()(rr,gr.COLOR_ATTACHMENT_HALF_FLOAT,["EXT_color_buffer_half_float"]),h()(rr,gr.GLSL_FRAG_DATA,["WEBGL_draw_buffers",!0]),h()(rr,gr.GLSL_FRAG_DEPTH,["EXT_frag_depth",!0]),h()(rr,gr.GLSL_DERIVATIVES,["OES_standard_derivatives",!0]),h()(rr,gr.GLSL_TEXTURE_LOD,["EXT_shader_texture_lod",!0]),rr);function yr(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return pr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pr(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function pr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function br(t,e){return _r(t,e)}function _r(t,e){return(e=Array.isArray(e)?e:[e]).every((function(e){return xr(t,e)}))}function Ar(t){for(var e in t.luma=t.luma||{},t.luma.caps=t.luma.caps||{},mr)void 0===t.luma.caps[e]&&(t.luma.caps[e]=xr(t,e));return t.luma.caps}function xr(t,e){return t.luma=t.luma||{},t.luma.caps=t.luma.caps||{},void 0===t.luma.caps[e]&&(t.luma.caps[e]=function(t,e){var r,n=mr[e];Yt(n,e);var i=M(t)&&n[1]||n[0];if("function"==typeof i)r=i(t);else if(Array.isArray(i)){r=!0;var a,o=yr(i);try{for(o.s();!(a=o.n()).done;){var u=a.value;r=r&&Boolean(t.getExtension(u))}}catch(t){o.e(t)}finally{o.f()}}else"string"==typeof i?r=Boolean(t.getExtension(i)):"boolean"==typeof i?r=i:Yt(!1);return r}(t,e)),t.luma.caps[e]||j.log(2,"Feature: ".concat(e," not supported"))(),t.luma.caps[e]}function wr(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Er(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Er(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Er(t,e){(null==e||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=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var kr=function(t){Gt()(r,t);var e=Tr(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=e.call(this,t,a)).width=null,n.height=null,n.attachments={},n.readBuffer=36064,n.drawBuffers=[36064],n.ownResources=[],n.initialize(a),Object.seal(Ut()(n)),n}return o()(r,[{key:"MAX_COLOR_ATTACHMENTS",get:function(){var t=V(this.gl);return t.getParameter(t.MAX_COLOR_ATTACHMENTS)}},{key:"MAX_DRAW_BUFFERS",get:function(){var t=V(this.gl);return t.getParameter(t.MAX_DRAW_BUFFERS)}}],[{key:"isSupported",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.colorBufferFloat,n=e.colorBufferHalfFloat,i=!0;return r&&(i=Boolean(t.getExtension("EXT_color_buffer_float")||t.getExtension("WEBGL_color_buffer_float")||t.getExtension("OES_texture_float"))),n&&(i=i&&Boolean(t.getExtension("EXT_color_buffer_float")||t.getExtension("EXT_color_buffer_half_float"))),i}},{key:"getDefaultFramebuffer",value:function(t){return t.luma=t.luma||{},t.luma.defaultFramebuffer=t.luma.defaultFramebuffer||new r(t,{id:"default-framebuffer",handle:null,attachments:{}}),t.luma.defaultFramebuffer}}]),o()(r,[{key:"initialize",value:function(t){var e=t.width,r=void 0===e?1:e,n=t.height,i=void 0===n?1:n,a=t.attachments,o=void 0===a?null:a,u=t.color,s=void 0===u||u,c=t.depth,l=void 0===c||c,f=t.stencil,h=void 0!==f&&f,d=t.check,v=void 0===d||d,g=t.readBuffer,m=void 0===g?void 0:g,y=t.drawBuffers,p=void 0===y?void 0:y;if(Yt(r>=0&&i>=0,"Width and height need to be integers"),this.width=r,this.height=i,o)for(var b in o){var _=o[b];(Array.isArray(_)?_[0]:_).resize({width:r,height:i})}else o=this._createDefaultAttachments(s,l,h,r,i);this.update({clearAttachments:!0,attachments:o,readBuffer:m,drawBuffers:p}),o&&v&&this.checkStatus()}},{key:"delete",value:function(){var t,e=wr(this.ownResources);try{for(e.s();!(t=e.n()).done;){t.value.delete()}}catch(t){e.e(t)}finally{e.f()}return Je()(Wt()(r.prototype),"delete",this).call(this),this}},{key:"update",value:function(t){var e=t.attachments,r=void 0===e?{}:e,n=t.readBuffer,i=t.drawBuffers,a=t.clearAttachments,o=void 0!==a&&a,u=t.resizeAttachments,s=void 0===u||u;this.attach(r,{clearAttachments:o,resizeAttachments:s});var c=this.gl,l=c.bindFramebuffer(36160,this.handle);return n&&this._setReadBuffer(n),i&&this._setDrawBuffers(i),c.bindFramebuffer(36160,l||null),this}},{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.width,r=t.height;if(null===this.handle)return Yt(void 0===e&&void 0===r),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;for(var n in void 0===e&&(e=this.gl.drawingBufferWidth),void 0===r&&(r=this.gl.drawingBufferHeight),e!==this.width&&r!==this.height&&j.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(e,"x").concat(r))(),this.attachments)this.attachments[n].resize({width:e,height:r});return this.width=e,this.height=r,this}},{key:"attach",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.clearAttachments,i=void 0!==n&&n,a=r.resizeAttachments,o=void 0===a||a,u={};i&&Object.keys(this.attachments).forEach((function(t){u[t]=null})),Object.assign(u,t);var s=this.gl.bindFramebuffer(36160,this.handle);for(var c in u){Yt(void 0!==c,"Misspelled framebuffer binding point?");var l=Number(c),f=u[l],h=f;if(h)if(h instanceof nr)this._attachRenderbuffer({attachment:l,renderbuffer:h});else if(Array.isArray(f)){var d=at()(f,3),v=d[0],g=d[1],m=void 0===g?0:g,y=d[2],p=void 0===y?0:y;h=v,this._attachTexture({attachment:l,texture:v,layer:m,level:p})}else this._attachTexture({attachment:l,texture:h,layer:0,level:0});else this._unattach(l);o&&h&&h.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,s||null),Object.assign(this.attachments,t),Object.keys(this.attachments).filter((function(t){return!e.attachments[t]})).forEach((function(t){delete e.attachments[t]}))}},{key:"checkStatus",value:function(){this.gl;var t=this.getStatus();if(36053!==t)throw new Error(function(t){return(kr.STATUS||{})[t]||"Framebuffer error ".concat(t)}(t));return this}},{key:"getStatus",value:function(){var t=this.gl,e=t.bindFramebuffer(36160,this.handle),r=t.checkFramebufferStatus(36160);return t.bindFramebuffer(36160,e||null),r}},{key:"clear",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.color,n=e.depth,i=e.stencil,a=e.drawBuffers,o=void 0===a?[]:a,u=this.gl.bindFramebuffer(36160,this.handle);return(r||n||i)&&ir(this.gl,{color:r,depth:n,stencil:i}),o.forEach((function(e,r){ar(t.gl,{drawBuffer:r,value:e})})),this.gl.bindFramebuffer(36160,u||null),this}},{key:"readPixels",value:function(){return j.error("Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)")(),null}},{key:"readPixelsToBuffer",value:function(){return j.error("Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)")(),null}},{key:"copyToDataUrl",value:function(){return j.error("Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)")(),null}},{key:"copyToImage",value:function(){return j.error("Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)")(),null}},{key:"copyToTexture",value:function(){return j.error("Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}},{key:"blit",value:function(){return j.error("Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)")(),null}},{key:"invalidate",value:function(t){var e=t.attachments,r=void 0===e?[]:e,n=t.x,i=void 0===n?0:n,a=t.y,o=void 0===a?0:a,u=t.width,s=t.height,c=V(this.gl),l=c.bindFramebuffer(36008,this.handle);return 0===i&&0===o&&void 0===u&&void 0===s?c.invalidateFramebuffer(36008,r):c.invalidateFramebuffer(36008,r,i,o,u,s),c.bindFramebuffer(36008,l),this}},{key:"getAttachmentParameter",value:function(t,e,r){var n=this._getAttachmentParameterFallback(e);return null===n&&(this.gl.bindFramebuffer(36160,this.handle),n=this.gl.getFramebufferAttachmentParameter(36160,t,e),this.gl.bindFramebuffer(36160,null)),r&&n>1e3&&(n=Qt(this.gl,n)),n}},{key:"getAttachmentParameters",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:36064,r=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[],i={},a=wr(n);try{for(a.s();!(t=a.n()).done;){var o=t.value,u=r?Qt(this.gl,o):o;i[u]=this.getAttachmentParameter(e,o,r)}}catch(t){a.e(t)}finally{a.f()}return i}},{key:"getParameters",value:function(){for(var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=Object.keys(this.attachments),r={},n=0,i=e;n<i.length;n++){var a=i[n],o=Number(a),u=t?Qt(this.gl,o):o;r[u]=this.getAttachmentParameters(o,t)}return r}},{key:"show",value:function(){return"undefined"!=typeof window&&window.open(cr(this),"luma-debug-texture"),this}},{key:"log",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t>j.level||"undefined"==typeof window)return this;e=e||"Framebuffer ".concat(this.id);var r=cr(this,{targetMaxHeight:100});return j.image({logLevel:t,message:e,image:r},e)(),this}},{key:"bind",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.target,r=void 0===e?36160:e;return this.gl.bindFramebuffer(r,this.handle),this}},{key:"unbind",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.target,r=void 0===e?36160:e;return this.gl.bindFramebuffer(r,null),this}},{key:"_createDefaultAttachments",value:function(t,e,r,n,i){var a,o=null;t&&((o=o||{})[36064]=new Me(this.gl,{id:"".concat(this.id,"-color0"),pixels:null,format:6408,type:5121,width:n,height:i,mipmaps:!1,parameters:(a={},h()(a,10241,9729),h()(a,10240,9729),h()(a,10242,33071),h()(a,10243,33071),a)}),this.ownResources.push(o[36064]));return e&&r?((o=o||{})[33306]=new nr(this.gl,{id:"".concat(this.id,"-depth-stencil"),format:35056,width:n,height:111}),this.ownResources.push(o[33306])):e?((o=o||{})[36096]=new nr(this.gl,{id:"".concat(this.id,"-depth"),format:33189,width:n,height:i}),this.ownResources.push(o[36096])):r&&Yt(!1),o}},{key:"_unattach",value:function(t){var e=this.attachments[t];e&&(e instanceof nr?this.gl.framebufferRenderbuffer(36160,t,36161,null):this.gl.framebufferTexture2D(36160,t,3553,null,0),delete this.attachments[t])}},{key:"_attachRenderbuffer",value:function(t){var e=t.attachment,r=void 0===e?36064:e,n=t.renderbuffer;this.gl.framebufferRenderbuffer(36160,r,36161,n.handle),this.attachments[r]=n}},{key:"_attachTexture",value:function(t){var e=t.attachment,r=void 0===e?36064:e,n=t.texture,i=t.layer,a=t.level,o=this.gl;switch(o.bindTexture(n.target,n.handle),n.target){case 35866:case 32879:V(o).framebufferTextureLayer(36160,r,n.target,a,i);break;case 34067:var u=function(t){return t<34069?t+34069:t}(i);o.framebufferTexture2D(36160,r,u,n.handle,a);break;case 3553:o.framebufferTexture2D(36160,r,3553,n.handle,a);break;default:Yt(!1,"Illegal texture type")}o.bindTexture(n.target,null),this.attachments[r]=n}},{key:"_setReadBuffer",value:function(t){var e,r=M(e=this.gl)?e:null;r?r.readBuffer(t):Yt(36064===t||1029===t,"Multiple render targets not supported"),this.readBuffer=t}},{key:"_setDrawBuffers",value:function(t){var e=this.gl,r=V(e);if(r)r.drawBuffers(t);else{var n=e.getExtension("WEBGL_draw_buffers");n?n.drawBuffersWEBGL(t):Yt(1===t.length&&(36064===t[0]||1029===t[0]),"Multiple render targets not supported")}this.drawBuffers=t}},{key:"_getAttachmentParameterFallback",value:function(t){var e=Ar(this.gl);switch(t){case 36052:return e.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return e.WEBGL2?null:8;case 33297:return e.WEBGL2?null:5125;case 33296:return e.WEBGL2||e.EXT_sRGB?null:9729;default:return null}}},{key:"_createHandle",value:function(){return this.gl.createFramebuffer()}},{key:"_deleteHandle",value:function(){this.gl.deleteFramebuffer(this.handle)}},{key:"_bindHandle",value:function(t){return this.gl.bindFramebuffer(36160,t)}},{key:"color",get:function(){return this.attachments[36064]||null}},{key:"texture",get:function(){return this.attachments[36064]||null}},{key:"depth",get:function(){return this.attachments[36096]||this.attachments[33306]||null}},{key:"stencil",get:function(){return this.attachments[36128]||this.attachments[33306]||null}}]),r}(ie);var Sr;function Or(t,e){Yt(t instanceof Me||t instanceof We||t instanceof Qe);var r=t.constructor,n=t.gl,i=t.width,a=t.height,o=t.format,u=t.type,s=t.dataFormat,c=t.border,l=t.mipmaps;return new r(n,Object.assign({width:i,height:a,format:o,type:u,dataFormat:s,border:c,mipmaps:l},e))}kr.ATTACHMENT_PARAMETERS=[36049,36048,33296,33298,33299,33300,33301,33302,33303];var Lr=(Sr={},h()(Sr,33902,{gl1:new Float32Array([1,1])}),h()(Sr,33901,{gl1:new Float32Array([1,1])}),h()(Sr,3379,{gl1:64,gl2:2048}),h()(Sr,34076,{gl1:16}),h()(Sr,34930,{gl1:8}),h()(Sr,35661,{gl1:8}),h()(Sr,35660,{gl1:0}),h()(Sr,34024,{gl1:1}),h()(Sr,36348,{gl1:8}),h()(Sr,34921,{gl1:8}),h()(Sr,36347,{gl1:128}),h()(Sr,36349,{gl1:16}),h()(Sr,3386,{gl1:new Int32Array([0,0])}),h()(Sr,32883,{gl1:0,gl2:256}),h()(Sr,35071,{gl1:0,gl2:256}),h()(Sr,37447,{gl1:0,gl2:0}),h()(Sr,36063,{gl1:0,gl2:4}),h()(Sr,35379,{gl1:0,gl2:0}),h()(Sr,35374,{gl1:0,gl2:0}),h()(Sr,35377,{gl1:0,gl2:0}),h()(Sr,34852,{gl1:0,gl2:4}),h()(Sr,36203,{gl1:0,gl2:0}),h()(Sr,33001,{gl1:0,gl2:0}),h()(Sr,33e3,{gl1:0,gl2:0}),h()(Sr,37157,{gl1:0,gl2:0}),h()(Sr,35373,{gl1:0,gl2:0}),h()(Sr,35657,{gl1:0,gl2:0}),h()(Sr,36183,{gl1:0,gl2:0}),h()(Sr,37137,{gl1:0,gl2:0}),h()(Sr,34045,{gl1:0,gl2:0}),h()(Sr,35978,{gl1:0,gl2:0}),h()(Sr,35979,{gl1:0,gl2:0}),h()(Sr,35968,{gl1:0,gl2:0}),h()(Sr,35376,{gl1:0,gl2:0}),h()(Sr,35375,{gl1:0,gl2:0}),h()(Sr,35659,{gl1:0,gl2:0}),h()(Sr,37154,{gl1:0,gl2:0}),h()(Sr,35371,{gl1:0,gl2:0}),h()(Sr,35658,{gl1:0,gl2:0}),h()(Sr,35076,{gl1:0,gl2:-8,negative:!0}),h()(Sr,35077,{gl1:0,gl2:7}),h()(Sr,35380,{gl1:0,gl2:0}),Sr);function Fr(t){if(t.luma=t.luma||{},!t.luma.limits){t.luma.limits={},t.luma.webgl1MinLimits={},t.luma.webgl2MinLimits={};var e=M(t);for(var r in Lr){var n=Lr[r],i=n.gl1,a="gl2"in n?n.gl2:n.gl1,o=e?a:i,u="gl2"in n&&!e||"extension"in n&&!t.getExtension(n.extension)?o:t.getParameter(r);t.luma.limits[r]=u,t.luma.webgl1MinLimits[r]=i,t.luma.webgl2MinLimits[r]=a}}return t.luma.limits}function Rr(t){t.luma=t.luma||{};var e,r=It(t);t.luma.info||(t.luma.info=(e={},h()(e,37445,r.vendor),h()(e,37446,r.renderer),h()(e,7936,r.vendorMasked),h()(e,7937,r.rendererMasked),h()(e,7938,r.version),h()(e,35724,r.shadingLanguageVersion),e));return t.luma.info}function Ir(t){return Object.assign(It(t),{limits:Fr(t),info:Rr(t),webgl1MinLimits:t.luma.webgl1MinLimits,webgl2MinLimits:t.luma.webgl2MinLimits})}function Br(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e="undefined"!=typeof window&&window.navigator||{},r=t.userAgent||e.userAgent||"",n=-1!==r.indexOf("MSIE "),i=-1!==r.indexOf("Trident/");return n||i}var Pr={};function Dr(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=mr[e];if(Yt(n,e),!Br(r))return!0;if(e in Pr)return Pr[e];var i=n[0],a="#extension GL_".concat(i," : enable\nvoid main(void) {}"),o=t.createShader(35633);t.shaderSource(o,a),t.compileShader(o);var u=t.getShaderParameter(o,35713);return t.deleteShader(o),Pr[e]=u,u}function jr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unnamed",r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,n=t.match(r);return n?n[1]:e}function Nr(t,e,r,n){for(var i=t.split(/\r?\n/),a={},o={},u=n||jr(e)||"(unnamed)",s="".concat(function(t){switch(t){case 35632:return"fragment";case 35633:return"vertex";default:return"unknown type"}}(r)," shader ").concat(u),c=0;c<i.length;c++){var l=i[c];if(!(l.length<=1)){var f=l.split(":"),h=f[0],d=parseInt(f[2],10);if(isNaN(d))throw new Error("GLSL compilation error in ".concat(s,": ").concat(t));"WARNING"!==h?a[d]=l:o[d]=l}}var v=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:": ",n=t.split(/\r?\n/),i=String(n.length+e-1).length;return n.map((function(t,n){var a=String(n+e),o=a.length;return Mr(a,i-o)+r+t}))}(e);return{shaderName:s,errors:Cr(a,v),warnings:Cr(o,v)}}function Cr(t,e){for(var r="",n=0;n<e.length;n++){var i=e[n];if((t[n+3]||t[n+2]||t[n+1])&&(r+="".concat(i,"\n"),t[n+1])){var a=t[n+1],o=a.split(":",3),u=o[0],s=parseInt(o[1],10)||0,c=a.substring(o.join(":").length+1).trim();r+=Mr("^^^ ".concat(u,": ").concat(c,"\n\n"),s)}}return r}function Mr(t,e){for(var r="",n=0;n<e;++n)r+=" ";return"".concat(r).concat(t)}function Ur(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var Vr,Gr,zr=function(t){Gt()(r,t);var e=Ur(r);function r(t,n){var a;i()(this,r),U(t),Yt("string"==typeof n.source,"Shader: GLSL source code must be a JavaScript string");var o=jr(n.source,null)||n.id||Jt("unnamed ".concat(r.getTypeName(n.shaderType)));return(a=e.call(this,t,{id:o})).shaderType=n.shaderType,a.source=n.source,a.initialize(n),a}return o()(r,null,[{key:"getTypeName",value:function(t){switch(t){case 35633:return"vertex-shader";case 35632:return"fragment-shader";default:return Yt(!1),"unknown"}}}]),o()(r,[{key:"initialize",value:function(t){var e=t.source,r=jr(e,null);r&&(this.id=Jt(r)),this._compile(e)}},{key:"getParameter",value:function(t){return this.gl.getShaderParameter(this.handle,t)}},{key:"toString",value:function(){return"".concat(r.getTypeName(this.shaderType),":").concat(this.id)}},{key:"getName",value:function(){return jr(this.source)||"unnamed-shader"}},{key:"getSource",value:function(){return this.gl.getShaderSource(this.handle)}},{key:"getTranslatedSource",value:function(){var t=this.gl.getExtension("WEBGL_debug_shaders");return t?t.getTranslatedShaderSource(this.handle):"No translated source available. WEBGL_debug_shaders not implemented"}},{key:"_compile",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.source;t.startsWith("#version ")||(t="#version 100\n".concat(t)),this.source=t,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle);var e=this.getParameter(35713);if(!e){var r=this.gl.getShaderInfoLog(this.handle),n=Nr(r,this.source,this.shaderType,this.id),i=n.shaderName,a=n.errors,o=n.warnings;throw j.error("GLSL compilation errors in ".concat(i,"\n").concat(a))(),j.warn("GLSL compilation warnings in ".concat(i,"\n").concat(o))(),new Error("GLSL compilation errors in ".concat(i))}}},{key:"_deleteHandle",value:function(){this.gl.deleteShader(this.handle)}},{key:"_getOptsFromHandle",value:function(){return{type:this.getParameter(35663),source:this.getSource()}}}]),r}(ie),Hr=function(t){Gt()(r,t);var e=Ur(r);function r(t,n){return i()(this,r),"string"==typeof n&&(n={source:n}),e.call(this,t,Object.assign({},n,{shaderType:35633}))}return o()(r,[{key:"_createHandle",value:function(){return this.gl.createShader(35633)}}]),r}(zr),Xr=function(t){Gt()(r,t);var e=Ur(r);function r(t,n){return i()(this,r),"string"==typeof n&&(n={source:n}),e.call(this,t,Object.assign({},n,{shaderType:35632}))}return o()(r,[{key:"_createHandle",value:function(){return this.gl.createShader(35632)}}]),r}(zr),Wr=(Vr={},h()(Vr,5126,sn.bind(null,"uniform1fv",Kr,1,cn)),h()(Vr,35664,sn.bind(null,"uniform2fv",Kr,2,cn)),h()(Vr,35665,sn.bind(null,"uniform3fv",Kr,3,cn)),h()(Vr,35666,sn.bind(null,"uniform4fv",Kr,4,cn)),h()(Vr,5124,sn.bind(null,"uniform1iv",Zr,1,cn)),h()(Vr,35667,sn.bind(null,"uniform2iv",Zr,2,cn)),h()(Vr,35668,sn.bind(null,"uniform3iv",Zr,3,cn)),h()(Vr,35669,sn.bind(null,"uniform4iv",Zr,4,cn)),h()(Vr,35670,sn.bind(null,"uniform1iv",Zr,1,cn)),h()(Vr,35671,sn.bind(null,"uniform2iv",Zr,2,cn)),h()(Vr,35672,sn.bind(null,"uniform3iv",Zr,3,cn)),h()(Vr,35673,sn.bind(null,"uniform4iv",Zr,4,cn)),h()(Vr,35674,sn.bind(null,"uniformMatrix2fv",Kr,4,ln)),h()(Vr,35675,sn.bind(null,"uniformMatrix3fv",Kr,9,ln)),h()(Vr,35676,sn.bind(null,"uniformMatrix4fv",Kr,16,ln)),h()(Vr,35678,un),h()(Vr,35680,un),h()(Vr,5125,sn.bind(null,"uniform1uiv",tn,1,cn)),h()(Vr,36294,sn.bind(null,"uniform2uiv",tn,2,cn)),h()(Vr,36295,sn.bind(null,"uniform3uiv",tn,3,cn)),h()(Vr,36296,sn.bind(null,"uniform4uiv",tn,4,cn)),h()(Vr,35685,sn.bind(null,"uniformMatrix2x3fv",Kr,6,ln)),h()(Vr,35686,sn.bind(null,"uniformMatrix2x4fv",Kr,8,ln)),h()(Vr,35687,sn.bind(null,"uniformMatrix3x2fv",Kr,6,ln)),h()(Vr,35688,sn.bind(null,"uniformMatrix3x4fv",Kr,12,ln)),h()(Vr,35689,sn.bind(null,"uniformMatrix4x2fv",Kr,8,ln)),h()(Vr,35690,sn.bind(null,"uniformMatrix4x3fv",Kr,12,ln)),h()(Vr,35678,un),h()(Vr,35680,un),h()(Vr,35679,un),h()(Vr,35682,un),h()(Vr,36289,un),h()(Vr,36292,un),h()(Vr,36293,un),h()(Vr,36298,un),h()(Vr,36299,un),h()(Vr,36300,un),h()(Vr,36303,un),h()(Vr,36306,un),h()(Vr,36307,un),h()(Vr,36308,un),h()(Vr,36311,un),Vr),Yr={},qr={},Qr={},$r=[0];function Jr(t,e,r,n){1===e&&"boolean"==typeof t&&(t=t?1:0),Number.isFinite(t)&&($r[0]=t,t=$r);var i=t.length;if(i%e&&j.warn("Uniform size should be multiples of ".concat(e),t)(),t instanceof r)return t;var a=n[i];a||(a=new r(i),n[i]=a);for(var o=0;o<i;o++)a[o]=t[o];return a}function Kr(t,e){return Jr(t,e,Float32Array,Yr)}function Zr(t,e){return Jr(t,e,Int32Array,qr)}function tn(t,e){return Jr(t,e,Uint32Array,Qr)}function en(t,e,r){var n=Wr[r.type];if(!n)throw new Error("Unknown GLSL uniform type ".concat(r.type));return n().bind(null,t,e)}function rn(t){if("]"!==t[t.length-1])return{name:t,length:1,isArray:!1};var e=t.match(/([^[]*)(\[[0-9]+\])?/);if(!e||e.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(t));return{name:e[1],length:e[2]||1,isArray:Boolean(e[2])}}function nn(t,e,r){for(var n in t){var i=t[n];if((!r||Boolean(r[n]))&&!an(i))throw e=e?"".concat(e," "):"",console.error("".concat(e," Bad uniform ").concat(n),i),new Error("".concat(e," Bad uniform ").concat(n))}return!0}function an(t){return Array.isArray(t)||ArrayBuffer.isView(t)?function(t){if(0===t.length)return!1;for(var e=Math.min(t.length,16),r=0;r<e;++r)if(!Number.isFinite(t[r]))return!1;return!0}(t):!!isFinite(t)||(!0===t||!1===t||(t instanceof Be||(t instanceof nr||t instanceof kr&&Boolean(t.texture))))}function on(t,e,r){if(Array.isArray(r)||ArrayBuffer.isView(r))if(t[e])for(var n=t[e],i=0,a=r.length;i<a;++i)n[i]=r[i];else t[e]=r.slice();else t[e]=r}function un(){var t=null;return function(e,r,n){var i=t!==n;return i&&(e.uniform1i(r,n),t=n),i}}function sn(t,e,r,n){var i=null,a=null;return function(o,u,s){var c=e(s,r),l=c.length,f=!1;if(null===i)i=new Float32Array(l),a=l,f=!0;else{Yt(a===l,"Uniform length cannot change.");for(var h=0;h<l;++h)if(c[h]!==i[h]){f=!0;break}}return f&&(n(o,t,u,c),i.set(c)),f}}function cn(t,e,r,n){t[e](r,n)}function ln(t,e,r,n){t[e](r,!1,n)}var fn=(Gr={},h()(Gr,5126,[5126,1,"float"]),h()(Gr,35664,[5126,2,"vec2"]),h()(Gr,35665,[5126,3,"vec3"]),h()(Gr,35666,[5126,4,"vec4"]),h()(Gr,5124,[5124,1,"int"]),h()(Gr,35667,[5124,2,"ivec2"]),h()(Gr,35668,[5124,3,"ivec3"]),h()(Gr,35669,[5124,4,"ivec4"]),h()(Gr,5125,[5125,1,"uint"]),h()(Gr,36294,[5125,2,"uvec2"]),h()(Gr,36295,[5125,3,"uvec3"]),h()(Gr,36296,[5125,4,"uvec4"]),h()(Gr,35670,[5126,1,"bool"]),h()(Gr,35671,[5126,2,"bvec2"]),h()(Gr,35672,[5126,3,"bvec3"]),h()(Gr,35673,[5126,4,"bvec4"]),h()(Gr,35674,[5126,8,"mat2"]),h()(Gr,35685,[5126,8,"mat2x3"]),h()(Gr,35686,[5126,8,"mat2x4"]),h()(Gr,35675,[5126,12,"mat3"]),h()(Gr,35687,[5126,12,"mat3x2"]),h()(Gr,35688,[5126,12,"mat3x4"]),h()(Gr,35676,[5126,16,"mat4"]),h()(Gr,35689,[5126,16,"mat4x2"]),h()(Gr,35690,[5126,16,"mat4x3"]),Gr);function hn(t){switch(t){case 0:return 0;case 1:case 3:case 2:return 1;case 4:case 5:case 6:return 4;default:return Yt(!1),0}}function dn(t){var e=fn[t];if(!e)return null;var r=at()(e,2);return{type:r[0],components:r[1]}}function vn(t,e){switch(t){case 5120:case 5121:case 5122:case 5123:t=5126}for(var r in fn){var n=at()(fn[r],3),i=n[0],a=n[1],o=n[2];if(i===t&&a===e)return{glType:r,name:o}}return null}var gn=function(){function t(e){i()(this,t),this.id=e.id,this.attributeInfos=[],this.attributeInfosByName={},this.attributeInfosByLocation=[],this.varyingInfos=[],this.varyingInfosByName={},Object.seal(this),this._readAttributesFromProgram(e),this._readVaryingsFromProgram(e)}return o()(t,[{key:"getAttributeInfo",value:function(t){var e=Number(t);return Number.isFinite(e)?this.attributeInfosByLocation[e]:this.attributeInfosByName[t]||null}},{key:"getAttributeLocation",value:function(t){var e=this.getAttributeInfo(t);return e?e.location:-1}},{key:"getAttributeAccessor",value:function(t){var e=this.getAttributeInfo(t);return e?e.accessor:null}},{key:"getVaryingInfo",value:function(t){var e=Number(t);return Number.isFinite(e)?this.varyingInfos[e]:this.varyingInfosByName[t]||null}},{key:"getVaryingIndex",value:function(t){var e=this.getVaryingInfo();return e?e.location:-1}},{key:"getVaryingAccessor",value:function(t){var e=this.getVaryingInfo();return e?e.accessor:null}},{key:"_readAttributesFromProgram",value:function(t){for(var e=t.gl,r=e.getProgramParameter(t.handle,35721),n=0;n<r;n++){var i=e.getActiveAttrib(t.handle,n),a=i.name,o=i.type,u=i.size,s=e.getAttribLocation(t.handle,a);s>=0&&this._addAttribute(s,a,o,u)}this.attributeInfos.sort((function(t,e){return t.location-e.location}))}},{key:"_readVaryingsFromProgram",value:function(t){var e=t.gl;if(M(e)){for(var r=e.getProgramParameter(t.handle,35971),n=0;n<r;n++){var i=e.getTransformFeedbackVarying(t.handle,n),a=i.name,o=i.type,u=i.size;this._addVarying(n,a,o,u)}this.varyingInfos.sort((function(t,e){return t.location-e.location}))}}},{key:"_addAttribute",value:function(t,e,r,n){var i=dn(r),a={type:i.type,size:n*i.components};this._inferProperties(t,e,a);var o={location:t,name:e,accessor:new ve(a)};this.attributeInfos.push(o),this.attributeInfosByLocation[t]=o,this.attributeInfosByName[o.name]=o}},{key:"_inferProperties",value:function(t,e,r){/instance/i.test(e)&&(r.divisor=1)}},{key:"_addVarying",value:function(t,e,r,n){var i=dn(r),a=i.type,o=i.components,u={location:t,name:e,accessor:new ve({type:a,size:n*o})};this.varyingInfos.push(u),this.varyingInfosByName[u.name]=u}}]),t}();function mn(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return yn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yn(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function yn(t,e){(null==e||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){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var bn=["setVertexArray","setAttributes","setBuffers","unsetBuffers","use","getUniformCount","getUniformInfo","getUniformLocation","getUniformValue","getVarying","getFragDataLocation","getAttachedShaders","getAttributeCount","getAttributeLocation","getAttributeInfo"],_n=function(t){Gt()(r,t);var e=pn(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=e.call(this,t,a)).stubRemovedMethods("Program","v6.0",bn),n._isCached=!1,n.initialize(a),Object.seal(Ut()(n)),n._setId(a.id),n}return o()(r,[{key:"initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.hash,r=t.vs,n=t.fs,i=t.varyings,a=t.bufferMode,o=void 0===a?35981:a;return this.hash=e||"",this.vs="string"==typeof r?new Hr(this.gl,{id:"".concat(t.id,"-vs"),source:r}):r,this.fs="string"==typeof n?new Xr(this.gl,{id:"".concat(t.id,"-fs"),source:n}):n,Yt(this.vs instanceof Hr),Yt(this.fs instanceof Xr),this.uniforms={},this._textureUniforms={},i&&i.length>0&&(V(this.gl),this.varyings=i,this.gl2.transformFeedbackVaryings(this.handle,i,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new gn(this),this.setProps(t)}},{key:"delete",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._isCached?this:Je()(Wt()(r.prototype),"delete",this).call(this,t)}},{key:"setProps",value:function(t){return"uniforms"in t&&this.setUniforms(t.uniforms),this}},{key:"draw",value:function(t){var e=this,r=t.logPriority,n=t.drawMode,i=void 0===n?4:n,a=t.vertexCount,o=t.offset,u=void 0===o?0:o,s=t.start,c=t.end,l=t.isIndexed,f=void 0!==l&&l,h=t.indexType,d=void 0===h?5123:h,v=t.instanceCount,g=void 0===v?0:v,m=t.isInstanced,y=void 0===m?g>0:m,p=t.vertexArray,b=void 0===p?null:p,_=t.transformFeedback,A=t.framebuffer,x=t.parameters,w=void 0===x?{}:x,E=t.uniforms,T=t.samplers;if((E||T)&&(j.deprecated("Program.draw({uniforms})","Program.setUniforms(uniforms)")(),this.setUniforms(E||{})),j.priority>=r){var k=A?A.id:"default",S="mode=".concat(Qt(this.gl,i)," verts=").concat(a," ")+"instances=".concat(g," indexType=").concat(Qt(this.gl,d)," ")+"isInstanced=".concat(y," isIndexed=").concat(f," ")+"Framebuffer=".concat(k);j.log(r,S)()}return Yt(b),this.gl.useProgram(this.handle),!(!this._areTexturesRenderable()||0===a||y&&0===g)&&(b.bindForDraw(a,g,(function(){if(void 0!==A&&(w=Object.assign({},w,{framebuffer:A})),_){var t=hn(i);_.begin(t)}e._bindTextures(),Lt(e.gl,w,(function(){f&&y?e.gl2.drawElementsInstanced(i,a,d,u,g):f&&M(e.gl)&&!isNaN(s)&&!isNaN(c)?e.gl2.drawRangeElements(i,s,c,a,d,u):f?e.gl.drawElements(i,a,d,u):y?e.gl2.drawArraysInstanced(i,u,a,g):e.gl.drawArrays(i,u,a)})),_&&_.end()})),!0)}},{key:"setUniforms",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in j.priority>=2&&nn(t,this.id,this._uniformSetters),this.gl.useProgram(this.handle),t){var r=t[e],n=this._uniformSetters[e];if(n){var i=r,a=!1;if(i instanceof kr&&(i=i.texture),i instanceof Be)if(a=this.uniforms[e]!==r){void 0===n.textureIndex&&(n.textureIndex=this._textureIndexCounter++);var o=i,u=n.textureIndex;o.bind(u),i=u,this._textureUniforms[e]=o}else i=n.textureIndex;else this._textureUniforms[e]&&delete this._textureUniforms[e];(n(i)||a)&&on(this.uniforms,e,r)}}return this}},{key:"_areTexturesRenderable",value:function(){var t=!0;for(var e in this._textureUniforms){var r=this._textureUniforms[e];r.update(),t=t&&r.loaded}return t}},{key:"_bindTextures",value:function(){for(var t in this._textureUniforms){var e=this._uniformSetters[t].textureIndex;this._textureUniforms[t].bind(e)}}},{key:"_createHandle",value:function(){return this.gl.createProgram()}},{key:"_deleteHandle",value:function(){this.gl.deleteProgram(this.handle)}},{key:"_getOptionsFromHandle",value:function(t){var e,r={},n=mn(this.gl.getAttachedShaders(t));try{for(n.s();!(e=n.n()).done;){var i=e.value;switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:r.vs=new Hr({handle:i});break;case 35632:r.fs=new Xr({handle:i})}}}catch(t){n.e(t)}finally{n.f()}return r}},{key:"_getParameter",value:function(t){return this.gl.getProgramParameter(this.handle,t)}},{key:"_setId",value:function(t){if(!t){var e=this._getName();this.id=Jt(e)}}},{key:"_getName",value:function(){var t=this.vs.getName()||this.fs.getName();return t=(t=t.replace(/shader/i,""))?"".concat(t,"-program"):"program"}},{key:"_compileAndLink",value:function(){var t=this.gl;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),j.time(4,"linkProgram for ".concat(this._getName()))(),t.linkProgram(this.handle),j.timeEnd(4,"linkProgram for ".concat(this._getName()))(),t.debug||j.level>0){if(!t.getProgramParameter(this.handle,35714))throw new Error("Error linking: ".concat(t.getProgramInfoLog(this.handle)));if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error("Error validating: ".concat(t.getProgramInfoLog(this.handle)))}}},{key:"_readUniformLocationsFromLinkedProgram",value:function(){var t=this.gl;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(var e=0;e<this._uniformCount;e++){var r=this.gl.getActiveUniform(this.handle,e),n=rn(r.name).name,i=t.getUniformLocation(this.handle,n);if(this._uniformSetters[n]=en(t,i,r),r.size>1)for(var a=0;a<r.size;a++)i=t.getUniformLocation(this.handle,"".concat(n,"[").concat(a,"]")),this._uniformSetters["".concat(n,"[").concat(a,"]")]=en(t,i,r)}this._textureIndexCounter=0}},{key:"getActiveUniforms",value:function(t,e){return this.gl2.getActiveUniforms(this.handle,t,e)}},{key:"getUniformBlockIndex",value:function(t){return this.gl2.getUniformBlockIndex(this.handle,t)}},{key:"getActiveUniformBlockParameter",value:function(t,e){return this.gl2.getActiveUniformBlockParameter(this.handle,t,e)}},{key:"uniformBlockBinding",value:function(t,e){this.gl2.uniformBlockBinding(this.handle,t,e)}}]),r}(ie);function An(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return xn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xn(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function xn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var En=function(t){Gt()(r,t);var e=wn(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),(n=e.call(this,t,a)).target=null,n._queryPending=!1,n._pollingPromise=null,Object.seal(Ut()(n)),n}return o()(r,null,[{key:"isSupported",value:function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=M(t),i=_r(t,gr.TIMER_QUERY),a=n||i,o=An(r);try{for(o.s();!(e=o.n()).done;){var u=e.value;switch(u){case"queries":a=a&&n;break;case"timers":a=a&&i;break;default:Yt(!1)}}}catch(t){o.e(t)}finally{o.f()}return a}}]),o()(r,[{key:"beginTimeElapsedQuery",value:function(){return this.begin(35007)}},{key:"beginOcclusionQuery",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.conservative,r=void 0!==e&&e;return this.begin(r?36202:35887)}},{key:"beginTransformFeedbackQuery",value:function(){return this.begin(35976)}},{key:"begin",value:function(t){return this._queryPending||(this.target=t,this.gl2.beginQuery(this.target,this.handle)),this}},{key:"end",value:function(){return this._queryPending||this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this}},{key:"isResultAvailable",value:function(){if(!this._queryPending)return!1;var t=this.gl2.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}},{key:"isTimerDisjoint",value:function(){return this.gl2.getParameter(36795)}},{key:"getResult",value:function(){return this.gl2.getQueryParameter(this.handle,34918)}},{key:"getTimerMilliseconds",value:function(){return this.getResult()/1e6}},{key:"createPoll",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;var r=0;return this._pollingPromise=new Promise((function(n,i){requestAnimationFrame((function a(){t.isResultAvailable()?(n(t.getResult()),t._pollingPromise=null):r++>e?(i("Timed out"),t._pollingPromise=null):requestAnimationFrame(a)}))})),this._pollingPromise}},{key:"_createHandle",value:function(){return r.isSupported(this.gl)?this.gl2.createQuery():null}},{key:"_deleteHandle",value:function(){this.gl2.deleteQuery(this.handle)}}]),r}(ie);function Tn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var kn=function(t){Gt()(r,t);var e=Tn(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,r),V(t),(n=e.call(this,t,a)).initialize(a),n.stubRemovedMethods("TransformFeedback","v6.0",["pause","resume"]),Object.seal(Ut()(n)),n}return o()(r,null,[{key:"isSupported",value:function(t){return M(t)}}]),o()(r,[{key:"initialize",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,Zt(this.buffers)||this.bind((function(){return t._unbindBuffers()})),this.setProps(e),this}},{key:"setProps",value:function(t){"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"bindOnUse"in t&&(t=t.bindOnUse),"buffers"in t&&this.setBuffers(t.buffers)}},{key:"setBuffers",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.bind((function(){for(var r in e)t.setBuffer(r,e[r])})),this}},{key:"setBuffer",value:function(t,e){var r=this,n=this._getVaryingIndex(t),i=this._getBufferParams(e),a=i.buffer,o=i.byteSize,u=i.byteOffset;return n<0?(this.unused[t]=a,j.warn((function(){return"".concat(r.id," unused varying buffer ").concat(t)}))(),this):(this.buffers[n]=e,this.bindOnUse||this._bindBuffer(n,a,u,o),this)}},{key:"begin",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(t),this}},{key:"end",value:function(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}},{key:"_getBufferParams",value:function(t){var e,r,n;return t instanceof xe==!1?(n=t.buffer,r=t.byteSize,e=t.byteOffset):n=t,void 0===e&&void 0===r||(e=e||0,r=r||n.byteLength-e),{buffer:n,byteOffset:e,byteSize:r}}},{key:"_getVaryingInfo",value:function(t){return this.configuration&&this.configuration.getVaryingInfo(t)}},{key:"_getVaryingIndex",value:function(t){if(this.configuration)return this.configuration.getVaryingInfo(t).location;var e=Number(t);return Number.isFinite(e)?e:-1}},{key:"_bindBuffers",value:function(){if(this.bindOnUse)for(var t in this.buffers){var e=this._getBufferParams(this.buffers[t]),r=e.buffer,n=e.byteSize,i=e.byteOffset;this._bindBuffer(t,r,i,n)}}},{key:"_unbindBuffers",value:function(){if(this.bindOnUse)for(var t in this.buffers)this._bindBuffer(t,null)}},{key:"_bindBuffer",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0,i=e&&e.handle;return i&&void 0!==n?this.gl.bindBufferRange(35982,t,i,r,n):this.gl.bindBufferBase(35982,t,i),this}},{key:"_createHandle",value:function(){return this.gl.createTransformFeedback()}},{key:"_deleteHandle",value:function(){this.gl.deleteTransformFeedback(this.handle)}},{key:"_bindHandle",value:function(t){this.gl.bindTransformFeedback(36386,this.handle)}}]),r}(ie),Sn=null;function On(t,e){var r;return new t((r=t.BYTES_PER_ELEMENT*e,(!Sn||Sn.byteLength<r)&&(Sn=new ArrayBuffer(r)),Sn),0,e)}var Ln=r(15);function Fn(t){if(!t&&!Object(d.a)())return"Node";if(Object(Ln.a)(t))return"Electron";var e="undefined"!=typeof navigator?navigator:{},r=t||e.userAgent||"";if(r.indexOf("Edge")>-1)return"Edge";var n=-1!==r.indexOf("MSIE "),i=-1!==r.indexOf("Trident/");return n||i?"IE":E.b.chrome?"Chrome":E.b.safari?"Safari":E.b.mozInnerScreenX?"Firefox":"Unknown"}function Rn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=Wt()(t);if(e){var i=Wt()(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht()(this,r)}}var In="elements must be GL.ELEMENT_ARRAY_BUFFER",Bn=function(t){Gt()(r,t);var e=Rn(r);function r(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,r);var o=a.id||a.program&&a.program.id;return(n=e.call(this,t,Object.assign({},a,{id:o}))).buffer=null,n.bufferValue=null,n.isDefaultArray=a.isDefaultArray||!1,n.gl2=t,n.initialize(a),Object.seal(Ut()(n)),n}return o()(r,null,[{key:"isSupported",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!e.constantAttributeZero||(M(t)||"Chrome"===Fn())}},{key:"getDefaultArray",value:function(t){return t.luma=t.luma||{},t.luma.defaultVertexArray||(t.luma.defaultVertexArray=new r(t,{handle:null,isDefaultArray:!0})),t.luma.defaultVertexArray}},{key:"getMaxAttributes",value:function(t){return r.MAX_ATTRIBUTES=r.MAX_ATTRIBUTES||t.getParameter(34921),r.MAX_ATTRIBUTES}},{key:"setConstant",value:function(t,e,n){switch(n.constructor){case Float32Array:r._setConstantFloatArray(t,e,n);break;case Int32Array:r._setConstantIntArray(t,e,n);break;case Uint32Array:r._setConstantUintArray(t,e,n);break;default:Yt(!1)}}}]),o()(r,[{key:"delete",value:function(){return Je()(Wt()(r.prototype),"delete",this).call(this),this.buffer&&this.buffer.delete(),this}},{key:"initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setProps(t)}},{key:"setProps",value:function(t){return this}},{key:"setElementBuffer",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Yt(!e||34963===e.target,In),this.bind((function(){t.gl.bindBuffer(34963,e?e.handle:null)})),this}},{key:"setBuffer",value:function(t,e,r){if(34963===e.target)return this.setElementBuffer(e,r);var n=r.size,i=r.type,a=r.stride,o=r.offset,u=r.normalized,s=r.integer,c=r.divisor,l=this.gl,f=this.gl2;return t=Number(t),this.bind((function(){l.bindBuffer(34962,e.handle),s?(Yt(M(l)),f.vertexAttribIPointer(t,n,i,a,o)):l.vertexAttribPointer(t,n,i,u,a,o),l.enableVertexAttribArray(t),f.vertexAttribDivisor(t,c||0)})),this}},{key:"enable",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!n&&0===t&&!r.isSupported(this.gl,{constantAttributeZero:!0});return i||(t=Number(t),this.bind((function(){return n?e.gl.enableVertexAttribArray(t):e.gl.disableVertexAttribArray(t)}))),this}},{key:"getConstantBuffer",value:function(t,e){var r=this._normalizeConstantArrayValue(e),n=r.byteLength*t,i=r.length*t,a=!this.buffer;if(this.buffer=this.buffer||new xe(this.gl,n),a=(a=a||this.buffer.reallocate(n))||!this._compareConstantArrayValues(r,this.bufferValue)){var o=On(e.constructor,i);!function(t){for(var e=t.target,r=t.source,n=t.start,i=void 0===n?0:n,a=t.count,o=void 0===a?1:a,u=r.length,s=o*u,c=0,l=i;c<u;c++)e[l++]=r[c];for(;c<s;)c<s-c?(e.copyWithin(i+c,i,i+c),c*=2):(e.copyWithin(i+c,i,i+s-c),c=s)}({target:o,source:r,start:0,count:i}),this.buffer.subData(o),this.bufferValue=e}return this.buffer}},{key:"_normalizeConstantArrayValue",value:function(t){return Array.isArray(t)?new Float32Array(t):t}},{key:"_compareConstantArrayValues",value:function(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(var r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}},{key:"_createHandle",value:function(){return this.gl.createVertexArray()}},{key:"_deleteHandle",value:function(t){return this.gl2.deleteVertexArray(t),[this.elements]}},{key:"_bindHandle",value:function(t){this.gl2.bindVertexArray(t)}},{key:"_getParameter",value:function(t,e){var r=this,n=e.location;return Yt(Number.isFinite(n)),this.bind((function(){switch(t){case 34373:return r.gl.getVertexAttribOffset(n,t);default:return r.gl.getVertexAttrib(n,t)}}))}},{key:"MAX_ATTRIBUTES",get:function(){return r.getMaxAttributes(this.gl)}}],[{key:"_setConstantFloatArray",value:function(t,e,r){switch(r.length){case 1:t.vertexAttrib1fv(e,r);break;case 2:t.vertexAttrib2fv(e,r);break;case 3:t.vertexAttrib3fv(e,r);break;case 4:t.vertexAttrib4fv(e,r);break;default:Yt(!1)}}},{key:"_setConstantIntArray",value:function(t,e,r){switch(Yt(M(t)),r.length){case 1:t.vertexAttribI1iv(e,r);break;case 2:t.vertexAttribI2iv(e,r);break;case 3:t.vertexAttribI3iv(e,r);break;case 4:t.vertexAttribI4iv(e,r);break;default:Yt(!1)}}},{key:"_setConstantUintArray",value:function(t,e,r){switch(Yt(M(t)),r.length){case 1:t.vertexAttribI1uiv(e,r);break;case 2:t.vertexAttribI2uiv(e,r);break;case 3:t.vertexAttribI3uiv(e,r);break;case 4:t.vertexAttribI4uiv(e,r);break;default:Yt(!1)}}}]),r}(ie),Pn=/^(.+)__LOCATION_([0-9]+)$/,Dn=["setBuffers","setGeneric","clearBindings","setLocations","setGenericValues","setDivisor","enable","disable"],jn=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,t);var n=r.id||r.program&&r.program.id;this.id=n,this.gl=e,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new Bn(e),te(this,"VertexArray","v6.0",Dn),this.initialize(r),Object.seal(this)}return o()(t,[{key:"delete",value:function(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}},{key:"initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(t)}},{key:"reset",value:function(){this.elements=null,this.elementsAccessor=null;var t=this.vertexArrayObject.MAX_ATTRIBUTES;return this.values=new Array(t).fill(null),this.accessors=new Array(t).fill(null),this.unused={},this.drawParams=null,this}},{key:"setProps",value:function(t){return"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"attributes"in t&&this.setAttributes(t.attributes),"elements"in t&&this.setElementBuffer(t.elements),"bindOnUse"in t&&(t=t.bindOnUse),this}},{key:"clearDrawParams",value:function(){this.drawParams=null}},{key:"getDrawParams",value:function(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}},{key:"setAttributes",value:function(t){var e=this;return Object.assign(this.attributes,t),this.vertexArrayObject.bind((function(){for(var r in t){var n=t[r];e._setAttribute(r,n)}e.gl.bindBuffer(34962,null)})),this}},{key:"setElementBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.elements=t,this.elementsAccessor=e,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(t,e),this}},{key:"setBuffer",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(34963===e.target)return this.setElementBuffer(e,r);var n=this._resolveLocationAndAccessor(t,e,e.accessor,r),i=n.location,a=n.accessor;return i>=0&&(this.values[i]=e,this.accessors[i]=a,this.clearDrawParams(),this.vertexArrayObject.setBuffer(i,e,a)),this}},{key:"setConstant",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this._resolveLocationAndAccessor(t,e,Object.assign({size:e.length},r)),i=n.location,a=n.accessor;return i>=0&&(e=this.vertexArrayObject._normalizeConstantArrayValue(e),this.values[i]=e,this.accessors[i]=a,this.clearDrawParams(),this.vertexArrayObject.enable(i,!1)),this}},{key:"unbindBuffers",value:function(){var t=this;return this.vertexArrayObject.bind((function(){t.elements&&t.vertexArrayObject.setElementBuffer(null),t.buffer=t.buffer||new xe(t.gl,{accessor:{size:4}});for(var e=0;e<t.vertexArrayObject.MAX_ATTRIBUTES;e++)t.values[e]instanceof xe&&(t.gl.disableVertexAttribArray(e),t.gl.bindBuffer(34962,t.buffer.handle),t.gl.vertexAttribPointer(e,1,5126,!1,0,0))})),this}},{key:"bindBuffers",value:function(){var t=this;return this.vertexArrayObject.bind((function(){t.elements&&t.setElementBuffer(t.elements);for(var e=0;e<t.vertexArrayObject.MAX_ATTRIBUTES;e++){var r=t.values[e];r instanceof xe&&t.setBuffer(e,r)}})),this}},{key:"bindForDraw",value:function(t,e,r){var n,i=this;return this.vertexArrayObject.bind((function(){i._setConstantAttributes(t,e),n=r()})),n}},{key:"_resolveLocationAndAccessor",value:function(t,e,r,n){var i=this,a={location:-1,accessor:null},o=this._getAttributeIndex(t),u=o.location,s=o.name;if(!Number.isFinite(u)||u<0)return this.unused[t]=e,j.once(3,(function(){return"unused value ".concat(t," in ").concat(i.id)}))(),a;var c=this._getAttributeInfo(s||u);if(!c)return a;var l=this.accessors[u]||{},f=ve.resolve(c.accessor,l,r,n),h=f.size,d=f.type;return Yt(Number.isFinite(h)&&Number.isFinite(d)),{location:u,accessor:f}}},{key:"_getAttributeInfo",value:function(t){return this.configuration&&this.configuration.getAttributeInfo(t)}},{key:"_getAttributeIndex",value:function(t){var e=Number(t);if(Number.isFinite(e))return{location:e};var r=Pn.exec(t),n=r?r[1]:t,i=r?Number(r[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(n)+i,name:n}:{location:-1}}},{key:"_setAttribute",value:function(t,e){if(e instanceof xe)this.setBuffer(t,e);else if(Array.isArray(e)&&e.length&&e[0]instanceof xe){var r=e[0],n=e[1];this.setBuffer(t,r,n)}else if(ArrayBuffer.isView(e)||Array.isArray(e)){var i=e;this.setConstant(t,i)}else{if(!(e.buffer instanceof xe))throw new Error("VertexArray: attributes must be Buffers or constants (i.e. typed array)");var a=e;this.setBuffer(t,a.buffer,a)}}},{key:"_setConstantAttributes",value:function(t,e){var r=Math.max(0|t,0|e),n=this.values[0];ArrayBuffer.isView(n)&&this._setConstantAttributeZero(n,r);for(var i=1;i<this.vertexArrayObject.MAX_ATTRIBUTES;i++)n=this.values[i],ArrayBuffer.isView(n)&&this._setConstantAttribute(i,n)}},{key:"_setConstantAttributeZero",value:function(t,e){if(Bn.isSupported(this.gl,{constantAttributeZero:!0}))this._setConstantAttribute(0,t);else{var r=this.vertexArrayObject.getConstantBuffer(e,t);this.vertexArrayObject.setBuffer(0,r,this.accessors[0])}}},{key:"_setConstantAttribute",value:function(t,e){Bn.setConstant(this.gl,t,e)}},{key:"_updateDrawParams",value:function(){for(var t={isIndexed:!1,isInstanced:!1,indexCount:1/0,vertexCount:1/0,instanceCount:1/0},e=0;e<this.vertexArrayObject.MAX_ATTRIBUTES;e++)this._updateDrawParamsForLocation(t,e);return this.elements&&(t.elementCount=this.elements.getElementCount(this.elements.accessor),t.isIndexed=!0,t.indexType=this.elementsAccessor.type||this.elements.accessor.type,t.indexOffset=this.elementsAccessor.offset||0),t.indexCount===1/0&&(t.indexCount=0),t.vertexCount===1/0&&(t.vertexCount=0),t.instanceCount===1/0&&(t.instanceCount=0),t}},{key:"_updateDrawParamsForLocation",value:function(t,e){var r=this.values[e],n=this.accessors[e];if(r){var i=n.divisor>0;if(t.isInstanced=t.isInstanced||i,r instanceof xe){var a=r;if(i){var o=a.getVertexCount(n);t.instanceCount=Math.min(t.instanceCount,o)}else{var u=a.getVertexCount(n);t.vertexCount=Math.min(t.vertexCount,u)}}}}},{key:"setElements",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return j.deprecated("setElements","setElementBuffer")(),this.setElementBuffer(t,e)}}]),t}(),Nn=function(){function t(e){var r;for(var n in i()(this,t),this.layout={},this.size=0,e)this._addUniform(n,e[n]);this.size+=(4-this.size%4)%4;var a=new Float32Array(this.size);this.typedArray=(r={},h()(r,5126,a),h()(r,5124,new Int32Array(a.buffer)),h()(r,5125,new Uint32Array(a.buffer)),r)}return o()(t,[{key:"getBytes",value:function(){return 4*this.size}},{key:"getData",value:function(){return this.typedArray[5126]}},{key:"getSubData",value:function(t){var e,r;if(void 0===t)e=this.data,r=0;else{var n=this.offsets[t],i=n+this.sizes[t];e=this.data.subarray(n,i),r=4*n}return{data:e,offset:r}}},{key:"setUniforms",value:function(t){for(var e in t)this._setValue(e,t[e]);return this}},{key:"_setValue",value:function(t,e){var r=this.layout[t];Yt(r,"UniformLayoutStd140 illegal argument");var n=this.typedArray[r.type];1===r.size?n[r.offset]=e:n.set(e,r.offset)}},{key:"_addUniform",value:function(t,e){var r=dn(e);Yt(r,"UniformBufferLayout illegal argument");var n=r.type,i=r.components;this.size=this._alignTo(this.size,i);var a=this.size;this.size+=i,this.layout[t]={type:n,size:i,offset:a}}},{key:"_alignTo",value:function(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}}]),t}();function Cn(t){var e=100,r=t.match(/[^\s]+/g);if(r.length>=2&&"#version"===r[0]){var n=parseInt(r[1],10);Number.isFinite(n)&&(e=n)}return e}function Mn(t,e){for(var r=e.maxElts,n=void 0===r?16:r,i=e.size,a=void 0===i?1:i,o="[",u=0;u<t.length&&u<n;++u)u>0&&(o+=",".concat(u%a==0?" ":"")),o+=Un(t[u],e);var s=t.length>n?"...":"]";return"".concat(o).concat(s)}function Un(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=1e-16,n=e.isInteger,i=void 0!==n&&n;if(Array.isArray(t)||ArrayBuffer.isView(t))return Mn(t,e);if(!Number.isFinite(t))return String(t);if(Math.abs(t)<r)return i?"0":"0.";if(i)return t.toFixed(0);if(Math.abs(t)>100&&Math.abs(t)<1e4)return t.toFixed(0);var a=t.toPrecision(2),o=a.indexOf(".0");return o===a.length-2?a.slice(0,-1):a}function Vn(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Gn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gn(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function zn(t){var e=t.header,r=void 0===e?"Uniforms":e,n=t.program,i=t.uniforms,a=t.undefinedOnly,o=void 0!==a&&a;Yt(n);var u,s=n._uniformSetters,c={},l=Object.keys(s).sort(),f=0,d=Vn(l);try{for(d.s();!(u=d.n()).done;){var v=u.value;v.match(".*_.*")||v.match(".*Matrix")||Hn({table:c,header:r,uniforms:i,uniformName:v,undefinedOnly:o})&&f++}}catch(t){d.e(t)}finally{d.f()}var g,m=Vn(l);try{for(m.s();!(g=m.n()).done;){var y=g.value;y.match(".*Matrix")&&Hn({table:c,header:r,uniforms:i,uniformName:y,undefinedOnly:o})&&f++}}catch(t){m.e(t)}finally{m.f()}var p,b=Vn(l);try{for(b.s();!(p=b.n()).done;){var _=p.value;c[_]||Hn({table:c,header:r,uniforms:i,uniformName:_,undefinedOnly:o})&&f++}}catch(t){b.e(t)}finally{b.f()}var A=0,x={};if(!o)for(var w in i){var E=i[w];c[w]||(A++,x[w]=h()({Type:"NOT USED: ".concat(E)},r,Un(E)))}return{table:c,count:f,unusedTable:x,unusedCount:A}}function Hn(t){var e,r=t.table,n=t.header,i=t.uniforms,a=t.uniformName,o=t.undefinedOnly,u=i[a],s=function(t){return null!=t}(u);return(!o||!s)&&(r[a]=(e={},h()(e,n,s?Un(u):"N/A"),h()(e,"Uniform Type",s?u:"NOT PROVIDED"),e),!0)}function Xn(t){var e=t.vertexArray,r=t.header,n=void 0===r?"Attributes":r;if(!e.configuration)return{};var i={};e.elements&&(i.ELEMENT_ARRAY_BUFFER=Wn(e,e.elements,null,n));var a=e.values;for(var o in a){var u=e._getAttributeInfo(o);if(u){var s="".concat(o,": ").concat(u.name),c=e.accessors[u.location];c&&(s="".concat(o,": ").concat(Yn(u.name,c))),i[s]=Wn(e,a[o],c,n)}}return i}function Wn(t,e,r,n){var i,a,o=t.gl;if(!e)return a={},h()(a,n,"null"),h()(a,"Format ","N/A"),a;var u,s,c,l="NOT PROVIDED",f=1,d=0,v=0;if(r&&(l=r.type,f=r.size,u=-1!==(l=String(l).replace("Array","")).indexOf("nt")),e instanceof xe){var g,m,y=e,p=y.getDebugData(),b=p.data;if(s=p.changed?"*":"",c=b,d=(v=y.byteLength)/b.BYTES_PER_ELEMENT/f,r){var _=r.divisor>0;m="".concat(_?"I ":"P "," ").concat(d," (x").concat(f,"=").concat(v," bytes ").concat(Qt(o,l),")")}else u=!0,m="".concat(v," bytes");return g={},h()(g,n,"".concat(s).concat(Un(c,{size:f,isInteger:u}))),h()(g,"Format ",m),g}return c=e,f=e.length,u=-1!==(l=String(e.constructor.name).replace("Array","")).indexOf("nt"),i={},h()(i,n,"".concat(Un(c,{size:f,isInteger:u})," (constant)")),h()(i,"Format ","".concat(f,"x").concat(l," (constant)")),i}function Yn(t,e){var r=vn(e.type,e.size);return r?"".concat(t," (").concat(r.name,")"):t}function qn(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return Qn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Qn(t,e)}(t))||e&&t&&"number"==typeof t.length){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(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function Qn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $n(t){var e,r={},n="Accessors for ".concat(t.id),i=qn(t.attributeInfos);try{for(i.s();!(e=i.n()).done;){var a=e.value;if(a){var o=Jn(a);r["in ".concat(o)]=h()({},n,JSON.stringify(a.accessor))}}}catch(t){i.e(t)}finally{i.f()}var u,s=qn(t.varyingInfos);try{for(s.s();!(u=s.n()).done;){var c=u.value;if(c){var l=Jn(c);r["out ".concat(l)]=h()({},n,JSON.stringify(c.accessor))}}}catch(t){s.e(t)}finally{s.f()}return r}function Jn(t){var e=t.accessor,r=vn(e.type,e.size);return r?"".concat(r.name," ").concat(t.name):t.name}},,function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return o}));var n=r(8),i=r.n(n),a=r(21);function o(){return!("object"===(void 0===t?"undefined":i()(t))&&"[object process]"===String(t)&&!t.browser)||Object(a.a)()}}).call(this,r(11))}])}));