(self.webpackChunkalvanon_analytics_platform_frontend=self.webpackChunkalvanon_analytics_platform_frontend||[]).push([[8674],{28494(e){e.exports=function(){"use strict";var e=function(e,t){for(var r=Object.keys(t),n=0;n1&&t===r&&('"'===t||"'"===t))return['"'+n(e.substr(1,e.length-2))+'"'];var a=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(a)return i(e.substr(0,a.index)).concat(i(a[1])).concat(i(e.substr(a.index+a[0].length)));var f=e.split(".");if(1===f.length)return['"'+n(e)+'"'];for(var o=[],u=0;u65535)<<4,t|=r=((e>>>=t)>255)<<3,t|=r=((e>>>=r)>15)<<2,(t|=r=((e>>>=r)>3)<<1)|(e>>>=r)>>1}function h(){var e=p(8,function(){return[]});function t(t){var r=function(e){for(var t=16;t<=1<<28;t*=16)if(e<=t)return t;return 0}(t),n=e[d(r)>>2];return n.length>0?n.pop():new ArrayBuffer(r)}function r(t){e[d(t.byteLength)>>2].push(t)}return{alloc:t,free:r,allocType:function(e,r){var n=null;switch(e){case 5120:n=new Int8Array(t(r),0,r);break;case 5121:n=new Uint8Array(t(r),0,r);break;case 5122:n=new Int16Array(t(2*r),0,r);break;case 5123:n=new Uint16Array(t(2*r),0,r);break;case 5124:n=new Int32Array(t(4*r),0,r);break;case 5125:n=new Uint32Array(t(4*r),0,r);break;case 5126:n=new Float32Array(t(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(e){r(e.buffer)}}}var m=h();m.zero=h();var v=3553,b=6408,g=5126,y=36160,x=function(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array||e instanceof Uint8ClampedArray};function w(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)||x(e.data))}var A=function(e){return Object.keys(e).map(function(t){return e[t]})},k={shape:function(e){for(var t=[],r=e;r.length;r=r[0])t.push(r.length);return t},flatten:function(e,t,r,n){var i=1;if(t.length)for(var a=0;a>>31<<15,a=(n<<1>>>24)-127,f=n>>13&1023;if(a<-24)t[r]=i;else if(a<-14){var o=-14-a;t[r]=i+(f+1024>>o)}else t[r]=a>15?i+31744:i+(a+15<<10)+f}return t}function Q(e){return Array.isArray(e)||x(e)}var q=3553,G=34067,Y=34069,X=6408,J=6406,K=6407,Z=6409,$=6410,ee=32855,te=6402,re=34041,ne=35904,ie=35906,ae=36193,fe=33776,oe=33777,ue=33778,se=5121,ce=5123,le=5125,pe=5126,de=33071,he=9728,me=9984,ve=9987,be=4352,ge=33984,ye=[me,9986,9985,ve],xe=[0,Z,$,K,X],we={};function Ae(e){return"[object "+e+"]"}we[6409]=we[6406]=we[6402]=1,we[34041]=we[6410]=2,we[6407]=we[35904]=3,we[6408]=we[35906]=4;var ke=Ae("HTMLCanvasElement"),Oe=Ae("OffscreenCanvas"),Ee=Ae("CanvasRenderingContext2D"),_e=Ae("ImageBitmap"),De=Ae("HTMLImageElement"),Te=Ae("HTMLVideoElement"),Ce=Object.keys(_).concat([ke,Oe,Ee,_e,De,Te]),Se=[];Se[5121]=1,Se[5126]=4,Se[36193]=2,Se[5123]=2,Se[5125]=4;var je=[];function Ve(e){return Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}function Fe(e){return!!Array.isArray(e)&&!(0===e.length||!Q(e[0]))}function Be(e){return Object.prototype.toString.call(e)}function ze(e){return Be(e)===ke}function Ie(e){return Be(e)===Oe}function Pe(e){if(!e)return!1;var t=Be(e);return Ce.indexOf(t)>=0||Ve(e)||Fe(e)||w(e)}function Le(e){return 0|_[Object.prototype.toString.call(e)]}function Me(e,t){return m.allocType(e.type===ae?pe:e.type,t)}function Re(e,t){e.type===ae?(e.data=W(t),m.freeType(t)):e.data=t}function Ue(e,t,r,n,i,a){var f;if(f=void 0!==je[e]?je[e]:we[e]*Se[t],a&&(f*=6),i){for(var o=0,u=r;u>=1;)o+=f*u*u,u/=2;return o}return f*r*n}function He(t,r,n,i,a,f,o){var u={"don't care":be,"dont care":be,nice:4354,fast:4353},s={repeat:10497,clamp:de,mirror:33648},c={nearest:he,linear:9729},l=e({mipmap:ve,"nearest mipmap nearest":me,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":ve},c),p={none:0,browser:37444},d={uint8:se,rgba4:32819,rgb565:33635,"rgb5 a1":32820},h={alpha:J,luminance:Z,"luminance alpha":$,rgb:K,rgba:X,rgba4:32854,"rgb5 a1":ee,rgb565:36194},v={};r.ext_srgb&&(h.srgb=ne,h.srgba=ie),r.oes_texture_float&&(d.float32=d.float=pe),r.oes_texture_half_float&&(d.float16=d["half float"]=ae),r.webgl_depth_texture&&(e(h,{depth:te,"depth stencil":re}),e(d,{uint16:ce,uint32:le,"depth stencil":34042})),r.webgl_compressed_texture_s3tc&&e(v,{"rgb s3tc dxt1":fe,"rgba s3tc dxt1":oe,"rgba s3tc dxt3":ue,"rgba s3tc dxt5":33779}),r.webgl_compressed_texture_atc&&e(v,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798}),r.webgl_compressed_texture_pvrtc&&e(v,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843}),r.webgl_compressed_texture_etc1&&(v["rgb etc1"]=36196);var b=Array.prototype.slice.call(t.getParameter(34467));Object.keys(v).forEach(function(e){var t=v[e];b.indexOf(t)>=0&&(h[e]=t)});var g=Object.keys(h);n.textureFormats=g;var y=[];Object.keys(h).forEach(function(e){var t=h[e];y[t]=e});var O=[];Object.keys(d).forEach(function(e){var t=d[e];O[t]=e});var E=[];Object.keys(c).forEach(function(e){E[c[e]]=e});var _=[];Object.keys(l).forEach(function(e){var t=l[e];_[t]=e});var D=[];Object.keys(s).forEach(function(e){D[s[e]]=e});var T=g.reduce(function(e,t){var n=h[t];return n===Z||n===J||n===Z||n===$||n===te||n===re||r.ext_srgb&&(n===ne||n===ie)?e[n]=n:n===ee||t.indexOf("rgba")>=0?e[n]=X:e[n]=K,e},{});function C(){this.internalformat=X,this.format=X,this.type=se,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=37444,this.width=0,this.height=0,this.channels=0}function S(e,t){e.internalformat=t.internalformat,e.format=t.format,e.type=t.type,e.compressed=t.compressed,e.premultiplyAlpha=t.premultiplyAlpha,e.flipY=t.flipY,e.unpackAlignment=t.unpackAlignment,e.colorSpace=t.colorSpace,e.width=t.width,e.height=t.height,e.channels=t.channels}function j(e,t){if("object"==typeof t&&t){if("premultiplyAlpha"in t&&(e.premultiplyAlpha=t.premultiplyAlpha),"flipY"in t&&(e.flipY=t.flipY),"alignment"in t&&(e.unpackAlignment=t.alignment),"colorSpace"in t&&(e.colorSpace=p[t.colorSpace]),"type"in t){var r=t.type;e.type=d[r]}var n=e.width,i=e.height,a=e.channels,f=!1;"shape"in t?(n=t.shape[0],i=t.shape[1],3===t.shape.length&&(a=t.shape[2],f=!0)):("radius"in t&&(n=i=t.radius),"width"in t&&(n=t.width),"height"in t&&(i=t.height),"channels"in t&&(a=t.channels,f=!0)),e.width=0|n,e.height=0|i,e.channels=0|a;var o=!1;if("format"in t){var u=t.format,s=e.internalformat=h[u];e.format=T[s],u in d&&("type"in t||(e.type=d[u])),u in v&&(e.compressed=!0),o=!0}!f&&o?e.channels=we[e.format]:f&&!o&&e.channels!==xe[e.format]&&(e.format=e.internalformat=xe[e.channels])}}function V(e){t.pixelStorei(37440,e.flipY),t.pixelStorei(37441,e.premultiplyAlpha),t.pixelStorei(37443,e.colorSpace),t.pixelStorei(3317,e.unpackAlignment)}function F(){C.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function B(e,t){var r=null;if(Pe(t)?r=t:t&&(j(e,t),"x"in t&&(e.xOffset=0|t.x),"y"in t&&(e.yOffset=0|t.y),Pe(t.data)&&(r=t.data)),t.copy){var n=a.viewportWidth,i=a.viewportHeight;e.width=e.width||n-e.xOffset,e.height=e.height||i-e.yOffset,e.needsCopy=!0}else if(r){if(x(r))e.channels=e.channels||4,e.data=r,"type"in t||e.type!==se||(e.type=Le(r));else if(Ve(r))e.channels=e.channels||4,function(e,t){var r=t.length;switch(e.type){case se:case ce:case le:case pe:var n=m.allocType(e.type,r);n.set(t),e.data=n;break;case ae:e.data=W(t)}}(e,r),e.alignment=1,e.needsFree=!0;else if(w(r)){var f=r.data;Array.isArray(f)||e.type!==se||(e.type=Le(f));var o,u,s,c,l,p,d=r.shape,h=r.stride;3===d.length?(s=d[2],p=h[2]):(s=1,p=1),o=d[0],u=d[1],c=h[0],l=h[1],e.alignment=1,e.width=o,e.height=u,e.channels=s,e.format=e.internalformat=xe[s],e.needsFree=!0,function(e,t,r,n,i,a){for(var f=e.width,o=e.height,u=e.channels,s=Me(e,f*o*u),c=0,l=0;l>=i,r.height>>=i,B(r,n[i]),e.mipmask|=1<=0&&!("faces"in t)&&(e.genMipmaps=!0)}if("mag"in t){var n=t.mag;e.magFilter=c[n]}var i=e.wrapS,a=e.wrapT;if("wrap"in t){var f=t.wrap;"string"==typeof f?i=a=s[f]:Array.isArray(f)&&(i=s[f[0]],a=s[f[1]])}else{if("wrapS"in t){var o=t.wrapS;i=s[o]}if("wrapT"in t){var p=t.wrapT;a=s[p]}}if(e.wrapS=i,e.wrapT=a,"anisotropic"in t&&(t.anisotropic,e.anisotropic=t.anisotropic),"mipmap"in t){var d=!1;switch(typeof t.mipmap){case"string":e.mipmapHint=u[t.mipmap],e.genMipmaps=!0,d=!0;break;case"boolean":d=e.genMipmaps=t.mipmap;break;case"object":e.genMipmaps=!1,d=!0}d&&!("min"in t)&&(e.minFilter=me)}}function je(e,n){t.texParameteri(n,10241,e.minFilter),t.texParameteri(n,10240,e.magFilter),t.texParameteri(n,10242,e.wrapS),t.texParameteri(n,10243,e.wrapT),r.ext_texture_filter_anisotropic&&t.texParameteri(n,34046,e.anisotropic),e.genMipmaps&&(t.hint(33170,e.mipmapHint),t.generateMipmap(n))}var He=0,Ne={},We=n.maxTextureUnits,Qe=Array(We).map(function(){return null});function qe(e){C.call(this),this.mipmask=0,this.internalformat=X,this.id=He++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Ce,o.profile&&(this.stats={size:0})}function Ge(e){t.activeTexture(ge),t.bindTexture(e.target,e.texture)}function Ye(){var e=Qe[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(q,null)}function Xe(e){var r=e.texture,n=e.unit,i=e.target;n>=0&&(t.activeTexture(ge+n),t.bindTexture(i,null),Qe[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete Ne[e.id],f.textureCount--}return e(qe.prototype,{bind:function(){var e=this;e.bindCount+=1;var r=e.unit;if(r<0){for(var n=0;n0)continue;i.unit=-1}Qe[n]=e,r=n;break}o.profile&&f.maxTextureUnits>u)-f,s.height=s.height||(n.height>>u)-o,Ge(n),I(s,q,f,o,u),Ye(),M(s),i},i.resize=function(e,r){var a=0|e,f=0|r||a;if(a===n.width&&f===n.height)return i;i.width=n.width=a,i.height=n.height=f,Ge(n);for(var u=0;n.mipmask>>u;++u){var s=a>>u,c=f>>u;if(!s||!c)break;t.texImage2D(q,u,n.format,s,c,0,n.format,n.type,null)}return Ye(),o.profile&&(n.stats.size=Ue(n.internalformat,n.type,a,f,!1,!1)),i},i._reglType="texture2d",i._texture=n,o.profile&&(i.stats=n.stats),i.destroy=function(){n.decRef()},i},createCube:function(e,r,n,i,a,u){var s=new qe(G);Ne[s.id]=s,f.cubeCount++;var c=new Array(6);function l(e,t,r,n,i,a){var f,u=s.texInfo;for(Ce.call(u),f=0;f<6;++f)c[f]=ke();if("number"!=typeof e&&e){if("object"==typeof e)if(t)H(c[0],e),H(c[1],t),H(c[2],r),H(c[3],n),H(c[4],i),H(c[5],a);else if(Se(u,e),j(s,e),"faces"in e){var p=e.faces;for(f=0;f<6;++f)S(c[f],s),H(c[f],p[f])}else for(f=0;f<6;++f)H(c[f],e)}else{var d=0|e||1;for(f=0;f<6;++f)U(c[f],d,d)}for(S(s,c[0]),u.genMipmaps?s.mipmask=(c[0].width<<1)-1:s.mipmask=c[0].mipmask,s.internalformat=c[0].internalformat,l.width=c[0].width,l.height=c[0].height,Ge(s),f=0;f<6;++f)N(c[f],Y+f);for(je(u,G),Ye(),o.profile&&(s.stats.size=Ue(s.internalformat,s.type,l.width,l.height,u.genMipmaps,!0)),l.format=y[s.internalformat],l.type=O[s.type],l.mag=E[u.magFilter],l.min=_[u.minFilter],l.wrapS=D[u.wrapS],l.wrapT=D[u.wrapT],f=0;f<6;++f)Oe(c[f]);return l}return l(e,r,n,i,a,u),l.subimage=function(e,t,r,n,i){var a=0|r,f=0|n,o=0|i,u=L();return S(u,s),u.width=0,u.height=0,B(u,t),u.width=u.width||(s.width>>o)-a,u.height=u.height||(s.height>>o)-f,Ge(s),I(u,Y+e,a,f,o),Ye(),M(u),l},l.resize=function(e){var r=0|e;if(r!==s.width){l.width=s.width=r,l.height=s.height=r,Ge(s);for(var n=0;n<6;++n)for(var i=0;s.mipmask>>i;++i)t.texImage2D(Y+n,i,s.format,r>>i,r>>i,0,s.format,s.type,null);return Ye(),o.profile&&(s.stats.size=Ue(s.internalformat,s.type,l.width,l.height,!1,!0)),l}},l._reglType="textureCube",l._texture=s,o.profile&&(l.stats=s.stats),l.destroy=function(){s.decRef()},l},clear:function(){for(var e=0;e>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(Y+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);je(e.texInfo,e.target)})},refresh:function(){for(var e=0;e>>4&15)+r.charAt(15&t);return n}(function(e){return function(e){for(var t="",r=0;r<32*e.length;r+=8)t+=String.fromCharCode(e[r>>5]>>>24-r%32&255);return t}(function(e,t){var r,n,i,a,f,o,u,s,c,l,p,d,h=new Array(1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225),m=new Array(64);for(e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t,c=0;c>2),r=0;r>5]|=(255&e.charCodeAt(r/8))<<24-r%32;return t}(e),8*e.length))}(function(e){for(var t,r,n="",i=-1;++i>>6&31,128|63&t):t<=65535?n+=String.fromCharCode(224|t>>>12&15,128|t>>>6&63,128|63&t):t<=2097151&&(n+=String.fromCharCode(240|t>>>18&7,128|t>>>12&63,128|t>>>6&63,128|63&t));return n}(e)))}function rt(e,t){return e>>>t|e<<32-t}function nt(e,t){return e>>>t}function it(e,t,r){return e&t^~e&r}function at(e,t,r){return e&t^e&r^t&r}function ft(e){return rt(e,2)^rt(e,13)^rt(e,22)}function ot(e){return rt(e,6)^rt(e,11)^rt(e,25)}function ut(e){return rt(e,7)^rt(e,18)^nt(e,3)}function st(e){return rt(e,17)^rt(e,19)^nt(e,10)}var ct=new Array(1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998);function lt(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function pt(e){return Array.prototype.slice.call(e)}function dt(e){return pt(e).join("")}var ht="xyzw".split(""),mt="dither",vt="blend.enable",bt="blend.color",gt="blend.equation",yt="blend.func",xt="depth.enable",wt="depth.func",At="depth.range",kt="depth.mask",Ot="colorMask",Et="cull.enable",_t="cull.face",Dt="frontFace",Tt="lineWidth",Ct="polygonOffset.enable",St="polygonOffset.offset",jt="sample.alpha",Vt="sample.enable",Ft="sample.coverage",Bt="stencil.enable",zt="stencil.mask",It="stencil.func",Pt="stencil.opFront",Lt="stencil.opBack",Mt="scissor.enable",Rt="scissor.box",Ut="viewport",Ht="profile",Nt="framebuffer",Wt="vert",Qt="frag",qt="elements",Gt="primitive",Yt="count",Xt="offset",Jt="instances",Kt="vao",Zt="Width",$t="Height",er=Nt+Zt,tr=Nt+$t,rr=Ut+Zt,nr=Ut+$t,ir="drawingBuffer",ar=ir+Zt,fr=ir+$t,or=[yt,gt,It,Pt,Lt,Ft,Ut,Rt,St],ur=34962,sr=34963,cr=35664,lr=35665,pr=35666,dr=35667,hr=35668,mr=35669,vr=35671,br=35672,gr=35673,yr=35674,xr=35675,wr=35676,Ar=35678,kr=35680,Or=1028,Er=1029,_r=2305,Dr=7680,Tr={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},Cr={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},Sr={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},jr={cw:2304,ccw:_r};function Vr(e){return Array.isArray(e)||x(e)||w(e)}function Fr(e){return e.sort(function(e,t){return e===Ut?-1:t===Ut?1:e=1,n>=2,t)}if(4===r){var i=e.data;return new Br(i.thisDep,i.contextDep,i.propDep,t)}if(5===r)return new Br(!1,!1,!1,t);if(6===r){for(var a=!1,f=!1,o=!1,u=0;u=1&&(f=!0),c>=2&&(o=!0)}else 4===s.type&&(a=a||s.data.thisDep,f=f||s.data.contextDep,o=o||s.data.propDep)}return new Br(a,f,o,t)}return new Br(3===r,2===r,1===r,t)}var Lr=new Br(!1,!1,!1,function(){});function Mr(t,r,n,i,a,o,u,s,c,l,d,h,m,v,b,g){var y=l.Record,x={add:32774,subtract:32778,"reverse subtract":32779};n.ext_blend_minmax&&(x.min=32775,x.max=32776);var w=n.angle_instanced_arrays,A=n.webgl_draw_buffers,k=n.oes_vertex_array_object,O={dirty:!0,profile:g.profile},E={},_=[],T={},C={};function S(e){return e.replace(".","_")}function j(e,t,r){var n=S(e);_.push(e),E[n]=O[n]=!!r,T[n]=t}function V(e,t,r){var n=S(e);_.push(e),Array.isArray(r)?(O[n]=r.slice(),E[n]=r.slice()):O[n]=E[n]=r,C[n]=t}function F(e){return!!isNaN(e)}j(mt,3024),j(vt,3042),V(bt,"blendColor",[0,0,0,0]),V(gt,"blendEquationSeparate",[32774,32774]),V(yt,"blendFuncSeparate",[1,0,1,0]),j(xt,2929,!0),V(wt,"depthFunc",513),V(At,"depthRange",[0,1]),V(kt,"depthMask",!0),V(Ot,Ot,[!0,!0,!0,!0]),j(Et,2884),V(_t,"cullFace",Er),V(Dt,Dt,_r),V(Tt,Tt,1),j(Ct,32823),V(St,"polygonOffset",[0,0]),j(jt,32926),j(Vt,32928),V(Ft,"sampleCoverage",[1,!1]),j(Bt,2960),V(zt,"stencilMask",-1),V(It,"stencilFunc",[519,0,-1]),V(Pt,"stencilOpSeparate",[Or,Dr,Dr,Dr]),V(Lt,"stencilOpSeparate",[Er,Dr,Dr,Dr]),j(Mt,3089),V(Rt,"scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),V(Ut,Ut,[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var B={gl:t,context:m,strings:r,next:E,current:O,draw:h,elements:o,buffer:a,shader:d,attributes:l.state,vao:l,uniforms:c,framebuffer:s,extensions:n,timer:v,isBufferArgs:Vr},z={primTypes:P,compareFuncs:Cr,blendFuncs:Tr,blendEquations:x,stencilOps:Sr,glTypes:D,orientationType:jr};A&&(z.backBuffer=[Er],z.drawBuffer=p(i.maxDrawbuffers,function(e){return 0===e?[0]:p(e,function(e){return 36064+e})}));var I=0;function L(){var t=function(t){var r=t&&t.cache,n=0,i=[],a=[],f=[];function o(){var t=[],r=[];return e(function(){t.push.apply(t,pt(arguments))},{def:function(){var e="v"+n++;return r.push(e),arguments.length>0&&(t.push(e,"="),t.push.apply(t,pt(arguments)),t.push(";")),e},toString:function(){return dt([r.length>0?"var "+r.join(",")+";":"",dt(t)])}})}function u(){var t=o(),r=o(),n=t.toString,i=r.toString;function a(e,n){r(e,n,"=",t.def(e,n),";")}return e(function(){t.apply(t,pt(arguments))},{def:t.def,entry:t,exit:r,save:a,set:function(e,r,n){a(e,r),t(e,r,"=",n,";")},toString:function(){return n()+i()}})}var s=o(),c={};return{global:s,link:function(e,t){var r=t&&t.stable;if(!r)for(var o=0;o0)return null;var n=t.static,i=Object.keys(n);if(i.length>0&&"number"==typeof n[i[0]]){for(var a=[],f=0;f0,k={framebuffer:h,draw:v,shader:g,state:b,dirty:A,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(k.profile=function(e){var t,r=e.static,n=e.dynamic;if(Ht in r){var i=!!r[Ht];(t=Ir(function(e,t){return i})).enable=i}else if(Ht in n){var a=n[Ht];t=Pr(a,function(e,t){return e.invoke(t,a)})}return t}(e),k.uniforms=function(e){var t=e.static,r=e.dynamic,n={};return Object.keys(t).forEach(function(e){var r,i=t[e];if("number"==typeof i||"boolean"==typeof i)r=Ir(function(){return i});else if("function"==typeof i){var a=i._reglType;"texture2d"===a||"textureCube"===a?r=Ir(function(e){return e.link(i)}):"framebuffer"!==a&&"framebufferCube"!==a||(r=Ir(function(e){return e.link(i.color[0])}))}else Q(i)&&(r=Ir(function(e){return e.global.def("[",p(i.length,function(e){return i[e]}),"]")}));r.value=i,n[e]=r}),Object.keys(r).forEach(function(e){var t=r[e];n[e]=Pr(t,function(e,r){return e.invoke(r,t)})}),n}(i),k.drawVAO=k.scopeVAO=v.vao,!k.drawVAO&&g.program&&!c&&n.angle_instanced_arrays&&v.static.elements){var O=!0,E=g.program.attributes.map(function(e){var r=t.static[e];return O=O&&!!r,r});if(O&&E.length>0){var T=l.getVAO(l.createVAO({attributes:E,elements:v.static.elements}));k.drawVAO=new Br(null,null,null,function(e,t){return e.link(T)}),k.useVAO=!0}}return c?k.useVAO=!0:k.attributes=function(e){var t=e.static,n=e.dynamic,i={};return Object.keys(t).forEach(function(e){var n=t[e],f=r.id(e),o=new y;if(Vr(n))o.state=1,o.buffer=a.getBuffer(a.create(n,ur,!1,!0)),o.type=0;else{var u=a.getBuffer(n);if(u)o.state=1,o.buffer=u,o.type=0;else if("constant"in n){var s=n.constant;o.buffer="null",o.state=2,"number"==typeof s?o.x=s:ht.forEach(function(e,t){t"+t+"?"+n+".constant["+t+"]:0;"}).join(""),"}}else{","if(",f,"(",n,".buffer)){",c,"=",o,".createStream(",ur,",",n,".buffer);","}else{",c,"=",o,".getBuffer(",n,".buffer);","}",l,'="type" in ',n,"?",a.glTypes,"[",n,".type]:",c,".dtype;",u.normalized,"=!!",n,".normalized;"),p("size"),p("offset"),p("stride"),p("divisor"),r("}}"),r.exit("if(",u.isStream,"){",o,".destroyStream(",c,");","}"),u})}),i}(t),k.context=function(e){var t=e.static,r=e.dynamic,n={};return Object.keys(t).forEach(function(e){var r=t[e];n[e]=Ir(function(e,t){return"number"==typeof r||"boolean"==typeof r?""+r:e.link(r)})}),Object.keys(r).forEach(function(e){var t=r[e];n[e]=Pr(t,function(e,r){return e.invoke(r,t)})}),n}(f),k}function R(e,t,r){var n=e.shared.context,i=e.scope();Object.keys(r).forEach(function(a){t.save(n,"."+a);var f=r[a].append(e,t);Array.isArray(f)?i(n,".",a,"=[",f.join(),"];"):i(n,".",a,"=",f,";")}),t(i)}function U(e,t,r,n){var i,a=e.shared,f=a.gl,o=a.framebuffer;A&&(i=t.def(a.extensions,".webgl_draw_buffers"));var u,s=e.constants,c=s.drawBuffer,l=s.backBuffer;u=r?r.append(e,t):t.def(o,".next"),n||t("if(",u,"!==",o,".cur){"),t("if(",u,"){",f,".bindFramebuffer(",36160,",",u,".framebuffer);"),A&&t(i,".drawBuffersWEBGL(",c,"[",u,".colorAttachments.length]);"),t("}else{",f,".bindFramebuffer(",36160,",null);"),A&&t(i,".drawBuffersWEBGL(",l,");"),t("}",o,".cur=",u,";"),n||t("}")}function H(e,t,r){var n=e.shared,i=n.gl,a=e.current,f=e.next,o=n.current,u=n.next,s=e.cond(o,".dirty");_.forEach(function(t){var n,c,l=S(t);if(!(l in r.state))if(l in f){n=f[l],c=a[l];var d=p(O[l].length,function(e){return s.def(n,"[",e,"]")});s(e.cond(d.map(function(e,t){return e+"!=="+c+"["+t+"]"}).join("||")).then(i,".",C[l],"(",d,");",d.map(function(e,t){return c+"["+t+"]="+e}).join(";"),";"))}else{n=s.def(u,".",l);var h=e.cond(n,"!==",o,".",l);s(h),l in T?h(e.cond(n).then(i,".enable(",T[l],");").else(i,".disable(",T[l],");"),o,".",l,"=",n,";"):h(i,".",C[l],"(",n,");",o,".",l,"=",n,";")}}),0===Object.keys(r.state).length&&s(o,".dirty=false;"),t(s)}function N(e,t,r,n){var i,a=e.shared,f=e.current,o=a.current,u=a.gl;Fr(Object.keys(r)).forEach(function(a){var s=r[a];if(!n||n(s)){var c=s.append(e,t);if(T[a]){var l=T[a];zr(s)?(i=e.link(c,{stable:!0}),t(e.cond(i).then(u,".enable(",l,");").else(u,".disable(",l,");")),t(o,".",a,"=",i,";")):(t(e.cond(c).then(u,".enable(",l,");").else(u,".disable(",l,");")),t(o,".",a,"=",c,";"))}else if(Q(c)){var p=f[a];t(u,".",C[a],"(",c,");",c.map(function(e,t){return p+"["+t+"]="+e}).join(";"),";")}else zr(s)?(i=e.link(c,{stable:!0}),t(u,".",C[a],"(",i,");",o,".",a,"=",i,";")):t(u,".",C[a],"(",c,");",o,".",a,"=",c,";")}})}function W(e,t){w&&(e.instancing=t.def(e.shared.extensions,".angle_instanced_arrays"))}function q(e,t,r,n,i){var a,f,o,u=e.shared,s=e.stats,c=u.current,l=u.timer,p=r.profile;function d(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function h(e){e(a=t.def(),"=",d(),";"),"string"==typeof i?e(s,".count+=",i,";"):e(s,".count++;"),v&&(n?e(f=t.def(),"=",l,".getNumPendingQueries();"):e(l,".beginQuery(",s,");"))}function m(e){e(s,".cpuTime+=",d(),"-",a,";"),v&&(n?e(l,".pushScopeStats(",f,",",l,".getNumPendingQueries(),",s,");"):e(l,".endQuery();"))}function b(e){var r=t.def(c,".profile");t(c,".profile=",e,";"),t.exit(c,".profile=",r,";")}if(p){if(zr(p))return void(p.enable?(h(t),m(t.exit),b("true")):b("false"));b(o=p.append(e,t))}else o=t.def(c,".profile");var g=e.block();h(g),t("if(",o,"){",g,"}");var y=e.block();m(y),t.exit("if(",o,"){",y,"}")}function G(e,t,r,n,i){var a=e.shared;n.forEach(function(n){var f,o=n.name,u=r.attributes[o];if(u){if(!i(u))return;f=u.append(e,t)}else{if(!i(Lr))return;var s=e.scopeAttrib(o);f={},Object.keys(new y).forEach(function(e){f[e]=t.def(s,".",e)})}!function(r,n,i){var f=a.gl,o=t.def(r,".location"),u=t.def(a.attributes,"[",o,"]"),s=i.state,c=i.buffer,l=[i.x,i.y,i.z,i.w],p=["buffer","normalized","offset","stride"];function d(){t("if(!",u,".buffer){",f,".enableVertexAttribArray(",o,");}");var r,a=i.type;if(r=i.size?t.def(i.size,"||",n):n,t("if(",u,".type!==",a,"||",u,".size!==",r,"||",p.map(function(e){return u+"."+e+"!=="+i[e]}).join("||"),"){",f,".bindBuffer(",ur,",",c,".buffer);",f,".vertexAttribPointer(",[o,r,a,i.normalized,i.stride,i.offset],");",u,".type=",a,";",u,".size=",r,";",p.map(function(e){return u+"."+e+"="+i[e]+";"}).join(""),"}"),w){var s=i.divisor;t("if(",u,".divisor!==",s,"){",e.instancing,".vertexAttribDivisorANGLE(",[o,s],");",u,".divisor=",s,";}")}}function h(){t("if(",u,".buffer){",f,".disableVertexAttribArray(",o,");",u,".buffer=null;","}if(",ht.map(function(e,t){return u+"."+e+"!=="+l[t]}).join("||"),"){",f,".vertexAttrib4f(",o,",",l,");",ht.map(function(e,t){return u+"."+e+"="+l[t]+";"}).join(""),"}")}1===s?d():2===s?h():(t("if(",s,"===",1,"){"),d(),t("}else{"),h(),t("}"))}(e.link(n),function(e){switch(e){case cr:case dr:case vr:return 2;case lr:case hr:case br:return 3;case pr:case mr:case gr:return 4;default:return 1}}(n.info.type),f)})}function Y(e,t,n,i,a,f){for(var o,u=e.shared,s=u.gl,c=0;c1){for(var _=[],D=[],T=0;T>1)",c],");")}function t(){r(l,".drawArraysInstancedANGLE(",[p,d,h,c],");")}u&&"null"!==u?v?e():(r("if(",u,"){"),e(),r("}else{"),t(),r("}")):t()}function g(){function e(){r(a+".drawElements("+[p,h,m,d+"<<(("+m+"-5121)>>1)"]+");")}function t(){r(a+".drawArrays("+[p,d,h]+");")}u&&"null"!==u?v?e():(r("if(",u,"){"),e(),r("}else{"),t(),r("}")):t()}w&&("number"!=typeof c||c>=0)?"string"==typeof c?(r("if(",c,">0){"),b(),r("}else if(",c,"<0){"),g(),r("}")):b():g()}function J(e,t,r,n,i){var a=L(),f=a.proc("body",i);return w&&(a.instancing=f.def(a.shared.extensions,".angle_instanced_arrays")),e(a,f,r,n),a.compile().body}function K(e,t,r,n){W(e,t),r.useVAO?r.drawVAO?t(e.shared.vao,".setVAO(",r.drawVAO.append(e,t),");"):t(e.shared.vao,".setVAO(",e.shared.vao,".targetVAO);"):(t(e.shared.vao,".setVAO(null);"),G(e,t,r,n.attributes,function(){return!0})),Y(e,t,r,n.uniforms,function(){return!0},!1),X(e,t,t,r)}function Z(e,t,r,n){function i(){return!0}e.batchId="a1",W(e,t),G(e,t,r,n.attributes,i),Y(e,t,r,n.uniforms,i,!1),X(e,t,t,r)}function $(e,t,r,n){W(e,t);var i=r.contextDep,a=t.def(),f=t.def();e.shared.props=f,e.batchId=a;var o=e.scope(),u=e.scope();function s(e){return e.contextDep&&i||e.propDep}function c(e){return!s(e)}if(t(o.entry,"for(",a,"=0;",a,"<","a1",";++",a,"){",f,"=","a0","[",a,"];",u,"}",o.exit),r.needsContext&&R(e,u,r.context),r.needsFramebuffer&&U(e,u,r.framebuffer),N(e,u,r.state,s),r.profile&&s(r.profile)&&q(e,u,r,!1,!0),n)r.useVAO?r.drawVAO?s(r.drawVAO)?u(e.shared.vao,".setVAO(",r.drawVAO.append(e,u),");"):o(e.shared.vao,".setVAO(",r.drawVAO.append(e,o),");"):o(e.shared.vao,".setVAO(",e.shared.vao,".targetVAO);"):(o(e.shared.vao,".setVAO(null);"),G(e,o,r,n.attributes,c),G(e,u,r,n.attributes,s)),Y(e,o,r,n.uniforms,c,!1),Y(e,u,r,n.uniforms,s,!0),X(e,o,u,r);else{var l=e.global.def("{}"),p=r.shader.progVar.append(e,u),d=u.def(p,".id"),h=u.def(l,"[",d,"]");u(e.shared.gl,".useProgram(",p,".program);","if(!",h,"){",h,"=",l,"[",d,"]=",e.link(function(e){return J(Z,0,r,e,2)}),"(",p,");}",h,".call(this,a0[",a,"],",a,");")}}function ee(e,t,r){var n=t.static[r];if(n&&function(e){if("object"==typeof e&&!Q(e)){for(var t=Object.keys(e),r=0;r0&&r(e.shared.current,".dirty=true;"),e.shared.vao&&r(e.shared.vao,".setVAO(null);")}(o,u),function(e,t){var n=e.proc("scope",3);e.batchId="a2";var i=e.shared,a=i.current;if(R(e,n,t.context),t.framebuffer&&t.framebuffer.append(e,n),Fr(Object.keys(t.state)).forEach(function(r){var a=t.state[r],f=a.append(e,n);Q(f)?f.forEach(function(t,i){F(t)?n.set(e.next[r],"["+i+"]",t):n.set(e.next[r],"["+i+"]",e.link(t,{stable:!0}))}):zr(a)?n.set(i.next,"."+r,e.link(f,{stable:!0})):n.set(i.next,"."+r,f)}),q(e,n,t,!0,!0),[qt,Xt,Yt,Jt,Gt].forEach(function(r){var a=t.draw[r];if(a){var f=a.append(e,n);F(f)?n.set(i.draw,"."+r,f):n.set(i.draw,"."+r,e.link(f),{stable:!0})}}),Object.keys(t.uniforms).forEach(function(a){var f=t.uniforms[a].append(e,n);Array.isArray(f)&&(f="["+f.map(function(t){return F(t)?t:e.link(t,{stable:!0})})+"]"),n.set(i.uniforms,"["+e.link(r.id(a),{stable:!0})+"]",f)}),Object.keys(t.attributes).forEach(function(r){var i=t.attributes[r].append(e,n),a=e.scopeAttrib(r);Object.keys(new y).forEach(function(e){n.set(a,"."+e,i[e])})}),t.scopeVAO){var f=t.scopeVAO.append(e,n);F(f)?n.set(i.vao,".targetVAO",f):n.set(i.vao,".targetVAO",e.link(f,{stable:!0}))}function o(r){var a=t.shader[r];if(a){var f=a.append(e,n);F(f)?n.set(i.shader,"."+r,f):n.set(i.shader,"."+r,e.link(f,{stable:!0}))}}o(Wt),o(Qt),Object.keys(t.state).length>0&&(n(a,".dirty=true;"),n.exit(a,".dirty=true;")),n("a1(",e.shared.context,",a0,",e.batchId,");")}(o,u),function(e,t){var r=e.proc("batch",2);e.batchId="0",W(e,r);var n=!1,i=!0;Object.keys(t.context).forEach(function(e){n=n||t.context[e].propDep}),n||(R(e,r,t.context),i=!1);var a=t.framebuffer,f=!1;function o(e){return e.contextDep&&n||e.propDep}a?(a.propDep?n=f=!0:a.contextDep&&n&&(f=!0),f||U(e,r,a)):U(e,r,null),t.state.viewport&&t.state.viewport.propDep&&(n=!0),H(e,r,t),N(e,r,t.state,function(e){return!o(e)}),t.profile&&o(t.profile)||q(e,r,t,!1,"a1"),t.contextDep=n,t.needsContext=i,t.needsFramebuffer=f;var u=t.shader.progVar;if(u.contextDep&&n||u.propDep)$(e,r,t,null);else{var s=u.append(e,r);if(r(e.shared.gl,".useProgram(",s,".program);"),t.shader.program)$(e,r,t,t.shader.program);else{r(e.shared.vao,".setVAO(null);");var c=e.global.def("{}"),l=r.def(s,".id"),p=r.def(c,"[",l,"]");r(e.cond(p).then(p,".call(this,a0,a1);").else(p,"=",c,"[",l,"]=",e.link(function(e){return J($,0,t,e,2)}),"(",s,");",p,".call(this,a0,a1);"))}}Object.keys(t.state).length>0&&r(e.shared.current,".dirty=true;"),e.shared.vao&&r(e.shared.vao,".setVAO(null);")}(o,u),e(o.compile(),{destroy:function(){u.shader.program.destroy()}})}}}var Rr=function(e,t){if(!t.ext_disjoint_timer_query)return null;var r=[];function n(e){r.push(e)}var i=[];function a(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var f=[];function o(e){f.push(e)}var u=[];function s(e,t,r){var n=f.pop()||new a;n.startQueryIndex=e,n.endQueryIndex=t,n.sum=0,n.stats=r,u.push(n)}var c=[],l=[];return{beginQuery:function(e){var n=r.pop()||t.ext_disjoint_timer_query.createQueryEXT();t.ext_disjoint_timer_query.beginQueryEXT(35007,n),i.push(n),s(i.length-1,i.length,e)},endQuery:function(){t.ext_disjoint_timer_query.endQueryEXT(35007)},pushScopeStats:s,update:function(){var e,r,a=i.length;if(0!==a){l.length=Math.max(l.length,a+1),c.length=Math.max(c.length,a+1),c[0]=0,l[0]=0;var f=0;for(e=0,r=0;r0)if(Array.isArray(t[0])){f=S(t);for(var s=1,c=1;c0)if("number"==typeof e[0]){var i=m.allocType(l.dtype,e.length);z(i,e),d(i,n),m.freeType(i)}else if(Array.isArray(e[0])||x(e[0])){r=S(e);var a=C(e,r,l.dtype);d(a,n),m.freeType(a)}}else if(w(e)){r=e.shape;var f=e.stride,o=0,u=0,s=0,c=0;1===r.length?(o=r[0],u=1,s=f[0],c=0):2===r.length&&(o=r[0],u=r[1],s=f[0],c=f[1]);var h=Array.isArray(e.data)?l.dtype:B(e.data),v=m.allocType(h,o*u);I(v,e.data,o,u,s,c,e.offset),d(v,n),m.freeType(v)}return p},r.profile&&(p.stats=l.stats),p.destroy=function(){c(l)},p},createStream:function(e,t){var r=o.pop();return r||(r=new f(e)),r.bind(),s(r,t,35040,0,1,!1),r},destroyStream:function(e){o.push(e)},clear:function(){A(a).forEach(c),o.forEach(c)},getBuffer:function(e){return e&&e._buffer instanceof f?e._buffer:null},restore:function(){A(a).forEach(function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)})},_initBuffer:s}}(n,d,r,function(e){return Y.destroyBuffer(e)}),G=function(e,t,r,n){var i={},a=0,f={uint8:L,uint16:M};function o(e){this.id=a++,i[this.id]=this,this.buffer=e,this.primType=4,this.vertCount=0,this.type=0}t.oes_element_index_uint&&(f.uint32=R),o.prototype.bind=function(){this.buffer.bind()};var u=[];function s(n,i,a,f,o,u,s){var c;if(n.buffer.bind(),i){var l=s;s||x(i)&&(!w(i)||x(i.data))||(l=t.oes_element_index_uint?R:M),r._initBuffer(n.buffer,i,a,l,3)}else e.bufferData(U,u,a),n.buffer.dtype=c||L,n.buffer.usage=a,n.buffer.dimension=3,n.buffer.byteLength=u;if(c=s,!s){switch(n.buffer.dtype){case L:case 5120:c=L;break;case M:case 5122:c=M;break;case R:case 5124:c=R}n.buffer.dtype=c}n.type=c;var p=o;p<0&&(p=n.buffer.byteLength,c===M?p>>=1:c===R&&(p>>=2)),n.vertCount=p;var d=f;if(f<0){d=4;var h=n.buffer.dimension;1===h&&(d=0),2===h&&(d=1),3===h&&(d=4)}n.primType=d}function c(e){n.elementsCount--,delete i[e.id],e.buffer.destroy(),e.buffer=null}return{create:function(e,t){var i=r.create(null,U,!0),a=new o(i._buffer);function u(e){if(e)if("number"==typeof e)i(e),a.primType=4,a.vertCount=0|e,a.type=L;else{var t=null,r=35044,n=-1,o=-1,c=0,l=0;Array.isArray(e)||x(e)||w(e)?t=e:("data"in e&&(t=e.data),"usage"in e&&(r=T[e.usage]),"primitive"in e&&(n=P[e.primitive]),"count"in e&&(o=0|e.count),"type"in e&&(l=f[e.type]),"length"in e?c=0|e.length:(c=o,l===M||5122===l?c*=2:l!==R&&5124!==l||(c*=4))),s(a,t,r,n,o,c,l)}else i(),a.primType=4,a.vertCount=0,a.type=L;return u}return n.elementsCount++,u(e),u._reglType="elements",u._elements=a,u.subdata=function(e,t){return i.subdata(e,t),u},u.destroy=function(){c(a)},u},createStream:function(e){var t=u.pop();return t||(t=new o(r.create(null,U,!0,!1)._buffer)),s(t,e,35040,-1,-1,0,0),t},destroyStream:function(e){u.push(e)},getElements:function(e){return"function"==typeof e&&e._elements instanceof o?e._elements:null},clear:function(){A(i).forEach(c)}}}(n,k,q,d),Y=function(e,t,r,n,i,a,f){for(var o=r.maxAttributes,u=new Array(o),s=0;s=d.byteLength?c.subdata(d):(c.destroy(),t.buffers[s]=null)),t.buffers[s]||(c=t.buffers[s]=i.create(l,34962,!1,!0)),p.buffer=i.getBuffer(c),p.size=0|p.buffer.dimension,p.normalized=!1,p.type=p.buffer.dtype,p.offset=0,p.stride=0,p.divisor=0,p.state=1,o[s]=1):i.getBuffer(l)?(p.buffer=i.getBuffer(l),p.size=0|p.buffer.dimension,p.normalized=!1,p.type=p.buffer.dtype,p.offset=0,p.stride=0,p.divisor=0,p.state=1):i.getBuffer(l.buffer)?(p.buffer=i.getBuffer(l.buffer),p.size=0|(+l.size||p.buffer.dimension),p.normalized=!!l.normalized||!1,p.type="type"in l?D[l.type]:p.buffer.dtype,p.offset=0|(l.offset||0),p.stride=0|(l.stride||0),p.divisor=0|(l.divisor||0),p.state=1):"x"in l&&(p.x=+l.x||0,p.y=+l.y||0,p.z=+l.z||0,p.w=+l.w||0,p.state=2)}for(var h=0;h1)for(var b=0;be&&(e=t.stats.uniformsCount)}),e},n.getMaxAttributesCount=function(){var e=0;return l.forEach(function(t){t.stats.attributesCount>e&&(e=t.stats.attributesCount)}),e}),{clear:function(){var e=t.deleteShader.bind(t);A(a).forEach(e),a={},A(f).forEach(e),f={},l.forEach(function(e){t.deleteProgram(e.program)}),l.length=0,c={},n.shaderCount=0},program:function(r,i,o,u){var s=c[i];s||(s=c[i]={});var p=s[r];if(p&&(p.refCount++,!u))return p;var m=new d(i,r);return n.shaderCount++,h(m,0,u),p||(s[r]=m),l.push(m),e(m,{destroy:function(){if(m.refCount--,m.refCount<=0){t.deleteProgram(m.program);var e=l.indexOf(m);l.splice(e,1),n.shaderCount--}s[m.vertId].refCount<=0&&(t.deleteShader(f[m.vertId]),delete f[m.vertId],delete c[m.fragId][m.vertId]),Object.keys(c[m.fragId]).length||(t.deleteShader(a[m.fragId]),delete a[m.fragId],delete c[m.fragId])}})},restore:function(){a={},f={};for(var e=0;e=0?p=!0:s.indexOf(h)>=0&&(p=!1))),("depthTexture"in _||"depthStencilTexture"in _)&&(O=!(!_.depthTexture&&!_.depthStencilTexture)),"depth"in _&&("boolean"==typeof _.depth?o=_.depth:(x=_.depth,c=!1)),"stencil"in _&&("boolean"==typeof _.stencil?c=_.stencil:(w=_.stencil,o=!1)),"depthStencil"in _&&("boolean"==typeof _.depthStencil?o=c=_.depthStencil:(A=_.depthStencil,o=!1,c=!1))}else a=f=1;var T=null,C=null,S=null,j=null;if(Array.isArray(l))T=l.map(m);else if(l)T=[m(l)];else for(T=new Array(y),r=0;r0&&(o.depth=r[0].depth,o.stencil=r[0].stencil,o.depthStencil=r[0].depthStencil),r[a]?r[a](o):r[a]=_(o)}return e(n,{width:u,height:u,color:f})}return n(t),e(n,{faces:r,resize:function(e){var t,i=0|e;if(i===n.width)return n;var a=n.color;for(t=0;t=0;--e){var t=ne[e];t&&t(N,null,0)}n.flush(),O&&O.update()}function se(){!oe&&ne.length>0&&(oe=o.next(ue))}function ce(){oe&&(o.cancel(ue),oe=null)}function le(e){e.preventDefault(),ce(),ie.forEach(function(e){e()})}function pe(e){n.getError(),a.restore(),X.restore(),q.restore(),J.restore(),K.restore(),Z.restore(),Y.restore(),O&&O.restore(),$.procs.refresh(),se(),ae.forEach(function(e){e()})}function de(t){function r(e,t){var r={},n={};return Object.keys(e).forEach(function(i){var a=e[i];if(f.isDynamic(a))n[i]=f.unbox(a,i);else{if(t&&Array.isArray(a))for(var o=0;o0)return l.call(this,function(e){for(;d.length=0},read:ee,destroy:function(){ne.length=0,ce(),re&&(re.removeEventListener(Ur,le),re.removeEventListener(Hr,pe)),X.clear(),Z.clear(),K.clear(),Y.clear(),J.clear(),G.clear(),q.clear(),O&&O.clear(),fe.forEach(function(e){e()})},_gl:n,_refresh:ye,poll:function(){ge(),O&&O.update()},now:xe,stats:d,getCachedCode:function(){return h},preloadCachedCode:function(e){Object.entries(e).forEach(function(e){h[e[0]]=e[1]})}});return r.onDone(null,we),we}}()}}]);