text: /*!
   * @license twgl.js 4.10.1 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
   * Available via the MIT license.
   * see: http://github.com/greggman/twgl.js for details
   */
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.twgl=t():e.twgl=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.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 o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));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=5)}([function(e,t,r){"use strict";t.__esModule=!0,t.copyExistingProperties=function(e,t){Object.keys(t).forEach(function(r){t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(t[r]=e[r])})},t.copyNamedProperties=function(e,t,r){e.forEach(function(e){var n=t[e];void 0!==n&&(r[e]=n)})},t.isBuffer=function(e,t){return"undefined"!=typeof WebGLBuffer&&t instanceof WebGLBuffer},t.isRenderbuffer=function(e,t){return"undefined"!=typeof WebGLRenderbuffer&&t instanceof WebGLRenderbuffer},t.isShader=function(e,t){return"undefined"!=typeof WebGLShader&&t instanceof WebGLShader},t.isTexture=function(e,t){return"undefined"!=typeof WebGLTexture&&t instanceof WebGLTexture},t.isSampler=function(e,t){return"undefined"!=typeof WebGLSampler&&t instanceof WebGLSampler},t.warn=t.error=void 0;var n="undefined"!=typeof console&&console.error&&"function"==typeof console.error?console.error.bind(console):function(){};t.error=n;var o="undefined"!=typeof console&&console.warn&&"function"==typeof console.warn?console.warn.bind(console):function(){};t.warn=o},function(e,t,r){"use strict";t.__esModule=!0,t.getGLTypeForTypedArray=function(e){if(e instanceof Int8Array)return n;if(e instanceof Uint8Array)return o;if(e instanceof Uint8ClampedArray)return o;if(e instanceof Int16Array)return i;if(e instanceof Uint16Array)return u;if(e instanceof Int32Array)return a;if(e instanceof Uint32Array)return f;if(e instanceof Float32Array)return l;throw new Error("unsupported typed array type")},t.getGLTypeForTypedArrayType=function(e){if(e===Int8Array)return n;if(e===Uint8Array)return o;if(e===Uint8ClampedArray)return o;if(e===Int16Array)return i;if(e===Uint16Array)return u;if(e===Int32Array)return a;if(e===Uint32Array)return f;if(e===Float32Array)return l;throw new Error("unsupported typed array type")},t.getTypedArrayTypeForGLType=function(e){var t=c[e];if(!t)throw new Error("unknown gl type");return t},t.isArrayBuffer=void 0;var n=5120,o=5121,i=5122,u=5123,a=5124,f=5125,l=5126,c={},s=c;s[n]=Int8Array,s[o]=Uint8Array,s[i]=Int16Array,s[u]=Uint16Array,s[a]=Int32Array,s[f]=Uint32Array,s[l]=Float32Array,s[32819]=Uint16Array,s[32820]=Uint16Array,s[33635]=Uint16Array,s[5131]=Uint16Array,s[33640]=Uint32Array,s[35899]=Uint32Array,s[35902]=Uint32Array,s[36269]=Uint32Array,s[34042]=Uint32Array;var y="undefined"!=typeof SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};t.isArrayBuffer=y},function(e,t,r){"use strict";t.__esModule=!0,t.isWebGL1=function(e){return!e.texStorage2D},t.isWebGL2=function(e){return!!e.texStorage2D},t.glEnumToString=void 0;var n=function(){var e={},t={};return function(r,n){return function(r){var n=r.constructor.name;if(!e[n]){for(var o in r)if("number"==typeof r[o]){var i=t[r[o]];t[r[o]]=i?"".concat(i," | ").concat(o):o}e[n]=!0}}(r),t[n]||"0x"+n.toString(16)}}();t.glEnumToString=n},function(e,t,r){"use strict";t.__esModule=!0,t.createAttributeSetters=G,t.createProgram=T,t.createProgramFromScripts=function(e,t,r,n,o){for(var i=h(r,n,o),u=[],a=0;a<t.length;++a){var f=z(e,t[a],e[j[a]],i.errorCallback);if(!f)return null;u.push(f)}return T(e,u,i)},t.createProgramFromSources=g,t.createProgramInfo=function(e,t,r,n,o){var i=h(r,n,o),u=!0;if(t=t.map(function(e){if(e.indexOf("\n")<0){var t=f(e);t?e=t.text:(i.errorCallback("no element with id: "+e),u=!1)}return e}),!u)return null;var a=g(e,t,i);if(!a)return null;return X(e,a)},t.createProgramInfoFromProgram=X,t.createUniformSetters=S,t.createUniformBlockSpecFromProgram=B,t.createUniformBlockInfoFromProgram=k,t.createUniformBlockInfo=function(e,t,r){return k(e,t.program,t.uniformBlockSpec,r)},t.createTransformFeedback=function(e,t,r){var n=e.createTransformFeedback();return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n),e.useProgram(t.program),I(e,t,r),e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),n},t.createTransformFeedbackInfo=U,t.bindTransformFeedbackInfo=I,t.setAttributes=W,t.setBuffersAndAttributes=function(e,t,r){r.vertexArrayObject?e.bindVertexArray(r.vertexArrayObject):(W(t.attribSetters||t,r.attribs),r.indices&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.indices))},t.setUniforms=function e(t,r){var n=t.uniformSetters||t;var o=arguments.length;for(var i=1;i<o;++i){var u=arguments[i];if(Array.isArray(u))for(var a=u.length,f=0;f<a;++f)e(n,u[f]);else for(var l in u){var c=n[l];c&&c(u[l])}}},t.setUniformBlock=function(e,t,r){M(e,t,r)&&e.bufferData(e.UNIFORM_BUFFER,r.array,e.DYNAMIC_DRAW)},t.setBlockUniforms=function(e,t){var r=e.uniforms;for(var n in t){var o=r[n];if(o){var i=t[n];i.length?o.set(i):o[0]=i}}},t.bindUniformBlock=M;var n=i(r(2)),o=i(r(0));function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}var u=o.error,a=o.warn,f="undefined"!=typeof document&&document.getElementById?document.getElementById.bind(document):function(){return null},l={};function c(e,t){return l[t].bindPoint}function s(e,t){return function(r){e.uniform1i(t,r)}}function y(e,t){return function(r){e.uniform1iv(t,r)}}function b(e,t){return function(r){e.uniform2iv(t,r)}}function v(e,t){return function(r){e.uniform3iv(t,r)}}function m(e,t){return function(r){e.uniform4iv(t,r)}}function d(e,t,r,i){var u=c(0,t);return n.isWebGL2(e)?function(t){var n,a;o.isTexture(e,t)?(n=t,a=null):(n=t.texture,a=t.sampler),e.uniform1i(i,r),e.activeTexture(e.TEXTURE0+r),e.bindTexture(u,n),e.bindSampler(r,a)}:function(t){e.uniform1i(i,r),e.activeTexture(e.TEXTURE0+r),e.bindTexture(u,t)}}function p(e,t,r,i,u){for(var a=c(0,t),f=new Int32Array(u),l=0;l<u;++l)f[l]=r+l;return n.isWebGL2(e)?function(t){e.uniform1iv(i,f),t.forEach(function(t,n){var i,u;e.activeTexture(e.TEXTURE0+f[n]),o.isTexture(e,t)?(i=t,u=null):(i=t.texture,u=t.sampler),e.bindSampler(r,u),e.bindTexture(a,i)})}:function(t){e.uniform1iv(i,f),t.forEach(function(t,r){e.activeTexture(e.TEXTURE0+f[r]),e.bindTexture(a,t)})}}function x(e,t){return function(r){if(r.value)switch(e.disableVertexAttribArray(t),r.value.length){case 4:e.vertexAttrib4fv(t,r.value);break;case 3:e.vertexAttrib3fv(t,r.value);break;case 2:e.vertexAttrib2fv(t,r.value);break;case 1:e.vertexAttrib1fv(t,r.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else e.bindBuffer(e.ARRAY_BUFFER,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribPointer(t,r.numComponents||r.size,r.type||e.FLOAT,r.normalize||!1,r.stride||0,r.offset||0),void 0!==r.divisor&&e.vertexAttribDivisor(t,r.divisor)}}function F(e,t){return function(r){if(r.value){if(e.disableVertexAttribArray(t),4!==r.value.length)throw new Error("The length of an integer constant value must be 4!");e.vertexAttrib4iv(t,r.value)}else e.bindBuffer(e.ARRAY_BUFFER,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||e.INT,r.stride||0,r.offset||0),void 0!==r.divisor&&e.vertexAttribDivisor(t,r.divisor)}}function E(e,t){return function(r){if(r.value){if(e.disableVertexAttribArray(t),4!==r.value.length)throw new Error("The length of an unsigned integer constant value must be 4!");e.vertexAttrib4uiv(t,r.value)}else e.bindBuffer(e.ARRAY_BUFFER,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||e.UNSIGNED_INT,r.stride||0,r.offset||0),void 0!==r.divisor&&e.vertexAttribDivisor(t,r.divisor)}}function _(e,t,r){var n=r.size,o=r.count;return function(r){e.bindBuffer(e.ARRAY_BUFFER,r.buffer);for(var i=r.size||r.numComponents||n,u=i/o,a=r.type||e.FLOAT,f=l[a].size*i,c=r.normalize||!1,s=r.offset||0,y=f/o,b=0;b<o;++b)e.enableVertexAttribArray(t+b),e.vertexAttribPointer(t+b,u,a,c,f,s+y*b),void 0!==r.divisor&&e.vertexAttribDivisor(t+b,r.divisor)}}l[5126]={Type:Float32Array,size:4,setter:function(e,t){return function(r){e.uniform1f(t,r)}},arraySetter:function(e,t){return function(r){e.uniform1fv(t,r)}}},l[35664]={Type:Float32Array,size:8,setter:function(e,t){return function(r){e.uniform2fv(t,r)}}},l[35665]={Type:Float32Array,size:12,setter:function(e,t){return function(r){e.uniform3fv(t,r)}}},l[35666]={Type:Float32Array,size:16,setter:function(e,t){return function(r){e.uniform4fv(t,r)}}},l[5124]={Type:Int32Array,size:4,setter:s,arraySetter:y},l[35667]={Type:Int32Array,size:8,setter:b},l[35668]={Type:Int32Array,size:12,setter:v},l[35669]={Type:Int32Array,size:16,setter:m},l[5125]={Type:Uint32Array,size:4,setter:function(e,t){return function(r){e.uniform1ui(t,r)}},arraySetter:function(e,t){return function(r){e.uniform1uiv(t,r)}}},l[36294]={Type:Uint32Array,size:8,setter:function(e,t){return function(r){e.uniform2uiv(t,r)}}},l[36295]={Type:Uint32Array,size:12,setter:function(e,t){return function(r){e.uniform3uiv(t,r)}}},l[36296]={Type:Uint32Array,size:16,setter:function(e,t){return function(r){e.uniform4uiv(t,r)}}},l[35670]={Type:Uint32Array,size:4,setter:s,arraySetter:y},l[35671]={Type:Uint32Array,size:8,setter:b},l[35672]={Type:Uint32Array,size:12,setter:v},l[35673]={Type:Uint32Array,size:16,setter:m},l[35674]={Type:Float32Array,size:16,setter:function(e,t){return function(r){e.uniformMatrix2fv(t,!1,r)}}},l[35675]={Type:Float32Array,size:36,setter:function(e,t){return function(r){e.uniformMatrix3fv(t,!1,r)}}},l[35676]={Type:Float32Array,size:64,setter:function(e,t){return function(r){e.uniformMatrix4fv(t,!1,r)}}},l[35685]={Type:Float32Array,size:24,setter:function(e,t){return function(r){e.uniformMatrix2x3fv(t,!1,r)}}},l[35686]={Type:Float32Array,size:32,setter:function(e,t){return function(r){e.uniformMatrix2x4fv(t,!1,r)}}},l[35687]={Type:Float32Array,size:24,setter:function(e,t){return function(r){e.uniformMatrix3x2fv(t,!1,r)}}},l[35688]={Type:Float32Array,size:48,setter:function(e,t){return function(r){e.uniformMatrix3x4fv(t,!1,r)}}},l[35689]={Type:Float32Array,size:32,setter:function(e,t){return function(r){e.uniformMatrix4x2fv(t,!1,r)}}},l[35690]={Type:Float32Array,size:48,setter:function(e,t){return function(r){e.uniformMatrix4x3fv(t,!1,r)}}},l[35678]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:3553},l[35680]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:34067},l[35679]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:32879},l[35682]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:3553},l[36289]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:35866},l[36292]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:35866},l[36293]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:34067},l[36298]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:3553},l[36299]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:32879},l[36300]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:34067},l[36303]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:35866},l[36306]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:3553},l[36307]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:32879},l[36308]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:34067},l[36311]={Type:null,size:0,setter:d,arraySetter:p,bindPoint:35866};var A={};A[5126]={size:4,setter:x},A[35664]={size:8,setter:x},A[35665]={size:12,setter:x},A[35666]={size:16,setter:x},A[5124]={size:4,setter:F},A[35667]={size:8,setter:F},A[35668]={size:12,setter:F},A[35669]={size:16,setter:F},A[5125]={size:4,setter:E},A[36294]={size:8,setter:E},A[36295]={size:12,setter:E},A[36296]={size:16,setter:E},A[35670]={size:4,setter:F},A[35671]={size:8,setter:F},A[35672]={size:12,setter:F},A[35673]={size:16,setter:F},A[35674]={size:4,setter:_,count:2},A[35675]={size:9,setter:_,count:3},A[35676]={size:16,setter:_,count:4};var w=/^[ \t]*\n/;function O(e,t,r,n){var o=n||u,i=e.createShader(r),a=0;if(w.test(t)&&(a=1,t=t.replace(w,"")),e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){var f=e.getShaderInfoLog(i);return o(function(e,t){return t=t||0,++t,e.split("\n").map(function(e,r){return r+t+": "+e}).join("\n")}(t,a)+"\n*** Error compiling shader: "+f),e.deleteShader(i),null}return i}function h(e,t,r){var n;if("function"==typeof t&&(r=t,t=void 0),"function"==typeof e)r=e,e=void 0;else if(e&&!Array.isArray(e)){if(e.errorCallback)return e;var o=e;r=o.errorCallback,e=o.attribLocations,n=o.transformFeedbackVaryings}var i={errorCallback:r||u,transformFeedbackVaryings:n};if(e){var a={};Array.isArray(e)?e.forEach(function(e,r){a[e]=t?t[r]:r}):a=e,i.attribLocations=a}return i}var j=["VERTEX_SHADER","FRAGMENT_SHADER"];function P(e,t){return t.indexOf("frag")>=0?e.FRAGMENT_SHADER:t.indexOf("vert")>=0?e.VERTEX_SHADER:void 0}function R(e,t){t.forEach(function(t){e.deleteShader(t)})}function T(e,t,r,n,i){for(var u=h(r,n,i),a=[],l=[],c=0;c<t.length;++c){var s=t[c];if("string"==typeof s){var y=f(s),b=y?y.text:s,v=e[j[c]];y&&y.type&&(v=P(e,y.type)||v),s=O(e,b,v,u.errorCallback),l.push(s)}o.isShader(e,s)&&a.push(s)}if(a.length!==t.length)return u.errorCallback("not enough shaders for program"),R(e,l),null;var m=e.createProgram();a.forEach(function(t){e.attachShader(m,t)}),u.attribLocations&&Object.keys(u.attribLocations).forEach(function(t){e.bindAttribLocation(m,u.attribLocations[t],t)});var d=u.transformFeedbackVaryings;if(d&&(d.attribs&&(d=d.attribs),Array.isArray(d)||(d=Object.keys(d)),e.transformFeedbackVaryings(m,d,u.transformFeedbackMode||e.SEPARATE_ATTRIBS)),e.linkProgram(m),!e.getProgramParameter(m,e.LINK_STATUS)){var p=e.getProgramInfoLog(m);return u.errorCallback("Error in program linking:"+p),e.deleteProgram(m),R(e,l),null}return m}function z(e,t,r,n){var o,i=f(t);if(!i)throw new Error("unknown script element: ".concat(t));o=i.text;var u=r||P(e,i.type);if(!u)throw new Error("unknown shader type");return O(e,o,u,n)}function g(e,t,r,n,o){for(var i=h(r,n,o),u=[],a=0;a<t.length;++a){var f=O(e,t[a],e[j[a]],i.errorCallback);if(!f)return null;u.push(f)}return T(e,u,i)}function C(e){var t=e.name;return t.startsWith("gl_")||t.startsWith("webgl_")}function S(e,t){var r=0;function n(t,n){var o,i=e.getUniformLocation(t,n.name),u=n.size>1&&"[0]"===n.name.substr(-3),a=n.type,f=l[a];if(!f)throw new Error("unknown type: 0x".concat(a.toString(16)));if(f.bindPoint){var c=r;r+=n.size,o=u?f.arraySetter(e,a,c,i,n.size):f.setter(e,a,c,i,n.size)}else o=f.arraySetter&&u?f.arraySetter(e,i):f.setter(e,i);return o.location=i,o}for(var o={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),u=0;u<i;++u){var a=e.getActiveUniform(t,u);if(!C(a)){var f=a.name;"[0]"===f.substr(-3)&&(f=f.substr(0,f.length-3));var c=n(t,a);o[f]=c}}return o}function U(e,t){for(var r={},n=e.getProgramParameter(t,e.TRANSFORM_FEEDBACK_VARYINGS),o=0;o<n;++o){var i=e.getTransformFeedbackVarying(t,o);r[i.name]={index:o,type:i.type,size:i.size}}return r}function I(e,t,r){for(var n in t.transformFeedbackInfo&&(t=t.transformFeedbackInfo),r.attribs&&(r=r.attribs),r){var o=t[n];if(o){var i=r[n];i.offset?e.bindBufferRange(e.TRANSFORM_FEEDBACK_BUFFER,o.index,i.buffer,i.offset,i.size):e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,o.index,i.buffer)}}}function B(e,t){for(var r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=[],o=[],i=0;i<r;++i){o.push(i),n.push({});var u=e.getActiveUniform(t,i);if(C(u))break;n[i].name=u.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(r){var i=r[0],u=r[1];e.getActiveUniforms(t,o,e[i]).forEach(function(e,t){n[t][u]=e})});for(var a={},f=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS),l=0;l<f;++l){var c=e.getActiveUniformBlockName(t,l),s={index:l,usedByVertexShader:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)};s.used=s.usedByVertexSahder||s.usedByFragmentShader,a[c]=s}return{blockSpecs:a,uniformData:n}}var L=/\[\d+\]\.$/;function k(e,t,r,n){var o=r.blockSpecs,i=r.uniformData,u=o[n];if(!u)return a("no uniform block object named:",n),{name:n,uniforms:{}};var f=new ArrayBuffer(u.size),c=e.createBuffer(),s=u.index;e.bindBuffer(e.UNIFORM_BUFFER,c),e.uniformBlockBinding(t,u.index,s);var y=n+".";L.test(y)&&(y=y.replace(L,"."));var b={};return u.uniformIndices.forEach(function(e){var t=i[e],r=l[t.type],n=r.Type,o=t.size*r.size,u=t.name;u.substr(0,y.length)===y&&(u=u.substr(y.length)),b[u]=new n(f,t.offset,o/n.BYTES_PER_ELEMENT)}),{name:n,array:f,asFloat:new Float32Array(f),buffer:c,uniforms:b}}function M(e,t,r){var n=(t.uniformBlockSpec||t).blockSpecs[r.name];if(n){var o=n.index;return e.bindBufferRange(e.UNIFORM_BUFFER,o,r.buffer,r.offset||0,r.array.byteLength),!0}return!1}function G(e,t){for(var r={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),o=0;o<n;++o){var i=e.getActiveAttrib(t,o);if(!C(i)){var u=e.getAttribLocation(t,i.name),a=A[i.type],f=a.setter(e,u,a);f.location=u,r[i.name]=f}}return r}function W(e,t){for(var r in t){var n=e[r];n&&n(t[r])}}function X(e,t){var r={program:t,uniformSetters:S(e,t),attribSetters:G(e,t)};return n.isWebGL2(e)&&(r.uniformBlockSpec=B(e,t),r.transformFeedbackInfo=U(e,t)),r}},function(e,t,r){"use strict";t.__esModule=!0,t.setTextureDefaults_=function(e){i.copyExistingProperties(e,a),e.textureColor&&w(e.textureColor)},t.createSampler=C,t.createSamplers=function(e,t){var r={};return Object.keys(t).forEach(function(n){r[n]=C(e,t[n])}),r},t.setSamplerParameters=g,t.createTexture=Y,t.setEmptyTexture=V,t.setTextureFromArray=q,t.loadTextureFromUrl=D,t.setTextureFromElement=L,t.setTextureFilteringForSize=S,t.setTextureParameters=z,t.setDefaultTextureColor=w,t.createTextures=function(e,t,r){r=r||k;var n=0,o=[],i={},u={};function a(){0===n&&setTimeout(function(){r(o.length?o:void 0,i,u)},0)}return Object.keys(t).forEach(function(r){var f,l,c=t[r];("string"==typeof(l=c.src)||Array.isArray(l)&&"string"==typeof l[0])&&(f=function(e,t,i){u[r]=i,--n,e&&o.push(e),a()},++n),i[r]=Y(e,c,f)}),a(),i},t.resizeTexture=function(e,t,r,n,o){n=n||r.width,o=o||r.height;var i=r.target||e.TEXTURE_2D;e.bindTexture(i,t);var u,a=r.level||0,l=r.internalFormat||r.format||e.RGBA,c=p(l),s=r.format||c.format,y=r.src;u=y&&(f(y)||Array.isArray(y)&&"number"==typeof y[0])?r.type||_(e,y,c.type):r.type||c.type;if(i===e.TEXTURE_CUBE_MAP)for(var b=0;b<6;++b)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+b,a,l,n,o,0,s,u,null);else e.texImage2D(i,a,l,n,o,0,s,u,null)},t.canGenerateMipmap=F,t.canFilter=E,t.getNumComponentsForFormat=function(e){var t=y[e];if(!t)throw"unknown format: "+e;return t.u},t.getBytesPerElementForInternalFormat=d,t.getFormatAndTypeForInternalFormat=p;var n=u(r(2)),o=u(r(1)),i=u(r(0));function u(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}var a={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},f=o.isArrayBuffer,l="undefined"!=typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null,c=6407,s=33319,y={},b=y;b[6406]={u:1},b[6409]={u:1},b[6410]={u:2},b[c]={u:3},b[6408]={u:4},b[6403]={u:1},b[36244]={u:1},b[s]={u:2},b[33320]={u:2},b[c]={u:3},b[36248]={u:3},b[6408]={u:4},b[36249]={u:4},b[6402]={u:1},b[34041]={u:2};var v={},m=v;function d(e,t){var r=v[e];if(!r)throw"unknown internal format";var n=r.bytesPerElementMap[t];if(void 0===n)throw"unknown internal format";return n}function p(e){var t=v[e];if(!t)throw"unknown internal format";return{format:t.v,type:t.type[0]}}function x(e){return 0==(e&e-1)}function F(e,t,r,o){if(!n.isWebGL2(e))return x(t)&&x(r);var i=v[o];if(!i)throw"unknown internal format";return i.F&&i._}function E(e){var t=v[e];if(!t)throw"unknown internal format";return t._}function _(e,t,r){return f(t)?o.getGLTypeForTypedArray(t):r||e.UNSIGNED_BYTE}function A(e,t,r,n,o){if(o%1!=0)throw"can't guess dimensions";if(r||n){if(n){if(!r&&(r=o/n)%1)throw"can't guess dimensions"}else if((n=o/r)%1)throw"can't guess dimensions"}else{var i=Math.sqrt(o/(t===e.TEXTURE_CUBE_MAP?6:1));i%1==0?(r=i,n=i):(r=o,n=1)}return{width:r,height:n}}function w(e){a.textureColor=new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}m[6406]={v:6406,F:!0,_:!0,A:[1,2,2,4],type:[5121,5131,36193,5126]},m[6409]={v:6409,F:!0,_:!0,A:[1,2,2,4],type:[5121,5131,36193,5126]},m[6410]={v:6410,F:!0,_:!0,A:[2,4,4,8],type:[5121,5131,36193,5126]},m[c]={v:c,F:!0,_:!0,A:[3,6,6,12,2],type:[5121,5131,36193,5126,33635]},m[6408]={v:6408,F:!0,_:!0,A:[4,8,8,16,2,2],type:[5121,5131,36193,5126,32819,32820]},m[33321]={v:6403,F:!0,_:!0,A:[1],type:[5121]},m[36756]={v:6403,F:!1,_:!0,A:[1],type:[5120]},m[33325]={v:6403,F:!1,_:!0,A:[4,2],type:[5126,5131]},m[33326]={v:6403,F:!1,_:!1,A:[4],type:[5126]},m[33330]={v:36244,F:!0,_:!1,A:[1],type:[5121]},m[33329]={v:36244,F:!0,_:!1,A:[1],type:[5120]},m[33332]={v:36244,F:!0,_:!1,A:[2],type:[5123]},m[33331]={v:36244,F:!0,_:!1,A:[2],type:[5122]},m[33334]={v:36244,F:!0,_:!1,A:[4],type:[5125]},m[33333]={v:36244,F:!0,_:!1,A:[4],type:[5124]},m[33323]={v:s,F:!0,_:!0,A:[2],type:[5121]},m[36757]={v:s,F:!1,_:!0,A:[2],type:[5120]},m[33327]={v:s,F:!1,_:!0,A:[8,4],type:[5126,5131]},m[33328]={v:s,F:!1,_:!1,A:[8],type:[5126]},m[33336]={v:33320,F:!0,_:!1,A:[2],type:[5121]},m[33335]={v:33320,F:!0,_:!1,A:[2],type:[5120]},m[33338]={v:33320,F:!0,_:!1,A:[4],type:[5123]},m[33337]={v:33320,F:!0,_:!1,A:[4],type:[5122]},m[33340]={v:33320,F:!0,_:!1,A:[8],type:[5125]},m[33339]={v:33320,F:!0,_:!1,A:[8],type:[5124]},m[32849]={v:c,F:!0,_:!0,A:[3],type:[5121]},m[35905]={v:c,F:!1,_:!0,A:[3],type:[5121]},m[36194]={v:c,F:!0,_:!0,A:[3,2],type:[5121,33635]},m[36758]={v:c,F:!1,_:!0,A:[3],type:[5120]},m[35898]={v:c,F:!1,_:!0,A:[12,6,4],type:[5126,5131,35899]},m[35901]={v:c,F:!1,_:!0,A:[12,6,4],type:[5126,5131,35902]},m[34843]={v:c,F:!1,_:!0,A:[12,6],type:[5126,5131]},m[34837]={v:c,F:!1,_:!1,A:[12],type:[5126]},m[36221]={v:36248,F:!1,_:!1,A:[3],type:[5121]},m[36239]={v:36248,F:!1,_:!1,A:[3],type:[5120]},m[36215]={v:36248,F:!1,_:!1,A:[6],type:[5123]},m[36233]={v:36248,F:!1,_:!1,A:[6],type:[5122]},m[36209]={v:36248,F:!1,_:!1,A:[12],type:[5125]},m[36227]={v:36248,F:!1,_:!1,A:[12],type:[5124]},m[32856]={v:6408,F:!0,_:!0,A:[4],type:[5121]},m[35907]={v:6408,F:!0,_:!0,A:[4],type:[5121]},m[36759]={v:6408,F:!1,_:!0,A:[4],type:[5120]},m[32855]={v:6408,F:!0,_:!0,A:[4,2,4],type:[5121,32820,33640]},m[32854]={v:6408,F:!0,_:!0,A:[4,2],type:[5121,32819]},m[32857]={v:6408,F:!0,_:!0,A:[4],type:[33640]},m[34842]={v:6408,F:!1,_:!0,A:[16,8],type:[5126,5131]},m[34836]={v:6408,F:!1,_:!1,A:[16],type:[5126]},m[36220]={v:36249,F:!0,_:!1,A:[4],type:[5121]},m[36238]={v:36249,F:!0,_:!1,A:[4],type:[5120]},m[36975]={v:36249,F:!0,_:!1,A:[4],type:[33640]},m[36214]={v:36249,F:!0,_:!1,A:[8],type:[5123]},m[36232]={v:36249,F:!0,_:!1,A:[8],type:[5122]},m[36226]={v:36249,F:!0,_:!1,A:[16],type:[5124]},m[36208]={v:36249,F:!0,_:!1,A:[16],type:[5125]},m[33189]={v:6402,F:!0,_:!1,A:[2,4],type:[5123,5125]},m[33190]={v:6402,F:!0,_:!1,A:[4],type:[5125]},m[36012]={v:6402,F:!0,_:!1,A:[4],type:[5126]},m[35056]={v:34041,F:!0,_:!1,A:[4],type:[34042]},m[36013]={v:34041,F:!0,_:!1,A:[4],type:[36269]},Object.keys(m).forEach(function(e){var t=m[e];t.bytesPerElementMap={},t.A.forEach(function(e,r){var n=t.type[r];t.bytesPerElementMap[n]=e})});var O={};function h(e,t){void 0!==t.colorspaceConversion&&(O.colorspaceConversion=e.getParameter(e.UNPACK_COLORSPACE_CONVERSION_WEBGL),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.colorspaceConversion)),void 0!==t.premultiplyAlpha&&(O.premultiplyAlpha=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha)),void 0!==t.flipY&&(O.flipY=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY))}function j(e,t){void 0!==t.colorspaceConversion&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,O.colorspaceConversion),void 0!==t.premultiplyAlpha&&e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),void 0!==t.flipY&&e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,O.flipY)}function P(e){O.unpackAlignment=e.getParameter(e.UNPACK_ALIGNMENT),n.isWebGL2(e)&&(O.unpackRowLength=e.getParameter(e.UNPACK_ROW_LENGTH),O.unpackImageHeight=e.getParameter(e.UNPACK_IMAGE_HEIGHT),O.unpackSkipPixels=e.getParameter(e.UNPACK_SKIP_PIXELS),O.unpackSkipRows=e.getParameter(e.UNPACK_SKIP_ROWS),O.unpackSkipImages=e.getParameter(e.UNPACK_SKIP_IMAGES))}function R(e){e.pixelStorei(e.UNPACK_ALIGNMENT,O.unpackAlignment),n.isWebGL2(e)&&(e.pixelStorei(e.UNPACK_ROW_LENGTH,O.unpackRowLength),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,O.unpackImageHeight),e.pixelStorei(e.UNPACK_SKIP_PIXELS,O.unpackSkipPixels),e.pixelStorei(e.UNPACK_SKIP_ROWS,O.unpackSkipRows),e.pixelStorei(e.UNPACK_SKIP_IMAGES,O.unpackSkipImages))}function T(e,t,r,n){n.minMag&&(r.call(e,t,e.TEXTURE_MIN_FILTER,n.minMag),r.call(e,t,e.TEXTURE_MAG_FILTER,n.minMag)),n.min&&r.call(e,t,e.TEXTURE_MIN_FILTER,n.min),n.mag&&r.call(e,t,e.TEXTURE_MAG_FILTER,n.mag),n.wrap&&(r.call(e,t,e.TEXTURE_WRAP_S,n.wrap),r.call(e,t,e.TEXTURE_WRAP_T,n.wrap),(t===e.TEXTURE_3D||i.isSampler(e,t))&&r.call(e,t,e.TEXTURE_WRAP_R,n.wrap)),n.wrapR&&r.call(e,t,e.TEXTURE_WRAP_R,n.wrapR),n.wrapS&&r.call(e,t,e.TEXTURE_WRAP_S,n.wrapS),n.wrapT&&r.call(e,t,e.TEXTURE_WRAP_T,n.wrapT),n.minLod&&r.call(e,t,e.TEXTURE_MIN_LOD,n.minLod),n.maxLod&&r.call(e,t,e.TEXTURE_MAX_LOD,n.maxLod),n.baseLevel&&r.call(e,t,e.TEXTURE_BASE_LEVEL,n.baseLevel),n.maxLevel&&r.call(e,t,e.TEXTURE_MAX_LEVEL,n.maxLevel)}function z(e,t,r){var n=r.target||e.TEXTURE_2D;e.bindTexture(n,t),T(e,n,e.texParameteri,r)}function g(e,t,r){T(e,t,e.samplerParameteri,r)}function C(e,t){var r=e.createSampler();return g(e,r,t),r}function S(e,t,r,n,o,i,u){r=r||a.textureOptions,i=i||e.RGBA,u=u||e.UNSIGNED_BYTE;var f=r.target||e.TEXTURE_2D;if(n=n||r.width,o=o||r.height,e.bindTexture(f,t),F(e,n,o,i))e.generateMipmap(f);else{var l=E(i)?e.LINEAR:e.NEAREST;e.texParameteri(f,e.TEXTURE_MIN_FILTER,l),e.texParameteri(f,e.TEXTURE_MAG_FILTER,l),e.texParameteri(f,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(f,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}function U(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function I(e,t){return(t=t||{}).cubeFaceOrder||[e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function B(e,t){var r=I(e,t).map(function(e,t){return{face:e,ndx:t}});return r.sort(function(e,t){return e.face-t.face}),r}function L(e,t,r,n){var o=(n=n||a.textureOptions).target||e.TEXTURE_2D,i=n.level||0,u=r.width,f=r.height,c=n.internalFormat||n.format||e.RGBA,s=p(c),y=n.format||s.format,b=n.type||s.type;if(h(e,n),e.bindTexture(o,t),o===e.TEXTURE_CUBE_MAP){var v,m,d=r.width,x=r.height;if(d/6===x)v=x,m=[0,0,1,0,2,0,3,0,4,0,5,0];else if(x/6===d)v=d,m=[0,0,0,1,0,2,0,3,0,4,0,5];else if(d/3==x/2)v=d/3,m=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(d/2!=x/3)throw"can't figure out cube map from element: "+(r.src?r.src:r.nodeName);v=d/2,m=[0,0,1,0,0,1,1,1,0,2,1,2]}l?(l.canvas.width=v,l.canvas.height=v,u=v,f=v,B(e,n).forEach(function(t){var n=m[2*t.ndx+0]*v,o=m[2*t.ndx+1]*v;l.drawImage(r,n,o,v,v,0,0,v,v),e.texImage2D(t.face,i,c,y,b,l.canvas)}),l.canvas.width=1,l.canvas.height=1):"undefined"!=typeof createImageBitmap&&(u=v,f=v,B(e,n).forEach(function(a){var l=m[2*a.ndx+0]*v,s=m[2*a.ndx+1]*v;e.texImage2D(a.face,i,c,v,v,0,y,b,null),createImageBitmap(r,l,s,v,v,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(function(r){h(e,n),e.bindTexture(o,t),e.texImage2D(a.face,i,c,y,b,r),j(e,n),U(n)&&S(e,t,n,u,f,c,b)})}))}else if(o===e.TEXTURE_3D||o===e.TEXTURE_2D_ARRAY){var F=Math.min(r.width,r.height),E=Math.max(r.width,r.height),_=E/F;if(_%1!=0)throw"can not compute 3D dimensions of element";var A=r.width===E?1:0,w=r.height===E?1:0;P(e),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_ROW_LENGTH,r.width),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),e.texImage3D(o,i,c,F,F,F,0,y,b,null);for(var O=0;O<_;++O){var T=O*F*A,g=O*F*w;e.pixelStorei(e.UNPACK_SKIP_PIXELS,T),e.pixelStorei(e.UNPACK_SKIP_ROWS,g),e.texSubImage3D(o,i,0,0,O,F,F,1,y,b,r)}R(e)}else e.texImage2D(o,i,c,y,b,r);j(e,n),U(n)&&S(e,t,n,u,f,c,b),z(e,t,n)}function k(){}function M(e,t){return void 0!==t||function(e){if("undefined"!=typeof document){var t=document.createElement("a");return t.href=e,t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol}var r=new URL(location.href).origin;return new URL(e,location.href).origin===r}(e)?t:"anonymous"}function G(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}function W(e,t,r){return G(e)?(setTimeout(function(){r(null,e)}),e):function(e,t,r){var n;if(r=r||k,t=void 0!==t?t:a.crossOrigin,t=M(e,t),"undefined"!=typeof Image){n=new Image,void 0!==t&&(n.crossOrigin=t);var o=function(){n.removeEventListener("error",u),n.removeEventListener("load",f),n=null},u=function(){var t="couldn't load image: "+e;i.error(t),r(t,n),o()},f=function(){r(null,n),o()};return n.addEventListener("error",u),n.addEventListener("load",f),n.src=e,n}if("undefined"!=typeof ImageBitmap){var l,c,s=function(){r(l,c)},y={};t&&(y.mode="cors"),fetch(e,y).then(function(e){if(!e.ok)throw e;return e.blob()}).then(function(e){return createImageBitmap(e,{premultiplyAlpha:"none",colorSpaceConversion:"none"})}).then(function(e){c=e,setTimeout(s)}).catch(function(e){l=e,setTimeout(s)}),n=null}return n}(e,t,r)}function X(e,t,r){var n=(r=r||a.textureOptions).target||e.TEXTURE_2D;if(e.bindTexture(n,t),!1!==r.color){var o=function(e){return e=e||a.textureColor,f(e)?e:new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}(r.color);if(n===e.TEXTURE_CUBE_MAP)for(var i=0;i<6;++i)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o);else n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o):e.texImage2D(n,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,o)}}function D(e,t,r,n){return n=n||k,r=r||a.textureOptions,X(e,t,r),W((r=Object.assign({},r)).src,r.crossOrigin,function(o,i){o?n(o,t,i):(L(e,t,i,r),n(null,t,i))})}function N(e,t,r,n){n=n||k;var o=r.src;if(6!==o.length)throw"there must be 6 urls for a cubemap";var i=r.level||0,u=r.internalFormat||r.format||e.RGBA,a=p(u),f=r.format||a.format,l=r.type||e.UNSIGNED_BYTE,c=r.target||e.TEXTURE_2D;if(c!==e.TEXTURE_CUBE_MAP)throw"target must be TEXTURE_CUBE_MAP";X(e,t,r),r=Object.assign({},r);var s,y=6,b=[],v=I(e,r);s=o.map(function(o,a){return W(o,r.crossOrigin,(m=v[a],function(o,a){--y,o?b.push(o):a.width!==a.height?b.push("cubemap face img is not a square: "+a.src):(h(e,r),e.bindTexture(c,t),5===y?I(e).forEach(function(t){e.texImage2D(t,i,u,f,l,a)}):e.texImage2D(m,i,u,f,l,a),j(e,r),U(r)&&e.generateMipmap(c)),0===y&&n(b.length?b:void 0,t,s)}));var m})}function H(e,t,r,n){n=n||k;var o=r.src,i=r.internalFormat||r.format||e.RGBA,u=p(i),a=r.format||u.format,f=r.type||e.UNSIGNED_BYTE,c=r.target||e.TEXTURE_2D_ARRAY;if(c!==e.TEXTURE_3D&&c!==e.TEXTURE_2D_ARRAY)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";X(e,t,r),r=Object.assign({},r);var s,y=o.length,b=[],v=r.level||0,m=r.width,d=r.height,x=o.length,F=!0;s=o.map(function(o,u){return W(o,r.crossOrigin,(p=u,function(o,u){if(--y,o)b.push(o);else{if(h(e,r),e.bindTexture(c,t),F){F=!1,m=r.width||u.width,d=r.height||u.height,e.texImage3D(c,v,i,m,d,x,0,a,f,null);for(var E=0;E<x;++E)e.texSubImage3D(c,v,0,0,E,m,d,1,a,f,u)}else{var _=u;u.width===m&&u.height===d||(_=l.canvas,l.canvas.width=m,l.canvas.height=d,l.drawImage(u,0,0,m,d)),e.texSubImage3D(c,v,0,0,p,m,d,1,a,f,_),_===l.canvas&&(l.canvas.width=0,l.canvas.height=0)}j(e,r),U(r)&&e.generateMipmap(c)}0===y&&n(b.length?b:void 0,t,s)}));var p})}function q(e,t,r,i){var u=(i=i||a.textureOptions).target||e.TEXTURE_2D;e.bindTexture(u,t);var l=i.width,c=i.height,s=i.depth,y=i.level||0,b=i.internalFormat||i.format||e.RGBA,v=p(b),m=i.format||v.format,x=i.type||_(e,r,v.type);if(f(r))r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));else{var F=o.getTypedArrayTypeForGLType(x);r=new F(r)}var E,w=d(b,x),O=r.byteLength/w;if(O%1)throw"length wrong size for format: "+n.glEnumToString(e,m);if(u===e.TEXTURE_3D)if(l||c||s)!l||c&&s?!c||l&&s?(E=A(e,u,l,c,O/s),l=E.width,c=E.height):(E=A(e,u,l,s,O/c),l=E.width,s=E.height):(E=A(e,u,c,s,O/l),c=E.width,s=E.height);else{var T=Math.cbrt(O);if(T%1!=0)throw"can't guess cube size of array of numElements: "+O;l=T,c=T,s=T}else E=A(e,u,l,c,O),l=E.width,c=E.height;if(P(e),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment||1),h(e,i),u===e.TEXTURE_CUBE_MAP){var z=O/6*(w/r.BYTES_PER_ELEMENT);B(e,i).forEach(function(t){var n=z*t.ndx,o=r.subarray(n,n+z);e.texImage2D(t.face,y,b,l,c,0,m,x,o)})}else u===e.TEXTURE_3D?e.texImage3D(u,y,b,l,c,s,0,m,x,r):e.texImage2D(u,y,b,l,c,0,m,x,r);return j(e,i),R(e),{width:l,height:c,depth:s,type:x}}function V(e,t,r){var n=r.target||e.TEXTURE_2D;e.bindTexture(n,t);var o=r.level||0,i=r.internalFormat||r.format||e.RGBA,u=p(i),a=r.format||u.format,f=r.type||u.type;if(h(e,r),n===e.TEXTURE_CUBE_MAP)for(var l=0;l<6;++l)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+l,o,i,r.width,r.height,0,a,f,null);else n===e.TEXTURE_3D?e.texImage3D(n,o,i,r.width,r.height,r.depth,0,a,f,null):e.texImage2D(n,o,i,r.width,r.height,0,a,f,null);j(e,r)}function Y(e,t,r){r=r||k,t=t||a.textureOptions;var n=e.createTexture(),o=t.target||e.TEXTURE_2D,i=t.width||1,u=t.height||1,l=t.internalFormat||e.RGBA,c=p(l),s=t.type||c.type;e.bindTexture(o,n),o===e.TEXTURE_CUBE_MAP&&(e.texParameteri(o,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(o,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE));var y=t.src;if(y)if("function"==typeof y&&(y=y(e,t)),"string"==typeof y)D(e,n,t,r);else if(f(y)||Array.isArray(y)&&("number"==typeof y[0]||Array.isArray(y[0])||f(y[0]))){var b=q(e,n,y,t);i=b.width,u=b.height,s=b.type}else if(Array.isArray(y)&&("string"==typeof y[0]||G(y[0])))o===e.TEXTURE_CUBE_MAP?N(e,n,t,r):H(e,n,t,r);else{if(!G(y))throw"unsupported src type";L(e,n,y,t),i=y.width,u=y.height}else V(e,n,t);return U(t)&&S(e,n,t,i,u,l,s),z(e,n,t),n}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(6);Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&(t[e]=n[e])})},function(e,t,r){"use strict";t.__esModule=!0;var n={addExtensionsToContext:!0,getContext:!0,getWebGLContext:!0,resizeCanvasToDisplaySize:!0,setDefaults:!0};t.addExtensionsToContext=x,t.getContext=function(e,t){return function(e,t){for(var r=["webgl2","webgl","experimental-webgl"],n=null,o=0;o<r.length;++o)if(n=e.getContext(r[o],t)){v.addExtensionsToContext&&x(n);break}return n}(e,t)},t.getWebGLContext=function(e,t){return function(e,t){for(var r=["webgl","experimental-webgl"],n=null,o=0;o<r.length;++o)if(n=e.getContext(r[o],t)){v.addExtensionsToContext&&x(n);break}return n}(e,t)},t.resizeCanvasToDisplaySize=function(e,t){t=t||1,t=Math.max(0,t);var r=e.clientWidth*t|0,n=e.clientHeight*t|0;if(e.width!==r||e.height!==n)return e.width=r,e.height=n,!0;return!1},t.setDefaults=function(e){u.copyExistingProperties(e,v),o.setAttributeDefaults_(e),i.setTextureDefaults_(e)};var o=b(r(7));Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=o[e]))});var i=b(r(4));Object.keys(i).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=i[e]))});var u=b(r(0)),a=b(r(2));Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=a[e]))});var f=r(8);Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=f[e]))});var l=r(9);Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=l[e]))});var c=r(3);Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=c[e]))});var s=r(1);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=s[e]))});var y=r(10);function b(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}Object.keys(y).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=y[e]))});var v={addExtensionsToContext:!0};var m=/^(.*?)_/;function d(e,t){a.glEnumToString(e,0);var r=e.getExtension(t);if(r){var n={},o=m.exec(t)[1],i="_"+o;for(var f in r){var l=r[f],c="function"==typeof l,s=c?o:i,y=f;f.endsWith(s)&&(y=f.substring(0,f.length-s.length)),void 0!==e[y]?c||e[y]===l||u.warn(y,e[y],l,f):c?e[y]=function(e){return function(){return e.apply(r,arguments)}}(l):(e[y]=l,n[y]=l)}n.constructor={name:r.constructor.name},a.glEnumToString(n,0)}return r}var p=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function x(e){for(var t=0;t<p.length;++t)d(e,p[t])}},function(e,t,r){"use strict";t.__esModule=!0,t.createAttribsFromArrays=d,t.createBuffersFromArrays=function(e,t){var r={};Object.keys(t).forEach(function(n){r[n]=x(e,t[n],n)}),t.indices?(r.numElements=t.indices.length,r.elementType=n.getGLTypeForTypedArray(m(t.indices),"indices")):r.numElements=function(e){var t,r;for(r=0;r<p.length&&!((t=p[r])in e);++r);r===p.length&&(t=Object.keys(e)[0]);var n=e[t],o=c(n).length,i=v(n,t),u=o/i;if(o%i>0)throw new Error("numComponents ".concat(i," not correct for length ").concat(o));return u}(t);return r},t.createBufferFromArray=x,t.createBufferFromTypedArray=f,t.createBufferInfoFromArrays=function(e,t,r){var o=d(e,t),i=Object.assign({},r||{});i.attribs=Object.assign({},r?r.attribs:{},o);var a=t.indices;if(a){var l=m(a,"indices");i.indices=f(e,l,e.ELEMENT_ARRAY_BUFFER),i.numElements=l.length,i.elementType=n.getGLTypeForTypedArray(l)}else i.numElements||(i.numElements=function(e,t){var r,n;for(n=0;n<p.length&&!((r=p[n])in t)&&!((r=u.attribPrefix+r)in t);++n);n===p.length&&(r=Object.keys(t)[0]);var o=t[r];e.bindBuffer(e.ARRAY_BUFFER,o.buffer);var i=e.getBufferParameter(e.ARRAY_BUFFER,e.BUFFER_SIZE);e.bindBuffer(e.ARRAY_BUFFER,null);var a=function(e,t){return t===e.BYTE?1:t===e.UNSIGNED_BYTE?1:t===e.SHORT?2:t===e.UNSIGNED_SHORT?2:t===e.INT?4:t===e.UNSIGNED_INT?4:t===e.FLOAT?4:0}(e,o.type),f=i/a,l=o.numComponents||o.size,c=f/l;if(c%1!=0)throw new Error("numComponents ".concat(l," not correct for length ").concat(length));return c}(e,i.attribs));return i},t.setAttribInfoBufferFromArray=function(e,t,r,n){r=m(r),void 0!==n?(e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.bufferSubData(e.ARRAY_BUFFER,n,r)):a(e,e.ARRAY_BUFFER,t.buffer,r,t.drawType)},t.setAttributePrefix=function(e){u.attribPrefix=e},t.setAttributeDefaults_=function(e){o.copyExistingProperties(e,u)},t.getNumComponents_=v,t.getArray_=c;var n=i(r(1)),o=i(r(0));function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}var u={attribPrefix:""};function a(e,t,r,n,o){e.bindBuffer(t,r),e.bufferData(t,n,o||e.STATIC_DRAW)}function f(e,t,r,n){if(o.isBuffer(e,t))return t;r=r||e.ARRAY_BUFFER;var i=e.createBuffer();return a(e,r,i,t,n),i}function l(e){return"indices"===e}function c(e){return e.length?e:e.data}var s=/coord|texture/i,y=/color|colour/i;function b(e,t){var r;if(t%(r=s.test(e)?2:y.test(e)?4:3)>0)throw new Error("Can not guess numComponents for attribute '".concat(e,"'. Tried ").concat(r," but ").concat(t," values is not evenly divisible by ").concat(r,". You should specify it."));return r}function v(e,t){return e.numComponents||e.size||b(t,c(e).length)}function m(e,t){if(n.isArrayBuffer(e))return e;if(n.isArrayBuffer(e.data))return e.data;Array.isArray(e)&&(e={data:e});var r=e.type;return r||(r=l(t)?Uint16Array:Float32Array),new r(e.data)}function d(e,t){var r={};return Object.keys(t).forEach(function(o){if(!l(o)){var i=t[o],a=i.attrib||i.name||i.attribName||u.attribPrefix+o;if(i.value){if(!Array.isArray(i.value)&&!n.isArrayBuffer(i.value))throw new Error("array.value is not array or typedarray");r[a]={value:i.value}}else{var c,s,y,d;if(i.buffer&&i.buffer instanceof WebGLBuffer)c=i.buffer,d=i.numComponents||i.size,s=i.type,y=i.normalize;else if("number"==typeof i||"number"==typeof i.data){var p=i.data||i,x=i.type||Float32Array,F=p*x.BYTES_PER_ELEMENT;s=n.getGLTypeForTypedArrayType(x),y=void 0!==i.normalize?i.normalize:(_=x)===Int8Array||_===Uint8Array,d=i.numComponents||i.size||b(o,p),c=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,F,i.drawType||e.STATIC_DRAW)}else{var E=m(i,o);c=f(e,E,void 0,i.drawType),s=n.getGLTypeForTypedArray(E),y=void 0!==i.normalize?i.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(E),d=v(i,o)}r[a]={buffer:c,numComponents:d,type:s,normalize:y,stride:i.stride||0,offset:i.offset||0,divisor:void 0===i.divisor?void 0:i.divisor,drawType:i.drawType}}}var _}),e.bindBuffer(e.ARRAY_BUFFER,null),r}var p=["position","positions","a_position"];function x(e,t,r){var n="indices"===r?e.ELEMENT_ARRAY_BUFFER:e.ARRAY_BUFFER;return f(e,m(t,r),n)}},function(e,t,r){"use strict";t.__esModule=!0,t.drawBufferInfo=o,t.drawObjectList=function(e,t){var r=null,i=null;t.forEach(function(t){if(!1!==t.active){var u=t.programInfo,a=t.vertexArrayInfo||t.bufferInfo,f=!1,l=void 0===t.type?e.TRIANGLES:t.type;u!==r&&(r=u,e.useProgram(u.program),f=!0),(f||a!==i)&&(i&&i.vertexArrayObject&&!a.vertexArrayObject&&e.bindVertexArray(null),i=a,n.setBuffersAndAttributes(e,u,a)),n.setUniforms(u,t.uniforms),o(e,a,l,t.count,t.offset,t.instanceCount)}}),i.vertexArrayObject&&e.bindVertexArray(null)};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}(r(3));function o(e,t,r,n,o,i){r=void 0===r?e.TRIANGLES:r;var u=t.indices,a=t.elementType,f=void 0===n?t.numElements:n;o=void 0===o?0:o,a||u?void 0!==i?e.drawElementsInstanced(r,f,void 0===a?e.UNSIGNED_SHORT:t.elementType,o,i):e.drawElements(r,f,void 0===a?e.UNSIGNED_SHORT:t.elementType,o):void 0!==i?e.drawArraysInstanced(r,o,f,i):e.drawArrays(r,o,f)}},function(e,t,r){"use strict";t.__esModule=!0,t.bindFramebufferInfo=function(e,t,r){r=r||e.FRAMEBUFFER,t?(e.bindFramebuffer(r,t.framebuffer),e.viewport(0,0,t.width,t.height)):(e.bindFramebuffer(r,null),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight))},t.createFramebufferInfo=function(e,t,r,i){var c=e.FRAMEBUFFER,s=e.createFramebuffer();e.bindFramebuffer(c,s),r=r||e.drawingBufferWidth,i=i||e.drawingBufferHeight;var y=0,b={framebuffer:s,attachments:[],width:r,height:i};return(t=t||a).forEach(function(t){var a=t.attachment,s=t.format,v=function(e){return f[e]}(s);if(v||(v=u+y++),!a)if(function(e){return l[e]}(s))a=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,a),e.renderbufferStorage(e.RENDERBUFFER,s,r,i);else{var m=Object.assign({},t);m.width=r,m.height=i,void 0===m.auto&&(m.auto=!1,m.min=m.min||m.minMag||e.LINEAR,m.mag=m.mag||m.minMag||e.LINEAR,m.wrapS=m.wrapS||m.wrap||e.CLAMP_TO_EDGE,m.wrapT=m.wrapT||m.wrap||e.CLAMP_TO_EDGE),a=n.createTexture(e,m)}if(o.isRenderbuffer(e,a))e.framebufferRenderbuffer(c,v,e.RENDERBUFFER,a);else{if(!o.isTexture(e,a))throw new Error("unknown attachment type");e.framebufferTexture2D(c,v,t.texTarget||e.TEXTURE_2D,a,t.level||0)}b.attachments.push(a)}),b},t.resizeFramebufferInfo=function(e,t,r,i,u){i=i||e.drawingBufferWidth,u=u||e.drawingBufferHeight,t.width=i,t.height=u,(r=r||a).forEach(function(r,a){var f=t.attachments[a],l=r.format;if(o.isRenderbuffer(e,f))e.bindRenderbuffer(e.RENDERBUFFER,f),e.renderbufferStorage(e.RENDERBUFFER,l,i,u);else{if(!o.isTexture(e,f))throw new Error("unknown attachment type");n.resizeTexture(e,f,r,i,u)}})};var n=i(r(4)),o=i(r(0));function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}var u=36064,a=[{format:6408,type:5121,min:9729,wrap:33071},{format:34041}],f={};f[34041]=33306,f[6401]=36128,f[36168]=36128,f[6402]=36096,f[33189]=36096;var l={};l[32854]=!0,l[32855]=!0,l[36194]=!0,l[34041]=!0,l[33189]=!0,l[6401]=!0,l[36168]=!0},function(e,t,r){"use strict";t.__esModule=!0,t.createVertexArrayInfo=function(e,t,r){var o=e.createVertexArray();e.bindVertexArray(o),t.length||(t=[t]);return t.forEach(function(t){n.setBuffersAndAttributes(e,t,r)}),e.bindVertexArray(null),{numElements:r.numElements,elementType:r.elementType,vertexArrayObject:o}},t.createVAOAndSetAttributes=o,t.createVAOFromBufferInfo=function(e,t,r){return o(e,t.attribSetters||t,r.attribs,r.indices)};var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};n.get||n.set?Object.defineProperty(t,r,n):t[r]=e[r]}return t.default=e,t}(r(3));function o(e,t,r,o){var i=e.createVertexArray();return e.bindVertexArray(i),n.setAttributes(t,r),o&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o),e.bindVertexArray(null),i}}])});