securityos/public/System/Hexells/twgl-full.min.js

8 lines
74 KiB
JavaScript

/**
* Minified by jsDelivr using Terser v3.14.1.
* Original file: /npm/[email protected]/dist/4.x/twgl-full.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.twgl=r():e.twgl=r()}("undefined"!=typeof self?self:this,function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var a in e)t.d(n,a,function(r){return e[r]}.bind(null,a));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s="./src/twgl-full.js")}({"./src/attributes.js":function(e,r,t){"use strict";r.__esModule=!0,r.createAttribsFromArrays=_,r.createBuffersFromArrays=function(e,r){var t={};Object.keys(r).forEach(function(n){t[n]=M(e,r[n],n)}),r.indices?(t.numElements=r.indices.length,t.elementType=n.getGLTypeForTypedArray(O(r.indices),"indices")):t.numElements=function(e){var r,t;for(t=0;t<j.length&&!((r=j[t])in e);++t);t===j.length&&(r=Object.keys(e)[0]);var n=e[r],a=A(n).length,o=T(n,r),i=a/o;if(a%o>0)throw new Error("numComponents ".concat(o," not correct for length ").concat(a));return i}(r);return t},r.createBufferFromArray=M,r.createBufferFromTypedArray=x,r.createBufferInfoFromArrays=function(e,r,t){var a=_(e,r),o=Object.assign({},t||{});o.attribs=Object.assign({},t?t.attribs:{},a);var i=r.indices;if(i){var u=O(i,"indices");o.indices=x(e,u,s),o.numElements=u.length,o.elementType=n.getGLTypeForTypedArray(u)}else o.numElements||(o.numElements=function(e,r){var t,n;for(n=0;n<j.length&&!((t=j[n])in r)&&!((t=h.attribPrefix+t)in r);++n);n===j.length&&(t=Object.keys(r)[0]);var a=r[t];e.bindBuffer(f,a.buffer);var o=e.getBufferParameter(f,c);e.bindBuffer(f,null);var i=(x=a.type,x===l?1:x===p?1:x===m?2:x===y?2:x===d?4:x===v?4:x===b?4:0),u=o/i,s=a.numComponents||a.size,g=u/s;var x;if(g%1!=0)throw new Error("numComponents ".concat(s," not correct for length ").concat(length));return g}(e,o.attribs));return o},r.setAttribInfoBufferFromArray=function(e,r,t,n){t=O(t),void 0!==n?(e.bindBuffer(f,r.buffer),e.bufferSubData(f,n,t)):g(e,f,r.buffer,t,r.drawType)},r.setAttributePrefix=function(e){h.attribPrefix=e},r.setAttributeDefaults_=function(e){a.copyExistingProperties(e,h)},r.getNumComponents_=T,r.getArray_=A;var n=i(t("./src/typedarrays.js")),a=i(t("./src/helper.js"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function i(e){if(e&&e.__esModule)return e;var r=o();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=n?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(t,a,i):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}var u=35044,f=34962,s=34963,c=34660,l=5120,p=5121,m=5122,y=5123,d=5124,v=5125,b=5126,h={attribPrefix:""};function g(e,r,t,n,a){e.bindBuffer(r,t),e.bufferData(r,n,a||u)}function x(e,r,t,n){if(a.isBuffer(e,r))return r;t=t||f;var o=e.createBuffer();return g(e,t,o,r,n),o}function w(e){return"indices"===e}function A(e){return e.length?e:e.data}var P=/coord|texture/i,F=/color|colour/i;function E(e,r){var t;if(r%(t=P.test(e)?2:F.test(e)?4:3)>0)throw new Error("Can not guess numComponents for attribute '".concat(e,"'. Tried ").concat(t," but ").concat(r," values is not evenly divisible by ").concat(t,". You should specify it."));return t}function T(e,r){return e.numComponents||e.size||E(r,A(e).length)}function O(e,r){if(n.isArrayBuffer(e))return e;if(n.isArrayBuffer(e.data))return e.data;Array.isArray(e)&&(e={data:e});var t=e.type;return t||(t=w(r)?Uint16Array:Float32Array),new t(e.data)}function _(e,r){var t={};return Object.keys(r).forEach(function(a){if(!w(a)){var o=r[a],i=o.attrib||o.name||o.attribName||h.attribPrefix+a;if(o.value){if(!Array.isArray(o.value)&&!n.isArrayBuffer(o.value))throw new Error("array.value is not array or typedarray");t[i]={value:o.value}}else{var s,c,l,p;if(o.buffer&&o.buffer instanceof WebGLBuffer)s=o.buffer,p=o.numComponents||o.size,c=o.type,l=o.normalize;else if("number"==typeof o||"number"==typeof o.data){var m=o.data||o,y=o.type||Float32Array,d=m*y.BYTES_PER_ELEMENT;c=n.getGLTypeForTypedArrayType(y),l=void 0!==o.normalize?o.normalize:(b=y)===Int8Array||b===Uint8Array,p=o.numComponents||o.size||E(a,m),s=e.createBuffer(),e.bindBuffer(f,s),e.bufferData(f,d,o.drawType||u)}else{var v=O(o,a);s=x(e,v,void 0,o.drawType),c=n.getGLTypeForTypedArray(v),l=void 0!==o.normalize?o.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(v),p=T(o,a)}t[i]={buffer:s,numComponents:p,type:c,normalize:l,stride:o.stride||0,offset:o.offset||0,divisor:void 0===o.divisor?void 0:o.divisor,drawType:o.drawType}}}var b}),e.bindBuffer(f,null),t}var j=["position","positions","a_position"];function M(e,r,t){var n="indices"===t?s:f;return x(e,O(r,t),n)}},"./src/draw.js":function(e,r,t){"use strict";r.__esModule=!0,r.drawBufferInfo=u,r.drawObjectList=function(e,r){var t=null,a=null;r.forEach(function(r){if(!1!==r.active){var i=r.programInfo,f=r.vertexArrayInfo||r.bufferInfo,s=!1,c=void 0===r.type?o:r.type;i!==t&&(t=i,e.useProgram(i.program),s=!0),(s||f!==a)&&(a&&a.vertexArrayObject&&!f.vertexArrayObject&&e.bindVertexArray(null),a=f,n.setBuffersAndAttributes(e,i,f)),n.setUniforms(i,r.uniforms),u(e,f,c,r.count,r.offset,r.instanceCount)}}),a&&a.vertexArrayObject&&e.bindVertexArray(null)};var n=function(e){if(e&&e.__esModule)return e;var r=a();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}}t.default=e,r&&r.set(e,t);return t}(t("./src/programs.js"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}var o=4,i=5123;function u(e,r,t,n,a,u){t=void 0===t?o:t;var f=r.indices,s=r.elementType,c=void 0===n?r.numElements:n;a=void 0===a?0:a,s||f?void 0!==u?e.drawElementsInstanced(t,c,void 0===s?i:r.elementType,a,u):e.drawElements(t,c,void 0===s?i:r.elementType,a):void 0!==u?e.drawArraysInstanced(t,a,c,u):e.drawArrays(t,a,c)}},"./src/framebuffers.js":function(e,r,t){"use strict";r.__esModule=!0,r.bindFramebufferInfo=function(e,r,t){t=t||u,r?(e.bindFramebuffer(t,r.framebuffer),e.viewport(0,0,r.width,r.height)):(e.bindFramebuffer(t,null),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight))},r.createFramebufferInfo=function(e,r,t,o){var i=u,v=e.createFramebuffer();e.bindFramebuffer(i,v),t=t||e.drawingBufferWidth,o=o||e.drawingBufferHeight;var b=0,h={framebuffer:v,attachments:[],width:t,height:o};return(r=r||m).forEach(function(r){var u=r.attachment,m=r.format,v=function(e){return y[e]}(m);if(v||(v=c+b++),!u)if(function(e){return d[e]}(m))u=e.createRenderbuffer(),e.bindRenderbuffer(f,u),e.renderbufferStorage(f,m,t,o);else{var g=Object.assign({},r);g.width=t,g.height=o,void 0===g.auto&&(g.auto=!1,g.min=g.min||g.minMag||p,g.mag=g.mag||g.minMag||p,g.wrapS=g.wrapS||g.wrap||l,g.wrapT=g.wrapT||g.wrap||l),u=n.createTexture(e,g)}if(a.isRenderbuffer(e,u))e.framebufferRenderbuffer(i,v,f,u);else{if(!a.isTexture(e,u))throw new Error("unknown attachment type");void 0!==r.layer?e.framebufferTextureLayer(i,v,u,r.level||0,r.layer):e.framebufferTexture2D(i,v,r.texTarget||s,u,r.level||0)}h.attachments.push(u)}),h},r.resizeFramebufferInfo=function(e,r,t,o,i){o=o||e.drawingBufferWidth,i=i||e.drawingBufferHeight,r.width=o,r.height=i,(t=t||m).forEach(function(t,u){var s=r.attachments[u],c=t.format;if(a.isRenderbuffer(e,s))e.bindRenderbuffer(f,s),e.renderbufferStorage(f,c,o,i);else{if(!a.isTexture(e,s))throw new Error("unknown attachment type");n.resizeTexture(e,s,t,o,i)}})};var n=i(t("./src/textures.js")),a=i(t("./src/helper.js"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function i(e){if(e&&e.__esModule)return e;var r=o();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=n?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(t,a,i):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}var u=36160,f=36161,s=3553,c=36064,l=33071,p=9729,m=[{format:6408,type:5121,min:p,wrap:l},{format:34041}],y={};y[34041]=33306,y[6401]=36128,y[36168]=36128,y[6402]=36096,y[33189]=36096;var d={};d[32854]=!0,d[32855]=!0,d[36194]=!0,d[34041]=!0,d[33189]=!0,d[6401]=!0,d[36168]=!0},"./src/helper.js":function(e,r,t){"use strict";r.__esModule=!0,r.copyExistingProperties=function(e,r){Object.keys(r).forEach(function(t){r.hasOwnProperty(t)&&e.hasOwnProperty(t)&&(r[t]=e[t])})},r.copyNamedProperties=function(e,r,t){e.forEach(function(e){var n=r[e];void 0!==n&&(t[e]=n)})},r.error=function(){var e;(e=console).error.apply(e,arguments)},r.warn=function(){var e;(e=console).warn.apply(e,arguments)},r.isBuffer=function(e,r){return"undefined"!=typeof WebGLBuffer&&r instanceof WebGLBuffer},r.isRenderbuffer=function(e,r){return"undefined"!=typeof WebGLRenderbuffer&&r instanceof WebGLRenderbuffer},r.isShader=function(e,r){return"undefined"!=typeof WebGLShader&&r instanceof WebGLShader},r.isTexture=function(e,r){return"undefined"!=typeof WebGLTexture&&r instanceof WebGLTexture},r.isSampler=function(e,r){return"undefined"!=typeof WebGLSampler&&r instanceof WebGLSampler}},"./src/m4.js":function(e,r,t){"use strict";r.__esModule=!0,r.axisRotate=function(e,r,t,n){n=n||new f(16);var a=r[0],o=r[1],i=r[2],u=Math.sqrt(a*a+o*o+i*i),s=(a/=u)*a,c=(o/=u)*o,l=(i/=u)*i,p=Math.cos(t),m=Math.sin(t),y=1-p,d=s+(1-s)*p,v=a*o*y+i*m,b=a*i*y-o*m,h=a*o*y-i*m,g=c+(1-c)*p,x=o*i*y+a*m,w=a*i*y+o*m,A=o*i*y-a*m,P=l+(1-l)*p,F=e[0],E=e[1],T=e[2],O=e[3],_=e[4],j=e[5],M=e[6],S=e[7],B=e[8],k=e[9],C=e[10],I=e[11];n[0]=d*F+v*_+b*B,n[1]=d*E+v*j+b*k,n[2]=d*T+v*M+b*C,n[3]=d*O+v*S+b*I,n[4]=h*F+g*_+x*B,n[5]=h*E+g*j+x*k,n[6]=h*T+g*M+x*C,n[7]=h*O+g*S+x*I,n[8]=w*F+A*_+P*B,n[9]=w*E+A*j+P*k,n[10]=w*T+A*M+P*C,n[11]=w*O+A*S+P*I,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]);return n},r.axisRotation=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=Math.sqrt(n*n+a*a+o*o),u=(n/=i)*n,s=(a/=i)*a,c=(o/=i)*o,l=Math.cos(r),p=Math.sin(r),m=1-l;return t[0]=u+(1-u)*l,t[1]=n*a*m+o*p,t[2]=n*o*m-a*p,t[3]=0,t[4]=n*a*m-o*p,t[5]=s+(1-s)*l,t[6]=a*o*m+n*p,t[7]=0,t[8]=n*o*m+a*p,t[9]=a*o*m-n*p,t[10]=c+(1-c)*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},r.copy=s,r.frustum=function(e,r,t,n,a,o,i){i=i||new f(16);var u=r-e,s=n-t,c=a-o;return i[0]=2*a/u,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2*a/s,i[6]=0,i[7]=0,i[8]=(e+r)/u,i[9]=(n+t)/s,i[10]=o/c,i[11]=-1,i[12]=0,i[13]=0,i[14]=a*o/c,i[15]=0,i},r.getAxis=function(e,r,t){t=t||n.create();var a=4*r;return t[0]=e[a+0],t[1]=e[a+1],t[2]=e[a+2],t},r.getTranslation=function(e,r){return(r=r||n.create())[0]=e[12],r[1]=e[13],r[2]=e[14],r},r.identity=c,r.inverse=l,r.lookAt=function(e,r,t,a){return a=a||new f(16),o=o||n.create(),i=i||n.create(),u=u||n.create(),n.normalize(n.subtract(e,r,u),u),n.normalize(n.cross(t,u,o),o),n.normalize(n.cross(u,o,i),i),a[0]=o[0],a[1]=o[1],a[2]=o[2],a[3]=0,a[4]=i[0],a[5]=i[1],a[6]=i[2],a[7]=0,a[8]=u[0],a[9]=u[1],a[10]=u[2],a[11]=0,a[12]=e[0],a[13]=e[1],a[14]=e[2],a[15]=1,a},r.multiply=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=e[3],u=e[4],s=e[5],c=e[6],l=e[7],p=e[8],m=e[9],y=e[10],d=e[11],v=e[12],b=e[13],h=e[14],g=e[15],x=r[0],w=r[1],A=r[2],P=r[3],F=r[4],E=r[5],T=r[6],O=r[7],_=r[8],j=r[9],M=r[10],S=r[11],B=r[12],k=r[13],C=r[14],I=r[15];return t[0]=n*x+u*w+p*A+v*P,t[1]=a*x+s*w+m*A+b*P,t[2]=o*x+c*w+y*A+h*P,t[3]=i*x+l*w+d*A+g*P,t[4]=n*F+u*E+p*T+v*O,t[5]=a*F+s*E+m*T+b*O,t[6]=o*F+c*E+y*T+h*O,t[7]=i*F+l*E+d*T+g*O,t[8]=n*_+u*j+p*M+v*S,t[9]=a*_+s*j+m*M+b*S,t[10]=o*_+c*j+y*M+h*S,t[11]=i*_+l*j+d*M+g*S,t[12]=n*B+u*k+p*C+v*I,t[13]=a*B+s*k+m*C+b*I,t[14]=o*B+c*k+y*C+h*I,t[15]=i*B+l*k+d*C+g*I,t},r.negate=function(e,r){return(r=r||new f(16))[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r[4]=-e[4],r[5]=-e[5],r[6]=-e[6],r[7]=-e[7],r[8]=-e[8],r[9]=-e[9],r[10]=-e[10],r[11]=-e[11],r[12]=-e[12],r[13]=-e[13],r[14]=-e[14],r[15]=-e[15],r},r.ortho=function(e,r,t,n,a,o,i){return(i=i||new f(16))[0]=2/(r-e),i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=2/(n-t),i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2/(a-o),i[11]=0,i[12]=(r+e)/(e-r),i[13]=(n+t)/(t-n),i[14]=(o+a)/(a-o),i[15]=1,i},r.perspective=function(e,r,t,n,a){a=a||new f(16);var o=Math.tan(.5*Math.PI-.5*e),i=1/(t-n);return a[0]=o/r,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(t+n)*i,a[11]=-1,a[12]=0,a[13]=0,a[14]=t*n*i*2,a[15]=0,a},r.rotateX=function(e,r,t){t=t||new f(16);var n=e[4],a=e[5],o=e[6],i=e[7],u=e[8],s=e[9],c=e[10],l=e[11],p=Math.cos(r),m=Math.sin(r);t[4]=p*n+m*u,t[5]=p*a+m*s,t[6]=p*o+m*c,t[7]=p*i+m*l,t[8]=p*u-m*n,t[9]=p*s-m*a,t[10]=p*c-m*o,t[11]=p*l-m*i,e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.rotateY=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=e[3],u=e[8],s=e[9],c=e[10],l=e[11],p=Math.cos(r),m=Math.sin(r);t[0]=p*n-m*u,t[1]=p*a-m*s,t[2]=p*o-m*c,t[3]=p*i-m*l,t[8]=p*u+m*n,t[9]=p*s+m*a,t[10]=p*c+m*o,t[11]=p*l+m*i,e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.rotateZ=function(e,r,t){t=t||new f(16);var n=e[0],a=e[1],o=e[2],i=e[3],u=e[4],s=e[5],c=e[6],l=e[7],p=Math.cos(r),m=Math.sin(r);t[0]=p*n+m*u,t[1]=p*a+m*s,t[2]=p*o+m*c,t[3]=p*i+m*l,t[4]=p*u-m*n,t[5]=p*s-m*a,t[6]=p*c-m*o,t[7]=p*l-m*i,e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.rotationX=function(e,r){r=r||new f(16);var t=Math.cos(e),n=Math.sin(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t,r[6]=n,r[7]=0,r[8]=0,r[9]=-n,r[10]=t,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.rotationY=function(e,r){r=r||new f(16);var t=Math.cos(e),n=Math.sin(e);return r[0]=t,r[1]=0,r[2]=-n,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=n,r[9]=0,r[10]=t,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.rotationZ=function(e,r){r=r||new f(16);var t=Math.cos(e),n=Math.sin(e);return r[0]=t,r[1]=n,r[2]=0,r[3]=0,r[4]=-n,r[5]=t,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.scale=function(e,r,t){t=t||new f(16);var n=r[0],a=r[1],o=r[2];t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=n*e[3],t[4]=a*e[4],t[5]=a*e[5],t[6]=a*e[6],t[7]=a*e[7],t[8]=o*e[8],t[9]=o*e[9],t[10]=o*e[10],t[11]=o*e[11],e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t},r.scaling=function(e,r){return(r=r||new f(16))[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},r.setAxis=function(e,r,t,n){n!==e&&(n=s(e,n));var a=4*t;return n[a+0]=r[0],n[a+1]=r[1],n[a+2]=r[2],n},r.setDefaultType=function(e){var r=f;return f=e,r},r.setTranslation=function(e,r,t){t=t||c(),e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11]);return t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},r.transformDirection=function(e,r,t){t=t||n.create();var a=r[0],o=r[1],i=r[2];return t[0]=a*e[0]+o*e[4]+i*e[8],t[1]=a*e[1]+o*e[5]+i*e[9],t[2]=a*e[2]+o*e[6]+i*e[10],t},r.transformNormal=function(e,r,t){t=t||n.create();var a=l(e),o=r[0],i=r[1],u=r[2];return t[0]=o*a[0]+i*a[1]+u*a[2],t[1]=o*a[4]+i*a[5]+u*a[6],t[2]=o*a[8]+i*a[9]+u*a[10],t},r.transformPoint=function(e,r,t){t=t||n.create();var a=r[0],o=r[1],i=r[2],u=a*e[3]+o*e[7]+i*e[11]+e[15];return t[0]=(a*e[0]+o*e[4]+i*e[8]+e[12])/u,t[1]=(a*e[1]+o*e[5]+i*e[9]+e[13])/u,t[2]=(a*e[2]+o*e[6]+i*e[10]+e[14])/u,t},r.translate=function(e,r,t){t=t||new f(16);var n=r[0],a=r[1],o=r[2],i=e[0],u=e[1],s=e[2],c=e[3],l=e[4],p=e[5],m=e[6],y=e[7],d=e[8],v=e[9],b=e[10],h=e[11],g=e[12],x=e[13],w=e[14],A=e[15];e!==t&&(t[0]=i,t[1]=u,t[2]=s,t[3]=c,t[4]=l,t[5]=p,t[6]=m,t[7]=y,t[8]=d,t[9]=v,t[10]=b,t[11]=h);return t[12]=i*n+l*a+d*o+g,t[13]=u*n+p*a+v*o+x,t[14]=s*n+m*a+b*o+w,t[15]=c*n+y*a+h*o+A,t},r.translation=function(e,r){return(r=r||new f(16))[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r},r.transpose=function(e,r){if((r=r||new f(16))===e){var t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,r}var n=e[0],a=e[1],o=e[2],i=e[3],u=e[4],s=e[5],c=e[6],l=e[7],p=e[8],m=e[9],y=e[10],d=e[11],v=e[12],b=e[13],h=e[14],g=e[15];return r[0]=n,r[1]=u,r[2]=p,r[3]=v,r[4]=a,r[5]=s,r[6]=m,r[7]=b,r[8]=o,r[9]=c,r[10]=y,r[11]=h,r[12]=i,r[13]=l,r[14]=d,r[15]=g,r};var n=function(e){if(e&&e.__esModule)return e;var r=a();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}}t.default=e,r&&r.set(e,t);return t}(t("./src/v3.js"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}var o,i,u,f=Float32Array;function s(e,r){return(r=r||new f(16))[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function c(e){return(e=e||new f(16))[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function l(e,r){r=r||new f(16);var t=e[0],n=e[1],a=e[2],o=e[3],i=e[4],u=e[5],s=e[6],c=e[7],l=e[8],p=e[9],m=e[10],y=e[11],d=e[12],v=e[13],b=e[14],h=e[15],g=m*h,x=b*y,w=s*h,A=b*c,P=s*y,F=m*c,E=a*h,T=b*o,O=a*y,_=m*o,j=a*c,M=s*o,S=l*v,B=d*p,k=i*v,C=d*u,I=i*p,z=l*u,R=t*v,D=d*n,U=t*p,L=l*n,W=t*u,V=i*n,G=g*u+A*p+P*v-(x*u+w*p+F*v),N=x*n+E*p+_*v-(g*n+T*p+O*v),X=w*n+T*u+j*v-(A*n+E*u+M*v),Y=F*n+O*u+M*p-(P*n+_*u+j*p),q=1/(t*G+i*N+l*X+d*Y);return r[0]=q*G,r[1]=q*N,r[2]=q*X,r[3]=q*Y,r[4]=q*(x*i+w*l+F*d-(g*i+A*l+P*d)),r[5]=q*(g*t+T*l+O*d-(x*t+E*l+_*d)),r[6]=q*(A*t+E*i+M*d-(w*t+T*i+j*d)),r[7]=q*(P*t+_*i+j*l-(F*t+O*i+M*l)),r[8]=q*(S*c+C*y+I*h-(B*c+k*y+z*h)),r[9]=q*(B*o+R*y+L*h-(S*o+D*y+U*h)),r[10]=q*(k*o+D*c+W*h-(C*o+R*c+V*h)),r[11]=q*(z*o+U*c+V*y-(I*o+L*c+W*y)),r[12]=q*(k*m+z*b+B*s-(I*b+S*s+C*m)),r[13]=q*(U*b+S*a+D*m-(R*m+L*b+B*a)),r[14]=q*(R*s+V*b+C*a-(W*b+k*a+D*s)),r[15]=q*(W*m+I*a+L*s-(U*s+V*m+z*a)),r}},"./src/primitives.js":function(e,r,t){"use strict";r.__esModule=!0,r.create3DFVertices=_,r.createAugmentedTypedArray=m,r.createCubeVertices=E,r.createPlaneVertices=A,r.createSphereVertices=P,r.createTruncatedConeVertices=T,r.createXYQuadVertices=w,r.createCrescentVertices=j,r.createCylinderVertices=M,r.createTorusVertices=S,r.createDiscVertices=B,r.deindexVertices=function(e){var r=e.indices,t={},n=r.length;return Object.keys(e).filter(y).forEach(function(a){for(var o=e[a],i=o.numComponents,u=m(i,n,o.constructor),f=0;f<n;++f)for(var s=r[f],c=s*i,l=0;l<i;++l)u.push(o[c+l]);t[a]=u}),t},r.flattenNormals=function(e){if(e.indices)throw new Error("can not flatten normals of indexed vertices. deindex them first");for(var r=e.normal,t=r.length,n=0;n<t;n+=9){var a=r[n+0],o=r[n+1],i=r[n+2],u=r[n+3],f=r[n+4],s=r[n+5],c=r[n+6],l=r[n+7],p=r[n+8],m=a+u+c,y=o+f+l,d=i+s+p,v=Math.sqrt(m*m+y*y+d*d);m/=v,y/=v,d/=v,r[n+0]=m,r[n+1]=y,r[n+2]=d,r[n+3]=m,r[n+4]=y,r[n+5]=d,r[n+6]=m,r[n+7]=y,r[n+8]=d}return e},r.makeRandomVertexColors=function(e,r){r=r||{};var t=e.position.numElements,n=m(4,t,Uint8Array),a=r.rand||function(e,r){return r<3?(t=256,Math.random()*t|0):255;};if(e.color=n,e.indices)for(var o=0;o<t;++o)n.push(a(o,0),a(o,1),a(o,2),a(o,3));else for(var i=r.vertsPerColor||3,u=t/i,f=0;f<u;++f)for(var s=[a(f,0),a(f,1),a(f,2),a(f,3)],c=0;c<i;++c)n.push(s);return e},r.reorientDirections=b,r.reorientNormals=h,r.reorientPositions=g,r.reorientVertices=x,r.concatVertices=function(e){for(var r,t={},n=function(n){var a=e[n];Object.keys(a).forEach(function(e){t[e]||(t[e]=[]),r||"indices"===e||(r=e);var n=a[e],o=l(n,e),i=c(n),u=i.length/o;t[e].push(u)})},a=0;a<e.length;++a)n(a);var o=t[r],i={};return Object.keys(t).forEach(function(r){var t=function(r){for(var t,n=0,a=0;a<e.length;++a){var o=e[a],i=o[r],u=c(i);n+=u.length,t&&!i.data||(t=i)}return{length:n,spec:t}}(r),n=R(t.spec,t.length);!function(r,t,n){for(var a=0,o=0,i=0;i<e.length;++i){var u=e[i],f=u[r],s=c(f);"indices"===r?(z(s,n,o,a),a+=t[i]):z(s,n,o),o+=s.length}}(r,o,c(n)),i[r]=n}),i},r.duplicateVertices=function(e){var r={};return Object.keys(e).forEach(function(t){var n=e[t],a=c(n),o=R(n,a.length);z(a,c(o),0),r[t]=o}),r},r.createDiscBuffers=r.createDiscBufferInfo=r.createTorusBuffers=r.createTorusBufferInfo=r.createCylinderBuffers=r.createCylinderBufferInfo=r.createCrescentBuffers=r.createCrescentBufferInfo=r.createCresentVertices=r.createCresentBuffers=r.createCresentBufferInfo=r.createXYQuadBuffers=r.createXYQuadBufferInfo=r.createTruncatedConeBuffers=r.createTruncatedConeBufferInfo=r.createSphereBuffers=r.createSphereBufferInfo=r.createPlaneBuffers=r.createPlaneBufferInfo=r.createCubeBuffers=r.createCubeBufferInfo=r.create3DFBuffers=r.create3DFBufferInfo=void 0;var n=s(t("./src/attributes.js")),a=s(t("./src/helper.js")),o=s(t("./src/typedarrays.js")),i=s(t("./src/m4.js")),u=s(t("./src/v3.js"));function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function s(e){if(e&&e.__esModule)return e;var r=f();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(t,a,o):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}var c=n.getArray_,l=n.getNumComponents_;function p(e,r){var t=0;return e.push=function(){for(var r=0;r<arguments.length;++r){var n=arguments[r];if(n instanceof Array||o.isArrayBuffer(n))for(var a=0;a<n.length;++a)e[t++]=n[a];else e[t++]=n}},e.reset=function(e){t=e||0},e.numComponents=r,Object.defineProperty(e,"numElements",{get:function(){return this.length/this.numComponents|0}}),e}function m(e,r,t){return p(new(t||Float32Array)(e*r),e)}function y(e){return"indices"!==e}function d(e,r,t){for(var n=e.length,a=new Float32Array(3),o=0;o<n;o+=3)t(r,[e[o],e[o+1],e[o+2]],a),e[o]=a[0],e[o+1]=a[1],e[o+2]=a[2]}function v(e,r,t){t=t||u.create();var n=r[0],a=r[1],o=r[2];return t[0]=n*e[0]+a*e[1]+o*e[2],t[1]=n*e[4]+a*e[5]+o*e[6],t[2]=n*e[8]+a*e[9]+o*e[10],t}function b(e,r){return d(e,r,i.transformDirection),e}function h(e,r){return d(e,i.inverse(r),v),e}function g(e,r){return d(e,r,i.transformPoint),e}function x(e,r){return Object.keys(e).forEach(function(t){var n=e[t];t.indexOf("pos")>=0?g(n,r):t.indexOf("tan")>=0||t.indexOf("binorm")>=0?b(n,r):t.indexOf("norm")>=0&&h(n,r)}),e}function w(e,r,t){return e=e||2,{position:{numComponents:2,data:[(r=r||0)+-1*(e*=.5),(t=t||0)+-1*e,r+1*e,t+-1*e,r+-1*e,t+1*e,r+1*e,t+1*e]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function A(e,r,t,n,a){e=e||1,r=r||1,t=t||1,n=n||1,a=a||i.identity();for(var o=(t+1)*(n+1),u=m(3,o),f=m(3,o),s=m(2,o),c=0;c<=n;c++)for(var l=0;l<=t;l++){var p=l/t,y=c/n;u.push(e*p-.5*e,0,r*y-.5*r),f.push(0,1,0),s.push(p,y)}for(var d=t+1,v=m(3,t*n*2,Uint16Array),b=0;b<n;b++)for(var h=0;h<t;h++)v.push((b+0)*d+h,(b+1)*d+h,(b+0)*d+h+1),v.push((b+1)*d+h,(b+1)*d+h+1,(b+0)*d+h+1);return x({position:u,normal:f,texcoord:s,indices:v},a)}function P(e,r,t,n,a,o,i){if(r<=0||t<=0)throw new Error("subdivisionAxis and subdivisionHeight must be > 0");n=n||0,o=o||0;for(var u=(a=a||Math.PI)-n,f=(i=i||2*Math.PI)-o,s=(r+1)*(t+1),c=m(3,s),l=m(3,s),p=m(2,s),y=0;y<=t;y++)for(var d=0;d<=r;d++){var v=d/r,b=y/t,h=f*v+o,g=u*b+n,x=Math.sin(h),w=Math.cos(h),A=Math.sin(g),P=w*A,F=Math.cos(g),E=x*A;c.push(e*P,e*F,e*E),l.push(P,F,E),p.push(1-v,b)}for(var T=r+1,O=m(3,r*t*2,Uint16Array),_=0;_<r;_++)for(var j=0;j<t;j++)O.push((j+0)*T+_,(j+0)*T+_+1,(j+1)*T+_),O.push((j+1)*T+_,(j+0)*T+_+1,(j+1)*T+_+1);return{position:c,normal:l,texcoord:p,indices:O}}var F=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function E(e){for(var r=(e=e||1)/2,t=[[-r,-r,-r],[+r,-r,-r],[-r,+r,-r],[+r,+r,-r],[-r,-r,+r],[+r,-r,+r],[-r,+r,+r],[+r,+r,+r]],n=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],a=[[1,0],[0,0],[0,1],[1,1]],o=m(3,24),i=m(3,24),u=m(2,24),f=m(3,12,Uint16Array),s=0;s<6;++s){for(var c=F[s],l=0;l<4;++l){var p=t[c[l]],y=n[s],d=a[l];o.push(p),i.push(y),u.push(d)}var v=4*s;f.push(v+0,v+1,v+2),f.push(v+0,v+2,v+3)}return{position:o,normal:i,texcoord:u,indices:f}}function T(e,r,t,n,a,o,i){if(n<3)throw new Error("radialSubdivisions must be 3 or greater");if(a<1)throw new Error("verticalSubdivisions must be 1 or greater");for(var u=void 0===o||o,f=void 0===i||i,s=(u?2:0)+(f?2:0),c=(n+1)*(a+1+s),l=m(3,c),p=m(3,c),y=m(2,c),d=m(3,n*(a+s/2)*2,Uint16Array),v=n+1,b=Math.atan2(e-r,t),h=Math.cos(b),g=Math.sin(b),x=a+(f?2:0),w=u?-2:0;w<=x;++w){var A=w/a,P=t*A,F=void 0;w<0?(P=0,A=1,F=e):w>a?(P=t,A=1,F=r):F=e+w/a*(r-e),-2!==w&&w!==a+2||(F=0,A=0),P-=t/2;for(var E=0;E<v;++E){var T=Math.sin(E*Math.PI*2/n),O=Math.cos(E*Math.PI*2/n);l.push(T*F,P,O*F),w<0?p.push(0,-1,0):w>a?p.push(0,1,0):0===F?p.push(0,0,0):p.push(T*h,g,O*h),y.push(E/n,1-A)}}for(var _=0;_<a+s;++_)if(!(1===_&&u||_===a+s-2&&f))for(var j=0;j<n;++j)d.push(v*(_+0)+0+j,v*(_+0)+1+j,v*(_+1)+1+j),d.push(v*(_+0)+0+j,v*(_+1)+1+j,v*(_+1)+0+j);return{position:l,normal:p,texcoord:y,indices:d}}function O(e,r){r=r||[];for(var t=[],n=0;n<e.length;n+=4){var a=e[n],o=e.slice(n+1,n+4);o.push.apply(o,r);for(var i=0;i<a;++i)t.push.apply(t,o)}return t}function _(){var e=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],r=O([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),t=O([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),n=e.length/3,a={position:m(3,n),texcoord:m(2,n),normal:m(3,n),color:m(4,n,Uint8Array),indices:m(3,n/3,Uint16Array)};a.position.push(e),a.texcoord.push([.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0]),a.normal.push(r),a.color.push(t);for(var o=0;o<n;++o)a.indices.push(o);return a}function j(e,r,t,n,a,o,i){if(a<=0)throw new Error("subdivisionDown must be > 0");var f=2,s=(i=i||1)-(o=o||0),c=2*(a+1)*(2+f),l=m(3,c),p=m(3,c),y=m(2,c);function d(e,r,t){return e+(r-e)*t}function v(r,t,i,c,m,v){for(var b=0;b<=a;b++){var h=t/(f-1),g=b/a,x=2*(h-.5),w=(o+g*s)*Math.PI,A=Math.sin(w),P=Math.cos(w),F=d(e,r,A),E=x*n,T=P*e,O=A*F;l.push(E,T,O);var _=u.add(u.multiply([0,A,P],i),c);p.push(_),y.push(h*m+v,g)}}for(var b=0;b<f;b++){var h=2*(b/(f-1)-.5);v(r,b,[1,1,1],[0,0,0],1,0),v(r,b,[0,0,0],[h,0,0],0,0),v(t,b,[1,1,1],[0,0,0],1,0),v(t,b,[0,0,0],[h,0,0],0,1)}var g=m(3,2*a*(2+f),Uint16Array);function x(e,r){for(var t=0;t<a;++t)g.push(e+t+0,e+t+1,r+t+0),g.push(e+t+1,r+t+1,r+t+0)}var w=a+1;return x(0*w,4*w),x(5*w,7*w),x(6*w,2*w),x(3*w,1*w),{position:l,normal:p,texcoord:y,indices:g}}function M(e,r,t,n,a,o){return T(e,e,r,t,n,a,o)}function S(e,r,t,n,a,o){if(t<3)throw new Error("radialSubdivisions must be 3 or greater");if(n<3)throw new Error("verticalSubdivisions must be 3 or greater");a=a||0;for(var i=(o=o||2*Math.PI)-a,u=t+1,f=n+1,s=u*f,c=m(3,s),l=m(3,s),p=m(2,s),y=m(3,t*n*2,Uint16Array),d=0;d<f;++d)for(var v=d/n,b=v*Math.PI*2,h=Math.sin(b),g=e+h*r,x=Math.cos(b),w=x*r,A=0;A<u;++A){var P=A/t,F=a+P*i,E=Math.sin(F),T=Math.cos(F),O=E*g,_=T*g,j=E*h,M=T*h;c.push(O,w,_),l.push(j,x,M),p.push(P,1-v)}for(var S=0;S<n;++S)for(var B=0;B<t;++B){var k=1+B,C=1+S;y.push(u*S+B,u*C+B,u*S+k),y.push(u*C+B,u*C+k,u*S+k)}return{position:c,normal:l,texcoord:p,indices:y}}function B(e,r,t,n,a){if(r<3)throw new Error("divisions must be at least 3");a=a||1,n=n||0;for(var o=(r+1)*((t=t||1)+1),i=m(3,o),u=m(3,o),f=m(2,o),s=m(3,t*r*2,Uint16Array),c=0,l=e-n,p=r+1,y=0;y<=t;++y){for(var d=n+l*Math.pow(y/t,a),v=0;v<=r;++v){var b=2*Math.PI*v/r,h=d*Math.cos(b),g=d*Math.sin(b);if(i.push(h,0,g),u.push(0,1,0),f.push(1-v/r,y/t),y>0&&v!==r){var x=c+(v+1),w=c+v,A=c+v-p,P=c+(v+1)-p;s.push(x,w,A),s.push(x,A,P)}}c+=r+1}return{position:i,normal:u,texcoord:f,indices:s}}function k(e){return function(r){var t=e.apply(this,Array.prototype.slice.call(arguments,1));return n.createBuffersFromArrays(r,t)}}function C(e){return function(r){var t=e.apply(null,Array.prototype.slice.call(arguments,1));return n.createBufferInfoFromArrays(r,t)}}var I=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function z(e,r,t,n){n=n||0;for(var a=e.length,o=0;o<a;++o)r[t+o]=e[o]+n}function R(e,r){var t=c(e),n=new t.constructor(r),o=n;return t.numComponents&&t.numElements&&p(n,t.numComponents),e.data&&(o={data:n},a.copyNamedProperties(I,e,o)),o}var D=C(_);r.create3DFBufferInfo=D;var U=k(_);r.create3DFBuffers=U;var L=C(E);r.createCubeBufferInfo=L;var W=k(E);r.createCubeBuffers=W;var V=C(A);r.createPlaneBufferInfo=V;var G=k(A);r.createPlaneBuffers=G;var N=C(P);r.createSphereBufferInfo=N;var X=k(P);r.createSphereBuffers=X;var Y=C(T);r.createTruncatedConeBufferInfo=Y;var q=k(T);r.createTruncatedConeBuffers=q;var H=C(w);r.createXYQuadBufferInfo=H;var Q=k(w);r.createXYQuadBuffers=Q;var Z=C(j);r.createCrescentBufferInfo=Z;var K=k(j);r.createCrescentBuffers=K;var $=C(M);r.createCylinderBufferInfo=$;var J=k(M);r.createCylinderBuffers=J;var ee=C(S);r.createTorusBufferInfo=ee;var re=k(S);r.createTorusBuffers=re;var te=C(B);r.createDiscBufferInfo=te;var ne=k(B);r.createDiscBuffers=ne;var ae=Z;r.createCresentBufferInfo=ae;var oe=K;r.createCresentBuffers=oe;var ie=j;r.createCresentVertices=ie},"./src/programs.js":function(e,r,t){"use strict";r.__esModule=!0,r.createAttributeSetters=pe,r.createProgram=J,r.createProgramFromScripts=function(e,r,t,n,a){for(var o=Q(t,n,a),i=[],u=0;u<r.length;++u){var f=ee(e,r[u],e[Z[u]],o.errorCallback);if(!f)return null;i.push(f)}return J(e,i,o)},r.createProgramFromSources=re,r.createProgramInfo=function(e,r,t,n,a){var o=Q(t,n,a),i=!0;if(r=r.map(function(e){if(e.indexOf("\n")<0){var r=s(e);r?e=r.text:(o.errorCallback("no element with id: "+e),i=!1)}return e}),!i)return null;var u=re(e,r,o);if(!u)return null;return ye(e,u)},r.createProgramInfoFromProgram=ye,r.createUniformSetters=ne,r.createUniformBlockSpecFromProgram=ie,r.createUniformBlockInfoFromProgram=fe,r.createUniformBlockInfo=function(e,r,t){return fe(e,r.program,r.uniformBlockSpec,t)},r.createTransformFeedback=function(e,r,t){var n=e.createTransformFeedback();return e.bindTransformFeedback(v,n),e.useProgram(r.program),oe(e,r,t),e.bindTransformFeedback(v,null),n},r.createTransformFeedbackInfo=ae,r.bindTransformFeedbackInfo=oe,r.setAttributes=me,r.setBuffersAndAttributes=function(e,r,t){t.vertexArrayObject?e.bindVertexArray(t.vertexArrayObject):(me(r.attribSetters||r,t.attribs),t.indices&&e.bindBuffer(m,t.indices))},r.setUniforms=ce,r.setUniformBlock=function(e,r,t){se(e,r,t)&&e.bufferData(y,t.array,l)},r.setBlockUniforms=function(e,r){var t=e.uniforms;for(var n in r){var a=t[n];if(a){var o=r[n];o.length?a.set(o):a[0]=o}}},r.bindUniformBlock=se,r.setUniformsAndBindTextures=void 0;var n=i(t("./src/utils.js")),a=i(t("./src/helper.js"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function i(e){if(e&&e.__esModule)return e;var r=o();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=n?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(t,a,i):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}var u=a.error,f=a.warn;function s(e){return"undefined"!=typeof document&&document.getElementById?document.getElementById(e):null}var c=33984,l=35048,p=34962,m=34963,y=35345,d=35982,v=36386,b=35713,h=35714,g=35632,x=35633,w=35981,A=35718,P=35721,F=35971,E=35382,T=35396,O=35398,_=35392,j=35395,M=5126,S=5124,B=5125,k={};function C(e,r){return k[r].bindPoint}function I(e,r){return function(t){e.uniform1i(r,t)}}function z(e,r){return function(t){e.uniform1iv(r,t)}}function R(e,r){return function(t){e.uniform2iv(r,t)}}function D(e,r){return function(t){e.uniform3iv(r,t)}}function U(e,r){return function(t){e.uniform4iv(r,t)}}function L(e,r,t,o){var i=C(0,r);return n.isWebGL2(e)?function(r){var n,u;a.isTexture(e,r)?(n=r,u=null):(n=r.texture,u=r.sampler),e.uniform1i(o,t),e.activeTexture(c+t),e.bindTexture(i,n),e.bindSampler(t,u)}:function(r){e.uniform1i(o,t),e.activeTexture(c+t),e.bindTexture(i,r)}}function W(e,r,t,o,i){for(var u=C(0,r),f=new Int32Array(i),s=0;s<i;++s)f[s]=t+s;return n.isWebGL2(e)?function(r){e.uniform1iv(o,f),r.forEach(function(r,n){var o,i;e.activeTexture(c+f[n]),a.isTexture(e,r)?(o=r,i=null):(o=r.texture,i=r.sampler),e.bindSampler(t,i),e.bindTexture(u,o)})}:function(r){e.uniform1iv(o,f),r.forEach(function(r,t){e.activeTexture(c+f[t]),e.bindTexture(u,r)})}}function V(e,r){return function(t){if(t.value)switch(e.disableVertexAttribArray(r),t.value.length){case 4:e.vertexAttrib4fv(r,t.value);break;case 3:e.vertexAttrib3fv(r,t.value);break;case 2:e.vertexAttrib2fv(r,t.value);break;case 1:e.vertexAttrib1fv(r,t.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else e.bindBuffer(p,t.buffer),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,t.numComponents||t.size,t.type||M,t.normalize||!1,t.stride||0,t.offset||0),void 0!==t.divisor&&e.vertexAttribDivisor(r,t.divisor)}}function G(e,r){return function(t){if(t.value){if(e.disableVertexAttribArray(r),4!==t.value.length)throw new Error("The length of an integer constant value must be 4!");e.vertexAttrib4iv(r,t.value)}else e.bindBuffer(p,t.buffer),e.enableVertexAttribArray(r),e.vertexAttribIPointer(r,t.numComponents||t.size,t.type||S,t.stride||0,t.offset||0),void 0!==t.divisor&&e.vertexAttribDivisor(r,t.divisor)}}function N(e,r){return function(t){if(t.value){if(e.disableVertexAttribArray(r),4!==t.value.length)throw new Error("The length of an unsigned integer constant value must be 4!");e.vertexAttrib4uiv(r,t.value)}else e.bindBuffer(p,t.buffer),e.enableVertexAttribArray(r),e.vertexAttribIPointer(r,t.numComponents||t.size,t.type||B,t.stride||0,t.offset||0),void 0!==t.divisor&&e.vertexAttribDivisor(r,t.divisor)}}function X(e,r,t){var n=t.size,a=t.count;return function(t){e.bindBuffer(p,t.buffer);for(var o=t.size||t.numComponents||n,i=o/a,u=t.type||M,f=k[u].size*o,s=t.normalize||!1,c=t.offset||0,l=f/a,m=0;m<a;++m)e.enableVertexAttribArray(r+m),e.vertexAttribPointer(r+m,i,u,s,f,c+l*m),void 0!==t.divisor&&e.vertexAttribDivisor(r+m,t.divisor)}}k[M]={Type:Float32Array,size:4,setter:function(e,r){return function(t){e.uniform1f(r,t)}},arraySetter:function(e,r){return function(t){e.uniform1fv(r,t)}}},k[35664]={Type:Float32Array,size:8,setter:function(e,r){return function(t){e.uniform2fv(r,t)}}},k[35665]={Type:Float32Array,size:12,setter:function(e,r){return function(t){e.uniform3fv(r,t)}}},k[35666]={Type:Float32Array,size:16,setter:function(e,r){return function(t){e.uniform4fv(r,t)}}},k[S]={Type:Int32Array,size:4,setter:I,arraySetter:z},k[35667]={Type:Int32Array,size:8,setter:R},k[35668]={Type:Int32Array,size:12,setter:D},k[35669]={Type:Int32Array,size:16,setter:U},k[B]={Type:Uint32Array,size:4,setter:function(e,r){return function(t){e.uniform1ui(r,t)}},arraySetter:function(e,r){return function(t){e.uniform1uiv(r,t)}}},k[36294]={Type:Uint32Array,size:8,setter:function(e,r){return function(t){e.uniform2uiv(r,t)}}},k[36295]={Type:Uint32Array,size:12,setter:function(e,r){return function(t){e.uniform3uiv(r,t)}}},k[36296]={Type:Uint32Array,size:16,setter:function(e,r){return function(t){e.uniform4uiv(r,t)}}},k[35670]={Type:Uint32Array,size:4,setter:I,arraySetter:z},k[35671]={Type:Uint32Array,size:8,setter:R},k[35672]={Type:Uint32Array,size:12,setter:D},k[35673]={Type:Uint32Array,size:16,setter:U},k[35674]={Type:Float32Array,size:16,setter:function(e,r){return function(t){e.uniformMatrix2fv(r,!1,t)}}},k[35675]={Type:Float32Array,size:36,setter:function(e,r){return function(t){e.uniformMatrix3fv(r,!1,t)}}},k[35676]={Type:Float32Array,size:64,setter:function(e,r){return function(t){e.uniformMatrix4fv(r,!1,t)}}},k[35685]={Type:Float32Array,size:24,setter:function(e,r){return function(t){e.uniformMatrix2x3fv(r,!1,t)}}},k[35686]={Type:Float32Array,size:32,setter:function(e,r){return function(t){e.uniformMatrix2x4fv(r,!1,t)}}},k[35687]={Type:Float32Array,size:24,setter:function(e,r){return function(t){e.uniformMatrix3x2fv(r,!1,t)}}},k[35688]={Type:Float32Array,size:48,setter:function(e,r){return function(t){e.uniformMatrix3x4fv(r,!1,t)}}},k[35689]={Type:Float32Array,size:32,setter:function(e,r){return function(t){e.uniformMatrix4x2fv(r,!1,t)}}},k[35690]={Type:Float32Array,size:48,setter:function(e,r){return function(t){e.uniformMatrix4x3fv(r,!1,t)}}},k[35678]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:3553},k[35680]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:34067},k[35679]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:32879},k[35682]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:3553},k[36289]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:35866},k[36292]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:35866},k[36293]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:34067},k[36298]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:3553},k[36299]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:32879},k[36300]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:34067},k[36303]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:35866},k[36306]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:3553},k[36307]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:32879},k[36308]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:34067},k[36311]={Type:null,size:0,setter:L,arraySetter:W,bindPoint:35866};var Y={};Y[M]={size:4,setter:V},Y[35664]={size:8,setter:V},Y[35665]={size:12,setter:V},Y[35666]={size:16,setter:V},Y[S]={size:4,setter:G},Y[35667]={size:8,setter:G},Y[35668]={size:12,setter:G},Y[35669]={size:16,setter:G},Y[B]={size:4,setter:N},Y[36294]={size:8,setter:N},Y[36295]={size:12,setter:N},Y[36296]={size:16,setter:N},Y[35670]={size:4,setter:G},Y[35671]={size:8,setter:G},Y[35672]={size:12,setter:G},Y[35673]={size:16,setter:G},Y[35674]={size:4,setter:X,count:2},Y[35675]={size:9,setter:X,count:3},Y[35676]={size:16,setter:X,count:4};var q=/^[ \t]*\n/;function H(e,r,t,n){var a=n||u,o=e.createShader(t),i=0;if(q.test(r)&&(i=1,r=r.replace(q,"")),e.shaderSource(o,r),e.compileShader(o),!e.getShaderParameter(o,b)){var f=e.getShaderInfoLog(o);return a(function(e,r){return r=r||0,++r,e.split("\n").map(function(e,t){return t+r+": "+e}).join("\n")}(r,i)+"\n*** Error compiling shader: "+f),e.deleteShader(o),null}return o}function Q(e,r,t){var n,a;if("function"==typeof r&&(t=r,r=void 0),"function"==typeof e)t=e,e=void 0;else if(e&&!Array.isArray(e)){if(e.errorCallback)return e;var o=e;t=o.errorCallback,e=o.attribLocations,n=o.transformFeedbackVaryings,a=o.transformFeedbackMode}var i={errorCallback:t||u,transformFeedbackVaryings:n,transformFeedbackMode:a};if(e){var f={};Array.isArray(e)?e.forEach(function(e,t){f[e]=r?r[t]:t}):f=e,i.attribLocations=f}return i}var Z=["VERTEX_SHADER","FRAGMENT_SHADER"];function K(e,r){return r.indexOf("frag")>=0?g:r.indexOf("vert")>=0?x:void 0}function $(e,r){r.forEach(function(r){e.deleteShader(r)})}function J(e,r,t,n,o){for(var i=Q(t,n,o),u=[],f=[],c=0;c<r.length;++c){var l=r[c];if("string"==typeof l){var p=s(l),m=p?p.text:l,y=e[Z[c]];p&&p.type&&(y=K(0,p.type)||y),l=H(e,m,y,i.errorCallback),f.push(l)}a.isShader(e,l)&&u.push(l)}if(u.length!==r.length)return i.errorCallback("not enough shaders for program"),$(e,f),null;var d=e.createProgram();u.forEach(function(r){e.attachShader(d,r)}),i.attribLocations&&Object.keys(i.attribLocations).forEach(function(r){e.bindAttribLocation(d,i.attribLocations[r],r)});var v=i.transformFeedbackVaryings;if(v&&(v.attribs&&(v=v.attribs),Array.isArray(v)||(v=Object.keys(v)),e.transformFeedbackVaryings(d,v,i.transformFeedbackMode||w)),e.linkProgram(d),!e.getProgramParameter(d,h)){var b=e.getProgramInfoLog(d);return i.errorCallback("Error in program linking:"+b),e.deleteProgram(d),$(e,f),null}return d}function ee(e,r,t,n){var a,o=s(r);if(!o)throw new Error("unknown script element: ".concat(r));a=o.text;var i=t||K(0,o.type);if(!i)throw new Error("unknown shader type");return H(e,a,i,n)}function re(e,r,t,n,a){for(var o=Q(t,n,a),i=[],u=0;u<r.length;++u){var f=H(e,r[u],e[Z[u]],o.errorCallback);if(!f)return null;i.push(f)}return J(e,i,o)}function te(e){var r=e.name;return r.startsWith("gl_")||r.startsWith("webgl_")}function ne(e,r){var t=0;function n(r,n){var a,o=e.getUniformLocation(r,n.name),i=n.size>1&&"[0]"===n.name.substr(-3),u=n.type,f=k[u];if(!f)throw new Error("unknown type: 0x".concat(u.toString(16)));if(f.bindPoint){var s=t;t+=n.size,a=i?f.arraySetter(e,u,s,o,n.size):f.setter(e,u,s,o,n.size)}else a=f.arraySetter&&i?f.arraySetter(e,o):f.setter(e,o);return a.location=o,a}for(var a={},o=e.getProgramParameter(r,A),i=0;i<o;++i){var u=e.getActiveUniform(r,i);if(!te(u)){var f=u.name;"[0]"===f.substr(-3)&&(f=f.substr(0,f.length-3));var s=n(r,u);a[f]=s}}return a}function ae(e,r){for(var t={},n=e.getProgramParameter(r,F),a=0;a<n;++a){var o=e.getTransformFeedbackVarying(r,a);t[o.name]={index:a,type:o.type,size:o.size}}return t}function oe(e,r,t){for(var n in r.transformFeedbackInfo&&(r=r.transformFeedbackInfo),t.attribs&&(t=t.attribs),t){var a=r[n];if(a){var o=t[n];o.offset?e.bindBufferRange(d,a.index,o.buffer,o.offset,o.size):e.bindBufferBase(d,a.index,o.buffer)}}}function ie(e,r){for(var t=e.getProgramParameter(r,A),n=[],a=[],o=0;o<t;++o){a.push(o),n.push({});var i=e.getActiveUniform(r,o);if(te(i))break;n[o].name=i.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(t){var o=t[0],i=t[1];e.getActiveUniforms(r,a,e[o]).forEach(function(e,r){n[r][i]=e})});for(var u={},f=e.getProgramParameter(r,E),s=0;s<f;++s){var c=e.getActiveUniformBlockName(r,s),l={index:s,usedByVertexShader:e.getActiveUniformBlockParameter(r,s,T),usedByFragmentShader:e.getActiveUniformBlockParameter(r,s,O),size:e.getActiveUniformBlockParameter(r,s,_),uniformIndices:e.getActiveUniformBlockParameter(r,s,j)};l.used=l.usedByVertexShader||l.usedByFragmentShader,u[c]=l}return{blockSpecs:u,uniformData:n}}var ue=/\[\d+\]\.$/;function fe(e,r,t,n){var a=t.blockSpecs,o=t.uniformData,i=a[n];if(!i)return f("no uniform block object named:",n),{name:n,uniforms:{}};var u=new ArrayBuffer(i.size),s=e.createBuffer(),c=i.index;e.bindBuffer(y,s),e.uniformBlockBinding(r,i.index,c);var l=n+".";ue.test(l)&&(l=l.replace(ue,"."));var p={};return i.uniformIndices.forEach(function(e){var r=o[e],t=k[r.type],n=t.Type,a=r.size*t.size,i=r.name;i.substr(0,l.length)===l&&(i=i.substr(l.length)),p[i]=new n(u,r.offset,a/n.BYTES_PER_ELEMENT)}),{name:n,array:u,asFloat:new Float32Array(u),buffer:s,uniforms:p}}function se(e,r,t){var n=(r.uniformBlockSpec||r).blockSpecs[t.name];if(n){var a=n.index;return e.bindBufferRange(y,a,t.buffer,t.offset||0,t.array.byteLength),!0}return!1}function ce(e,r){for(var t=e.uniformSetters||e,n=arguments.length,a=1;a<n;++a){var o=arguments[a];if(Array.isArray(o))for(var i=o.length,u=0;u<i;++u)ce(t,o[u]);else for(var f in o){var s=t[f];s&&s(o[f])}}}var le=ce;function pe(e,r){for(var t={},n=e.getProgramParameter(r,P),a=0;a<n;++a){var o=e.getActiveAttrib(r,a);if(!te(o)){var i=e.getAttribLocation(r,o.name),u=Y[o.type],f=u.setter(e,i,u);f.location=i,t[o.name]=f}}return t}function me(e,r){for(var t in r){var n=e[t];n&&n(r[t])}}function ye(e,r){var t={program:r,uniformSetters:ne(e,r),attribSetters:pe(e,r)};return n.isWebGL2(e)&&(t.uniformBlockSpec=ie(e,r),t.transformFeedbackInfo=ae(e,r)),t}r.setUniformsAndBindTextures=le},"./src/textures.js":function(e,r,t){"use strict";r.__esModule=!0,r.setTextureDefaults_=function(e){o.copyExistingProperties(e,s),e.textureColor&&Mr(e.textureColor)},r.createSampler=Ur,r.createSamplers=function(e,r){var t={};return Object.keys(r).forEach(function(n){t[n]=Ur(e,r[n])}),t},r.setSamplerParameters=Dr,r.createTexture=rt,r.setEmptyTexture=et,r.setTextureFromArray=Jr,r.loadTextureFromUrl=Zr,r.setTextureFromElement=Nr,r.setTextureFilteringForSize=Lr,r.setTextureParameters=Rr,r.setDefaultTextureColor=Mr,r.createTextures=function(e,r,t){t=t||Xr;var n=0,a=[],o={},i={};function u(){0===n&&setTimeout(function(){t(a.length?a:void 0,o,i)},0)}return Object.keys(r).forEach(function(t){var f,s,c=r[t];("string"==typeof(s=c.src)||Array.isArray(s)&&"string"==typeof s[0])&&(f=function(e,r,o){i[t]=o,--n,e&&a.push(e),u()},++n),o[t]=rt(e,c,f)}),u(),o},r.resizeTexture=function(e,r,t,n,a,o){n=n||t.width,a=a||t.height,o=o||t.depth;var i=t.target||P;e.bindTexture(i,r);var u,f=t.level||0,s=t.internalFormat||t.format||d,l=Fr(s),p=t.format||l.format,m=t.src;u=m&&(c(m)||Array.isArray(m)&&"number"==typeof m[0])?t.type||_r(e,m,l.type):t.type||l.type;if(i===F)for(var y=0;y<6;++y)e.texImage2D(O+y,f,s,n,a,0,p,u,null);else i===E||i===T?e.texImage3D(i,f,s,n,a,o,0,p,u,null):e.texImage2D(i,f,s,n,a,0,p,u,null)},r.canGenerateMipmap=Tr,r.canFilter=Or,r.getNumComponentsForFormat=function(e){var r=xr[e];if(!r)throw"unknown format: "+e;return r.numColorComponents},r.getBytesPerElementForInternalFormat=Pr,r.getFormatAndTypeForInternalFormat=Fr;var n=u(t("./src/utils.js")),a=u(t("./src/typedarrays.js")),o=u(t("./src/helper.js"));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function u(e){if(e&&e.__esModule)return e;var r=i();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(t,a,o):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}var f,s={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},c=a.isArrayBuffer;function l(){return f=f||("undefined"!=typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null)}var p,m=6406,y=6407,d=6408,v=6409,b=6410,h=6402,g=34041,x=33071,w=9728,A=9729,P=3553,F=34067,E=32879,T=35866,O=34069,_=34070,j=34071,M=34072,S=34073,B=34074,k=10241,C=10240,I=10242,z=10243,R=32882,D=33082,U=33083,L=33084,W=33085,V=3317,G=3314,N=32878,X=3316,Y=3315,q=32877,H=37443,Q=37441,Z=37440,K=33321,$=36756,J=33325,ee=33326,re=33330,te=33329,ne=33338,ae=33337,oe=33340,ie=33339,ue=33323,fe=36757,se=33327,ce=33328,le=33336,pe=33335,me=33332,ye=33331,de=33334,ve=33333,be=32849,he=35905,ge=36194,xe=36758,we=35898,Ae=35901,Pe=34843,Fe=34837,Ee=36221,Te=36239,Oe=36215,_e=36233,je=36209,Me=36227,Se=32856,Be=35907,ke=36759,Ce=32855,Ie=32854,ze=32857,Re=34842,De=34836,Ue=36220,Le=36238,We=36975,Ve=36214,Ge=36232,Ne=36226,Xe=36208,Ye=33189,qe=33190,He=36012,Qe=36013,Ze=35056,Ke=5120,$e=5121,Je=5122,er=5123,rr=5124,tr=5125,nr=5126,ar=32819,or=32820,ir=33635,ur=5131,fr=36193,sr=33640,cr=35899,lr=35902,pr=36269,mr=34042,yr=33319,dr=33320,vr=6403,br=36244,hr=36248,gr=36249,xr={},wr=xr;function Ar(e){if(!p){var r={};r[m]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[$e,ur,fr,nr]},r[v]={textureFormat:v,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[$e,ur,fr,nr]},r[b]={textureFormat:b,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[$e,ur,fr,nr]},r[y]={textureFormat:y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[$e,ur,fr,nr,ir]},r[d]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[$e,ur,fr,nr,ar,or]},r[K]={textureFormat:vr,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[$e]},r[$]={textureFormat:vr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[Ke]},r[J]={textureFormat:vr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[nr,ur]},r[ee]={textureFormat:vr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[nr]},r[re]={textureFormat:br,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[$e]},r[te]={textureFormat:br,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[Ke]},r[me]={textureFormat:br,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[er]},r[ye]={textureFormat:br,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Je]},r[de]={textureFormat:br,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[tr]},r[ve]={textureFormat:br,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[rr]},r[ue]={textureFormat:yr,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[$e]},r[fe]={textureFormat:yr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[Ke]},r[se]={textureFormat:yr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[nr,ur]},r[ce]={textureFormat:yr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[nr]},r[le]={textureFormat:dr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[$e]},r[pe]={textureFormat:dr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Ke]},r[ne]={textureFormat:dr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[er]},r[ae]={textureFormat:dr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Je]},r[oe]={textureFormat:dr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[tr]},r[ie]={textureFormat:dr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[rr]},r[be]={textureFormat:y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[$e]},r[he]={textureFormat:y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[$e]},r[ge]={textureFormat:y,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[$e,ir]},r[xe]={textureFormat:y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[Ke]},r[we]={textureFormat:y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[nr,ur,cr]},r[Ae]={textureFormat:y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[nr,ur,lr]},r[Pe]={textureFormat:y,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[nr,ur]},r[Fe]={textureFormat:y,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[nr]},r[Ee]={textureFormat:hr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[$e]},r[Te]={textureFormat:hr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[Ke]},r[Oe]={textureFormat:hr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[er]},r[_e]={textureFormat:hr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[Je]},r[je]={textureFormat:hr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[tr]},r[Me]={textureFormat:hr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[rr]},r[Se]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[$e]},r[Be]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[$e]},r[ke]={textureFormat:d,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[Ke]},r[Ce]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[$e,or,sr]},r[Ie]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[$e,ar]},r[ze]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[sr]},r[Re]={textureFormat:d,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[nr,ur]},r[De]={textureFormat:d,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[nr]},r[Ue]={textureFormat:gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[$e]},r[Le]={textureFormat:gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ke]},r[We]={textureFormat:gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[sr]},r[Ve]={textureFormat:gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[er]},r[Ge]={textureFormat:gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Je]},r[Ne]={textureFormat:gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[rr]},r[Xe]={textureFormat:gr,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[tr]},r[Ye]={textureFormat:h,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[er,tr]},r[qe]={textureFormat:h,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[tr]},r[He]={textureFormat:h,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[nr]},r[Ze]={textureFormat:g,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[mr]},r[Qe]={textureFormat:g,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[pr]},Object.keys(r).forEach(function(e){var t=r[e];t.bytesPerElementMap={},t.bytesPerElement.forEach(function(e,r){var n=t.type[r];t.bytesPerElementMap[n]=e})}),p=r}return p[e]}function Pr(e,r){var t=Ar(e);if(!t)throw"unknown internal format";var n=t.bytesPerElementMap[r];if(void 0===n)throw"unknown internal format";return n}function Fr(e){var r=Ar(e);if(!r)throw"unknown internal format";return{format:r.textureFormat,type:r.type[0]}}function Er(e){return 0==(e&e-1)}function Tr(e,r,t,a){if(!n.isWebGL2(e))return Er(r)&&Er(t);var o=Ar(a);if(!o)throw"unknown internal format";return o.colorRenderable&&o.textureFilterable}function Or(e){var r=Ar(e);if(!r)throw"unknown internal format";return r.textureFilterable}function _r(e,r,t){return c(r)?a.getGLTypeForTypedArray(r):t||$e}function jr(e,r,t,n,a){if(a%1!=0)throw"can't guess dimensions";if(t||n){if(n){if(!t&&(t=a/n)%1)throw"can't guess dimensions"}else if((n=a/t)%1)throw"can't guess dimensions"}else{var o=Math.sqrt(a/(r===F?6:1));o%1==0?(t=o,n=o):(t=a,n=1)}return{width:t,height:n}}function Mr(e){s.textureColor=new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}wr[m]={numColorComponents:1},wr[v]={numColorComponents:1},wr[b]={numColorComponents:2},wr[y]={numColorComponents:3},wr[d]={numColorComponents:4},wr[vr]={numColorComponents:1},wr[br]={numColorComponents:1},wr[yr]={numColorComponents:2},wr[dr]={numColorComponents:2},wr[y]={numColorComponents:3},wr[hr]={numColorComponents:3},wr[d]={numColorComponents:4},wr[gr]={numColorComponents:4},wr[h]={numColorComponents:1},wr[g]={numColorComponents:2};var Sr={};function Br(e,r){void 0!==r.colorspaceConversion&&(Sr.colorspaceConversion=e.getParameter(H),e.pixelStorei(H,r.colorspaceConversion)),void 0!==r.premultiplyAlpha&&(Sr.premultiplyAlpha=e.getParameter(Q),e.pixelStorei(Q,r.premultiplyAlpha)),void 0!==r.flipY&&(Sr.flipY=e.getParameter(Z),e.pixelStorei(Z,r.flipY))}function kr(e,r){void 0!==r.colorspaceConversion&&e.pixelStorei(H,Sr.colorspaceConversion),void 0!==r.premultiplyAlpha&&e.pixelStorei(Q,Sr.premultiplyAlpha),void 0!==r.flipY&&e.pixelStorei(Z,Sr.flipY)}function Cr(e){Sr.unpackAlignment=e.getParameter(V),n.isWebGL2(e)&&(Sr.unpackRowLength=e.getParameter(G),Sr.unpackImageHeight=e.getParameter(N),Sr.unpackSkipPixels=e.getParameter(X),Sr.unpackSkipRows=e.getParameter(Y),Sr.unpackSkipImages=e.getParameter(q))}function Ir(e){e.pixelStorei(V,Sr.unpackAlignment),n.isWebGL2(e)&&(e.pixelStorei(G,Sr.unpackRowLength),e.pixelStorei(N,Sr.unpackImageHeight),e.pixelStorei(X,Sr.unpackSkipPixels),e.pixelStorei(Y,Sr.unpackSkipRows),e.pixelStorei(q,Sr.unpackSkipImages))}function zr(e,r,t,n){n.minMag&&(t.call(e,r,k,n.minMag),t.call(e,r,C,n.minMag)),n.min&&t.call(e,r,k,n.min),n.mag&&t.call(e,r,C,n.mag),n.wrap&&(t.call(e,r,I,n.wrap),t.call(e,r,z,n.wrap),(r===E||o.isSampler(e,r))&&t.call(e,r,R,n.wrap)),n.wrapR&&t.call(e,r,R,n.wrapR),n.wrapS&&t.call(e,r,I,n.wrapS),n.wrapT&&t.call(e,r,z,n.wrapT),n.minLod&&t.call(e,r,D,n.minLod),n.maxLod&&t.call(e,r,U,n.maxLod),n.baseLevel&&t.call(e,r,L,n.baseLevel),n.maxLevel&&t.call(e,r,W,n.maxLevel)}function Rr(e,r,t){var n=t.target||P;e.bindTexture(n,r),zr(e,n,e.texParameteri,t)}function Dr(e,r,t){zr(e,r,e.samplerParameteri,t)}function Ur(e,r){var t=e.createSampler();return Dr(e,t,r),t}function Lr(e,r,t,n,a,o){t=t||s.textureOptions,o=o||d;var i=t.target||P;if(n=n||t.width,a=a||t.height,e.bindTexture(i,r),Tr(e,n,a,o))e.generateMipmap(i);else{var u=Or(o)?A:w;e.texParameteri(i,k,u),e.texParameteri(i,C,u),e.texParameteri(i,I,x),e.texParameteri(i,z,x)}}function Wr(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function Vr(e,r){return(r=r||{}).cubeFaceOrder||[O,_,j,M,S,B]}function Gr(e,r){var t=Vr(0,r).map(function(e,r){return{face:e,ndx:r}});return t.sort(function(e,r){return e.face-r.face}),t}function Nr(e,r,t,n){var a=(n=n||s.textureOptions).target||P,o=n.level||0,i=t.width,u=t.height,f=n.internalFormat||n.format||d,c=Fr(f),p=n.format||c.format,m=n.type||c.type;if(Br(e,n),e.bindTexture(a,r),a===F){var y,v,b=t.width,h=t.height;if(b/6===h)y=h,v=[0,0,1,0,2,0,3,0,4,0,5,0];else if(h/6===b)y=b,v=[0,0,0,1,0,2,0,3,0,4,0,5];else if(b/3==h/2)y=b/3,v=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(b/2!=h/3)throw"can't figure out cube map from element: "+(t.src?t.src:t.nodeName);y=b/2,v=[0,0,1,0,0,1,1,1,0,2,1,2]}var g=l();g?(g.canvas.width=y,g.canvas.height=y,i=y,u=y,Gr(0,n).forEach(function(r){var n=v[2*r.ndx+0]*y,a=v[2*r.ndx+1]*y;g.drawImage(t,n,a,y,y,0,0,y,y),e.texImage2D(r.face,o,f,p,m,g.canvas)}),g.canvas.width=1,g.canvas.height=1):"undefined"!=typeof createImageBitmap&&(i=y,u=y,Gr(0,n).forEach(function(s){var c=v[2*s.ndx+0]*y,l=v[2*s.ndx+1]*y;e.texImage2D(s.face,o,f,y,y,0,p,m,null),createImageBitmap(t,c,l,y,y,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(function(t){Br(e,n),e.bindTexture(a,r),e.texImage2D(s.face,o,f,p,m,t),kr(e,n),Wr(n)&&Lr(e,r,n,i,u,f)})}))}else if(a===E||a===T){var x=Math.min(t.width,t.height),w=Math.max(t.width,t.height),A=w/x;if(A%1!=0)throw"can not compute 3D dimensions of element";var O=t.width===w?1:0,_=t.height===w?1:0;Cr(e),e.pixelStorei(V,1),e.pixelStorei(G,t.width),e.pixelStorei(N,0),e.pixelStorei(q,0),e.texImage3D(a,o,f,x,x,x,0,p,m,null);for(var j=0;j<A;++j){var M=j*x*O,S=j*x*_;e.pixelStorei(X,M),e.pixelStorei(Y,S),e.texSubImage3D(a,o,0,0,j,x,x,1,p,m,t)}Ir(e)}else e.texImage2D(a,o,f,p,m,t);kr(e,n),Wr(n)&&Lr(e,r,n,i,u,f),Rr(e,r,n)}function Xr(){}function Yr(e,r){return void 0!==r||function(e){if("undefined"!=typeof document){var r=document.createElement("a");return r.href=e,r.hostname===location.hostname&&r.port===location.port&&r.protocol===location.protocol}var t=new URL(location.href).origin;return new URL(e,location.href).origin===t}(e)?r:"anonymous"}function qr(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}function Hr(e,r,t){return qr(e)?(setTimeout(function(){t(null,e)}),e):function(e,r,t){var n;if(t=t||Xr,r=void 0!==r?r:s.crossOrigin,r=Yr(e,r),"undefined"!=typeof Image){n=new Image,void 0!==r&&(n.crossOrigin=r);var a=function(){n.removeEventListener("error",i),n.removeEventListener("load",u),n=null},i=function(){var r="couldn't load image: "+e;o.error(r),t(r,n),a()},u=function(){t(null,n),a()};return n.addEventListener("error",i),n.addEventListener("load",u),n.src=e,n}if("undefined"!=typeof ImageBitmap){var f,c,l=function(){t(f,c)},p={};r&&(p.mode="cors"),fetch(e,p).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(l)}).catch(function(e){f=e,setTimeout(l)}),n=null}return n}(e,r,t)}function Qr(e,r,t){var n=(t=t||s.textureOptions).target||P;if(e.bindTexture(n,r),!1!==t.color){var a=function(e){return e=e||s.textureColor,c(e)?e:new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}(t.color);if(n===F)for(var o=0;o<6;++o)e.texImage2D(O+o,0,d,1,1,0,d,$e,a);else n===E||n===T?e.texImage3D(n,0,d,1,1,1,0,d,$e,a):e.texImage2D(n,0,d,1,1,0,d,$e,a)}}function Zr(e,r,t,n){return n=n||Xr,t=t||s.textureOptions,Qr(e,r,t),Hr((t=Object.assign({},t)).src,t.crossOrigin,function(a,o){a?n(a,r,o):(Nr(e,r,o,t),n(null,r,o))})}function Kr(e,r,t,n){n=n||Xr;var a=t.src;if(6!==a.length)throw"there must be 6 urls for a cubemap";var o=t.level||0,i=t.internalFormat||t.format||d,u=Fr(i),f=t.format||u.format,s=t.type||$e,c=t.target||P;if(c!==F)throw"target must be TEXTURE_CUBE_MAP";Qr(e,r,t),t=Object.assign({},t);var l,p=6,m=[],y=Vr(0,t);l=a.map(function(a,u){return Hr(a,t.crossOrigin,(d=y[u],function(a,u){--p,a?m.push(a):u.width!==u.height?m.push("cubemap face img is not a square: "+u.src):(Br(e,t),e.bindTexture(c,r),5===p?Vr().forEach(function(r){e.texImage2D(r,o,i,f,s,u)}):e.texImage2D(d,o,i,f,s,u),kr(e,t),Wr(t)&&e.generateMipmap(c)),0===p&&n(m.length?m:void 0,r,l)}));})}function $r(e,r,t,n){n=n||Xr;var a=t.src,o=t.internalFormat||t.format||d,i=Fr(o),u=t.format||i.format,f=t.type||$e,s=t.target||T;if(s!==E&&s!==T)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";Qr(e,r,t),t=Object.assign({},t);var c,p=a.length,m=[],y=t.level||0,v=t.width,b=t.height,h=a.length,g=!0;c=a.map(function(a,i){return Hr(a,t.crossOrigin,(d=i,function(a,i){if(--p,a)m.push(a);else{if(Br(e,t),e.bindTexture(s,r),g){g=!1,v=t.width||i.width,b=t.height||i.height,e.texImage3D(s,y,o,v,b,h,0,u,f,null);for(var x=0;x<h;++x)e.texSubImage3D(s,y,0,0,x,v,b,1,u,f,i)}else{var w,A=i;i.width===v&&i.height===b||(A=(w=l()).canvas,w.canvas.width=v,w.canvas.height=b,w.drawImage(i,0,0,v,b)),e.texSubImage3D(s,y,0,0,d,v,b,1,u,f,A),w&&A===w.canvas&&(w.canvas.width=0,w.canvas.height=0)}kr(e,t),Wr(t)&&e.generateMipmap(s)}0===p&&n(m.length?m:void 0,r,c)}));})}function Jr(e,r,t,o){var i=(o=o||s.textureOptions).target||P;e.bindTexture(i,r);var u=o.width,f=o.height,l=o.depth,p=o.level||0,m=o.internalFormat||o.format||d,y=Fr(m),v=o.format||y.format,b=o.type||_r(0,t,y.type);if(c(t))t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));else{var h=a.getTypedArrayTypeForGLType(b);t=new h(t)}var g,x=Pr(m,b),w=t.byteLength/x;if(w%1)throw"length wrong size for format: "+n.glEnumToString(e,v);if(i===E||i===T)if(u||f||l)!u||f&&l?!f||u&&l?(g=jr(0,i,u,f,w/l),u=g.width,f=g.height):(g=jr(0,i,u,l,w/f),u=g.width,l=g.height):(g=jr(0,i,f,l,w/u),f=g.width,l=g.height);else{var A=Math.cbrt(w);if(A%1!=0)throw"can't guess cube size of array of numElements: "+w;u=A,f=A,l=A}else g=jr(0,i,u,f,w),u=g.width,f=g.height;if(Cr(e),e.pixelStorei(V,o.unpackAlignment||1),Br(e,o),i===F){var O=w/6*(x/t.BYTES_PER_ELEMENT);Gr(0,o).forEach(function(r){var n=O*r.ndx,a=t.subarray(n,n+O);e.texImage2D(r.face,p,m,u,f,0,v,b,a)})}else i===E||i===T?e.texImage3D(i,p,m,u,f,l,0,v,b,t):e.texImage2D(i,p,m,u,f,0,v,b,t);return kr(e,o),Ir(e),{width:u,height:f,depth:l,type:b}}function et(e,r,t){var n=t.target||P;e.bindTexture(n,r);var a=t.level||0,o=t.internalFormat||t.format||d,i=Fr(o),u=t.format||i.format,f=t.type||i.type;if(Br(e,t),n===F)for(var s=0;s<6;++s)e.texImage2D(O+s,a,o,t.width,t.height,0,u,f,null);else n===E||n===T?e.texImage3D(n,a,o,t.width,t.height,t.depth,0,u,f,null):e.texImage2D(n,a,o,t.width,t.height,0,u,f,null);kr(e,t)}function rt(e,r,t){t=t||Xr,r=r||s.textureOptions;var n=e.createTexture(),a=r.target||P,o=r.width||1,i=r.height||1,u=r.internalFormat||d;e.bindTexture(a,n),a===F&&(e.texParameteri(a,I,x),e.texParameteri(a,z,x));var f=r.src;if(f)if("function"==typeof f&&(f=f(e,r)),"string"==typeof f)Zr(e,n,r,t);else if(c(f)||Array.isArray(f)&&("number"==typeof f[0]||Array.isArray(f[0])||c(f[0]))){var l=Jr(e,n,f,r);o=l.width,i=l.height}else Array.isArray(f)&&("string"==typeof f[0]||qr(f[0]))?a===F?Kr(e,n,r,t):$r(e,n,r,t):(Nr(e,n,f,r),o=f.width,i=f.height);else et(e,n,r);return Wr(r)&&Lr(e,n,r,o,i,u),Rr(e,n,r),n}},"./src/twgl-full.js":function(e,r,t){"use strict";r.__esModule=!0;var n={m4:!0,v3:!0,primitives:!0};r.primitives=r.v3=r.m4=void 0;var a=s(t("./src/m4.js"));r.m4=a;var o=s(t("./src/v3.js"));r.v3=o;var i=s(t("./src/primitives.js"));r.primitives=i;var u=t("./src/twgl.js");function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function s(e){if(e&&e.__esModule)return e;var r=f();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(t,a,o):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=u[e]))})},"./src/twgl.js":function(e,r,t){"use strict";r.__esModule=!0;var n={addExtensionsToContext:!0,getContext:!0,getWebGLContext:!0,resizeCanvasToDisplaySize:!0,setDefaults:!0,attributes:!0,textures:!0,utils:!0,draw:!0,framebuffers:!0,programs:!0,typedarrays:!0,vertexArrays:!0};r.addExtensionsToContext=g,r.getContext=function(e,r){return function(e,r){for(var t=["webgl2","webgl","experimental-webgl"],n=null,a=0;a<t.length;++a)if(n=e.getContext(t[a],r)){d.addExtensionsToContext&&g(n);break}return n}(e,r)},r.getWebGLContext=function(e,r){return function(e,r){for(var t=["webgl","experimental-webgl"],n=null,a=0;a<t.length;++a)if(n=e.getContext(t[a],r)){d.addExtensionsToContext&&g(n);break}return n}(e,r)},r.resizeCanvasToDisplaySize=function(e,r){r=r||1,r=Math.max(0,r);var t=e.clientWidth*r|0,n=e.clientHeight*r|0;if(e.width!==t||e.height!==n)return e.width=t,e.height=n,!0;return!1},r.setDefaults=function(e){i.copyExistingProperties(e,d),a.setAttributeDefaults_(e),o.setTextureDefaults_(e)},r.vertexArrays=r.typedarrays=r.programs=r.framebuffers=r.draw=r.utils=r.textures=r.attributes=void 0;var a=y(t("./src/attributes.js"));r.attributes=a,Object.keys(a).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=a[e]))});var o=y(t("./src/textures.js"));r.textures=o,Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=o[e]))});var i=y(t("./src/helper.js")),u=y(t("./src/utils.js"));r.utils=u,Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=u[e]))});var f=y(t("./src/draw.js"));r.draw=f,Object.keys(f).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=f[e]))});var s=y(t("./src/framebuffers.js"));r.framebuffers=s,Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=s[e]))});var c=y(t("./src/programs.js"));r.programs=c,Object.keys(c).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=c[e]))});var l=y(t("./src/typedarrays.js"));r.typedarrays=l,Object.keys(l).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=l[e]))});var p=y(t("./src/vertex-arrays.js"));function m(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return m=function(){return e},e}function y(e){if(e&&e.__esModule)return e;var r=m();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(t,a,o):t[a]=e[a]}}return t.default=e,r&&r.set(e,t),t}r.vertexArrays=p,Object.keys(p).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(r[e]=p[e]))});var d={addExtensionsToContext:!0};var v=/^(.*?)_/;function b(e,r){u.glEnumToString(e,0);var t=e.getExtension(r);if(t){var n={},a=v.exec(r)[1],o="_"+a;for(var f in t){var s=t[f],c="function"==typeof s,l=c?a:o,p=f;f.endsWith(l)&&(p=f.substring(0,f.length-l.length)),void 0!==e[p]?c||e[p]===s||i.warn(p,e[p],s,f):c?e[p]=function(e){return function(){return e.apply(t,arguments)}}(s):(e[p]=s,n[p]=s)}n.constructor={name:t.constructor.name},u.glEnumToString(n,0)}return t}var h=["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 g(e){for(var r=0;r<h.length;++r)b(e,h[r])}},"./src/typedarrays.js":function(e,r,t){"use strict";r.__esModule=!0,r.getGLTypeForTypedArray=function(e){if(e instanceof Int8Array)return n;if(e instanceof Uint8Array)return a;if(e instanceof Uint8ClampedArray)return a;if(e instanceof Int16Array)return o;if(e instanceof Uint16Array)return i;if(e instanceof Int32Array)return u;if(e instanceof Uint32Array)return f;if(e instanceof Float32Array)return s;throw new Error("unsupported typed array type")},r.getGLTypeForTypedArrayType=function(e){if(e===Int8Array)return n;if(e===Uint8Array)return a;if(e===Uint8ClampedArray)return a;if(e===Int16Array)return o;if(e===Uint16Array)return i;if(e===Int32Array)return u;if(e===Uint32Array)return f;if(e===Float32Array)return s;throw new Error("unsupported typed array type")},r.getTypedArrayTypeForGLType=function(e){var r=c[e];if(!r)throw new Error("unknown gl type");return r},r.isArrayBuffer=void 0;var n=5120,a=5121,o=5122,i=5123,u=5124,f=5125,s=5126,c={},l=c;l[n]=Int8Array,l[a]=Uint8Array,l[o]=Int16Array,l[i]=Uint16Array,l[u]=Int32Array,l[f]=Uint32Array,l[s]=Float32Array,l[32819]=Uint16Array,l[32820]=Uint16Array,l[33635]=Uint16Array,l[5131]=Uint16Array,l[33640]=Uint32Array,l[35899]=Uint32Array,l[35902]=Uint32Array,l[36269]=Uint32Array,l[34042]=Uint32Array;var p="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};r.isArrayBuffer=p},"./src/utils.js":function(e,r,t){"use strict";r.__esModule=!0,r.isWebGL1=function(e){return!e.texStorage2D},r.isWebGL2=function(e){return!!e.texStorage2D},r.glEnumToString=void 0;var n=function(){var e={},r={};return function(t,n){return function(t){var n=t.constructor.name;if(!e[n]){for(var a in t)if("number"==typeof t[a]){var o=r[t[a]];r[t[a]]=o?"".concat(o," | ").concat(a):a}e[n]=!0}}(t),r[n]||"0x"+n.toString(16)}}();r.glEnumToString=n},"./src/v3.js":function(e,r,t){"use strict";r.__esModule=!0,r.add=function(e,r,t){return(t=t||new n(3))[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},r.copy=function(e,r){return(r=r||new n(3))[0]=e[0],r[1]=e[1],r[2]=e[2],r},r.create=function(e,r,t){var a=new n(3);e&&(a[0]=e);r&&(a[1]=r);t&&(a[2]=t);return a},r.cross=function(e,r,t){t=t||new n(3);var a=e[2]*r[0]-e[0]*r[2],o=e[0]*r[1]-e[1]*r[0];return t[0]=e[1]*r[2]-e[2]*r[1],t[1]=a,t[2]=o,t},r.distance=function(e,r){var t=e[0]-r[0],n=e[1]-r[1],a=e[2]-r[2];return Math.sqrt(t*t+n*n+a*a)},r.distanceSq=function(e,r){var t=e[0]-r[0],n=e[1]-r[1],a=e[2]-r[2];return t*t+n*n+a*a},r.divide=function(e,r,t){return(t=t||new n(3))[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},r.divScalar=function(e,r,t){return(t=t||new n(3))[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r,t},r.dot=function(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]},r.lerp=function(e,r,t,a){return(a=a||new n(3))[0]=e[0]+t*(r[0]-e[0]),a[1]=e[1]+t*(r[1]-e[1]),a[2]=e[2]+t*(r[2]-e[2]),a},r.lerpV=function(e,r,t,a){return(a=a||new n(3))[0]=e[0]+t[0]*(r[0]-e[0]),a[1]=e[1]+t[1]*(r[1]-e[1]),a[2]=e[2]+t[2]*(r[2]-e[2]),a},r.length=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])},r.lengthSq=function(e){return e[0]*e[0]+e[1]*e[1]+e[2]*e[2]},r.max=function(e,r,t){return(t=t||new n(3))[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t},r.min=function(e,r,t){return(t=t||new n(3))[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t},r.mulScalar=function(e,r,t){return(t=t||new n(3))[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},r.multiply=function(e,r,t){return(t=t||new n(3))[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t},r.negate=function(e,r){return(r=r||new n(3))[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r},r.normalize=function(e,r){r=r||new n(3);var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=Math.sqrt(t);a>1e-5?(r[0]=e[0]/a,r[1]=e[1]/a,r[2]=e[2]/a):(r[0]=0,r[1]=0,r[2]=0);return r},r.setDefaultType=function(e){var r=n;return n=e,r},r.subtract=function(e,r,t){return(t=t||new n(3))[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t};var n=Float32Array},"./src/vertex-arrays.js":function(e,r,t){"use strict";r.__esModule=!0,r.createVertexArrayInfo=function(e,r,t){var a=e.createVertexArray();e.bindVertexArray(a),r.length||(r=[r]);return r.forEach(function(r){n.setBuffersAndAttributes(e,r,t)}),e.bindVertexArray(null),{numElements:t.numElements,elementType:t.elementType,vertexArrayObject:a}},r.createVAOAndSetAttributes=i,r.createVAOFromBufferInfo=function(e,r,t){return i(e,r.attribSetters||r,t.attribs,t.indices)};var n=function(e){if(e&&e.__esModule)return e;var r=a();if(r&&r.has(e))return r.get(e);var t={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(t,o,i):t[o]=e[o]}}t.default=e,r&&r.set(e,t);return t}(t("./src/programs.js"));function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}var o=34963;function i(e,r,t,a){var i=e.createVertexArray();return e.bindVertexArray(i),n.setAttributes(r,t),a&&e.bindBuffer(o,a),e.bindVertexArray(null),i}}})});