text: /*
   * glfx.js
   * https://github.com/after12am/glfx.js
   *
   * Copyright 2011 Evan Wallace
   * Released under the MIT license
   */
  var fx=function(){function r(a,e,d){return Math.max(a,Math.min(e,d))}function y(c){return{_:c,loadContentsOf:function(c){a=this._.gl;this._.loadContentsOf(c)},destroy:function(){a=this._.gl;this._.destroy()}}}function C(a){return y(u.fromElement(a))}function D(a){return new E(this,a)}function F(c,e){var d=a.UNSIGNED_BYTE;if(a.getExtension("OES_texture_float")&&a.getExtension("OES_texture_float_linear")){var b=new u(100,100,a.RGBA,a.FLOAT);try{b.drawTo(function(){d=a.FLOAT})}catch(g){}b.destroy()}this._.texture&&
  this._.texture.destroy();this._.spareTexture&&this._.spareTexture.destroy();this.width=c;this.height=e;this._.texture=new u(c,e,a.RGBA,d);this._.spareTexture=new u(c,e,a.RGBA,d);this._.extraTexture=this._.extraTexture||new u(0,0,a.RGBA,d);this._.flippedShader=this._.flippedShader||new k(null,"uniform sampler2D texture;varying vec2 texCoord;void main(){gl_FragColor=texture2D(texture,vec2(texCoord.x,1.0-texCoord.y));}");this._.isInitialized=!0}
  function G(a,e,d){this._.isInitialized&&a._.width==this.width&&a._.height==this.height||F.call(this,e?e:a._.width,d?d:a._.height);a._.use();this._.texture.drawTo(function(){k.getDefaultShader().drawRect()});return this}function H(){this._.texture.use();this._.flippedShader.drawRect();return this}function h(a,e,d,b){(d||this._.texture).use();this._.spareTexture.drawTo(function(){a.uniforms(e).drawRect()});this._.spareTexture.swapWith(b||this._.texture)}function I(a){a.parentNode.insertBefore(this,
  a);a.parentNode.removeChild(a);return this}function J(){var c=new u(this._.texture.width,this._.texture.height,a.RGBA,a.UNSIGNED_BYTE);this._.texture.use();c.drawTo(function(){k.getDefaultShader().drawRect()});return y(c)}function K(){var c=this._.texture.width,e=this._.texture.height,d=new Uint8Array(c*e*4);this._.texture.drawTo(function(){});a.readPixels(0,0,c,e,a.RGBA,a.UNSIGNED_BYTE,d);return d}function f(c){return function(){a=this._.gl;return c.apply(this,arguments)}}function z(a,e,d,b,g,n,
  p,m){var q=d-g,t=b-n,f=p-g,k=m-n;g=a-d+g-p;n=e-b+n-m;var h=q*k-f*t,f=(g*k-f*n)/h,q=(q*n-g*t)/h;return[d-a+f*d,b-e+f*b,f,p-a+q*p,m-e+q*m,q,a,e,1]}function A(a){var e=a[0],d=a[1],b=a[2],g=a[3],n=a[4],p=a[5],m=a[6],f=a[7];a=a[8];var t=e*n*a-e*p*f-d*g*a+d*p*m+b*g*f-b*n*m;return[(n*a-p*f)/t,(b*f-d*a)/t,(d*p-b*n)/t,(p*m-g*a)/t,(e*a-b*m)/t,(b*g-e*p)/t,(g*f-n*m)/t,(d*m-e*f)/t,(e*n-d*g)/t]}function B(a){var e=a.length;this.xa=[];this.ya=[];this.u=[];this.y2=[];a.sort(function(a,b){return a[0]-b[0]});for(var d=
  0;d<e;d++)this.xa.push(a[d][0]),this.ya.push(a[d][1]);this.u[0]=0;this.y2[0]=0;for(d=1;d<e-1;++d){a=this.xa[d+1]-this.xa[d-1];var b=(this.xa[d]-this.xa[d-1])/a,g=b*this.y2[d-1]+2;this.y2[d]=(b-1)/g;this.u[d]=(6*((this.ya[d+1]-this.ya[d])/(this.xa[d+1]-this.xa[d])-(this.ya[d]-this.ya[d-1])/(this.xa[d]-this.xa[d-1]))/a-b*this.u[d-1])/g}this.y2[e-1]=0;for(d=e-2;0<=d;--d)this.y2[d]=this.y2[d]*this.y2[d+1]+this.u[d]}function x(a,e){return new k(null,a+"uniform sampler2D texture;uniform vec2 texSize;varying vec2 texCoord;void main(){vec2 coord=texCoord*texSize;"+
  e+"gl_FragColor=texture2D(texture,coord/texSize);vec2 clampedCoord=clamp(coord,vec2(0.0),texSize);if(coord!=clampedCoord){gl_FragColor.a*=max(0.0,1.0-length(coord-clampedCoord));}}")}function L(c,e){a.brightnessContrast=a.brightnessContrast||new k(null,"uniform sampler2D texture;uniform float brightness;uniform float contrast;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);color.rgb+=brightness;if(contrast>0.0){color.rgb=(color.rgb-0.5)/(1.0-contrast)+0.5;}else{color.rgb=(color.rgb-0.5)*(1.0+contrast)+0.5;}gl_FragColor=color;}");
  h.call(this,a.brightnessContrast,{brightness:r(-1,c,1),contrast:r(-1,e,1)});return this}function w(a){a=new B(a);for(var e=[],d=0;256>d;d++)e.push(r(0,Math.floor(256*a.interpolate(d/255)),255));return e}function M(c,e,d){c=w(c);1==arguments.length?e=d=c:(e=w(e),d=w(d));for(var b=[],g=0;256>g;g++)b.splice(b.length,0,c[g],e[g],d[g],255);this._.extraTexture.initFromBytes(256,1,b);this._.extraTexture.use(1);a.curves=a.curves||new k(null,"uniform sampler2D texture;uniform sampler2D map;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);color.r=texture2D(map,vec2(color.r)).r;color.g=texture2D(map,vec2(color.g)).g;color.b=texture2D(map,vec2(color.b)).b;gl_FragColor=color;}");
  a.curves.textures({map:1});h.call(this,a.curves,{});return this}function N(c){a.denoise=a.denoise||new k(null,"uniform sampler2D texture;uniform float exponent;uniform float strength;uniform vec2 texSize;varying vec2 texCoord;void main(){vec4 center=texture2D(texture,texCoord);vec4 color=vec4(0.0);float total=0.0;for(float x=-4.0;x<=4.0;x+=1.0){for(float y=-4.0;y<=4.0;y+=1.0){vec4 sample=texture2D(texture,texCoord+vec2(x,y)/texSize);float weight=1.0-abs(dot(sample.rgb-center.rgb,vec3(0.25)));weight=pow(weight,exponent);color+=sample*weight;total+=weight;}}gl_FragColor=color/total;}");
  for(var e=0;2>e;e++)h.call(this,a.denoise,{exponent:Math.max(0,c),texSize:[this.width,this.height]});return this}function O(c,e){a.hueSaturation=a.hueSaturation||new k(null,"uniform sampler2D texture;uniform float hue;uniform float saturation;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float angle=hue*3.14159265;float s=sin(angle),c=cos(angle);vec3 weights=(vec3(2.0*c,-sqrt(3.0)*s-c,sqrt(3.0)*s-c)+1.0)/3.0;float len=length(color.rgb);color.rgb=vec3(dot(color.rgb,weights.xyz),dot(color.rgb,weights.zxy),dot(color.rgb,weights.yzx));float average=(color.r+color.g+color.b)/3.0;if(saturation>0.0){color.rgb+=(average-color.rgb)*(1.0-1.0/(1.001-saturation));}else{color.rgb+=(average-color.rgb)*(-saturation);}gl_FragColor=color;}");
  h.call(this,a.hueSaturation,{hue:r(-1,c,1),saturation:r(-1,e,1)});return this}function P(c){a.noise=a.noise||new k(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;float rand(vec2 co){return fract(sin(dot(co.xy,vec2(12.9898,78.233)))*43758.5453);}void main(){vec4 color=texture2D(texture,texCoord);float diff=(rand(texCoord)-0.5)*amount;color.r+=diff;color.g+=diff;color.b+=diff;gl_FragColor=color;}");
  h.call(this,a.noise,{amount:r(0,c,1)});return this}function Q(c){a.sepia=a.sepia||new k(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float r=color.r;float g=color.g;float b=color.b;color.r=min(1.0,(r*(1.0-(0.607*amount)))+(g*(0.769*amount))+(b*(0.189*amount)));color.g=min(1.0,(r*0.349*amount)+(g*(1.0-(0.314*amount)))+(b*0.168*amount));color.b=min(1.0,(r*0.272*amount)+(g*0.534*amount)+(b*(1.0-(0.869*amount))));gl_FragColor=color;}");
  h.call(this,a.sepia,{amount:r(0,c,1)});return this}function R(c,e){a.unsharpMask=a.unsharpMask||new k(null,"uniform sampler2D blurredTexture;uniform sampler2D originalTexture;uniform float strength;uniform float threshold;varying vec2 texCoord;void main(){vec4 blurred=texture2D(blurredTexture,texCoord);vec4 original=texture2D(originalTexture,texCoord);gl_FragColor=mix(blurred,original,1.0+strength);}");
  this._.extraTexture.ensureFormat(this._.texture);this._.texture.use();this._.extraTexture.drawTo(function(){k.getDefaultShader().drawRect()});this._.extraTexture.use(1);this.triangleBlur(c);a.unsharpMask.textures({originalTexture:1});h.call(this,a.unsharpMask,{strength:e});this._.extraTexture.unuse(1);return this}function S(c){a.vibrance=a.vibrance||new k(null,"uniform sampler2D texture;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float average=(color.r+color.g+color.b)/3.0;float mx=max(color.r,max(color.g,color.b));float amt=(mx-average)*(-amount*3.0);color.rgb=mix(color.rgb,vec3(mx),amt);gl_FragColor=color;}");
  h.call(this,a.vibrance,{amount:r(-1,c,1)});return this}function T(c,e){a.vignette=a.vignette||new k(null,"uniform sampler2D texture;uniform float size;uniform float amount;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);float dist=distance(texCoord,vec2(0.5,0.5));color.rgb*=smoothstep(0.8,size*0.799,dist*(amount+size));gl_FragColor=color;}");
  h.call(this,a.vignette,{size:r(0,c,1),amount:r(0,e,1)});return this}function U(c,e,d){a.lensBlurPrePass=a.lensBlurPrePass||new k(null,"uniform sampler2D texture;uniform float power;varying vec2 texCoord;void main(){vec4 color=texture2D(texture,texCoord);color=pow(color,vec4(power));gl_FragColor=vec4(color);}");var b="uniform sampler2D texture0;uniform sampler2D texture1;uniform vec2 delta0;uniform vec2 delta1;uniform float power;varying vec2 texCoord;"+
  v+"vec4 sample(vec2 delta){float offset=random(vec3(delta,151.7182),0.0);vec4 color=vec4(0.0);float total=0.0;for(float t=0.0;t<=30.0;t++){float percent=(t+offset)/30.0;color+=texture2D(texture0,texCoord+delta*percent);total+=1.0;}return color/total;}";
  a.lensBlur0=a.lensBlur0||new k(null,b+"void main(){gl_FragColor=sample(delta0);}");a.lensBlur1=a.lensBlur1||new k(null,b+"void main(){gl_FragColor=(sample(delta0)+sample(delta1))*0.5;}");a.lensBlur2=a.lensBlur2||(new k(null,b+"void main(){vec4 color=(sample(delta0)+2.0*texture2D(texture1,texCoord))/3.0;gl_FragColor=pow(color,vec4(power));}")).textures({texture1:1});for(var b=
  [],g=0;3>g;g++){var n=d+g*Math.PI*2/3;b.push([c*Math.sin(n)/this.width,c*Math.cos(n)/this.height])}c=Math.pow(10,r(-1,e,1));h.call(this,a.lensBlurPrePass,{power:c});this._.extraTexture.ensureFormat(this._.texture);h.call(this,a.lensBlur0,{delta0:b[0]},this._.texture,this._.extraTexture);h.call(this,a.lensBlur1,{delta0:b[1],delta1:b[2]},this._.extraTexture,this._.extraTexture);h.call(this,a.lensBlur0,{delta0:b[1]});this._.extraTexture.use(1);h.call(this,a.lensBlur2,{power:1/c,delta0:b[2]});return this}
  function V(c,e,d,b,g,n){a.tiltShift=a.tiltShift||new k(null,"uniform sampler2D texture;uniform float blurRadius;uniform float gradientRadius;uniform vec2 start;uniform vec2 end;uniform vec2 delta;uniform vec2 texSize;varying vec2 texCoord;"+v+"void main(){vec4 color=vec4(0.0);float total=0.0;float offset=random(vec3(12.9898,78.233,151.7182),0.0);vec2 normal=normalize(vec2(start.y-end.y,end.x-start.x));float radius=smoothstep(0.0,1.0,abs(dot(texCoord*texSize-start,normal))/gradientRadius)*blurRadius;for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec4 sample=texture2D(texture,texCoord+delta/texSize*percent*radius);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}");
  var f=d-c,m=b-e,q=Math.sqrt(f*f+m*m);h.call(this,a.tiltShift,{blurRadius:g,gradientRadius:n,start:[c,e],end:[d,b],delta:[f/q,m/q],texSize:[this.width,this.height]});h.call(this,a.tiltShift,{blurRadius:g,gradientRadius:n,start:[c,e],end:[d,b],delta:[-m/q,f/q],texSize:[this.width,this.height]});return this}function W(c){a.triangleBlur=a.triangleBlur||new k(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+v+"void main(){vec4 color=vec4(0.0);float total=0.0;float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec4 sample=texture2D(texture,texCoord+delta*percent);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}");
  h.call(this,a.triangleBlur,{delta:[c/this.width,0]});h.call(this,a.triangleBlur,{delta:[0,c/this.height]});return this}function X(c,e,d){a.zoomBlur=a.zoomBlur||new k(null,"uniform sampler2D texture;uniform vec2 center;uniform float strength;uniform vec2 texSize;varying vec2 texCoord;"+v+"void main(){vec4 color=vec4(0.0);float total=0.0;vec2 toCenter=center-texCoord*texSize;float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=0.0;t<=40.0;t++){float percent=(t+offset)/40.0;float weight=4.0*(percent-percent*percent);vec4 sample=texture2D(texture,texCoord+toCenter*percent*strength/texSize);sample.rgb*=sample.a;color+=sample*weight;total+=weight;}gl_FragColor=color/total;gl_FragColor.rgb/=gl_FragColor.a+0.00001;}");
  h.call(this,a.zoomBlur,{center:[c,e],strength:d,texSize:[this.width,this.height]});return this}function Y(c,e,d,b){a.colorHalftone=a.colorHalftone||new k(null,"uniform sampler2D texture;uniform vec2 center;uniform float angle;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;float pattern(float angle){float s=sin(angle),c=cos(angle);vec2 tex=texCoord*texSize-center;vec2 point=vec2(c*tex.x-s*tex.y,s*tex.x+c*tex.y)*scale;return(sin(point.x)*sin(point.y))*4.0;}void main(){vec4 color=texture2D(texture,texCoord);vec3 cmy=1.0-color.rgb;float k=min(cmy.x,min(cmy.y,cmy.z));cmy=(cmy-k)/(1.0-k);cmy=clamp(cmy*10.0-3.0+vec3(pattern(angle+0.26179),pattern(angle+1.30899),pattern(angle)),0.0,1.0);k=clamp(k*10.0-5.0+pattern(angle+0.78539),0.0,1.0);gl_FragColor=vec4(1.0-cmy-k,color.a);}");
  h.call(this,a.colorHalftone,{center:[c,e],angle:d,scale:Math.PI/b,texSize:[this.width,this.height]});return this}function Z(c,e,d,b){a.dotScreen=a.dotScreen||new k(null,"uniform sampler2D texture;uniform vec2 center;uniform float angle;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;float pattern(){float s=sin(angle),c=cos(angle);vec2 tex=texCoord*texSize-center;vec2 point=vec2(c*tex.x-s*tex.y,s*tex.x+c*tex.y)*scale;return(sin(point.x)*sin(point.y))*4.0;}void main(){vec4 color=texture2D(texture,texCoord);float average=(color.r+color.g+color.b)/3.0;gl_FragColor=vec4(vec3(average*10.0-5.0+pattern()),color.a);}");
  h.call(this,a.dotScreen,{center:[c,e],angle:d,scale:Math.PI/b,texSize:[this.width,this.height]});return this}function aa(c){a.edgeWork1=a.edgeWork1||new k(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+v+"void main(){vec2 color=vec2(0.0);vec2 total=vec2(0.0);float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec3 sample=texture2D(texture,texCoord+delta*percent).rgb;float average=(sample.r+sample.g+sample.b)/3.0;color.x+=average*weight;total.x+=weight;if(abs(t)<15.0){weight=weight*2.0-1.0;color.y+=average*weight;total.y+=weight;}}gl_FragColor=vec4(color/total,0.0,1.0);}");
  a.edgeWork2=a.edgeWork2||new k(null,"uniform sampler2D texture;uniform vec2 delta;varying vec2 texCoord;"+v+"void main(){vec2 color=vec2(0.0);vec2 total=vec2(0.0);float offset=random(vec3(12.9898,78.233,151.7182),0.0);for(float t=-30.0;t<=30.0;t++){float percent=(t+offset-0.5)/30.0;float weight=1.0-abs(percent);vec2 sample=texture2D(texture,texCoord+delta*percent).xy;color.x+=sample.x*weight;total.x+=weight;if(abs(t)<15.0){weight=weight*2.0-1.0;color.y+=sample.y*weight;total.y+=weight;}}float c=clamp(10000.0*(color.y/total.y-color.x/total.x)+0.5,0.0,1.0);gl_FragColor=vec4(c,c,c,1.0);}");
  h.call(this,a.edgeWork1,{delta:[c/this.width,0]});h.call(this,a.edgeWork2,{delta:[0,c/this.height]});return this}function ba(c,e,d){a.hexagonalPixelate=a.hexagonalPixelate||new k(null,"uniform sampler2D texture;uniform vec2 center;uniform float scale;uniform vec2 texSize;varying vec2 texCoord;void main(){vec2 tex=(texCoord*texSize-center)/scale;tex.y/=0.866025404;tex.x-=tex.y*0.5;vec2 a;if(tex.x+tex.y-floor(tex.x)-floor(tex.y)<1.0)a=vec2(floor(tex.x),floor(tex.y));else a=vec2(ceil(tex.x),ceil(tex.y));vec2 b=vec2(ceil(tex.x),floor(tex.y));vec2 c=vec2(floor(tex.x),ceil(tex.y));vec3 TEX=vec3(tex.x,tex.y,1.0-tex.x-tex.y);vec3 A=vec3(a.x,a.y,1.0-a.x-a.y);vec3 B=vec3(b.x,b.y,1.0-b.x-b.y);vec3 C=vec3(c.x,c.y,1.0-c.x-c.y);float alen=length(TEX-A);float blen=length(TEX-B);float clen=length(TEX-C);vec2 choice;if(alen<blen){if(alen<clen)choice=a;else choice=c;}else{if(blen<clen)choice=b;else choice=c;}choice.x+=choice.y*0.5;choice.y*=0.866025404;choice*=scale/texSize;gl_FragColor=texture2D(texture,choice+center/texSize);}");
  h.call(this,a.hexagonalPixelate,{center:[c,e],scale:d,texSize:[this.width,this.height]});return this}function ca(c){a.ink=a.ink||new k(null,"uniform sampler2D texture;uniform float strength;uniform vec2 texSize;varying vec2 texCoord;void main(){vec2 dx=vec2(1.0/texSize.x,0.0);vec2 dy=vec2(0.0,1.0/texSize.y);vec4 color=texture2D(texture,texCoord);float bigTotal=0.0;float smallTotal=0.0;vec3 bigAverage=vec3(0.0);vec3 smallAverage=vec3(0.0);for(float x=-2.0;x<=2.0;x+=1.0){for(float y=-2.0;y<=2.0;y+=1.0){vec3 sample=texture2D(texture,texCoord+dx*x+dy*y).rgb;bigAverage+=sample;bigTotal+=1.0;if(abs(x)+abs(y)<2.0){smallAverage+=sample;smallTotal+=1.0;}}}vec3 edge=max(vec3(0.0),bigAverage/bigTotal-smallAverage/smallTotal);gl_FragColor=vec4(color.rgb-dot(edge,edge)*strength*100000.0,color.a);}");
  h.call(this,a.ink,{strength:c*c*c*c*c,texSize:[this.width,this.height]});return this}function da(c,e,d,b){a.bulgePinch=a.bulgePinch||x("uniform float radius;uniform float strength;uniform vec2 center;","coord-=center;float distance=length(coord);if(distance<radius){float percent=distance/radius;if(strength>0.0){coord*=mix(1.0,smoothstep(0.0,radius/distance,percent),strength*0.75);}else{coord*=mix(1.0,pow(percent,1.0+strength*0.75)*radius/distance,1.0-percent);}}coord+=center;");
  h.call(this,a.bulgePinch,{radius:d,strength:r(-1,b,1),center:[c,e],texSize:[this.width,this.height]});return this}function ea(c,e,d){a.matrixWarp=a.matrixWarp||x("uniform mat3 matrix;uniform bool useTextureSpace;","if(useTextureSpace)coord=coord/texSize*2.0-1.0;vec3 warp=matrix*vec3(coord,1.0);coord=warp.xy/warp.z;if(useTextureSpace)coord=(coord*0.5+0.5)*texSize;");c=Array.prototype.concat.apply([],c);if(4==c.length)c=
  [c[0],c[1],0,c[2],c[3],0,0,0,1];else if(9!=c.length)throw"can only warp with 2x2 or 3x3 matrix";h.call(this,a.matrixWarp,{matrix:e?A(c):c,texSize:[this.width,this.height],useTextureSpace:d|0});return this}function fa(a,e){var d=z.apply(null,e),b=z.apply(null,a),d=A(d);return this.matrixWarp([d[0]*b[0]+d[1]*b[3]+d[2]*b[6],d[0]*b[1]+d[1]*b[4]+d[2]*b[7],d[0]*b[2]+d[1]*b[5]+d[2]*b[8],d[3]*b[0]+d[4]*b[3]+d[5]*b[6],d[3]*b[1]+d[4]*b[4]+d[5]*b[7],d[3]*b[2]+d[4]*b[5]+d[5]*b[8],d[6]*b[0]+d[7]*b[3]+d[8]*b[6],
  d[6]*b[1]+d[7]*b[4]+d[8]*b[7],d[6]*b[2]+d[7]*b[5]+d[8]*b[8]])}function ga(c,e,d,b){a.swirl=a.swirl||x("uniform float radius;uniform float angle;uniform vec2 center;","coord-=center;float distance=length(coord);if(distance<radius){float percent=(radius-distance)/radius;float theta=percent*percent*angle;float s=sin(theta);float c=cos(theta);coord=vec2(coord.x*c-coord.y*s,coord.x*s+coord.y*c);}coord+=center;");
  h.call(this,a.swirl,{radius:d,center:[c,e],angle:b,texSize:[this.width,this.height]});return this}var l={};(function(){function a(b){if(!b.getExtension("OES_texture_float"))return!1;var d=b.createFramebuffer(),c=b.createTexture();b.bindTexture(b.TEXTURE_2D,c);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
  b.texImage2D(b.TEXTURE_2D,0,b.RGBA,1,1,0,b.RGBA,b.UNSIGNED_BYTE,null);b.bindFramebuffer(b.FRAMEBUFFER,d);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,c,0);d=b.createTexture();b.bindTexture(b.TEXTURE_2D,d);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texImage2D(b.TEXTURE_2D,
  0,b.RGBA,2,2,0,b.RGBA,b.FLOAT,new Float32Array([2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));var c=b.createProgram(),e=b.createShader(b.VERTEX_SHADER),g=b.createShader(b.FRAGMENT_SHADER);b.shaderSource(e,"attribute vec2 vertex;void main(){gl_Position=vec4(vertex,0.0,1.0);}");b.shaderSource(g,"uniform sampler2D texture;void main(){gl_FragColor=texture2D(texture,vec2(0.5));}");b.compileShader(e);b.compileShader(g);b.attachShader(c,e);b.attachShader(c,
  g);b.linkProgram(c);e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,new Float32Array([0,0]),b.STREAM_DRAW);b.enableVertexAttribArray(0);b.vertexAttribPointer(0,2,b.FLOAT,!1,0,0);e=new Uint8Array(4);b.useProgram(c);b.viewport(0,0,1,1);b.bindTexture(b.TEXTURE_2D,d);b.drawArrays(b.POINTS,0,1);b.readPixels(0,0,1,1,b.RGBA,b.UNSIGNED_BYTE,e);return 127===e[0]||128===e[0]}function e(){}function d(a){"OES_texture_float_linear"===a?(void 0===this.$OES_texture_float_linear$&&Object.defineProperty(this,
  "$OES_texture_float_linear$",{enumerable:!1,configurable:!1,writable:!1,value:new e}),a=this.$OES_texture_float_linear$):a=n.call(this,a);return a}function b(){var a=f.call(this);-1===a.indexOf("OES_texture_float_linear")&&a.push("OES_texture_float_linear");return a}try{var g=document.createElement("canvas").getContext("experimental-webgl")}catch(m){}if(g&&-1===g.getSupportedExtensions().indexOf("OES_texture_float_linear")&&a(g)){var n=WebGLRenderingContext.prototype.getExtension,f=WebGLRenderingContext.prototype.getSupportedExtensions;
  WebGLRenderingContext.prototype.getExtension=d;WebGLRenderingContext.prototype.getSupportedExtensions=b}})();var a;l.canvas=function(){var c=document.createElement("canvas");try{a=c.getContext("experimental-webgl",{premultipliedAlpha:!1})}catch(e){a=null}if(!a)throw"This browser does not support WebGL";c._={gl:a,isInitialized:!1,texture:null,spareTexture:null,flippedShader:null};c.texture=f(C);c.draw=f(G);c.update=f(H);c.replace=f(I);c.contents=f(J);c.getPixelArray=f(K);c.brightnessContrast=f(L);
  c.hexagonalPixelate=f(ba);c.hueSaturation=f(O);c.colorHalftone=f(Y);c.triangleBlur=f(W);c.unsharpMask=f(R);c.perspective=f(fa);c.matrixWarp=f(ea);c.bulgePinch=f(da);c.tiltShift=f(V);c.dotScreen=f(Z);c.edgeWork=f(aa);c.lensBlur=f(U);c.zoomBlur=f(X);c.noise=f(P);c.denoise=f(N);c.curves=f(M);c.swirl=f(ga);c.ink=f(ca);c.vignette=f(T);c.vibrance=f(S);c.sepia=f(Q);c.glitch=f(D);return c};l.splineInterpolate=w;l.ALPHA=6406;l.LUMINANCE=6409;l.LUMINANCE_ALPHA=6410;l.RGB=6407;l.RGBA=6408;l.UNSIGNED_BYTE=5121;
  l.UNSIGNED_SHORT_4_4_4_4=32819;l.UNSIGNED_SHORT_5_5_5_1=32820;l.UNSIGNED_SHORT_5_6_5=33635;var k=function(){function c(d,b){var c=a.createShader(d);a.shaderSource(c,b);a.compileShader(c);if(!a.getShaderParameter(c,a.COMPILE_STATUS))throw"compile error: "+a.getShaderInfoLog(c);return c}function e(d,b){this.texCoordAttribute=this.vertexAttribute=null;this.program=a.createProgram();b="precision highp float;"+(b||"uniform sampler2D texture;varying vec2 texCoord;void main(){gl_FragColor=texture2D(texture,texCoord);}");
  a.attachShader(this.program,c(a.VERTEX_SHADER,d||"attribute vec2 vertex;attribute vec2 _texCoord;varying vec2 texCoord;void main(){texCoord=_texCoord;gl_Position=vec4(vertex*2.0-1.0,0.0,1.0);}"));a.attachShader(this.program,c(a.FRAGMENT_SHADER,b));a.linkProgram(this.program);if(!a.getProgramParameter(this.program,a.LINK_STATUS))throw"link error: "+a.getProgramInfoLog(this.program);}e.prototype.destroy=function(){a.deleteProgram(this.program);this.program=
  null};e.prototype.uniforms=function(d){a.useProgram(this.program);for(var b in d)if(d.hasOwnProperty(b)){var c=a.getUniformLocation(this.program,b);if(null!==c){var e=d[b];if("[object Array]"==Object.prototype.toString.call(e))switch(e.length){case 1:a.uniform1fv(c,new Float32Array(e));break;case 2:a.uniform2fv(c,new Float32Array(e));break;case 3:a.uniform3fv(c,new Float32Array(e));break;case 4:a.uniform4fv(c,new Float32Array(e));break;case 9:a.uniformMatrix3fv(c,!1,new Float32Array(e));break;case 16:a.uniformMatrix4fv(c,
  !1,new Float32Array(e));break;default:throw"dont't know how to load uniform \""+b+'" of length '+e.length;}else if("[object Number]"==Object.prototype.toString.call(e))a.uniform1f(c,e);else throw'attempted to set uniform "'+b+'" to invalid value '+(e||"undefined").toString();}}return this};e.prototype.textures=function(c){a.useProgram(this.program);for(var b in c)c.hasOwnProperty(b)&&a.uniform1i(a.getUniformLocation(this.program,b),c[b]);return this};e.prototype.drawRect=function(c,b,e,f){var p=a.getParameter(a.VIEWPORT);
  b=void 0!==b?(b-p[1])/p[3]:0;c=void 0!==c?(c-p[0])/p[2]:0;e=void 0!==e?(e-p[0])/p[2]:1;f=void 0!==f?(f-p[1])/p[3]:1;null==a.vertexBuffer&&(a.vertexBuffer=a.createBuffer());a.bindBuffer(a.ARRAY_BUFFER,a.vertexBuffer);a.bufferData(a.ARRAY_BUFFER,new Float32Array([c,b,c,f,e,b,e,f]),a.STATIC_DRAW);null==a.texCoordBuffer&&(a.texCoordBuffer=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,a.texCoordBuffer),a.bufferData(a.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,1]),a.STATIC_DRAW));null==this.vertexAttribute&&
  (this.vertexAttribute=a.getAttribLocation(this.program,"vertex"),a.enableVertexAttribArray(this.vertexAttribute));null==this.texCoordAttribute&&(this.texCoordAttribute=a.getAttribLocation(this.program,"_texCoord"),a.enableVertexAttribArray(this.texCoordAttribute));a.useProgram(this.program);a.bindBuffer(a.ARRAY_BUFFER,a.vertexBuffer);a.vertexAttribPointer(this.vertexAttribute,2,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,a.texCoordBuffer);a.vertexAttribPointer(this.texCoordAttribute,2,a.FLOAT,!1,
  0,0);a.drawArrays(a.TRIANGLE_STRIP,0,4)};e.getDefaultShader=function(){a.defaultShader=a.defaultShader||new e;return a.defaultShader};return e}();B.prototype.interpolate=function(a){for(var e=0,d=this.ya.length-1;1<d-e;){var b=d+e>>1;this.xa[b]>a?d=b:e=b}var b=this.xa[d]-this.xa[e],g=(this.xa[d]-a)/b;a=(a-this.xa[e])/b;return g*this.ya[e]+a*this.ya[d]+((g*g*g-g)*this.y2[e]+(a*a*a-a)*this.y2[d])*b*b/6};var u=function(){function c(b,c,d,e){this.gl=a;this.id=a.createTexture();this.width=b;this.height=
  c;this.format=d;this.type=e;a.bindTexture(a.TEXTURE_2D,this.id);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);b&&c&&a.texImage2D(a.TEXTURE_2D,0,this.format,b,c,0,this.format,this.type,null)}function e(a){null==d&&(d=document.createElement("canvas"));d.width=a.width;d.height=a.height;a=d.getContext("2d");
  a.clearRect(0,0,d.width,d.height);return a}c.fromElement=function(b){var d=new c(0,0,a.RGBA,a.UNSIGNED_BYTE);d.loadContentsOf(b);return d};c.prototype.loadContentsOf=function(b){this.width=b.width||b.videoWidth;this.height=b.height||b.videoHeight;a.bindTexture(a.TEXTURE_2D,this.id);a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,b)};c.prototype.initFromBytes=function(b,c,d){this.width=b;this.height=c;this.format=a.RGBA;this.type=a.UNSIGNED_BYTE;a.bindTexture(a.TEXTURE_2D,this.id);a.texImage2D(a.TEXTURE_2D,
  0,a.RGBA,b,c,0,a.RGBA,this.type,new Uint8Array(d))};c.prototype.destroy=function(){a.deleteTexture(this.id);this.id=null};c.prototype.use=function(b){a.activeTexture(a.TEXTURE0+(b||0));a.bindTexture(a.TEXTURE_2D,this.id)};c.prototype.unuse=function(b){a.activeTexture(a.TEXTURE0+(b||0));a.bindTexture(a.TEXTURE_2D,null)};c.prototype.ensureFormat=function(b,c,d,e){if(1==arguments.length){var f=arguments[0];b=f.width;c=f.height;d=f.format;e=f.type}if(b!=this.width||c!=this.height||d!=this.format||e!=
  this.type)this.width=b,this.height=c,this.format=d,this.type=e,a.bindTexture(a.TEXTURE_2D,this.id),a.texImage2D(a.TEXTURE_2D,0,this.format,b,c,0,this.format,this.type,null)};c.prototype.drawTo=function(b){a.framebuffer=a.framebuffer||a.createFramebuffer();a.bindFramebuffer(a.FRAMEBUFFER,a.framebuffer);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,this.id,0);if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw Error("incomplete framebuffer");a.viewport(0,
  0,this.width,this.height);b();a.bindFramebuffer(a.FRAMEBUFFER,null)};var d=null;c.prototype.fillUsingCanvas=function(b){b(e(this));this.format=a.RGBA;this.type=a.UNSIGNED_BYTE;a.bindTexture(a.TEXTURE_2D,this.id);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,d);return this};c.prototype.toImage=function(b){this.use();k.getDefaultShader().drawRect();var c=this.width*this.height*4,f=new Uint8Array(c),h=e(this),m=h.createImageData(this.width,this.height);a.readPixels(0,0,this.width,this.height,
  a.RGBA,a.UNSIGNED_BYTE,f);for(var l=0;l<c;l++)m.data[l]=f[l];h.putImageData(m,0,0);b.src=d.toDataURL()};c.prototype.swapWith=function(a){var c;c=a.id;a.id=this.id;this.id=c;c=a.width;a.width=this.width;this.width=c;c=a.height;a.height=this.height;this.height=c;c=a.format;a.format=this.format;this.format=c};return c}(),v="float random(vec3 scale,float seed){return fract(sin(dot(gl_FragCoord.xyz+seed,scale))*43758.5453+seed);}",
  E=function(a,e){var d=a._.gl;a.draw(e);var b=a.getPixelArray(),f,h,k,m,q;this.width=function(a){f=a=a||e._.width;return this};this.height=function(a){h=a=a||e._.height;return this};this.shortenX=function(a){f=e._.width-(a||0);return this};this.shortenY=function(a){h=e._.height-(a||0);return this};this.type=function(a){switch(a){case l.UNSIGNED_BYTE:case l.UNSIGNED_SHORT_5_6_5:case l.UNSIGNED_SHORT_4_4_4_4:case l.UNSIGNED_SHORT_5_5_5_1:m=a;break;default:console.log("[GLITCH TYPE ERROR] type supports only fx.UNSIGNED_BYTE, fx.UNSIGNED_SHORT_5_6_5, fx.UNSIGNED_SHORT_4_4_4_4, fx.UNSIGNED_SHORT_5_5_5_1.")}return this};
  this.format=function(a){switch(a){case l.ALPHA:case l.LUMINANCE:case l.LUMINANCE_ALPHA:case l.RGB:case l.RGBA:k=a;break;default:console.log("[GLITCH FORMAT ERROR] format supports only fx.ALPHA, fx.LUMINANCE, fx.LUMINANCE_ALPHA, fx.RGB and fx.RGBA.")}return this};this.offset=function(a){var c=b.subarray(0,a);a=b.subarray(a,b.length);for(var d=new Uint8Array(b.length),e=0,f=0;f<a.length;f++)d[e]=a[f],e++;for(f=0;f<c.length;f++)d[e]=c[f],e++;b=d;return this};this.length=function(){return b.length()};
  this.process=function(a){q=a||function(){};return this};this.update=function(){f=f||e._.width;h=h||e._.height;k=k||l.RGBA;m=m||l.UNSIGNED_BYTE;q=q||function(a){};q(b);d.bindTexture(d.TEXTURE_2D,e._.id);d.texImage2D(d.TEXTURE_2D,0,k,f,h,0,k,m,b);a.draw(e).update();return this}};return l}();
  