Files
cdnjs/ajax/libs/processing.js/1.2.3/processing-api.min.js
T

350 lines
172 KiB
JavaScript

/***
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;G<d.length;++G)L=L*31+d.charCodeAt(G)&4294967295;return L}else if(typeof d!=="object")return d&4294967295;else if(d.hashCode instanceof Function)return d.hashCode();else{if(d.$id===q)d.$id=j.floor(j.random()*65536)-32768<<16|j.floor(j.random()*65536);
return d.$id}}function ia(d,j){return d===null||j===null?d===null&&j===null:d.constructor===String?d===j:typeof d!=="object"?d===j:d.equals instanceof Function?d.equals(j):d===j}function xb(){}function Sa(d,j){function q(t){W.defineProperty(d,t,{get:function(){return j[t]},set:function(d){j[t]=d},enumerable:!0})}var z=[],u;for(u in j)typeof j[u]==="function"?d.hasOwnProperty(u)||(d[u]=j[u]):u.charAt(0)!=="$"&&!(u in d)&&z.push(u);for(;z.length>0;)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++j<d.length};this.next=function(){return d[j]}}else throw"Unable to iterate: "+d;},dc=function(){function d(j){var p=0;this.hasNext=function(){return p<j.length};this.next=function(){return j[p++]};this.remove=function(){j.splice(p,1)}}function j(){var q;arguments.length===0?q=[]:arguments.length>0&&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<p;++j)if(ia(d,q[j]))return j;return-1};this.add=function(){if(arguments.length===1)q.push(arguments[0]);else if(arguments.length===2){var d=arguments[0];if(typeof d==="number")if(d>=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<q.length)q.splice(d,1,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.size=function(){return q.length};this.clear=function(){q.length=0};this.remove=function(d){if(typeof d==="number")return q.splice(d,1)[0];else{d=this.indexOf(d);if(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;++p)J[p]!==q&&(d=d.concat(J[p]));p=J.length*2;J=[];J.length=p;for(p=0;p<d.length;++p){var t=j(d[p].key),G=J[t];G===q&&(J[t]=G=[]);G.push(d[p])}}}function z(d,j){function p(){for(;!G;)if(++L,t>=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;d<q.length;++d)p(q[d]);
return q.length>0};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;t<p.length;++t)if(ia(p[t].key,d))return!0;return!1};this.containsValue=function(d){for(var j=0;j<J.length;++j){var p=J[j];if(p!==q)for(var t=0;t<p.length;++t)if(ia(p[t].value,d))return!0}return!1};
this.entrySet=function(){return new u(function(d){return new t(d)},function(d){return d.constructor===t&&d._isIn(O)},function(d){return O.remove(d.getKey())})};this.get=function(d){var p=j(d),p=J[p];if(p===q)return null;for(var t=0;t<p.length;++t)if(ia(p[t].key,d))return p[t].value;return null};this.isEmpty=function(){return E===0};this.keySet=function(){return new u(function(d){return d.key},function(d){return O.containsKey(d)},function(d){return O.remove(d)})};this.put=function(d,p){var t=j(d),
u=J[t];if(u===q)return++E,J[t]=[{key:d,value:p}],G(),null;for(t=0;t<u.length;++t)if(ia(u[t].key,d)){var z=u[t].value;u[t].value=p;return z}++E;u.push({key:d,value:p});G();return null};this.putAll=function(d){for(d=d.entrySet().iterator();d.hasNext();){var j=d.next();this.put(j.getKey(),j.getValue())}};this.remove=function(d){var p=j(d),t=J[p];if(t===q)return null;for(var G=0;G<t.length;++G)if(ia(t[G].key,d))return--E,d=t[G].value,t[G].removed=!0,t.length>1?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;u<z;++u)q[u]=0}else for(var q=[],u=j.slice(1),t=0;t<z;++t)q.push(W.createJavaArray(d,u))}return q};var Gb={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",
blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",
darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",
lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",
mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",
pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",
whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},La=[],Hb={},A=this.Processing=function(p,L){function G(a){A.debug("Unimplemented - "+a)}function z(a,b,f,c){var e=va.locations[a];e===q&&(e=h.getUniformLocation(b,f),va.locations[a]=e);e!==-1&&(c.length===4?h.uniform4fv(e,c):c.length===3?h.uniform3fv(e,c):c.length===2?h.uniform2fv(e,c):h.uniform1f(e,c))}function u(a,b,f,c){var e=va.locations[a];e===q&&(e=h.getUniformLocation(b,f),va.locations[a]=e);e!==-1&&(c.length===4?h.uniform4iv(e,c):
c.length===3?h.uniform3iv(e,c):c.length===2?h.uniform2iv(e,c):h.uniform1i(e,c))}function t(a,b,f,c,e){var d=va.attributes[a];d===q&&(d=h.getAttribLocation(b,f),va.attributes[a]=d);d!==-1&&(h.bindBuffer(h.ARRAY_BUFFER,e),h.vertexAttribPointer(d,c,h.FLOAT,!1,0,0),h.enableVertexAttribArray(d))}function ma(a,b,f){var c=va.attributes[a];c===q&&(c=h.getAttribLocation(b,f),va.attributes[a]=c);c!==-1&&h.disableVertexAttribArray(c)}function N(a,b,f,c,e){var d=va.locations[a];d===q&&(d=h.getUniformLocation(b,
f),va.locations[a]=d);d!==-1&&(e.length===16?h.uniformMatrix4fv(d,c,e):e.length===9?h.uniformMatrix3fv(d,c,e):h.uniformMatrix2fv(d,c,e))}function J(a,b,f,l){Ta===d.HSB?(f=c.color.toRGB(a,b,f),a=f[0],b=f[1],f=f[2]):(a=j.round(255*(a/ja)),b=j.round(255*(b/wa)),f=j.round(255*(f/na)));l=j.round(255*(l/fa));return(l>255?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<b;e++)c+=f&a?"1":"0",f>>>=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;k<m;k++)i.push(za(a[k],b,f,c,e,d));return i}else return za(a,b,f,c,e,d)}function Ca(a){a=parseInt("0x"+a,16);a>2147483647&&(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;i<e;++i)$.text$line(a[i],b,f+g,c,kb),g+=Ua}function Oc(a,b,f,c,e,g){if(!(a.length===0||c===0||e===0)&&!(M>e)){var i=-1,k=0,m=0,j=0;h.font=M+"px "+Y.name;for(var o=[],q=0,n=a.length;q<n;q++){var p=
a[q],s=p===" ",t=h.measureText(p).width;if(p!=="\n"&&m+t<c)s&&(i=q),m+=t;else{if(i+1===k)if(q>0)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}}k<n&&o.push({text:a.substring(k),width:m,offset:j});a=0;kb===d.CENTER?a=c/2:kb===d.RIGHT&&(a=c);c=(1-Jb)*M;i=0;jb===d.BOTTOM?i=e-o.length*Ua:jb===d.CENTER&&(i=(e-o.length*Ua)/2);k=0;for(m=o.length;k<m;k++)if(j=o[k],!(j.offset+i<0)){if(j.offset+i+M>e)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<a.touches.length;f++){var c=a.touches[f];c.offsetX=c.pageX-b.X;c.offsetY=c.pageY-b.Y}for(f=0;f<a.targetTouches.length;f++)c=a.targetTouches[f],c.offsetX=c.pageX-b.X,c.offsetY=c.pageY-b.Y;for(f=0;f<a.changedTouches.length;f++)c=a.changedTouches[f],c.offsetX=c.pageX-b.X,c.offsetY=c.pageY-b.Y;
return a}function Ka(a){a=a.which||a.keyCode;switch(a){case 13:return 10;case 91:case 93:case 224:return 157;case 57392:return 17;case 46:return 127;case 45:return 155}return a}function Aa(a){typeof a.preventDefault==="function"?a.preventDefault():typeof a.stopPropagation==="function"&&a.stopPropagation();return!1}function fc(){for(var a in Va)if(Va.hasOwnProperty(a)){c.__keyPressed=!0;return}c.__keyPressed=!1}function xb(a,b){Va[a]=b;$a=null;c.key=b;c.keyCode=a;c.keyPressed();c.keyCode=0;c.keyTyped();
fc()}function dc(a){var b=Ka(a);if(b===d.DELETE)xb(b,new ka(127));else if(wd.indexOf(b)<0)$a=b;else{var f=new ka(d.CODED);c.key=f;c.keyCode=b;Va[b]=f;c.keyPressed();$a=null;fc();return Aa(a)}}function ec(a){if($a!==null){var b=$a,f;f=a.which||a.keyCode;var c=a.shiftKey||a.ctrlKey||a.altKey||a.metaKey;switch(f){case 13:f=c?13:10;break;case 8:f=c?127:8}f=new ka(f);xb(b,f);return Aa(a)}}function xd(a){var a=Ka(a),b=Va[a];if(b!==q)c.key=b,c.keyCode=a,c.keyReleased(),delete Va[a],fc()}if(!(this instanceof
A))throw"called Processing constructor as if it were a function: missing 'new'.";var c=this,mb=arguments.length===0;mb&&(p=E.createElement("canvas"));c.externals={canvas:p,context:q,sketch:q};c.name="Processing.js Instance";c.use3DContext=!1;c.focused=!1;c.breakShape=!1;c.glyphTable={};c.pmouseX=0;c.pmouseY=0;c.mouseX=0;c.mouseY=0;c.mouseButton=0;c.mouseScroll=0;c.mouseClicked=q;c.mouseDragged=q;c.mouseMoved=q;c.mousePressed=q;c.mouseReleased=q;c.mouseScrolled=q;c.mouseOver=q;c.mouseOut=q;c.touchStart=
q;c.touchEnd=q;c.touchMove=q;c.touchCancel=q;c.key=q;c.keyCode=q;c.keyPressed=function(){};c.keyReleased=function(){};c.keyTyped=function(){};c.draw=q;c.setup=q;c.__mousePressed=!1;c.__keyPressed=!1;c.__frameRate=60;c.frameCount=0;c.width=100;c.height=100;var h,T,$,R=!0,oa=[1,1,1,1],Na=4294967295,Ma=!0,I=!0,la=[0.8,0.8,0.8,1],ba=4294835709,Ib=!0,xa=1,Mb=!1,ab=!0,Nb=0,bb=d.CORNER,Wa=d.CENTER,gc=0,hc=0,ic=0,Ob=d.NORMAL_MODE_AUTO,jc=60,Tc=1E3/jc,yd=p.style.cursor,U=d.POLYGON,kc=0,lc=20,Uc=!1,nb=-3355444,
mc=20,fa=255,ja=255,wa=255,na=255,Ta=d.RGB,cb=null,M=12,Y={name:'"Arial", sans-serif',origName:"Arial"},Ua=14,Vc=(new Date).getTime(),nc=Vc,Pb=0,ra,zb,Qb,ob,pb,oc,pc,va={attributes:{},locations:{}},s,x,ga,qc,rc,sc,Rb,tc,Ab,uc,Wc,vc,Xc,Sb,Yc,Zc,$c,Tb={width:0,height:0},ad=d.IMAGE,pa=!1,wc,xc,yc,kb=d.LEFT,jb=d.BASELINE,Jb=0.2,zc=d.MODEL,Lc,Ac=null,yb=!1,bd,cd=1E3,Va=[],$a=null,wd=[d.SHIFT,d.CONTROL,d.ALT,d.CAPSLK,d.PGUP,d.PGDN,d.END,d.HOME,d.LEFT,d.UP,d.RIGHT,d.DOWN,d.NUMLK,d.INSERT,d.F1,d.F2,d.F3,
d.F4,d.F5,d.F6,d.F7,d.F8,d.F9,d.F10,d.F11,d.F12,d.META],Pc,Qc,Rc,Sc;E.defaultView&&E.defaultView.getComputedStyle&&(Pc=parseInt(E.defaultView.getComputedStyle(p,null).paddingLeft,10)||0,Qc=parseInt(E.defaultView.getComputedStyle(p,null).paddingTop,10)||0,Rc=parseInt(E.defaultView.getComputedStyle(p,null).borderLeftWidth,10)||0,Sc=parseInt(E.defaultView.getComputedStyle(p,null).borderTopWidth,10)||0);var D=0,Ub=0,db=0,Ea=[],Fa=[],Ga=[],qb=new P(d.SINCOS_LENGTH),rb=new P(d.SINCOS_LENGTH),H,eb,Ha,ca,
da,Q,Ia,sb,tb,Bb,ya,Vb=!1,Wb=60*(j.PI/180),Bc=c.width/2,fb=c.height/2,gb=fb/j.tan(Wb/2),dd=gb/10,ed=gb*10,fd=c.width/c.height,o=[],ha=[],ea=0,ub=!1,vb=!1,Xa=!0,Cb=d.CORNER,gd=[],hd=new P([0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,0.5,
-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5]),id=new P([0.5,0.5,0.5,0.5,-0.5,0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,
0.5]),zd=new P([0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0]),Cc=new P([0,0,0,0,1,0,1,1,0,1,0,0]),Ad=new P([0,0,1,0,0,1,0,0,1,0,0,1]),Bd="varying vec4 frontColor;attribute vec3 Vertex;attribute vec3 Normal;attribute vec4 aColor;attribute vec2 aTexture;varying vec2 vTexture;uniform vec4 color;uniform bool usingMat;uniform vec3 specular;uniform vec3 mat_emissive;uniform vec3 mat_ambient;uniform vec3 mat_specular;uniform float shininess;uniform mat4 model;uniform mat4 view;uniform mat4 projection;uniform mat4 normalTransform;uniform int lightCount;uniform vec3 falloff;struct Light { int type; vec3 color; vec3 position; vec3 direction; float angle; vec3 halfVector; float concentration;};uniform Light lights0;uniform Light lights1;uniform Light lights2;uniform Light lights3;uniform Light lights4;uniform Light lights5;uniform Light lights6;uniform Light lights7;Light getLight(int index){ if(index == 0) return lights0; if(index == 1) return lights1; if(index == 2) return lights2; if(index == 3) return lights3; if(index == 4) return lights4; if(index == 5) return lights5; if(index == 6) return lights6; return lights7;}void AmbientLight( inout vec3 totalAmbient, in vec3 ecPos, in Light light ) { float d = length( light.position - ecPos ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d )); totalAmbient += light.color * attenuation;}void DirectionalLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerfactor = 0.0; float nDotVP = max(0.0, dot( vertNormal, normalize(-light.position) )); float nDotVH = max(0.0, dot( vertNormal, normalize(-light.position-normalize(ecPos) ))); if( nDotVP != 0.0 ){ powerfactor = pow( nDotVH, shininess ); } col += light.color * nDotVP; spec += specular * powerfactor;}void PointLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerfactor; vec3 VP = light.position - ecPos; float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d )); 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 SpotLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float spotAttenuation; float powerfactor; vec3 VP = light.position - ecPos; vec3 ldir = normalize( -light.direction ); float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d ) ); float spotDot = dot( VP, ldir );"+
(/Windows/.test(navigator.userAgent)?" spotAttenuation = 1.0; ":" if( spotDot > 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;a<b;a++)this.children[a].disableStyle()},enableStyle:function(){this.style=!0;for(var a=0,b=this.children.length;a<b;a++)this.children[a].enableStyle()},getFamily:function(){return this.family},getWidth:function(){return this.width},getHeight:function(){return this.height},setName:function(a){this.name=a},getName:function(){return this.name},draw:function(){this.visible&&(this.pre(),this.drawImpl(),this.post())},drawImpl:function(){this.family===
d.GROUP?this.drawGroup():this.family===d.PRIMITIVE?this.drawPrimitive():this.family===d.GEOMETRY?this.drawGeometry():this.family===d.PATH&&this.drawPath()},drawPath:function(){var a,b;if(this.vertices.length!==0){c.beginShape();if(this.vertexCodes.length===0)if(this.vertices[0].length===2){a=0;for(b=this.vertices.length;a<b;a++)c.vertex(this.vertices[a][0],this.vertices[a][1])}else{a=0;for(b=this.vertices.length;a<b;a++)c.vertex(this.vertices[a][0],this.vertices[a][1],this.vertices[a][2])}else{var f=
0;if(this.vertices[0].length===2){a=0;for(b=this.vertexCodes.length;a<b;a++)if(this.vertexCodes[a]===d.VERTEX)c.vertex(this.vertices[f][0],this.vertices[f][1]),this.vertices[f].moveTo===!0?o[o.length-1].moveTo=!0:this.vertices[f].moveTo===!1&&(o[o.length-1].moveTo=!1),c.breakShape=!1,f++;else if(this.vertexCodes[a]===d.BEZIER_VERTEX)c.bezierVertex(this.vertices[f+0][0],this.vertices[f+0][1],this.vertices[f+1][0],this.vertices[f+1][1],this.vertices[f+2][0],this.vertices[f+2][1]),f+=3;else if(this.vertexCodes[a]===
d.CURVE_VERTEX)c.curveVertex(this.vertices[f][0],this.vertices[f][1]),f++;else if(this.vertexCodes[a]===d.BREAK)c.breakShape=!0}else{a=0;for(b=this.vertexCodes.length;a<b;a++)if(this.vertexCodes[a]===d.VERTEX)c.vertex(this.vertices[f][0],this.vertices[f][1],this.vertices[f][2]),this.vertices[f].moveTo===!0?o[o.length-1].moveTo=!0:this.vertices[f].moveTo===!1&&(o[o.length-1].moveTo=!1),c.breakShape=!1;else if(this.vertexCodes[a]===d.BEZIER_VERTEX)c.bezierVertex(this.vertices[f+0][0],this.vertices[f+
0][1],this.vertices[f+0][2],this.vertices[f+1][0],this.vertices[f+1][1],this.vertices[f+1][2],this.vertices[f+2][0],this.vertices[f+2][1],this.vertices[f+2][2]),f+=3;else if(this.vertexCodes[a]===d.CURVE_VERTEX)c.curveVertex(this.vertices[f][0],this.vertices[f][1],this.vertices[f][2]),f++;else if(this.vertexCodes[a]===d.BREAK)c.breakShape=!0}}c.endShape(this.close?d.CLOSE:d.OPEN)}},drawGeometry:function(){var a,b;c.beginShape(this.kind);if(this.style){a=0;for(b=this.vertices.length;a<b;a++)c.vertex(this.vertices[a])}else{a=
0;for(b=this.vertices.length;a<b;a++){var f=this.vertices[a];f[2]===0?c.vertex(f[0],f[1]):c.vertex(f[0],f[1],f[2])}}c.endShape()},drawGroup:function(){for(var a=0,b=this.children.length;a<b;a++)this.children[a].draw()},drawPrimitive:function(){this.kind===d.POINT?c.point(this.params[0],this.params[1]):this.kind===d.LINE?this.params.length===4?c.line(this.params[0],this.params[1],this.params[2],this.params[3]):c.line(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]):
this.kind===d.TRIANGLE?c.triangle(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]):this.kind===d.QUAD?c.quad(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5],this.params[6],this.params[7]):this.kind===d.RECT?this.image!==null?(c.imageMode(d.CORNER),c.image(this.image,this.params[0],this.params[1],this.params[2],this.params[3])):(c.rectMode(d.CORNER),c.rect(this.params[0],this.params[1],this.params[2],this.params[3])):
this.kind===d.ELLIPSE?(c.ellipseMode(d.CORNER),c.ellipse(this.params[0],this.params[1],this.params[2],this.params[3])):this.kind===d.ARC?(c.ellipseMode(d.CORNER),c.arc(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5])):this.kind===d.BOX?this.params.length===1?c.box(this.params[0]):c.box(this.params[0],this.params[1],this.params[2]):this.kind===d.SPHERE&&c.sphere(this.params[0])},pre:function(){this.matrix&&(c.pushMatrix(),h.transform(this.matrix.elements[0],
this.matrix.elements[3],this.matrix.elements[1],this.matrix.elements[4],this.matrix.elements[2],this.matrix.elements[5]));this.style&&(c.pushStyle(),this.styles())},post:function(){this.matrix&&c.popMatrix();this.style&&c.popStyle()},styles:function(){this.stroke?(c.stroke(this.strokeColor),c.strokeWeight(this.strokeWeight),c.strokeCap(this.strokeCap),c.strokeJoin(this.strokeJoin)):c.noStroke();this.fill?c.fill(this.fillColor):c.noFill()},getChild:function(a){var b,f;if(typeof a==="number")return this.children[a];
else{var c;if(a===""||this.name===a)return this;else{if(this.nameTable.length>0){b=0;for(f=this.nameTable.length;b<f||c;b++)this.nameTable[b].getName===a&&(c=this.nameTable[b]);if(c)return c}b=0;for(f=this.children.length;b<f;b++)if(c=this.children[b].getChild(a))return c}return null}},getChildCount:function(){return this.children.length},addChild:function(a){this.children.push(a);a.parent=this;a.getName()!==null&&this.addName(a.getName(),a)},addName:function(a,b){this.parent!==null?this.parent.addName(a,
b):this.nameTable.push([a,b])},translate:function(){arguments.length===2?(this.checkMatrix(2),this.matrix.translate(arguments[0],arguments[1])):(this.checkMatrix(3),this.matrix.translate(arguments[0],arguments[1],0))},checkMatrix:function(a){if(this.matrix===null)this.matrix=a===2?new c.PMatrix2D:new c.PMatrix3D;else if(a===3&&this.matrix instanceof c.PMatrix2D)this.matrix=new c.PMatrix3D},rotateX:function(a){this.rotate(a,1,0,0)},rotateY:function(a){this.rotate(a,0,1,0)},rotateZ:function(a){this.rotate(a,
0,0,1)},rotate:function(){arguments.length===1?(this.checkMatrix(2),this.matrix.rotate(arguments[0])):(this.checkMatrix(3),this.matrix.rotate(arguments[0],arguments[1],arguments[2],arguments[3]))},scale:function(){arguments.length===2?(this.checkMatrix(2),this.matrix.scale(arguments[0],arguments[1])):arguments.length===3?(this.checkMatrix(2),this.matrix.scale(arguments[0],arguments[1],arguments[2])):(this.checkMatrix(2),this.matrix.scale(arguments[0]))},resetMatrix:function(){this.checkMatrix(2);
this.matrix.reset()},applyMatrix:function(a){arguments.length===1?this.applyMatrix(a.elements[0],a.elements[1],0,a.elements[2],a.elements[3],a.elements[4],0,a.elements[5],0,0,1,0,0,0,0,1):arguments.length===6?(this.checkMatrix(2),this.matrix.apply(arguments[0],arguments[1],arguments[2],0,arguments[3],arguments[4],arguments[5],0,0,0,1,0,0,0,0,1)):arguments.length===16&&(this.checkMatrix(3),this.matrix.apply(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],
arguments[7],arguments[8],arguments[9],arguments[10],arguments[11],arguments[12],arguments[13],arguments[14],arguments[15]))}};var K=c.PShapeSVG=function(){c.PShape.call(this);if(arguments.length===1){if(this.element=arguments[0],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=null,this.strokeOpacity=1,this.fill=!0,this.fillColor=
d.ALPHA_MASK,this.fillName=this.fillGradientPaint=this.fillGradient=null,this.fillOpacity=1,this.element.getName()!=="svg")throw"root is not <svg>, 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 <svg> 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<l;b++){var e=a(f[b]);
if(f[b].indexOf("matrix")!==-1)this.matrix.set(e[0],e[2],e[4],e[1],e[3],e[5]);else if(f[b].indexOf("translate")!==-1)this.matrix.translate(e[0],e.length===2?e[1]:0);else if(f[b].indexOf("scale")!==-1)this.matrix.scale(e[0],e.length===2?e[1]:e[0]);else if(f[b].indexOf("rotate")!==-1){var d=e[0];e.length===1?this.matrix.rotate(c.radians(d)):e.length===3&&(this.matrix.translate(e[1],e[2]),this.matrix.rotate(c.radians(e[0])),this.matrix.translate(-e[1],-e[2]))}else f[b].indexOf("skewX")!==-1?this.matrix.skewX(parseFloat(e[0])):
f[b].indexOf("skewY")!==-1&&this.matrix.skewY(e[0])}return this.matrix}}();K.prototype.parseChildren=function(a){for(var a=a.getChildren(),b=new c.PShape,f=0,l=a.length;f<l;f++){var e=this.parseChild(a[f]);e&&b.addChild(e)}this.children.push(b)};K.prototype.getName=function(){return this.name};K.prototype.parseChild=function(a){var b=a.getName(),f;b==="g"?f=new K(this,a):b==="defs"?f=new K(this,a):b==="line"?(f=new K(this,a),f.parseLine()):b==="circle"?(f=new K(this,a),f.parseEllipse(!0)):b==="ellipse"?
(f=new K(this,a),f.parseEllipse(!1)):b==="rect"?(f=new K(this,a),f.parseRect()):b==="polygon"?(f=new K(this,a),f.parsePoly(!0)):b==="polyline"?(f=new K(this,a),f.parsePoly(!1)):b==="path"?(f=new K(this,a),f.parsePath()):b==="radialGradient"?G("PShapeSVG.prototype.parseChild, name = radialGradient"):b==="linearGradient"?G("PShapeSVG.prototype.parseChild, name = linearGradient"):b==="text"?G("PShapeSVG.prototype.parseChild, name = text"):b==="filter"?G("PShapeSVG.prototype.parseChild, name = filter"):
b==="mask"&&G("PShapeSVG.prototype.parseChild, name = mask");return f};K.prototype.parsePath=function(){this.family=d.PATH;this.kind=0;var a=c.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g," "));if(a!==null)for(var a=c.__toCharArray(a),b=0,f=0,l=0,e=0,g=e=l=0,i=0,k=0,m=0,h=m=e=k=l=0,j=0,o="",n=[],q=!1,p,s,r;h<a.length;)if(j=a[h].valueOf(),j>=65&&j<=90||j>=97&&j<=122){r=h;h++;if(h<a.length){n=[];for(j=a[h].valueOf();!(j>=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<j;r+=2)b=n[r],f=n[r+1],this.parsePathLineto(b,f)}}else if(j===109){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<j;r+=2)b+=n[r],f+=n[r+1],this.parsePathLineto(b,f)}}else if(j===76){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)b=n[r],f=n[r+1],this.parsePathLineto(b,f)}}else if(j===108){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)b+=n[r],f+=n[r+1],this.parsePathLineto(b,f)}}else if(j===72){r=0;for(j=n.length;r<j;r++)b=n[r],this.parsePathLineto(b,f)}else if(j===104){r=0;for(j=n.length;r<j;r++)b+=n[r],this.parsePathLineto(b,f)}else if(j===86){r=
0;for(j=n.length;r<j;r++)f=n[r],this.parsePathLineto(b,f)}else if(j===118){r=0;for(j=n.length;r<j;r++)f+=n[r],this.parsePathLineto(b,f)}else if(j===67){if(n.length>=6&&n.length%6===0){r=0;for(j=n.length;r<j;r+=6)l=n[r],g=n[r+1],e=n[r+2],i=n[r+3],k=n[r+4],m=n[r+5],this.parsePathCurveto(l,g,e,i,k,m),b=k,f=m}}else if(j===99){if(n.length>=6&&n.length%6===0){r=0;for(j=n.length;r<j;r+=6)l=b+n[r],g=f+n[r+1],e=b+n[r+2],i=f+n[r+3],k=b+n[r+4],m=f+n[r+5],this.parsePathCurveto(l,g,e,i,k,m),b=k,f=m}}else if(j===
83){if(n.length>=4&&n.length%4===0){r=0;for(j=n.length;r<j;r+=4)p.toLowerCase()==="c"||p.toLowerCase()==="s"?(l=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-1][0],m=this.vertices[this.vertices.length-1][1],l=e+(e-l),g=m+(m-k)):(l=this.vertices[this.vertices.length-1][0],g=this.vertices[this.vertices.length-1][1]),e=n[r],i=n[r+1],k=n[r+2],m=n[r+3],this.parsePathCurveto(l,g,e,i,k,m),b=k,f=m}}else if(j===115){if(n.length>=4&&
n.length%4===0){r=0;for(j=n.length;r<j;r+=4)p.toLowerCase()==="c"||p.toLowerCase()==="s"?(l=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-1][0],m=this.vertices[this.vertices.length-1][1],l=e+(e-l),g=m+(m-k)):(l=this.vertices[this.vertices.length-1][0],g=this.vertices[this.vertices.length-1][1]),e=b+n[r],i=f+n[r+1],k=b+n[r+2],m=f+n[r+3],this.parsePathCurveto(l,g,e,i,k,m),b=k,f=m}}else if(j===81){if(n.length>=4&&n.length%4===
0){r=0;for(j=n.length;r<j;r+=4)l=n[r],e=n[r+1],k=n[r+2],m=n[r+3],this.parsePathQuadto(b,f,l,e,k,m),b=k,f=m}}else if(j===113){if(n.length>=4&&n.length%4===0){r=0;for(j=n.length;r<j;r+=4)l=b+n[r],e=f+n[r+1],k=b+n[r+2],m=f+n[r+3],this.parsePathQuadto(b,f,l,e,k,m),b=k,f=m}}else if(j===84){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)p.toLowerCase()==="q"||p.toLowerCase()==="t"?(l=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-
1][0],m=this.vertices[this.vertices.length-1][1],l=e+(e-l),e=m+(m-k)):(l=b,e=f),k=n[r],m=n[r+1],this.parsePathQuadto(b,f,l,e,k,m),b=k,f=m}}else if(j===116){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)p.toLowerCase()==="q"||p.toLowerCase()==="t"?(l=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-1][0],m=this.vertices[this.vertices.length-1][1],l=e+(e-l),e=m+(m-k)):(l=b,e=f),k=b+n[r],m=f+n[r+1],this.parsePathQuadto(b,
f,l,e,k,m),b=k,f=m}}else if(j!==90&&j===122)this.close=!0;p=s.toString()}else h++};K.prototype.parsePathQuadto=function(a,b,f,c,e,g){if(this.vertices.length>0)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<f;b++){var l=[];l[0]=a[b];l[1]=a[++b];this.vertices.push(l)}else throw"Error parsing polygon points: odd number of coordinates provided";};K.prototype.parseRect=function(){this.kind=
d.RECT;this.family=d.PRIMITIVE;this.params=[];this.params[0]=this.element.getFloatAttribute("x");this.params[1]=this.element.getFloatAttribute("y");this.params[2]=this.element.getFloatAttribute("width");this.params[3]=this.element.getFloatAttribute("height");if(this.params[2]<0||this.params[3]<0)throw"svg error: negative width or height found while parsing <rect>";};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 <circle>";}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 <ellipse>";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<f;b++){var l=c.trim(a[b].split(":"));l[0]==="fill"?this.setFill(l[1]):l[0]==="fill-opacity"?this.setFillOpacity(l[1]):l[0]==="stroke"?this.setStroke(l[1]):l[0]==="stroke-width"?this.setStrokeWeight(l[1]):
l[0]==="stroke-linecap"?this.setStrokeCap(l[1]):l[0]==="stroke-linejoin"?this.setStrokeJoin(l[1]):l[0]==="stroke-opacity"?this.setStrokeOpacity(l[1]):l[0]==="opacity"&&this.setOpacity(l[1])}};K.prototype.setFillOpacity=function(a){this.fillOpacity=parseFloat(a);this.fillColor=this.fillOpacity*255<<24|this.fillColor&16777215};K.prototype.setFill=function(a){var b=this.fillColor&4278190080;if(a==="none")this.fill=!1;else if(a.indexOf("#")===0)this.fill=!0,a.length===4&&(a=a.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")),
this.fillColor=b|parseInt(a.substring(1),16)&16777215;else if(a.indexOf("rgb")===0)this.fill=!0,this.fillColor=b|this.parseRGB(a);else if(a.indexOf("url(#")===0)this.fillName=a.substring(5,a.length-1);else if(Gb[a])this.fill=!0,this.fillColor=b|parseInt(Gb[a].substring(1),16)&16777215};K.prototype.setOpacity=function(a){this.strokeColor=parseFloat(a)*255<<24|this.strokeColor&16777215;this.fillColor=parseFloat(a)*255<<24|this.fillColor&16777215};K.prototype.setStroke=function(a){var b=this.strokeColor&
4278190080;if(a==="none")this.stroke=!1;else if(a.charAt(0)==="#")this.stroke=!0,a.length===4&&(a=a.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")),this.strokeColor=b|parseInt(a.substring(1),16)&16777215;else if(a.indexOf("rgb")===0)this.stroke=!0,this.strokeColor=b|this.parseRGB(a);else if(a.indexOf("url(#")===0)this.strokeName=a.substring(5,a.length-1);else if(Gb[a])this.stroke=!0,this.strokeColor=b|parseInt(Gb[a].substring(1),16)&16777215};K.prototype.setStrokeWeight=function(a){this.strokeWeight=this.parseUnitSize(a)};
K.prototype.setStrokeJoin=function(a){if(a==="miter")this.strokeJoin=d.MITER;else if(a==="round")this.strokeJoin=d.ROUND;else if(a==="bevel")this.strokeJoin=d.BEVEL};K.prototype.setStrokeCap=function(a){if(a==="butt")this.strokeCap=d.SQUARE;else if(a==="round")this.strokeCap=d.ROUND;else if(a==="square")this.strokeCap=d.PROJECT};K.prototype.setStrokeOpacity=function(a){this.strokeOpacity=parseFloat(a);this.strokeColor=this.strokeOpacity*255<<24|this.strokeColor&16777215};K.prototype.parseRGB=function(a){a=
a.substring(a.indexOf("(")+1,a.indexOf(")")).split(", ");return a[0]<<16|a[1]<<8|a[2]};K.prototype.parseUnitSize=function(a){var b=a.length-2;if(b<0)return a;return a.indexOf("pt")===b?parseFloat(a.substring(0,b))*1.25:a.indexOf("pc")===b?parseFloat(a.substring(0,b))*15:a.indexOf("mm")===b?parseFloat(a.substring(0,b))*3.543307:a.indexOf("cm")===b?parseFloat(a.substring(0,b))*35.43307:a.indexOf("in")===b?parseFloat(a.substring(0,b))*90:a.indexOf("px")===b?parseFloat(a.substring(0,b)):parseFloat(a)};
c.shape=function(a,b,f,l,e){arguments.length>=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;e<d;e++)c=b.attributes[e],c=new Yb(c.getname,c.nodeName,c.namespaceURI,c.nodeValue,c.nodeType),f.attributes.push(c);e=0;for(d=b.childNodes.length;e<d;e++)if(c=b.childNodes[e],c.nodeType===1||c.nodeType===
3)c=f.parseChildrenRecursive(f,c),c!==null&&f.children.push(c);return f},createElement:function(){return arguments.length===2?new Ya(arguments[0],arguments[1],null,null):new Ya(arguments[0],arguments[1],arguments[2],arguments[3])},createPCDataElement:function(a){if(a.replace(/^\s+$/g,"")==="")return null;var b=new Ya;b.content=a;b.type="TEXT";return b},hasAttribute:function(){if(arguments.length===1)return this.getAttribute(arguments[0])!==null;else if(arguments.length===2)return this.getAttribute(arguments[0],
arguments[1])!==null},equals:function(a){if(!(a instanceof Ya))return!1;var b,f;if(this.name!==a.getLocalName())return!1;if(this.attributes.length!==a.getAttributeCount())return!1;if(this.attributes.length!==a.attributes.length)return!1;var c,e;b=0;for(f=this.attributes.length;b<f;b++){c=this.attributes[b].getName();e=this.attributes[b].getNamespace();c=a.findAttribute(c,e);if(c===null)return!1;if(this.attributes[b].getValue()!==c.getValue())return!1;if(this.attributes[b].getType()!==c.getType())return!1}if(this.children.length!==
a.getChildCount())return!1;if(this.children.length>0){b=0;for(f=this.children.length;b<f;b++)if(c=this.getChild(b),e=a.getChild(b),!c.equals(e))return!1;return!0}else return this.content===a.content},getContent:function(){if(this.type==="TEXT")return this.content;else if(this.children.length===1&&this.children[0].type==="TEXT")return this.children[0].content;return null},getAttribute:function(){var a;if(arguments.length===2)return(a=this.findAttribute(arguments[0]))?a.getValue():arguments[1];else if(arguments.length===
1)return(a=this.findAttribute(arguments[0]))?a.getValue():null;else if(arguments.length===3)return(a=this.findAttribute(arguments[0],arguments[1]))?a.getValue():arguments[2]},getStringAttribute:function(){return arguments.length===1?this.getAttribute(arguments[0]):arguments.length===2?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getString:function(a){return this.getStringAttribute(a)},getFloatAttribute:function(){return arguments.length===
1?parseFloat(this.getAttribute(arguments[0],0)):arguments.length===2?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getFloat:function(a){return this.getFloatAttribute(a)},getIntAttribute:function(){return arguments.length===1?this.getAttribute(arguments[0],0):arguments.length===2?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getInt:function(a){return this.getIntAttribute(a)},hasChildren:function(){return this.children.length>
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();c<e;c++)b=this.getChild(c),f=b.getName(),f!==null&&f===arguments[0]&&a.push(b);return a}else return this.children},getChildCount:function(){return this.children.length},
getChildRecursive:function(a,b){for(var f,c,e=0,d=this.getChildCount();e<d;e++)if(f=this.getChild(e),c=f.getName(),c!==null&&c===a[b])return b===a.length-1?f:(b+=1,f.getChildRecursive(a,b));return null},getChildrenRecursive:function(a,b){if(b===a.length-1)return this.getChildren(a[b]);for(var f=this.getChildren(a[b]),c=[],e=0;e<f.length;e++)c=c.concat(f[e].getChildrenRecursive(a,b+1));return c},isLeaf:function(){return!this.hasChildren()},listChildren:function(){for(var a=[],b=0,f=this.children.length;b<
f;b++)a.push(this.getChild(b).getName());return a},removeAttribute:function(a,b){this.namespace=b||"";for(var f=0,c=this.attributes.length;f<c;f++)if(this.attributes[f].getName()===a&&this.attributes[f].getNamespace()===this.namespace){this.attributes.splice(f,1);break}},removeChild:function(a){if(a)for(var b=0,f=this.children.length;b<f;b++)if(this.children[b].equals(a)){this.children.splice(b,1);break}},removeChildAtIndex:function(a){this.children.length>a&&this.children.splice(a,1)},findAttribute:function(a,
b){this.namespace=b||"";for(var f=0,c=this.attributes.length;f<c;f++)if(this.attributes[f].getName()===a&&this.attributes[f].getNamespace()===this.namespace)return this.attributes[f];return null},setAttribute:function(){var a;if(arguments.length===3){a=arguments[0].indexOf(":");var b=arguments[0].substring(a+1);(a=this.findAttribute(b,arguments[1]))?a.setValue(arguments[2]):(a=new Yb(arguments[0],b,arguments[1],arguments[2],"CDATA"),this.attributes.push(a))}else(a=this.findAttribute(arguments[0]))?
a.setValue(arguments[1]):(a=new Yb(arguments[0],arguments[0],null,arguments[1],"CDATA"),this.attributes.push(a))},setString:function(a,b){this.setAttribute(a,b)},setInt:function(a,b){this.setAttribute(a,b)},setFloat:function(a,b){this.setAttribute(a,b)},setContent:function(a){this.children.length>0&&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.attributes.length;f++){var c=
this.attributes[f];b+=" "+c.getName()+'="'+c.getValue()+'"'}if(this.children.length===0)b+=this.content===""?"/>":">"+this.content+"</"+a+">";else{b+=">";for(f=0;f<this.children.length;f++)b+=this.children[f].toString();b+="</"+a+">"}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;f<a.length;f++)b=f!==0?j.max(b,j.abs(a[f])):j.abs(a[f]);a=(b+"").indexOf(".");if(a===0)a=1;else if(a===-1)a=(b+"").length;return a},Pa=c.PMatrix2D=function(){arguments.length===
0?this.reset():arguments.length===1&&arguments[0]instanceof Pa?this.set(arguments[0].array()):arguments.length===6&&this.set(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])};Pa.prototype={set:function(){if(arguments.length===6){var a=arguments;this.set([a[0],a[1],a[2],a[3],a[4],a[5]])}else if(arguments.length===1&&arguments[0]instanceof Pa)this.elements=arguments[0].array();else if(arguments.length===1&&arguments[0]instanceof Array)this.elements=arguments[0].slice()},
get:function(){var a=new Pa;a.set(this.elements);return a},reset:function(){this.set([1,0,0,0,1,0])},array:function(){return this.elements.slice()},translate:function(a,b){this.elements[2]=a*this.elements[0]+b*this.elements[1]+this.elements[2];this.elements[5]=a*this.elements[3]+b*this.elements[4]+this.elements[5]},invTranslate:function(a,b){this.translate(-a,-b)},transpose:function(){},mult:function(a,b){var f,c;a instanceof aa?(f=a.x,c=a.y,b||(b=new aa)):a instanceof Array&&(f=a[0],c=a[1],b||(b=
[]));if(b instanceof Array)b[0]=this.elements[0]*f+this.elements[1]*c+this.elements[2],b[1]=this.elements[3]*f+this.elements[4]*c+this.elements[5];else if(b instanceof aa)b.x=this.elements[0]*f+this.elements[1]*c+this.elements[2],b.y=this.elements[3]*f+this.elements[4]*c+this.elements[5],b.z=0;return b},multX:function(a,b){return a*this.elements[0]+b*this.elements[1]+this.elements[2]},multY:function(a,b){return a*this.elements[3]+b*this.elements[4]+this.elements[5]},skewX:function(a){this.apply(1,
0,1,a,0,0)},skewY:function(a){this.apply(1,0,1,0,a,0)},determinant:function(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]},invert:function(){var a=this.determinant();if(j.abs(a)>d.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;e<c;e++)f.push(a[e]);typeof a[0]==="string"?f.sort():f.sort(function(a,b){return a-b});if(b>0)for(c=f.length;c<a.length;c++)f.push(a[c])}return f};c.splice=function(a,b,f){if(b.length===0)return a;if(b instanceof Array)for(var c=0;c<b.length;f++,c++)a.splice(f,0,b[c]);else a.splice(f,0,b);return a};c.subset=function(a,b,c){if(arguments.length===2)return a.slice(b,
a.length);else if(arguments.length===3)return a.slice(b,b+c)};c.join=function(a,b){return a.join(b)};c.shorten=function(a){for(var b=[],c=a.length,d=0;d<c;d++)b[d]=a[d];b.pop();return b};c.expand=function(a,b){var c=a.slice(0);if(arguments.length===1)return c.length=a.length*2,c;else if(arguments.length===2)return c.length=b,c};c.arrayCopy=function(){var a,b=0,c,d=0,e;arguments.length===2?(a=arguments[0],c=arguments[1],e=a.length):arguments.length===3?(a=arguments[0],c=arguments[1],e=arguments[2]):
arguments.length===5&&(a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[3],e=arguments[4]);for(var g=b;g<e+b;g++,d++)if(c[d]!==q)c[d]=a[g];else throw"array index out of bounds exception";};c.reverse=function(a){return a.reverse()};c.mix=function(a,b,c){return a+((b-a)*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<a.length;b++)f[b]=c.unbinary(a[b]);return f}else if(isNaN(a))throw"NaN_Err";else if(arguments.length===1||a.length===8)if(b.test(a)){for(b=0;b<8;b++)f+=j.pow(2,b)*parseInt(a.charAt(7-b),10);return f+""}else throw"notBinary: the value passed into unbinary was not an 8 bit binary number";
else throw"longErr";};c.nf=function(a,b,c){return Fb(a,"","-",b,c)};c.nfs=function(a,b,c){return Fb(a," ","-",b,c)};c.nfp=function(a,b,c){return Fb(a,"+","-",b,c)};c.nfc=function(a,b,c){return Fb(a,"","-",b,c,",")};c.hex=function(a,b){arguments.length===1&&(b=a instanceof ka?4:8);var c=a,d=b,d=d===q||d===null?d=8:d;c<0&&(c=4294967295+c+1);for(c=Number(c).toString(16).toUpperCase();c.length<d;)c="0"+c;c.length>=d&&(c=c.substring(c.length-d,c.length));return c};c.unhex=function(a){if(a instanceof Array){for(var b=
[],c=0;c<a.length;c++)b.push(Ca(a[c]));return b}else return Ca(a)};c.loadStrings=function(a){if(localStorage[a])return localStorage[a].split("\n");a=cc(a);if(typeof a!=="string"||a==="")return[];a=a.replace(/(\r\n?)/g,"\n").replace(/\n$/,"");return a.split("\n")};c.saveStrings=function(a,b){localStorage[a]=b.join("\n")};c.loadBytes=function(a){for(var a=cc(a),b=[],c=0;c<a.length;c++)b.push(a.charCodeAt(c));return b};c.matchAll=function(a,b){for(var c=[],d,e=RegExp(b,"g");(d=e.exec(a))!==null;)c.push(d),
d[0].length===0&&++e.lastIndex;return c.length>0?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;c<d;++c)b[c]=new ka(a.charAt(c));return b};c.__split=function(a,b,c){if(typeof a!=="string")return a.split.apply(a,Ba(arguments));var d=RegExp(b);if(c===q||c<1)return a.split(d);for(var e=[],g=a,i;(i=g.search(d))!==-1&&e.length<c-1;){var k=d.exec(g).toString();e.push(g.substring(0,i));g=g.substring(i+k.length)}(i!==-1||g!=="")&&e.push(g);return e};c.match=function(a,b){return a.match(b)};c.__hashCode=function(a){if(a.hashCode instanceof Function)return a.hashCode.apply(a,
Ba(arguments));return ac(a)};c.__printStackTrace=function(a){c.println("Exception: "+a.toString())};var Zb=[];c.console=S.console||A.logger;c.println=function(a){var b=Zb.length;if(b)A.logger.log(Zb.join("")),Zb.length=0;arguments.length===0&&b===0?A.logger.log(""):arguments.length!==0&&A.logger.log(a)};c.print=function(a){Zb.push(a)};c.str=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(a[c].toString()+"");return b}else return a.toString()+""};c.trim=function(a){if(a instanceof
Array){for(var b=[],c=0;c<a.length;c++)b.push(a[c].replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,""));return b}else return a.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,"")};c.parseBoolean=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(Hc(a[c]));return b}else return Hc(a)};c.parseByte=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(0-(a[c]&128)|a[c]&127);return b}else return 0-(a&128)|a&127};c.parseChar=function(a){if(typeof a===
"number")return new ka(String.fromCharCode(a&65535));else if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(new ka(String.fromCharCode(a[c]&65535)));return b}else throw"char() may receive only one argument of type int, byte, int[], or byte[].";};c.parseFloat=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(Ic(a[c]));return b}else return Ic(a)};c.parseInt=function(a,b){if(a instanceof Array){for(var c=[],d=0;d<a.length;d++)typeof a[d]==="string"&&!/^\s*[+\-]?\d+\s*$/.test(a[d])?
c.push(0):c.push(Jc(a[d],b));return c}else return Jc(a,b)};c.__int_cast=function(a){return 0|a};c.__instanceof=function(a,b){if(typeof b!=="function")throw"Function is expected as type argument for instanceof operator";if(typeof a==="string")return b===Object||b===String;if(a instanceof b)return!0;if(typeof a!=="object"||a===null)return!1;var c=a.constructor;if(b.$isInterface){for(var d=[];c;)c.$interfaces&&(d=d.concat(c.$interfaces)),c=c.$base;for(;d.length>0;){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:a<b?b:a};c.dist=function(){var a,b,c;if(arguments.length===4)return a=arguments[0]-arguments[2],b=arguments[1]-arguments[3],j.sqrt(a*a+b*b);else if(arguments.length===6)return a=arguments[0]-arguments[3],b=arguments[1]-arguments[4],c=arguments[2]-arguments[5],j.sqrt(a*a+b*b+c*c)};c.exp=j.exp;c.floor=j.floor;c.lerp=function(a,
b,c){return(b-a)*c+a};c.log=j.log;c.mag=function(a,b,c){if(c)return j.sqrt(a*a+b*b+c*c);return j.sqrt(a*a+b*b)};c.map=function(a,b,c,d,e){return d+(e-d)*((a-b)/(c-b))};c.max=function(){if(arguments.length===2)return arguments[0]<arguments[1]?arguments[1]:arguments[0];else{var a=arguments.length===1?arguments[0]:arguments;if(!("length"in a&&a.length>0))throw"Non-empty array is expected";for(var b=a[0],c=a.length,d=1;d<c;++d)b<a[d]&&(b=a[d]);return b}};c.min=function(){if(arguments.length===2)return arguments[0]<
arguments[1]?arguments[0]:arguments[1];else{var a=arguments.length===1?arguments[0]:arguments;if(!("length"in a&&a.length>0))throw"Non-empty array is expected";for(var b=a[0],c=a.length,d=1;d<c;++d)b>a[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;k<Ja.octaves;++k){e*=Ja.fallout;switch(arguments.length){case 1:i+=e*(1+d.noise1d(g*a))/2;break;case 2:i+=e*(1+d.noise2d(g*a,g*b))/2;break;case 3:i+=e*(1+d.noise3d(g*a,g*b,g*c))/2}g*=2}return i};c.noiseDetail=function(a,b){Ja.octaves=a;if(b!==q)Ja.fallout=b};c.noiseSeed=
function(a){Ja.seed=a;Ja.generator=q};F.prototype.size=function(a,b){c.stroke(0);c.fill(255);var f={fillStyle:h.fillStyle,strokeStyle:h.strokeStyle,lineCap:h.lineCap,lineJoin:h.lineJoin};p.style.length>0&&(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;f<d.SINCOS_LENGTH;f++)qb[f]=c.sin(f*(d.PI/180)*0.5),
rb[f]=c.cos(f*(d.PI/180)*0.5)};v.prototype.size=function(){h===q&&(h=p.getContext("2d"),sb=new Qa,tb=new Qa,ca=new Pa,da=new Pa,Q=ca,Ia=da);F.prototype.size.apply(this,arguments)};B.prototype.size=function(){var a=!1;return function(b,f){function d(a){for(var b=["experimental-webgl","webgl","webkit-3d"],c,f=0,e=b.length;f<e;f++)if(c=a.getContext(b[f]))break;return c}if(a)throw"Multiple calls to size() for 3D renders are not allowed.";a=!0;try{if(p.width!==b||p.height!==f)p.setAttribute("width",b),
p.setAttribute("height",f);h=d(p);Zc=h.createTexture();$c=h.createTexture()}catch(e){A.debug(e)}if(!h)throw"WebGL context is not supported on this browser.";h.viewport(0,0,p.width,p.height);h.enable(h.DEPTH_TEST);h.enable(h.BLEND);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);x=Dc(h,"varying vec4 frontColor;attribute vec3 Vertex;attribute vec2 aTextureCoord;uniform vec4 color;uniform mat4 model;uniform mat4 view;uniform mat4 projection;uniform float pointSize;varying vec2 vTextureCoord;void main(void) { gl_PointSize = pointSize; frontColor = color; gl_Position = projection * view * model * vec4(Vertex, 1.0); vTextureCoord = aTextureCoord;}",
"#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform int picktype;void main(void){ if(picktype == 0){ gl_FragColor = frontColor; } else if(picktype == 1){ float alpha = texture2D(uSampler, vTextureCoord).a; gl_FragColor = vec4(frontColor.rgb*alpha, alpha);\n }}");ga=Dc(h,"varying vec4 frontColor;attribute vec3 aVertex;attribute vec4 aColor;uniform mat4 uView;uniform mat4 uProjection;uniform float pointSize;void main(void) { frontColor = aColor; gl_PointSize = pointSize; gl_Position = uProjection * uView * vec4(aVertex, 1.0);}",
"#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;void main(void){ gl_FragColor = frontColor;}");c.strokeWeight(1);s=Dc(h,Bd,"#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;uniform sampler2D sampler;uniform bool usingTexture;varying vec2 vTexture;void main(void){ if(usingTexture){ gl_FragColor = vec4(texture2D(sampler, vTexture.xy)); } else{ gl_FragColor = frontColor; }}");h.useProgram(s);u("usingTexture3d",s,"usingTexture",pa);c.lightFalloff(1,
0,0);c.shininess(1);c.ambient(255,255,255);c.specular(0,0,0);c.emissive(0,0,0);qc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,qc);h.bufferData(h.ARRAY_BUFFER,hd,h.STATIC_DRAW);rc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,rc);h.bufferData(h.ARRAY_BUFFER,zd,h.STATIC_DRAW);sc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,sc);h.bufferData(h.ARRAY_BUFFER,id,h.STATIC_DRAW);Rb=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,Rb);h.bufferData(h.ARRAY_BUFFER,Cc,h.STATIC_DRAW);tc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,
tc);h.bufferData(h.ARRAY_BUFFER,Ad,h.STATIC_DRAW);Ab=h.createBuffer();uc=h.createBuffer();Wc=h.createBuffer();vc=h.createBuffer();Xc=h.createBuffer();Yc=h.createBuffer();Sb=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,Sb);h.bufferData(h.ARRAY_BUFFER,new P([0,0,0]),h.STATIC_DRAW);wc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,wc);h.bufferData(h.ARRAY_BUFFER,new P([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),h.STATIC_DRAW);xc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,xc);h.bufferData(h.ARRAY_BUFFER,new P([0,
0,1,0,1,1,0,1]),h.STATIC_DRAW);yc=h.createBuffer();h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,yc);h.bufferData(h.ELEMENT_ARRAY_BUFFER,new td([0,1,2,2,3,0]),h.STATIC_DRAW);eb=new w;Ha=new w;Q=new w;Ia=new w;ya=new w;c.camera();c.perspective();ca=Q;da=Ia;sb=new Qa;tb=new Qa;zb=new w;Qb=new w;ob=new w;pb=new w;oc=new w;pc=new w;pc.set(-1,3,-3,1,3,-6,3,0,-3,3,0,0,1,0,0,0);F.prototype.size.apply(this,arguments)}}();v.prototype.ambientLight=F.prototype.a3DOnlyFunction;B.prototype.ambientLight=function(a,b,c,l,
e,g){if(D===d.MAX_LIGHTS)throw"can only create "+d.MAX_LIGHTS+" lights";l=new aa(l,e,g);e=new w;e.scale(1,-1,1);e.apply(Q.array());e.mult(l,l);h.useProgram(s);z("lights.color.3d."+D,s,"lights"+D+".color",[a/255,b/255,c/255]);z("lights.position.3d."+D,s,"lights"+D+".position",l.array());u("lights.type.3d."+D,s,"lights"+D+".type",0);u("lightCount3d",s,"lightCount",++D)};v.prototype.directionalLight=F.prototype.a3DOnlyFunction;B.prototype.directionalLight=function(a,b,c,l,e,g){if(D===d.MAX_LIGHTS)throw"can only create "+
d.MAX_LIGHTS+" lights";h.useProgram(s);var i=new w;i.scale(1,-1,1);i.apply(Q.array());i=i.array();l=[i[0]*l+i[4]*e+i[8]*g,i[1]*l+i[5]*e+i[9]*g,i[2]*l+i[6]*e+i[10]*g];z("lights.color.3d."+D,s,"lights"+D+".color",[a/255,b/255,c/255]);z("lights.position.3d."+D,s,"lights"+D+".position",l);u("lights.type.3d."+D,s,"lights"+D+".type",1);u("lightCount3d",s,"lightCount",++D)};v.prototype.lightFalloff=F.prototype.a3DOnlyFunction;B.prototype.lightFalloff=function(a,b,c){h.useProgram(s);z("falloff3d",s,"falloff",
[a,b,c])};v.prototype.lightSpecular=F.prototype.a3DOnlyFunction;B.prototype.lightSpecular=function(a,b,c){h.useProgram(s);z("specular3d",s,"specular",[a/255,b/255,c/255])};c.lights=function(){c.ambientLight(128,128,128);c.directionalLight(128,128,128,0,0,-1);c.lightFalloff(1,0,0);c.lightSpecular(0,0,0)};v.prototype.pointLight=F.prototype.a3DOnlyFunction;B.prototype.pointLight=function(a,b,c,l,e,g){if(D===d.MAX_LIGHTS)throw"can only create "+d.MAX_LIGHTS+" lights";l=new aa(l,e,g);e=new w;e.scale(1,
-1,1);e.apply(Q.array());e.mult(l,l);h.useProgram(s);z("lights.color.3d."+D,s,"lights"+D+".color",[a/255,b/255,c/255]);z("lights.position.3d."+D,s,"lights"+D+".position",l.array());u("lights.type.3d."+D,s,"lights"+D+".type",2);u("lightCount3d",s,"lightCount",++D)};v.prototype.noLights=F.prototype.a3DOnlyFunction;B.prototype.noLights=function(){D=0;h.useProgram(s);u("lightCount3d",s,"lightCount",D)};v.prototype.spotLight=F.prototype.a3DOnlyFunction;B.prototype.spotLight=function(a,b,c,l,e,g,i,k,m,
j,o){if(D===d.MAX_LIGHTS)throw"can only create "+d.MAX_LIGHTS+" lights";h.useProgram(s);l=new aa(l,e,g);e=new w;e.scale(1,-1,1);e.apply(Q.array());e.mult(l,l);e=e.array();i=[e[0]*i+e[4]*k+e[8]*m,e[1]*i+e[5]*k+e[9]*m,e[2]*i+e[6]*k+e[10]*m];z("lights.color.3d."+D,s,"lights"+D+".color",[a/255,b/255,c/255]);z("lights.position.3d."+D,s,"lights"+D+".position",l.array());z("lights.direction.3d."+D,s,"lights"+D+".direction",i);z("lights.concentration.3d."+D,s,"lights"+D+".concentration",o);z("lights.angle.3d."+
D,s,"lights"+D+".angle",j);u("lights.type.3d."+D,s,"lights"+D+".type",3);u("lightCount3d",s,"lightCount",++D)};c.beginCamera=function(){if(Vb)throw"You cannot call beginCamera() again before calling endCamera()";else Vb=!0,ca=Ha,da=eb};c.endCamera=function(){if(Vb)Q.set(eb),Ia.set(Ha),ca=Q,da=Ia,Vb=!1;else throw"You cannot call endCamera() before calling beginCamera()";};c.camera=function(a,b,c,d,e,g,i,k,m){arguments.length===0&&(Bc=p.width/2,fb=p.height/2,gb=fb/j.tan(Wb/2),a=Bc,b=fb,c=gb,d=Bc,e=
fb,i=g=0,k=1,m=0);var h=new aa(a-d,b-e,c-g),o=new aa(i,k,m);h.normalize();var q=aa.cross(o,h),o=aa.cross(h,q);q.normalize();o.normalize();eb.set(q.x,q.y,q.z,0,o.x,o.y,o.z,0,h.x,h.y,h.z,0,0,0,0,1);eb.translate(-a,-b,-c);Ha.reset();Ha.invApply(q.x,q.y,q.z,0,o.x,o.y,o.z,0,h.x,h.y,h.z,0,0,0,0,1);Ha.translate(a,b,c);Q.set(eb);Ia.set(Ha)};c.perspective=function(a,b,f,d){arguments.length===0&&(fb=p.height/2,gb=fb/j.tan(Wb/2),dd=gb/10,ed=gb*10,fd=p.width/p.height,a=Wb,b=fd,f=dd,d=ed);var e,g;e=f*j.tan(a/
2);g=-e;c.frustum(g*b,e*b,g,e,f,d)};c.frustum=function(a,b,c,d,e,g){ya=new w;ya.set(2*e/(b-a),0,(b+a)/(b-a),0,0,2*e/(d-c),(d+c)/(d-c),0,0,0,-(g+e)/(g-e),-(2*g*e)/(g-e),0,0,-1,0);a=new w;a.set(ya);a.transpose();h.useProgram(x);N("projection2d",x,"projection",!1,a.array());h.useProgram(s);N("projection3d",s,"projection",!1,a.array());h.useProgram(ga);N("uProjectionUS",ga,"uProjection",!1,a.array())};c.ortho=function(a,b,f,d,e,g){if(arguments.length===0)a=0,b=c.width,f=0,d=c.height,e=-10,g=10;var i=
2/(b-a),k=2/(d-f),m=-2/(g-e),j=-(b+a)/(b-a),o=-(d+f)/(d-f),p=-(g+e)/(g-e);ya=new w;ya.set(i,0,0,j,0,k,0,o,0,0,m,p,0,0,0,1);i=new w;i.set(ya);i.transpose();h.useProgram(x);N("projection2d",x,"projection",!1,i.array());h.useProgram(s);N("projection3d",s,"projection",!1,i.array());h.useProgram(ga);N("uProjectionUS",ga,"uProjection",!1,i.array())};c.printProjection=function(){ya.print()};c.printCamera=function(){eb.print()};v.prototype.box=F.prototype.a3DOnlyFunction;B.prototype.box=function(a,b,c){if(!b||
!c)b=c=a;var d=new w;d.scale(a,b,c);a=new w;a.scale(1,-1,1);a.apply(Q.array());a.transpose();R&&(h.useProgram(s),N("model3d",s,"model",!1,d.array()),N("view3d",s,"view",!1,a.array()),h.enable(h.POLYGON_OFFSET_FILL),h.polygonOffset(1,1),z("color3d",s,"color",oa),D>0?(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;c<a;c++)e[c]=rb[parseInt(c*l%d.SINCOS_LENGTH,10)],g[c]=qb[parseInt(c*l%d.SINCOS_LENGTH,10)];c=a*(b-1)+2;l=0;Ea=new P(c);Fa=new P(c);Ga=new P(c);var i=d.SINCOS_LENGTH*0.5/b,k=i;for(c=1;c<b;c++){for(var m=qb[parseInt(k%d.SINCOS_LENGTH,10)],j=-rb[parseInt(k%d.SINCOS_LENGTH,10)],o=0;o<a;o++)Ea[l]=e[o]*m,Fa[l]=j,Ga[l++]=g[o]*m;k+=i}db=a;Ub=b;H=[];for(e=0;e<db;e++)H.push(0),H.push(-1),H.push(0),H.push(Ea[e]),H.push(Fa[e]),H.push(Ga[e]);H.push(0);H.push(-1);
H.push(0);H.push(Ea[0]);H.push(Fa[0]);H.push(Ga[0]);i=0;for(e=2;e<Ub;e++){g=c=i;i+=db;l=i;for(k=0;k<db;k++)H.push(parseFloat(Ea[g])),H.push(parseFloat(Fa[g])),H.push(parseFloat(Ga[g++])),H.push(parseFloat(Ea[l])),H.push(parseFloat(Fa[l])),H.push(parseFloat(Ga[l++]));g=c;l=i;H.push(parseFloat(Ea[g]));H.push(parseFloat(Fa[g]));H.push(parseFloat(Ga[g]));H.push(parseFloat(Ea[l]));H.push(parseFloat(Fa[l]));H.push(parseFloat(Ga[l]))}for(e=0;e<db;e++)l=i+e,H.push(parseFloat(Ea[l])),H.push(parseFloat(Fa[l])),
H.push(parseFloat(Ga[l])),H.push(0),H.push(1),H.push(0);H.push(parseFloat(Ea[i]));H.push(parseFloat(Fa[i]));H.push(parseFloat(Ga[i]));H.push(0);H.push(1);H.push(0);h.bindBuffer(h.ARRAY_BUFFER,Ab);h.bufferData(h.ARRAY_BUFFER,new P(H),h.STATIC_DRAW)}};v.prototype.sphere=F.prototype.a3DOnlyFunction;B.prototype.sphere=function(a){(db<3||Ub<2)&&c.sphereDetail(30);var b=new w;b.scale(a,a,a);a=new w;a.scale(1,-1,1);a.apply(Q.array());a.transpose();if(R){if(D>0){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;c<l.length;c+=2)l[c]/=Tb.width,l[c+1]/=Tb.height;for(c=0;c<l.length;c+=2)l[c+0]>1&&(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;i<m;i++){g=o[i];for(k=0;k<3;k++)b.push(g[k])}for(i=
0;i<m;i++){g=o[i];for(k=5;k<9;k++)f.push(g[k])}for(i=0;i<m;i++){g=o[i];for(k=9;k<13;k++)l.push(g[k])}for(i=0;i<m;i++)g=o[i],e.push(g[3]),e.push(g[4]);if(a){b.push(o[0][0]);b.push(o[0][1]);b.push(o[0][2]);for(i=5;i<9;i++)f.push(o[0][i]);for(i=9;i<13;i++)l.push(o[0][i]);e.push(o[0][3]);e.push(o[0][4])}if(ub&&(U===d.POLYGON||U===q)){if(m>3){b=[];f=1-kc;h.beginPath();h.moveTo(o[1][0],o[1][1]);for(i=1;i+2<m;i++)g=o[i],b[0]=[g[0],g[1]],b[1]=[g[0]+(f*o[i+1][0]-f*o[i-1][0])/6,g[1]+(f*o[i+1][1]-f*o[i-1][1])/
6],b[2]=[o[i+1][0]+(f*o[i][0]-f*o[i+2][0])/6,o[i+1][1]+(f*o[i][1]-f*o[i+2][1])/6],b[3]=[o[i+1][0],o[i+1][1]],h.bezierCurveTo(b[1][0],b[1][1],b[2][0],b[2][1],b[3][0],b[3][1]);a&&h.lineTo(o[0][0],o[0][1]);X();V();h.closePath()}}else if(vb&&(U===d.POLYGON||U===q)){h.beginPath();for(i=0;i<m;i++)g=o[i],o[i].isVert?o[i].moveTo?h.moveTo(g[0],g[1]):h.lineTo(g[0],g[1]):h.bezierCurveTo(o[i][0],o[i][1],o[i][2],o[i][3],o[i][4],o[i][5]);a&&h.lineTo(o[0][0],o[0][1]);X();V();h.closePath()}else if(U===d.POINTS)for(i=
0;i<m;i++)g=o[i],I&&c.stroke(g[6]),c.point(g[0],g[1]);else if(U===d.LINES)for(i=0;i+1<m;i+=2)g=o[i],I&&c.stroke(o[i+1][6]),c.line(g[0],g[1],o[i+1][0],o[i+1][1]);else if(U===d.TRIANGLES)for(i=0;i+2<m;i+=3)g=o[i],h.beginPath(),h.moveTo(g[0],g[1]),h.lineTo(o[i+1][0],o[i+1][1]),h.lineTo(o[i+2][0],o[i+2][1]),h.lineTo(g[0],g[1]),R&&(c.fill(o[i+2][5]),X()),I&&(c.stroke(o[i+2][6]),V()),h.closePath();else if(U===d.TRIANGLE_STRIP)for(i=0;i+1<m;i++)g=o[i],h.beginPath(),h.moveTo(o[i+1][0],o[i+1][1]),h.lineTo(g[0],
g[1]),I&&c.stroke(o[i+1][6]),R&&c.fill(o[i+1][5]),i+2<m&&(h.lineTo(o[i+2][0],o[i+2][1]),I&&c.stroke(o[i+2][6]),R&&c.fill(o[i+2][5])),X(),V(),h.closePath();else if(U===d.TRIANGLE_FAN){if(m>2){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;i<m;i++)g=o[i],h.beginPath(),h.moveTo(o[0][0],o[0][1]),h.lineTo(o[i-1][0],o[i-1][1]),h.lineTo(g[0],g[1]),R&&(c.fill(g[5]),X()),I&&(c.stroke(g[6]),
V()),h.closePath()}}else if(U===d.QUADS)for(i=0;i+3<m;i+=4){g=o[i];h.beginPath();h.moveTo(g[0],g[1]);for(k=1;k<4;k++)h.lineTo(o[i+k][0],o[i+k][1]);h.lineTo(g[0],g[1]);R&&(c.fill(o[i+3][5]),X());I&&(c.stroke(o[i+3][6]),V());h.closePath()}else if(U===d.QUAD_STRIP){if(m>3)for(i=0;i+1<m;i+=2)g=o[i],h.beginPath(),i+3<m?(h.moveTo(o[i+2][0],o[i+2][1]),h.lineTo(g[0],g[1]),h.lineTo(o[i+1][0],o[i+1][1]),h.lineTo(o[i+3][0],o[i+3][1]),R&&c.fill(o[i+3][5]),I&&c.stroke(o[i+3][6])):(h.moveTo(g[0],g[1]),h.lineTo(o[i+
1][0],o[i+1][1])),X(),V(),h.closePath()}else{h.beginPath();h.moveTo(o[0][0],o[0][1]);for(i=1;i<m;i++)g=o[i],g.isVert&&(g.moveTo?h.moveTo(g[0],g[1]):h.lineTo(g[0],g[1]));a&&h.lineTo(o[0][0],o[0][1]);X();V();h.closePath()}vb=ub=!1;ha=[];ea=0}};B.prototype.endShape=function(a){if(o.length!==0){var b=a===d.CLOSE,a=[],c=[],l=[],e=[],g=[],i;Xa=!0;var k,m,j=o.length;for(k=0;k<j;k++){i=o[k];for(m=0;m<3;m++)c.push(i[m])}for(k=0;k<j;k++){i=o[k];for(m=5;m<9;m++)l.push(i[m])}for(k=0;k<j;k++){i=o[k];for(m=9;m<
13;m++)e.push(i[m])}for(k=0;k<j;k++)i=o[k],g.push(i[3]),g.push(i[4]);if(b){c.push(o[0][0]);c.push(o[0][1]);c.push(o[0][2]);for(k=5;k<9;k++)l.push(o[0][k]);for(k=9;k<13;k++)e.push(o[0][k]);g.push(o[0][3]);g.push(o[0][4])}if(ub&&(U===d.POLYGON||U===q))I&&sa(c,null,e),R&&Ra(c,null,l);else if(vb&&(U===d.POLYGON||U===q))a=c,a.splice(a.length-3),e.splice(e.length-4),I&&sa(a,null,e),R&&Ra(c,"TRIANGLES",l);else{if(U===d.POINTS){for(k=0;k<j;k++){i=o[k];for(m=0;m<3;m++)a.push(i[m])}ld(a,e)}else if(U===d.LINES){for(k=
0;k<j;k++){i=o[k];for(m=0;m<3;m++)a.push(i[m])}for(k=0;k<j;k++){i=o[k];for(m=5;m<9;m++)l.push(i[m])}sa(a,"LINES",e)}else if(U===d.TRIANGLES){if(j>2)for(k=0;k+2<j;k+=3){c=[];g=[];a=[];l=[];e=[];for(m=0;m<3;m++)for(b=0;b<3;b++)a.push(o[k+m][b]),c.push(o[k+m][b]);for(m=0;m<3;m++)for(b=3;b<5;b++)g.push(o[k+m][b]);for(m=0;m<3;m++)for(b=5;b<9;b++)l.push(o[k+m][b]),e.push(o[k+m][b+4]);I&&sa(a,"LINE_LOOP",e);(R||pa)&&Ra(c,"TRIANGLES",l,g)}}else if(U===d.TRIANGLE_STRIP){if(j>2)for(k=0;k+2<j;k++){a=[];c=[];
e=[];l=[];g=[];for(m=0;m<3;m++)for(b=0;b<3;b++)a.push(o[k+m][b]),c.push(o[k+m][b]);for(m=0;m<3;m++)for(b=3;b<5;b++)g.push(o[k+m][b]);for(m=0;m<3;m++)for(b=5;b<9;b++)e.push(o[k+m][b+4]),l.push(o[k+m][b]);(R||pa)&&Ra(c,"TRIANGLE_STRIP",l,g);I&&sa(a,"LINE_LOOP",e)}}else if(U===d.TRIANGLE_FAN){if(j>2){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+1<j;k++){a=[];e=[];a.push(o[0][0]);a.push(o[0][1]);a.push(o[0][2]);
e.push(o[0][9]);e.push(o[0][10]);e.push(o[0][11]);e.push(o[0][12]);for(m=0;m<2;m++)for(b=0;b<3;b++)a.push(o[k+m][b]);for(m=0;m<2;m++)for(b=9;b<13;b++)e.push(o[k+m][b]);I&&sa(a,"LINE_STRIP",e)}(R||pa)&&Ra(c,"TRIANGLE_FAN",l,g)}}else if(U===d.QUADS)for(k=0;k+3<j;k+=4){a=[];for(m=0;m<4;m++){i=o[k+m];for(b=0;b<3;b++)a.push(i[b])}I&&sa(a,"LINE_LOOP",e);if(R){c=[];l=[];g=[];for(m=0;m<3;m++)c.push(o[k][m]);for(m=5;m<9;m++)l.push(o[k][m]);for(m=0;m<3;m++)c.push(o[k+1][m]);for(m=5;m<9;m++)l.push(o[k+1][m]);
for(m=0;m<3;m++)c.push(o[k+3][m]);for(m=5;m<9;m++)l.push(o[k+3][m]);for(m=0;m<3;m++)c.push(o[k+2][m]);for(m=5;m<9;m++)l.push(o[k+2][m]);pa&&(g.push(o[k+0][3]),g.push(o[k+0][4]),g.push(o[k+1][3]),g.push(o[k+1][4]),g.push(o[k+3][3]),g.push(o[k+3][4]),g.push(o[k+2][3]),g.push(o[k+2][4]));Ra(c,"TRIANGLE_STRIP",l,g)}}else if(U===d.QUAD_STRIP){if(j>3){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+3<j;k+=2){a=[];e=[];for(m=0;m<3;m++)a.push(o[k+1][m]);for(m=0;m<3;m++)a.push(o[k+3][m]);for(m=0;m<3;m++)a.push(o[k+2][m]);for(m=0;m<3;m++)a.push(o[k+0][m]);for(m=9;m<13;m++)e.push(o[k+1][m]);for(m=9;m<13;m++)e.push(o[k+3][m]);for(m=9;m<13;m++)e.push(o[k+2][m]);for(m=9;m<13;m++)e.push(o[k+0][m]);I&&sa(a,"LINE_STRIP",e)}(R||pa)&&Ra(c,"TRIANGLE_LIST",l,g)}}else if(j===1){for(m=0;m<3;m++)a.push(o[0][m]);for(m=9;m<13;m++)e.push(o[0][m]);ld(a,e)}else{for(k=0;k<j;k++){i=o[k];for(m=
0;m<3;m++)a.push(i[m]);for(m=5;m<9;m++)e.push(i[m])}I&&b?sa(a,"LINE_LOOP",e):I&&!b&&sa(a,"LINE_STRIP",e);(R||pa)&&Ra(c,"TRIANGLE_FAN",l,g)}pa=!1;h.useProgram(s);u("usingTexture3d",s,"usingTexture",pa)}vb=ub=!1;ha=[];ea=0}};var md=function(a,b){var c=1/a,d=c*c,e=d*c;b.set(0,0,0,1,e,d,c,0,6*e,2*d,0,0,6*e,0,0,0)},nd=function(){ob||(zb=new w,ob=new w,Uc=!0);var a=kc;zb.set((a-1)/2,(a+3)/2,(-3-a)/2,(1-a)/2,1-a,(-5-a)/2,a+2,(a-1)/2,(a-1)/2,0,(1-a)/2,0,0,1,0,0);md(lc,ob);oc||(Qb=new w);Qb.set(zb);Qb.preApply(oc);
ob.apply(zb)};v.prototype.bezierVertex=function(){vb=!0;var a=[];if(Xa)throw"vertex() must be used at least once before calling bezierVertex()";for(var b=0;b<arguments.length;b++)a[b]=arguments[b];o.push(a);o[o.length-1].isVert=!1};B.prototype.bezierVertex=function(){vb=!0;if(Xa)throw"vertex() must be used at least once before calling bezierVertex()";if(arguments.length===9){pb===q&&(pb=new w);var a=o.length-1;md(mc,pb);pb.apply(pc);for(var b=pb.array(),d=o[a][0],l=o[a][1],a=o[a][2],e=b[4]*d+b[5]*
arguments[0]+b[6]*arguments[3]+b[7]*arguments[6],g=b[8]*d+b[9]*arguments[0]+b[10]*arguments[3]+b[11]*arguments[6],i=b[12]*d+b[13]*arguments[0]+b[14]*arguments[3]+b[15]*arguments[6],k=b[4]*l+b[5]*arguments[1]+b[6]*arguments[4]+b[7]*arguments[7],m=b[8]*l+b[9]*arguments[1]+b[10]*arguments[4]+b[11]*arguments[7],h=b[12]*l+b[13]*arguments[1]+b[14]*arguments[4]+b[15]*arguments[7],j=b[4]*a+b[5]*arguments[2]+b[6]*arguments[5]+b[7]*arguments[8],p=b[8]*a+b[9]*arguments[2]+b[10]*arguments[5]+b[11]*arguments[8],
b=b[12]*a+b[13]*arguments[2]+b[14]*arguments[5]+b[15]*arguments[8],n=0;n<mc;n++)d+=e,e+=g,g+=i,l+=k,k+=m,m+=h,a+=j,j+=p,p+=b,c.vertex(d,l,a);c.vertex(arguments[6],arguments[7],arguments[8])}};var wb=function(){var a=E.createElement("canvas");try{h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,a),wb=function(a){h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,a)}}catch(b){wb=function(a){h.texImage2D(h.TEXTURE_2D,0,a,!1)}}wb.apply(this,arguments)};c.texture=function(a){var b=$.$ensureContext();
if(a.localName==="canvas")b.bindTexture(b.TEXTURE_2D,Zc),wb(a),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR),b.generateMipmap(b.TEXTURE_2D);else if(a.__texture)b.bindTexture(b.TEXTURE_2D,a.__texture);else{var c=b.createTexture();a.__texture=c;var c=E.createElement("canvas"),d;if(a.width&a.width-1===0)c.width=a.width;else{for(d=1;d<a.width;)d*=2;c.width=d}if(a.height&a.height-1===0)c.height=a.height;else{for(d=1;d<a.height;)d*=
2;c.height=d}d=c.getContext("2d");for(var e=d.createImageData(c.width,c.height),g=a.toImageData(),i=0;i<c.width;i+=1)for(var k=0;k<c.height;k+=1){var m=(k*c.width+i)*4;e.data[m+0]=g.data[m+0];e.data[m+1]=g.data[m+1];e.data[m+2]=g.data[m+2];e.data[m+3]=255}d.putImageData(e,0,0);a.__cvs=c;b.bindTexture(b.TEXTURE_2D,a.__texture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,
b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);wb(a.__cvs);b.generateMipmap(b.TEXTURE_2D)}Tb.width=a.width;Tb.height=a.height;pa=!0;b.useProgram(s);u("usingTexture3d",s,"usingTexture",pa)};c.textureMode=function(a){ad=a};v.prototype.curveVertex=function(a,b){ub=!0;c.vertex(a,b)};B.prototype.curveVertex=function(a,b,d){ub=!0;Uc||nd();var l=[];l[0]=a;l[1]=b;l[2]=d;ha.push(l);ea++;if(ea>3){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;h<lc;h++)a+=l,l+=t,t+=e,b+=k,k+=j,j+=g,d+=m,m+=o,o+=i,c.vertex(a,b,d)}};v.prototype.curve=
function(){arguments.length===8&&(c.beginShape(),c.curveVertex(arguments[0],arguments[1]),c.curveVertex(arguments[2],arguments[3]),c.curveVertex(arguments[4],arguments[5]),c.curveVertex(arguments[6],arguments[7]),c.endShape())};B.prototype.curve=function(){arguments.length===12&&(c.beginShape(),c.curveVertex(arguments[0],arguments[1],arguments[2]),c.curveVertex(arguments[3],arguments[4],arguments[5]),c.curveVertex(arguments[6],arguments[7],arguments[8]),c.curveVertex(arguments[9],arguments[10],arguments[11]),
c.endShape())};c.curveTightness=function(a){kc=a};c.curveDetail=function(a){lc=a;nd()};c.rectMode=function(a){bb=a};c.imageMode=function(a){switch(a){case d.CORNER:Xb=jd;break;case d.CORNERS:Xb=Cd;break;case d.CENTER:Xb=Dd;break;default:throw"Invalid imageMode";}};c.ellipseMode=function(a){Wa=a};c.arc=function(a,b,f,l,e,g){if(!(f<=0||g<e)){Wa===d.CORNERS?(f-=a,l-=b):Wa===d.RADIUS?(a-=f,b-=l,f*=2,l*=2):Wa===d.CENTER&&(a-=f/2,b-=l/2);for(;e<0;)e+=d.TWO_PI,g+=d.TWO_PI;if(g-e>d.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<g;i++,k++)k>=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<g;i++,k++)k>=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;e<f;++e)c.set(a+e,b,ba),c.set(a+e,i,ba);for(e=0;e<l;++e)c.set(a,b+e,ba),c.set(g,b+e,ba)}else{h.beginPath();bb===d.CORNERS&&(f-=a,l-=b);bb===d.RADIUS&&(f*=2,l*=2);if(bb===d.CENTER||bb===d.RADIUS)a-=f/2,b-=l/2;h.rect(j.round(a)-0,j.round(b)-0,j.round(f)+0,j.round(l)+0);X();V();h.closePath()}};B.prototype.rect=function(a,b,c,d){var e=new w;e.translate(a,b,
0);e.scale(c,d,1);e.transpose();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,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<o.length;m++)i+=o[m][0],k+=o[m][1];i/=o.length;k/=o.length;m=[];e=[];g=[];m[0]=i;m[1]=
k;m[2]=0;m[3]=0;m[4]=0;m[5]=oa[0];m[6]=oa[1];m[7]=oa[2];m[8]=oa[3];m[9]=la[0];m[10]=la[1];m[11]=la[2];m[12]=la[3];m[13]=gc;m[14]=hc;m[15]=ic;o.unshift(m);for(m=0;m<o.length;m++){for(i=0;i<3;i++)e.push(o[m][i]);for(i=5;i<9;i++)g.push(o[m][i])}Ra(e,"TRIANGLE_FAN",g)}}};c.normal=function(a,b,c){if(arguments.length!==3||!(typeof a==="number"&&typeof b==="number"&&typeof c==="number"))throw"normal() requires three numeric arguments.";gc=a;hc=b;ic=c;if(U!==0)if(Ob===d.NORMAL_MODE_AUTO)Ob=d.NORMAL_MODE_SHAPE;
else if(Ob===d.NORMAL_MODE_SHAPE)Ob=d.NORMAL_MODE_VERTEX};c.save=function(a,b){return b!==q?S.open(b.toDataURL(),"_blank"):S.open(c.externals.canvas.toDataURL(),"_blank")};var Ed=0;c.saveFrame=function(a){a===q&&(a="screen-####.png");a=a.replace(/#+/,function(a){for(var c=""+Ed++;c.length<a.length;)c="0"+c;return c});c.save(a)};var od=E.createElement("canvas").getContext("2d"),Kc=[q,q,q],ta=function(a,b,f){this.get=function(a,b,d,f){if(arguments.length)if(arguments.length===2)return c.get(a,b,this);
else{if(arguments.length===4)return c.get(a,b,d,f,this)}else return c.get(this)};this.set=function(a,b,d){c.set(a,b,d,this)};this.blend=function(a,b,d,f,e,g,l,h,j,o){arguments.length===9?c.blend(this,a,b,d,f,e,g,l,h,j,this):arguments.length===10&&c.blend(a,b,d,f,e,g,l,h,j,o,this);delete this.sourceImg};this.copy=function(a,b,f,e,g,l,h,j,o){arguments.length===8?c.blend(this,a,b,f,e,g,l,h,j,d.REPLACE,this):arguments.length===9&&c.blend(a,b,f,e,g,l,h,j,o,d.REPLACE,this);delete this.sourceImg};this.filter=
function(a,b){arguments.length===2?c.filter(a,b,this):arguments.length===1&&c.filter(a,null,this);delete this.sourceImg};this.save=function(a){c.save(a,this)};this.resize=function(a,b){if(this.isRemote)throw"Image is loaded remotely. Cannot resize.";else if(this.width!==0||this.height!==0){a===0&&b!==0?a=j.floor(this.width/this.height*b):b===0&&a!==0&&(b=j.floor(this.height/this.width*a));var c=qa(this.imageData).canvas;this.fromImageData(qa(c,a,b).context.getImageData(0,0,a,b))}};this.mask=function(a){this.__mask=
q;if(a instanceof ta)if(a.width===this.width&&a.height===this.height)this.__mask=a;else throw"mask must have the same dimensions as PImage.";else if(a instanceof Array)if(this.pixels.length===a.length)this.__mask=a;else throw"mask array must be the same length as PImage pixels array.";};this.pixels={getLength:function(a){if(a.isRemote)throw"Image is loaded remotely. Cannot get length.";else return function(){return a.imageData.data.length?a.imageData.data.length/4:0}}(this),getPixel:function(a){if(a.isRemote)throw"Image is loaded remotely. Cannot get pixels.";
else return function(b){b*=4;return c.color.toInt(a.imageData.data[b],a.imageData.data[b+1],a.imageData.data[b+2],a.imageData.data[b+3])}}(this),setPixel:function(a){if(a.isRemote)throw"Image is loaded remotely. Cannot set pixel.";else return function(b,c){var f=b*4;a.imageData.data[f+0]=(c&d.RED_MASK)>>>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<c;b++)this.setPixel(b,a[b])}};this.loadPixels=function(){};this.updatePixels=function(){};this.toImageData=function(){return this.isRemote?this.sourceImg:qa(this.imageData).context.getImageData(0,0,this.width,this.height)};this.toDataURL=function(){if(this.isRemote)throw"Image is loaded remotely. Cannot create dataURI.";else return qa(this.imageData).canvas.toDataURL()};this.fromImageData=function(a){this.width=a.width;this.height=a.height;this.imageData=a;this.format=
d.ARGB};this.fromHTMLImageData=function(a){var b=qa(a);try{this.fromImageData(b.context.getImageData(0,0,a.width,a.height))}catch(c){if(a.width&&a.height)this.isRemote=!0,this.width=a.width,this.height=a.height}this.sourceImg=a};if(arguments.length===1)this.fromHTMLImageData(arguments[0]);else if(arguments.length===2||arguments.length===3){if(this.width=a||1,this.height=b||1,this.imageData=od.createImageData(this.width,this.height),this.format=f===d.ARGB||f===d.ALPHA?f:d.RGB,this.format===d.RGB)for(var l=
3,e=this.imageData.data,g=e.length;l<g;l+=4)e[l]=255}else this.height=this.width=0,this.imageData=od.createImageData(1,1),this.format=d.ARGB};c.PImage=ta;c.createImage=function(a,b,c){return new ta(a,b,c)};c.loadImage=function(a,b,c){b&&(a=a+"."+b);if(T.imageCache.images[a])b=new ta(T.imageCache.images[a]),b.loaded=!0;else{var b=new ta,d=E.createElement("img");b.sourceImg=d;d.onload=function(a,b,c){return function(){b.fromHTMLImageData(a);b.loaded=!0;c&&c()}}(d,b,c);d.src=a}return b};c.requestImage=
c.loadImage;c.get=function(a,b,f,l,e){if(arguments.length===2){var g;if(a<c.width&&a>=0&&b>=0&&b<c.height)if(yb){var i=((0|a)+c.width*(0|b))*4;g=c.imageData.data;g=c.color.toInt(g[i],g[i+1],g[i+2],g[i+3])}else g=h.getImageData(0|a,0|b,1,1).data,g=c.color.toInt(g[0],g[1],g[2],g[3]);else g=0;return g}else if(arguments.length===0)return g=new ta(c.width,c.height,d.RGB),g.fromImageData(h.getImageData(0,0,c.width,c.height)),g;else if(arguments.length===5){if(e.isRemote)throw"Image is loaded remotely. Cannot get x,y,w,h.";
else{g=new ta(f,l,d.RGB);for(var i=g.imageData.data,k=e.width,m=e.height,o=e.imageData.data,p=j.max(0,-b),q=j.max(0,-a),m=j.min(l,m-b),n=j.min(f,k-a);p<m;++p)for(var s=((b+p)*k+(a+q))*4,t=(p*f+q)*4,L=q;L<n;++L)i[t++]=o[s++],i[t++]=o[s++],i[t++]=o[s++],i[t++]=o[s++]}return g}else if(arguments.length===4)return g=new ta(f,l,d.RGB),g.fromImageData(h.getImageData(a,b,f,l)),g;else if(arguments.length===3){if(f.isRemote)throw"Image is loaded remotely. Cannot get x,y.";else g=b*f.width*4+a*4,g=c.color.toInt(f.imageData.data[g],
f.imageData.data[g+1],f.imageData.data[g+2],f.imageData.data[g+3]);return g}else if(arguments.length===1)return a};c.createGraphics=function(a,b,c){var d=new A;d.size(a,b,c);return d};c.set=function(a,b,d,l){if(arguments.length===3)typeof d==="number"?a<c.width&&a>=0&&b>=0&&b<c.height&&(yb||(c.loadPixels(),Ac===null&&(Lc=h,Ac=new vd),yb=!0,h=Ac,bd=0),c.pixels.setPixel((0|a)+c.width*(0|b),d),++bd>cd&&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;b<c;b++)this.setPixel(b,a[b])}};c.loadPixels=function(){c.imageData=$.$ensureContext().getImageData(0,0,c.width,c.height)};c.updatePixels=function(){c.imageData&&$.$ensureContext().putImageData(c.imageData,0,0)};c.hint=function(a){var b=$.$ensureContext();a===d.DISABLE_DEPTH_TEST?(b.disable(b.DEPTH_TEST),b.depthMask(!1),b.clear(b.DEPTH_BUFFER_BIT)):a===d.ENABLE_DEPTH_TEST&&(b.enable(b.DEPTH_TEST),b.depthMask(!0))};
var pd=function(a,b,d,l){if(a instanceof ta)if(a.loaded){if(a.width!==c.width||a.height!==c.height)throw"Background image must be the same dimensions as the canvas.";}else throw"Error using image in background(): PImage not loaded.";else a=c.color(a,b,d,l);nb=a};v.prototype.background=function(a,b,d,l){a!==q&&pd(a,b,d,l);nb instanceof ta?(h.save(),h.setTransform(1,0,0,1,0,0),c.image(nb,0,0)):(h.save(),h.setTransform(1,0,0,1,0,0),c.alpha(nb)!==fa&&h.clearRect(0,0,c.width,c.height),h.fillStyle=c.color.toString(nb),
h.fillRect(0,0,c.width,c.height),Ma=!0);hb()};B.prototype.background=function(a,b,d,l){arguments.length>0&&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;k<m;k+=4)i.data[k+1]=j.data[k]}else{k=0;for(m=a.__mask.length;k<m;++k)i.data[(k<<2)+3]=a.__mask[k]}}cb!==null&&cb(i);h.drawImage(qa(i).canvas,0,0,a.width,a.height,g.x,g.y,g.w,g.h)}}};B.prototype.image=function(a,b,d,l,e){a.width>0&&(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<a;)c[k++]*=b,c[k++]*=d,c[k++]*=l,c[k++]*=e}};c.noTint=function(){cb=null};c.copy=function(a,b,f,l,e,g,i,k,h){arguments.length===8&&(h=k,k=i,i=g,g=e,e=l,l=f,f=b,b=a,a=c);c.blend(a,b,f,l,e,g,i,k,h,d.REPLACE)};c.blend=function(a,b,d,l,e,g,i,k,h,j,o){arguments.length===9&&(j=h,h=k,k=i,i=g,g=e,e=l,l=d,d=b,b=a,a=c);var p=b+l,n=d+e,q=g+k,s=i+h,t;if(a.isRemote)throw"Image is loaded remotely. Cannot blend image.";
else arguments.length===10||arguments.length===9?(c.loadPixels(),t=c):arguments.length===11&&o&&o.imageData&&(t=o),a===c?c.intersect(b,d,p,n,g,i,q,s)?c.blit_resize(c.get(b,d,p-b,n-d),0,0,p-b-1,n-d-1,t.imageData.data,t.width,t.height,g,i,q,s,j):c.blit_resize(a,b,d,p,n,t.imageData.data,t.width,t.height,g,i,q,s,j):(a.loadPixels(),c.blit_resize(a,b,d,p,n,t.imageData.data,t.width,t.height,g,i,q,s,j)),arguments.length===10&&c.updatePixels()};var qd=function(a,b){var c=0,d=b.pixels.getLength(),e=new sd(d),
g,i,k,h,j,o,p,n,q,s,t,r;if(a)for(;c<d;){g=c;for(i=c+b.width;c<i;)k=h=b.pixels.getPixel(c),o=c-1,j=c+1,p=c-b.width,n=c+b.width,o<g&&(o=c),j>=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}else for(;c<d;){g=c;for(i=c+b.width;c<i;)k=h=b.pixels.getPixel(c),o=c-1,j=c+1,p=c-b.width,n=c+b.width,o<g&&(o=c),j>=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<A;v++)B[v]=0;A=(h-1)*(h-1);for(v=1;v<h;v++)B[h+v]=B[void 0]=A;B[h]=h*h}h=j.height;v=j.width;B=c.shared.blurKernelSize;u=c.shared.blurRadius;var A=c.shared.blurKernel,C=j.imageData.data;for(y=0;y<h;y++){for(w=0;w<v;w++){n=p=o=s=j=0;L=w-u;if(L<0)t=-L,L=0;else{if(L>=v)break;t=0}for(x=t;x<B;x++){if(L>=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;y++){for(w=0;w<v;w++){n=p=o=s=j=0;if(u<0)t=r=-u,L=w;else{if(u>=h)break;t=0;r=u;L=w+z}for(x=t;x<B;x++){if(r>=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<k;i++)e=255-l.pixels.getPixel(i),l.pixels.setPixel(i,4278190080|e<<16|e<<8|e);l.format=d.RGB}else for(i=
0;i<k;i++)e=l.pixels.getPixel(i),g=77*(e>>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;i<k;i++)l.pixels.setPixel(i,l.pixels.getPixel(i)^16777215);break;case d.POSTERIZE:if(b===null)throw"Use filter(POSTERIZE, int levels) instead of filter(POSTERIZE)";e=c.floor(b);if(e<2||e>255)throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)";g=e-1;for(i=0;i<k;i++)G=l.pixels.getPixel(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;i<k;i++)l.pixels.setPixel(i,l.pixels.getPixel(i)|4278190080);l.format=d.RGB;break;case d.THRESHOLD:b===null&&(b=0.5);if(b<0||b>1)throw"Level must be between 0 and 1 for filter(THRESHOLD, level)";e=c.floor(b*255);for(i=0;i<k;i++)g=c.max((l.pixels.getPixel(i)&d.RED_MASK)>>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|(g<e?0:16777215));break;case d.ERODE:qd(!0,l);break;case d.DILATE:qd(!1,l)}l.updatePixels()}};c.shared={fracU:0,ifU:0,fracV:0,ifV:0,u1:0,u2:0,v1:0,v2:0,sX:0,sY:0,iw:0,iw1:0,ih1:0,ul:0,ll:0,ur:0,lr:0,cUL:0,cLL:0,cUR:0,cLR:0,srcXOffset:0,srcYOffset:0,r:0,g:0,b:0,a:0,srcBuffer:null,blurRadius:0,blurKernelSize:0,blurKernel:null};c.intersect=function(a,b,c,d,e,g,i,k){c=c-a+1;d=d-b+1;i=i-e+1;k=k-g+1;e<a?(i+=e-a,i>c&&(i=c)):(a=c+a-e,i>a&&
(i=a));g<b?(k+=g-b,k>d&&(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.PREC_RED_SHIFT&d.RED_MASK;c.shared.g=c.shared.ul*(c.shared.cUL&d.GREEN_MASK)+c.shared.ll*(c.shared.cLL&d.GREEN_MASK)+c.shared.ur*(c.shared.cUR&d.GREEN_MASK)+c.shared.lr*(c.shared.cLR&d.GREEN_MASK)>>>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)<<d.PREC_ALPHA_SHIFT&d.ALPHA_MASK;return c.shared.a|c.shared.r|c.shared.g|c.shared.b};c.blit_resize=function(a,b,f,h,e,g,i,k,m,o,p,q,n){b<0&&(b=0);f<0&&(f=0);h>=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<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.blend(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+
1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.ADD:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.add(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.SUBTRACT:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],
g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.subtract(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.LIGHTEST:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.lightest(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;
b+=i;c.shared.srcYOffset+=e}break;case d.DARKEST:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.darkest(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.REPLACE:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=a.format!==
d.RGB&&g[(b+n)*4]!==255?c.color.toArray(c.modes.blend(k,c.filter_bilinear())):c.color.toArray(c.filter_bilinear()),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.DIFFERENCE:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.difference(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=
k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.EXCLUSION:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.exclusion(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.MULTIPLY:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+
n)*4+3]),k=c.color.toArray(c.modes.multiply(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.SCREEN:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.screen(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;
case d.OVERLAY:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.overlay(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.HARD_LIGHT:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.hard_light(k,c.filter_bilinear())),
g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.SOFT_LIGHT:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.soft_light(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.DODGE:for(f=0;f<q;f++){c.filter_new_scanline();for(n=
0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.dodge(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.BURN:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.burn(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*
4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}}};Za.prototype.width=function(a){return"measureText"in h?h.measureText(typeof a==="number"?String.fromCharCode(a):a).width/M:0};Za.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]};c.PFont=Za;c.loadFont=function(a){if(a===q||a.indexOf(".svg")===-1)return new Za(a);else{var b=c.loadGlyphs(a);return{name:a,glyph:!0,units_per_em:b.units_per_em,horiz_adv_x:1/b.units_per_em*b.horiz_adv_x,ascent:b.ascent,descent:b.descent,
width:function(b){for(var d=0,e=b.length,g=0;g<e;g++)try{d+=parseFloat(c.glyphLook(c.glyphTable[a],b[g]).horiz_adv_x)}catch(i){A.debug(i)}return d/c.glyphTable[a].units_per_em}}}};c.createFont=function(a,b){if(arguments.length===2)return c.textSize(b),c.loadFont(a);else if(arguments.length===3)return c.textSize(b),c.loadFont(a);else if(arguments.length===4)return c.textSize(b),c.loadFont(a);else throw"incorrent number of parameters for createFont";};c.textFont=function(a,b){Y=a;b?c.textSize(b):$.$ensureContext().font=
M+"px "+Y.name};c.textSize=function(a){if(a)M=a,$.$ensureContext().font=M+"px "+Y.name};c.textAlign=function(){arguments.length===1?kb=arguments[0]:arguments.length===2&&(kb=arguments[0],jb=arguments[1])};v.prototype.textWidth=function(a){var a=Oa(a).split(/\r?\n/g),b=0,c,d=a.length;h.font=M+"px "+Y.name;for(c=0;c<d;++c)b=j.max(b,h.measureText(a[c]).width);return b};B.prototype.textWidth=function(a){var a=Oa(a).split(/\r?\n/g),b=0,c,d=a.length;ra===q&&(ra=E.createElement("canvas"));var e=ra.getContext("2d");
e.font=M+"px "+Y.name;for(c=0;c<d;++c)b=j.max(b,e.measureText(a[c]).width);return b};c.textLeading=function(a){Ua=a};c.textAscent=function(){var a=q,b=q,d=q,h=q;return function(){if(b!==Y||a!==M){b=Y;a=M;var e=!1,g=c.color(0),i=0,k=M,m=M/2;for(h=new Mc(Y.name,M,M,"k");m!==k;){for(var o=0;o<M;o++)h.get(o,m)!==g&&(e=!0,o=M);e?(k=m,e=!1):i=m;m=j.ceil((k+i)/2)}d=M-1-m+1}return d}}();c.textDescent=function(){var a=q,b=q,d=q,h=q;return function(){if(b!==Y||a!==M){b=Y;a=M;var e=!1,g=c.color(0),i=0,k=M,m=
M/2;for(h=new Mc(Y.name,M,0,"p");m!==k;){for(var o=0;o<M;o++)h.get(o,m)!==g&&(e=!0,o=M);e?(i=m,e=!1):k=m;m=j.ceil((k+i)/2)}d=m+1}return d}}();c.glyphLook=function(a,b){try{switch(b){case "1":return a.one;case "2":return a.two;case "3":return a.three;case "4":return a.four;case "5":return a.five;case "6":return a.six;case "7":return a.seven;case "8":return a.eight;case "9":return a.nine;case "0":return a.zero;case " ":return a.space;case "$":return a.dollar;case "!":return a.exclam;case '"':return a.quotedbl;
case "#":return a.numbersign;case "%":return a.percent;case "&":return a.ampersand;case "'":return a.quotesingle;case "(":return a.parenleft;case ")":return a.parenright;case "*":return a.asterisk;case "+":return a.plus;case ",":return a.comma;case "-":return a.hyphen;case ".":return a.period;case "/":return a.slash;case "_":return a.underscore;case ":":return a.colon;case ";":return a.semicolon;case "<":return a.less;case "=":return a.equal;case ">":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;k<p;k++){var q=c[k][0],a=t("[0-9\\-]+",q);switch(q[0]){case "M":b=parseFloat(a[0][0]);d=parseFloat(a[1][0]);n+="curContext.moveTo("+b+","+-d+");";break;case "L":b=parseFloat(a[0][0]);d=parseFloat(a[1][0]);n+="curContext.lineTo("+b+","+-d+");";break;case "H":b=parseFloat(a[0][0]);n+="curContext.lineTo("+b+","+-d+");";break;case "V":d=parseFloat(a[0][0]);n+="curContext.lineTo("+b+","+-d+");";break;case "T":g=parseFloat(a[0][0]);i=parseFloat(a[1][0]);o===
"Q"||o==="T"?(a=j.sqrt(j.pow(b-l,2)+j.pow(e-d,2)),m=j.PI+j.atan2(l-b,e-d),l=b+j.sin(m)*a,e=d+j.cos(m)*a):(l=b,e=d);n+="curContext.quadraticCurveTo("+l+","+-e+","+g+","+-i+");";b=g;d=i;break;case "Q":l=parseFloat(a[0][0]);e=parseFloat(a[1][0]);g=parseFloat(a[2][0]);i=parseFloat(a[3][0]);n+="curContext.quadraticCurveTo("+l+","+-e+","+g+","+-i+");";b=g;d=i;break;case "Z":n+="curContext.closePath();"}o=q[0]}n+="afterPathDraw();";n+="curContext.translate("+s+",0);";n+="}}";return(new Function("beforePathDraw",
"afterPathDraw",n))(function(){h.save();return $.$ensureContext()},function(){X();V();hb()})},u=function(b){var d=b.getElementsByTagName("font");c.glyphTable[a].horiz_adv_x=d[0].getAttribute("horiz-adv-x");d=b.getElementsByTagName("font-face")[0];c.glyphTable[a].units_per_em=parseFloat(d.getAttribute("units-per-em"));c.glyphTable[a].ascent=parseFloat(d.getAttribute("ascent"));c.glyphTable[a].descent=parseFloat(d.getAttribute("descent"));for(var b=b.getElementsByTagName("glyph"),d=b.length,e=0;e<d;e++){var f=
b[e].getAttribute("unicode"),g=b[e].getAttribute("glyph-name");s=b[e].getAttribute("horiz-adv-x");if(s===null)s=c.glyphTable[a].horiz_adv_x;k=b[e].getAttribute("d");k!==q&&(n=L(k),c.glyphTable[a][g]={name:g,unicode:f,horiz_adv_x:s,draw:n.draw})}};c.glyphTable[a]={};(function(){var b;try{b=E.implementation.createDocument("","",null)}catch(c){A.debug(c.message);return}try{b.async=!1,b.load(a),u(b.getElementsByTagName("svg")[0])}catch(d){A.debug(d);try{var e=new S.XMLHttpRequest;e.open("GET",a,!1);e.send(null);
u(e.responseXML.documentElement)}catch(f){A.debug(d)}}})(a);return c.glyphTable[a]};c.param=function(a){var b="data-processing-"+a;if(p.hasAttribute(b))return p.getAttribute(b);for(var b=0,c=p.childNodes.length;b<c;++b){var d=p.childNodes.item(b);if(!(d.nodeType!==1||d.tagName.toLowerCase()!=="param")&&d.getAttribute("name")===a)return d.getAttribute("value")}if(T.params.hasOwnProperty(a))return T.params[a];return null};y.prototype.translate=C("translate");y.prototype.scale=C("scale");y.prototype.pushMatrix=
C("pushMatrix");y.prototype.popMatrix=C("popMatrix");y.prototype.resetMatrix=C("resetMatrix");y.prototype.applyMatrix=C("applyMatrix");y.prototype.rotate=C("rotate");y.prototype.rotateZ=C("rotateZ");y.prototype.redraw=C("redraw");y.prototype.ambientLight=C("ambientLight");y.prototype.directionalLight=C("directionalLight");y.prototype.lightFalloff=C("lightFalloff");y.prototype.lightSpecular=C("lightSpecular");y.prototype.pointLight=C("pointLight");y.prototype.noLights=C("noLights");y.prototype.spotLight=
C("spotLight");y.prototype.box=C("box");y.prototype.sphere=C("sphere");y.prototype.ambient=C("ambient");y.prototype.emissive=C("emissive");y.prototype.shininess=C("shininess");y.prototype.specular=C("specular");y.prototype.fill=C("fill");y.prototype.stroke=C("stroke");y.prototype.strokeWeight=C("strokeWeight");y.prototype.smooth=C("smooth");y.prototype.noSmooth=C("noSmooth");y.prototype.point=C("point");y.prototype.vertex=C("vertex");y.prototype.endShape=C("endShape");y.prototype.bezierVertex=C("bezierVertex");
y.prototype.curveVertex=C("curveVertex");y.prototype.curve=C("curve");y.prototype.line=C("line");y.prototype.bezier=C("bezier");y.prototype.rect=C("rect");y.prototype.ellipse=C("ellipse");y.prototype.background=C("background");y.prototype.image=C("image");y.prototype.textWidth=C("textWidth");y.prototype.text$line=C("text$line");y.prototype.$ensureContext=C("$ensureContext");y.prototype.$newPMatrix=C("$newPMatrix");y.prototype.size=function(a,b,f){lb(f===d.WEBGL?"3D":"2D");c.size(a,b,f)};y.prototype.$init=
function(){};v.prototype.$init=function(){c.size(c.width,c.height);h.translate(0.5,0.5);h.lineCap="round";c.noSmooth();c.disableContextMenu()};B.prototype.$init=function(){c.use3DContext=!0};F.prototype.$ensureContext=function(){return h};O(p,"touchstart",function(a){p.setAttribute("style","-webkit-user-select: none");p.setAttribute("onclick","void(0)");p.setAttribute("style","-webkit-tap-highlight-color:rgba(0,0,0,0)");for(var b=0,f=ib.length;b<f;b++){var h=ib[b].type;(h==="mouseout"||h==="mousemove"||
h==="mousedown"||h==="mouseup"||h==="DOMMouseScroll"||h==="mousewheel"||h==="touchstart")&&ia(ib[b])}c.touchStart!==q||c.touchMove!==q||c.touchEnd!==q||c.touchCancel!==q?(O(p,"touchstart",function(a){c.touchStart!==q&&(a=Lb(a),c.touchStart(a))}),O(p,"touchmove",function(a){c.touchMove!==q&&(a.preventDefault(),a=Lb(a),c.touchMove(a))}),O(p,"touchend",function(a){c.touchEnd!==q&&(a=Lb(a),c.touchEnd(a))}),O(p,"touchcancel",function(a){c.touchCancel!==q&&(a=Lb(a),c.touchCancel(a))})):(O(p,"touchstart",
function(a){Kb(p,a.touches[0]);c.__mousePressed=!0;c.mouseDragging=!1;c.mouseButton=d.LEFT;typeof c.mousePressed==="function"&&c.mousePressed()}),O(p,"touchmove",function(a){a.preventDefault();Kb(p,a.touches[0]);typeof c.mouseMoved==="function"&&!c.__mousePressed&&c.mouseMoved();if(typeof c.mouseDragged==="function"&&c.__mousePressed)c.mouseDragged(),c.mouseDragging=!0}),O(p,"touchend",function(){c.__mousePressed=!1;typeof c.mouseClicked==="function"&&!c.mouseDragging&&c.mouseClicked();typeof c.mouseReleased===
"function"&&c.mouseReleased()}));p.dispatchEvent(a)});(function(){var a=!0,b=function(a){a.preventDefault();a.stopPropagation()};c.disableContextMenu=function(){a&&(O(p,"contextmenu",b),a=!1)};c.enableContextMenu=function(){a||(ia({elem:p,type:"contextmenu",fn:b}),a=!0)}})();O(p,"mousemove",function(a){Kb(p,a);typeof c.mouseMoved==="function"&&!c.__mousePressed&&c.mouseMoved();if(typeof c.mouseDragged==="function"&&c.__mousePressed)c.mouseDragged(),c.mouseDragging=!0});O(p,"mouseout",function(){typeof c.mouseOut===
"function"&&c.mouseOut()});O(p,"mouseover",function(a){Kb(p,a);typeof c.mouseOver==="function"&&c.mouseOver()});O(p,"mousedown",function(a){c.__mousePressed=!0;c.mouseDragging=!1;switch(a.which){case 1:c.mouseButton=d.LEFT;break;case 2:c.mouseButton=d.CENTER;break;case 3:c.mouseButton=d.RIGHT}typeof c.mousePressed==="function"&&c.mousePressed()});O(p,"mouseup",function(){c.__mousePressed=!1;typeof c.mouseClicked==="function"&&!c.mouseDragging&&c.mouseClicked();typeof c.mouseReleased==="function"&&
c.mouseReleased()});Db=function(a){var b=0;a.wheelDelta?(b=a.wheelDelta/120,S.opera&&(b=-b)):a.detail&&(b=-a.detail/3);(c.mouseScroll=b)&&typeof c.mouseScrolled==="function"&&c.mouseScrolled()};O(E,"DOMMouseScroll",Db);O(E,"mousewheel",Db);typeof p==="string"&&(p=E.getElementById(p));p.getAttribute("tabindex")||p.setAttribute("tabindex",0);if(mb)T=new A.Sketch,lb(),c.size=function(a,b,f){f&&f===d.WEBGL?lb("3D"):lb("2D");c.toImageData=f===d.WEBGL?function(){var a=E.createElement("canvas").getContext("2d").createImageData(this.width,
this.height),b=new Fc(this.width*this.height*4);h.readPixels(0,0,this.width,this.height,h.RGBA,h.UNSIGNED_BYTE,b);for(var c=0,d=b.length,f=this.height,m=this.width,o=a.data;c<d;c++)o[c]=b[(f-1-j.floor(c/4/m))*m*4+c%(m*4)];return a}:function(){return h.getImageData(0,0,this.width,this.height)};c.size(a,b,f)};else{if(L instanceof A.Sketch)T=L;else if(typeof L==="function")T=new A.Sketch(L);else if(L)throw"PJS compile is not supported";else T=new A.Sketch(function(){});c.externals.sketch=T;lb();p.onfocus=
function(){c.focused=!0};p.onblur=function(){c.focused=!1;if(!T.options.globalKeyEvents)c.__keyPressed=!1,Va=[],$a=null};T.options.pauseOnBlur&&(O(S,"focus",function(){ab&&c.loop()}),O(S,"blur",function(){ab&&Mb&&(c.noLoop(),ab=!0);c.__keyPressed=!1;Va=[];$a=null}));mb=T.options.globalKeyEvents?S:p;O(mb,"keydown",dc);O(mb,"keypress",ec);O(mb,"keyup",xd);for(var Eb in A.lib)A.lib.hasOwnProperty(Eb)&&(A.lib[Eb].hasOwnProperty("attach")?A.lib[Eb].attach(c):A.lib[Eb]instanceof Function&&A.lib[Eb].call(this));
var rd=function(a){!T.imageCache.pending&&T.fonts.pending()?(T.attach(a,W),T.onLoad(),a.setup&&(a.setup(),h&&!c.use3DContext&&h.setTransform(1,0,0,1,0,0),T.onSetup()),Da(),a.draw&&(ab?a.loop():a.redraw())):S.setTimeout(function(){rd(a)},10)};if(this.externals.canvas.id===q||!this.externals.canvas.id.length)this.externals.canvas.id="__processing"+La.length;Hb[this.externals.canvas.id]=La.length;La.push(this);rd(c)}};A.debug=Ka;A.prototype=W;Ka=function(){var d={};typeof tinylog!=="undefined"&&typeof tinylog.log===
"function"?d.log=tinylog.log:typeof E!=="undefined"&&!E.fake?function(){var j=E,q={zIndex:1E4,position:"fixed",bottom:"0px",width:"100%",height:"15%",fontFamily:"sans-serif",color:"#ccc",backgroundColor:"black"},z={position:"relative",fontFamily:"monospace",overflow:"auto",height:"100%",paddingTop:"5px"},u={height:"5px",marginTop:"-5px",cursor:"n-resize",backgroundColor:"darkgrey"},t={position:"absolute",top:"5px",right:"20px",color:"#111",MozBorderRadius:"4px",webkitBorderRadius:"4px",borderRadius:"4px",
cursor:"pointer",fontWeight:"normal",textAlign:"center",padding:"3px 5px",backgroundColor:"#333",fontSize:"12px"},A={minHeight:"16px"},N={fontSize:"12px",margin:"0 8px 0 8px",maxWidth:"100%",whiteSpace:"pre-wrap",overflow:"auto"},J=j.defaultView,P=j.documentElement,O=P.style,S=function(){for(var d=arguments.length,j,p,q;d--;)for(q in p=arguments[d--],j=arguments[d].style,p)p.hasOwnProperty(q)&&(j[q]=p[q])},W=function(d,j,p){d.addEventListener?d.addEventListener(j,p,!1):d.attachEvent&&d.attachEvent("on"+
j,p);return[d,j,p]},aa=function(d,j,p){d.removeEventListener?d.removeEventListener(j,p,!1):d.detachEvent&&d.detachEvent("on"+j,p)},ia=function(d){for(var j=d.childNodes,p=j.length;p--;)d.removeChild(j.item(0))},Ca=function(d,j){return d.appendChild(j)},Ba=d.log=function(E){var za,Sa=O.paddingBottom,Z=j.createElement("div"),Ka=Z.style,X=Ca(Z,j.createElement("div")),V=Ca(Z,j.createElement("div")),ua=Ca(Z,j.createElement("div")),qa=!1,Da=!1,Aa=!1,Za=0,Oa=function(d){var j=J.innerHeight,p=X.clientHeight;
d<0?d=0:d+p>j&&(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<this.fontList.length;j++)this.fontList[j].offsetWidth===
this.template.offsetWidth&&this.fontList[j].offsetHeight===this.template.offsetHeight?(d=!1,this.attempt++):(E.getElementsByTagName("body")[0].removeChild(this.fontList[j]),this.fontList.splice(j--,1),this.attempt=0);if(this.attempt>=30){d=!0;for(j=0;j<this.fontList.length;j++)E.getElementsByTagName("body")[0].removeChild(this.fontList[j]),this.fontList.splice(j--,1)}d&&E.getElementsByTagName("body")[0].removeChild(this.template);return d},fontList:[],fontFamily:"",style:ua?E.createElement("style"):
null,add:function(d){var j=typeof d==="object"?d.fontFace:d;this.fontFamily+="@font-face{\n font-family: '"+j+"';\n src: url('"+(typeof d==="object"?d.url:d)+"');\n}\n";this.style.innerHTML=this.fontFamily;E.getElementsByTagName("head")[0].appendChild(this.style);d=E.createElement("p");d.style.fontFamily="'"+j+"', 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);this.fontList.push(d)}};
this.sourceCode=void 0;this.attach=function(d){if(typeof this.attachFunction==="function")this.attachFunction(d);else if(this.sourceCode){var j=(new Function("return ("+this.sourceCode+");"))();j(d);this.attachFunction=j}else throw"Unable to attach sketch to the processing instance";}};ua?S.Processing=A:this.Processing=A})(window,window.document,Math);