!function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return i(n||e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o"),n.print.apply(n,e),n.BufferArray.length>n.BufferMax?n.BufferArray.splice(0,1):n.javaconsole.scrollTop=n.javaconsole.scrollHeight},n.showconsole=function(){n.wrapper.classList.remove("hidden")},n.hideconsole=function(){n.wrapper.classList.add("hidden")},n.closer.onclick=function(){n.hideconsole()},n.hideconsole(),n}},{}],6:[function(e,t,n){t.exports=function(e){function t(){}function n(e,t,n){if(e.hasOwnProperty(t)&&"function"==typeof e[t]){var r=e[t];if("$overloads"in r)r.$defaultOverload=n;else if("$overloads"in n||r.length!==n.length){var i,s;"$overloads"in n?((i=n.$overloads.slice(0))[r.length]=r,s=n.$defaultOverload):((i=[])[n.length]=n,i[r.length]=r,s=r);var o=function(){return(o.$overloads[arguments.length]||("$methodArgsIndex"in o&&arguments.length>o.$methodArgsIndex?o.$overloads[o.$methodArgsIndex]:null)||o.$defaultOverload).apply(this,arguments)};o.$overloads=i,"$methodArgsIndex"in n&&(o.$methodArgsIndex=n.$methodArgsIndex),o.$defaultOverload=s,o.name=t,e[t]=o}}else e[t]=n}function r(e,t){function r(n){i.defineProperty(e,n,{get:function(){return t[n]},set:function(e){t[n]=e},enumerable:!0})}var s=[];for(var o in t)"function"==typeof t[o]?n(e,o,t[o]):"$"===o.charAt(0)||o in e||s.push(o);for(;s.length>0;)r(s.shift());e.$super=t}t.prototype=e.PConstants;var i=new t;return Object.keys(e).forEach(function(t){i[t]=e[t]}),i.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))},i.extendClassChain=function(e){for(var t=[e],n=e.$upcast;n;n=n.$upcast)r(n,e),t.push(n),e=n;for(;t.length>0;)t.pop().$self=e},i.extendStaticMembers=function(e,t){r(e,t)},i.extendInterfaceMembers=function(e,t){r(e,t)},i.addMethod=function(e,t,n,r){var i=e[t];if(i||r){var s=n.length;if("$overloads"in i)i.$overloads[s]=n;else{var o=function(){return(o.$overloads[arguments.length]||("$methodArgsIndex"in o&&arguments.length>o.$methodArgsIndex?o.$overloads[o.$methodArgsIndex]:null)||o.$defaultOverload).apply(this,arguments)},a=[];i&&(a[i.length]=i),a[s]=n,o.$overloads=a,o.$defaultOverload=i||n,r&&(o.$methodArgsIndex=s),o.name=t,e[t]=o}}else e[t]=n},i.createJavaArray=function(e,t){var n,r=null,s=null;if("string"==typeof e&&("boolean"===e?s=!1:"string"==typeof(n=e)&&-1!==["byte","int","char","color","float","long","double"].indexOf(n)&&(s=0)),"number"==typeof t[0]){var o=0|t[0];if(t.length<=1){(r=[]).length=o;for(var a=0;a "+r),c===u){if(0!==h.length)throw"Processing.js: Unable to load pjs sketch files: "+h.join("\n");var i=new e(t,l.join("\n"));o&&o(i)}}if("#"!==a.charAt(0)){var p,m,g;p=a,m=f,(g=new i).onreadystatechange=function(){var e;4===g.readyState&&(200!==g.status&&0!==g.status?e="Invalid XHR status "+g.status:""===g.responseText&&(e="withCredentials"in new i&&!1===(new i).withCredentials&&"file:"===n.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."),m(g.responseText,e))},g.open("GET",p,!0),g.overrideMimeType&&g.overrideMimeType("application/json"),g.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT"),g.send(null)}else{var d=r.getElementById(a.substring(1));d?f(d.text||d.textContent):f("","Unable to load pjs sketch: element with id '"+a.substring(1)+"' was not found")}}for(var l=[],h=[],u=s.length,c=0,f=0;f0;)for(t=e.instances.length-1;t>=0;t--)e.instances[t]&&e.instances[t].exit();var n,i=r.getElementsByTagName("canvas");for(t=0,l=i.length;t=0;a--)m.push(p[a]);for(a=0,c=m.length;a-1},this.indexOf=function(e){for(var n=0,i=r.length;n=0;--n)if(t(e,r[n]))return n;return-1},this.add=function(){if(1===arguments.length)r.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<=r.length))throw e+" is not a valid index";r.splice(e,0,arguments[1])}},this.addAll=function(e,t){var n;if("number"==typeof e){if(e<0||e>r.length)throw"Index out of bounds for addAll: "+e+" greater or equal than "+r.length;for(n=new ObjectIterator(t);n.hasNext();)r.splice(e++,0,n.next())}else for(n=new ObjectIterator(e);n.hasNext();)r.push(n.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-1&&(r.splice(e,1),!0)},this.removeAll=function(t){var n,r,i,s=new e;for(s.addAll(this),this.clear(),n=0,r=0;n=h.length)o=!0;else{if(!(void 0===h[i]||s>=h[i].length))return;s=-1,++i}}var r,i=0,s=-1,o=!1;this.hasNext=function(){return!o},this.next=function(){return r=e(h[i][s]),n(),r},this.remove=function(){void 0!==r&&(t(r),--s,n())},n()}(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;s0},this.size=function(){return c.size()},this.toArray=function(){for(var e=[],t=this.iterator();t.hasNext();)e.push(t.next());return e}}function o(e){this._isIn=function(t){return t===c&&void 0===e.removed},this.equals=function(t){return n(e.key,t.getKey())},this.getKey=function(){return e.key},this.getValue=function(){return e.value},this.hashCode=function(n){return t(e.key)},this.setValue=function(t){var n=e.value;return e.value=t,n}}if(1===arguments.length&&arguments[0]instanceof e)return arguments[0].clone();var a=arguments.length>0?arguments[0]:16,l=arguments.length>1?arguments[1]:.75,h=[];h.length=a;var u=0,c=this;this.clear=function(){u=0,(h=[]).length=a},this.clone=function(){var t=new e;return t.putAll(this),t},this.containsKey=function(e){var t=r(e),i=h[t];if(void 0===i)return!1;for(var s=0;s1?i.splice(s,1):h[t]=void 0,o}return null},this.removeByValue=function(e){var t,n,r,i;for(t in h)if(h.hasOwnProperty(t))for(n=0,r=h[t].length;n"+a,r.body.appendChild(l);var h=n.width,u=n.height,c=u/2;o.fillStyle="white",o.fillRect(0,0,h,u),o.fillStyle="black",o.fillText(a,0,c);for(var f=o.getImageData(0,0,h,u).data,p=0,m=4*h,g=f.length;++p0&&255===f[p];)i();var v=Math.round(p/m);if(e.ascent=t*(c-d),e.descent=t*(v-c),r.defaultView.getComputedStyle){var y=r.defaultView.getComputedStyle(l,null).getPropertyValue("height");(y=t*y.replace("px",""))>=2*e.size&&(e.leading=Math.round(y/2))}if(r.body.removeChild(l),e.caching)return o}(this),this.css=this.getCSSDefinition(),this.context2d&&(this.context2d.font=this.css)}var r=(e.Browser.window,e.Browser.document),i=e.noop;return n.prototype.caching=!0,n.prototype.getCSSDefinition=function(e,n){return e===t&&(e=this.size+"px"),n===t&&(n=this.leading+"px"),[this.style,"normal",this.weight,e+"/"+n,this.family].join(" ")},n.prototype.measureTextWidth=function(e){return this.context2d.measureText(e).width},n.prototype.measureTextWidthFallback=function(e){var t=r.createElement("canvas").getContext("2d");return t.font=this.css,t.measureText(e).width},n.PFontCache={length:0},n.get=function(e,t){t=(10*t+.5|0)/10;var r=n.PFontCache,i=e+"/"+t;if(!r[i]){if(r[i]=new n(e,t),r.length++,50===r.length){var s;n.prototype.measureTextWidth=n.prototype.measureTextWidthFallback,n.prototype.caching=!1;for(s in r)"length"!==s&&(r[s].context2d=null);return new n(e,t)}if(400===r.length)return n.PFontCache={},n.get=n.getFallback,new n(e,t)}return r[i]},n.getFallback=function(e,t){return new n(e,t)},n.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]},n.preloading={template:{},initialized:!1,initialize:function(){var e=r.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}",r.head.appendChild(e);var t=r.createElement("span");t.style.cssText='position: absolute; top: -1000; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;',t.innerHTML="AAAAAAAA",r.body.appendChild(t),this.template=t,this.initialized=!0},getElementWidth:function(e){return r.defaultView.getComputedStyle(e,"").getPropertyValue("width")},timeAttempted:0,pending:function(e){this.initialized||this.initialize();for(var t,n,i=this.getElementWidth(this.template),s=0;sPConstants.MIN_INT){var t=this.elements[0],n=this.elements[1],r=this.elements[2],i=this.elements[3],s=this.elements[4],o=this.elements[5];return this.elements[0]=s/e,this.elements[3]=-i/e,this.elements[1]=-n/e,this.elements[4]=t/e,this.elements[2]=(n*o-s*r)/e,this.elements[5]=(i*r-t*o)/e,!0}return!1},scale:function(e,n){e&&n===t&&(n=e),e&&n&&(this.elements[0]*=e,this.elements[1]*=n,this.elements[3]*=e,this.elements[4]*=n)},invScale:function(e,t){e&&!t&&(t=e),this.scale(1/e,1/t)},apply:function(){var e;1===arguments.length&&arguments[0]instanceof r?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,i=0;i<2;i++)for(var s=0;s<3;s++,n++)t[n]+=this.elements[3*i+0]*e[s+0]+this.elements[3*i+1]*e[s+3];this.elements=t.slice()},preApply:function(){var e;1===arguments.length&&arguments[0]instanceof r?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=Math.cos(e),n=Math.sin(e),r=this.elements[0],i=this.elements[1];this.elements[0]=t*r+n*i,this.elements[1]=-n*r+t*i,r=this.elements[3],i=this.elements[4],this.elements[3]=t*r+n*i,this.elements[4]=-n*r+t*i},rotateZ:function(e){this.rotate(e)},invRotateZ:function(e){this.rotateZ(e-Math.PI)},print:function(){var e=printMatrixHelper(this.elements),t=n.nfs(this.elements[0],e,4)+" "+n.nfs(this.elements[1],e,4)+" "+n.nfs(this.elements[2],e,4)+"\n"+n.nfs(this.elements[3],e,4)+" "+n.nfs(this.elements[4],e,4)+" "+n.nfs(this.elements[5],e,4)+"\n\n";n.println(t)}},r}},{}],15:[function(e,t,n){t.exports=function(e,t){var n=e.p,r=function(){this.reset()};return r.prototype={set:function(){16===arguments.length?this.elements=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof r?this.elements=arguments[0].array():1===arguments.length&&arguments[0]instanceof Array&&(this.elements=arguments[0].slice())},get:function(){var e=new r;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,n,r){r===t&&(r=0),this.elements[3]+=e*this.elements[0]+n*this.elements[1]+r*this.elements[2],this.elements[7]+=e*this.elements[4]+n*this.elements[5]+r*this.elements[6],this.elements[11]+=e*this.elements[8]+n*this.elements[9]+r*this.elements[10],this.elements[15]+=e*this.elements[12]+n*this.elements[13]+r*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 PVector?(n=e.x,r=e.y,i=e.z,s=1,t||(t=new PVector)):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 PVector&&(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 r?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,i=0;i<4;i++)for(var s=0;s<4;s++,n++)t[n]+=this.elements[s+0]*e[4*i+0]+this.elements[s+4]*e[4*i+1]+this.elements[s+8]*e[4*i+2]+this.elements[s+12]*e[4*i+3];this.elements=t.slice()},apply:function(){var e;1===arguments.length&&arguments[0]instanceof r?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,i=0;i<4;i++)for(var s=0;s<4;s++,n++)t[n]+=this.elements[4*i+0]*e[s+0]+this.elements[4*i+1]*e[s+4]+this.elements[4*i+2]*e[s+8]+this.elements[4*i+3]*e[s+12];this.elements=t.slice()},rotate:function(e,t,n,r){if(n){var i=Math.cos(e),s=Math.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(){inverseCopy===t&&(inverseCopy=new r);var e=arguments;return inverseCopy.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]),!!inverseCopy.invert()&&(this.preApply(inverseCopy),!0)},rotateX:function(e){var t=Math.cos(e),n=Math.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=Math.cos(e),n=Math.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=Math.cos(e),n=Math.sin(e);this.apply([t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1])},scale:function(e,n,r){e&&n===t&&r===t?n=r=e:e&&n&&r===t&&(r=1),e&&n&&r&&(this.elements[0]*=e,this.elements[1]*=n,this.elements[2]*=r,this.elements[4]*=e,this.elements[5]*=n,this.elements[6]*=r,this.elements[8]*=e,this.elements[9]*=n,this.elements[10]*=r,this.elements[12]*=e,this.elements[13]*=n,this.elements[14]*=r)},skewX:function(e){var t=Math.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=Math.tan(e);this.apply(1,0,0,0,t,1,0,0,0,0,1,0,0,0,0,1)},shearX:function(e){var t=Math.tan(e);this.apply(1,t,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},shearY:function(e){var t=Math.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],n=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4],r=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5],i=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5],s=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6],o=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12],a=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12],l=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12],h=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13],u=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],f=e*c-t*u+n*h+r*l-i*a+s*o;if(Math.abs(f)<=1e-9)return!1;var p=[];p[0]=+this.elements[5]*c-this.elements[6]*u+this.elements[7]*h,p[4]=-this.elements[4]*c+this.elements[6]*l-this.elements[7]*a,p[8]=+this.elements[4]*u-this.elements[5]*l+this.elements[7]*o,p[12]=-this.elements[4]*h+this.elements[5]*a-this.elements[6]*o,p[1]=-this.elements[1]*c+this.elements[2]*u-this.elements[3]*h,p[5]=+this.elements[0]*c-this.elements[2]*l+this.elements[3]*a,p[9]=-this.elements[0]*u+this.elements[1]*l-this.elements[3]*o,p[13]=+this.elements[0]*h-this.elements[1]*a+this.elements[2]*o,p[2]=+this.elements[13]*s-this.elements[14]*i+this.elements[15]*r,p[6]=-this.elements[12]*s+this.elements[14]*n-this.elements[15]*t,p[10]=+this.elements[12]*i-this.elements[13]*n+this.elements[15]*e,p[14]=-this.elements[12]*r+this.elements[13]*t-this.elements[14]*e,p[3]=-this.elements[9]*s+this.elements[10]*i-this.elements[11]*r,p[7]=+this.elements[8]*s-this.elements[10]*n+this.elements[11]*t,p[11]=-this.elements[8]*i+this.elements[9]*n-this.elements[11]*e,p[15]=+this.elements[8]*r-this.elements[9]*t+this.elements[10]*e;var m=1/f;return p[0]*=m,p[1]*=m,p[2]*=m,p[3]*=m,p[4]*=m,p[5]*=m,p[6]*=m,p[7]*=m,p[8]*=m,p[9]*=m,p[10]*=m,p[11]*=m,p[12]*=m,p[13]*=m,p[14]*=m,p[15]*=m,this.elements=p.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=printMatrixHelper(this.elements),t=n.nfs(this.elements[0],e,4)+" "+n.nfs(this.elements[1],e,4)+" "+n.nfs(this.elements[2],e,4)+" "+n.nfs(this.elements[3],e,4)+"\n"+n.nfs(this.elements[4],e,4)+" "+n.nfs(this.elements[5],e,4)+" "+n.nfs(this.elements[6],e,4)+" "+n.nfs(this.elements[7],e,4)+"\n"+n.nfs(this.elements[8],e,4)+" "+n.nfs(this.elements[9],e,4)+" "+n.nfs(this.elements[10],e,4)+" "+n.nfs(this.elements[11],e,4)+"\n"+n.nfs(this.elements[12],e,4)+" "+n.nfs(this.elements[13],e,4)+" "+n.nfs(this.elements[14],e,4)+" "+n.nfs(this.elements[15],e,4)+"\n\n";n.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=Math.cos(-e),n=Math.sin(-e);this.preApply([1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1])},invRotateY:function(e){var t=Math.cos(-e),n=Math.sin(-e);this.preApply([t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1])},invRotateZ:function(e){var t=Math.cos(-e),n=Math.sin(-e);this.preApply([t,-n,0,0,n,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])}},r}},{}],16:[function(e,t,n){t.exports=function(e){var t=e.PConstants,n=e.PMatrix2D,r=e.PMatrix3D,i=function(e){this.family=e||t.GROUP,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};return i.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;e0){for(t=0,n=this.nameTable.length;t, it's <"+this.element.getName()+">"}else 2===arguments.length&&("string"==typeof arguments[1]?arguments[1].indexOf(".svg")>-1&&(this.element=new i(!0,arguments[1]),this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=n.ALPHA_MASK,this.strokeWeight=1,this.strokeCap=n.SQUARE,this.strokeJoin=n.MITER,this.strokeGradient="",this.strokeGradientPaint="",this.strokeName="",this.strokeOpacity=1,this.fill=!0,this.fillColor=n.ALPHA_MASK,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 s=this.element.getStringAttribute("viewBox");if(null!==s){var o=s.split(" ");this.width=o[2],this.height=o[3]}var a=this.element.getStringAttribute("width"),l=this.element.getStringAttribute("height");if(null!==a)this.width=this.parseUnitSize(a),this.height=this.parseUnitSize(l);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 tag of this file.";this.parseColors(this.element),this.parseChildren(this.element)};return(o.prototype=new r).parseMatrix=function(){function e(e){var t=[];return e.replace(/\((.*?)\)/,function(e,n){t=n.replace(/,+/g," ").split(/\s+/)}),t}return function(n){this.checkMatrix(2);var r=[];if(n.replace(/\s*(\w+)\((.*?)\)/g,function(e){r.push(t.trim(e))}),0===r.length)return null;for(var i=0,s=r.length;i=65&&w<=90||w>=97&&w<=122){if(s=x,++x=65&&w<=90||w>=97&&w<=100||w>=102&&w<=122)&&!1===P;)32===w?(""!==E&&(S.push(parseFloat(E)),E=""),x++):45===w?101===e[x-1].charCodeAt(0)?(E+=e[x].toString(),x++):(""!==E&&S.push(parseFloat(E)),E=e[x].toString(),x++):(E+=e[x].toString(),x++),x===e.length?P=!0:w=e[x].charCodeAt(0);if(""!==E&&(S.push(parseFloat(E)),E=""),77===(w=(i=e[s]).charCodeAt(0))){if(S.length>=2&&S.length%2==0&&(a=S[0],l=S[1],this.parsePathMoveto(a,l),S.length>2))for(s=2,o=S.length;s=2&&S.length%2==0&&(a+=S[0],l+=S[1],this.parsePathMoveto(a,l),S.length>2))for(s=2,o=S.length;s=2&&S.length%2==0)for(s=0,o=S.length;s=2&&S.length%2==0)for(s=0,o=S.length;s=6&&S.length%6==0)for(s=0,o=S.length;s=6&&S.length%6==0)for(s=0,o=S.length;s=4&&S.length%4==0)for(s=0,o=S.length;s=4&&S.length%4==0)for(s=0,o=S.length;s=4&&S.length%4==0)for(s=0,o=S.length;s=4&&S.length%4==0)for(s=0,o=S.length;s=2&&S.length%2==0)for(s=0,o=S.length;s=2&&S.length%2==0)for(s=0,o=S.length;s0))throw"Path must start with M/m";this.parsePathCode(n.BEZIER_VERTEX),this.parsePathVertex(e+2*(r-e)/3,t+2*(i-t)/3),this.parsePathVertex(s+2*(r-s)/3,o+2*(i-o)/3),this.parsePathVertex(s,o)},o.prototype.parsePathCurveto=function(e,t,r,i,s,o){if(!(this.vertices.length>0))throw"Path must start with M/m";this.parsePathCode(n.BEZIER_VERTEX),this.parsePathVertex(e,t),this.parsePathVertex(r,i),this.parsePathVertex(s,o)},o.prototype.parsePathLineto=function(e,t){if(!(this.vertices.length>0))throw"Path must start with M/m";this.parsePathCode(n.VERTEX),this.parsePathVertex(e,t),this.vertices[this.vertices.length-1].moveTo=!1},o.prototype.parsePathMoveto=function(e,t){this.vertices.length>0&&this.parsePathCode(n.BREAK),this.parsePathCode(n.VERTEX),this.parsePathVertex(e,t),this.vertices[this.vertices.length-1].moveTo=!0},o.prototype.parsePathVertex=function(e,t){var n=[];n[0]=e,n[1]=t,this.vertices.push(n)},o.prototype.parsePathCode=function(e){this.vertexCodes.push(e)},o.prototype.parsePoly=function(e){this.family=n.PATH,this.close=e;var r=t.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(null!==r){var i=r.split(" ");if(i.length%2!=0)throw"Error parsing polygon points: odd number of coordinates provided";for(var s=0,o=i.length;s"},o.prototype.parseEllipse=function(e){var t,r;if(this.kind=n.ELLIPSE,this.family=n.PRIMITIVE,this.params=[],this.params[0]=0|this.element.getFloatAttribute("cx"),this.params[1]=0|this.element.getFloatAttribute("cy"),e){if((t=r=this.element.getFloatAttribute("r"))<0)throw"svg error: negative radius found while parsing "}else if(t=this.element.getFloatAttribute("rx"),r=this.element.getFloatAttribute("ry"),t<0||r<0)throw"svg error: negative x-axis radius or y-axis radius found while parsing ";this.params[0]-=t,this.params[1]-=r,this.params[2]=2*t,this.params[3]=2*r},o.prototype.parseLine=function(){this.kind=n.LINE,this.family=n.PRIMITIVE,this.params=[],this.params[0]=this.element.getFloatAttribute("x1"),this.params[1]=this.element.getFloatAttribute("y1"),this.params[2]=this.element.getFloatAttribute("x2"),this.params[3]=this.element.getFloatAttribute("y2")},o.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 n=e.getStringAttribute("style"),r=n.toString().split(";"),i=0,s=r.length;i0&&this.div(e)},limit:function(e){this.mag()>e&&(this.normalize(),this.mult(e))},heading:function(){return-Math.atan2(-this.y,this.x)},heading2D:function(){return this.heading()},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};for(var s in n.prototype)n.prototype.hasOwnProperty(s)&&!n.hasOwnProperty(s)&&(n[s]=r(s));return n}},{}],19:[function(e,t,n){t.exports=function(){var e=function(e,t,n,r,i){this.fullName=e||"",this.name=t||"",this.namespace=n||"",this.value=r,this.type=i};return e.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}},e}},{}],20:[function(e,t,n){t.exports=function(e,t){var n=e.Browser,r=n.ajax,i=n.window,s=(i.XMLHttpRequest,i.DOMParser),o=e.XMLAttribute,a=function(e,n,r,i){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",e&&("string"==typeof e?n===t&&e.indexOf("<")>-1?this.parse(e):(this.fullName=e,this.namespace=n,this.systemId=r,this.lineNr=i):this.parse(n,!0))};return a.prototype={parse:function(e,t){try{t&&(e=r(e));var n=(new s).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,l,h;if(e?(n=new a(t.nodeName)).parent=e:(this.fullName=t.localName,this.name=t.nodeName,n=this),3===t.nodeType&&""!==t.textContent)return this.createPCDataElement(t.textContent);if(4===t.nodeType)return this.createCDataElement(t.textContent);if(t.attributes)for(s=0,l=t.attributes.length;s":">","'":"'",'"':"""};for(n in r)Object.hasOwnProperty(r,n)||(e=e.replace(new RegExp(n,"g"),r[n]));return t.cdata=e,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 a))return!1;var t,n,r,i,s;if(this.fullName!==e.fullName)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;t0){var o,l;for(t=0,n=this.children.length;t0},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(e){if("number"==typeof e)return this.children[e];if(-1!==e.indexOf("/"))return this.getChildRecursive(e.split("/"),0);for(var t,n,r=0,i=this.getChildCount();re&&this.children.splice(e,1)},findAttribute:function(e,t){this.namespace=t||"";for(var n=0,r=this.attributes.length;n0&&Processing.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||"";if("CDATA"===this.type)return this.cdata||"";var e,t,n=this.fullName,r="<"+n;for(e=0;e":">"+this.content+"";else{for(r+=">",t=0;t"}return r}},a.parse=function(e){var t=new a;return t.parse(e),t},a}},{}],21:[function(e,t,n){t.exports={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"}},{}],22:[function(e,t,n){t.exports=function(e,t,n){return function(r,i){r.__contains=function(e,t){return"string"!=typeof e?e.contains.apply(e,i(arguments)):null!==e&&null!==t&&"string"==typeof t&&e.indexOf(t)>-1},r.__replaceAll=function(e,t,n){return"string"!=typeof e?e.replaceAll.apply(e,i(arguments)):e.replace(new RegExp(t,"g"),n)},r.__replaceFirst=function(e,t,n){return"string"!=typeof e?e.replaceFirst.apply(e,i(arguments)):e.replace(new RegExp(t,""),n)},r.__replace=function(e,t,n){if("string"!=typeof e)return e.replace.apply(e,i(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 s=0,o="";do{o+=e.substring(s,r)+n,s=r+t.length}while((r=e.indexOf(t,s))>=0);return o+e.substring(s)},r.__equals=function(e,n){return e.equals instanceof Function?e.equals.apply(e,i(arguments)):t(e,n)},r.__equalsIgnoreCase=function(e,t){return"string"!=typeof e?e.equalsIgnoreCase.apply(e,i(arguments)):e.toLowerCase()===t.toLowerCase()},r.__toCharArray=function(e){if("string"!=typeof e)return e.toCharArray.apply(e,i(arguments));for(var t=[],n=0,r=e.length;ne.length||""!==t&&t!==e&&e.indexOf(t)!==n)},r.__endsWith=function(e,t){if("string"!=typeof e)return e.endsWith.apply(e,i(arguments));var n=t?t.length:0;return""===t||t===e||e.indexOf(t)===e.length-n},r.__hashCode=function(t){return t.hashCode instanceof Function?t.hashCode.apply(t,i(arguments)):e(t)},r.__printStackTrace=function(e){r.println("Exception: "+e.toString())}}}},{}],23:[function(e,t,n){t.exports=function(e,t){function n(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.doubleGenerator=function(){var e=i()/4294967296;return e<0?1+e:e},this.intGenerator=i}var r=function(){return Math.random()};e.abs=Math.abs,e.ceil=Math.ceil,e.exp=Math.exp,e.floor=Math.floor,e.log=Math.log,e.pow=Math.pow,e.round=Math.round,e.sqrt=Math.sqrt,e.acos=Math.acos,e.asin=Math.asin,e.atan=Math.atan,e.atan2=Math.atan2,e.cos=Math.cos,e.sin=Math.sin,e.tan=Math.tan,e.constrain=function(e,t,n){return e>n?n:e0))throw"Non-empty array is expected";for(var t=e[0],n=e.length,r=1;r0))throw"Non-empty array is expected";for(var t=e[0],n=e.length,r=1;re[r]&&(t=e[r]);return t},e.norm=function(e,t,n){return(e-t)/(n-t)},e.sq=function(e){return e*e},e.degrees=function(e){return 180*e/Math.PI},e.random=function(e,t){if(0===arguments.length?(t=1,e=0):1===arguments.length&&(t=e,e=0),e===t)return e;for(var n=0;n<100;n++){var i=r()*(t-e)+e;if(i!==t)return i}return e},n.createRandomized=function(){var e=new Date;return new n(e/6e4&4294967295,4294967295&e)},e.randomSeed=function(e){r=new n(e,(e<<16)+(e>>16)).doubleGenerator,this.haveNextNextGaussian=!1},e.randomGaussian=function(){if(this.haveNextNextGaussian)return this.haveNextNextGaussian=!1,this.nextNextGaussian;var e,t,n;do{e=2*r()-1,t=2*r()-1,n=e*e+t*t}while(n>=1||0===n);var i=Math.sqrt(-2*Math.log(n)/n);return this.nextNextGaussian=t*i,this.haveNextNextGaussian=!0,e*i};var i={generator:t,octaves:4,fallout:.5,seed:t};e.noise=function(e,r,s){i.generator===t&&(i.generator=new function(e){function r(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 i(e,t,n){var r=0==(1&e)?t:n;return 0==(2&e)?-r:r}function s(e,t){return 0==(1&e)?-t:t}function o(e,t,n){return t+e*(n-t)}var a,l,h=e!==t?new n(e,(e<<16)+(e>>16)):n.createRandomized(),u=new Uint8Array(512);for(a=0;a<256;++a)u[a]=a;for(a=0;a<256;++a){var c=u[l=255&h.intGenerator()];u[l]=u[a],u[a]=c}for(a=0;a<256;++a)u[a+256]=u[a];this.noise3d=function(e,t,n){var i=255&Math.floor(e),s=255&Math.floor(t),a=255&Math.floor(n),l=(3-2*(e-=Math.floor(e)))*e*e,h=(3-2*(t-=Math.floor(t)))*t*t,c=(3-2*(n-=Math.floor(n)))*n*n,f=u[i]+s,p=u[f]+a,m=u[f+1]+a,g=u[i+1]+s,d=u[g]+a,v=u[g+1]+a;return o(c,o(h,o(l,r(u[p],e,t,n),r(u[d],e-1,t,n)),o(l,r(u[m],e,t-1,n),r(u[v],e-1,t-1,n))),o(h,o(l,r(u[p+1],e,t,n-1),r(u[d+1],e-1,t,n-1)),o(l,r(u[m+1],e,t-1,n-1),r(u[v+1],e-1,t-1,n-1))))},this.noise2d=function(e,t){var n=255&Math.floor(e),r=255&Math.floor(t),s=(3-2*(e-=Math.floor(e)))*e*e,a=(3-2*(t-=Math.floor(t)))*t*t,l=u[n]+r,h=u[n+1]+r;return o(a,o(s,i(u[l],e,t),i(u[h],e-1,t)),o(s,i(u[l+1],e,t-1),i(u[h+1],e-1,t-1)))},this.noise1d=function(e){var t=255&Math.floor(e);return o((3-2*(e-=Math.floor(e)))*e*e,s(u[t],e),s(u[t+1],e-1))}}(i.seed));for(var o=i.generator,a=1,l=1,h=0,u=0;u1e-6&&l<7;)++l,h*=10;else 0!==l&&(h*=Math.pow(10,l));var u,c=2*h;if(Math.floor(h)===h)u=h;else if(Math.floor(c)===c){var f=Math.floor(h);u=f+f%2}else u=Math.round(h);for(var p="",m=r+l;m>0||u>0;)m--,p=""+u%10+p,u=Math.floor(u/10);if(void 0!==s)for(var g=p.length-3-l;g>0;)p=p.substring(0,g)+s+p.substring(g),g-=3;return l>0?o+p.substring(0,p.length-l)+"."+p.substring(p.length-l,p.length):o+p},nfCore:function(e,t,n,i,s,o){if(e instanceof Array){for(var a=[],l=0,h=e.length;l=0){i=new g(a[1]);break}n.push(new g(a[1]))}return new d(n,i)}function y(e,t){this.baseInterfaceName=e,this.body=t,t.owner=this}function A(e,t,n){this.name=e,this.params=t,this.body=n}function b(e){var t=new RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/).exec(e);return new A("function"!==t[1]?t[1]:null,v(de[t[2]]),pe(de[t[3]]))}function x(e){this.members=e}function w(e){if("("===e.charAt(0)||"["===e.charAt(0))return e.charAt(0)+w(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)?"{"+u(e.substring(1,e.length-1),"I")+"}":"["+w(e.substring(1,e.length-1))+"]";var t=n(e),r=function(e){function t(e,t,r,s){var o=de[s];i=!0;var a=n(o.substring(1,o.length-1));return"__"+r+(""===a.middle?u("("+t.replace(/\.\s*$/,"")+")","B"):u("("+t.replace(/\.\s*$/,"")+","+a.middle+")","B"))}function r(e,t,n){return i=!0,"__instanceof"+u("("+t+", "+n+")","B")}var i,s=e;s=(s=(s=(s=(s=(s=(s=(s=(s=(s=(s=(s=(s=(s=(s=s.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 u(e,"F")})).replace(Se,function(e){return u(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 de[t]}).replace(/\[\s*\]/g,"[null]").replace(/\s*\]\s*\[\s*/g,", ");return"$p.createJavaArray"+u("('"+t+"', "+u("{"+r.substring(1,r.length-1)+"}","A")+")","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=de[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(de[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=de[r];return i?"pixels.setPixel"+u("("+o.substring(1,o.length-1)+","+s+")","B"):"pixels.getPixel"+u("("+o.substring(1,o.length-1)+")","B")}return t?"pixels.getLength"+u("()","B"):i?"pixels.set"+u("("+s+")","B"):"pixels.toArray"+u("()","B")});do{i=!1,s=s.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|matches)\s*"B(\d+)"/g,t)}while(i);do{i=!1,s=s.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,r)}while(i);return s.replace(/\bthis(\s*"B\d+")/g,"$$constr$1")}(t.middle);return r=r.replace(/"[ABC](\d+)"/g,function(e,t){return w(de[t])}),t.untrim(r)}function E(e,t){this.expr=e,this.transforms=t}function S(e,t,n){this.name=e,this.value=t,this.isDefault=n}function P(e,t){var n,i,s,o=e.indexOf("=");return o<0?(n=e,i=t,s=!0):(n=e.substring(0,o),i=ge(e.substring(o+1)),s=!1),new S(r(n.replace(/(\s*"C\d+")+/g,"")),i,s)}function C(e){return"int"===e||"float"===e?"0":"boolean"===e?"false":"color"===e?"0x00000000":"null"}function M(e,t){this.definitions=e,this.varType=t}function T(e){this.expression=e}function _(e){if(xe.test(e)){for(var t=Ee.exec(e),n=e.substring(t[0].length).split(","),r=C(t[2]),i=0;i=0,i=de[h(t[6])],s=ue,o=c();return ue=o,f(n="interface"===t[2]?new O(t[3],fe(i,t[3],t[4]),r):new N(t[3],ce(i,t[3],t[4],t[5]),r),o,s),ue=s,n}function k(e,t,n,r){this.name=e,this.params=t,this.body=n,this.isStatic=r}function B(e){var t=be.exec(e);be.lastIndex=0;var n=t[1].indexOf("static")>=0,r=";"!==t[6]?de[h(t[6])]:"{}";return new k(t[3],v(de[h(t[4])]),pe(r),n)}function $(e,t,n){this.definitions=e,this.fieldType=t,this.isStatic=n}function G(e){for(var t=Ee.exec(e),n=t[1].indexOf("static")>=0,r=e.substring(t[0].length).split(/,\s*/g),i=C(t[2]),s=0;s([=]?)/g,le)}while(re);var he,ue,ce,fe,pe,me,ge,de=function(e){for(var t=[],n=e.split(/([\{\[\(\)\]\}])/),r=n[0],i=[],s=1;s0&&(n+=this.functions.join("\n")+"\n"),D(this.innerClasses),u=0,c=this.innerClasses.length;u0&&(n+=this.cstrs.join("\n")+"\n"),n+="function $constr() {\n";var C=[];for(u=0,c=this.cstrs.length;u=":"===")+" "+M+") { $constr_"+M+".apply("+e+", arguments); }")}return C.length>0&&(n+=C.join(" else ")+" else "),n+="$superCstr();\n}\n",he=m,"(function() {\nfunction "+t+"() {\n"+(n+="$constr.apply(null, arguments);\n")+"}\n"+i+s+"return "+t+";\n})()"},ce=function(e,t,r,s){var o,a,l,h=e.substring(1,e.length-1),u=[],c=[],f=[],g=[],d=(h=(h=m(h=p(h),t)).replace(/"([DEGH])(\d+)"/g,function(e,t,n){return"D"===t?u.push(n):"E"===t?c.push(n):"H"===t?g.push(n):f.push(n),""})).replace(/^(?:\s*;)+/,"").split(/;(?:\s*;)*/g);for(r!==i&&(o=r.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g,"$1")),s!==i&&(a=s.replace(/^\s*implements\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)),l=0;l=0&&o.indexOf(";")<0?new I(_(r((a=o.substring(1,o.length-1).split(":"))[0])),ge(a[1])):new R(_(r((a=o.substring(1,o.length-1).split(";"))[0])),ge(a[1]),ge(a[2]))),{prefix:m})):"catch"===u[1]?h.push(new Z(v(de[u[2]]),{prefix:m})):h.push(new q(u[1],ge(de[u[2]]),{prefix:m}))}else if(u[3]!==i)h.push(new q(u[3],i,{prefix:e.substring(f,l.lastIndex)}));else if(u[4]!==i){if(0!==r(c=e.substring(f,l.lastIndex-u[4].length)).length)continue;h.push(c);var g=u[4].charAt(1),d=u[5];"D"===g?h.push(t(de[d])):"E"===g?h.push(s(de[d])):"H"===g?h.push(b(de[d])):h.push(pe(de[d]))}else if(u[6]!==i)h.push(new Q(ge(r(u[7]))));else if(u[8]!==i){if(0!==r(c=e.substring(f,l.lastIndex-u[8].length)).length)continue;h.push(new J(e.substring(f,l.lastIndex)))}else{var y=n(e.substring(f,l.lastIndex-1));h.push(y.left),h.push(_(y.middle)),h.push(y.right+";")}f=l.lastIndex}var A=n(e.substring(f));return h.push(A.left),""!==A.middle&&(h.push(_(A.middle)),h.push(";"+A.right)),h},te.prototype.toString=function(){var e=ee(this.statements),t=he;(function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0})(e)||(he=function(n){return e.hasOwnProperty(n.name)?n.name:t(n)});var n="{\n"+this.statements.join("")+"\n}";return he=t,n},pe=function(e){var t=n(e.substring(1,e.length-1));return new te(me(t.middle))},ne.prototype.toString=function(){for(var e,t=[],n=[],r=0,i=this.statements.length;r0){for(c=0,f=p.length;c0&&(r.interfaces=m)}}})(),function(e){function t(e,t){var n=o[e];if(!n)return!1;var r=n.indexOf(t);return!(r<0||(n.splice(r,1),n.length>0||(delete o[e],0)))}var n,r,i,s=[],o={};for(n in ve)if(ve.hasOwnProperty(n))if(i=ve[n],i.inScope||i.derived){var a=[];if(i.inScope)for(r in i.inScope)i.inScope.hasOwnProperty(r)&&a.push(i.inScope[r]);i.derived&&(a=a.concat(i.derived)),o[n]=a}else s.push(n),i.weight=0;for(;s.length>0;)if(n=s.shift(),i=ve[n],i.scopeId&&t(i.scopeId,i)&&(s.push(i.scopeId),ve[i.scopeId].weight=i.weight+1),i.base&&t(i.base.classId,i)&&(s.push(i.base.classId),i.base.weight=i.weight+1),i.interfaces){var l,h;for(l=0,h=i.interfaces.length;l=9&&!h.doctype)throw"The doctype directive is missing. The recommended doctype in Internet Explorer is the HTML5 doctype: ";var A=[],b={},x=this.Processing=function(e,n,s){function w(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n),ie.push({elem:e,type:t,fn:n})}function E(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 S(e,n,r,i){var s=Dt.locations[e];s===t&&(s=oe.getUniformLocation(n,r),Dt.locations[e]=s),null!==s&&(4===i.length?oe.uniform4fv(s,i):3===i.length?oe.uniform3fv(s,i):2===i.length?oe.uniform2fv(s,i):oe.uniform1f(s,i))}function P(e,n,r,i){var s=Dt.locations[e];s===t&&(s=oe.getUniformLocation(n,r),Dt.locations[e]=s),null!==s&&(4===i.length?oe.uniform4iv(s,i):3===i.length?oe.uniform3iv(s,i):2===i.length?oe.uniform2iv(s,i):oe.uniform1i(s,i))}function C(e,n,r,i,s){var o=Dt.locations[e];o===t&&(o=oe.getUniformLocation(n,r),Dt.locations[e]=o),-1!==o&&(16===s.length?oe.uniformMatrix4fv(o,i,s):9===s.length?oe.uniformMatrix3fv(o,i,s):oe.uniformMatrix2fv(o,i,s))}function M(e,n,r,i,s){var o=Dt.attributes[e];o===t&&(o=oe.getAttribLocation(n,r),Dt.attributes[e]=o),-1!==o&&(oe.bindBuffer(oe.ARRAY_BUFFER,s),oe.vertexAttribPointer(o,i,oe.FLOAT,!1,0,0),oe.enableVertexAttribArray(o))}function T(e,n,r){var i=Dt.attributes[e];i===t&&(i=oe.getAttribLocation(n,r),Dt.attributes[e]=i),-1!==i&&oe.disableVertexAttribArray(i)}function _(e,t,n,r){var i,s,o,a;if(Mt===c.HSB){var l=se.color.toRGB(e,t,n);i=l[0],s=l[1],o=l[2]}else i=Math.round(e/wt*255),s=Math.round(t/Et*255),o=Math.round(n/St*255);return a=Math.round(r/xt*255),i=i<0?0:i,s=s<0?0:s,o=o<0?0:o,a=a<0?0:a,i=i>255?255:i,s=s>255?255:s,o=o>255?255:o,(a=a>255?255:a)<<24&c.ALPHA_MASK|i<<16&c.RED_MASK|s<<8&c.GREEN_MASK|o&c.BLUE_MASK}function R(e){var t,n,r;t=((e&c.RED_MASK)>>>16)/255,n=((e&c.GREEN_MASK)>>>8)/255,r=(e&c.BLUE_MASK)/255;var i,s=se.max(se.max(t,n),r),o=se.min(se.min(t,n),r);return o===s?[0,0,s*St]:(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*wt,(s-o)/s*Et,s*St])}function L(){oe.save()}function I(){oe.restore(),et=!0,Ze=!0}function D(){var e=(Date.now()-Lt)/1e3,t=++It/e;e>.5&&(Lt=Date.now(),It=0,se.__frameRate=t),se.frameCount++}function O(e){var t=parseInt("0x"+e,16);return t>2147483647&&(t-=4294967296),t}function N(e){return"number"==typeof e?0!==e:"boolean"==typeof e?e:"string"==typeof e?"true"===e.toLowerCase():e instanceof Char?49===e.code||84===e.code||116===e.code:void 0}function F(e){return"number"==typeof e?e:"boolean"==typeof e?e?1:0:"string"==typeof e?parseFloat(e):e instanceof Char?e.code:void 0}function k(e,t){return"number"==typeof e?4294967295&e:"boolean"==typeof e?e?1:0:"string"==typeof e?4294967295&parseInt(e,t||10):e instanceof Char?e.code:void 0}function B(){je&&(Ze&&(oe.fillStyle=se.color.toString(We),Ze=!1),oe.fill())}function $(){qe&&(et&&(oe.strokeStyle=se.color.toString(Je),et=!1),oe.stroke())}function G(){B(),$(),oe.closePath()}function V(e,n,r){var i=Zn.shift();i===t&&((i={}).canvas=h.createElement("canvas"),i.context=i.canvas.getContext("2d")),Zn.push(i);var s=i.canvas,o=i.context,a=n||e.width,l=r||e.height;return s.width=a,s.height=l,e?"data"in e?o.putImageData(e,0,0):(o.clearRect(0,0,a,l),o.drawImage(e,0,0,a,l)):o.clearRect(0,0,a,l),i}function z(e,t,n,r){var i=new qn(n,r,c.ARGB);return i.fromImageData(se.toImageData(e,t,n,r)),i}function U(e,t,n,r,i){if(i.isRemote)throw"Image is loaded remotely. Cannot get x,y,w,h.";for(var s=new qn(n,r,c.ARGB),o=s.imageData.data,a=i.width,l=i.height,h=i.imageData.data,u=Math.max(0,-t),f=Math.max(0,-e),p=Math.min(r,l-t),m=Math.min(n,a-e),g=u;gi)){for(var o=-1,a=0,l=0,h=[],u=0,f=e.length;u0))return;o=u}"\n"===p?(h.push({text:e.substring(a,u),width:l}),a=u+1):(h.push({text:e.substring(a,o+1),width:l}),a=o+1),l=0,u=a-1}}ai-Ut);y++)A=h[y],le.text$line(A.text,t+d,n+v+b,s,kt)}}function W(e){le="3D"===e?new Fn:"2D"===e?new Nn:new kn;for(var t in kn.prototype)kn.prototype.hasOwnProperty(t)&&t.indexOf("$")<0&&(se[t]=le[t]);le.$init()}function Z(e){return function(){return W("2D"),le[e].apply(this,arguments)}}function q(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 Q(e){return"function"==typeof e.preventDefault?e.preventDefault():"function"==typeof e.stopPropagation&&e.stopPropagation(),!1}function J(){var e;for(e in Wt)if(Wt.hasOwnProperty(e))return void(se.__keyPressed=!0);se.__keyPressed=!1}function ee(){se.__keyPressed=!1,Wt=[],Zt=null}function te(e,t){Wt[e]=t,Zt=null,se.key=t,se.keyCode=e,se.keyPressed(),se.keyCode=0,se.keyTyped(),J()}if(!(this instanceof x))throw"called Processing constructor as if it were a function: missing 'new'.";var ne={},re=e===t&&n===t;if(!("getContext"in(ne=re?h.createElement("canvas"):"string"==typeof e?h.getElementById(e):e)))throw"called Processing constructor without passing canvas element reference or id.";var ie=[],se=this;se.Char=se.Character=Char,ie=[],i.withCommonFunctions(se),i.withMath(se),i.withProxyFunctions(se,function(e){return Array.prototype.slice.call(e,1)}),i.withTouch(se,ne,w,function(e,t){Object.keys(ie).forEach(function(n){t.indexOf(n.type)>-1&&n.elem==e&&E(n.type)})},h,c),s&&Object.keys(s).forEach(function(e){se[e]=s[e]}),se.externals={canvas:ne,context:t,sketch:t,window:l},se.name="Processing.js Instance",se.use3DContext=!1,se.focused=!1,se.breakShape=!1,se.glyphTable={},se.pmouseX=0,se.pmouseY=0,se.mouseX=0,se.mouseY=0,se.mouseButton=0,se.mouseScroll=0,se.mouseClicked=t,se.mouseDragged=t,se.mouseMoved=t,se.mousePressed=t,se.mouseReleased=t,se.mouseScrolled=t,se.mouseOver=t,se.mouseOut=t,se.touchStart=t,se.touchEnd=t,se.touchMove=t,se.touchCancel=t,se.key=t,se.keyCode=t,se.keyPressed=u,se.keyReleased=u,se.keyTyped=u,se.draw=t,se.setup=t,se.__mousePressed=!1,se.__keyPressed=!1,se.__frameRate=60,se.frameCount=0,se.width=100,se.height=100;var oe,ae,le,he,ue,ce,fe,pe,me,ge,de,ve,ye,Ae,be,xe,we,Ee,Se,Pe,Ce,Me,Te,_e,Re,Le,Ie,De,Oe,Ne,Fe,ke,Be,$e,Ge,Ve,ze,Ue,He,Xe,Ye,je=!0,Ke=[1,1,1,1],We=4294967295,Ze=!0,qe=!0,Qe=[0,0,0,1],Je=4278190080,et=!0,tt=1,nt=!1,rt=!1,it=!0,st=0,ot=c.CORNER,at=c.CENTER,lt=0,ht=0,ut=0,ct=c.NORMAL_MODE_AUTO,ft=60,pt=1e3/ft,mt=(c.ARROW,ne.style.cursor),gt=c.POLYGON,dt=0,vt=20,yt=!1,At=-3355444,bt=20,xt=255,wt=255,Et=255,St=255,Pt=0,Ct=0,Mt=c.RGB,Tt=null,_t=null,Rt=Date.now(),Lt=Rt,It=0,Dt={attributes:{},locations:{}},Ot={width:0,height:0},Nt=c.IMAGE,Ft=!1,kt=c.LEFT,Bt=c.BASELINE,$t=c.MODEL,Gt="Arial",Vt=12,zt=9,Ut=2,Ht=14,Xt=PFont.get(Gt,Vt),Yt=null,jt=!1,Kt=1e3,Wt=[],Zt=null,qt=[c.SHIFT,c.CONTROL,c.ALT,c.CAPSLK,c.PGUP,c.PGDN,c.END,c.HOME,c.LEFT,c.UP,c.RIGHT,c.DOWN,c.NUMLK,c.INSERT,c.F1,c.F2,c.F3,c.F4,c.F5,c.F6,c.F7,c.F8,c.F9,c.F10,c.F11,c.F12,c.META],Qt=0,Jt=0,en=0,tn=[],nn=[],rn=[],sn=new g(c.SINCOS_LENGTH),on=new g(c.SINCOS_LENGTH),an=!1,ln=Math.PI/180*60,hn=se.width/2,un=se.height/2,cn=un/Math.tan(ln/2),fn=cn/10,pn=10*cn,mn=se.width/se.height,gn=[],dn=[],vn=0,yn=!1,An=!1,bn=!0,xn=c.CORNER,wn=[],En=new g([.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]),Sn=new g([.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]),Pn=new g([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]),Cn=new g([0,0,0,0,1,0,1,1,0,1,0,0]),Mn=new g([0,0,1,0,0,1,0,0,1,0,0,1]),Tn="varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec3 aNormal;attribute vec4 aColor;attribute vec2 aTexture;varying vec2 vTexture;uniform vec4 uColor;uniform bool uUsingMat;uniform vec3 uSpecular;uniform vec3 uMaterialEmissive;uniform vec3 uMaterialAmbient;uniform vec3 uMaterialSpecular;uniform float uShininess;uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection;uniform mat4 uNormalTransform;uniform int uLightCount;uniform vec3 uFalloff;struct Light { int type; vec3 color; vec3 position; vec3 direction; float angle; vec3 halfVector; float concentration;};uniform Light uLights0;uniform Light uLights1;uniform Light uLights2;uniform Light uLights3;uniform Light uLights4;uniform Light uLights5;uniform Light uLights6;uniform Light uLights7;Light getLight(int index){ if(index == 0) return uLights0; if(index == 1) return uLights1; if(index == 2) return uLights2; if(index == 3) return uLights3; if(index == 4) return uLights4; if(index == 5) return uLights5; if(index == 6) return uLights6; return uLights7;}void AmbientLight( inout vec3 totalAmbient, in vec3 ecPos, in Light light ) { float d = length( light.position - ecPos ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[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, uShininess ); } col += light.color * nDotVP; spec += uSpecular * 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 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[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, uShininess ); } spec += uSpecular * 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 = 0.0; vec3 VP = light.position - ecPos; vec3 ldir = normalize( -light.direction ); float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d ) ); float spotDot = dot( VP, ldir );"+(/Windows/.test(a.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 = pow( nDotHV, uShininess ); } spec += uSpecular * powerFactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0 ); vec3 finalDiffuse = vec3( 0.0 ); vec3 finalSpecular = vec3( 0.0 ); vec4 col = uColor; if ( uColor[0] == -1.0 ){ col = aColor; } vec3 norm = normalize(vec3( uNormalTransform * vec4( aNormal, 0.0 ) )); vec4 ecPos4 = uView * uModel * vec4(aVertex, 1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( uLightCount == 0 ) { vFrontColor = col + vec4(uMaterialSpecular, 1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= uLightCount ){ 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( uUsingMat == false ) { vFrontColor = vec4( vec3( col ) * finalAmbient + vec3( col ) * finalDiffuse + vec3( col ) * finalSpecular, col[3] ); } else{ vFrontColor = vec4( uMaterialEmissive + (vec3(col) * uMaterialAmbient * finalAmbient ) + (vec3(col) * finalDiffuse) + (uMaterialSpecular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = uProjection * uView * uModel * vec4( aVertex, 1.0 );}",_n=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},Rn=function(e,t,n,r,i){return{x:e,y:t,w:n,h:r}},Ln=Rn,In=function(e,t,n,r,i){return{x:e,y:t,w:i?n:n-e,h:i?r:r-t}},Dn=function(e,t,n,r,i){return{x:e-n/2,y:t-r/2,w:n,h:r}},On=function(){},Nn=function(){},Fn=function(){},kn=function(){};Nn.prototype=new On,Nn.prototype.constructor=Nn,Fn.prototype=new On,Fn.prototype.constructor=Fn,kn.prototype=new On,kn.prototype.constructor=kn,On.prototype.a3DOnlyFunction=u,se.shape=function(e,t,n,r,i){arguments.length>=1&&null!==arguments[0]&&e.isVisible()&&(se.pushMatrix(),xn===c.CENTER?5===arguments.length?(se.translate(t-r/2,n-i/2),se.scale(r/e.getWidth(),i/e.getHeight())):3===arguments.length?se.translate(t-e.getWidth()/2,-e.getHeight()/2):se.translate(-e.getWidth()/2,-e.getHeight()/2):xn===c.CORNER?5===arguments.length?(se.translate(t,n),se.scale(r/e.getWidth(),i/e.getHeight())):3===arguments.length&&se.translate(t,n):xn===c.CORNERS&&(5===arguments.length?(r-=t,i-=n,se.translate(t,n),se.scale(r/e.getWidth(),i/e.getHeight())):3===arguments.length&&se.translate(t,n)),e.draw(se),(1===arguments.length&&xn===c.CENTER||arguments.length>1)&&se.popMatrix())},se.shapeMode=function(e){xn=e},se.loadShape=function(e){return 1===arguments.length&&e.indexOf(".svg")>-1?new PShapeSVG(null,e):null},se.loadXML=function(e){return new XML(se,e)},se.parseXML=function(e){var t=new XML;return t.parse(e),t};var Bn=function(e){for(var t=0,n=0;nc.MIN_INT){var t=this.elements[0],n=this.elements[1],r=this.elements[2],i=this.elements[3],s=this.elements[4],o=this.elements[5];return this.elements[0]=s/e,this.elements[3]=-i/e,this.elements[1]=-n/e,this.elements[4]=t/e,this.elements[2]=(n*o-s*r)/e,this.elements[5]=(i*r-t*o)/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 $n?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 $n?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=Math.cos(e),n=Math.sin(e),r=this.elements[0],i=this.elements[1];this.elements[0]=t*r+n*i,this.elements[1]=-n*r+t*i,r=this.elements[3],i=this.elements[4],this.elements[3]=t*r+n*i,this.elements[4]=-n*r+t*i},rotateZ:function(e){this.rotate(e)},invRotateZ:function(e){this.rotateZ(e-Math.PI)},print:function(){var e=Bn(this.elements),t=se.nfs(this.elements[0],e,4)+" "+se.nfs(this.elements[1],e,4)+" "+se.nfs(this.elements[2],e,4)+"\n"+se.nfs(this.elements[3],e,4)+" "+se.nfs(this.elements[4],e,4)+" "+se.nfs(this.elements[5],e,4)+"\n\n";se.println(t)}};var Gn=se.PMatrix3D=function(){this.reset()};Gn.prototype={set:function(){16===arguments.length?this.elements=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Gn?this.elements=arguments[0].array():1===arguments.length&&arguments[0]instanceof Array&&(this.elements=arguments[0].slice())},get:function(){var e=new Gn;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,n,r){r===t&&(r=0),this.elements[3]+=e*this.elements[0]+n*this.elements[1]+r*this.elements[2],this.elements[7]+=e*this.elements[4]+n*this.elements[5]+r*this.elements[6],this.elements[11]+=e*this.elements[8]+n*this.elements[9]+r*this.elements[10],this.elements[15]+=e*this.elements[12]+n*this.elements[13]+r*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 PVector?(n=e.x,r=e.y,i=e.z,s=1,t||(t=new PVector)):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 PVector&&(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 Gn?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 Gn?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(arguments.length<4)this.rotateZ(e);else{var i=new PVector(t,n,r),s=i.mag();if(0===s)return;1!=s&&(i.normalize(),t=i.x,n=i.y,r=i.z);var o=se.cos(e),a=se.sin(e),l=1-o;this.apply(l*t*t+o,l*t*n-a*r,l*t*r+a*n,0,l*t*n+a*r,l*n*n+o,l*n*r-a*t,0,l*t*r-a*n,l*n*r+a*t,l*r*r+o,0,0,0,0,1)}},invApply:function(){Xe===t&&(Xe=new Gn);var e=arguments;return Xe.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]),!!Xe.invert()&&(this.preApply(Xe),!0)},rotateX:function(e){var t=se.cos(e),n=se.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=se.cos(e),n=se.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=Math.cos(e),n=Math.sin(e);this.apply([t,-n,0,0,n,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=Math.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=Math.tan(e);this.apply(1,0,0,0,t,1,0,0,0,0,1,0,0,0,0,1)},shearX:function(e){var t=Math.tan(e);this.apply(1,t,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},shearY:function(e){var t=Math.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],n=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4],r=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5],i=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5],s=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6],o=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12],a=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12],l=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12],h=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13],u=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],f=e*c-t*u+n*h+r*l-i*a+s*o;if(Math.abs(f)<=1e-9)return!1;var p=[];p[0]=+this.elements[5]*c-this.elements[6]*u+this.elements[7]*h,p[4]=-this.elements[4]*c+this.elements[6]*l-this.elements[7]*a,p[8]=+this.elements[4]*u-this.elements[5]*l+this.elements[7]*o,p[12]=-this.elements[4]*h+this.elements[5]*a-this.elements[6]*o,p[1]=-this.elements[1]*c+this.elements[2]*u-this.elements[3]*h,p[5]=+this.elements[0]*c-this.elements[2]*l+this.elements[3]*a,p[9]=-this.elements[0]*u+this.elements[1]*l-this.elements[3]*o,p[13]=+this.elements[0]*h-this.elements[1]*a+this.elements[2]*o,p[2]=+this.elements[13]*s-this.elements[14]*i+this.elements[15]*r,p[6]=-this.elements[12]*s+this.elements[14]*n-this.elements[15]*t,p[10]=+this.elements[12]*i-this.elements[13]*n+this.elements[15]*e,p[14]=-this.elements[12]*r+this.elements[13]*t-this.elements[14]*e,p[3]=-this.elements[9]*s+this.elements[10]*i-this.elements[11]*r,p[7]=+this.elements[8]*s-this.elements[10]*n+this.elements[11]*t,p[11]=-this.elements[8]*i+this.elements[9]*n-this.elements[11]*e,p[15]=+this.elements[8]*r-this.elements[9]*t+this.elements[10]*e;var m=1/f;return p[0]*=m,p[1]*=m,p[2]*=m,p[3]*=m,p[4]*=m,p[5]*=m,p[6]*=m,p[7]*=m,p[8]*=m,p[9]*=m,p[10]*=m,p[11]*=m,p[12]*=m,p[13]*=m,p[14]*=m,p[15]*=m,this.elements=p.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=Bn(this.elements),t=se.nfs(this.elements[0],e,4)+" "+se.nfs(this.elements[1],e,4)+" "+se.nfs(this.elements[2],e,4)+" "+se.nfs(this.elements[3],e,4)+"\n"+se.nfs(this.elements[4],e,4)+" "+se.nfs(this.elements[5],e,4)+" "+se.nfs(this.elements[6],e,4)+" "+se.nfs(this.elements[7],e,4)+"\n"+se.nfs(this.elements[8],e,4)+" "+se.nfs(this.elements[9],e,4)+" "+se.nfs(this.elements[10],e,4)+" "+se.nfs(this.elements[11],e,4)+"\n"+se.nfs(this.elements[12],e,4)+" "+se.nfs(this.elements[13],e,4)+" "+se.nfs(this.elements[14],e,4)+" "+se.nfs(this.elements[15],e,4)+"\n\n";se.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=Math.cos(-e),n=Math.sin(-e);this.preApply([1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1])},invRotateY:function(e){var t=Math.cos(-e),n=Math.sin(-e);this.preApply([t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1])},invRotateZ:function(e){var t=Math.cos(-e),n=Math.sin(-e);this.preApply([t,-n,0,0,n,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 Vn=se.PMatrixStack=function(){this.matrixStack=[]};Vn.prototype.load=function(){var e=le.$newPMatrix();1===arguments.length?e.set(arguments[0]):e.set(arguments),this.matrixStack.push(e)},Nn.prototype.$newPMatrix=function(){return new $n},Fn.prototype.$newPMatrix=function(){return new Gn},Vn.prototype.push=function(){this.matrixStack.push(this.peek())},Vn.prototype.pop=function(){return this.matrixStack.pop()},Vn.prototype.peek=function(){var e=le.$newPMatrix();return e.set(this.matrixStack[this.matrixStack.length-1]),e},Vn.prototype.mult=function(e){this.matrixStack[this.matrixStack.length-1].apply(e)},se.split=function(e,t){return e.split(t)},se.splitTokens=function(e,n){if(n===t)return e.split(/\s+/g);var r,i,s=n.split(/()/g),o="",a=e.length,l=[];for(r=0;r-1?(""!==o&&l.push(o),o=""):o+=i;return""!==o&&l.push(o),l},se.append=function(e,t){return e[e.length]=t,e},se.concat=function(e,t){return e.concat(t)},se.sort=function(e,t){var n=[];if(e.length>0){for(var r=t>0?t:e.length,i=0;i0)for(var s=n.length;s>8)},se.peg=function(e){return e<0?0:e>255?255:e},se.modes=function(){function e(e,t,n,r,i,o,a,l,h,u,c){var f=n+((h-n)*t>>8),p=r+((u-r)*t>>8),m=i+((c-i)*t>>8);return s(((4278190080&e)>>>24)+t,255)<<24|(f=(f<0?0:f>255?255:f)<<16)|(p=(p<0?0:p>255?255:p)<<8)|(m=m<0?0:m>255?255:m)}var t=c.ALPHA_MASK,n=c.RED_MASK,r=c.GREEN_MASK,i=c.BLUE_MASK,s=Math.min,o=Math.max;return{replace:function(e,t){return t},blend:function(e,o){var a=(o&t)>>>24,l=e&n,h=e&r,u=e&i,c=o&n,f=o&r,p=o&i;return s(((e&t)>>>24)+a,255)<<24|l+((c-l)*a>>8)&n|h+((f-h)*a>>8)&r|u+((p-u)*a>>8)&i},add:function(e,o){var a=(o&t)>>>24;return s(((e&t)>>>24)+a,255)<<24|s((e&n)+((o&n)>>8)*a,n)&n|s((e&r)+((o&r)>>8)*a,r)&r|s((e&i)+((o&i)*a>>8),i)},subtract:function(e,a){var l=(a&t)>>>24;return s(((e&t)>>>24)+l,255)<<24|o((e&n)-((a&n)>>8)*l,r)&n|o((e&r)-((a&r)>>8)*l,i)&r|o((e&i)-((a&i)*l>>8),0)},lightest:function(e,a){var l=(a&t)>>>24;return s(((e&t)>>>24)+l,255)<<24|o(e&n,((a&n)>>8)*l)&n|o(e&r,((a&r)>>8)*l)&r|o(e&i,(a&i)*l>>8)},darkest:function(e,o){var a=(o&t)>>>24,l=e&n,h=e&r,u=e&i,c=s(e&n,((o&n)>>8)*a),f=s(e&r,((o&r)>>8)*a),p=s(e&i,(o&i)*a>>8);return s(((e&t)>>>24)+a,255)<<24|l+((c-l)*a>>8)&n|h+((f-h)*a>>8)&r|u+((p-u)*a>>8)&i},difference:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i;return e(s,(o&t)>>>24,a,l,h,0,0,0,a>u?a-u:u-a,l>c?l-c:c-l,h>f?h-f:f-h)},exclusion:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i;return e(s,(o&t)>>>24,a,l,h,0,0,0,a+u-(a*u>>7),l+c-(l*c>>7),h+f-(h*f>>7))},multiply:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i;return e(s,(o&t)>>>24,a,l,h,0,0,0,a*u>>8,l*c>>8,h*f>>8)},screen:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i;return e(s,(o&t)>>>24,a,l,h,0,0,0,255-((255-a)*(255-u)>>8),255-((255-l)*(255-c)>>8),255-((255-h)*(255-f)>>8))},hard_light:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i;return e(s,(o&t)>>>24,a,l,h,0,0,0,u<128?a*u>>7:255-((255-a)*(255-u)>>7),c<128?l*c>>7:255-((255-l)*(255-c)>>7),f<128?h*f>>7:255-((255-h)*(255-f)>>7))},soft_light:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i;return e(s,(o&t)>>>24,a,l,h,0,0,0,(a*u>>7)+(a*a>>8)-(a*a*u>>15),(l*c>>7)+(l*l>>8)-(l*l*c>>15),(h*f>>7)+(h*h>>8)-(h*h*f>>15))},overlay:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i;return e(s,(o&t)>>>24,a,l,h,0,0,0,a<128?a*u>>7:255-((255-a)*(255-u)>>7),l<128?l*c>>7:255-((255-l)*(255-c)>>7),h<128?h*f>>7:255-((255-h)*(255-f)>>7))},dodge:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i,p=255;255!==u&&(p=(p=(a<<8)/(255-u))<0?0:p>255?255:p);var m=255;255!==c&&(m=(m=(l<<8)/(255-c))<0?0:m>255?255:m);var g=255;return 255!==f&&(g=(g=(h<<8)/(255-f))<0?0:g>255?255:g),e(s,(o&t)>>>24,a,l,h,0,0,0,p,m,g)},burn:function(s,o){var a=(s&n)>>16,l=(s&r)>>8,h=s&i,u=(o&n)>>16,c=(o&r)>>8,f=o&i,p=0;0!==u&&(p=255-((p=(255-a<<8)/u)<0?0:p>255?255:p));var m=0;0!==c&&(m=255-((m=(255-l<<8)/c)<0?0:m>255?255:m));var g=0;return 0!==f&&(g=255-((g=(255-h<<8)/f)<0?0:g>255?255:g)),e(s,(o&t)>>>24,a,l,h,0,0,0,p,m,g)}}}(),se.color=function(e,n,r,i){return e!==t&&n!==t&&r!==t&&i!==t?_(e,n,r,i):e!==t&&n!==t&&r!==t?_(e,n,r,xt):e!==t&&n!==t?(o=n,(s=e)&c.ALPHA_MASK?(a=(a=(a=Math.round(o/xt*255))>255?255:a)<0?0:a,s-(s&c.ALPHA_MASK)+(a<<24&c.ALPHA_MASK)):Mt===c.RGB?_(s,s,s,o):Mt===c.HSB?_(0,0,s/wt*St,o):void 0):"number"==typeof e?function(e){if(e<=wt&&e>=0){if(Mt===c.RGB)return _(e,e,e,xt);if(Mt===c.HSB)return _(0,0,e/wt*St,xt)}if(e)return e>2147483647&&(e-=4294967296),e}(e):_(wt,Et,St,xt);var s,o,a},se.color.toString=function(e){return"rgba("+((e&c.RED_MASK)>>>16)+","+((e&c.GREEN_MASK)>>>8)+","+(e&c.BLUE_MASK)+","+((e&c.ALPHA_MASK)>>>24)/255+")"},se.color.toInt=function(e,t,n,r){return r<<24&c.ALPHA_MASK|e<<16&c.RED_MASK|t<<8&c.GREEN_MASK|n&c.BLUE_MASK},se.color.toArray=function(e){return[(e&c.RED_MASK)>>>16,(e&c.GREEN_MASK)>>>8,e&c.BLUE_MASK,(e&c.ALPHA_MASK)>>>24]},se.color.toGLArray=function(e){return[((e&c.RED_MASK)>>>16)/255,((e&c.GREEN_MASK)>>>8)/255,(e&c.BLUE_MASK)/255,((e&c.ALPHA_MASK)>>>24)/255]},se.color.toRGB=function(e,t,n){e=e>wt?wt:e,t=t>Et?Et:t,n=n>St?St:n,e=(e=e<0?0:e)/wt*360,t=t/Et*100,n=n/St*100;var r=Math.round(n/100*255);if(0===t)return[r,r,r];var i=e%360,s=i%60,o=Math.round(n*(100-t)/1e4*255),a=Math.round(n*(6e3-t*s)/6e5*255),l=Math.round(n*(6e3-t*(60-s))/6e5*255);switch(Math.floor(i/60)){case 0:return[r,l,o];case 1:return[a,r,o];case 2:return[o,r,l];case 3:return[o,a,r];case 4:return[l,o,r];case 5:return[r,o,a];default:x.debug("Unexpectedly hit default case in toRGB function.")}},se.brightness=function(e){return R(e)[2]},se.saturation=function(e){return R(e)[1]},se.hue=function(e){return R(e)[0]},se.red=function(e){return((e&c.RED_MASK)>>>16)/255*wt},se.green=function(e){return((e&c.GREEN_MASK)>>>8)/255*Et},se.blue=function(e){return(e&c.BLUE_MASK)/255*St},se.alpha=function(e){return((e&c.ALPHA_MASK)>>>24)/255*xt},se.lerpColor=function(e,t,n){var r,i,s,o,a,l,h,u,f,p,m,g,d,v,y,A,b=se.color(e),x=se.color(t);return Mt===c.HSB?(g=R(b),h=((b&c.ALPHA_MASK)>>>24)/xt,d=R(x),m=((x&c.ALPHA_MASK)>>>24)/xt,y=se.lerp(g[0],d[0],n),A=se.lerp(g[1],d[1],n),s=se.lerp(g[2],d[2],n),v=se.color.toRGB(y,A,s),(se.lerp(h,m,n)*xt+.5|0)<<24&c.ALPHA_MASK|v[0]<<16&c.RED_MASK|v[1]<<8&c.GREEN_MASK|v[2]&c.BLUE_MASK):(o=(b&c.RED_MASK)>>>16,a=(b&c.GREEN_MASK)>>>8,l=b&c.BLUE_MASK,h=((b&c.ALPHA_MASK)>>>24)/xt,u=(x&c.RED_MASK)>>>16,f=(x&c.GREEN_MASK)>>>8,p=x&c.BLUE_MASK,m=((x&c.ALPHA_MASK)>>>24)/xt,r=se.lerp(o,u,n)+.5|0,i=se.lerp(a,f,n)+.5|0,s=se.lerp(l,p,n)+.5|0,(se.lerp(h,m,n)*xt+.5|0)<<24&c.ALPHA_MASK|r<<16&c.RED_MASK|i<<8&c.GREEN_MASK|s&c.BLUE_MASK)},se.colorMode=function(){Mt=arguments[0],arguments.length>1&&(wt=arguments[1],Et=arguments[2]||arguments[1],St=arguments[3]||arguments[1],xt=arguments[4]||arguments[1])},se.blendColor=function(e,t,n){return n===c.REPLACE?se.modes.replace(e,t):n===c.BLEND?se.modes.blend(e,t):n===c.ADD?se.modes.add(e,t):n===c.SUBTRACT?se.modes.subtract(e,t):n===c.LIGHTEST?se.modes.lightest(e,t):n===c.DARKEST?se.modes.darkest(e,t):n===c.DIFFERENCE?se.modes.difference(e,t):n===c.EXCLUSION?se.modes.exclusion(e,t):n===c.MULTIPLY?se.modes.multiply(e,t):n===c.SCREEN?se.modes.screen(e,t):n===c.HARD_LIGHT?se.modes.hard_light(e,t):n===c.SOFT_LIGHT?se.modes.soft_light(e,t):n===c.OVERLAY?se.modes.overlay(e,t):n===c.DODGE?se.modes.dodge(e,t):n===c.BURN?se.modes.burn(e,t):void 0},se.printMatrix=function(){Ve.print()},Nn.prototype.translate=function(e,t){Ve.translate(e,t),ze.invTranslate(e,t),oe.translate(e,t)},Fn.prototype.translate=function(e,t,n){Ve.translate(e,t,n),ze.invTranslate(e,t,n)},Nn.prototype.scale=function(e,t){Ve.scale(e,t),ze.invScale(e,t),oe.scale(e,t||e)},Fn.prototype.scale=function(e,t,n){Ve.scale(e,t,n),ze.invScale(e,t,n)},Nn.prototype.transform=function(e){var t=e.array();oe.transform(t[0],t[3],t[1],t[4],t[2],t[5])},Fn.prototype.transformm=function(e){throw"p.transform is currently not supported in 3D mode"},Nn.prototype.pushMatrix=function(){Ue.load(Ve),He.load(ze),L()},Fn.prototype.pushMatrix=function(){Ue.load(Ve),He.load(ze)},Nn.prototype.popMatrix=function(){Ve.set(Ue.pop()),ze.set(He.pop()),I()},Fn.prototype.popMatrix=function(){Ve.set(Ue.pop()),ze.set(He.pop())},Nn.prototype.resetMatrix=function(){Ve.reset(),ze.reset(),oe.setTransform(1,0,0,1,0,0)},Fn.prototype.resetMatrix=function(){Ve.reset(),ze.reset()},On.prototype.applyMatrix=function(){var e=arguments;Ve.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]),ze.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])},Nn.prototype.applyMatrix=function(){for(var e=arguments,t=e.length;t<16;t++)e[t]=0;e[10]=e[15]=1,On.prototype.applyMatrix.apply(this,e)},se.rotateX=function(e){Ve.rotateX(e),ze.invRotateX(e)},Nn.prototype.rotateZ=function(){throw"rotateZ() is not supported in 2D mode. Use rotate(float) instead."},Fn.prototype.rotateZ=function(e){Ve.rotateZ(e),ze.invRotateZ(e)},se.rotateY=function(e){Ve.rotateY(e),ze.invRotateY(e)},Nn.prototype.rotate=function(e){Ve.rotateZ(e),ze.invRotateZ(e),oe.rotate(e)},Fn.prototype.rotate=function(e){arguments.length<4?se.rotateZ(e):(Ve.rotate(e,arguments[1],arguments[2],arguments[3]),ze.rotate(-e,arguments[1],arguments[2],arguments[3]))},Nn.prototype.shearX=function(e){Ve.shearX(e),oe.transform(1,0,e,1,0,0)},Fn.prototype.shearX=function(e){Ve.shearX(e)},Nn.prototype.shearY=function(e){Ve.shearY(e),oe.transform(1,e,0,1,0,0)},Fn.prototype.shearY=function(e){Ve.shearY(e)},se.pushStyle=function(){L(),se.pushMatrix();var e={doFill:je,currentFillColor:We,doStroke:qe,currentStrokeColor:Je,curTint:Tt,curRectMode:ot,curColorMode:Mt,colorModeX:wt,colorModeZ:St,colorModeY:Et,colorModeA:xt,curTextFont:Xt,horizontalTextAlignment:kt,verticalTextAlignment:Bt,textMode:$t,curFontName:Gt,curTextSize:Vt,curTextAscent:zt,curTextDescent:Ut,curTextLeading:Ht};wn.push(e)},se.popStyle=function(){var e=wn.pop();if(!e)throw"Too many popStyle() without enough pushStyle()";I(),se.popMatrix(),je=e.doFill,We=e.currentFillColor,qe=e.doStroke,Je=e.currentStrokeColor,Tt=e.curTint,ot=e.curRectMode,Mt=e.curColorMode,wt=e.colorModeX,St=e.colorModeZ,Et=e.colorModeY,xt=e.colorModeA,Xt=e.curTextFont,Gt=e.curFontName,Vt=e.curTextSize,kt=e.horizontalTextAlignment,Bt=e.verticalTextAlignment,$t=e.textMode,zt=e.curTextAscent,Ut=e.curTextDescent,Ht=e.curTextLeading},se.year=function(){return(new Date).getFullYear()},se.month=function(){return(new Date).getMonth()+1},se.day=function(){return(new Date).getDate()},se.hour=function(){return(new Date).getHours()},se.minute=function(){return(new Date).getMinutes()},se.second=function(){return(new Date).getSeconds()},se.millis=function(){return Date.now()-Rt},Nn.prototype.redraw=function(){D(),oe.lineWidth=tt;var e=se.pmouseX,t=se.pmouseY;se.pmouseX=Pt,se.pmouseY=Ct,L(),se.draw(),I(),Pt=se.mouseX,Ct=se.mouseY,se.pmouseX=e,se.pmouseY=t},Fn.prototype.redraw=function(){D();var e=se.pmouseX,t=se.pmouseY;se.pmouseX=Pt,se.pmouseY=Ct,oe.clear(oe.DEPTH_BUFFER_BIT),Dt={attributes:{},locations:{}},se.noLights(),se.lightFalloff(1,0,0),se.shininess(1),se.ambient(255,255,255),se.specular(0,0,0),se.emissive(0,0,0),se.camera(),se.draw(),Pt=se.mouseX,Ct=se.mouseY,se.pmouseX=e,se.pmouseY=t},se.noLoop=function(){it=!1,nt=!1,clearInterval(st),ae.onPause()},se.loop=function(){nt||(Lt=Date.now(),It=0,st=l.setInterval(function(){try{ae.onFrameStart(),se.redraw(),ae.onFrameEnd()}catch(e){throw l.clearInterval(st),e}},pt),it=!0,nt=!0,ae.onLoop())},se.frameRate=function(e){pt=1e3/(ft=e),it&&(se.noLoop(),se.loop())},se.exit=function(){var e;l.clearInterval(st),e=se.externals.canvas.id,A.splice(b[e],1),delete b[e],delete ne.onmousedown;for(var t in x.lib)x.lib.hasOwnProperty(t)&&x.lib[t].hasOwnProperty("detach")&&x.lib[t].detach(se);for(var n=ie.length;n--;)E(ie[n]);ae.onExit()},se.cursor=function(){if(arguments.length>1||1===arguments.length&&arguments[0]instanceof se.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='url("'+n.toDataURL()+'") '+e+" "+t+", default";ne.style.cursor=r}else if(1===arguments.length){var i=arguments[0];ne.style.cursor=i}else ne.style.cursor=mt},se.noCursor=function(){ne.style.cursor=c.NOCURSOR},se.link=function(e,n){n!==t?l.open(e,n):l.location=e},se.beginDraw=u,se.endDraw=u,Nn.prototype.toImageData=function(e,n,r,i){return e=e!==t?e:0,n=n!==t?n:0,r=r!==t?r:se.width,i=i!==t?i:se.height,oe.getImageData(e,n,r,i)},Fn.prototype.toImageData=function(e,n,r,i){e=e!==t?e:0,n=n!==t?n:0,r=r!==t?r:se.width,i=i!==t?i:se.height;var s=h.createElement("canvas").getContext("2d").createImageData(r,i),o=new y(r*i*4);oe.readPixels(e,n,r,i,oe.RGBA,oe.UNSIGNED_BYTE,o);for(var a=0,l=o.length,u=s.data;a0)n=t;else if(e instanceof Char)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},se.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};var zn;se.hex=function(e,n){return 1===arguments.length&&(n=e instanceof Char?4:8),function(e,n){n=n===t||null===n?n=8:n,e<0&&(e=4294967295+e+1);for(var r=Number(e).toString(16).toUpperCase();r.length=n&&(r=r.substring(r.length-n,r.length)),r}(e,n)},se.unhex=function(e){if(e instanceof Array){for(var t=[],n=0;n0?r:null},se.match=function(e,t){return e.match(t)},se.println=function(){x.logger.println.apply(x.logger,arguments)},se.print=function(){x.logger.print.apply(x.logger,arguments)},se.str=function(e){if(e instanceof Array){for(var t=[],n=0;n0;){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,n===t)return!0;return!1},On.prototype.size=function(e,t,n){qe&&se.stroke(0),je&&se.fill(255);var r={fillStyle:oe.fillStyle,strokeStyle:oe.strokeStyle,lineCap:oe.lineCap,lineJoin:oe.lineJoin};ne.style.length>0&&(ne.style.removeProperty("width"),ne.style.removeProperty("height")),ne.width=se.width=e||100,ne.height=se.height=t||100;for(var i in r)r.hasOwnProperty(i)&&(oe[i]=r[i]);se.textFont(Xt),se.background(),Kt=Math.max(1e3,e*t*.05),se.externals.context=oe;for(var s=0;s 0.5){ discard; } } if(uIsDrawingText == 1){ float alpha = texture2D(uSampler, vTextureCoord).a; gl_FragColor = vec4(vFrontColor.rgb * alpha, alpha); } else{ gl_FragColor = vFrontColor; }}"),ye=_n(oe,"varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec4 aColor;uniform mat4 uView;uniform mat4 uProjection;uniform float uPointSize;void main(void) { vFrontColor = aColor; gl_PointSize = uPointSize; gl_Position = uProjection * uView * vec4(aVertex, 1.0);}","#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform bool uSmooth;void main(void){ if(uSmooth == true){ float dist = distance(gl_PointCoord, vec2(0.5)); if(dist > 0.5){ discard; } } gl_FragColor = vFrontColor;}"),se.strokeWeight(1),de=_n(oe,Tn,"#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform sampler2D uSampler;uniform bool uUsingTexture;varying vec2 vTexture;void main(void){ if( uUsingTexture ){ gl_FragColor = vec4(texture2D(uSampler, vTexture.xy)) * vFrontColor; } else{ gl_FragColor = vFrontColor; }}"),oe.useProgram(de),P("usingTexture3d",de,"usingTexture",Ft),se.lightFalloff(1,0,0),se.shininess(1),se.ambient(255,255,255),se.specular(0,0,0),se.emissive(0,0,0),Ae=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,Ae),oe.bufferData(oe.ARRAY_BUFFER,En,oe.STATIC_DRAW),be=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,be),oe.bufferData(oe.ARRAY_BUFFER,Pn,oe.STATIC_DRAW),xe=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,xe),oe.bufferData(oe.ARRAY_BUFFER,Sn,oe.STATIC_DRAW),we=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,we),oe.bufferData(oe.ARRAY_BUFFER,Cn,oe.STATIC_DRAW),Ee=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,Ee),oe.bufferData(oe.ARRAY_BUFFER,Mn,oe.STATIC_DRAW),Se=oe.createBuffer(),Pe=oe.createBuffer(),Ce=oe.createBuffer(),Me=oe.createBuffer(),Te=oe.createBuffer(),Re=oe.createBuffer(),_e=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,_e),oe.bufferData(oe.ARRAY_BUFFER,new g([0,0,0]),oe.STATIC_DRAW),De=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,De),oe.bufferData(oe.ARRAY_BUFFER,new g([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),oe.STATIC_DRAW),Oe=oe.createBuffer(),oe.bindBuffer(oe.ARRAY_BUFFER,Oe),oe.bufferData(oe.ARRAY_BUFFER,new g([0,0,1,0,1,1,0,1]),oe.STATIC_DRAW),Ne=oe.createBuffer(),oe.bindBuffer(oe.ELEMENT_ARRAY_BUFFER,Ne),oe.bufferData(oe.ELEMENT_ARRAY_BUFFER,new v([0,1,2,2,3,0]),oe.STATIC_DRAW),$e=new Gn,Ge=new Gn,Ve=new Gn,ze=new Gn,Ye=new Gn,se.camera(),se.perspective(),Ue=new Vn,He=new Vn,ue=new Gn,ce=new Gn,fe=new Gn,pe=new Gn,me=new Gn,(ge=new Gn).set(-1,3,-3,1,3,-6,3,0,-3,3,0,0,1,0,0,0),On.prototype.size.apply(this,arguments)}),Nn.prototype.ambientLight=On.prototype.a3DOnlyFunction,Fn.prototype.ambientLight=function(e,t,n,r,i,s){if(Qt===c.MAX_LIGHTS)throw"can only create "+c.MAX_LIGHTS+" lights";var o=new PVector(r,i,s),a=new Gn;a.scale(1,-1,1),a.apply(Ve.array()),a.mult(o,o);var l=_(e,t,n,0),h=[((l&c.RED_MASK)>>>16)/255,((l&c.GREEN_MASK)>>>8)/255,(l&c.BLUE_MASK)/255];oe.useProgram(de),S("uLights.color.3d."+Qt,de,"uLights"+Qt+".color",h),S("uLights.position.3d."+Qt,de,"uLights"+Qt+".position",o.array()),P("uLights.type.3d."+Qt,de,"uLights"+Qt+".type",0),P("uLightCount3d",de,"uLightCount",++Qt)},Nn.prototype.directionalLight=On.prototype.a3DOnlyFunction,Fn.prototype.directionalLight=function(e,t,n,r,i,s){if(Qt===c.MAX_LIGHTS)throw"can only create "+c.MAX_LIGHTS+" lights";oe.useProgram(de);var o=new Gn;o.scale(1,-1,1),o.apply(Ve.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=_(e,t,n,0),h=[((l&c.RED_MASK)>>>16)/255,((l&c.GREEN_MASK)>>>8)/255,(l&c.BLUE_MASK)/255];S("uLights.color.3d."+Qt,de,"uLights"+Qt+".color",h),S("uLights.position.3d."+Qt,de,"uLights"+Qt+".position",a),P("uLights.type.3d."+Qt,de,"uLights"+Qt+".type",1),P("uLightCount3d",de,"uLightCount",++Qt)},Nn.prototype.lightFalloff=On.prototype.a3DOnlyFunction,Fn.prototype.lightFalloff=function(e,t,n){oe.useProgram(de),S("uFalloff3d",de,"uFalloff",[e,t,n])},Nn.prototype.lightSpecular=On.prototype.a3DOnlyFunction,Fn.prototype.lightSpecular=function(e,t,n){var r=_(e,t,n,0),i=[((r&c.RED_MASK)>>>16)/255,((r&c.GREEN_MASK)>>>8)/255,(r&c.BLUE_MASK)/255];oe.useProgram(de),S("uSpecular3d",de,"uSpecular",i)},se.lights=function(){se.ambientLight(128,128,128),se.directionalLight(128,128,128,0,0,-1),se.lightFalloff(1,0,0),se.lightSpecular(0,0,0)},Nn.prototype.pointLight=On.prototype.a3DOnlyFunction,Fn.prototype.pointLight=function(e,t,n,r,i,s){if(Qt===c.MAX_LIGHTS)throw"can only create "+c.MAX_LIGHTS+" lights";var o=new PVector(r,i,s),a=new Gn;a.scale(1,-1,1),a.apply(Ve.array()),a.mult(o,o);var l=_(e,t,n,0),h=[((l&c.RED_MASK)>>>16)/255,((l&c.GREEN_MASK)>>>8)/255,(l&c.BLUE_MASK)/255];oe.useProgram(de),S("uLights.color.3d."+Qt,de,"uLights"+Qt+".color",h),S("uLights.position.3d."+Qt,de,"uLights"+Qt+".position",o.array()),P("uLights.type.3d."+Qt,de,"uLights"+Qt+".type",2),P("uLightCount3d",de,"uLightCount",++Qt)},Nn.prototype.noLights=On.prototype.a3DOnlyFunction,Fn.prototype.noLights=function(){Qt=0,oe.useProgram(de),P("uLightCount3d",de,"uLightCount",Qt)},Nn.prototype.spotLight=On.prototype.a3DOnlyFunction,Fn.prototype.spotLight=function(e,t,n,r,i,s,o,a,l,h,u){if(Qt===c.MAX_LIGHTS)throw"can only create "+c.MAX_LIGHTS+" lights";oe.useProgram(de);var f=new PVector(r,i,s),p=new Gn;p.scale(1,-1,1),p.apply(Ve.array()),p.mult(f,f);var m=[(p=p.array())[0]*o+p[4]*a+p[8]*l,p[1]*o+p[5]*a+p[9]*l,p[2]*o+p[6]*a+p[10]*l],g=_(e,t,n,0),d=[((g&c.RED_MASK)>>>16)/255,((g&c.GREEN_MASK)>>>8)/255,(g&c.BLUE_MASK)/255];S("uLights.color.3d."+Qt,de,"uLights"+Qt+".color",d),S("uLights.position.3d."+Qt,de,"uLights"+Qt+".position",f.array()),S("uLights.direction.3d."+Qt,de,"uLights"+Qt+".direction",m),S("uLights.concentration.3d."+Qt,de,"uLights"+Qt+".concentration",u),S("uLights.angle.3d."+Qt,de,"uLights"+Qt+".angle",h),P("uLights.type.3d."+Qt,de,"uLights"+Qt+".type",3),P("uLightCount3d",de,"uLightCount",++Qt)},Nn.prototype.beginCamera=function(){throw"beginCamera() is not available in 2D mode"},Fn.prototype.beginCamera=function(){if(an)throw"You cannot call beginCamera() again before calling endCamera()";an=!0,Ve=Ge,ze=$e},Nn.prototype.endCamera=function(){throw"endCamera() is not available in 2D mode"},Fn.prototype.endCamera=function(){if(!an)throw"You cannot call endCamera() before calling beginCamera()";Ve.set($e),ze.set(Ge),an=!1},se.camera=function(e,n,r,i,s,o,a,l,h){e===t&&(hn=se.width/2,un=se.height/2,cn=un/Math.tan(ln/2),e=hn,n=un,r=cn,i=hn,s=un,o=0,a=0,l=1,h=0);var u=new PVector(e-i,n-s,r-o),c=new PVector(a,l,h);u.normalize();var f=PVector.cross(c,u);c=PVector.cross(u,f),f.normalize(),c.normalize();var p=f.x,m=f.y,g=f.z,d=c.x,v=c.y,y=c.z,A=u.x,b=u.y,x=u.z;$e.set(p,m,g,0,d,v,y,0,A,b,x,0,0,0,0,1),$e.translate(-e,-n,-r),Ge.reset(),Ge.invApply(p,m,g,0,d,v,y,0,A,b,x,0,0,0,0,1),Ge.translate(e,n,r),Ve.set($e),ze.set(Ge)},se.perspective=function(e,t,n,r){var i,s,o,a;0===arguments.length&&(un=ne.height/2,cn=un/Math.tan(ln/2),fn=cn/10,pn=10*cn,mn=se.width/se.height,e=ln,t=mn,n=fn,r=pn),o=(i=n*Math.tan(e/2))*t,a=(s=-i)*t,se.frustum(a,o,s,i,n,r)},Nn.prototype.frustum=function(){throw"Processing.js: frustum() is not supported in 2D mode"},Fn.prototype.frustum=function(e,t,n,r,i,s){!0,(Ye=new Gn).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 Gn;o.set(Ye),o.transpose(),oe.useProgram(ve),C("projection2d",ve,"uProjection",!1,o.array()),oe.useProgram(de),C("projection3d",de,"uProjection",!1,o.array()),oe.useProgram(ye),C("uProjectionUS",ye,"uProjection",!1,o.array())},se.ortho=function(e,t,n,r,i,s){0===arguments.length&&(e=0,t=se.width,n=0,r=se.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),c=-(s+i)/(s-i);(Ye=new Gn).set(o,0,0,h,0,a,0,u,0,0,l,c,0,0,0,1);var f=new Gn;f.set(Ye),f.transpose(),oe.useProgram(ve),C("projection2d",ve,"uProjection",!1,f.array()),oe.useProgram(de),C("projection3d",de,"uProjection",!1,f.array()),oe.useProgram(ye),C("uProjectionUS",ye,"uProjection",!1,f.array()),!1},se.printProjection=function(){Ye.print()},se.printCamera=function(){$e.print()},Nn.prototype.box=On.prototype.a3DOnlyFunction,Fn.prototype.box=function(e,t,n){t&&n||(t=n=e);var r=new Gn;r.scale(e,t,n);var i=new Gn;if(i.scale(1,-1,1),i.apply(Ve.array()),i.transpose(),je){if(oe.useProgram(de),C("model3d",de,"uModel",!1,r.array()),C("view3d",de,"uView",!1,i.array()),oe.enable(oe.POLYGON_OFFSET_FILL),oe.polygonOffset(1,1),S("color3d",de,"uColor",Ke),Qt>0){var s=new Gn;s.set(i);var o=new Gn;o.set(r),s.mult(o);var a=new Gn;a.set(s),a.invert(),a.transpose(),C("uNormalTransform3d",de,"uNormalTransform",!1,a.array()),M("aNormal3d",de,"aNormal",3,be)}else T("aNormal3d",de,"aNormal");M("aVertex3d",de,"aVertex",3,Ae),T("aColor3d",de,"aColor"),T("aTexture3d",de,"aTexture"),oe.drawArrays(oe.TRIANGLES,0,En.length/3),oe.disable(oe.POLYGON_OFFSET_FILL)}tt>0&&qe&&(oe.useProgram(ve),C("uModel2d",ve,"uModel",!1,r.array()),C("uView2d",ve,"uView",!1,i.array()),S("uColor2d",ve,"uColor",Qe),P("uIsDrawingText2d",ve,"uIsDrawingText",!1),M("vertex2d",ve,"aVertex",3,xe),T("aTextureCoord2d",ve,"aTextureCoord"),oe.drawArrays(oe.LINES,0,Sn.length/3))};se.sphereDetail=function(e,t){var n;if(1===arguments.length&&(e=t=arguments[0]),e<3&&(e=3),t<2&&(t=2),e!==en||t!==Jt){var r=c.SINCOS_LENGTH/e,i=new g(e),s=new g(e);for(n=0;n0){var r=new Gn;r.set(n);var i=new Gn;i.set(t),r.mult(i);var s=new Gn;s.set(r),s.invert(),s.transpose(),C("uNormalTransform3d",de,"uNormalTransform",!1,s.array()),M("aNormal3d",de,"aNormal",3,Se)}else T("aNormal3d",de,"aNormal");oe.useProgram(de),T("aTexture3d",de,"aTexture"),C("uModel3d",de,"uModel",!1,t.array()),C("uView3d",de,"uView",!1,n.array()),M("aVertex3d",de,"aVertex",3,Se),T("aColor3d",de,"aColor"),oe.enable(oe.POLYGON_OFFSET_FILL),oe.polygonOffset(1,1),S("uColor3d",de,"uColor",Ke),oe.drawArrays(oe.TRIANGLE_STRIP,0,Be.length/3),oe.disable(oe.POLYGON_OFFSET_FILL)}tt>0&&qe&&(oe.useProgram(ve),C("uModel2d",ve,"uModel",!1,t.array()),C("uView2d",ve,"uView",!1,n.array()),M("aVertex2d",ve,"aVertex",3,Se),T("aTextureCoord2d",ve,"aTextureCoord"),S("uColor2d",ve,"uColor",Qe),P("uIsDrawingText",ve,"uIsDrawingText",!1),oe.drawArrays(oe.LINE_STRIP,0,Be.length/3))},se.modelX=function(e,t,n){var r=Ve.array(),i=Ge.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},se.modelY=function(e,t,n){var r=Ve.array(),i=Ge.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},se.modelZ=function(e,t,n){var r=Ve.array(),i=Ge.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},Nn.prototype.ambient=On.prototype.a3DOnlyFunction,Fn.prototype.ambient=function(e,t,n){oe.useProgram(de),P("uUsingMat3d",de,"uUsingMat",!0);var r=se.color(e,t,n);S("uMaterialAmbient3d",de,"uMaterialAmbient",se.color.toGLArray(r).slice(0,3))},Nn.prototype.emissive=On.prototype.a3DOnlyFunction,Fn.prototype.emissive=function(e,t,n){oe.useProgram(de),P("uUsingMat3d",de,"uUsingMat",!0);var r=se.color(e,t,n);S("uMaterialEmissive3d",de,"uMaterialEmissive",se.color.toGLArray(r).slice(0,3))},Nn.prototype.shininess=On.prototype.a3DOnlyFunction,Fn.prototype.shininess=function(e){oe.useProgram(de),P("uUsingMat3d",de,"uUsingMat",!0),S("uShininess3d",de,"uShininess",e)},Nn.prototype.specular=On.prototype.a3DOnlyFunction,Fn.prototype.specular=function(e,t,n){oe.useProgram(de),P("uUsingMat3d",de,"uUsingMat",!0);var r=se.color(e,t,n);S("uMaterialSpecular3d",de,"uMaterialSpecular",se.color.toGLArray(r).slice(0,3))},se.screenX=function(e,t,n){var r=Ve.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=Ye.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),se.width*(1+h)/2}return Ve.multX(e,t)},se.screenY=function(e,t,n){var r=Ve.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=Ye.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),se.height*(1+h)/2}return Ve.multY(e,t)},se.screenZ=function(e,t,n){var r=Ve.array();if(16!==r.length)return 0;var i=Ye.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},On.prototype.fill=function(){var e=se.color.apply(this,arguments);e===We&&je||(je=!0,We=e)},Nn.prototype.fill=function(){On.prototype.fill.apply(this,arguments),Ze=!0},Fn.prototype.fill=function(){On.prototype.fill.apply(this,arguments),Ke=se.color.toGLArray(We)},se.noFill=function(){je=!1},On.prototype.stroke=function(){var e=se.color.apply(this,arguments);e===Je&&qe||(qe=!0,Je=e)},Nn.prototype.stroke=function(){On.prototype.stroke.apply(this,arguments),et=!0},Fn.prototype.stroke=function(){On.prototype.stroke.apply(this,arguments),Qe=se.color.toGLArray(Je)},se.noStroke=function(){qe=!1},On.prototype.strokeWeight=function(e){tt=e},Nn.prototype.strokeWeight=function(e){On.prototype.strokeWeight.apply(this,arguments),oe.lineWidth=e},Fn.prototype.strokeWeight=function(e){On.prototype.strokeWeight.apply(this,arguments),oe.useProgram(ve),S("pointSize2d",ve,"uPointSize",e),oe.useProgram(ye),S("pointSizeUnlitShape",ye,"uPointSize",e),oe.lineWidth(e)},se.strokeCap=function(e){le.$ensureContext().lineCap=e},se.strokeJoin=function(e){le.$ensureContext().lineJoin=e},Nn.prototype.smooth=function(){rt=!0;var e=ne.style;e.setProperty("image-rendering","optimizeQuality","important"),e.setProperty("-ms-interpolation-mode","bicubic","important"),oe.hasOwnProperty("mozImageSmoothingEnabled")&&(oe.mozImageSmoothingEnabled=!0)},Fn.prototype.smooth=function(){rt=!0},Nn.prototype.noSmooth=function(){rt=!1;var e=ne.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"),oe.hasOwnProperty("mozImageSmoothingEnabled")&&(oe.mozImageSmoothingEnabled=!1)},Fn.prototype.noSmooth=function(){rt=!1},Nn.prototype.point=function(e,t){qe&&(rt||(e=Math.round(e),t=Math.round(t)),oe.fillStyle=se.color.toString(Je),Ze=!0,tt>1?(oe.beginPath(),oe.arc(e,t,tt/2,0,c.TWO_PI,!1),oe.fill()):oe.fillRect(e,t,1,1))},Fn.prototype.point=function(e,t,n){var r=new Gn;r.translate(e,t,n||0),r.transpose();var i=new Gn;i.scale(1,-1,1),i.apply(Ve.array()),i.transpose(),oe.useProgram(ve),C("uModel2d",ve,"uModel",!1,r.array()),C("uView2d",ve,"uView",!1,i.array()),tt>0&&qe&&(S("uColor2d",ve,"uColor",Qe),P("uIsDrawingText2d",ve,"uIsDrawingText",!1),P("uSmooth2d",ve,"uSmooth",rt),M("aVertex2d",ve,"aVertex",3,_e),T("aTextureCoord2d",ve,"aTextureCoord"),oe.drawArrays(oe.POINTS,0,1))},se.beginShape=function(e){gt=e,[],gn=[]},Nn.prototype.vertex=function(e,t,n){var r=[];bn&&(bn=!1),r.isVert=!0,r[0]=e,r[1]=t,r[2]=0,r[3]=0,r[4]=0,r[5]=We,r[6]=Je,gn.push(r),n&&(gn[gn.length-1].moveTo=n)},Fn.prototype.vertex=function(e,n,r,i,s){var o=[];bn&&(bn=!1),o.isVert=!0,s===t&&Ft&&(s=i,i=r,r=0),i!==t&&s!==t&&(Nt===c.IMAGE&&(i/=Ot.width,s/=Ot.height),i=(i=i>1?1:i)<0?0:i,s=(s=s>1?1:s)<0?0:s),o[0]=e,o[1]=n,o[2]=r||0,o[3]=i||0,o[4]=s||0,o[5]=Ke[0],o[6]=Ke[1],o[7]=Ke[2],o[8]=Ke[3],o[9]=Qe[0],o[10]=Qe[1],o[11]=Qe[2],o[12]=Qe[3],o[13]=lt,o[14]=ht,o[15]=ut,gn.push(o)};var Un=function(e,t){var n=new Gn;n.scale(1,-1,1),n.apply(Ve.array()),n.transpose(),oe.useProgram(ye),C("uViewUS",ye,"uView",!1,n.array()),P("uSmoothUS",ye,"uSmooth",rt),M("aVertexUS",ye,"aVertex",3,_e),oe.bufferData(oe.ARRAY_BUFFER,new g(e),oe.STREAM_DRAW),M("aColorUS",ye,"aColor",4,Me),oe.bufferData(oe.ARRAY_BUFFER,new g(t),oe.STREAM_DRAW),oe.drawArrays(oe.POINTS,0,e.length/3)},Hn=function(e,t,n){var r;r="LINES"===t?oe.LINES:"LINE_LOOP"===t?oe.LINE_LOOP:oe.LINE_STRIP;var i=new Gn;i.scale(1,-1,1),i.apply(Ve.array()),i.transpose(),oe.useProgram(ye),C("uViewUS",ye,"uView",!1,i.array()),M("aVertexUS",ye,"aVertex",3,Pe),oe.bufferData(oe.ARRAY_BUFFER,new g(e),oe.STREAM_DRAW),M("aColorUS",ye,"aColor",4,Te),oe.bufferData(oe.ARRAY_BUFFER,new g(n),oe.STREAM_DRAW),oe.drawArrays(r,0,e.length/3)},Xn=function(e,t,n,r){var i;i="TRIANGLES"===t?oe.TRIANGLES:"TRIANGLE_FAN"===t?oe.TRIANGLE_FAN:oe.TRIANGLE_STRIP;var s=new Gn;s.scale(1,-1,1),s.apply(Ve.array()),s.transpose(),oe.useProgram(de),C("model3d",de,"uModel",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),C("view3d",de,"uView",!1,s.array()),oe.enable(oe.POLYGON_OFFSET_FILL),oe.polygonOffset(1,1),S("color3d",de,"uColor",[-1,0,0,0]),M("vertex3d",de,"aVertex",3,Ce),oe.bufferData(oe.ARRAY_BUFFER,new g(e),oe.STREAM_DRAW),Ft&&null!==Tt&&_t(n),M("aColor3d",de,"aColor",4,Me),oe.bufferData(oe.ARRAY_BUFFER,new g(n),oe.STREAM_DRAW),T("aNormal3d",de,"aNormal"),Ft&&(P("uUsingTexture3d",de,"uUsingTexture",Ft),M("aTexture3d",de,"aTexture",2,Re),oe.bufferData(oe.ARRAY_BUFFER,new g(r),oe.STREAM_DRAW)),oe.drawArrays(i,0,e.length/3),oe.disable(oe.POLYGON_OFFSET_FILL)};Nn.prototype.endShape=function(e){if(0!==gn.length){var n=e===c.CLOSE;n&&gn.push(gn[0]);var r,i=[],s=[],o=[],a=[];bn=!0;var l,h,u=gn.length;for(l=0;l2)for(oe.beginPath(),oe.moveTo(gn[0][0],gn[0][1]),oe.lineTo(gn[1][0],gn[1][1]),oe.lineTo(gn[2][0],gn[2][1]),je&&(se.fill(gn[2][5]),B()),qe&&(se.stroke(gn[2][6]),$()),oe.closePath(),l=3;l3)for(l=0;l+13){var f=[],p=1-dt;for(oe.beginPath(),oe.moveTo(gn[1][0],gn[1][1]),l=1;l+22)for(h=0;h+22)for(h=0;h+22){for(h=0;h<3;h++)for(n=gn[h],u=0;u<3;u++)i.push(n[u]);for(h=0;h<3;h++)for(n=gn[h],u=9;u<13;u++)a.push(n[u]);for(qe&&Hn(i,"LINE_LOOP",a),h=2;h+13){for(h=0;h<2;h++)for(n=gn[h],u=0;u<3;u++)i.push(n[u]);for(h=0;h<2;h++)for(n=gn[h],u=9;u<13;u++)a.push(n[u]);for(Hn(i,"LINE_STRIP",a),p>4&&p%2>0&&(s.splice(s.length-3),gn.pop()),h=0;h+33&&function(e,t,n,r,i,s,o,a,l,h,u,c){var f=r,p=i,m=s,g=fe.array(),d=g[4]*e+g[5]*r+g[6]*o+g[7]*h,v=g[8]*e+g[9]*r+g[10]*o+g[11]*h,y=g[12]*e+g[13]*r+g[14]*o+g[15]*h,A=g[4]*t+g[5]*i+g[6]*a+g[7]*u,b=g[8]*t+g[9]*i+g[10]*a+g[11]*u,x=g[12]*t+g[13]*i+g[14]*a+g[15]*u,w=g[4]*n+g[5]*s+g[6]*l+g[7]*c,E=g[8]*n+g[9]*s+g[10]*l+g[11]*c,S=g[12]*n+g[13]*s+g[14]*l+g[15]*c;se.vertex(f,p,m);for(var P=0;Pc.TWO_PI&&(s=i+c.TWO_PI);var a=n/2,l=r/2,h=e+a,u=t+l,f=(g=h+.5,d=u+.5,v=i,y=1/(a+l),A=s,function(e,t,n,r,i){for(n=0,r=v,i=A+y,e.beginShape(),t&&e.vertex(g-.5,d-.5);ri&&(s=n,n=i,i=s),i++,tt%2==1&&oe.translate(.5,0)):n===i&&(e>r&&(s=e,e=r,r=s),r++,tt%2==1&&oe.translate(0,.5)),1===tt&&(o=oe.lineCap,oe.lineCap="butt")),oe.beginPath(),oe.moveTo(e||0,n||0),oe.lineTo(r||0,i||0),$(),a&&(e===r&&tt%2==1?oe.translate(-.5,0):n===i&&tt%2==1&&oe.translate(0,-.5),1===tt&&(oe.lineCap=o))}},Fn.prototype.line=function(e,n,r,i,s,o){if(s!==t&&o!==t||(o=0,s=i,i=r,r=0),e!==i||n!==s||r!==o){var a=[e,n,r,i,s,o],l=new Gn;l.scale(1,-1,1),l.apply(Ve.array()),l.transpose(),tt>0&&qe&&(oe.useProgram(ve),C("uModel2d",ve,"uModel",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),C("uView2d",ve,"uView",!1,l.array()),S("uColor2d",ve,"uColor",Qe),P("uIsDrawingText",ve,"uIsDrawingText",!1),M("aVertex2d",ve,"aVertex",3,Pe),T("aTextureCoord2d",ve,"aTextureCoord"),oe.bufferData(oe.ARRAY_BUFFER,new g(a),oe.STREAM_DRAW),oe.drawArrays(oe.LINES,0,2))}else se.point(e,n,r)},Nn.prototype.bezier=function(){if(8!==arguments.length)throw"You must use 8 parameters for bezier() in 2D mode";se.beginShape(),se.vertex(arguments[0],arguments[1]),se.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]),se.endShape()},Fn.prototype.bezier=function(){if(12!==arguments.length)throw"You must use 12 parameters for bezier() in 3D mode";se.beginShape(),se.vertex(arguments[0],arguments[1],arguments[2]),se.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]),se.endShape()},se.bezierDetail=function(e){bt=e},se.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},se.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)},se.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)},se.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)},se.triangle=function(e,t,n,r,i,s){se.beginShape(c.TRIANGLES),se.vertex(e,t,0),se.vertex(n,r,0),se.vertex(i,s,0),se.endShape()},se.quad=function(e,t,n,r,i,s,o,a){se.beginShape(c.QUADS),se.vertex(e,t,0),se.vertex(n,r,0),se.vertex(i,s,0),se.vertex(o,a,0),se.endShape()};Nn.prototype.rect=function(e,n,r,i,s,o,a,l){if(r==""+r||i==""+i){if(ot===c.CORNERS?(r-=e,i-=n):ot===c.RADIUS?(e-=(r*=2)/2,n-=(i*=2)/2):ot===c.CENTER&&(e-=r/2,n-=i/2),rt||(e=Math.round(e),n=Math.round(n),r=Math.round(r),i=Math.round(i)),s!==t)return void function(e,n,r,i,s,o,a,l){l===t&&(o=s,a=s,l=s);var h=r/2,u=i/2;(s>h||s>u)&&(s=Math.min(h,u)),(o>h||o>u)&&(o=Math.min(h,u)),(a>h||a>u)&&(a=Math.min(h,u)),(l>h||l>u)&&(l=Math.min(h,u)),je&&!qe||oe.translate(.5,.5),oe.beginPath(),oe.moveTo(e+s,n),oe.lineTo(e+r-o,n),oe.quadraticCurveTo(e+r,n,e+r,n+o),oe.lineTo(e+r,n+i-a),oe.quadraticCurveTo(e+r,n+i,e+r-a,n+i),oe.lineTo(e+l,n+i),oe.quadraticCurveTo(e,n+i,e,n+i-l),oe.lineTo(e,n+s),oe.quadraticCurveTo(e,n,e+s,n),je&&!qe||oe.translate(-.5,-.5),B(),$()}(e,n,r,i,s,o,a,l);qe&&tt%2==1&&oe.translate(.5,.5),oe.beginPath(),oe.rect(e,n,r,i),B(),$(),qe&&tt%2==1&&oe.translate(-.5,-.5)}},Fn.prototype.rect=function(e,n,r,i,s,o,a,l){if(s!==t)throw"rect() with rounded corners is not supported in 3D mode";ot===c.CORNERS?(r-=e,i-=n):ot===c.RADIUS?(e-=(r*=2)/2,n-=(i*=2)/2):ot===c.CENTER&&(e-=r/2,n-=i/2);var h=new Gn;h.translate(e,n,0),h.scale(r,i,1),h.transpose();var u=new Gn;if(u.scale(1,-1,1),u.apply(Ve.array()),u.transpose(),tt>0&&qe&&(oe.useProgram(ve),C("uModel2d",ve,"uModel",!1,h.array()),C("uView2d",ve,"uView",!1,u.array()),S("uColor2d",ve,"uColor",Qe),P("uIsDrawingText2d",ve,"uIsDrawingText",!1),M("aVertex2d",ve,"aVertex",3,we),T("aTextureCoord2d",ve,"aTextureCoord"),oe.drawArrays(oe.LINE_LOOP,0,Cn.length/3)),je){if(oe.useProgram(de),C("uModel3d",de,"uModel",!1,h.array()),C("uView3d",de,"uView",!1,u.array()),oe.enable(oe.POLYGON_OFFSET_FILL),oe.polygonOffset(1,1),S("color3d",de,"uColor",Ke),Qt>0){var f=new Gn;f.set(u);var p=new Gn;p.set(h),f.mult(p);var m=new Gn;m.set(f),m.invert(),m.transpose(),C("uNormalTransform3d",de,"uNormalTransform",!1,m.array()),M("aNormal3d",de,"aNormal",3,Ee)}else T("normal3d",de,"aNormal");M("vertex3d",de,"aVertex",3,we),oe.drawArrays(oe.TRIANGLE_FAN,0,Cn.length/3),oe.disable(oe.POLYGON_OFFSET_FILL)}},Nn.prototype.ellipse=function(e,t,n,r){if(e=e||0,t=t||0,!(n<=0&&r<=0))if(at===c.RADIUS?(n*=2,r*=2):at===c.CORNERS?(n-=e,r-=t,e+=n/2,t+=r/2):at===c.CORNER&&(e+=n/2,t+=r/2),n===r)oe.beginPath(),oe.arc(e,t,n/2,0,c.TWO_PI,!1),B(),$();else{var i=n/2,s=r/2,o=.5522847498307933,a=o*i,l=o*s;se.beginShape(),se.vertex(e+i,t),se.bezierVertex(e+i,t-l,e+a,t-s,e,t-s),se.bezierVertex(e-a,t-s,e-i,t-l,e-i,t),se.bezierVertex(e-i,t+l,e-a,t+s,e,t+s),se.bezierVertex(e+a,t+s,e+i,t+l,e+i,t),se.endShape()}},Fn.prototype.ellipse=function(e,t,n,r){if(e=e||0,t=t||0,!(n<=0&&r<=0)){at===c.RADIUS?(n*=2,r*=2):at===c.CORNERS?(e+=(n-=e)/2,t+=(r-=t)/2):at===c.CORNER&&(e+=n/2,t+=r/2);var i=n/2,s=r/2,o=.5522847498307933,a=o*i,l=o*s;if(se.beginShape(),se.vertex(e+i,t),se.bezierVertex(e+i,t-l,0,e+a,t-s,0,e,t-s,0),se.bezierVertex(e-a,t-s,0,e-i,t-l,0,e-i,t,0),se.bezierVertex(e-i,t+l,0,e-a,t+s,0,e,t+s,0),se.bezierVertex(e+a,t+s,0,e+i,t+l,0,e+i,t,0),se.endShape(),je){var h,u,f=0,p=0;for(h=0;h>>16,r[n+1]=(t&c.GREEN_MASK)>>>8,r[n+2]=t&c.BLUE_MASK,r[n+3]=(t&c.ALPHA_MASK)>>>24,f.__isDirty=!0}),toArray:(u=a,function(){var e=[],t=u.imageData.data,n=u.width*u.height;if(u.isRemote)throw"Image is loaded remotely. Cannot get pixels.";for(var r=0,i=0;r>>16,n[t+1]=(r&c.GREEN_MASK)>>>8,n[t+2]=r&c.BLUE_MASK,n[t+3]=(r&c.ALPHA_MASK)>>>24;l.__isDirty=!0})}};qn.prototype={__isPImage:!0,updatePixels:function(){var e=this.sourceImg;e&&e instanceof p&&this.__isDirty&&e.getContext("2d").putImageData(this.imageData,0,0),this.__isDirty=!1},fromHTMLImageData:function(e){var t=V(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?se.get(e,t,this):4===arguments.length?se.get(e,t,n,r,this):void 0:se.get(this)},set:function(e,t,n){se.set(e,t,n,this),this.__isDirty=!0},blend:function(e,t,n,r,i,s,o,a,l,h){9===arguments.length?se.blend(this,e,t,n,r,i,s,o,a,l,this):10===arguments.length&&se.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?se.blend(this,e,t,n,r,i,s,o,a,c.REPLACE,this):9===arguments.length&&se.blend(e,t,n,r,i,s,o,a,l,c.REPLACE,this),delete this.sourceImg},filter:function(e,t){2===arguments.length?se.filter(e,t,this):1===arguments.length&&se.filter(e,null,this),delete this.sourceImg},save:function(e){se.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=Math.floor(this.width/this.height*t):0===t&&0!==e&&(t=Math.floor(this.height/this.width*e));var n=V(V(this.imageData).canvas,e,t).context.getImageData(0,0,e,t);this.fromImageData(n)}},mask:function(e){var t,n,r=this.toImageData();if(e instanceof qn||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=se.width||e<0||t<0||t>=se.height)return 0;if(jt){var r=4*((0|e)+se.width*(0|t));return(n=se.imageData.data)[r+3]<<24&c.ALPHA_MASK|n[r]<<16&c.RED_MASK|n[r+1]<<8&c.GREEN_MASK|n[r+2]&c.BLUE_MASK}return(n=se.toImageData(0|e,0|t,1,1).data)[3]<<24&c.ALPHA_MASK|n[0]<<16&c.RED_MASK|n[1]<<8&c.GREEN_MASK|n[2]&c.BLUE_MASK}(e,t):void 0!==e?U(0,0,e.width,e.height,e):z(0,0,se.width,se.height)},se.createGraphics=function(e,t,n){var r=new x;return r.size(e,t,n),r.background(0,0),r},se.set=function(e,t,n,r){var i,s,o;3===arguments.length?"number"==typeof n?(s=t,o=n,(i=e)=0&&s>=0&&sKt&&H())):(n instanceof qn||n.__isPImage)&&se.image(n,e,t):4===arguments.length&&function(e,t,n,r){if(r.isRemote)throw"Image is loaded remotely. Cannot set x,y.";var i=se.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]}(e,t,n,r)},se.imageData={},se.pixels={getLength:function(){return se.imageData.data.length?se.imageData.data.length/4:0},getPixel:function(e){var t=4*e,n=se.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=se.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=se.imageData.width*se.imageData.height,n=se.imageData.data,r=0,i=0;r0&&Qn(e,t,n,r);var i=se.color.toGLArray(At);oe.clearColor(i[0],i[1],i[2],i[3]),oe.clear(oe.COLOR_BUFFER_BIT|oe.DEPTH_BUFFER_BIT)},Nn.prototype.image=function(e,t,n,r,i){if(t=Math.round(t),n=Math.round(n),e.width>0){var s=(r||e.width,i||e.height,Ln(t||0,n||0,r||e.width,i||e.height,arguments.length<4));if(!!e.sourceImg&&null===Tt){var o=e.sourceImg;e.__isDirty&&e.updatePixels(),oe.drawImage(o,0,0,o.width,o.height,s.x,s.y,s.w,s.h)}else{var a=e.toImageData();null!==Tt&&(Tt(a),e.__isDirty=!0),oe.drawImage(V(a).canvas,0,0,e.width,e.height,s.x,s.y,s.w,s.h)}}},Fn.prototype.image=function(e,t,n,r,i){e.width>0&&(t=Math.round(t),n=Math.round(n),r=r||e.width,i=i||e.height,se.beginShape(se.QUADS),se.texture(e),se.vertex(t,n,0,0,0),se.vertex(t,n+i,0,0,i),se.vertex(t+r,n+i,0,r,i),se.vertex(t+r,n,0,r,0),se.endShape())},se.tint=function(e,t,n,r){var i=se.color(e,t,n,r),s=se.red(i)/wt,o=se.green(i)/Et,a=se.blue(i)/St,l=se.alpha(i)/xt;Tt=function(e){for(var t=e.data,n=4*e.width*e.height,r=0;r=P)break;f=0}for(d=f;d=P);d++)v=4*(l+E),a=T[d],o+=a*_[v+3],r+=a*_[v],i+=a*_[v+1],s+=a*_[v+2],n+=a,l++;w[h=E+p]=o/n,A[h]=r/n,b[h]=i/n,x[h]=s/n}E+=P}for(E=0,c=(u=-M)*P,m=0;m=S)break;f=0,h=u,l=p+c}for(d=f;d=S);d++)a=T[d],o+=a*w[l],r+=a*A[l],i+=a*b[l],s+=a*x[l],n+=a,h++,l+=P;_[v=4*(p+E)]=r/n,_[v+1]=i/n,_[v+2]=s/n,_[v+3]=o/n}E+=P,c+=P,u++}},er=function(e,t){var n,r,i,s,o,a,l,h,u,c,f,p,m,g,v,y,A,b=0,x=t.pixels.getLength(),w=new d(x);if(e)for(;b=r&&(a=b),h<0&&(h=0),u>=x&&(u=b),p=t.pixels.getPixel(h),f=t.pixels.getPixel(l),m=t.pixels.getPixel(u),c=t.pixels.getPixel(a),o=77*(i>>16&255)+151*(i>>8&255)+28*(255&i),v=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),g=77*(c>>16&255)+151*(c>>8&255)+28*(255&c),y=77*(p>>16&255)+151*(p>>8&255)+28*(255&p),A=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),v=r&&(a=b),h<0&&(h=0),u>=x&&(u=b),p=t.pixels.getPixel(h),f=t.pixels.getPixel(l),m=t.pixels.getPixel(u),c=t.pixels.getPixel(a),o=77*(i>>16&255)+151*(i>>8&255)+28*(255&i),v=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),g=77*(c>>16&255)+151*(c>>8&255)+28*(255&c),y=77*(p>>16&255)+151*(p>>8&255)+28*(255&p),A=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),v>o&&(s=f,o=v),g>o&&(s=c,o=g),y>o&&(s=p,o=y),A>o&&(s=m,o=A),w[b++]=s;t.pixels.set(w)};se.filter=function(e,n,r){var i,s,o,a;if(3===arguments.length?(r.loadPixels(),i=r):(se.loadPixels(),i=se),n===t&&(n=null),i.isRemote)throw"Image is loaded remotely. Cannot filter image.";var l=i.pixels.getLength();switch(e){case c.BLUR:Jn(n||1,i);break;case c.GRAY:if(i.format===c.ALPHA){for(a=0;a>16&255)+151*(s>>8&255)+28*(255&s)>>8,i.pixels.setPixel(a,s&c.ALPHA_MASK|o<<16|o<<8|o);break;case c.INVERT:for(a=0;a255)throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)";var u=h-1;for(a=0;a>16&255,p=i.pixels.getPixel(a)>>8&255,m=255&i.pixels.getPixel(a);f=255*(f*h>>8)/u,p=255*(p*h>>8)/u,m=255*(m*h>>8)/u,i.pixels.setPixel(a,4278190080&i.pixels.getPixel(a)|f<<16|p<<8|m)}break;case c.OPAQUE:for(a=0;a1)throw"Level must be between 0 and 1 for filter(THRESHOLD, level)";var g=se.floor(255*n);for(a=0;a>16,se.max((i.pixels.getPixel(a)&c.GREEN_MASK)>>8,i.pixels.getPixel(a)&c.BLUE_MASK));i.pixels.setPixel(a,i.pixels.getPixel(a)&c.ALPHA_MASK|(dl&&(u=l);else{var f=l+e-i;u>f&&(u=f)}if(sh&&(c=h);else{var p=h+t-s;c>p&&(c=p)}return!(u<=0||c<=0)};var tr,nr={};if(nr[c.BLEND]=se.modes.blend,nr[c.ADD]=se.modes.add,nr[c.SUBTRACT]=se.modes.subtract,nr[c.LIGHTEST]=se.modes.lightest,nr[c.DARKEST]=se.modes.darkest,nr[c.REPLACE]=se.modes.replace,nr[c.DIFFERENCE]=se.modes.difference,nr[c.EXCLUSION]=se.modes.exclusion,nr[c.MULTIPLY]=se.modes.multiply,nr[c.SCREEN]=se.modes.screen,nr[c.OVERLAY]=se.modes.overlay,nr[c.HARD_LIGHT]=se.modes.hard_light,nr[c.SOFT_LIGHT]=se.modes.soft_light,nr[c.DODGE]=se.modes.dodge,nr[c.BURN]=se.modes.burn,se.blit_resize=function(e,t,n,r,i,s,o,a,l,h,u,f,p){var m,g;t<0&&(t=0),n<0&&(n=0),r>=e.width&&(r=e.width-1),i>=e.height&&(i=e.height-1);var d=r-t,v=i-n,y=u-l,A=f-h;if(!(y<=0||A<=0||d<=0||v<=0||l>=o||h>=a||t>=e.width||n>=e.height)){var b=Math.floor(d/y*c.PRECISIONF),x=Math.floor(v/A*c.PRECISIONF),w=se.shared;w.srcXOffset=Math.floor(l<0?-l*b:t*c.PRECISIONF),w.srcYOffset=Math.floor(h<0?-h*x:n*c.PRECISIONF),l<0&&(y+=l,l=0),h<0&&(A+=h,h=0),y=Math.min(y,o-l),A=Math.min(A,a-h);var E,S=h*o+l;w.srcBuffer=e.imageData.data,w.iw=e.width,w.iw1=e.width-1,w.ih1=e.height-1;var P,C,M,T,_,R,L=(se.filter_bilinear,se.filter_new_scanline,nr[p]),I=c.ALPHA_MASK,D=c.RED_MASK,O=c.GREEN_MASK,N=c.BLUE_MASK,F=c.PREC_MAXVAL,k=c.PRECISIONB,B=c.PREC_RED_SHIFT,$=c.PREC_ALPHA_SHIFT,G=w.srcBuffer,V=Math.min;for(g=0;g>k)*w.iw,w.v2=V(1+(w.srcYOffset>>k),w.ih1)*w.iw,m=0;m>k,w.ll=w.ifU*w.fracV>>k,w.ur=w.fracU*w.ifV>>k,w.lr=w.fracU*w.fracV>>k,w.u1=w.sX>>k,w.u2=V(w.u1+1,w.iw1),M=4*(w.v1+w.u1),T=4*(w.v1+w.u2),_=4*(w.v2+w.u1),R=4*(w.v2+w.u2),w.cUL=G[M+3]<<24&I|G[M]<<16&D|G[M+1]<<8&O|G[M+2]&N,w.cUR=G[T+3]<<24&I|G[T]<<16&D|G[T+1]<<8&O|G[T+2]&N,w.cLL=G[_+3]<<24&I|G[_]<<16&D|G[_+1]<<8&O|G[_+2]&N,w.cLR=G[R+3]<<24&I|G[R]<<16&D|G[R+1]<<8&O|G[R+2]&N,w.r=w.ul*((w.cUL&D)>>16)+w.ll*((w.cLL&D)>>16)+w.ur*((w.cUR&D)>>16)+w.lr*((w.cLR&D)>>16)<>>k&O,w.b=w.ul*(w.cUL&N)+w.ll*(w.cLL&N)+w.ur*(w.cUR&N)+w.lr*(w.cLR&N)>>>k,w.a=w.ul*((w.cUL&I)>>>24)+w.ll*((w.cLL&I)>>>24)+w.ur*((w.cUR&I)>>>24)+w.lr*((w.cLR&I)>>>24)<<$&I,P=L(E,w.a|w.r|w.g|w.b),s[C]=(P&D)>>>16,s[C+1]=(P&O)>>>8,s[C+2]=P&N,s[C+3]=(P&I)>>>24,w.sX+=b;S+=o,w.srcYOffset+=x}}},se.loadFont=function(e,n){if(e===t)throw"font name required in loadFont.";if(-1===e.indexOf(".svg"))return n===t&&(n=Xt.size),PFont.get(e,n);var r=se.loadGlyphs(e);return{name:e,css:"12px sans-serif",glyph:!0,units_per_em:r.units_per_em,horiz_adv_x:1/r.units_per_em*r.horiz_adv_x,ascent:r.ascent,descent:r.descent,width:function(t){for(var n=0,r=t.length,i=0;i":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){x.debug(e)}},Nn.prototype.text$line=function(e,t,n,r,i){var s=0,o=0;if(Xt.glyph){var a=se.glyphTable[Gt];L(),oe.translate(t,n+Vt),i!==c.RIGHT&&i!==c.CENTER||(s=a.width(e),o=i===c.RIGHT?-s:-s/2);var l=1/a.units_per_em*Vt;oe.scale(l,l);for(var h=0,u=e.length;h