text: !function(e,t,n,r){var i=function(){},s=function(){if("console"in e)return function(t){e.console.log("Processing.js: "+t)}}(),o=function(e){var t=new XMLHttpRequest;if(t.open("GET",e,!1),t.overrideMimeType&&t.overrideMimeType("text/plain"),t.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT"),t.send(null),200!==t.status&&0!==t.status)throw"XMLHttpRequest failed, status code "+t.status;return t.responseText},a="document"in this&&!("fake"in this.document);function l(t,n){return t in e?e[t]:"function"==typeof e[n]?e[n]:function(e){if(e instanceof Array)return e;if("number"==typeof e){var t=[];return t.length=e,t}}}t.head=t.head||t.getElementsByTagName("head")[0];var h=l("Float32Array","WebGLFloatArray"),u=l("Int32Array","WebGLIntArray"),f=l("Uint16Array","WebGLUnsignedShortArray"),c=l("Uint8Array","WebGLUnsignedByteArray"),p={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:1e-4,MAX_FLOAT:34028235e31,MIN_FLOAT:-34028235e31,MAX_INT:2147483647,MIN_INT:-2147483648,PI:n.PI,TWO_PI:2*n.PI,HALF_PI:n.PI/2,THIRD_PI:n.PI/3,QUARTER_PI:n.PI/4,DEG_TO_RAD:n.PI/180,RAD_TO_DEG:180/n.PI,WHITESPACE:" \t\n\r\f ",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:720,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};function g(e){if("string"==typeof e){for(var t=0,i=0;i<e.length;++i)t=31*t+e.charCodeAt(i)&4294967295;return t}return"object"!=typeof e?4294967295&e:e.hashCode instanceof Function?e.hashCode():(e.$id===r&&(e.$id=n.floor(65536*n.random())-32768<<16|n.floor(65536*n.random())),e.$id)}function m(e,t){return null===e||null===t?null===e&&null===t:"string"==typeof e||"object"!=typeof e?e===t:e.equals instanceof Function?e.equals(t):e===t}var d=function(e){if(e.iterator instanceof Function)return e.iterator();if(!(e instanceof Array))throw"Unable to iterate: "+e;var t=-1;this.hasNext=function(){return++t<e.length},this.next=function(){return e[t]}},v=function(){function e(e){var t=0;this.hasNext=function(){return t<e.length},this.next=function(){return e[t++]},this.remove=function(){e.splice(t,1)}}return function t(){var n;0===arguments.length?n=[]:arguments.length>0&&"number"!=typeof arguments[0]?n=arguments[0].toArray():(n=[]).length=0|arguments[0],this.get=function(e){return n[e]},this.contains=function(e){return this.indexOf(e)>-1},this.indexOf=function(e){for(var t=0,r=n.length;t<r;++t)if(m(e,n[t]))return t;return-1},this.add=function(){if(1===arguments.length)n.push(arguments[0]);else{if(2!==arguments.length)throw"Please use the proper number of parameters.";var e=arguments[0];if("number"!=typeof e)throw typeof e+" is not a number";if(!(e>=0&&e<=n.length))throw e+" is not a valid index";n.splice(e,0,arguments[1])}},this.addAll=function(e,t){var r;if("number"==typeof e){if(e<0||e>n.length)throw"Index out of bounds for addAll: "+e+" greater or equal than "+n.length;for(r=new d(t);r.hasNext();)n.splice(e++,0,r.next())}else for(r=new d(e);r.hasNext();)n.push(r.next())},this.set=function(){if(2!==arguments.length)throw"Please use the proper number of parameters.";var e=arguments[0];if("number"!=typeof e)throw typeof e+" is not a number";if(!(e>=0&&e<n.length))throw e+" is not a valid index.";n.splice(e,1,arguments[1])},this.size=function(){return n.length},this.clear=function(){n.length=0},this.remove=function(e){return"number"==typeof e?n.splice(e,1)[0]:(e=this.indexOf(e))>-1&&(n.splice(e,1),!0)},this.isEmpty=function(){return!n.length},this.clone=function(){return new t(this)},this.toArray=function(){return n.slice(0)},this.iterator=function(){return new e(n)}}}(),y=function e(){if(1===arguments.length&&arguments[0]instanceof e)return arguments[0].clone();var t=arguments.length>0?arguments[0]:16,n=arguments.length>1?arguments[1]:.75,i=[];i.length=t;var s=0,o=this;function a(e){var t=g(e)%i.length;return t<0?i.length+t:t}function l(){if(!(s<=n*i.length)){for(var e=[],t=0;t<i.length;++t)i[t]!==r&&(e=e.concat(i[t]));var o=2*i.length;(i=[]).length=o;for(var l=0;l<e.length;++l){var h=a(e[l].key),u=i[h];u===r&&(i[h]=u=[]),u.push(e[l])}}}function h(e,t){var n=0,s=-1,o=!1;function a(){for(;!o;)if(++s,n>=i.length)o=!0;else{if(!(i[n]===r||s>=i[n].length))return;s=-1,++n}}this.hasNext=function(){return!o},this.next=function(){var t=e(i[n][s]);return a(),t},this.remove=function(){t(this.next()),--s},a()}function u(e,t,n){this.clear=function(){o.clear()},this.contains=function(e){return t(e)},this.containsAll=function(e){for(var t=e.iterator();t.hasNext();)if(!this.contains(t.next()))return!1;return!0},this.isEmpty=function(){return o.isEmpty()},this.iterator=function(){return new h(e,n)},this.remove=function(e){return!!this.contains(e)&&(n(e),!0)},this.removeAll=function(e){for(var t=e.iterator();t.hasNext();){var r=t.next();this.contains(r)&&n(r)}return!0},this.retainAll=function(e){for(var t=this.iterator(),r=[];t.hasNext();){var i=t.next();e.contains(i)||r.push(i)}for(var s=0;s<r.length;++s)n(r[s]);return r.length>0},this.size=function(){return o.size()},this.toArray=function(){for(var e=[],t=this.iterator();t.hasNext();)e.push(t.next());return e}}function f(e){this._isIn=function(t){return t===o&&e.removed===r},this.equals=function(t){return m(e.key,t.getKey())},this.getKey=function(){return e.key},this.getValue=function(){return e.value},this.hashCode=function(t){return g(e.key)},this.setValue=function(t){var n=e.value;return e.value=t,n}}this.clear=function(){s=0,(i=[]).length=t},this.clone=function(){var t=new e;return t.putAll(this),t},this.containsKey=function(e){var t=a(e),n=i[t];if(n===r)return!1;for(var s=0;s<n.length;++s)if(m(n[s].key,e))return!0;return!1},this.containsValue=function(e){for(var t=0;t<i.length;++t){var n=i[t];if(n!==r)for(var s=0;s<n.length;++s)if(m(n[s].value,e))return!0}return!1},this.entrySet=function(){return new u((function(e){return new f(e)}),(function(e){return e instanceof f&&e._isIn(o)}),(function(e){return o.remove(e.getKey())}))},this.get=function(e){var t=a(e),n=i[t];if(n===r)return null;for(var s=0;s<n.length;++s)if(m(n[s].key,e))return n[s].value;return null},this.isEmpty=function(){return 0===s},this.keySet=function(){return new u((function(e){return e.key}),(function(e){return o.containsKey(e)}),(function(e){return o.remove(e)}))},this.values=function(){return new u((function(e){return e.value}),(function(e){return o.containsValue(e)}),(function(e){return o.removeByValue(e)}))},this.put=function(e,t){var n=a(e),o=i[n];if(o===r)return++s,i[n]=[{key:e,value:t}],l(),null;for(var h=0;h<o.length;++h)if(m(o[h].key,e)){var u=o[h].value;return o[h].value=t,u}return++s,o.push({key:e,value:t}),l(),null},this.putAll=function(e){for(var t=e.entrySet().iterator();t.hasNext();){var n=t.next();this.put(n.getKey(),n.getValue())}},this.remove=function(e){var t=a(e),n=i[t];if(n===r)return null;for(var o=0;o<n.length;++o)if(m(n[o].key,e)){--s;var l=n[o].value;return n[o].removed=!0,n.length>1?n.splice(o,1):i[t]=r,l}return null},this.removeByValue=function(e){var t,n,r;for(t in i)if(i.hasOwnProperty(t))for(n=0,r=i[t].length;n<r;n++)if(i[t][n].value===e)return i[t].splice(n,1),!0;return!1},this.size=function(){return s}},b=function(){function e(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function t(e){return function(t,n){var r=t.get();return r[e](n),r}}for(var r in e.dist=function(e,t){return e.dist(t)},e.dot=function(e,t){return e.dot(t)},e.cross=function(e,t){return e.cross(t)},e.angleBetween=function(e,t){return n.acos(e.dot(t)/(e.mag()*t.mag()))},e.prototype={set:function(e,t,n){1===arguments.length?this.set(e.x||e[0]||0,e.y||e[1]||0,e.z||e[2]||0):(this.x=e,this.y=t,this.z=n)},get:function(){return new e(this.x,this.y,this.z)},mag:function(){var e=this.x,t=this.y,r=this.z;return n.sqrt(e*e+t*t+r*r)},add:function(e,t,n){1===arguments.length?(this.x+=e.x,this.y+=e.y,this.z+=e.z):(this.x+=e,this.y+=t,this.z+=n)},sub:function(e,t,n){1===arguments.length?(this.x-=e.x,this.y-=e.y,this.z-=e.z):(this.x-=e,this.y-=t,this.z-=n)},mult:function(e){"number"==typeof e?(this.x*=e,this.y*=e,this.z*=e):(this.x*=e.x,this.y*=e.y,this.z*=e.z)},div:function(e){"number"==typeof e?(this.x/=e,this.y/=e,this.z/=e):(this.x/=e.x,this.y/=e.y,this.z/=e.z)},dist:function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n.sqrt(t*t+r*r+i*i)},dot:function(e,t,n){return 1===arguments.length?this.x*e.x+this.y*e.y+this.z*e.z:this.x*e+this.y*t+this.z*n},cross:function(t){var n=this.x,r=this.y,i=this.z;return new e(r*t.z-t.y*i,i*t.x-t.z*n,n*t.y-t.x*r)},normalize:function(){var e=this.mag();e>0&&this.div(e)},limit:function(e){this.mag()>e&&(this.normalize(),this.mult(e))},heading2D:function(){return-n.atan2(-this.y,this.x)},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}},e.prototype)e.prototype.hasOwnProperty(r)&&!e.hasOwnProperty(r)&&(e[r]=t(r));return e}();function x(){}x.prototype=p;var w=new x;function A(e,t){function n(n){w.defineProperty(e,n,{get:function(){return t[n]},set:function(e){t[n]=e},enumerable:!0})}var r=[];for(var i in t)"function"==typeof t[i]?e.hasOwnProperty(i)||(e[i]=t[i]):"$"===i.charAt(0)||i in e||r.push(i);for(;r.length>0;)n(r.shift())}w.ArrayList=v,w.HashMap=y,w.PVector=b,w.ObjectIterator=d,w.PConstants=p,w.defineProperty=function(e,t,n){"defineProperty"in Object?Object.defineProperty(e,t,n):(n.hasOwnProperty("get")&&e.__defineGetter__(t,n.get),n.hasOwnProperty("set")&&e.__defineSetter__(t,n.set))},w.extendClassChain=function(e){for(var t=[e],n=e.$upcast;n;n=n.$upcast)A(n,e),t.push(n),e=n;for(;t.length>0;)t.pop().$self=e},w.extendStaticMembers=function(e,t){A(e,t)},w.extendInterfaceMembers=function(e,t){A(e,t)},w.addMethod=function(e,t,n,r){if(e[t]){var i=n.length,s=e[t];e[t]=function(){return arguments.length===i?n.apply(this,arguments):s.apply(this,arguments)}}else e[t]=n},w.createJavaArray=function(e,t){var n=null;if("number"==typeof t[0]){var r=0|t[0];if(t.length<=1){(n=[]).length=r;for(var i=0;i<r;++i)n[i]=0}else{n=[];for(var s=t.slice(1),o=0;o<r;++o)n.push(w.createJavaArray(e,s))}}return n};var C={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"};!function(e){var t,n="open() createOutput() createInput() BufferedReader selectFolder() dataPath() createWriter() selectOutput() beginRecord() saveStream() endRecord() selectInput() saveBytes() createReader() beginRaw() endRaw() PrintWriter delay()".split(" "),r=n.length;function i(e){return function(){throw"Processing.js does not support "+e+"."}}for(;r--;)e[(t=n[r]).replace("()","")]=i(t)}(w),w.defineProperty(w,"screenWidth",{get:function(){return e.innerWidth}}),w.defineProperty(w,"screenHeight",{get:function(){return e.innerHeight}});var T=[],S={};function P(e,i){e===r&&(e=""),this.name=e,i===r&&(i=0),this.size=i,this.glyph=!1,this.ascent=0,this.descent=0,this.leading=1.2*i;var s=e.indexOf(" Italic Bold");-1!==s&&(e=e.substring(0,s)),this.style="normal";var o=e.indexOf(" Italic");-1!==o&&(e=e.substring(0,o),this.style="italic"),this.weight="normal";var a=e.indexOf(" Bold");if(-1!==a&&(e=e.substring(0,a),this.weight="bold"),this.family="sans-serif",e!==r)switch(e){case"sans-serif":case"serif":case"monospace":case"fantasy":case"cursive":this.family=e;break;default:this.family='"'+e+'", sans-serif'}this.context2d=null,function(e){var r=e.size/250,i=t.createElement("canvas");i.width=500,i.height=500,i.style.opacity=0;var s=e.getCSSDefinition("250px","normal"),o=i.getContext("2d");o.font=s,e.context2d=o,i.width=o.measureText("dbflkhyjqpg").width,o.font=s;var a=t.createElement("div");a.style.position="absolute",a.style.opacity=0,a.style.fontFamily='"'+e.name+'"',a.style.fontSize="250px",a.innerHTML="dbflkhyjqpg<br/>dbflkhyjqpg",t.body.appendChild(a);var l=i.width,h=i.height,u=h/2;o.fillStyle="white",o.fillRect(0,0,l,h),o.fillStyle="black",o.fillText("dbflkhyjqpg",0,u);for(var f=o.getImageData(0,0,l,h).data,c=0,p=4*l,g=f.length;++c<g&&255===f[c];);var m=n.round(c/p);for(c=g-1;--c>0&&255===f[c];);var d=n.round(c/p);if(e.ascent=r*(u-m),e.descent=r*(d-u),t.defaultView.getComputedStyle){var v=t.defaultView.getComputedStyle(a,null).getPropertyValue("height");(v=r*v.replace("px",""))>=2*e.size&&(e.leading=n.round(v/2))}t.body.removeChild(a)}(this),this.css=this.getCSSDefinition(),this.context2d.font=this.css}P.prototype.getCSSDefinition=function(e,t){return e===r&&(e=this.size+"px"),t===r&&(t=this.leading+"px"),[this.style,"normal",this.weight,e+"/"+t,this.family].join(" ")},P.prototype.measureTextWidth=function(e){return this.context2d.measureText(e).width},P.PFontCache={},P.get=function(e,t){var n=P.PFontCache,r=e+"/"+t;return n[r]||(n[r]=new P(e,t)),n[r]},P.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]},P.preloading={template:{},initialized:!1,initialize:function(){var e=t.createElement("style");e.setAttribute("type","text/css"),e.innerHTML='@font-face {\n  font-family: "PjsEmptyFont";\n  src: url(\'data:application/x-font-ttf;base64,'+"#E3KAI2wAgT1MvMg7Eo3VmNtYX7ABi3CxnbHlm7Abw3kaGVhZ7ACs3OGhoZWE7A53CRobXR47AY3AGbG9jYQ7G03Bm1heH7ABC3CBuYW1l7Ae3AgcG9zd7AI3AE#B3AQ2kgTY18PPPUACwAg3ALSRoo3#yld0xg32QAB77#E777773B#E3C#I#Q77773E#Q7777777772CMAIw7AB77732B#M#Q3wAB#g3B#E#E2BB//82BB////w#B7#gAEg3E77x2B32B#E#Q#MTcBAQ32gAe#M#QQJ#E32M#QQJ#I#g32Q77#".replace(/[#237]/g,(function(e){return"AAAAAAAA".substr(~~e?7-e:6)}))+"')\n       format('truetype');\n}",t.head.appendChild(e);var n=t.createElement("span");n.style.cssText='position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;',n.innerHTML="AAAAAAAA",t.body.appendChild(n),this.template=n,this.initialized=!0},getElementWidth:function(e){return t.defaultView.getComputedStyle(e,"").getPropertyValue("width")},timeAttempted:0,pending:function(e){this.initialized||this.initialize();for(var n,r,i=this.getElementWidth(this.template),s=0;s<this.fontList.length;s++){if(n=this.fontList[s],r=this.getElementWidth(n),this.timeAttempted<4e3&&r===i)return this.timeAttempted+=e,!0;t.body.removeChild(n),this.fontList.splice(s--,1),this.timeAttempted=0}return 0!==this.fontList.length},fontList:[],addedList:{},add:function(e){this.initialized||this.initialize();var n="object"==typeof e?e.fontFace:e,r="object"==typeof e?e.url:e;if(!this.addedList[n]){var i=t.createElement("style");i.setAttribute("type","text/css"),i.innerHTML="@font-face{\n  font-family: '"+n+"';\n  src:  url('"+r+"');\n}\n",t.head.appendChild(i),this.addedList[n]=!0;var s=t.createElement("span");s.style.cssText="position: absolute; top: 0; left: 0; opacity: 0;",s.style.fontFamily='"'+n+'", "PjsEmptyFont", fantasy',s.innerHTML="AAAAAAAA",t.body.appendChild(s),this.fontList.push(s)}}},w.PFont=P;var E=this.Processing=function(s,a){if(!(this instanceof E))throw"called Processing constructor as if it were a function: missing 'new'.";var l,m=s===r&&a===r;if(!((l=m?t.createElement("canvas"):"string"==typeof s?t.getElementById(s):s)instanceof HTMLCanvasElement))throw"called Processing constructor without passing canvas element reference or id.";function d(e){E.debug("Unimplemented - "+e)}var v=this;v.externals={canvas:l,context:r,sketch:r},v.name="Processing.js Instance",v.use3DContext=!1,v.focused=!1,v.breakShape=!1,v.glyphTable={},v.pmouseX=0,v.pmouseY=0,v.mouseX=0,v.mouseY=0,v.mouseButton=0,v.mouseScroll=0,v.mouseClicked=r,v.mouseDragged=r,v.mouseMoved=r,v.mousePressed=r,v.mouseReleased=r,v.mouseScrolled=r,v.mouseOver=r,v.mouseOut=r,v.touchStart=r,v.touchEnd=r,v.touchMove=r,v.touchCancel=r,v.key=r,v.keyCode=r,v.keyPressed=i,v.keyReleased=i,v.keyTyped=i,v.draw=r,v.setup=r,v.__mousePressed=!1,v.__keyPressed=!1,v.__frameRate=60,v.frameCount=0,v.width=100,v.height=100;var y,x,A,_,R,k,L,D,I,O,N,F,M,$,z,B,V,U,G,X,Y,H,Z,W,j,q,K,J,Q,ee,te,ne,re,ie,se,oe,ae=!0,le=[1,1,1,1],he=4294967295,ue=!0,fe=!0,ce=[0,0,0,1],pe=4278190080,ge=!0,me=1,de=!1,ve=!0,ye=0,be=0,xe=3,we=0,Ae=0,Ce=0,Te=0,Se=60,Pe=1e3/Se,Ee=l.style.cursor,_e=20,Re=0,ke=20,Le=!1,De=-3355444,Ie=20,Oe=255,Ne=255,Fe=255,Me=255,$e=0,ze=0,Be=1,Ve=null,Ue=null,Ge=Date.now(),Xe=Ge,Ye=0,He={attributes:{},locations:{}},Ze={width:0,height:0},We=2,je=!1,qe=37,Ke=0,Je=4,Qe="Arial",et=12,tt=9,nt=2,rt=14,it=P.get(Qe,et),st=null,ot=!1,at=1e3,lt=[],ht=null,ut=[16,17,18,20,33,34,35,36,37,38,39,40,144,155,112,113,114,115,116,117,118,119,120,121,122,123,157];t.defaultView&&t.defaultView.getComputedStyle&&(re=parseInt(t.defaultView.getComputedStyle(l,null).paddingLeft,10)||0,ie=parseInt(t.defaultView.getComputedStyle(l,null).paddingTop,10)||0,se=parseInt(t.defaultView.getComputedStyle(l,null).borderLeftWidth,10)||0,oe=parseInt(t.defaultView.getComputedStyle(l,null).borderTopWidth,10)||0);var ft,ct,pt,gt,mt,dt,vt,yt,bt,xt=0,wt=0,At=0,Ct=[],Tt=[],St=[],Pt=new h(720),Et=new h(720),_t=!1,Rt=n.PI/180*60,kt=v.width/2,Lt=v.height/2,Dt=Lt/n.tan(Rt/2),It=Dt/10,Ot=10*Dt,Nt=v.width/v.height,Ft=[],Mt=[],$t=0,zt=!1,Bt=!1,Vt=!0,Ut=0,Gt=[],Xt=new h([.5,.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,-.5,-.5,.5,.5,-.5,.5,.5,.5,.5,.5,.5,-.5,.5,.5,.5,.5,-.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,.5,-.5,.5,-.5,-.5,.5,-.5,.5,-.5,-.5,.5,-.5,-.5,.5,-.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5,-.5,.5,-.5,-.5,-.5,-.5,.5,.5,.5,.5,.5,-.5,-.5,.5,-.5,-.5,.5,-.5,-.5,.5,.5,.5,.5,.5]),Yt=new h([.5,.5,.5,.5,-.5,.5,.5,.5,-.5,.5,-.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,.5,.5,-.5,-.5,.5,.5,.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,-.5,-.5,.5,-.5,-.5,.5,.5,-.5,.5,.5,.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,.5,.5,-.5,.5]),Ht=new h([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]),Zt=new h([0,0,0,0,1,0,1,1,0,1,0,0]),Wt=new h([0,0,1,0,0,1,0,0,1,0,0,1]),jt="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);}",qt="#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;void main(void){  gl_FragColor = frontColor;}",Kt="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;}",Jt="#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  }}",Qt="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 );}",en="#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)) * frontColor;  }  else{    gl_FragColor = frontColor;  }}";function tn(e,t,n,i){var s=He.locations[e];s===r&&(s=y.getUniformLocation(t,n),He.locations[e]=s),null!==s&&(4===i.length?y.uniform4fv(s,i):3===i.length?y.uniform3fv(s,i):2===i.length?y.uniform2fv(s,i):y.uniform1f(s,i))}function nn(e,t,n,i){var s=He.locations[e];s===r&&(s=y.getUniformLocation(t,n),He.locations[e]=s),null!==s&&(4===i.length?y.uniform4iv(s,i):3===i.length?y.uniform3iv(s,i):2===i.length?y.uniform2iv(s,i):y.uniform1i(s,i))}function rn(e,t,n,i,s){var o=He.locations[e];o===r&&(o=y.getUniformLocation(t,n),He.locations[e]=o),-1!==o&&(16===s.length?y.uniformMatrix4fv(o,i,s):9===s.length?y.uniformMatrix3fv(o,i,s):y.uniformMatrix2fv(o,i,s))}function sn(e,t,n,i,s){var o=He.attributes[e];o===r&&(o=y.getAttribLocation(t,n),He.attributes[e]=o),-1!==o&&(y.bindBuffer(y.ARRAY_BUFFER,s),y.vertexAttribPointer(o,i,y.FLOAT,!1,0,0),y.enableVertexAttribArray(o))}function on(e,t,n){var i=He.attributes[e];i===r&&(i=y.getAttribLocation(t,n),He.attributes[e]=i),-1!==i&&y.disableVertexAttribArray(i)}var an=function(e,t,n){var r=e.createShader(e.VERTEX_SHADER);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw e.getShaderInfoLog(r);var i=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(i,n),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS))throw e.getShaderInfoLog(i);var s=e.createProgram();if(e.attachShader(s,r),e.attachShader(s,i),e.linkProgram(s),!e.getProgramParameter(s,e.LINK_STATUS))throw"Error linking shaders.";return s},ln=function(e,t,n,r,i){return{x:e,y:t,w:n,h:r}},hn=ln,un=function(e,t,n,r,i){return{x:e,y:t,w:i?n:n-e,h:i?r:r-t}},fn=function(e,t,n,r,i){return{x:e-n/2,y:t-r/2,w:n,h:r}},cn=function(){},pn=function(){},gn=function(){},mn=function(){};(pn.prototype=new cn).constructor=pn,(gn.prototype=new cn).constructor=gn,(mn.prototype=new cn).constructor=mn,cn.prototype.a3DOnlyFunction=i;var dn={},vn=v.Character=function(e){return"string"==typeof e&&1===e.length?this.code=e.charCodeAt(0):this.code="number"==typeof e||e instanceof vn?e:NaN,dn[this.code]===r?dn[this.code]=this:dn[this.code]};vn.prototype.toString=function(){return String.fromCharCode(this.code)},vn.prototype.valueOf=function(){return this.code};var yn=v.PShape=function(e){this.family=e||0,this.visible=!0,this.style=!0,this.children=[],this.nameTable=[],this.params=[],this.name="",this.image=null,this.matrix=null,this.kind=null,this.close=null,this.width=null,this.height=null,this.parent=null};yn.prototype={isVisible:function(){return this.visible},setVisible:function(e){this.visible=e},disableStyle:function(){this.style=!1;for(var e=0,t=this.children.length;e<t;e++)this.children[e].disableStyle()},enableStyle:function(){this.style=!0;for(var e=0,t=this.children.length;e<t;e++)this.children[e].enableStyle()},getFamily:function(){return this.family},getWidth:function(){return this.width},getHeight:function(){return this.height},setName:function(e){this.name=e},getName:function(){return this.name},draw:function(){this.visible&&(this.pre(),this.drawImpl(),this.post())},drawImpl:function(){0===this.family?this.drawGroup():1===this.family?this.drawPrimitive():3===this.family?this.drawGeometry():21===this.family&&this.drawPath()},drawPath:function(){var e,t;if(0!==this.vertices.length){if(v.beginShape(),0===this.vertexCodes.length)if(2===this.vertices[0].length)for(e=0,t=this.vertices.length;e<t;e++)v.vertex(this.vertices[e][0],this.vertices[e][1]);else for(e=0,t=this.vertices.length;e<t;e++)v.vertex(this.vertices[e][0],this.vertices[e][1],this.vertices[e][2]);else{var n=0;if(2===this.vertices[0].length)for(e=0,t=this.vertexCodes.length;e<t;e++)0===this.vertexCodes[e]?(v.vertex(this.vertices[n][0],this.vertices[n][1]),!0===this.vertices[n].moveTo?Ft[Ft.length-1].moveTo=!0:!1===this.vertices[n].moveTo&&(Ft[Ft.length-1].moveTo=!1),v.breakShape=!1,n++):1===this.vertexCodes[e]?(v.bezierVertex(this.vertices[n+0][0],this.vertices[n+0][1],this.vertices[n+1][0],this.vertices[n+1][1],this.vertices[n+2][0],this.vertices[n+2][1]),n+=3):2===this.vertexCodes[e]?(v.curveVertex(this.vertices[n][0],this.vertices[n][1]),n++):3===this.vertexCodes[e]&&(v.breakShape=!0);else for(e=0,t=this.vertexCodes.length;e<t;e++)0===this.vertexCodes[e]?(v.vertex(this.vertices[n][0],this.vertices[n][1],this.vertices[n][2]),!0===this.vertices[n].moveTo?Ft[Ft.length-1].moveTo=!0:!1===this.vertices[n].moveTo&&(Ft[Ft.length-1].moveTo=!1),v.breakShape=!1):1===this.vertexCodes[e]?(v.bezierVertex(this.vertices[n+0][0],this.vertices[n+0][1],this.vertices[n+0][2],this.vertices[n+1][0],this.vertices[n+1][1],this.vertices[n+1][2],this.vertices[n+2][0],this.vertices[n+2][1],this.vertices[n+2][2]),n+=3):2===this.vertexCodes[e]?(v.curveVertex(this.vertices[n][0],this.vertices[n][1],this.vertices[n][2]),n++):3===this.vertexCodes[e]&&(v.breakShape=!0)}v.endShape(this.close?2:1)}},drawGeometry:function(){var e,t;if(v.beginShape(this.kind),this.style)for(e=0,t=this.vertices.length;e<t;e++)v.vertex(this.vertices[e]);else for(e=0,t=this.vertices.length;e<t;e++){var n=this.vertices[e];0===n[2]?v.vertex(n[0],n[1]):v.vertex(n[0],n[1],n[2])}v.endShape()},drawGroup:function(){for(var e=0,t=this.children.length;e<t;e++)this.children[e].draw()},drawPrimitive:function(){2===this.kind?v.point(this.params[0],this.params[1]):4===this.kind?4===this.params.length?v.line(this.params[0],this.params[1],this.params[2],this.params[3]):v.line(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]):8===this.kind?v.triangle(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]):16===this.kind?v.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]):30===this.kind?null!==this.image?(v.imageMode(0),v.image(this.image,this.params[0],this.params[1],this.params[2],this.params[3])):(v.rectMode(0),v.rect(this.params[0],this.params[1],this.params[2],this.params[3])):31===this.kind?(v.ellipseMode(0),v.ellipse(this.params[0],this.params[1],this.params[2],this.params[3])):32===this.kind?(v.ellipseMode(0),v.arc(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5])):41===this.kind?1===this.params.length?v.box(this.params[0]):v.box(this.params[0],this.params[1],this.params[2]):40===this.kind&&v.sphere(this.params[0])},pre:function(){this.matrix&&(v.pushMatrix(),y.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&&(v.pushStyle(),this.styles())},post:function(){this.matrix&&v.popMatrix(),this.style&&v.popStyle()},styles:function(){this.stroke?(v.stroke(this.strokeColor),v.strokeWeight(this.strokeWeight),v.strokeCap(this.strokeCap),v.strokeJoin(this.strokeJoin)):v.noStroke(),this.fill?v.fill(this.fillColor):v.noFill()},getChild:function(e){var t,n,r;if("number"==typeof e)return this.children[e];if(""===e||this.name===e)return this;if(this.nameTable.length>0){for(t=0,n=this.nameTable.length;t<n||r;t++)if(this.nameTable[t].getName===e){r=this.nameTable[t];break}if(r)return r}for(t=0,n=this.children.length;t<n;t++)if(r=this.children[t].getChild(e))return r;return null},getChildCount:function(){return this.children.length},addChild:function(e){this.children.push(e),e.parent=this,null!==e.getName()&&this.addName(e.getName(),e)},addName:function(e,t){null!==this.parent?this.parent.addName(e,t):this.nameTable.push([e,t])},translate:function(){2===arguments.length?(this.checkMatrix(2),this.matrix.translate(arguments[0],arguments[1])):(this.checkMatrix(3),this.matrix.translate(arguments[0],arguments[1],0))},checkMatrix:function(e){null===this.matrix?this.matrix=2===e?new v.PMatrix2D:new v.PMatrix3D:3===e&&this.matrix instanceof v.PMatrix2D&&(this.matrix=new v.PMatrix3D)},rotateX:function(e){this.rotate(e,1,0,0)},rotateY:function(e){this.rotate(e,0,1,0)},rotateZ:function(e){this.rotate(e,0,0,1)},rotate:function(){1===arguments.length?(this.checkMatrix(2),this.matrix.rotate(arguments[0])):(this.checkMatrix(3),this.matrix.rotate(arguments[0],arguments[1],arguments[2],arguments[3]))},scale:function(){2===arguments.length?(this.checkMatrix(2),this.matrix.scale(arguments[0],arguments[1])):3===arguments.length?(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(e){1===arguments.length?this.applyMatrix(e.elements[0],e.elements[1],0,e.elements[2],e.elements[3],e.elements[4],0,e.elements[5],0,0,1,0,0,0,0,1):6===arguments.length?(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)):16===arguments.length&&(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 bn=v.PShapeSVG=function(){if(v.PShape.call(this),1===arguments.length){if(this.element=arguments[0],this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=4278190080,this.strokeWeight=1,this.strokeCap="butt",this.strokeJoin="miter",this.strokeGradient=null,this.strokeGradientPaint=null,this.strokeName=null,this.strokeOpacity=1,this.fill=!0,this.fillColor=4278190080,this.fillGradient=null,this.fillGradientPaint=null,this.fillName=null,this.fillOpacity=1,"svg"!==this.element.getName())throw"root is not <svg>, it's <"+this.element.getName()+">"}else 2===arguments.length&&("string"==typeof arguments[1]?arguments[1].indexOf(".svg")>-1&&(this.element=new v.XMLElement(null,arguments[1]),this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=4278190080,this.strokeWeight=1,this.strokeCap="butt",this.strokeJoin="miter",this.strokeGradient="",this.strokeGradientPaint="",this.strokeName="",this.strokeOpacity=1,this.fill=!0,this.fillColor=4278190080,this.fillGradient=null,this.fillGradientPaint=null,this.fillOpacity=1):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");var e=this.element.getStringAttribute("display","inline");this.visible="none"!==e;var t=this.element.getAttribute("transform");t&&(this.matrix=this.parseMatrix(t));var n=this.element.getStringAttribute("viewBox");if(null!==n){var r=n.split(" ");this.width=r[2],this.height=r[3]}var i=this.element.getStringAttribute("width"),s=this.element.getStringAttribute("height");if(null!==i)this.width=this.parseUnitSize(i),this.height=this.parseUnitSize(s);else if(0===this.width||0===this.height)throw this.width=1,this.height=1,"The width and/or height is not readable in the <svg> tag of this file.";this.parseColors(this.element),this.parseChildren(this.element)};bn.prototype=new yn,bn.prototype.parseMatrix=function(){function e(e){var t=[];return e.replace(/\((.*?)\)/,(function(e,n){t=n.replace(/,+/g," ").split(/\s+/)})),t}return function(t){this.checkMatrix(2);var n=[];if(t.replace(/\s*(\w+)\((.*?)\)/g,(function(e){n.push(v.trim(e))})),0===n.length)return null;for(var r=0,i=n.length;r<i;r++){var s=e(n[r]);if(-1!==n[r].indexOf("matrix"))this.matrix.set(s[0],s[2],s[4],s[1],s[3],s[5]);else if(-1!==n[r].indexOf("translate")){var o=s[0],a=2===s.length?s[1]:0;this.matrix.translate(o,a)}else if(-1!==n[r].indexOf("scale")){var l=s[0],h=2===s.length?s[1]:s[0];this.matrix.scale(l,h)}else if(-1!==n[r].indexOf("rotate")){var u=s[0];1===s.length?this.matrix.rotate(v.radians(u)):3===s.length&&(this.matrix.translate(s[1],s[2]),this.matrix.rotate(v.radians(s[0])),this.matrix.translate(-s[1],-s[2]))}else-1!==n[r].indexOf("skewX")?this.matrix.skewX(parseFloat(s[0])):-1!==n[r].indexOf("skewY")&&this.matrix.skewY(s[0])}return this.matrix}}(),bn.prototype.parseChildren=function(e){for(var t=e.getChildren(),n=new v.PShape,r=0,i=t.length;r<i;r++){var s=this.parseChild(t[r]);s&&n.addChild(s)}this.children.push(n)},bn.prototype.getName=function(){return this.name},bn.prototype.parseChild=function(e){var t,n=e.getName();return"g"===n||"defs"===n?t=new bn(this,e):"line"===n?(t=new bn(this,e)).parseLine():"circle"===n?(t=new bn(this,e)).parseEllipse(!0):"ellipse"===n?(t=new bn(this,e)).parseEllipse(!1):"rect"===n?(t=new bn(this,e)).parseRect():"polygon"===n?(t=new bn(this,e)).parsePoly(!0):"polyline"===n?(t=new bn(this,e)).parsePoly(!1):"path"===n?(t=new bn(this,e)).parsePath():"radialGradient"===n?d("PShapeSVG.prototype.parseChild, name = radialGradient"):"linearGradient"===n?d("PShapeSVG.prototype.parseChild, name = linearGradient"):"text"===n?d("PShapeSVG.prototype.parseChild, name = text"):"filter"===n?d("PShapeSVG.prototype.parseChild, name = filter"):"mask"===n&&d("PShapeSVG.prototype.parseChild, name = mask"),t},bn.prototype.parsePath=function(){this.family=21,this.kind=0;var e=v.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g," "));if(null!==e){e=v.__toCharArray(e);for(var t,n,r,i,s=0,o=0,a=0,l=0,h=0,u=0,f=0,c=0,p=0,g=0,m=0,d=0,y=0,b=0,x=0,w=0,A="",C=[],T=!1;x<e.length;)if((w=e[x].valueOf())>=65&&w<=90||w>=97&&w<=122){if(r=x,++x<e.length)for(C=[],w=e[x].valueOf();!(w>=65&&w<=90||w>=97&&w<=100||w>=102&&w<=122)&&!1===T;)32===w?(""!==A&&(C.push(parseFloat(A)),A=""),x++):45===w?101===e[x-1].valueOf()?(A+=e[x].toString(),x++):(""!==A&&C.push(parseFloat(A)),A=e[x].toString(),x++):(A+=e[x].toString(),x++),x===e.length?T=!0:w=e[x].valueOf();if(""!==A&&(C.push(parseFloat(A)),A=""),77===(w=(n=e[r]).valueOf())){if(C.length>=2&&C.length%2==0&&(s=C[0],o=C[1],this.parsePathMoveto(s,o),C.length>2))for(r=2,i=C.length;r<i;r+=2)s=C[r],o=C[r+1],this.parsePathLineto(s,o)}else if(109===w){if(C.length>=2&&C.length%2==0&&(s+=C[0],o+=C[1],this.parsePathMoveto(s,o),C.length>2))for(r=2,i=C.length;r<i;r+=2)s+=C[r],o+=C[r+1],this.parsePathLineto(s,o)}else if(76===w){if(C.length>=2&&C.length%2==0)for(r=0,i=C.length;r<i;r+=2)s=C[r],o=C[r+1],this.parsePathLineto(s,o)}else if(108===w){if(C.length>=2&&C.length%2==0)for(r=0,i=C.length;r<i;r+=2)s+=C[r],o+=C[r+1],this.parsePathLineto(s,o)}else if(72===w)for(r=0,i=C.length;r<i;r++)s=C[r],this.parsePathLineto(s,o);else if(104===w)for(r=0,i=C.length;r<i;r++)s+=C[r],this.parsePathLineto(s,o);else if(86===w)for(r=0,i=C.length;r<i;r++)o=C[r],this.parsePathLineto(s,o);else if(118===w)for(r=0,i=C.length;r<i;r++)o+=C[r],this.parsePathLineto(s,o);else if(67===w){if(C.length>=6&&C.length%6==0)for(r=0,i=C.length;r<i;r+=6)h=C[r],f=C[r+1],u=C[r+2],c=C[r+3],p=C[r+4],g=C[r+5],this.parsePathCurveto(h,f,u,c,p,g),s=p,o=g}else if(99===w){if(C.length>=6&&C.length%6==0)for(r=0,i=C.length;r<i;r+=6)h=s+C[r],f=o+C[r+1],u=s+C[r+2],c=o+C[r+3],p=s+C[r+4],g=o+C[r+5],this.parsePathCurveto(h,f,u,c,p,g),s=p,o=g}else if(83===w){if(C.length>=4&&C.length%4==0)for(r=0,i=C.length;r<i;r+=4)"c"===t.toLowerCase()||"s"===t.toLowerCase()?(m=this.vertices[this.vertices.length-2][0],d=this.vertices[this.vertices.length-2][1],h=(y=this.vertices[this.vertices.length-1][0])+(y-m),f=(b=this.vertices[this.vertices.length-1][1])+(b-d)):(h=this.vertices[this.vertices.length-1][0],f=this.vertices[this.vertices.length-1][1]),u=C[r],c=C[r+1],p=C[r+2],g=C[r+3],this.parsePathCurveto(h,f,u,c,p,g),s=p,o=g}else if(115===w){if(C.length>=4&&C.length%4==0)for(r=0,i=C.length;r<i;r+=4)"c"===t.toLowerCase()||"s"===t.toLowerCase()?(m=this.vertices[this.vertices.length-2][0],d=this.vertices[this.vertices.length-2][1],h=(y=this.vertices[this.vertices.length-1][0])+(y-m),f=(b=this.vertices[this.vertices.length-1][1])+(b-d)):(h=this.vertices[this.vertices.length-1][0],f=this.vertices[this.vertices.length-1][1]),u=s+C[r],c=o+C[r+1],p=s+C[r+2],g=o+C[r+3],this.parsePathCurveto(h,f,u,c,p,g),s=p,o=g}else if(81===w){if(C.length>=4&&C.length%4==0)for(r=0,i=C.length;r<i;r+=4)a=C[r],l=C[r+1],p=C[r+2],g=C[r+3],this.parsePathQuadto(s,o,a,l,p,g),s=p,o=g}else if(113===w){if(C.length>=4&&C.length%4==0)for(r=0,i=C.length;r<i;r+=4)a=s+C[r],l=o+C[r+1],p=s+C[r+2],g=o+C[r+3],this.parsePathQuadto(s,o,a,l,p,g),s=p,o=g}else if(84===w){if(C.length>=2&&C.length%2==0)for(r=0,i=C.length;r<i;r+=2)"q"===t.toLowerCase()||"t"===t.toLowerCase()?(m=this.vertices[this.vertices.length-2][0],d=this.vertices[this.vertices.length-2][1],a=(y=this.vertices[this.vertices.length-1][0])+(y-m),l=(b=this.vertices[this.vertices.length-1][1])+(b-d)):(a=s,l=o),p=C[r],g=C[r+1],this.parsePathQuadto(s,o,a,l,p,g),s=p,o=g}else if(116===w){if(C.length>=2&&C.length%2==0)for(r=0,i=C.length;r<i;r+=2)"q"===t.toLowerCase()||"t"===t.toLowerCase()?(m=this.vertices[this.vertices.length-2][0],d=this.vertices[this.vertices.length-2][1],a=(y=this.vertices[this.vertices.length-1][0])+(y-m),l=(b=this.vertices[this.vertices.length-1][1])+(b-d)):(a=s,l=o),p=s+C[r],g=o+C[r+1],this.parsePathQuadto(s,o,a,l,p,g),s=p,o=g}else 90!==w&&122!==w||(this.close=!0);t=n.toString()}else x++}},bn.prototype.parsePathQuadto=function(e,t,n,r,i,s){if(!(this.vertices.length>0))throw"Path must start with M/m";this.parsePathCode(1),this.parsePathVertex(e+2*(n-e)/3,t+2*(r-t)/3),this.parsePathVertex(i+2*(n-i)/3,s+2*(r-s)/3),this.parsePathVertex(i,s)},bn.prototype.parsePathCurveto=function(e,t,n,r,i,s){if(!(this.vertices.length>0))throw"Path must start with M/m";this.parsePathCode(1),this.parsePathVertex(e,t),this.parsePathVertex(n,r),this.parsePathVertex(i,s)},bn.prototype.parsePathLineto=function(e,t){if(!(this.vertices.length>0))throw"Path must start with M/m";this.parsePathCode(0),this.parsePathVertex(e,t),this.vertices[this.vertices.length-1].moveTo=!1},bn.prototype.parsePathMoveto=function(e,t){this.vertices.length>0&&this.parsePathCode(3),this.parsePathCode(0),this.parsePathVertex(e,t),this.vertices[this.vertices.length-1].moveTo=!0},bn.prototype.parsePathVertex=function(e,t){var n=[];n[0]=e,n[1]=t,this.vertices.push(n)},bn.prototype.parsePathCode=function(e){this.vertexCodes.push(e)},bn.prototype.parsePoly=function(e){this.family=21,this.close=e;var t=v.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(null!==t){var n=t.split(" ");if(n.length%2!=0)throw"Error parsing polygon points: odd number of coordinates provided";for(var r=0,i=n.length;r<i;r++){var s=[];s[0]=n[r],s[1]=n[++r],this.vertices.push(s)}}},bn.prototype.parseRect=function(){if(this.kind=30,this.family=1,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"),this.params[2]<0||this.params[3]<0)throw"svg error: negative width or height found while parsing <rect>"},bn.prototype.parseEllipse=function(e){var t,n;if(this.kind=31,this.family=1,this.params=[],this.params[0]=0|this.element.getFloatAttribute("cx"),this.params[1]=0|this.element.getFloatAttribute("cy"),e){if((t=n=this.element.getFloatAttribute("r"))<0)throw"svg error: negative radius found while parsing <circle>"}else if(t=this.element.getFloatAttribute("rx"),n=this.element.getFloatAttribute("ry"),t<0||n<0)throw"svg error: negative x-axis radius or y-axis radius found while parsing <ellipse>";this.params[0]-=t,this.params[1]-=n,this.params[2]=2*t,this.params[3]=2*n},bn.prototype.parseLine=function(){this.kind=4,this.family=1,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")},bn.prototype.parseColors=function(e){if(e.hasAttribute("opacity")&&this.setOpacity(e.getAttribute("opacity")),e.hasAttribute("stroke")&&this.setStroke(e.getAttribute("stroke")),e.hasAttribute("stroke-width")&&this.setStrokeWeight(e.getAttribute("stroke-width")),e.hasAttribute("stroke-linejoin")&&this.setStrokeJoin(e.getAttribute("stroke-linejoin")),e.hasAttribute("stroke-linecap")&&this.setStrokeCap(e.getStringAttribute("stroke-linecap")),e.hasAttribute("fill")&&this.setFill(e.getStringAttribute("fill")),e.hasAttribute("style"))for(var t=e.getStringAttribute("style").toString().split(";"),n=0,r=t.length;n<r;n++){var i=v.trim(t[n].split(":"));"fill"===i[0]?this.setFill(i[1]):"fill-opacity"===i[0]?this.setFillOpacity(i[1]):"stroke"===i[0]?this.setStroke(i[1]):"stroke-width"===i[0]?this.setStrokeWeight(i[1]):"stroke-linecap"===i[0]?this.setStrokeCap(i[1]):"stroke-linejoin"===i[0]?this.setStrokeJoin(i[1]):"stroke-opacity"===i[0]?this.setStrokeOpacity(i[1]):"opacity"===i[0]&&this.setOpacity(i[1])}},bn.prototype.setFillOpacity=function(e){this.fillOpacity=parseFloat(e),this.fillColor=255*this.fillOpacity<<24|16777215&this.fillColor},bn.prototype.setFill=function(e){var t=4278190080&this.fillColor;"none"===e?this.fill=!1:0===e.indexOf("#")?(this.fill=!0,4===e.length&&(e=e.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")),this.fillColor=t|16777215&parseInt(e.substring(1),16)):0===e.indexOf("rgb")?(this.fill=!0,this.fillColor=t|this.parseRGB(e)):0===e.indexOf("url(#")?this.fillName=e.substring(5,e.length-1):C[e]&&(this.fill=!0,this.fillColor=t|16777215&parseInt(C[e].substring(1),16))},bn.prototype.setOpacity=function(e){this.strokeColor=255*parseFloat(e)<<24|16777215&this.strokeColor,this.fillColor=255*parseFloat(e)<<24|16777215&this.fillColor},bn.prototype.setStroke=function(e){var t=4278190080&this.strokeColor;"none"===e?this.stroke=!1:"#"===e.charAt(0)?(this.stroke=!0,4===e.length&&(e=e.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")),this.strokeColor=t|16777215&parseInt(e.substring(1),16)):0===e.indexOf("rgb")?(this.stroke=!0,this.strokeColor=t|this.parseRGB(e)):0===e.indexOf("url(#")?this.strokeName=e.substring(5,e.length-1):C[e]&&(this.stroke=!0,this.strokeColor=t|16777215&parseInt(C[e].substring(1),16))},bn.prototype.setStrokeWeight=function(e){this.strokeWeight=this.parseUnitSize(e)},bn.prototype.setStrokeJoin=function(e){"miter"===e?this.strokeJoin="miter":"round"===e?this.strokeJoin="round":"bevel"===e&&(this.strokeJoin="bevel")},bn.prototype.setStrokeCap=function(e){"butt"===e?this.strokeCap="butt":"round"===e?this.strokeCap="round":"square"===e&&(this.strokeCap="square")},bn.prototype.setStrokeOpacity=function(e){this.strokeOpacity=parseFloat(e),this.strokeColor=255*this.strokeOpacity<<24|16777215&this.strokeColor},bn.prototype.parseRGB=function(e){var t=e.substring(e.indexOf("(")+1,e.indexOf(")")).split(", ");return t[0]<<16|t[1]<<8|t[2]},bn.prototype.parseUnitSize=function(e){var t=e.length-2;return t<0?e:e.indexOf("pt")===t?1.25*parseFloat(e.substring(0,t)):e.indexOf("pc")===t?15*parseFloat(e.substring(0,t)):e.indexOf("mm")===t?3.543307*parseFloat(e.substring(0,t)):e.indexOf("cm")===t?35.43307*parseFloat(e.substring(0,t)):e.indexOf("in")===t?90*parseFloat(e.substring(0,t)):e.indexOf("px")===t?parseFloat(e.substring(0,t)):parseFloat(e)},v.shape=function(e,t,n,r,i){arguments.length>=1&&null!==arguments[0]&&e.isVisible()&&(v.pushMatrix(),3===Ut?5===arguments.length?(v.translate(t-r/2,n-i/2),v.scale(r/e.getWidth(),i/e.getHeight())):3===arguments.length?v.translate(t-e.getWidth()/2,-e.getHeight()/2):v.translate(-e.getWidth()/2,-e.getHeight()/2):0===Ut?5===arguments.length?(v.translate(t,n),v.scale(r/e.getWidth(),i/e.getHeight())):3===arguments.length&&v.translate(t,n):1===Ut&&(5===arguments.length?(r-=t,i-=n,v.translate(t,n),v.scale(r/e.getWidth(),i/e.getHeight())):3===arguments.length&&v.translate(t,n)),e.draw(),(1===arguments.length&&3===Ut||arguments.length>1)&&v.popMatrix())},v.shapeMode=function(e){Ut=e},v.loadShape=function(e){return 1===arguments.length&&e.indexOf(".svg")>-1?new bn(null,e):null};var xn=function(e,t,n,r,i){this.fullName=e||"",this.name=t||"",this.namespace=n||"",this.value=r,this.type=i};xn.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(e){this.value=e}};var wn=v.XMLElement=function(){if(this.attributes=[],this.children=[],this.fullName=null,this.name=null,this.namespace="",this.content=null,this.parent=null,this.lineNr="",this.systemID="",this.type="ELEMENT",4===arguments.length){if(this.fullName=arguments[0]||"",arguments[1])this.name=arguments[1];else{var e=this.fullName.indexOf(":");this.name=e>=0?this.fullName.substring(e+1):this.fullName}this.namespace=arguments[1],this.lineNr=arguments[3],this.systemID=arguments[2]}else 2===arguments.length&&arguments[1].indexOf(".")>-1?this.parse(arguments[arguments.length-1]):1===arguments.length&&"string"==typeof arguments[0]&&this.parse(arguments[0])};wn.prototype={parse:function(e){try{var t=e.substring(e.length-4);".xml"!==t&&".svg"!==t||(e=o(e));var n=(new DOMParser).parseFromString(e,"text/xml").documentElement;if(!n)throw"Error loading document";return this.parseChildrenRecursive(null,n),this}catch(e){throw e}},parseChildrenRecursive:function(e,t){var n,r,i,s,o,a;if(e?(n=new wn(t.localName,t.nodeName,"","")).parent=e:(this.fullName=t.localName,this.name=t.nodeName,n=this),3===t.nodeType&&""!==t.textContent)return this.createPCDataElement(t.textContent);for(s=0,o=t.attributes.length;s<o;s++)i=t.attributes[s],r=new xn(i.getname,i.nodeName,i.namespaceURI,i.nodeValue,i.nodeType),n.attributes.push(r);for(s=0,o=t.childNodes.length;s<o;s++){var l=t.childNodes[s];1!==l.nodeType&&3!==l.nodeType||null!==(a=n.parseChildrenRecursive(n,l))&&n.children.push(a)}return n},createElement:function(){return 2===arguments.length?new wn(arguments[0],arguments[1],null,null):new wn(arguments[0],arguments[1],arguments[2],arguments[3])},createPCDataElement:function(e){if(""===e.replace(/^\s+$/g,""))return null;var t=new wn;return t.content=e,t.type="TEXT",t},hasAttribute:function(){return 1===arguments.length?null!==this.getAttribute(arguments[0]):2===arguments.length?null!==this.getAttribute(arguments[0],arguments[1]):void 0},equals:function(e){if(!(e instanceof wn))return!1;var t,n,r,i,s;if(this.name!==e.getLocalName())return!1;if(this.attributes.length!==e.getAttributeCount())return!1;if(this.attributes.length!==e.attributes.length)return!1;for(t=0,n=this.attributes.length;t<n;t++){if(r=this.attributes[t].getName(),i=this.attributes[t].getNamespace(),null===(s=e.findAttribute(r,i)))return!1;if(this.attributes[t].getValue()!==s.getValue())return!1;if(this.attributes[t].getType()!==s.getType())return!1}if(this.children.length!==e.getChildCount())return!1;if(this.children.length>0){var o,a;for(t=0,n=this.children.length;t<n;t++)if(o=this.getChild(t),a=e.getChild(t),!o.equals(a))return!1;return!0}return this.content===e.content},getContent:function(){if("TEXT"===this.type)return this.content;var e=this.children;return 1===e.length&&"TEXT"===e[0].type?e[0].content:null},getAttribute:function(){var e;return 2===arguments.length?(e=this.findAttribute(arguments[0]))?e.getValue():arguments[1]:1===arguments.length?(e=this.findAttribute(arguments[0]))?e.getValue():null:3===arguments.length?(e=this.findAttribute(arguments[0],arguments[1]))?e.getValue():arguments[2]:void 0},getStringAttribute:function(){return 1===arguments.length?this.getAttribute(arguments[0]):2===arguments.length?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getString:function(e){return this.getStringAttribute(e)},getFloatAttribute:function(){return 1===arguments.length?parseFloat(this.getAttribute(arguments[0],0)):2===arguments.length?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getFloat:function(e){return this.getFloatAttribute(e)},getIntAttribute:function(){return 1===arguments.length?this.getAttribute(arguments[0],0):2===arguments.length?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getInt:function(e){return this.getIntAttribute(e)},hasChildren:function(){return this.children.length>0},addChild:function(e){null!==e&&(e.parent=this,this.children.push(e))},insertChild:function(e,t){if(e){if(null===e.getLocalName()&&!this.hasChildren()){var n=this.children[this.children.length-1];if(null===n.getLocalName())return void n.setContent(n.getContent()+e.getContent())}e.parent=this,this.children.splice(t,0,e)}},getChild:function(){if("number"==typeof arguments[0])return this.children[arguments[0]];if(-1!==arguments[0].indexOf("/"))return this.getChildRecursive(arguments[0].split("/"),0),null;for(var e,t,n=0,r=this.getChildCount();n<r;n++)if(null!==(t=(e=this.getChild(n)).getName())&&t===arguments[0])return e;return null},getChildren:function(){if(1===arguments.length){if("number"==typeof arguments[0])return this.getChild(arguments[0]);if(-1!==arguments[0].indexOf("/"))return this.getChildrenRecursive(arguments[0].split("/"),0);for(var e,t,n=[],r=0,i=this.getChildCount();r<i;r++)null!==(t=(e=this.getChild(r)).getName())&&t===arguments[0]&&n.push(e);return n}return this.children},getChildCount:function(){return this.children.length},getChildRecursive:function(e,t){for(var n,r,i=0,s=this.getChildCount();i<s;i++)if(null!==(r=(n=this.getChild(i)).getName())&&r===e[t])return t===e.length-1?n:(t+=1,n.getChildRecursive(e,t));return null},getChildrenRecursive:function(e,t){if(t===e.length-1)return this.getChildren(e[t]);for(var n=this.getChildren(e[t]),r=[],i=0;i<n.length;i++)r=r.concat(n[i].getChildrenRecursive(e,t+1));return r},isLeaf:function(){return!this.hasChildren()},listChildren:function(){for(var e=[],t=0,n=this.children.length;t<n;t++)e.push(this.getChild(t).getName());return e},removeAttribute:function(e,t){this.namespace=t||"";for(var n=0,r=this.attributes.length;n<r;n++)if(this.attributes[n].getName()===e&&this.attributes[n].getNamespace()===this.namespace){this.attributes.splice(n,1);break}},removeChild:function(e){if(e)for(var t=0,n=this.children.length;t<n;t++)if(this.children[t].equals(e)){this.children.splice(t,1);break}},removeChildAtIndex:function(e){this.children.length>e&&this.children.splice(e,1)},findAttribute:function(e,t){this.namespace=t||"";for(var n=0,r=this.attributes.length;n<r;n++)if(this.attributes[n].getName()===e&&this.attributes[n].getNamespace()===this.namespace)return this.attributes[n];return null},setAttribute:function(){var e;if(3===arguments.length){var t=arguments[0].indexOf(":"),n=arguments[0].substring(t+1);(e=this.findAttribute(n,arguments[1]))?e.setValue(arguments[2]):(e=new xn(arguments[0],n,arguments[1],arguments[2],"CDATA"),this.attributes.push(e))}else(e=this.findAttribute(arguments[0]))?e.setValue(arguments[1]):(e=new xn(arguments[0],arguments[0],null,arguments[1],"CDATA"),this.attributes.push(e))},setString:function(e,t){this.setAttribute(e,t)},setInt:function(e,t){this.setAttribute(e,t)},setFloat:function(e,t){this.setAttribute(e,t)},setContent:function(e){this.children.length>0&&E.debug("Tried to set content for XMLElement with children"),this.content=e},setName:function(){if(1===arguments.length)this.name=arguments[0],this.fullName=arguments[0],this.namespace=null;else{var e=arguments[0].indexOf(":");null===arguments[1]||e<0?this.name=arguments[0]:this.name=arguments[0].substring(e+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("TEXT"===this.type)return this.content;var e,t,n=(""!==this.namespace&&this.namespace!==this.name?this.namespace+":":"")+this.name,r="<"+n;for(e=0;e<this.attributes.length;e++){var i=this.attributes[e];r+=" "+i.getName()+'="'+i.getValue()+'"'}if(0===this.children.length)""===this.content?r+="/>":r+=">"+this.content+"</"+n+">";else{for(r+=">",t=0;t<this.children.length;t++)r+=this.children[t].toString();r+="</"+n+">"}return r}},wn.parse=function(e){var t=new wn;return t.parse(e),t};var An=function(e){for(var t=0,r=0;r<e.length;r++)t=0!==r?n.max(t,n.abs(e[r])):n.abs(e[r]);var i=(t+"").indexOf(".");return 0===i?i=1:-1===i&&(i=(t+"").length),i},Cn=v.PMatrix2D=function(){0===arguments.length?this.reset():1===arguments.length&&arguments[0]instanceof Cn?this.set(arguments[0].array()):6===arguments.length&&this.set(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])};Cn.prototype={set:function(){if(6===arguments.length){var e=arguments;this.set([e[0],e[1],e[2],e[3],e[4],e[5]])}else 1===arguments.length&&arguments[0]instanceof Cn?this.elements=arguments[0].array():1===arguments.length&&arguments[0]instanceof Array&&(this.elements=arguments[0].slice())},get:function(){var e=new Cn;return e.set(this.elements),e},reset:function(){this.set([1,0,0,0,1,0])},array:function(){return this.elements.slice()},translate:function(e,t){this.elements[2]=e*this.elements[0]+t*this.elements[1]+this.elements[2],this.elements[5]=e*this.elements[3]+t*this.elements[4]+this.elements[5]},invTranslate:function(e,t){this.translate(-e,-t)},transpose:function(){},mult:function(e,t){var n,r;return e instanceof b?(n=e.x,r=e.y,t||(t=new b)):e instanceof Array&&(n=e[0],r=e[1],t||(t=[])),t instanceof Array?(t[0]=this.elements[0]*n+this.elements[1]*r+this.elements[2],t[1]=this.elements[3]*n+this.elements[4]*r+this.elements[5]):t instanceof b&&(t.x=this.elements[0]*n+this.elements[1]*r+this.elements[2],t.y=this.elements[3]*n+this.elements[4]*r+this.elements[5],t.z=0),t},multX:function(e,t){return e*this.elements[0]+t*this.elements[1]+this.elements[2]},multY:function(e,t){return e*this.elements[3]+t*this.elements[4]+this.elements[5]},skewX:function(e){this.apply(1,0,1,e,0,0)},skewY:function(e){this.apply(1,0,1,0,e,0)},determinant:function(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]},invert:function(){var e=this.determinant();if(n.abs(e)>-2147483648){var t=this.elements[0],r=this.elements[1],i=this.elements[2],s=this.elements[3],o=this.elements[4],a=this.elements[5];return this.elements[0]=o/e,this.elements[3]=-s/e,this.elements[1]=-r/e,this.elements[4]=t/e,this.elements[2]=(r*a-o*i)/e,this.elements[5]=(s*i-t*a)/e,!0}return!1},scale:function(e,t){e&&!t&&(t=e),e&&t&&(this.elements[0]*=e,this.elements[1]*=t,this.elements[3]*=e,this.elements[4]*=t)},invScale:function(e,t){e&&!t&&(t=e),this.scale(1/e,1/t)},apply:function(){var e;1===arguments.length&&arguments[0]instanceof Cn?e=arguments[0].array():6===arguments.length?e=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(e=arguments[0]);for(var t=[0,0,this.elements[2],0,0,this.elements[5]],n=0,r=0;r<2;r++)for(var i=0;i<3;i++,n++)t[n]+=this.elements[3*r+0]*e[i+0]+this.elements[3*r+1]*e[i+3];this.elements=t.slice()},preApply:function(){var e;1===arguments.length&&arguments[0]instanceof Cn?e=arguments[0].array():6===arguments.length?e=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(e=arguments[0]);var t=[0,0,e[2],0,0,e[5]];t[2]=e[2]+this.elements[2]*e[0]+this.elements[5]*e[1],t[5]=e[5]+this.elements[2]*e[3]+this.elements[5]*e[4],t[0]=this.elements[0]*e[0]+this.elements[3]*e[1],t[3]=this.elements[0]*e[3]+this.elements[3]*e[4],t[1]=this.elements[1]*e[0]+this.elements[4]*e[1],t[4]=this.elements[1]*e[3]+this.elements[4]*e[4],this.elements=t.slice()},rotate:function(e){var t=n.cos(e),r=n.sin(e),i=this.elements[0],s=this.elements[1];this.elements[0]=t*i+r*s,this.elements[1]=-r*i+t*s,i=this.elements[3],s=this.elements[4],this.elements[3]=t*i+r*s,this.elements[4]=-r*i+t*s},rotateZ:function(e){this.rotate(e)},invRotateZ:function(e){this.rotateZ(e-n.PI)},print:function(){var e=An(this.elements),t=v.nfs(this.elements[0],e,4)+" "+v.nfs(this.elements[1],e,4)+" "+v.nfs(this.elements[2],e,4)+"\n"+v.nfs(this.elements[3],e,4)+" "+v.nfs(this.elements[4],e,4)+" "+v.nfs(this.elements[5],e,4)+"\n\n";v.println(t)}};var Tn=v.PMatrix3D=function(){this.reset()};Tn.prototype={set:function(){16===arguments.length?this.elements=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Tn?this.elements=arguments[0].array():1===arguments.length&&arguments[0]instanceof Array&&(this.elements=arguments[0].slice())},get:function(){var e=new Tn;return e.set(this.elements),e},reset:function(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},array:function(){return this.elements.slice()},translate:function(e,t,n){n===r&&(n=0),this.elements[3]+=e*this.elements[0]+t*this.elements[1]+n*this.elements[2],this.elements[7]+=e*this.elements[4]+t*this.elements[5]+n*this.elements[6],this.elements[11]+=e*this.elements[8]+t*this.elements[9]+n*this.elements[10],this.elements[15]+=e*this.elements[12]+t*this.elements[13]+n*this.elements[14]},transpose:function(){var e=this.elements[4];this.elements[4]=this.elements[1],this.elements[1]=e,e=this.elements[8],this.elements[8]=this.elements[2],this.elements[2]=e,e=this.elements[6],this.elements[6]=this.elements[9],this.elements[9]=e,e=this.elements[3],this.elements[3]=this.elements[12],this.elements[12]=e,e=this.elements[7],this.elements[7]=this.elements[13],this.elements[13]=e,e=this.elements[11],this.elements[11]=this.elements[14],this.elements[14]=e},mult:function(e,t){var n,r,i,s;return e instanceof b?(n=e.x,r=e.y,i=e.z,s=1,t||(t=new b)):e instanceof Array&&(n=e[0],r=e[1],i=e[2],s=e[3]||1,(!t||3!==t.length&&4!==t.length)&&(t=[0,0,0])),t instanceof Array&&(3===t.length?(t[0]=this.elements[0]*n+this.elements[1]*r+this.elements[2]*i+this.elements[3],t[1]=this.elements[4]*n+this.elements[5]*r+this.elements[6]*i+this.elements[7],t[2]=this.elements[8]*n+this.elements[9]*r+this.elements[10]*i+this.elements[11]):4===t.length&&(t[0]=this.elements[0]*n+this.elements[1]*r+this.elements[2]*i+this.elements[3]*s,t[1]=this.elements[4]*n+this.elements[5]*r+this.elements[6]*i+this.elements[7]*s,t[2]=this.elements[8]*n+this.elements[9]*r+this.elements[10]*i+this.elements[11]*s,t[3]=this.elements[12]*n+this.elements[13]*r+this.elements[14]*i+this.elements[15]*s)),t instanceof b&&(t.x=this.elements[0]*n+this.elements[1]*r+this.elements[2]*i+this.elements[3],t.y=this.elements[4]*n+this.elements[5]*r+this.elements[6]*i+this.elements[7],t.z=this.elements[8]*n+this.elements[9]*r+this.elements[10]*i+this.elements[11]),t},preApply:function(){var e;1===arguments.length&&arguments[0]instanceof Tn?e=arguments[0].array():16===arguments.length?e=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(e=arguments[0]);for(var t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=0;r<4;r++)for(var i=0;i<4;i++,n++)t[n]+=this.elements[i+0]*e[4*r+0]+this.elements[i+4]*e[4*r+1]+this.elements[i+8]*e[4*r+2]+this.elements[i+12]*e[4*r+3];this.elements=t.slice()},apply:function(){var e;1===arguments.length&&arguments[0]instanceof Tn?e=arguments[0].array():16===arguments.length?e=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(e=arguments[0]);for(var t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=0;r<4;r++)for(var i=0;i<4;i++,n++)t[n]+=this.elements[4*r+0]*e[i+0]+this.elements[4*r+1]*e[i+4]+this.elements[4*r+2]*e[i+8]+this.elements[4*r+3]*e[i+12];this.elements=t.slice()},rotate:function(e,t,n,r){if(n){var i=v.cos(e),s=v.sin(e),o=1-i;this.apply(o*t*t+i,o*t*n-s*r,o*t*r+s*n,0,o*t*n+s*r,o*n*n+i,o*n*r-s*t,0,o*t*r-s*n,o*n*r+s*t,o*r*r+i,0,0,0,0,1)}else this.rotateZ(e)},invApply:function(){yt===r&&(yt=new Tn);var e=arguments;return yt.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]),!!yt.invert()&&(this.preApply(yt),!0)},rotateX:function(e){var t=v.cos(e),n=v.sin(e);this.apply([1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1])},rotateY:function(e){var t=v.cos(e),n=v.sin(e);this.apply([t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1])},rotateZ:function(e){var t=n.cos(e),r=n.sin(e);this.apply([t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1])},scale:function(e,t,n){!e||t||n?e&&t&&!n&&(n=1):t=n=e,e&&t&&n&&(this.elements[0]*=e,this.elements[1]*=t,this.elements[2]*=n,this.elements[4]*=e,this.elements[5]*=t,this.elements[6]*=n,this.elements[8]*=e,this.elements[9]*=t,this.elements[10]*=n,this.elements[12]*=e,this.elements[13]*=t,this.elements[14]*=n)},skewX:function(e){var t=n.tan(e);this.apply(1,t,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},skewY:function(e){var t=n.tan(e);this.apply(1,0,0,0,t,1,0,0,0,0,1,0,0,0,0,1)},multX:function(e,t,n,r){return n?r?this.elements[0]*e+this.elements[1]*t+this.elements[2]*n+this.elements[3]*r:this.elements[0]*e+this.elements[1]*t+this.elements[2]*n+this.elements[3]:this.elements[0]*e+this.elements[1]*t+this.elements[3]},multY:function(e,t,n,r){return n?r?this.elements[4]*e+this.elements[5]*t+this.elements[6]*n+this.elements[7]*r:this.elements[4]*e+this.elements[5]*t+this.elements[6]*n+this.elements[7]:this.elements[4]*e+this.elements[5]*t+this.elements[7]},multZ:function(e,t,n,r){return r?this.elements[8]*e+this.elements[9]*t+this.elements[10]*n+this.elements[11]*r:this.elements[8]*e+this.elements[9]*t+this.elements[10]*n+this.elements[11]},multW:function(e,t,n,r){return r?this.elements[12]*e+this.elements[13]*t+this.elements[14]*n+this.elements[15]*r:this.elements[12]*e+this.elements[13]*t+this.elements[14]*n+this.elements[15]},invert:function(){var e=this.elements[0]*this.elements[5]-this.elements[1]*this.elements[4],t=this.elements[0]*this.elements[6]-this.elements[2]*this.elements[4],r=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4],i=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5],s=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5],o=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6],a=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12],l=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12],h=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12],u=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13],f=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13],c=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14],p=e*c-t*f+r*u+i*h-s*l+o*a;if(n.abs(p)<=1e-9)return!1;var g=[];g[0]=+this.elements[5]*c-this.elements[6]*f+this.elements[7]*u,g[4]=-this.elements[4]*c+this.elements[6]*h-this.elements[7]*l,g[8]=+this.elements[4]*f-this.elements[5]*h+this.elements[7]*a,g[12]=-this.elements[4]*u+this.elements[5]*l-this.elements[6]*a,g[1]=-this.elements[1]*c+this.elements[2]*f-this.elements[3]*u,g[5]=+this.elements[0]*c-this.elements[2]*h+this.elements[3]*l,g[9]=-this.elements[0]*f+this.elements[1]*h-this.elements[3]*a,g[13]=+this.elements[0]*u-this.elements[1]*l+this.elements[2]*a,g[2]=+this.elements[13]*o-this.elements[14]*s+this.elements[15]*i,g[6]=-this.elements[12]*o+this.elements[14]*r-this.elements[15]*t,g[10]=+this.elements[12]*s-this.elements[13]*r+this.elements[15]*e,g[14]=-this.elements[12]*i+this.elements[13]*t-this.elements[14]*e,g[3]=-this.elements[9]*o+this.elements[10]*s-this.elements[11]*i,g[7]=+this.elements[8]*o-this.elements[10]*r+this.elements[11]*t,g[11]=-this.elements[8]*s+this.elements[9]*r-this.elements[11]*e,g[15]=+this.elements[8]*i-this.elements[9]*t+this.elements[10]*e;var m=1/p;return g[0]*=m,g[1]*=m,g[2]*=m,g[3]*=m,g[4]*=m,g[5]*=m,g[6]*=m,g[7]*=m,g[8]*=m,g[9]*=m,g[10]*=m,g[11]*=m,g[12]*=m,g[13]*=m,g[14]*=m,g[15]*=m,this.elements=g.slice(),!0},toString:function(){for(var e="",t=0;t<15;t++)e+=this.elements[t]+", ";return e+=this.elements[15]},print:function(){var e=An(this.elements),t=v.nfs(this.elements[0],e,4)+" "+v.nfs(this.elements[1],e,4)+" "+v.nfs(this.elements[2],e,4)+" "+v.nfs(this.elements[3],e,4)+"\n"+v.nfs(this.elements[4],e,4)+" "+v.nfs(this.elements[5],e,4)+" "+v.nfs(this.elements[6],e,4)+" "+v.nfs(this.elements[7],e,4)+"\n"+v.nfs(this.elements[8],e,4)+" "+v.nfs(this.elements[9],e,4)+" "+v.nfs(this.elements[10],e,4)+" "+v.nfs(this.elements[11],e,4)+"\n"+v.nfs(this.elements[12],e,4)+" "+v.nfs(this.elements[13],e,4)+" "+v.nfs(this.elements[14],e,4)+" "+v.nfs(this.elements[15],e,4)+"\n\n";v.println(t)},invTranslate:function(e,t,n){this.preApply(1,0,0,-e,0,1,0,-t,0,0,1,-n,0,0,0,1)},invRotateX:function(e){var t=n.cos(-e),r=n.sin(-e);this.preApply([1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1])},invRotateY:function(e){var t=n.cos(-e),r=n.sin(-e);this.preApply([t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1])},invRotateZ:function(e){var t=n.cos(-e),r=n.sin(-e);this.preApply([t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1])},invScale:function(e,t,n){this.preApply([1/e,0,0,0,0,1/t,0,0,0,0,1/n,0,0,0,0,1])}};var Sn=v.PMatrixStack=function(){this.matrixStack=[]};function Pn(e,t,r,i){var s,o,a,l;if(3===Be){var h=v.color.toRGB(e,t,r);s=h[0],o=h[1],a=h[2]}else s=n.round(e/Ne*255),o=n.round(t/Fe*255),a=n.round(r/Me*255);return(l=(l=(l=n.round(i/Oe*255))<0?0:l)>255?255:l)<<24&4278190080|(s=(s=s<0?0:s)>255?255:s)<<16&16711680|(o=(o=o<0?0:o)>255?255:o)<<8&65280|255&(a=(a=a<0?0:a)>255?255:a)}function En(e){var t,n,r;t=(e>>16&255)/255,n=(e>>8&255)/255,r=(255&e)/255;var i,s=v.max(v.max(t,n),r),o=v.min(v.min(t,n),r);return o===s?[0,0,s*Me]:(i=t===s?(n-r)/(s-o):n===s?2+(r-t)/(s-o):4+(t-n)/(s-o),(i/=6)<0?i+=1:i>1&&(i-=1),[i*Ne,(s-o)/s*Fe,s*Me])}function _n(){y.save()}function Rn(){y.restore(),ge=!0,ue=!0}function kn(){var e=(Date.now()-Xe)/1e3,t=++Ye/e;e>.5&&(Xe=Date.now(),Ye=0,v.__frameRate=t),v.frameCount++}Sn.prototype.load=function(){var e=A.$newPMatrix();1===arguments.length?e.set(arguments[0]):e.set(arguments),this.matrixStack.push(e)},pn.prototype.$newPMatrix=function(){return new Cn},gn.prototype.$newPMatrix=function(){return new Tn},Sn.prototype.push=function(){this.matrixStack.push(this.peek())},Sn.prototype.pop=function(){return this.matrixStack.pop()},Sn.prototype.peek=function(){var e=A.$newPMatrix();return e.set(this.matrixStack[this.matrixStack.length-1]),e},Sn.prototype.mult=function(e){this.matrixStack[this.matrixStack.length-1].apply(e)},v.split=function(e,t){return e.split(t)},v.splitTokens=function(e,t){1===arguments.length&&(t="\n\t\r\f "),t="["+t+"]";for(var n=[],i=0,s=e.search(t);s>=0;)0===s?e=e.substring(1):(n[i]=e.substring(0,s),i++,e=e.substring(s)),s=e.search(t);return e.length>0&&(n[i]=e),0===n.length&&(n=r),n},v.append=function(e,t){return e[e.length]=t,e},v.concat=function(e,t){return e.concat(t)},v.sort=function(e,t){var n=[];if(e.length>0){for(var r=t>0?t:e.length,i=0;i<r;i++)n.push(e[i]);if("string"==typeof e[0]?n.sort():n.sort((function(e,t){return e-t})),t>0)for(var s=n.length;s<e.length;s++)n.push(e[s])}return n},v.splice=function(e,t,n){if(0===t.length)return e;if(t instanceof Array)for(var r=0,i=n;r<t.length;i++,r++)e.splice(i,0,t[r]);else e.splice(n,0,t);return e},v.subset=function(e,t,n){var i=n!==r?t+n:e.length;return e.slice(t,i)},v.join=function(e,t){return e.join(t)},v.shorten=function(e){for(var t=[],n=e.length,r=0;r<n;r++)t[r]=e[r];return t.pop(),t},v.expand=function(e,t){var n=e.slice(0),r=t||2*e.length;return n.length=r,n},v.arrayCopy=function(){var e,t,n,i=0,s=0;2===arguments.length?(e=arguments[0],t=arguments[1],n=e.length):3===arguments.length?(e=arguments[0],t=arguments[1],n=arguments[2]):5===arguments.length&&(e=arguments[0],i=arguments[1],t=arguments[2],s=arguments[3],n=arguments[4]);for(var o=i,a=s;o<n+i;o++,a++){if(t[a]===r)throw"array index out of bounds exception";t[a]=e[o]}},v.reverse=function(e){return e.reverse()},v.mix=function(e,t,n){return e+((t-e)*n>>8)},v.peg=function(e){return e<0?0:e>255?255:e},v.modes=function(){var e=n.min,t=n.max;function r(t,n,r,i,s,o,a,l,h,u,f){var c=r+((h-r)*n>>8),p=i+((u-i)*n>>8),g=s+((f-s)*n>>8);return e(((4278190080&t)>>>24)+n,255)<<24|(c=(c<0?0:c>255?255:c)<<16)|(p=(p<0?0:p>255?255:p)<<8)|(g=g<0?0:g>255?255:g)}return{replace:function(e,t){return t},blend:function(t,n){var r=(4278190080&n)>>>24,i=16711680&t,s=65280&t,o=255&t,a=16711680&n,l=65280&n,h=255&n;return e(((4278190080&t)>>>24)+r,255)<<24|i+((a-i)*r>>8)&16711680|s+((l-s)*r>>8)&65280|o+((h-o)*r>>8)&255},add:function(t,n){var r=(4278190080&n)>>>24;return e(((4278190080&t)>>>24)+r,255)<<24|16711680&e((16711680&t)+((16711680&n)>>8)*r,16711680)|65280&e((65280&t)+((65280&n)>>8)*r,65280)|e((255&t)+((255&n)*r>>8),255)},subtract:function(n,r){var i=(4278190080&r)>>>24;return e(((4278190080&n)>>>24)+i,255)<<24|16711680&t((16711680&n)-((16711680&r)>>8)*i,65280)|65280&t((65280&n)-((65280&r)>>8)*i,255)|t((255&n)-((255&r)*i>>8),0)},lightest:function(n,r){var i=(4278190080&r)>>>24;return e(((4278190080&n)>>>24)+i,255)<<24|16711680&t(16711680&n,((16711680&r)>>8)*i)|65280&t(65280&n,((65280&r)>>8)*i)|t(255&n,(255&r)*i>>8)},darkest:function(t,n){var r=(4278190080&n)>>>24,i=16711680&t,s=65280&t,o=255&t,a=e(16711680&t,((16711680&n)>>8)*r),l=e(65280&t,((65280&n)>>8)*r),h=e(255&t,(255&n)*r>>8);return e(((4278190080&t)>>>24)+r,255)<<24|i+((a-i)*r>>8)&16711680|s+((l-s)*r>>8)&65280|o+((h-o)*r>>8)&255},difference:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t;return r(e,(4278190080&t)>>>24,n,i,s,0,0,0,n>o?n-o:o-n,i>a?i-a:a-i,s>l?s-l:l-s)},exclusion:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t;return r(e,(4278190080&t)>>>24,n,i,s,0,0,0,n+o-(n*o>>7),i+a-(i*a>>7),s+l-(s*l>>7))},multiply:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t;return r(e,(4278190080&t)>>>24,n,i,s,0,0,0,n*o>>8,i*a>>8,s*l>>8)},screen:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t;return r(e,(4278190080&t)>>>24,n,i,s,0,0,0,255-((255-n)*(255-o)>>8),255-((255-i)*(255-a)>>8),255-((255-s)*(255-l)>>8))},hard_light:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t;return r(e,(4278190080&t)>>>24,n,i,s,0,0,0,o<128?n*o>>7:255-((255-n)*(255-o)>>7),a<128?i*a>>7:255-((255-i)*(255-a)>>7),l<128?s*l>>7:255-((255-s)*(255-l)>>7))},soft_light:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t;return r(e,(4278190080&t)>>>24,n,i,s,0,0,0,(n*o>>7)+(n*n>>8)-(n*n*o>>15),(i*a>>7)+(i*i>>8)-(i*i*a>>15),(s*l>>7)+(s*s>>8)-(s*s*l>>15))},overlay:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t;return r(e,(4278190080&t)>>>24,n,i,s,0,0,0,n<128?n*o>>7:255-((255-n)*(255-o)>>7),i<128?i*a>>7:255-((255-i)*(255-a)>>7),s<128?s*l>>7:255-((255-s)*(255-l)>>7))},dodge:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t,h=255;255!==o&&(h=(h=(n<<8)/(255-o))<0?0:h>255?255:h);var u=255;255!==a&&(u=(u=(i<<8)/(255-a))<0?0:u>255?255:u);var f=255;return 255!==l&&(f=(f=(s<<8)/(255-l))<0?0:f>255?255:f),r(e,(4278190080&t)>>>24,n,i,s,0,0,0,h,u,f)},burn:function(e,t){var n=(16711680&e)>>16,i=(65280&e)>>8,s=255&e,o=(16711680&t)>>16,a=(65280&t)>>8,l=255&t,h=0;0!==o&&(h=255-((h=(255-n<<8)/o)<0?0:h>255?255:h));var u=0;0!==a&&(u=255-((u=(255-i<<8)/a)<0?0:u>255?255:u));var f=0;return 0!==l&&(f=255-((f=(255-s<<8)/l)<0?0:f>255?255:f)),r(e,(4278190080&t)>>>24,n,i,s,0,0,0,h,u,f)}}}(),v.color=function(e,t,i,s){return e!==r&&t!==r&&i!==r&&s!==r?Pn(e,t,i,s):e!==r&&t!==r&&i!==r?Pn(e,t,i,Oe):e!==r&&t!==r?function(e,t){var r;return 4278190080&e?e-(4278190080&e)+((r=(r=(r=n.round(t/Oe*255))>255?255:r)<0?0:r)<<24&4278190080):1===Be?Pn(e,e,e,t):3===Be?Pn(0,0,e/Ne*Me,t):void 0}(e,t):"number"==typeof e?function(e){if(e<=Ne&&e>=0){if(1===Be)return Pn(e,e,e,Oe);if(3===Be)return Pn(0,0,e/Ne*Me,Oe)}if(e)return e>2147483647&&(e-=4294967296),e}(e):Pn(Ne,Fe,Me,Oe)},v.color.toString=function(e){return"rgba("+(e>>16&255)+","+(e>>8&255)+","+(255&e)+","+(e>>24&255)/255+")"},v.color.toInt=function(e,t,n,r){return r<<24&4278190080|e<<16&16711680|t<<8&65280|255&n},v.color.toArray=function(e){return[e>>16&255,e>>8&255,255&e,e>>24&255]},v.color.toGLArray=function(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255,((4278190080&e)>>>24)/255]},v.color.toRGB=function(e,t,r){e=(e=e>Ne?Ne:e)/Ne*360,t=(t=t>Fe?Fe:t)/Fe*100,r=(r=r>Me?Me:r)/Me*100;var i=n.round(r/100*255);if(0===t)return[i,i,i];var s=e%360,o=s%60,a=n.round(r*(100-t)/1e4*255),l=n.round(r*(6e3-t*o)/6e5*255),h=n.round(r*(6e3-t*(60-o))/6e5*255);switch(n.floor(s/60)){case 0:return[i,h,a];case 1:return[l,i,a];case 2:return[a,i,h];case 3:return[a,l,i];case 4:return[h,a,i];case 5:return[i,a,l]}},v.brightness=function(e){return En(e)[2]},v.saturation=function(e){return En(e)[1]},v.hue=function(e){return En(e)[0]},v.red=function(e){return(e>>16&255)/255*Ne},v.green=function(e){return(e>>8&255)/255*Fe},v.blue=function(e){return(255&e)/255*Me},v.alpha=function(e){return(e>>24&255)/255*Oe},v.lerpColor=function(e,t,n){var r,i,s,o,a,l,h,u,f,c,p,g,m,d,y,b,x=v.color(e),w=v.color(t);return 3===Be?(g=En(x),h=(x>>24&255)/Oe,m=En(w),p=(w>>24&255)/Oe,y=v.lerp(g[0],m[0],n),b=v.lerp(g[1],m[1],n),s=v.lerp(g[2],m[2],n),d=v.color.toRGB(y,b,s),v.lerp(h,p,n)*Oe<<24&4278190080|(255&d[0])<<16|(255&d[1])<<8|255&d[2]):(o=x>>16&255,a=x>>8&255,l=255&x,h=(x>>24&255)/Oe,u=w>>16&255,f=w>>8&255,c=255&w,p=((4278190080&w)>>>24)/Oe,r=0|v.lerp(o,u,n),i=0|v.lerp(a,f,n),s=0|v.lerp(l,c,n),v.lerp(h,p,n)*Oe<<24&4278190080|r<<16&16711680|i<<8&65280|255&s)},v.colorMode=function(){Be=arguments[0],arguments.length>1&&(Ne=arguments[1],Fe=arguments[2]||arguments[1],Me=arguments[3]||arguments[1],Oe=arguments[4]||arguments[1])},v.blendColor=function(e,t,n){return 0===n?v.modes.replace(e,t):1===n?v.modes.blend(e,t):2===n?v.modes.add(e,t):4===n?v.modes.subtract(e,t):8===n?v.modes.lightest(e,t):16===n?v.modes.darkest(e,t):32===n?v.modes.difference(e,t):64===n?v.modes.exclusion(e,t):128===n?v.modes.multiply(e,t):256===n?v.modes.screen(e,t):1024===n?v.modes.hard_light(e,t):2048===n?v.modes.soft_light(e,t):512===n?v.modes.overlay(e,t):4096===n?v.modes.dodge(e,t):8192===n?v.modes.burn(e,t):void 0},v.printMatrix=function(){gt.print()},pn.prototype.translate=function(e,t){gt.translate(e,t),mt.invTranslate(e,t),y.translate(e,t)},gn.prototype.translate=function(e,t,n){gt.translate(e,t,n),mt.invTranslate(e,t,n)},pn.prototype.scale=function(e,t){gt.scale(e,t),mt.invScale(e,t),y.scale(e,t||e)},gn.prototype.scale=function(e,t,n){gt.scale(e,t,n),mt.invScale(e,t,n)},pn.prototype.pushMatrix=function(){dt.load(gt),vt.load(mt),_n()},gn.prototype.pushMatrix=function(){dt.load(gt),vt.load(mt)},pn.prototype.popMatrix=function(){gt.set(dt.pop()),mt.set(vt.pop()),Rn()},gn.prototype.popMatrix=function(){gt.set(dt.pop()),mt.set(vt.pop())},pn.prototype.resetMatrix=function(){gt.reset(),mt.reset(),y.setTransform(1,0,0,1,0,0)},gn.prototype.resetMatrix=function(){gt.reset(),mt.reset()},cn.prototype.applyMatrix=function(){var e=arguments;gt.apply(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]),mt.invApply(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},pn.prototype.applyMatrix=function(){for(var e=arguments,t=e.length;t<16;t++)e[t]=0;e[10]=e[15]=1,cn.prototype.applyMatrix.apply(this,e)},v.rotateX=function(e){gt.rotateX(e),mt.invRotateX(e)},pn.prototype.rotateZ=function(){throw"rotateZ() is not supported in 2D mode. Use rotate(float) instead."},gn.prototype.rotateZ=function(e){gt.rotateZ(e),mt.invRotateZ(e)},v.rotateY=function(e){gt.rotateY(e),mt.invRotateY(e)},pn.prototype.rotate=function(e){gt.rotateZ(e),mt.invRotateZ(e),y.rotate(e)},gn.prototype.rotate=function(e){v.rotateZ(e)},v.pushStyle=function(){_n(),v.pushMatrix();var e={doFill:ae,currentFillColor:he,doStroke:fe,currentStrokeColor:pe,curTint:Ve,curRectMode:be,curColorMode:Be,colorModeX:Ne,colorModeZ:Me,colorModeY:Fe,colorModeA:Oe,curTextFont:it,horizontalTextAlignment:qe,verticalTextAlignment:Ke,textMode:Je,curFontName:Qe,curTextSize:et,curTextAscent:tt,curTextDescent:nt,curTextLeading:rt};Gt.push(e)},v.popStyle=function(){var e=Gt.pop();if(!e)throw"Too many popStyle() without enough pushStyle()";Rn(),v.popMatrix(),ae=e.doFill,he=e.currentFillColor,fe=e.doStroke,pe=e.currentStrokeColor,Ve=e.curTint,be=e.curRectmode,Be=e.curColorMode,Ne=e.colorModeX,Me=e.colorModeZ,Fe=e.colorModeY,Oe=e.colorModeA,it=e.curTextFont,Qe=e.curFontName,et=e.curTextSize,qe=e.horizontalTextAlignment,Ke=e.verticalTextAlignment,Je=e.textMode,tt=e.curTextAscent,nt=e.curTextDescent,rt=e.curTextLeading},v.year=function(){return(new Date).getFullYear()},v.month=function(){return(new Date).getMonth()+1},v.day=function(){return(new Date).getDate()},v.hour=function(){return(new Date).getHours()},v.minute=function(){return(new Date).getMinutes()},v.second=function(){return(new Date).getSeconds()},v.millis=function(){return Date.now()-Ge},pn.prototype.redraw=function(){kn(),y.lineWidth=me;var e=v.pmouseX,t=v.pmouseY;v.pmouseX=$e,v.pmouseY=ze,_n(),v.draw(),Rn(),$e=v.mouseX,ze=v.mouseY,v.pmouseX=e,v.pmouseY=t},gn.prototype.redraw=function(){kn();var e=v.pmouseX,t=v.pmouseY;v.pmouseX=$e,v.pmouseY=ze,y.clear(y.DEPTH_BUFFER_BIT),He={attributes:{},locations:{}},v.noLights(),v.lightFalloff(1,0,0),v.shininess(1),v.ambient(255,255,255),v.specular(0,0,0),v.emissive(0,0,0),v.camera(),v.draw(),$e=v.mouseX,ze=v.mouseY,v.pmouseX=e,v.pmouseY=t},v.noLoop=function(){ve=!1,de=!1,clearInterval(ye),x.onPause()},v.loop=function(){de||(Xe=Date.now(),Ye=0,ye=e.setInterval((function(){try{x.onFrameStart(),v.redraw(),x.onFrameEnd()}catch(t){throw e.clearInterval(ye),t}}),Pe),ve=!0,de=!0,x.onLoop())},v.frameRate=function(e){Pe=1e3/(Se=e),ve&&(v.noLoop(),v.loop())};var Ln=[];function Dn(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n),Ln.push({elem:e,type:t,fn:n})}function In(e){var t=e.elem,n=e.type,r=e.fn;t.removeEventListener?t.removeEventListener(n,r,!1):t.detachEvent&&t.detachEvent("on"+n,r)}function On(e,t,i,s,o,a){var l=e<0?i:t,h=0===o,u=o===r||o<0?0:o,f=n.abs(e);if(h)for(u=1,f*=10;n.abs(n.round(f)-f)>1e-6&&u<7;)++u,f*=10;else 0!==u&&(f*=n.pow(10,u));var c,p=2*f;if(n.floor(f)===f)c=f;else if(n.floor(p)===p){var g=n.floor(f);c=g+g%2}else c=n.round(f);for(var m="",d=s+u;d>0||c>0;)d--,m=""+c%10+m,c=n.floor(c/10);if(a!==r)for(var v=m.length-3-u;v>0;)m=m.substring(0,v)+a+m.substring(v),v-=3;return u>0?l+m.substring(0,m.length-u)+"."+m.substring(m.length-u,m.length):l+m}function Nn(e,t,n,r,i,s){if(e instanceof Array){for(var o=[],a=0,l=e.length;a<l;a++)o.push(On(e[a],t,n,r,i,s));return o}return On(e,t,n,r,i,s)}v.exit=function(){var t;for(var n in e.clearInterval(ye),t=v.externals.canvas.id,T.splice(S[t],1),delete S[t],E.lib)E.lib.hasOwnProperty(n)&&E.lib[n].hasOwnProperty("detach")&&E.lib[n].detach(v);for(var r=Ln.length;r--;)In(Ln[r]);x.onExit()},v.cursor=function(){if(arguments.length>1||1===arguments.length&&arguments[0]instanceof v.PImage){var e,t,n=arguments[0];if(arguments.length>=3){if(e=arguments[1],t=arguments[2],e<0||t<0||t>=n.height||e>=n.width)throw"x and y must be non-negative and less than the dimensions of the image"}else e=n.width>>>1,t=n.height>>>1;var r=n.toDataURL(),i='url("'+r+'") '+e+" "+t+", default";l.style.cursor=i}else if(1===arguments.length){var s=arguments[0];l.style.cursor=s}else l.style.cursor=Ee},v.noCursor=function(){l.style.cursor=p.NOCURSOR},v.link=function(t,n){n!==r?e.open(t,n):e.location=t},v.beginDraw=i,v.endDraw=i,pn.prototype.toImageData=function(e,t,n,i){return e=e!==r?e:0,t=t!==r?t:0,n=n!==r?n:v.width,i=i!==r?i:v.height,y.getImageData(e,t,n,i)},gn.prototype.toImageData=function(e,i,s,o){e=e!==r?e:0,i=i!==r?i:0,s=s!==r?s:v.width,o=o!==r?o:v.height;var a=t.createElement("canvas").getContext("2d").createImageData(s,o),l=new c(s*o*4);y.readPixels(e,i,s,o,y.RGBA,y.UNSIGNED_BYTE,l);for(var h=0,u=l.length,f=a.data;h<u;h++)f[h]=l[(o-1-n.floor(h/4/s))*s*4+h%(4*s)];return a},v.status=function(t){e.status=t},v.binary=function(e,t){var n;if(t>0)n=t;else if(e instanceof vn)n=16,e|=0;else for(n=32;n>1&&!(e>>>n-1&1);)n--;for(var r="";n>0;)r+=e>>>--n&1?"1":"0";return r},v.unbinary=function(e){for(var t=e.length-1,n=1,r=0;t>=0;){var i=e[t--];if("0"!==i&&"1"!==i)throw"the value passed into unbinary was not an 8 bit binary number";"1"===i&&(r+=n),n<<=1}return r},v.nf=function(e,t,n){return Nn(e,"","-",t,n)},v.nfs=function(e,t,n){return Nn(e," ","-",t,n)},v.nfp=function(e,t,n){return Nn(e,"+","-",t,n)},v.nfc=function(e,t,n){return Nn(e,"","-",t,n,",")};var Fn=function(e,t){t=t===r||null===t?t=8:t,e<0&&(e=4294967295+e+1);for(var n=Number(e).toString(16).toUpperCase();n.length<t;)n="0"+n;return n.length>=t&&(n=n.substring(n.length-t,n.length)),n};function Mn(e){var t=parseInt("0x"+e,16);return t>2147483647&&(t-=4294967296),t}function $n(e){return Array.prototype.slice.call(e,1)}v.hex=function(e,t){return 1===arguments.length&&(t=e instanceof vn?4:8),Fn(e,t)},v.unhex=function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(Mn(e[n]));return t}return Mn(e)},v.loadStrings=function(e){if(localStorage[e])return localStorage[e].split("\n");var t=o(e);return"string"!=typeof t||""===t?[]:(t=t.replace(/(\r\n?)/g,"\n").replace(/\n$/,"")).split("\n")},v.saveStrings=function(e,t){localStorage[e]=t.join("\n")},v.loadBytes=function(e){for(var t=o(e),n=[],r=0;r<t.length;r++)n.push(t.charCodeAt(r));return n},v.matchAll=function(e,t){for(var n,r=[],i=new RegExp(t,"g");null!==(n=i.exec(e));)r.push(n),0===n[0].length&&++i.lastIndex;return r.length>0?r:null},v.__contains=function(e,t){return"string"!=typeof e?e.contains.apply(e,$n(arguments)):null!==e&&null!==t&&"string"==typeof t&&e.indexOf(t)>-1},v.__replaceAll=function(e,t,n){return"string"!=typeof e?e.replaceAll.apply(e,$n(arguments)):e.replace(new RegExp(t,"g"),n)},v.__replaceFirst=function(e,t,n){return"string"!=typeof e?e.replaceFirst.apply(e,$n(arguments)):e.replace(new RegExp(t,""),n)},v.__replace=function(e,t,n){if("string"!=typeof e)return e.replace.apply(e,$n(arguments));if(t instanceof RegExp)return e.replace(t,n);if("string"!=typeof t&&(t=t.toString()),""===t)return e;var r=e.indexOf(t);if(r<0)return e;var i=0,s="";do{s+=e.substring(i,r)+n,i=r+t.length}while((r=e.indexOf(t,i))>=0);return s+e.substring(i)},v.__equals=function(e,t){return e.equals instanceof Function?e.equals.apply(e,$n(arguments)):e.valueOf()===t.valueOf()},v.__equalsIgnoreCase=function(e,t){return"string"!=typeof e?e.equalsIgnoreCase.apply(e,$n(arguments)):e.toLowerCase()===t.toLowerCase()},v.__toCharArray=function(e){if("string"!=typeof e)return e.toCharArray.apply(e,$n(arguments));for(var t=[],n=0,r=e.length;n<r;++n)t[n]=new vn(e.charAt(n));return t},v.__split=function(e,t,n){if("string"!=typeof e)return e.split.apply(e,$n(arguments));var i=new RegExp(t);if(n===r||n<1)return e.split(i);for(var s,o=[],a=e;-1!==(s=a.search(i))&&o.length<n-1;){var l=i.exec(a).toString();o.push(a.substring(0,s)),a=a.substring(s+l.length)}return-1===s&&""===a||o.push(a),o},v.__codePointAt=function(e,t){var n=e.charCodeAt(t);return 55296<=n&&n<=56319?1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536:n},v.match=function(e,t){return e.match(t)},v.__startsWith=function(e,t,n){return"string"!=typeof e?e.startsWith.apply(e,$n(arguments)):!((n=n||0)<0||n>e.length)&&(""===t||t===e||e.indexOf(t)===n)},v.__endsWith=function(e,t){if("string"!=typeof e)return e.endsWith.apply(e,$n(arguments));var n=t?t.length:0;return""===t||t===e||e.indexOf(t)===e.length-n},v.__hashCode=function(e){return e.hashCode instanceof Function?e.hashCode.apply(e,$n(arguments)):g(e)},v.__printStackTrace=function(e){v.println("Exception: "+e.toString())};var zn=[];function Bn(e){return"number"==typeof e?0!==e:"boolean"==typeof e?e:"string"==typeof e?"true"===e.toLowerCase():e instanceof vn?49===e.code||84===e.code||116===e.code:void 0}function Vn(e){return"number"==typeof e?e:"boolean"==typeof e?e?1:0:"string"==typeof e?parseFloat(e):e instanceof vn?e.code:void 0}function Un(e,t){return"number"==typeof e?4294967295&e:"boolean"==typeof e?e?1:0:"string"==typeof e?4294967295&parseInt(e,t||10):e instanceof vn?e.code:void 0}v.println=function(e){var t=zn.length;t&&(E.logger.log(zn.join("")),zn.length=0),0===arguments.length&&0===t?E.logger.log(""):0!==arguments.length&&E.logger.log(e)},v.print=function(e){zn.push(e)},v.str=function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString()+"");return t}return e.toString()+""},v.trim=function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(e[n].replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,""));return t}return e.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,"")},v.parseBoolean=function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(Bn(e[n]));return t}return Bn(e)},v.parseByte=function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(0-(128&e[n])|127&e[n]);return t}return 0-(128&e)|127&e},v.parseChar=function(e){if("number"==typeof e)return new vn(String.fromCharCode(65535&e));if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(new vn(String.fromCharCode(65535&e[n])));return t}throw"char() may receive only one argument of type int, byte, int[], or byte[]."},v.parseFloat=function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;n++)t.push(Vn(e[n]));return t}return Vn(e)},v.parseInt=function(e,t){if(e instanceof Array){for(var n=[],r=0;r<e.length;r++)"string"!=typeof e[r]||/^\s*[+\-]?\d+\s*$/.test(e[r])?n.push(Un(e[r],t)):n.push(0);return n}return Un(e,t)},v.__int_cast=function(e){return 0|e},v.__instanceof=function(e,t){if("function"!=typeof t)throw"Function is expected as type argument for instanceof operator";if("string"==typeof e)return t===Object||t===String;if(e instanceof t)return!0;if("object"!=typeof e||null===e)return!1;var n=e.constructor;if(t.$isInterface){for(var r=[];n;)n.$interfaces&&(r=r.concat(n.$interfaces)),n=n.$base;for(;r.length>0;){var i=r.shift();if(i===t)return!0;i.$interfaces&&(r=r.concat(i.$interfaces))}return!1}for(;n.hasOwnProperty("$base");)if((n=n.$base)===t)return!0;return!1},v.abs=n.abs,v.ceil=n.ceil,v.constrain=function(e,t,n){return e>n?n:e<t?t:e},v.dist=function(){var e,t,r;return 4===arguments.length?(e=arguments[0]-arguments[2],t=arguments[1]-arguments[3],n.sqrt(e*e+t*t)):6===arguments.length?(e=arguments[0]-arguments[3],t=arguments[1]-arguments[4],r=arguments[2]-arguments[5],n.sqrt(e*e+t*t+r*r)):void 0},v.exp=n.exp,v.floor=n.floor,v.lerp=function(e,t,n){return(t-e)*n+e},v.log=n.log,v.mag=function(e,t,r){return r?n.sqrt(e*e+t*t+r*r):n.sqrt(e*e+t*t)},v.map=function(e,t,n,r,i){return r+(e-t)/(n-t)*(i-r)},v.max=function(){if(2===arguments.length)return arguments[0]<arguments[1]?arguments[1]:arguments[0];var e=1===arguments.length?arguments[0]:arguments;if(!("length"in e&&e.length>0))throw"Non-empty array is expected";for(var t=e[0],n=e.length,r=1;r<n;++r)t<e[r]&&(t=e[r]);return t},v.min=function(){if(2===arguments.length)return arguments[0]<arguments[1]?arguments[0]:arguments[1];var e=1===arguments.length?arguments[0]:arguments;if(!("length"in e&&e.length>0))throw"Non-empty array is expected";for(var t=e[0],n=e.length,r=1;r<n;++r)t>e[r]&&(t=e[r]);return t},v.norm=function(e,t,n){return(e-t)/(n-t)},v.pow=n.pow,v.round=n.round,v.sq=function(e){return e*e},v.sqrt=n.sqrt,v.acos=n.acos,v.asin=n.asin,v.atan=n.atan,v.atan2=n.atan2,v.cos=n.cos,v.degrees=function(e){return 180*e/n.PI},v.radians=function(e){return e/180*n.PI},v.sin=n.sin,v.tan=n.tan;var Gn=n.random;function Xn(e,t){var n=e||362436069,r=t||521288629,i=function(){return 4294967295&((65535&(n=36969*(65535&n)+(n>>>16)&4294967295))<<16|65535&(r=18e3*(65535&r)+(r>>>16)&4294967295))};this.nextDouble=function(){var e=i()/4294967296;return e<0?1+e:e},this.nextInt=i}function Yn(e){var t,i,s=e!==r?new Xn(e):Xn.createRandomized(),o=new c(512);for(t=0;t<256;++t)o[t]=t;for(t=0;t<256;++t){var a=o[i=255&s.nextInt()];o[i]=o[t],o[t]=a}for(t=0;t<256;++t)o[t+256]=o[t];function l(e,t,n,r){var i=15&e,s=i<8?t:n,o=i<4?n:12===i||14===i?t:r;return(0==(1&i)?s:-s)+(0==(2&i)?o:-o)}function h(e,t,n){var r=0==(1&e)?t:n;return 0==(2&e)?-r:r}function u(e,t){return 0==(1&e)?-t:t}function f(e,t,n){return t+e*(n-t)}this.noise3d=function(e,t,r){var i=255&n.floor(e),s=255&n.floor(t),a=255&n.floor(r),h=(3-2*(e-=n.floor(e)))*e*e,u=(3-2*(t-=n.floor(t)))*t*t,c=(3-2*(r-=n.floor(r)))*r*r,p=o[i]+s,g=o[p]+a,m=o[p+1]+a,d=o[i+1]+s,v=o[d]+a,y=o[d+1]+a;return f(c,f(u,f(h,l(o[g],e,t,r),l(o[v],e-1,t,r)),f(h,l(o[m],e,t-1,r),l(o[y],e-1,t-1,r))),f(u,f(h,l(o[g+1],e,t,r-1),l(o[v+1],e-1,t,r-1)),f(h,l(o[m+1],e,t-1,r-1),l(o[y+1],e-1,t-1,r-1))))},this.noise2d=function(e,t){var r=255&n.floor(e),i=255&n.floor(t),s=(3-2*(e-=n.floor(e)))*e*e,a=(3-2*(t-=n.floor(t)))*t*t,l=o[r]+i,u=o[r+1]+i;return f(a,f(s,h(o[l],e,t),h(o[u],e-1,t)),f(s,h(o[l+1],e,t-1),h(o[u+1],e-1,t-1)))},this.noise1d=function(e){var t=255&n.floor(e);return f((3-2*(e-=n.floor(e)))*e*e,u(o[t],e),u(o[t+1],e-1))}}v.random=function(){if(0===arguments.length)return Gn();if(1===arguments.length)return Gn()*arguments[0];var e=arguments[0],t=arguments[1];return Gn()*(t-e)+e},Xn.createRandomized=function(){var e=new Date;return new Xn(e/6e4&4294967295,4294967295&e)},v.randomSeed=function(e){Gn=new Xn(e).nextDouble},v.Random=function(e){var t,i,s=!1;this.nextGaussian=function(){if(s)return s=!1,t;var e,r,o;do{o=(e=2*i()-1)*e+(r=2*i()-1)*r}while(o>=1||0===o);var a=n.sqrt(-2*n.log(o)/o);return t=r*a,s=!0,e*a},i=e===r?n.random:new Xn(e).nextDouble};var Hn,Zn={generator:r,octaves:4,fallout:.5,seed:r};v.noise=function(e,t,n){Zn.generator===r&&(Zn.generator=new Yn(Zn.seed));for(var i=Zn.generator,s=1,o=1,a=0,l=0;l<Zn.octaves;++l){switch(s*=Zn.fallout,arguments.length){case 1:a+=s*(1+i.noise1d(o*e))/2;break;case 2:a+=s*(1+i.noise2d(o*e,o*t))/2;break;case 3:a+=s*(1+i.noise3d(o*e,o*t,o*n))/2}o*=2}return a},v.noiseDetail=function(e,t){Zn.octaves=e,t!==r&&(Zn.fallout=t)},v.noiseSeed=function(e){Zn.seed=e,Zn.generator=r},cn.prototype.size=function(e,t,r){fe&&v.stroke(0),ae&&v.fill(255);var i={fillStyle:y.fillStyle,strokeStyle:y.strokeStyle,lineCap:y.lineCap,lineJoin:y.lineJoin};for(var s in l.style.length>0&&(l.style.removeProperty("width"),l.style.removeProperty("height")),l.width=v.width=e||100,l.height=v.height=t||100,i)i.hasOwnProperty(s)&&(y[s]=i[s]);v.textFont(it),v.background(),at=n.max(1e3,e*t*.05),v.externals.context=y;for(var o=0;o<720;o++)Pt[o]=v.sin(o*(n.PI/180)*.5),Et[o]=v.cos(o*(n.PI/180)*.5)},pn.prototype.size=function(e,t,n){y===r&&(y=l.getContext("2d"),dt=new Sn,vt=new Sn,gt=new Cn,mt=new Cn),cn.prototype.size.apply(this,arguments)},gn.prototype.size=(Hn=!1,function(e,t,n){if(Hn)throw"Multiple calls to size() for 3D renders are not allowed.";function r(e){for(var t,n=["experimental-webgl","webgl","webkit-3d"],r=0,i=n.length;r<i&&!(t=e.getContext(n[r],{antialias:!1}));r++);return t}Hn=!0;try{l.width=v.width=e||100,l.height=v.height=t||100,y=r(l),q=y.createTexture(),K=y.createTexture()}catch(e){E.debug(e)}if(!y)throw"WebGL context is not supported on this browser.";y.viewport(0,0,l.width,l.height),y.enable(y.DEPTH_TEST),y.enable(y.BLEND),y.blendFunc(y.SRC_ALPHA,y.ONE_MINUS_SRC_ALPHA),F=an(y,Kt,Jt),M=an(y,jt,qt),v.strokeWeight(1),N=an(y,Qt,en),y.useProgram(N),nn("usingTexture3d",N,"usingTexture",je),v.lightFalloff(1,0,0),v.shininess(1),v.ambient(255,255,255),v.specular(0,0,0),v.emissive(0,0,0),$=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,$),y.bufferData(y.ARRAY_BUFFER,Xt,y.STATIC_DRAW),z=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,z),y.bufferData(y.ARRAY_BUFFER,Ht,y.STATIC_DRAW),B=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,B),y.bufferData(y.ARRAY_BUFFER,Yt,y.STATIC_DRAW),V=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,V),y.bufferData(y.ARRAY_BUFFER,Zt,y.STATIC_DRAW),U=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,U),y.bufferData(y.ARRAY_BUFFER,Wt,y.STATIC_DRAW),G=y.createBuffer(),X=y.createBuffer(),Y=y.createBuffer(),H=y.createBuffer(),Z=y.createBuffer(),j=y.createBuffer(),W=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,W),y.bufferData(y.ARRAY_BUFFER,new h([0,0,0]),y.STATIC_DRAW),J=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,J),y.bufferData(y.ARRAY_BUFFER,new h([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),y.STATIC_DRAW),Q=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,Q),y.bufferData(y.ARRAY_BUFFER,new h([0,0,1,0,1,1,0,1]),y.STATIC_DRAW),ee=y.createBuffer(),y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,ee),y.bufferData(y.ELEMENT_ARRAY_BUFFER,new f([0,1,2,2,3,0]),y.STATIC_DRAW),ct=new Tn,pt=new Tn,gt=new Tn,mt=new Tn,bt=new Tn,v.camera(),v.perspective(),dt=new Sn,vt=new Sn,R=new Tn,k=new Tn,L=new Tn,D=new Tn,I=new Tn,(O=new Tn).set(-1,3,-3,1,3,-6,3,0,-3,3,0,0,1,0,0,0),cn.prototype.size.apply(this,arguments)}),pn.prototype.ambientLight=cn.prototype.a3DOnlyFunction,gn.prototype.ambientLight=function(e,t,n,r,i,s){if(8===xt)throw"can only create 8 lights";var o=new b(r,i,s),a=new Tn;a.scale(1,-1,1),a.apply(gt.array()),a.mult(o,o);var l=Pn(e,t,n,0),h=[(l>>16&255)/255,((65280&l)>>>8)/255,(255&l)/255];y.useProgram(N),tn("lights.color.3d."+xt,N,"lights"+xt+".color",h),tn("lights.position.3d."+xt,N,"lights"+xt+".position",o.array()),nn("lights.type.3d."+xt,N,"lights"+xt+".type",0),nn("lightCount3d",N,"lightCount",++xt)},pn.prototype.directionalLight=cn.prototype.a3DOnlyFunction,gn.prototype.directionalLight=function(e,t,n,r,i,s){if(8===xt)throw"can only create 8 lights";y.useProgram(N);var o=new Tn;o.scale(1,-1,1),o.apply(gt.array());var a=[(o=o.array())[0]*r+o[4]*i+o[8]*s,o[1]*r+o[5]*i+o[9]*s,o[2]*r+o[6]*i+o[10]*s],l=Pn(e,t,n,0);tn("lights.color.3d."+xt,N,"lights"+xt+".color",[(l>>16&255)/255,(l>>8&255)/255,(255&l)/255]),tn("lights.position.3d."+xt,N,"lights"+xt+".position",a),nn("lights.type.3d."+xt,N,"lights"+xt+".type",1),nn("lightCount3d",N,"lightCount",++xt)},pn.prototype.lightFalloff=cn.prototype.a3DOnlyFunction,gn.prototype.lightFalloff=function(e,t,n){y.useProgram(N),tn("falloff3d",N,"falloff",[e,t,n])},pn.prototype.lightSpecular=cn.prototype.a3DOnlyFunction,gn.prototype.lightSpecular=function(e,t,n){var r=Pn(e,t,n,0),i=[(r>>16&255)/255,(r>>8&255)/255,(255&r)/255];y.useProgram(N),tn("specular3d",N,"specular",i)},v.lights=function(){v.ambientLight(128,128,128),v.directionalLight(128,128,128,0,0,-1),v.lightFalloff(1,0,0),v.lightSpecular(0,0,0)},pn.prototype.pointLight=cn.prototype.a3DOnlyFunction,gn.prototype.pointLight=function(e,t,n,r,i,s){if(8===xt)throw"can only create 8 lights";var o=new b(r,i,s),a=new Tn;a.scale(1,-1,1),a.apply(gt.array()),a.mult(o,o);var l=Pn(e,t,n,0),h=[(l>>16&255)/255,(l>>8&255)/255,(255&l)/255];y.useProgram(N),tn("lights.color.3d."+xt,N,"lights"+xt+".color",h),tn("lights.position.3d."+xt,N,"lights"+xt+".position",o.array()),nn("lights.type.3d."+xt,N,"lights"+xt+".type",2),nn("lightCount3d",N,"lightCount",++xt)},pn.prototype.noLights=cn.prototype.a3DOnlyFunction,gn.prototype.noLights=function(){xt=0,y.useProgram(N),nn("lightCount3d",N,"lightCount",xt)},pn.prototype.spotLight=cn.prototype.a3DOnlyFunction,gn.prototype.spotLight=function(e,t,n,r,i,s,o,a,l,h,u){if(8===xt)throw"can only create 8 lights";y.useProgram(N);var f=new b(r,i,s),c=new Tn;c.scale(1,-1,1),c.apply(gt.array()),c.mult(f,f);var p=[(c=c.array())[0]*o+c[4]*a+c[8]*l,c[1]*o+c[5]*a+c[9]*l,c[2]*o+c[6]*a+c[10]*l],g=Pn(e,t,n,0);tn("lights.color.3d."+xt,N,"lights"+xt+".color",[(g>>16&255)/255,(g>>8&255)/255,(255&g)/255]),tn("lights.position.3d."+xt,N,"lights"+xt+".position",f.array()),tn("lights.direction.3d."+xt,N,"lights"+xt+".direction",p),tn("lights.concentration.3d."+xt,N,"lights"+xt+".concentration",u),tn("lights.angle.3d."+xt,N,"lights"+xt+".angle",h),nn("lights.type.3d."+xt,N,"lights"+xt+".type",3),nn("lightCount3d",N,"lightCount",++xt)},pn.prototype.beginCamera=function(){throw"beginCamera() is not available in 2D mode"},gn.prototype.beginCamera=function(){if(_t)throw"You cannot call beginCamera() again before calling endCamera()";_t=!0,gt=pt,mt=ct},pn.prototype.endCamera=function(){throw"endCamera() is not available in 2D mode"},gn.prototype.endCamera=function(){if(!_t)throw"You cannot call endCamera() before calling beginCamera()";gt.set(ct),mt.set(pt),_t=!1},v.camera=function(e,t,i,s,o,a,l,h,u){e===r&&(kt=v.width/2,Lt=v.height/2,Dt=Lt/n.tan(Rt/2),e=kt,t=Lt,i=Dt,s=kt,o=Lt,a=0,l=0,h=1,u=0);var f=new b(e-s,t-o,i-a),c=new b(l,h,u);f.normalize();var p=b.cross(c,f);c=b.cross(f,p),p.normalize(),c.normalize();var g=p.x,m=p.y,d=p.z,y=c.x,x=c.y,w=c.z,A=f.x,C=f.y,T=f.z;ct.set(g,m,d,0,y,x,w,0,A,C,T,0,0,0,0,1),ct.translate(-e,-t,-i),pt.reset(),pt.invApply(g,m,d,0,y,x,w,0,A,C,T,0,0,0,0,1),pt.translate(e,t,i),gt.set(ct),mt.set(pt)},v.perspective=function(e,t,r,i){var s,o,a,h;0===arguments.length&&(Lt=l.height/2,Dt=Lt/n.tan(Rt/2),It=Dt/10,Ot=10*Dt,Nt=v.width/v.height,e=Rt,t=Nt,r=It,i=Ot),a=(s=r*n.tan(e/2))*t,h=(o=-s)*t,v.frustum(h,a,o,s,r,i)},pn.prototype.frustum=function(){throw"Processing.js: frustum() is not supported in 2D mode"},gn.prototype.frustum=function(e,t,n,r,i,s){!0,(bt=new Tn).set(2*i/(t-e),0,(t+e)/(t-e),0,0,2*i/(r-n),(r+n)/(r-n),0,0,0,-(s+i)/(s-i),-2*s*i/(s-i),0,0,-1,0);var o=new Tn;o.set(bt),o.transpose(),y.useProgram(F),rn("projection2d",F,"projection",!1,o.array()),y.useProgram(N),rn("projection3d",N,"projection",!1,o.array()),y.useProgram(M),rn("uProjectionUS",M,"uProjection",!1,o.array())},v.ortho=function(e,t,n,r,i,s){0===arguments.length&&(e=0,t=v.width,n=0,r=v.height,i=-10,s=10);var o=2/(t-e),a=2/(r-n),l=-2/(s-i),h=-(t+e)/(t-e),u=-(r+n)/(r-n),f=-(s+i)/(s-i);(bt=new Tn).set(o,0,0,h,0,a,0,u,0,0,l,f,0,0,0,1);var c=new Tn;c.set(bt),c.transpose(),y.useProgram(F),rn("projection2d",F,"projection",!1,c.array()),y.useProgram(N),rn("projection3d",N,"projection",!1,c.array()),y.useProgram(M),rn("uProjectionUS",M,"uProjection",!1,c.array()),!1},v.printProjection=function(){bt.print()},v.printCamera=function(){ct.print()},pn.prototype.box=cn.prototype.a3DOnlyFunction,gn.prototype.box=function(e,t,n){t&&n||(t=n=e);var r=new Tn;r.scale(e,t,n);var i=new Tn;if(i.scale(1,-1,1),i.apply(gt.array()),i.transpose(),ae){if(y.useProgram(N),rn("model3d",N,"model",!1,r.array()),rn("view3d",N,"view",!1,i.array()),y.enable(y.POLYGON_OFFSET_FILL),y.polygonOffset(1,1),tn("color3d",N,"color",le),xt>0){var s=new Tn;s.set(i);var o=new Tn;o.set(r),s.mult(o);var a=new Tn;a.set(s),a.invert(),a.transpose(),rn("normalTransform3d",N,"normalTransform",!1,a.array()),sn("normal3d",N,"Normal",3,z)}else on("normal3d",N,"Normal");sn("vertex3d",N,"Vertex",3,$),on("aColor3d",N,"aColor"),on("aTexture3d",N,"aTexture"),y.drawArrays(y.TRIANGLES,0,Xt.length/3),y.disable(y.POLYGON_OFFSET_FILL)}me>0&&fe&&(y.useProgram(F),rn("model2d",F,"model",!1,r.array()),rn("view2d",F,"view",!1,i.array()),tn("color2d",F,"color",ce),nn("picktype2d",F,"picktype",0),sn("vertex2d",F,"Vertex",3,B),on("aTextureCoord2d",F,"aTextureCoord"),y.drawArrays(y.LINES,0,Yt.length/3))};var Wn=function(){var e,t,n,r;for(ft=[],e=0;e<At;e++)ft.push(0),ft.push(-1),ft.push(0),ft.push(Ct[e]),ft.push(Tt[e]),ft.push(St[e]);ft.push(0),ft.push(-1),ft.push(0),ft.push(Ct[0]),ft.push(Tt[0]),ft.push(St[0]);var i=0;for(e=2;e<wt;e++){t=n=i,r=i+=At;for(var s=0;s<At;s++)ft.push(Ct[t]),ft.push(Tt[t]),ft.push(St[t++]),ft.push(Ct[r]),ft.push(Tt[r]),ft.push(St[r++]);t=n,r=i,ft.push(Ct[t]),ft.push(Tt[t]),ft.push(St[t]),ft.push(Ct[r]),ft.push(Tt[r]),ft.push(St[r])}for(e=0;e<At;e++)r=i+e,ft.push(Ct[r]),ft.push(Tt[r]),ft.push(St[r]),ft.push(0),ft.push(1),ft.push(0);ft.push(Ct[i]),ft.push(Tt[i]),ft.push(St[i]),ft.push(0),ft.push(1),ft.push(0),y.bindBuffer(y.ARRAY_BUFFER,G),y.bufferData(y.ARRAY_BUFFER,new h(ft),y.STATIC_DRAW)};function jn(){ae&&(ue&&(y.fillStyle=v.color.toString(he),ue=!1),y.fill())}function qn(){fe&&(ge&&(y.strokeStyle=v.color.toString(pe),ge=!1),y.stroke())}v.sphereDetail=function(e,t){var n;if(1===arguments.length&&(e=t=arguments[0]),e<3&&(e=3),t<2&&(t=2),e!==At||t!==wt){var r=720/e,i=new h(e),s=new h(e);for(n=0;n<e;n++)i[n]=Et[n*r%720|0],s[n]=Pt[n*r%720|0];var o=e*(t-1)+2,a=0;Ct=new h(o),Tt=new h(o),St=new h(o);var l=360/t,u=l;for(n=1;n<t;n++){for(var f=Pt[u%720|0],c=-Et[u%720|0],p=0;p<e;p++)Ct[a]=i[p]*f,Tt[a]=c,St[a++]=s[p]*f;u+=l}At=e,wt=t,Wn()}},pn.prototype.sphere=cn.prototype.a3DOnlyFunction,gn.prototype.sphere=function(){var e=arguments[0];(At<3||wt<2)&&v.sphereDetail(30);var t=new Tn;t.scale(e,e,e);var n=new Tn;if(n.scale(1,-1,1),n.apply(gt.array()),n.transpose(),ae){if(xt>0){var r=new Tn;r.set(n);var i=new Tn;i.set(t),r.mult(i);var s=new Tn;s.set(r),s.invert(),s.transpose(),rn("normalTransform3d",N,"normalTransform",!1,s.array()),sn("normal3d",N,"Normal",3,G)}else on("normal3d",N,"Normal");y.useProgram(N),on("aTexture3d",N,"aTexture"),rn("model3d",N,"model",!1,t.array()),rn("view3d",N,"view",!1,n.array()),sn("vertex3d",N,"Vertex",3,G),on("aColor3d",N,"aColor"),y.enable(y.POLYGON_OFFSET_FILL),y.polygonOffset(1,1),tn("color3d",N,"color",le),y.drawArrays(y.TRIANGLE_STRIP,0,ft.length/3),y.disable(y.POLYGON_OFFSET_FILL)}me>0&&fe&&(y.useProgram(F),rn("model2d",F,"model",!1,t.array()),rn("view2d",F,"view",!1,n.array()),sn("vertex2d",F,"Vertex",3,G),on("aTextureCoord2d",F,"aTextureCoord"),tn("color2d",F,"color",ce),nn("picktype2d",F,"picktype",0),y.drawArrays(y.LINE_STRIP,0,ft.length/3))},v.modelX=function(e,t,n){var r=gt.array(),i=pt.array(),s=r[0]*e+r[1]*t+r[2]*n+r[3],o=r[4]*e+r[5]*t+r[6]*n+r[7],a=r[8]*e+r[9]*t+r[10]*n+r[11],l=r[12]*e+r[13]*t+r[14]*n+r[15],h=i[0]*s+i[1]*o+i[2]*a+i[3]*l,u=i[12]*s+i[13]*o+i[14]*a+i[15]*l;return 0!==u?h/u:h},v.modelY=function(e,t,n){var r=gt.array(),i=pt.array(),s=r[0]*e+r[1]*t+r[2]*n+r[3],o=r[4]*e+r[5]*t+r[6]*n+r[7],a=r[8]*e+r[9]*t+r[10]*n+r[11],l=r[12]*e+r[13]*t+r[14]*n+r[15],h=i[4]*s+i[5]*o+i[6]*a+i[7]*l,u=i[12]*s+i[13]*o+i[14]*a+i[15]*l;return 0!==u?h/u:h},v.modelZ=function(e,t,n){var r=gt.array(),i=pt.array(),s=r[0]*e+r[1]*t+r[2]*n+r[3],o=r[4]*e+r[5]*t+r[6]*n+r[7],a=r[8]*e+r[9]*t+r[10]*n+r[11],l=r[12]*e+r[13]*t+r[14]*n+r[15],h=i[8]*s+i[9]*o+i[10]*a+i[11]*l,u=i[12]*s+i[13]*o+i[14]*a+i[15]*l;return 0!==u?h/u:h},pn.prototype.ambient=cn.prototype.a3DOnlyFunction,gn.prototype.ambient=function(e,t,n){y.useProgram(N),nn("usingMat3d",N,"usingMat",!0);var r=v.color(e,t,n);tn("mat_ambient3d",N,"mat_ambient",v.color.toGLArray(r).slice(0,3))},pn.prototype.emissive=cn.prototype.a3DOnlyFunction,gn.prototype.emissive=function(e,t,n){y.useProgram(N),nn("usingMat3d",N,"usingMat",!0);var r=v.color(e,t,n);tn("mat_emissive3d",N,"mat_emissive",v.color.toGLArray(r).slice(0,3))},pn.prototype.shininess=cn.prototype.a3DOnlyFunction,gn.prototype.shininess=function(e){y.useProgram(N),nn("usingMat3d",N,"usingMat",!0),tn("shininess3d",N,"shininess",e)},pn.prototype.specular=cn.prototype.a3DOnlyFunction,gn.prototype.specular=function(e,t,n){y.useProgram(N),nn("usingMat3d",N,"usingMat",!0);var r=v.color(e,t,n);tn("mat_specular3d",N,"mat_specular",v.color.toGLArray(r).slice(0,3))},v.screenX=function(e,t,n){var r=gt.array();if(16===r.length){var i=r[0]*e+r[1]*t+r[2]*n+r[3],s=r[4]*e+r[5]*t+r[6]*n+r[7],o=r[8]*e+r[9]*t+r[10]*n+r[11],a=r[12]*e+r[13]*t+r[14]*n+r[15],l=bt.array(),h=l[0]*i+l[1]*s+l[2]*o+l[3]*a,u=l[12]*i+l[13]*s+l[14]*o+l[15]*a;return 0!==u&&(h/=u),v.width*(1+h)/2}return gt.multX(e,t)},v.screenY=function(e,t,n){var r=gt.array();if(16===r.length){var i=r[0]*e+r[1]*t+r[2]*n+r[3],s=r[4]*e+r[5]*t+r[6]*n+r[7],o=r[8]*e+r[9]*t+r[10]*n+r[11],a=r[12]*e+r[13]*t+r[14]*n+r[15],l=bt.array(),h=l[4]*i+l[5]*s+l[6]*o+l[7]*a,u=l[12]*i+l[13]*s+l[14]*o+l[15]*a;return 0!==u&&(h/=u),v.height*(1+h)/2}return gt.multY(e,t)},v.screenZ=function(e,t,n){var r=gt.array();if(16!==r.length)return 0;var i=bt.array(),s=r[0]*e+r[1]*t+r[2]*n+r[3],o=r[4]*e+r[5]*t+r[6]*n+r[7],a=r[8]*e+r[9]*t+r[10]*n+r[11],l=r[12]*e+r[13]*t+r[14]*n+r[15],h=i[8]*s+i[9]*o+i[10]*a+i[11]*l,u=i[12]*s+i[13]*o+i[14]*a+i[15]*l;return 0!==u&&(h/=u),(h+1)/2},cn.prototype.fill=function(){var e=v.color(arguments[0],arguments[1],arguments[2],arguments[3]);e===he&&ae||(ae=!0,he=e)},pn.prototype.fill=function(){cn.prototype.fill.apply(this,arguments),ue=!0},gn.prototype.fill=function(){cn.prototype.fill.apply(this,arguments),le=v.color.toGLArray(he)},v.noFill=function(){ae=!1},cn.prototype.stroke=function(){var e=v.color(arguments[0],arguments[1],arguments[2],arguments[3]);e===pe&&fe||(fe=!0,pe=e)},pn.prototype.stroke=function(){cn.prototype.stroke.apply(this,arguments),ge=!0},gn.prototype.stroke=function(){cn.prototype.stroke.apply(this,arguments),ce=v.color.toGLArray(pe)},v.noStroke=function(){fe=!1},cn.prototype.strokeWeight=function(e){me=e},pn.prototype.strokeWeight=function(e){cn.prototype.strokeWeight.apply(this,arguments),y.lineWidth=e},gn.prototype.strokeWeight=function(e){cn.prototype.strokeWeight.apply(this,arguments),y.useProgram(F),tn("pointSize2d",F,"pointSize",e),y.useProgram(M),tn("pointSizeUnlitShape",M,"pointSize",e),y.lineWidth(e)},v.strokeCap=function(e){A.$ensureContext().lineCap=e},v.strokeJoin=function(e){A.$ensureContext().lineJoin=e},pn.prototype.smooth=function(){!0;var e=l.style;e.setProperty("image-rendering","optimizeQuality","important"),e.setProperty("-ms-interpolation-mode","bicubic","important"),y.hasOwnProperty("mozImageSmoothingEnabled")&&(y.mozImageSmoothingEnabled=!0)},gn.prototype.smooth=i,pn.prototype.noSmooth=function(){!1;var e=l.style;e.setProperty("image-rendering","optimizeSpeed","important"),e.setProperty("image-rendering","-moz-crisp-edges","important"),e.setProperty("image-rendering","-webkit-optimize-contrast","important"),e.setProperty("image-rendering","optimize-contrast","important"),e.setProperty("-ms-interpolation-mode","nearest-neighbor","important"),y.hasOwnProperty("mozImageSmoothingEnabled")&&(y.mozImageSmoothingEnabled=!1)},gn.prototype.noSmooth=i,pn.prototype.point=function(e,t){fe&&(e=n.round(e),t=n.round(t),y.fillStyle=v.color.toString(pe),ue=!0,me>1?(y.beginPath(),y.arc(e,t,me/2,0,6.283185307179586,!1),y.fill()):y.fillRect(e,t,1,1))},gn.prototype.point=function(e,t,n){var r=new Tn;r.translate(e,t,n||0),r.transpose();var i=new Tn;i.scale(1,-1,1),i.apply(gt.array()),i.transpose(),y.useProgram(F),rn("model2d",F,"model",!1,r.array()),rn("view2d",F,"view",!1,i.array()),me>0&&fe&&(tn("color2d",F,"color",ce),nn("picktype2d",F,"picktype",0),sn("vertex2d",F,"Vertex",3,W),on("aTextureCoord2d",F,"aTextureCoord"),y.drawArrays(y.POINTS,0,1))},v.beginShape=function(e){_e=e,[],Ft=[]},pn.prototype.vertex=function(e,t,n,r){var i=[];Vt&&(Vt=!1),i.isVert=!0,i[0]=e,i[1]=t,i[2]=0,i[3]=n,i[4]=r,i[5]=he,i[6]=pe,Ft.push(i)},gn.prototype.vertex=function(e,t,n,i,s){var o=[];Vt&&(Vt=!1),o.isVert=!0,s===r&&je&&(s=i,i=n,n=0),i!==r&&s!==r&&(2===We&&(i/=Ze.width,s/=Ze.height),i=(i=i>1?1:i)<0?0:i,s=(s=s>1?1:s)<0?0:s),o[0]=e,o[1]=t,o[2]=n||0,o[3]=i||0,o[4]=s||0,o[5]=le[0],o[6]=le[1],o[7]=le[2],o[8]=le[3],o[9]=ce[0],o[10]=ce[1],o[11]=ce[2],o[12]=ce[3],o[13]=we,o[14]=Ae,o[15]=Ce,Ft.push(o)};var Kn=function(e,t){var n=new Tn;n.scale(1,-1,1),n.apply(gt.array()),n.transpose(),y.useProgram(M),rn("uViewUS",M,"uView",!1,n.array()),sn("aVertexUS",M,"aVertex",3,W),y.bufferData(y.ARRAY_BUFFER,new h(e),y.STREAM_DRAW),sn("aColorUS",M,"aColor",4,H),y.bufferData(y.ARRAY_BUFFER,new h(t),y.STREAM_DRAW),y.drawArrays(y.POINTS,0,e.length/3)},Jn=function(e,t,n){var r;r="LINES"===t?y.LINES:"LINE_LOOP"===t?y.LINE_LOOP:y.LINE_STRIP;var i=new Tn;i.scale(1,-1,1),i.apply(gt.array()),i.transpose(),y.useProgram(M),rn("uViewUS",M,"uView",!1,i.array()),sn("aVertexUS",M,"aVertex",3,X),y.bufferData(y.ARRAY_BUFFER,new h(e),y.STREAM_DRAW),sn("aColorUS",M,"aColor",4,Z),y.bufferData(y.ARRAY_BUFFER,new h(n),y.STREAM_DRAW),y.drawArrays(r,0,e.length/3)},Qn=function(e,t,n,r){var i;i="TRIANGLES"===t?y.TRIANGLES:"TRIANGLE_FAN"===t?y.TRIANGLE_FAN:y.TRIANGLE_STRIP;var s=new Tn;s.scale(1,-1,1),s.apply(gt.array()),s.transpose(),y.useProgram(N),rn("model3d",N,"model",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),rn("view3d",N,"view",!1,s.array()),y.enable(y.POLYGON_OFFSET_FILL),y.polygonOffset(1,1),tn("color3d",N,"color",[-1,0,0,0]),sn("vertex3d",N,"Vertex",3,Y),y.bufferData(y.ARRAY_BUFFER,new h(e),y.STREAM_DRAW),je&&null!==Ve&&Ue(n),sn("aColor3d",N,"aColor",4,H),y.bufferData(y.ARRAY_BUFFER,new h(n),y.STREAM_DRAW),on("normal3d",N,"Normal"),je&&(nn("usingTexture3d",N,"usingTexture",je),sn("aTexture3d",N,"aTexture",2,j),y.bufferData(y.ARRAY_BUFFER,new h(r),y.STREAM_DRAW)),y.drawArrays(i,0,e.length/3),y.disable(y.POLYGON_OFFSET_FILL)};function er(){jn(),qn(),y.closePath()}pn.prototype.endShape=function(e){if(0!==Ft.length){var t=2===e;t&&Ft.push(Ft[0]);var n,i,s,o=[],a=[],l=[],h=[];Vt=!0;var u=Ft.length;for(i=0;i<u;i++)for(n=Ft[i],s=0;s<3;s++)o.push(n[s]);for(i=0;i<u;i++)for(n=Ft[i],s=5;s<9;s++)a.push(n[s]);for(i=0;i<u;i++)for(n=Ft[i],s=9;s<13;s++)l.push(n[s]);for(i=0;i<u;i++)n=Ft[i],h.push(n[3]),h.push(n[4]);if(!zt||20!==_e&&_e!==r)if(!Bt||20!==_e&&_e!==r)if(2===_e)for(i=0;i<u;i++)n=Ft[i],fe&&v.stroke(n[6]),v.point(n[0],n[1]);else if(4===_e)for(i=0;i+1<u;i+=2)n=Ft[i],fe&&v.stroke(Ft[i+1][6]),v.line(n[0],n[1],Ft[i+1][0],Ft[i+1][1]);else if(9===_e)for(i=0;i+2<u;i+=3)n=Ft[i],y.beginPath(),y.moveTo(n[0],n[1]),y.lineTo(Ft[i+1][0],Ft[i+1][1]),y.lineTo(Ft[i+2][0],Ft[i+2][1]),y.lineTo(n[0],n[1]),ae&&(v.fill(Ft[i+2][5]),jn()),fe&&(v.stroke(Ft[i+2][6]),qn()),y.closePath();else if(10===_e)for(i=0;i+1<u;i++)n=Ft[i],y.beginPath(),y.moveTo(Ft[i+1][0],Ft[i+1][1]),y.lineTo(n[0],n[1]),fe&&v.stroke(Ft[i+1][6]),ae&&v.fill(Ft[i+1][5]),i+2<u&&(y.lineTo(Ft[i+2][0],Ft[i+2][1]),fe&&v.stroke(Ft[i+2][6]),ae&&v.fill(Ft[i+2][5])),er();else if(11===_e){if(u>2)for(y.beginPath(),y.moveTo(Ft[0][0],Ft[0][1]),y.lineTo(Ft[1][0],Ft[1][1]),y.lineTo(Ft[2][0],Ft[2][1]),ae&&(v.fill(Ft[2][5]),jn()),fe&&(v.stroke(Ft[2][6]),qn()),y.closePath(),i=3;i<u;i++)n=Ft[i],y.beginPath(),y.moveTo(Ft[0][0],Ft[0][1]),y.lineTo(Ft[i-1][0],Ft[i-1][1]),y.lineTo(n[0],n[1]),ae&&(v.fill(n[5]),jn()),fe&&(v.stroke(n[6]),qn()),y.closePath()}else if(16===_e)for(i=0;i+3<u;i+=4){for(n=Ft[i],y.beginPath(),y.moveTo(n[0],n[1]),s=1;s<4;s++)y.lineTo(Ft[i+s][0],Ft[i+s][1]);y.lineTo(n[0],n[1]),ae&&(v.fill(Ft[i+3][5]),jn()),fe&&(v.stroke(Ft[i+3][6]),qn()),y.closePath()}else if(17===_e){if(u>3)for(i=0;i+1<u;i+=2)n=Ft[i],y.beginPath(),i+3<u?(y.moveTo(Ft[i+2][0],Ft[i+2][1]),y.lineTo(n[0],n[1]),y.lineTo(Ft[i+1][0],Ft[i+1][1]),y.lineTo(Ft[i+3][0],Ft[i+3][1]),ae&&v.fill(Ft[i+3][5]),fe&&v.stroke(Ft[i+3][6])):(y.moveTo(n[0],n[1]),y.lineTo(Ft[i+1][0],Ft[i+1][1])),er()}else{for(y.beginPath(),y.moveTo(Ft[0][0],Ft[0][1]),i=1;i<u;i++)(n=Ft[i]).isVert&&(n.moveTo?y.moveTo(n[0],n[1]):y.lineTo(n[0],n[1]));er()}else{for(y.beginPath(),i=0;i<u;i++)n=Ft[i],Ft[i].isVert?Ft[i].moveTo?y.moveTo(n[0],n[1]):y.lineTo(n[0],n[1]):y.bezierCurveTo(Ft[i][0],Ft[i][1],Ft[i][2],Ft[i][3],Ft[i][4],Ft[i][5]);er()}else if(u>3){var f=[],c=1-Re;for(y.beginPath(),y.moveTo(Ft[1][0],Ft[1][1]),i=1;i+2<u;i++)n=Ft[i],f[0]=[n[0],n[1]],f[1]=[n[0]+(c*Ft[i+1][0]-c*Ft[i-1][0])/6,n[1]+(c*Ft[i+1][1]-c*Ft[i-1][1])/6],f[2]=[Ft[i+1][0]+(c*Ft[i][0]-c*Ft[i+2][0])/6,Ft[i+1][1]+(c*Ft[i][1]-c*Ft[i+2][1])/6],f[3]=[Ft[i+1][0],Ft[i+1][1]],y.bezierCurveTo(f[1][0],f[1][1],f[2][0],f[2][1],f[3][0],f[3][1]);er()}zt=!1,Bt=!1,Mt=[],$t=0,t&&Ft.pop()}},gn.prototype.endShape=function(e){if(0!==Ft.length){var t,n,i,s,o=2===e,a=[],l=[],h=[],u=[],f=[];Vt=!0;var c=Ft.length;for(n=0;n<c;n++)for(t=Ft[n],i=0;i<3;i++)l.push(t[i]);for(n=0;n<c;n++)for(t=Ft[n],i=5;i<9;i++)h.push(t[i]);for(n=0;n<c;n++)for(t=Ft[n],i=9;i<13;i++)u.push(t[i]);for(n=0;n<c;n++)t=Ft[n],f.push(t[3]),f.push(t[4]);if(o){for(l.push(Ft[0][0]),l.push(Ft[0][1]),l.push(Ft[0][2]),n=5;n<9;n++)h.push(Ft[0][n]);for(n=9;n<13;n++)u.push(Ft[0][n]);f.push(Ft[0][3]),f.push(Ft[0][4])}if(!zt||20!==_e&&_e!==r)if(!Bt||20!==_e&&_e!==r){if(2===_e){for(n=0;n<c;n++)for(t=Ft[n],i=0;i<3;i++)a.push(t[i]);Kn(a,u)}else if(4===_e){for(n=0;n<c;n++)for(t=Ft[n],i=0;i<3;i++)a.push(t[i]);for(n=0;n<c;n++)for(t=Ft[n],i=5;i<9;i++)h.push(t[i]);Jn(a,"LINES",u)}else if(9===_e){if(c>2)for(n=0;n+2<c;n+=3){for(l=[],f=[],a=[],h=[],u=[],i=0;i<3;i++)for(s=0;s<3;s++)a.push(Ft[n+i][s]),l.push(Ft[n+i][s]);for(i=0;i<3;i++)for(s=3;s<5;s++)f.push(Ft[n+i][s]);for(i=0;i<3;i++)for(s=5;s<9;s++)h.push(Ft[n+i][s]),u.push(Ft[n+i][s+4]);fe&&Jn(a,"LINE_LOOP",u),(ae||je)&&Qn(l,"TRIANGLES",h,f)}}else if(10===_e){if(c>2)for(n=0;n+2<c;n++){for(a=[],l=[],u=[],h=[],f=[],i=0;i<3;i++)for(s=0;s<3;s++)a.push(Ft[n+i][s]),l.push(Ft[n+i][s]);for(i=0;i<3;i++)for(s=3;s<5;s++)f.push(Ft[n+i][s]);for(i=0;i<3;i++)for(s=5;s<9;s++)u.push(Ft[n+i][s+4]),h.push(Ft[n+i][s]);(ae||je)&&Qn(l,"TRIANGLE_STRIP",h,f),fe&&Jn(a,"LINE_LOOP",u)}}else if(11===_e){if(c>2){for(n=0;n<3;n++)for(t=Ft[n],i=0;i<3;i++)a.push(t[i]);for(n=0;n<3;n++)for(t=Ft[n],i=9;i<13;i++)u.push(t[i]);for(fe&&Jn(a,"LINE_LOOP",u),n=2;n+1<c;n++){for(u=[],(a=[]).push(Ft[0][0]),a.push(Ft[0][1]),a.push(Ft[0][2]),u.push(Ft[0][9]),u.push(Ft[0][10]),u.push(Ft[0][11]),u.push(Ft[0][12]),i=0;i<2;i++)for(s=0;s<3;s++)a.push(Ft[n+i][s]);for(i=0;i<2;i++)for(s=9;s<13;s++)u.push(Ft[n+i][s]);fe&&Jn(a,"LINE_STRIP",u)}(ae||je)&&Qn(l,"TRIANGLE_FAN",h,f)}}else if(16===_e)for(n=0;n+3<c;n+=4){for(a=[],i=0;i<4;i++)for(t=Ft[n+i],s=0;s<3;s++)a.push(t[s]);if(fe&&Jn(a,"LINE_LOOP",u),ae){for(l=[],h=[],f=[],i=0;i<3;i++)l.push(Ft[n][i]);for(i=5;i<9;i++)h.push(Ft[n][i]);for(i=0;i<3;i++)l.push(Ft[n+1][i]);for(i=5;i<9;i++)h.push(Ft[n+1][i]);for(i=0;i<3;i++)l.push(Ft[n+3][i]);for(i=5;i<9;i++)h.push(Ft[n+3][i]);for(i=0;i<3;i++)l.push(Ft[n+2][i]);for(i=5;i<9;i++)h.push(Ft[n+2][i]);je&&(f.push(Ft[n+0][3]),f.push(Ft[n+0][4]),f.push(Ft[n+1][3]),f.push(Ft[n+1][4]),f.push(Ft[n+3][3]),f.push(Ft[n+3][4]),f.push(Ft[n+2][3]),f.push(Ft[n+2][4])),Qn(l,"TRIANGLE_STRIP",h,f)}}else if(17===_e){if(c>3){for(n=0;n<2;n++)for(t=Ft[n],i=0;i<3;i++)a.push(t[i]);for(n=0;n<2;n++)for(t=Ft[n],i=9;i<13;i++)u.push(t[i]);for(Jn(a,"LINE_STRIP",u),c>4&&c%2>0&&(l.splice(l.length-3),Ft.pop()),n=0;n+3<c;n+=2){for(a=[],u=[],i=0;i<3;i++)a.push(Ft[n+1][i]);for(i=0;i<3;i++)a.push(Ft[n+3][i]);for(i=0;i<3;i++)a.push(Ft[n+2][i]);for(i=0;i<3;i++)a.push(Ft[n+0][i]);for(i=9;i<13;i++)u.push(Ft[n+1][i]);for(i=9;i<13;i++)u.push(Ft[n+3][i]);for(i=9;i<13;i++)u.push(Ft[n+2][i]);for(i=9;i<13;i++)u.push(Ft[n+0][i]);fe&&Jn(a,"LINE_STRIP",u)}(ae||je)&&Qn(l,"TRIANGLE_LIST",h,f)}}else if(1===c){for(i=0;i<3;i++)a.push(Ft[0][i]);for(i=9;i<13;i++)u.push(Ft[0][i]);Kn(a,u)}else{for(n=0;n<c;n++){for(t=Ft[n],i=0;i<3;i++)a.push(t[i]);for(i=5;i<9;i++)u.push(t[i])}fe&&o?Jn(a,"LINE_LOOP",u):fe&&!o&&Jn(a,"LINE_STRIP",u),(ae||je)&&Qn(l,"TRIANGLE_FAN",h,f)}je=!1,y.useProgram(N),nn("usingTexture3d",N,"usingTexture",je)}else(a=l).splice(a.length-3),u.splice(u.length-4),fe&&Jn(a,null,u),ae&&Qn(l,"TRIANGLES",h);else a=l,fe&&Jn(a,null,u),ae&&Qn(l,null,h);zt=!1,Bt=!1,Mt=[],$t=0}};var tr=function(e,t){var n=1/e,r=n*n,i=r*n;t.set(0,0,0,1,i,r,n,0,6*i,2*r,0,0,6*i,0,0,0)},nr=function(){L||(R=new Tn,L=new Tn,Le=!0);var e=Re;R.set((e-1)/2,(e+3)/2,(-3-e)/2,(1-e)/2,1-e,(-5-e)/2,e+2,(e-1)/2,(e-1)/2,0,(1-e)/2,0,0,1,0,0),tr(ke,L),I||(k=new Tn),k.set(R),k.preApply(I),L.apply(R)};pn.prototype.bezierVertex=function(){Bt=!0;var e=[];if(Vt)throw"vertex() must be used at least once before calling bezierVertex()";for(var t=0;t<arguments.length;t++)e[t]=arguments[t];Ft.push(e),Ft[Ft.length-1].isVert=!1},gn.prototype.bezierVertex=function(){Bt=!0;if(Vt)throw"vertex() must be used at least once before calling bezierVertex()";if(9===arguments.length){D===r&&(D=new Tn);var e=Ft.length-1;tr(Ie,D),D.apply(O);for(var t=D.array(),n=Ft[e][0],i=Ft[e][1],s=Ft[e][2],o=t[4]*n+t[5]*arguments[0]+t[6]*arguments[3]+t[7]*arguments[6],a=t[8]*n+t[9]*arguments[0]+t[10]*arguments[3]+t[11]*arguments[6],l=t[12]*n+t[13]*arguments[0]+t[14]*arguments[3]+t[15]*arguments[6],h=t[4]*i+t[5]*arguments[1]+t[6]*arguments[4]+t[7]*arguments[7],u=t[8]*i+t[9]*arguments[1]+t[10]*arguments[4]+t[11]*arguments[7],f=t[12]*i+t[13]*arguments[1]+t[14]*arguments[4]+t[15]*arguments[7],c=t[4]*s+t[5]*arguments[2]+t[6]*arguments[5]+t[7]*arguments[8],p=t[8]*s+t[9]*arguments[2]+t[10]*arguments[5]+t[11]*arguments[8],g=t[12]*s+t[13]*arguments[2]+t[14]*arguments[5]+t[15]*arguments[8],m=0;m<Ie;m++)n+=o,o+=a,a+=l,i+=h,h+=u,u+=f,s+=c,c+=p,p+=g,v.vertex(n,i,s);v.vertex(arguments[6],arguments[7],arguments[8])}},v.texture=function(e){var n=A.$ensureContext();if(e.__texture)n.bindTexture(n.TEXTURE_2D,e.__texture);else if("canvas"===e.localName)n.bindTexture(n.TEXTURE_2D,q),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.generateMipmap(n.TEXTURE_2D),Ze.width=e.width,Ze.height=e.height;else{var r,i=n.createTexture(),s=t.createElement("canvas"),o=s.getContext("2d");if(e.width&e.width-1==0)s.width=e.width;else{for(r=1;r<e.width;)r*=2;s.width=r}if(e.height&e.height-1==0)s.height=e.height;else{for(r=1;r<e.height;)r*=2;s.height=r}o.drawImage(e.sourceImg,0,0,e.width,e.height,0,0,s.width,s.height),n.bindTexture(n.TEXTURE_2D,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR_MIPMAP_LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,s),n.generateMipmap(n.TEXTURE_2D),e.__texture=i,Ze.width=e.width,Ze.height=e.height}je=!0,n.useProgram(N),nn("usingTexture3d",N,"usingTexture",je)},v.textureMode=function(e){We=e};pn.prototype.curveVertex=function(e,t){zt=!0,v.vertex(e,t)},gn.prototype.curveVertex=function(e,t,n){zt=!0,Le||nr();var r=[];r[0]=e,r[1]=t,r[2]=n,Mt.push(r),++$t>3&&function(e,t,n,r,i,s,o,a,l,h,u,f){var c=r,p=i,g=s,m=L.array(),d=m[4]*e+m[5]*r+m[6]*o+m[7]*h,y=m[8]*e+m[9]*r+m[10]*o+m[11]*h,b=m[12]*e+m[13]*r+m[14]*o+m[15]*h,x=m[4]*t+m[5]*i+m[6]*a+m[7]*u,w=m[8]*t+m[9]*i+m[10]*a+m[11]*u,A=m[12]*t+m[13]*i+m[14]*a+m[15]*u,C=m[4]*n+m[5]*s+m[6]*l+m[7]*f,T=m[8]*n+m[9]*s+m[10]*l+m[11]*f,S=m[12]*n+m[13]*s+m[14]*l+m[15]*f;v.vertex(c,p,g);for(var P=0;P<ke;P++)c+=d,d+=y,y+=b,p+=x,x+=w,w+=A,g+=C,C+=T,T+=S,v.vertex(c,p,g)}(Mt[$t-4][0],Mt[$t-4][1],Mt[$t-4][2],Mt[$t-3][0],Mt[$t-3][1],Mt[$t-3][2],Mt[$t-2][0],Mt[$t-2][1],Mt[$t-2][2],Mt[$t-1][0],Mt[$t-1][1],Mt[$t-1][2])},pn.prototype.curve=function(){8===arguments.length&&(v.beginShape(),v.curveVertex(arguments[0],arguments[1]),v.curveVertex(arguments[2],arguments[3]),v.curveVertex(arguments[4],arguments[5]),v.curveVertex(arguments[6],arguments[7]),v.endShape())},gn.prototype.curve=function(){12===arguments.length&&(v.beginShape(),v.curveVertex(arguments[0],arguments[1],arguments[2]),v.curveVertex(arguments[3],arguments[4],arguments[5]),v.curveVertex(arguments[6],arguments[7],arguments[8]),v.curveVertex(arguments[9],arguments[10],arguments[11]),v.endShape())},v.curveTightness=function(e){Re=e},v.curveDetail=function(e){ke=e,nr()},v.rectMode=function(e){be=e},v.imageMode=function(e){switch(e){case 0:hn=ln;break;case 1:hn=un;break;case 3:hn=fn;break;default:throw"Invalid imageMode"}},v.ellipseMode=function(e){xe=e},v.arc=function(e,t,n,r,i,s){if(!(n<=0||s<i)){for(1===xe?(n-=e,r-=t):2===xe?(e-=n,t-=r,n*=2,r*=2):3===xe&&(e-=n/2,t-=r/2);i<0;)i+=6.283185307179586,s+=6.283185307179586;s-i>6.283185307179586&&(i=0,s=6.283185307179586);var o,a,l=n/2,h=r/2,u=e+l,f=t+h,c=0|i*v.RAD_TO_DEG*2-.5,p=0|.5+s*v.RAD_TO_DEG*2;if(ae){var g=fe;for(fe=!1,v.beginShape(),v.vertex(u,f),o=c;o<=p;o++)a=o%720,v.vertex(u+Et[a]*l,f+Pt[a]*h);v.endShape(2),fe=g}if(fe){var m=ae;for(ae=!1,v.beginShape(),o=c;o<=p;o++)a=o%720,v.vertex(u+Et[a]*l,f+Pt[a]*h);v.endShape(),ae=m}}},pn.prototype.line=function(e,t,i,s){if(fe)if(e=n.round(e),i=n.round(i),t=n.round(t),s=n.round(s),e!==i||t!==s){for(var o=r,a=r,l=!0,h=gt.array(),u=[1,0,0,0,1,0],f=0;f<6&&l;f++)l=h[f]===u[f];l&&(e===i?(t>s&&(o=t,t=s,s=o),s++,me%2==1&&y.translate(.5,0)):t===s&&(e>i&&(o=e,e=i,i=o),i++,me%2==1&&y.translate(0,.5)),1===me&&(a=y.lineCap,y.lineCap="butt")),y.beginPath(),y.moveTo(e||0,t||0),y.lineTo(i||0,s||0),qn(),l&&(e===i&&me%2==1?y.translate(-.5,0):t===s&&me%2==1&&y.translate(0,-.5),1===me&&(y.lineCap=a))}else v.point(e,t)},gn.prototype.line=function(e,t,n,i,s,o){if(s!==r&&o!==r||(o=0,s=i,i=n,n=0),e!==i||t!==s||n!==o){var a=[e,t,n,i,s,o],l=new Tn;l.scale(1,-1,1),l.apply(gt.array()),l.transpose(),me>0&&fe&&(y.useProgram(F),rn("model2d",F,"model",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),rn("view2d",F,"view",!1,l.array()),tn("color2d",F,"color",ce),nn("picktype2d",F,"picktype",0),sn("vertex2d",F,"Vertex",3,X),on("aTextureCoord2d",F,"aTextureCoord"),y.bufferData(y.ARRAY_BUFFER,new h(a),y.STREAM_DRAW),y.drawArrays(y.LINES,0,2))}else v.point(e,t,n)},pn.prototype.bezier=function(){if(8!==arguments.length)throw"You must use 8 parameters for bezier() in 2D mode";v.beginShape(),v.vertex(arguments[0],arguments[1]),v.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]),v.endShape()},gn.prototype.bezier=function(){if(12!==arguments.length)throw"You must use 12 parameters for bezier() in 3D mode";v.beginShape(),v.vertex(arguments[0],arguments[1],arguments[2]),v.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]),v.endShape()},v.bezierDetail=function(e){Ie=e},v.bezierPoint=function(e,t,n,r,i){return(1-i)*(1-i)*(1-i)*e+3*(1-i)*(1-i)*i*t+3*(1-i)*i*i*n+i*i*i*r},v.bezierTangent=function(e,t,n,r,i){return 3*i*i*(3*t-e-3*n+r)+6*i*(e-2*t+n)+3*(-e+t)},v.curvePoint=function(e,t,n,r,i){return.5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*i*i+(3*t-e-3*n+r)*i*i*i)},v.curveTangent=function(e,t,n,r,i){return.5*(-e+n+2*(2*e-5*t+4*n-r)*i+3*(3*t-e-3*n+r)*i*i)},v.triangle=function(e,t,n,r,i,s){v.beginShape(9),v.vertex(e,t,0),v.vertex(n,r,0),v.vertex(i,s,0),v.endShape()},v.quad=function(e,t,n,r,i,s,o,a){v.beginShape(16),v.vertex(e,t,0),v.vertex(n,r,0),v.vertex(i,s,0),v.vertex(o,a,0),v.endShape()};pn.prototype.rect=function(e,t,i,s,o,a,l,h){(i||s)&&(1===be?(i-=e,s-=t):2===be?(e-=(i*=2)/2,t-=(s*=2)/2):3===be&&(e-=i/2,t-=s/2),e=n.round(e),t=n.round(t),i=n.round(i),s=n.round(s),o===r?(fe&&me%2==1&&y.translate(.5,.5),y.beginPath(),y.rect(e,t,i,s),jn(),qn(),fe&&me%2==1&&y.translate(-.5,-.5)):function(e,t,i,s,o,a,l,h){h===r&&(a=o,l=o,h=o);var u=i/2,f=s/2;(o>u||o>f)&&(o=n.min(u,f)),(a>u||a>f)&&(a=n.min(u,f)),(l>u||l>f)&&(l=n.min(u,f)),(h>u||h>f)&&(h=n.min(u,f)),ae&&!fe||y.translate(.5,.5),y.beginPath(),y.moveTo(e+o,t),y.lineTo(e+i-a,t),y.quadraticCurveTo(e+i,t,e+i,t+a),y.lineTo(e+i,t+s-l),y.quadraticCurveTo(e+i,t+s,e+i-l,t+s),y.lineTo(e+h,t+s),y.quadraticCurveTo(e,t+s,e,t+s-h),y.lineTo(e,t+o),y.quadraticCurveTo(e,t,e+o,t),ae&&!fe||y.translate(-.5,-.5),jn(),qn()}(e,t,i,s,o,a,l,h))},gn.prototype.rect=function(e,t,n,i,s,o,a,l){if(s!==r)throw"rect() with rounded corners is not supported in 3D mode";1===be?(n-=e,i-=t):2===be?(e-=(n*=2)/2,t-=(i*=2)/2):3===be&&(e-=n/2,t-=i/2);var h=new Tn;h.translate(e,t,0),h.scale(n,i,1),h.transpose();var u=new Tn;if(u.scale(1,-1,1),u.apply(gt.array()),u.transpose(),me>0&&fe&&(y.useProgram(F),rn("model2d",F,"model",!1,h.array()),rn("view2d",F,"view",!1,u.array()),tn("color2d",F,"color",ce),nn("picktype2d",F,"picktype",0),sn("vertex2d",F,"Vertex",3,V),on("aTextureCoord2d",F,"aTextureCoord"),y.drawArrays(y.LINE_LOOP,0,Zt.length/3)),ae){if(y.useProgram(N),rn("model3d",N,"model",!1,h.array()),rn("view3d",N,"view",!1,u.array()),y.enable(y.POLYGON_OFFSET_FILL),y.polygonOffset(1,1),tn("color3d",N,"color",le),xt>0){var f=new Tn;f.set(u);var c=new Tn;c.set(h),f.mult(c);var p=new Tn;p.set(f),p.invert(),p.transpose(),rn("normalTransform3d",N,"normalTransform",!1,p.array()),sn("normal3d",N,"Normal",3,U)}else on("normal3d",N,"Normal");sn("vertex3d",N,"Vertex",3,V),y.drawArrays(y.TRIANGLE_FAN,0,Zt.length/3),y.disable(y.POLYGON_OFFSET_FILL)}},pn.prototype.ellipse=function(e,t,n,r){if(e=e||0,t=t||0,!(n<=0&&r<=0))if(2===xe?(n*=2,r*=2):1===xe?(e+=(n-=e)/2,t+=(r-=t)/2):0===xe&&(e+=n/2,t+=r/2),n===r)y.beginPath(),y.arc(e,t,n/2,0,6.283185307179586,!1),jn(),qn();else{var i=n/2,s=r/2,o=.5522847498307933,a=o*i,l=o*s;v.beginShape(),v.vertex(e+i,t),v.bezierVertex(e+i,t-l,e+a,t-s,e,t-s),v.bezierVertex(e-a,t-s,e-i,t-l,e-i,t),v.bezierVertex(e-i,t+l,e-a,t+s,e,t+s),v.bezierVertex(e+a,t+s,e+i,t+l,e+i,t),v.endShape()}},gn.prototype.ellipse=function(e,t,n,r){if(e=e||0,t=t||0,!(n<=0&&r<=0)){2===xe?(n*=2,r*=2):1===xe?(e+=(n-=e)/2,t+=(r-=t)/2):0===xe&&(e+=n/2,t+=r/2);var i=n/2,s=r/2,o=.5522847498307933,a=o*i,l=o*s;if(v.beginShape(),v.vertex(e+i,t),v.bezierVertex(e+i,t-l,0,e+a,t-s,0,e,t-s,0),v.bezierVertex(e-a,t-s,0,e-i,t-l,0,e-i,t,0),v.bezierVertex(e-i,t+l,0,e-a,t+s,0,e,t+s,0),v.bezierVertex(e+a,t+s,0,e+i,t+l,0,e+i,t,0),v.endShape(),ae){var h,u,f=0,c=0;for(h=0;h<Ft.length;h++)f+=Ft[h][0],c+=Ft[h][1];f/=Ft.length,c/=Ft.length;var p=[],g=[],m=[];for(p[0]=f,p[1]=c,p[2]=0,p[3]=0,p[4]=0,p[5]=le[0],p[6]=le[1],p[7]=le[2],p[8]=le[3],p[9]=ce[0],p[10]=ce[1],p[11]=ce[2],p[12]=ce[3],p[13]=we,p[14]=Ae,p[15]=Ce,Ft.unshift(p),h=0;h<Ft.length;h++){for(u=0;u<3;u++)g.push(Ft[h][u]);for(u=5;u<9;u++)m.push(Ft[h][u])}Qn(g,"TRIANGLE_FAN",m)}}},v.normal=function(e,t,n){if(3!==arguments.length||"number"!=typeof e||"number"!=typeof t||"number"!=typeof n)throw"normal() requires three numeric arguments.";we=e,Ae=t,Ce=n,0!==_e&&(0===Te?Te=1:1===Te&&(Te=2))},v.save=function(t,n){return n!==r?e.open(n.toDataURL(),"_blank"):e.open(v.externals.canvas.toDataURL(),"_blank")};var rr=0;v.saveFrame=function(e){e===r&&(e="screen-####.png");var t=e.replace(/#+/,(function(e){for(var t=""+rr++;t.length<e.length;)t="0"+t;return t}));v.save(t)};var ir=t.createElement("canvas").getContext("2d"),sr=[r,r,r];function or(e,n,i){var s=sr.shift();s===r&&((s={}).canvas=t.createElement("canvas"),s.context=s.canvas.getContext("2d")),sr.push(s);var o=s.canvas,a=s.context,l=n||e.width,h=i||e.height;return o.width=l,o.height=h,e?"data"in e?a.putImageData(e,0,0):(a.clearRect(0,0,l,h),a.drawImage(e,0,0,l,h)):a.clearRect(0,0,l,h),s}var ar=function(e,n,r){if(this.__isDirty=!1,e instanceof HTMLImageElement)this.fromHTMLImageData(e);else if(n||r){this.width=e||1,this.height=n||1;var i=this.sourceImg=t.createElement("canvas");i.width=this.width,i.height=this.height;this.imageData=i.getContext("2d").createImageData(this.width,this.height);if(this.format=2===r||4===r?r:1,1===this.format)for(var s=3,o=this.imageData.data,a=o.length;s<a;s+=4)o[s]=255;this.__isDirty=!0,this.updatePixels()}else this.width=0,this.height=0,this.imageData=ir.createImageData(1,1),this.format=2;var l,h;this.pixels={getLength:(h=l=this,function(){if(h.isRemote)throw"Image is loaded remotely. Cannot get length.";return h.imageData.data.length?h.imageData.data.length/4:0}),getPixel:function(e){return function(t){var n=4*t,r=e.imageData.data;if(e.isRemote)throw"Image is loaded remotely. Cannot get pixels.";return(255&r[n+3])<<24|(255&r[n])<<16|(255&r[n+1])<<8|255&r[n+2]}}(l),setPixel:function(e){return function(t,n){var r=4*t,i=e.imageData.data;if(e.isRemote)throw"Image is loaded remotely. Cannot set pixel.";i[r+0]=n>>16&255,i[r+1]=n>>8&255,i[r+2]=255&n,i[r+3]=n>>24&255,e.__isDirty=!0}}(l),toArray:function(e){return function(){var t=[],n=e.imageData.data,r=e.width*e.height;if(e.isRemote)throw"Image is loaded remotely. Cannot get pixels.";for(var i=0,s=0;i<r;i++,s+=4)t.push((255&n[s+3])<<24|(255&n[s])<<16|(255&n[s+1])<<8|255&n[s+2]);return t}}(l),set:function(e){return function(t){var n,r,i;if(this.isRemote)throw"Image is loaded remotely. Cannot set pixels.";r=e.imageData.data;for(var s=0,o=t.length;s<o;s++)i=t[s],r[0+(n=4*s)]=i>>16&255,r[n+1]=i>>8&255,r[n+2]=255&i,r[n+3]=i>>24&255;e.__isDirty=!0}}(l)}};function lr(e,t,n,r){var i=new ar(n,r,2);return i.fromImageData(v.toImageData(e,t,n,r)),i}function hr(e,t,r,i,s){if(s.isRemote)throw"Image is loaded remotely. Cannot get x,y,w,h.";for(var o=new ar(r,i,2),a=o.imageData.data,l=s.width,h=s.height,u=s.imageData.data,f=n.max(0,-t),c=n.max(0,-e),p=n.min(i,h-t),g=n.min(r,l-e),m=f;m<p;++m)for(var d=4*((t+m)*l+(e+c)),v=4*(m*r+c),y=c;y<g;++y)a[v++]=u[d++],a[v++]=u[d++],a[v++]=u[d++],a[v++]=u[d++];return o.__isDirty=!0,o}function ur(){ot&&(y=te,ot=!1,v.updatePixels())}function fr(){function e(e,t){e[t]=function(){ur(),y[t].apply(y,arguments)}}function t(e,t){v.defineProperty(e,t,{get:function(){return ur(),y[t]},set:function(e){ur(),y[t]=e}})}for(var n in y)"function"==typeof y[n]?e(this,n):t(this,n)}function cr(e,t,n){e<v.width&&e>=0&&t>=0&&t<v.height&&(ot||(v.loadPixels(),null===st&&(te=y,st=new fr),ot=!0,y=st,ne=0),v.pixels.setPixel((0|e)+v.width*(0|t),n),++ne>at&&ur())}function pr(e,t,n,r){if(r.isRemote)throw"Image is loaded remotely. Cannot set x,y.";var i=v.color.toArray(n),s=t*r.width*4+4*e,o=r.imageData.data;o[s]=i[0],o[s+1]=i[1],o[s+2]=i[2],o[s+3]=i[3]}ar.prototype={__isPImage:!0,updatePixels:function(){var e=this.sourceImg;e&&e instanceof HTMLCanvasElement&&this.__isDirty&&e.getContext("2d").putImageData(this.imageData,0,0),this.__isDirty=!1},fromHTMLImageData:function(e){var t=or(e);try{var n=t.context.getImageData(0,0,e.width,e.height);this.fromImageData(n)}catch(t){e.width&&e.height&&(this.isRemote=!0,this.width=e.width,this.height=e.height)}this.sourceImg=e},get:function(e,t,n,r){return arguments.length?2===arguments.length?v.get(e,t,this):4===arguments.length?v.get(e,t,n,r,this):void 0:v.get(this)},set:function(e,t,n){v.set(e,t,n,this),this.__isDirty=!0},blend:function(e,t,n,r,i,s,o,a,l,h){9===arguments.length?v.blend(this,e,t,n,r,i,s,o,a,l,this):10===arguments.length&&v.blend(e,t,n,r,i,s,o,a,l,h,this),delete this.sourceImg},copy:function(e,t,n,r,i,s,o,a,l){8===arguments.length?v.blend(this,e,t,n,r,i,s,o,a,0,this):9===arguments.length&&v.blend(e,t,n,r,i,s,o,a,l,0,this),delete this.sourceImg},filter:function(e,t){2===arguments.length?v.filter(e,t,this):1===arguments.length&&v.filter(e,null,this),delete this.sourceImg},save:function(e){v.save(e,this)},resize:function(e,t){if(this.isRemote)throw"Image is loaded remotely. Cannot resize.";if(0!==this.width||0!==this.height){0===e&&0!==t?e=n.floor(this.width/this.height*t):0===t&&0!==e&&(t=n.floor(this.height/this.width*e));var r=or(this.imageData).canvas,i=or(r,e,t).context.getImageData(0,0,e,t);this.fromImageData(i)}},mask:function(e){var t,n,r=this.toImageData();if(e instanceof ar||e.__isPImage){if(e.width!==this.width||e.height!==this.height)throw"mask must have the same dimensions as PImage.";for(e=e.toImageData(),t=2,n=this.width*this.height*4;t<n;t+=4)r.data[t+1]=e.data[t]}else if(e instanceof Array){if(this.width*this.height!==e.length)throw"mask array must be the same length as PImage pixels array.";for(t=0,n=e.length;t<n;++t)r.data[4*t+3]=e[t]}this.fromImageData(r)},loadPixels:i,toImageData:function(){return this.isRemote?this.sourceImg:this.__isDirty?or(this.imageData).context.getImageData(0,0,this.width,this.height):this.imageData},toDataURL:function(){if(this.isRemote)throw"Image is loaded remotely. Cannot create dataURI.";return or(this.imageData).canvas.toDataURL()},fromImageData:function(e){var n=e.width,r=e.height,i=t.createElement("canvas"),s=i.getContext("2d");this.width=i.width=n,this.height=i.height=r,s.putImageData(e,0,0),this.format=2,this.imageData=e,this.sourceImg=i}},v.PImage=ar,v.createImage=function(e,t,n){return new ar(e,t,n)},v.loadImage=function(e,n,r){var i;if(n&&(e=e+"."+n),x.imageCache.images[e])return(i=new ar(x.imageCache.images[e])).loaded=!0,i;i=new ar;var s=t.createElement("img");return i.sourceImg=s,s.onload=function(e,t,n){var r=e,i=t,s=n;return function(){i.fromHTMLImageData(r),i.loaded=!0,s&&s()}}(s,i,r),s.src=e,i},v.requestImage=v.loadImage,v.get=function(e,t,n,r,i){return void 0!==i?hr(e,t,n,r,i):void 0!==r?lr(e,t,n,r):void 0!==n?function(e,t,n){if(n.isRemote)throw"Image is loaded remotely. Cannot get x,y.";var r=t*n.width*4+4*e,i=n.imageData.data;return(255&i[r+3])<<24|(255&i[r])<<16|(255&i[r+1])<<8|255&i[r+2]}(e,t,n):void 0!==t?function(e,t){var n;if(e>=v.width||e<0||t<0||t>=v.height)return 0;if(ot){var r=4*((0|e)+v.width*(0|t));return(255&(n=v.imageData.data)[r+3])<<24|(255&n[r])<<16|(255&n[r+1])<<8|255&n[r+2]}return(255&(n=v.toImageData(0|e,0|t,1,1).data)[3])<<24|(255&n[0])<<16|(255&n[1])<<8|255&n[2]}(e,t):void 0!==e?hr(0,0,e.width,e.height,e):lr(0,0,v.width,v.height)},v.createGraphics=function(e,t,n){var r=new E;return r.size(e,t,n),r},v.set=function(e,t,n,r){3===arguments.length?"number"==typeof n?cr(e,t,n):(n instanceof ar||n.__isPImage)&&v.image(n,e,t):4===arguments.length&&pr(e,t,n,r)},v.imageData={},v.pixels={getLength:function(){return v.imageData.data.length?v.imageData.data.length/4:0},getPixel:function(e){var t=4*e,n=v.imageData.data;return n[t+3]<<24&4278190080|n[t+0]<<16&16711680|n[t+1]<<8&65280|255&n[t+2]},setPixel:function(e,t){var n=4*e,r=v.imageData.data;r[n+0]=(16711680&t)>>>16,r[n+1]=(65280&t)>>>8,r[n+2]=255&t,r[n+3]=(4278190080&t)>>>24},toArray:function(){for(var e=[],t=v.imageData.width*v.imageData.height,n=v.imageData.data,r=0,i=0;r<t;r++,i+=4)e.push(n[i+3]<<24&4278190080|n[i+0]<<16&16711680|n[i+1]<<8&65280|255&n[i+2]);return e},set:function(e){for(var t=0,n=e.length;t<n;t++)this.setPixel(t,e[t])}},v.loadPixels=function(){v.imageData=A.$ensureContext().getImageData(0,0,v.width,v.height)},v.updatePixels=function(){v.imageData&&A.$ensureContext().putImageData(v.imageData,0,0)},v.hint=function(e){var t=A.$ensureContext();4===e?(t.disable(t.DEPTH_TEST),t.depthMask(!1),t.clear(t.DEPTH_BUFFER_BIT)):-4===e&&(t.enable(t.DEPTH_TEST),t.depthMask(!0))};var gr=function(e,t,n,r){var i;if(e instanceof ar||e.__isPImage){if(!(i=e).loaded)throw"Error using image in background(): PImage not loaded.";if(i.width!==v.width||i.height!==v.height)throw"Background image must be the same dimensions as the canvas."}else i=v.color(e,t,n,r);De=i};pn.prototype.background=function(e,t,n,i){e!==r&&gr(e,t,n,i),De instanceof ar||De.__isPImage?(_n(),y.setTransform(1,0,0,1,0,0),v.image(De,0,0),Rn()):(_n(),y.setTransform(1,0,0,1,0,0),v.alpha(De)!==Oe&&y.clearRect(0,0,v.width,v.height),y.fillStyle=v.color.toString(De),y.fillRect(0,0,v.width,v.height),ue=!0,Rn())},gn.prototype.background=function(e,t,n,r){arguments.length>0&&gr(e,t,n,r);var i=v.color.toGLArray(De);y.clearColor(i[0],i[1],i[2],i[3]),y.clear(y.COLOR_BUFFER_BIT|y.DEPTH_BUFFER_BIT)},pn.prototype.image=function(e,t,r,i,s){if(t=n.round(t),r=n.round(r),e.width>0){i||e.width,s||e.height;var o=hn(t||0,r||0,i||e.width,s||e.height,arguments.length<4),a=!!e.sourceImg&&null===Ve;if(a){var l=e.sourceImg;e.__isDirty&&e.updatePixels(),y.drawImage(l,0,0,l.width,l.height,o.x,o.y,o.w,o.h)}else{var h=e.toImageData();null!==Ve&&(Ve(h),e.__isDirty=!0),y.drawImage(or(h).canvas,0,0,e.width,e.height,o.x,o.y,o.w,o.h)}}},gn.prototype.image=function(e,t,r,i,s){e.width>0&&(t=n.round(t),r=n.round(r),i=i||e.width,s=s||e.height,v.beginShape(v.QUADS),v.texture(e),v.vertex(t,r,0,0,0),v.vertex(t,r+s,0,0,s),v.vertex(t+i,r+s,0,i,s),v.vertex(t+i,r,0,i,0),v.endShape())},v.tint=function(e,t,n,r){var i=v.color(e,t,n,r),s=v.red(i)/Ne,o=v.green(i)/Fe,a=v.blue(i)/Me,l=v.alpha(i)/Oe;Ve=function(e){for(var t=e.data,n=4*e.width*e.height,r=0;r<n;)t[r++]*=s,t[r++]*=o,t[r++]*=a,t[r++]*=l},Ue=function(e){for(var t=0;t<e.length;)e[t++]=s,e[t++]=o,e[t++]=a,e[t++]=l}},v.noTint=function(){Ve=null,Ue=null},v.copy=function(e,t,n,i,s,o,a,l,h){h===r&&(h=l,l=a,a=o,o=s,s=i,i=n,n=t,t=e,e=v),v.blend(e,t,n,i,s,o,a,l,h,0)},v.blend=function(e,t,n,i,s,o,a,l,h,u,f){if(e.isRemote)throw"Image is loaded remotely. Cannot blend image.";u===r&&(u=h,h=l,l=a,a=o,o=s,s=i,i=n,n=t,t=e,e=v);var c=t+i,p=n+s,g=o+l,m=a+h,d=f||v;f!==r&&u!==r||v.loadPixels(),e.loadPixels(),e===v&&v.intersect(t,n,c,p,o,a,g,m)?v.blit_resize(v.get(t,n,c-t,p-n),0,0,c-t-1,p-n-1,d.imageData.data,d.width,d.height,o,a,g,m,u):v.blit_resize(e,t,n,c,p,d.imageData.data,d.width,d.height,o,a,g,m,u),f===r&&v.updatePixels()};var mr=function(e,t){var n,r,i,s,o,a,l,u,f,c,p,g,m,d,y,b=t.pixels.getLength(),x=new h(b),w=new h(b),A=new h(b),C=new h(b),T=0;!function(e){var t,n=v.floor(3.5*e);if(n=n<1?1:n<248?n:248,v.shared.blurRadius!==n){v.shared.blurRadius=n,v.shared.blurKernelSize=1+(v.shared.blurRadius<<1),v.shared.blurKernel=new h(v.shared.blurKernelSize);var r=v.shared.blurKernel,i=v.shared.blurKernelSize;v.shared.blurRadius;for(t=0;t<i;t++)r[t]=0;var s=(n-1)*(n-1);for(t=1;t<n;t++)r[n+t]=r[void 0]=s;r[n]=n*n}}(e);var S=t.height,P=t.width,E=v.shared.blurKernelSize,_=v.shared.blurRadius,R=v.shared.blurKernel,k=t.imageData.data;for(m=0;m<S;m++){for(g=0;g<P;g++){if(s=i=r=o=n=0,(l=g-_)<0)p=-l,l=0;else{if(l>=P)break;p=0}for(d=p;d<E&&!(l>=P);d++)y=4*(l+T),o+=(a=R[d])*k[y+3],r+=a*k[y],i+=a*k[y+1],s+=a*k[y+2],n+=a,l++;C[u=T+g]=o/n,x[u]=r/n,w[u]=i/n,A[u]=s/n}T+=P}for(T=0,c=(f=-_)*P,m=0;m<S;m++){for(g=0;g<P;g++){if(s=i=r=o=n=0,f<0)p=u=-f,l=g;else{if(f>=S)break;p=0,u=f,l=g+c}for(d=p;d<E&&!(u>=S);d++)o+=(a=R[d])*C[l],r+=a*x[l],i+=a*w[l],s+=a*A[l],n+=a,u++,l+=P;k[y=4*(g+T)]=r/n,k[y+1]=i/n,k[y+2]=s/n,k[y+3]=o/n}T+=P,c+=P,f++}},dr=function(e,t){var n,r,i,s,o,a,l,h,f,c,p,g,m,d,v,y,b,x=0,w=t.pixels.getLength(),A=new u(w);if(e)for(;x<w;)for(n=x,r=x+t.width;x<r;)i=s=t.pixels.getPixel(x),(l=x-1)<n&&(l=x),(a=x+1)>=r&&(a=x),(h=x-t.width)<0&&(h=0),(f=x+t.width)>=w&&(f=x),g=t.pixels.getPixel(h),p=t.pixels.getPixel(l),m=t.pixels.getPixel(f),(v=77*(p>>16&255)+151*(p>>8&255)+28*(255&p))<(o=77*(i>>16&255)+151*(i>>8&255)+28*(255&i))&&(s=p,o=v),(d=77*((c=t.pixels.getPixel(a))>>16&255)+151*(c>>8&255)+28*(255&c))<o&&(s=c,o=d),(y=77*(g>>16&255)+151*(g>>8&255)+28*(255&g))<o&&(s=g,o=y),(b=77*(m>>16&255)+151*(m>>8&255)+28*(255&m))<o&&(s=m,o=b),A[x++]=s;else for(;x<w;)for(n=x,r=x+t.width;x<r;)i=s=t.pixels.getPixel(x),(l=x-1)<n&&(l=x),(a=x+1)>=r&&(a=x),(h=x-t.width)<0&&(h=0),(f=x+t.width)>=w&&(f=x),g=t.pixels.getPixel(h),p=t.pixels.getPixel(l),m=t.pixels.getPixel(f),(v=77*(p>>16&255)+151*(p>>8&255)+28*(255&p))>(o=77*(i>>16&255)+151*(i>>8&255)+28*(255&i))&&(s=p,o=v),(d=77*((c=t.pixels.getPixel(a))>>16&255)+151*(c>>8&255)+28*(255&c))>o&&(s=c,o=d),(y=77*(g>>16&255)+151*(g>>8&255)+28*(255&g))>o&&(s=g,o=y),(b=77*(m>>16&255)+151*(m>>8&255)+28*(255&m))>o&&(s=m,o=b),A[x++]=s;t.pixels.set(A)};v.filter=function(e,t,n){var i,s,o,a;if(3===arguments.length?(n.loadPixels(),i=n):(v.loadPixels(),i=v),t===r&&(t=null),i.isRemote)throw"Image is loaded remotely. Cannot filter image.";var l=i.pixels.getLength();switch(e){case 11:var h=t||1;mr(h,i);break;case 12:if(4===i.format){for(a=0;a<l;a++)s=255-i.pixels.getPixel(a),i.pixels.setPixel(a,4278190080|s<<16|s<<8|s);i.format=1}else for(a=0;a<l;a++)o=77*((s=i.pixels.getPixel(a))>>16&255)+151*(s>>8&255)+28*(255&s)>>8,i.pixels.setPixel(a,4278190080&s|o<<16|o<<8|o);break;case 13:for(a=0;a<l;a++)i.pixels.setPixel(a,16777215^i.pixels.getPixel(a));break;case 15:if(null===t)throw"Use filter(POSTERIZE, int levels) instead of filter(POSTERIZE)";var u=v.floor(t);if(u<2||u>255)throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)";var f=u-1;for(a=0;a<l;a++){var c=i.pixels.getPixel(a)>>16&255,p=i.pixels.getPixel(a)>>8&255,g=255&i.pixels.getPixel(a);c=255*(c*u>>8)/f,p=255*(p*u>>8)/f,g=255*(g*u>>8)/f,i.pixels.setPixel(a,4278190080&i.pixels.getPixel(a)|c<<16|p<<8|g)}break;case 14:for(a=0;a<l;a++)i.pixels.setPixel(a,4278190080|i.pixels.getPixel(a));i.format=1;break;case 16:if(null===t&&(t=.5),t<0||t>1)throw"Level must be between 0 and 1 for filter(THRESHOLD, level)";var m=v.floor(255*t);for(a=0;a<l;a++){var d=v.max((16711680&i.pixels.getPixel(a))>>16,v.max((65280&i.pixels.getPixel(a))>>8,255&i.pixels.getPixel(a)));i.pixels.setPixel(a,4278190080&i.pixels.getPixel(a)|(d<m?0:16777215))}break;case 17:dr(!0,i);break;case 18:dr(!1,i)}i.updatePixels()},v.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},v.intersect=function(e,t,n,r,i,s,o,a){var l=n-e+1,h=r-t+1,u=o-i+1,f=a-s+1;if(i<e)(u+=i-e)>l&&(u=l);else{var c=l+e-i;u>c&&(u=c)}if(s<t)(f+=s-t)>h&&(f=h);else{var p=h+t-s;f>p&&(f=p)}return!(u<=0||f<=0)};var vr,yr,br={};function xr(e){return e instanceof String?e:"number"==typeof e?e===(0|e)?e.toString():v.nf(e,0,3):null===e||e===r?"":e.toString()}function wr(e,t,n,r){var i,s;e.indexOf("\n")<0?(i=[e],s=1):s=(i=e.split(/\r?\n/g)).length;var o=0;101===Ke?o=tt+nt:3===Ke?o=tt/2-(s-1)*rt/2:102===Ke&&(o=-(nt+(s-1)*rt));for(var a=0;a<s;++a){var l=i[a];A.text$line(l,t,n+o,r,qe),o+=rt}}function Ar(e,t,r,i,s,o){if(0!==e.length&&0!==i&&0!==s&&!(et>s)){for(var a=-1,l=0,h=0,u=[],f=0,c=e.length;f<c;f++){var p=e[f],g=" "===p,m=it.measureTextWidth(p);if("\n"!==p&&h+m<=i)g&&(a=f),h+=m;else{if(a+1===l){if(!(f>0))return;a=f}"\n"===p?(u.push({text:e.substring(l,f),width:h}),l=f+1):(u.push({text:e.substring(l,a+1),width:h}),l=a+1),h=0,f=l-1}}l<c&&u.push({text:e.substring(l),width:h});var d=1,v=tt;3===qe?d=i/2:39===qe&&(d=i);var y,b,x,w=u.length,C=n.min(w,n.floor(s/rt));for(101===Ke?v=tt+nt:3===Ke?v=s/2-rt*(C/2-1):102===Ke&&(v=nt+rt),y=0;y<w&&!(v+(x=y*rt)>s-nt);y++)b=u[y],A.text$line(b.text,t+d,r+v+x,o,qe)}}function Cr(e){for(var t in A="3D"===e?new gn:"2D"===e?new pn:new mn,mn.prototype)mn.prototype.hasOwnProperty(t)&&t.indexOf("$")<0&&(v[t]=A[t]);A.$init()}function Tr(e){return function(){return Cr("2D"),A[e].apply(this,arguments)}}function Sr(t,n){var r=t,i=0,s=0;if(v.pmouseX=v.mouseX,v.pmouseY=v.mouseY,r.offsetParent)do{i+=r.offsetLeft,s+=r.offsetTop}while(r=r.offsetParent);r=t;do{i-=r.scrollLeft||0,s-=r.scrollTop||0}while(r=r.parentNode);return i+=re,s+=ie,i+=se,s+=oe,{X:i+=e.pageXOffset,Y:s+=e.pageYOffset}}function Pr(e,t){var n=Sr(e);v.mouseX=t.pageX-n.X,v.mouseY=t.pageY-n.Y}function Er(e){var t,n=Sr(e.changedTouches[0].target,e.changedTouches[0]);for(t=0;t<e.touches.length;t++){var r=e.touches[t];r.offsetX=r.pageX-n.X,r.offsetY=r.pageY-n.Y}for(t=0;t<e.targetTouches.length;t++){var i=e.targetTouches[t];i.offsetX=i.pageX-n.X,i.offsetY=i.pageY-n.Y}for(t=0;t<e.changedTouches.length;t++){var s=e.changedTouches[t];s.offsetX=s.pageX-n.X,s.offsetY=s.pageY-n.Y}return e}br[1]=v.modes.blend,br[2]=v.modes.add,br[4]=v.modes.subtract,br[8]=v.modes.lightest,br[16]=v.modes.darkest,br[0]=v.modes.replace,br[32]=v.modes.difference,br[64]=v.modes.exclusion,br[128]=v.modes.multiply,br[256]=v.modes.screen,br[512]=v.modes.overlay,br[1024]=v.modes.hard_light,br[2048]=v.modes.soft_light,br[4096]=v.modes.dodge,br[8192]=v.modes.burn,v.blit_resize=function(e,t,r,i,s,o,a,l,h,u,f,c,p){var g,m;t<0&&(t=0),r<0&&(r=0),i>=e.width&&(i=e.width-1),s>=e.height&&(s=e.height-1);var d=i-t,y=s-r,b=f-h,x=c-u;if(!(b<=0||x<=0||d<=0||y<=0||h>=a||u>=l||t>=e.width||r>=e.height)){var w=n.floor(d/b*32768),A=n.floor(y/x*32768),C=v.shared;C.srcXOffset=n.floor(h<0?-h*w:32768*t),C.srcYOffset=n.floor(u<0?-u*A:32768*r),h<0&&(b+=h,h=0),u<0&&(x+=u,u=0),b=n.min(b,a-h),x=n.min(x,l-u);var T,S=u*a+h;C.srcBuffer=e.imageData.data,C.iw=e.width,C.iw1=e.width-1,C.ih1=e.height-1;v.filter_bilinear,v.filter_new_scanline;var P,E,_,R,k,L,D=br[p],I=C.srcBuffer,O=n.min;for(m=0;m<x;m++){for(C.sX=C.srcXOffset,C.fracV=32767&C.srcYOffset,C.ifV=32767-C.fracV,C.v1=(C.srcYOffset>>15)*C.iw,C.v2=O(1+(C.srcYOffset>>15),C.ih1)*C.iw,g=0;g<b;g++)T=o[(E=4*(S+g))+3]<<24&4278190080|o[E]<<16&16711680|o[E+1]<<8&65280|255&o[E+2],C.fracU=32767&C.sX,C.ifU=32767-C.fracU,C.ul=C.ifU*C.ifV>>15,C.ll=C.ifU*C.fracV>>15,C.ur=C.fracU*C.ifV>>15,C.lr=C.fracU*C.fracV>>15,C.u1=C.sX>>15,C.u2=O(C.u1+1,C.iw1),_=4*(C.v1+C.u1),R=4*(C.v1+C.u2),k=4*(C.v2+C.u1),L=4*(C.v2+C.u2),C.cUL=I[_+3]<<24&4278190080|I[_]<<16&16711680|I[_+1]<<8&65280|255&I[_+2],C.cUR=I[R+3]<<24&4278190080|I[R]<<16&16711680|I[R+1]<<8&65280|255&I[R+2],C.cLL=I[k+3]<<24&4278190080|I[k]<<16&16711680|I[k+1]<<8&65280|255&I[k+2],C.cLR=I[L+3]<<24&4278190080|I[L]<<16&16711680|I[L+1]<<8&65280|255&I[L+2],C.r=C.ul*((16711680&C.cUL)>>16)+C.ll*((16711680&C.cLL)>>16)+C.ur*((16711680&C.cUR)>>16)+C.lr*((16711680&C.cLR)>>16)<<1&16711680,C.g=C.ul*(65280&C.cUL)+C.ll*(65280&C.cLL)+C.ur*(65280&C.cUR)+C.lr*(65280&C.cLR)>>>15&65280,C.b=C.ul*(255&C.cUL)+C.ll*(255&C.cLL)+C.ur*(255&C.cUR)+C.lr*(255&C.cLR)>>>15,C.a=C.ul*((4278190080&C.cUL)>>>24)+C.ll*((4278190080&C.cLL)>>>24)+C.ur*((4278190080&C.cUR)>>>24)+C.lr*((4278190080&C.cLR)>>>24)<<9&4278190080,P=D(T,C.a|C.r|C.g|C.b),o[E]=(16711680&P)>>>16,o[E+1]=(65280&P)>>>8,o[E+2]=255&P,o[E+3]=(4278190080&P)>>>24,C.sX+=w;S+=a,C.srcYOffset+=A}}},v.loadFont=function(e,t){if(e===r)throw"font name required in loadFont.";if(-1===e.indexOf(".svg"))return t===r&&(t=it.size),P.get(e,t);var n=v.loadGlyphs(e);return{name:e,css:"12px sans-serif",glyph:!0,units_per_em:n.units_per_em,horiz_adv_x:1/n.units_per_em*n.horiz_adv_x,ascent:n.ascent,descent:n.descent,width:function(t){for(var n=0,r=t.length,i=0;i<r;i++)try{n+=parseFloat(v.glyphLook(v.glyphTable[e],t[i]).horiz_adv_x)}catch(e){E.debug(e)}return n/v.glyphTable[e].units_per_em}}},v.createFont=function(e,t){return v.loadFont(e,t)},v.textFont=function(e,t){t!==r&&(e.glyph||(e=P.get(e.name,t)),et=t),Qe=(it=e).name,tt=it.ascent,nt=it.descent,rt=it.leading,A.$ensureContext().font=it.css},v.textSize=function(e){e!==et&&(it=P.get(Qe,e),et=e,tt=it.ascent,nt=it.descent,rt=it.leading,A.$ensureContext().font=it.css)},v.textAscent=function(){return tt},v.textDescent=function(){return nt},v.textLeading=function(e){rt=e},v.textAlign=function(e,t){qe=e,Ke=t||0},pn.prototype.textWidth=function(e){var t,r=xr(e).split(/\r?\n/g),i=0,s=r.length;for(y.font=it.css,t=0;t<s;++t)i=n.max(i,it.measureTextWidth(r[t]));return 0|i},gn.prototype.textWidth=function(e){var i,s=xr(e).split(/\r?\n/g),o=0,a=s.length;_===r&&(_=t.createElement("canvas"));var l=_.getContext("2d");for(l.font=it.css,i=0;i<a;++i)o=n.max(o,l.measureText(s[i]).width);return 0|o},v.glyphLook=function(e,t){try{switch(t){case"1":return e.one;case"2":return e.two;case"3":return e.three;case"4":return e.four;case"5":return e.five;case"6":return e.six;case"7":return e.seven;case"8":return e.eight;case"9":return e.nine;case"0":return e.zero;case" ":return e.space;case"$":return e.dollar;case"!":return e.exclam;case'"':return e.quotedbl;case"#":return e.numbersign;case"%":return e.percent;case"&":return e.ampersand;case"'":return e.quotesingle;case"(":return e.parenleft;case")":return e.parenright;case"*":return e.asterisk;case"+":return e.plus;case",":return e.comma;case"-":return e.hyphen;case".":return e.period;case"/":return e.slash;case"_":return e.underscore;case":":return e.colon;case";":return e.semicolon;case"<":return e.less;case"=":return e.equal;case">":return e.greater;case"?":return e.question;case"@":return e.at;case"[":return e.bracketleft;case"\\":return e.backslash;case"]":return e.bracketright;case"^":return e.asciicircum;case"`":return e.grave;case"{":return e.braceleft;case"|":return e.bar;case"}":return e.braceright;case"~":return e.asciitilde;default:return e[t]}}catch(e){E.debug(e)}},pn.prototype.text$line=function(e,t,n,r,i){var s=0,o=0;if(it.glyph){var a=v.glyphTable[Qe];_n(),y.translate(t,n+et),39!==i&&3!==i||(s=a.width(e),o=39===i?-s:-s/2);var l=1/a.units_per_em*et;y.scale(l,l);for(var h=0,u=e.length;h<u;h++)try{v.glyphLook(a,e[h]).draw()}catch(e){E.debug(e)}Rn()}else e&&"fillText"in y&&(ue&&(y.fillStyle=v.color.toString(he),ue=!1),39!==i&&3!==i||(s=it.measureTextWidth(e),o=39===i?-s:-s/2),y.fillText(e,t+o,n))},gn.prototype.text$line=function(e,n,i,s,o){_===r&&(_=t.createElement("canvas"));var a=y;(y=_.getContext("2d")).font=it.css;var l=it.measureTextWidth(e);_.width=l,_.height=et,(y=_.getContext("2d")).font=it.css,y.textBaseline="top",pn.prototype.text$line(e,0,0,0,37);var h=_.width/_.height;(y=a).bindTexture(y.TEXTURE_2D,K),y.texImage2D(y.TEXTURE_2D,0,y.RGBA,y.RGBA,y.UNSIGNED_BYTE,_),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,y.LINEAR),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,y.CLAMP_TO_EDGE),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,y.CLAMP_TO_EDGE);var u=0;39===o?u=-l:3===o&&(u=-l/2);var f=new Tn,c=.5*et;f.translate(n+u-c/2,i-c,s),f.scale(-h*c,-c,c),f.translate(-1,-1,-1),f.transpose();var p=new Tn;p.scale(1,-1,1),p.apply(gt.array()),p.transpose(),y.useProgram(F),sn("vertex2d",F,"Vertex",3,J),sn("aTextureCoord2d",F,"aTextureCoord",2,Q),nn("uSampler2d",F,"uSampler",[0]),nn("picktype2d",F,"picktype",1),rn("model2d",F,"model",!1,f.array()),rn("view2d",F,"view",!1,p.array()),tn("color2d",F,"color",le),y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,ee),y.drawElements(y.TRIANGLES,6,y.UNSIGNED_SHORT,0)},v.text=function(){5!==Je&&(3===arguments.length?wr(xr(arguments[0]),arguments[1],arguments[2],0):4===arguments.length?wr(xr(arguments[0]),arguments[1],arguments[2],arguments[3]):5===arguments.length?Ar(xr(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0):6===arguments.length&&Ar(xr(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))},v.textMode=function(e){Je=e},v.loadGlyphs=function(i){var s,o,a,l,h,u,f,c,p,g,m,d,y=function(e,t){var n,r=0,i=[],s=new RegExp(e,"g");for(n=i[r]=s.exec(t);n;)n=i[++r]=s.exec(t);return i},b=function(e){var t=y("[A-Za-z][0-9\\- ]+|Z",e);d="return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();",s=0,o=0,a=0,l=0,h=0,u=0,e=0,c=0,p="",g=t.length-1;for(var r=0;r<g;r++){var i=t[r][0],f=y("[0-9\\-]+",i);switch(i[0]){case"M":s=parseFloat(f[0][0]),o=parseFloat(f[1][0]),d+="curContext.moveTo("+s+","+-o+");";break;case"L":s=parseFloat(f[0][0]),o=parseFloat(f[1][0]),d+="curContext.lineTo("+s+","+-o+");";break;case"H":s=parseFloat(f[0][0]),d+="curContext.lineTo("+s+","+-o+");";break;case"V":o=parseFloat(f[0][0]),d+="curContext.lineTo("+s+","+-o+");";break;case"T":h=parseFloat(f[0][0]),u=parseFloat(f[1][0]),"Q"===p||"T"===p?(e=n.sqrt(n.pow(s-a,2)+n.pow(l-o,2)),c=n.PI+n.atan2(a-s,l-o),a=s+n.sin(c)*e,l=o+n.cos(c)*e):(a=s,l=o),d+="curContext.quadraticCurveTo("+a+","+-l+","+h+","+-u+");",s=h,o=u;break;case"Q":a=parseFloat(f[0][0]),l=parseFloat(f[1][0]),h=parseFloat(f[2][0]),u=parseFloat(f[3][0]),d+="curContext.quadraticCurveTo("+a+","+-l+","+h+","+-u+");",s=h,o=u;break;case"Z":d+="curContext.closePath();"}p=i[0]}return d+="afterPathDraw();",d+="curContext.translate("+m+",0);",d+="}}",new Function("beforePathDraw","afterPathDraw",d)((function(){return _n(),A.$ensureContext()}),(function(){jn(),qn(),Rn()}))},x=function(e){var t=e.getElementsByTagName("font");v.glyphTable[i].horiz_adv_x=t[0].getAttribute("horiz-adv-x");var n=e.getElementsByTagName("font-face")[0];v.glyphTable[i].units_per_em=parseFloat(n.getAttribute("units-per-em")),v.glyphTable[i].ascent=parseFloat(n.getAttribute("ascent")),v.glyphTable[i].descent=parseFloat(n.getAttribute("descent"));for(var s=e.getElementsByTagName("glyph"),o=s.length,a=0;a<o;a++){var l=s[a].getAttribute("unicode"),h=s[a].getAttribute("glyph-name");null===(m=s[a].getAttribute("horiz-adv-x"))&&(m=v.glyphTable[i].horiz_adv_x),(f=s[a].getAttribute("d"))!==r&&(d=b(f),v.glyphTable[i][h]={name:h,unicode:l,horiz_adv_x:m,draw:d.draw})}};return v.glyphTable[i]={},function(){var n;try{n=t.implementation.createDocument("","",null)}catch(e){return void E.debug(e.message)}try{n.async=!1,n.load(i),x(n.getElementsByTagName("svg")[0])}catch(t){E.debug(t);try{var r=new e.XMLHttpRequest;r.open("GET",i,!1),r.send(null),x(r.responseXML.documentElement)}catch(e){E.debug(t)}}}(),v.glyphTable[i]},v.param=function(e){var t="data-processing-"+e;if(l.hasAttribute(t))return l.getAttribute(t);for(var n=0,r=l.childNodes.length;n<r;++n){var i=l.childNodes.item(n);if(1===i.nodeType&&"param"===i.tagName.toLowerCase()&&i.getAttribute("name")===e)return i.getAttribute("value")}return x.params.hasOwnProperty(e)?x.params[e]:null},mn.prototype.translate=Tr("translate"),mn.prototype.scale=Tr("scale"),mn.prototype.pushMatrix=Tr("pushMatrix"),mn.prototype.popMatrix=Tr("popMatrix"),mn.prototype.resetMatrix=Tr("resetMatrix"),mn.prototype.applyMatrix=Tr("applyMatrix"),mn.prototype.rotate=Tr("rotate"),mn.prototype.rotateZ=Tr("rotateZ"),mn.prototype.redraw=Tr("redraw"),mn.prototype.toImageData=Tr("toImageData"),mn.prototype.ambientLight=Tr("ambientLight"),mn.prototype.directionalLight=Tr("directionalLight"),mn.prototype.lightFalloff=Tr("lightFalloff"),mn.prototype.lightSpecular=Tr("lightSpecular"),mn.prototype.pointLight=Tr("pointLight"),mn.prototype.noLights=Tr("noLights"),mn.prototype.spotLight=Tr("spotLight"),mn.prototype.beginCamera=Tr("beginCamera"),mn.prototype.endCamera=Tr("endCamera"),mn.prototype.frustum=Tr("frustum"),mn.prototype.box=Tr("box"),mn.prototype.sphere=Tr("sphere"),mn.prototype.ambient=Tr("ambient"),mn.prototype.emissive=Tr("emissive"),mn.prototype.shininess=Tr("shininess"),mn.prototype.specular=Tr("specular"),mn.prototype.fill=Tr("fill"),mn.prototype.stroke=Tr("stroke"),mn.prototype.strokeWeight=Tr("strokeWeight"),mn.prototype.smooth=Tr("smooth"),mn.prototype.noSmooth=Tr("noSmooth"),mn.prototype.point=Tr("point"),mn.prototype.vertex=Tr("vertex"),mn.prototype.endShape=Tr("endShape"),mn.prototype.bezierVertex=Tr("bezierVertex"),mn.prototype.curveVertex=Tr("curveVertex"),mn.prototype.curve=Tr("curve"),mn.prototype.line=Tr("line"),mn.prototype.bezier=Tr("bezier"),mn.prototype.rect=Tr("rect"),mn.prototype.ellipse=Tr("ellipse"),mn.prototype.background=Tr("background"),mn.prototype.image=Tr("image"),mn.prototype.textWidth=Tr("textWidth"),mn.prototype.text$line=Tr("text$line"),mn.prototype.$ensureContext=Tr("$ensureContext"),mn.prototype.$newPMatrix=Tr("$newPMatrix"),mn.prototype.size=function(e,t,n){Cr(2===n?"3D":"2D"),v.size(e,t,n)},mn.prototype.$init=i,pn.prototype.$init=function(){v.size(v.width,v.height),y.lineCap="round",v.noSmooth(),v.disableContextMenu()},gn.prototype.$init=function(){v.use3DContext=!0},cn.prototype.$ensureContext=function(){return y},Dn(l,"touchstart",(function(e){l.setAttribute("style","-webkit-user-select: none"),l.setAttribute("onclick","void(0)"),l.setAttribute("style","-webkit-tap-highlight-color:rgba(0,0,0,0)");for(var t=0,n=Ln.length;t<n;t++){var i=Ln[t].type;"mouseout"!==i&&"mousemove"!==i&&"mousedown"!==i&&"mouseup"!==i&&"DOMMouseScroll"!==i&&"mousewheel"!==i&&"touchstart"!==i||In(Ln[t])}v.touchStart!==r||v.touchMove!==r||v.touchEnd!==r||v.touchCancel!==r?(Dn(l,"touchstart",(function(e){v.touchStart!==r&&(e=Er(e),v.touchStart(e))})),Dn(l,"touchmove",(function(e){v.touchMove!==r&&(e.preventDefault(),e=Er(e),v.touchMove(e))})),Dn(l,"touchend",(function(e){v.touchEnd!==r&&(e=Er(e),v.touchEnd(e))})),Dn(l,"touchcancel",(function(e){v.touchCancel!==r&&(e=Er(e),v.touchCancel(e))}))):(Dn(l,"touchstart",(function(e){Pr(l,e.touches[0]),v.__mousePressed=!0,v.mouseDragging=!1,v.mouseButton=37,"function"==typeof v.mousePressed&&v.mousePressed()})),Dn(l,"touchmove",(function(e){e.preventDefault(),Pr(l,e.touches[0]),"function"!=typeof v.mouseMoved||v.__mousePressed||v.mouseMoved(),"function"==typeof v.mouseDragged&&v.__mousePressed&&(v.mouseDragged(),v.mouseDragging=!0)})),Dn(l,"touchend",(function(e){v.__mousePressed=!1,"function"!=typeof v.mouseClicked||v.mouseDragging||v.mouseClicked(),"function"==typeof v.mouseReleased&&v.mouseReleased()}))),l.dispatchEvent(e)})),vr=!0,yr=function(e){e.preventDefault(),e.stopPropagation()},v.disableContextMenu=function(){vr&&(Dn(l,"contextmenu",yr),vr=!1)},v.enableContextMenu=function(){vr||(In({elem:l,type:"contextmenu",fn:yr}),vr=!0)},Dn(l,"mousemove",(function(e){Pr(l,e),"function"!=typeof v.mouseMoved||v.__mousePressed||v.mouseMoved(),"function"==typeof v.mouseDragged&&v.__mousePressed&&(v.mouseDragged(),v.mouseDragging=!0)})),Dn(l,"mouseout",(function(e){"function"==typeof v.mouseOut&&v.mouseOut()})),Dn(l,"mouseover",(function(e){Pr(l,e),"function"==typeof v.mouseOver&&v.mouseOver()})),Dn(l,"mousedown",(function(e){switch(v.__mousePressed=!0,v.mouseDragging=!1,e.which){case 1:v.mouseButton=37;break;case 2:v.mouseButton=3;break;case 3:v.mouseButton=39}"function"==typeof v.mousePressed&&v.mousePressed()})),Dn(l,"mouseup",(function(e){v.__mousePressed=!1,"function"!=typeof v.mouseClicked||v.mouseDragging||v.mouseClicked(),"function"==typeof v.mouseReleased&&v.mouseReleased()}));var _r,Rr=function(t){var n=0;t.wheelDelta?(n=t.wheelDelta/120,e.opera&&(n=-n)):t.detail&&(n=-t.detail/3),v.mouseScroll=n,n&&"function"==typeof v.mouseScrolled&&v.mouseScrolled()};function kr(e){var t=e.which||e.keyCode;switch(t){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 t}function Lr(e){return"function"==typeof e.preventDefault?e.preventDefault():"function"==typeof e.stopPropagation&&e.stopPropagation(),!1}function Dr(){var e;for(e in lt)if(lt.hasOwnProperty(e))return void(v.__keyPressed=!0);v.__keyPressed=!1}function Ir(){v.__keyPressed=!1,lt=[],ht=null}function Or(e,t){lt[e]=t,ht=null,v.key=t,v.keyCode=e,v.keyPressed(),v.keyCode=0,v.keyTyped(),Dr()}if(Dn(t,"DOMMouseScroll",Rr),Dn(t,"mousewheel",Rr),"string"==typeof l&&(l=t.getElementById(l)),l.getAttribute("tabindex")||l.setAttribute("tabindex",0),m)x=new E.Sketch,Cr(),v.size=function(e,t,n){Cr(n&&2===n?"3D":"2D"),v.size(e,t,n)};else{x=a instanceof E.Sketch?a:"function"==typeof a?new E.Sketch(a):a?E.compile(a):new E.Sketch((function(){})),v.externals.sketch=x,Cr(),l.onfocus=function(){v.focused=!0},l.onblur=function(){v.focused=!1,x.options.globalKeyEvents||Ir()},x.options.pauseOnBlur&&(Dn(e,"focus",(function(){ve&&v.loop()})),Dn(e,"blur",(function(){ve&&de&&(v.noLoop(),ve=!0),Ir()})));var Nr=x.options.globalKeyEvents?e:l;for(var Fr in Dn(Nr,"keydown",(function(e){var t=kr(e);if(127!==t){if(!(ut.indexOf(t)<0)){var n=new vn(65535);return v.key=n,v.keyCode=t,lt[t]=n,v.keyPressed(),ht=null,Dr(),Lr(e)}ht=t}else Or(t,new vn(127))})),Dn(Nr,"keypress",(function(e){if(null!==ht)return Or(ht,function(e){var t=e.which||e.keyCode,n=e.shiftKey||e.ctrlKey||e.altKey||e.metaKey;switch(t){case 13:t=n?13:10;break;case 8:t=n?127:8}return new vn(t)}(e)),Lr(e)})),Dn(Nr,"keyup",(function(e){var t=kr(e),n=lt[t];n!==r&&(v.key=n,v.keyCode=t,v.keyReleased(),delete lt[t],Dr())})),E.lib)E.lib.hasOwnProperty(Fr)&&(E.lib[Fr].hasOwnProperty("attach")?E.lib[Fr].attach(v):E.lib[Fr]instanceof Function&&E.lib[Fr].call(this));var Mr=function(n){if(x.imageCache.pending||P.preloading.pending(100))e.setTimeout((function(){Mr(n)}),100);else{if(e.opera){var r,i,s=x.imageCache.operaCache;for(r in s)s.hasOwnProperty(r)&&(null!==(i=s[r])&&t.body.removeChild(i),delete s[r])}x.attach(n,w),x.onLoad(n),n.setup&&(n.setup(),n.resetMatrix(),x.onSetup()),ur(),n.draw&&(ve?n.loop():n.redraw())}};(_r=this).externals.canvas.id!==r&&_r.externals.canvas.id.length||(_r.externals.canvas.id="__processing"+T.length),S[_r.externals.canvas.id]=T.length,T.push(_r),Mr(v)}};function _(e){var t=function(){var e,t,n=["abs","acos","alpha","ambient","ambientLight","append","applyMatrix","arc","arrayCopy","asin","atan","atan2","background","beginCamera","beginDraw","beginShape","bezier","bezierDetail","bezierPoint","bezierTangent","bezierVertex","binary","blend","blendColor","blit_resize","blue","box","breakShape","brightness","camera","ceil","Character","color","colorMode","concat","constrain","copy","cos","createFont","createGraphics","createImage","cursor","curve","curveDetail","curvePoint","curveTangent","curveTightness","curveVertex","day","degrees","directionalLight","disableContextMenu","dist","draw","ellipse","ellipseMode","emissive","enableContextMenu","endCamera","endDraw","endShape","exit","exp","expand","externals","fill","filter","floor","focused","frameCount","frameRate","frustum","get","glyphLook","glyphTable","green","height","hex","hint","hour","hue","image","imageMode","intersect","join","key","keyCode","keyPressed","keyReleased","keyTyped","lerp","lerpColor","lightFalloff","lights","lightSpecular","line","link","loadBytes","loadFont","loadGlyphs","loadImage","loadPixels","loadShape","loadStrings","log","loop","mag","map","match","matchAll","max","millis","min","minute","mix","modelX","modelY","modelZ","modes","month","mouseButton","mouseClicked","mouseDragged","mouseMoved","mouseOut","mouseOver","mousePressed","mouseReleased","mouseScroll","mouseScrolled","mouseX","mouseY","name","nf","nfc","nfp","nfs","noCursor","noFill","noise","noiseDetail","noiseSeed","noLights","noLoop","norm","normal","noSmooth","noStroke","noTint","ortho","param","parseBoolean","parseByte","parseChar","parseFloat","parseInt","peg","perspective","PImage","pixels","PMatrix2D","PMatrix3D","PMatrixStack","pmouseX","pmouseY","point","pointLight","popMatrix","popStyle","pow","print","printCamera","println","printMatrix","printProjection","PShape","PShapeSVG","pushMatrix","pushStyle","quad","radians","random","Random","randomSeed","rect","rectMode","red","redraw","requestImage","resetMatrix","reverse","rotate","rotateX","rotateY","rotateZ","round","saturation","save","saveFrame","saveStrings","scale","screenX","screenY","screenZ","second","set","setup","shape","shapeMode","shared","shininess","shorten","sin","size","smooth","sort","specular","sphere","sphereDetail","splice","split","splitTokens","spotLight","sq","sqrt","status","str","stroke","strokeCap","strokeJoin","strokeWeight","subset","tan","text","textAlign","textAscent","textDescent","textFont","textLeading","textMode","textSize","texture","textureMode","textWidth","tint","toImageData","touchCancel","touchEnd","touchMove","touchStart","translate","triangle","trim","unbinary","unhex","updatePixels","use3DContext","vertex","width","XMLElement","year","__contains","__equals","__equalsIgnoreCase","__frameRate","__hashCode","__int_cast","__instanceof","__keyPressed","__mousePressed","__printStackTrace","__replace","__replaceAll","__replaceFirst","__toCharArray","__split","__codePointAt","__startsWith","__endsWith"],r={};for(e=0,t=n.length;e<t;++e)r[n[e]]=null;for(var i in E.lib)if(E.lib.hasOwnProperty(i)&&E.lib[i].exports){var s=E.lib[i].exports;for(e=0,t=s.length;e<t;++e)r[s[e]]=null}return r}();function n(e){var t,n=/^\s*/.exec(e);if(n[0].length===e.length)t={left:n[0],middle:"",right:""};else{var r=/\s*$/.exec(e);t={left:n[0],middle:e.substring(n[0].length,r.index),right:r[0]}}return t.untrim=function(e){return this.left+e+this.right},t}function i(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}function s(e,t){for(var n=0,r=t.length;n<r;++n)e[t[n]]=null;return e}function o(e){return e.substring(2,e.length-1)}var a,l=e.replace(/\r\n?|\n\r/g,"\n"),h=[],u=l.replace(/("(?:[^"\\\n]|\\.)*")|('(?:[^'\\\n]|\\.)*')|(([\[\(=|&!\^:?]\s*)(\/(?![*\/])(?:[^\/\\\n]|\\.)*\/[gim]*)\b)|(\/\/[^\n]*\n)|(\/\*(?:(?!\*\/)(?:.|\n))*\*\/)/g,(function(e,t,n,r,i,s,o,a){var l;return t||n?(l=h.length,h.push(e),"'"+l+"'"):r?(l=h.length,h.push(s),i+"'"+l+"'"):""!==a?" ":"\n"})),f=function(e,t,n,r){return t||r?e:(a=!0,"")};do{a=!1,u=u.replace(/([<]?)<\s*((?:\?|[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s+(?:extends|super)\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)?(?:\s*,\s*(?:\?|[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s+(?:extends|super)\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)?)*)\s*>([=]?)/g,f)}while(a);var c,g,m,d,v,y,b,x=function(e){for(var t=[],n=e.split(/([\{\[\(\)\]\}])/),r=n[0],i=[],s=1;s<n.length;s+=2){var o=n[s];if("["===o||"{"===o||"("===o)i.push(r),r=o;else if("]"===o||"}"===o||")"===o){var a="}"===o?"A":")"===o?"B":"C",l=t.length;t.push(r+o),r=i.pop()+'"'+a+(l+1)+'"'}r+=n[s+1]}return t.unshift(r),t}(u),A={},C=0;function T(e,t){var n=x.length;return x.push(e),'"'+t+n+'"'}function S(){return"class"+ ++C}function P(e,t,n){e.classId=t,e.scopeId=n,A[t]=e}var _=/\b((?:(?:public|private|final|protected|static|abstract)\s+)*)(class|interface)\s+([A-Za-z_$][\w$]*\b)(\s+extends\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?(\s+implements\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?\s*("A\d+")/g,R=/\b((?:(?:public|private|final|protected|static|abstract|synchronized)\s+)*)((?!(?:else|new|return|throw|function|public|private|protected)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+"|;)/g,k=/^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:else|new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*(?:"C\d+"\s*)*([=,]|$)/,L=/\b((?:(?:public|private|final|protected|static|abstract)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+")/g,D=/^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*/,I=/\bfunction(?:\s+([A-Za-z_$][\w$]*))?\s*("B\d+")\s*("A\d+")/g;function O(e){var t=e;return t=(t=(t=t.replace(_,(function(e){return T(e,"E")}))).replace(R,(function(e){return T(e,"D")}))).replace(I,(function(e){return T(e,"H")}))}function N(e,t){return e.replace(L,(function(e,n,r,i,s,o){return r!==t?e:T(e,"G")}))}function F(e){this.name=e}function M(e){this.params=e}function $(e){var t=i(e.substring(1,e.length-1)),n=[];if(""!==t)for(var r=t.split(","),s=0;s<r.length;++s){var o=/\b([A-Za-z_$][\w$]*\b)(\s*"[ABC][\d]*")*\s*$/.exec(r[s]);n.push(new F(o[1]))}return new M(n)}function z(e,t){this.baseInterfaceName=e,this.body=t,t.owner=this}function B(e,t,n){this.name=e,this.params=t,this.body=n}function V(e){var t=new RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/).exec(e);return new B("function"!==t[1]?t[1]:null,$(x[t[2]]),v(x[t[3]]))}function U(e){this.members=e}function G(e){if("("===e.charAt(0)||"["===e.charAt(0))return e.charAt(0)+G(e.substring(1,e.length-1))+e.charAt(e.length-1);if("{"===e.charAt(0))return/^\{\s*(?:[A-Za-z_$][\w$]*|'\d+')\s*:/.test(e)?"{"+T(e.substring(1,e.length-1),"I")+"}":"["+G(e.substring(1,e.length-1))+"]";var t=n(e),r=function(e){var t,r=e;function i(e,r,i,s){var o=x[s];t=!0;var a=n(o.substring(1,o.length-1));return"__"+i+(""===a.middle?T("("+r.replace(/\.\s*$/,"")+")","B"):T("("+r.replace(/\.\s*$/,"")+","+a.middle+")","B"))}r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=(r=r.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"C\d+")+\s*("A\d+")/g,(function(e,t,n){return n}))).replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"B\d+")\s*("A\d+")/g,(function(e,t,n){return T(e,"F")}))).replace(I,(function(e){return T(e,"H")}))).replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*("C\d+"(?:\s*"C\d+")*)/g,(function(e,t,n){var r=n.replace(/"C(\d+)"/g,(function(e,t){return x[t]})).replace(/\[\s*\]/g,"[null]").replace(/\s*\]\s*\[\s*/g,", "),i="('"+t+"', "+T("{"+r.substring(1,r.length-1)+"}","A")+")";return"$p.createJavaArray"+T(i,"B")}))).replace(/(\.\s*length)\s*"B\d+"/g,"$1")).replace(/#([0-9A-Fa-f]{6})\b/g,(function(e,t){return"0xFF"+t}))).replace(/"B(\d+)"(\s*(?:[\w$']|"B))/g,(function(e,t,n){var r=x[t];if(!/^\(\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\s*(?:"C\d+"\s*)*\)$/.test(r))return e;if(/^\(\s*int\s*\)$/.test(r))return"(int)"+n;var i=r.split(/"C(\d+)"/g);return i.length>1&&!/^\[\s*\]$/.test(x[i[1]])?e:""+n}))).replace(/\(int\)([^,\]\)\}\?\:\*\+\-\/\^\|\%\&\~<\>\=]+)/g,(function(e,t){var r=n(t);return r.untrim("__int_cast("+r.middle+")")}))).replace(/\bsuper(\s*"B\d+")/g,"$$superCstr$1").replace(/\bsuper(\s*\.)/g,"$$super$1")).replace(/\b0+((\d*)(?:\.[\d*])?(?:[eE][\-\+]?\d+)?[fF]?)\b/,(function(e,t,n){return t===n?e:""===n?"0"+t:t}))).replace(/\b(\.?\d+\.?)[fF]\b/g,"$1")).replace(/([^\s])%([^=\s])/g,"$1 % $2")).replace(/\b(frameRate|keyPressed|mousePressed)\b(?!\s*"B)/g,"__$1")).replace(/\b(boolean|byte|char|float|int)\s*"B/g,(function(e,t){return"parse"+t.substring(0,1).toUpperCase()+t.substring(1)+'"B'}))).replace(/\bpixels\b\s*(("C(\d+)")|\.length)?(\s*=(?!=)([^,\]\)\}]+))?/g,(function(e,t,n,r,i,s){if(n){var o=x[r];return i?"pixels.setPixel"+T("("+o.substring(1,o.length-1)+","+s+")","B"):"pixels.getPixel"+T("("+o.substring(1,o.length-1)+")","B")}return t?"pixels.getLength"+T("()","B"):i?"pixels.set"+T("("+s+")","B"):"pixels.toArray"+T("()","B")}));do{t=!1,r=r.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*\.\s*(?:[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*\.\s*)*)(replace|replaceAll|replaceFirst|contains|equals|equalsIgnoreCase|hashCode|toCharArray|printStackTrace|split|startsWith|endsWith|codePointAt)\s*"B(\d+)"/g,i)}while(t);function s(e,n,r){return t=!0,"__instanceof"+T("("+n+", "+r+")","B")}do{t=!1,r=r.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*(?:\.\s*[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*)*)instanceof\s+([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)/g,s)}while(t);return r=r.replace(/\bthis(\s*"B\d+")/g,"$$constr$1")}(t.middle);return r=r.replace(/"[ABC](\d+)"/g,(function(e,t){return G(x[t])})),t.untrim(r)}function X(e,t){this.expr=e,this.transforms=t}function Y(e,t,n){this.name=e,this.value=t,this.isDefault=n}function H(e,t){var n,r,s,o=e.indexOf("=");return o<0?(n=e,r=t,s=!0):(n=e.substring(0,o),r=b(e.substring(o+1)),s=!1),new Y(i(n.replace(/(\s*"C\d+")+/g,"")),r,s)}function Z(e){return"int"===e||"float"===e?"0":"boolean"===e?"false":"color"===e?"0x00000000":"null"}function W(e,t){this.definitions=e,this.varType=t}function j(e){this.expression=e}function q(e){if(k.test(e)){for(var t=D.exec(e),n=e.substring(t[0].length).split(","),r=Z(t[2]),i=0;i<n.length;++i)n[i]=H(n[i],r);return new W(n,t[2])}return new j(b(e))}function K(e,t,n){this.initStatement=e,this.condition=t,this.step=n}function J(e,t){this.initStatement=e,this.container=t}function Q(e,t){this.initStatement=e,this.container=t}function ee(e){e.sort((function(e,t){return t.weight-e.weight}))}function te(e,t,n){this.name=e,this.body=t,this.isStatic=n,t.owner=this}function ne(e,t,n){this.name=e,this.body=t,this.isStatic=n,t.owner=this}function re(e){var t=_.exec(e);_.lastIndex=0;var n,r=t[1].indexOf("static")>=0,i=x[o(t[6])],s=g,a=S();return g=a,P(n="interface"===t[2]?new te(t[3],d(i,t[3],t[4]),r):new ne(t[3],m(i,t[3],t[4],t[5]),r),a,s),g=s,n}function ie(e,t,n,r){this.name=e,this.params=t,this.body=n,this.isStatic=r}function se(e){var t=R.exec(e);R.lastIndex=0;var n=t[1].indexOf("static")>=0,r=";"!==t[6]?x[o(t[6])]:"{}";return new ie(t[3],$(x[o(t[4])]),v(r),n)}function oe(e,t,n){this.definitions=e,this.fieldType=t,this.isStatic=n}function ae(e){for(var t=D.exec(e),n=t[1].indexOf("static")>=0,r=e.substring(t[0].length).split(/,\s*/g),i=Z(t[2]),s=0;s<r.length;++s)r[s]=H(r[s],i);return new oe(r,t[2],n)}function le(e,t){this.params=e,this.body=t}function he(e,t,n,r,i,s){var o,a;for(this.name=e,this.interfacesNames=t,this.methodsNames=n,this.fields=r,this.innerClasses=i,this.misc=s,o=0,a=r.length;o<a;++o)r[o].owner=this}function ue(e,t,n,r,i,s,o,a,l){var h,u;for(this.name=e,this.baseClassName=t,this.interfacesNames=n,this.functions=r,this.methods=i,this.fields=s,this.cstrs=o,this.innerClasses=a,this.misc=l,h=0,u=s.length;h<u;++h)s[h].owner=this}function fe(e,t){this.name=e,this.body=t,t.owner=this}function ce(e,t){this.name=e,this.body=t,t.owner=this}function pe(e){var t=_.exec(e);_.lastIndex=0;var n,r=x[o(t[6])],i=g,s=S();return g=s,P(n="interface"===t[2]?new fe(t[3],d(r,t[3],t[4])):new ce(t[3],m(r,t[3],t[4],t[5])),s,i),g=i,n}function ge(e,t,n){this.name=e,this.params=t,this.body=n}function me(e){var t=R.exec(e);R.lastIndex=0;return new ge(t[3],$(x[o(t[4])]),v(x[o(t[6])]))}function de(e,t){this.argument=e,this.misc=t}function ve(e,t){this.argument=e,this.misc=t}function ye(e,t,n){this.name=e,this.argument=t,this.misc=n}function be(e){this.expr=e}function xe(e){this.label=e}function we(e){for(var t=[],n=0,r=e.length;n<r;++n){var i=e[n];i instanceof W?t=t.concat(i.getNames()):i instanceof de&&i.argument.initStatement instanceof W?t=t.concat(i.argument.initStatement.getNames()):(i instanceof te||i instanceof ne||i instanceof fe||i instanceof ce||i instanceof ge||i instanceof B)&&t.push(i.name)}return s({},t)}function Ae(e){this.statements=e}function Ce(e){this.statements=e}F.prototype.toString=function(){return this.name},M.prototype.getNames=function(){for(var e=[],t=0,n=this.params.length;t<n;++t)e.push(this.params[t].name);return e},M.prototype.toString=function(){if(0===this.params.length)return"()";for(var e="(",t=0,n=this.params.length;t<n;++t)e+=this.params[t]+", ";return e.substring(0,e.length-2)+")"},z.prototype.toString=function(){return"new ("+this.body+")"},B.prototype.toString=function(){var e=c,t=s({this:null},this.params.getNames());c=function(n){return t.hasOwnProperty(n.name)?n.name:e(n)};var n="function";return this.name&&(n+=" "+this.name),n+=this.params+" "+this.body,c=e,n},U.prototype.toString=function(){var e=c;c=function(t){return"this"===t.name?"this":e(t)};for(var t="",n=0,r=this.members.length;n<r;++n)this.members[n].label&&(t+=this.members[n].label+": "),t+=this.members[n].value.toString()+", ";return c=e,t.substring(0,t.length-2)},X.prototype.toString=function(){var e=this.transforms;return function(e){return e.replace(/(\.\s*)?((?:\b[A-Za-z_]|\$)[\w$]*)(\s*\.\s*([A-Za-z_$][\w$]*)(\s*\()?)?/g,(function(e,t,n,i,s,o){return t?e:c({name:n,member:s,callSign:!!o})+(i===r?"":i)}))}(this.expr).replace(/"!(\d+)"/g,(function(t,n){return e[n].toString()}))},b=function(e){var t=[],n=G(e);return new X(n=(n=(n=n.replace(/"H(\d+)"/g,(function(e,n){return t.push(V(x[n])),'"!'+(t.length-1)+'"'}))).replace(/"F(\d+)"/g,(function(e,n){return t.push(function(e){var t=new RegExp(/\bnew\s*([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)\s*"B\d+"\s*"A(\d+)"/).exec(e),n=g,r=S();g=r;var i=t[1]+"$"+r,s=new z(i,m(x[t[2]],i,"","implements "+t[1]));return P(s,r,n),g=n,s}(x[n])),'"!'+(t.length-1)+'"'}))).replace(/"I(\d+)"/g,(function(e,n){return t.push(function(e){for(var t=e.split(","),n=0;n<t.length;++n){var r=t[n].indexOf(":");t[n]=r<0?{value:b(t[n])}:{label:i(t[n].substring(0,r)),value:b(i(t[n].substring(r+1)))}}return new U(t)}(x[n])),'"!'+(t.length-1)+'"'})),t)},Y.prototype.toString=function(){return this.name+" = "+this.value},W.prototype.getNames=function(){for(var e=[],t=0,n=this.definitions.length;t<n;++t)e.push(this.definitions[t].name);return e},W.prototype.toString=function(){return"var "+this.definitions.join(",")},j.prototype.toString=function(){return this.expression.toString()},K.prototype.toString=function(){return"("+this.initStatement+"; "+this.condition+"; "+this.step+")"},J.prototype.toString=function(){var e=this.initStatement.toString();return e.indexOf("=")>=0&&(e=e.substring(0,e.indexOf("="))),"("+e+" in "+this.container+")"},Q.iteratorId=0,Q.prototype.toString=function(){var e=this.initStatement.toString(),t="$it"+Q.iteratorId++,n=e.replace(/^\s*var\s*/,"").split("=")[0];return"("+("var "+t+" = new $p.ObjectIterator("+this.container+"), "+n+" = void(0)")+"; "+(t+".hasNext() && (("+n+" = "+t+".next()) || true)")+";)"},te.prototype.toString=function(){return""+this.body},ne.prototype.toString=function(){return""+this.body},ie.prototype.toString=function(){var e=s({},this.params.getNames()),t=c;c=function(n){return e.hasOwnProperty(n.name)?n.name:t(n)};var n="function "+this.methodId+this.params+" "+this.body+"\n";return c=t,n},oe.prototype.getNames=function(){for(var e=[],t=0,n=this.definitions.length;t<n;++t)e.push(this.definitions[t].name);return e},oe.prototype.toString=function(){var e=c({name:"[this]"});if(this.isStatic){for(var t=this.owner.name,n=[],r=0,i=this.definitions.length;r<i;++r){var s=this.definitions[r],o=s.name,a=t+"."+o,l="if("+a+" === void(0)) {\n "+a+" = "+s.value+"; }\n$p.defineProperty("+e+", '"+o+"', { get: function(){return "+a+";}, set: function(val){"+a+" = val;} });\n";n.push(l)}return n.join("")}return e+"."+this.definitions.join("; "+e+".")},le.prototype.toString=function(){var e=s({},this.params.getNames()),t=c;c=function(n){return e.hasOwnProperty(n.name)?n.name:t(n)};var n="function $constr_"+this.params.params.length+this.params.toString(),r=this.body.toString();return/\$(superCstr|constr)\b/.test(r)||(r="{\n$superCstr();\n"+r.substring(1)),c=t,n+r+"\n"},he.prototype.getMembers=function(e,t,n){var r,i,s,o;for(this.owner.base&&this.owner.base.body.getMembers(e,t,n),r=0,s=this.fields.length;r<s;++r){var a=this.fields[r].getNames();for(i=0,o=a.length;i<o;++i)e[a[i]]=this.fields[r]}for(r=0,s=this.methodsNames.length;r<s;++r){t[this.methodsNames[r]]=!0}for(r=0,s=this.innerClasses.length;r<s;++r){var l=this.innerClasses[r];n[l.name]=l}},he.prototype.toString=function(){!function(e){for(var t=0;e;)++t,e=e.scope}(this.owner);var e,t,n=this.name,r="",i="";if(this.getMembers({},{},{}),this.owner.interfaces){var s,o=[];for(e=0,t=this.interfacesNames.length;e<t;++e)this.owner.interfaces[e]&&(s=c({name:this.interfacesNames[e]}),o.push(s),r+="$p.extendInterfaceMembers("+n+", "+s+");\n");i+=n+".$interfaces = ["+o.join(", ")+"];\n"}for(i+=n+".$isInterface = true;\n",i+=n+".$methods = ['"+this.methodsNames.join("', '")+"'];\n",ee(this.innerClasses),e=0,t=this.innerClasses.length;e<t;++e){var a=this.innerClasses[e];a.isStatic&&(r+=n+"."+a.name+" = "+a+";\n")}for(e=0,t=this.fields.length;e<t;++e){var l=this.fields[e];l.isStatic&&(r+=n+"."+l.definitions.join(";\n"+n+".")+";\n")}return"(function() {\nfunction "+n+"() { throw 'Unable to create the interface'; }\n"+r+i+"return "+n+";\n})()"},d=function(e,t,i){var s=e.substring(1,e.length-1);s=N(s=O(s),t);var o,a,l,h=[],u=[],f=(s=s.replace(/"([DE])(\d+)"/g,(function(e,t,n){return"D"===t?h.push(n):"E"===t&&u.push(n),""}))).split(/;(?:\s*;)*/g);for(i!==r&&(o=i.replace(/^\s*extends\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)),a=0,l=h.length;a<l;++a){var c=se(x[h[a]]);h[a]=c.name}for(a=0,l=f.length-1;a<l;++a){var p=n(f[a]);f[a]=ae(p.middle)}var g=f.pop();for(a=0,l=u.length;a<l;++a)u[a]=re(x[u[a]]);return new he(t,o,h,f,u,{tail:g})},ue.prototype.getMembers=function(e,t,n){var r,i,s,o;for(this.owner.base&&this.owner.base.body.getMembers(e,t,n),r=0,s=this.fields.length;r<s;++r){var a=this.fields[r].getNames();for(i=0,o=a.length;i<o;++i)e[a[i]]=this.fields[r]}for(r=0,s=this.methods.length;r<s;++r){var l=this.methods[r];t[l.name]=l}for(r=0,s=this.innerClasses.length;r<s;++r){var h=this.innerClasses[r];n[h.name]=h}},ue.prototype.toString=function(){var e="$this_"+function(e){for(var t=0;e;)++t,e=e.scope;return t}(this.owner),t=this.name,n="var "+e+" = this;\n",r="",s="",o={},a={},l={};this.getMembers(o,a,l);var h,u,f,p,g,m=c;if(c=function(n){var r=n.name;return"this"===r?n.callSign||!n.member?e+".$self":e:o.hasOwnProperty(r)?o[r].isStatic?t+"."+r:e+"."+r:l.hasOwnProperty(r)?e+"."+r:a.hasOwnProperty(r)?a[r].isStatic?t+"."+r:e+".$self."+r:m(n)},this.baseClassName?(h=m({name:this.baseClassName}),n+="var $super = { $upcast: "+e+" };\n",n+="function $superCstr(){"+h+".apply($super,arguments);if(!('$self' in $super)) $p.extendClassChain($super)}\n",s+=t+".$base = "+h+";\n"):n+="function $superCstr(){$p.extendClassChain("+e+")}\n",this.owner.base&&(r+="$p.extendStaticMembers("+t+", "+h+");\n"),this.owner.interfaces){var d,v=[];for(u=0,f=this.interfacesNames.length;u<f;++u)this.owner.interfaces[u]&&(d=m({name:this.interfacesNames[u]}),v.push(d),r+="$p.extendInterfaceMembers("+t+", "+d+");\n");s+=t+".$interfaces = ["+v.join(", ")+"];\n"}for(this.functions.length>0&&(n+=this.functions.join("\n")+"\n"),ee(this.innerClasses),u=0,f=this.innerClasses.length;u<f;++u){var y=this.innerClasses[u];y.isStatic?(r+=t+"."+y.name+" = "+y+";\n",n+=e+"."+y.name+" = "+t+"."+y.name+";\n"):n+=e+"."+y.name+" = "+y+";\n"}for(u=0,f=this.fields.length;u<f;++u){var b=this.fields[u];if(b.isStatic)for(r+=t+"."+b.definitions.join(";\n"+t+".")+";\n",p=0,g=b.definitions.length;p<g;++p){var x=b.definitions[p].name,w=t+"."+x;n+="$p.defineProperty("+e+", '"+x+"', {get: function(){return "+w+"}, set: function(val){"+w+" = val}});\n"}else n+=e+"."+b.definitions.join(";\n"+e+".")+";\n"}var A={};for(u=0,f=this.methods.length;u<f;++u){var C=this.methods[u],T=A[C.name],S=C.name+"$"+C.params.params.length;T?S+="_"+ ++T:T=1,C.methodId=S,A[C.name]=T,C.isStatic?(r+=C,r+="$p.addMethod("+t+", '"+C.name+"', "+S+");\n",n+="$p.addMethod("+e+", '"+C.name+"', "+S+");\n"):(n+=C,n+="$p.addMethod("+e+", '"+C.name+"', "+S+");\n")}n+=i(this.misc.tail),this.cstrs.length>0&&(n+=this.cstrs.join("\n")+"\n"),n+="function $constr() {\n";var P=[];for(u=0,f=this.cstrs.length;u<f;++u){var E=this.cstrs[u].params.params.length;P.push("if(arguments.length === "+E+") { $constr_"+E+".apply("+e+", arguments); }")}return P.length>0&&(n+=P.join(" else ")+" else "),n+="$superCstr();\n}\n",c=m,"(function() {\nfunction "+t+"() {\n"+(n+="$constr.apply(null, arguments);\n")+"}\n"+r+s+"return "+t+";\n})()"},m=function(e,t,i,s){var o=e.substring(1,e.length-1);o=N(o=O(o),t);var a,l,h,u=[],f=[],c=[],p=[],g=(o=o.replace(/"([DEGH])(\d+)"/g,(function(e,t,n){return"D"===t?u.push(n):"E"===t?f.push(n):"H"===t?p.push(n):c.push(n),""}))).replace(/^(?:\s*;)+/,"").split(/;(?:\s*;)*/g);for(i!==r&&(a=i.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g,"$1")),s!==r&&(l=s.replace(/^\s*implements\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)),h=0;h<p.length;++h)p[h]=V(x[p[h]]);for(h=0;h<u.length;++h)u[h]=se(x[u[h]]);for(h=0;h<g.length-1;++h){var m=n(g[h]);g[h]=ae(m.middle)}var d,y,b=g.pop();for(h=0;h<c.length;++h)c[h]=(d=x[c[h]],y=void 0,y=new RegExp(/"B(\d+)"\s*"A(\d+)"/).exec(d),new le($(x[y[1]]),v(x[y[2]])));for(h=0;h<f.length;++h)f[h]=re(x[f[h]]);return new ue(t,a,l,p,u,g,c,f,{tail:b})},fe.prototype.toString=function(){return"var "+this.name+" = "+this.body+";\n$p."+this.name+" = "+this.name+";\n"},ce.prototype.toString=function(){return"var "+this.name+" = "+this.body+";\n$p."+this.name+" = "+this.name+";\n"},ge.prototype.toString=function(){var e=s({},this.params.getNames()),t=c;c=function(n){return e.hasOwnProperty(n.name)?n.name:t(n)};var n="function "+this.name+this.params+" "+this.body+"\n$p."+this.name+" = "+this.name+";";return c=t,n},de.prototype.toString=function(){return this.misc.prefix+this.argument.toString()},ve.prototype.toString=function(){return this.misc.prefix+this.argument.toString()},ye.prototype.toString=function(){var e=this.misc.prefix;return this.argument!==r&&(e+=this.argument.toString()),e},be.prototype.toString=function(){return"case "+this.expr+":"},xe.prototype.toString=function(){return this.label},y=function(e,t,s){var o=new RegExp(/\b(catch|for|if|switch|while|with)\s*"B(\d+)"|\b(do|else|finally|return|throw|try|break|continue)\b|("[ADEH](\d+)")|\b(case)\s+([^:]+):|\b([A-Za-z_$][\w$]*\s*:)|(;)/g),a=[];e=function(e){var t=e;return t=t.replace(/\b(catch\s*"B\d+"\s*"A\d+")(\s*catch\s*"B\d+"\s*"A\d+")+/g,"$1")}(e);for(var l,h,u,f,c=0;null!==(l=o.exec(e));){if(l[1]!==r){var p=e.lastIndexOf('"B',o.lastIndex),g=e.substring(c,p);"for"===l[1]?a.push(new de((u=x[l[2]],f=void 0,/\bin\b/.test(u)?new J(q(i((f=u.substring(1,u.length-1).split(/\bin\b/g))[0])),b(f[1])):u.indexOf(":")>=0&&u.indexOf(";")<0?new Q(q(i((f=u.substring(1,u.length-1).split(":"))[0])),b(f[1])):new K(q(i((f=u.substring(1,u.length-1).split(";"))[0])),b(f[1]),b(f[2]))),{prefix:g})):"catch"===l[1]?a.push(new ve($(x[l[2]]),{prefix:g})):a.push(new ye(l[1],b(x[l[2]]),{prefix:g}))}else if(l[3]!==r)a.push(new ye(l[3],r,{prefix:e.substring(c,o.lastIndex)}));else if(l[4]!==r){if(0!==i(h=e.substring(c,o.lastIndex-l[4].length)).length)continue;a.push(h);var m=l[4].charAt(1),d=l[5];"D"===m?a.push(t(x[d])):"E"===m?a.push(s(x[d])):"H"===m?a.push(V(x[d])):a.push(v(x[d]))}else if(l[6]!==r)a.push(new be(b(i(l[7]))));else if(l[8]!==r){if(0!==i(h=e.substring(c,o.lastIndex-l[8].length)).length)continue;a.push(new xe(e.substring(c,o.lastIndex)))}else{var y=n(e.substring(c,o.lastIndex-1));a.push(y.left),a.push(q(y.middle)),a.push(y.right+";")}c=o.lastIndex}var w=n(e.substring(c));return a.push(w.left),""!==w.middle&&(a.push(q(w.middle)),a.push(";"+w.right)),a},Ae.prototype.toString=function(){var e=we(this.statements),t=c;(function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0})(e)||(c=function(n){return e.hasOwnProperty(n.name)?n.name:t(n)});var n="{\n"+this.statements.join("")+"\n}";return c=t,n},v=function(e){var t=n(e.substring(1,e.length-1));return new Ae(y(t.middle))},Ce.prototype.toString=function(){for(var e,n=[],r=[],i=0,s=this.statements.length;i<s;++i)(e=this.statements[i])instanceof ce||e instanceof fe?n.push(e):r.push(e);ee(n);var o=we(this.statements);c=function(e){var n=e.name;return o.hasOwnProperty(n)?n:t.hasOwnProperty(n)||p.hasOwnProperty(n)||w.hasOwnProperty(n)?"$p."+n:n};var a="// this code was autogenerated from PJS\n(function($p) {\n"+n.join("")+"\n"+r.join("")+"\n})";return c=null,a};var Te=function(){var e=O(x[0]);return e=e.replace(/\bimport\s+[^;]+;/g,""),new Ce(y(e,me,pe))}();!function(e){var t,n,i={};for(t in A)if(A.hasOwnProperty(t)){var s=(n=A[t]).scopeId,o=n.name;if(s){var a=A[s];n.scope=a,a.inScope===r&&(a.inScope={}),a.inScope[o]=n}else i[o]=n}function l(e,t){for(var n,s=t.split("."),o=e.scope;o;){if(o.hasOwnProperty(s[0])){n=o[s[0]];break}o=o.scope}n===r&&(n=i[s[0]]);for(var a=1,l=s.length;a<l&&n;++a)n=n.inScope[s[a]];return n}for(t in A)if(A.hasOwnProperty(t)){var h=(n=A[t]).body.baseClassName;if(h){var u=l(n,h);u&&(n.base=u,u.derived||(u.derived=[]),u.derived.push(n))}var f,c,p=n.body.interfacesNames,g=[];if(p&&p.length>0){for(f=0,c=p.length;f<c;++f){var m=l(n,p[f]);g.push(m),m&&(m.derived||(m.derived=[]),m.derived.push(n))}g.length>0&&(n.interfaces=g)}}}(),function(e){var t,n,r,i=[],s={};for(t in A)if(A.hasOwnProperty(t))if((r=A[t]).inScope||r.derived){var o=[];if(r.inScope)for(n in r.inScope)r.inScope.hasOwnProperty(n)&&o.push(r.inScope[n]);r.derived&&(o=o.concat(r.derived)),s[t]=o}else i.push(t),r.weight=0;function a(e,t){var n=s[e];if(!n)return!1;var r=n.indexOf(t);return!(r<0)&&(n.splice(r,1),!(n.length>0)&&(delete s[e],!0))}for(;i.length>0;){var l,h;if(t=i.shift(),(r=A[t]).scopeId&&a(r.scopeId,r)&&(i.push(r.scopeId),A[r.scopeId].weight=r.weight+1),r.base&&a(r.base.classId,r)&&(i.push(r.base.classId),r.base.weight=r.weight+1),r.interfaces)for(l=0,h=r.interfaces.length;l<h;++l)r.interfaces[l]&&a(r.interfaces[l].classId,r)&&(i.push(r.interfaces[l].classId),r.interfaces[l].weight=r.weight+1)}}();var Se=Te.toString();return function(e,t){return e.replace(/'(\d+)'/g,(function(e,n){var r=t[n];return"/"===r.charAt(0)?r:/^'((?:[^'\\\n])|(?:\\.[0-9A-Fa-f]*))'$/.test(r)?"(new $p.Character("+r+"))":r}))}(Se=Se.replace(/\s*\n(?:[\t ]*\n)+/g,"\n\n"),h)}E.debug=s,E.prototype=w,E.compile=function(e){var t=new E.Sketch,n=_(function(e,t){var n=new RegExp(/\/\*\s*@pjs\s+((?:[^\*]|\*+[^\*\/])*)\*\//g).exec(e);if(n&&2===n.length)for(var r=[],i=n.splice(1,2)[0].replace(/\{([\s\S]*?)\}/g,(function(e,t){return r.push(t),"{"+(r.length-1)+"}"})).replace("\n","").replace("\r","").split(";"),s=function(e){return e.replace(/^\s*["']?/,"").replace(/["']?\s*$/,"")},o=0,a=i.length;o<a;o++){var l=i[o].split("=");if(l&&2===l.length){var h=s(l[0]),u=s(l[1]),f=[];if("preload"===h)for(var c=0,p=(f=u.split(",")).length;c<p;c++){var g=s(f[c]);t.imageCache.add(g)}else if("font"===h)for(var m=0,d=(f=u.split(",")).length;m<d;m++){var v=s(f[m]),y=/^\{(\d*?)\}$/.exec(v);P.preloading.add(y?JSON.parse("{"+r[y[1]]+"}"):v)}else"pauseOnBlur"===h?t.options.pauseOnBlur="true"===u:"globalKeyEvents"===h?t.options.globalKeyEvents="true"===u:"param-"===h.substring(0,6)?t.params[h.substring(6)]=u:t.options[h]=u}}return e}(e,t));return t.sourceCode=n,t};var R=function(){var e,n,r,i,s,o,a,l,h,u,f,c,p,g,m,d,v,y,b={};return"undefined"!=typeof tinylog&&"function"==typeof tinylog.log?b.log=tinylog.log:void 0===t||t.fake?"function"==typeof print&&(b.log=print):(n={zIndex:1e4,position:"fixed",bottom:"0px",width:"100%",height:"15%",fontFamily:"sans-serif",color:"#ccc",backgroundColor:"black"},r={position:"relative",fontFamily:"monospace",overflow:"auto",height:"100%",paddingTop:"5px"},i={height:"5px",marginTop:"-5px",cursor:"n-resize",backgroundColor:"darkgrey"},s={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"},o={minHeight:"16px"},a={fontSize:"12px",margin:"0 8px 0 8px",maxWidth:"100%",whiteSpace:"pre-wrap",overflow:"auto"},l=(e=t).defaultView,h=e.documentElement,u=h.style,f=function(){for(var e,t,n,r=arguments.length;r--;)for(n in t=arguments[r--],e=arguments[r].style,t)t.hasOwnProperty(n)&&(e[n]=t[n])},c=function(e,t,n){return e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n),[e,t,n]},p=function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)},g=function(e){for(var t=e.childNodes,n=t.length;n--;)e.removeChild(t.item(0))},m=function(e,t){return e.appendChild(t)},d=function(t){return e.createElement(t)},v=function(t){return e.createTextNode(t)},y=b.log=function(t){var x,w=u.paddingBottom,A=d("div"),C=A.style,T=m(A,d("div")),S=m(A,d("div")),P=m(A,d("div")),E=!1,_=!1,R=!1,k=0,L=function(){u.paddingBottom=A.clientHeight+"px"},D=function(e){var t=l.innerHeight,n=T.clientHeight;e<0?e=0:e+n>t&&(e=t-n),C.height=e/t*100+"%",L()},I=[c(e,"mousemove",(function(e){E&&(D(l.innerHeight-e.clientY),S.scrollTop=R)})),c(e,"mouseup",(function(){E&&(E=R=!1)})),c(T,"dblclick",(function(e){e.preventDefault(),_?(D(_),_=!1):(_=A.clientHeight,C.height="0px")})),c(T,"mousedown",(function(e){e.preventDefault(),E=!0,R=S.scrollTop})),c(T,"contextmenu",(function(){E=!1})),c(P,"click",(function(){x()}))];x=function(){for(var e=I.length;e--;)p.apply(b,I[e]);h.removeChild(A),u.paddingBottom=w,g(S),g(A),b.log=y},f(A,n,S,r,T,i,P,s),P.title="Close Log",m(P,v("✖")),T.title="Double-click to toggle log minimization",h.insertBefore(A,h.firstChild),b.log=function(e){512===k?S.removeChild(S.firstChild):k++;var t=m(S,d("div")),n=m(t,d("div"));t.title=(new Date).toLocaleTimeString(),f(t,o,n,a),m(n,v(e)),S.scrollTop=S.scrollHeight},b.log(t),L()}),b}();E.logger=R,E.version="1.3.6",E.lib={},E.registerLibrary=function(e,t){E.lib[e]=t,t.hasOwnProperty("init")&&t.init(w)},E.instances=T,E.getInstanceById=function(e){return T[S[e]]},E.Sketch=function(n){this.attachFunction=n,this.options={pauseOnBlur:!1,globalKeyEvents:!1},this.onLoad=i,this.onSetup=i,this.onPause=i,this.onLoop=i,this.onFrameStart=i,this.onFrameEnd=i,this.onExit=i,this.params={},this.imageCache={pending:0,images:{},operaCache:{},add:function(n,r){var i;if(!this.images[n]&&(a||(this.images[n]=null),r||((r=new Image).onload=(i=this,function(){i.pending--}),this.pending++,r.src=n),this.images[n]=r,e.opera)){var s=t.createElement("div");s.appendChild(r),s.style.position="absolute",s.style.opacity=0,s.style.width="1px",s.style.height="1px",this.operaCache[n]||(t.body.appendChild(s),this.operaCache[n]=s)}}},this.sourceCode=void 0,this.attach=function(e){if("function"==typeof this.attachFunction)this.attachFunction(e);else{if(!this.sourceCode)throw"Unable to attach sketch to the processing instance";var t=new Function("return ("+this.sourceCode+");")();t(e),this.attachFunction=t}},this.toString=function(){var e,t="((function(Sketch) {\n";for(e in t+="var sketch = new Sketch(\n"+this.sourceCode+");\n",this.options)if(this.options.hasOwnProperty(e)){var n=this.options[e];t+="sketch.options."+e+" = "+("string"==typeof n?'"'+n+'"':""+n)+";\n"}for(e in this.imageCache)this.options.hasOwnProperty(e)&&(t+='sketch.imageCache.add("'+e+'");\n');return t+="return sketch;\n})(Processing.Sketch))"}};var k=function(n,r){var i=[],s=[],o=r.length,a=0;function l(r,l){function h(e,t){if(i[r]=e,++a,t&&s.push(l+" ==> "+t),a===o){if(0!==s.length)throw"Processing.js: Unable to load pjs sketch files: "+s.join("\n");try{return new E(n,i.join("\n"))}catch(e){throw"Processing.js: Unable to execute pjs sketch: "+e}}}if("#"!==l.charAt(0))!function(t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){var t;4===r.readyState&&(200!==r.status&&0!==r.status?t="Invalid XHR status "+r.status:""===r.responseText&&(t="withCredentials"in new XMLHttpRequest&&!1===(new XMLHttpRequest).withCredentials&&"file:"===e.location.protocol?"XMLHttpRequest failure, possibly due to a same-origin policy violation. You can try loading this page in another browser, or load it from http://localhost using a local webserver. See the Processing.js README for a more detailed explanation of this problem and solutions.":"File is empty."),n(r.responseText,t))},r.open("GET",t,!0),r.overrideMimeType&&r.overrideMimeType("application/json"),r.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT"),r.send(null)}(l,h);else{var u=t.getElementById(l.substring(1));u?h(u.text||u.textContent):h("","Unable to load pjs sketch: element with id '"+l.substring(1)+"' was not found")}}for(var h=0;h<o;++h)l(h,r[h])},L=function(){t.removeEventListener("DOMContentLoaded",L,!1);for(var e,n=t.getElementsByTagName("canvas"),i=0,s=n.length;i<s;i++){var o=n[i].getAttribute("data-processing-sources");if(null===o&&null===(o=n[i].getAttribute("data-src"))&&(o=n[i].getAttribute("datasrc")),o){e=o.split(" ");for(var a=0;a<e.length;)e[a]?a++:e.splice(a,1);k(n[i],e)}}var l,h,u=t.getElementsByTagName("script");for(l=0;l<u.length;l++){var f=u[l];if(f.getAttribute){var c=f.getAttribute("type");if(c&&("text/processing"===c.toLowerCase()||"application/processing"===c.toLowerCase())){var p=f.getAttribute("data-processing-target");if(n=r,p)n=t.getElementById(p);else{for(var g=f.nextSibling;g&&1!==g.nodeType;)g=g.nextSibling;"canvas"===g.nodeName.toLowerCase()&&(n=g)}if(n){if(f.getAttribute("src")){e=f.getAttribute("src").split(/\s+/),k(n,e);continue}h=f.textContent||f.text,new E(n,h)}}}}};E.loadSketchFromSources=k,E.disableInit=function(){a&&t.removeEventListener("DOMContentLoaded",L,!1)},a?(e.Processing=E,t.addEventListener("DOMContentLoaded",L,!1)):this.Processing=E}(window,window.document,Math);
  IG$.v$olapChartView.prototype.drawProtovisChartLD=function(t,e){var n,a,r,i=this,o=i.sheetoption?i.sheetoption.model.chart_option:null,l=e._tabledata,s=e.colfix,c=e.rowfix,d=l.length>0?l[0].length:0,u=[],p=i.cop.relationgroups;i.drawmode="protovis",i.mresult=e,i.rct=t,o.settings=o.settings||{};var h=$(i.container),v=IG$.j$ext._w(h),f=IG$.j$ext._h(h),g=(o?o.xaxissep:null)||ig$.chart_separator||IG$._separator;switch(g="nl"==g?"\n":g,i.vis&&($(i.container).empty(),i.vis=null),t){case"boxplot":var m=[],x=[],b=[],y=0;for(n=s;n<d;n++){for(a=0;a<c;a++)Jt=0==a?l[a][n].text:Jt+g+l[a][n].text;x.push(Jt),b.push({id:Jt,median:0,uq:0,lq:0,max:0,min:0})}for(n=s;n<d;n++){wt=[];var w,_=Number(l[c][n].code),k=_,I=parseInt(.8*(l.length-c)),G=parseInt(.2*(l.length-c)),M=parseInt(.5*(l.length-c));for(a=c;a<l.length;a++)w=Number(l[a][n].code),_=Math.min(_,w),k=Math.max(k,w),w,wt.push(w);wt=wt.sort((function(t,e){return t-e})),b[n-s].min=_,b[n-s].max=k,b[n-s].median=wt[M],b[n-s].lq=wt[G],b[n-s].uq=wt[I],y=Math.max(y,k)}var S=v,N=f;i.vismargin={top:0,bottom:20,right:20,left:40},v-=i.vismargin.left+i.vismargin.right,f-=i.vismargin.top+i.vismargin.bottom;var D=pv.Scale.ordinal(b,(function(t){return t.id})).splitBanded(0,v,.6);W=pv.Scale.linear(0,y).range(0,f),T=D.range().band/2,i.vis=(new pv.Panel).canvas(i.container).width(v).height(f).top(i.vismargin.top).bottom(i.vismargin.bottom).left(i.vismargin.left).right(i.vismargin.right),i.vis.add(pv.Rule).data(W.ticks()).bottom(W).strokeStyle((function(t){return 0==t||1==t?"#000":"#ccc"})).anchor("left").add(pv.Label).text(W.tickFormat);var C=i.vis.add(pv.Panel).data(b).left((function(t){return D(t.id)})).width(2*T);C.anchor("bottom").add(pv.Label).textBaseline("top").text((function(t){return t.id})),C.add(pv.Rule).left(T).bottom((function(t){return W(t.min)})).height((function(t){return W(t.max)-W(t.min)})),C.add(pv.Rule).data((function(t){return[t.min,t.max]})).bottom(W).left(T/2).width(T),C.add(pv.Bar).bottom((function(t){return W(t.lq)})).height((function(t){return W(t.uq)-W(t.lq)})).fillStyle((function(t){return t.median>.5*(t.uq-t.lq)+t.lq?"#aec7e8":"#ffbb78"})).strokeStyle("black").lineWidth(1).antialias(!1),C.add(pv.Rule).bottom((function(t){return W(t.median)})),i.vis.render();break;case"performancemap":m=[],x=["Name"];var L,B=30,F=100;for(n=s;n<d;n++){for(a=0;a<c;a++)Jt=0==a?l[a][n].text:Jt+g+l[a][n].text;L=IG$.measureText(12,Jt),B=Math.max(L.width+10,B),x.push(Jt)}for(n=c;n<l.length;n++){for(wt=[],a=0;a<s;a++)Jt=0==a?l[n][a].text:Jt+g+l[n][a].text;for(L=IG$.measureText(12,Jt),F=Math.max(L.width,F),wt.push(Jt),a=s;a<d;a++)wt.push(Number(l[n][a].code)||0);m.push(wt)}m=m.map((function(t){return pv.dict(x,(function(){return t[this.index]}))})),x.shift();D=pv.dict(x,(function(t){return pv.mean(m,(function(e){return e[t]}))}));var T=pv.dict(x,(function(t){return pv.deviation(m,(function(e){return e[t]}))})),A=pv.dict(x,(function(t){return pv.Scale.linear().domain(-3*T[t]+D[t],3*T[t]+D[t]).range("white","steelblue")}));i.vismargin={top:B,left:F,width:24*x.length,height:13*m.length};var P=$(i.container),E=Math.max(i.vismargin.width+i.vismargin.left,v),j=Math.max(i.vismargin.top+i.vismargin.height,f);P.css({overflow:"scroll"}),i.vis=(new pv.Panel).canvas(i.container).width(i.vismargin.width).height(i.vismargin.height).top(B).left(F),i.vis.add(pv.Panel).data(x).left((function(){return 24*this.index})).width(24).add(pv.Panel).data(m).top((function(){return 13*this.index})).height(13).fillStyle((function(t,e){return A[e](t[e])})).strokeStyle("white").lineWidth(1).antialias(!1).title((function(t,e){return t.Name+"'s "+e+": "+t[e]})),i.vis.add(pv.Label).data(x).top(3).left((function(){return 24*this.index+12})).textAngle(-Math.PI/2).textBaseline("middle"),i.vis.add(pv.Label).data(m).top((function(){return 13*this.index+6.5})).left(3).textAlign("right").textBaseline("middle").text((function(t){return t.Name})),i.vis.render();break;case"parallel":for(n=s;n<l[0].length;n++){for(r="",a=0;a<c;a++)r=0==a?l[n][a].text:r+g+l[n][a].text;u.push(r)}var R=[],q=(x=[],{});for(n=s;n<l[0].length;n++){for(r="",a=0;a<c;a++)r=0==a?l[a][n].text:r+g+l[a][n].text;q[r]={name:r,unit:""},x.push(r)}var O=pv.keys(q);for(n=c;n<l.length;n++){for(r="",a=0;a<s;a++)r=0==a?l[n][a].text:r+g+l[n][a].text;var V={};for(V.name=r,a=s;a<l[n].length;a++)V[x[a-s]]=Number(l[n][a].code);R.push(V)}i.vismargin={left:30,right:30,top:30,bottom:40},v-=i.vismargin.left+i.vismargin.right,f-=i.vismargin.top+i.vismargin.bottom;D=pv.Scale.ordinal(O).splitFlush(0,v);var W=pv.dict(O,(function(t){return pv.Scale.linear(R.filter((function(e){return!isNaN(e[t])})),(function(e){return Math.floor(e[t])-.5}),(function(e){return Math.ceil(e[t])+.5})).range(0,f)})),U=pv.dict(O,(function(t){return pv.Scale.linear(R.filter((function(e){return!isNaN(e[t])})),(function(e){return Math.floor(e[t])-.5}),(function(e){return Math.ceil(e[t])+.5})).range("steelblue","brown")})),z=pv.dict(O,(function(t){return{min:W[t].domain()[0],max:W[t].domain()[1]}})),H=O[0];i.vis=(new pv.Panel).canvas(i.container).width(v).height(f).left(i.vismargin.left).right(i.vismargin.right).top(i.vismargin.top).bottom(i.vismargin.bottom),i.vis.add(pv.Panel).data(R).visible((function(t){return O.every((function(e){return t[e]>=z[e].min&&t[e]<=z[e].max}))})).add(pv.Line).data(O).left((function(t,e){return D(t)})).bottom((function(t,e){return W[t](e[t])})).strokeStyle("#ddd").lineWidth(1).antialias(!1),i.vis.add(pv.Rule).data(O).left(D).anchor("top").add(pv.Label).top(-12).font("bold 10px sans-serif").text((function(t){return q[t].name}));var J=i.vis.add(pv.Panel);J.add(pv.Panel).data(R).visible((function(t){return O.every((function(e){return t[e]>=z[e].min&&t[e]<=z[e].max}))})).add(pv.Line).data(O).left((function(t,e){return D(t)})).bottom((function(t,e){return W[t](e[t])})).strokeStyle((function(t,e){return U[H](e[H])})).lineWidth(1);var K=function(t){var e=t.dim;return z[e].min=Math.max(W[e].domain()[0],W[e].invert(f-t.y-t.dy)),z[e].max=Math.min(W[e].domain()[1],W[e].invert(f-t.y)),H=e,i.updateSel.call(i,z,x),J.render(),!1},Q=J.add(pv.Panel).data(O.map((function(t){return{y:0,dy:f,dim:t}}))).left((function(t){return D(t.dim)-30})).width(60).fillStyle("rgba(0,0,0,.001)").cursor("crosshair").event("mousedown",pv.Behavior.select()).event("select",K).event("selectend",(function(t){if(t.dy<3){var e=t.dim;z[e].min=Math.max(W[e].domain()[0],W[e].invert(0)),z[e].max=Math.min(W[e].domain()[1],W[e].invert(f)),t.y=0,t.dy=f,H=e,i.updateSel.call(i,null),J.render()}return!1})).add(pv.Bar).left(25).top((function(t){return t.y})).width(10).height((function(t){return t.dy})).fillStyle((function(t){return t.dim==H?U[t.dim]((z[t.dim].max+z[t.dim].min)/2):"hsla(0,0,50%,.5)"})).strokeStyle("white").cursor("move").event("mousedown",pv.Behavior.drag()).event("dragstart",K).event("drag",K);Q.anchor("bottom").add(pv.Label).textBaseline("top").text((function(t){return z[t.dim].min.toFixed(0)+q[t.dim].unit})),Q.anchor("top").add(pv.Label).textBaseline("bottom").text((function(t){return z[t.dim].max.toFixed(0)+q[t.dim].unit})),i.vis.render(),i._selBtn||(i._selBtn=$("<div class='m-vis-selbutton'>Selected</div>").appendTo(i.maincontainer),i._selBtn.bind("click",(function(){i.showHideSel.call(i,null)})));break;case"networkdiagram_pos":case"networkdiagram_neg":var X=i.cop.rel_range1==IG$.UNDEFINED||null==i.cop.rel_range1?-1:i.cop.rel_range1,Y=i.cop.rel_range2==IG$.UNDEFINED||null==i.cop.rel_range2?1:i.cop.rel_range2;i.vismargin={left:0,right:0,top:0,bottom:90},v-=i.vismargin.left+i.vismargin.right,f-=i.vismargin.top+i.vismargin.bottom;var Z=i.getRelData(e,"networkdiagram_pos"==t?1:0,!1,p,{s:X,t:Y});i.vis=(new pv.Panel).canvas(i.container).width(v).height(f).bottom(90),(Ot=i.vis.add(pv.Layout.Arc).nodes(Z.nodes).links(Z.links).sort((function(t,e){return t.group==e.group?e.linkDegree-t.linkDegree:e.group-t.group}))).link.add(pv.Line),Ot.node.add(pv.Dot).size((function(t){return t.linkDegree+4})).fillStyle(pv.Colors.category19().by((function(t){return t.group}))).strokeStyle((function(){return this.fillStyle().darker()})),Ot.label.add(pv.Label),i.vis.render();break;case"matrixdiagram":var tt=pv.Colors.category19().by((function(t){return t.group}));X=i.cop.rel_range1==IG$.UNDEFINED||null==i.cop.rel_range1?-1:i.cop.rel_range1,Y=i.cop.rel_range2==IG$.UNDEFINED||null==i.cop.rel_range2?1:i.cop.rel_range2;i.vismargin={left:90,right:0,top:90,bottom:0},v-=i.vismargin.left+i.vismargin.right,f-=i.vismargin.top+i.vismargin.bottom;Z=i.getRelData(e,2,!1,p,{s:X,t:Y});i.vis=(new pv.Panel).canvas(i.container).width(v).height(f).top(i.vismargin.top).left(i.vismargin.left);var et=i.vis.add(pv.Layout.Matrix).nodes(Z.nodes).links(Z.links).sort((function(t,e){return e.group-t.group}));et.link.add(pv.Bar).fillStyle((function(t){return t.linkValue?t.targetNode.group==t.sourceNode.group?tt(t.sourceNode):"#555":"#eee"})).antialias(!1).lineWidth(1),et.label.add(pv.Label).textStyle(tt),i.vis.render();break;case"anderson":var nt,at,rt,it=[],ot={},lt=[],st=[],ct=0;d=l[0].length;for(n=s;n<l[0].length;n++){for(r="",a=0;a<c;a++)r=0==a?l[a][n].text:r+"_"+l[a][n].text;lt.push(r)}for(n=0;n<i.sheetoption.model.rows.length;n++)if(i.sheetoption.model.rows[n].name==i.cop.andersonspecies){ct=n;break}for(n=c;n<l.length;n++){for(ot[nt=l[n][ct].text]||(ot[nt]=nt),at={species:nt},a=s;a<d;a++)at[lt[a-s]]=l[n][a].code;st.push(at)}for(rt in ot)it.push(rt);P=$(i.container),E=Math.max(170*lt.length,v),j=Math.max(170*lt.length,f)+20;P.css({overflow:"scroll"});var dt=pv.rgb(144,144,144,.2),ut=(tt=pv.colors("rgba(30, 108, 11, 1)","rgba(0, 72, 140, 1)","rgba(51, 38, 9, 1)","rgba(216, 64, 0, 1)","rgba(67, 76, 67, 1)","rgba(179, 0, 35, 1)","rgba(248, 215, 83, 1)","rgba(92, 151, 70, 1)","rgba(62, 117, 167, 1)","rgba(122, 101, 62, 1)","rgba(225, 102, 42, 1)","rgba(116, 121, 111, 1)","rgba(196, 56, 79, 1)","rgba(255, 248, 163, 1)","rgba(196, 204, 143, 1)","rgba(178, 200, 217, 1)","rgba(190, 163, 122, 1)","rgba(243, 170, 121, 1)","rgba(181, 181, 169, 1)","rgba(230, 165, 164, 1)"),pv.dict(lt,(function(t){return pv.Scale.linear(st,(function(e){return e[t]})).range(0,150)})));i.vismargin={left:10,right:0,top:5,bottom:0},v-=i.vismargin.left+i.vismargin.right,f-=i.vismargin.top+i.vismargin.bottom,i.vismargin.width=E,i.vismargin.height=j,i.vis=(new pv.Panel).canvas(i.container).width(170*lt.length).height(170*lt.length+20).left(i.vismargin.left).top(i.vismargin.top);var pt=i.vis.add(pv.Panel).data(lt).top((function(){return 170*this.index+10})).height(150).add(pv.Panel).data((function(t){return lt.map((function(e){return{px:e,py:t}}))})).left((function(){return 170*this.index+10})).width(150),ht=pt.add(pv.Panel).visible((function(t){return t.px!=t.py})).strokeStyle("#aaa"),vt=ht.add(pv.Rule).data((function(t){return ut[t.px].ticks(5)})).left((function(t,e){return ut[e.px](t)})).strokeStyle("#eee");vt.anchor("bottom").add(pv.Label).visible((function(){return pt.parent.index==lt.length-1&&!(1&pt.index)})).text((function(t,e){return ut[e.px].tickFormat(t)})),vt.anchor("top").add(pv.Label).visible((function(){return 0==pt.parent.index&&1&pt.index})).text((function(t,e){return ut[e.px].tickFormat(t)}));var ft=ht.add(pv.Rule).data((function(t){return ut[t.py].ticks(5)})).bottom((function(t,e){return ut[e.py](t)})).strokeStyle("#eee");ft.anchor("left").add(pv.Label).visible((function(){return 0==pt.index&&1&pt.parent.index})).text((function(t,e){return ut[e.py].tickFormat(t)})),ft.anchor("right").add(pv.Label).visible((function(){return pt.index==lt.length-1&&!(1&pt.parent.index)})).text((function(t,e){return ut[e.py].tickFormat(t)}));var gt=ht.add(pv.Dot).data(st).left((function(t,e){return ut[e.px](t[e.px])})).bottom((function(t,e){return ut[e.py](t[e.py])})).size(10).strokeStyle(null).fillStyle((function(t){return T&&(t[T.px]<T.x1||t[T.px]>T.x2||t[T.py]<T.y1||t[T.py]>T.y2)?dt:tt(t.species)})),mt=i.vis,xt=function(t,e){(T=t).px=e.px,T.py=e.py,T.x1=ut[e.px].invert(t.x),T.x2=ut[e.px].invert(t.x+t.dx),T.y1=ut[e.py].invert(150-t.y-t.dy),T.y2=ut[e.py].invert(150-t.y),gt.context(null,0,(function(){mt.render()})),i.updateSel.call(i,null,lt,T)};ht.add(pv.Panel).data([{x:20,y:20,dx:100,dy:100}]).cursor("crosshair").events("all").event("mousedown",pv.Behavior.select()).event("selectstart",(function(){return T=null,mt})).event("select",xt).add(pv.Bar).visible((function(t,e,n){return T&&T.px==n.px&&T.py==n.py})).left((function(t){return t.x})).top((function(t){return t.y})).width((function(t){return t.dx})).height((function(t){return t.dy})).fillStyle("rgba(0,0,0,.15)").strokeStyle("white").cursor("move").event("mousedown",pv.Behavior.drag()).event("drag",xt),pt.anchor("center").add(pv.Label).visible((function(t){return t.px==t.py})).font("bold 14px sans-serif").text((function(t){return t.px.replace(/([WL])/," $1").toLowerCase()})),i.vis.add(pv.Dot).data(it).bottom(10).left((function(){return 15+65*this.index})).size(8).strokeStyle(null).fillStyle(tt).anchor("right").add(pv.Label),i.vis.render(),i._selBtn||(i._selBtn=$("<div class='m-vis-selbutton'></div>").appendTo(i.maincontainer),i._selBtn.bind("click",(function(){i.showHideSel.call(i,null)})));break;case"forcelayout":i.vismargin={left:0,right:0,top:0,bottom:0},v-=i.vismargin.left+i.vismargin.right,f-=i.vismargin.top+i.vismargin.bottom;var bt=pv.Colors.category19();X=i.cop.rel_range1==IG$.UNDEFINED||null==i.cop.rel_range1?-1:i.cop.rel_range1,Y=i.cop.rel_range2==IG$.UNDEFINED||null==i.cop.rel_range2?1:i.cop.rel_range2,Z=i.getRelData(e,2,!0,p,{s:X,t:Y});i.vis=(new pv.Panel).canvas(i.container).width(v).height(f).fillStyle("white").event("mousedown",pv.Behavior.pan()).event("mousewheel",pv.Behavior.zoom());var yt=i.vis.add(pv.Layout.Force).nodes(Z.nodes).links(Z.links).chargeConstant(-9e3);yt.link.add(pv.Line),yt.node.add(pv.Dot).size((function(t){return(t.linkDegree+4)*Math.pow(this.scale,-1.5)})).fillStyle((function(t){return t.fix?"brown":bt(t.group)})).strokeStyle((function(){return this.fillStyle().darker()})).lineWidth(1).title((function(t){return t.nodeName})).event("mousedown",pv.Behavior.drag()).event("drag",yt),i.vis.render();break;case"chord":var wt,_t,$t=[],kt=[],It=(d=l[0].length,o&&o.settings.chd_method||"relations"),Gt=[],Mt=0;X=i.cop.rel_range1==IG$.UNDEFINED||null==i.cop.rel_range1?-1:i.cop.rel_range1,Y=i.cop.rel_range2==IG$.UNDEFINED||null==i.cop.rel_range2?1:i.cop.rel_range2;if("tablematrix"==It){var St,Nt,Dt,Ct,Lt={},Bt=[];T=0;if(s>0){for(n=c;n<l.length;n++)Lt[Ft=l[n][0].code]||(St={name:Ft,seq:T,r:n,c:-1},Bt.push(St),T++,Lt[Ft]=St,Gt.push({title:Ft,code:Ft}));for(n=s;n<d;n++)Lt[Ft=l[0][n].code]&&(Lt[Ft].c=n);for(n=0;n<Bt.length;n++){for(wt=[],Ct=Bt[n].r,a=0;a<Bt.length;a++)Nt=0,(Dt=Bt[a].c)>-1&&(Nt=Number(l[Ct][Dt].code)||0),Nt>0&&(Mt=1),wt.push(Nt);$t.push(wt)}}}else{var Ft,Tt=i.getRelData(e,2,!1,p,{s:X,t:Y});Tt.nodes.length;for(n=0;n<Tt.nodes.length;n++){for(wt=[],Ft=Tt.nodes[n].nodeName,kt.push({name:Ft}),a=0;a<Tt.nodes.length;a++)wt.push(0);Gt.push({title:Ft,code:Ft}),$t.push(wt)}for(n=0;n<Tt.links.length;n++)$t[(_t=Tt.links[n]).source][_t.target]=_t.value+1,_t.source!=_t.target&&($t[_t.target][_t.source]=_t.value+1,Mt=1)}if(0==Mt)return;S=v,N=f;var At=(o?o.colorset:"")||e.c_cset,Pt=.41*Math.min(v,f),Et=1.1*Pt;bt=["#009CFF","#FBE105","#72C936","#C42AD8","#2164E9","#FF9600","#F02F1B"];IG$.__chartoption&&IG$.__chartoption.chartcolors&&IG$.__chartoption.chartcolors[At]&&(bt=IG$.__chartoption.chartcolors[At]);var jt=i.vis=d3.select(i.container).append("svg:svg").attr("width",S).attr("height",N).attr("viewBox",[-S/2,-N/2,S,N]),Rt=d3.format(".1~%"),qt=d3.chord().padAngle(10/Pt).sortSubgroups(d3.descending).sortChords(d3.descending)($t),Ot=d3.arc().innerRadius(Pt).outerRadius(Et),Vt=d3.ribbon();Vt.radius(Pt-1);tt=d3.scaleOrdinal(kt,bt);var Wt=d3.tickStep(0,d3.sum($t.flat()),100);var Ut=jt.append("g");(Ut=(Ut=(Ut=(Ut=Ut.attr("font-size",10).attr("font-family","sans-serif")).selectAll("g")).data(qt.groups)).join("g")).append("path").attr("fill",(function(t){return tt(kt[t.index].name)})).attr("d",Ot),Ut.append("title").text((function(t){return"".concat(kt[t.index].name,"\n").concat(Rt(t.value))}));var zt=Ut.append("g").selectAll("g").data((function(t){var e=t.startAngle,n=t.endAngle,a=t.value,r=(n-e)/a;return d3.range(0,a,Wt).map((function(t){return{value:t,angle:t*r+e}}))})).join("g").attr("transform",(function(t){return"rotate(".concat(180*t.angle/Math.PI-90,") translate(").concat(Et,",0)")}));zt.append("line").attr("stroke","currentColor").attr("x2",6),zt.append("text").attr("x",8).attr("dy","0.35em").attr("transform",(function(t){return t.angle>Math.PI?"rotate(180) translate(-16)":null})).attr("text-anchor",(function(t){return t.angle>Math.PI?"end":null})).text((function(t){return Rt(t.value)})),Ut.select("text").attr("font-weight","bold").text((function(t){return"end"===this.getAttribute("text-anchor")?"↑ ".concat(kt[t.index].name):"".concat(kt[t.index].name," ↓")})),jt.append("g").attr("fill-opacity",.8).selectAll("path").data(qt).join("path").style("mix-blend-mode","multiply").attr("fill",(function(t){return tt(kt[t.source.index].name)})).attr("d",Vt).append("title").text((function(t){return"".concat(Rt(t.source.value)," ").concat(kt[t.target.index].name," → ").concat(kt[t.source.index].name).concat(t.source.index===t.target.index?"":"\n".concat(Rt(t.target.value)," ").concat(kt[t.source.index].name," → ").concat(kt[t.target.index].name))}));break;case"sunburst":if(!window.d3)return;S=v,N=f;var Ht,Jt,Kt=Math.min(S,N),Qt=s,Xt=s+1,Yt=Kt/(2*Xt),Zt={name:"root",children:[]},te=(d=l[0].length,[]);for(n=0;n<s;n++)te.push({name:null,child:Zt});for(n=c;n<l.length;n++)for(a=0;a<s;a++)Jt=l[n][a].text||l[n][a].code,te[a].name!=Jt&&(0==a?(Ht={name:Jt},Zt.children.push(Ht),te[a].child=Ht):(Ht={name:Jt},te[a-1].child.children.push(Ht),te[a].child=Ht),te[a].name=Ht.name,a==s-1?Ht.value=Number(l[n][Qt].code||0):Ht.children=[]);tt=d3.scaleOrdinal(d3.quantize(d3.interpolateRainbow,Zt.children.length+1));var ee=d3.hierarchy(Zt).sum((function(t){return t.value})).sort((function(t,e){return e.value-t.value}));ee=d3.partition().size([2*Math.PI,ee.height+1])(ee);var ne=d3.format(",d"),ae=Yt;Ot=d3.arc().startAngle((function(t){return t.x0})).endAngle((function(t){return t.x1})).padAngle((function(t){return Math.min(t.x1-t.x0),.005})).padRadius(1.5*ae).innerRadius((function(t){return t.y0*ae})).outerRadius((function(t){return Math.max(t.y0*ae,t.y1*ae-1)}));ee.each((function(t){t.current=t}));var re=(jt=i.vis=d3.select(i.container).append("svg:svg").attr("viewBox",[0,0,S,N]).attr("width",S).attr("height",N).style("font","10px sans-serif")).append("g").attr("transform","translate("+(S>Kt?Kt/2+(S-Kt)/2:Kt/2)+","+(N>Kt?Kt/2+(N-Kt)/2:Kt/2)+")");function ie(t){return t.y1<=Xt&&t.y0>=1&&t.x1>t.x0}function oe(t){return t.y1<=Xt&&t.y0>=1&&(t.y1-t.y0)*(t.x1-t.x0)>.03}function le(t){var e=(t.x0+t.x1)/2*180/Math.PI,n=(t.y0+t.y1)/2*ae;return"rotate(".concat(e-90,") translate(").concat(n,",0) rotate(").concat(e<180?0:180,")")}function se(t){ue.datum(t.parent||ee),ee.each((function(e){e.target={x0:2*Math.max(0,Math.min(1,(e.x0-t.x0)/(t.x1-t.x0)))*Math.PI,x1:2*Math.max(0,Math.min(1,(e.x1-t.x0)/(t.x1-t.x0)))*Math.PI,y0:Math.max(0,e.y0-t.depth),y1:Math.max(0,e.y1-t.depth)}}));var e=re.transition().duration(750);ce.transition(e).tween("data",(function(t){var e=d3.interpolate(t.current,t.target);return function(n){return t.current=e(n)}})).filter((function(t){return+this.getAttribute("fill-opacity")||ie(t.target)})).attr("fill-opacity",(function(t){return ie(t.target)?t.children?.6:.4:0})).attrTween("d",(function(t){return function(){return Ot(t.current)}})),de.filter((function(t){return+this.getAttribute("fill-opacity")||oe(t.target)})).transition(e).attr("fill-opacity",(function(t){return+oe(t.target)})).attrTween("transform",(function(t){return function(){return le(t.current)}}))}var ce=re.append("g").selectAll("path").data(ee.descendants().slice(1)).join("path").attr("fill",(function(t){for(;t.depth>1;)t=t.parent;return tt(t.data.name)})).attr("fill-opacity",(function(t){return ie(t.current)?t.children?.6:.4:.2})).attr("d",(function(t){return Ot(t.current)}));ce.filter((function(t){return t.children})).style("cursor","pointer").on("click",se),ce.append("title").text((function(t){var e=t.ancestors().map((function(t){return t.data.name})).reverse().join("/");return e+="\n"+ne(t.value)}));var de=re.append("g").attr("pointer-events","none").attr("text-anchor","middle").style("user-select","none").selectAll("text").data(ee.descendants().slice(1)).join("text").attr("dy","0.35em").attr("fill-opacity",(function(t){return+oe(t.current)})).attr("transform",(function(t){return le(t.current)})).text((function(t){return t.data.name})),ue=re.append("circle").datum(ee).attr("r",ae).attr("fill","none").attr("pointer-events","all").on("click",se)}},IG$.v$olapChartView.prototype.drD3CustLD=function(t,e){var n,a=this;a.drawmode="dcust",a.mresult=e,a.rct=t;var r=$(a.container);IG$.j$ext._w(r),IG$.j$ext._h(r);switch(t){case"bullet":(n=new IG$.c$BulChart($(a.container))).loadData.call(n,a.mresult),a.dcust=n}},IG$.v$olapChartView.prototype.getRelData=function(t,e,n,a,r){var i,o,l,s,c,d,u,p,h,v,f=t._tabledata,g=t.colfix,m=t.rowfix,x=[],b={nodes:[],links:[]},y=this.sheetoption.model.chart_option,w=(y?y.xaxissep:null)||ig$.chart_separator||IG$._separator;for(w="nl"==w?"\n":w,i=g;i<f[0].length;i++){for(l="",o=0;o<m;o++)l=0==o?f[o][i].text:l+w+f[o][i].text;b.nodes.push({nodeName:l,group:a&&a.length>i-g&&""!=a[i-g]?parseInt(a[i-g]):i})}for(p=b.nodes.length,i=m;i<f.length;i++){for(s=[],o=g;o<f[i].length;o++)c=Number(f[i][o].code)||0,s.push(c);x.push(s)}for(d=0;d<p;d++)for(u=0;u<d+1;u++)d!=u&&(h={source:d,target:u},v=this.corRelCoefficient.call(this,x,d,u),r.s<=v&&v<=r.t&&(h.value=v,h.value=1==n?10*(v+1):10*v,1==e?v>0&&b.links.push(h):0==e?v<0&&b.links.push(h):b.links.push(h)));return b},IG$.v$olapChartView.prototype.corRelCoefficient=function(t,e,n){var a,r,i=t.length,o=0,l=0,s=0,c=0,d=0;for(r=0;r<t.length;r++){var u=(a=t[r])[e],p=a[n];o+=u,l+=p,s+=Math.pow(u,2),c+=Math.pow(p,2),d+=u*p}return(i*d-o*l)/(Math.sqrt(i*s-Math.pow(o,2))*Math.sqrt(i*c-Math.pow(l,2)))},IG$.v$olapChartView.prototype.drMatrixChartLD=function(t){var e,n,a,r,i,o=t._tabledata,l=t.colfix,s=t.rowfix,c=[],d=[],u=this,p=u.sheetoption.model.chart_option,h=(p?p.xaxissep:null)||ig$.chart_separator||IG$._separator;for(h="nl"==h?"\n":h,u.drawmode="qavis",e=l;e<o[0].length;e++){for(a="",n=0;n<s;n++)a=0==n?o[n][e].text:a+h+o[n][e].text;c.push(a)}for(e=s;e<o.length;e++){for(r=[],n=l;n<o[e].length;n++)i=Number(o[e][n].code),r.push(i);d.push(r)}u.qavis=new IG$.ComparisonMatrix(u.container,{cr1:u.cop.comp_range0,cr2:u.cop.comp_range1}),u.qavis.dataSet=d,u.qavis.fields=c,u.qavis.commitProp()},IG$.v$olapChartView.prototype.centroid=function(t){for(var e,n,a,r=t.length,i=0,o=0,l=r-1,s=0;s<r;l=s++)n=t[s],a=t[l],e=n.lng*a.lat-a.lng*n.lat,i+=(n.lng+a.lng)*e,o+=(n.lat+a.lat)*e;return{lng:i/(e=6*this.area(t)),lat:o/e}},IG$.v$olapChartView.prototype.drMapChartLD=function(t){var e=this;e.drD3ExtMap(t)},IG$.v$olapChartView.prototype.drProtovisMapChartLD=function(t){var e=this,n=function(t){return t<17?"#008038":t<20?"#A3D396":t<23?"#FDD2AA":t<26?"#F7976B":t<29?"#F26123":t<32?"#E12816":"#B7161E"};us_lowres.forEach((function(t){t.code=t.code.toUpperCase(),t.centLatLon=e.centroid(t.borders[0])}));var a=[];for(i=t.rowfix;i<t._tabledata.length;i++){var r,o=t._tabledata[i][0].text,l=0;for(j=t.colfix;j<t.colcnt;j++)r=t._tabledata[i][j].code,l+=Number(r);a[o]=l}var s=$(e.container),c=IG$.j$ext._w(s),d=IG$.j$ext._h(s),u=pv.Geo.scale().domain({lng:-128,lat:24},{lng:-64,lat:50}).range({x:0,y:0},{x:c,y:d});e.vismargin={top:30,bottom:20},e.vis=(new pv.Panel).canvas(e.container).width(c).height(d-e.vismargin.top-e.vismargin.bottom).top(30).bottom(20),e.vis.add(pv.Panel).data(us_lowres).add(pv.Panel).data((function(t){return t.borders})).add(pv.Line).data((function(t){return t})).left(u.x).top(u.y).fillStyle((function(t,e,r){return n(a[r.code])})).lineWidth(1).strokeStyle("white").antialias(!1),e.vis.add(pv.Label).data(us_lowres).left((function(t){return u(t.centLatLon).x})).top((function(t){return u(t.centLatLon).y})).text((function(t){return t.code})).textAlign("center").textBaseline("middle"),e.vis.add(pv.Bar).data(pv.range(14,32.1,3)).bottom((function(t){return 12*this.index})).height(10).width(10).left(5).fillStyle((function(t){return n(14+3*this.index)})).lineWidth(null).anchor("right").add(pv.Label).textAlign("left").text((function(t){return t+" - "+(t+3)+"%"})),e.vis.render()},IG$.v$olapChartView.prototype.drD3MapLD=function(t){var e=d3.geo.path(),n=d3.select(this.container).append("svg"),a=n.append("g").attr("id","counties").attr("class","Blues"),r=n.append("g").attr("id","states");d3.json("./data/us-counties.json",(function(t){a.selectAll("path").data(t.features).enter().append("path").attr("class",data?d:null).attr("d",e)})),d3.json("./data/us-states.json",(function(t){r.selectAll("path").data(t.features).enter().append("path").attr("d",e)}));var o=[];for(i=t.rowfix;i<t._tabledata.length;i++){var l,s=t._tabledata[i][0].text,c=0;for(j=t.colfix;j<t.colcnt;j++)l=t._tabledata[i][j].code,c+=Number(l);o[s]=c}function d(t){return"q"+Math.min(8,~~(9*o[t.id]/12))+"-9"}a.selectAll("path").attr("class",d)},IG$.v$olapChartView.prototype.drD3ExtMapLD=function(){var t,e,n,a,r,i,o,l,s,c,d=this,u=d.mresult,p=u.colfix,h=u.rowfix,v=u._tabledata,f=v.length>0?v[0].length:0,g=d.container,m=d.cop,x=d.sheetoption?d.sheetoption.model:null,b=m.mapcategory,y=-1,w=IG$.mLU?IG$.mLU.maptype:null,_=null,k={},I=[],G=function(t){return t<17?"#008038":t<20?"#A3D396":t<23?"#FDD2AA":t<26?"#F7976B":t<29?"#F26123":t<32?"#E12816":"#B7161E"},M=d.sheetoption.model.chart_option,S=(M?M.xaxissep:null)||ig$.chart_separator||IG$._separator;if(S="nl"==S?"\n":S,w)for(e=0;e<w.length;e++)if(w[e].subtype==m.maptype){_=w[e];break}if(x){for(e=0;e<x.rows.length;e++)if(x.rows[e].uid==b){y=e;break}y<0&&x.rows.length>0&&(y=0)}if(null!=_){for(e=p;e<f;e++){for(c="",n=0;n<h;n++)c+=(n>0?S:"")+((a=v[n][e]).text||a.code);I.push({cindex:e,c:e-p,name:c,maxvalue:null,minvalue:null,sumvalue:0})}for(e=h;e<v.length;e++){if(r=(r=y>-1?v[e][y].code:"NO_REGION")?r.toLowerCase():"",l=(l=y>-1?v[e][y].value:"NO_REGION")?l.toLowerCase():"",k[r])s=k[r];else for(k[r]=s=[],n=0;n<I.length;n++)s.push(0);if(r!=l)if(k[l])s=k[l];else for(k[l]=s=[],n=0;n<I.length;n++)s.push(0);for(n=p;n<f;n++)o=n-p,i=(a=v[e][n]).code&&""!=a.code?parseFloat(a.code):0,s[o]+=i,I[o].maxvalue=null==I[o].maxvalue?s[o]:Math.max(I[o].maxvalue,s[o]),I[o].minvalue=null==I[o].minvalue?s[o]:Math.min(I[o].minvalue,s[o]),I[o].sumvalue+=i}t="./data/"+_.filename;$.getJSON(t,(function(t){var e=$(g),n=new gJ(e);n.color=G,n.clickHandler={o:d,f:function(t){var e={name:n.mapseries[n.legidx||0].name},a={point:{category:t.name||t.value}};" "==e.name.charAt(e.name.length-1)&&(e.name=e.name.substring(0,e.name.length-1)),d.procClickEvent.call(d,e,a)}},n.drawMap.call(n,t,{scale:_.scale,maptype:_.subtype,mapseries:I,mapdp:k})}))}},IG$.v$olapChartView.prototype.drGSAPIMapLD=function(){var t=this.container,e=new google.visualization.GeoChart(t),n=new google.visualization.DataTable;n.addColumn("string","State"),n.addColumn("number","Data"),e.draw(n,{region:"840"})},window.Highcharts?IG$.v$olapChartView.prototype.drTreeMapLD=function(t){var e,n,a,r,i,o,l,s,c=this,d=t._tabledata,u=t.colfix,p=t.rowfix,h=c.sheetoption.model.chart_option,v=h.tm_l_cl,f=t._tabledata.length>0?t._tabledata[0].length:0,g=[],m=[],x=[],b=$(c.container),y={ty:0},w=0,_=(h?h.xaxissep:null)||ig$.chart_separator||IG$._separator;for(_="nl"==_?"\n":_,b.empty(),s=IG$.__chartoption&&IG$.__chartoption.chartcolors&&IG$.__chartoption.chartcolors[h.colorset]?IG$.__chartoption.chartcolors[h.colorset]:Highcharts.getOptions().colors,e=0;e<u;e++)m.push({value:null,seq:0,point:null});for(e=u;e<f;e++){for(G="",n=0;n<p;n++)G=0==n?d[n][e].text:G+_+d[n][e].text;x.push({name:G,selected:e-u==c.ti})}for(x&&x.length>1&&(o=$("<div class='mtreemap-caption'></div>"),b.append(o),$.each(x,(function(t,e){$("<input type='radio' name='category' value='"+t+"'>"+e.name+"&nbsp;&nbsp;&nbsp;&nbsp;</input>").prop("checked",e.selected).appendTo(o).bind("change",(function(e){c.ti=t,c.drTreeMap.call(c,c.mresult)}))})),y.ty=o.height()),e=p;e<d.length;e++){for(a=d[e],n=0;n<u;n++)val=a[n].text,m[n].value!=val&&(0==n?(r={id:"id_"+m[n].seq,name:val,value:0},v?r.colorValue=0:r.color=s[w%s.length],m[n].seq++,m[n].point=r,g.push(r),w++):(r={id:(i=m[n-1].point).id+"_"+m[n].seq,name:val,parent:i.id,value:0},v&&(r.colorValue=0),m[n].seq++,m[n].point=r,g.push(r))),m[n].value=val,v&&(m[n].colorValue=val);if(a.length>c.ti+u)for(l=a[c.ti+u],r={id:(i=m[u-1].point).id+"_"+(c.ti+u),name:x[c.ti].name,parent:i.id,value:Number(l.code)},v&&(r.colorValue=Number(l.code)),g.push(r),k=0;k<m.length;k++)val=Number(l.code),val&&(m[k].point.value+=val,v&&(m[k].point.colorValue=m[k].point.value))}var I=IG$.j$ext._w(b),G=IG$.j$ext._h(b),M=new Object;if(c.drawmode="treemap",y.box=$("<div></div>").appendTo(b),y.box.css({position:"absolute",width:I,height:G-y.ty,top:y.ty,left:0}),M.chart={animation:!1,renderTo:y.box[0],reflow:!1,alignTicks:!0,borderWidth:0},M.colors=s,1==h.showtitle){var S=h.title||"";switch(M.title={text:S},h.titleposition){case"BOTTOM_LEFT":M.title.align="left",M.title.floating=!0,M.chart.marginBottom=50,M.title.y=G-20;break;case"BOTTOM_CENTER":M.title.align="center",M.title.floating=!0,M.chart.marginBottom=50,M.title.y=G-20;break;case"BOTTOM_RIGHT":M.title.align="right",M.title.floating=!0,M.chart.marginBottom=50,M.title.y=G-20;break;case"TOP_LEFT":M.title.align="left",M.title.verticalAlign="top";break;case"TOP_CENTER":break;case"TOP_RIGHT":M.title.align="right",M.title.verticalAlign="top"}}else M.title={text:""};v&&(M.colorAxis={minColor:"#FFFFFF",maxColor:Highcharts.getOptions().colors[0]}),M.series=[{type:"treemap",layoutAlgorithm:h.tm_l_alg||"squarified",allowDrillToNode:!0,dataLabels:{enabled:!1},levelIsConstant:!1,levels:[{level:1,colorByPoint:!1,dataLabels:{enabled:!0},borderWidth:2}],drillUpButton:{text:"< "+IRm$.r1("B_BACK"),relativeTo:"plotBox",position:{y:0,x:0}},data:g}],y.map=new Highcharts.Chart(M),c.treemap=y}:IG$.v$olapChartView.prototype.drTreeMapLD=function(t){var e,n,a,r,i,o,l,s,c,d,u,p=this,h=t._tabledata,v=t.colfix,f=t.rowfix,g=p.sheetoption.model.chart_option,m=g.tm_l_cl,x=h.length>0?h[0].length:0,b=[],y=[],w=[],_=$(p.container),k={ty:0},I=g.colorset||t.c_cset,G=(g?g.xaxissep:null)||ig$.chart_separator||IG$._separator;for(G="nl"==G?"\n":G,_.empty(),IG$.__chartoption&&IG$.__chartoption.chartcolors&&IG$.__chartoption.chartcolors[I]&&(l=IG$.__chartoption.chartcolors[I]),e=0;e<v;e++)y.push({value:null,seq:0,point:null});for(e=v;e<x;e++){for(S="",n=0;n<f;n++)S=0==n?h[n][e].text:S+G+h[n][e].text;w.push({name:S,selected:e-v==p.ti})}for(w&&w.length>1&&(i=$("<div class='mtreemap-caption'></div>"),_.append(i),$.each(w,(function(t,e){$("<input type='radio' name='category' value='"+t+"'>"+e.name+"&nbsp;&nbsp;&nbsp;&nbsp;</input>").prop("checked",e.selected).appendTo(i).bind("change",(function(e){p.ti=t,p.drTreeMap.call(p,p.mresult)}))})),k.ty=i.height()),d=[],n=0;n<v;n++)d.push({});for(e=f;e<h.length;e++){for(a=h[e],"",n=0;n<v;n++)val=a[n].text||a[n].code,0==n?(!c||c&&c.name!=val?(r={name:val,path:val},b.push(r),c=r):r=c,d[0]=r):((s=d[n-1]).children=s.children||[],s.childmap=s.childmap||{},s.childmap[val]?r=s.childmap[val]:(r={name:val,path:s.path+"/"+val},s.children.push(r),s.childmap[val]=r),d[n]=r),s=r;if(a.length>p.ti+v&&(o=a[p.ti+v],u=Number(o.code),0==isNaN(u)))for(n=0;n<d.length;n++)r=d[n],isNaN(r.value)?r.value=u:r.value+=u}var M=IG$.j$ext._w(_),S=IG$.j$ext._h(_),N={};p.drawmode="treemap",k.box=$("<div></div>").appendTo(_),k.box.css({position:"absolute",width:M,height:S-k.ty,top:k.ty,left:0}),N.grid={left:10,top:10,bottom:10,right:10,containLabel:!0},N.chart={animation:!1,renderTo:k.box[0],reflow:!1,alignTicks:!0,borderWidth:0},N.tooltip={formatter:function(t){for(var e=t.value,n=t.treePathInfo,a=[],r=1;r<n.length;r++)a.push(n[r].name);return['<div class="tooltip-title">'+a.join("/")+"</div>",": "+e].join("")}},N.colors=l;var D,C=g.title||"",L=g.titleposition,B=N.grid;1==g.showtitle&&C?(D=N.title={text:C,show:!0,textStyle:{align:"center"}},L.indexOf("BOTTOM_")>-1?(D.bottom=25,B.bottom+=10):B.top+=30,L.indexOf("_LEFT")>-1?(D.textAlign="left",D.textStyle.align="left",D.left=20):L.indexOf("_RIGHT")>-1?(D.textAlign="left",D.right=120,D.textStyle.align="right"):(D.textAlign="center",D.right="50%",D.left="50%")):N.title={text:"",show:!1},m&&(N.colorAxis={minColor:"#FFFFFF",maxColor:l[0]}),N.series=[{type:"treemap",layoutAlgorithm:g.tm_l_alg||"squarified",allowDrillToNode:!1,dataLabels:{enabled:!1},label:{show:!0,formatter:"{b}"},data:b,breadcrumb:{show:!1},nodeClick:!1}],v>1&&(N.series[0].allowDrillToNode=!0,N.series[0].levelIsConstant=!1,N.series[0].levels=[{itemStyle:{normal:{borderWidth:2,gapWidth:4}}},{colorSaturation:[.3,.6],itemStyle:{normal:{borderColorSaturation:.7,gapWidth:2,borderWidth:2}}},{colorSaturation:[.3,.5],itemStyle:{normal:{borderColorSaturation:.6,gapWidth:1}}},{colorSaturation:[.3,.5]}],N.series[0].drillUpButton={text:"< "+IRm$.r1("B_BACK"),relativeTo:"plotBox",position:{y:0,x:0}},N.series[0].breadcrumb.show=!0,N.series[0].nodeClick="zoomToNode"),k.map=echarts.init(k.box[0],g.echart_theme||ig$.echarts_theme||"amplix"),k.map.setOption(N),p.treemap=k};