-
Notifications
You must be signed in to change notification settings - Fork 2
/
p5.min.js
2 lines (2 loc) · 62.3 KB
/
p5.min.js
1
2
!function(){var shim=function(){window.requestDraw=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}()}({}),constants=function(){var t=Math.PI;return{ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",HALF_PI:t/2,PI:t,QUARTER_PI:t/4,TAU:2*t,TWO_PI:2*t,DEGREES:"degrees",RADIANS:"radians",CORNER:"corner",CORNERS:"corners",RADIUS:"radius",RIGHT:"right",LEFT:"left",CENTER:"center",POINTS:"points",LINES:"lines",TRIANGLES:"triangles",TRIANGLE_FAN:"triangles_fan",TRIANGLE_STRIP:"triangles_strip",QUADS:"quads",QUAD_STRIP:"quad_strip",CLOSE:"close",OPEN:"open",CHORD:"chord",PIE:"pie",PROJECT:"square",SQUARE:"butt",ROUND:"round",BEVEL:"bevel",MITER:"miter",RGB:"rgb",HSB:"hsb",AUTO:"auto",ALT:18,BACKSPACE:8,CONTROL:17,DELETE:46,DOWN_ARROW:40,ENTER:13,ESCAPE:27,LEFT_ARROW:37,OPTION:18,RETURN:13,RIGHT_ARROW:39,SHIFT:16,TAB:9,UP_ARROW:38,NORMAL:"normal",ITALIC:"italic",BOLD:"bold",LINEAR:"linear",QUADRATIC:"quadratic",BEZIER:"bezier",CURVE:"curve"}}({}),core=function(t,e,n){"use strict";var n=n,r=function(t,e){if(this.remove=function(){if(this._curElement){this._timeout&&(clearTimeout(this._timeout),this._loop=!1);for(var t in this._events)window.removeEventListener(t,this._events[t]);for(var e in this._curElement._events){var o=this._curElement._events[e];this._curElement.elt.removeEventListener(e,o)}if(this._isGlobal){for(var i in r.prototype)delete window[i];for(var s in this)this.hasOwnProperty(s)&&delete window[s];for(var a in n)delete window[a]}var u=this._curElement.elt;u.parentNode.removeChild(u)}}.bind(this),this._setupDone=!1,this._pixelDensity=window.devicePixelRatio||1,this._startTime=(new Date).getTime(),this._userNode=e,this._curElement=null,this._preloadCount=0,this._updateInterval=0,this._isGlobal=!1,this._loop=!0,this.styles=[],this._defaultCanvasSize={width:100,height:100},this._events={mousemove:null,mousedown:null,mouseup:null,click:null,mousewheel:null,mouseover:null,mouseout:null,keydown:null,keyup:null,keypress:null,touchstart:null,touchmove:null,touchend:null},this._start=function(){this._userNode&&"string"==typeof this._userNode&&(this._userNode=document.getElementById(this._userNode)),this.createCanvas(this._defaultCanvasSize.width,this._defaultCanvasSize.height,!0);var t=this.preload||window.preload,e=this._isGlobal?window:this;t?(this._preloadFuncs.forEach(function(t){e[t]=function(n){return e._preload(t,n)}}),t(),0===this._preloadCount&&(this._setup(),this._runFrames(),this._draw())):(this._setup(),this._runFrames(),this._draw())}.bind(this),this._preload=function(t,e){var n=this._isGlobal?window:this;return n._setProperty("_preloadCount",n._preloadCount+1),r.prototype[t].call(n,e,function(){n._setProperty("_preloadCount",n._preloadCount-1),0===n._preloadCount&&(n._setup(),n._runFrames(),n._draw())})}.bind(this),this._setup=function(){var t=this.setup||window.setup;"function"==typeof t&&t();for(var e=new RegExp(/(^|\s)p5_hidden(?!\S)/g),n=document.getElementsByClassName("p5_hidden"),r=0;r<n.length;r++){var o=n[r];o.style.visibility="",o.className=o.className.replace(e,"")}this._setupDone=!0}.bind(this),this._draw=function(){var t=this.setup||window.setup,e=(new Date).getTime();this._frameRate=1e3/(e-this._lastFrameTime),this._lastFrameTime=e;var n=this.draw||window.draw;this._loop&&(this._timeout=setTimeout(function(){window.requestDraw(this._draw.bind(this))}.bind(this),1e3/this._targetFrameRate)),"function"==typeof n&&(this.pushMatrix(),"undefined"==typeof t&&this.scale(this._pixelDensity,this._pixelDensity),n(),this.popMatrix())}.bind(this),this._runFrames=function(){this._updateInterval&&clearInterval(this._updateInterval),this._updateInterval=setInterval(function(){this._setProperty("frameCount",this.frameCount+1)}.bind(this),1e3/this._targetFrameRate)}.bind(this),this._applyDefaults=function(){this._curElement.context.fillStyle="#FFFFFF",this._curElement.context.strokeStyle="#000000",this._curElement.context.lineCap=n.ROUND}.bind(this),this._setProperty=function(t,e){this[t]=e,this._isGlobal&&(window[t]=e)}.bind(this),this._registerPreloadFunc=function(t){this._preloadFuncs.push(t)}.bind(this),t){t(this);for(var o in n)n.hasOwnProperty(o)&&(r.prototype[o]=n[o])}else{this._isGlobal=!0;for(var i in r.prototype){var s=i.substring(2);this._events.hasOwnProperty(s)||"function"==typeof r.prototype[i]&&(window[i]=r.prototype[i].bind(this))}for(var a in this)this.hasOwnProperty(a)&&(window[a]=this[a]);for(var u in r.prototype)r.prototype.hasOwnProperty(u)&&"function"!=typeof r.prototype[u]&&(window[u]=this[u]);for(var c in n)n.hasOwnProperty(c)&&(window[c]=n[c])}for(var p in this._events){var h=this["on"+p];if(h){var l=h.bind(this);window.addEventListener(p,l),this._events[p]=l}}"complete"===document.readyState?this._start():window.addEventListener("load",this._start.bind(this),!1)};for(var o in n)n.hasOwnProperty(o)&&(r.prototype[o]=n[o]);return r.prototype._preloadFuncs=["loadJSON","loadImage","loadStrings","loadXML"],r.prototype._registerPreloadFunc=function(t){r.prototype._preloadFuncs.push(t)}.bind(this),r}({},shim,constants),p5Element=function(t,e){function n(t,e,n){var r=n,o=function(t){e(t,r)};n.elt.addEventListener(t,o,!1),n._events[t]=o}var r=e;return r.Element=function(t,e){this.elt=t,this._pInst=e,this._events={},this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,t instanceof HTMLCanvasElement&&this._pInst&&(this.context=t.getContext("2d"),this._pInst._setProperty("canvas",t))},r.Element.prototype.parent=function(t){"string"==typeof t&&(t=document.getElementById(t)),t.appendChild(this.elt)},r.Element.prototype.id=function(t){this.elt.id=t},r.Element.prototype.class=function(t){this.elt.className+=" "+t},r.Element.prototype.mousePressed=function(t){n("click",t,this)},r.Element.prototype.mouseOver=function(t){n("mouseover",t,this)},r.Element.prototype.mouseOut=function(t){n("mouseout",t,this)},r.Element.prototype._setProperty=function(t,e){this[t]=e},r.Element}({},core),filters=function(){"use strict";function t(t){var e=3.5*t|0;if(e=1>e?1:248>e?e:248,r!==e){r=e,o=1+r<<1,i=new Int32Array(o),s=new Array(o);for(var n=0;o>n;n++)s[n]=new Int32Array(256);for(var a,u,c,p,h=1,l=e-1;e>h;h++){i[e+h]=i[l]=u=l*l,c=s[e+h],p=s[l--];for(var d=0;256>d;d++)c[d]=p[d]=u*d}a=i[e]=e*e,c=s[e];for(var f=0;256>f;f++)c[f]=a*f}}function e(e,a){for(var u=n._toPixels(e),c=e.width,p=e.height,h=c*p,l=new Int32Array(h),d=0;h>d;d++)l[d]=n._getARGB(u,d);var f,m,y,g,_,v,x,w,E,R=new Int32Array(h),M=new Int32Array(h),b=new Int32Array(h),C=0;t(a);var A,S,P,T;for(S=0;p>S;S++){for(A=0;c>A;A++){if(g=y=m=f=0,_=A-r,0>_)E=-_,_=0;else{if(_>=c)break;E=0}for(P=E;o>P&&!(_>=c);P++){var I=l[_+C];T=s[P],m+=T[(16711680&I)>>16],y+=T[(65280&I)>>8],g+=T[255&I],f+=i[P],_++}v=C+A,R[v]=m/f,M[v]=y/f,b[v]=g/f}C+=c}for(C=0,x=-r,w=x*c,S=0;p>S;S++){for(A=0;c>A;A++){if(g=y=m=f=0,0>x)E=v=-x,_=A;else{if(x>=p)break;E=0,v=x,_=A+w}for(P=E;o>P&&!(v>=p);P++)T=s[P],m+=T[R[_]],y+=T[M[_]],g+=T[b[_]],f+=i[P],v++,_+=c;l[A+C]=4278190080|m/f<<16|y/f<<8|g/f}C+=c,w+=c,x++}n._setPixels(u,l)}var n={};n._toPixels=function(t){return t instanceof ImageData?t.data:t.getContext("2d").getImageData(0,0,t.width,t.height).data},n._getARGB=function(t,e){var n=4*e;return t[n+3]<<24&4278190080|t[n]<<16&16711680|t[n+1]<<8&65280|255&t[n+2]},n._setPixels=function(t,e){for(var n=0,r=0,o=t.length;o>r;r++)n=4*r,t[n+0]=(16711680&e[r])>>>16,t[n+1]=(65280&e[r])>>>8,t[n+2]=255&e[r],t[n+3]=(4278190080&e[r])>>>24},n._toImageData=function(t){return t instanceof ImageData?t:t.getContext("2d").getImageData(0,0,t.width,t.height)},n._createImageData=function(t,e){return n._tmpCanvas=document.createElement("canvas"),n._tmpCtx=n._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(t,e)},n.apply=function(t,e,n){var r=t.getContext("2d"),o=r.getImageData(0,0,t.width,t.height),i=e(o,n);i instanceof ImageData?r.putImageData(i,0,0,0,0,t.width,t.height):r.putImageData(o,0,0,0,0,t.width,t.height)},n.threshold=function(t,e){var r=n._toPixels(t);void 0===e&&(e=.5);for(var o=Math.floor(255*e),i=0;i<r.length;i+=4){var s,a=r[i],u=r[i+1],c=r[i+2],p=.2126*a+.7152*u+.0722*c;s=p>=o?255:0,r[i]=r[i+1]=r[i+2]=s}},n.gray=function(t){for(var e=n._toPixels(t),r=0;r<e.length;r+=4){var o=e[r],i=e[r+1],s=e[r+2],a=.2126*o+.7152*i+.0722*s;e[r]=e[r+1]=e[r+2]=a}},n.opaque=function(t){for(var e=n._toPixels(t),r=0;r<e.length;r+=4)e[r+3]=255;return e},n.invert=function(t){for(var e=n._toPixels(t),r=0;r<e.length;r+=4)e[r]=255-e[r],e[r+1]=255-e[r+1],e[r+2]=255-e[r+2]},n.posterize=function(t,e){var r=n._toPixels(t);if(2>e||e>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");for(var o=e-1,i=0;i<r.length;i+=4){var s=r[i],a=r[i+1],u=r[i+2];r[i]=255*(s*e>>8)/o,r[i+1]=255*(a*e>>8)/o,r[i+2]=255*(u*e>>8)/o}},n.dilate=function(t){for(var e,r,o,i,s,a,u,c,p,h,l,d,f,m,y,g,_,v=n._toPixels(t),x=0,w=v.length?v.length/4:0,E=new Int32Array(w);w>x;)for(e=x,r=x+t.width;r>x;)o=i=n._getARGB(v,x),u=x-1,a=x+1,c=x-t.width,p=x+t.width,e>u&&(u=x),a>=r&&(a=x),0>c&&(c=0),p>=w&&(p=x),d=n._getARGB(v,c),l=n._getARGB(v,u),f=n._getARGB(v,p),h=n._getARGB(v,a),s=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),y=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),m=77*(h>>16&255)+151*(h>>8&255)+28*(255&h),g=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),_=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),y>s&&(i=l,s=y),m>s&&(i=h,s=m),g>s&&(i=d,s=g),_>s&&(i=f,s=_),E[x++]=i;n._setPixels(v,E)},n.erode=function(t){for(var e,r,o,i,s,a,u,c,p,h,l,d,f,m,y,g,_,v=n._toPixels(t),x=0,w=v.length?v.length/4:0,E=new Int32Array(w);w>x;)for(e=x,r=x+t.width;r>x;)o=i=n._getARGB(v,x),u=x-1,a=x+1,c=x-t.width,p=x+t.width,e>u&&(u=x),a>=r&&(a=x),0>c&&(c=0),p>=w&&(p=x),d=n._getARGB(v,c),l=n._getARGB(v,u),f=n._getARGB(v,p),h=n._getARGB(v,a),s=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),y=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),m=77*(h>>16&255)+151*(h>>8&255)+28*(255&h),g=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),_=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),s>y&&(i=l,s=y),s>m&&(i=h,s=m),s>g&&(i=d,s=g),s>_&&(i=f,s=_),E[x++]=i;n._setPixels(v,E)};var r,o,i,s;return n.blur=function(t,n){e(t,n)},n}({}),p5Image=function(t,e,n){"use strict";var r=e,o=n;return r.Image=function(t,e){this.width=t,this.height=e,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.pixels=[]},r.Image.prototype._setProperty=function(t,e){this[t]=e},r.Image.prototype.loadPixels=function(){r.prototype.loadPixels.call(this)},r.Image.prototype.updatePixels=function(t,e,n,o){r.prototype.updatePixels.call(this,t,e,n,o)},r.Image.prototype.get=function(t,e,n,o){return r.prototype.get.call(this,t,e,n,o)},r.Image.prototype.set=function(t,e,n){r.prototype.set.call(this,t,e,n)},r.Image.prototype.resize=function(t,e){var n=document.createElement("canvas");n.width=t,n.height=e,n.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,n.width,n.width),this.canvas.width=this.width=t,this.canvas.height=this.height=e,this.canvas.getContext("2d").drawImage(n,0,0,t,e,0,0,t,e),this.pixels.length>0&&this.loadPixels()},r.Image.prototype.copy=function(){r.prototype.copy.apply(this,arguments)},r.Image.prototype.mask=function(t){void 0===t&&(t=this);var e=this.canvas.getContext("2d").globalCompositeOperation,n=[t,0,0,t.width,t.height,0,0,this.width,this.height];this.canvas.getContext("2d").globalCompositeOperation="destination-out",this.copy.apply(this,n),this.canvas.getContext("2d").globalCompositeOperation=e},r.Image.prototype.filter=function(t,e){o.apply(this.canvas,o[t.toLowerCase()],e)},r.Image.prototype.blend=function(){r.prototype.blend.apply(this,arguments)},r.Image.prototype.save=function(t){var e;switch(t.toLowerCase()){case"png":e="image/png";break;case"jpeg":e="image/jpeg";break;case"jpg":e="image/jpeg";break;default:e="image/png"}if(void 0!==e){var n="image/octet-stream",r=this.canvas.toDataURL(e);r=r.replace(e,n),window.location.href=r}},r.Image}({},core,filters),polargeometry=function(){return{degreesToRadians:function(t){return 2*Math.PI*t/360},radiansToDegrees:function(t){return 360*t/(2*Math.PI)}}}({}),p5Vector=function(t,e,n,r){"use strict";var o=e,i=n,r=r;return o.Vector=function(){var t,e,n;arguments[0]instanceof o?(this.p5=arguments[0],t=arguments[1][0]||0,e=arguments[1][1]||0,n=arguments[1][2]||0):(t=arguments[0]||0,e=arguments[1]||0,n=arguments[2]||0),this.x=t,this.y=e,this.z=n},o.Vector.prototype.set=function(t,e,n){return t instanceof o.Vector?this.set(t.x,t.y,t.z):t instanceof Array?this.set(t[0],t[1],t[2]):(this.x=t||0,this.y=e||0,this.z=n||0,this)},o.Vector.prototype.get=function(){return this.p5?new o.Vector(this.p5,[this.x,this.y,this.z]):new o.Vector(this.x,this.y,this.z)},o.Vector.prototype.add=function(t,e,n){return t instanceof o.Vector?this.add(t.x,t.y,t.z):t instanceof Array?this.add(t[0],t[1],t[2]):(this.x+=t||0,this.y+=e||0,this.z+=n||0,this)},o.Vector.prototype.sub=function(t,e,n){return t instanceof o.Vector?this.sub(t.x,t.y,t.z):t instanceof Array?this.sub(t[0],t[1],t[2]):(this.x-=t||0,this.y-=e||0,this.z-=n||0,this)},o.Vector.prototype.mult=function(t){return this.x*=t||0,this.y*=t||0,this.z*=t||0,this},o.Vector.prototype.div=function(t){return this.x/=t,this.y/=t,this.z/=t,this},o.Vector.prototype.mag=function(){return Math.sqrt(this.magSq())},o.Vector.prototype.magSq=function(){var t=this.x,e=this.y,n=this.z;return t*t+e*e+n*n},o.Vector.prototype.dot=function(t,e,n){return t instanceof o.Vector?this.dot(t.x,t.y,t.z):this.x*(t||0)+this.y*(e||0)+this.z*(n||0)},o.Vector.prototype.cross=function(t){var e=this.y*t.z-this.z*t.y,n=this.z*t.x-this.x*t.z,r=this.x*t.y-this.y*t.x;return this.p5?new o.Vector(this.p5,[e,n,r]):new o.Vector(e,n,r)},o.Vector.prototype.dist=function(t){var e=t.get().sub(this);return e.mag()},o.Vector.prototype.normalize=function(){return this.div(this.mag())},o.Vector.prototype.limit=function(t){var e=this.magSq();return e>t*t&&(this.div(Math.sqrt(e)),this.mult(t)),this},o.Vector.prototype.setMag=function(t){return this.normalize().mult(t)},o.Vector.prototype.heading=function(){var t=Math.atan2(this.y,this.x);return this.p5?this.p5._angleMode===r.RADIANS?t:i.radiansToDegrees(t):t},o.Vector.prototype.rotate=function(t){this.p5&&this.p5._angleMode===r.DEGREES&&(t=i.degreesToRadians(t));var e=this.heading()+t,n=this.mag();return this.x=Math.cos(e)*n,this.y=Math.sin(e)*n,this},o.Vector.prototype.lerp=function(t,e,n,r){return t instanceof o.Vector?this.lerp(t.x,t.y,t.z,e):(this.x+=(t-this.x)*r||0,this.y+=(e-this.y)*r||0,this.z+=(n-this.z)*r||0,this)},o.Vector.prototype.array=function(){return[this.x||0,this.y||0,this.z||0]},o.Vector.fromAngle=function(t){return this.p5&&this.p5._angleMode===r.DEGREES&&(t=i.degreesToRadians(t)),this.p5?new o.Vector(this.p5,[Math.cos(t),Math.sin(t),0]):new o.Vector(Math.cos(t),Math.sin(t),0)},o.Vector.random2D=function(){var t;return t=this.p5?this.p5.random(this.p5._angleMode===r.DEGREES?360:r.TWO_PI):Math.random()*Math.PI*2,this.fromAngle(t)},o.Vector.random3D=function(){var t,e;this.p5?(t=this.p5.random(0,r.TWO_PI),e=this.p5.random(-1,1)):(t=Math.random()*Math.PI*2,e=2*Math.random()-1);var n=Math.sqrt(1-e*e)*Math.cos(t),i=Math.sqrt(1-e*e)*Math.sin(t);return this.p5?new o.Vector(this.p5,[n,i,e]):new o.Vector(n,i,e)},o.Vector.add=function(t,e){return t.get().add(e)},o.Vector.sub=function(t,e){return t.get().sub(e)},o.Vector.mult=function(t,e){return t.get().mult(e)},o.Vector.div=function(t,e){return t.get().div(e)},o.Vector.dot=function(t,e){return t.dot(e)},o.Vector.cross=function(t,e){return t.cross(e)},o.Vector.dist=function(t,e){return t.dist(e)},o.Vector.lerp=function(t,e,n){return t.get().lerp(e,n)},o.Vector.angleBetween=function(t,e){var n=Math.acos(t.dot(e)/(t.mag()*e.mag()));return this.p5&&this.p5._angleMode===r.DEGREES&&(n=i.radiansToDegrees(n)),n},o.Vector}({},core,polargeometry,constants),colorcreating_reading=function(t,e){"use strict";var n=e;return n.prototype.alpha=function(t){return t.length>3?t[3]:255},n.prototype.blue=function(t){return t.length>2?t[2]:0},n.prototype.brightness=function(t){return t.length>2?t[2]:0},n.prototype.color=function(){return this.getNormalizedColor(arguments)},n.prototype.green=function(t){return t.length>2?t[1]:0},n.prototype.hue=function(t){return t.length>2?t[0]:0},n.prototype.lerpColor=function(t,e,r){if("Array"==typeof t){for(var o=[],i=0;i<t.length;i++)o.push(n.prototype.lerp(t[i],e[i],r));return o}return n.prototype.lerp(t,e,r)},n.prototype.red=function(t){return t.length>2?t[0]:0},n.prototype.saturation=function(t){return t.length>2?t[1]:0},n}({},core),colorsetting=function(t,e,n){"use strict";function r(t,e,n){t/=255,e/=255,n/=255;var r=[];if(0===e)r=[Math.round(255*n),Math.round(255*n),Math.round(255*n)];else{var o=6*t;6===o&&(o=0);var i,s,a,u=Math.floor(o),c=n*(1-e),p=n*(1-e*(o-u)),h=n*(1-e*(1-(o-u)));0===u?(i=n,s=h,a=c):1===u?(i=p,s=n,a=c):2===u?(i=c,s=n,a=h):3===u?(i=c,s=p,a=n):4===u?(i=h,s=c,a=n):(i=n,s=c,a=p),r=[Math.round(255*i),Math.round(255*s),Math.round(255*a)]}return r}var o=e,n=n;return o.prototype._colorMode=n.RGB,o.prototype._maxC0=255,o.prototype._maxC1=255,o.prototype._maxC2=255,o.prototype._maxA=255,o.prototype.background=function(){var t=this.getNormalizedColor(arguments),e=this._curElement.context.fillStyle;this._curElement.context.fillStyle=this.getCSSRGBAColor(t),this._curElement.context.fillRect(0,0,this.width,this.height),this._curElement.context.fillStyle=e},o.prototype.clear=function(){this._curElement.context.clearRect(0,0,this.width,this.height)},o.prototype.colorMode=function(){(arguments[0]===n.RGB||arguments[0]===n.HSB)&&(this._colorMode=arguments[0]),2===arguments.length?(this._maxC0=arguments[1],this._maxC1=arguments[1],this._maxC2=arguments[1]):arguments.length>2&&(this._maxC0=arguments[1],this._maxC1=arguments[2],this._maxC2=arguments[3]),5===arguments.length&&(this._maxA=arguments[4])},o.prototype.fill=function(){var t=this.getNormalizedColor(arguments);this._curElement.context.fillStyle=this.getCSSRGBAColor(t)},o.prototype.noFill=function(){this._curElement.context.fillStyle="rgba(0,0,0,0)"},o.prototype.noStroke=function(){this._curElement.context.strokeStyle="rgba(0,0,0,0)"},o.prototype.stroke=function(){var t=this.getNormalizedColor(arguments);this._curElement.context.strokeStyle=this.getCSSRGBAColor(t)},o.prototype.getNormalizedColor=function(t){if(t[0]instanceof Array)return t[0];var e,o,i,s,a;return t.length>=3?(e=t[0],o=t[1],i=t[2],s="number"==typeof t[3]?t[3]:this._maxA):(e=o=i=t[0],s="number"==typeof t[1]?t[1]:this._maxA),e*=255/this._maxC0,o*=255/this._maxC1,i*=255/this._maxC2,s*=255/this._maxA,a=this._colorMode===n.HSB?r(e,o,i).concat(s):[e,o,i,s]},o.prototype.getCSSRGBAColor=function(t){var e=t.map(function(t){return Math.floor(t)}),n=e[3]?e[3]/255:1;return"rgba("+e[0]+","+e[1]+","+e[2]+","+n+")"},o}({},core,constants),dataarray_functions=function(t,e){"use strict";var n=e;return n.prototype.append=function(t,e){return t.push(e),t},n.prototype.arrayCopy=function(t,e,n,r,o){var i,s;"undefined"!=typeof o?(s=Math.min(o,t.length),i=r,t=t.slice(e,s+e)):("undefined"!=typeof n?(s=n,s=Math.min(s,t.length)):s=t.length,i=0,n=e,t=t.slice(0,s)),Array.prototype.splice.apply(n,[i,s].concat(t))},n.prototype.concat=function(t,e){return t.concat(e)},n.prototype.reverse=function(t){return t.reverse()},n.prototype.shorten=function(t){return t.pop(),t},n.prototype.sort=function(t,e){var n=e?t.slice(0,Math.min(e,t.length)):t,r=e?t.slice(Math.min(e,t.length)):[];return n="string"==typeof n[0]?n.sort():n.sort(function(t,e){return t-e}),n.concat(r)},n.prototype.splice=function(t,e,n){return Array.prototype.splice.apply(t,[n,0].concat(e)),t},n.prototype.subset=function(t,e,n){return"undefined"!=typeof n?t.slice(e,e+n):t.slice(e,t.length)},n}({},core),datastring_functions=function(t,e){"use strict";function n(){var t=arguments[0],e=0>t,n=e?t.toString().substring(1):t.toString(),r=n.indexOf("."),o=-1!==r?n.substring(0,r):n,i=-1!==r?n.substring(r+1):"",s=e?"-":"";if(3===arguments.length){for(var a=0;a<arguments[1]-o.length;a++)s+="0";s+=o,s+=".",s+=i;for(var u=0;u<arguments[2]-i.length;u++)s+="0";return s}for(var c=0;c<Math.max(arguments[1]-o.length,0);c++)s+="0";return s+=n}function r(){var t=arguments[0].toString(),e=t.indexOf("."),n=-1!==e?t.substring(e):"",r=-1!==e?t.substring(0,e):t;return r=r.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),arguments.length>1&&(n=n.substring(0,arguments[1]+1)),r+n}function o(){return parseFloat(arguments[0])>0?"+"+arguments[0].toString():arguments[0].toString()}function i(){return parseFloat(arguments[0])>0?" "+arguments[0].toString():arguments[0].toString()}var s=e;return s.prototype.join=function(t,e){return t.join(e)},s.prototype.match=function(t,e){return t.match(e)},s.prototype.matchAll=function(t,e){for(var n=new RegExp(e,"g"),r=n.exec(t),o=[];null!==r;)o.push(r),r=n.exec(t);return o},s.prototype.nf=function(){if(arguments[0]instanceof Array){var t=arguments[1],e=arguments[2];return arguments[0].map(function(r){return n(r,t,e)})}return n.apply(this,arguments)},s.prototype.nfc=function(){if(arguments[0]instanceof Array){var t=arguments[1];return arguments[0].map(function(e){return r(e,t)})}return r.apply(this,arguments)},s.prototype.nfp=function(){var t=this.nf(arguments);return t instanceof Array?t.map(o):o(t)},s.prototype.nfs=function(){var t=this.nf(arguments);return t instanceof Array?t.map(i):i(t)},s.prototype.split=function(t,e){return t.split(e)},s.prototype.splitTokens=function(){var t=arguments.length>0?arguments[1]:/\s/g;return arguments[0].split(t).filter(function(t){return t})},s.prototype.trim=function(t){return t instanceof Array?t.map(this.trim):t.trim()},s}({},core),inputmouse=function(t,e,n){"use strict";function r(t,e){var n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}}var o=e,n=n;return o.prototype.mouseX=0,o.prototype.mouseY=0,o.prototype.pmouseX=0,o.prototype.pmouseY=0,o.prototype.winMouseX=0,o.prototype.winMouseY=0,o.prototype.pwinMouseX=0,o.prototype.pwinMouseY=0,o.prototype.mouseButton=0,o.prototype.isMousePressed=!1,o.prototype.mouseIsPressed=!1,o.prototype.updateMouseCoords=function(t){var e=r(this._curElement.elt,t);this._setProperty("pmouseX",this.mouseX),this._setProperty("pmouseY",this.mouseY),this._setProperty("mouseX",e.x),this._setProperty("mouseY",e.y),this._setProperty("pwinMouseX",this.winMouseX),this._setProperty("pwinMouseY",this.winMouseY),this._setProperty("winMouseX",t.pageX),this._setProperty("winMouseY",t.pageY)},o.prototype.setMouseButton=function(t){1===t.button?this._setProperty("mouseButton",n.CENTER):2===t.button?this._setProperty("mouseButton",n.RIGHT):this._setProperty("mouseButton",n.LEFT)},o.prototype.onmousemove=function(t){var e=this._isGlobal?window:this;this.updateMouseCoords(t),this.isMousePressed?"function"==typeof e.mouseDragged?(t.preventDefault(),e.mouseDragged(t)):"function"==typeof e.touchMoved&&(t.preventDefault(),e.touchMoved(t)):"function"==typeof e.mouseMoved?(t.preventDefault(),e.mouseMoved(t)):"function"==typeof e.touchMoved&&(t.preventDefault(),e.touchMoved(t))},o.prototype.onmousedown=function(t){var e=this._isGlobal?window:this;this._setProperty("isMousePressed",!0),this._setProperty("mouseIsPressed",!0),this.setMouseButton(t),"function"==typeof e.mousePressed?(t.preventDefault(),e.mousePressed(t)):"function"==typeof e.touchStarted&&(t.preventDefault(),e.touchStarted(t))},o.prototype.onmouseup=function(t){var e=this._isGlobal?window:this;this._setProperty("isMousePressed",!1),this._setProperty("mouseIsPressed",!1),"function"==typeof e.mouseReleased?(t.preventDefault(),e.mouseReleased(t)):"function"==typeof e.touchEnded&&(t.preventDefault(),e.touchEnded(t))},o.prototype.onclick=function(t){var e=this._isGlobal?window:this;"function"==typeof e.mouseClicked&&(t.preventDefault(),e.mouseClicked(t))},o.prototype.onmousewheel=function(t){var e=this._isGlobal?window:this;"function"==typeof e.mouseWheel&&(t.preventDefault(),e.mouseWheel(t))},o}({},core,constants),inputtouch=function(t,e){"use strict";var n=e;return n.prototype.touchX=0,n.prototype.touchY=0,n.prototype.setTouchPoints=function(t){var e=this._isGlobal?window:this;e._setProperty("touchX",t.changedTouches[0].pageX),e._setProperty("touchY",t.changedTouches[0].pageY);for(var n=[],r=0;r<t.changedTouches.length;r++){var o=t.changedTouches[r];n[r]={x:o.pageX,y:o.pageY}}e._setProperty("touches",n)},n.prototype.ontouchstart=function(t){var e=this._isGlobal?window:this;e.setTouchPoints(t),"function"==typeof e.touchStarted?(t.preventDefault(),e.touchStarted(t)):"function"==typeof e.mousePressed&&(t.preventDefault(),e.mousePressed(t))},n.prototype.ontouchmove=function(t){var e=this._isGlobal?window:this;e.setTouchPoints(t),"function"==typeof e.touchMoved?(t.preventDefault(),e.touchMoved(t)):"function"==typeof e.mouseDragged&&(t.preventDefault(),e.mouseDragged(t))},n.prototype.ontouchend=function(t){var e=this._isGlobal?window:this;e.setTouchPoints(t),"function"==typeof e.touchEnded?(t.preventDefault(),e.touchEnded(t)):"function"==typeof e.mouseReleased&&(t.preventDefault(),e.mouseReleased(t))},n}({},core),domdom=function(t,e){var n=e;return n.prototype.createCanvas=function(t,e,r){var o;if(r)o=document.createElement("canvas"),o.id="defaultCanvas";else if(o=document.getElementById("defaultCanvas"),o.id="",!o){o=document.createElement("canvas");var i="Warning: createCanvas more than once not recommended.";i+="Unpredictable behavior may result.",console.log(i)}o.setAttribute("width",t*this._pixelDensity),o.setAttribute("height",e*this._pixelDensity),o.setAttribute("style","width:"+t+"px !important; height:"+e+"px !important;"),this._setupDone||(o.className+=" p5_hidden",o.style.visibility="hidden"),this._userNode?this._userNode.appendChild(o):document.body.appendChild(o);var s=new n.Element(o,this);return this.context(s),this._applyDefaults(),this.scale(this._pixelDensity,this._pixelDensity),s},n.prototype.context=function(t){var e;if("string"==typeof t||t instanceof String){var r=document.getElementById(t);if(r){var o=new n.Element(r,this);e=o}else e=null}else e=t;if("undefined"!=typeof e){this._curElement=e,this._setProperty("width",e.elt.offsetWidth),this._setProperty("height",e.elt.offsetHeight);var i=this;window.onfocus=function(){i._setProperty("focused",!0)},window.onblur=function(){i._setProperty("focused",!1)},"undefined"!=typeof this._curElement.context&&this._curElement.context.setTransform(1,0,0,1,0,0)}},n}({},core,inputmouse,inputtouch),environment=function(t,e,n){"use strict";var r=e,o=n,i=[o.ARROW,o.CROSS,o.HAND,o.MOVE,o.TEXT,o.WAIT];return r.prototype._frameRate=0,r.prototype._lastFrameTime=0,r.prototype._targetFrameRate=60,r.prototype.frameCount=0,r.prototype.focused=!0,r.prototype.cursor=function(t,e,n){var r="auto",o=this._curElement.elt;if(i.indexOf(t)>-1)r=t;else if("string"==typeof t){var s="";e&&n&&"number"==typeof e&&"number"==typeof n&&(s=e+" "+n),r="http://"!==t.substring(0,6)?"url("+t+") "+s+", auto":/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(t)?"url("+t+") "+s+", auto":t}o.style.cursor=r},r.prototype.frameRate=function(t){return"undefined"==typeof t?this._frameRate:(this._setProperty("_targetFrameRate",t),this._runFrames(),this)},r.prototype.getFrameRate=function(){return this.frameRate()},r.prototype.setFrameRate=function(t){return this.frameRate(t)},r.prototype.noCursor=function(){this._curElement.elt.style.cursor="none"},r.prototype.displayWidth=screen.width,r.prototype.displayHeight=screen.height,r.prototype.windowWidth=window.innerWidth,window.addEventListener("resize",function(){this.windowWidth=window.innerWidth}),r.prototype.windowHeight=window.innerHeight,window.addEventListener("resize",function(){this.windowHeight=window.windowHeight}),r.prototype.width=0,r.prototype.height=0,r}({},core,constants),imageimage=function(t,e,n){"use strict";var r=e,n=n;return r.prototype._imageMode=n.CORNER,r.prototype._tint=null,r.prototype.createImage=function(t,e){return new r.Image(t,e)},r}({},core,constants),canvas=function(t,e){var e=e;return{modeAdjust:function(t,n,r,o,i){return i===e.CORNER?{x:t,y:n,w:r,h:o}:i===e.CORNERS?{x:t,y:n,w:r-t,h:o-n}:i===e.RADIUS?{x:t-r,y:n-o,w:2*r,h:2*o}:i===e.CENTER?{x:t-.5*r,y:n-.5*o,w:r,h:o}:void 0},arcModeAdjust:function(t,n,r,o,i){return i===e.CORNER?{x:t+.5*r,y:n+.5*o,w:r,h:o}:i===e.CORNERS?{x:t,y:n,w:r+t,h:o+n}:i===e.RADIUS?{x:t,y:n,w:2*r,h:2*o}:i===e.CENTER?{x:t,y:n,w:r,h:o}:void 0}}}({},constants),imageloading_displaying=function(t,e,n,r,o){"use strict";var i=e,s=n,r=r,o=o;return i.prototype.loadImage=function(t,e){var n=new Image,r=new i.Image(1,1,this);return n.onload=function(){r.width=r.canvas.width=n.width,r.height=r.canvas.height=n.height,r.canvas.getContext("2d").drawImage(n,0,0),"undefined"!=typeof e&&e(r)},n.crossOrigin="Anonymous",n.src=t,r},i.prototype.image=function(t,e,n,o,i){void 0===o&&(o=t.width),void 0===i&&(i=t.height);var s=r.modeAdjust(e,n,o,i,this._imageMode);this._tint?this._curElement.context.drawImage(this._getTintedImageCanvas(t),s.x,s.y,s.w,s.h):this._curElement.context.drawImage(t.canvas,s.x,s.y,s.w,s.h)},i.prototype.tint=function(){var t=this.getNormalizedColor(arguments);this._tint=t},i.prototype.noTint=function(){this._tint=null},i.prototype._getTintedImageCanvas=function(t){var e=s._toPixels(t.canvas),n=document.createElement("canvas");n.width=t.canvas.width,n.height=t.canvas.height;for(var r=n.getContext("2d"),o=r.createImageData(t.canvas.width,t.canvas.height),i=o.data,a=0;a<e.length;a+=4){var u=e[a],c=e[a+1],p=e[a+2],h=e[a+3];i[a]=u*this._tint[0]/255,i[a+1]=c*this._tint[1]/255,i[a+2]=p*this._tint[2]/255,i[a+3]=h*this._tint[3]/255}return r.putImageData(o,0,0),n},i.prototype.imageMode=function(t){(t===o.CORNER||t===o.CORNERS||t===o.CENTER)&&(this._imageMode=t)},i}({},core,filters,canvas,constants),imagepixels=function(t,e,n){"use strict";var r=e,o=n;return r.prototype.pixels=[],r.prototype.blend=function(){var t=this.canvas.getContext("2d").globalCompositeOperation,e=arguments[arguments.length-1],n=Array.prototype.slice.call(arguments,0,arguments.length-1);this.canvas.getContext("2d").globalCompositeOperation=e,this.copy.apply(this,n),this.canvas.getContext("2d").globalCompositeOperation=t},r.prototype.copy=function(){var t,e,n,r,o,i,s,a,u;if(9===arguments.length)t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3],o=arguments[4],i=arguments[5],s=arguments[6],a=arguments[7],u=arguments[8];else{if(8!==arguments.length)throw new Error("Signature not supported");e=arguments[0],n=arguments[1],r=arguments[2],o=arguments[3],i=arguments[4],s=arguments[5],a=arguments[6],u=arguments[7],t=this}this.canvas.getContext("2d").drawImage(t.canvas,e,n,r,o,i,s,a,u)},r.prototype.filter=function(t,e){o.apply(this.canvas,o[t.toLowerCase()],e)},r.prototype.get=function(t,e,n,o){if(void 0===t&&void 0===e&&void 0===n&&void 0===o?(t=0,e=0,n=this.width,o=this.height):void 0===n&&void 0===o&&(n=1,o=1),t>this.width||e>this.height||0>t||0>e)return[0,0,0,255];var i=this.canvas.getContext("2d").getImageData(t,e,n,o),s=i.data;if(1===n&&1===o){for(var a=[],u=0;u<s.length;u+=4)a.push(s[u],s[u+1],s[u+2],s[u+3]);return a}n=Math.min(n,this.width),o=Math.min(o,this.height);var c=new r.Image(n,o);return c.canvas.getContext("2d").putImageData(i,0,0,0,0,n,o),c},r.prototype.loadPixels=function(){for(var t=this.width,e=this.height,n=this.canvas.getContext("2d").getImageData(0,0,t,e).data,r=[],o=0;o<n.length;o+=4)r.push([n[o],n[o+1],n[o+2],n[o+3]]);this._setProperty("pixels",r)},r.prototype.set=function(t,e,n){var r=e*this.width+t;"number"==typeof n?(this.pixels||this.loadPixels.call(this),r<this.pixels.length&&(this.pixels[r]=[n,n,n,255],this.updatePixels.call(this))):n instanceof Array?(n.length<4&&(n[3]=255),this.pixels||this.loadPixels.call(this),r<this.pixels.length&&(this.pixels[r]=n,this.updatePixels.call(this))):(this.canvas.getContext("2d").drawImage(n.canvas,t,e),this.loadPixels.call(this))},r.prototype.updatePixels=function(t,e,n,r){void 0===t&&void 0===e&&void 0===n&&void 0===r&&(t=0,e=0,n=this.width,r=this.height);
for(var o=this.canvas.getContext("2d").getImageData(t,e,n,r),i=o.data,s=0;s<this.pixels.length;s+=1){var a=4*s;i[a]=this.pixels[s][0],i[a+1]=this.pixels[s][1],i[a+2]=this.pixels[s][2],i[a+3]=this.pixels[s][3]}this.canvas.getContext("2d").putImageData(o,t,e,0,0,n,r)},r}({},core,filters);!function(t,e,n){"undefined"!=typeof module&&module.exports?module.exports=n():"function"==typeof define&&define.amd?define("reqwest",n):e[t]=n()}("reqwest",this,function(){function handleReadyState(t,e,n){return function(){return t._aborted?n(t.request):void(t.request&&4==t.request[readyState]&&(t.request.onreadystatechange=noop,twoHundo.test(t.request.status)?e(t.request):n(t.request)))}}function setHeaders(t,e){var n,r=e.headers||{};r.Accept=r.Accept||defaultHeaders.accept[e.type]||defaultHeaders.accept["*"],e.crossOrigin||r[requestedWith]||(r[requestedWith]=defaultHeaders.requestedWith),r[contentType]||(r[contentType]=e.contentType||defaultHeaders.contentType);for(n in r)r.hasOwnProperty(n)&&"setRequestHeader"in t&&t.setRequestHeader(n,r[n])}function setCredentials(t,e){"undefined"!=typeof e.withCredentials&&"undefined"!=typeof t.withCredentials&&(t.withCredentials=!!e.withCredentials)}function generalCallback(t){lastValue=t}function urlappend(t,e){return t+(/\?/.test(t)?"&":"?")+e}function handleJsonp(t,e,n,r){var o=uniqid++,i=t.jsonpCallback||"callback",s=t.jsonpCallbackName||reqwest.getcallbackPrefix(o),a=new RegExp("((^|\\?|&)"+i+")=([^&]+)"),u=r.match(a),c=doc.createElement("script"),p=0,h=-1!==navigator.userAgent.indexOf("MSIE 10.0");return u?"?"===u[3]?r=r.replace(a,"$1="+s):s=u[3]:r=urlappend(r,i+"="+s),win[s]=generalCallback,c.type="text/javascript",c.src=r,c.async=!0,"undefined"==typeof c.onreadystatechange||h||(c.event="onclick",c.htmlFor=c.id="_reqwest_"+o),c.onload=c.onreadystatechange=function(){return c[readyState]&&"complete"!==c[readyState]&&"loaded"!==c[readyState]||p?!1:(c.onload=c.onreadystatechange=null,c.onclick&&c.onclick(),e(lastValue),lastValue=void 0,head.removeChild(c),void(p=1))},head.appendChild(c),{abort:function(){c.onload=c.onreadystatechange=null,n({},"Request is aborted: timeout",{}),lastValue=void 0,head.removeChild(c),p=1}}}function getRequest(t,e){var n,r=this.o,o=(r.method||"GET").toUpperCase(),i="string"==typeof r?r:r.url,s=r.processData!==!1&&r.data&&"string"!=typeof r.data?reqwest.toQueryString(r.data):r.data||null,a=!1;return"jsonp"!=r.type&&"GET"!=o||!s||(i=urlappend(i,s),s=null),"jsonp"==r.type?handleJsonp(r,t,e,i):(n=r.xhr&&r.xhr(r)||xhr(r),n.open(o,i,r.async===!1?!1:!0),setHeaders(n,r),setCredentials(n,r),win[xDomainRequest]&&n instanceof win[xDomainRequest]?(n.onload=t,n.onerror=e,n.onprogress=function(){},a=!0):n.onreadystatechange=handleReadyState(this,t,e),r.before&&r.before(n),a?setTimeout(function(){n.send(s)},200):n.send(s),n)}function Reqwest(t,e){this.o=t,this.fn=e,init.apply(this,arguments)}function setType(t){var e=t.match(/\.(json|jsonp|html|xml)(\?|$)/);return e?e[1]:"js"}function init(o,fn){function complete(t){for(o.timeout&&clearTimeout(self.timeout),self.timeout=null;self._completeHandlers.length>0;)self._completeHandlers.shift()(t)}function success(resp){resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(t,e,n){for(t=self.request,self._responseArgs.resp=t,self._responseArgs.msg=e,self._responseArgs.t=n,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(t,e,n);complete(t)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(t,e){return new Reqwest(t,e)}function normalize(t){return t?t.replace(/\r?\n/g,"\r\n"):""}function serial(t,e){var n,r,o,i,s=t.name,a=t.tagName.toLowerCase(),u=function(t){t&&!t.disabled&&e(s,normalize(t.attributes.value&&t.attributes.value.specified?t.value:t.text))};if(!t.disabled&&s)switch(a){case"input":/reset|button|image|file/i.test(t.type)||(n=/checkbox/i.test(t.type),r=/radio/i.test(t.type),o=t.value,(!(n||r)||t.checked)&&e(s,normalize(n&&""===o?"on":o)));break;case"textarea":e(s,normalize(t.value));break;case"select":if("select-one"===t.type.toLowerCase())u(t.selectedIndex>=0?t.options[t.selectedIndex]:null);else for(i=0;t.length&&i<t.length;i++)t.options[i].selected&&u(t.options[i])}}function eachFormElement(){var t,e,n=this,r=function(t,e){var r,o,i;for(r=0;r<e.length;r++)for(i=t[byTag](e[r]),o=0;o<i.length;o++)serial(i[o],n)};for(e=0;e<arguments.length;e++)t=arguments[e],/input|select|textarea/i.test(t.tagName)&&serial(t,n),r(t,["input","select","textarea"])}function serializeQueryString(){return reqwest.toQueryString(reqwest.serializeArray.apply(null,arguments))}function serializeHash(){var t={};return eachFormElement.apply(function(e,n){e in t?(t[e]&&!isArray(t[e])&&(t[e]=[t[e]]),t[e].push(n)):t[e]=n},arguments),t}function buildParams(t,e,n,r){var o,i,s,a=/\[\]$/;if(isArray(e))for(i=0;e&&i<e.length;i++)s=e[i],n||a.test(t)?r(t,s):buildParams(t+"["+("object"==typeof s?i:"")+"]",s,n,r);else if(e&&"[object Object]"===e.toString())for(o in e)buildParams(t+"["+o+"]",e[o],n,r);else r(t,e)}var win=window,doc=document,twoHundo=/^(20\d|1223)$/,byTag="getElementsByTagName",readyState="readyState",contentType="Content-Type",requestedWith="X-Requested-With",head=doc[byTag]("head")[0],uniqid=0,callbackPrefix="reqwest_"+ +new Date,lastValue,xmlHttpRequest="XMLHttpRequest",xDomainRequest="XDomainRequest",noop=function(){},isArray="function"==typeof Array.isArray?Array.isArray:function(t){return t instanceof Array},defaultHeaders={contentType:"application/x-www-form-urlencoded",requestedWith:xmlHttpRequest,accept:{"*":"text/javascript, text/html, application/xml, text/xml, */*",xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript",js:"application/javascript, text/javascript"}},xhr=function(t){if(t.crossOrigin===!0){var e=win[xmlHttpRequest]?new XMLHttpRequest:null;if(e&&"withCredentials"in e)return e;if(win[xDomainRequest])return new XDomainRequest;throw new Error("Browser does not support cross-origin requests")}return win[xmlHttpRequest]?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")},globalSetupOptions={dataFilter:function(t){return t}};return Reqwest.prototype={abort:function(){this._aborted=!0,this.request.abort()},retry:function(){init.call(this,this.o,this.fn)},then:function(t,e){return t=t||function(){},e=e||function(){},this._fulfilled?this._responseArgs.resp=t(this._responseArgs.resp):this._erred?e(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):(this._fulfillmentHandlers.push(t),this._errorHandlers.push(e)),this},always:function(t){return this._fulfilled||this._erred?t(this._responseArgs.resp):this._completeHandlers.push(t),this},fail:function(t){return this._erred?t(this._responseArgs.resp,this._responseArgs.msg,this._responseArgs.t):this._errorHandlers.push(t),this}},reqwest.serializeArray=function(){var t=[];return eachFormElement.apply(function(e,n){t.push({name:e,value:n})},arguments),t},reqwest.serialize=function(){if(0===arguments.length)return"";var t,e,n=Array.prototype.slice.call(arguments,0);return t=n.pop(),t&&t.nodeType&&n.push(t)&&(t=null),t&&(t=t.type),e="map"==t?serializeHash:"array"==t?reqwest.serializeArray:serializeQueryString,e.apply(null,n)},reqwest.toQueryString=function(t,e){var n,r,o=e||!1,i=[],s=encodeURIComponent,a=function(t,e){e="function"==typeof e?e():null==e?"":e,i[i.length]=s(t)+"="+s(e)};if(isArray(t))for(r=0;t&&r<t.length;r++)a(t[r].name,t[r].value);else for(n in t)t.hasOwnProperty(n)&&buildParams(n,t[n],o,a);return i.join("&").replace(/%20/g,"+")},reqwest.getcallbackPrefix=function(){return callbackPrefix},reqwest.compat=function(t,e){return t&&(t.type&&(t.method=t.type)&&delete t.type,t.dataType&&(t.type=t.dataType),t.jsonpCallback&&(t.jsonpCallbackName=t.jsonpCallback)&&delete t.jsonpCallback,t.jsonp&&(t.jsonpCallback=t.jsonp)),new Reqwest(t,e)},reqwest.ajaxSetup=function(t){t=t||{};for(var e in t)globalSetupOptions[e]=t[e]},reqwest});var inputfiles=function(t,e,n){"use strict";var r=e,n=n;return r.prototype.createInput=function(){throw"not yet implemented"},r.prototype.createReader=function(){throw"not yet implemented"},r.prototype.loadBytes=function(){throw"not yet implemented"},r.prototype.loadJSON=function(t,e){var r=[],o=-1===t.indexOf("http")?"json":"jsonp";return n({url:t,type:o,success:function(t){for(var n in t)r[n]=t[n];"undefined"!=typeof e&&e(r)}}),r},r.prototype.loadStrings=function(t,e){var n=[],r=new XMLHttpRequest;return r.open("GET",t,!0),r.onreadystatechange=function(){if(4===r.readyState&&(200===r.status||0===r.status)){var t=r.responseText.match(/[^\r\n]+/g);for(var o in t)n[o]=t[o];"undefined"!=typeof e&&e(n)}},r.send(null),n},r.prototype.loadTable=function(){throw"not yet implemented"},r.prototype.loadXML=function(t,e){var r=[];return n({url:t,type:"xml",success:function(t){r[0]=t,"undefined"!=typeof e&&e(r)}}),r},r.prototype.parseXML=function(){throw"not yet implemented"},r.prototype.saveTable=function(){throw"not yet implemented"},r.prototype.selectFolder=function(){throw"not yet implemented"},r.prototype.selectInput=function(){throw"not yet implemented"},r}({},core,reqwest),inputkeyboard=function(t,e){"use strict";var n=e;return n.prototype.isKeyPressed=!1,n.prototype.keyIsPressed=!1,n.prototype.key="",n.prototype.keyCode=0,n.prototype.onkeydown=function(t){this._setProperty("isKeyPressed",!0),this._setProperty("keyIsPressed",!0),this._setProperty("keyCode",t.which);var e=String.fromCharCode(t.which);e||(e=t.which),this._setProperty("key",e);var n=this.keyPressed||window.keyPressed;"function"!=typeof n||t.charCode||n(t)},n.prototype.onkeyup=function(t){var e=this.keyReleased||window.keyReleased;this._setProperty("isKeyPressed",!1),this._setProperty("keyIsPressed",!1),"function"==typeof e&&e(t)},n.prototype.onkeypress=function(t){this._setProperty("keyCode",t.which),this._setProperty("key",String.fromCharCode(t.which));var e=this.keyTyped||window.keyTyped;"function"==typeof e&&e(t)},n}({},core),inputtime_date=function(t,e){"use strict";var n=e;return n.prototype.day=function(){return(new Date).getDate()},n.prototype.hour=function(){return(new Date).getHours()},n.prototype.minute=function(){return(new Date).getMinutes()},n.prototype.millis=function(){return(new Date).getTime()-this._startTime},n.prototype.month=function(){return(new Date).getMonth()+1},n.prototype.second=function(){return(new Date).getSeconds()},n.prototype.year=function(){return(new Date).getFullYear()},n}({},core),mathmath=function(t,e){"use strict";var n=e;return n.prototype.createVector=function(){return new n.Vector(this,arguments)},n}({},core),mathcalculation=function(t,e){"use strict";var n=e;return n.prototype.abs=Math.abs,n.prototype.ceil=Math.ceil,n.prototype.constrain=function(t,e,n){return this.max(this.min(t,n),e)},n.prototype.dist=function(t,e,n,r){var o=n-t,i=r-e;return Math.sqrt(o*o+i*i)},n.prototype.exp=Math.exp,n.prototype.floor=Math.floor,n.prototype.lerp=function(t,e,n){return n*(e-t)+t},n.prototype.log=Math.log,n.prototype.mag=function(t,e){return Math.sqrt(t*t+e*e)},n.prototype.map=function(t,e,n,r,o){return(t-e)/(n-e)*(o-r)+r},n.prototype.max=function(){return arguments[0]instanceof Array?Math.max.apply(null,arguments[0]):Math.max.apply(null,arguments)},n.prototype.min=function(){return arguments[0]instanceof Array?Math.min.apply(null,arguments[0]):Math.min.apply(null,arguments)},n.prototype.norm=function(t,e,n){return this.map(t,e,n,0,1)},n.prototype.pow=Math.pow,n.prototype.round=Math.round,n.prototype.sq=function(t){return t*t},n.prototype.sqrt=Math.sqrt,n}({},core),mathrandom=function(t,e){"use strict";var n=e,r=!1,o=function(){var t,e,n=4294967296,r=1664525,o=1013904223;return{setSeed:function(r){e=t=r||Math.round(Math.random()*n)},getSeed:function(){return t},rand:function(){return e=(r*e+o)%n,e/n}}}();n.prototype.randomSeed=function(t){o.setSeed(t),r=!0},n.prototype.random=function(t,e){var n;if(n=r?o.rand():Math.random(),0===arguments.length)return n;if(1===arguments.length)return n*t;if(t>e){var i=t;t=e,e=i}return n*(e-t)+t};var i,s=!1;return n.prototype.randomGaussian=function(t,e){var n,r,o,a;if(s)n=i,s=!1;else{do r=this.random(2)-1,o=this.random(2)-1,a=r*r+o*o;while(a>=1);a=Math.sqrt(-2*Math.log(a)/a),n=r*a,i=o*a,s=!0}var u=t||0,c=e||1;return n*c+u},n}({},core),mathnoise=function(t,e){"use strict";for(var n=e,r=4,o=1<<r,i=8,s=1<<i,a=4095,u=4,c=.5,p=.5,h=Math.floor(360/p),l=new Array(h),d=new Array(h),f=Math.PI/180,m=0;h>m;m++)l[m]=Math.sin(m*f*p),d[m]=Math.cos(m*f*p);var y=h;y>>=1;var g;return n.prototype.noise=function(t,e,n){if(e=e||0,n=n||0,null==g){g=new Array(a+1);for(var p=0;a+1>p;p++)g[p]=Math.random()}0>t&&(t=-t),0>e&&(e=-e),0>n&&(n=-n);for(var l,f,m,_,v,x=Math.floor(t),w=Math.floor(e),E=Math.floor(n),R=t-x,M=e-w,b=n-E,C=0,A=.5,S=function(t){return.5*(1-d[Math.floor(t*y)%h])},P=0;u>P;P++){var T=x+(w<<r)+(E<<i);l=S(R),f=S(M),m=g[T&a],m+=l*(g[T+1&a]-m),_=g[T+o&a],_+=l*(g[T+o+1&a]-_),m+=f*(_-m),T+=s,_=g[T&a],_+=l*(g[T+1&a]-_),v=g[T+o&a],v+=l*(g[T+o+1&a]-v),_+=f*(v-_),m+=S(b)*(_-m),C+=m*A,A*=c,x<<=1,R*=2,w<<=1,M*=2,E<<=1,b*=2,R>=1&&(x++,R--),M>=1&&(w++,M--),b>=1&&(E++,b--)}return C},n.prototype.noiseDetail=function(t,e){t>0&&(u=t),e>0&&(c=e)},n.prototype.noiseSeed=function(t){var e=function(){var t,e,n=4294967296,r=1664525,o=1013904223;return{setSeed:function(r){e=t=r||Math.round(Math.random()*n)},getSeed:function(){return t},rand:function(){return e=(r*e+o)%n,e/n}}}();e.setSeed(t),g=new Array(a+1);for(var n=0;a+1>n;n++)g[n]=e.rand()},n}({},core),mathtrigonometry=function(t,e,n,r){"use strict";var o=e,i=n,r=r;return o.prototype._angleMode=r.RADIANS,o.prototype.acos=function(t){return this._angleMode===r.RADIANS?Math.acos(t):i.radiansToDegrees(Math.acos(t))},o.prototype.asin=function(t){return this._angleMode===r.RADIANS?Math.asin(t):i.radiansToDegrees(Math.asin(t))},o.prototype.atan=function(t){return this._angleMode===r.RADIANS?Math.atan(t):i.radiansToDegrees(Math.atan(t))},o.prototype.atan2=function(t,e){return this._angleMode===r.RADIANS?Math.atan2(t,e):i.radiansToDegrees(Math.atan2(t,e))},o.prototype.cos=function(t){return Math.cos(this._angleMode===r.RADIANS?t:this.radians(t))},o.prototype.sin=function(t){return Math.sin(this._angleMode===r.RADIANS?t:this.radians(t))},o.prototype.tan=function(t){return Math.tan(this._angleMode===r.RADIANS?t:this.radians(t))},o.prototype.degrees=function(t){return i.radiansToDegrees(t)},o.prototype.radians=function(t){return i.degreesToRadians(t)},o.prototype.angleMode=function(t){(t===r.DEGREES||t===r.RADIANS)&&(this._angleMode=t)},o}({},core,polargeometry,constants),outputfiles=function(t,e){"use strict";var n=e;return n.prototype.pWriters=[],n.prototype.beginRaw=function(){throw"not yet implemented"},n.prototype.beginRecord=function(){throw"not yet implemented"},n.prototype.createOutput=function(){throw"not yet implemented"},n.prototype.createWriter=function(t){-1===this.pWriters.indexOf(t)&&(this.pWriters.name=new this.PrintWriter(t))},n.prototype.endRaw=function(){throw"not yet implemented"},n.prototype.endRecord=function(){throw"not yet implemented"},n.prototype.escape=function(t){return t},n.prototype.PrintWriter=function(t){this.name=t,this.content="",this.print=function(t){this.content+=t},this.println=function(t){this.content+=t+"\n"},this.flush=function(){this.content=""},this.close=function(){this.writeFile(this.content)}},n.prototype.saveBytes=function(){throw"not yet implemented"},n.prototype.saveJSONArray=function(){throw"not yet implemented"},n.prototype.saveJSONObject=function(){throw"not yet implemented"},n.prototype.saveStream=function(){throw"not yet implemented"},n.prototype.saveStrings=function(t){this.writeFile(t.join("\n"))},n.prototype.saveXML=function(){throw"not yet implemented"},n.prototype.selectOutput=function(){throw"not yet implemented"},n.prototype.writeFile=function(t){this.open("data:text/json;charset=utf-8,"+this.escape(t),"download")},n}({},core),outputimage=function(t,e){"use strict";var n=e;return n.prototype.save=function(){window.open(this._curElement.elt.toDataURL("image/png"))},n}({},core),outputtext_area=function(t,e){"use strict";var n=e;return n.prototype.print=window.console&&console.log?console.log.bind(console):function(){},n.prototype.println=n.prototype.print,n}({},core),shape2d_primitives=function(t,e,n,r){"use strict";var o=e,n=n,r=r;return o.prototype.arc=function(t,e,o,i,s,a,u){var c=n.arcModeAdjust(t,e,o,i,this._ellipseMode),p=c.h>c.w?c.h/2:c.w/2,h=c.h>c.w?c.w/c.h:1,l=c.h>c.w?1:c.h/c.w;return this._curElement.context.scale(h,l),this._curElement.context.beginPath(),this._curElement.context.arc(c.x,c.y,p,s,a),this._curElement.context.stroke(),u===r.CHORD||u===r.OPEN?this._curElement.context.closePath():(u===r.PIE||void 0===u)&&(this._curElement.context.lineTo(c.x,c.y),this._curElement.context.closePath()),this._curElement.context.fill(),u!==r.OPEN&&void 0!==u&&this._curElement.context.stroke(),this},o.prototype.ellipse=function(t,e,r,o){var i=n.modeAdjust(t,e,r,o,this._ellipseMode),s=.5522848,a=i.w/2*s,u=i.h/2*s,c=i.x+i.w,p=i.y+i.h,h=i.x+i.w/2,l=i.y+i.h/2;return this._curElement.context.beginPath(),this._curElement.context.moveTo(i.x,l),this._curElement.context.bezierCurveTo(i.x,l-u,h-a,i.y,h,i.y),this._curElement.context.bezierCurveTo(h+a,i.y,c,l-u,c,l),this._curElement.context.bezierCurveTo(c,l+u,h+a,p,h,p),this._curElement.context.bezierCurveTo(h-a,p,i.x,l+u,i.x,l),this._curElement.context.closePath(),this._curElement.context.fill(),this._curElement.context.stroke(),this},o.prototype.line=function(t,e,n,r){return"rgba(0,0,0,0)"!==this._curElement.context.strokeStyle?(this._curElement.context.beginPath(),this._curElement.context.moveTo(t,e),this._curElement.context.lineTo(n,r),this._curElement.context.stroke(),this):void 0},o.prototype.point=function(t,e){var n=this._curElement.context.strokeStyle,o=this._curElement.context.fillStyle;return"rgba(0,0,0,0)"!==n?(t=Math.round(t),e=Math.round(e),this._curElement.context.fillStyle=n,this._curElement.context.lineWidth>1?(this._curElement.context.beginPath(),this._curElement.context.arc(t,e,this._curElement.context.lineWidth/2,0,r.TWO_PI,!1),this._curElement.context.fill()):this._curElement.context.fillRect(t,e,1,1),this._curElement.context.fillStyle=o,this):void 0},o.prototype.quad=function(t,e,n,r,o,i,s,a){return this._curElement.context.beginPath(),this._curElement.context.moveTo(t,e),this._curElement.context.lineTo(n,r),this._curElement.context.lineTo(o,i),this._curElement.context.lineTo(s,a),this._curElement.context.closePath(),this._curElement.context.fill(),this._curElement.context.stroke(),this},o.prototype.rect=function(t,e,r,o){var i=n.modeAdjust(t,e,r,o,this._rectMode);return this._curElement.context.beginPath(),this._curElement.context.rect(i.x,i.y,i.w,i.h),this._curElement.context.fill(),this._curElement.context.stroke(),this},o.prototype.triangle=function(t,e,n,r,o,i){return this._curElement.context.beginPath(),this._curElement.context.moveTo(t,e),this._curElement.context.lineTo(n,r),this._curElement.context.lineTo(o,i),this._curElement.context.closePath(),this._curElement.context.fill(),this._curElement.context.stroke(),this},o}({},core,canvas,constants),shapeattributes=function(t,e,n){"use strict";var r=e,n=n;return r.prototype._rectMode=n.CORNER,r.prototype._ellipseMode=n.CENTER,r.prototype.ellipseMode=function(t){return(t===n.CORNER||t===n.CORNERS||t===n.RADIUS||t===n.CENTER)&&(this._ellipseMode=t),this},r.prototype.noSmooth=function(){return this._curElement.context.mozImageSmoothingEnabled=!1,this._curElement.context.webkitImageSmoothingEnabled=!1,this},r.prototype.rectMode=function(t){return(t===n.CORNER||t===n.CORNERS||t===n.RADIUS||t===n.CENTER)&&(this._rectMode=t),this},r.prototype.smooth=function(){return this._curElement.context.mozImageSmoothingEnabled=!0,this._curElement.context.webkitImageSmoothingEnabled=!0,this},r.prototype.strokeCap=function(t){return(t===n.ROUND||t===n.SQUARE||t===n.PROJECT)&&(this._curElement.context.lineCap=t),this},r.prototype.strokeJoin=function(t){return(t===n.ROUND||t===n.BEVEL||t===n.MITER)&&(this._curElement.context.lineJoin=t),this},r.prototype.strokeWeight=function(t){return this._curElement.context.lineWidth="undefined"==typeof t||0===t?1e-4:t,this},r}({},core,constants),shapecurves=function(t,e){"use strict";var n=e;return n.prototype._bezierDetail=20,n.prototype._curveDetail=20,n.prototype.bezier=function(t,e,r,o,i,s,a,u){this._curElement.context.beginPath(),this._curElement.context.moveTo(t,e);for(var c=0;c<=this._bezierDetail;c++){var p=c/parseFloat(this._bezierDetail),h=n.prototype.bezierPoint(t,r,i,a,p),l=n.prototype.bezierPoint(e,o,s,u,p);this._curElement.context.lineTo(h,l)}return this._curElement.context.stroke(),this},n.prototype.bezierDetail=function(t){return this._setProperty("_bezierDetail",t),this},n.prototype.bezierPoint=function(t,e,n,r,o){var i=1-o;return Math.pow(i,3)*t+3*Math.pow(i,2)*o*e+3*i*Math.pow(o,2)*n+Math.pow(o,3)*r},n.prototype.bezierTangent=function(t,e,n,r,o){var i=1-o;return 3*r*Math.pow(o,2)-3*n*Math.pow(o,2)+6*n*i*o-6*e*i*o+3*e*Math.pow(i,2)-3*t*Math.pow(i,2)},n.prototype.curve=function(t,e,r,o,i,s,a,u){this._curElement.context.moveTo(t,e),this._curElement.context.beginPath();for(var c=0;c<=this._curveDetail;c++){var p=parseFloat(c/this._curveDetail),h=n.prototype.curvePoint(t,r,i,a,p),l=n.prototype.curvePoint(e,o,s,u,p);this._curElement.context.lineTo(h,l)}return this._curElement.context.stroke(),this._curElement.context.closePath(),this},n.prototype.curveDetail=function(t){return this._setProperty("_curveDetail",t),this},n.prototype.curvePoint=function(t,e,n,r,o){var i=o*o*o,s=o*o,a=-.5*i+s-.5*o,u=1.5*i-2.5*s+1,c=-1.5*i+2*s+.5*o,p=.5*i-.5*s;return t*a+e*u+n*c+r*p},n.prototype.curveTangent=function(t,e,n,r,o){var i=o*o,s=-3*i/2+2*o-.5,a=9*i/2-5*o,u=-9*i/2+4*o+.5,c=3*i/2-o;return t*s+e*a+n*u+r*c},n.prototype.curveTightness=function(){throw"not yet implemented"},n}({},core),shapevertex=function(t,e,n){"use strict";var r=e,n=n;return r.prototype._shapeKind=null,r.prototype._shapeInited=!1,r.prototype._contourInited=!1,r.prototype._contourVertices=[],r.prototype._curveVertices=[],r.prototype.beginContour=function(){return this._contourVertices=[],this._contourInited=!0,this},r.prototype.beginShape=function(t){return this._shapeKind=t===n.POINTS||t===n.LINES||t===n.TRIANGLES||t===n.TRIANGLE_FAN||t===n.TRIANGLE_STRIP||t===n.QUADS||t===n.QUAD_STRIP?t:null,this._shapeInited=!0,this._curElement.context.beginPath(),this},r.prototype.bezierVertex=function(t,e,r,o,i,s){if(this._contourInited){var a={};return a.x=t,a.y=e,a.x3=r,a.y3=o,a.x4=i,a.y4=s,a.type=n.BEZIER,this._contourVertices.push(a),this}return this._curElement.context.bezierCurveTo(t,e,r,o,i,s),this},r.prototype.curveVertex=function(t,e){var n={};return n.x=t,n.y=e,this._curveVertices.push(n),this._curveVertices.length>=4&&(this.curve(this._curveVertices[0].x,this._curveVertices[0].y,this._curveVertices[1].x,this._curveVertices[1].y,this._curveVertices[2].x,this._curveVertices[2].y,this._curveVertices[3].x,this._curveVertices[3].y),this._curveVertices.shift()),this},r.prototype.endContour=function(){this._contourVertices.reverse(),this._curElement.context.moveTo(this._contourVertices[0].x,this._contourVertices[0].y);var t=this._curElement.context;return this._contourVertices.slice(1).forEach(function(e){switch(e.type){case n.LINEAR:t.lineTo(e.x,e.y);break;case n.QUADRATIC:t.quadraticCurveTo(e.x,e.y,e.x3,e.y3);break;case n.BEZIER:t.bezierCurveTo(e.x,e.y,e.x3,e.y3,e.x4,e.y4);break;case n.CURVE:}}),this._curElement.context.closePath(),this._contourInited=!1,this},r.prototype.endShape=function(t){return t===n.CLOSE&&(this._curElement.context.closePath(),this._curElement.context.fill()),this._curveVertices.length<=0?this._curElement.context.stroke():this._curveVertices=[],this},r.prototype.quadraticVertex=function(t,e,r,o){if(this._contourInited){var i={};return i.x=t,i.y=e,i.x3=r,i.y3=o,i.type=n.QUADRATIC,this._contourVertices.push(i),this}return this._curElement.context.quadraticCurveTo(t,e,r,o),this},r.prototype.vertex=function(t,e){if(this._contourInited){var r={};return r.x=t,r.y=e,r.type=n.LINEAR,this._contourVertices.push(r),this}return this._shapeInited?this._curElement.context.moveTo(t,e):this._curElement.context.lineTo(t,e),this._shapeInited=!1,this},r}({},core,constants),structure=function(t,e){"use strict";var n=e;return n.prototype.exit=function(){throw"Not implemented"},n.prototype.noLoop=function(){this._loop=!1},n.prototype.loop=function(){this._loop=!0},n.prototype.pushStyle=function(){this.styles.push({fillStyle:this._curElement.context.fillStyle,strokeStyle:this._curElement.context.strokeStyle,lineWidth:this._curElement.context.lineWidth,lineCap:this._curElement.context.lineCap,lineJoin:this._curElement.context.lineJoin,tint:this._tint,imageMode:this._imageMode,rectMode:this._rectMode,ellipseMode:this._ellipseMode,colorMode:this._colorMode,textAlign:this._curElement.context.textAlign,textFont:this.textFont,textLeading:this.textLeading,textSize:this.textSize,textStyle:this.textStyle})},n.prototype.popStyle=function(){var t=this.styles.pop();this._curElement.context.fillStyle=t.fillStyle,this._curElement.context.strokeStyle=t.strokeStyle,this._curElement.context.lineWidth=t.lineWidth,this._curElement.context.lineCap=t.lineCap,this._curElement.context.lineJoin=t.lineJoin,this._tint=t.tint,this._imageMode=t.imageMode,this._rectMode=t._rectMode,this._ellipseMode=t.ellipseMode,this._colorMode=t._colorMode,this._curElement.context.textAlign=t.textAlign,this.textFont=t.textFont,this.textLeading=t.textLeading,this.textSize=t.textSize,this.textStyle=t.textStyle},n.prototype.redraw=function(){var t=this._isGlobal?window:this;t.draw&&t.draw()},n.prototype.size=function(){throw"Not implemented"},n}({},core),transform=function(t,e,n){"use strict";function r(t,e){for(var n=[],r=t.length,o=e.length,i=t[0].length,s=0;o>s;s++){n[s]=[];for(var a=0;i>a;a++){for(var u=0,c=0;r>c;c++)u+=t[c][a]*e[s][c];n[s].push(u)}}return n}var o=e,n=n;return o.prototype._matrices=[[1,0,0,1,0,0]],o.prototype.applyMatrix=function(t,e,n,o,i,s){this._curElement.context.transform(t,e,n,o,i,s);var a=this._matrices[this._matrices.length-1];return a=r(a,[t,e,n,o,i,s]),this},o.prototype.popMatrix=function(){return this._curElement.context.restore(),this._matrices.pop(),this},o.prototype.printMatrix=function(){return this},o.prototype.pushMatrix=function(){return this._curElement.context.save(),this._matrices.push([1,0,0,1,0,0]),this},o.prototype.resetMatrix=function(){return this._curElement.context.setTransform(),this._matrices[this._matrices.length-1]=[1,0,0,1,0,0],this},o.prototype.rotate=function(t){this._angleMode===n.DEGREES&&(t=this.radians(t)),this._curElement.context.rotate(t);var e=this._matrices[this._matrices.length-1],r=Math.cos(t),o=Math.sin(t),i=e[0]*r+e[2]*o,s=e[1]*r+e[3]*o,a=e[0]*-o+e[2]*r,u=e[1]*-o+e[3]*r;return e[0]=i,e[1]=s,e[2]=a,e[3]=u,this},o.prototype.rotateX=function(){throw"not yet implemented"},o.prototype.rotateY=function(){throw"not yet implemented"},o.prototype.scale=function(){var t=1,e=1;1===arguments.length?t=e=arguments[0]:(t=arguments[0],e=arguments[1]),this._curElement.context.scale(t,e);var n=this._matrices[this._matrices.length-1];return n[0]*=t,n[1]*=t,n[2]*=e,n[3]*=e,this},o.prototype.shearX=function(t){this._angleMode===n.DEGREES&&(t=this.radians(t)),this._curElement.context.transform(1,0,this.tan(t),1,0,0);var e=this._matrices[this._matrices.length-1];return e=r(e,[1,0,this.tan(t),1,0,0]),this},o.prototype.shearY=function(t){this._angleMode===n.DEGREES&&(t=this.radians(t)),this._curElement.context.transform(1,this.tan(t),0,1,0,0);var e=this._matrices[this._matrices.length-1];return e=r(e,[1,this.tan(t),0,1,0,0]),this},o.prototype.translate=function(t,e){this._curElement.context.translate(t,e);var n=this._matrices[this._matrices.length-1];return n[4]+=n[0]*t+n[2]*e,n[5]+=n[1]*t+n[3]*e,this},o}({},core,constants,outputtext_area),typographyattributes=function(t,e,n){"use strict";var r=e,n=n;return r.prototype._textLeading=15,r.prototype._textFont="sans-serif",r.prototype._textSize=12,r.prototype._textStyle=n.NORMAL,r.prototype.textAlign=function(t){(t===n.LEFT||t===n.RIGHT||t===n.CENTER)&&(this._curElement.context.textAlign=t)},r.prototype.textHeight=function(t){return this._curElement.context.measureText(t).height},r.prototype.textLeading=function(t){this._setProperty("_textLeading",t)},r.prototype.textSize=function(t){this._setProperty("_textSize",t)},r.prototype.textStyle=function(t){(t===n.NORMAL||t===n.ITALIC||t===n.BOLD)&&this._setProperty("_textStyle",t)},r.prototype.textWidth=function(t){return this._curElement.context.measureText(t).width},r}({},core,constants),typographyloading_displaying=function(t,e,n){"use strict";var r=e,n=n;return r.prototype.text=function(){if(this._curElement.context.font=this._textStyle+" "+this._textSize+"px "+this._textFont,3===arguments.length)this._curElement.context.fillText(arguments[0],arguments[1],arguments[2]),this._curElement.context.strokeText(arguments[0],arguments[1],arguments[2]);else if(5===arguments.length){var t=arguments[0].split(" "),e="",r=n.modeAdjust(arguments[1],arguments[2],arguments[3],arguments[4],this._rectMode);r.y+=this._textLeading;for(var o=0;o<t.length;o++){var i=e+t[o]+" ",s=this._curElement.context.measureText(i),a=s.width;if(r.y>r.h)break;a>r.w&&o>0?(this._curElement.context.fillText(e,r.x,r.y),this._curElement.context.strokeText(e,r.x,r.y),e=t[o]+" ",r.y+=this._textLeading):e=i}r.y<=r.h&&(this._curElement.context.fillText(e,r.x,r.y),this._curElement.context.strokeText(e,r.x,r.y))}},r.prototype.textFont=function(t){this._setProperty("_textFont",t)},r}({},core,canvas),src_app=function(t,e){"use strict";var n=e,r=function(){window.PHANTOMJS||(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&new n};return"complete"===document.readyState?r():window.addEventListener("load",r,!1),window.p5=n,n}({},core,p5Element,p5Image,p5Vector,colorcreating_reading,colorsetting,constants,dataarray_functions,datastring_functions,domdom,environment,imageimage,imageloading_displaying,imagepixels,inputfiles,inputkeyboard,inputmouse,inputtime_date,inputtouch,mathmath,mathcalculation,mathrandom,mathnoise,mathtrigonometry,outputfiles,outputimage,outputtext_area,shape2d_primitives,shapeattributes,shapecurves,shapevertex,structure,transform,typographyattributes,typographyloading_displaying)}();