diff --git a/ajax/libs/processing.js/1.2.3/processing-api.min.js b/ajax/libs/processing.js/1.2.3/processing-api.min.js new file mode 100644 index 000000000..ee67b749f --- /dev/null +++ b/ajax/libs/processing.js/1.2.3/processing-api.min.js @@ -0,0 +1,349 @@ +/*** + + P R O C E S S I N G . J S - 1.2.3-API + a port of the Processing visualization language + + Processing.js is licensed under the MIT License, see LICENSE. + For a list of copyright holders, please refer to AUTHORS. + + http://processingjs.org + +***/ + +(function(S,E,j,q){function za(d,j){if(d in S)return S[d];return typeof S[j]==="function"?S[j]:function(d){if(d instanceof Array)return d;else if(typeof d==="number"){var j=[];j.length=d;return j}}}function ac(d){if(d.constructor===String){for(var L=0,G=0;G0;)q(z.shift())}var bc=function(){},Ka=function(){return"console"in +S?function(d){S.console.log("Processing.js: "+d)}:void 0}(),cc=function(d){var j=new XMLHttpRequest;j.open("GET",d,!1);j.overrideMimeType&&j.overrideMimeType("text/plain");j.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");j.send(null);if(j.status!==200&&j.status!==0)throw"XMLHttpRequest failed, status code "+j.status;return j.responseText},ua="document"in this&&!("fake"in this.document),P=za("Float32Array","WebGLFloatArray"),sd=za("Int32Array","WebGLIntArray"),td=za("Uint16Array", +"WebGLUnsignedShortArray"),Fc=za("Uint8Array","WebGLUnsignedByteArray"),d={X:0,Y:1,Z:2,R:3,G:4,B:5,A:6,U:7,V:8,NX:9,NY:10,NZ:11,EDGE:12,SR:13,SG:14,SB:15,SA:16,SW:17,TX:18,TY:19,TZ:20,VX:21,VY:22,VZ:23,VW:24,AR:25,AG:26,AB:27,DR:3,DG:4,DB:5,DA:6,SPR:28,SPG:29,SPB:30,SHINE:31,ER:32,EG:33,EB:34,BEEN_LIT:35,VERTEX_FIELD_COUNT:36,P2D:1,JAVA2D:1,WEBGL:2,P3D:2,OPENGL:2,PDF:0,DXF:0,OTHER:0,WINDOWS:1,MAXOSX:2,LINUX:3,EPSILON:1.0E-4,MAX_FLOAT:3.4028235E38,MIN_FLOAT:-3.4028235E38,MAX_INT:2147483647,MIN_INT:-2147483648, +PI:j.PI,TWO_PI:2*j.PI,HALF_PI:j.PI/2,THIRD_PI:j.PI/3,QUARTER_PI:j.PI/4,DEG_TO_RAD:j.PI/180,RAD_TO_DEG:180/j.PI,WHITESPACE:" \t\n\r\u000c\u00a0",RGB:1,ARGB:2,HSB:3,ALPHA:4,CMYK:5,TIFF:0,TARGA:1,JPEG:2,GIF:3,BLUR:11,GRAY:12,INVERT:13,OPAQUE:14,POSTERIZE:15,THRESHOLD:16,ERODE:17,DILATE:18,REPLACE:0,BLEND:1,ADD:2,SUBTRACT:4,LIGHTEST:8,DARKEST:16,DIFFERENCE:32,EXCLUSION:64,MULTIPLY:128,SCREEN:256,OVERLAY:512,HARD_LIGHT:1024,SOFT_LIGHT:2048,DODGE:4096,BURN:8192,ALPHA_MASK:4278190080,RED_MASK:16711680,GREEN_MASK:65280, +BLUE_MASK:255,CUSTOM:0,ORTHOGRAPHIC:2,PERSPECTIVE:3,POINT:2,POINTS:2,LINE:4,LINES:4,TRIANGLE:8,TRIANGLES:9,TRIANGLE_STRIP:10,TRIANGLE_FAN:11,QUAD:16,QUADS:16,QUAD_STRIP:17,POLYGON:20,PATH:21,RECT:30,ELLIPSE:31,ARC:32,SPHERE:40,BOX:41,GROUP:0,PRIMITIVE:1,GEOMETRY:3,VERTEX:0,BEZIER_VERTEX:1,CURVE_VERTEX:2,BREAK:3,CLOSESHAPE:4,OPEN:1,CLOSE:2,CORNER:0,CORNERS:1,RADIUS:2,CENTER_RADIUS:2,CENTER:3,DIAMETER:3,CENTER_DIAMETER:3,BASELINE:0,TOP:101,BOTTOM:102,NORMAL:1,NORMALIZED:1,IMAGE:2,MODEL:4,SHAPE:5,SQUARE:"butt", +ROUND:"round",PROJECT:"square",MITER:"miter",BEVEL:"bevel",AMBIENT:0,DIRECTIONAL:1,SPOT:3,BACKSPACE:8,TAB:9,ENTER:10,RETURN:13,ESC:27,DELETE:127,CODED:65535,SHIFT:16,CONTROL:17,ALT:18,CAPSLK:20,PGUP:33,PGDN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLK:144,META:157,INSERT:155,ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",NOCURSOR:"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto", +DISABLE_OPENGL_2X_SMOOTH:1,ENABLE_OPENGL_2X_SMOOTH:-1,ENABLE_OPENGL_4X_SMOOTH:2,ENABLE_NATIVE_FONTS:3,DISABLE_DEPTH_TEST:4,ENABLE_DEPTH_TEST:-4,ENABLE_DEPTH_SORT:5,DISABLE_DEPTH_SORT:-5,DISABLE_OPENGL_ERROR_REPORT:6,ENABLE_OPENGL_ERROR_REPORT:-6,ENABLE_ACCURATE_TEXTURES:7,DISABLE_ACCURATE_TEXTURES:-7,HINT_COUNT:10,SINCOS_LENGTH:parseInt(720,10),PRECISIONB:15,PRECISIONF:32768,PREC_MAXVAL:32767,PREC_ALPHA_SHIFT:9,PREC_RED_SHIFT:1,NORMAL_MODE_AUTO:0,NORMAL_MODE_SHAPE:1,NORMAL_MODE_VERTEX:2,MAX_LIGHTS:8}, +Aa=function(d){if(d.iterator instanceof Function)return d.iterator();else if(d instanceof Array){var j=-1;this.hasNext=function(){return++j0&&typeof arguments[0]!=="number"?q=arguments[0].toArray():(q=[],q.length= +0|arguments[0]);this.get=function(d){return q[d]};this.contains=function(d){return this.indexOf(d)>-1};this.indexOf=function(d){for(var j=0,p=q.length;j=0&&d<=q.length)q.splice(d,0,arguments[1]);else throw d+" is not a valid index";else throw typeof d+" is not a number";}else throw"Please use the proper number of parameters."; +};this.addAll=function(d,j){var p;if(typeof d==="number"){if(d<0||d>q.length)throw"Index out of bounds for addAll: "+d+" greater or equal than "+q.length;for(p=new Aa(j);p.hasNext();)q.splice(d++,0,p.next())}else for(p=new Aa(d);p.hasNext();)q.push(p.next())};this.set=function(){if(arguments.length===2){var d=arguments[0];if(typeof d==="number")if(d>=0&&d-1)return q.splice(d,1),!0;return!1}};this.isEmpty=function(){return!q.length};this.clone=function(){return new j(this)};this.toArray=function(){return q.slice(0)};this.iterator=function(){return new d(q)}}return j}(),ec=function(){function d(){function j(d){d=ac(d)%J.length;return d<0?J.length+d:d}function G(){if(!(E<=N*J.length)){for(var d= +[],p=0;p=J.length)G=!0;else if(J[t]===q||L>=J[t].length)L=-1,++t;else break}var t=0,L=-1,G=!1;this.hasNext=function(){return!G};this.next=function(){var j=d(J[t][L]);p();return j};this.remove=function(){j(this.next());--L};p()}function u(d,j,p){this.clear=function(){O.clear()};this.contains=function(d){return j(d)}; +this.containsAll=function(d){for(d=d.iterator();d.hasNext();)if(!this.contains(d.next()))return!1;return!0};this.isEmpty=function(){return O.isEmpty()};this.iterator=function(){return new z(d,p)};this.remove=function(d){if(this.contains(d))return p(d),!0;return!1};this.removeAll=function(d){for(d=d.iterator();d.hasNext();){var j=d.next();this.contains(j)&&p(j)}return!0};this.retainAll=function(d){for(var j=this.iterator(),q=[];j.hasNext();){var t=j.next();d.contains(t)||q.push(t)}for(d=0;d0};this.size=function(){return O.size()};this.toArray=function(){for(var d=[],j=this.iterator();j.hasNext();)d.push(j.next());return d}}function t(d){this._isIn=function(j){return j===O&&d.removed===q};this.equals=function(j){return ia(d.key,j.getKey())};this.getKey=function(){return d.key};this.getValue=function(){return d.value};this.hashCode=function(){return ac(d.key)};this.setValue=function(j){var p=d.value;d.value=j;return p}}if(arguments.length===1&&arguments[0].constructor=== +d)return arguments[0].clone();var A=arguments.length>0?arguments[0]:16,N=arguments.length>1?arguments[1]:0.75,J=[];J.length=A;var E=0,O=this;this.clear=function(){E=0;J=[];J.length=A};this.clone=function(){var j=new d;j.putAll(this);return j};this.containsKey=function(d){var p=j(d),p=J[p];if(p===q)return!1;for(var t=0;t1?t.splice(G,1):J[p]=q,d;return null};this.size= +function(){return E};this.values=function(){for(var d=[],j=this.entrySet().iterator();j.hasNext();){var p=j.next();d.push(p.getValue())}return d}}return d}(),aa=function(){function d(j,p,q){this.x=j||0;this.y=p||0;this.z=q||0}function q(d){return function(j,p){var q=j.get();q[d](p);return q}}function G(d){return function(j,p){return j[d](p)}}var z="dist dot cross".split(" "),u=z.length;d.angleBetween=function(d,p){return j.acos(d.dot(p)/(d.mag()*p.mag()))};for(d.prototype={set:function(d,j,p){arguments.length=== +1?this.set(d.x||d[0]||0,d.y||d[1]||0,d.z||d[2]||0):(this.x=d,this.y=j,this.z=p)},get:function(){return new d(this.x,this.y,this.z)},mag:function(){return j.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},add:function(d,j,p){arguments.length===3?(this.x+=d,this.y+=j,this.z+=p):arguments.length===1&&(this.x+=d.x,this.y+=d.y,this.z+=d.z)},sub:function(d,j,p){arguments.length===3?(this.x-=d,this.y-=j,this.z-=p):arguments.length===1&&(this.x-=d.x,this.y-=d.y,this.z-=d.z)},mult:function(d){typeof d=== +"number"?(this.x*=d,this.y*=d,this.z*=d):typeof d==="object"&&(this.x*=d.x,this.y*=d.y,this.z*=d.z)},div:function(d){typeof d==="number"?(this.x/=d,this.y/=d,this.z/=d):typeof d==="object"&&(this.x/=d.x,this.y/=d.y,this.z/=d.z)},dist:function(d){var p=this.x-d.x,q=this.y-d.y,d=this.z-d.z;return j.sqrt(p*p+q*q+d*d)},dot:function(d,j,p){if(arguments.length===3)return this.x*d+this.y*j+this.z*p;else if(arguments.length===1)return this.x*d.x+this.y*d.y+this.z*d.z},cross:function(j){return new d(this.y* +j.z-j.y*this.z,this.z*j.x-j.z*this.x,this.x*j.y-j.x*this.y)},normalize:function(){var d=this.mag();d>0&&this.div(d)},limit:function(d){this.mag()>d&&(this.normalize(),this.mult(d))},heading2D:function(){return-j.atan2(-this.y,this.x)},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};u--;)d[z[u]]=G(z[u]);for(u in d.prototype)d.prototype.hasOwnProperty(u)&&!d.hasOwnProperty(u)&&(d[u]=q(u));return d}();xb.prototype=d;var W=new xb;W.ArrayList= +dc;W.HashMap=ec;W.PVector=aa;W.ObjectIterator=Aa;W.defineProperty=function(d,j,q){"defineProperty"in Object?Object.defineProperty(d,j,q):(q.hasOwnProperty("get")&&d.__defineGetter__(j,q.get),q.hasOwnProperty("set")&&d.__defineSetter__(j,q.set))};W.extendClassChain=function(d){for(var j=[d],q=d.$upcast;q;q=q.$upcast)Sa(q,d),j.push(q),d=q;for(;j.length>0;)j.pop().$self=d};W.extendStaticMembers=function(d,j){Sa(d,j)};W.extendInterfaceMembers=function(d,j){Sa(d,j)};W.addMethod=function(d,j,q){if(d[j]){var z= +q.length,u=d[j];d[j]=function(){return arguments.length===z?q.apply(this,arguments):u.apply(this,arguments)}}else d[j]=q};W.createJavaArray=function(d,j){var q=null;if(typeof j[0]==="number"){var z=0|j[0];if(j.length<=1){q=[];q.length=z;for(var u=0;u255?255:l)<<24&d.ALPHA_MASK|(a>255?255:a)<<16&d.RED_MASK|(b>255?255:b)<<8&d.GREEN_MASK|(f>255?255:f)&d.BLUE_MASK}function hb(){h.restore();Ma=Ib=!0}function O(a,b,f){a.addEventListener?a.addEventListener(b, +f,!1):a.attachEvent("on"+b,f);ib.push({elem:a,type:b,fn:f})}function ia(a){var b=a.elem,f=a.type,a=a.fn;b.removeEventListener?b.removeEventListener(f,a,!1):b.detachEvent&&b.detachEvent("on"+f,a)}function Gc(a,b){var f=1;f<<=b-1;for(var c="",e=0;e>>=1;return c}function za(a,b,f,c,e,d){b=a<0?f:b;f=e===0;e=e===q||e<0?0:e;a=j.abs(a);if(f){e=1;for(a*=10;j.abs(j.round(a)-a)>1.0E-6&&e<7;)++e,a*=10}else e!==0&&(a*=j.pow(10,e));f=a*2;j.floor(a)===a?f=a:j.floor(f)===f?(a=j.floor(a), +f=a+a%2):f=j.round(a);a="";for(c+=e;c>0||f>0;)c--,a=""+f%10+a,f=j.floor(f/10);if(d!==q)for(c=a.length-3-e;c>0;)a=a.substring(0,c)+d+a.substring(c),c-=3;return e>0?b+a.substring(0,a.length-e)+"."+a.substring(a.length-e,a.length):b+a}function Fb(a,b,f,c,e,d){if(a instanceof Array){for(var i=[],k=0,m=a.length;k2147483647&&(a-=4294967296);return a}function Ba(a){return Array.prototype.slice.call(a, +1)}function Hc(a){if(typeof a==="number")return a!==0;else if(typeof a==="boolean")return a;else if(typeof a==="string")return a.toLowerCase()==="true";else if(a instanceof ka)return a.code===49||a.code===84||a.code===116}function Ic(a){if(typeof a==="number")return a;else if(typeof a==="boolean")return a?1:0;else if(typeof a==="string")return parseFloat(a);else if(a instanceof ka)return a.code}function Jc(a,b){if(typeof a==="number")return a&4294967295;else if(typeof a==="boolean")return a?1:0;else if(typeof a=== +"string")return parseInt(a,b||10)&4294967295;else if(a instanceof ka)return a.code}function Z(a,b){var f=a||362436069,c=b||521288629,e=function(){f=36969*(f&65535)+(f>>>16)&4294967295;c=18E3*(c&65535)+(c>>>16)&4294967295;return((f&65535)<<16|c&65535)&4294967295};this.nextDouble=function(){var a=e()/4294967296;return a<0?1+a:a};this.nextInt=e}function ua(a){function b(a,b,f,c){a&=15;var l=a<8?b:f,b=a<4?f:a===12||a===14?b:c;return((a&1)===0?l:-l)+((a&2)===0?b:-b)}function f(a,b,f){b=(a&1)===0?b:f;return(a& +2)===0?-b:b}function c(a,b,f){return b+a*(f-b)}var a=a!==q?new Z(a):Z.createRandomized(),e,d,i=new Fc(512);for(e=0;e<256;++e)i[e]=e;for(e=0;e<256;++e){var k=i[d=a.nextInt()&255];i[d]=i[e];i[e]=k}for(e=0;e<256;++e)i[e+256]=i[e];this.noise3d=function(a,f,e){var d=j.floor(a)&255,g=j.floor(f)&255,k=j.floor(e)&255;a-=j.floor(a);f-=j.floor(f);e-=j.floor(e);var h=(3-2*a)*a*a,o=(3-2*f)*f*f,r=i[d]+g,q=i[r]+k,r=i[r+1]+k,g=i[d+1]+g,d=i[g]+k,k=i[g+1]+k;return c((3-2*e)*e*e,c(o,c(h,b(i[q],a,f,e),b(i[d],a-1,f, +e)),c(h,b(i[r],a,f-1,e),b(i[k],a-1,f-1,e))),c(o,c(h,b(i[q+1],a,f,e-1),b(i[d+1],a-1,f,e-1)),c(h,b(i[r+1],a,f-1,e-1),b(i[k+1],a-1,f-1,e-1))))};this.noise2d=function(a,b){var e=j.floor(a)&255,d=j.floor(b)&255;a-=j.floor(a);b-=j.floor(b);var g=(3-2*a)*a*a,k=i[e]+d,e=i[e+1]+d;return c((3-2*b)*b*b,c(g,f(i[k],a,b),f(i[e],a-1,b)),c(g,f(i[k+1],a,b-1),f(i[e+1],a-1,b-1)))};this.noise1d=function(a){var b=j.floor(a)&255;a-=j.floor(a);return c((3-2*a)*a*a,(i[b]&1)===0?-a:a,(i[b+1]&1)===0?-(a-1):a-1)}}function X(){if(R){if(Ma)h.fillStyle= +c.color.toString(Na),Ma=!1;h.fill()}}function V(){if(I){if(Ib)h.strokeStyle=c.color.toString(ba),Ib=!1;h.stroke()}}function ud(a,b,f){f=0|f*((b&d.ALPHA_MASK)>>>24);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.mix(a&d.RED_MASK,b&d.RED_MASK,f)&d.RED_MASK|c.mix(a&d.GREEN_MASK,b&d.GREEN_MASK,f)&d.GREEN_MASK|c.mix(a&d.BLUE_MASK,b&d.BLUE_MASK,f)}function qa(a,b,f){var c=Kc.shift();if(c===q)c={},c.canvas=E.createElement("canvas"),c.context=c.canvas.getContext("2d");Kc.push(c);var e=c.canvas,d=c.context, +b=b||a.width,f=f||a.height;e.width=b;e.height=f;a?"data"in a?d.putImageData(a,0,0):(d.clearRect(0,0,b,f),d.drawImage(a,0,0,b,f)):d.clearRect(0,0,b,f);return c}function Da(){yb&&(h=Lc,yb=!1,c.updatePixels())}function vd(){function a(a,b){a[b]=function(){Da();h[b].apply(h,arguments)}}function b(a,b){c.defineProperty(a,b,{get:function(){Da();return h[b]},set:function(a){Da();h[b]=a}})}for(var f in h)typeof h[f]==="function"?a(this,f):b(this,f)}function Za(a){this.name="sans-serif";if(a!==q)switch(a){case "sans-serif":case "serif":case "monospace":case "fantasy":case "cursive":this.name= +a;break;default:this.name='"'+a+'", sans-serif'}this.origName=a}function Oa(a){return a instanceof String?a:typeof a==="number"?a===(0|a)?a.toString():c.nf(a,0,3):a===null||a===q?"":a.toString()}function Mc(a,b,f,c){this.canvas=E.createElement("canvas");this.canvas.setAttribute("width",b+"px");this.canvas.setAttribute("height",b+"px");this.ctx=this.canvas.getContext("2d");this.ctx.font=b+"pt "+a;this.ctx.fillStyle="black";this.ctx.fillRect(0,0,b,b);this.ctx.fillStyle="white";this.ctx.fillText(c,0, +f);this.imageData=this.ctx.getImageData(0,0,b,b);this.get=function(a,b){return this.imageData.data[b*this.imageData.width*4+a*4]}}function Nc(a,b,f,c){var e;a.indexOf("\n")<0?(a=[a],e=1):(a=a.split(/\r?\n/g),e=a.length);var g;g=jb===d.TOP?(1-Jb)*Ua:jb===d.CENTER?(1-Jb-e/2)*Ua:jb===d.BOTTOM?(1-Jb-e)*Ua:0;for(var i=0;ie)){var i=-1,k=0,m=0,j=0;h.font=M+"px "+Y.name;for(var o=[],q=0,n=a.length;q0)i=q;else return;p==="\n"?(o.push({text:a.substring(k,q),width:m,offset:j}),k=q+1):(o.push({text:a.substring(k,i),width:m,offset:j}),k=i+1);j+=Ua;m=0;q=k-1}}ke)break; +$.text$line(j.text,b+a,f+j.offset+c+i,g,kb)}}}function lb(a){$=a==="3D"?new B:a==="2D"?new v:new y;for(var b in y.prototype)y.prototype.hasOwnProperty(b)&&b.indexOf("$")<0&&(c[b]=$[b]);$.$init()}function C(a){return function(){lb("2D");return $[a].apply(this,arguments)}}function Sa(a){var b=a,f=0,l=0;c.pmouseX=c.mouseX;c.pmouseY=c.mouseY;if(b.offsetParent){do f+=b.offsetLeft,l+=b.offsetTop;while(b=b.offsetParent)}b=a;do f-=b.scrollLeft||0,l-=b.scrollTop||0;while(b=b.parentNode);f+=Pc;l+=Qc;f+=Rc; +l+=Sc;f+=S.pageXOffset;l+=S.pageYOffset;return{X:f,Y:l}}function Kb(a,b){var f=Sa(a,b);c.mouseX=b.pageX-f.X;c.mouseY=b.pageY-f.Y}function Lb(a){var b=Sa(a.changedTouches[0].target,a.changedTouches[0]),f;for(f=0;f cos( light.angle ) ) { spotAttenuation = pow( spotDot, light.concentration ); } else{ spotAttenuation = 0.0; } attenuation *= spotAttenuation;")+" float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0 ) { powerfactor = 0.0; } else { powerfactor = pow( nDotHV, shininess ); } spec += specular * powerfactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0, 0.0, 0.0 ); vec3 finalDiffuse = vec3( 0.0, 0.0, 0.0 ); vec3 finalSpecular = vec3( 0.0, 0.0, 0.0 ); vec4 col = color; if(color[0] == -1.0){ col = aColor; } vec3 norm = normalize(vec3( normalTransform * vec4( Normal, 0.0 ) )); vec4 ecPos4 = view * model * vec4(Vertex,1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( lightCount == 0 ) { frontColor = col + vec4(mat_specular,1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= lightCount ){ break; } if( l.type == 0 ) { AmbientLight( finalAmbient, ecPos, l ); } else if( l.type == 1 ) { DirectionalLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else if( l.type == 2 ) { PointLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else { SpotLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } } if( usingMat == false ) { frontColor = vec4( vec3(col) * finalAmbient + vec3(col) * finalDiffuse + vec3(col) * finalSpecular, col[3] ); } else{ frontColor = vec4( mat_emissive + (vec3(col) * mat_ambient * finalAmbient) + (vec3(col) * finalDiffuse) + (mat_specular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = projection * view * model * vec4( Vertex, 1.0 );}", +jd=function(a,b,f,c){return{x:a,y:b,w:f,h:c}},Xb=jd,Cd=function(a,b,f,c,e){return{x:a,y:b,w:e?f:f-a,h:e?c:c-b}},Dd=function(a,b,f,c){return{x:a-f/2,y:b-c/2,w:f,h:c}},Dc=function(a,b,f){var c=a.createShader(a.VERTEX_SHADER);a.shaderSource(c,b);a.compileShader(c);if(!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);b=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(b,f);a.compileShader(b);if(!a.getShaderParameter(b,a.COMPILE_STATUS))throw a.getShaderInfoLog(b);f=a.createProgram(); +a.attachShader(f,c);a.attachShader(f,b);a.linkProgram(f);if(!a.getProgramParameter(f,a.LINK_STATUS))throw"Error linking shaders.";return f},F=function(){},v=function(){},B=function(){},y=function(){};v.prototype=new F;v.prototype.constructor=v;B.prototype=new F;B.prototype.constructor=B;y.prototype=new F;y.prototype.constructor=y;F.prototype.a3DOnlyFunction=function(){};var Ec={},ka=c.Character=function(a){this.code=typeof a==="string"&&a.length===1?a.charCodeAt(0):typeof a==="number"?a:a instanceof +ka?a:NaN;return Ec[this.code]===q?Ec[this.code]=this:Ec[this.code]};ka.prototype.toString=function(){return String.fromCharCode(this.code)};ka.prototype.valueOf=function(){return this.code};var Db=c.PShape=function(a){this.family=a||d.GROUP;this.style=this.visible=!0;this.children=[];this.nameTable=[];this.params=[];this.name="";this.parent=this.height=this.width=this.close=this.kind=this.matrix=this.image=null};Db.prototype={isVisible:function(){return this.visible},setVisible:function(a){this.visible= +a},disableStyle:function(){this.style=!1;for(var a=0,b=this.children.length;a0){b=0;for(f=this.nameTable.length;b, it's <"+this.element.getName()+">";}else if(arguments.length===2)if(typeof arguments[1]==="string"){if(arguments[1].indexOf(".svg")>-1)this.element=new c.XMLElement(null,arguments[1]),this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=d.ALPHA_MASK,this.strokeWeight=1,this.strokeCap=d.SQUARE,this.strokeJoin=d.MITER,this.strokeName= +this.strokeGradientPaint=this.strokeGradient="",this.strokeOpacity=1,this.fill=!0,this.fillColor=d.ALPHA_MASK,this.fillGradientPaint=this.fillGradient=null,this.fillOpacity=1}else if(arguments[0])this.element=arguments[1],this.vertexCodes=arguments[0].vertexCodes.slice(),this.vertices=arguments[0].vertices.slice(),this.stroke=arguments[0].stroke,this.strokeColor=arguments[0].strokeColor,this.strokeWeight=arguments[0].strokeWeight,this.strokeCap=arguments[0].strokeCap,this.strokeJoin=arguments[0].strokeJoin, +this.strokeGradient=arguments[0].strokeGradient,this.strokeGradientPaint=arguments[0].strokeGradientPaint,this.strokeName=arguments[0].strokeName,this.fill=arguments[0].fill,this.fillColor=arguments[0].fillColor,this.fillGradient=arguments[0].fillGradient,this.fillGradientPaint=arguments[0].fillGradientPaint,this.fillName=arguments[0].fillName,this.strokeOpacity=arguments[0].strokeOpacity,this.fillOpacity=arguments[0].fillOpacity,this.opacity=arguments[0].opacity;this.name=this.element.getStringAttribute("id"); +this.visible=this.element.getStringAttribute("display","inline")!=="none";var a=this.element.getAttribute("transform");if(a)this.matrix=this.parseMatrix(a);a=this.element.getStringAttribute("viewBox");if(a!==null)a=a.split(" "),this.width=a[2],this.height=a[3];var a=this.element.getStringAttribute("width"),b=this.element.getStringAttribute("height");if(a!==null)this.width=this.parseUnitSize(a),this.height=this.parseUnitSize(b);else if(this.width===0||this.height===0)throw this.height=this.width=1, +"The width and/or height is not readable in the tag of this file.";this.parseColors(this.element);this.parseChildren(this.element)};K.prototype=new Db;K.prototype.parseMatrix=function(){function a(a){var f=[];a.replace(/\((.*?)\)/,function(){return function(a,b){f=b.replace(/,+/g," ").split(/\s+/)}}());return f}return function(b){this.checkMatrix(2);var f=[];b.replace(/\s*(\w+)\((.*?)\)/g,function(a){f.push(c.trim(a))});if(f.length===0)return null;for(var b=0,l=f.length;b=65&&j<=90||j>=97&&j<=122){r=h;h++;if(h=65&&j<=90||j>=97&&j<=100||j>=102&&j<=122)&&q===!1;)j===32?o!==""&& +(n.push(parseFloat(o)),o=""):j===45?a[h-1].valueOf()===101?o+=a[h].toString():(o!==""&&n.push(parseFloat(o)),o=a[h].toString()):o+=a[h].toString(),h++,h===a.length?q=!0:j=a[h].valueOf()}o!==""&&(n.push(parseFloat(o)),o="");s=a[r];j=s.valueOf();if(j===77){if(n.length>=2&&n.length%2===0&&(b=n[0],f=n[1],this.parsePathMoveto(b,f),n.length>2)){r=2;for(j=n.length;r=2&&n.length%2===0&&(b+=n[0],f+=n[1],this.parsePathMoveto(b, +f),n.length>2)){r=2;for(j=n.length;r=2&&n.length%2===0){r=0;for(j=n.length;r=2&&n.length%2===0){r=0;for(j=n.length;r=6&&n.length%6===0){r=0;for(j=n.length;r=6&&n.length%6===0){r=0;for(j=n.length;r=4&&n.length%4===0){r=0;for(j=n.length;r=4&& +n.length%4===0){r=0;for(j=n.length;r=4&&n.length%4=== +0){r=0;for(j=n.length;r=4&&n.length%4===0){r=0;for(j=n.length;r=2&&n.length%2===0){r=0;for(j=n.length;r=2&&n.length%2===0){r=0;for(j=n.length;r0)this.parsePathCode(d.BEZIER_VERTEX),this.parsePathVertex(a+(f-a)*2/3,b+(c-b)*2/3),this.parsePathVertex(e+(f-e)*2/3,g+(c-g)*2/3),this.parsePathVertex(e,g);else throw"Path must start with M/m";};K.prototype.parsePathCurveto=function(a,b,f,c,e,g){if(this.vertices.length>0)this.parsePathCode(d.BEZIER_VERTEX),this.parsePathVertex(a,b),this.parsePathVertex(f, +c),this.parsePathVertex(e,g);else throw"Path must start with M/m";};K.prototype.parsePathLineto=function(a,b){if(this.vertices.length>0)this.parsePathCode(d.VERTEX),this.parsePathVertex(a,b),this.vertices[this.vertices.length-1].moveTo=!1;else throw"Path must start with M/m";};K.prototype.parsePathMoveto=function(a,b){this.vertices.length>0&&this.parsePathCode(d.BREAK);this.parsePathCode(d.VERTEX);this.parsePathVertex(a,b);this.vertices[this.vertices.length-1].moveTo=!0};K.prototype.parsePathVertex= +function(a,b){var f=[];f[0]=a;f[1]=b;this.vertices.push(f)};K.prototype.parsePathCode=function(a){this.vertexCodes.push(a)};K.prototype.parsePoly=function(a){this.family=d.PATH;this.close=a;a=c.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(a!==null)if(a=a.split(" "),a.length%2===0)for(var b=0,f=a.length;b";};K.prototype.parseEllipse=function(a){this.kind=d.ELLIPSE;this.family=d.PRIMITIVE;this.params=[];this.params[0]=this.element.getFloatAttribute("cx")| +0;this.params[1]=this.element.getFloatAttribute("cy")|0;var b;if(a){if(a=b=this.element.getFloatAttribute("r"),a<0)throw"svg error: negative radius found while parsing ";}else if(a=this.element.getFloatAttribute("rx"),b=this.element.getFloatAttribute("ry"),a<0||b<0)throw"svg error: negative x-axis radius or y-axis radius found while parsing ";this.params[0]-=a;this.params[1]-=b;this.params[2]=a*2;this.params[3]=b*2};K.prototype.parseLine=function(){this.kind=d.LINE;this.family=d.PRIMITIVE; +this.params=[];this.params[0]=this.element.getFloatAttribute("x1");this.params[1]=this.element.getFloatAttribute("y1");this.params[2]=this.element.getFloatAttribute("x2");this.params[3]=this.element.getFloatAttribute("y2")};K.prototype.parseColors=function(a){a.hasAttribute("opacity")&&this.setOpacity(a.getAttribute("opacity"));a.hasAttribute("stroke")&&this.setStroke(a.getAttribute("stroke"));a.hasAttribute("stroke-width")&&this.setStrokeWeight(a.getAttribute("stroke-width"));a.hasAttribute("stroke-linejoin")&& +this.setStrokeJoin(a.getAttribute("stroke-linejoin"));a.hasAttribute("stroke-linecap")&&this.setStrokeCap(a.getStringAttribute("stroke-linecap"));a.hasAttribute("fill")&&this.setFill(a.getStringAttribute("fill"));if(a.hasAttribute("style"))for(var a=a.getStringAttribute("style").toString().split(";"),b=0,f=a.length;b=1&&arguments[0]!==null&&a.isVisible()&&(c.pushMatrix(),Cb===d.CENTER?arguments.length===5?(c.translate(b-l/2,f-e/2),c.scale(l/a.getWidth(),e/a.getHeight())):arguments.length===3?c.translate(b-a.getWidth()/2,-a.getHeight()/2):c.translate(-a.getWidth()/2,-a.getHeight()/2):Cb===d.CORNER?arguments.length===5?(c.translate(b,f),c.scale(l/a.getWidth(),e/a.getHeight())):arguments.length===3&&c.translate(b,f):Cb===d.CORNERS&&(arguments.length===5?(l-=b,e-=f,c.translate(b, +f),c.scale(l/a.getWidth(),e/a.getHeight())):arguments.length===3&&c.translate(b,f)),a.draw(),(arguments.length===1&&Cb===d.CENTER||arguments.length>1)&&c.popMatrix())};c.shapeMode=function(a){Cb=a};c.loadShape=function(a){if(arguments.length===1&&a.indexOf(".svg")>-1)return new K(null,a);return null};var Yb=function(a,b,f,c,e){this.fullName=a||"";this.name=b||"";this.namespace=f||"";this.value=c;this.type=e};Yb.prototype={getName:function(){return this.name},getFullName:function(){return this.fullName}, +getNamespace:function(){return this.namespace},getValue:function(){return this.value},getType:function(){return this.type},setValue:function(a){this.value=a}};var Ya=c.XMLElement=function(){this.attributes=[];this.children=[];this.name=this.fullName=null;this.namespace="";this.parent=this.content=null;this.systemID=this.lineNr="";this.type="ELEMENT";if(arguments.length===4){this.fullName=arguments[0]||"";if(arguments[1])this.name=arguments[1];else{var a=this.fullName.indexOf(":");this.name=a>=0?this.fullName.substring(a+ +1):this.fullName}this.namespace=arguments[1];this.lineNr=arguments[3];this.systemID=arguments[2]}else arguments.length===2&&arguments[1].indexOf(".")>-1?this.parse(arguments[arguments.length-1]):arguments.length===1&&typeof arguments[0]==="string"&&this.parse(arguments[0])};Ya.prototype={parse:function(a){var b;try{if(a.indexOf(".xml")>-1||a.indexOf(".svg")>-1)a=cc(a);b=(new DOMParser).parseFromString(a,"text/xml");var f=b.documentElement;if(f)this.parseChildrenRecursive(null,f);else throw"Error loading document"; +return this}catch(c){throw c;}},parseChildrenRecursive:function(a,b){var f,c,e,d;a?(f=new Ya(b.localName,b.nodeName,"",""),f.parent=a):(this.fullName=b.localName,this.name=b.nodeName,f=this);if(b.nodeType===3&&b.textContent!=="")return this.createPCDataElement(b.textContent);e=0;for(d=b.attributes.length;e0){b=0;for(f=this.children.length;b +0},addChild:function(a){if(a!==null)a.parent=this,this.children.push(a)},insertChild:function(a,b){if(a){if(a.getLocalName()===null&&!this.hasChildren()){var f=this.children[this.children.length-1];if(f.getLocalName()===null){f.setContent(f.getContent()+a.getContent());return}}a.parent=this;this.children.splice(b,0,a)}},getChild:function(a){if(typeof a==="number")return this.children[a];else if(a.indexOf("/")!==-1)this.getChildRecursive(a.split("/"),0);else{for(var b,f,c=0,e=this.getChildCount();c< +e;c++)if(b=this.getChild(c),f=b.getName(),f!==null&&f===a)return b;return null}},getChildren:function(){if(arguments.length===1)if(typeof arguments[0]==="number")return this.getChild(arguments[0]);else if(arguments[0].indexOf("/")!==-1)return this.getChildrenRecursive(arguments[0].split("/"),0);else{for(var a=[],b,f,c=0,e=this.getChildCount();ca&&this.children.splice(a,1)},findAttribute:function(a, +b){this.namespace=b||"";for(var f=0,c=this.attributes.length;f0&&A.debug("Tried to set content for XMLElement with children");this.content=a},setName:function(){if(arguments.length===1)this.name=arguments[0],this.fullName=arguments[0],this.namespace=null;else{var a= +arguments[0].indexOf(":");this.name=arguments[1]===null||a<0?arguments[0]:arguments[0].substring(a+1);this.fullName=arguments[0];this.namespace=arguments[1]}},getName:function(){return this.fullName},getLocalName:function(){return this.name},getAttributeCount:function(){return this.attributes.length},toString:function(){if(this.type==="TEXT")return this.content;var a=(this.namespace!==""&&this.namespace!==this.name?this.namespace+":":"")+this.name,b="<"+a,f;for(f=0;f":">"+this.content+"";else{b+=">";for(f=0;f"}return b}};Ya.parse=function(a){var b=new Ya;b.parse(a);return b};var kd=function(a){for(var b=0,f=0;fd.MIN_INT){var b=this.elements[0],f=this.elements[1],c=this.elements[2],e=this.elements[3],g=this.elements[4],i=this.elements[5];this.elements[0]=g/a;this.elements[3]=-e/a;this.elements[1]=-f/a;this.elements[4]=b/a;this.elements[2]=(f*i-g*c)/a;this.elements[5]=(e*c-b*i)/a;return!0}return!1}, +scale:function(a,b){a&&!b&&(b=a);a&&b&&(this.elements[0]*=a,this.elements[1]*=b,this.elements[3]*=a,this.elements[4]*=b)},invScale:function(a,b){a&&!b&&(b=a);this.scale(1/a,1/b)},apply:function(){var a;arguments.length===1&&arguments[0]instanceof Pa?a=arguments[0].array():arguments.length===6?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,this.elements[2],0,0,this.elements[5]],f=0,c=0;c<2;c++)for(var e=0;e<3;e++,f++)b[f]+= +this.elements[c*3+0]*a[e+0]+this.elements[c*3+1]*a[e+3];this.elements=b.slice()},preApply:function(){var a;arguments.length===1&&arguments[0]instanceof Pa?a=arguments[0].array():arguments.length===6?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);var b=[0,0,a[2],0,0,a[5]];b[2]=a[2]+this.elements[2]*a[0]+this.elements[5]*a[1];b[5]=a[5]+this.elements[2]*a[3]+this.elements[5]*a[4];b[0]=this.elements[0]*a[0]+this.elements[3]*a[1];b[3]=this.elements[0]* +a[3]+this.elements[3]*a[4];b[1]=this.elements[1]*a[0]+this.elements[4]*a[1];b[4]=this.elements[1]*a[3]+this.elements[4]*a[4];this.elements=b.slice()},rotate:function(a){var b=j.cos(a),a=j.sin(a),f=this.elements[0],c=this.elements[1];this.elements[0]=b*f+a*c;this.elements[1]=-a*f+b*c;f=this.elements[3];c=this.elements[4];this.elements[3]=b*f+a*c;this.elements[4]=-a*f+b*c},rotateZ:function(a){this.rotate(a)},invRotateZ:function(a){this.rotateZ(a-j.PI)},print:function(){var a=kd(this.elements),a=""+ +c.nfs(this.elements[0],a,4)+" "+c.nfs(this.elements[1],a,4)+" "+c.nfs(this.elements[2],a,4)+"\n"+c.nfs(this.elements[3],a,4)+" "+c.nfs(this.elements[4],a,4)+" "+c.nfs(this.elements[5],a,4)+"\n\n";c.println(a)}};var w=c.PMatrix3D=function(){this.reset()};w.prototype={set:function(){if(arguments.length===16)this.elements=Array.prototype.slice.call(arguments);else if(arguments.length===1&&arguments[0]instanceof w)this.elements=arguments[0].array();else if(arguments.length===1&&arguments[0]instanceof +Array)this.elements=arguments[0].slice()},get:function(){var a=new w;a.set(this.elements);return a},reset:function(){this.set([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},array:function(){return this.elements.slice()},translate:function(a,b,f){f===q&&(f=0);this.elements[3]+=a*this.elements[0]+b*this.elements[1]+f*this.elements[2];this.elements[7]+=a*this.elements[4]+b*this.elements[5]+f*this.elements[6];this.elements[11]+=a*this.elements[8]+b*this.elements[9]+f*this.elements[10];this.elements[15]+=a*this.elements[12]+ +b*this.elements[13]+f*this.elements[14]},transpose:function(){var a=this.elements.slice();this.elements[0]=a[0];this.elements[1]=a[4];this.elements[2]=a[8];this.elements[3]=a[12];this.elements[4]=a[1];this.elements[5]=a[5];this.elements[6]=a[9];this.elements[7]=a[13];this.elements[8]=a[2];this.elements[9]=a[6];this.elements[10]=a[10];this.elements[11]=a[14];this.elements[12]=a[3];this.elements[13]=a[7];this.elements[14]=a[11];this.elements[15]=a[15]},mult:function(a,b){var f,c,e,d;if(a instanceof +aa)f=a.x,c=a.y,e=a.z,d=1,b||(b=new aa);else if(a instanceof Array&&(f=a[0],c=a[1],e=a[2],d=a[3]||1,!b||b.length!==3&&b.length!==4))b=[0,0,0];b instanceof Array&&(b.length===3?(b[0]=this.elements[0]*f+this.elements[1]*c+this.elements[2]*e+this.elements[3],b[1]=this.elements[4]*f+this.elements[5]*c+this.elements[6]*e+this.elements[7],b[2]=this.elements[8]*f+this.elements[9]*c+this.elements[10]*e+this.elements[11]):b.length===4&&(b[0]=this.elements[0]*f+this.elements[1]*c+this.elements[2]*e+this.elements[3]* +d,b[1]=this.elements[4]*f+this.elements[5]*c+this.elements[6]*e+this.elements[7]*d,b[2]=this.elements[8]*f+this.elements[9]*c+this.elements[10]*e+this.elements[11]*d,b[3]=this.elements[12]*f+this.elements[13]*c+this.elements[14]*e+this.elements[15]*d));if(b instanceof aa)b.x=this.elements[0]*f+this.elements[1]*c+this.elements[2]*e+this.elements[3],b.y=this.elements[4]*f+this.elements[5]*c+this.elements[6]*e+this.elements[7],b.z=this.elements[8]*f+this.elements[9]*c+this.elements[10]*e+this.elements[11]; +return b},preApply:function(){var a;arguments.length===1&&arguments[0]instanceof w?a=arguments[0].array():arguments.length===16?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,c=0;c<4;c++)for(var e=0;e<4;e++,f++)b[f]+=this.elements[e+0]*a[c*4+0]+this.elements[e+4]*a[c*4+1]+this.elements[e+8]*a[c*4+2]+this.elements[e+12]*a[c*4+3];this.elements=b.slice()},apply:function(){var a;arguments.length=== +1&&arguments[0]instanceof w?a=arguments[0].array():arguments.length===16?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,c=0;c<4;c++)for(var e=0;e<4;e++,f++)b[f]+=this.elements[c*4+0]*a[e+0]+this.elements[c*4+1]*a[e+4]+this.elements[c*4+2]*a[e+8]+this.elements[c*4+3]*a[e+12];this.elements=b.slice()},rotate:function(a,b,f,d){if(f){var e=c.cos(a),a=c.sin(a),g=1-e;this.apply(g*b*b+e,g*b*f-a*d, +g*b*d+a*f,0,g*b*f+a*d,g*f*f+e,g*f*d-a*b,0,g*b*d-a*f,g*f*d+a*b,g*d*d+e,0,0,0,0,1)}else this.rotateZ(a)},invApply:function(){Bb===q&&(Bb=new w);var a=arguments;Bb.set(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]);if(!Bb.invert())return!1;this.preApply(Bb);return!0},rotateX:function(a){var b=c.cos(a),a=c.sin(a);this.apply([1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1])},rotateY:function(a){var b=c.cos(a),a=c.sin(a);this.apply([b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1])},rotateZ:function(a){var b= +j.cos(a),a=j.sin(a);this.apply([b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1])},scale:function(a,b,f){a&&!b&&!f?b=f=a:a&&b&&!f&&(f=1);a&&b&&f&&(this.elements[0]*=a,this.elements[1]*=b,this.elements[2]*=f,this.elements[4]*=a,this.elements[5]*=b,this.elements[6]*=f,this.elements[8]*=a,this.elements[9]*=b,this.elements[10]*=f,this.elements[12]*=a,this.elements[13]*=b,this.elements[14]*=f)},skewX:function(a){this.apply(1,j.tan(a),0,0,0,1,0,0,0,0,1,0,0,0,0,1)},skewY:function(a){this.apply(1,0,0,0,j.tan(a),1,0,0,0, +0,1,0,0,0,0,1)},multX:function(a,b,f,c){return f?c?this.elements[0]*a+this.elements[1]*b+this.elements[2]*f+this.elements[3]*c:this.elements[0]*a+this.elements[1]*b+this.elements[2]*f+this.elements[3]:this.elements[0]*a+this.elements[1]*b+this.elements[3]},multY:function(a,b,f,c){return f?c?this.elements[4]*a+this.elements[5]*b+this.elements[6]*f+this.elements[7]*c:this.elements[4]*a+this.elements[5]*b+this.elements[6]*f+this.elements[7]:this.elements[4]*a+this.elements[5]*b+this.elements[7]},multZ:function(a, +b,f,c){return c?this.elements[8]*a+this.elements[9]*b+this.elements[10]*f+this.elements[11]*c:this.elements[8]*a+this.elements[9]*b+this.elements[10]*f+this.elements[11]},multW:function(a,b,f,c){return c?this.elements[12]*a+this.elements[13]*b+this.elements[14]*f+this.elements[15]*c:this.elements[12]*a+this.elements[13]*b+this.elements[14]*f+this.elements[15]},invert:function(){var a=this.elements[0]*this.elements[5]-this.elements[1]*this.elements[4],b=this.elements[0]*this.elements[6]-this.elements[2]* +this.elements[4],f=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4],c=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5],e=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5],d=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6],i=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12],k=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12],m=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12], +h=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13],o=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13],q=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14],n=a*q-b*o+f*h+c*m-e*k+d*i;if(j.abs(n)<=1.0E-9)return!1;var p=[];p[0]=+this.elements[5]*q-this.elements[6]*o+this.elements[7]*h;p[4]=-this.elements[4]*q+this.elements[6]*m-this.elements[7]*k;p[8]=+this.elements[4]*o-this.elements[5]*m+this.elements[7]*i;p[12]=-this.elements[4]*h+this.elements[5]* +k-this.elements[6]*i;p[1]=-this.elements[1]*q+this.elements[2]*o-this.elements[3]*h;p[5]=+this.elements[0]*q-this.elements[2]*m+this.elements[3]*k;p[9]=-this.elements[0]*o+this.elements[1]*m-this.elements[3]*i;p[13]=+this.elements[0]*h-this.elements[1]*k+this.elements[2]*i;p[2]=+this.elements[13]*d-this.elements[14]*e+this.elements[15]*c;p[6]=-this.elements[12]*d+this.elements[14]*f-this.elements[15]*b;p[10]=+this.elements[12]*e-this.elements[13]*f+this.elements[15]*a;p[14]=-this.elements[12]*c+this.elements[13]* +b-this.elements[14]*a;p[3]=-this.elements[9]*d+this.elements[10]*e-this.elements[11]*c;p[7]=+this.elements[8]*d-this.elements[10]*f+this.elements[11]*b;p[11]=-this.elements[8]*e+this.elements[9]*f-this.elements[11]*a;p[15]=+this.elements[8]*c-this.elements[9]*b+this.elements[10]*a;a=1/n;p[0]*=a;p[1]*=a;p[2]*=a;p[3]*=a;p[4]*=a;p[5]*=a;p[6]*=a;p[7]*=a;p[8]*=a;p[9]*=a;p[10]*=a;p[11]*=a;p[12]*=a;p[13]*=a;p[14]*=a;p[15]*=a;this.elements=p.slice();return!0},toString:function(){for(var a="",b=0;b<15;b++)a+= +this.elements[b]+", ";a+=this.elements[15];return a},print:function(){var a=kd(this.elements),a=""+c.nfs(this.elements[0],a,4)+" "+c.nfs(this.elements[1],a,4)+" "+c.nfs(this.elements[2],a,4)+" "+c.nfs(this.elements[3],a,4)+"\n"+c.nfs(this.elements[4],a,4)+" "+c.nfs(this.elements[5],a,4)+" "+c.nfs(this.elements[6],a,4)+" "+c.nfs(this.elements[7],a,4)+"\n"+c.nfs(this.elements[8],a,4)+" "+c.nfs(this.elements[9],a,4)+" "+c.nfs(this.elements[10],a,4)+" "+c.nfs(this.elements[11],a,4)+"\n"+c.nfs(this.elements[12], +a,4)+" "+c.nfs(this.elements[13],a,4)+" "+c.nfs(this.elements[14],a,4)+" "+c.nfs(this.elements[15],a,4)+"\n\n";c.println(a)},invTranslate:function(a,b,f){this.preApply(1,0,0,-a,0,1,0,-b,0,0,1,-f,0,0,0,1)},invRotateX:function(a){var b=j.cos(-a),a=j.sin(-a);this.preApply([1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1])},invRotateY:function(a){var b=j.cos(-a),a=j.sin(-a);this.preApply([b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1])},invRotateZ:function(a){var b=j.cos(-a),a=j.sin(-a);this.preApply([b,-a,0,0,a,b,0,0,0,0,1,0,0, +0,0,1])},invScale:function(a,b,f){this.preApply([1/a,0,0,0,0,1/b,0,0,0,0,1/f,0,0,0,0,1])}};var Qa=c.PMatrixStack=function(){this.matrixStack=[]};Qa.prototype.load=function(){var a=$.$newPMatrix();arguments.length===1?a.set(arguments[0]):a.set(arguments);this.matrixStack.push(a)};v.prototype.$newPMatrix=function(){return new Pa};B.prototype.$newPMatrix=function(){return new w};Qa.prototype.push=function(){this.matrixStack.push(this.peek())};Qa.prototype.pop=function(){return this.matrixStack.pop()}; +Qa.prototype.peek=function(){var a=$.$newPMatrix();a.set(this.matrixStack[this.matrixStack.length-1]);return a};Qa.prototype.mult=function(a){this.matrixStack[this.matrixStack.length-1].apply(a)};c.split=function(a,b){return a.split(b)};c.splitTokens=function(a,b){arguments.length===1&&(b="\n\t\r\u000c ");for(var b="["+b+"]",f=[],c=0,e=a.search(b);e>=0;)e===0?a=a.substring(1):(f[c]=a.substring(0,e),c++,a=a.substring(e)),e=a.search(b);a.length>0&&(f[c]=a);f.length===0&&(f=q);return f};c.append=function(a, +b){a[a.length]=b;return a};c.concat=function(a,b){return a.concat(b)};c.sort=function(a,b){var f=[];if(a.length>0){for(var c=b>0?b:a.length,e=0;e0)for(c=f.length;c>8)};c.peg=function(a){return a<0?0:a>255?255:a};c.modes={replace:function(a,b){return b},blend:function(a,b){var f=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.mix(a&d.RED_MASK,b&d.RED_MASK,f)&d.RED_MASK| +c.mix(a&d.GREEN_MASK,b&d.GREEN_MASK,f)&d.GREEN_MASK|c.mix(a&d.BLUE_MASK,b&d.BLUE_MASK,f)},add:function(a,b){var c=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>>24)+c,255)<<24|j.min((a&d.RED_MASK)+((b&d.RED_MASK)>>8)*c,d.RED_MASK)&d.RED_MASK|j.min((a&d.GREEN_MASK)+((b&d.GREEN_MASK)>>8)*c,d.GREEN_MASK)&d.GREEN_MASK|j.min((a&d.BLUE_MASK)+((b&d.BLUE_MASK)*c>>8),d.BLUE_MASK)},subtract:function(a,b){var c=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>>24)+c,255)<<24|j.max((a&d.RED_MASK)- +((b&d.RED_MASK)>>8)*c,d.GREEN_MASK)&d.RED_MASK|j.max((a&d.GREEN_MASK)-((b&d.GREEN_MASK)>>8)*c,d.BLUE_MASK)&d.GREEN_MASK|j.max((a&d.BLUE_MASK)-((b&d.BLUE_MASK)*c>>8),0)},lightest:function(a,b){var c=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>>24)+c,255)<<24|j.max(a&d.RED_MASK,((b&d.RED_MASK)>>8)*c)&d.RED_MASK|j.max(a&d.GREEN_MASK,((b&d.GREEN_MASK)>>8)*c)&d.GREEN_MASK|j.max(a&d.BLUE_MASK,(b&d.BLUE_MASK)*c>>8)},darkest:function(a,b){var f=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>> +24)+f,255)<<24|c.mix(a&d.RED_MASK,j.min(a&d.RED_MASK,((b&d.RED_MASK)>>8)*f),f)&d.RED_MASK|c.mix(a&d.GREEN_MASK,j.min(a&d.GREEN_MASK,((b&d.GREEN_MASK)>>8)*f),f)&d.GREEN_MASK|c.mix(a&d.BLUE_MASK,j.min(a&d.BLUE_MASK,(b&d.BLUE_MASK)*f>>8),f)},difference:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,m=b&d.BLUE_MASK,i=l>i?l-i:i-l,k=e>k?e-k:k-e,m=g>m?g-m:m-g;return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+ +((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},exclusion:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,m=b&d.BLUE_MASK,i=l+i-(l*i>>7),k=e+k-(e*k>>7),m=g+m-(g*m>>7);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},multiply:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a& +d.BLUE_MASK,i=l*((b&d.RED_MASK)>>16)>>8,k=e*((b&d.GREEN_MASK)>>8)>>8,m=g*(b&d.BLUE_MASK)>>8;return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},screen:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=255-((255-l)*(255-((b&d.RED_MASK)>>16))>>8),k=255-((255-e)*(255-((b&d.GREEN_MASK)>>8))>>8),m=255-((255-g)*(255-(b&d.BLUE_MASK))>>8);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<< +24|c.peg(l+((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},hard_light:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,m=b&d.BLUE_MASK,i=i<128?l*i>>7:255-((255-l)*(255-i)>>7),k=k<128?e*k>>7:255-((255-e)*(255-k)>>7),m=m<128?g*m>>7:255-((255-g)*(255-m)>>7);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},soft_light:function(a, +b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,m=b&d.BLUE_MASK,i=(l*i>>7)+(l*l>>8)-(l*l*i>>15),k=(e*k>>7)+(e*e>>8)-(e*e*k>>15),m=(g*m>>7)+(g*g>>8)-(g*g*m>>15);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},overlay:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b& +d.GREEN_MASK)>>8,m=b&d.BLUE_MASK,i=l<128?l*i>>7:255-((255-l)*(255-i)>>7),k=e<128?e*k>>7:255-((255-e)*(255-k)>>7),m=g<128?g*m>>7:255-((255-g)*(255-m)>>7);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},dodge:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,m=b&d.BLUE_MASK,i=i===255?255:c.peg((l<<8)/(255-i)),k=k===255?255:c.peg((e<< +8)/(255-k)),m=m===255?255:c.peg((g<<8)/(255-m));return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+((i-l)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))},burn:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,l=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,m=b&d.BLUE_MASK,i=i===0?0:255-c.peg((255-l<<8)/i),k=k===0?0:255-c.peg((255-e<<8)/k),m=m===0?0:255-c.peg((255-g<<8)/m);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(l+((i-l)*f>> +8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((m-g)*f>>8))}};c.color=function(a,b,c,l){if(a!==q&&b!==q&&c!==q&&l!==q)return J(a,b,c,l);if(a!==q&&b!==q&&c!==q)return J(a,b,c,fa);if(a!==q&&b!==q){var e;a&d.ALPHA_MASK?(b=j.round(255*(b/fa)),e=a-(a&d.ALPHA_MASK)+((b>255?255:b)<<24&d.ALPHA_MASK)):Ta===d.RGB?e=J(a,a,a,b):Ta===d.HSB&&(e=J(0,0,a/ja*na,b));return e}if(typeof a==="number"){var g;a<=ja&&a>=0?Ta===d.RGB?g=J(a,a,a,fa):Ta===d.HSB&&(g=J(0,0,a/ja*na,fa)):a&&(g=a);return g}return J(ja,wa,na,fa)};c.color.toString= +function(a){return"rgba("+((a&d.RED_MASK)>>>16)+","+((a&d.GREEN_MASK)>>>8)+","+(a&d.BLUE_MASK)+","+((a&d.ALPHA_MASK)>>>24)/255+")"};c.color.toInt=function(a,b,c,l){return l<<24&d.ALPHA_MASK|a<<16&d.RED_MASK|b<<8&d.GREEN_MASK|c&d.BLUE_MASK};c.color.toArray=function(a){return[(a&d.RED_MASK)>>>16,(a&d.GREEN_MASK)>>>8,a&d.BLUE_MASK,(a&d.ALPHA_MASK)>>>24]};c.color.toGLArray=function(a){return[((a&d.RED_MASK)>>>16)/255,((a&d.GREEN_MASK)>>>8)/255,(a&d.BLUE_MASK)/255,((a&d.ALPHA_MASK)>>>24)/255]};c.color.toRGB= +function(a,b,c){var a=a>ja?ja:a,b=b>wa?wa:b,c=c>na?na:c,a=a/ja*360,b=b/wa*100,c=c/na*100,d=j.round(c/100*255);if(b===0)return[d,d,d];else{a%=360;var e=a%60,g=j.round(c*(100-b)/1E4*255),i=j.round(c*(6E3-b*e)/6E5*255),b=j.round(c*(6E3-b*(60-e))/6E5*255);switch(j.floor(a/60)){case 0:return[d,b,g];case 1:return[i,d,g];case 2:return[g,d,b];case 3:return[g,i,d];case 4:return[b,g,d];case 5:return[d,g,i]}}};c.color.toHSB=function(a){var b,f,l;b=((a&d.RED_MASK)>>>16)/255;f=((a&d.GREEN_MASK)>>>8)/255;l=(a& +d.BLUE_MASK)/255;var a=c.max(c.max(b,f),l),e=c.min(c.min(b,f),l);if(e===a)return[0,0,a];else b=b===a?(f-l)/(a-e):f===a?2+(l-b)/(a-e):4+(b-f)/(a-e),b/=6,b<0?b+=1:b>1&&(b-=1);return[b*ja,(a-e)/a*wa,a*na]};c.brightness=function(a){return c.color.toHSB(a)[2]};c.saturation=function(a){return c.color.toHSB(a)[1]};c.hue=function(a){return c.color.toHSB(a)[0]};c.red=function(a){return((a&d.RED_MASK)>>>16)/255*ja};c.green=function(a){return((a&d.GREEN_MASK)>>>8)/255*wa};c.blue=function(a){return(a&d.BLUE_MASK)/ +255*na};c.alpha=function(a){return((a&d.ALPHA_MASK)>>>24)/255*fa};c.lerpColor=function(a,b,f){var l=c.color(a),e=(l&d.RED_MASK)>>>16,g=(l&d.GREEN_MASK)>>>8,a=l&d.BLUE_MASK,l=((l&d.ALPHA_MASK)>>>24)/fa,i=c.color(b),k=(i&d.GREEN_MASK)>>>8,m=i&d.BLUE_MASK,b=((i&d.ALPHA_MASK)>>>24)/fa,e=parseInt(c.lerp(e,(i&d.RED_MASK)>>>16,f),10),g=parseInt(c.lerp(g,k,f),10),a=parseInt(c.lerp(a,m,f),10),f=parseFloat(c.lerp(l,b,f)*fa);return c.color.toInt(e,g,a,f)};c.colorMode=function(){Ta=arguments[0];arguments.length> +1&&(ja=arguments[1],wa=arguments[2]||arguments[1],na=arguments[3]||arguments[1],fa=arguments[4]||arguments[1])};c.blendColor=function(a,b,f){var l=0;switch(f){case d.REPLACE:l=c.modes.replace(a,b);break;case d.BLEND:l=c.modes.blend(a,b);break;case d.ADD:l=c.modes.add(a,b);break;case d.SUBTRACT:l=c.modes.subtract(a,b);break;case d.LIGHTEST:l=c.modes.lightest(a,b);break;case d.DARKEST:l=c.modes.darkest(a,b);break;case d.DIFFERENCE:l=c.modes.difference(a,b);break;case d.EXCLUSION:l=c.modes.exclusion(a, +b);break;case d.MULTIPLY:l=c.modes.multiply(a,b);break;case d.SCREEN:l=c.modes.screen(a,b);break;case d.HARD_LIGHT:l=c.modes.hard_light(a,b);break;case d.SOFT_LIGHT:l=c.modes.soft_light(a,b);break;case d.OVERLAY:l=c.modes.overlay(a,b);break;case d.DODGE:l=c.modes.dodge(a,b);break;case d.BURN:l=c.modes.burn(a,b)}return l};c.printMatrix=function(){Q.print()};v.prototype.translate=function(a,b){ca.translate(a,b);da.invTranslate(a,b);h.translate(a,b)};B.prototype.translate=function(a,b,c){ca.translate(a, +b,c);da.invTranslate(a,b,c)};v.prototype.scale=function(a,b){ca.scale(a,b);da.invScale(a,b);h.scale(a,b||a)};B.prototype.scale=function(a,b,c){ca.scale(a,b,c);da.invScale(a,b,c)};v.prototype.pushMatrix=function(){sb.load(Q);tb.load(Ia);h.save()};B.prototype.pushMatrix=function(){sb.load(Q);tb.load(Ia)};v.prototype.popMatrix=function(){Q.set(sb.pop());Ia.set(tb.pop());hb()};B.prototype.popMatrix=function(){Q.set(sb.pop());Ia.set(tb.pop())};v.prototype.resetMatrix=function(){ca.reset();da.reset();h.setTransform(1, +0,0,1,0,0)};B.prototype.resetMatrix=function(){ca.reset();da.reset()};F.prototype.applyMatrix=function(){var a=arguments;ca.apply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]);da.invApply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])};v.prototype.applyMatrix=function(){for(var a=arguments,b=a.length;b<16;b++)a[b]=0;a[10]=a[15]=1;F.prototype.applyMatrix.apply(this,a)};c.rotateX=function(a){ca.rotateX(a);da.invRotateX(a)}; +v.prototype.rotateZ=function(){throw"rotateZ() is not supported in 2D mode. Use rotate(float) instead.";};B.prototype.rotateZ=function(a){ca.rotateZ(a);da.invRotateZ(a)};c.rotateY=function(a){ca.rotateY(a);da.invRotateY(a)};v.prototype.rotate=function(a){ca.rotateZ(a);da.invRotateZ(a);h.rotate(a)};B.prototype.rotate=function(a){c.rotateZ(a)};c.pushStyle=function(){h.save();c.pushMatrix();gd.push({doFill:R,currentFillColor:Na,doStroke:I,currentStrokeColor:ba,curTint:cb,curRectMode:bb,curColorMode:Ta, +colorModeX:ja,colorModeZ:na,colorModeY:wa,colorModeA:fa,curTextFont:Y,curTextSize:M})};c.popStyle=function(){var a=gd.pop();if(a)hb(),c.popMatrix(),R=a.doFill,Na=a.currentFillColor,I=a.doStroke,ba=a.currentStrokeColor,cb=a.curTint,bb=a.curRectmode,Ta=a.curColorMode,ja=a.colorModeX,na=a.colorModeZ,wa=a.colorModeY,fa=a.colorModeA,Y=a.curTextFont,M=a.curTextSize;else throw"Too many popStyle() without enough pushStyle()";};c.year=function(){return(new Date).getFullYear()};c.month=function(){return(new Date).getMonth()+ +1};c.day=function(){return(new Date).getDate()};c.hour=function(){return(new Date).getHours()};c.minute=function(){return(new Date).getMinutes()};c.second=function(){return(new Date).getSeconds()};c.millis=function(){return(new Date).getTime()-Vc};F.prototype.redraw=function(){var a=((new Date).getTime()-nc)/1E3;Pb++;var b=Pb/a;if(a>0.5)nc=(new Date).getTime(),Pb=0,c.__frameRate=b;c.frameCount++};v.prototype.redraw=function(){F.prototype.redraw.apply(this,arguments);h.lineWidth=xa;h.save();c.draw(); +hb()};B.prototype.redraw=function(){F.prototype.redraw.apply(this,arguments);h.clear(h.DEPTH_BUFFER_BIT);va={attributes:{},locations:{}};c.noLights();c.lightFalloff(1,0,0);c.shininess(1);c.ambient(255,255,255);c.specular(0,0,0);c.emissive(0,0,0);c.camera();c.draw()};c.noLoop=function(){Mb=ab=!1;clearInterval(Nb);T.onPause()};c.loop=function(){Mb||(nc=(new Date).getTime(),Pb=0,Nb=S.setInterval(function(){try{T.onFrameStart(),c.redraw(),T.onFrameEnd()}catch(a){throw S.clearInterval(Nb),a;}},Tc),Mb= +ab=!0,T.onLoop())};c.frameRate=function(a){jc=a;Tc=1E3/jc;ab&&(c.noLoop(),c.loop())};var ib=[];c.exit=function(){S.clearInterval(Nb);var a=c.externals.canvas.id;La.splice(Hb[a],1);delete Hb[a];for(var b in A.lib)A.lib.hasOwnProperty(b)&&A.lib[b].hasOwnProperty("detach")&&A.lib[b].detach(c);for(a=ib.length;a--;)ia(ib[a]);T.onExit()};c.cursor=function(){if(arguments.length>1||arguments.length===1&&arguments[0]instanceof c.PImage){var a=arguments[0],b,f;if(arguments.length>=3){if(b=arguments[1],f=arguments[2], +b<0||f<0||f>=a.height||b>=a.width)throw"x and y must be non-negative and less than the dimensions of the image";}else b=a.width>>>1,f=a.height>>>1;a='url("'+a.toDataURL()+'") '+b+" "+f+", default";p.style.cursor=a}else p.style.cursor=arguments.length===1?arguments[0]:yd};c.noCursor=function(){p.style.cursor=d.NOCURSOR};c.link=function(a,b){b!==q?S.open(a,b):S.location=a};c.beginDraw=bc;c.endDraw=bc;c.Import=function(){};c.status=function(a){S.status=a};c.binary=function(a,b){var c=32;if(typeof a=== +"number")return b&&(c=b),Gc(a,c);a instanceof ka&&(a=a.toString().charCodeAt(0),c=b?32:16);c=Gc(a,c);b&&(c=c.substr(-b));return c};c.unbinary=function(a){var b=/^[0|1]{8}$/,f=0;if(a instanceof Array){f=[];for(b=0;b=d&&(c=c.substring(c.length-d,c.length));return c};c.unhex=function(a){if(a instanceof Array){for(var b= +[],c=0;c0?c:null};c.__contains=function(a,b){if(typeof a!=="string")return a.contains.apply(a,Ba(arguments));return a!==null&&b!==null&&typeof b==="string"&&a.indexOf(b)>-1};c.__replaceAll=function(a,b,c){if(typeof a!=="string")return a.replaceAll.apply(a,Ba(arguments));return a.replace(RegExp(b,"g"),c)};c.__replaceFirst=function(a,b,c){if(typeof a!=="string")return a.replaceFirst.apply(a,Ba(arguments));return a.replace(RegExp(b,""),c)};c.__replace=function(a, +b,c){if(typeof a!=="string")return a.replace.apply(a,Ba(arguments));if(b instanceof RegExp)return a.replace(b,c);typeof b!=="string"&&(b=b.toString());if(b==="")return a;var d=a.indexOf(b);if(d<0)return a;var e=0,g="";do g+=a.substring(e,d)+c,e=d+b.length;while((d=a.indexOf(b,e))>=0);return g+a.substring(e)};c.__equals=function(a,b){if(a.equals instanceof Function)return a.equals.apply(a,Ba(arguments));return a.valueOf()===b.valueOf()};c.__toCharArray=function(a){if(typeof a!=="string")return a.toCharArray.apply(a, +Ba(arguments));for(var b=[],c=0,d=a.length;c0;){c=d.shift();if(c===b)return!0;c.$interfaces&& +(d=d.concat(c.$interfaces))}return!1}for(;c.hasOwnProperty("$base");)if(c=c.$base,c===b)return!0;return!1};c.abs=j.abs;c.ceil=j.ceil;c.constrain=function(a,b,c){return a>c?c:a0))throw"Non-empty array is expected";for(var b=a[0],c=a.length,d=1;d0))throw"Non-empty array is expected";for(var b=a[0],c=a.length,d=1;da[d]&&(b=a[d]);return b}};c.norm=function(a,b,c){return(a-b)/(c-b)};c.pow=j.pow;c.round=j.round;c.sq=function(a){return a*a};c.sqrt=j.sqrt;c.acos=j.acos;c.asin=j.asin;c.atan=j.atan;c.atan2=j.atan2;c.cos=j.cos;c.degrees=function(a){return a*180/j.PI};c.radians=function(a){return a/180*j.PI};c.sin=j.sin; +c.tan=j.tan;var $b=j.random;c.random=function(){if(arguments.length===0)return $b();else if(arguments.length===1)return $b()*arguments[0];else{var a=arguments[0],b=arguments[1];return $b()*(b-a)+a}};Z.createRandomized=function(){var a=new Date;return new Z(a/6E4&4294967295,a&4294967295)};c.randomSeed=function(a){$b=(new Z(a)).nextDouble};c.Random=function(a){var b=!1,c,d;this.nextGaussian=function(){if(b)return b=!1,c;else{var a,g,i;do a=2*d()-1,g=2*d()-1,i=a*a+g*g;while(i>=1||i===0);i=j.sqrt(-2* +j.log(i)/i);c=g*i;b=!0;return a*i}};d=a===q?j.random:(new Z(a)).nextDouble};var Ja={generator:q,octaves:4,fallout:0.5,seed:q};c.noise=function(a,b,c){if(Ja.generator===q)Ja.generator=new ua(Ja.seed);for(var d=Ja.generator,e=1,g=1,i=0,k=0;k0&&(p.style.removeProperty("width"),p.style.removeProperty("height"));p.width=c.width=a||100;p.height=c.height=b||100;for(var l in f)f.hasOwnProperty(l)&&(h[l]=f[l]);c.textSize(M);c.background();cd=j.max(1E3,a*b*0.05);c.externals.context=h;for(f=0;f0?(b=new w,b.set(a),c=new w,c.set(d),b.mult(c),c=new w,c.set(b),c.invert(),c.transpose(),N("normalTransform3d",s,"normalTransform",!1,c.array()),t("normal3d",s,"Normal",3,rc)):ma("normal3d",s,"Normal"),t("vertex3d",s,"Vertex",3,qc),ma("aColor3d", +s,"aColor"),ma("aTexture3d",s,"aTexture"),h.drawArrays(h.TRIANGLES,0,hd.length/3),h.disable(h.POLYGON_OFFSET_FILL));xa>0&&I&&(h.useProgram(x),N("model2d",x,"model",!1,d.array()),N("view2d",x,"view",!1,a.array()),z("color2d",x,"color",la),u("picktype2d",x,"picktype",0),t("vertex2d",x,"Vertex",3,sc),ma("aTextureCoord2d",x,"aTextureCoord"),h.drawArrays(h.LINES,0,id.length/3))};c.sphereDetail=function(a,b){var c;arguments.length===1&&(a=b=arguments[0]);a<3&&(a=3);b<2&&(b=2);if(!(a===db&&b===Ub)){var l= +d.SINCOS_LENGTH/a,e=new P(a),g=new P(a);for(c=0;c0){var f=new w;f.set(a);var d=new w;d.set(b); +f.mult(d);d=new w;d.set(f);d.invert();d.transpose();N("normalTransform3d",s,"normalTransform",!1,d.array());t("normal3d",s,"Normal",3,Ab)}else ma("normal3d",s,"Normal");h.useProgram(s);ma("aTexture3d",s,"aTexture");N("model3d",s,"model",!1,b.array());N("view3d",s,"view",!1,a.array());t("vertex3d",s,"Vertex",3,Ab);ma("aColor3d",s,"aColor");h.enable(h.POLYGON_OFFSET_FILL);h.polygonOffset(1,1);z("color3d",s,"color",oa);h.drawArrays(h.TRIANGLE_STRIP,0,H.length/3);h.disable(h.POLYGON_OFFSET_FILL)}xa>0&& +I&&(h.useProgram(x),N("model2d",x,"model",!1,b.array()),N("view2d",x,"view",!1,a.array()),t("vertex2d",x,"Vertex",3,Ab),ma("aTextureCoord2d",x,"aTextureCoord"),z("color2d",x,"color",la),u("picktype2d",x,"picktype",0),h.drawArrays(h.LINE_STRIP,0,H.length/3))};c.modelX=function(a,b,c){var d=Q.array(),e=Ha.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],k=d[8]*a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[0]*g+e[1]*i+e[2]*k+e[3]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]*b;return e!== +0?a/e:a};c.modelY=function(a,b,c){var d=Q.array(),e=Ha.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],k=d[8]*a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[4]*g+e[5]*i+e[6]*k+e[7]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]*b;return e!==0?a/e:a};c.modelZ=function(a,b,c){var d=Q.array(),e=Ha.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],k=d[8]*a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[8]*g+e[9]*i+e[10]*k+e[11]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]* +b;return e!==0?a/e:a};v.prototype.ambient=F.prototype.a3DOnlyFunction;B.prototype.ambient=function(){var a=arguments;h.useProgram(s);u("usingMat3d",s,"usingMat",!0);a.length===1?typeof a[0]==="string"?(a=a[0].slice(5,-1).split(","),z("mat_ambient3d",s,"mat_ambient",[a[0]/255,a[1]/255,a[2]/255])):z("mat_ambient3d",s,"mat_ambient",[a[0]/255,a[0]/255,a[0]/255]):z("mat_ambient3d",s,"mat_ambient",[a[0]/255,a[1]/255,a[2]/255])};v.prototype.emissive=F.prototype.a3DOnlyFunction;B.prototype.emissive=function(){var a= +arguments;h.useProgram(s);u("usingMat3d",s,"usingMat",!0);a.length===1?typeof a[0]==="string"?(a=a[0].slice(5,-1).split(","),z("mat_emissive3d",s,"mat_emissive",[a[0]/255,a[1]/255,a[2]/255])):z("mat_emissive3d",s,"mat_emissive",[a[0]/255,a[0]/255,a[0]/255]):z("mat_emissive3d",s,"mat_emissive",[a[0]/255,a[1]/255,a[2]/255])};v.prototype.shininess=F.prototype.a3DOnlyFunction;B.prototype.shininess=function(a){h.useProgram(s);u("usingMat3d",s,"usingMat",!0);z("shininess3d",s,"shininess",a)};v.prototype.specular= +F.prototype.a3DOnlyFunction;B.prototype.specular=function(){var a=c.color.apply(this,arguments);h.useProgram(s);u("usingMat3d",s,"usingMat",!0);z("mat_specular3d",s,"mat_specular",c.color.toGLArray(a).slice(0,3))};c.screenX=function(a,b,f){var d=Q.array();if(d.length===16){var e=d[0]*a+d[1]*b+d[2]*f+d[3],g=d[4]*a+d[5]*b+d[6]*f+d[7],i=d[8]*a+d[9]*b+d[10]*f+d[11],b=d[12]*a+d[13]*b+d[14]*f+d[15],f=ya.array(),a=f[0]*e+f[1]*g+f[2]*i+f[3]*b,e=f[12]*e+f[13]*g+f[14]*i+f[15]*b;e!==0&&(a/=e);return c.width* +(1+a)/2}else return Q.multX(a,b)};c.screenY=function(a,b,f){var d=Q.array();if(d.length===16){var e=d[0]*a+d[1]*b+d[2]*f+d[3],g=d[4]*a+d[5]*b+d[6]*f+d[7],i=d[8]*a+d[9]*b+d[10]*f+d[11],b=d[12]*a+d[13]*b+d[14]*f+d[15],f=ya.array(),a=f[4]*e+f[5]*g+f[6]*i+f[7]*b,e=f[12]*e+f[13]*g+f[14]*i+f[15]*b;e!==0&&(a/=e);return c.height*(1+a)/2}else return Q.multY(a,b)};c.screenZ=function(a,b,c){var d=Q.array();if(d.length!==16)return 0;var e=ya.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],k=d[8]* +a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[8]*g+e[9]*i+e[10]*k+e[11]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]*b;e!==0&&(a/=e);return(a+1)/2};F.prototype.fill=function(a,b,d,l){a=c.color(a,b,d,l);a===Na&&R||(R=!0,Na=a)};v.prototype.fill=function(){F.prototype.fill.apply(this,arguments);Ma=!0};B.prototype.fill=function(){F.prototype.fill.apply(this,arguments);oa=c.color.toGLArray(Na)};c.noFill=function(){R=!1};F.prototype.stroke=function(a,b,d,l){a=c.color(a,b,d,l);a===ba&&I||(I=!0,ba=a)}; +v.prototype.stroke=function(){F.prototype.stroke.apply(this,arguments);Ib=!0};B.prototype.stroke=function(){F.prototype.stroke.apply(this,arguments);la=c.color.toGLArray(ba)};c.noStroke=function(){I=!1};F.prototype.strokeWeight=function(a){xa=a};v.prototype.strokeWeight=function(a){F.prototype.strokeWeight.apply(this,arguments);h.lineWidth=a};B.prototype.strokeWeight=function(a){F.prototype.strokeWeight.apply(this,arguments);h.useProgram(x);z("pointSize2d",x,"pointSize",a);h.useProgram(ga);z("pointSizeUnlitShape", +ga,"pointSize",a);h.lineWidth(a)};c.strokeCap=function(a){$.$ensureContext().lineCap=a};c.strokeJoin=function(a){$.$ensureContext().lineJoin=a};F.prototype.smooth=function(){p.style.setProperty("image-rendering","optimizeQuality","important")};v.prototype.smooth=function(){F.prototype.smooth.apply(this,arguments);if("mozImageSmoothingEnabled"in h)h.mozImageSmoothingEnabled=!0};F.prototype.noSmooth=function(){p.style.setProperty("image-rendering","optimizeSpeed","important")};v.prototype.noSmooth= +function(){F.prototype.noSmooth.apply(this,arguments);if("mozImageSmoothingEnabled"in h)h.mozImageSmoothingEnabled=!1};v.prototype.point=function(a,b){if(I)if(T.options.crispLines){var f=j.PI/4,l=c.get(a,b);c.set(a,b,ud(l,ba,f))}else xa>1?(h.fillStyle=c.color.toString(ba),Ma=!0,h.beginPath(),h.arc(a,b,xa/2,0,d.TWO_PI,!1),h.fill(),h.closePath()):(h.fillStyle=c.color.toString(ba),h.fillRect(j.round(a),j.round(b),1,1),Ma=!0)};B.prototype.point=function(a,b,c){var d=new w;d.translate(a,b,c||0);d.transpose(); +a=new w;a.scale(1,-1,1);a.apply(Q.array());a.transpose();h.useProgram(x);N("model2d",x,"model",!1,d.array());N("view2d",x,"view",!1,a.array());xa>0&&I&&(z("color2d",x,"color",la),u("picktype2d",x,"picktype",0),t("vertex2d",x,"Vertex",3,Sb),ma("aTextureCoord2d",x,"aTextureCoord"),h.drawArrays(h.POINTS,0,1))};c.beginShape=function(a){U=a;o=[]};v.prototype.vertex=function(a,b,c,d){var e=[];Xa&&(Xa=!1);e.isVert=!0;e[0]=a;e[1]=b;e[2]=0;e[3]=c;e[4]=d;e[5]=Na;e[6]=ba;o.push(e)};B.prototype.vertex=function(a, +b,c,d,e){var g=[];Xa&&(Xa=!1);g.isVert=!0;g[0]=a;g[1]=b;g[2]=c||0;g[3]=d||0;g[4]=e||0;g[5]=oa[0];g[6]=oa[1];g[7]=oa[2];g[8]=oa[3];g[9]=la[0];g[10]=la[1];g[11]=la[2];g[12]=la[3];g[13]=gc;g[14]=hc;g[15]=ic;o.push(g)};var ld=function(a,b){var c=new w;c.scale(1,-1,1);c.apply(Q.array());c.transpose();h.useProgram(ga);N("uViewUS",ga,"uView",!1,c.array());t("aVertexUS",ga,"aVertex",3,Sb);h.bufferData(h.ARRAY_BUFFER,new P(a),h.STREAM_DRAW);t("aColorUS",ga,"aColor",4,vc);h.bufferData(h.ARRAY_BUFFER,new P(b), +h.STREAM_DRAW);h.drawArrays(h.POINTS,0,a.length/3)},sa=function(a,b,c){var b=b==="LINES"?h.LINES:b==="LINE_LOOP"?h.LINE_LOOP:h.LINE_STRIP,d=new w;d.scale(1,-1,1);d.apply(Q.array());d.transpose();h.useProgram(ga);N("uViewUS",ga,"uView",!1,d.array());t("aVertexUS",ga,"aVertex",3,uc);h.bufferData(h.ARRAY_BUFFER,new P(a),h.STREAM_DRAW);t("aColorUS",ga,"aColor",4,Xc);h.bufferData(h.ARRAY_BUFFER,new P(c),h.STREAM_DRAW);h.drawArrays(b,0,a.length/3)},Ra=function(a,b,c,l){var b=b==="TRIANGLES"?h.TRIANGLES: +b==="TRIANGLE_FAN"?h.TRIANGLE_FAN:h.TRIANGLE_STRIP,e=new w;e.scale(1,-1,1);e.apply(Q.array());e.transpose();h.useProgram(s);N("model3d",s,"model",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);N("view3d",s,"view",!1,e.array());h.enable(h.POLYGON_OFFSET_FILL);h.polygonOffset(1,1);z("color3d",s,"color",[-1,0,0,0]);t("vertex3d",s,"Vertex",3,Wc);h.bufferData(h.ARRAY_BUFFER,new P(a),h.STREAM_DRAW);t("aColor3d",s,"aColor",4,vc);h.bufferData(h.ARRAY_BUFFER,new P(c),h.STREAM_DRAW);ma("normal3d",s,"Normal");if(pa){if(ad=== +d.IMAGE)for(c=0;c1&&(l[c+0]-=l[c+0]-1),l[c+1]>1&&(l[c+1]-=l[c+1]-1);u("usingTexture3d",s,"usingTexture",pa);t("aTexture3d",s,"aTexture",2,Yc);h.bufferData(h.ARRAY_BUFFER,new P(l),h.STREAM_DRAW)}h.drawArrays(b,0,a.length/3);h.disable(h.POLYGON_OFFSET_FILL)};v.prototype.endShape=function(a){if(o.length!==0){var a=a===d.CLOSE,b=[],f=[],l=[],e=[],g;Xa=!0;var i,k,m=o.length;for(i=0;i3){b=[];f=1-kc;h.beginPath();h.moveTo(o[1][0],o[1][1]);for(i=1;i+22){h.beginPath();h.moveTo(o[0][0],o[0][1]);h.lineTo(o[1][0],o[1][1]);h.lineTo(o[2][0],o[2][1]);R&&(c.fill(o[2][5]),X());I&&(c.stroke(o[2][6]),V());h.closePath();for(i=3;i3)for(i=0;i+12)for(k=0;k+22)for(k=0;k+22){for(k=0;k<3;k++){i=o[k];for(m=0;m<3;m++)a.push(i[m])}for(k=0;k<3;k++){i=o[k];for(m=9;m<13;m++)e.push(i[m])}I&&sa(a,"LINE_LOOP",e);for(k=2;k+13){for(k=0;k<2;k++){i=o[k];for(m=0;m<3;m++)a.push(i[m])}for(k=0;k<2;k++){i=o[k];for(m=9;m<13;m++)e.push(i[m])}sa(a,"LINE_STRIP",e);j>4&&j%2>0&&(c.splice(c.length- +3),o.pop());for(k=0;k+33){var e=ha[ea-4][0],g=ha[ea-4][1],i=ha[ea-4][2],k=ha[ea-3][0],m=ha[ea-3][1],h=ha[ea- +3][2],j=ha[ea-2][0],o=ha[ea-2][1],n=ha[ea-2][2],p=ha[ea-1][0],q=ha[ea-1][1],s=ha[ea-1][2],a=k,b=m,d=h,r=ob.array(),l=r[4]*e+r[5]*k+r[6]*j+r[7]*p,t=r[8]*e+r[9]*k+r[10]*j+r[11]*p,e=r[12]*e+r[13]*k+r[14]*j+r[15]*p,k=r[4]*g+r[5]*m+r[6]*o+r[7]*q,j=r[8]*g+r[9]*m+r[10]*o+r[11]*q,g=r[12]*g+r[13]*m+r[14]*o+r[15]*q,m=r[4]*i+r[5]*h+r[6]*n+r[7]*s,o=r[8]*i+r[9]*h+r[10]*n+r[11]*s,i=r[12]*i+r[13]*h+r[14]*n+r[15]*s;c.vertex(a,b,d);for(h=0;hd.TWO_PI)e=0,g=d.TWO_PI; +f/=2;l/=2;a+=f;b+=l;var e=0|-0.5+e/d.TWO_PI*d.SINCOS_LENGTH,g=0|0.5+g/d.TWO_PI*d.SINCOS_LENGTH,i,k;if(R){var m=I;I=!1;c.beginShape();c.vertex(a,b);for(k=i=e;i=d.SINCOS_LENGTH&&(k-=d.SINCOS_LENGTH),c.vertex(a+rb[k]*f,b+qb[k]*l);c.endShape(d.CLOSE);I=m}if(I){m=R;R=!1;c.beginShape();for(k=i=e;i=d.SINCOS_LENGTH&&(k-=d.SINCOS_LENGTH),c.vertex(a+rb[k]*f,b+qb[k]*l);k=g%d.SINCOS_LENGTH;c.vertex(a+rb[k]*f,b+qb[k]*l);c.endShape();R=m}}};v.prototype.line=function(a,b,d,l){if(a===d&& +b===l)c.point(a,b);else if((a===d||b===l)&&xa<=1&&I&&T.options.crispLines){var e;if(a===d){b>l&&(e=b,b=l,l=e);for(;b<=l;++b)c.set(a,b,ba)}else{a>d&&(e=a,a=d,d=e);for(;a<=d;++a)c.set(a,b,ba)}}else I&&(h.beginPath(),h.moveTo(a||0,b||0),h.lineTo(d||0,l||0),V(),h.closePath())};B.prototype.line=function(a,b,d,l,e,g){if(e===q||g===q)g=0,e=l,l=d,d=0;a===l&&b===e&&d===g?c.point(a,b,d):(a=[a,b,d,l,e,g],b=new w,b.scale(1,-1,1),b.apply(Q.array()),b.transpose(),xa>0&&I&&(h.useProgram(x),N("model2d",x,"model", +!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),N("view2d",x,"view",!1,b.array()),z("color2d",x,"color",la),u("picktype2d",x,"picktype",0),t("vertex2d",x,"Vertex",3,uc),ma("aTextureCoord2d",x,"aTextureCoord"),h.bufferData(h.ARRAY_BUFFER,new P(a),h.STREAM_DRAW),h.drawArrays(h.LINES,0,2)))};v.prototype.bezier=function(){if(arguments.length!==8)throw"You must use 8 parameters for bezier() in 2D mode";c.beginShape();c.vertex(arguments[0],arguments[1]);c.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5], +arguments[6],arguments[7]);c.endShape()};B.prototype.bezier=function(){if(arguments.length!==12)throw"You must use 12 parameters for bezier() in 3D mode";c.beginShape();c.vertex(arguments[0],arguments[1],arguments[2]);c.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]);c.endShape()};c.bezierDetail=function(a){mc=a};c.bezierPoint=function(a,b,c,d,e){return(1-e)*(1-e)*(1-e)*a+3*(1-e)*(1-e)*e*b+3*(1-e)*e*e*c+e*e*e*d}; +c.bezierTangent=function(a,b,c,d,e){return 3*e*e*(-a+3*b-3*c+d)+6*e*(a-2*b+c)+3*(-a+b)};c.curvePoint=function(a,b,c,d,e){return 0.5*(2*b+(-a+c)*e+(2*a-5*b+4*c-d)*e*e+(-a+3*b-3*c+d)*e*e*e)};c.curveTangent=function(a,b,c,d,e){return 0.5*(-a+c+2*(2*a-5*b+4*c-d)*e+3*(-a+3*b-3*c+d)*e*e)};c.triangle=function(a,b,f,l,e,g){c.beginShape(d.TRIANGLES);c.vertex(a,b,0);c.vertex(f,l,0);c.vertex(e,g,0);c.endShape()};c.quad=function(a,b,f,l,e,g,i,k){c.beginShape(d.QUADS);c.vertex(a,b,0);c.vertex(f,l,0);c.vertex(e, +g,0);c.vertex(i,k,0);c.endShape()};v.prototype.rect=function(a,b,f,l){if(f||l)if(I&&!R&&xa<=1&&T.options.crispLines){var e,g=a+f-1,i=b+l-1;for(e=0;e0&&I&&(h.useProgram(x),N("model2d",x,"model",!1,e.array()),N("view2d",x,"view",!1,b.array()),z("color2d",x,"color",la),u("picktype2d",x,"picktype",0),t("vertex2d",x,"Vertex",3,Rb),ma("aTextureCoord2d",x,"aTextureCoord"),h.drawArrays(h.LINE_LOOP,0,Cc.length/3));R&&(h.useProgram(s),N("model3d",s,"model",!1,e.array()),N("view3d",s,"view",!1,b.array()),h.enable(h.POLYGON_OFFSET_FILL),h.polygonOffset(1,1),z("color3d", +s,"color",oa),D>0?(a=new w,a.set(b),b=new w,b.set(e),a.mult(b),e=new w,e.set(a),e.invert(),e.transpose(),N("normalTransform3d",s,"normalTransform",!1,e.array()),t("normal3d",s,"Normal",3,tc)):ma("normal3d",s,"Normal"),t("vertex3d",s,"Vertex",3,Rb),h.drawArrays(h.TRIANGLE_FAN,0,Cc.length/3),h.disable(h.POLYGON_OFFSET_FILL))};F.prototype.ellipse=function(a,b,c,l){a=a||0;b=b||0;if(!(c<=0&&l<=0)){Wa===d.RADIUS&&(c*=2,l*=2);Wa===d.CORNERS&&(c-=a,l-=b);if(Wa===d.CORNER||Wa===d.CORNERS)a+=c/2,b+=l/2;return{x:a, +y:b,width:c,height:l}}};v.prototype.ellipse=function(a,b,f,l){var e=F.prototype.ellipse.apply(this,arguments);if(e)if(a=e.x,b=e.y,f=e.width,l=e.height,f===l)h.beginPath(),h.arc(a-0,b-0,f/2,0,d.TWO_PI,!1),X(),V(),h.closePath();else{var e=f/2,g=l/2,i=0.5522847498307933*e,k=0.5522847498307933*g;c.beginShape();c.vertex(a+e,b);c.bezierVertex(a+e,b-k,a+i,b-g,a,b-g);c.bezierVertex(a-i,b-g,a-e,b-k,a-e,b);c.bezierVertex(a-e,b+k,a-i,b+g,a,b+g);c.bezierVertex(a+i,b+g,a+e,b+k,a+e,b);c.endShape()}};B.prototype.ellipse= +function(a,b,d,l){var e=F.prototype.ellipse.apply(this,arguments);if(e){var a=e.x,b=e.y,d=e.width,l=e.height,e=d/2,g=l/2,i=0.5522847498307933*e,k=0.5522847498307933*g;c.beginShape();c.vertex(a+e,b);c.bezierVertex(a+e,b-k,0,a+i,b-g,0,a,b-g,0);c.bezierVertex(a-i,b-g,0,a-e,b-k,0,a-e,b,0);c.bezierVertex(a-e,b+k,0,a-i,b+g,0,a,b+g,0);c.bezierVertex(a+i,b+g,0,a+e,b+k,0,a+e,b,0);c.endShape();if(R){var k=i=0,m;for(m=0;m>>16;a.imageData.data[f+1]=(c&d.GREEN_MASK)>>>8;a.imageData.data[f+2]=c&d.BLUE_MASK;a.imageData.data[f+3]=(c&d.ALPHA_MASK)>>>24}}(this),set:function(a){if(this.isRemote)throw"Image is loaded remotely. Cannot set pixels."; +else for(var b=0,c=a.length;b=0&&b>=0&&b=0&&b>=0&&bcd&&Da()):d instanceof ta&&c.image(d,a,b);else if(arguments.length===4)if(l.isRemote)throw"Image is loaded remotely. Cannot set x,y."; +else{var e=c.color.toArray(d),g=b*l.width*4+a*4,i=l.imageData.data;i[g]=e[0];i[g+1]=e[1];i[g+2]=e[2];i[g+3]=e[3]}};c.imageData={};c.pixels={getLength:function(){return c.imageData.data.length?c.imageData.data.length/4:0},getPixel:function(a){a*=4;return c.imageData.data[a+3]<<24&4278190080|c.imageData.data[a+0]<<16&16711680|c.imageData.data[a+1]<<8&65280|c.imageData.data[a+2]&255},setPixel:function(a,b){var d=a*4;c.imageData.data[d+0]=(b&16711680)>>>16;c.imageData.data[d+1]=(b&65280)>>>8;c.imageData.data[d+ +2]=b&255;c.imageData.data[d+3]=(b&4278190080)>>>24},set:function(a){for(var b=0,c=a.length;b0&&pd(a,b,d,l);var e=c.color.toGLArray(nb);h.clearColor(e[0],e[1],e[2],e[3]);h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT)};v.prototype.image=function(a,b,c,d,e){if(a.width>0){var g=Xb(b||0,c||0,d||a.width,e||a.height,arguments.length<4);if(a.sourceImg&&cb===null&&!a.__mask){var i=a.sourceImg;h.drawImage(i,0,0,i.width,i.height,g.x,g.y,g.w,g.h)}else{i=a.toImageData();if(a.__mask){var k,m;if(a.__mask instanceof +ta){var j=a.__mask.toImageData();k=2;for(m=a.width*a.height*4;k0&&(l=l||a.width,e=e||a.height,c.beginShape(c.QUADS),c.texture(a.externals.canvas),c.vertex(b,d,0,0,0),c.vertex(b,d+e,0,0,e),c.vertex(b+l,d+e,0,l,e),c.vertex(b+l,d,0,l,0),c.endShape())};c.tint=function(){var a= +c.color.apply(this,arguments),b=c.red(a)/ja,d=c.green(a)/wa,l=c.blue(a)/na,e=c.alpha(a)/fa;cb=function(a){for(var c=a.data,a=4*a.width*a.height,k=0;k=i&&(j=c),p<0&&(p=0),n>=d&&(n=c),p=b.pixels.getPixel(p),o=b.pixels.getPixel(o),n=b.pixels.getPixel(n),j=b.pixels.getPixel(j),k=77*(k>>16&255)+151*(k>>8&255)+28*(k&255),s=77*(o>>16&255)+151*(o>>8&255)+28*(o&255),q=77*(j>>16&255)+151*(j>>8&255)+28*(j&255),t=77*(p>>16&255)+151*(p>>8&255)+28*(p&255),r=77*(n>>16&255)+151*(n>>8&255)+28*(n&255),s=i&&(j=c),p<0&&(p=0),n>=d&&(n=c),p=b.pixels.getPixel(p),o=b.pixels.getPixel(o),n=b.pixels.getPixel(n),j=b.pixels.getPixel(j),k=77*(k>>16&255)+151*(k>>8&255)+28*(k&255),s=77*(o>>16&255)+151*(o>>8&255)+28*(o&255),q=77*(j>>16&255)+151*(j>>8&255)+28*(j&255),t=77*(p>>16&255)+151*(p>>8&255)+28*(p&255),r=77*(n>>16&255)+151*(n>>8&255)+28*(n&255),s>k&& +(h=o,k=s),q>k&&(h=j,k=q),t>k&&(h=p,k=t),r>k&&(h=n),e[c++]=h}b.pixels.set(e)};c.filter=function(a,b,f){var l,e,g,i;arguments.length===3?(f.loadPixels(),l=f):(c.loadPixels(),l=c);b===q&&(b=null);if(l.isRemote)throw"Image is loaded remotely. Cannot filter image.";else{var k=l.pixels.getLength();switch(a){case d.BLUR:var h=b||1,j=l,o,p,n,s,t,L,r,u,z;g=j.pixels.getLength();i=new P(g);k=new P(g);e=new P(g);g=new P(g);var G=0,w,y,x,h=c.floor(h*3.5),v,h=h<1?1:h<248?h:248;if(c.shared.blurRadius!==h){c.shared.blurRadius= +h;c.shared.blurKernelSize=1+(c.shared.blurRadius<<1);c.shared.blurKernel=new P(c.shared.blurKernelSize);var B=c.shared.blurKernel,A=c.shared.blurKernelSize;for(v=0;v=v)break;t=0}for(x=t;x=v)break;r=(L+G)*4;t=A[x];s+=t*C[r+3]; +o+=t*C[r];p+=t*C[r+1];n+=t*C[r+2];j+=t;L++}r=G+w;g[r]=s/j;i[r]=o/j;k[r]=p/j;e[r]=n/j}G+=v}G=0;u=-u;z=u*v;for(y=0;y=h)break;t=0;r=u;L=w+z}for(x=t;x=h)break;t=A[x];s+=t*g[L];o+=t*i[L];p+=t*k[L];n+=t*e[L];j+=t;r++;L+=v}r=(w+G)*4;C[r]=o/j;C[r+1]=p/j;C[r+2]=n/j;C[r+3]=s/j}G+=v;z+=v;u++}break;case d.GRAY:if(l.format===d.ALPHA){for(i=0;i>16&255)+151*(e>>8&255)+28*(e&255)>>8,l.pixels.setPixel(i,e&d.ALPHA_MASK|g<<16|g<<8|g);break;case d.INVERT:for(i=0;i255)throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)";g=e-1;for(i=0;i>16&255,h=l.pixels.getPixel(i)>>8&255,v= +l.pixels.getPixel(i)&255,G=(G*e>>8)*255/g,h=(h*e>>8)*255/g,v=(v*e>>8)*255/g,l.pixels.setPixel(i,4278190080&l.pixels.getPixel(i)|G<<16|h<<8|v);break;case d.OPAQUE:for(i=0;i1)throw"Level must be between 0 and 1 for filter(THRESHOLD, level)";e=c.floor(b*255);for(i=0;i>16,c.max((l.pixels.getPixel(i)&d.GREEN_MASK)>>8,l.pixels.getPixel(i)& +d.BLUE_MASK)),l.pixels.setPixel(i,l.pixels.getPixel(i)&d.ALPHA_MASK|(gc&&(i=c)):(a=c+a-e,i>a&& +(i=a));gd&&(k=d)):(b=d+b-g,k>b&&(k=b));return!(i<=0||k<=0)};c.filter_new_scanline=function(){c.shared.sX=c.shared.srcXOffset;c.shared.fracV=c.shared.srcYOffset&d.PREC_MAXVAL;c.shared.ifV=d.PREC_MAXVAL-c.shared.fracV;c.shared.v1=(c.shared.srcYOffset>>d.PRECISIONB)*c.shared.iw;c.shared.v2=j.min((c.shared.srcYOffset>>d.PRECISIONB)+1,c.shared.ih1)*c.shared.iw};c.filter_bilinear=function(){c.shared.fracU=c.shared.sX&d.PREC_MAXVAL;c.shared.ifU=d.PREC_MAXVAL-c.shared.fracU;c.shared.ul=c.shared.ifU* +c.shared.ifV>>d.PRECISIONB;c.shared.ll=c.shared.ifU*c.shared.fracV>>d.PRECISIONB;c.shared.ur=c.shared.fracU*c.shared.ifV>>d.PRECISIONB;c.shared.lr=c.shared.fracU*c.shared.fracV>>d.PRECISIONB;c.shared.u1=c.shared.sX>>d.PRECISIONB;c.shared.u2=j.min(c.shared.u1+1,c.shared.iw1);var a=(c.shared.v1+c.shared.u1)*4,b=(c.shared.v1+c.shared.u2)*4,f=(c.shared.v2+c.shared.u1)*4,h=(c.shared.v2+c.shared.u2)*4;c.shared.cUL=c.color.toInt(c.shared.srcBuffer[a],c.shared.srcBuffer[a+1],c.shared.srcBuffer[a+2],c.shared.srcBuffer[a+ +3]);c.shared.cUR=c.color.toInt(c.shared.srcBuffer[b],c.shared.srcBuffer[b+1],c.shared.srcBuffer[b+2],c.shared.srcBuffer[b+3]);c.shared.cLL=c.color.toInt(c.shared.srcBuffer[f],c.shared.srcBuffer[f+1],c.shared.srcBuffer[f+2],c.shared.srcBuffer[f+3]);c.shared.cLR=c.color.toInt(c.shared.srcBuffer[h],c.shared.srcBuffer[h+1],c.shared.srcBuffer[h+2],c.shared.srcBuffer[h+3]);c.shared.r=c.shared.ul*((c.shared.cUL&d.RED_MASK)>>16)+c.shared.ll*((c.shared.cLL&d.RED_MASK)>>16)+c.shared.ur*((c.shared.cUR&d.RED_MASK)>> +16)+c.shared.lr*((c.shared.cLR&d.RED_MASK)>>16)<>>d.PRECISIONB&d.GREEN_MASK;c.shared.b=c.shared.ul*(c.shared.cUL&d.BLUE_MASK)+c.shared.ll*(c.shared.cLL&d.BLUE_MASK)+c.shared.ur*(c.shared.cUR&d.BLUE_MASK)+c.shared.lr*(c.shared.cLR&d.BLUE_MASK)>>>d.PRECISIONB;c.shared.a=c.shared.ul*((c.shared.cUL&d.ALPHA_MASK)>>> +24)+c.shared.ll*((c.shared.cLL&d.ALPHA_MASK)>>>24)+c.shared.ur*((c.shared.cUR&d.ALPHA_MASK)>>>24)+c.shared.lr*((c.shared.cLR&d.ALPHA_MASK)>>>24)<=a.width&&(h=a.width-1);e>=a.height&&(e=a.height-1);h-=b;e-=f;p-=m;q-=o;if(!(p<=0||q<=0||h<=0||e<=0||m>=i||o>=k||b>=a.width||f>=a.height))switch(h=j.floor(h/p*d.PRECISIONF),e=j.floor(e/q*d.PRECISIONF), +c.shared.srcXOffset=j.floor(m<0?-m*h:b*d.PRECISIONF),c.shared.srcYOffset=j.floor(o<0?-o*e:f*d.PRECISIONF),m<0&&(p+=m,m=0),o<0&&(q+=o,o=0),p=j.min(p,i-m),q=j.min(q,k-o),b=o*i+m,c.shared.srcBuffer=a.imageData.data,c.shared.iw=a.width,c.shared.iw1=a.width-1,c.shared.ih1=a.height-1,n){case d.BLEND:for(f=0;f":return a.greater;case "?":return a.question;case "@":return a.at; +case "[":return a.bracketleft;case "\\":return a.backslash;case "]":return a.bracketright;case "^":return a.asciicircum;case "`":return a.grave;case "{":return a.braceleft;case "|":return a.bar;case "}":return a.braceright;case "~":return a.asciitilde;default:return a[b]}}catch(c){A.debug(c)}};v.prototype.text$line=function(a,b,f,j,e){j=j=0;if(Y.glyph){j=c.glyphTable[Y.name];h.save();h.translate(b,f+M);(e===d.RIGHT||e===d.CENTER)&&j.width(a);b=1/j.units_per_em*M;h.scale(b,b);b=0;for(f=a.length;b< +f;b++)try{c.glyphLook(j,a[b]).draw()}catch(g){A.debug(g)}hb()}else if(a&&"fillText"in h){if(Ma)h.fillStyle=c.color.toString(Na),Ma=!1;if(e===d.RIGHT||e===d.CENTER)j=h.measureText(a).width,j=e===d.RIGHT?-j:-j/2;h.fillText(a,b+j,f)}};B.prototype.text$line=function(a,b,c,j,e){ra===q&&(ra=E.createElement("canvas"));var g=h;h=ra.getContext("2d");h.font=M+"px "+Y.name;var i=h.measureText(a).width;ra.width=i;ra.height=M;h=ra.getContext("2d");h.font=M+"px "+Y.name;h.textBaseline="top";v.prototype.text$line(a, +0,0,0,d.LEFT);a=ra.width/ra.height;h=g;h.bindTexture(h.TEXTURE_2D,$c);wb(ra);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);g=0;e===d.RIGHT?g=-i:e===d.CENTER&&(g=-i/2);e=new w;i=M*0.5;e.translate(b+g-i/2,c-i,j);e.scale(-a*i,-i,i);e.translate(-1,-1,-1);e.transpose();b=new w;b.scale(1,-1,1);b.apply(Q.array()); +b.transpose();h.useProgram(x);t("vertex2d",x,"Vertex",3,wc);t("aTextureCoord2d",x,"aTextureCoord",2,xc);u("uSampler2d",x,"uSampler",[0]);u("picktype2d",x,"picktype",1);N("model2d",x,"model",!1,e.array());N("view2d",x,"view",!1,b.array());z("color2d",x,"color",oa);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,yc);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)};c.text=function(){if(zc===d.SCREEN){c.pushMatrix();c.resetMatrix();var a=c.textAscent(),b=c.textDescent(),f=c.textWidth(arguments[0]),h=a+b,b=c.loadFont(Y.origName), +f=c.createGraphics(f,h);f.beginDraw();f.fill(Na);f.opaque=!1;f.background(0,0,0,0);f.textFont(b);f.textSize(M);f.text(arguments[0],0,a);f.endDraw();arguments.length===5||arguments.length===6?c.image(f,arguments[1],arguments[2]-a,arguments[3],arguments[4]):c.image(f,arguments[1],arguments[2]-a);c.popMatrix()}else zc!==d.SHAPE&&(arguments.length===3?Nc(Oa(arguments[0]),arguments[1],arguments[2],0):arguments.length===4?Nc(Oa(arguments[0]),arguments[1],arguments[2],arguments[3]):arguments.length===5? +Oc(Oa(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0):arguments.length===6&&Oc(Oa(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))};c.textMode=function(a){zc=a};c.loadGlyphs=function(a){var b,d,l,e,g,i,k,m,o,p,s,n,t=function(a,b){var c=0,d=[],e,f=RegExp(a,"g");for(e=d[c]=f.exec(b);e;)c++,e=d[c]=f.exec(b);return d},L=function(a){var c=t("[A-Za-z][0-9\\- ]+|Z",a);n="return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();"; +m=a=i=g=e=l=d=b=0;o="";p=c.length-1;for(var k=0;kj&&(d=j-p);Ka.height=d/j*100+"%";O.paddingBottom=Z.clientHeight+"px"},La=[W(j,"mousemove",function(d){if(qa)Oa(J.innerHeight-d.clientY),V.scrollTop=Aa}),W(j,"mouseup",function(){qa&&(qa=Aa=!1)}),W(X,"dblclick",function(d){d.preventDefault();Da?(Oa(Da),Da=!1):(Da=Z.clientHeight,Ka.height="0px")}),W(X,"mousedown",function(d){d.preventDefault();qa=!0;Aa=V.scrollTop}),W(X,"contextmenu",function(){qa=!1}),W(ua,"click",function(){za()})];za=function(){for(var j=La.length;j--;)aa.apply(d,La[j]); +P.removeChild(Z);O.paddingBottom=Sa;ia(V);ia(Z);d.log=Ba};S(Z,q,V,z,X,u,ua,t);ua.title="Close Log";Ca(ua,j.createTextNode("\u2716"));X.title="Double-click to toggle log minimization";P.insertBefore(Z,P.firstChild);d.log=function(d){Za===512?V.removeChild(V.firstChild):Za++;var p=Ca(V,j.createElement("div")),q=Ca(p,j.createElement("div"));p.title=(new Date).toLocaleTimeString();S(p,A,q,N);Ca(q,j.createTextNode(d));V.scrollTop=V.scrollHeight};d.log(E);O.paddingBottom=Z.clientHeight+"px"}}():typeof print=== +"function"&&(d.log=print);return d}();A.logger=Ka;A.version="1.2.3-API";A.lib={};A.registerLibrary=function(d,j){A.lib[d]=j;j.hasOwnProperty("init")&&j.init(W)};A.instances=La;A.getInstanceById=function(d){return La[Hb[d]]};A.Sketch=function(d){this.attachFunction=d;this.options={crispLines:!1,pauseOnBlur:!1,globalKeyEvents:!1};this.onExit=this.onFrameEnd=this.onFrameStart=this.onLoop=this.onPause=this.onSetup=this.onLoad=bc;this.params={};this.imageCache={pending:0,images:{},add:function(d){if(ua){var j= +new Image;j.onload=function(d){return function(){d.pending--}}(this);this.pending++;this.images[d]=j;j.src=d}else this.images[d]=null}};this.fonts={template:function(){if(!ua)return null;var d=E.createElement("p");d.style.fontFamily="serif";d.style.fontSize="72px";d.style.visibility="hidden";d.innerHTML="This element is a text block for font loading";E.getElementsByTagName("body")[0].appendChild(d);return d}(),attempt:0,pending:function(){for(var d=!0,j=0;j=30){d=!0;for(j=0;j0;)g(v.shift())}function yc(){var c=["abs","acos","alpha", +"ambient","ambientLight","append","applyMatrix","arc","arrayCopy","asin","atan","atan2","background","beginCamera","beginDraw","beginShape","bezier","bezierDetail","bezierPoint","bezierTangent","bezierVertex","binary","blend","blendColor","blit_resize","blue","box","breakShape","brightness","camera","ceil","Character","color","colorMode","concat","console","constrain","copy","cos","createFont","createGraphics","createImage","cursor","curve","curveDetail","curvePoint","curveTangent","curveTightness", +"curveVertex","day","degrees","directionalLight","disableContextMenu","dist","draw","ellipse","ellipseMode","emissive","enableContextMenu","endCamera","endDraw","endShape","exit","exp","expand","externals","fill","filter","filter_bilinear","filter_new_scanline","floor","focused","frameCount","frameRate","frustum","get","glyphLook","glyphTable","green","height","hex","hint","hour","hue","image","imageMode","Import","intersect","join","key","keyCode","keyPressed","keyReleased","keyTyped","lerp","lerpColor", +"lightFalloff","lights","lightSpecular","line","link","loadBytes","loadFont","loadGlyphs","loadImage","loadPixels","loadShape","loadStrings","log","loop","mag","map","match","matchAll","max","millis","min","minute","mix","modelX","modelY","modelZ","modes","month","mouseButton","mouseClicked","mouseDragged","mouseMoved","mouseOut","mouseOver","mousePressed","mouseReleased","mouseScroll","mouseScrolled","mouseX","mouseY","name","nf","nfc","nfp","nfs","noCursor","noFill","noise","noiseDetail","noiseSeed", +"noLights","noLoop","norm","normal","noSmooth","noStroke","noTint","ortho","param","parseBoolean","parseByte","parseChar","parseFloat","parseInt","peg","perspective","PFont","PImage","pixels","PMatrix2D","PMatrix3D","PMatrixStack","pmouseX","pmouseY","point","pointLight","popMatrix","popStyle","pow","print","printCamera","println","printMatrix","printProjection","PShape","PShapeSVG","pushMatrix","pushStyle","quad","radians","random","Random","randomSeed","rect","rectMode","red","redraw","requestImage", +"resetMatrix","reverse","rotate","rotateX","rotateY","rotateZ","round","saturation","save","saveFrame","saveStrings","scale","screenX","screenY","screenZ","second","set","setup","shape","shapeMode","shared","shininess","shorten","sin","size","smooth","sort","specular","sphere","sphereDetail","splice","split","splitTokens","spotLight","sq","sqrt","status","str","stroke","strokeCap","strokeJoin","strokeWeight","subset","tan","text","textAlign","textAscent","textDescent","textFont","textLeading","textMode", +"textSize","texture","textureMode","textWidth","tint","touchCancel","touchEnd","touchMove","touchStart","translate","triangle","trim","unbinary","unhex","updatePixels","use3DContext","vertex","width","XMLElement","year","__contains","__equals","__frameRate","__hashCode","__int_cast","__instanceof","__keyPressed","__mousePressed","__printStackTrace","__replace","__replaceAll","__replaceFirst","__toCharArray","__split"],f={},g,p;g=0;for(p=c.length;g1&&!/^\[\s*\]$/.test(N[c[1]]))return a;return""+d}else return a}),a=a.replace(/\(int\)([^,\]\)\}\?\:\*\+\-\/\^\|\%\&\~<\>\=]+)/g,function(a,c){var d=f(c);return d.untrim("__int_cast("+d.middle+")")}),a=a.replace(/\bsuper(\s*"B\d+")/g,"$$superCstr$1").replace(/\bsuper(\s*\.)/g, +"$$super$1"),a=a.replace(/\b0+((\d*)(?:\.[\d*])?(?:[eE][\-\+]?\d+)?[fF]?)\b/,function(a,c,d){if(c===d)return a;return d===""?"0"+c:c}),a=a.replace(/\b(\.?\d+\.?)[fF]\b/g,"$1"),a=a.replace(/([^\s])%([^=\s])/g,"$1 % $2"),a=a.replace(/\b(frameRate|keyPressed|mousePressed)\b(?!\s*"B)/g,"__$1"),a=a.replace(/\b(boolean|byte|char|float|int)\s*"B/g,function(a,c){return"parse"+c.substring(0,1).toUpperCase()+c.substring(1)+'"B'}),a=a.replace(/\bpixels\s*(("C(\d+)")|\.length)?(\s*=(?!=)([^,\]\)\}]+))?/g,function(a, +c,d,Z,ia,xa){return d?(a=N[Z],ia?"pixels.setPixel"+J("("+a.substring(1,a.length-1)+","+xa+")","B"):"pixels.getPixel"+J("("+a.substring(1,a.length-1)+")","B")):c?"pixels.getLength"+J("()","B"):ia?"pixels.set"+J("("+xa+")","B"):"pixels.toArray"+J("()","B")}),B;do B=!1,a=a.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*\.\s*(?:[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*\.\s*)*)(replace|replaceAll|replaceFirst|contains|equals|hashCode|toCharArray|printStackTrace|split)\s*"B(\d+)"/g,c);while(B);do B= +!1,a=a.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*(?:\.\s*[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*)*)instanceof\s+([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)/g,d);while(B);return a=a.replace(/\bthis(\s*"B\d+")/g,"$$constr$1")}function Xc(a,c){this.baseInterfaceName=a;this.body=c;c.owner=this}function fa(a){var c=RegExp(/\bnew\s*([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)\s*"B\d+"\s*"A(\d+)"/).exec(a),a=za,d="class"+ ++ob;za=d;var B=c[1]+"$"+d,c=new Xc(B,fb(N[c[2]],B,"","implements "+ +c[1]));c.classId=d;c.scopeId=a;ba[d]=c;za=a;return c}function A(a,c,d){this.name=a;this.params=c;this.body=d}function L(a){a=RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/).exec(a);return new A(a[1]!=="function"?a[1]:null,ca(N[a[2]]),Oa(N[a[3]]))}function Xb(a){this.members=a}function X(a){for(var a=a.split(","),c=0;c=0&&a.indexOf(";")< +0?(a=a.substring(1,a.length-1).split(":"),new Qa(La(g(a[0])),Aa(a[1]))):(a=a.substring(1,a.length-1).split(";"),new Pa(La(g(a[0])),Aa(a[1]),Aa(a[2])))}function Ab(a){a.sort(function(a,c){return c.weight-a.weight})}function Ra(a,c,d){this.name=a;this.body=c;this.isStatic=d;c.owner=this}function H(a,c,d){this.name=a;this.body=c;this.isStatic=d;c.owner=this}function qa(a){var c=W.exec(a);W.lastIndex=0;var d=c[1].indexOf("static")>=0,B=N[s(c[6])],a=za,f="class"+ ++ob;za=f;c=c[2]==="interface"?new Ra(c[3], +hb(B,c[3],c[4]),d):new H(c[3],fb(B,c[3],c[4],c[5]),d);c.classId=f;c.scopeId=a;ba[f]=c;za=a;return c}function qb(a,c,d,B){this.name=a;this.params=c;this.body=d;this.isStatic=B}function rb(a){a=Ya.exec(a);Ya.lastIndex=0;var c=a[1].indexOf("static")>=0,d=a[6]!==";"?N[s(a[6])]:"{}";return new qb(a[3],ca(N[s(a[4])]),Oa(d),c)}function Ca(a,c,d){this.definitions=a;this.fieldType=c;this.isStatic=d}function Ia(a){for(var c=Za.exec(a),d=c[1].indexOf("static")>=0,a=a.substring(c[0].length).split(/,\s*/g),B= +hc(c[2]),f=0;f([=]?)/g,$a);while(jb);var N=function(a){for(var c=[],a=a.split(/([\{\[\(\)\]\}])/),d=a[0],f=[],g=1;g=0&&(a=a.substring(0,a.indexOf("=")));return"("+a+" in "+this.container+")"};Qa.iteratorId=0;Qa.prototype.toString=function(){var a=this.initStatement.toString(),c="$it"+Qa.iteratorId++,a=a.replace(/^\s*var\s*/, +"").split("=")[0];return"("+("var "+c+" = new $p.ObjectIterator("+this.container+"), "+a+" = void(0)")+"; "+(c+".hasNext() && (("+a+" = "+c+".next()) || true)")+";)"};Ra.prototype.toString=function(){return""+this.body};H.prototype.toString=function(){return""+this.body};qb.prototype.toString=function(){var a=v({},this.params.getNames()),c=T;T=function(d){return a.hasOwnProperty(d.name)?d.name:c(d)};var d="function "+this.methodId+this.params+" "+this.body+"\n";T=c;return d};Ca.prototype.getNames= +function(){for(var a=[],c=0,d=this.definitions.length;c0&&(d+=this.functions.join("\n")+"\n");Ab(this.innerClasses);q=0;for(da=this.innerClasses.length;q< +da;++q)w=this.innerClasses[q],w.isStatic?(f+=c+"."+w.name+" = "+w+";\n",d+=a+"."+w.name+" = "+c+"."+w.name+";\n"):d+=a+"."+w.name+" = "+w+";\n";q=0;for(da=this.fields.length;q0&&(d+=this.cstrs.join("\n")+"\n");d+="function $constr() {\n";w=[];q=0;for(da=this.cstrs.length;q0&&(d+=w.join(" else ")+" else ");d+="$superCstr();\n}\n";d+="$constr.apply(null, arguments);\n";T=ca;return"(function() {\nfunction "+c+"() {\n"+d+"}\n"+f+i+"return "+c+";\n})()"};fb=function(a,c,d,i){var a=a.substring(1,a.length-1),a=w(a),a=x(a,c),g=[],s=[],Q=[],v=[],a=a.replace(/"([DEGH])(\d+)"/g,function(a,c,d){c==="D"?g.push(d):c==="E"?s.push(d):c==="H"?v.push(d):Q.push(d);return""}),a=a.replace(/^(?:\s*;)+/,"").split(/;(?:\s*;)*/g), +q,ca;d!==p&&(q=d.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g,"$1"));i!==p&&(ca=i.replace(/^\s*implements\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g));for(d=0;d0){s=0;for(v=g.length;s0)f.interfaces=i}}})(i);(function(){function a(c,f){var g=d[c];if(!g)return!1; +var i=g.indexOf(f);if(i<0)return!1;g.splice(i,1);if(g.length>0)return!1;delete d[c];return!0}var c=[],d={},f,i,g;for(f in ba)if(ba.hasOwnProperty(f))if(g=ba[f],!g.inScope&&!g.derived)c.push(f),g.weight=0;else{var s=[];if(g.inScope)for(i in g.inScope)g.inScope.hasOwnProperty(i)&&s.push(g.inScope[i]);g.derived&&(s=s.concat(g.derived));d[f]=s}for(;c.length>0;){f=c.shift();g=ba[f];if(g.scopeId&&a(g.scopeId,g))c.push(g.scopeId),ba[g.scopeId].weight=g.weight+1;if(g.base&&a(g.base.classId,g))c.push(g.base.classId), +g.base.weight=g.weight+1;if(g.interfaces){f=0;for(i=g.interfaces.length;f0&&typeof arguments[0]!=="number"?g=arguments[0].toArray():(g=[],g.length=0|arguments[0]);this.get=function(c){return g[c]}; +this.contains=function(c){return this.indexOf(c)>-1};this.indexOf=function(c){for(var f=0,i=g.length;f=0&&c<=g.length)g.splice(c,0,arguments[1]);else throw c+" is not a valid index";else throw typeof c+" is not a number";}else throw"Please use the proper number of parameters.";};this.addAll=function(c,f){var i;if(typeof c=== +"number"){if(c<0||c>g.length)throw"Index out of bounds for addAll: "+c+" greater or equal than "+g.length;for(i=new Ib(f);i.hasNext();)g.splice(c++,0,i.next())}else for(i=new Ib(c);i.hasNext();)g.push(i.next())};this.set=function(){if(arguments.length===2){var c=arguments[0];if(typeof c==="number")if(c>=0&&c-1)return g.splice(c,1),!0;return!1}};this.isEmpty=function(){return!g.length};this.clone=function(){return new f(this)};this.toArray=function(){return g.slice(0)};this.iterator=function(){return new c(g)}}return f}(),Gc=function(){function c(){function f(c){c=xc(c)%x.length;return c<0?x.length+c:c}function g(){if(!(A<=w*x.length)){for(var c=[],i=0;i=x.length)q=!0;else if(x[i]===p||s>=x[i].length)s=-1,++i;else break}var i=0,s=-1,q=!1;this.hasNext=function(){return!q};this.next=function(){var f=c(x[i][s]);g();return f};this.remove=function(){f(this.next());--s};g()}function q(c,f,g){this.clear=function(){G.clear()};this.contains=function(c){return f(c)};this.containsAll= +function(c){for(c=c.iterator();c.hasNext();)if(!this.contains(c.next()))return!1;return!0};this.isEmpty=function(){return G.isEmpty()};this.iterator=function(){return new v(c,g)};this.remove=function(c){if(this.contains(c))return g(c),!0;return!1};this.removeAll=function(c){for(c=c.iterator();c.hasNext();){var f=c.next();this.contains(f)&&g(f)}return!0};this.retainAll=function(c){for(var f=this.iterator(),i=[];f.hasNext();){var s=f.next();c.contains(s)||i.push(s)}for(c=0;c +0};this.size=function(){return G.size()};this.toArray=function(){for(var c=[],f=this.iterator();f.hasNext();)c.push(f.next());return c}}function s(c){this._isIn=function(f){return f===G&&c.removed===p};this.equals=function(f){return qa(c.key,f.getKey())};this.getKey=function(){return c.key};this.getValue=function(){return c.value};this.hashCode=function(){return xc(c.key)};this.setValue=function(f){var g=c.value;c.value=f;return g}}if(arguments.length===1&&arguments[0].constructor===c)return arguments[0].clone(); +var z=arguments.length>0?arguments[0]:16,w=arguments.length>1?arguments[1]:0.75,x=[];x.length=z;var A=0,G=this;this.clear=function(){A=0;x=[];x.length=z};this.clone=function(){var f=new c;f.putAll(this);return f};this.containsKey=function(c){var g=f(c),g=x[g];if(g===p)return!1;for(var i=0;i1?i.splice(s,1):x[g]=p,c;return null};this.size=function(){return A}; +this.values=function(){for(var c=[],f=this.entrySet().iterator();f.hasNext();){var g=f.next();c.push(g.getValue())}return c}}return c}(),aa=function(){function c(f,g,i){this.x=f||0;this.y=g||0;this.z=i||0}function f(c){return function(f,g){var i=f.get();i[c](g);return i}}function p(c){return function(f,g){return f[c](g)}}var v="dist dot cross".split(" "),q=v.length;c.angleBetween=function(c,f){return g.acos(c.dot(f)/(c.mag()*f.mag()))};for(c.prototype={set:function(c,f,g){arguments.length===1?this.set(c.x|| +c[0]||0,c.y||c[1]||0,c.z||c[2]||0):(this.x=c,this.y=f,this.z=g)},get:function(){return new c(this.x,this.y,this.z)},mag:function(){return g.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},add:function(c,f,g){arguments.length===3?(this.x+=c,this.y+=f,this.z+=g):arguments.length===1&&(this.x+=c.x,this.y+=c.y,this.z+=c.z)},sub:function(c,f,g){arguments.length===3?(this.x-=c,this.y-=f,this.z-=g):arguments.length===1&&(this.x-=c.x,this.y-=c.y,this.z-=c.z)},mult:function(c){typeof c==="number"?(this.x*= +c,this.y*=c,this.z*=c):typeof c==="object"&&(this.x*=c.x,this.y*=c.y,this.z*=c.z)},div:function(c){typeof c==="number"?(this.x/=c,this.y/=c,this.z/=c):typeof c==="object"&&(this.x/=c.x,this.y/=c.y,this.z/=c.z)},dist:function(c){var f=this.x-c.x,i=this.y-c.y,c=this.z-c.z;return g.sqrt(f*f+i*i+c*c)},dot:function(c,f,g){if(arguments.length===3)return this.x*c+this.y*f+this.z*g;else if(arguments.length===1)return this.x*c.x+this.y*c.y+this.z*c.z},cross:function(f){return new c(this.y*f.z-f.y*this.z,this.z* +f.x-f.z*this.x,this.x*f.y-f.x*this.y)},normalize:function(){var c=this.mag();c>0&&this.div(c)},limit:function(c){this.mag()>c&&(this.normalize(),this.mult(c))},heading2D:function(){return-g.atan2(-this.y,this.x)},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};q--;)c[v[q]]=p(v[q]);for(q in c.prototype)c.prototype.hasOwnProperty(q)&&!c.hasOwnProperty(q)&&(c[q]=f(q));return c}();Wb.prototype=c;var la=new Wb;la.ArrayList=Fc;la.HashMap= +Gc;la.PVector=aa;la.ObjectIterator=Ib;la.defineProperty=function(c,f,g){"defineProperty"in Object?Object.defineProperty(c,f,g):(g.hasOwnProperty("get")&&c.__defineGetter__(f,g.get),g.hasOwnProperty("set")&&c.__defineSetter__(f,g.set))};la.extendClassChain=function(c){for(var f=[c],g=c.$upcast;g;g=g.$upcast)xb(g,c),f.push(g),c=g;for(;f.length>0;)f.pop().$self=c};la.extendStaticMembers=function(c,f){xb(c,f)};la.extendInterfaceMembers=function(c,f){xb(c,f)};la.addMethod=function(c,f,g){if(c[f]){var p= +g.length,q=c[f];c[f]=function(){return arguments.length===p?g.apply(this,arguments):q.apply(this,arguments)}}else c[f]=g};la.createJavaArray=function(c,f){var g=null;if(typeof f[0]==="number"){var p=0|f[0];if(f.length<=1){g=[];g.length=p;for(var q=0;q255?255:e)<<24&c.ALPHA_MASK|(b>255?255:b)<<16&c.RED_MASK|(k>255?255:k)<<8&c.GREEN_MASK|(m>255?255:m)&c.BLUE_MASK}function zb(){d.restore();Ga=Db=!0}function G(b,k,a){b.addEventListener?b.addEventListener(k, +a,!1):b.attachEvent("on"+k,a);Kb.push({elem:b,type:k,fn:a})}function ca(b){var k=b.elem,a=b.type,b=b.fn;k.removeEventListener?k.removeEventListener(a,b,!1):k.detachEvent&&k.detachEvent("on"+a,b)}function da(b,k){var a=1;a<<=k-1;for(var c="",h=0;h>>=1;return c}function qa(b,k,a,c,h,d){k=b<0?a:k;a=h===0;h=h===p||h<0?0:h;b=g.abs(b);if(a){h=1;for(b*=10;g.abs(g.round(b)-b)>1.0E-6&&h<7;)++h,b*=10}else h!==0&&(b*=g.pow(10,h));a=b*2;g.floor(b)===b?a=b:g.floor(a)===a?(b=g.floor(b), +a=b+b%2):a=g.round(b);b="";for(c+=h;c>0||a>0;)c--,b=""+a%10+b,a=g.floor(a/10);if(d!==p)for(c=b.length-3-h;c>0;)b=b.substring(0,c)+d+b.substring(c),c-=3;return h>0?k+b.substring(0,b.length-h)+"."+b.substring(b.length-h,b.length):k+b}function fa(b,k,a,c,h,d){if(b instanceof Array){for(var j=[],l=0,y=b.length;l2147483647&&(b-=4294967296);return b}function gb(b){return Array.prototype.slice.call(b, +1)}function Xb(b){if(typeof b==="number")return b!==0;else if(typeof b==="boolean")return b;else if(typeof b==="string")return b.toLowerCase()==="true";else if(b instanceof ya)return b.code===49||b.code===84||b.code===116}function Zc(b){if(typeof b==="number")return b;else if(typeof b==="boolean")return b?1:0;else if(typeof b==="string")return parseFloat(b);else if(b instanceof ya)return b.code}function pb(b,k){if(typeof b==="number")return b&4294967295;else if(typeof b==="boolean")return b?1:0;else if(typeof b=== +"string")return parseInt(b,k||10)&4294967295;else if(b instanceof ya)return b.code}function ha(b,k){var a=b||362436069,c=k||521288629,h=function(){a=36969*(a&65535)+(a>>>16)&4294967295;c=18E3*(c&65535)+(c>>>16)&4294967295;return((a&65535)<<16|c&65535)&4294967295};this.nextDouble=function(){var b=h()/4294967296;return b<0?1+b:b};this.nextInt=h}function Ia(b){function k(b,k,a,m){b&=15;var c=b<8?k:a,k=b<4?a:b===12||b===14?k:m;return((b&1)===0?c:-c)+((b&2)===0?k:-k)}function a(b,k,m){k=(b&1)===0?k:m; +return(b&2)===0?-k:k}function c(b,k,a){return k+b*(a-k)}var b=b!==p?new ha(b):ha.createRandomized(),h,d,j=new $c(512);for(h=0;h<256;++h)j[h]=h;for(h=0;h<256;++h){var l=j[d=b.nextInt()&255];j[d]=j[h];j[h]=l}for(h=0;h<256;++h)j[h+256]=j[h];this.noise3d=function(b,a,m){var h=g.floor(b)&255,d=g.floor(a)&255,r=g.floor(m)&255;b-=g.floor(b);a-=g.floor(a);m-=g.floor(m);var l=(3-2*b)*b*b,f=(3-2*a)*a*a,i=j[h]+d,o=j[i]+r,i=j[i+1]+r,d=j[h+1]+d,h=j[d]+r,r=j[d+1]+r;return c((3-2*m)*m*m,c(f,c(l,k(j[o],b,a,m),k(j[h], +b-1,a,m)),c(l,k(j[i],b,a-1,m),k(j[r],b-1,a-1,m))),c(f,c(l,k(j[o+1],b,a,m-1),k(j[h+1],b-1,a,m-1)),c(l,k(j[i+1],b,a-1,m-1),k(j[r+1],b-1,a-1,m-1))))};this.noise2d=function(b,k){var h=g.floor(b)&255,d=g.floor(k)&255;b-=g.floor(b);k-=g.floor(k);var r=(3-2*b)*b*b,l=j[h]+d,h=j[h+1]+d;return c((3-2*k)*k*k,c(r,a(j[l],b,k),a(j[h],b-1,k)),c(r,a(j[l+1],b,k-1),a(j[h+1],b-1,k-1)))};this.noise1d=function(b){var k=g.floor(b)&255;b-=g.floor(b);return c((3-2*b)*b*b,(j[k]&1)===0?-b:b,(j[k+1]&1)===0?-(b-1):b-1)}}function ea(){if(U){if(Ga)d.fillStyle= +a.color.toString(Fa),Ga=!1;d.fill()}}function Y(){if(O){if(Db)d.strokeStyle=a.color.toString(ka),Db=!1;d.stroke()}}function hc(b,k,m){m=0|m*((k&c.ALPHA_MASK)>>>24);return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.mix(b&c.RED_MASK,k&c.RED_MASK,m)&c.RED_MASK|a.mix(b&c.GREEN_MASK,k&c.GREEN_MASK,m)&c.GREEN_MASK|a.mix(b&c.BLUE_MASK,k&c.BLUE_MASK,m)}function ma(b,k,a){var c=ad.shift();if(c===p)c={},c.canvas=A.createElement("canvas"),c.context=c.canvas.getContext("2d");ad.push(c);var h=c.canvas,d=c.context, +k=k||b.width,a=a||b.height;h.width=k;h.height=a;b?"data"in b?d.putImageData(b,0,0):(d.clearRect(0,0,k,a),d.drawImage(b,0,0,k,a)):d.clearRect(0,0,k,a);return c}function Ba(){bc&&(d=bd,bc=!1,a.updatePixels())}function La(){function b(b,k){b[k]=function(){Ba();d[k].apply(d,arguments)}}function k(b,k){a.defineProperty(b,k,{get:function(){Ba();return d[k]},set:function(b){Ba();d[k]=b}})}for(var m in d)typeof d[m]==="function"?b(this,m):k(this,m)}function Pa(b){this.name="sans-serif";if(b!==p)switch(b){case "sans-serif":case "serif":case "monospace":case "fantasy":case "cursive":this.name= +b;break;default:this.name='"'+b+'", sans-serif'}this.origName=b}function Ea(b){return b instanceof String?b:typeof b==="number"?b===(0|b)?b.toString():a.nf(b,0,3):b===null||b===p?"":b.toString()}function Qa(b,k,a,c){this.canvas=A.createElement("canvas");this.canvas.setAttribute("width",k+"px");this.canvas.setAttribute("height",k+"px");this.ctx=this.canvas.getContext("2d");this.ctx.font=k+"pt "+b;this.ctx.fillStyle="black";this.ctx.fillRect(0,0,k,k);this.ctx.fillStyle="white";this.ctx.fillText(c,0, +a);this.imageData=this.ctx.getImageData(0,0,k,k);this.get=function(b,k){return this.imageData.data[k*this.imageData.width*4+b*4]}}function ic(b,k,a,e){var h;b.indexOf("\n")<0?(b=[b],h=1):(b=b.split(/\r?\n/g),h=b.length);var d;d=Lb===c.TOP?(1-mc)*eb:Lb===c.CENTER?(1-mc-h/2)*eb:Lb===c.BOTTOM?(1-mc-h)*eb:0;for(var j=0;jh)){var j=-1,l=0,y=0,f=0;d.font=S+"px "+ja.name;for(var g=[],i=0,n=b.length;i< +n;i++){var o=b[i],p=o===" ",q=d.measureText(o).width;if(o!=="\n"&&y+q0)j=i;else return;o==="\n"?(g.push({text:b.substring(l,i),width:y,offset:f}),l=i+1):(g.push({text:b.substring(l,j),width:y,offset:f}),l=j+1);f+=eb;y=0;i=l-1}}lh)break;ga.text$line(f.text,k+b,a+f.offset+e+j,r,Mb)}}}function Ra(b){ga=b==="3D"?new I:b==="2D"?new E:new D;for(var k in D.prototype)D.prototype.hasOwnProperty(k)&&k.indexOf("$")<0&&(a[k]=ga[k]);ga.$init()}function H(b){return function(){Ra("2D");return ga[b].apply(this,arguments)}}function wa(b){var k=b,m=0,c=0;a.pmouseX=a.mouseX;a.pmouseY=a.mouseY;if(k.offsetParent){do m+=k.offsetLeft,c+=k.offsetTop;while(k=k.offsetParent)}k=b;do m-=k.scrollLeft||0,c-=k.scrollTop||0;while(k=k.parentNode);m+= +cd;c+=dd;m+=ed;c+=fd;m+=X.pageXOffset;c+=X.pageYOffset;return{X:m,Y:c}}function qb(b,k){var m=wa(b,k);a.mouseX=k.pageX-m.X;a.mouseY=k.pageY-m.Y}function rb(b){var k=wa(b.changedTouches[0].target,b.changedTouches[0]),a;for(a=0;a cos( light.angle ) ) { spotAttenuation = pow( spotDot, light.concentration ); } else{ spotAttenuation = 0.0; } attenuation *= spotAttenuation;")+" float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0 ) { powerfactor = 0.0; } else { powerfactor = pow( nDotHV, shininess ); } spec += specular * powerfactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0, 0.0, 0.0 ); vec3 finalDiffuse = vec3( 0.0, 0.0, 0.0 ); vec3 finalSpecular = vec3( 0.0, 0.0, 0.0 ); vec4 col = color; if(color[0] == -1.0){ col = aColor; } vec3 norm = normalize(vec3( normalTransform * vec4( Normal, 0.0 ) )); vec4 ecPos4 = view * model * vec4(Vertex,1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( lightCount == 0 ) { frontColor = col + vec4(mat_specular,1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= lightCount ){ break; } if( l.type == 0 ) { AmbientLight( finalAmbient, ecPos, l ); } else if( l.type == 1 ) { DirectionalLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else if( l.type == 2 ) { PointLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else { SpotLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } } if( usingMat == false ) { frontColor = vec4( vec3(col) * finalAmbient + vec3(col) * finalDiffuse + vec3(col) * finalSpecular, col[3] ); } else{ frontColor = vec4( mat_emissive + (vec3(col) * mat_ambient * finalAmbient) + (vec3(col) * finalDiffuse) + (mat_specular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = projection * view * model * vec4( Vertex, 1.0 );}", +td=function(b,k,a,c){return{x:b,y:k,w:a,h:c}},tc=td,Gc=function(b,k,a,c,h){return{x:b,y:k,w:h?a:a-b,h:h?c:c-k}},Ed=function(b,k,a,c){return{x:b-a/2,y:k-c/2,w:a,h:c}},Vc=function(b,k,a){var c=b.createShader(b.VERTEX_SHADER);b.shaderSource(c,k);b.compileShader(c);if(!b.getShaderParameter(c,b.COMPILE_STATUS))throw b.getShaderInfoLog(c);k=b.createShader(b.FRAGMENT_SHADER);b.shaderSource(k,a);b.compileShader(k);if(!b.getShaderParameter(k,b.COMPILE_STATUS))throw b.getShaderInfoLog(k);a=b.createProgram(); +b.attachShader(a,c);b.attachShader(a,k);b.linkProgram(a);if(!b.getProgramParameter(a,b.LINK_STATUS))throw"Error linking shaders.";return a},M=function(){},E=function(){},I=function(){},D=function(){};E.prototype=new M;E.prototype.constructor=E;I.prototype=new M;I.prototype.constructor=I;D.prototype=new M;D.prototype.constructor=D;M.prototype.a3DOnlyFunction=function(){};var Wc={},ya=a.Character=function(b){this.code=typeof b==="string"&&b.length===1?b.charCodeAt(0):typeof b==="number"?b:b instanceof +ya?b:NaN;return Wc[this.code]===p?Wc[this.code]=this:Wc[this.code]};ya.prototype.toString=function(){return String.fromCharCode(this.code)};ya.prototype.valueOf=function(){return this.code};var fc=a.PShape=function(b){this.family=b||c.GROUP;this.style=this.visible=!0;this.children=[];this.nameTable=[];this.params=[];this.name="";this.parent=this.height=this.width=this.close=this.kind=this.matrix=this.image=null};fc.prototype={isVisible:function(){return this.visible},setVisible:function(b){this.visible= +b},disableStyle:function(){this.style=!1;for(var b=0,k=this.children.length;b0){k=0;for(a=this.nameTable.length;k, it's <"+this.element.getName()+">";}else if(arguments.length===2)if(typeof arguments[1]==="string"){if(arguments[1].indexOf(".svg")>-1)this.element=new a.XMLElement(null,arguments[1]),this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=c.ALPHA_MASK,this.strokeWeight=1,this.strokeCap=c.SQUARE,this.strokeJoin=c.MITER,this.strokeName= +this.strokeGradientPaint=this.strokeGradient="",this.strokeOpacity=1,this.fill=!0,this.fillColor=c.ALPHA_MASK,this.fillGradientPaint=this.fillGradient=null,this.fillOpacity=1}else if(arguments[0])this.element=arguments[1],this.vertexCodes=arguments[0].vertexCodes.slice(),this.vertices=arguments[0].vertices.slice(),this.stroke=arguments[0].stroke,this.strokeColor=arguments[0].strokeColor,this.strokeWeight=arguments[0].strokeWeight,this.strokeCap=arguments[0].strokeCap,this.strokeJoin=arguments[0].strokeJoin, +this.strokeGradient=arguments[0].strokeGradient,this.strokeGradientPaint=arguments[0].strokeGradientPaint,this.strokeName=arguments[0].strokeName,this.fill=arguments[0].fill,this.fillColor=arguments[0].fillColor,this.fillGradient=arguments[0].fillGradient,this.fillGradientPaint=arguments[0].fillGradientPaint,this.fillName=arguments[0].fillName,this.strokeOpacity=arguments[0].strokeOpacity,this.fillOpacity=arguments[0].fillOpacity,this.opacity=arguments[0].opacity;this.name=this.element.getStringAttribute("id"); +this.visible=this.element.getStringAttribute("display","inline")!=="none";var b=this.element.getAttribute("transform");if(b)this.matrix=this.parseMatrix(b);b=this.element.getStringAttribute("viewBox");if(b!==null)b=b.split(" "),this.width=b[2],this.height=b[3];var b=this.element.getStringAttribute("width"),k=this.element.getStringAttribute("height");if(b!==null)this.width=this.parseUnitSize(b),this.height=this.parseUnitSize(k);else if(this.width===0||this.height===0)throw this.height=this.width=1, +"The width and/or height is not readable in the tag of this file.";this.parseColors(this.element);this.parseChildren(this.element)};R.prototype=new fc;R.prototype.parseMatrix=function(){function b(b){var a=[];b.replace(/\((.*?)\)/,function(){return function(b,k){a=k.replace(/,+/g," ").split(/\s+/)}}());return a}return function(k){this.checkMatrix(2);var c=[];k.replace(/\s*(\w+)\((.*?)\)/g,function(b){c.push(a.trim(b))});if(c.length===0)return null;for(var k=0,e=c.length;k=65&&g<=90||g>=97&&g<=122){t=f;f++;if(f=65&&g<=90||g>=97&&g<=100||g>=102&&g<=122)&&o===!1;)g===32?i!==""&& +(n.push(parseFloat(i)),i=""):g===45?b[f-1].valueOf()===101?i+=b[f].toString():(i!==""&&n.push(parseFloat(i)),i=b[f].toString()):i+=b[f].toString(),f++,f===b.length?o=!0:g=b[f].valueOf()}i!==""&&(n.push(parseFloat(i)),i="");q=b[t];g=q.valueOf();if(g===77){if(n.length>=2&&n.length%2===0&&(k=n[0],m=n[1],this.parsePathMoveto(k,m),n.length>2)){t=2;for(g=n.length;t=2&&n.length%2===0&&(k+=n[0],m+=n[1],this.parsePathMoveto(k, +m),n.length>2)){t=2;for(g=n.length;t=2&&n.length%2===0){t=0;for(g=n.length;t=2&&n.length%2===0){t=0;for(g=n.length;t=6&&n.length%6===0){t=0;for(g=n.length;t=6&&n.length%6===0){t=0;for(g=n.length;t=4&&n.length%4===0){t=0;for(g=n.length;t=4&& +n.length%4===0){t=0;for(g=n.length;t=4&&n.length%4=== +0){t=0;for(g=n.length;t=4&&n.length%4===0){t=0;for(g=n.length;t=2&&n.length%2===0){t=0;for(g=n.length;t=2&&n.length%2===0){t=0;for(g=n.length;t0)this.parsePathCode(c.BEZIER_VERTEX),this.parsePathVertex(b+(a-b)*2/3,k+(e-k)*2/3),this.parsePathVertex(h+(a-h)*2/3,d+(e-d)*2/3),this.parsePathVertex(h,d);else throw"Path must start with M/m";};R.prototype.parsePathCurveto=function(b,a,m,e,h,d){if(this.vertices.length>0)this.parsePathCode(c.BEZIER_VERTEX),this.parsePathVertex(b,a),this.parsePathVertex(m, +e),this.parsePathVertex(h,d);else throw"Path must start with M/m";};R.prototype.parsePathLineto=function(b,a){if(this.vertices.length>0)this.parsePathCode(c.VERTEX),this.parsePathVertex(b,a),this.vertices[this.vertices.length-1].moveTo=!1;else throw"Path must start with M/m";};R.prototype.parsePathMoveto=function(b,a){this.vertices.length>0&&this.parsePathCode(c.BREAK);this.parsePathCode(c.VERTEX);this.parsePathVertex(b,a);this.vertices[this.vertices.length-1].moveTo=!0};R.prototype.parsePathVertex= +function(b,a){var c=[];c[0]=b;c[1]=a;this.vertices.push(c)};R.prototype.parsePathCode=function(b){this.vertexCodes.push(b)};R.prototype.parsePoly=function(b){this.family=c.PATH;this.close=b;b=a.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(b!==null)if(b=b.split(" "),b.length%2===0)for(var k=0,m=b.length;k";};R.prototype.parseEllipse=function(b){this.kind=c.ELLIPSE;this.family=c.PRIMITIVE;this.params=[];this.params[0]=this.element.getFloatAttribute("cx")| +0;this.params[1]=this.element.getFloatAttribute("cy")|0;var a;if(b){if(b=a=this.element.getFloatAttribute("r"),b<0)throw"svg error: negative radius found while parsing ";}else if(b=this.element.getFloatAttribute("rx"),a=this.element.getFloatAttribute("ry"),b<0||a<0)throw"svg error: negative x-axis radius or y-axis radius found while parsing ";this.params[0]-=b;this.params[1]-=a;this.params[2]=b*2;this.params[3]=a*2};R.prototype.parseLine=function(){this.kind=c.LINE;this.family=c.PRIMITIVE; +this.params=[];this.params[0]=this.element.getFloatAttribute("x1");this.params[1]=this.element.getFloatAttribute("y1");this.params[2]=this.element.getFloatAttribute("x2");this.params[3]=this.element.getFloatAttribute("y2")};R.prototype.parseColors=function(b){b.hasAttribute("opacity")&&this.setOpacity(b.getAttribute("opacity"));b.hasAttribute("stroke")&&this.setStroke(b.getAttribute("stroke"));b.hasAttribute("stroke-width")&&this.setStrokeWeight(b.getAttribute("stroke-width"));b.hasAttribute("stroke-linejoin")&& +this.setStrokeJoin(b.getAttribute("stroke-linejoin"));b.hasAttribute("stroke-linecap")&&this.setStrokeCap(b.getStringAttribute("stroke-linecap"));b.hasAttribute("fill")&&this.setFill(b.getStringAttribute("fill"));if(b.hasAttribute("style"))for(var b=b.getStringAttribute("style").toString().split(";"),k=0,c=b.length;k=1&&arguments[0]!==null&&b.isVisible()&&(a.pushMatrix(),ec===c.CENTER?arguments.length===5?(a.translate(k-e/2,m-h/2),a.scale(e/b.getWidth(),h/b.getHeight())):arguments.length===3?a.translate(k-b.getWidth()/2,-b.getHeight()/2):a.translate(-b.getWidth()/2,-b.getHeight()/2):ec===c.CORNER?arguments.length===5?(a.translate(k,m),a.scale(e/b.getWidth(),h/b.getHeight())):arguments.length===3&&a.translate(k,m):ec===c.CORNERS&&(arguments.length===5?(e-=k,h-=m,a.translate(k, +m),a.scale(e/b.getWidth(),h/b.getHeight())):arguments.length===3&&a.translate(k,m)),b.draw(),(arguments.length===1&&ec===c.CENTER||arguments.length>1)&&a.popMatrix())};a.shapeMode=function(b){ec=b};a.loadShape=function(b){if(arguments.length===1&&b.indexOf(".svg")>-1)return new R(null,b);return null};var uc=function(b,a,c,e,h){this.fullName=b||"";this.name=a||"";this.namespace=c||"";this.value=e;this.type=h};uc.prototype={getName:function(){return this.name},getFullName:function(){return this.fullName}, +getNamespace:function(){return this.namespace},getValue:function(){return this.value},getType:function(){return this.type},setValue:function(b){this.value=b}};var mb=a.XMLElement=function(){this.attributes=[];this.children=[];this.name=this.fullName=null;this.namespace="";this.parent=this.content=null;this.systemID=this.lineNr="";this.type="ELEMENT";if(arguments.length===4){this.fullName=arguments[0]||"";if(arguments[1])this.name=arguments[1];else{var b=this.fullName.indexOf(":");this.name=b>=0?this.fullName.substring(b+ +1):this.fullName}this.namespace=arguments[1];this.lineNr=arguments[3];this.systemID=arguments[2]}else arguments.length===2&&arguments[1].indexOf(".")>-1?this.parse(arguments[arguments.length-1]):arguments.length===1&&typeof arguments[0]==="string"&&this.parse(arguments[0])};mb.prototype={parse:function(b){var a;try{if(b.indexOf(".xml")>-1||b.indexOf(".svg")>-1)b=Ec(b);a=(new DOMParser).parseFromString(b,"text/xml");var c=a.documentElement;if(c)this.parseChildrenRecursive(null,c);else throw"Error loading document"; +return this}catch(e){throw e;}},parseChildrenRecursive:function(b,a){var c,e,h,d;b?(c=new mb(a.localName,a.nodeName,"",""),c.parent=b):(this.fullName=a.localName,this.name=a.nodeName,c=this);if(a.nodeType===3&&a.textContent!=="")return this.createPCDataElement(a.textContent);h=0;for(d=a.attributes.length;h0){a=0;for(c=this.children.length;a +0},addChild:function(b){if(b!==null)b.parent=this,this.children.push(b)},insertChild:function(b,a){if(b){if(b.getLocalName()===null&&!this.hasChildren()){var c=this.children[this.children.length-1];if(c.getLocalName()===null){c.setContent(c.getContent()+b.getContent());return}}b.parent=this;this.children.splice(a,0,b)}},getChild:function(b){if(typeof b==="number")return this.children[b];else if(b.indexOf("/")!==-1)this.getChildRecursive(b.split("/"),0);else{for(var a,c,e=0,h=this.getChildCount();e< +h;e++)if(a=this.getChild(e),c=a.getName(),c!==null&&c===b)return a;return null}},getChildren:function(){if(arguments.length===1)if(typeof arguments[0]==="number")return this.getChild(arguments[0]);else if(arguments[0].indexOf("/")!==-1)return this.getChildrenRecursive(arguments[0].split("/"),0);else{for(var b=[],a,c,e=0,h=this.getChildCount();eb&&this.children.splice(b,1)},findAttribute:function(b, +a){this.namespace=a||"";for(var c=0,e=this.attributes.length;c0&&z.debug("Tried to set content for XMLElement with children");this.content=b},setName:function(){if(arguments.length===1)this.name=arguments[0],this.fullName=arguments[0],this.namespace=null;else{var b= +arguments[0].indexOf(":");this.name=arguments[1]===null||b<0?arguments[0]:arguments[0].substring(b+1);this.fullName=arguments[0];this.namespace=arguments[1]}},getName:function(){return this.fullName},getLocalName:function(){return this.name},getAttributeCount:function(){return this.attributes.length},toString:function(){if(this.type==="TEXT")return this.content;var b=(this.namespace!==""&&this.namespace!==this.name?this.namespace+":":"")+this.name,a="<"+b,c;for(c=0;c":">"+this.content+"";else{a+=">";for(c=0;c"}return a}};mb.parse=function(b){var a=new mb;a.parse(b);return a};var ud=function(b){for(var a=0,c=0;cc.MIN_INT){var a=this.elements[0],m=this.elements[1],e=this.elements[2],h=this.elements[3],d=this.elements[4],j=this.elements[5];this.elements[0]=d/b;this.elements[3]=-h/b;this.elements[1]=-m/b;this.elements[4]=a/b;this.elements[2]=(m*j-d*e)/b;this.elements[5]=(h*e-a*j)/b;return!0}return!1}, +scale:function(b,a){b&&!a&&(a=b);b&&a&&(this.elements[0]*=b,this.elements[1]*=a,this.elements[3]*=b,this.elements[4]*=a)},invScale:function(b,a){b&&!a&&(a=b);this.scale(1/b,1/a)},apply:function(){var b;arguments.length===1&&arguments[0]instanceof ab?b=arguments[0].array():arguments.length===6?b=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(b=arguments[0]);for(var a=[0,0,this.elements[2],0,0,this.elements[5]],c=0,e=0;e<2;e++)for(var h=0;h<3;h++,c++)a[c]+= +this.elements[e*3+0]*b[h+0]+this.elements[e*3+1]*b[h+3];this.elements=a.slice()},preApply:function(){var b;arguments.length===1&&arguments[0]instanceof ab?b=arguments[0].array():arguments.length===6?b=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(b=arguments[0]);var a=[0,0,b[2],0,0,b[5]];a[2]=b[2]+this.elements[2]*b[0]+this.elements[5]*b[1];a[5]=b[5]+this.elements[2]*b[3]+this.elements[5]*b[4];a[0]=this.elements[0]*b[0]+this.elements[3]*b[1];a[3]=this.elements[0]* +b[3]+this.elements[3]*b[4];a[1]=this.elements[1]*b[0]+this.elements[4]*b[1];a[4]=this.elements[1]*b[3]+this.elements[4]*b[4];this.elements=a.slice()},rotate:function(b){var a=g.cos(b),b=g.sin(b),c=this.elements[0],e=this.elements[1];this.elements[0]=a*c+b*e;this.elements[1]=-b*c+a*e;c=this.elements[3];e=this.elements[4];this.elements[3]=a*c+b*e;this.elements[4]=-b*c+a*e},rotateZ:function(b){this.rotate(b)},invRotateZ:function(b){this.rotateZ(b-g.PI)},print:function(){var b=ud(this.elements),b=""+ +a.nfs(this.elements[0],b,4)+" "+a.nfs(this.elements[1],b,4)+" "+a.nfs(this.elements[2],b,4)+"\n"+a.nfs(this.elements[3],b,4)+" "+a.nfs(this.elements[4],b,4)+" "+a.nfs(this.elements[5],b,4)+"\n\n";a.println(b)}};var C=a.PMatrix3D=function(){this.reset()};C.prototype={set:function(){if(arguments.length===16)this.elements=Array.prototype.slice.call(arguments);else if(arguments.length===1&&arguments[0]instanceof C)this.elements=arguments[0].array();else if(arguments.length===1&&arguments[0]instanceof +Array)this.elements=arguments[0].slice()},get:function(){var b=new C;b.set(this.elements);return b},reset:function(){this.set([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},array:function(){return this.elements.slice()},translate:function(b,a,c){c===p&&(c=0);this.elements[3]+=b*this.elements[0]+a*this.elements[1]+c*this.elements[2];this.elements[7]+=b*this.elements[4]+a*this.elements[5]+c*this.elements[6];this.elements[11]+=b*this.elements[8]+a*this.elements[9]+c*this.elements[10];this.elements[15]+=b*this.elements[12]+ +a*this.elements[13]+c*this.elements[14]},transpose:function(){var b=this.elements.slice();this.elements[0]=b[0];this.elements[1]=b[4];this.elements[2]=b[8];this.elements[3]=b[12];this.elements[4]=b[1];this.elements[5]=b[5];this.elements[6]=b[9];this.elements[7]=b[13];this.elements[8]=b[2];this.elements[9]=b[6];this.elements[10]=b[10];this.elements[11]=b[14];this.elements[12]=b[3];this.elements[13]=b[7];this.elements[14]=b[11];this.elements[15]=b[15]},mult:function(b,a){var c,e,h,d;if(b instanceof +aa)c=b.x,e=b.y,h=b.z,d=1,a||(a=new aa);else if(b instanceof Array&&(c=b[0],e=b[1],h=b[2],d=b[3]||1,!a||a.length!==3&&a.length!==4))a=[0,0,0];a instanceof Array&&(a.length===3?(a[0]=this.elements[0]*c+this.elements[1]*e+this.elements[2]*h+this.elements[3],a[1]=this.elements[4]*c+this.elements[5]*e+this.elements[6]*h+this.elements[7],a[2]=this.elements[8]*c+this.elements[9]*e+this.elements[10]*h+this.elements[11]):a.length===4&&(a[0]=this.elements[0]*c+this.elements[1]*e+this.elements[2]*h+this.elements[3]* +d,a[1]=this.elements[4]*c+this.elements[5]*e+this.elements[6]*h+this.elements[7]*d,a[2]=this.elements[8]*c+this.elements[9]*e+this.elements[10]*h+this.elements[11]*d,a[3]=this.elements[12]*c+this.elements[13]*e+this.elements[14]*h+this.elements[15]*d));if(a instanceof aa)a.x=this.elements[0]*c+this.elements[1]*e+this.elements[2]*h+this.elements[3],a.y=this.elements[4]*c+this.elements[5]*e+this.elements[6]*h+this.elements[7],a.z=this.elements[8]*c+this.elements[9]*e+this.elements[10]*h+this.elements[11]; +return a},preApply:function(){var b;arguments.length===1&&arguments[0]instanceof C?b=arguments[0].array():arguments.length===16?b=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(b=arguments[0]);for(var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0,e=0;e<4;e++)for(var h=0;h<4;h++,c++)a[c]+=this.elements[h+0]*b[e*4+0]+this.elements[h+4]*b[e*4+1]+this.elements[h+8]*b[e*4+2]+this.elements[h+12]*b[e*4+3];this.elements=a.slice()},apply:function(){var b;arguments.length=== +1&&arguments[0]instanceof C?b=arguments[0].array():arguments.length===16?b=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(b=arguments[0]);for(var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0,e=0;e<4;e++)for(var h=0;h<4;h++,c++)a[c]+=this.elements[e*4+0]*b[h+0]+this.elements[e*4+1]*b[h+4]+this.elements[e*4+2]*b[h+8]+this.elements[e*4+3]*b[h+12];this.elements=a.slice()},rotate:function(b,k,c,e){if(c){var h=a.cos(b),b=a.sin(b),d=1-h;this.apply(d*k*k+h,d*k*c-b*e, +d*k*e+b*c,0,d*k*c+b*e,d*c*c+h,d*c*e-b*k,0,d*k*e-b*c,d*c*e+b*k,d*e*e+h,0,0,0,0,1)}else this.rotateZ(b)},invApply:function(){dc===p&&(dc=new C);var b=arguments;dc.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);if(!dc.invert())return!1;this.preApply(dc);return!0},rotateX:function(b){var k=a.cos(b),b=a.sin(b);this.apply([1,0,0,0,0,k,-b,0,0,b,k,0,0,0,0,1])},rotateY:function(b){var k=a.cos(b),b=a.sin(b);this.apply([k,0,b,0,0,1,0,0,-b,0,k,0,0,0,0,1])},rotateZ:function(b){var a= +g.cos(b),b=g.sin(b);this.apply([a,-b,0,0,b,a,0,0,0,0,1,0,0,0,0,1])},scale:function(b,a,c){b&&!a&&!c?a=c=b:b&&a&&!c&&(c=1);b&&a&&c&&(this.elements[0]*=b,this.elements[1]*=a,this.elements[2]*=c,this.elements[4]*=b,this.elements[5]*=a,this.elements[6]*=c,this.elements[8]*=b,this.elements[9]*=a,this.elements[10]*=c,this.elements[12]*=b,this.elements[13]*=a,this.elements[14]*=c)},skewX:function(b){this.apply(1,g.tan(b),0,0,0,1,0,0,0,0,1,0,0,0,0,1)},skewY:function(b){this.apply(1,0,0,0,g.tan(b),1,0,0,0, +0,1,0,0,0,0,1)},multX:function(b,a,c,e){return c?e?this.elements[0]*b+this.elements[1]*a+this.elements[2]*c+this.elements[3]*e:this.elements[0]*b+this.elements[1]*a+this.elements[2]*c+this.elements[3]:this.elements[0]*b+this.elements[1]*a+this.elements[3]},multY:function(b,a,c,e){return c?e?this.elements[4]*b+this.elements[5]*a+this.elements[6]*c+this.elements[7]*e:this.elements[4]*b+this.elements[5]*a+this.elements[6]*c+this.elements[7]:this.elements[4]*b+this.elements[5]*a+this.elements[7]},multZ:function(b, +a,c,e){return e?this.elements[8]*b+this.elements[9]*a+this.elements[10]*c+this.elements[11]*e:this.elements[8]*b+this.elements[9]*a+this.elements[10]*c+this.elements[11]},multW:function(b,a,c,e){return e?this.elements[12]*b+this.elements[13]*a+this.elements[14]*c+this.elements[15]*e:this.elements[12]*b+this.elements[13]*a+this.elements[14]*c+this.elements[15]},invert:function(){var b=this.elements[0]*this.elements[5]-this.elements[1]*this.elements[4],a=this.elements[0]*this.elements[6]-this.elements[2]* +this.elements[4],c=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4],e=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5],h=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5],d=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6],j=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12],l=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12],y=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12], +f=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13],i=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13],o=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14],n=b*o-a*i+c*f+e*y-h*l+d*j;if(g.abs(n)<=1.0E-9)return!1;var p=[];p[0]=+this.elements[5]*o-this.elements[6]*i+this.elements[7]*f;p[4]=-this.elements[4]*o+this.elements[6]*y-this.elements[7]*l;p[8]=+this.elements[4]*i-this.elements[5]*y+this.elements[7]*j;p[12]=-this.elements[4]*f+this.elements[5]* +l-this.elements[6]*j;p[1]=-this.elements[1]*o+this.elements[2]*i-this.elements[3]*f;p[5]=+this.elements[0]*o-this.elements[2]*y+this.elements[3]*l;p[9]=-this.elements[0]*i+this.elements[1]*y-this.elements[3]*j;p[13]=+this.elements[0]*f-this.elements[1]*l+this.elements[2]*j;p[2]=+this.elements[13]*d-this.elements[14]*h+this.elements[15]*e;p[6]=-this.elements[12]*d+this.elements[14]*c-this.elements[15]*a;p[10]=+this.elements[12]*h-this.elements[13]*c+this.elements[15]*b;p[14]=-this.elements[12]*e+this.elements[13]* +a-this.elements[14]*b;p[3]=-this.elements[9]*d+this.elements[10]*h-this.elements[11]*e;p[7]=+this.elements[8]*d-this.elements[10]*c+this.elements[11]*a;p[11]=-this.elements[8]*h+this.elements[9]*c-this.elements[11]*b;p[15]=+this.elements[8]*e-this.elements[9]*a+this.elements[10]*b;b=1/n;p[0]*=b;p[1]*=b;p[2]*=b;p[3]*=b;p[4]*=b;p[5]*=b;p[6]*=b;p[7]*=b;p[8]*=b;p[9]*=b;p[10]*=b;p[11]*=b;p[12]*=b;p[13]*=b;p[14]*=b;p[15]*=b;this.elements=p.slice();return!0},toString:function(){for(var b="",a=0;a<15;a++)b+= +this.elements[a]+", ";b+=this.elements[15];return b},print:function(){var b=ud(this.elements),b=""+a.nfs(this.elements[0],b,4)+" "+a.nfs(this.elements[1],b,4)+" "+a.nfs(this.elements[2],b,4)+" "+a.nfs(this.elements[3],b,4)+"\n"+a.nfs(this.elements[4],b,4)+" "+a.nfs(this.elements[5],b,4)+" "+a.nfs(this.elements[6],b,4)+" "+a.nfs(this.elements[7],b,4)+"\n"+a.nfs(this.elements[8],b,4)+" "+a.nfs(this.elements[9],b,4)+" "+a.nfs(this.elements[10],b,4)+" "+a.nfs(this.elements[11],b,4)+"\n"+a.nfs(this.elements[12], +b,4)+" "+a.nfs(this.elements[13],b,4)+" "+a.nfs(this.elements[14],b,4)+" "+a.nfs(this.elements[15],b,4)+"\n\n";a.println(b)},invTranslate:function(b,a,c){this.preApply(1,0,0,-b,0,1,0,-a,0,0,1,-c,0,0,0,1)},invRotateX:function(b){var a=g.cos(-b),b=g.sin(-b);this.preApply([1,0,0,0,0,a,-b,0,0,b,a,0,0,0,0,1])},invRotateY:function(b){var a=g.cos(-b),b=g.sin(-b);this.preApply([a,0,b,0,0,1,0,0,-b,0,a,0,0,0,0,1])},invRotateZ:function(b){var a=g.cos(-b),b=g.sin(-b);this.preApply([a,-b,0,0,b,a,0,0,0,0,1,0,0, +0,0,1])},invScale:function(b,a,c){this.preApply([1/b,0,0,0,0,1/a,0,0,0,0,1/c,0,0,0,0,1])}};var bb=a.PMatrixStack=function(){this.matrixStack=[]};bb.prototype.load=function(){var b=ga.$newPMatrix();arguments.length===1?b.set(arguments[0]):b.set(arguments);this.matrixStack.push(b)};E.prototype.$newPMatrix=function(){return new ab};I.prototype.$newPMatrix=function(){return new C};bb.prototype.push=function(){this.matrixStack.push(this.peek())};bb.prototype.pop=function(){return this.matrixStack.pop()}; +bb.prototype.peek=function(){var b=ga.$newPMatrix();b.set(this.matrixStack[this.matrixStack.length-1]);return b};bb.prototype.mult=function(b){this.matrixStack[this.matrixStack.length-1].apply(b)};a.split=function(b,a){return b.split(a)};a.splitTokens=function(b,a){arguments.length===1&&(a="\n\t\r\u000c ");for(var a="["+a+"]",c=[],e=0,h=b.search(a);h>=0;)h===0?b=b.substring(1):(c[e]=b.substring(0,h),e++,b=b.substring(h)),h=b.search(a);b.length>0&&(c[e]=b);c.length===0&&(c=p);return c};a.append=function(b, +a){b[b.length]=a;return b};a.concat=function(b,a){return b.concat(a)};a.sort=function(b,a){var c=[];if(b.length>0){for(var e=a>0?a:b.length,h=0;h0)for(e=c.length;e>8)};a.peg=function(b){return b<0?0:b>255?255:b};a.modes={replace:function(b,a){return a},blend:function(b,k){var m=(k&c.ALPHA_MASK)>>>24;return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.mix(b&c.RED_MASK,k&c.RED_MASK,m)&c.RED_MASK| +a.mix(b&c.GREEN_MASK,k&c.GREEN_MASK,m)&c.GREEN_MASK|a.mix(b&c.BLUE_MASK,k&c.BLUE_MASK,m)},add:function(b,a){var m=(a&c.ALPHA_MASK)>>>24;return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|g.min((b&c.RED_MASK)+((a&c.RED_MASK)>>8)*m,c.RED_MASK)&c.RED_MASK|g.min((b&c.GREEN_MASK)+((a&c.GREEN_MASK)>>8)*m,c.GREEN_MASK)&c.GREEN_MASK|g.min((b&c.BLUE_MASK)+((a&c.BLUE_MASK)*m>>8),c.BLUE_MASK)},subtract:function(b,a){var m=(a&c.ALPHA_MASK)>>>24;return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|g.max((b&c.RED_MASK)- +((a&c.RED_MASK)>>8)*m,c.GREEN_MASK)&c.RED_MASK|g.max((b&c.GREEN_MASK)-((a&c.GREEN_MASK)>>8)*m,c.BLUE_MASK)&c.GREEN_MASK|g.max((b&c.BLUE_MASK)-((a&c.BLUE_MASK)*m>>8),0)},lightest:function(b,a){var m=(a&c.ALPHA_MASK)>>>24;return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|g.max(b&c.RED_MASK,((a&c.RED_MASK)>>8)*m)&c.RED_MASK|g.max(b&c.GREEN_MASK,((a&c.GREEN_MASK)>>8)*m)&c.GREEN_MASK|g.max(b&c.BLUE_MASK,(a&c.BLUE_MASK)*m>>8)},darkest:function(b,k){var m=(k&c.ALPHA_MASK)>>>24;return g.min(((b&c.ALPHA_MASK)>>> +24)+m,255)<<24|a.mix(b&c.RED_MASK,g.min(b&c.RED_MASK,((k&c.RED_MASK)>>8)*m),m)&c.RED_MASK|a.mix(b&c.GREEN_MASK,g.min(b&c.GREEN_MASK,((k&c.GREEN_MASK)>>8)*m),m)&c.GREEN_MASK|a.mix(b&c.BLUE_MASK,g.min(b&c.BLUE_MASK,(k&c.BLUE_MASK)*m>>8),m)},difference:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=(k&c.RED_MASK)>>16,l=(k&c.GREEN_MASK)>>8,y=k&c.BLUE_MASK,j=e>j?e-j:j-e,l=h>l?h-l:l-h,y=d>y?d-y:y-d;return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+ +((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},exclusion:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=(k&c.RED_MASK)>>16,l=(k&c.GREEN_MASK)>>8,y=k&c.BLUE_MASK,j=e+j-(e*j>>7),l=h+l-(h*l>>7),y=d+y-(d*y>>7);return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},multiply:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b& +c.BLUE_MASK,j=e*((k&c.RED_MASK)>>16)>>8,l=h*((k&c.GREEN_MASK)>>8)>>8,y=d*(k&c.BLUE_MASK)>>8;return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},screen:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=255-((255-e)*(255-((k&c.RED_MASK)>>16))>>8),l=255-((255-h)*(255-((k&c.GREEN_MASK)>>8))>>8),y=255-((255-d)*(255-(k&c.BLUE_MASK))>>8);return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<< +24|a.peg(e+((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},hard_light:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=(k&c.RED_MASK)>>16,l=(k&c.GREEN_MASK)>>8,y=k&c.BLUE_MASK,j=j<128?e*j>>7:255-((255-e)*(255-j)>>7),l=l<128?h*l>>7:255-((255-h)*(255-l)>>7),y=y<128?d*y>>7:255-((255-d)*(255-y)>>7);return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},soft_light:function(b, +k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=(k&c.RED_MASK)>>16,l=(k&c.GREEN_MASK)>>8,y=k&c.BLUE_MASK,j=(e*j>>7)+(e*e>>8)-(e*e*j>>15),l=(h*l>>7)+(h*h>>8)-(h*h*l>>15),y=(d*y>>7)+(d*d>>8)-(d*d*y>>15);return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},overlay:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=(k&c.RED_MASK)>>16,l=(k& +c.GREEN_MASK)>>8,y=k&c.BLUE_MASK,j=e<128?e*j>>7:255-((255-e)*(255-j)>>7),l=h<128?h*l>>7:255-((255-h)*(255-l)>>7),y=d<128?d*y>>7:255-((255-d)*(255-y)>>7);return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},dodge:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=(k&c.RED_MASK)>>16,l=(k&c.GREEN_MASK)>>8,y=k&c.BLUE_MASK,j=j===255?255:a.peg((e<<8)/(255-j)),l=l===255?255:a.peg((h<< +8)/(255-l)),y=y===255?255:a.peg((d<<8)/(255-y));return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+((j-e)*m>>8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))},burn:function(b,k){var m=(k&c.ALPHA_MASK)>>>24,e=(b&c.RED_MASK)>>16,h=(b&c.GREEN_MASK)>>8,d=b&c.BLUE_MASK,j=(k&c.RED_MASK)>>16,l=(k&c.GREEN_MASK)>>8,y=k&c.BLUE_MASK,j=j===0?0:255-a.peg((255-e<<8)/j),l=l===0?0:255-a.peg((255-h<<8)/l),y=y===0?0:255-a.peg((255-d<<8)/y);return g.min(((b&c.ALPHA_MASK)>>>24)+m,255)<<24|a.peg(e+((j-e)*m>> +8))<<16|a.peg(h+((l-h)*m>>8))<<8|a.peg(d+((y-d)*m>>8))}};a.color=function(b,a,m,e){if(b!==p&&a!==p&&m!==p&&e!==p)return x(b,a,m,e);if(b!==p&&a!==p&&m!==p)return x(b,a,m,Z);if(b!==p&&a!==p){var h;b&c.ALPHA_MASK?(a=g.round(255*(a/Z)),h=b-(b&c.ALPHA_MASK)+((a>255?255:a)<<24&c.ALPHA_MASK)):db===c.RGB?h=x(b,b,b,a):db===c.HSB&&(h=x(0,0,b/ia*B,a));return h}if(typeof b==="number"){var d;b<=ia&&b>=0?db===c.RGB?d=x(b,b,b,Z):db===c.HSB&&(d=x(0,0,b/ia*B,Z)):b&&(d=b);return d}return x(ia,xa,B,Z)};a.color.toString= +function(b){return"rgba("+((b&c.RED_MASK)>>>16)+","+((b&c.GREEN_MASK)>>>8)+","+(b&c.BLUE_MASK)+","+((b&c.ALPHA_MASK)>>>24)/255+")"};a.color.toInt=function(b,a,m,e){return e<<24&c.ALPHA_MASK|b<<16&c.RED_MASK|a<<8&c.GREEN_MASK|m&c.BLUE_MASK};a.color.toArray=function(b){return[(b&c.RED_MASK)>>>16,(b&c.GREEN_MASK)>>>8,b&c.BLUE_MASK,(b&c.ALPHA_MASK)>>>24]};a.color.toGLArray=function(b){return[((b&c.RED_MASK)>>>16)/255,((b&c.GREEN_MASK)>>>8)/255,(b&c.BLUE_MASK)/255,((b&c.ALPHA_MASK)>>>24)/255]};a.color.toRGB= +function(b,a,c){var b=b>ia?ia:b,a=a>xa?xa:a,c=c>B?B:c,b=b/ia*360,a=a/xa*100,c=c/B*100,e=g.round(c/100*255);if(a===0)return[e,e,e];else{b%=360;var h=b%60,d=g.round(c*(100-a)/1E4*255),j=g.round(c*(6E3-a*h)/6E5*255),a=g.round(c*(6E3-a*(60-h))/6E5*255);switch(g.floor(b/60)){case 0:return[e,a,d];case 1:return[j,e,d];case 2:return[d,e,a];case 3:return[d,j,e];case 4:return[a,d,e];case 5:return[e,d,j]}}};a.color.toHSB=function(b){var k,m,e;k=((b&c.RED_MASK)>>>16)/255;m=((b&c.GREEN_MASK)>>>8)/255;e=(b&c.BLUE_MASK)/ +255;var b=a.max(a.max(k,m),e),h=a.min(a.min(k,m),e);if(h===b)return[0,0,b];else k=k===b?(m-e)/(b-h):m===b?2+(e-k)/(b-h):4+(k-m)/(b-h),k/=6,k<0?k+=1:k>1&&(k-=1);return[k*ia,(b-h)/b*xa,b*B]};a.brightness=function(b){return a.color.toHSB(b)[2]};a.saturation=function(b){return a.color.toHSB(b)[1]};a.hue=function(b){return a.color.toHSB(b)[0]};a.red=function(b){return((b&c.RED_MASK)>>>16)/255*ia};a.green=function(b){return((b&c.GREEN_MASK)>>>8)/255*xa};a.blue=function(b){return(b&c.BLUE_MASK)/255*B};a.alpha= +function(b){return((b&c.ALPHA_MASK)>>>24)/255*Z};a.lerpColor=function(b,k,m){var e=a.color(b),h=(e&c.RED_MASK)>>>16,d=(e&c.GREEN_MASK)>>>8,b=e&c.BLUE_MASK,e=((e&c.ALPHA_MASK)>>>24)/Z,j=a.color(k),l=(j&c.GREEN_MASK)>>>8,g=j&c.BLUE_MASK,k=((j&c.ALPHA_MASK)>>>24)/Z,h=parseInt(a.lerp(h,(j&c.RED_MASK)>>>16,m),10),d=parseInt(a.lerp(d,l,m),10),b=parseInt(a.lerp(b,g,m),10),m=parseFloat(a.lerp(e,k,m)*Z);return a.color.toInt(h,d,b,m)};a.colorMode=function(){db=arguments[0];arguments.length>1&&(ia=arguments[1], +xa=arguments[2]||arguments[1],B=arguments[3]||arguments[1],Z=arguments[4]||arguments[1])};a.blendColor=function(b,k,m){var e=0;switch(m){case c.REPLACE:e=a.modes.replace(b,k);break;case c.BLEND:e=a.modes.blend(b,k);break;case c.ADD:e=a.modes.add(b,k);break;case c.SUBTRACT:e=a.modes.subtract(b,k);break;case c.LIGHTEST:e=a.modes.lightest(b,k);break;case c.DARKEST:e=a.modes.darkest(b,k);break;case c.DIFFERENCE:e=a.modes.difference(b,k);break;case c.EXCLUSION:e=a.modes.exclusion(b,k);break;case c.MULTIPLY:e= +a.modes.multiply(b,k);break;case c.SCREEN:e=a.modes.screen(b,k);break;case c.HARD_LIGHT:e=a.modes.hard_light(b,k);break;case c.SOFT_LIGHT:e=a.modes.soft_light(b,k);break;case c.OVERLAY:e=a.modes.overlay(b,k);break;case c.DODGE:e=a.modes.dodge(b,k);break;case c.BURN:e=a.modes.burn(b,k)}return e};a.printMatrix=function(){V.print()};E.prototype.translate=function(b,a){ra.translate(b,a);sa.invTranslate(b,a);d.translate(b,a)};I.prototype.translate=function(b,a,c){ra.translate(b,a,c);sa.invTranslate(b, +a,c)};E.prototype.scale=function(b,a){ra.scale(b,a);sa.invScale(b,a);d.scale(b,a||b)};I.prototype.scale=function(b,a,c){ra.scale(b,a,c);sa.invScale(b,a,c)};E.prototype.pushMatrix=function(){Pb.load(V);Qb.load(Wa);d.save()};I.prototype.pushMatrix=function(){Pb.load(V);Qb.load(Wa)};E.prototype.popMatrix=function(){V.set(Pb.pop());Wa.set(Qb.pop());zb()};I.prototype.popMatrix=function(){V.set(Pb.pop());Wa.set(Qb.pop())};E.prototype.resetMatrix=function(){ra.reset();sa.reset();d.setTransform(1,0,0,1,0, +0)};I.prototype.resetMatrix=function(){ra.reset();sa.reset()};M.prototype.applyMatrix=function(){var b=arguments;ra.apply(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);sa.invApply(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15])};E.prototype.applyMatrix=function(){for(var b=arguments,a=b.length;a<16;a++)b[a]=0;b[10]=b[15]=1;M.prototype.applyMatrix.apply(this,b)};a.rotateX=function(b){ra.rotateX(b);sa.invRotateX(b)};E.prototype.rotateZ= +function(){throw"rotateZ() is not supported in 2D mode. Use rotate(float) instead.";};I.prototype.rotateZ=function(b){ra.rotateZ(b);sa.invRotateZ(b)};a.rotateY=function(b){ra.rotateY(b);sa.invRotateY(b)};E.prototype.rotate=function(b){ra.rotateZ(b);sa.invRotateZ(b);d.rotate(b)};I.prototype.rotate=function(b){a.rotateZ(b)};a.pushStyle=function(){d.save();a.pushMatrix();qd.push({doFill:U,currentFillColor:Fa,doStroke:O,currentStrokeColor:ka,curTint:nb,curRectMode:T,curColorMode:db,colorModeX:ia,colorModeZ:B, +colorModeY:xa,colorModeA:Z,curTextFont:ja,curTextSize:S})};a.popStyle=function(){var b=qd.pop();if(b)zb(),a.popMatrix(),U=b.doFill,Fa=b.currentFillColor,O=b.doStroke,ka=b.currentStrokeColor,nb=b.curTint,T=b.curRectmode,db=b.curColorMode,ia=b.colorModeX,B=b.colorModeZ,xa=b.colorModeY,Z=b.colorModeA,ja=b.curTextFont,S=b.curTextSize;else throw"Too many popStyle() without enough pushStyle()";};a.year=function(){return(new Date).getFullYear()};a.month=function(){return(new Date).getMonth()+1};a.day=function(){return(new Date).getDate()}; +a.hour=function(){return(new Date).getHours()};a.minute=function(){return(new Date).getMinutes()};a.second=function(){return(new Date).getSeconds()};a.millis=function(){return(new Date).getTime()-Vb};M.prototype.redraw=function(){var b=((new Date).getTime()-Ac)/1E3;jc++;var c=jc/b;if(b>0.5)Ac=(new Date).getTime(),jc=0,a.__frameRate=c;a.frameCount++};E.prototype.redraw=function(){M.prototype.redraw.apply(this,arguments);d.lineWidth=pa;d.save();a.draw();zb()};I.prototype.redraw=function(){M.prototype.redraw.apply(this, +arguments);d.clear(d.DEPTH_BUFFER_BIT);Ma={attributes:{},locations:{}};a.noLights();a.lightFalloff(1,0,0);a.shininess(1);a.ambient(255,255,255);a.specular(0,0,0);a.emissive(0,0,0);a.camera();a.draw()};a.noLoop=function(){jb=$a=!1;clearInterval(N);$.onPause()};a.loop=function(){jb||(Ac=(new Date).getTime(),jc=0,N=X.setInterval(function(){try{$.onFrameStart(),a.redraw(),$.onFrameEnd()}catch(b){throw X.clearInterval(N),b;}},Eb),jb=$a=!0,$.onLoop())};a.frameRate=function(b){Oa=b;Eb=1E3/Oa;$a&&(a.noLoop(), +a.loop())};var Kb=[];a.exit=function(){X.clearInterval(N);var b=a.externals.canvas.id;Ca.splice(lc[b],1);delete lc[b];for(var c in z.lib)z.lib.hasOwnProperty(c)&&z.lib[c].hasOwnProperty("detach")&&z.lib[c].detach(a);for(b=Kb.length;b--;)ca(Kb[b]);$.onExit()};a.cursor=function(){if(arguments.length>1||arguments.length===1&&arguments[0]instanceof a.PImage){var b=arguments[0],c,m;if(arguments.length>=3){if(c=arguments[1],m=arguments[2],c<0||m<0||m>=b.height||c>=b.width)throw"x and y must be non-negative and less than the dimensions of the image"; +}else c=b.width>>>1,m=b.height>>>1;b='url("'+b.toDataURL()+'") '+c+" "+m+", default";i.style.cursor=b}else i.style.cursor=arguments.length===1?arguments[0]:Aa};a.noCursor=function(){i.style.cursor=c.NOCURSOR};a.link=function(b,a){a!==p?X.open(b,a):X.location=b};a.beginDraw=Dc;a.endDraw=Dc;a.Import=function(){};a.status=function(b){X.status=b};a.binary=function(b,a){var c=32;if(typeof b==="number")return a&&(c=a),da(b,c);b instanceof ya&&(b=b.toString().charCodeAt(0),c=a?32:16);c=da(b,c);a&&(c=c.substr(-a)); +return c};a.unbinary=function(b){var c=/^[0|1]{8}$/,m=0;if(b instanceof Array){m=[];for(c=0;c=e&&(c=c.substring(c.length-e,c.length));return c};a.unhex=function(b){if(b instanceof Array){for(var a=[],c=0;c0?c:null};a.__contains=function(b,a){if(typeof b!=="string")return b.contains.apply(b,gb(arguments)); +return b!==null&&a!==null&&typeof a==="string"&&b.indexOf(a)>-1};a.__replaceAll=function(b,a,c){if(typeof b!=="string")return b.replaceAll.apply(b,gb(arguments));return b.replace(RegExp(a,"g"),c)};a.__replaceFirst=function(b,a,c){if(typeof b!=="string")return b.replaceFirst.apply(b,gb(arguments));return b.replace(RegExp(a,""),c)};a.__replace=function(b,a,c){if(typeof b!=="string")return b.replace.apply(b,gb(arguments));if(a instanceof RegExp)return b.replace(a,c);typeof a!=="string"&&(a=a.toString()); +if(a==="")return b;var e=b.indexOf(a);if(e<0)return b;var d=0,r="";do r+=b.substring(d,e)+c,d=e+a.length;while((e=b.indexOf(a,d))>=0);return r+b.substring(d)};a.__equals=function(b,a){if(b.equals instanceof Function)return b.equals.apply(b,gb(arguments));return b.valueOf()===a.valueOf()};a.__toCharArray=function(b){if(typeof b!=="string")return b.toCharArray.apply(b,gb(arguments));for(var a=[],c=0,e=b.length;c0;){c=e.shift();if(c===a)return!0;c.$interfaces&&(e=e.concat(c.$interfaces))}return!1}for(;c.hasOwnProperty("$base");)if(c=c.$base,c===a)return!0;return!1};a.abs=g.abs;a.ceil=g.ceil; +a.constrain=function(b,a,c){return b>c?c:b0))throw"Non-empty array is expected";for(var a=b[0],c=b.length,e=1;e +0))throw"Non-empty array is expected";for(var a=b[0],c=b.length,e=1;eb[e]&&(a=b[e]);return a}};a.norm=function(b,a,c){return(b-a)/(c-a)};a.pow=g.pow;a.round=g.round;a.sq=function(b){return b*b};a.sqrt=g.sqrt;a.acos=g.acos;a.asin=g.asin;a.atan=g.atan;a.atan2=g.atan2;a.cos=g.cos;a.degrees=function(b){return b*180/g.PI};a.radians=function(b){return b/180*g.PI};a.sin=g.sin;a.tan=g.tan;var wc=g.random;a.random=function(){if(arguments.length===0)return wc();else if(arguments.length===1)return wc()* +arguments[0];else{var b=arguments[0],a=arguments[1];return wc()*(a-b)+b}};ha.createRandomized=function(){var b=new Date;return new ha(b/6E4&4294967295,b&4294967295)};a.randomSeed=function(b){wc=(new ha(b)).nextDouble};a.Random=function(b){var a=!1,c,e;this.nextGaussian=function(){if(a)return a=!1,c;else{var b,d,j;do b=2*e()-1,d=2*e()-1,j=b*b+d*d;while(j>=1||j===0);j=g.sqrt(-2*g.log(j)/j);c=d*j;a=!0;return b*j}};e=b===p?g.random:(new ha(b)).nextDouble};var Xa={generator:p,octaves:4,fallout:0.5,seed:p}; +a.noise=function(b,a,c){if(Xa.generator===p)Xa.generator=new Ia(Xa.seed);for(var e=Xa.generator,d=1,r=1,j=0,l=0;l0&&(i.style.removeProperty("width"),i.style.removeProperty("height"));i.width=a.width=b||100;i.height=a.height=k||100;for(var e in m)m.hasOwnProperty(e)&&(d[e]=m[e]);a.textSize(S);a.background();md=g.max(1E3,b*k*0.05);a.externals.context=d;for(m=0;m0?(a=new C,a.set(b),c=new C,c.set(e),a.mult(c),c=new C,c.set(a),c.invert(),c.transpose(),w("normalTransform3d",u,"normalTransform",!1,c.array()),s("normal3d",u,"Normal",3,Jc)):J("normal3d",u,"Normal"), +s("vertex3d",u,"Vertex",3,Ic),J("aColor3d",u,"aColor"),J("aTexture3d",u,"aTexture"),d.drawArrays(d.TRIANGLES,0,rd.length/3),d.disable(d.POLYGON_OFFSET_FILL));pa>0&&O&&(d.useProgram(F),w("model2d",F,"model",!1,e.array()),w("view2d",F,"view",!1,b.array()),v("color2d",F,"color",oa),q("picktype2d",F,"picktype",0),s("vertex2d",F,"Vertex",3,Kc),J("aTextureCoord2d",F,"aTextureCoord"),d.drawArrays(d.LINES,0,sd.length/3))};a.sphereDetail=function(b,a){var m;arguments.length===1&&(b=a=arguments[0]);b<3&&(b= +3);a<2&&(a=2);if(!(b===tb&&a===qc)){var e=c.SINCOS_LENGTH/b,h=new L(b),r=new L(b);for(m=0;m0){var m=new C;m.set(b); +var e=new C;e.set(c);m.mult(e);e=new C;e.set(m);e.invert();e.transpose();w("normalTransform3d",u,"normalTransform",!1,e.array());s("normal3d",u,"Normal",3,cc)}else J("normal3d",u,"Normal");d.useProgram(u);J("aTexture3d",u,"aTexture");w("model3d",u,"model",!1,c.array());w("view3d",u,"view",!1,b.array());s("vertex3d",u,"Vertex",3,cc);J("aColor3d",u,"aColor");d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(1,1);v("color3d",u,"color",na);d.drawArrays(d.TRIANGLE_STRIP,0,P.length/3);d.disable(d.POLYGON_OFFSET_FILL)}pa> +0&&O&&(d.useProgram(F),w("model2d",F,"model",!1,c.array()),w("view2d",F,"view",!1,b.array()),s("vertex2d",F,"Vertex",3,cc),J("aTextureCoord2d",F,"aTextureCoord"),v("color2d",F,"color",oa),q("picktype2d",F,"picktype",0),d.drawArrays(d.LINE_STRIP,0,P.length/3))};a.modelX=function(b,a,c){var e=V.array(),d=Va.array(),r=e[0]*b+e[1]*a+e[2]*c+e[3],j=e[4]*b+e[5]*a+e[6]*c+e[7],l=e[8]*b+e[9]*a+e[10]*c+e[11],a=e[12]*b+e[13]*a+e[14]*c+e[15],b=d[0]*r+d[1]*j+d[2]*l+d[3]*a,d=d[12]*r+d[13]*j+d[14]*l+d[15]*a;return d!== +0?b/d:b};a.modelY=function(b,a,c){var e=V.array(),d=Va.array(),r=e[0]*b+e[1]*a+e[2]*c+e[3],j=e[4]*b+e[5]*a+e[6]*c+e[7],l=e[8]*b+e[9]*a+e[10]*c+e[11],a=e[12]*b+e[13]*a+e[14]*c+e[15],b=d[4]*r+d[5]*j+d[6]*l+d[7]*a,d=d[12]*r+d[13]*j+d[14]*l+d[15]*a;return d!==0?b/d:b};a.modelZ=function(b,a,c){var e=V.array(),d=Va.array(),r=e[0]*b+e[1]*a+e[2]*c+e[3],j=e[4]*b+e[5]*a+e[6]*c+e[7],l=e[8]*b+e[9]*a+e[10]*c+e[11],a=e[12]*b+e[13]*a+e[14]*c+e[15],b=d[8]*r+d[9]*j+d[10]*l+d[11]*a,d=d[12]*r+d[13]*j+d[14]*l+d[15]* +a;return d!==0?b/d:b};E.prototype.ambient=M.prototype.a3DOnlyFunction;I.prototype.ambient=function(){var b=arguments;d.useProgram(u);q("usingMat3d",u,"usingMat",!0);b.length===1?typeof b[0]==="string"?(b=b[0].slice(5,-1).split(","),v("mat_ambient3d",u,"mat_ambient",[b[0]/255,b[1]/255,b[2]/255])):v("mat_ambient3d",u,"mat_ambient",[b[0]/255,b[0]/255,b[0]/255]):v("mat_ambient3d",u,"mat_ambient",[b[0]/255,b[1]/255,b[2]/255])};E.prototype.emissive=M.prototype.a3DOnlyFunction;I.prototype.emissive=function(){var b= +arguments;d.useProgram(u);q("usingMat3d",u,"usingMat",!0);b.length===1?typeof b[0]==="string"?(b=b[0].slice(5,-1).split(","),v("mat_emissive3d",u,"mat_emissive",[b[0]/255,b[1]/255,b[2]/255])):v("mat_emissive3d",u,"mat_emissive",[b[0]/255,b[0]/255,b[0]/255]):v("mat_emissive3d",u,"mat_emissive",[b[0]/255,b[1]/255,b[2]/255])};E.prototype.shininess=M.prototype.a3DOnlyFunction;I.prototype.shininess=function(b){d.useProgram(u);q("usingMat3d",u,"usingMat",!0);v("shininess3d",u,"shininess",b)};E.prototype.specular= +M.prototype.a3DOnlyFunction;I.prototype.specular=function(){var b=a.color.apply(this,arguments);d.useProgram(u);q("usingMat3d",u,"usingMat",!0);v("mat_specular3d",u,"mat_specular",a.color.toGLArray(b).slice(0,3))};a.screenX=function(b,c,d){var e=V.array();if(e.length===16){var h=e[0]*b+e[1]*c+e[2]*d+e[3],r=e[4]*b+e[5]*c+e[6]*d+e[7],j=e[8]*b+e[9]*c+e[10]*d+e[11],c=e[12]*b+e[13]*c+e[14]*d+e[15],d=Na.array(),b=d[0]*h+d[1]*r+d[2]*j+d[3]*c,h=d[12]*h+d[13]*r+d[14]*j+d[15]*c;h!==0&&(b/=h);return a.width* +(1+b)/2}else return V.multX(b,c)};a.screenY=function(b,c,d){var e=V.array();if(e.length===16){var h=e[0]*b+e[1]*c+e[2]*d+e[3],r=e[4]*b+e[5]*c+e[6]*d+e[7],j=e[8]*b+e[9]*c+e[10]*d+e[11],c=e[12]*b+e[13]*c+e[14]*d+e[15],d=Na.array(),b=d[4]*h+d[5]*r+d[6]*j+d[7]*c,h=d[12]*h+d[13]*r+d[14]*j+d[15]*c;h!==0&&(b/=h);return a.height*(1+b)/2}else return V.multY(b,c)};a.screenZ=function(b,a,c){var d=V.array();if(d.length!==16)return 0;var h=Na.array(),r=d[0]*b+d[1]*a+d[2]*c+d[3],j=d[4]*b+d[5]*a+d[6]*c+d[7],l=d[8]* +b+d[9]*a+d[10]*c+d[11],a=d[12]*b+d[13]*a+d[14]*c+d[15],b=h[8]*r+h[9]*j+h[10]*l+h[11]*a,h=h[12]*r+h[13]*j+h[14]*l+h[15]*a;h!==0&&(b/=h);return(b+1)/2};M.prototype.fill=function(b,c,d,e){b=a.color(b,c,d,e);b===Fa&&U||(U=!0,Fa=b)};E.prototype.fill=function(){M.prototype.fill.apply(this,arguments);Ga=!0};I.prototype.fill=function(){M.prototype.fill.apply(this,arguments);na=a.color.toGLArray(Fa)};a.noFill=function(){U=!1};M.prototype.stroke=function(b,c,d,e){b=a.color(b,c,d,e);b===ka&&O||(O=!0,ka=b)}; +E.prototype.stroke=function(){M.prototype.stroke.apply(this,arguments);Db=!0};I.prototype.stroke=function(){M.prototype.stroke.apply(this,arguments);oa=a.color.toGLArray(ka)};a.noStroke=function(){O=!1};M.prototype.strokeWeight=function(b){pa=b};E.prototype.strokeWeight=function(b){M.prototype.strokeWeight.apply(this,arguments);d.lineWidth=b};I.prototype.strokeWeight=function(b){M.prototype.strokeWeight.apply(this,arguments);d.useProgram(F);v("pointSize2d",F,"pointSize",b);d.useProgram(ua);v("pointSizeUnlitShape", +ua,"pointSize",b);d.lineWidth(b)};a.strokeCap=function(b){ga.$ensureContext().lineCap=b};a.strokeJoin=function(b){ga.$ensureContext().lineJoin=b};M.prototype.smooth=function(){i.style.setProperty("image-rendering","optimizeQuality","important")};E.prototype.smooth=function(){M.prototype.smooth.apply(this,arguments);if("mozImageSmoothingEnabled"in d)d.mozImageSmoothingEnabled=!0};M.prototype.noSmooth=function(){i.style.setProperty("image-rendering","optimizeSpeed","important")};E.prototype.noSmooth= +function(){M.prototype.noSmooth.apply(this,arguments);if("mozImageSmoothingEnabled"in d)d.mozImageSmoothingEnabled=!1};E.prototype.point=function(b,k){if(O)if($.options.crispLines){var m=g.PI/4,e=a.get(b,k);a.set(b,k,hc(e,ka,m))}else pa>1?(d.fillStyle=a.color.toString(ka),Ga=!0,d.beginPath(),d.arc(b,k,pa/2,0,c.TWO_PI,!1),d.fill(),d.closePath()):(d.fillStyle=a.color.toString(ka),d.fillRect(g.round(b),g.round(k),1,1),Ga=!0)};I.prototype.point=function(b,a,c){var e=new C;e.translate(b,a,c||0);e.transpose(); +b=new C;b.scale(1,-1,1);b.apply(V.array());b.transpose();d.useProgram(F);w("model2d",F,"model",!1,e.array());w("view2d",F,"view",!1,b.array());pa>0&&O&&(v("color2d",F,"color",oa),q("picktype2d",F,"picktype",0),s("vertex2d",F,"Vertex",3,oc),J("aTextureCoord2d",F,"aTextureCoord"),d.drawArrays(d.POINTS,0,1))};a.beginShape=function(b){W=b;o=[]};E.prototype.vertex=function(b,a,c,d){var h=[];lb&&(lb=!1);h.isVert=!0;h[0]=b;h[1]=a;h[2]=0;h[3]=c;h[4]=d;h[5]=Fa;h[6]=ka;o.push(h)};I.prototype.vertex=function(b, +a,c,d,h){var r=[];lb&&(lb=!1);r.isVert=!0;r[0]=b;r[1]=a;r[2]=c||0;r[3]=d||0;r[4]=h||0;r[5]=na[0];r[6]=na[1];r[7]=na[2];r[8]=na[3];r[9]=oa[0];r[10]=oa[1];r[11]=oa[2];r[12]=oa[3];r[13]=za;r[14]=ob;r[15]=fb;o.push(r)};var vd=function(b,a){var c=new C;c.scale(1,-1,1);c.apply(V.array());c.transpose();d.useProgram(ua);w("uViewUS",ua,"uView",!1,c.array());s("aVertexUS",ua,"aVertex",3,oc);d.bufferData(d.ARRAY_BUFFER,new L(b),d.STREAM_DRAW);s("aColorUS",ua,"aColor",4,Nc);d.bufferData(d.ARRAY_BUFFER,new L(a), +d.STREAM_DRAW);d.drawArrays(d.POINTS,0,b.length/3)},Ja=function(b,a,c){var a=a==="LINES"?d.LINES:a==="LINE_LOOP"?d.LINE_LOOP:d.LINE_STRIP,e=new C;e.scale(1,-1,1);e.apply(V.array());e.transpose();d.useProgram(ua);w("uViewUS",ua,"uView",!1,e.array());s("aVertexUS",ua,"aVertex",3,Mc);d.bufferData(d.ARRAY_BUFFER,new L(b),d.STREAM_DRAW);s("aColorUS",ua,"aColor",4,gd);d.bufferData(d.ARRAY_BUFFER,new L(c),d.STREAM_DRAW);d.drawArrays(a,0,b.length/3)},cb=function(b,a,m,e){var a=a==="TRIANGLES"?d.TRIANGLES: +a==="TRIANGLE_FAN"?d.TRIANGLE_FAN:d.TRIANGLE_STRIP,h=new C;h.scale(1,-1,1);h.apply(V.array());h.transpose();d.useProgram(u);w("model3d",u,"model",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);w("view3d",u,"view",!1,h.array());d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(1,1);v("color3d",u,"color",[-1,0,0,0]);s("vertex3d",u,"Vertex",3,Wb);d.bufferData(d.ARRAY_BUFFER,new L(b),d.STREAM_DRAW);s("aColor3d",u,"aColor",4,Nc);d.bufferData(d.ARRAY_BUFFER,new L(m),d.STREAM_DRAW);J("normal3d",u,"Normal");if(Da){if(kd=== +c.IMAGE)for(m=0;m1&&(e[m+0]-=e[m+0]-1),e[m+1]>1&&(e[m+1]-=e[m+1]-1);q("usingTexture3d",u,"usingTexture",Da);s("aTexture3d",u,"aTexture",2,hd);d.bufferData(d.ARRAY_BUFFER,new L(e),d.STREAM_DRAW)}d.drawArrays(a,0,b.length/3);d.disable(d.POLYGON_OFFSET_FILL)};E.prototype.endShape=function(b){if(o.length!==0){var b=b===c.CLOSE,k=[],m=[],e=[],h=[],r;lb=!0;var j,l,g=o.length;for(j=0;j3){k=[];m=1-Ya;d.beginPath();d.moveTo(o[1][0],o[1][1]);for(j=1;j+22){d.beginPath();d.moveTo(o[0][0],o[0][1]);d.lineTo(o[1][0],o[1][1]);d.lineTo(o[2][0],o[2][1]);U&&(a.fill(o[2][5]),ea());O&&(a.stroke(o[2][6]),Y());d.closePath();for(j=3;j3)for(j=0;j+12)for(l=0;l+22)for(l=0;l+22){for(l=0;l<3;l++){j=o[l];for(f=0;f<3;f++)b.push(j[f])}for(l=0;l<3;l++){j=o[l];for(f=9;f<13;f++)h.push(j[f])}O&&Ja(b,"LINE_LOOP",h);for(l=2;l+13){for(l=0;l<2;l++){j=o[l];for(f=0;f<3;f++)b.push(j[f])}for(l=0;l<2;l++){j=o[l];for(f=9;f<13;f++)h.push(j[f])}Ja(b,"LINE_STRIP",h);i>4&&i%2>0&&(m.splice(m.length- +3),o.pop());for(l=0;l+33){var h=va[ta-4][0],f=va[ta-4][1],j=va[ta-4][2],g=va[ta-3][0],i=va[ta-3][1],p=va[ta- +3][2],o=va[ta-2][0],q=va[ta-2][1],n=va[ta-2][2],s=va[ta-1][0],v=va[ta-1][1],u=va[ta-1][2],b=g,c=i,d=p,t=Gb.array(),e=t[4]*h+t[5]*g+t[6]*o+t[7]*s,w=t[8]*h+t[9]*g+t[10]*o+t[11]*s,h=t[12]*h+t[13]*g+t[14]*o+t[15]*s,g=t[4]*f+t[5]*i+t[6]*q+t[7]*v,o=t[8]*f+t[9]*i+t[10]*q+t[11]*v,f=t[12]*f+t[13]*i+t[14]*q+t[15]*v,i=t[4]*j+t[5]*p+t[6]*n+t[7]*u,q=t[8]*j+t[9]*p+t[10]*n+t[11]*u,j=t[12]*j+t[13]*p+t[14]*n+t[15]*u;a.vertex(b,c,d);for(p=0;pc.TWO_PI)h=0,f=c.TWO_PI;m/= +2;e/=2;b+=m;d+=e;var h=0|-0.5+h/c.TWO_PI*c.SINCOS_LENGTH,f=0|0.5+f/c.TWO_PI*c.SINCOS_LENGTH,j,g;if(U){var i=O;O=!1;a.beginShape();a.vertex(b,d);for(g=j=h;j=c.SINCOS_LENGTH&&(g-=c.SINCOS_LENGTH),a.vertex(b+Ob[g]*m,d+Nb[g]*e);a.endShape(c.CLOSE);O=i}if(O){i=U;U=!1;a.beginShape();for(g=j=h;j=c.SINCOS_LENGTH&&(g-=c.SINCOS_LENGTH),a.vertex(b+Ob[g]*m,d+Nb[g]*e);g=f%c.SINCOS_LENGTH;a.vertex(b+Ob[g]*m,d+Nb[g]*e);a.endShape();U=i}}};E.prototype.line=function(b,c,m,e){if(b===m&&c=== +e)a.point(b,c);else if((b===m||c===e)&&pa<=1&&O&&$.options.crispLines){var h;if(b===m){c>e&&(h=c,c=e,e=h);for(;c<=e;++c)a.set(b,c,ka)}else{b>m&&(h=b,b=m,m=h);for(;b<=m;++b)a.set(b,c,ka)}}else O&&(d.beginPath(),d.moveTo(b||0,c||0),d.lineTo(m||0,e||0),Y(),d.closePath())};I.prototype.line=function(b,c,m,e,h,f){if(h===p||f===p)f=0,h=e,e=m,m=0;b===e&&c===h&&m===f?a.point(b,c,m):(b=[b,c,m,e,h,f],c=new C,c.scale(1,-1,1),c.apply(V.array()),c.transpose(),pa>0&&O&&(d.useProgram(F),w("model2d",F,"model",!1, +[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),w("view2d",F,"view",!1,c.array()),v("color2d",F,"color",oa),q("picktype2d",F,"picktype",0),s("vertex2d",F,"Vertex",3,Mc),J("aTextureCoord2d",F,"aTextureCoord"),d.bufferData(d.ARRAY_BUFFER,new L(b),d.STREAM_DRAW),d.drawArrays(d.LINES,0,2)))};E.prototype.bezier=function(){if(arguments.length!==8)throw"You must use 8 parameters for bezier() in 2D mode";a.beginShape();a.vertex(arguments[0],arguments[1]);a.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5], +arguments[6],arguments[7]);a.endShape()};I.prototype.bezier=function(){if(arguments.length!==12)throw"You must use 12 parameters for bezier() in 3D mode";a.beginShape();a.vertex(arguments[0],arguments[1],arguments[2]);a.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]);a.endShape()};a.bezierDetail=function(a){yb=a};a.bezierPoint=function(a,c,d,e,h){return(1-h)*(1-h)*(1-h)*a+3*(1-h)*(1-h)*h*c+3*(1-h)*h*h*d+h*h*h*e}; +a.bezierTangent=function(a,c,d,e,h){return 3*h*h*(-a+3*c-3*d+e)+6*h*(a-2*c+d)+3*(-a+c)};a.curvePoint=function(a,c,d,e,h){return 0.5*(2*c+(-a+d)*h+(2*a-5*c+4*d-e)*h*h+(-a+3*c-3*d+e)*h*h*h)};a.curveTangent=function(a,c,d,e,h){return 0.5*(-a+d+2*(2*a-5*c+4*d-e)*h+3*(-a+3*c-3*d+e)*h*h)};a.triangle=function(b,d,m,e,h,f){a.beginShape(c.TRIANGLES);a.vertex(b,d,0);a.vertex(m,e,0);a.vertex(h,f,0);a.endShape()};a.quad=function(b,d,f,e,h,g,j,l){a.beginShape(c.QUADS);a.vertex(b,d,0);a.vertex(f,e,0);a.vertex(h, +g,0);a.vertex(j,l,0);a.endShape()};E.prototype.rect=function(b,k,f,e){if(f||e)if(O&&!U&&pa<=1&&$.options.crispLines){var h,r=b+f-1,j=k+e-1;for(h=0;h0&&O&&(d.useProgram(F),w("model2d",F,"model",!1,h.array()),w("view2d",F,"view",!1,c.array()),v("color2d",F,"color",oa),q("picktype2d",F,"picktype",0),s("vertex2d",F,"Vertex",3,nc),J("aTextureCoord2d",F,"aTextureCoord"),d.drawArrays(d.LINE_LOOP,0,Uc.length/3));U&&(d.useProgram(u),w("model3d",u,"model",!1,h.array()),w("view3d",u,"view",!1,c.array()),d.enable(d.POLYGON_OFFSET_FILL),d.polygonOffset(1,1),v("color3d", +u,"color",na),K>0?(a=new C,a.set(c),c=new C,c.set(h),a.mult(c),h=new C,h.set(a),h.invert(),h.transpose(),w("normalTransform3d",u,"normalTransform",!1,h.array()),s("normal3d",u,"Normal",3,Lc)):J("normal3d",u,"Normal"),s("vertex3d",u,"Vertex",3,nc),d.drawArrays(d.TRIANGLE_FAN,0,Uc.length/3),d.disable(d.POLYGON_OFFSET_FILL))};M.prototype.ellipse=function(a,d,f,e){a=a||0;d=d||0;if(!(f<=0&&e<=0)){ba===c.RADIUS&&(f*=2,e*=2);ba===c.CORNERS&&(f-=a,e-=d);if(ba===c.CORNER||ba===c.CORNERS)a+=f/2,d+=e/2;return{x:a, +y:d,width:f,height:e}}};E.prototype.ellipse=function(b,k,f,e){var h=M.prototype.ellipse.apply(this,arguments);if(h)if(b=h.x,k=h.y,f=h.width,e=h.height,f===e)d.beginPath(),d.arc(b-0,k-0,f/2,0,c.TWO_PI,!1),ea(),Y(),d.closePath();else{var h=f/2,g=e/2,j=0.5522847498307933*h,l=0.5522847498307933*g;a.beginShape();a.vertex(b+h,k);a.bezierVertex(b+h,k-l,b+j,k-g,b,k-g);a.bezierVertex(b-j,k-g,b-h,k-l,b-h,k);a.bezierVertex(b-h,k+l,b-j,k+g,b,k+g);a.bezierVertex(b+j,k+g,b+h,k+l,b+h,k);a.endShape()}};I.prototype.ellipse= +function(b,c,d,e){var h=M.prototype.ellipse.apply(this,arguments);if(h){var b=h.x,c=h.y,d=h.width,e=h.height,h=d/2,f=e/2,j=0.5522847498307933*h,g=0.5522847498307933*f;a.beginShape();a.vertex(b+h,c);a.bezierVertex(b+h,c-g,0,b+j,c-f,0,b,c-f,0);a.bezierVertex(b-j,c-f,0,b-h,c-g,0,b-h,c,0);a.bezierVertex(b-h,c+g,0,b-j,c+f,0,b,c+f,0);a.bezierVertex(b+j,c+f,0,b+h,c+g,0,b+h,c,0);a.endShape();if(U){var g=j=0,i;for(i=0;i>>16;a.imageData.data[e+1]=(d&c.GREEN_MASK)>>>8;a.imageData.data[e+2]=d&c.BLUE_MASK;a.imageData.data[e+3]=(d&c.ALPHA_MASK)>>>24}}(this),set:function(a){if(this.isRemote)throw"Image is loaded remotely. Cannot set pixels."; +else for(var b=0,c=a.length;b=0&&k>=0&&k=0&&c>=0&&cmd&&Ba()):f instanceof Ka&&a.image(f,b,c);else if(arguments.length===4)if(e.isRemote)throw"Image is loaded remotely. Cannot set x,y."; +else{var h=a.color.toArray(f),g=c*e.width*4+b*4,j=e.imageData.data;j[g]=h[0];j[g+1]=h[1];j[g+2]=h[2];j[g+3]=h[3]}};a.imageData={};a.pixels={getLength:function(){return a.imageData.data.length?a.imageData.data.length/4:0},getPixel:function(b){b*=4;return a.imageData.data[b+3]<<24&4278190080|a.imageData.data[b+0]<<16&16711680|a.imageData.data[b+1]<<8&65280|a.imageData.data[b+2]&255},setPixel:function(b,c){var d=b*4;a.imageData.data[d+0]=(c&16711680)>>>16;a.imageData.data[d+1]=(c&65280)>>>8;a.imageData.data[d+ +2]=c&255;a.imageData.data[d+3]=(c&4278190080)>>>24},set:function(a){for(var c=0,d=a.length;c0&&zd(b,c,f,e);var h=a.color.toGLArray(Za);d.clearColor(h[0],h[1],h[2],h[3]);d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};E.prototype.image=function(a,c,f,e,h){if(a.width>0){var g=tc(c||0,f||0,e||a.width,h||a.height,arguments.length<4);if(a.sourceImg&&nb===null&&!a.__mask){var j=a.sourceImg;d.drawImage(j,0,0,j.width,j.height,g.x,g.y,g.w,g.h)}else{j=a.toImageData();if(a.__mask){var l,i;if(a.__mask instanceof +Ka){var p=a.__mask.toImageData();l=2;for(i=a.width*a.height*4;l0&&(e=e||b.width,h=h||b.height,a.beginShape(a.QUADS),a.texture(b.externals.canvas),a.vertex(c,d,0,0,0),a.vertex(c,d+h,0,0,h),a.vertex(c+e,d+h,0,e,h),a.vertex(c+e,d,0,e,0),a.endShape())};a.tint=function(){var b= +a.color.apply(this,arguments),c=a.red(b)/ia,d=a.green(b)/xa,e=a.blue(b)/B,h=a.alpha(b)/Z;nb=function(a){for(var b=a.data,a=4*a.width*a.height,f=0;f=g&&(p=d),q<0&&(q=0),n>=e&&(n=d),q=c.pixels.getPixel(q),o=c.pixels.getPixel(o),n=c.pixels.getPixel(n),p=c.pixels.getPixel(p),l=77*(l>>16&255)+151*(l>>8&255)+28*(l&255),v=77*(o>>16&255)+151*(o>>8&255)+28*(o&255),s=77*(p>>16&255)+151*(p>>8&255)+28*(p&255),u=77*(q>>16&255)+151*(q>>8&255)+28*(q&255),t=77*(n>>16&255)+151*(n>>8&255)+28*(n&255),v=g&&(p=d),q<0&&(q=0),n>=e&&(n=d),q=c.pixels.getPixel(q),o=c.pixels.getPixel(o),n=c.pixels.getPixel(n),p=c.pixels.getPixel(p),l=77*(l>>16&255)+151*(l>>8&255)+28*(l&255),v=77*(o>>16&255)+151*(o>>8&255)+28*(o&255),s=77*(p>>16&255)+151*(p>>8&255)+28*(p&255),u=77*(q>>16&255)+151*(q>>8&255)+28*(q&255),t=77*(n>>16&255)+151*(n>>8&255)+28*(n&255),v>l&& +(i=o,l=v),s>l&&(i=p,l=s),u>l&&(i=q,l=u),t>l&&(i=n),h[d++]=i}c.pixels.set(h)};a.filter=function(b,d,f){var e,h,g,j;arguments.length===3?(f.loadPixels(),e=f):(a.loadPixels(),e=a);d===p&&(d=null);if(e.isRemote)throw"Image is loaded remotely. Cannot filter image.";else{var l=e.pixels.getLength();switch(b){case c.BLUR:var i=d||1,o=e,q,s,n,v,u,w,t,x,z;g=o.pixels.getLength();j=new L(g);l=new L(g);h=new L(g);g=new L(g);var Q=0,B,C,G,i=a.floor(i*3.5),A,i=i<1?1:i<248?i:248;if(a.shared.blurRadius!==i){a.shared.blurRadius= +i;a.shared.blurKernelSize=1+(a.shared.blurRadius<<1);a.shared.blurKernel=new L(a.shared.blurKernelSize);var D=a.shared.blurKernel,F=a.shared.blurKernelSize;for(A=0;A=A)break;u=0}for(G=u;G=A)break;t=(w+Q)*4;u=F[G];v+=u*E[t+3]; +q+=u*E[t];s+=u*E[t+1];n+=u*E[t+2];o+=u;w++}t=Q+B;g[t]=v/o;j[t]=q/o;l[t]=s/o;h[t]=n/o}Q+=A}Q=0;x=-x;z=x*A;for(C=0;C=i)break;u=0;t=x;w=B+z}for(G=u;G=i)break;u=F[G];v+=u*g[w];q+=u*j[w];s+=u*l[w];n+=u*h[w];o+=u;t++;w+=A}t=(B+Q)*4;E[t]=q/o;E[t+1]=s/o;E[t+2]=n/o;E[t+3]=v/o}Q+=A;z+=A;x++}break;case c.GRAY:if(e.format===c.ALPHA){for(j=0;j>16&255)+151*(h>>8&255)+28*(h&255)>>8,e.pixels.setPixel(j,h&c.ALPHA_MASK|g<<16|g<<8|g);break;case c.INVERT:for(j=0;j255)throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)";g=h-1;for(j=0;j>16&255,i=e.pixels.getPixel(j)>>8&255,A= +e.pixels.getPixel(j)&255,Q=(Q*h>>8)*255/g,i=(i*h>>8)*255/g,A=(A*h>>8)*255/g,e.pixels.setPixel(j,4278190080&e.pixels.getPixel(j)|Q<<16|i<<8|A);break;case c.OPAQUE:for(j=0;j1)throw"Level must be between 0 and 1 for filter(THRESHOLD, level)";h=a.floor(d*255);for(j=0;j>16,a.max((e.pixels.getPixel(j)&c.GREEN_MASK)>>8,e.pixels.getPixel(j)& +c.BLUE_MASK)),e.pixels.setPixel(j,e.pixels.getPixel(j)&c.ALPHA_MASK|(gd&&(g=d)):(a=d+a-h,g>a&& +(g=a));fe&&(l=e)):(c=e+c-f,l>c&&(l=c));return!(g<=0||l<=0)};a.filter_new_scanline=function(){a.shared.sX=a.shared.srcXOffset;a.shared.fracV=a.shared.srcYOffset&c.PREC_MAXVAL;a.shared.ifV=c.PREC_MAXVAL-a.shared.fracV;a.shared.v1=(a.shared.srcYOffset>>c.PRECISIONB)*a.shared.iw;a.shared.v2=g.min((a.shared.srcYOffset>>c.PRECISIONB)+1,a.shared.ih1)*a.shared.iw};a.filter_bilinear=function(){a.shared.fracU=a.shared.sX&c.PREC_MAXVAL;a.shared.ifU=c.PREC_MAXVAL-a.shared.fracU;a.shared.ul=a.shared.ifU* +a.shared.ifV>>c.PRECISIONB;a.shared.ll=a.shared.ifU*a.shared.fracV>>c.PRECISIONB;a.shared.ur=a.shared.fracU*a.shared.ifV>>c.PRECISIONB;a.shared.lr=a.shared.fracU*a.shared.fracV>>c.PRECISIONB;a.shared.u1=a.shared.sX>>c.PRECISIONB;a.shared.u2=g.min(a.shared.u1+1,a.shared.iw1);var b=(a.shared.v1+a.shared.u1)*4,d=(a.shared.v1+a.shared.u2)*4,f=(a.shared.v2+a.shared.u1)*4,e=(a.shared.v2+a.shared.u2)*4;a.shared.cUL=a.color.toInt(a.shared.srcBuffer[b],a.shared.srcBuffer[b+1],a.shared.srcBuffer[b+2],a.shared.srcBuffer[b+ +3]);a.shared.cUR=a.color.toInt(a.shared.srcBuffer[d],a.shared.srcBuffer[d+1],a.shared.srcBuffer[d+2],a.shared.srcBuffer[d+3]);a.shared.cLL=a.color.toInt(a.shared.srcBuffer[f],a.shared.srcBuffer[f+1],a.shared.srcBuffer[f+2],a.shared.srcBuffer[f+3]);a.shared.cLR=a.color.toInt(a.shared.srcBuffer[e],a.shared.srcBuffer[e+1],a.shared.srcBuffer[e+2],a.shared.srcBuffer[e+3]);a.shared.r=a.shared.ul*((a.shared.cUL&c.RED_MASK)>>16)+a.shared.ll*((a.shared.cLL&c.RED_MASK)>>16)+a.shared.ur*((a.shared.cUR&c.RED_MASK)>> +16)+a.shared.lr*((a.shared.cLR&c.RED_MASK)>>16)<>>c.PRECISIONB&c.GREEN_MASK;a.shared.b=a.shared.ul*(a.shared.cUL&c.BLUE_MASK)+a.shared.ll*(a.shared.cLL&c.BLUE_MASK)+a.shared.ur*(a.shared.cUR&c.BLUE_MASK)+a.shared.lr*(a.shared.cLR&c.BLUE_MASK)>>>c.PRECISIONB;a.shared.a=a.shared.ul*((a.shared.cUL&c.ALPHA_MASK)>>> +24)+a.shared.ll*((a.shared.cLL&c.ALPHA_MASK)>>>24)+a.shared.ur*((a.shared.cUR&c.ALPHA_MASK)>>>24)+a.shared.lr*((a.shared.cLR&c.ALPHA_MASK)>>>24)<=b.width&&(e=b.width-1);h>=b.height&&(h=b.height-1);e-=d;h-=f;q-=o;s-=p;if(!(q<=0||s<=0||e<=0||h<=0||o>=j||p>=l||d>=b.width||f>=b.height))switch(e=g.floor(e/q*c.PRECISIONF),h=g.floor(h/s*c.PRECISIONF), +a.shared.srcXOffset=g.floor(o<0?-o*e:d*c.PRECISIONF),a.shared.srcYOffset=g.floor(p<0?-p*h:f*c.PRECISIONF),o<0&&(q+=o,o=0),p<0&&(s+=p,p=0),q=g.min(q,j-o),s=g.min(s,l-p),d=p*j+o,a.shared.srcBuffer=b.imageData.data,a.shared.iw=b.width,a.shared.iw1=b.width-1,a.shared.ih1=b.height-1,n){case c.BLEND:for(f=0;f":return a.greater;case "?":return a.question;case "@":return a.at; +case "[":return a.bracketleft;case "\\":return a.backslash;case "]":return a.bracketright;case "^":return a.asciicircum;case "`":return a.grave;case "{":return a.braceleft;case "|":return a.bar;case "}":return a.braceright;case "~":return a.asciitilde;default:return a[c]}}catch(d){z.debug(d)}};E.prototype.text$line=function(b,f,g,e,h){e=e=0;if(ja.glyph){e=a.glyphTable[ja.name];d.save();d.translate(f,g+S);(h===c.RIGHT||h===c.CENTER)&&e.width(b);f=1/e.units_per_em*S;d.scale(f,f);f=0;for(g=b.length;f< +g;f++)try{a.glyphLook(e,b[f]).draw()}catch(i){z.debug(i)}zb()}else if(b&&"fillText"in d){if(Ga)d.fillStyle=a.color.toString(Fa),Ga=!1;if(h===c.RIGHT||h===c.CENTER)e=d.measureText(b).width,e=h===c.RIGHT?-e:-e/2;d.fillText(b,f+e,g)}};I.prototype.text$line=function(a,f,g,e,h){Ha===p&&(Ha=A.createElement("canvas"));var i=d;d=Ha.getContext("2d");d.font=S+"px "+ja.name;var j=d.measureText(a).width;Ha.width=j;Ha.height=S;d=Ha.getContext("2d");d.font=S+"px "+ja.name;d.textBaseline="top";E.prototype.text$line(a, +0,0,0,c.LEFT);a=Ha.width/Ha.height;d=i;d.bindTexture(d.TEXTURE_2D,jd);Tb(Ha);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);i=0;h===c.RIGHT?i=-j:h===c.CENTER&&(i=-j/2);h=new C;j=S*0.5;h.translate(f+i-j/2,g-j,e);h.scale(-a*j,-j,j);h.translate(-1,-1,-1);h.transpose();f=new C;f.scale(1,-1,1);f.apply(V.array()); +f.transpose();d.useProgram(F);s("vertex2d",F,"Vertex",3,Oc);s("aTextureCoord2d",F,"aTextureCoord",2,Pc);q("uSampler2d",F,"uSampler",[0]);q("picktype2d",F,"picktype",1);w("model2d",F,"model",!1,h.array());w("view2d",F,"view",!1,f.array());v("color2d",F,"color",na);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Qc);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)};a.text=function(){if(Rc===c.SCREEN){a.pushMatrix();a.resetMatrix();var b=a.textAscent(),d=a.textDescent(),f=a.textWidth(arguments[0]),e=b+d,d=a.loadFont(ja.origName), +f=a.createGraphics(f,e);f.beginDraw();f.fill(Fa);f.opaque=!1;f.background(0,0,0,0);f.textFont(d);f.textSize(S);f.text(arguments[0],0,b);f.endDraw();arguments.length===5||arguments.length===6?a.image(f,arguments[1],arguments[2]-b,arguments[3],arguments[4]):a.image(f,arguments[1],arguments[2]-b);a.popMatrix()}else Rc!==c.SHAPE&&(arguments.length===3?ic(Ea(arguments[0]),arguments[1],arguments[2],0):arguments.length===4?ic(Ea(arguments[0]),arguments[1],arguments[2],arguments[3]):arguments.length===5? +Ab(Ea(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0):arguments.length===6&&Ab(Ea(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))};a.textMode=function(a){Rc=a};a.loadGlyphs=function(b){var c,f,e,h,i,j,l,o,q,s,u,n,v=function(a,b){var c=0,d=[],e,f=RegExp(a,"g");for(e=d[c]=f.exec(b);e;)c++,e=d[c]=f.exec(b);return d},w=function(a){var b=v("[A-Za-z][0-9\\- ]+|Z",a);n="return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();"; +o=a=j=i=h=e=f=c=0;q="";s=b.length-1;for(var l=0;lf&&(c=f-g);Ca.height=c/f*100+"%";G.paddingBottom=ha.clientHeight+"px"},Qa=[da(f,"mousemove",function(c){if(ma)Ea(x.innerHeight-c.clientY),Y.scrollTop=La}),da(f,"mouseup",function(){ma&&(ma=La=!1)}),da(ea,"dblclick",function(c){c.preventDefault();Ba?(Ea(Ba),Ba=!1):(Ba=ha.clientHeight,Ca.height="0px")}),da(ea,"mousedown",function(c){c.preventDefault();ma=!0;La=Y.scrollTop}),da(ea, +"contextmenu",function(){ma=!1}),da(wa,"click",function(){qa()})];qa=function(){for(var f=Qa.length;f--;)X.apply(c,Qa[f]);L.removeChild(ha);G.paddingBottom=Ia;fa(Y);fa(ha);c.log=la};ca(ha,g,Y,p,ea,q,wa,s);wa.title="Close Log";aa(wa,f.createTextNode("\u2716"));ea.title="Double-click to toggle log minimization";L.insertBefore(ha,L.firstChild);c.log=function(c){Pa===512?Y.removeChild(Y.firstChild):Pa++;var g=aa(Y,f.createElement("div")),i=aa(g,f.createElement("div"));g.title=(new Date).toLocaleTimeString(); +ca(g,z,i,w);aa(i,f.createTextNode(c));Y.scrollTop=Y.scrollHeight};c.log(A);G.paddingBottom=ha.clientHeight+"px"}}():typeof print==="function"&&(c.log=print);return c}();z.logger=Hb;z.version="1.2.3";z.lib={};z.registerLibrary=function(c,f){z.lib[c]=f;f.hasOwnProperty("init")&&f.init(la)};z.instances=Ca;z.getInstanceById=function(c){return Ca[lc[c]]};z.Sketch=function(c){this.attachFunction=c;this.options={crispLines:!1,pauseOnBlur:!1,globalKeyEvents:!1};this.onExit=this.onFrameEnd=this.onFrameStart= +this.onLoop=this.onPause=this.onSetup=this.onLoad=Dc;this.params={};this.imageCache={pending:0,images:{},add:function(c){if(Ia){var g=new Image;g.onload=function(c){return function(){c.pending--}}(this);this.pending++;this.images[c]=g;g.src=c}else this.images[c]=null}};this.fonts={template:function(){if(!Ia)return null;var c=A.createElement("p");c.style.fontFamily="serif";c.style.fontSize="72px";c.style.visibility="hidden";c.innerHTML="This element is a text block for font loading";A.getElementsByTagName("body")[0].appendChild(c); +return c}(),attempt:0,pending:function(){for(var c=!0,g=0;g=30){c=!0;for(g=0;g "+p);if(w===J)if(s.length===0)try{return new z(c,q.join("\n"))}catch(A){z.logger.log("Unable to execute pjs sketch: "+A)}else z.logger.log("Unable to load pjs sketch files: "+s.join("\n"))}if(v.charAt(0)==="#"){var L=A.getElementById(v.substring(1));L?x(L.text||L.textContent):x("","Unable to load pjs sketch: element with id '"+v.substring(1)+"' was not found")}else g(v,x)}for(var q=[],s=[],J=f.length,w=0,x=0;x