!function(){return function e(t,n,r){function i(a,f){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!f&&u)return u(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n||e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a-1}},{}],17:[function(e,t,n){"use strict";var r,i,o,a,f,u,s,c=e("d"),l=e("es5-ext/object/valid-callable"),p=Function.prototype.apply,h=Function.prototype.call,d=Object.create,m=Object.defineProperty,x=Object.defineProperties,b=Object.prototype.hasOwnProperty,g={configurable:!0,enumerable:!1,writable:!0};f={on:r=function(e,t){var n;return l(t),b.call(this,"__ee__")?n=this.__ee__:(n=g.value=d(null),m(this,"__ee__",g),g.value=null),n[e]?"object"==typeof n[e]?n[e].push(t):n[e]=[n[e],t]:n[e]=t,this},once:i=function(e,t){var n,i;return l(t),i=this,r.call(this,e,n=function(){o.call(i,e,n),p.call(t,this,arguments)}),n.__eeOnceListener__=t,this},off:o=function(e,t){var n,r,i,o;if(l(t),!b.call(this,"__ee__"))return this;if(!(n=this.__ee__)[e])return this;if("object"==typeof(r=n[e]))for(o=0;i=r[o];++o)i!==t&&i.__eeOnceListener__!==t||(2===r.length?n[e]=r[o?0:1]:r.splice(o,1));else r!==t&&r.__eeOnceListener__!==t||delete n[e];return this},emit:a=function(e){var t,n,r,i,o;if(b.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(n=arguments.length,o=new Array(n-1),t=1;t0)return 1<=0)return 1<1)for(var n=1;n>>=t))<<3,(t|=n=(15<(e>>>=n))<<2)|(n=(3<(e>>>=n))<<1)|e>>>n>>1}function f(){function e(e){e:{for(var t=16;268435456>=t;t*=16)if(e<=t){e=t;break e}e=0}return 0<(t=n[a(e)>>2]).length?t.pop():new ArrayBuffer(e)}function t(e){n[a(e.byteLength)>>2].push(e)}var n=o(8,function(){return[]});return{alloc:e,free:t,allocType:function(t,n){var r=null;switch(t){case 5120:r=new Int8Array(e(n),0,n);break;case 5121:r=new Uint8Array(e(n),0,n);break;case 5122:r=new Int16Array(e(2*n),0,n);break;case 5123:r=new Uint16Array(e(2*n),0,n);break;case 5124:r=new Int32Array(e(4*n),0,n);break;case 5125:r=new Uint32Array(e(4*n),0,n);break;case 5126:r=new Float32Array(e(4*n),0,n);break;default:return null}return r.length!==n?r.subarray(0,n):r},freeType:function(e){t(e.buffer)}}}function u(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||Q(e.data))}function s(e,t,n,r,i,o){for(var a=0;a(i=f)&&(i=r.buffer.byteLength,5123===l?i>>=1:5125===l&&(i>>=2)),r.vertCount=i,i=a,0>a&&(i=4,1===(a=r.buffer.dimension)&&(i=0),2===a&&(i=1),3===a&&(i=4)),r.primType=i}function a(e){r.elementsCount--,delete f[e.id],e.buffer.destroy(),e.buffer=null}var f={},s=0,c={uint8:5121,uint16:5123};t.oes_element_index_uint&&(c.uint32=5125),i.prototype.bind=function(){this.buffer.bind()};var l=[];return{create:function(e,t){function f(e){if(e)if("number"==typeof e)s(e),l.primType=4,l.vertCount=0|e,l.type=5121;else{var t=null,n=35044,r=-1,i=-1,a=0,p=0;Array.isArray(e)||Q(e)||u(e)?t=e:("data"in e&&(t=e.data),"usage"in e&&(n=J[e.usage]),"primitive"in e&&(r=ne[e.primitive]),"count"in e&&(i=0|e.count),"type"in e&&(p=c[e.type]),"length"in e?a=0|e.length:(a=i,5123===p||5122===p?a*=2:5125!==p&&5124!==p||(a*=4))),o(l,t,n,r,i,a,p)}else s(),l.primType=4,l.vertCount=0,l.type=5121;return f}var s=n.create(null,34963,!0),l=new i(s._buffer);return r.elementsCount++,f(e),f._reglType="elements",f._elements=l,f.subdata=function(e,t){return s.subdata(e,t),f},f.destroy=function(){a(l)},f},createStream:function(e){var t=l.pop();return t||(t=new i(n.create(null,34963,!0,!1)._buffer)),o(t,e,35040,-1,-1,0,0),t},destroyStream:function(e){l.push(e)},getElements:function(e){return"function"==typeof e&&e._elements instanceof i?e._elements:null},clear:function(){G(f).forEach(a)}}}function m(e){for(var t=q.allocType(5123,e.length),n=0;n>>31<<15,i=(o<<1>>>24)-127,o=o>>13&1023;t[n]=-24>i?r:-14>i?r+(o+1024>>-14-i):15>=i,n.height>>=i,h(n,r[i]),e.mipmask|=1<t;++t)e.images[t]=null;return e}function D(e){for(var t=e.images,n=0;nt){for(var n=0;n=--this.refCount&&B(this)}}),a.profile&&(o.getTotalTextureSize=function(){var e=0;return Object.keys(xe).forEach(function(t){e+=xe[t].stats.size}),e}),{create2D:function(t,n){function r(e,t){var n=i.texInfo;j.call(n);var o=S();return"number"==typeof e?E(o,0|e,"number"==typeof t?0|t:0|e):e?(O(n,e),T(o,e)):E(o,1,1),n.genMipmaps&&(o.mipmask=(o.width<<1)-1),i.mipmask=o.mipmask,s(i,o),i.internalformat=o.internalformat,r.width=o.width,r.height=o.height,P(i),C(o,3553),F(n,3553),z(),D(o),a.profile&&(i.stats.size=k(i.internalformat,i.type,o.width,o.height,n.genMipmaps,!1)),r.format=Z[i.internalformat],r.type=ee[i.type],r.mag=te[n.magFilter],r.min=ne[n.minFilter],r.wrapS=re[n.wrapS],r.wrapT=re[n.wrapT],r}var i=new L(3553);return xe[i.id]=i,o.textureCount++,r(t,n),r.subimage=function(e,t,n,o){t|=0,n|=0,o|=0;var a=b();return s(a,i),a.width=0,a.height=0,h(a,e),a.width=a.width||(i.width>>o)-t,a.height=a.height||(i.height>>o)-n,P(i),d(a,3553,t,n,o),z(),A(a),r},r.resize=function(t,n){var o=0|t,f=0|n||o;if(o===i.width&&f===i.height)return r;r.width=i.width=o,r.height=i.height=f,P(i);for(var u,s=i.channels,c=i.type,l=0;i.mipmask>>l;++l){var p=o>>l,h=f>>l;if(!p||!h)break;u=q.zero.allocType(c,p*h*s),e.texImage2D(3553,l,i.format,p,h,0,i.format,i.type,u),u&&q.zero.freeType(u)}return z(),a.profile&&(i.stats.size=k(i.internalformat,i.type,o,f,!1,!1)),r},r._reglType="texture2d",r._texture=i,a.profile&&(r.stats=i.stats),r.destroy=function(){i.decRef()},r},createCube:function(t,n,r,i,f,u){function l(e,t,n,r,i,o){var f,u=p.texInfo;for(j.call(u),f=0;6>f;++f)m[f]=S();if("number"!=typeof e&&e){if("object"==typeof e)if(t)T(m[0],e),T(m[1],t),T(m[2],n),T(m[3],r),T(m[4],i),T(m[5],o);else if(O(u,e),c(p,e),"faces"in e)for(e=e.faces,f=0;6>f;++f)s(m[f],p),T(m[f],e[f]);else for(f=0;6>f;++f)T(m[f],e)}else for(e=0|e||1,f=0;6>f;++f)E(m[f],e,e);for(s(p,m[0]),p.mipmask=u.genMipmaps?(m[0].width<<1)-1:m[0].mipmask,p.internalformat=m[0].internalformat,l.width=m[0].width,l.height=m[0].height,P(p),f=0;6>f;++f)C(m[f],34069+f);for(F(u,34067),z(),a.profile&&(p.stats.size=k(p.internalformat,p.type,l.width,l.height,u.genMipmaps,!0)),l.format=Z[p.internalformat],l.type=ee[p.type],l.mag=te[u.magFilter],l.min=ne[u.minFilter],l.wrapS=re[u.wrapS],l.wrapT=re[u.wrapT],f=0;6>f;++f)D(m[f]);return l}var p=new L(34067);xe[p.id]=p,o.cubeCount++;var m=Array(6);return l(t,n,r,i,f,u),l.subimage=function(e,t,n,r,i){n|=0,r|=0,i|=0;var o=b();return s(o,p),o.width=0,o.height=0,h(o,t),o.width=o.width||(p.width>>i)-n,o.height=o.height||(p.height>>i)-r,P(p),d(o,34069+e,n,r,i),z(),A(o),l},l.resize=function(t){if((t|=0)!==p.width){l.width=p.width=t,l.height=p.height=t,P(p);for(var n=0;6>n;++n)for(var r=0;p.mipmask>>r;++r)e.texImage2D(34069+n,r,p.format,t>>r,t>>r,0,p.format,p.type,null);return z(),a.profile&&(p.stats.size=k(p.internalformat,p.type,l.width,l.height,!1,!0)),l}},l._reglType="textureCube",l._texture=p,a.profile&&(l.stats=p.stats),l.destroy=function(){p.decRef()},l},clear:function(){for(var t=0;tn;++n)if(0!=(t.mipmask&1<>n,t.height>>n,0,t.internalformat,t.type,null);else for(var r=0;6>r;++r)e.texImage2D(34069+r,n,t.internalformat,t.width>>n,t.height>>n,0,t.internalformat,t.type,null);F(t.texInfo,t.target)})}}}function E(e,t,n,r,i,o){function a(e,t,n){this.target=e,this.texture=t,this.renderbuffer=n;var r=e=0;t?(e=t.width,r=t.height):n&&(e=n.width,r=n.height),this.width=e,this.height=r}function f(e){e&&(e.texture&&e.texture._texture.decRef(),e.renderbuffer&&e.renderbuffer._renderbuffer.decRef())}function u(e,t,n){e&&(e.texture?e.texture._texture.refCount+=1:e.renderbuffer._renderbuffer.refCount+=1)}function s(t,n){n&&(n.texture?e.framebufferTexture2D(36160,t,n.target,n.texture._texture.texture,0):e.framebufferRenderbuffer(36160,t,36161,n.renderbuffer._renderbuffer.renderbuffer))}function c(e){var t=3553,n=null,r=null,i=e;return"object"==typeof e&&(i=e.data,"target"in e&&(t=0|e.target)),"texture2d"===(e=i._reglType)?n=i:"textureCube"===e?n=i:"renderbuffer"===e&&(r=i,t=36161),new a(t,n,r)}function l(e,t,n,o,f){return n?((e=r.create2D({width:e,height:t,format:o,type:f}))._texture.refCount=0,new a(3553,e,null)):((e=i.create({width:e,height:t,format:o}))._renderbuffer.refCount=0,new a(36161,null,e))}function p(e){return e&&(e.texture||e.renderbuffer)}function h(e,t,n){e&&(e.texture?e.texture.resize(t,n):e.renderbuffer&&e.renderbuffer.resize(t,n))}function d(){this.id=k++,A[this.id]=this,this.framebuffer=e.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function m(e){e.colorAttachments.forEach(f),f(e.depthAttachment),f(e.stencilAttachment),f(e.depthStencilAttachment)}function x(t){e.deleteFramebuffer(t.framebuffer),t.framebuffer=null,o.framebufferCount--,delete A[t.id]}function b(t){var r;e.bindFramebuffer(36160,t.framebuffer);var i=t.colorAttachments;for(r=0;ri;++i){for(s=0;se;++e)n[e].resize(r);return t.width=t.height=r,t},_reglType:"framebufferCube",destroy:function(){n.forEach(function(e){e.destroy()})}})},clear:function(){G(A).forEach(x)},restore:function(){G(A).forEach(function(t){t.framebuffer=e.createFramebuffer(),b(t)})}})}function T(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function C(e,t,n,r){function i(e,t,n,r){this.name=e,this.id=t,this.location=n,this.info=r}function o(e,t){for(var n=0;ne&&(e=t.stats.uniformsCount)}),e},n.getMaxAttributesCount=function(){var e=0;return p.forEach(function(t){t.stats.attributesCount>e&&(e=t.stats.attributesCount)}),e}),{clear:function(){var t=e.deleteShader.bind(e);G(s).forEach(t),s={},G(c).forEach(t),c={},p.forEach(function(t){e.deleteProgram(t.program)}),p.length=0,l={},n.shaderCount=0},program:function(e,t,r){var i=l[t];i||(i=l[t]={});var o=i[e];return o||(o=new f(t,e),n.shaderCount++,u(o),i[e]=o,p.push(o)),o},restore:function(){s={},c={};for(var e=0;e"+t+"?"+i+".constant["+t+"]:0;"}).join(""),"}}else{","if(",a,"(",i,".buffer)){",c,"=",f,".createStream(",34962,",",i,".buffer);","}else{",c,"=",f,".getBuffer(",i,".buffer);","}",l,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",c,".dtype;",u.normalized,"=!!",i,".normalized;"),r("size"),r("offset"),r("stride"),r("divisor"),n("}}"),n.exit("if(",u.isStream,"){",f,".destroyStream(",c,");","}"),u})}),a}function E(e,t,n,r,i){var a=_(e),f=function(e,t,n){function r(e){if(e in i){var n=i[e];e=!0;var r,a,f=0|n.x,u=0|n.y;return"width"in n?r=0|n.width:e=!1,"height"in n?a=0|n.height:e=!1,new P(!e&&t&&t.thisDep,!e&&t&&t.contextDep,!e&&t&&t.propDep,function(e,t){var i=e.shared.context,o=r;"width"in n||(o=t.def(i,".","framebufferWidth","-",f));var s=a;return"height"in n||(s=t.def(i,".","framebufferHeight","-",u)),[f,u,o,s]})}if(e in o){var s=o[e];return e=M(s,function(e,t){var n=e.invoke(t,s),r=e.shared.context,i=t.def(n,".x|0"),o=t.def(n,".y|0");return[i,o,t.def('"width" in ',n,"?",n,".width|0:","(",r,".","framebufferWidth","-",i,")"),n=t.def('"height" in ',n,"?",n,".height|0:","(",r,".","framebufferHeight","-",o,")")]}),t&&(e.thisDep=e.thisDep||t.thisDep,e.contextDep=e.contextDep||t.contextDep,e.propDep=e.propDep||t.propDep),e}return t?new P(t.thisDep,t.contextDep,t.propDep,function(e,t){var n=e.shared.context;return[0,0,t.def(n,".","framebufferWidth"),t.def(n,".","framebufferHeight")]}):null}var i=e.static,o=e.dynamic;if(e=r("viewport")){var a=e;e=new P(e.thisDep,e.contextDep,e.propDep,function(e,t){var n=a.append(e,t),r=e.shared.context;return t.set(r,".viewportWidth",n[2]),t.set(r,".viewportHeight",n[3]),n})}return{viewport:e,scissor_box:r("scissor.box")}}(e,a),u=k(e),s=function(e,t){var n=e.static,r=e.dynamic,i={};return re.forEach(function(e){function t(t,o){if(e in n){var f=t(n[e]);i[a]=B(function(){return f})}else if(e in r){var u=r[e];i[a]=M(u,function(e,t){return o(e,t,e.invoke(t,u))})}}var a=b(e);switch(e){case"cull.enable":case"blend.enable":case"dither":case"stencil.enable":case"depth.enable":case"scissor.enable":case"polygonOffset.enable":case"sample.alpha":case"sample.enable":case"depth.mask":return t(function(e){return e},function(e,t,n){return n});case"depth.func":return t(function(e){return ke[e]},function(e,t,n){return t.def(e.constants.compareFuncs,"[",n,"]")});case"depth.range":return t(function(e){return e},function(e,t,n){return[t.def("+",n,"[0]"),t=t.def("+",n,"[1]")]});case"blend.func":return t(function(e){return[we["srcRGB"in e?e.srcRGB:e.src],we["dstRGB"in e?e.dstRGB:e.dst],we["srcAlpha"in e?e.srcAlpha:e.src],we["dstAlpha"in e?e.dstAlpha:e.dst]]},function(e,t,n){function r(e,r){return t.def('"',e,r,'" in ',n,"?",n,".",e,r,":",n,".",e)}e=e.constants.blendFuncs;var i=r("src","RGB"),o=r("dst","RGB"),a=(i=t.def(e,"[",i,"]"),t.def(e,"[",r("src","Alpha"),"]"));return[i,o=t.def(e,"[",o,"]"),a,e=t.def(e,"[",r("dst","Alpha"),"]")]});case"blend.equation":return t(function(e){return"string"==typeof e?[$[e],$[e]]:"object"==typeof e?[$[e.rgb],$[e.alpha]]:void 0},function(e,t,n){var r=e.constants.blendEquations,i=t.def(),o=t.def();return(e=e.cond("typeof ",n,'==="string"')).then(i,"=",o,"=",r,"[",n,"];"),e.else(i,"=",r,"[",n,".rgb];",o,"=",r,"[",n,".alpha];"),t(e),[i,o]});case"blend.color":return t(function(e){return o(4,function(t){return+e[t]})},function(e,t,n){return o(4,function(e){return t.def("+",n,"[",e,"]")})});case"stencil.mask":return t(function(e){return 0|e},function(e,t,n){return t.def(n,"|0")});case"stencil.func":return t(function(e){return[ke[e.cmp||"keep"],e.ref||0,"mask"in e?e.mask:-1]},function(e,t,n){return[e=t.def('"cmp" in ',n,"?",e.constants.compareFuncs,"[",n,".cmp]",":",7680),t.def(n,".ref|0"),t=t.def('"mask" in ',n,"?",n,".mask|0:-1")]});case"stencil.opFront":case"stencil.opBack":return t(function(t){return["stencil.opBack"===e?1029:1028,Ae[t.fail||"keep"],Ae[t.zfail||"keep"],Ae[t.zpass||"keep"]]},function(t,n,r){function i(e){return n.def('"',e,'" in ',r,"?",o,"[",r,".",e,"]:",7680)}var o=t.constants.stencilOps;return["stencil.opBack"===e?1029:1028,i("fail"),i("zfail"),i("zpass")]});case"polygonOffset.offset":return t(function(e){return[0|e.factor,0|e.units]},function(e,t,n){return[t.def(n,".factor|0"),t=t.def(n,".units|0")]});case"cull.face":return t(function(e){var t=0;return"front"===e?t=1028:"back"===e&&(t=1029),t},function(e,t,n){return t.def(n,'==="front"?',1028,":",1029)});case"lineWidth":return t(function(e){return e},function(e,t,n){return n});case"frontFace":return t(function(e){return Ee[e]},function(e,t,n){return t.def(n+'==="cw"?2304:2305')});case"colorMask":return t(function(e){return e.map(function(e){return!!e})},function(e,t,n){return o(4,function(e){return"!!"+n+"["+e+"]"})});case"sample.coverage":return t(function(e){return["value"in e?e.value:1,!!e.invert]},function(e,t,n){return[t.def('"value" in ',n,"?+",n,".value:1"),t=t.def("!!",n,".invert")]})}}),i}(e),c=w(e),l=f.viewport;return l&&(s.viewport=l),(f=f[l=b("scissor.box")])&&(s[l]=f),(a={framebuffer:a,draw:u,shader:c,state:s,dirty:f=0>1)",f],");")}function t(){n(u,".drawArraysInstancedANGLE(",[d,m,x,f],");")}h?g?e():(n("if(",h,"){"),e(),n("}else{"),t(),n("}")):t()}function a(){function e(){n(c+".drawElements("+[d,x,b,m+"<<(("+b+"-5121)>>1)"]+");")}function t(){n(c+".drawArrays("+[d,m,x]+");")}h?g?e():(n("if(",h,"){"),e(),n("}else{"),t(),n("}")):t()}var f,u,s=e.shared,c=s.gl,l=s.draw,p=r.draw,h=function(){var i=p.elements,o=t;return i?((i.contextDep&&r.contextDynamic||i.propDep)&&(o=n),i=i.append(e,o)):i=o.def(l,".","elements"),i&&o("if("+i+")"+c+".bindBuffer(34963,"+i+".buffer.buffer);"),i}(),d=i("primitive"),m=i("offset"),x=function(){var i=p.count,o=t;return i?((i.contextDep&&r.contextDynamic||i.propDep)&&(o=n),i=i.append(e,o)):i=o.def(l,".","count"),i}();if("number"==typeof x){if(0===x)return}else n("if(",x,"){"),n.exit("}");J&&(f=i("instances"),u=e.instancing);var b=h+".type",g=p.elements&&z(p.elements);J&&("number"!=typeof f||0<=f)?"string"==typeof f?(n("if(",f,">0){"),o(),n("}else if(",f,"<0){"),a(),n("}")):o():a()}function W(e,t,n,r,i){return i=(t=y()).proc("body",i),J&&(t.instancing=i.def(t.shared.extensions,".angle_instanced_arrays")),e(t,i,n,r),t.compile().body}function V(e,t,n,r){j(e,t),N(e,t,n,r.attributes,function(){return!0}),U(e,t,n,r.uniforms,function(){return!0}),R(e,t,t,n)}function q(e,t,n,r){function i(){return!0}e.batchId="a1",j(e,t),N(e,t,n,r.attributes,i),U(e,t,n,r.uniforms,i),R(e,t,t,n)}function X(e,t,n,r){function i(e){return e.contextDep&&a||e.propDep}function o(e){return!i(e)}j(e,t);var a=n.contextDep,f=t.def(),u=t.def();e.shared.props=u,e.batchId=f;var s=e.scope(),c=e.scope();t(s.entry,"for(",f,"=0;",f,"<","a1",";++",f,"){",u,"=","a0","[",f,"];",c,"}",s.exit),n.needsContext&&T(e,c,n.context),n.needsFramebuffer&&C(e,c,n.framebuffer),D(e,c,n.state,i),n.profile&&i(n.profile)&&I(e,c,n,!1,!0),r?(N(e,s,n,r.attributes,o),N(e,c,n,r.attributes,i),U(e,s,n,r.uniforms,o),U(e,c,n,r.uniforms,i),R(e,s,c,n)):(t=e.global.def("{}"),r=n.shader.progVar.append(e,c),u=c.def(r,".id"),s=c.def(t,"[",u,"]"),c(e.shared.gl,".useProgram(",r,".program);","if(!",s,"){",s,"=",t,"[",u,"]=",e.link(function(t){return W(q,e,n,t,2)}),"(",r,");}",s,".call(this,a0[",f,"],",f,");"))}function Q(e,n){function r(t){var r=n.shader[t];r&&i.set(o.shader,"."+t,r.append(e,i))}var i=e.proc("scope",3);e.batchId="a2";var o=e.shared,a=o.current;T(e,i,n.context),n.framebuffer&&n.framebuffer.append(e,i),L(Object.keys(n.state)).forEach(function(t){var r=n.state[t].append(e,i);x(r)?r.forEach(function(n,r){i.set(e.next[t],"["+r+"]",n)}):i.set(o.next,"."+t,r)}),I(e,i,n,!0,!0),["elements","offset","count","instances","primitive"].forEach(function(t){var r=n.draw[t];r&&i.set(o.draw,"."+t,""+r.append(e,i))}),Object.keys(n.uniforms).forEach(function(r){i.set(o.uniforms,"["+t.id(r)+"]",n.uniforms[r].append(e,i))}),Object.keys(n.attributes).forEach(function(t){var r=n.attributes[t].append(e,i),o=e.scopeAttrib(t);Object.keys(new Y).forEach(function(e){i.set(o,"."+e,r[e])})}),r("vert"),r("frag"),0=--this.refCount&&a(this)},i.profile&&(r.getTotalRenderbufferSize=function(){var e=0;return Object.keys(c).forEach(function(t){e+=c[t].stats.size}),e}),{create:function(t,n){function a(t,n){var r=0,o=0,c=32854;if("object"==typeof t&&t?("shape"in t?(r=0|(o=t.shape)[0],o=0|o[1]):("radius"in t&&(r=o=0|t.radius),"width"in t&&(r=0|t.width),"height"in t&&(o=0|t.height)),"format"in t&&(c=f[t.format])):"number"==typeof t?(r=0|t,o="number"==typeof n?0|n:r):t||(r=o=1),r!==s.width||o!==s.height||c!==s.format)return a.width=s.width=r,a.height=s.height=o,s.format=c,e.bindRenderbuffer(36161,s.renderbuffer),e.renderbufferStorage(36161,c,r,o),i.profile&&(s.stats.size=xe[s.format]*s.width*s.height),a.format=u[s.format],a}var s=new o(e.createRenderbuffer());return c[s.id]=s,r.renderbufferCount++,a(t,n),a.resize=function(t,n){var r=0|t,o=0|n||r;return r===s.width&&o===s.height?a:(a.width=s.width=r,a.height=s.height=o,e.bindRenderbuffer(36161,s.renderbuffer),e.renderbufferStorage(36161,s.format,r,o),i.profile&&(s.stats.size=xe[s.format]*s.width*s.height),a)},a._reglType="renderbuffer",a._renderbuffer=s,i.profile&&(a.stats=s.stats),a.destroy=function(){s.decRef()},a},clear:function(){G(c).forEach(a)},restore:function(){G(c).forEach(function(t){t.renderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,t.renderbuffer),e.renderbufferStorage(36161,t.format,t.width,t.height)}),e.bindRenderbuffer(36161,null)}}},ge=[];ge[6408]=4,ge[6407]=3;var ve=[];ve[5121]=1,ve[5126]=4,ve[36193]=2;var ye=["x","y","z","w"],_e="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),we={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},ke={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Ae={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Ee={cw:2304,ccw:2305},Te=new P(!1,!1,!1,function(){});return function(e){function t(){if(0===Y.length)w&&w.update(),Z=null;else{Z=W.next(t),l();for(var e=Y.length-1;0<=e;--e){var n=Y[e];n&&n(O,null,0)}x.flush(),w&&w.update()}}function n(){!Z&&0=Y.length&&r()}}}}function c(){var e=Q.viewport,t=Q.scissor_box;e[0]=e[1]=t[0]=t[1]=0,O.viewportWidth=O.framebufferWidth=O.drawingBufferWidth=e[2]=t[2]=x.drawingBufferWidth,O.viewportHeight=O.framebufferHeight=O.drawingBufferHeight=e[3]=t[3]=x.drawingBufferHeight}function l(){O.tick+=1,O.time=m(),c(),q.procs.poll()}function p(){c(),q.procs.refresh(),w&&w.update()}function m(){return(V()-k)/1e3}if(!(e=i(e)))return null;var x=e.gl,b=x.getContextAttributes();x.isContextLost();var g=function(e,t){function n(t){var n;t=t.toLowerCase();try{n=r[t]=e.getExtension(t)}catch(e){}return!!n}for(var r={},i=0;it;++t)ee(U({framebuffer:e.framebuffer.faces[t]},e),u);else ee(e,u);else u(0,e)},prop:H.define.bind(null,1),context:H.define.bind(null,2),this:H.define.bind(null,3),draw:f({}),buffer:function(e){return L.create(e,34962,!1,!1)},elements:function(e){return P.create(e,!1)},texture:B.create2D,cube:B.createCube,renderbuffer:M.create,framebuffer:R.create,framebufferCube:R.createCube,attributes:b,frame:s,on:function(e,t){var n;switch(e){case"frame":return s(t);case"lost":n=$;break;case"restore":n=K;break;case"destroy":n=J}return n.push(t),{cancel:function(){for(var e=0;e2;)k.push(arguments[o]);for(t&&null!=t.children&&(k.length||k.push(t.children),delete t.children);k.length;)if((r=k.pop())&&void 0!==r.pop)for(o=r.length;o--;)k.push(r[o]);else"boolean"==typeof r&&(r=null),(i="function"!=typeof e)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(i=!1)),i&&n?a[a.length-1]+=r:a===A?a=[r]:a.push(r),n=i;var f=new _;return f.nodeName=e,f.children=a,f.attributes=null==t?void 0:t,f.key=null==t?void 0:t.key,void 0!==w.vnode&&w.vnode(f),f}function n(e,t){for(var n in t)e[n]=t[n];return e}function r(e){!e.__d&&(e.__d=!0)&&1==C.push(e)&&(w.debounceRendering||E)(i)}function i(){var e,t=C;for(C=[];e=t.pop();)e.__d&&g(e)}function o(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function a(e){var t=n({},e.attributes);t.children=e.children;var r=e.nodeName.defaultProps;if(void 0!==r)for(var i in r)void 0===t[i]&&(t[i]=r[i]);return t}function f(e){var t=e.parentNode;t&&t.removeChild(e)}function u(e,t,n,r,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),r&&r(e);else if("class"!==t||i)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var o in n)o in r||(e.style[o]="");for(var o in r)e.style[o]="number"==typeof r[o]&&!1===T.test(o)?r[o]+"px":r[o]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var a=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,s,a):e.removeEventListener(t,s,a),(e.__l||(e.__l={}))[t]=r}else if("list"!==t&&"type"!==t&&!i&&t in e){try{e[t]=null==r?"":r}catch(e){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var f=i&&t!==(t=t.replace(/^xlink:?/,""));null==r||!1===r?f?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(f?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function s(e){return this.__l[e.type](w.event&&w.event(e)||e)}function c(){for(var e;e=S.pop();)w.afterMount&&w.afterMount(e),e.componentDidMount&&e.componentDidMount()}function l(e,t,n,r,i,o){D++||(j=null!=i&&void 0!==i.ownerSVGElement,O=null!=e&&!("__preactattr_"in e));var a=p(e,t,n,r,o);return i&&a.parentNode!==i&&i.appendChild(a),--D||(O=!1,o||c()),a}function p(e,t,n,r,i){var s=e,c=j;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||i)?e.nodeValue!=t&&(e.nodeValue=t):(s=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(s,e),h(e,!0))),s.__preactattr_=!0,s;var l,d,x=t.nodeName;if("function"==typeof x)return function(e,t,n,r){var i=e&&e._component,o=i,f=e,u=i&&e._componentConstructor===t.nodeName,s=u,c=a(t);for(;i&&!s&&(i=i.__u);)s=i.constructor===t.nodeName;i&&s&&(!r||i._component)?(b(i,c,3,n,r),e=i.base):(o&&!u&&(v(o),e=f=null),i=m(t.nodeName,c,n),e&&!i.__b&&(i.__b=e,f=null),b(i,c,1,n,r),e=i.base,f&&e!==f&&(f._component=null,h(f,!1)));return e}(e,t,n,r);if(j="svg"===x||"foreignObject"!==x&&j,x=String(x),(!e||!o(e,x))&&(l=x,(d=j?document.createElementNS("http://www.w3.org/2000/svg",l):document.createElement(l)).__n=l,s=d,e)){for(;e.firstChild;)s.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(s,e),h(e,!0)}var g=s.firstChild,y=s.__preactattr_,_=t.children;if(null==y){y=s.__preactattr_={};for(var w=s.attributes,k=w.length;k--;)y[w[k].name]=w[k].value}return!O&&_&&1===_.length&&"string"==typeof _[0]&&null!=g&&void 0!==g.splitText&&null==g.nextSibling?g.nodeValue!=_[0]&&(g.nodeValue=_[0]):(_&&_.length||null!=g)&&function(e,t,n,r,i){var a,u,s,c,l,d=e.childNodes,m=[],x={},b=0,g=0,v=d.length,y=0,_=t?t.length:0;if(0!==v)for(var w=0;w2?[].slice.call(arguments,2):t.children)},Component:y,render:function(e,t,n){return l(n,e,{},!1,t,!1)},rerender:i,options:w};void 0!==t?t.exports=L:self.preact=L}()},{}],32:[function(e,t,n){(function(n){for(var r=e("performance-now"),i="undefined"==typeof window?n:window,o=["moz","webkit"],a="AnimationFrame",f=i["request"+a],u=i["cancel"+a]||i["cancelRequest"+a],s=0;!f&&s 0.0 ? 1.0 : 0.0;\n }\n\n float psi(vec2 xt) {\n return uM / (2.0 * PI * (uT + xt.y)) * (step(u(xt, 1.0)) - step(u(xt, -1.0)));\n }\n\n void main () {\n gl_FragColor = colormap(psi(vXt - vec2(uX0, uT)) * uColorScaleFactor);\n if (vXt.y - uT > (-uRes.y * 5.0 * (uAxes.w - uAxes.z)) && ((vXt.x - uV * uT) < -uB || (vXt.x - uV * uT) > uB)) gl_FragColor = vec4(1);\n }\n ",""]),attributes:{xy:[-4,-4,0,4,4,-4]},scissor:{enable:!0,box:{x:0,y:0,width:function(e){return e.framebufferWidth},height:function(e){return Math.max(0,Math.ceil((f-l)/(p-l)*e.framebufferHeight))}}},depth:{enable:!1},count:3}),v=!0;t.frame(function(){v&&(x(function(){b(),g()}),v=!1)})})}),e("insert-css")("\n.axis-label {\n font-family: sans-serif;\n color: white;\n position: fixed;\n font-weight: 200;\n font-style: italic;\n}\n.x-axis {\n bottom: 8px;\n right: 10px;\n}\n.y-axis {\n transform: translate(0, 100%) rotate(-90deg) translate(-50%, 0);\n transform-origin: 0% 0%;\n left: 8px;\n bottom: 50%;\n}\n.\n")},{"./control-panel-2":27,"./control-panel-2/gui":26,"./plasma":42,"fail-nicely":18,glslify:19,h:20,"insert-css":21,"mouse-change":22,regl:25}],42:[function(e,t,n){t.exports=[[.050383,.029803,.527975,1],[.063536,.028426,.533124,1],[.075353,.027206,.538007,1],[.086222,.026125,.542658,1],[.096379,.025165,.547103,1],[.10598,.024309,.551368,1],[.115124,.023556,.555468,1],[.123903,.022878,.559423,1],[.132381,.022258,.56325,1],[.140603,.021687,.566959,1],[.148607,.021154,.570562,1],[.156421,.020651,.574065,1],[.16407,.020171,.577478,1],[.171574,.019706,.580806,1],[.17895,.019252,.584054,1],[.186213,.018803,.587228,1],[.193374,.018354,.59033,1],[.200445,.017902,.593364,1],[.207435,.017442,.596333,1],[.21435,.016973,.599239,1],[.221197,.016497,.602083,1],[.227983,.016007,.604867,1],[.234715,.015502,.607592,1],[.241396,.014979,.610259,1],[.248032,.014439,.612868,1],[.254627,.013882,.615419,1],[.261183,.013308,.617911,1],[.267703,.012716,.620346,1],[.274191,.012109,.622722,1],[.280648,.011488,.625038,1],[.287076,.010855,.627295,1],[.293478,.010213,.62949,1],[.299855,.009561,.631624,1],[.30621,.008902,.633694,1],[.312543,.008239,.6357,1],[.318856,.007576,.63764,1],[.32515,.006915,.639512,1],[.331426,.006261,.641316,1],[.337683,.005618,.643049,1],[.343925,.004991,.64471,1],[.35015,.004382,.646298,1],[.356359,.003798,.64781,1],[.362553,.003243,.649245,1],[.368733,.002724,.650601,1],[.374897,.002245,.651876,1],[.381047,.001814,.653068,1],[.387183,.001434,.654177,1],[.393304,.001114,.655199,1],[.399411,859e-6,.656133,1],[.405503,678e-6,.656977,1],[.41158,577e-6,.65773,1],[.417642,564e-6,.65839,1],[.423689,646e-6,.658956,1],[.429719,831e-6,.659425,1],[.435734,.001127,.659797,1],[.441732,.00154,.660069,1],[.447714,.00208,.66024,1],[.453677,.002755,.66031,1],[.459623,.003574,.660277,1],[.46555,.004545,.660139,1],[.471457,.005678,.659897,1],[.477344,.00698,.659549,1],[.48321,.00846,.659095,1],[.489055,.010127,.658534,1],[.494877,.01199,.657865,1],[.500678,.014055,.657088,1],[.506454,.016333,.656202,1],[.512206,.018833,.655209,1],[.517933,.021563,.654109,1],[.523633,.024532,.652901,1],[.529306,.027747,.651586,1],[.534952,.031217,.650165,1],[.54057,.03495,.64864,1],[.546157,.038954,.64701,1],[.551715,.043136,.645277,1],[.557243,.047331,.643443,1],[.562738,.051545,.641509,1],[.568201,.055778,.639477,1],[.573632,.060028,.637349,1],[.579029,.064296,.635126,1],[.584391,.068579,.632812,1],[.589719,.072878,.630408,1],[.595011,.07719,.627917,1],[.600266,.081516,.625342,1],[.605485,.085854,.622686,1],[.610667,.090204,.619951,1],[.615812,.094564,.61714,1],[.620919,.098934,.614257,1],[.625987,.103312,.611305,1],[.631017,.107699,.608287,1],[.636008,.112092,.605205,1],[.640959,.116492,.602065,1],[.645872,.120898,.598867,1],[.650746,.125309,.595617,1],[.65558,.129725,.592317,1],[.660374,.134144,.588971,1],[.665129,.138566,.585582,1],[.669845,.142992,.582154,1],[.674522,.147419,.578688,1],[.67916,.151848,.575189,1],[.683758,.156278,.57166,1],[.688318,.160709,.568103,1],[.69284,.165141,.564522,1],[.697324,.169573,.560919,1],[.701769,.174005,.557296,1],[.706178,.178437,.553657,1],[.710549,.182868,.550004,1],[.714883,.187299,.546338,1],[.719181,.191729,.542663,1],[.723444,.196158,.538981,1],[.72767,.200586,.535293,1],[.731862,.205013,.531601,1],[.736019,.209439,.527908,1],[.740143,.213864,.524216,1],[.744232,.218288,.520524,1],[.748289,.222711,.516834,1],[.752312,.227133,.513149,1],[.756304,.231555,.509468,1],[.760264,.235976,.505794,1],[.764193,.240396,.502126,1],[.76809,.244817,.498465,1],[.771958,.249237,.494813,1],[.775796,.253658,.491171,1],[.779604,.258078,.487539,1],[.783383,.2625,.483918,1],[.787133,.266922,.480307,1],[.790855,.271345,.476706,1],[.794549,.27577,.473117,1],[.798216,.280197,.469538,1],[.801855,.284626,.465971,1],[.805467,.289057,.462415,1],[.809052,.293491,.45887,1],[.812612,.297928,.455338,1],[.816144,.302368,.451816,1],[.819651,.306812,.448306,1],[.823132,.311261,.444806,1],[.826588,.315714,.441316,1],[.830018,.320172,.437836,1],[.833422,.324635,.434366,1],[.836801,.329105,.430905,1],[.840155,.33358,.427455,1],[.843484,.338062,.424013,1],[.846788,.342551,.420579,1],[.850066,.347048,.417153,1],[.853319,.351553,.413734,1],[.856547,.356066,.410322,1],[.85975,.360588,.406917,1],[.862927,.365119,.403519,1],[.866078,.36966,.400126,1],[.869203,.374212,.396738,1],[.872303,.378774,.393355,1],[.875376,.383347,.389976,1],[.878423,.387932,.3866,1],[.881443,.392529,.383229,1],[.884436,.397139,.37986,1],[.887402,.401762,.376494,1],[.89034,.406398,.37313,1],[.89325,.411048,.369768,1],[.896131,.415712,.366407,1],[.898984,.420392,.363047,1],[.901807,.425087,.359688,1],[.904601,.429797,.356329,1],[.907365,.434524,.35297,1],[.910098,.439268,.34961,1],[.9128,.444029,.346251,1],[.915471,.448807,.34289,1],[.918109,.453603,.339529,1],[.920714,.458417,.336166,1],[.923287,.463251,.332801,1],[.925825,.468103,.329435,1],[.928329,.472975,.326067,1],[.930798,.477867,.322697,1],[.933232,.48278,.319325,1],[.93563,.487712,.315952,1],[.93799,.492667,.312575,1],[.940313,.497642,.309197,1],[.942598,.502639,.305816,1],[.944844,.507658,.302433,1],[.947051,.512699,.299049,1],[.949217,.517763,.295662,1],[.951344,.52285,.292275,1],[.953428,.52796,.288883,1],[.95547,.533093,.28549,1],[.957469,.53825,.282096,1],[.959424,.543431,.278701,1],[.961336,.548636,.275305,1],[.963203,.553865,.271909,1],[.965024,.559118,.268513,1],[.966798,.564396,.265118,1],[.968526,.5697,.261721,1],[.970205,.575028,.258325,1],[.971835,.580382,.254931,1],[.973416,.585761,.25154,1],[.974947,.591165,.248151,1],[.976428,.596595,.244767,1],[.977856,.602051,.241387,1],[.979233,.607532,.238013,1],[.980556,.613039,.234646,1],[.981826,.618572,.231287,1],[.983041,.624131,.227937,1],[.984199,.629718,.224595,1],[.985301,.63533,.221265,1],[.986345,.640969,.217948,1],[.987332,.646633,.214648,1],[.98826,.652325,.211364,1],[.989128,.658043,.2081,1],[.989935,.663787,.204859,1],[.990681,.669558,.201642,1],[.991365,.675355,.198453,1],[.991985,.681179,.195295,1],[.992541,.68703,.19217,1],[.993032,.692907,.189084,1],[.993456,.69881,.186041,1],[.993814,.704741,.183043,1],[.994103,.710698,.180097,1],[.994324,.716681,.177208,1],[.994474,.722691,.174381,1],[.994553,.728728,.171622,1],[.994561,.734791,.168938,1],[.994495,.74088,.166335,1],[.994355,.746995,.163821,1],[.994141,.753137,.161404,1],[.993851,.759304,.159092,1],[.993482,.765499,.156891,1],[.993033,.77172,.154808,1],[.992505,.777967,.152855,1],[.991897,.784239,.151042,1],[.991209,.790537,.149377,1],[.990439,.796859,.14787,1],[.989587,.803205,.146529,1],[.988648,.809579,.145357,1],[.987621,.815978,.144363,1],[.986509,.822401,.143557,1],[.985314,.828846,.142945,1],[.984031,.835315,.142528,1],[.982653,.841812,.142303,1],[.98119,.848329,.142279,1],[.979644,.854866,.142453,1],[.977995,.861432,.142808,1],[.976265,.868016,.143351,1],[.974443,.874622,.144061,1],[.97253,.88125,.144923,1],[.970533,.887896,.145919,1],[.968443,.894564,.147014,1],[.966271,.901249,.14818,1],[.964021,.90795,.14937,1],[.961681,.914672,.15052,1],[.959276,.921407,.151566,1],[.956808,.928152,.152409,1],[.954287,.934908,.152921,1],[.951726,.941671,.152925,1],[.949151,.948435,.152178,1],[.946602,.95519,.150328,1],[.944152,.961916,.146861,1],[.941896,.96859,.140956,1],[.940015,.975158,.131326,1]].map(function(e){return e.map(function(e){return Math.max(0,Math.min(255,256*e))})})},{}]},{},[41]);