From c17bbb39f3d1cfec0f769b44e5a5e769d861da66 Mon Sep 17 00:00:00 2001 From: 123niel Date: Tue, 22 Jan 2019 17:38:35 +0100 Subject: [PATCH] sierpinski --- p5/p5.dom.min.js | 1 + p5/p5.min.js | 15 +++++++++++++++ sierpinski/index.html | 15 +++++++++++++++ sierpinski/sketch.js | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 p5/p5.dom.min.js create mode 100644 p5/p5.min.js create mode 100644 sierpinski/index.html create mode 100644 sierpinski/sketch.js diff --git a/p5/p5.dom.min.js b/p5/p5.dom.min.js new file mode 100644 index 0000000..76cd895 --- /dev/null +++ b/p5/p5.dom.min.js @@ -0,0 +1 @@ +/*! p5.js v0.7.2 September 02, 2018 */ !function(a,b){"function"==typeof define&&define.amd?define("p5.dom",["p5"],function(a){b(a)}):b("object"==typeof exports?require("../p5"):a.p5)}(this,function(a){function b(b){var c=document;return"string"==typeof b&&"#"===b[0]?(b=b.slice(1),c=document.getElementById(b)||document):b instanceof a.Element?c=b.elt:b instanceof HTMLElement&&(c=b),c}function c(b,c,d){(c._userNode?c._userNode:document.body).appendChild(b);var e=d?new a.MediaElement(b,c):new a.Element(b,c);return c._elements.push(e),e}function d(a,b,d,e){var f=document.createElement(b);"string"==typeof(d=d||"")&&(d=[d]);for(var g=0;g0&&c.every(function(a){return"INPUT"===a.tagName||"LABEL"===a.tagName})?this.createRadio(new a.Element(b,this)):new a.Element(b,this)},a.prototype.removeElements=function(b){a._validateParameters("removeElements",arguments);for(var c=0;c1&&"function"==typeof e[1]?(b.fn=e[1],b.fn()):e.length>1&&"function"==typeof e[2]&&(b.fn=e[2],b.fn())};return d.src=e[0],e.length>1&&"string"==typeof e[1]&&(d.alt=e[1]),d.onload=function(){f()},b=c(d,this)},a.prototype.createA=function(b,d,e){a._validateParameters("createA",arguments);var f=document.createElement("a");return f.href=b,f.innerHTML=d,e&&(f.target=e),c(f,this)},a.prototype.createSlider=function(b,d,e,f){a._validateParameters("createSlider",arguments);var g=document.createElement("input");return g.type="range",g.min=b,g.max=d,0===f?g.step=1e-18:f&&(g.step=f),"number"==typeof e&&(g.value=e),c(g,this)},a.prototype.createButton=function(b,d){a._validateParameters("createButton",arguments);var e=document.createElement("button");return e.innerHTML=b,d&&(e.value=d),c(e,this)},a.prototype.createCheckbox=function(){a._validateParameters("createCheckbox",arguments);var b=document.createElement("div"),d=document.createElement("input");d.type="checkbox",b.appendChild(d);var e=c(b,this);if(e.checked=function(){var a=e.elt.getElementsByTagName("input")[0];if(a){if(0===arguments.length)return a.checked;arguments[0]?a.checked=!0:a.checked=!1}return e},this.value=function(a){return e.value=a,this},arguments[0]){var f=Math.random().toString(36).slice(2),g=document.createElement("label");d.setAttribute("id",f),g.htmlFor=f,e.value(arguments[0]),g.appendChild(document.createTextNode(arguments[0])),b.appendChild(g)}return arguments[1]&&(d.checked=!0),e},a.prototype.createSelect=function(){a._validateParameters("createSelect",arguments);var b,d,e=arguments[0];return"object"==typeof e&&"SELECT"===e.elt.nodeName?(d=e,b=this.elt=e.elt):(b=document.createElement("select"),e&&"boolean"==typeof e&&b.setAttribute("multiple","true"),d=c(b,this)),d.option=function(a,c){for(var d,e=0;e1?f.value=c:f.value=a,b.appendChild(f)}},d.selected=function(a){var b,c=[];if(arguments.length>0){for(b=0;b1){var f=d.length,g=d[0].name,h=d[1].name;e=1;for(var i=1;i-1?h.readAsText(g):h.readAsDataURL(g)}}if(a._validateParameters("createFileInput",arguments),window.File&&window.FileReader&&window.FileList&&window.Blob){var f=document.createElement("input");return f.type="file",d&&(f.multiple="multiple"),f.addEventListener("change",e,!1),c(f,this)}console.log("The File APIs are not fully supported in this browser. Cannot create element.")},a.prototype.createVideo=function(b,c){return a._validateParameters("createVideo",arguments),d(this,"video",b,c)},a.prototype.createAudio=function(b,c){return a._validateParameters("createAudio",arguments),d(this,"audio",b,c)},a.prototype.VIDEO="video",a.prototype.AUDIO="audio",void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(a){var b=navigator.webkitGetUserMedia||navigator.mozGetUserMedia;return b?new Promise(function(c,d){b.call(navigator,a,c,d)}):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),a.prototype.createCapture=function(){a._validateParameters("createCapture",arguments);for(var b,d,e=!0,f=!0,g=0;g2&&(this.elt.style.transform="translate3d("+arguments[0]+"px,"+arguments[1]+"px,"+arguments[2]+"px)",3===arguments.length?this.elt.parentElement.style.perspective="1000px":this.elt.parentElement.style.perspective=arguments[3]+"px"),this.elt.style.transform+=a,this},a.Element.prototype._rotate=function(){var a="";return this.elt.style.transform&&(a=this.elt.style.transform.replace(/rotate3d\(.*\)/g,""),a=a.replace(/rotate[X-Z]?\(.*\)/g,"")),1===arguments.length?this.elt.style.transform="rotate("+arguments[0]+"deg)":2===arguments.length?this.elt.style.transform="rotate("+arguments[0]+"deg, "+arguments[1]+"deg)":3===arguments.length&&(this.elt.style.transform="rotateX("+arguments[0]+"deg)",this.elt.style.transform+="rotateY("+arguments[1]+"deg)",this.elt.style.transform+="rotateZ("+arguments[2]+"deg)"),this.elt.style.transform+=a,this},a.Element.prototype.style=function(b,c){var d=this;if(c instanceof a.Color&&(c="rgba("+c.levels[0]+","+c.levels[1]+","+c.levels[2]+","+c.levels[3]/255+")"),void 0===c){if(-1===b.indexOf(":"))return window.getComputedStyle(d.elt).getPropertyValue(b);for(var e=b.split(";"),f=0;f0?(this.elt.value=arguments[0],this):"range"===this.elt.type?parseFloat(this.elt.value):this.elt.value},a.Element.prototype.show=function(){return this.elt.style.display="block",this},a.Element.prototype.hide=function(){return this.elt.style.display="none",this},a.Element.prototype.size=function(b,c){if(0===arguments.length)return{width:this.elt.offsetWidth,height:this.elt.offsetHeight};var d=b,e=c,f=a.prototype.AUTO;if(d!==f||e!==f){if(d===f?d=c*this.width/this.height:e===f&&(e=b*this.height/this.width),this.elt instanceof HTMLCanvasElement){var g,h={},i=this.elt.getContext("2d");for(g in i)h[g]=i[g];this.elt.setAttribute("width",d*this._pInst._pixelDensity),this.elt.setAttribute("height",e*this._pInst._pixelDensity),this.elt.setAttribute("style","width:"+d+"px; height:"+e+"px"),this._pInst.scale(this._pInst._pixelDensity,this._pInst._pixelDensity);for(g in h)this.elt.getContext("2d")[g]=h[g]}else this.elt.style.width=d+"px",this.elt.style.height=e+"px",this.elt.width=d,this.elt.height=e,this.width=d,this.height=e;this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,this._pInst&&this._pInst._curElement&&this._pInst._curElement.elt===this.elt&&(this._pInst._setProperty("width",this.elt.offsetWidth),this._pInst._setProperty("height",this.elt.offsetHeight))}return this},a.Element.prototype.remove=function(){for(var a in this._events)this.elt.removeEventListener(a,this._events[a]);this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt)},a.MediaElement=function(b,c){a.Element.call(this,b,c);var d=this;this.elt.crossOrigin="anonymous",this._prevTime=0,this._cueIDCounter=0,this._cues=[],this._pixelDensity=1,this._modified=!1,this._pixelsDirty=!0,this._pixelsTime=-1,Object.defineProperty(d,"src",{get:function(){var a=d.elt.children[0].src,b=d.elt.src===window.location.href?"":d.elt.src;return a===window.location.href?b:a},set:function(a){for(var c=0;c1?a=this.elt.play():(this.elt.load(),a=this.elt.play()),a&&a.catch&&a.catch(function(a){console.log("WARN: Element play method raised an error asynchronously",a)}),this},a.MediaElement.prototype.stop=function(){return this.elt.pause(),this.elt.currentTime=0,this},a.MediaElement.prototype.pause=function(){return this.elt.pause(),this},a.MediaElement.prototype.loop=function(){return this.elt.setAttribute("loop",!0),this.play(),this},a.MediaElement.prototype.noLoop=function(){return this.elt.setAttribute("loop",!1),this},a.MediaElement.prototype.autoplay=function(a){return this.elt.setAttribute("autoplay",a),this},a.MediaElement.prototype.volume=function(a){if(void 0===a)return this.elt.volume;this.elt.volume=a},a.MediaElement.prototype.speed=function(a){if(void 0===a)return this.presetPlaybackRate||this.elt.playbackRate;this.loadedmetadata?this.elt.playbackRate=a:this.presetPlaybackRate=a},a.MediaElement.prototype.time=function(a){return void 0===a?this.elt.currentTime:(this.elt.currentTime=a,this)},a.MediaElement.prototype.duration=function(){return this.elt.duration},a.MediaElement.prototype.pixels=[],a.MediaElement.prototype._ensureCanvas=function(){this.canvas||this.loadPixels()},a.MediaElement.prototype.loadPixels=function(){if(this.canvas||(this.canvas=document.createElement("canvas"),this.drawingContext=this.canvas.getContext("2d")),this.loadedmetadata){this.canvas.width!==this.elt.width&&(this.canvas.width=this.elt.width,this.canvas.height=this.elt.height,this.width=this.canvas.width,this.height=this.canvas.height,this._pixelsDirty=!0);var b=this.elt.currentTime;(this._pixelsDirty||this._pixelsTime!==b)&&(this._pixelsTime=b,this._pixelsDirty=!0,this.drawingContext.drawImage(this.elt,0,0,this.canvas.width,this.canvas.height),a.Renderer2D.prototype.loadPixels.call(this))}return this.setModified(!0),this},a.MediaElement.prototype.updatePixels=function(b,c,d,e){return this.loadedmetadata&&(this._ensureCanvas(),a.Renderer2D.prototype.updatePixels.call(this,b,c,d,e)),this.setModified(!0),this},a.MediaElement.prototype.get=function(b,c,d,e){if(this.loadedmetadata){var f=this.elt.currentTime;return this._pixelsTime!==f?this.loadPixels():this._ensureCanvas(),a.Renderer2D.prototype.get.call(this,b,c,d,e)}return void 0===b?new a.Image(1,1):d>1?new a.Image(b,c,d,e):[0,0,0,255]},a.MediaElement.prototype.set=function(b,c,d){this.loadedmetadata&&(this._ensureCanvas(),a.Renderer2D.prototype.set.call(this,b,c,d),this.setModified(!0))},a.MediaElement.prototype.copy=function(){this._ensureCanvas(),a.Renderer2D.prototype.copy.apply(this,arguments)},a.MediaElement.prototype.mask=function(){this.loadPixels(),this.setModified(!0),a.Image.prototype.mask.apply(this,arguments)},a.MediaElement.prototype.isModified=function(){return this._modified},a.MediaElement.prototype.setModified=function(a){this._modified=a},a.MediaElement.prototype.onended=function(a){return this._onended=a,this},a.MediaElement.prototype.connect=function(b){var c,d;if("function"==typeof a.prototype.getAudioContext)c=a.prototype.getAudioContext(),d=a.soundOut.input;else try{c=b.context,d=c.destination}catch(a){throw"connect() is meant to be used with Web Audio API or p5.sound.js"}this.audioSourceNode||(this.audioSourceNode=c.createMediaElementSource(this.elt),this.audioSourceNode.connect(d)),b?b.input?this.audioSourceNode.connect(b.input):this.audioSourceNode.connect(b):this.audioSourceNode.connect(d)},a.MediaElement.prototype.disconnect=function(){if(!this.audioSourceNode)throw"nothing to disconnect";this.audioSourceNode.disconnect()},a.MediaElement.prototype.showControls=function(){this.elt.style["text-align"]="inherit",this.elt.controls=!0},a.MediaElement.prototype.hideControls=function(){this.elt.controls=!1};var e=function(a,b,c,d){this.callback=a,this.time=b,this.id=c,this.val=d};a.MediaElement.prototype.addCue=function(a,b,c){var d=this._cueIDCounter++,f=new e(b,a,d,c);return this._cues.push(f),this.elt.ontimeupdate||(this.elt.ontimeupdate=this._onTimeUpdate.bind(this)),d},a.MediaElement.prototype.removeCue=function(a){for(var b=0;b0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new e(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,f=0;d>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function d(a){function b(a){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var d,e,f,g=a.length%3,h="";for(d=0,f=a.length-g;d>2),h+=b(e<<4&63),h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=b(e>>10),h+=b(e>>4&63),h+=b(e<<2&63),h+="="}return h}var e="undefined"!=typeof Uint8Array?Uint8Array:Array,f="+".charCodeAt(0),g="/".charCodeAt(0),h="0".charCodeAt(0),i="a".charCodeAt(0),j="A".charCodeAt(0),k="-".charCodeAt(0),l="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=d}(void 0===c?this.base64js={}:c)},{}],2:[function(a,b,c){},{}],3:[function(a,b,c){(function(b){"use strict";function d(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(a){return!1}}function e(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a){return this instanceof f?(f.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof a?g(this,a):"string"==typeof a?h(this,a,arguments.length>1?arguments[1]:"utf8"):i(this,a)):arguments.length>1?new f(a,arguments[1]):new f(a)}function g(a,b){if(a=p(a,b<0?0:0|q(b)),!f.TYPED_ARRAY_SUPPORT)for(var c=0;c>>1&&(a.parent=Z),a}function q(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function r(a,b){if(!(this instanceof r))return new r(a,b);var c=new f(a,b);return delete c.parent,c}function s(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return R(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return U(a).length;default:if(d)return R(a).length;b=(""+b).toLowerCase(),d=!0}}function t(a,b,c){var d=!1;if(b|=0,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),b<0&&(b=0),c>this.length&&(c=this.length),c<=b)return"";for(;;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d))>e&&(d=e):d=e;var f=b.length;if(f%2!=0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128==(192&i)&&(l=(31&f)<<6|63&i)>127&&(g=l);break;case 3:i=a[e+1],j=a[e+2],128==(192&i)&&128==(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j)>2047&&(l<55296||l>57343)&&(g=l);break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128==(192&i)&&128==(192&j)&&128==(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k)>65535&&l<1114112&&(g=l)}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(b<=$)return String.fromCharCode.apply(String,a);for(var c="",d=0;dd)&&(c=d);for(var e="",f=b;fc)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>e||ba.length)throw new RangeError("index out of range")}function J(a,b,c,d){b<0&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e>>8*(d?e:1-e)}function K(a,b,c,d){b<0&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e>>8*(d?e:3-e)&255}function L(a,b,c,d,e,f){if(b>e||ba.length)throw new RangeError("index out of range");if(c<0)throw new RangeError("index out of range")}function M(a,b,c,d,e){return e||L(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(a,b,c,d,23,4),c+4}function N(a,b,c,d,e){return e||L(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(a,b,c,d,52,8),c+8}function O(a){if(a=P(a).replace(aa,""),a.length<2)return"";for(;a.length%4!=0;)a+="=";return a}function P(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Q(a){return a<16?"0"+a.toString(16):a.toString(16)}function R(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=65536+(e-55296<<10|c-56320)}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function S(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function U(a){return W.toByteArray(O(a))}function V(a,b,c,d){for(var e=0;e=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var W=a("base64-js"),X=a("ieee754"),Y=a("isarray");c.Buffer=f,c.SlowBuffer=r,c.INSPECT_MAX_BYTES=50,f.poolSize=8192;var Z={};f.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),f.TYPED_ARRAY_SUPPORT?(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array):(f.prototype.length=void 0,f.prototype.parent=void 0),f.isBuffer=function(a){return!(null==a||!a._isBuffer)},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);e0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},f.prototype.compare=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:f.compare(this,a)},f.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(b<0&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(f.isBuffer(a))return c(this,a,b);if("number"==typeof a)return f.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b|=0,isFinite(c)?(c|=0,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c)<0&&(a=0):a>c&&(a=c),b<0?(b+=c)<0&&(b=0):b>c&&(b=c),b0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return b||H(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return b||H(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return b||H(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return b||H(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},f.prototype.readInt16LE=function(a,b){b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){a=+a,b|=0,c|=0,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f=0&&(f*=256);)this[b+e]=a/f&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,1,255,0),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):K(this,a,b,!0),b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=a<0?1:0;for(this[b]=255&a;++f>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=a<0?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,1,127,-128),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),a<0&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):K(this,a,b,!0),b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeFloatLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return N(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return N(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b=0;e--)a[e+b]=this[e+c];else if(g<1e3||!f.TYPED_ARRAY_SUPPORT)for(e=0;e=this.length)throw new RangeError("start out of bounds");if(c<0||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;d>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],8:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],9:[function(a,b,c){"use strict";function d(a,b){return a.b===b.b&&a.a===b.a}function e(a,b){return a.ba?0:a,c=0>c?0:c,a<=c?0===c?(b+d)/2:b+a/(a+c)*(d-b):d+c/(a+c)*(b-d)}function n(a){var b=s(a.b);return u(b,a.c),u(b.b,a.c),v(b,a.a),b}function o(a,b){var c=!1,d=!1;a!==b&&(b.a!==a.a&&(d=!0,x(b.a,a.a)),b.d!==a.d&&(c=!0,y(b.d,a.d)),t(b,a),d||(u(b,a.a),a.a.c=a),c||(v(b,a.d),a.d.a=a))}function p(a){var b=a.b,c=!1;a.d!==a.b.d&&(c=!0,y(a.d,a.b.d)),a.c===a?x(a.a,null):(a.b.d.a=$(a),a.a.c=a.c,t(a,$(a)),c||v(a,a.d)),b.c===b?(x(b.a,null),y(b.d,null)):(a.d.a=$(b),b.a.c=b.c,t(b,$(b))),w(a)}function q(a){var b=s(a),c=b.b;return t(b,a.e),b.a=a.b.a,u(c,b.a),b.d=c.d=a.d,b=b.b,t(a.b,$(a.b)),t(a.b,b),a.b.a=b.a,b.b.a.c=b.b,b.b.d=a.b.d,b.f=a.f,b.b.f=a.b.f,b}function r(a,b){var c=!1,d=s(a),e=d.b;return b.d!==a.d&&(c=!0,y(b.d,a.d)),t(d,a.e),t(e,b),d.a=a.b.a,e.a=b.a,d.d=e.d=a.d,a.d.a=e,c||v(d,a.d),d}function s(a){var b=new Z,c=new Z,d=a.b.h;return c.h=d,d.b.h=b,b.h=a,a.b.h=c,b.b=c,b.c=b,b.e=c,c.b=b,c.c=c,c.e=b}function t(a,b){var c=a.c,d=b.c;c.b.e=b,d.b.e=a,a.c=d,b.c=c}function u(a,b){var c=b.f,d=new aa(b,c);c.e=d,b.f=d,c=d.c=a;do{c.a=d,c=c.c}while(c!==a)}function v(a,b){var c=b.d,d=new Y(b,c);c.b=d,b.d=d,d.a=a,d.c=b.c,c=a;do{c.d=d,c=c.e}while(c!==a)}function w(a){var b=a.h;a=a.b.h,b.b.h=a,a.b.h=b}function x(a,b){var c=a.c,d=c;do{d.a=b,d=d.c}while(d!==c);c=a.f,d=a.e,d.f=c,c.e=d}function y(a,b){var c=a.a,d=c;do{d.d=b,d=d.e}while(d!==c);c=a.d,d=a.b,d.d=c,c.b=d}function z(a){var b=0;return Math.abs(a[1])>Math.abs(a[0])&&(b=1),Math.abs(a[2])>Math.abs(a[b])&&(b=2),b}function A(a,b){a.f+=b.f,a.b.f+=b.b.f}function B(a,b,c){return a=a.a,b=b.a,c=c.a,b.b.a===a?c.b.a===a?e(b.a,c.a)?0>=g(c.b.a,b.a,c.a):0<=g(b.b.a,c.a,b.a):0>=g(c.b.a,a,c.a):c.b.a===a?0<=g(b.b.a,a,b.a):(b=f(b.b.a,a,b.a),a=f(c.b.a,a,c.a),b>=a)}function C(a){a.a.i=null;var b=a.e;b.a.c=b.c,b.c.a=b.a,a.e=null}function D(a,b){p(a.a),a.c=!1,a.a=b,b.i=a}function E(a){var b=a.a.a;do{a=oa(a)}while(a.a.a===b);return a.c&&(b=r(na(a).a.b,a.a.e),D(a,b),a=oa(a)),a}function F(a,b,c){var d=new ma;return d.a=c,d.e=T(a.f,b.e,d),c.i=d}function G(a,b){switch(a.s){case 100130:return 0!=(1&b);case 100131:return 0!==b;case 100132:return 0b;case 100134:return 2<=b||-2>=b}return!1}function H(a){var b=a.a,c=b.d;c.c=a.d,c.a=b,C(a)}function I(a,b,c){for(a=b,b=b.a;a!==c;){a.c=!1;var d=na(a),e=d.a;if(e.a!==b.a){if(!d.c){H(a);break}e=r(b.c.b,e.b),D(d,e)}b.c!==e&&(o($(e),e),o(b,e)),H(a),b=d.a,a=d}return b}function J(a,b,c,d,e,f){var g=!0;do{F(a,b,c.b),c=c.c}while(c!==d);for(null===e&&(e=na(b).a.b.c);d=na(b),c=d.a.b,c.a===e.a;)c.c!==e&&(o($(c),c),o($(e),c)),d.f=b.f-c.f,d.d=G(a,d.f),b.b=!0,!g&&N(a,b)&&(A(c,e),C(b),p(e)),g=!1,b=d,e=c;b.b=!0,f&&P(a,b)}function K(a,b,c,d,e){var f=[b.g[0],b.g[1],b.g[2]];b.d=null,b.d=a.o?a.o(f,c,d,a.c)||null:null,null===b.d&&(e?a.n||(X(a,100156),a.n=!0):b.d=c[0])}function L(a,b,c){var d=[null,null,null,null];d[0]=b.a.d,d[1]=c.a.d,K(a,b.a,d,[.5,.5,0,0],!1),o(b,c)}function M(a,b,c,d,e){var f=Math.abs(b.b-a.b)+Math.abs(b.a-a.a),g=Math.abs(c.b-a.b)+Math.abs(c.a-a.a),h=e+1;d[e]=.5*g/(f+g),d[h]=.5*f/(f+g),a.g[0]+=d[e]*b.g[0]+d[h]*c.g[0],a.g[1]+=d[e]*b.g[1]+d[h]*c.g[1],a.g[2]+=d[e]*b.g[2]+d[h]*c.g[2]}function N(a,b){var c=na(b),f=b.a,h=c.a;if(e(f.a,h.a)){if(0=m?ka(c,m):e(k[j[m>>1]],k[j[m]])?ka(c,m):la(c,m)),k[i]=null,l[i]=c.b,c.b=i}else for(c.c[-(i+1)]=null;0g(f.b.a,h.a,f.a))return!1;oa(b).b=b.b=!0,q(f.b),o($(h),f)}return!0}function O(a,b){var c=na(b),k=b.a,l=c.a,n=k.a,p=l.a,r=k.b.a,s=l.b.a,t=new aa;if(g(r,a.a,n),g(s,a.a,p),n===p||Math.min(n.a,r.a)>Math.max(p.a,s.a))return!1;if(e(n,p)){if(0g(r,p,n))return!1;var u,v,w=r,x=n,y=s,z=p;if(e(w,x)||(u=w,w=x,x=u),e(y,z)||(u=y,y=z,z=u),e(w,y)||(u=w,w=y,y=u,u=x,x=z,z=u),e(y,x)?e(x,z)?(u=f(w,y,x),v=f(y,x,z),0>u+v&&(u=-u,v=-v),t.b=m(u,y.b,v,x.b)):(u=g(w,y,x),v=-g(w,z,x),0>u+v&&(u=-u,v=-v),t.b=m(u,y.b,v,z.b)):t.b=(y.b+x.b)/2,h(w,x)||(u=w,w=x,x=u),h(y,z)||(u=y,y=z,z=u),h(w,y)||(u=w,w=y,y=u,u=x,x=z,z=u),h(y,x)?h(x,z)?(u=i(w,y,x),v=i(y,x,z),0>u+v&&(u=-u,v=-v),t.a=m(u,y.a,v,x.a)):(u=j(w,y,x),v=-j(w,z,x),0>u+v&&(u=-u,v=-v),t.a=m(u,y.a,v,z.a)):t.a=(y.a+x.a)/2,e(t,a.a)&&(t.b=a.a.b,t.a=a.a.a),w=e(n,p)?n:p,e(w,t)&&(t.b=w.b,t.a=w.a),d(t,n)||d(t,p))return N(a,b),!1;if(!d(r,a.a)&&0<=g(r,a.a,t)||!d(s,a.a)&&0>=g(s,a.a,t)){if(s===a.a)return q(k.b),o(l.b,k),b=E(b),k=na(b).a,I(a,na(b),c),J(a,b,$(k),k,k,!0),!0;if(r===a.a){q(l.b),o(k.e,$(l)),n=c=b,p=n.a.b.a;do{n=oa(n)}while(n.a.b.a===p);return b=n,n=na(b).a.b.c,c.a=$(l),l=I(a,c,null),J(a,b,l.c,k.b.c,n,!0),!0}return 0<=g(r,a.a,t)&&(oa(b).b=b.b=!0,q(k.b),k.a.b=a.a.b,k.a.a=a.a.a),0>=g(s,a.a,t)&&(b.b=c.b=!0,q(l.b),l.a.b=a.a.b,l.a.a=a.a.a),!1}return q(k.b),q(l.b),o($(l),k),k.a.b=t.b,k.a.a=t.a,k.a.h=da(a.e,k.a),k=k.a,l=[0,0,0,0],t=[n.d,r.d,p.d,s.d],k.g[0]=k.g[1]=k.g[2]=0,M(k,n,r,l,0),M(k,p,s,l,2),K(a,k,t,l,!0),oa(b).b=b.b=c.b=!0,!1}function P(a,b){for(var c=na(b);;){for(;c.b;)b=c,c=na(c);if(!b.b&&(c=b,null===(b=oa(b))||!b.b))break;b.b=!1;var d,f=b.a,h=c.a;if(d=f.b.a!==h.b.a)a:{d=b;var i=na(d),j=d.a,k=i.a,l=void 0;if(e(j.b.a,k.b.a)){if(0>g(j.b.a,k.b.a,j.a)){d=!1;break a}oa(d).b=d.b=!0,l=q(j),o(k.b,l),l.d.c=d.d}else{if(0c.f&&(c.f*=2,c.c=ga(c.c,c.f+1));var e;return 0===c.b?e=d:(e=c.b,c.b=c.c[c.b]),c.e[e]=b,c.c[e]=d,c.d[d]=e,c.h&&la(c,d),e}return c=a.a++,a.c[c]=b,-(c+1)}function ea(a){if(0===a.a)return ja(a.b);var b=a.c[a.d[a.a-1]];if(0!==a.b.a&&e(ia(a.b),b))return ja(a.b);do{--a.a}while(0a.a||e(d[h],d[j])){c[g]=h,f[h]=g;break}c[g]=j,f[j]=g,g=i}}function la(a,b){for(var c=a.d,d=a.e,f=a.c,g=b,h=c[g];;){var i=g>>1,j=c[i];if(0===i||e(d[j],d[h])){c[g]=h,f[h]=g;break}c[g]=j,f[j]=g,g=i}}function ma(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function na(a){return a.e.c.b}function oa(a){return a.e.a.b}var pa,qa=4e150,ra=0;pa=V.prototype,pa.x=function(){W(this,ra)},pa.B=function(a,b){switch(a){case 100142:return;case 100140:switch(b){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=b)}break;case 100141:return void(this.m=!!b);default:return void X(this,100900)}X(this,100901)},pa.y=function(a){switch(a){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:X(this,100900)}return!1},pa.A=function(a,b,c){this.j[0]=a,this.j[1]=b,this.j[2]=c},pa.z=function(a,b){var c=b||null;switch(a){case 100100:case 100106:this.h=c;break;case 100104:case 100110:this.l=c;break;case 100101:case 100107:this.k=c;break;case 100102:case 100108:this.i=c;break;case 100103:case 100109:this.p=c;break;case 100105:case 100111:this.o=c;break;case 100112:this.r=c;break;default:X(this,100900)}},pa.C=function(a,b){var c=!1,d=[0,0,0];W(this,2);for(var e=0;3>e;++e){var f=a[e];-1e150>f&&(f=-1e150,c=!0),1e150m;++m){var n=a.g[m];nb[m]&&(b[m]=n,c[m]=a)}if(a=0,b[1]-i[1]>b[0]-i[0]&&(a=1),b[2]-i[2]>b[a]-i[a]&&(a=2),i[a]>=b[a])h[0]=0,h[1]=0,h[2]=1;else{for(b=0,i=j[a],c=c[a],j=[0,0,0],i=[i.g[0]-c.g[0],i.g[1]-c.g[1],i.g[2]-c.g[2]],m=[0,0,0],a=f.e;a!==f;a=a.e)m[0]=a.g[0]-c.g[0],m[1]=a.g[1]-c.g[1],m[2]=a.g[2]-c.g[2],j[0]=i[1]*m[2]-i[2]*m[1],j[1]=i[2]*m[0]-i[0]*m[2],j[2]=i[0]*m[1]-i[1]*m[0],(n=j[0]*j[0]+j[1]*j[1]+j[2]*j[2])>b&&(b=n,h[0]=j[0],h[1]=j[1],h[2]=j[2]);0>=b&&(h[0]=h[1]=h[2]=0,h[z(i)]=1)}f=!0}for(j=z(h),a=this.b.c,b=(j+1)%3,c=(j+2)%3,j=0=b.f))do{h+=(b.a.b-b.b.a.b)*(b.a.a+b.b.a.a),b=b.e}while(b!==a.a);if(0>h)for(h=this.b.c,f=h.e;f!==h;f=f.e)f.a=-f.a}for(this.n=!1,h=this.b.b,a=h.h;a!==h;a=f)f=a.h,b=a.e,d(a.a,a.b.a)&&a.e.e!==a&&(L(this,b,a),p(a),a=b,b=a.e),b.e===a&&(b!==a&&(b!==f&&b!==f.b||(f=f.h),p(b)),a!==f&&a!==f.b||(f=f.h),p(a));for(this.e=h=new ba,f=this.b.c,a=f.e;a!==f;a=a.e)a.h=da(h,a);for(ca(h),this.f=new S(this),R(this,-qa),R(this,qa);null!==(h=ea(this.e));){for(;;){a:if(a=this.e,0===a.a)f=ia(a.b);else if(f=a.c[a.d[a.a-1]],0!==a.b.a&&(a=ia(a.b),e(a,f))){f=a;break a}if(null===f||!d(f,h))break;f=ea(this.e),L(this,h.c,f.c)}Q(this,h)}for(this.a=this.f.a.a.b.a.a,h=0;null!==(f=this.f.a.a.b);)f.h||++h,C(f);for(this.f=null,h=this.e,h.b=null,h.d=null,this.e=h.c=null,h=this.b,a=h.a.b;a!==h.a;a=f)f=a.b,a=a.a,a.e.e===a&&(A(a.c,a),p(a));if(!this.n){if(h=this.b,this.m)for(a=h.b.h;a!==h.b;a=f)f=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:p(a);else for(a=h.a.b;a!==h.a;a=f)if(f=a.b,a.c){for(a=a.a;e(a.b.a,a.a);a=a.c.b);for(;e(a.a,a.b.a);a=a.e);for(b=a.c.b,c=void 0;a.e!==b;)if(e(a.b.a,b.a)){for(;b.e!==a&&(k(b.e)||0>=g(b.a,b.b.a,b.e.b.a));)c=r(b.e,b),b=c.b;b=b.c.b}else{for(;b.e!==a&&(l(a.c.b)||0<=g(a.b.a,a.a,a.c.b.a));)c=r(a,a.c.b),a=c.b;a=a.e}for(;b.e.e!==a;)c=r(b.e,b),b=c.b}if(this.h||this.i||this.k||this.l)if(this.m){for(h=this.b,f=h.a.b;f!==h.a;f=f.b)if(f.c){this.h&&this.h(2,this.c),a=f.a;do{this.k&&this.k(a.a.d,this.c),a=a.e}while(a!==f.a);this.i&&this.i(this.c)}}else{for(h=this.b,f=!!this.l,a=!1,b=-1,c=h.a.d;c!==h.a;c=c.d)if(c.c){a||(this.h&&this.h(4,this.c),a=!0),j=c.a;do{f&&(i=j.b.d.c?0:1,b!==i&&(b=i,this.l&&this.l(!!b,this.c))),this.k&&this.k(j.a.d,this.c),j=j.e}while(j!==c.a)}a&&this.i&&this.i(this.c)}if(this.r){for(h=this.b,a=h.a.b;a!==h.a;a=f)if(f=a.b,!a.c){b=a.a,c=b.e,j=void 0;do{j=c,c=j.e,j.d=null,null===j.b.d&&(j.c===j?x(j.a,null):(j.a.c=j.c,t(j,$(j))),i=j.b,i.c===i?x(i.a,null):(i.a.c=i.c,t(i,$(i))),w(j))}while(j!==b);b=a.d,a=a.b,a.d=b,b.b=a}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},this.libtess={GluTesselator:V,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},V.prototype.gluDeleteTess=V.prototype.x,V.prototype.gluTessProperty=V.prototype.B,V.prototype.gluGetTessProperty=V.prototype.y,V.prototype.gluTessNormal=V.prototype.A,V.prototype.gluTessCallback=V.prototype.z,V.prototype.gluTessVertex=V.prototype.C,V.prototype.gluTessBeginPolygon=V.prototype.u,V.prototype.gluTessBeginContour=V.prototype.t,V.prototype.gluTessEndContour=V.prototype.v,V.prototype.gluTessEndPolygon=V.prototype.w,void 0!==b&&(b.exports=this.libtess)},{}],10:[function(b,c,d){(function(e){!function(b,e){"object"==typeof d&&void 0!==c?e(d):"function"==typeof a&&a.amd?a(["exports"],e):e(b.opentype={})}(this,function(a){"use strict";function c(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function d(a,b){this.source=a,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=b,this.destLen=0,this.ltree=new c,this.dtree=new c}function f(a,b,c,d){var e,f;for(e=0;e>>=1,b}function j(a,b,c){if(!b)return c;for(;a.bitcount<24;)a.tag|=a.source[a.sourceIndex++]<>>16-b;return a.tag>>>=b,a.bitcount-=b,d+c}function k(a,b){for(;a.bitcount<24;)a.tag|=a.source[a.sourceIndex++]<>>=1,++e,c+=b.table[e],d-=b.table[e]}while(d>=0);return a.tag=f,a.bitcount-=e,b.trans[c+d]}function l(a,b,c){var d,e,f,g,i,l;for(d=j(a,5,257),e=j(a,5,1),f=j(a,4,4),g=0;g<19;++g)ue[g]=0;for(g=0;g8;)a.sourceIndex--,a.bitcount-=8;if(b=a.source[a.sourceIndex+1],b=256*b+a.source[a.sourceIndex],c=a.source[a.sourceIndex+3],c=256*c+a.source[a.sourceIndex+2],b!==(65535&~c))return le;for(a.sourceIndex+=4,d=b;d;--d)a.dest[a.destLen++]=a.source[a.sourceIndex++];return a.bitcount=0,ke}function o(a,b){var c,e,f=new d(a,b);do{switch(c=i(f),j(f,2,0)){case 0:e=n(f);break;case 1:e=m(f,me,ne);break;case 2:l(f,f.ltree,f.dtree),e=m(f,f.ltree,f.dtree);break;default:e=le}if(e!==ke)throw new Error("Data error")}while(!c);return f.destLen=-128&&a<=127}function w(a,b,c){for(var d=0,e=a.length;b>8&255,i+256&255)}return f}function z(a,b,c){for(var d=this,e=0;e>1,b.skip("uShort",3),a.glyphIndexMap={};for(var g=new Le.Parser(c,d+e+14),h=new Le.Parser(c,d+e+16+2*f),i=new Le.Parser(c,d+e+16+4*f),j=new Le.Parser(c,d+e+16+6*f),k=d+e+16+8*f,l=0;l=0;e-=1){var f=Le.getUShort(a,b+4+8*e),g=Le.getUShort(a,b+4+8*e+2);if(3===f&&(0===g||1===g||10===g)||0===f&&(0===g||1===g||2===g||3===g||4===g)){d=Le.getULong(a,b+4+8*e+4);break}}if(-1===d)throw new Error("No valid cmap sub-tables found.");var h=new Le.Parser(a,b+d);if(c.format=h.parseUShort(),12===c.format)R(c,h);else{if(4!==c.format)throw new Error("Only format 4 and 12 cmap tables are supported (found format "+c.format+").");S(c,h,a,b,d)}return c}function U(a,b,c){a.segments.push({end:b,start:b,delta:-(b-c),offset:0,glyphIndex:c})}function V(a){a.segments.push({end:65535,start:65535,delta:1,offset:0})}function W(a){var b,c=!0;for(b=a.length-1;b>0;b-=1){if(a.get(b).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),c=!1;break}}var d=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:c?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:c?12:20}];c||(d=d.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),d=d.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var e=new Ie.Table("cmap",d);for(e.segments=[],b=0;b>4,g=15&e;if(f===c)break;if(b+=d[f],g===c)break;b+=d[g]}return parseFloat(b)}function ma(a,b){var c,d,e,f;if(28===b)return c=a.parseByte(),d=a.parseByte(),c<<8|d;if(29===b)return c=a.parseByte(),d=a.parseByte(),e=a.parseByte(),f=a.parseByte(),c<<24|d<<16|e<<8|f;if(30===b)return la(a);if(b>=32&&b<=246)return b-139;if(b>=247&&b<=250)return c=a.parseByte(),256*(b-247)+c+108;if(b>=251&&b<=254)return c=a.parseByte(),256*-(b-251)-c-108;throw new Error("Invalid b0 "+b)}function na(a){for(var b={},c=0;c>1,p.length=0,s=!0}function f(c){for(var m,r,w,x,z,A,B,C,D,E,F,G,H=0;H1&&!s&&(y=p.shift()+n,s=!0),v+=p.pop(),d(u,v);break;case 5:for(;p.length>0;)u+=p.shift(),v+=p.shift(),o.lineTo(u,v);break;case 6:for(;p.length>0&&(u+=p.shift(),o.lineTo(u,v),0!==p.length);)v+=p.shift(),o.lineTo(u,v);break;case 7:for(;p.length>0&&(v+=p.shift(),o.lineTo(u,v),0!==p.length);)u+=p.shift(),o.lineTo(u,v);break;case 8:for(;p.length>0;)g=u+p.shift(),h=v+p.shift(),i=g+p.shift(),j=h+p.shift(), +u=i+p.shift(),v=j+p.shift(),o.curveTo(g,h,i,j,u,v);break;case 10:z=p.pop()+l,A=k[z],A&&f(A);break;case 11:return;case 12:switch(I=c[H],H+=1,I){case 35:g=u+p.shift(),h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j+p.shift(),D=B+p.shift(),E=C+p.shift(),F=D+p.shift(),G=E+p.shift(),u=F+p.shift(),v=G+p.shift(),p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,u,v);break;case 34:g=u+p.shift(),h=v,i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j,D=B+p.shift(),E=j,F=D+p.shift(),G=v,u=F+p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,u,v);break;case 36:g=u+p.shift(),h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j,D=B+p.shift(),E=j,F=D+p.shift(),G=E+p.shift(),u=F+p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,u,v);break;case 37:g=u+p.shift(),h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j+p.shift(),D=B+p.shift(),E=C+p.shift(),F=D+p.shift(),G=E+p.shift(),Math.abs(F-u)>Math.abs(G-v)?u=F+p.shift():v=G+p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,u,v);break;default:console.log("Glyph "+b.index+": unknown operator 1200"+I),p.length=0}break;case 14:p.length>0&&!s&&(y=p.shift()+n,s=!0),t&&(o.closePath(),t=!1);break;case 18:e();break;case 19:case 20:e(),H+=q+7>>3;break;case 21:p.length>2&&!s&&(y=p.shift()+n,s=!0),v+=p.pop(),u+=p.pop(),d(u,v);break;case 22:p.length>1&&!s&&(y=p.shift()+n,s=!0),u+=p.pop(),d(u,v);break;case 23:e();break;case 24:for(;p.length>2;)g=u+p.shift(),h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),u=i+p.shift(),v=j+p.shift(),o.curveTo(g,h,i,j,u,v);u+=p.shift(),v+=p.shift(),o.lineTo(u,v);break;case 25:for(;p.length>6;)u+=p.shift(),v+=p.shift(),o.lineTo(u,v);g=u+p.shift(),h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),u=i+p.shift(),v=j+p.shift(),o.curveTo(g,h,i,j,u,v);break;case 26:for(p.length%2&&(u+=p.shift());p.length>0;)g=u,h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),u=i,v=j+p.shift(),o.curveTo(g,h,i,j,u,v);break;case 27:for(p.length%2&&(v+=p.shift());p.length>0;)g=u+p.shift(),h=v,i=g+p.shift(),j=h+p.shift(),u=i+p.shift(),v=j,o.curveTo(g,h,i,j,u,v);break;case 28:m=c[H],r=c[H+1],p.push((m<<24|r<<16)>>16),H+=2;break;case 29:z=p.pop()+a.gsubrsBias,A=a.gsubrs[z],A&&f(A);break;case 30:for(;p.length>0&&(g=u,h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),u=i+p.shift(),v=j+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,u,v),0!==p.length);)g=u+p.shift(),h=v,i=g+p.shift(),j=h+p.shift(),v=j+p.shift(),u=i+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,u,v);break;case 31:for(;p.length>0&&(g=u+p.shift(),h=v,i=g+p.shift(),j=h+p.shift(),v=j+p.shift(),u=i+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,u,v),0!==p.length);)g=u,h=v+p.shift(),i=g+p.shift(),j=h+p.shift(),u=i+p.shift(),v=j+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,u,v);break;default:I<32?console.log("Glyph "+b.index+": unknown operator "+I):I<247?p.push(I-139):I<251?(m=c[H],H+=1,p.push(256*(I-247)+m+108)):I<255?(m=c[H],H+=1,p.push(256*-(I-251)-m-108)):(m=c[H],r=c[H+1],w=c[H+2],x=c[H+3],H+=4,p.push((m<<24|r<<16|w<<8|x)/65536))}}}var g,h,i,j,k,l,m,n,o=new r,p=[],q=0,s=!1,t=!1,u=0,v=0;if(a.isCIDFont){var w=a.tables.cff.topDict._fdSelect[b.index],x=a.tables.cff.topDict._fdArray[w];k=x._subrs,l=x._subrsBias,m=x._defaultWidthX,n=x._nominalWidthX}else k=a.tables.cff.topDict._subrs,l=a.tables.cff.topDict._subrsBias,m=a.tables.cff.topDict._defaultWidthX,n=a.tables.cff.topDict._nominalWidthX;var y=m;return f(c),b.advanceWidth=y,o}function ya(a,b,c,d){var e,f=[],g=new Le.Parser(a,b),h=g.parseCard8();if(0===h)for(var i=0;i=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+e+" (FD count "+d+")");f.push(e)}else{if(3!==h)throw new Error("CFF Table CID Font FDSelect table has unsupported format "+h);var j=g.parseCard16(),k=g.parseCard16();if(0!==k)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+k);for(var l,m=0;m=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+e+" (FD count "+d+")");if(l>c)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+l);for(;k=0&&(c=d),d=b.indexOf(a),d>=0?c=d+Ne.length:(c=Ne.length+b.length,b.push(a)),c}function Ba(){return new Ie.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ca(a){var b=new Ie.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);b.names=[];for(var c=0;c=c.begin&&a=1&&(c.ulCodePageRange1=d.parseULong(),c.ulCodePageRange2=d.parseULong()),c.version>=2&&(c.sxHeight=d.parseShort(),c.sCapHeight=d.parseShort(),c.usDefaultChar=d.parseUShort(),c.usBreakChar=d.parseUShort(),c.usMaxContent=d.parseUShort()),c}function fb(a){return new Ie.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],a)}function gb(a,b){var c={},d=new Le.Parser(a,b);switch(c.version=d.parseVersion(),c.italicAngle=d.parseFixed(),c.underlinePosition=d.parseShort(),c.underlineThickness=d.parseShort(),c.isFixedPitch=d.parseULong(),c.minMemType42=d.parseULong(),c.maxMemType42=d.parseULong(),c.minMemType1=d.parseULong(),c.maxMemType1=d.parseULong(),c.version){case 1:c.names=Qe.slice();break;case 2:c.numberOfGlyphs=d.parseUShort(),c.glyphNameIndex=new Array(c.numberOfGlyphs);for(var e=0;e=Qe.length){var g=d.parseChar();c.names.push(d.parseString(g))}break;case 2.5:c.numberOfGlyphs=d.parseUShort(),c.offset=new Array(c.numberOfGlyphs);for(var h=0;hb.value.tag?1:-1}),b.fields=b.fields.concat(d),b.fields=b.fields.concat(e),b}function qb(a,b,c){for(var d=0;d0){return a.glyphs.get(e).getMetrics()}}return c}function rb(a){for(var b=0,c=0;cq||void 0===b)&&q>0&&(b=q),j 123 are reserved for internal usage");n|=1<0?Ze.make(G):void 0,J=kf.make(),K=Ve.make(a.glyphs,{version:a.getEnglishName("version"),fullName:C,familyName:A,weightName:B,postScriptName:D,unitsPerEm:a.unitsPerEm,fontBBox:[0,t.yMin,t.ascender,t.advanceWidthMax]}),L=a.metas&&Object.keys(a.metas).length>0?pf.make(a.metas):void 0,M=[u,v,w,x,H,z,J,K,y];I&&M.push(I),a.tables.gsub&&M.push(of.make(a.tables.gsub)),L&&M.push(L);for(var N=pb(M),O=N.encode(),P=nb(O),Q=N.fields,R=!1,S=0;S>>1,f=a[e].tag;if(f===b)return e;f>>1,f=a[e];if(f===b)return e;f>>1;c=a[f];var g=c.start;if(g===b)return c;g0)return c=a[d-1],b>c.end?0:c}function wb(a,b){this.font=a,this.tableName=b}function xb(a){wb.call(this,a,"gpos")}function yb(a){wb.call(this,a,"gsub")}function zb(a,b){var c=a.length;if(c!==b.length)return!1;for(var d=0;d0?(f=a.parseByte(),0==(b&e)&&(f=-f),f=c+f):f=(b&e)>0?c:c+a.parseShort(),f}function Gb(a,b,c){var d=new Le.Parser(b,c);a.numberOfContours=d.parseShort(),a._xMin=d.parseShort(),a._yMin=d.parseShort(),a._xMax=d.parseShort(),a._yMax=d.parseShort();var e,f;if(a.numberOfContours>0){for(var g=a.endPointIndices=[],h=0;h0)for(var l=d.parseByte(),m=0;m0){var n,o=[];if(j>0){for(var p=0;p=0,o.push(n);for(var q=0,r=0;r0?(2&e)>0?(v.dx=d.parseShort(),v.dy=d.parseShort()):v.matchedPoints=[d.parseUShort(),d.parseUShort()]:(2&e)>0?(v.dx=d.parseChar(),v.dy=d.parseChar()):v.matchedPoints=[d.parseByte(),d.parseByte()],(8&e)>0?v.xScale=v.yScale=d.parseF2Dot14():(64&e)>0?(v.xScale=d.parseF2Dot14(),v.yScale=d.parseF2Dot14()):(128&e)>0&&(v.xScale=d.parseF2Dot14(),v.scale01=d.parseF2Dot14(),v.scale10=d.parseF2Dot14(),v.yScale=d.parseF2Dot14()),a.components.push(v),u=!!(32&e)}if(256&e){a.instructionLength=d.parseUShort(),a.instructions=[];for(var w=0;wb.points.length-1||d.matchedPoints[1]>e.points.length-1)throw Error("Matched points out of range in "+b.name);var g=b.points[d.matchedPoints[0]],h=e.points[d.matchedPoints[1]],i={xScale:d.xScale,scale01:d.scale01,scale10:d.scale10,yScale:d.yScale,dx:0,dy:0};h=Hb([h],i)[0],i.dx=g.x-h.x,i.dy=g.y-h.y,f=Hb(e.points,i)}b.points=b.points.concat(f)}}return Jb(b.points)}function Lb(a,b,c,d){for(var e=new Se.GlyphSet(d),f=0;f=176&&c<=183)e+=c-176+1;else if(c>=184&&c<=191)e+=2*(c-184+1);else if(b&&1===f&&27===c)break}while(f>0);a.ip=e}function Zb(b,c){a.DEBUG&&console.log(c.step,"SVTCA["+b.axis+"]"),c.fv=c.pv=c.dpv=b}function $b(b,c){a.DEBUG&&console.log(c.step,"SPVTCA["+b.axis+"]"),c.pv=c.dpv=b}function _b(b,c){a.DEBUG&&console.log(c.step,"SFVTCA["+b.axis+"]"),c.fv=b}function ac(b,c){var d=c.stack,e=d.pop(),f=d.pop(),g=c.z2[e],h=c.z1[f];a.DEBUG&&console.log("SPVTL["+b+"]",e,f);var i,j;b?(i=g.y-h.y,j=h.x-g.x):(i=h.x-g.x,j=h.y-g.y),c.pv=c.dpv=Ub(i,j)}function bc(b,c){var d=c.stack,e=d.pop(),f=d.pop(),g=c.z2[e],h=c.z1[f];a.DEBUG&&console.log("SFVTL["+b+"]",e,f);var i,j;b?(i=g.y-h.y,j=h.x-g.x):(i=h.x-g.x,j=h.y-g.y),c.fv=Ub(i,j)}function cc(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"SPVFS[]",d,e),b.pv=b.dpv=Ub(e,d)}function dc(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"SPVFS[]",d,e),b.fv=Ub(e,d)}function ec(b){var c=b.stack,d=b.pv;a.DEBUG&&console.log(b.step,"GPV[]"),c.push(16384*d.x),c.push(16384*d.y)}function fc(b){var c=b.stack,d=b.fv;a.DEBUG&&console.log(b.step,"GFV[]"),c.push(16384*d.x),c.push(16384*d.y)}function gc(b){b.fv=b.pv,a.DEBUG&&console.log(b.step,"SFVTPV[]")}function hc(b){var c=b.stack,d=c.pop(),e=c.pop(),f=c.pop(),g=c.pop(),h=c.pop(),i=b.z0,j=b.z1,k=i[d],l=i[e],m=j[f],n=j[g],o=b.z2[h];a.DEBUG&&console.log("ISECT[], ",d,e,f,g,h);var p=k.x,q=k.y,r=l.x,s=l.y,t=m.x,u=m.y,v=n.x,w=n.y,x=(p-r)*(u-w)-(q-s)*(t-v),y=p*s-q*r,z=t*w-u*v;o.x=(y*(t-v)-z*(p-r))/x,o.y=(y*(u-w)-z*(q-s))/x}function ic(b){b.rp0=b.stack.pop(),a.DEBUG&&console.log(b.step,"SRP0[]",b.rp0)}function jc(b){b.rp1=b.stack.pop(),a.DEBUG&&console.log(b.step,"SRP1[]",b.rp1)}function kc(b){b.rp2=b.stack.pop(),a.DEBUG&&console.log(b.step,"SRP2[]",b.rp2)}function lc(b){var c=b.stack.pop();switch(a.DEBUG&&console.log(b.step,"SZP0[]",c),b.zp0=c,c){case 0:b.tZone||Xb(b),b.z0=b.tZone;break;case 1:b.z0=b.gZone;break;default:throw new Error("Invalid zone pointer")}}function mc(b){var c=b.stack.pop();switch(a.DEBUG&&console.log(b.step,"SZP1[]",c),b.zp1=c,c){case 0:b.tZone||Xb(b),b.z1=b.tZone;break;case 1:b.z1=b.gZone;break;default:throw new Error("Invalid zone pointer")}}function nc(b){var c=b.stack.pop();switch(a.DEBUG&&console.log(b.step,"SZP2[]",c),b.zp2=c,c){case 0:b.tZone||Xb(b),b.z2=b.tZone;break;case 1:b.z2=b.gZone;break;default:throw new Error("Invalid zone pointer")}}function oc(b){var c=b.stack.pop();switch(a.DEBUG&&console.log(b.step,"SZPS[]",c),b.zp0=b.zp1=b.zp2=c,c){case 0:b.tZone||Xb(b),b.z0=b.z1=b.z2=b.tZone;break;case 1:b.z0=b.z1=b.z2=b.gZone;break;default:throw new Error("Invalid zone pointer")}}function pc(b){b.loop=b.stack.pop(),a.DEBUG&&console.log(b.step,"SLOOP[]",b.loop)}function qc(b){a.DEBUG&&console.log(b.step,"RTG[]"),b.round=Ob}function rc(b){a.DEBUG&&console.log(b.step,"RTHG[]"),b.round=Qb}function sc(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"SMD[]",c),b.minDis=c/64}function tc(b){a.DEBUG&&console.log(b.step,"ELSE[]"),Yb(b,!1)}function uc(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"JMPR[]",c),b.ip+=c-1}function vc(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"SCVTCI[]",c),b.cvCutIn=c/64}function wc(b){var c=b.stack;a.DEBUG&&console.log(b.step,"DUP[]"),c.push(c[c.length-1])}function xc(b){a.DEBUG&&console.log(b.step,"POP[]"),b.stack.pop()}function yc(b){a.DEBUG&&console.log(b.step,"CLEAR[]"),b.stack.length=0}function zc(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"SWAP[]"),c.push(d),c.push(e)}function Ac(b){var c=b.stack;a.DEBUG&&console.log(b.step,"DEPTH[]"),c.push(c.length)}function Bc(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"LOOPCALL[]",d,e);var f=b.ip,g=b.prog;b.prog=b.funcs[d];for(var h=0;h1?"loop "+(c.loop-i)+": ":"")+"SHP["+(b?"rp1":"rp2")+"]",k)}c.loop=1}function Jc(b,c){var d=c.stack,e=b?c.rp1:c.rp2,f=(b?c.z0:c.z1)[e],g=c.fv,h=c.pv,i=d.pop(),j=c.z2[c.contours[i]],k=j;a.DEBUG&&console.log(c.step,"SHC["+b+"]",i);var l=h.distance(f,f,!1,!0);do{k!==f&&g.setRelative(k,k,l,h),k=k.nextPointOnContour}while(k!==j)}function Kc(b,c){var d=c.stack,e=b?c.rp1:c.rp2,f=(b?c.z0:c.z1)[e],g=c.fv,h=c.pv,i=d.pop();a.DEBUG&&console.log(c.step,"SHZ["+b+"]",i);var j;switch(i){case 0:j=c.tZone;break;case 1:j=c.gZone;break;default:throw new Error("Invalid zone")}for(var k,l=h.distance(f,f,!1,!0),m=j.length-2,n=0;n1?"loop "+(b.loop-d)+": ":"")+"SHPIX[]",h,f),e.setRelative(i,i,f),e.touch(i)}b.loop=1}function Mc(b){for(var c=b.stack,d=b.rp1,e=b.rp2,f=b.loop,g=b.z0[d],h=b.z1[e],i=b.fv,j=b.dpv,k=b.z2;f--;){var l=c.pop(),m=k[l];a.DEBUG&&console.log(b.step,(b.loop>1?"loop "+(b.loop-f)+": ":"")+"IP[]",l,d,"<->",e),i.interpolate(m,g,h,j),i.touch(m)}b.loop=1}function Nc(b,c){var d=c.stack,e=d.pop()/64,f=d.pop(),g=c.z1[f],h=c.z0[c.rp0],i=c.fv,j=c.pv;i.setRelative(g,h,e,j),i.touch(g),a.DEBUG&&console.log(c.step,"MSIRP["+b+"]",e,f),c.rp1=c.rp0,c.rp2=f,b&&(c.rp0=f)}function Oc(b){for(var c=b.stack,d=b.rp0,e=b.z0[d],f=b.loop,g=b.fv,h=b.pv,i=b.z1;f--;){var j=c.pop(),k=i[j];a.DEBUG&&console.log(b.step,(b.loop>1?"loop "+(b.loop-f)+": ":"")+"ALIGNRP[]",j),g.setRelative(k,e,0,h),g.touch(k)}b.loop=1}function Pc(b){a.DEBUG&&console.log(b.step,"RTDG[]"),b.round=Pb}function Qc(b,c){var d=c.stack,e=d.pop(),f=d.pop(),g=c.z0[f],h=c.fv,i=c.pv,j=c.cvt[e];a.DEBUG&&console.log(c.step,"MIAP["+b+"]",e,"(",j,")",f);var k=i.distance(g,zf);b&&(Math.abs(k-j)",i),c.stack.push(Math.round(64*i))}function Zc(b){a.DEBUG&&console.log(b.step,"MPPEM[]"),b.stack.push(b.ppem)}function $c(b){a.DEBUG&&console.log(b.step,"FLIPON[]"),b.autoFlip=!0}function _c(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"LT[]",d,e),c.push(ed?1:0)}function cd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"GTEQ[]",d,e),c.push(e>=d?1:0)}function dd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"EQ[]",d,e),c.push(d===e?1:0)}function ed(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"NEQ[]",d,e),c.push(d!==e?1:0)}function fd(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"ODD[]",d),c.push(Math.trunc(d)%2?1:0)}function gd(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"EVEN[]",d),c.push(Math.trunc(d)%2?0:1)}function hd(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"IF[]",c),c||(Yb(b,!0),a.DEBUG&&console.log(b.step,"EIF[]"))}function id(b){a.DEBUG&&console.log(b.step,"EIF[]")}function jd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"AND[]",d,e),c.push(d&&e?1:0)}function kd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"OR[]",d,e),c.push(d||e?1:0)}function ld(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"NOT[]",d),c.push(d?0:1)}function md(b,c){var d=c.stack,e=d.pop(),f=c.fv,g=c.pv,h=c.ppem,i=c.deltaBase+16*(b-1),j=c.deltaShift,k=c.z0;a.DEBUG&&console.log(c.step,"DELTAP["+b+"]",e,d);for(var l=0;l>4)===h){var o=(15&n)-8;o>=0&&o++,a.DEBUG&&console.log(c.step,"DELTAPFIX",m,"by",o*j);var p=k[m];f.setRelative(p,p,o*j,g)}}}function nd(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"SDB[]",d),b.deltaBase=d}function od(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"SDS[]",d),b.deltaShift=Math.pow(.5,d)}function pd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"ADD[]",d,e),c.push(e+d)}function qd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"SUB[]",d,e),c.push(e-d)}function rd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"DIV[]",d,e),c.push(64*e/d)}function sd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"MUL[]",d,e),c.push(e*d/64)}function td(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"ABS[]",d),c.push(Math.abs(d))}function ud(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"NEG[]",d),c.push(-d)}function vd(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"FLOOR[]",d),c.push(64*Math.floor(d/64))}function wd(b){var c=b.stack,d=c.pop();a.DEBUG&&console.log(b.step,"CEILING[]",d),c.push(64*Math.ceil(d/64))}function xd(b,c){var d=c.stack,e=d.pop();a.DEBUG&&console.log(c.step,"ROUND[]"),d.push(64*c.round(e/64))}function yd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"WCVTF[]",d,e),b.cvt[e]=d*b.ppem/b.font.unitsPerEm}function zd(b,c){var d=c.stack,e=d.pop(),f=c.ppem,g=c.deltaBase+16*(b-1),h=c.deltaShift;a.DEBUG&&console.log(c.step,"DELTAC["+b+"]",e,d);for(var i=0;i>4)===f){var l=(15&k)-8;l>=0&&l++;var m=l*h;a.DEBUG&&console.log(c.step,"DELTACFIX",j,"by",m),c.cvt[j]+=m}}}function Ad(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"SROUND[]",c),b.round=wf;var d;switch(192&c){case 0:d=.5;break;case 64:d=1;break;case 128:d=2;break;default:throw new Error("invalid SROUND value")}switch(b.srPeriod=d,48&c){case 0:b.srPhase=0;break;case 16:b.srPhase=.25*d;break;case 32:b.srPhase=.5*d;break;case 48:b.srPhase=.75*d;break;default:throw new Error("invalid SROUND value")}c&=15,b.srThreshold=0===c?0:(c/8-.5)*d}function Bd(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"S45ROUND[]",c),b.round=wf;var d;switch(192&c){case 0:d=Math.sqrt(2)/2;break;case 64:d=Math.sqrt(2);break;case 128:d=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(b.srPeriod=d,48&c){case 0:b.srPhase=0;break;case 16:b.srPhase=.25*d;break;case 32:b.srPhase=.5*d;break;case 48:b.srPhase=.75*d;break;default:throw new Error("invalid S45ROUND value")}c&=15,b.srThreshold=0===c?0:(c/8-.5)*d}function Cd(b){a.DEBUG&&console.log(b.step,"ROFF[]"),b.round=Nb}function Dd(b){a.DEBUG&&console.log(b.step,"RUTG[]"),b.round=Rb}function Ed(b){a.DEBUG&&console.log(b.step,"RDTG[]"),b.round=Sb}function Fd(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"SCANCTRL[]",c)}function Gd(b,c){var d=c.stack,e=d.pop(),f=d.pop(),g=c.z2[e],h=c.z1[f];a.DEBUG&&console.log(c.step,"SDPVTL["+b+"]",e,f);var i,j;b?(i=g.y-h.y,j=h.x-g.x):(i=h.x-g.x,j=h.y-g.y),c.dpv=Ub(i,j)}function Hd(b){var c=b.stack,d=c.pop(),e=0;a.DEBUG&&console.log(b.step,"GETINFO[]",d),1&d&&(e=35),32&d&&(e|=4096),c.push(e)}function Id(b){var c=b.stack,d=c.pop(),e=c.pop(),f=c.pop();a.DEBUG&&console.log(b.step,"ROLL[]"),c.push(e),c.push(d),c.push(f)}function Jd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"MAX[]",d,e),c.push(Math.max(e,d))}function Kd(b){var c=b.stack,d=c.pop(),e=c.pop();a.DEBUG&&console.log(b.step,"MIN[]",d,e),c.push(Math.min(e,d))}function Ld(b){var c=b.stack.pop();a.DEBUG&&console.log(b.step,"SCANTYPE[]",c)}function Md(b){var c=b.stack.pop(),d=b.stack.pop();switch(a.DEBUG&&console.log(b.step,"INSTCTRL[]",c,d),c){case 1:return void(b.inhibitGridFit=!!d);case 2:return void(b.ignoreCvt=!!d);default:throw new Error("invalid INSTCTRL[] selector")}}function Nd(b,c){var d=c.stack,e=c.prog,f=c.ip;a.DEBUG&&console.log(c.step,"PUSHB["+b+"]");for(var g=0;g=0?1:-1,i=Math.abs(i),b&&(k=g.cvt[m],e&&Math.abs(i-k)":"_")+(e?"R":"_")+(0===f?"Gr":1===f?"Bl":2===f?"Wh":"")+"]",b?m+"("+g.cvt[m]+","+k+")":"",n,"(d =",h,"->",j*i,")"),g.rp1=g.rp0,g.rp2=n,c&&(g.rp0=n)}function Qd(a){a=a||{},a.empty||(Eb(a.familyName,"When creating a new Font object, familyName is required."),Eb(a.styleName,"When creating a new Font object, styleName is required."),Eb(a.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Eb(a.ascender,"When creating a new Font object, ascender is required."),Eb(a.descender,"When creating a new Font object, descender is required."),Eb(a.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:a.familyName||" "},fontSubfamily:{en:a.styleName||" "},fullName:{en:a.fullName||a.familyName+" "+a.styleName},postScriptName:{en:a.postScriptName||(a.familyName+a.styleName).replace(/\s/g,"")},designer:{en:a.designer||" "},designerURL:{en:a.designerURL||" "},manufacturer:{en:a.manufacturer||" "},manufacturerURL:{en:a.manufacturerURL||" "},license:{en:a.license||" "},licenseURL:{en:a.licenseURL||" "},version:{en:a.version||"Version 0.1"},description:{en:a.description||" "},copyright:{en:a.copyright||" "},trademark:{en:a.trademark||" "}},this.unitsPerEm=a.unitsPerEm||1e3,this.ascender=a.ascender,this.descender=a.descender,this.createdTimestamp=a.createdTimestamp,this.tables={os2:{usWeightClass:a.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:a.widthClass||this.usWidthClasses.MEDIUM,fsSelection:a.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new Se.GlyphSet(this,a.glyphs||[]),this.encoding=new X(this),this.position=new xb(this),this.substitution=new yb(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:"truetype"===this.outlinesFormat?this._hinting=new Mb(this):void 0}})}function Rd(a,b){var c=JSON.stringify(a),d=256;for(var e in b){var f=parseInt(e);if(f&&!(f<256)){if(JSON.stringify(b[e])===c)return f;d<=f&&(d=f+1)}}return b[d]=a,d}function Sd(a,b,c){var d=Rd(b.name,c);return[{name:"tag_"+a,type:"TAG",value:b.tag},{name:"minValue_"+a,type:"FIXED",value:b.minValue<<16},{name:"defaultValue_"+a,type:"FIXED",value:b.defaultValue<<16},{name:"maxValue_"+a,type:"FIXED",value:b.maxValue<<16},{name:"flags_"+a,type:"USHORT",value:0},{name:"nameID_"+a,type:"USHORT",value:d}]}function Td(a,b,c){var d={},e=new Le.Parser(a,b);return d.tag=e.parseTag(),d.minValue=e.parseFixed(),d.defaultValue=e.parseFixed(),d.maxValue=e.parseFixed(),e.skip("uShort",1),d.name=c[e.parseUShort()]||{},d}function Ud(a,b,c,d){for(var e=Rd(b.name,d),f=[{name:"nameID_"+a,type:"USHORT",value:e},{name:"flags_"+a,type:"USHORT",value:0}],g=0;g1&&console.warn("Only the first kern subtable is supported."),a.skip("uLong");var c=a.parseUShort(),d=255&c;if(a.skip("uShort"),0===d){var e=a.parseUShort();a.skip("uShort",3);for(var f=0;f=c)){var e,f=b.charCodeAt(d);return f>=55296&&f<=56319&&c>d+1&&(e=b.charCodeAt(d+1))>=56320&&e<=57343?1024*(f-55296)+e-56320+65536:f}};a?a(String.prototype,"codePointAt",{value:b,configurable:!0,writable:!0}):String.prototype.codePointAt=b}();var ke=0,le=-3,me=new c,ne=new c,oe=new Uint8Array(30),pe=new Uint16Array(30),qe=new Uint8Array(30),re=new Uint16Array(30),se=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),te=new c,ue=new Uint8Array(320),ve=new Uint16Array(16);g(me,ne),f(oe,pe,4,3),f(qe,re,2,1),oe[28]=0,pe[28]=258;var we=o;q.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},q.prototype.addPoint=function(a,b){"number"==typeof a&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=a,this.x2=a),athis.x2&&(this.x2=a)),"number"==typeof b&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=b,this.y2=b),bthis.y2&&(this.y2=b))},q.prototype.addX=function(a){this.addPoint(a,null)},q.prototype.addY=function(a){this.addPoint(null,a)},q.prototype.addBezier=function(a,b,c,d,e,f,g,h){var i=this,j=[a,b],k=[c,d],l=[e,f],m=[g,h];this.addPoint(a,b),this.addPoint(g,h);for(var n=0;n<=1;n++){var o=6*j[n]-12*k[n]+6*l[n],q=-3*j[n]+9*k[n]-9*l[n]+3*m[n],r=3*k[n]-3*j[n];if(0!==q){var s=Math.pow(o,2)-4*r*q;if(!(s<0)){var t=(-o+Math.sqrt(s))/(2*q);0=0&&d>0&&(c+=" "),c+=b(e)}return c}var d=this;a=void 0!==a?a:2;for(var e="",f=0;f=0&&a<=255,"Byte value should be between 0 and 255."),[a]},Ce.BYTE=u(1),Be.CHAR=function(a){return[a.charCodeAt(0)]},Ce.CHAR=u(1),Be.CHARARRAY=function(a){for(var b=[],c=0;c>8&255,255&a]},Ce.USHORT=u(2),Be.SHORT=function(a){return a>=ye&&(a=-(2*ye-a)),[a>>8&255,255&a]},Ce.SHORT=u(2),Be.UINT24=function(a){return[a>>16&255,a>>8&255,255&a]},Ce.UINT24=u(3),Be.ULONG=function(a){return[a>>24&255,a>>16&255,a>>8&255,255&a]},Ce.ULONG=u(4),Be.LONG=function(a){return a>=ze&&(a=-(2*ze-a)),[a>>24&255,a>>16&255,a>>8&255,255&a]},Ce.LONG=u(4),Be.FIXED=Be.ULONG,Ce.FIXED=Ce.ULONG,Be.FWORD=Be.SHORT,Ce.FWORD=Ce.SHORT,Be.UFWORD=Be.USHORT,Ce.UFWORD=Ce.USHORT,Be.LONGDATETIME=function(a){return[0,0,0,0,a>>24&255,a>>16&255,a>>8&255,255&a]},Ce.LONGDATETIME=u(8),Be.TAG=function(a){return xe.argument(4===a.length,"Tag should be exactly 4 ASCII characters."),[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)]},Ce.TAG=u(4),Be.Card8=Be.BYTE,Ce.Card8=Ce.BYTE,Be.Card16=Be.USHORT,Ce.Card16=Ce.USHORT,Be.OffSize=Be.BYTE,Ce.OffSize=Ce.BYTE,Be.SID=Be.USHORT,Ce.SID=Ce.USHORT,Be.NUMBER=function(a){return a>=-107&&a<=107?[a+139]:a>=108&&a<=1131?(a-=108,[247+(a>>8),255&a]):a>=-1131&&a<=-108?(a=-a-108,[251+(a>>8),255&a]):a>=-32768&&a<=32767?Be.NUMBER16(a):Be.NUMBER32(a) +},Ce.NUMBER=function(a){return Be.NUMBER(a).length},Be.NUMBER16=function(a){return[28,a>>8&255,255&a]},Ce.NUMBER16=u(3),Be.NUMBER32=function(a){return[29,a>>24&255,a>>16&255,a>>8&255,255&a]},Ce.NUMBER32=u(5),Be.REAL=function(a){var b=a.toString(),c=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(b);if(c){var d=parseFloat("1e"+((c[2]?+c[2]:0)+c[1].length));b=(Math.round(a*d)/d).toString()}for(var e="",f=0,g=b.length;f>8&255,b[b.length]=255&d}return b},Ce.UTF16=function(a){return 2*a.length};var De={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Ae.MACSTRING=function(a,b,c,d){var e=De[d];if(void 0!==e){for(var f="",g=0;g=128&&void 0===(f=c[f]))return;d[e]=f}return d}},Ce.MACSTRING=function(a,b){var c=Be.MACSTRING(a,b);return void 0!==c?c.length:0},Be.VARDELTAS=function(a){for(var b=0,c=[];b=-128&&d<=127?x(a,b,c):y(a,b,c)}return c},Be.INDEX=function(a){for(var b=1,c=[b],d=[],e=0;e>8,b[l+1]=255&m,b=b.concat(d[k])}return b},Ce.TABLE=function(a){for(var b=0,c=a.fields.length,d=0;d0)return new Q(this.data,this.offset+b).parseStruct(a)},Q.prototype.parsePointer32=function(a){var b=this.parseOffset32();if(b>0)return new Q(this.data,this.offset+b).parseStruct(a)},Q.prototype.parseListOfLists=function(a){for(var b=this,c=this.parseOffset16List(),d=c.length,e=this.relativeOffset,f=new Array(d),g=0;g=0)return d[e].script;if(b){var f={tag:a,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return d.splice(-1-e,0,f),f.script}}},getLangSysTable:function(a,b,c){var d=this.getScriptTable(a,c);if(d){if(!b||"dflt"===b||"DFLT"===b)return d.defaultLangSys;var e=tb(d.langSysRecords,b);if(e>=0)return d.langSysRecords[e].langSys;if(c){var f={tag:b,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return d.langSysRecords.splice(-1-e,0,f),f.langSys}}},getFeatureTable:function(a,b,c,d){var e=this.getLangSysTable(a,b,d);if(e){for(var f,g=e.featureIndexes,h=this.font.tables[this.tableName].features,i=0;i=h[j-1].tag,"Features must be added in alphabetical order."),f={tag:c,feature:{params:0,lookupListIndexes:[]}},h.push(f),g.push(j),f.feature}}},getLookupTables:function(a,b,c,d,e){var f=this.getFeatureTable(a,b,c,e),g=[];if(f){for(var h,i=f.lookupListIndexes,j=this.font.tables[this.tableName].lookups,k=0;k=0?c:-1;case 2:var d=vb(a.ranges,b);return d?d.index+b-d.start:-1}},expandCoverage:function(a){if(1===a.format)return a.glyphs;for(var b=[],c=a.ranges,d=0;d=0){for(var k=f.ligatureSets[j],l=0;l2)){var d=this.font,e=this._prepState;if(!e||e.ppem!==c){var f=this._fpgmState;if(!f){Wb.prototype=Af,f=this._fpgmState=new Wb("fpgm",d.tables.fpgm),f.funcs=[],f.font=d,a.DEBUG&&(console.log("---EXEC FPGM---"),f.step=-1);try{sf(f)}catch(a){return console.log("Hinting error in FPGM:"+a),void(this._errorState=3)}}Wb.prototype=f,e=this._prepState=new Wb("prep",d.tables.prep),e.ppem=c;var g=d.tables.cvt;if(g)for(var h=e.cvt=new Array(g.length),i=c/d.unitsPerEm,j=0;j1))try{return tf(b,e)}catch(a){return this._errorState<1&&(console.log("Hinting error:"+a),console.log("Note: further hinting errors are silenced")),void(this._errorState=1)}}},tf=function(b,c){var d,e,f,g=c.ppem/c.font.unitsPerEm,h=g,i=b.components;if(Wb.prototype=c,i){var j=c.font;e=[],d=[];for(var k=0;k0,"No English "+b+" specified.")}var c=this;b("fontFamily"),b("weightName"),b("manufacturer"),b("copyright"),b("version"),a(this.unitsPerEm>0,"No unitsPerEm specified.")},Qd.prototype.toTables=function(){return qf.fontToTable(this)},Qd.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Qd.prototype.toArrayBuffer=function(){for(var a=this.toTables(),b=a.encode(),c=new ArrayBuffer(b.length),d=new Uint8Array(c),e=0;e1)for(var c=1;c-1?b:a}function n(a,b){b=b||{};var c=b.body;if(a instanceof n){if(a.bodyUsed)throw new TypeError("Already read");this.url=a.url,this.credentials=a.credentials,b.headers||(this.headers=new e(a.headers)),this.method=a.method,this.mode=a.mode,c||null==a._bodyInit||(c=a._bodyInit,a.bodyUsed=!0)}else this.url=String(a);if(this.credentials=b.credentials||this.credentials||"omit",!b.headers&&this.headers||(this.headers=new e(b.headers)),this.method=m(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&c)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(c)}function o(a){var b=new FormData;return a.trim().split("&").forEach(function(a){if(a){var c=a.split("="),d=c.shift().replace(/\+/g," "),e=c.join("=").replace(/\+/g," ");b.append(decodeURIComponent(d),decodeURIComponent(e))}}),b}function p(a){var b=new e;return a.split(/\r?\n/).forEach(function(a){var c=a.split(":"),d=c.shift().trim();if(d){var e=c.join(":").trim();b.append(d,e)}}),b}function q(a,b){b||(b={}),this.type="default",this.status="status"in b?b.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new e(b.headers),this.url=b.url||"",this._initBody(a)}if(!a.fetch){var r={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch(a){return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};if(r.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],t=function(a){return a&&DataView.prototype.isPrototypeOf(a)},u=ArrayBuffer.isView||function(a){return a&&s.indexOf(Object.prototype.toString.call(a))>-1};e.prototype.append=function(a,d){a=b(a),d=c(d);var e=this.map[a];this.map[a]=e?e+","+d:d},e.prototype.delete=function(a){delete this.map[b(a)]},e.prototype.get=function(a){return a=b(a),this.has(a)?this.map[a]:null},e.prototype.has=function(a){return this.map.hasOwnProperty(b(a))},e.prototype.set=function(a,d){this.map[b(a)]=c(d)},e.prototype.forEach=function(a,b){for(var c in this.map)this.map.hasOwnProperty(c)&&a.call(b,this.map[c],c,this)},e.prototype.keys=function(){var a=[];return this.forEach(function(b,c){a.push(c)}),d(a)},e.prototype.values=function(){var a=[];return this.forEach(function(b){a.push(b)}),d(a)},e.prototype.entries=function(){var a=[];return this.forEach(function(b,c){a.push([c,b])}),d(a)},r.iterable&&(e.prototype[Symbol.iterator]=e.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];n.prototype.clone=function(){return new n(this,{body:this._bodyInit})},l.call(n.prototype),l.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new e(this.headers),url:this.url})},q.error=function(){var a=new q(null,{status:0,statusText:""});return a.type="error",a};var w=[301,302,303,307,308];q.redirect=function(a,b){if(-1===w.indexOf(b))throw new RangeError("Invalid status code");return new q(null,{status:b,headers:{location:a}})},a.Headers=e,a.Request=n,a.Response=q,a.fetch=function(a,b){return new Promise(function(c,d){var e=new n(a,b),f=new XMLHttpRequest;f.onload=function(){var a={status:f.status,statusText:f.statusText,headers:p(f.getAllResponseHeaders()||"")};a.url="responseURL"in f?f.responseURL:a.headers.get("X-Request-URL");var b="response"in f?f.response:f.responseText;c(new q(b,a))},f.onerror=function(){d(new TypeError("Network request failed"))},f.ontimeout=function(){d(new TypeError("Network request failed"))},f.open(e.method,e.url,!0),"include"===e.credentials&&(f.withCredentials=!0),"responseType"in f&&r.blob&&(f.responseType="blob"),e.headers.forEach(function(a,b){f.setRequestHeader(b,a)}),f.send(void 0===e._bodyInit?null:e._bodyInit)})},a.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],13:[function(a,b,c){"use strict";var d=a("./core/main");a("./core/constants"),a("./core/environment"),a("./core/error_helpers"),a("./core/helpers"),a("./core/legacy"),a("./core/p5.Element"),a("./core/p5.Graphics"),a("./core/p5.Renderer"),a("./core/p5.Renderer2D"),a("./core/rendering"),a("./core/shim"),a("./core/structure"),a("./core/transform"),a("./core/shape/2d_primitives"),a("./core/shape/attributes"),a("./core/shape/curves"),a("./core/shape/vertex"),a("./color/color_conversion"),a("./color/creating_reading"),a("./color/p5.Color"),a("./color/setting"),a("./data/p5.TypedDict"),a("./events/acceleration"),a("./events/keyboard"),a("./events/mouse"),a("./events/touch"),a("./image/filters"),a("./image/image"),a("./image/loading_displaying"),a("./image/p5.Image"),a("./image/pixels"),a("./io/files"),a("./io/p5.Table"),a("./io/p5.TableRow"),a("./io/p5.XML"),a("./math/calculation"),a("./math/math"),a("./math/noise"),a("./math/p5.Vector"),a("./math/random"),a("./math/trigonometry"),a("./typography/attributes"),a("./typography/loading_displaying"),a("./typography/p5.Font"),a("./utilities/array_functions"),a("./utilities/conversion"),a("./utilities/string_functions"),a("./utilities/time_date"),a("./webgl/3d_primitives"),a("./webgl/interaction"),a("./webgl/light"),a("./webgl/loading"),a("./webgl/material"),a("./webgl/p5.Camera"),a("./webgl/p5.Geometry"),a("./webgl/p5.Matrix"),a("./webgl/p5.RendererGL.Immediate"),a("./webgl/p5.RendererGL"),a("./webgl/p5.RendererGL.Retained"),a("./webgl/p5.Shader"),a("./webgl/p5.Texture"),a("./webgl/text"),a("./core/init"),b.exports=d},{"./color/color_conversion":14,"./color/creating_reading":15,"./color/p5.Color":16,"./color/setting":17,"./core/constants":18,"./core/environment":19,"./core/error_helpers":20,"./core/helpers":21,"./core/init":22,"./core/legacy":23,"./core/main":24,"./core/p5.Element":25,"./core/p5.Graphics":26,"./core/p5.Renderer":27,"./core/p5.Renderer2D":28,"./core/rendering":29,"./core/shape/2d_primitives":30,"./core/shape/attributes":31,"./core/shape/curves":32,"./core/shape/vertex":33,"./core/shim":34,"./core/structure":35,"./core/transform":36,"./data/p5.TypedDict":37,"./events/acceleration":38,"./events/keyboard":39,"./events/mouse":40,"./events/touch":41,"./image/filters":42,"./image/image":43,"./image/loading_displaying":44,"./image/p5.Image":45,"./image/pixels":46,"./io/files":47,"./io/p5.Table":48,"./io/p5.TableRow":49,"./io/p5.XML":50,"./math/calculation":51,"./math/math":52,"./math/noise":53,"./math/p5.Vector":54,"./math/random":55,"./math/trigonometry":56,"./typography/attributes":57,"./typography/loading_displaying":58,"./typography/p5.Font":59,"./utilities/array_functions":60,"./utilities/conversion":61,"./utilities/string_functions":62,"./utilities/time_date":63,"./webgl/3d_primitives":64,"./webgl/interaction":65,"./webgl/light":66,"./webgl/loading":67,"./webgl/material":68,"./webgl/p5.Camera":69,"./webgl/p5.Geometry":70,"./webgl/p5.Matrix":71,"./webgl/p5.RendererGL":74,"./webgl/p5.RendererGL.Immediate":72,"./webgl/p5.RendererGL.Retained":73,"./webgl/p5.Shader":75,"./webgl/p5.Texture":76,"./webgl/text":77}],14:[function(a,b,c){"use strict";var d=a("../core/main");d.ColorConversion={},d.ColorConversion._hsbaToHSLA=function(a){var b=a[0],c=a[1],d=a[2],e=(2-c)*d/2;return 0!==e&&(1===e?c=0:e<.5?c/=2-c:c=c*d/(2-2*e)),[b,c,e,a[3]]},d.ColorConversion._hsbaToRGBA=function(a){var b=6*a[0],c=a[1],d=a[2],e=[];if(0===c)e=[d,d,d,a[3]];else{var f,g,h,i=Math.floor(b),j=d*(1-c),k=d*(1-c*(b-i)),l=d*(1-c*(1+i-b));1===i?(f=k,g=d,h=j):2===i?(f=j,g=d,h=l):3===i?(f=j,g=k,h=d):4===i?(f=l,g=j,h=d):5===i?(f=d,g=j,h=k):(f=d,g=l,h=j),e=[f,g,h,a[3]]}return e},d.ColorConversion._hslaToHSBA=function(a){var b,c=a[0],d=a[1],e=a[2];return b=e<.5?(1+d)*e:e+d-e*d,d=2*(b-e)/b,[c,d,b,a[3]]},d.ColorConversion._hslaToRGBA=function(a){var b=6*a[0],c=a[1],d=a[2],e=[];if(0===c)e=[d,d,d,a[3]];else{var f;f=d<.5?(1+c)*d:d+c-d*c;var g=2*d-f,h=function(a,b,c){return a<0?a+=6:a>=6&&(a-=6),a<1?b+(c-b)*a:a<3?c:a<4?b+(c-b)*(4-a):b};e=[h(b+2,g,f),h(b,g,f),h(b-2,g,f),a[3]]}return e},d.ColorConversion._rgbaToHSBA=function(a){var b,c,d=a[0],e=a[1],f=a[2],g=Math.max(d,e,f),h=g-Math.min(d,e,f);return 0===h?(b=0,c=0):(c=h/g,d===g?b=(e-f)/h:e===g?b=2+(f-d)/h:f===g&&(b=4+(d-e)/h),b<0?b+=6:b>=6&&(b-=6)),[b/6,c,g,a[3]]},d.ColorConversion._rgbaToHSLA=function(a){var b,c,d=a[0],e=a[1],f=a[2],g=Math.max(d,e,f),h=Math.min(d,e,f),i=g+h,j=g-h;return 0===j?(b=0,c=0):(c=i<1?j/i:j/(2-i),d===g?b=(e-f)/j:e===g?b=2+(f-d)/j:f===g&&(b=4+(d-e)/j),b<0?b+=6:b>=6&&(b-=6)),[b/6,c,i/2,a[3]]},b.exports=d.ColorConversion},{"../core/main":24}],15:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants");a("./p5.Color"),a("../core/error_helpers"),d.prototype.alpha=function(a){return d._validateParameters("alpha",arguments),this.color(a)._getAlpha()},d.prototype.blue=function(a){return d._validateParameters("blue",arguments),this.color(a)._getBlue()},d.prototype.brightness=function(a){return d._validateParameters("brightness",arguments),this.color(a)._getBrightness()},d.prototype.color=function(){if(d._validateParameters("color",arguments),arguments[0]instanceof d.Color)return arguments[0];var a=arguments[0]instanceof Array?arguments[0]:arguments;return new d.Color(this,a)},d.prototype.green=function(a){return d._validateParameters("green",arguments),this.color(a)._getGreen()},d.prototype.hue=function(a){return d._validateParameters("hue",arguments),this.color(a)._getHue()},d.prototype.lerpColor=function(a,b,c){d._validateParameters("lerpColor",arguments);var f,g,h,i,j,k,l=this._colorMode,m=this._colorMaxes;if(l===e.RGB)j=a.levels.map(function(a){return a/255}),k=b.levels.map(function(a){return a/255});else if(l===e.HSB)a._getBrightness(),b._getBrightness(),j=a.hsba,k=b.hsba;else{if(l!==e.HSL)throw new Error(l+"cannot be used for interpolation.");a._getLightness(),b._getLightness(),j=a.hsla,k=b.hsla}return c=Math.max(Math.min(c,1),0),void 0===this.lerp&&(this.lerp=function(a,b,c){return c*(b-a)+a}),f=this.lerp(j[0],k[0],c),g=this.lerp(j[1],k[1],c),h=this.lerp(j[2],k[2],c),i=this.lerp(j[3],k[3],c),f*=m[l][0],g*=m[l][1],h*=m[l][2],i*=m[l][3],this.color(f,g,h,i)},d.prototype.lightness=function(a){return d._validateParameters("lightness",arguments),this.color(a)._getLightness()},d.prototype.red=function(a){return d._validateParameters("red",arguments),this.color(a)._getRed()},d.prototype.saturation=function(a){return d._validateParameters("saturation",arguments),this.color(a)._getSaturation()},b.exports=d},{"../core/constants":18,"../core/error_helpers":20,"../core/main":24,"./p5.Color":16}],16:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants"),f=a("./color_conversion");d.Color=function(a,b){if(this._storeModeAndMaxes(a._colorMode,a._colorMaxes),this.mode!==e.RGB&&this.mode!==e.HSL&&this.mode!==e.HSB)throw new Error(this.mode+" is an invalid colorMode.");return this._array=d.Color._parseInputs.apply(this,b),this._calculateLevels(),this},d.Color.prototype.toString=function(a){this.hsba||(this.hsba=f._rgbaToHSBA(this._array)),this.hsla||(this.hsla=f._rgbaToHSLA(this._array));var b=this.levels,c=this._array,d=c[3];switch(a){case"#rrggbb":return"#".concat(b[0]<16?"0".concat(b[0].toString(16)):b[0].toString(16),b[1]<16?"0".concat(b[1].toString(16)):b[1].toString(16),b[2]<16?"0".concat(b[2].toString(16)):b[2].toString(16));case"#rrggbbaa":return"#".concat(b[0]<16?"0".concat(b[0].toString(16)):b[0].toString(16),b[1]<16?"0".concat(b[1].toString(16)):b[1].toString(16),b[2]<16?"0".concat(b[2].toString(16)):b[2].toString(16),b[3]<16?"0".concat(b[2].toString(16)):b[3].toString(16));case"#rgb":return"#".concat(Math.round(15*c[0]).toString(16),Math.round(15*c[1]).toString(16),Math.round(15*c[2]).toString(16));case"#rgba":return"#".concat(Math.round(15*c[0]).toString(16),Math.round(15*c[1]).toString(16),Math.round(15*c[2]).toString(16),Math.round(15*c[3]).toString(16));case"rgb":return"rgb(".concat(b[0],", ",b[1],", ",b[2],")");case"rgb%":return"rgb(".concat((100*c[0]).toPrecision(3),"%, ",(100*c[1]).toPrecision(3),"%, ",(100*c[2]).toPrecision(3),"%)");case"rgba%":return"rgba(".concat((100*c[0]).toPrecision(3),"%, ",(100*c[1]).toPrecision(3),"%, ",(100*c[2]).toPrecision(3),"%, ",(100*c[3]).toPrecision(3),"%)");case"hsb":case"hsv":return"hsb(".concat(this.hsba[0]*this.maxes[e.HSB][0],", ",this.hsba[1]*this.maxes[e.HSB][1],", ",this.hsba[2]*this.maxes[e.HSB][2],")");case"hsb%":case"hsv%":return"hsb(".concat((100*this.hsba[0]).toPrecision(3),"%, ",(100*this.hsba[1]).toPrecision(3),"%, ",(100*this.hsba[2]).toPrecision(3),"%)");case"hsba":case"hsva":return"hsba(".concat(this.hsba[0]*this.maxes[e.HSB][0],", ",this.hsba[1]*this.maxes[e.HSB][1],", ",this.hsba[2]*this.maxes[e.HSB][2],", ",d,")");case"hsba%":case"hsva%":return"hsba(".concat((100*this.hsba[0]).toPrecision(3),"%, ",(100*this.hsba[1]).toPrecision(3),"%, ",(100*this.hsba[2]).toPrecision(3),"%, ",(100*d).toPrecision(3),"%)");case"hsl":return"hsl(".concat(this.hsla[0]*this.maxes[e.HSL][0],", ",this.hsla[1]*this.maxes[e.HSL][1],", ",this.hsla[2]*this.maxes[e.HSL][2],")");case"hsl%":return"hsl(".concat((100*this.hsla[0]).toPrecision(3),"%, ",(100*this.hsla[1]).toPrecision(3),"%, ",(100*this.hsla[2]).toPrecision(3),"%)");case"hsla":return"hsla(".concat(this.hsla[0]*this.maxes[e.HSL][0],", ",this.hsla[1]*this.maxes[e.HSL][1],", ",this.hsla[2]*this.maxes[e.HSL][2],", ",d,")");case"hsla%":return"hsl(".concat((100*this.hsla[0]).toPrecision(3),"%, ",(100*this.hsla[1]).toPrecision(3),"%, ",(100*this.hsla[2]).toPrecision(3),"%, ",(100*d).toPrecision(3),"%)");case"rgba":default:return"rgba("+b[0]+","+b[1]+","+b[2]+","+d+")"}},d.Color.prototype.setRed=function(a){this._array[0]=a/this.maxes[e.RGB][0],this._calculateLevels()},d.Color.prototype.setGreen=function(a){this._array[1]=a/this.maxes[e.RGB][1],this._calculateLevels()},d.Color.prototype.setBlue=function(a){this._array[2]=a/this.maxes[e.RGB][2],this._calculateLevels()},d.Color.prototype.setAlpha=function(a){this._array[3]=a/this.maxes[this.mode][3],this._calculateLevels()},d.Color.prototype._calculateLevels=function(){for(var a=this._array,b=this.levels=new Array(a.length),c=a.length-1;c>=0;--c)b[c]=Math.round(255*a[c])},d.Color.prototype._getAlpha=function(){return this._array[3]*this.maxes[this.mode][3]},d.Color.prototype._storeModeAndMaxes=function(a,b){this.mode=a,this.maxes=b},d.Color.prototype._getMode=function(){return this.mode},d.Color.prototype._getMaxes=function(){return this.maxes},d.Color.prototype._getBlue=function(){return this._array[2]*this.maxes[e.RGB][2]},d.Color.prototype._getBrightness=function(){return this.hsba||(this.hsba=f._rgbaToHSBA(this._array)),this.hsba[2]*this.maxes[e.HSB][2]},d.Color.prototype._getGreen=function(){return this._array[1]*this.maxes[e.RGB][1]},d.Color.prototype._getHue=function(){return this.mode===e.HSB?(this.hsba||(this.hsba=f._rgbaToHSBA(this._array)),this.hsba[0]*this.maxes[e.HSB][0]):(this.hsla||(this.hsla=f._rgbaToHSLA(this._array)),this.hsla[0]*this.maxes[e.HSL][0])},d.Color.prototype._getLightness=function(){return this.hsla||(this.hsla=f._rgbaToHSLA(this._array)),this.hsla[2]*this.maxes[e.HSL][2]},d.Color.prototype._getRed=function(){return this._array[0]*this.maxes[e.RGB][0]},d.Color.prototype._getSaturation=function(){return this.mode===e.HSB?(this.hsba||(this.hsba=f._rgbaToHSBA(this._array)),this.hsba[1]*this.maxes[e.HSB][1]):(this.hsla||(this.hsla=f._rgbaToHSLA(this._array)),this.hsla[1]*this.maxes[e.HSL][1])};var g={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",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#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",grey:"#808080",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",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",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:"#db7093",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",slategrey:"#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"},h=/\s*/,i=/(\d{1,3})/,j=/((?:\d+(?:\.\d+)?)|(?:\.\d+))/,k=new RegExp(j.source+"%"),l={HEX3:/^#([a-f0-9])([a-f0-9])([a-f0-9])$/i,HEX4:/^#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])$/i,HEX6:/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i,HEX8:/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i,RGB:new RegExp(["^rgb\\(",i.source,",",i.source,",",i.source,"\\)$"].join(h.source),"i"),RGB_PERCENT:new RegExp(["^rgb\\(",k.source,",",k.source,",",k.source,"\\)$"].join(h.source),"i"),RGBA:new RegExp(["^rgba\\(",i.source,",",i.source,",",i.source,",",j.source,"\\)$"].join(h.source),"i"),RGBA_PERCENT:new RegExp(["^rgba\\(",k.source,",",k.source,",",k.source,",",j.source,"\\)$"].join(h.source),"i"),HSL:new RegExp(["^hsl\\(",i.source,",",k.source,",",k.source,"\\)$"].join(h.source),"i"),HSLA:new RegExp(["^hsla\\(",i.source,",",k.source,",",k.source,",",j.source,"\\)$"].join(h.source),"i"),HSB:new RegExp(["^hsb\\(",i.source,",",k.source,",",k.source,"\\)$"].join(h.source),"i"),HSBA:new RegExp(["^hsba\\(",i.source,",",k.source,",",k.source,",",j.source,"\\)$"].join(h.source),"i")};d.Color._parseInputs=function(a,b,c,h){var i,j=arguments.length,k=this.mode,m=this.maxes[k],n=[];if(j>=3){for(n[0]=a/m[0],n[1]=b/m[1],n[2]=c/m[2],n[3]="number"==typeof h?h/m[3]:1,i=n.length-1;i>=0;--i){var o=n[i];o<0?n[i]=0:o>1&&(n[i]=1)}return k===e.HSL?f._hslaToRGBA(n):k===e.HSB?f._hsbaToRGBA(n):n}if(1===j&&"string"==typeof a){var p=a.trim().toLowerCase();if(g[p])return d.Color._parseInputs.call(this,g[p]);if(l.HEX3.test(p))return n=l.HEX3.exec(p).slice(1).map(function(a){return parseInt(a+a,16)/255}),n[3]=1,n;if(l.HEX6.test(p))return n=l.HEX6.exec(p).slice(1).map(function(a){return parseInt(a,16)/255}),n[3]=1,n;if(l.HEX4.test(p))return n=l.HEX4.exec(p).slice(1).map(function(a){return parseInt(a+a,16)/255});if(l.HEX8.test(p))return n=l.HEX8.exec(p).slice(1).map(function(a){return parseInt(a,16)/255});if(l.RGB.test(p))return n=l.RGB.exec(p).slice(1).map(function(a){return a/255}),n[3]=1,n;if(l.RGB_PERCENT.test(p))return n=l.RGB_PERCENT.exec(p).slice(1).map(function(a){return parseFloat(a)/100}),n[3]=1,n;if(l.RGBA.test(p))return n=l.RGBA.exec(p).slice(1).map(function(a,b){return 3===b?parseFloat(a):a/255});if(l.RGBA_PERCENT.test(p))return n=l.RGBA_PERCENT.exec(p).slice(1).map(function(a,b){return 3===b?parseFloat(a):parseFloat(a)/100});if(l.HSL.test(p)?(n=l.HSL.exec(p).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:parseInt(a,10)/100}),n[3]=1):l.HSLA.test(p)&&(n=l.HSLA.exec(p).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:3===b?parseFloat(a):parseInt(a,10)/100})),n=n.map(function(a){return Math.max(Math.min(a,1),0)}),n.length)return f._hslaToRGBA(n);if(l.HSB.test(p)?(n=l.HSB.exec(p).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:parseInt(a,10)/100}),n[3]=1):l.HSBA.test(p)&&(n=l.HSBA.exec(p).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:3===b?parseFloat(a):parseInt(a,10)/100})),n.length){for(i=n.length-1;i>=0;--i)n[i]=Math.max(Math.min(n[i],1),0);return f._hsbaToRGBA(n)}n=[1,1,1,1]}else{if(1!==j&&2!==j||"number"!=typeof a)throw new Error(arguments+"is not a valid color representation.");n[0]=a/m[2],n[1]=a/m[2],n[2]=a/m[2],n[3]="number"==typeof b?b/m[3]:1,n=n.map(function(a){return Math.max(Math.min(a,1),0)})}return n},b.exports=d.Color},{"../core/constants":18,"../core/main":24,"./color_conversion":14}],17:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants");a("./p5.Color"),d.prototype.background=function(){return arguments[0]instanceof d.Image?this.image(arguments[0],0,0,this.width,this.height):this._renderer.background.apply(this._renderer,arguments),this},d.prototype.clear=function(){return this._renderer.clear(),this},d.prototype.colorMode=function(a,b,c,f,g){if(d._validateParameters("colorMode",arguments),a===e.RGB||a===e.HSB||a===e.HSL){this._colorMode=a;var h=this._colorMaxes[a];2===arguments.length?(h[0]=b,h[1]=b,h[2]=b,h[3]=b):4===arguments.length?(h[0]=b,h[1]=c,h[2]=f):5===arguments.length&&(h[0]=b,h[1]=c,h[2]=f,h[3]=g)}return this},d.prototype.fill=function(){return this._renderer._setProperty("_fillSet",!0),this._renderer._setProperty("_doFill",!0),this._renderer.fill.apply(this._renderer,arguments),this},d.prototype.noFill=function(){return this._renderer._setProperty("_doFill",!1),this},d.prototype.noStroke=function(){return this._renderer._setProperty("_doStroke",!1),this},d.prototype.stroke=function(){return this._renderer._setProperty("_strokeSet",!0),this._renderer._setProperty("_doStroke",!0),this._renderer.stroke.apply(this._renderer,arguments),this},b.exports=d},{"../core/constants":18,"../core/main":24,"./p5.Color":16}],18:[function(a,b,c){"use strict";var d=Math.PI;b.exports={P2D:"p2d",WEBGL:"webgl",ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",HALF_PI:d/2,PI:d,QUARTER_PI:d/4,TAU:2*d,TWO_PI:2*d,DEGREES:"degrees",RADIANS:"radians",DEG_TO_RAD:d/180,RAD_TO_DEG:180/d,CORNER:"corner",CORNERS:"corners",RADIUS:"radius",RIGHT:"right",LEFT:"left",CENTER:"center",TOP:"top",BOTTOM:"bottom",BASELINE:"alphabetic",POINTS:0,LINES:1,LINE_STRIP:3,LINE_LOOP:2,TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,QUADS:"quads",QUAD_STRIP:"quad_strip",CLOSE:"close",OPEN:"open",CHORD:"chord",PIE:"pie",PROJECT:"square",SQUARE:"butt",ROUND:"round",BEVEL:"bevel",MITER:"miter",RGB:"rgb",HSB:"hsb",HSL:"hsl",AUTO:"auto",ALT:18,BACKSPACE:8,CONTROL:17,DELETE:46,DOWN_ARROW:40,ENTER:13,ESCAPE:27,LEFT_ARROW:37,OPTION:18,RETURN:13,RIGHT_ARROW:39,SHIFT:16,TAB:9,UP_ARROW:38,BLEND:"source-over",ADD:"lighter",DARKEST:"darken",LIGHTEST:"lighten",DIFFERENCE:"difference",EXCLUSION:"exclusion",MULTIPLY:"multiply",SCREEN:"screen",REPLACE:"copy",OVERLAY:"overlay",HARD_LIGHT:"hard-light",SOFT_LIGHT:"soft-light",DODGE:"color-dodge",BURN:"color-burn",THRESHOLD:"threshold",GRAY:"gray",OPAQUE:"opaque",INVERT:"invert",POSTERIZE:"posterize",DILATE:"dilate",ERODE:"erode",BLUR:"blur",NORMAL:"normal",ITALIC:"italic",BOLD:"bold",_DEFAULT_TEXT_FILL:"#000000",_DEFAULT_LEADMULT:1.25,_CTX_MIDDLE:"middle",LINEAR:"linear",QUADRATIC:"quadratic",BEZIER:"bezier",CURVE:"curve",STROKE:"stroke",FILL:"fill",TEXTURE:"texture",IMMEDIATE:"immediate",NEAREST:"nearest",REPEAT:"repeat",CLAMP:"clamp",MIRROR:"mirror",LANDSCAPE:"landscape",PORTRAIT:"portrait",_DEFAULT_STROKE:"#000000",_DEFAULT_FILL:"#FFFFFF",GRID:"grid",AXES:"axes"}},{}],19:[function(a,b,c){"use strict";function d(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function e(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}function f(a){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))throw new Error("Fullscreen not enabled in this browser.") +;a.requestFullscreen?a.requestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen?a.webkitRequestFullscreen():a.msRequestFullscreen&&a.msRequestFullscreen()}function g(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()}var h=a("./main"),i=a("./constants"),j=[i.ARROW,i.CROSS,i.HAND,i.MOVE,i.TEXT,i.WAIT];h.prototype._frameRate=0,h.prototype._lastFrameTime=window.performance.now(),h.prototype._targetFrameRate=60;var k=window.print;h.prototype.print=function(){arguments.length?console.log.apply(console,arguments):k()},h.prototype.frameCount=0,h.prototype.focused=document.hasFocus(),h.prototype.cursor=function(a,b,c){var d="auto",e=this._curElement.elt;if(j.indexOf(a)>-1)d=a;else if("string"==typeof a){var f="";b&&c&&"number"==typeof b&&"number"==typeof c&&(f=b+" "+c),d="http://"===a.substring(0,7)||"https://"===a.substring(0,8)?"url("+a+") "+f+", auto":/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(a)?"url("+a+") "+f+", auto":a}e.style.cursor=d},h.prototype.frameRate=function(a){return h._validateParameters("frameRate",arguments),"number"!=typeof a||a<0?this._frameRate:(this._setProperty("_targetFrameRate",a),this._runFrames(),this)},h.prototype.getFrameRate=function(){return this.frameRate()},h.prototype.setFrameRate=function(a){return this.frameRate(a)},h.prototype.noCursor=function(){this._curElement.elt.style.cursor="none"},h.prototype.displayWidth=screen.width,h.prototype.displayHeight=screen.height,h.prototype.windowWidth=d(),h.prototype.windowHeight=e(),h.prototype._onresize=function(a){this._setProperty("windowWidth",d()),this._setProperty("windowHeight",e());var b,c=this._isGlobal?window:this;"function"==typeof c.windowResized&&(void 0===(b=c.windowResized(a))||b||a.preventDefault())},h.prototype.width=0,h.prototype.height=0,h.prototype.fullscreen=function(a){if(h._validateParameters("fullscreen",arguments),void 0===a)return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;a?f(document.documentElement):g()},h.prototype.pixelDensity=function(a){h._validateParameters("pixelDensity",arguments);var b;return"number"==typeof a?(a!==this._pixelDensity&&(this._pixelDensity=a,this._pixelsDirty=!0),b=this,this.resizeCanvas(this.width,this.height,!0)):b=this._pixelDensity,b},h.prototype.displayDensity=function(){return window.devicePixelRatio},h.prototype.getURL=function(){return location.href},h.prototype.getURLPath=function(){return location.pathname.split("/").filter(function(a){return""!==a})},h.prototype.getURLParams=function(){for(var a,b=/[?&]([^&=]+)(?:[&=])([^&=]+)/gim,c={};null!=(a=b.exec(location.search));)a.index===b.lastIndex&&b.lastIndex++,c[a[1]]=a[2];return c},b.exports=h},{"./constants":18,"./main":24}],20:[function(a,b,c){"use strict";var d=a("./main");a("./constants");d._validateParameters=d._friendlyFileLoadError=function(){};var e=null,f="https://github.com/processing/p5.js/wiki/p5.js-overview#why-cant-i-assign-variables-using-p5-functions-and-variables-before-setup",g=function(){var b={},c=function(a){return Object.getOwnPropertyNames(a).filter(function(a){return"_"!==a[0]&&(!(a in b)&&(b[a]=!0,!0))}).map(function(b){var c;return c="function"==typeof a[b]?"function":b===b.toUpperCase()?"constant":"variable",{name:b,type:c}})};e=[].concat(c(d.prototype),c(a("./constants"))),e.sort(function(a,b){return b.name.length-a.name.length})},h=function(a,b){b||(b=console.log.bind(console)),e||g(),e.some(function(c){if(a.message&&null!==a.message.match("\\W?"+c.name+"\\W"))return b("Did you just try to use p5.js's "+c.name+("function"===c.type?"() ":" ")+c.type+"? If so, you may want to move it into your sketch's setup() function.\n\nFor more details, see: "+f),!0})};d.prototype._helpForMisusedAtTopLevelCode=h,"complete"!==document.readyState&&(window.addEventListener("error",h,!1),window.addEventListener("load",function(){window.removeEventListener("error",h,!1)})),b.exports=d},{"../../docs/reference/data.json":void 0,"./constants":18,"./main":24}],21:[function(a,b,c){"use strict";var d=a("./constants");b.exports={modeAdjust:function(a,b,c,e,f){return f===d.CORNER?{x:a,y:b,w:c,h:e}:f===d.CORNERS?{x:a,y:b,w:c-a,h:e-b}:f===d.RADIUS?{x:a-c,y:b-e,w:2*c,h:2*e}:f===d.CENTER?{x:a-.5*c,y:b-.5*e,w:c,h:e}:void 0}}},{"./constants":18}],22:[function(a,b,c){"use strict";var d=a("../core/main"),e=function(){window.mocha||(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&!d.instance&&new d};"complete"===document.readyState?e():window.addEventListener("load",e,!1)},{"../core/main":24}],23:[function(a,b,c){"use strict";var d=a("./main");d.prototype.exit=function(){throw new Error("exit() not implemented, see remove()")},d.prototype.pushStyle=function(){throw new Error("pushStyle() not used, see push()")},d.prototype.popStyle=function(){throw new Error("popStyle() not used, see pop()")},d.prototype.size=function(){var a="size() is not a valid p5 function, to set the size of the ";throw a+="drawing canvas, please use createCanvas() instead",new Error(a)},b.exports=d},{"./main":24}],24:[function(a,b,c){"use strict";a("./shim");var d=a("./constants"),e=function(a,b,c){"boolean"==typeof b&&void 0===c&&(c=b,b=void 0),this._setupDone=!1,this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this._userNode=b,this._curElement=null,this._elements=[],this._requestAnimId=0,this._preloadCount=0,this._isGlobal=!1,this._loop=!0,this._initializeInstanceVariables(),this._defaultCanvasSize={width:100,height:100},this._events={mousemove:null,mousedown:null,mouseup:null,dragend:null,dragover:null,click:null,dblclick:null,mouseover:null,mouseout:null,keydown:null,keyup:null,keypress:null,touchstart:null,touchmove:null,touchend:null,resize:null,blur:null},this._events.wheel=null,this._loadingScreenId="p5_loading",this._registeredMethods={};for(var d=Object.getOwnPropertyNames(e.prototype._registeredMethods),f=0;f=c-5)&&(this.redraw(),this._frameRate=1e3/(a-this._lastFrameTime),this._lastFrameTime=a,void 0!==this._updateMouseCoords&&this._updateMouseCoords()),this._loop&&(this._requestAnimId=window.requestAnimationFrame(this._draw))}.bind(this),this._runFrames=function(){this._updateInterval&&clearInterval(this._updateInterval)}.bind(this),this._setProperty=function(a,b){this[a]=b,this._isGlobal&&(window[a]=b)}.bind(this),this.remove=function(){var a=document.getElementById(this._loadingScreenId);if(a&&(a.parentNode.removeChild(a),this._incrementPreload()),this._curElement){this._loop=!1,this._requestAnimId&&window.cancelAnimationFrame(this._requestAnimId);for(var b in this._events)window.removeEventListener(b,this._events[b]);for(var c=0;c-1?f.readAsText(e):f.readAsDataURL(e)}},this)):console.log("The File APIs are not fully supported in this browser."),this},g.Element.prototype._setProperty=function(a,b){this[a]=b},b.exports=g.Element},{"./main":24}],26:[function(a,b,c){"use strict";var d=a("./main"),e=a("./constants");d.Graphics=function(a,b,c,f){var g=c||e.P2D;this.canvas=document.createElement("canvas"),(f._userNode||document.body).appendChild(this.canvas),d.Element.call(this,this.canvas,f,!1);for(var h in d.prototype)this[h]||("function"==typeof d.prototype[h]?this[h]=d.prototype[h].bind(this):this[h]=d.prototype[h]);return d.prototype._initializeInstanceVariables.apply(this),this.width=a,this.height=b,this._pixelDensity=f._pixelDensity,g===e.WEBGL?this._renderer=new d.RendererGL(this.canvas,this,!1):this._renderer=new d.Renderer2D(this.canvas,this,!1),f._elements.push(this),this._renderer.resize(a,b),this._renderer._applyDefaults(),this},d.Graphics.prototype=Object.create(d.Element.prototype),d.Graphics.prototype.remove=function(){this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt);var a=this._pInst._elements.indexOf(this);-1!==a&&this._pInst._elements.splice(a,1);for(var b in this._events)this.elt.removeEventListener(b,this._events[b])},b.exports=d.Graphics},{"./constants":18,"./main":24}],27:[function(a,b,c){"use strict";function d(a){var b=0,c=0;if(a.offsetParent)do{b+=a.offsetLeft,c+=a.offsetTop}while(a=a.offsetParent);else b+=a.offsetLeft,c+=a.offsetTop;return[b,c]}var e=a("./main"),f=a("../core/constants");e.Renderer=function(a,b,c){e.Element.call(this,a,b),this.canvas=a,c?(this._isMainCanvas=!0,this._pInst._setProperty("_curElement",this),this._pInst._setProperty("canvas",this.canvas),this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height)):(this.canvas.style.display="none",this._styles=[]),this._textSize=12,this._textLeading=15,this._textFont="sans-serif",this._textStyle=f.NORMAL,this._textAscent=null,this._textDescent=null,this._textAlign=f.LEFT,this._textBaseline=f.BASELINE,this._rectMode=f.CORNER,this._ellipseMode=f.CENTER,this._curveTightness=0,this._imageMode=f.CORNER,this._tint=null,this._doStroke=!0,this._doFill=!0,this._strokeSet=!1,this._fillSet=!1},e.Renderer.prototype=Object.create(e.Element.prototype),e.Renderer.prototype.push=function(){return{properties:{_doStroke:this._doStroke,_strokeSet:this._strokeSet,_doFill:this._doFill,_fillSet:this._fillSet,_tint:this._tint,_imageMode:this._imageMode,_rectMode:this._rectMode,_ellipseMode:this._ellipseMode,_textFont:this._textFont,_textLeading:this._textLeading,_textSize:this._textSize,_textAlign:this._textAlign,_textBaseline:this._textBaseline,_textStyle:this._textStyle}}},e.Renderer.prototype.pop=function(a){a.properties&&Object.assign(this,a.properties)},e.Renderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.elt.width=a*this._pInst._pixelDensity,this.elt.height=b*this._pInst._pixelDensity,this.elt.style.width=a+"px",this.elt.style.height=b+"px",this._isMainCanvas&&(this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height))},e.Renderer.prototype.textLeading=function(a){return"number"==typeof a?(this._setProperty("_textLeading",a),this._pInst):this._textLeading},e.Renderer.prototype.textSize=function(a){return"number"==typeof a?(this._setProperty("_textSize",a),this._setProperty("_textLeading",a*f._DEFAULT_LEADMULT),this._applyTextProperties()):this._textSize},e.Renderer.prototype.textStyle=function(a){return a?(a!==f.NORMAL&&a!==f.ITALIC&&a!==f.BOLD||this._setProperty("_textStyle",a),this._applyTextProperties()):this._textStyle},e.Renderer.prototype.textAscent=function(){return null===this._textAscent&&this._updateTextMetrics(),this._textAscent},e.Renderer.prototype.textDescent=function(){return null===this._textDescent&&this._updateTextMetrics(),this._textDescent},e.Renderer.prototype.textAlign=function(a,b){return void 0!==a?(this._setProperty("_textAlign",a),void 0!==b&&this._setProperty("_textBaseline",b),this._applyTextProperties()):{horizontal:this._textAlign,vertical:this._textBaseline}},e.Renderer.prototype.text=function(a,b,c,d,e){var g,h,i,j,k,l,m,n,o,p=this._pInst,q=Number.MAX_VALUE;if((this._doFill||this._doStroke)&&void 0!==a){if("string"!=typeof a&&(a=a.toString()),a=a.replace(/(\t)/g," "),g=a.split("\n"),void 0!==d){for(o=0,i=0;id?(k=n[h]+" ",o+=p.textLeading()):k=l;switch(this._rectMode===f.CENTER&&(b-=d/2,c-=e/2),this._textAlign){case f.CENTER:b+=d/2;break;case f.RIGHT:b+=d}var r=!1;if(void 0!==e){switch(this._textBaseline){case f.BOTTOM:c+=e-o;break;case f.CENTER:c+=(e-o)/2;break;case f.BASELINE:r=!0,this._textBaseline=f.TOP}q=c+e-p.textAscent()}for(i=0;id&&k.length>0?(this._renderText(p,k,b,c,q),k=n[h]+" ",c+=p.textLeading()):k=l;this._renderText(p,k,b,c,q),c+=p.textLeading(),r&&(this._textBaseline=f.BASELINE)}}else{var s=0,t=p.textAlign().vertical;for(t===f.CENTER?s=(g.length-1)*p.textLeading()/2:t===f.BOTTOM&&(s=(g.length-1)*p.textLeading()),j=0;j0&&(l=k.width/a.width),this.drawingContext.drawImage(k,l*b,l*c,l*e,l*f,g,h,i,j)}catch(a){if("NS_ERROR_NOT_AVAILABLE"!==a.name)throw a}this._pInst._pixelsDirty=!0},d.Renderer2D.prototype._getTintedImageCanvas=function(a){if(!a.canvas)return a;var b=f._toPixels(a.canvas),c=document.createElement("canvas");c.width=a.canvas.width,c.height=a.canvas.height;for(var d=c.getContext("2d"),e=d.createImageData(a.canvas.width,a.canvas.height),g=e.data,h=0;h=this.width||b>=this.height)return[0,0,0,255];var f=this._pInst||this,g=f._pixelDensity;a=Math.floor(a),b=Math.floor(b),c=Math.floor(c),e=Math.floor(e);var h=a*g,i=b*g;if(1!==c||1!==e||this instanceof d.RendererGL){var j=Math.min(c,f.width),k=Math.min(e,f.height),l=j*g,m=k*g,n=new d.Image(j,k);return n.canvas.getContext("2d").drawImage(this.canvas,h,i,l,m,0,0,j,k),n}var o,p;return f._pixelsDirty?(o=this.drawingContext.getImageData(h,i,1,1).data,p=0):(o=f.pixels,p=4*(h+i*this.width*g)),[o[p+0],o[p+1],o[p+2],o[p+3]]},d.Renderer2D.prototype.loadPixels=function(){var a=this._pInst||this;if(a._pixelsDirty){a._pixelsDirty=!1;var b=a._pixelDensity,c=this.width*b,d=this.height*b,e=this.drawingContext.getImageData(0,0,c,d);a._setProperty("imageData",e),a._setProperty("pixels",e.data)}},d.Renderer2D.prototype.set=function(a,b,c){a=Math.floor(a),b=Math.floor(b);var e=this._pInst||this;if(c instanceof d.Image)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(e._pixelDensity,e._pixelDensity),this.drawingContext.drawImage(c.canvas,a,b),this.drawingContext.restore(),e._pixelsDirty=!0;else{var f=0,g=0,h=0,i=0,j=4*(b*e._pixelDensity*(this.width*e._pixelDensity)+a*e._pixelDensity);if(e.imageData&&!e._pixelsDirty||e.loadPixels.call(e),"number"==typeof c)jl;)m=Math.min(g-f,e.HALF_PI),n.push(this._acuteArcToBezier(f,m)),f+=m;return this._doFill&&(i.beginPath(),n.forEach(function(c,d){0===d&&i.moveTo(a+c.ax*j,b+c.ay*k),i.bezierCurveTo(a+c.bx*j,b+c.by*k,a+c.cx*j,b+c.cy*k,a+c.dx*j,b+c.dy*k)}),h!==e.PIE&&null!=h||i.lineTo(a,b),i.closePath(),i.fill()),this._doStroke&&(i.beginPath(),n.forEach(function(c,d){0===d&&i.moveTo(a+c.ax*j,b+c.ay*k),i.bezierCurveTo(a+c.bx*j,b+c.by*k,a+c.cx*j,b+c.cy*k,a+c.dx*j,b+c.dy*k)}),h===e.PIE?(i.lineTo(a,b),i.closePath()):h===e.CHORD&&i.closePath(),i.stroke()),this},d.Renderer2D.prototype.ellipse=function(a){var b=this.drawingContext,c=this._doFill,d=this._doStroke,e=a[0],f=a[1],h=a[2],i=a[3];if(c&&!d){if(this._getFill()===g)return this}else if(!c&&d&&this._getStroke()===g)return this;var j=.5522847498,k=h/2*j,l=i/2*j,m=e+h,n=f+i,o=e+h/2,p=f+i/2;b.beginPath(),b.moveTo(e,p),b.bezierCurveTo(e,p-l,o-k,f,o,f),b.bezierCurveTo(o+k,f,m,p-l,m,p),b.bezierCurveTo(m,p+l,o+k,n,o,n),b.bezierCurveTo(o-k,n,e,p+l,e,p),b.closePath(),c&&b.fill(),d&&b.stroke()},d.Renderer2D.prototype.line=function(a,b,c,d){var e=this.drawingContext;return this._doStroke?this._getStroke()===g?this:(e.lineWidth%2==1&&e.translate(.5,.5),e.beginPath(),e.moveTo(a,b),e.lineTo(c,d),e.stroke(),e.lineWidth%2==1&&e.translate(-.5,-.5),this):this},d.Renderer2D.prototype.point=function(a,b){var c=this.drawingContext;if(!this._doStroke)return this;if(this._getStroke()===g)return this;var d=this._getStroke(),f=this._getFill();a=Math.round(a),b=Math.round(b),this._setFill(d),c.lineWidth>1?(c.beginPath(),c.arc(a,b,c.lineWidth/2,0,e.TWO_PI,!1),c.fill()):c.fillRect(a,b,1,1),this._setFill(f)},d.Renderer2D.prototype.quad=function(a,b,c,d,e,f,h,i){var j=this.drawingContext,k=this._doFill,l=this._doStroke;if(k&&!l){if(this._getFill()===g)return this}else if(!k&&l&&this._getStroke()===g)return this;return j.beginPath(),j.moveTo(a,b),j.lineTo(c,d),j.lineTo(e,f),j.lineTo(h,i),j.closePath(),k&&j.fill(),l&&j.stroke(),this},d.Renderer2D.prototype.rect=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],h=a[5],i=a[6],j=a[7],k=this.drawingContext,l=this._doFill,m=this._doStroke;if(l&&!m){if(this._getFill()===g)return this}else if(!l&&m&&this._getStroke()===g)return this;if(this._doStroke&&k.lineWidth%2==1&&k.translate(.5,.5),k.beginPath(),void 0===f)k.rect(b,c,d,e);else{void 0===h&&(h=f),void 0===i&&(i=h),void 0===j&&(j=i);var n=d/2,o=e/2;d<2*f&&(f=n),e<2*f&&(f=o),d<2*h&&(h=n),e<2*h&&(h=o),d<2*i&&(i=n),e<2*i&&(i=o),d<2*j&&(j=n),e<2*j&&(j=o),k.beginPath(),k.moveTo(b+f,c),k.arcTo(b+d,c,b+d,c+e,h),k.arcTo(b+d,c+e,b,c+e,i),k.arcTo(b,c+e,b,c,j),k.arcTo(b,c,b+d,c,f),k.closePath()}return this._doFill&&k.fill(),this._doStroke&&k.stroke(),this._doStroke&&k.lineWidth%2==1&&k.translate(-.5,-.5),this},d.Renderer2D.prototype.triangle=function(a){var b=this.drawingContext,c=this._doFill,d=this._doStroke,e=a[0],f=a[1],h=a[2],i=a[3],j=a[4],k=a[5];if(c&&!d){if(this._getFill()===g)return this}else if(!c&&d&&this._getStroke()===g)return this;b.beginPath(),b.moveTo(e,f),b.lineTo(h,i),b.lineTo(j,k),b.closePath(),c&&b.fill(),d&&b.stroke()},d.Renderer2D.prototype.endShape=function(a,b,c,d,f,g,h){if(0===b.length)return this;if(!this._doStroke&&!this._doFill)return this;var i,j=a===e.CLOSE;j&&!g&&b.push(b[0]);var k,l,m=b.length;if(!c||h!==e.POLYGON&&null!==h)if(!d||h!==e.POLYGON&&null!==h)if(!f||h!==e.POLYGON&&null!==h)if(h===e.POINTS)for(k=0;k2){for(this.drawingContext.beginPath(),k=2;k3)for(k=0;k+13){var n=[],o=1-this._curveTightness;for(this.drawingContext.beginPath(),this.drawingContext.moveTo(b[1][0],b[1][1]),k=1;k+2=f))return a.push(),this._isOpenType()?this._textFont._renderPath(b,c,d,{renderer:this}):(this._doStroke&&this._strokeSet&&this.drawingContext.strokeText(b,c,d),this._doFill&&(this._fillSet||this._setFill(e._DEFAULT_TEXT_FILL),this.drawingContext.fillText(b,c,d))),a.pop(),this._pInst._pixelsDirty=!0,a},d.Renderer2D.prototype.textWidth=function(a){return this._isOpenType()?this._textFont._textWidth(a,this._textSize):this.drawingContext.measureText(a).width},d.Renderer2D.prototype._applyTextProperties=function(){var a,b=this._pInst;return this._setProperty("_textAscent",null),this._setProperty("_textDescent",null),a=this._textFont,this._isOpenType()&&(a=this._textFont.font.familyName,this._setProperty("_textStyle",this._textFont.font.styleName)),this.drawingContext.font=(this._textStyle||"normal")+" "+(this._textSize||12)+"px "+(a||"sans-serif"),this.drawingContext.textAlign=this._textAlign,this._textBaseline===e.CENTER?this.drawingContext.textBaseline=e._CTX_MIDDLE:this.drawingContext.textBaseline=this._textBaseline,b},d.Renderer2D.prototype.push=function(){return this.drawingContext.save(),d.Renderer.prototype.push.apply(this)},d.Renderer2D.prototype.pop=function(a){this.drawingContext.restore(),this._cachedFillStyle=this.drawingContext.fillStyle,this._cachedStrokeStyle=this.drawingContext.strokeStyle,d.Renderer.prototype.pop.call(this,a)},b.exports=d.Renderer2D},{"../image/filters":42,"./constants":18,"./main":24,"./p5.Renderer":27}],29:[function(a,b,c){"use strict";var d=a("./main"),e=a("./constants");a("./p5.Graphics"),a("./p5.Renderer2D"),a("../webgl/p5.RendererGL");var f="defaultCanvas0",g="p5Canvas";d.prototype.createCanvas=function(a,b,c){d._validateParameters("createCanvas",arguments);var h,i=c||e.P2D;if(i===e.WEBGL){if(h=document.getElementById(f)){h.parentNode.removeChild(h);var j=this._renderer;this._elements=this._elements.filter(function(a){return a!==j})}h=document.createElement("canvas"),h.id=f,h.classList.add(g)}else if(this._defaultGraphicsCreated)h=this.canvas;else{h=document.createElement("canvas");for(var k=0;document.getElementById("defaultCanvas"+k);)k++;f="defaultCanvas"+k,h.id=f,h.classList.add(g)}return this._setupDone||(h.dataset.hidden=!0,h.style.visibility="hidden"),this._userNode?this._userNode.appendChild(h):document.body.appendChild(h),i===e.WEBGL?(this._setProperty("_renderer",new d.RendererGL(h,this,!0)),this._elements.push(this._renderer)):this._defaultGraphicsCreated||(this._setProperty("_renderer",new d.Renderer2D(h,this,!0)),this._defaultGraphicsCreated=!0,this._elements.push(this._renderer)),this._renderer.resize(a,b),this._renderer._applyDefaults(),this._renderer},d.prototype.resizeCanvas=function(a,b,c){if(d._validateParameters("resizeCanvas",arguments),this._renderer){var e={};for(var f in this.drawingContext){var g=this.drawingContext[f];"object"!=typeof g&&"function"!=typeof g&&(e[f]=g)}this._renderer.resize(a,b),this.width=a,this.height=b;for(var h in e)try{this.drawingContext[h]=e[h]}catch(a){}c||this.redraw()}},d.prototype.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},d.prototype.createGraphics=function(a,b,c){return d._validateParameters("createGraphics",arguments),new d.Graphics(a,b,c,this)},d.prototype.blendMode=function(a){if(d._validateParameters("blendMode",arguments),a!==e.BLEND&&a!==e.DARKEST&&a!==e.LIGHTEST&&a!==e.DIFFERENCE&&a!==e.MULTIPLY&&a!==e.EXCLUSION&&a!==e.SCREEN&&a!==e.REPLACE&&a!==e.OVERLAY&&a!==e.HARD_LIGHT&&a!==e.SOFT_LIGHT&&a!==e.DODGE&&a!==e.BURN&&a!==e.ADD&&a!==e.NORMAL)throw new Error("Mode "+a+" not recognized.");this._renderer.blendMode(a)},b.exports=d},{"../webgl/p5.RendererGL":74,"./constants":18,"./main":24,"./p5.Graphics":26,"./p5.Renderer2D":28}],30:[function(a,b,c){"use strict";var d=a("../main"),e=a("../constants"),f=a("../helpers");a("../error_helpers"),d.prototype.arc=function(a,b,c,g,h,i,j,k){if(d._validateParameters("arc",arguments),!this._renderer._doStroke&&!this._renderer._doFill)return this;for(h=this._toRadians(h),i=this._toRadians(i);h<0;)h+=e.TWO_PI;for(;i<0;)i+=e.TWO_PI;void 0!==h&&void 0!==i&&(i.toFixed(10)===h.toFixed(10)||Math.abs(i-h)===e.TWO_PI?(h%=e.TWO_PI,i%=e.TWO_PI,h+=e.TWO_PI):Math.abs(i-h)>e.TWO_PI&&(h%=e.TWO_PI,i%=e.TWO_PI,i+=e.TWO_PI)),h<=e.HALF_PI?h=Math.atan(c/g*Math.tan(h)):h>e.HALF_PI&&h<=3*e.HALF_PI&&(h=Math.atan(c/g*Math.tan(h))+e.PI),i<=e.HALF_PI?i=Math.atan(c/g*Math.tan(i)):i>e.HALF_PI&&i<=3*e.HALF_PI&&(i=Math.atan(c/g*Math.tan(i))+e.PI),h>i&&(i+=e.TWO_PI),c=Math.abs(c),g=Math.abs(g);var l=f.modeAdjust(a,b,c,g,this._renderer._ellipseMode);return this._renderer.arc(l.x,l.y,l.w,l.h,h,i,j,k),this},d.prototype.ellipse=function(a,b,c,e,g){if(d._validateParameters("ellipse",arguments),!this._renderer._doStroke&&!this._renderer._doFill)return this;c<0&&(c=Math.abs(c)),void 0===e?e=c:e<0&&(e=Math.abs(e));var h=f.modeAdjust(a,b,c,e,this._renderer._ellipseMode);return this._renderer.ellipse([h.x,h.y,h.w,h.h,g]),this},d.prototype.line=function(){return d._validateParameters("line",arguments),this._renderer._doStroke&&this._renderer.line.apply(this._renderer,arguments),this},d.prototype.point=function(){return d._validateParameters("point",arguments),this._renderer._doStroke&&this._renderer.point.apply(this._renderer,arguments),this},d.prototype.quad=function(){return d._validateParameters("quad",arguments),(this._renderer._doStroke||this._renderer._doFill)&&this._renderer.quad.apply(this._renderer,arguments),this},d.prototype.rect=function(){if(d._validateParameters("rect",arguments),this._renderer._doStroke||this._renderer._doFill){for(var a=f.modeAdjust(arguments[0],arguments[1],arguments[2],arguments[3],this._renderer._rectMode),b=[a.x,a.y,a.w,a.h],c=4;c0))throw new Error("vertex() must be used once before calling quadraticVertex()");k=!0;for(var b=[],c=0;cn||Math.abs(this.accelerationY-this.pAccelerationY)>n||Math.abs(this.accelerationZ-this.pAccelerationZ)>n)&&a();var b=this.deviceTurned||window.deviceTurned;if("function"==typeof b){var c=this.rotationX+180,d=this.pRotationX+180,p=h+180;c-d>0&&c-d<270||c-d<-270?k="clockwise":(c-d<0||c-d>270)&&(k="counter-clockwise"),k!==e&&(p=c),Math.abs(c-p)>90&&Math.abs(c-p)<270&&(p=c,this._setProperty("turnAxis","X"),b()),e=k,h=p-180;var q=this.rotationY+180,r=this.pRotationY+180,s=i+180;q-r>0&&q-r<270||q-r<-270?l="clockwise":(q-r<0||q-this.pRotationY>270)&&(l="counter-clockwise"),l!==f&&(s=q),Math.abs(q-s)>90&&Math.abs(q-s)<270&&(s=q,this._setProperty("turnAxis","Y"),b()),f=l,i=s-180,this.rotationZ-this.pRotationZ>0&&this.rotationZ-this.pRotationZ<270||this.rotationZ-this.pRotationZ<-270?m="clockwise":(this.rotationZ-this.pRotationZ<0||this.rotationZ-this.pRotationZ>270)&&(m="counter-clockwise"),m!==g&&(j=this.rotationZ),Math.abs(this.rotationZ-j)>90&&Math.abs(this.rotationZ-j)<270&&(j=this.rotationZ,this._setProperty("turnAxis","Z"),b()),g=m,this._setProperty("turnAxis",void 0)}var t=this.deviceShaken||window.deviceShaken;if("function"==typeof t){var u,v;null!==this.pAccelerationX&&(u=Math.abs(this.accelerationX-this.pAccelerationX),v=Math.abs(this.accelerationY-this.pAccelerationY)),u+v>o&&t()}},b.exports=d},{"../core/main":24}],39:[function(a,b,c){"use strict";function d(){for(var a in f)if(f.hasOwnProperty(a)&&!0===f[a])return!0;return!1}var e=a("../core/main"),f={};e.prototype.isKeyPressed=!1,e.prototype.keyIsPressed=!1,e.prototype.key="",e.prototype.keyCode=0,e.prototype._onkeydown=function(a){if(!f[a.which]){this._setProperty("isKeyPressed",!0),this._setProperty("keyIsPressed",!0),this._setProperty("keyCode",a.which),f[a.which]=!0,this._setProperty("key",a.key||String.fromCharCode(a.which)||a.which);var b=this.keyPressed||window.keyPressed;if("function"==typeof b&&!a.charCode){!1===b(a)&&a.preventDefault()}}},e.prototype._onkeyup=function(a){var b=this.keyReleased||window.keyReleased;if(f[a.which]=!1,d()||(this._setProperty("isKeyPressed",!1),this._setProperty("keyIsPressed",!1)),this._setProperty("_lastKeyCodeTyped",null),this._setProperty("key",a.key||String.fromCharCode(a.which)||a.which),this._setProperty("keyCode",a.which),"function"==typeof b){!1===b(a)&&a.preventDefault()}},e.prototype._onkeypress=function(a){if(a.which!==this._lastKeyCodeTyped){this._setProperty("keyCode",a.which),this._setProperty("_lastKeyCodeTyped",a.which),this._setProperty("key",String.fromCharCode(a.which));var b=this.keyTyped||window.keyTyped;if("function"==typeof b){!1===b(a)&&a.preventDefault()}}},e.prototype._onblur=function(a){f={}},e.prototype.keyIsDown=function(a){return e._validateParameters("keyIsDown",arguments),f[a]},b.exports=e},{"../core/main":24}],40:[function(a,b,c){"use strict";function d(a,b,c,d){d&&!d.clientX&&(d.touches?d=d.touches[0]:d.changedTouches&&(d=d.changedTouches[0]));var e=a.getBoundingClientRect(),f=a.scrollWidth/b,g=a.scrollHeight/c;return{x:(d.clientX-e.left)/f,y:(d.clientY-e.top)/g,winX:d.clientX,winY:d.clientY,id:d.identifier}}var e=a("../core/main"),f=a("../core/constants");e.prototype._hasMouseInteracted=!1,e.prototype.mouseX=0,e.prototype.mouseY=0,e.prototype.pmouseX=0,e.prototype.pmouseY=0,e.prototype.winMouseX=0,e.prototype.winMouseY=0,e.prototype.pwinMouseX=0,e.prototype.pwinMouseY=0,e.prototype.mouseButton=0,e.prototype.mouseIsPressed=!1,e.prototype._updateNextMouseCoords=function(a){if(null!==this._curElement&&(!a.touches||a.touches.length>0)){var b=d(this._curElement.elt,this.width,this.height,a);this._setProperty("mouseX",b.x),this._setProperty("mouseY",b.y),this._setProperty("winMouseX",b.winX),this._setProperty("winMouseY",b.winY)}this._hasMouseInteracted||(this._updateMouseCoords(),this._setProperty("_hasMouseInteracted",!0))},e.prototype._updateMouseCoords=function(){this._setProperty("pmouseX",this.mouseX),this._setProperty("pmouseY",this.mouseY),this._setProperty("pwinMouseX",this.winMouseX),this._setProperty("pwinMouseY",this.winMouseY),this._setProperty("_pmouseWheelDeltaY",this._mouseWheelDeltaY)},e.prototype._setMouseButton=function(a){1===a.button?this._setProperty("mouseButton",f.CENTER):2===a.button?this._setProperty("mouseButton",f.RIGHT):this._setProperty("mouseButton",f.LEFT)},e.prototype._onmousemove=function(a){var b=this._isGlobal?window:this;this._updateNextMouseCoords(a),this.mouseIsPressed?"function"==typeof b.mouseDragged?!1===b.mouseDragged(a)&&a.preventDefault():"function"==typeof b.touchMoved&&!1===b.touchMoved(a)&&a.preventDefault():"function"==typeof b.mouseMoved&&!1===b.mouseMoved(a)&&a.preventDefault()},e.prototype._onmousedown=function(a){var b=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!0),this._setMouseButton(a),this._updateNextMouseCoords(a),"function"==typeof b.mousePressed?!1===b.mousePressed(a)&&a.preventDefault():"function"==typeof b.touchStarted&&!1===b.touchStarted(a)&&a.preventDefault()},e.prototype._onmouseup=function(a){var b=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!1), +"function"==typeof b.mouseReleased?!1===b.mouseReleased(a)&&a.preventDefault():"function"==typeof b.touchEnded&&!1===b.touchEnded(a)&&a.preventDefault()},e.prototype._ondragend=e.prototype._onmouseup,e.prototype._ondragover=e.prototype._onmousemove,e.prototype._onclick=function(a){var b=this._isGlobal?window:this;if("function"==typeof b.mouseClicked){!1===b.mouseClicked(a)&&a.preventDefault()}},e.prototype._ondblclick=function(a){var b=this._isGlobal?window:this;if("function"==typeof b.doubleClicked){!1===b.doubleClicked(a)&&a.preventDefault()}},e.prototype._mouseWheelDeltaY=0,e.prototype._pmouseWheelDeltaY=0,e.prototype._onwheel=function(a){var b=this._isGlobal?window:this;if(this._setProperty("_mouseWheelDeltaY",a.deltaY),"function"==typeof b.mouseWheel){a.delta=a.deltaY;!1===b.mouseWheel(a)&&a.preventDefault()}},b.exports=e},{"../core/constants":18,"../core/main":24}],41:[function(a,b,c){"use strict";function d(a,b,c,d,e){e=e||0;var f=a.getBoundingClientRect(),g=a.scrollWidth/b,h=a.scrollHeight/c,i=d.touches[e]||d.changedTouches[e];return{x:(i.clientX-f.left)/g,y:(i.clientY-f.top)/h,winX:i.clientX,winY:i.clientY,id:i.identifier}}var e=a("../core/main");e.prototype.touches=[],e.prototype._updateTouchCoords=function(a){if(null!==this._curElement){for(var b=[],c=0;c=e)break;x=0}for(F=x;F=e);F++){var H=m[t+C];G=j[F],s+=G[(-16777216&H)>>>24],p+=G[(16711680&H)>>16],q+=G[(65280&H)>>8],r+=G[255&H],o+=i[F],t++}u=C+D,y[u]=s/o,z[u]=p/o,A[u]=q/o,B[u]=r/o}C+=e}for(C=0,v=-g,w=v*e,E=0;E=k)break;x=0,u=v,t=D+w}for(F=x;F=k);F++)G=j[F],s+=G[y[t]],p+=G[z[t]],q+=G[A[t]],r+=G[B[t]],o+=i[F],u++,t+=e;m[D+C]=s/o<<24|p/o<<16|q/o<<8|r/o}C+=e,w+=e,v++}f._setPixels(c,m)}var f={};f._toPixels=function(a){return a instanceof ImageData?a.data:a.getContext("2d").getImageData(0,0,a.width,a.height).data},f._getARGB=function(a,b){var c=4*b;return a[c+3]<<24&4278190080|a[c]<<16&16711680|a[c+1]<<8&65280|255&a[c+2]},f._setPixels=function(a,b){for(var c=0,d=0,e=a.length;d>>16,a[c+1]=(65280&b[d])>>>8,a[c+2]=255&b[d],a[c+3]=(4278190080&b[d])>>>24},f._toImageData=function(a){return a instanceof ImageData?a:a.getContext("2d").getImageData(0,0,a.width,a.height)},f._createImageData=function(a,b){return f._tmpCanvas=document.createElement("canvas"),f._tmpCtx=f._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(a,b)},f.apply=function(a,b,c){var d=a.getContext("2d"),e=d.getImageData(0,0,a.width,a.height),f=b(e,c);f instanceof ImageData?d.putImageData(f,0,0,0,0,a.width,a.height):d.putImageData(e,0,0,0,0,a.width,a.height)},f.threshold=function(a,b){var c=f._toPixels(a);void 0===b&&(b=.5);for(var d=Math.floor(255*b),e=0;e=d?255:0,c[e]=c[e+1]=c[e+2]=g}},f.gray=function(a){for(var b=f._toPixels(a),c=0;c255)throw new Error("Level must be greater than 2 and less than 255 for posterize");for(var d=b-1,e=0;e>8)/d,c[e+1]=255*(h*b>>8)/d,c[e+2]=255*(i*b>>8)/d}},f.dilate=function(a){for(var b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t=f._toPixels(a),u=0,v=t.length?t.length/4:0,w=new Int32Array(v);u=c&&(h=u),j<0&&(j=0),k>=v&&(k=u),n=f._getARGB(t,j),m=f._getARGB(t,i),o=f._getARGB(t,k),l=f._getARGB(t,h),g=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),q=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),p=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),r=77*(n>>16&255)+151*(n>>8&255)+28*(255&n),s=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),q>g&&(e=m,g=q),p>g&&(e=l,g=p),r>g&&(e=n,g=r),s>g&&(e=o,g=s),w[u++]=e;f._setPixels(t,w)},f.erode=function(a){for(var b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t=f._toPixels(a),u=0,v=t.length?t.length/4:0,w=new Int32Array(v);u=c&&(h=u),j<0&&(j=0),k>=v&&(k=u),n=f._getARGB(t,j),m=f._getARGB(t,i),o=f._getARGB(t,k),l=f._getARGB(t,h),g=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),q=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),p=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),r=77*(n>>16&255)+151*(n>>8&255)+28*(255&n),s=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),q=1&&(b=e[0]),e.length>=2&&(c=e[1]),c=c||d.prototype._checkFileExtension(b,c)[1]||"png";var f;switch(c){default:f="image/png";break;case"jpeg":case"jpg":f="image/jpeg"}a.toBlob(function(a){d.prototype.downloadFile(a,b,c)},f)},d.prototype.saveFrames=function(a,b,c,f,g){d._validateParameters("saveFrames",arguments);var h=c||3;h=d.prototype.constrain(h,0,15),h*=1e3;var i=f||15;i=d.prototype.constrain(i,0,22);var j=0,k=d.prototype._makeFrame,l=this._curElement.elt,m=setInterval(function(){k(a+j,b,l),j++},1e3/i);setTimeout(function(){if(clearInterval(m),g)g(e);else for(var a=0;a0&&a0&&this.loadPixels(),this.setModified(!0),this._pixelsDirty=!0},d.Image.prototype.copy=function(){var a,b,c,e,f,g,h,i,j;if(9===arguments.length)a=arguments[0],b=arguments[1],c=arguments[2],e=arguments[3],f=arguments[4],g=arguments[5],h=arguments[6],i=arguments[7],j=arguments[8];else{if(8!==arguments.length)throw new Error("Signature not supported");a=this,b=arguments[0],c=arguments[1],e=arguments[2],f=arguments[3],g=arguments[4],h=arguments[5],i=arguments[6],j=arguments[7]}d.Renderer2D._copyHelper(this,a,b,c,e,f,g,h,i,j),this._pixelsDirty=!0},d.Image.prototype.mask=function(a){void 0===a&&(a=this);var b=this.drawingContext.globalCompositeOperation,c=1;a instanceof d.Renderer&&(c=a._pInst._pixelDensity);var e=[a,0,0,c*a.width,c*a.height,0,0,this.width,this.height];this.drawingContext.globalCompositeOperation="destination-in",d.Image.prototype.copy.apply(this,e),this.drawingContext.globalCompositeOperation=b,this.setModified(!0)},d.Image.prototype.filter=function(a,b){e.apply(this.canvas,e[a.toLowerCase()],b),this.setModified(!0)},d.Image.prototype.blend=function(){d.prototype.blend.apply(this,arguments),this.setModified(!0)},d.Image.prototype.setModified=function(a){this._modified=a},d.Image.prototype.isModified=function(){return this._modified},d.Image.prototype.save=function(a,b){d.prototype.saveCanvas(this.canvas,a,b)},b.exports=d.Image},{"../core/main":24,"./filters":42}],46:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("./filters");a("../color/p5.Color"),d.prototype.pixels=[],d.prototype.blend=function(){d._validateParameters("blend",arguments),this._renderer?this._renderer.blend.apply(this._renderer,arguments):d.Renderer2D.prototype.blend.apply(this,arguments)},d.prototype.copy=function(){d._validateParameters("copy",arguments),d.Renderer2D.prototype.copy.apply(this._renderer,arguments)},d.prototype.filter=function(a,b){d._validateParameters("filter",arguments),void 0!==this.canvas?e.apply(this.canvas,e[a.toLowerCase()],b):e.apply(this.elt,e[a.toLowerCase()],b)},d.prototype.get=function(a,b,c,d){return this._renderer.get(a,b,c,d)},d.prototype.loadPixels=function(){d._validateParameters("loadPixels",arguments),this._renderer.loadPixels()},d.prototype.set=function(a,b,c){this._renderer.set(a,b,c)},d.prototype.updatePixels=function(a,b,c,e){d._validateParameters("updatePixels",arguments),0!==this.pixels.length&&this._renderer.updatePixels(a,b,c,e)},b.exports=d},{"../color/p5.Color":16,"../core/main":24,"./filters":42}],47:[function(a,b,c){"use strict";function d(a,b){var c={};if(void 0===(b=b||[]))for(var d=0;d/g,">").replace(/"/g,""").replace(/'/g,"'")}function g(a,b){b&&!0!==b&&"true"!==b||(b=""),a||(a="untitled");var c="";return a&&a.indexOf(".")>-1&&(c=a.split(".").pop()),b&&c!==b&&(c=b,a=a+"."+c),[a,c]}function h(a){document.body.removeChild(a.target)}var i=a("../core/main");a("whatwg-fetch"),a("es6-promise").polyfill();var j=a("fetch-jsonp");a("../core/error_helpers"),i.prototype.loadJSON=function(){i._validateParameters("loadJSON",arguments);for(var a,b,c,d=arguments[0],e={},f="json",g=1;g0&&"function"==typeof arguments[l];l--)h++;var m=arguments.length-h,n=arguments[0];if(2===m&&"string"==typeof n&&"object"==typeof arguments[1])d=new Request(n,arguments[1]),b=arguments[2],c=arguments[3];else{for(var o,p="GET",q=1;q64e6&&i._friendlyFileLoadError(7,n),a){case"json":case"jsonp":return b.json();case"binary":return b.blob();case"arrayBuffer":return b.arrayBuffer();case"xml":return b.text().then(function(a){return e((new DOMParser).parseFromString(a,"text/xml").documentElement)});default:return b.text()}}),f.then(b||function(){}),f.catch(c||console.error),f},window.URL=window.URL||window.webkitURL,i.prototype._pWriters=[],i.prototype.createWriter=function(a,b){var c;for(var d in i.prototype._pWriters)if(i.prototype._pWriters[d].name===a)return c=new i.PrintWriter(a+this.millis(),b),i.prototype._pWriters.push(c),c;return c=new i.PrintWriter(a,b),i.prototype._pWriters.push(c),c},i.PrintWriter=function(a,b){var c=this;this.name=a,this.content="",this.write=function(a){this.content+=a},this.print=function(a){this.content+=a+"\n"},this.clear=function(){this.content=""},this.close=function(){var d=[];d.push(this.content),i.prototype.writeFile(d,a,b);for(var e in i.prototype._pWriters)i.prototype._pWriters[e].name===this.name&&i.prototype._pWriters.splice(e,1);c.clear(),c={}}},i.prototype.save=function(a,b,c){var d=arguments,e=this._curElement.elt;if(0===d.length)return void i.prototype.saveCanvas(e);if(d[0]instanceof i.Renderer||d[0]instanceof i.Graphics)return void i.prototype.saveCanvas(d[0].elt,d[1],d[2]);if(1===d.length&&"string"==typeof d[0])i.prototype.saveCanvas(e,d[0]);else{switch(g(d[1],d[2])[1]){case"json":return void i.prototype.saveJSON(d[0],d[1],d[2]);case"txt":return void i.prototype.saveStrings(d[0],d[1],d[2]);default:d[0]instanceof Array?i.prototype.saveStrings(d[0],d[1],d[2]):d[0]instanceof i.Table?i.prototype.saveTable(d[0],d[1],d[2]):d[0]instanceof i.Image?i.prototype.saveCanvas(d[0].canvas,d[1]):d[0]instanceof i.SoundFile&&i.prototype.saveSound(d[0],d[1],d[2],d[3])}}},i.prototype.saveJSON=function(a,b,c){i._validateParameters("saveJSON",arguments);var d;d=c?JSON.stringify(a):JSON.stringify(a,void 0,2),this.saveStrings(d.split("\n"),b,"json")},i.prototype.saveJSONObject=i.prototype.saveJSON,i.prototype.saveJSONArray=i.prototype.saveJSON,i.prototype.saveStrings=function(a,b,c){i._validateParameters("saveStrings",arguments);for(var d=c||"txt",e=this.createWriter(b,d),f=0;f"),e.print("");var m=' "),e.print(""),e.print(" "),"0"!==g[0]){e.print(" ");for(var n=0;n"+o),e.print(" ")}e.print(" ")}for(var p=0;p");for(var q=0;q"+s),e.print(" ")}e.print(" ")}e.print("
"),e.print(""),e.print("")}e.close(),e.clear()},i.prototype.writeFile=function(a,b,c){var d="application/octet-stream";i.prototype._isSafari()&&(d="text/plain");var e=new Blob(a,{type:d});i.prototype.downloadFile(e,b,c)},i.prototype.downloadFile=function(b,c,d){var e=g(c,d),f=e[0];if(b instanceof Blob){return void a("file-saver").saveAs(b,f)}var j=document.createElement("a");if(j.href=b,j.download=f,j.onclick=function(a){h(a),a.stopPropagation()},j.style.display="none",document.body.appendChild(j),i.prototype._isSafari()){var k="Hello, Safari user! To download this file...\n";k+="1. Go to File --\x3e Save As.\n",k+='2. Choose "Page Source" as the Format.\n',k+='3. Name it with this extension: ."'+e[1]+'"',alert(k)}j.click()},i.prototype._checkFileExtension=g,i.prototype._isSafari=function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0},b.exports=i},{"../core/error_helpers":20,"../core/main":24,"es6-promise":4,"fetch-jsonp":5,"file-saver":6,"whatwg-fetch":12}],48:[function(a,b,c){"use strict";var d=a("../core/main");d.Table=function(a){this.columns=[],this.rows=[]},d.Table.prototype.addRow=function(a){var b=a||new d.TableRow;if(void 0===b.arr||void 0===b.obj)throw new Error("invalid TableRow: "+b);return b.table=this,this.rows.push(b),b},d.Table.prototype.removeRow=function(a){this.rows[a].table=null;var b=this.rows.splice(a+1,this.rows.length);this.rows.pop(),this.rows=this.rows.concat(b)},d.Table.prototype.getRow=function(a){return this.rows[a]},d.Table.prototype.getRows=function(){return this.rows},d.Table.prototype.findRow=function(a,b){if("string"==typeof b){for(var c=0;c=0))throw new Error('This table has no column named "'+a+'"');c=b[a],d[c]=b}else d[e]=this.rows[e].obj;return d},d.Table.prototype.getArray=function(){for(var a=[],b=0;b=0))throw new Error('This table has no column named "'+a+'"');this.obj[a]=b,this.arr[c]=b}else{if(!(a0},d.XML.prototype.listChildren=function(){return this.children.map(function(a){return a.name})},d.XML.prototype.getChildren=function(a){return a?this.children.filter(function(b){return b.name===a}):this.children},d.XML.prototype.getChild=function(a){if("string"!=typeof a)return this.children[a];for(var b=0;bf&&(f=h),e[g]=h}0===f&&(f=1);for(var i=0,j=0,k=0;k=1&&(s++,v--),w>=1&&(t++,w--),x>=1&&(u++,x--)}return y},e.prototype.noiseDetail=function(a,b){a>0&&(k=a),b>0&&(l=b)},e.prototype.noiseSeed=function(a){var b=function(){var a,b,c=4294967296,d=1664525,e=1013904223;return{setSeed:function(d){b=a=(null==d?Math.random()*c:d)>>>0},getSeed:function(){return a},rand:function(){return(b=(d*b+e)%c)/c}}}();b.setSeed(a),d=new Array(j+1);for(var c=0;ca*a&&this.div(Math.sqrt(b)).mult(a),this},d.Vector.prototype.setMag=function(a){return this.normalize().mult(a)},d.Vector.prototype.heading=function(){var a=Math.atan2(this.y,this.x);return this.p5?this.p5._fromRadians(a):a},d.Vector.prototype.rotate=function(a){var b=this.heading()+a;this.p5&&(b=this.p5._toRadians(b));var c=this.mag();return this.x=Math.cos(b)*c,this.y=Math.sin(b)*c,this},d.Vector.prototype.angleBetween=function(a){var b=this.dot(a)/(this.mag()*a.mag()),c=Math.acos(Math.min(1,Math.max(-1,b)));return this.p5?this.p5._fromRadians(c):c},d.Vector.prototype.lerp=function(a,b,c,e){return a instanceof d.Vector?this.lerp(a.x,a.y,a.z,b):(this.x+=(a-this.x)*e||0,this.y+=(b-this.y)*e||0,this.z+=(c-this.z)*e||0,this)},d.Vector.prototype.array=function(){return[this.x||0,this.y||0,this.z||0]},d.Vector.prototype.equals=function(a,b,c){var e,f,g;return a instanceof d.Vector?(e=a.x||0,f=a.y||0,g=a.z||0):a instanceof Array?(e=a[0]||0,f=a[1]||0,g=a[2]||0):(e=a||0,f=b||0,g=c||0),this.x===e&&this.y===f&&this.z===g},d.Vector.fromAngle=function(a,b){return void 0===b&&(b=1),new d.Vector(b*Math.cos(a),b*Math.sin(a),0)},d.Vector.fromAngles=function(a,b,c){void 0===c&&(c=1);var e=Math.cos(b),f=Math.sin(b),g=Math.cos(a),h=Math.sin(a);return new d.Vector(c*h*f,-c*g,c*h*e)},d.Vector.random2D=function(){return this.fromAngle(Math.random()*e.TWO_PI)},d.Vector.random3D=function(){var a=Math.random()*e.TWO_PI,b=2*Math.random()-1,c=Math.sqrt(1-b*b),f=c*Math.cos(a),g=c*Math.sin(a);return new d.Vector(f,g,b)},d.Vector.add=function(a,b,c){return c?c.set(a):c=a.copy(),c.add(b),c},d.Vector.sub=function(a,b,c){return c?c.set(a):c=a.copy(),c.sub(b),c},d.Vector.mult=function(a,b,c){return c?c.set(a):c=a.copy(),c.mult(b),c},d.Vector.div=function(a,b,c){return c?c.set(a):c=a.copy(),c.div(b),c},d.Vector.dot=function(a,b){return a.dot(b)},d.Vector.cross=function(a,b){return a.cross(b)},d.Vector.dist=function(a,b){return a.dist(b)},d.Vector.lerp=function(a,b,c,d){return d?d.set(a):d=a.copy(),d.lerp(b,c),d},d.Vector.mag=function(a){var b=a.x,c=a.y,d=a.z,e=b*b+c*c+d*d;return Math.sqrt(e)},b.exports=d.Vector},{"../core/constants":18,"../core/main":24}],55:[function(a,b,c){"use strict";var d=a("../core/main"),e=!1,f=!1,g=0,h=function(){var a,b,c=4294967296,d=1664525,e=1013904223;return{setSeed:function(d){b=a=(null==d?Math.random()*c:d)>>>0},getSeed:function(){return a},rand:function(){return(b=(d*b+e)%c)/c}}}();d.prototype.randomSeed=function(a){h.setSeed(a),e=!0,f=!1},d.prototype.random=function(a,b){var c;if(c=e?h.rand():Math.random(),void 0===a)return c;if(void 0===b)return a instanceof Array?a[Math.floor(c*a.length)]:c*a;if(a>b){var d=a;a=b,b=d}return c*(b-a)+a},d.prototype.randomGaussian=function(a,b){var c,d,e,h;if(f)c=g,f=!1;else{do{d=this.random(2)-1,e=this.random(2)-1,h=d*d+e*e}while(h>=1);h=Math.sqrt(-2*Math.log(h)/h),c=d*h,g=e*h,f=!0}var i=a||0;return c*(b||1)+i},b.exports=d},{"../core/main":24}],56:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants");d.prototype._angleMode=e.RADIANS,d.prototype.acos=function(a){return this._fromRadians(Math.acos(a))},d.prototype.asin=function(a){return this._fromRadians(Math.asin(a))},d.prototype.atan=function(a){return this._fromRadians(Math.atan(a))},d.prototype.atan2=function(a,b){return this._fromRadians(Math.atan2(a,b))},d.prototype.cos=function(a){return Math.cos(this._toRadians(a))},d.prototype.sin=function(a){return Math.sin(this._toRadians(a))},d.prototype.tan=function(a){return Math.tan(this._toRadians(a))},d.prototype.degrees=function(a){return a*e.RAD_TO_DEG},d.prototype.radians=function(a){return a*e.DEG_TO_RAD},d.prototype.angleMode=function(a){a!==e.DEGREES&&a!==e.RADIANS||(this._angleMode=a)},d.prototype._toRadians=function(a){return this._angleMode===e.DEGREES?a*e.DEG_TO_RAD:a},d.prototype._toDegrees=function(a){return this._angleMode===e.RADIANS?a*e.RAD_TO_DEG:a},d.prototype._fromRadians=function(a){return this._angleMode===e.DEGREES?a*e.RAD_TO_DEG:a},b.exports=d},{"../core/constants":18,"../core/main":24}],57:[function(a,b,c){"use strict";var d=a("../core/main");d.prototype.textAlign=function(a,b){return d._validateParameters("textAlign",arguments),this._renderer.textAlign.apply(this._renderer,arguments)},d.prototype.textLeading=function(a){return d._validateParameters("textLeading",arguments),this._renderer.textLeading.apply(this._renderer,arguments)},d.prototype.textSize=function(a){return d._validateParameters("textSize",arguments),this._renderer.textSize.apply(this._renderer,arguments)},d.prototype.textStyle=function(a){return d._validateParameters("textStyle",arguments),this._renderer.textStyle.apply(this._renderer,arguments)},d.prototype.textWidth=function(a){return d._validateParameters("textWidth",arguments),0===a.length?0:this._renderer.textWidth.apply(this._renderer,arguments)},d.prototype.textAscent=function(){return d._validateParameters("textAscent",arguments),this._renderer.textAscent()},d.prototype.textDescent=function(){return d._validateParameters("textDescent",arguments),this._renderer.textDescent()},d.prototype._updateTextMetrics=function(){return this._renderer._updateTextMetrics()},b.exports=d},{"../core/main":24}],58:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants"),f=a("opentype.js");a("../core/error_helpers"),d.prototype.loadFont=function(a,b,c){d._validateParameters("loadFont",arguments);var e=new d.Font(this),g=this;return f.load(a,function(f,h){if(f)return void 0!==c?c(f):(d._friendlyFileLoadError(4,a),void console.error(f,a));e.font=h,void 0!==b&&b(e),g._decrementPreload();var i,j,k=["ttf","otf","woff","woff2"],l=a.split("\\").pop().split("/").pop(),m=l.lastIndexOf("."),n=m<1?null:l.substr(m+1);k.indexOf(n)>-1&&(i=l.substr(0,m),j=document.createElement("style"),j.appendChild(document.createTextNode("\n@font-face {\nfont-family: "+i+";\nsrc: url("+a+");\n}\n")),document.head.appendChild(j))}),e},d.prototype.text=function(a,b,c,e,f){return d._validateParameters("text",arguments),this._renderer._doFill||this._renderer._doStroke?this._renderer.text.apply(this._renderer,arguments):this},d.prototype.textFont=function(a,b){if(d._validateParameters("textFont",arguments),arguments.length){if(!a)throw new Error("null font passed to textFont");return this._renderer._setProperty("_textFont",a),b&&(this._renderer._setProperty("_textSize",b),this._renderer._setProperty("_textLeading",b*e._DEFAULT_LEADMULT)),this._renderer._applyTextProperties()}return this._renderer._textFont},b.exports=d},{"../core/constants":18,"../core/error_helpers":20,"../core/main":24,"opentype.js":10}],59:[function(a,b,c){"use strict";function d(a,b){for(var c=h(b,{sampleFactor:.1,simplifyThreshold:0}),d=n(a,0,1),f=d/(d*c.sampleFactor),g=[],i=0;i3&&d>=0;--d)j(i(a,d-1),i(a,d),i(a,d+1),b)&&(a.splice(d%a.length,1),c++);return c}function f(a){for(var b,c=[],d=0;ds||rb&&!c)return h=m(d,e,f[1],f[2],f[3],f[4],f[5],f[6],b-k),{x:h.x,y:h.y,alpha:h.alpha};k+=g,d=+f[5],e=+f[6]}i+=f.shift()+f}return j.end=i,h=c?k:l(d,e,f[0],f[1],f[2],f[3],f[4],f[5],1),h.alpha&&(h={x:h.x,y:h.y,alpha:h.alpha}),h}function o(a){var b=[],c=0,d=0,e=0,f=0,g=0;if(!a)return b;"M"===a[0][0]&&(c=+a[0][1],d=+a[0][2],e=c,f=d,g++,b[0]=["M",c,d]);for(var h,i,j,k=3===a.length&&"M"===a[0][0]&&"R"===a[1][0].toUpperCase()&&"Z"===a[2][0].toUpperCase(),l=g,m=a.length;l7){a[b].shift();for(var f=a[b];f.length;)h[b]="A",e&&(i[b]="A"),a.splice(b++,0,["C"].concat(f.splice(0,6)));a.splice(b,1),c=Math.max(d.length,e&&e.length||0)}},l=function(a,b,f,g,h){a&&b&&"M"===a[h][0]&&"M"!==b[h][0]&&(b.splice(h,0,["M",g.x,g.y]),f.bx=0,f.by=0,f.x=a[h][1],f.y=a[h][2],c=Math.max(d.length,e&&e.length||0))},m="",n="";c=Math.max(d.length,e&&e.length||0);for(var p=0;p1&&(x=Math.sqrt(x),c*=x,d*=x);var y=c*c,z=d*d,A=(f===g?-1:1)*Math.sqrt(Math.abs((y*z-y*w*w-z*v*v)/(y*w*w+z*v*v)));m=A*c*w/d+(a+h)/2,n=A*-d*v/c+(b+i)/2,k=Math.asin(((b-n)/d).toFixed(9)),l=Math.asin(((i-n)/d).toFixed(9)),k=al&&(k-=2*p),!g&&l>k&&(l-=2*p)}var B=l-k;if(Math.abs(B)>r){var C=l,D=h,E=i;l=k+r*(g&&l>k?1:-1),h=m+c*Math.cos(l),i=n+d*Math.sin(l),t=q(h,i,c,d,e,0,g,D,E,[l,C,m,n])}B=l-k;var F=Math.cos(k),G=Math.sin(k),H=Math.cos(l),I=Math.sin(l),J=Math.tan(B/4),K=4/3*c*J,L=4/3*d*J,M=[a,b],N=[a+K*G,b-L*F],O=[h+K*I,i-L*H],P=[h,i];if(N[0]=2*M[0]-N[0],N[1]=2*M[1]-N[1],j)return[N,O,P].concat(t);t=[N,O,P].concat(t).join().split(",");for(var Q=[],R=0,S=t.length;Rd;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4===d?f[3]={x:+a[0],y:+a[1]}:e-2===d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4===d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function s(a,b,c,d){return[a,b,c,d,c,d]}function t(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function u(a,b,c,d,e,f,g,h,i){null==i&&(i=1),i=i>1?1:i<0?0:i;for(var j=i/2,k=12,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],m=0,n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0;on;)l/=2,m+=(j=0;--b){var c=arguments[b];a+=c===Object(c)?JSON.stringify(c):c}return a}var y=a("../core/main"),z=a("../core/constants");y.Font=function(a){this.parent=a,this.cache={},this.font=void 0},y.Font.prototype.list=function(){throw new Error("not yet implemented")},y.Font.prototype.textBounds=function(a,b,c,d,e){b=void 0!==b?b:0,c=void 0!==c?c:0,d=d||this.parent._renderer._textSize;var f=e&&e.renderer&&e.renderer._pInst||this.parent,g=f._renderer,h=g._textAlign||z.LEFT,i=g._textBaseline||z.BASELINE,j=x("textBounds",a,b,c,d,h,i),k=this.cache[j];if(!k){var l,m,n,o,p,q=[],r=[],s=this._scale(d);this.font.forEachGlyph(a,b,c,d,e,function(a,b,c,d){var e=a.getMetrics();q.push(b+e.xMin*s),q.push(b+e.xMax*s),r.push(c+-e.yMin*s),r.push(c+-e.yMax*s)}),l=Math.min.apply(null,q),m=Math.min.apply(null,r),n=Math.max.apply(null,q),o=Math.max.apply(null,r),k={x:l,y:m,h:o-m,w:n-l,advance:l-b},p=this._handleAlignment(g,a,k.x,k.y,k.w+k.advance),k.x=p.x,k.y=p.y,this.cache[x("textBounds",a,b,c,d,h,i)]=k}return k},y.Font.prototype.textToPoints=function(a,b,c,e,g){function h(b){return k[b].name&&"space"===k[b].name||a.length===k.length&&" "===a[b]||k[b].index&&3===k[b].index}var i=0,j=[],k=this._getGlyphs(a);e=e||this.parent._renderer._textSize;for(var l=0;l2?a=this._getPath(a,b,c,d):"object"==typeof b&&(d=b),d&&"number"==typeof d.decimals&&(e=d.decimals),a.toPathData(e)},y.Font.prototype._getSVG=function(a,b,c,d){var e=3;return"string"==typeof a&&arguments.length>2?a=this._getPath(a,b,c,d):"object"==typeof b&&(d=b),d&&("number"==typeof d.decimals&&(e=d.decimals),"number"==typeof d.strokeWidth&&(a.strokeWidth=d.strokeWidth),void 0!==d.fill&&(a.fill=d.fill),void 0!==d.stroke&&(a.stroke=d.stroke)),a.toSVG(e)},y.Font.prototype._renderPath=function(a,b,c,d){var e,f=d&&d.renderer||this.parent._renderer,g=f.drawingContext;e="object"==typeof a&&a.commands?a.commands:this._getPath(a,b,c,d).commands,g.beginPath();for(var h=0;h1;)d=Math.random()*f|0,e=a[--f],a[f]=a[d],a[d]=e;return a},d.prototype.sort=function(a,b){var c=b?a.slice(0,Math.min(b,a.length)):a,d=b?a.slice(Math.min(b,a.length)):[];return c="string"==typeof c[0]?c.sort():c.sort(function(a,b){return a-b}),c.concat(d)},d.prototype.splice=function(a,b,c){return Array.prototype.splice.apply(a,[c,0].concat(b)),a},d.prototype.subset=function(a,b,c){return void 0!==c?a.slice(b,b+c):a.slice(b,a.length)},b.exports=d},{"../core/main":24}],61:[function(a,b,c){"use strict";var d=a("../core/main");d.prototype.float=function(a){return a instanceof Array?a.map(parseFloat):parseFloat(a)},d.prototype.int=function(a,b){return b=b||10,"string"==typeof a?parseInt(a,b):"number"==typeof a?0|a:"boolean"==typeof a?a?1:0:a instanceof Array?a.map(function(a){return d.prototype.int(a,b)}):void 0},d.prototype.str=function(a){return a instanceof Array?a.map(d.prototype.str):String(a)},d.prototype.boolean=function(a){return"number"==typeof a?0!==a:"string"==typeof a?"true"===a.toLowerCase():"boolean"==typeof a?a:a instanceof Array?a.map(d.prototype.boolean):void 0},d.prototype.byte=function(a){var b=d.prototype.int(a,10);return"number"==typeof b?(b+128)%256-128:b instanceof Array?b.map(d.prototype.byte):void 0},d.prototype.char=function(a){return"number"!=typeof a||isNaN(a)?a instanceof Array?a.map(d.prototype.char):"string"==typeof a?d.prototype.char(parseInt(a,10)):void 0:String.fromCharCode(a)},d.prototype.unchar=function(a){return"string"==typeof a&&1===a.length?a.charCodeAt(0):a instanceof Array?a.map(d.prototype.unchar):void 0},d.prototype.hex=function(a,b){if(b=void 0===b||null===b?b=8:b,a instanceof Array)return a.map(function(a){return d.prototype.hex(a,b)});if("number"==typeof a){a<0&&(a=4294967295+a+1);for(var c=Number(a).toString(16).toUpperCase();c.length=b&&(c=c.substring(c.length-b,c.length)),c}},d.prototype.unhex=function(a){return a instanceof Array?a.map(d.prototype.unhex):parseInt("0x"+a,16)},b.exports=d},{"../core/main":24}],62:[function(a,b,c){"use strict";function d(a,b,c){var d=a<0,e=d?a.toString().substring(1):a.toString(),f=e.indexOf("."),g=-1!==f?e.substring(0,f):e,h=-1!==f?e.substring(f+1):"",i=d?"-":"";if(void 0!==c){var j="";(-1!==f||c-h.length>0)&&(j="."),h.length>c&&(h=h.substring(0,c));for(var k=0;kd.length){d+=-1===c?".":"";for(var f=b-d.length+1,g=0;g0?"+"+a.toString():a.toString()}function g(a){return parseFloat(a)>0?" "+a.toString():a.toString()}var h=a("../core/main");a("../core/error_helpers"),h.prototype.join=function(a,b){return h._validateParameters("join",arguments),a.join(b)},h.prototype.match=function(a,b){return h._validateParameters("match",arguments),a.match(b)},h.prototype.matchAll=function(a,b){h._validateParameters("matchAll",arguments);for(var c=new RegExp(b,"g"),d=c.exec(a),e=[];null!==d;)e.push(d),d=c.exec(a);return e},h.prototype.nf=function(a,b,c){return h._validateParameters("nf",arguments),a instanceof Array?a.map(function(a){return d(a,b,c)}):"[object Arguments]"===Object.prototype.toString.call(a)?3===a.length?this.nf(a[0],a[1],a[2]):2===a.length?this.nf(a[0],a[1]):this.nf(a[0]):d(a,b,c)},h.prototype.nfc=function(a,b){return h._validateParameters("nfc",arguments),a instanceof Array?a.map(function(a){return e(a,b)}):e(a,b)},h.prototype.nfp=function(){h._validateParameters("nfp",arguments);var a=h.prototype.nf.apply(this,arguments);return a instanceof Array?a.map(f):f(a)},h.prototype.nfs=function(){h._validateParameters("nfs",arguments);var a=h.prototype.nf.apply(this,arguments);return a instanceof Array?a.map(g):g(a)},h.prototype.split=function(a,b){return h._validateParameters("split",arguments),a.split(b)},h.prototype.splitTokens=function(a,b){h._validateParameters("splitTokens",arguments);var c;if(void 0!==b){var d=b,e=/\]/g.exec(d),f=/\[/g.exec(d);f&&e?(d=d.slice(0,e.index)+d.slice(e.index+1),f=/\[/g.exec(d),d=d.slice(0,f.index)+d.slice(f.index+1),c=new RegExp("[\\["+d+"\\]]","g")):e?(d=d.slice(0,e.index)+d.slice(e.index+1),c=new RegExp("["+d+"\\]]","g")):f?(d=d.slice(0,f.index)+d.slice(f.index+1),c=new RegExp("["+d+"\\[]","g")):c=new RegExp("["+d+"]","g")}else c=/\s/g;return a.split(c).filter(function(a){return a})},h.prototype.trim=function(a){return h._validateParameters("trim",arguments),a instanceof Array?a.map(this.trim):a.trim()},b.exports=h},{"../core/error_helpers":20,"../core/main":24}],63:[function(a,b,c){"use strict";var d=a("../core/main");d.prototype.day=function(){return(new Date).getDate()},d.prototype.hour=function(){return(new Date).getHours()},d.prototype.minute=function(){return(new Date).getMinutes()},d.prototype.millis=function(){return window.performance.now()},d.prototype.month=function(){return(new Date).getMonth()+1},d.prototype.second=function(){return(new Date).getSeconds()},d.prototype.year=function(){return(new Date).getFullYear()},b.exports=d},{"../core/main":24}],64:[function(a,b,c){"use strict";var d=a("../core/main");a("./p5.Geometry");var e=a("../core/constants");d.prototype.plane=function(a,b,c,e){this._assert3d("plane"),d._validateParameters("plane",arguments),void 0===a&&(a=50),void 0===b&&(b=a),void 0===c&&(c=1),void 0===e&&(e=1);var f="plane|"+c+"|"+e;if(!this._renderer.geometryInHash(f)){var g=function(){for(var a,b,c,e=0;e<=this.detailY;e++){b=e/this.detailY;for(var f=0;f<=this.detailX;f++)a=f/this.detailX,c=new d.Vector(a-.5,b-.5,0),this.vertices.push(c),this.uvs.push(a,b)}},h=new d.Geometry(c,e,g);h.computeFaces().computeNormals(),c<=1&&e<=1?h._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on plane objects with more than 1 detailX or 1 detailY"),this._renderer.createBuffers(f,h)}return this._renderer.drawBuffersScaled(f,a,b,1),this},d.prototype.box=function(a,b,c,e,f){this._assert3d("box"),d._validateParameters("box",arguments),void 0===a&&(a=50),void 0===b&&(b=a),void 0===c&&(c=b);var g=this._renderer.attributes&&this._renderer.attributes.perPixelLighting;void 0===e&&(e=g?1:4),void 0===f&&(f=g?1:4);var h="box|"+e+"|"+f;if(!this._renderer.geometryInHash(h)){var i=function(){var a=[[0,4,2,6],[1,3,5,7],[0,1,4,5],[2,6,3,7],[0,2,1,3],[4,5,6,7]];this.strokeIndices=[[0,1],[1,3],[3,2],[6,7],[8,9],[9,11],[14,15],[16,17],[17,19],[18,19],[20,21],[22,23]];for(var b=0;bf?(t=c,s=1,r=b):r=a+(b-a)*s,-2!==i&&i!==f+2||(r=0),t-=c/2,p[i]=0===r?1:e,j=0;jf?0:Math.sin(2*u*Math.PI)*Math.cos(q),i<0?-1:i>f?1:Math.sin(q),i<0||i>f?0:Math.cos(2*u*Math.PI)*Math.cos(q))),this.uvs.push(u,s)}}var v=0;if(g){for(k=0;k=e.TWO_PI?(b="ellipse",c=b+"|"+m+"|"):(b="arc",c=b+"|"+j+"|"+k+"|"+l+"|"+m+"|"),!this.geometryInHash(c)){var n=function(){if(this.strokeIndices=[],j.toFixed(10)!==k.toFixed(10)){l!==e.PIE&&void 0!==l||(this.vertices.push(new d.Vector(.5,.5,0)),this.uvs.push([.5,.5]));for(var a=0;a<=m;a++){var b=a/m,c=(k-j)*b+j,f=.5+Math.cos(c)/2,g=.5+Math.sin(c)/2;this.vertices.push(new d.Vector(f,g,0)),this.uvs.push([f,g]),a0&&i>0&&(this.strokeIndices=[[0,h],[h,(h+1)*(i+1)-1],[(h+1)*(i+1)-1,(h+1)*i],[(h+1)*i,0]])},l=new d.Geometry(h,i,k);l.computeFaces().computeNormals()._makeTriangleEdges()._edgesToVertices(),this.createBuffers(j,l)}var m=this.uMVMatrix.copy();try{this.uMVMatrix.translate([c,e,0]),this.uMVMatrix.scale(f,g,1),this.drawBuffers(j)}finally{this.uMVMatrix=m}return this},d.RendererGL.prototype.quad=function(a,b,c,e,f,g,h,i){var j="quad|"+a+"|"+b+"|"+c+"|"+e+"|"+f+"|"+g+"|"+h+"|"+i;if(!this.geometryInHash(j)){var k=function(){this.vertices.push(new d.Vector(a,b,0)),this.vertices.push(new d.Vector(c,e,0)),this.vertices.push(new d.Vector(f,g,0)),this.vertices.push(new d.Vector(h,i,0)),this.uvs.push(0,0,1,0,1,1,0,1),this.strokeIndices=[[0,1],[1,2],[2,3],[3,0]]},l=new d.Geometry(2,2,k);l.computeNormals()._makeTriangleEdges()._edgesToVertices(),l.faces=[[0,1,2],[2,3,0]],this.createBuffers(j,l)}return this.drawBuffers(j),this},d.RendererGL.prototype.bezier=function(a,b,c,d,e,f,g,h,i,j,k,l){8===arguments.length&&(j=g,k=h,g=e,h=d,d=c,e=d,c=f=i=l=0);var m=this._pInst._bezierDetail||20;this.beginShape();for(var n=0;n<=m;n++){var o=Math.pow(1-n/m,3),p=n/m*3*Math.pow(1-n/m,2),q=3*Math.pow(n/m,2)*(1-n/m),r=Math.pow(n/m,3);this.vertex(a*o+d*p+g*q+j*r,b*o+e*p+h*q+k*r,c*o+f*p+i*q+l*r)}return this.endShape(),this},d.RendererGL.prototype.curve=function(a,b,c,d,e,f,g,h,i,j,k,l){8===arguments.length&&(j=g,k=h,g=e,h=d,d=c,e=d,c=f=i=l=0);var m=this._pInst._curveDetail;this.beginShape();for(var n=0;n<=m;n++){var o=.5*Math.pow(n/m,3),p=.5*Math.pow(n/m,2),q=n/m*.5,r=.5,s=o*(3*d-a-3*g+j)+p*(2*a-5*d+4*g-j)+q*(-a+g)+r*(2*d),t=o*(3*e-b-3*h+k)+p*(2*b-5*e+4*h-k)+q*(-b+h)+r*(2*e),u=o*(3*f-c-3*i+l)+p*(2*c-5*f+4*i-l)+q*(-c+i)+r*(2*f);this.vertex(s,t,u)}return this.endShape(),this},d.RendererGL.prototype.line=function(){return 6===arguments.length?(this.beginShape(),this.vertex(arguments[0],arguments[1],arguments[2]),this.vertex(arguments[3],arguments[4],arguments[5]),this.endShape()):4===arguments.length&&(this.beginShape(),this.vertex(arguments[0],arguments[1],0),this.vertex(arguments[2],arguments[3],0),this.endShape()),this},d.RendererGL.prototype.bezierVertex=function(){if(0===this.immediateMode._bezierVertex.length)throw Error("vertex() must be used once before calling bezierVertex()");var a,b,c,d,e,f=[],g=[],h=[],i=arguments.length;if(a=0,0===this._lookUpTableBezier.length||this._lutBezierDetail!==this._pInst._curveDetail){this._lookUpTableBezier=[],this._lutBezierDetail=this._pInst._curveDetail;for(var j=1/this._lutBezierDetail,k=0,l=1,m=0;k<1;){if(a=parseFloat(k.toFixed(6)),this._lookUpTableBezier[m]=this._bezierCoefficients(a),l.toFixed(6)===j.toFixed(6)){a=parseFloat(l.toFixed(6))+parseFloat(k.toFixed(6)),++m,this._lookUpTableBezier[m]=this._bezierCoefficients(a);break}k+=j,l-=j,++m}}var n=this._lookUpTableBezier.length;if(6===i){for(this.isBezier=!0,f=[this.immediateMode._bezierVertex[0],arguments[0],arguments[2],arguments[4]],g=[this.immediateMode._bezierVertex[1],arguments[1],arguments[3],arguments[5]],e=0;e0&&this.mouseY0){var c=this._renderer._curCamera;void 0===a&&(a=1),void 0===b&&(b=a),!0!==this.contextMenuDisabled&&(this.canvas.oncontextmenu=function(){return!1},this._setProperty("contextMenuDisabled",!0)),!0!==this.wheelDefaultDisabled&&(this.canvas.onwheel=function(){return!1},this._setProperty("wheelDefaultDisabled",!0));var e=this.height0?this._renderer._curCamera._orbit(0,0,.5*e):this._renderer._curCamera._orbit(0,0,-.5*e)),this.mouseIsPressed)if(this.mouseButton===this.LEFT){var f=-a*(this.mouseX-this.pmouseX)/e,g=b*(this.mouseY-this.pmouseY)/e;this._renderer._curCamera._orbit(f,g,0)}else if(this.mouseButton===this.RIGHT){var h=c._getLocalAxes(),i=Math.sqrt(h.x[0]*h.x[0]+h.x[2]*h.x[2]);0!==i&&(h.x[0]/=i,h.x[2]/=i);var j=Math.sqrt(h.y[0]*h.y[0]+h.y[2]*h.y[2]);0!==j&&(h.y[0]/=j,h.y[2]/=j);var k=-1*a*(this.mouseX-this.pmouseX),l=-1*b*(this.mouseY-this.pmouseY);c.setPosition(c.eyeX+k*h.x[0]+l*h.z[0],c.eyeY,c.eyeZ+k*h.x[2]+l*h.z[2])}return this}},d.prototype.debugMode=function(){this._assert3d("debugMode"),d._validateParameters("debugMode",arguments);for(var a=this._registeredMethods.post.length-1;a>=0;a--)this._registeredMethods.post[a].toString()!==this._grid().toString()&&this._registeredMethods.post[a].toString()!==this._axesIcon().toString()||this._registeredMethods.post.splice(a,1);arguments[0]===e.GRID?this.registerMethod("post",this._grid.call(this,arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])):arguments[0]===e.AXES?this.registerMethod("post",this._axesIcon.call(this,arguments[1],arguments[2],arguments[3],arguments[4])):(this.registerMethod("post",this._grid.call(this,arguments[0],arguments[1],arguments[2],arguments[3],arguments[4])),this.registerMethod("post",this._axesIcon.call(this,arguments[5],arguments[6],arguments[7],arguments[8])))},d.prototype.noDebugMode=function(){this._assert3d("noDebugMode");for(var a=this._registeredMethods.post.length-1;a>=0;a--)this._registeredMethods.post[a].toString()!==this._grid().toString()&&this._registeredMethods.post[a].toString()!==this._axesIcon().toString()||this._registeredMethods.post.splice(a,1)},d.prototype._grid=function(a,b,c,d,e){void 0===a&&(a=this.width/2),void 0===b&&(b=Math.round(a/30)<4?4:Math.round(a/30)),void 0===c&&(c=0),void 0===d&&(d=0),void 0===e&&(e=0);var f=a/b,g=a/2;return function(){this.push(),this.stroke(255*this._renderer.curStrokeColor[0],255*this._renderer.curStrokeColor[1],255*this._renderer.curStrokeColor[2]),this._renderer.uMVMatrix.set(this._renderer._curCamera.cameraMatrix.mat4[0],this._renderer._curCamera.cameraMatrix.mat4[1],this._renderer._curCamera.cameraMatrix.mat4[2],this._renderer._curCamera.cameraMatrix.mat4[3],this._renderer._curCamera.cameraMatrix.mat4[4],this._renderer._curCamera.cameraMatrix.mat4[5],this._renderer._curCamera.cameraMatrix.mat4[6],this._renderer._curCamera.cameraMatrix.mat4[7],this._renderer._curCamera.cameraMatrix.mat4[8],this._renderer._curCamera.cameraMatrix.mat4[9],this._renderer._curCamera.cameraMatrix.mat4[10],this._renderer._curCamera.cameraMatrix.mat4[11],this._renderer._curCamera.cameraMatrix.mat4[12],this._renderer._curCamera.cameraMatrix.mat4[13],this._renderer._curCamera.cameraMatrix.mat4[14],this._renderer._curCamera.cameraMatrix.mat4[15]);for(var a=0;a<=b;a++)this.beginShape(this.LINES),this.vertex(-g+c,d,a*f-g+e),this.vertex(+g+c,d,a*f-g+e),this.endShape();for(var h=0;h<=b;h++)this.beginShape(this.LINES),this.vertex(h*f-g+c,d,-g+e),this.vertex(h*f-g+c,d,+g+e),this.endShape();this.pop()}},d.prototype._axesIcon=function(a,b,c,d){return void 0===a&&(a=this.width/20>40?this.width/20:40),void 0===b&&(b=-this.width/4),void 0===c&&(c=b),void 0===d&&(d=b),function(){this.push(),this._renderer.uMVMatrix.set(this._renderer._curCamera.cameraMatrix.mat4[0],this._renderer._curCamera.cameraMatrix.mat4[1],this._renderer._curCamera.cameraMatrix.mat4[2],this._renderer._curCamera.cameraMatrix.mat4[3],this._renderer._curCamera.cameraMatrix.mat4[4],this._renderer._curCamera.cameraMatrix.mat4[5],this._renderer._curCamera.cameraMatrix.mat4[6],this._renderer._curCamera.cameraMatrix.mat4[7],this._renderer._curCamera.cameraMatrix.mat4[8],this._renderer._curCamera.cameraMatrix.mat4[9],this._renderer._curCamera.cameraMatrix.mat4[10],this._renderer._curCamera.cameraMatrix.mat4[11],this._renderer._curCamera.cameraMatrix.mat4[12],this._renderer._curCamera.cameraMatrix.mat4[13],this._renderer._curCamera.cameraMatrix.mat4[14],this._renderer._curCamera.cameraMatrix.mat4[15]),this.strokeWeight(2),this.stroke(255,0,0),this.beginShape(this.LINES),this.vertex(b,c,d),this.vertex(b+a,c,d),this.endShape(),this.stroke(0,255,0),this.beginShape(this.LINES),this.vertex(b,c,d),this.vertex(b,c+a,d),this.endShape(),this.stroke(0,0,255),this.beginShape(this.LINES),this.vertex(b,c,d),this.vertex(b,c,d+a),this.endShape(),this.pop()}},b.exports=d},{"../core/constants":18,"../core/main":24}],66:[function(a,b,c){"use strict";var d=a("../core/main");d.prototype.ambientLight=function(a,b,c,e){this._assert3d("ambientLight"),d._validateParameters("ambientLight",arguments);var f=this.color.apply(this,arguments),g=this._renderer._useLightShader();return g.setUniform("uUseLighting",!0),g.setUniform("uMaterialColor",this._renderer.curFillColor),this._renderer.ambientLightColors.push(f._array[0],f._array[1],f._array[2]),g.setUniform("uAmbientColor",this._renderer.ambientLightColors),g.setUniform("uAmbientLightCount",this._renderer.ambientLightColors.length/3),this},d.prototype.directionalLight=function(a,b,c,e,f,g){this._assert3d("directionalLight"),d._validateParameters("directionalLight",arguments);var h,i=this._renderer._useLightShader();h=a instanceof d.Color?a:this.color(a,b,c);var j,k,l,m=arguments[arguments.length-1];"number"==typeof m?(j=arguments[arguments.length-3],k=arguments[arguments.length-2],l=arguments[arguments.length-1]):(j=m.x,k=m.y,l=m.z),i.setUniform("uUseLighting",!0),i.setUniform("uMaterialColor",this._renderer.curFillColor);var n=Math.sqrt(j*j+k*k+l*l);return this._renderer.directionalLightDirections.push(j/n,k/n,l/n),i.setUniform("uLightingDirection",this._renderer.directionalLightDirections),this._renderer.directionalLightColors.push(h._array[0],h._array[1],h._array[2]),i.setUniform("uDirectionalColor",this._renderer.directionalLightColors),i.setUniform("uDirectionalLightCount",this._renderer.directionalLightColors.length/3),this},d.prototype.pointLight=function(a,b,c,e,f,g){this._assert3d("pointLight"),d._validateParameters("pointLight",arguments);var h;h=a instanceof d.Color?a:this.color(a,b,c);var i,j,k,l=arguments[arguments.length-1];"number"==typeof l?(i=arguments[arguments.length-3],j=arguments[arguments.length-2],k=arguments[arguments.length-1]):(i=l.x,j=l.y,k=l.z);var m=this._renderer._useLightShader();return m.setUniform("uUseLighting",!0),m.setUniform("uMaterialColor",this._renderer.curFillColor),this._renderer.pointLightPositions.push(i,j,k),m.setUniform("uPointLightLocation",this._renderer.pointLightPositions),this._renderer.pointLightColors.push(h._array[0],h._array[1],h._array[2]),m.setUniform("uPointLightColor",this._renderer.pointLightColors),m.setUniform("uPointLightCount",this._renderer.pointLightColors.length/3),this},b.exports=d},{"../core/main":24}],67:[function(a,b,c){"use strict";function d(a,b){for(var c={v:[],vt:[],vn:[]},d={},f=0;f0)if("v"===g[0]||"vn"===g[0]){var h=new e.Vector(parseFloat(g[1]),parseFloat(g[2]),parseFloat(g[3]));c[g[0]].push(h)}else if("vt"===g[0]){var i=[parseFloat(g[1]),parseFloat(g[2])];c[g[0]].push(i)}else if("f"===g[0])for(var j=3;j0&&(this._renderer.geometryInHash(a.gid)||(a._makeTriangleEdges()._edgesToVertices(),this._renderer.createBuffers(a.gid,a)),this._renderer.drawBuffers(a.gid))},b.exports=e},{"../core/main":24,"./p5.Geometry":70}],68:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants");a("./p5.Texture"),d.prototype.loadShader=function(a,b){d._validateParameters("loadShader",arguments);var c=new d.Shader,e=this,f=!1,g=!1;return this.loadStrings(b,function(a){c._fragSrc=a.join("\n"),f=!0,g&&e._decrementPreload()}),this.loadStrings(a,function(a){c._vertSrc=a.join("\n"),g=!0,f&&e._decrementPreload()}),c},d.prototype.createShader=function(a,b){return this._assert3d("createShader"),d._validateParameters("createShader",arguments),new d.Shader(this._renderer,a,b)},d.prototype.shader=function(a){return this._assert3d("shader"),d._validateParameters("shader",arguments),void 0===a._renderer&&(a._renderer=this._renderer),a.isStrokeShader()?this._renderer.setStrokeShader(a):this._renderer.setFillShader(a),this},d.prototype.normalMaterial=function(){return this._assert3d("normalMaterial"),d._validateParameters("normalMaterial",arguments),this._renderer.drawMode=e.FILL,this._renderer.setFillShader(this._renderer._getNormalShader()),this._renderer.curFillColor=[1,1,1,1],this.noStroke(),this},d.prototype.texture=function(a){this._assert3d("texture"),d._validateParameters("texture",arguments),this._renderer.drawMode=e.TEXTURE;var b=this._renderer._useLightShader();return b.setUniform("uSpecular",!1),b.setUniform("isTexture",!0),b.setUniform("uSampler",a),this.noStroke(),this},d.prototype.ambientMaterial=function(a,b,c,e){this._assert3d("ambientMaterial"),d._validateParameters("ambientMaterial",arguments);var f=d.prototype.color.apply(this,arguments);this._renderer.curFillColor=f._array;var g=this._renderer._useLightShader();return g.setUniform("uMaterialColor",this._renderer.curFillColor),g.setUniform("uSpecular",!1),g.setUniform("isTexture",!1),this},d.prototype.specularMaterial=function(a,b,c,e){this._assert3d("specularMaterial"),d._validateParameters("specularMaterial",arguments);var f=d.prototype.color.apply(this,arguments);this._renderer.curFillColor=f._array;var g=this._renderer._useLightShader();return g.setUniform("uMaterialColor",this._renderer.curFillColor),g.setUniform("uSpecular",!0),g.setUniform("isTexture",!1),this},d.RendererGL.prototype._applyColorBlend=function(a){var b=this.GL,c=this.drawMode===e.TEXTURE;return c||a[a.length-1]<1?(b.depthMask(c),b.enable(b.BLEND),b.blendEquation(b.FUNC_ADD),b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA)):(b.depthMask(!0),b.disable(b.BLEND)),a},b.exports=d},{"../core/constants":18,"../core/main":24,"./p5.Texture":76}],69:[function(a,b,c){"use strict";var d=a("../core/main");d.prototype.camera=function(){return this._assert3d("camera"),d._validateParameters("camera",arguments),this._renderer._curCamera.camera.apply(this._renderer._curCamera,arguments),this},d.prototype.perspective=function(){return this._assert3d("perspective"),d._validateParameters("perspective",arguments),this._renderer._curCamera.perspective.apply(this._renderer._curCamera,arguments),this},d.prototype.ortho=function(){return this._assert3d("ortho"),d._validateParameters("ortho",arguments),this._renderer._curCamera.ortho.apply(this._renderer._curCamera,arguments),this},d.prototype.createCamera=function(){this._assert3d("createCamera");var a=new d.Camera(this._renderer);return a._computeCameraDefaultSettings(),a._setDefaultCamera(),this._renderer._curCamera=a,a},d.Camera=function(a){this._renderer=a,this.cameraType="default",this.cameraMatrix=new d.Matrix,this.projMatrix=new d.Matrix},d.Camera.prototype.perspective=function(a,b,c,e){void 0===a?(a=this.defaultCameraFOV,this.cameraFOV=a):this.cameraFOV=this._renderer._pInst._toRadians(a),void 0===b&&(b=this.defaultAspectRatio),void 0===c&&(c=this.defaultCameraNear),void 0===e&&(e=this.defaultCameraFar),c<=1e-4&&(c=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),eMath.PI?i=Math.PI:i<=0&&(i=.001);var j=Math.sin(i)*g*Math.sin(h),k=Math.cos(i)*g,l=Math.sin(i)*g*Math.cos(h);this.camera(j+this.centerX,k+this.centerY,l+this.centerZ,this.centerX,this.centerY,this.centerZ,0,1,0)},d.Camera.prototype._isActive=function(){return this===this._renderer._curCamera},d.prototype.setCamera=function(a){this._renderer._curCamera=a,this._renderer.uPMatrix.set(a.projMatrix.mat4[0],a.projMatrix.mat4[1],a.projMatrix.mat4[2],a.projMatrix.mat4[3],a.projMatrix.mat4[4],a.projMatrix.mat4[5],a.projMatrix.mat4[6],a.projMatrix.mat4[7],a.projMatrix.mat4[8],a.projMatrix.mat4[9],a.projMatrix.mat4[10],a.projMatrix.mat4[11],a.projMatrix.mat4[12],a.projMatrix.mat4[13],a.projMatrix.mat4[14],a.projMatrix.mat4[15])},b.exports=d.Camera},{"../core/main":24}],70:[function(a,b,c){"use strict";var d=a("../core/main");d.Geometry=function(a,b,c){return this.vertices=[],this.lineVertices=[],this.lineNormals=[],this.vertexNormals=[],this.faces=[],this.uvs=[],this.edges=[],this.detailX=void 0!==a?a:1,this.detailY=void 0!==b?b:1,c instanceof Function&&c.call(this),this},d.Geometry.prototype.computeFaces=function(){this.faces.length=0;for(var a,b,c,d,e=this.detailX+1,f=0;f1&&(k=1),i.mult(Math.asin(k)/j))},d.Geometry.prototype.computeNormals=function(){var a,b=this.vertexNormals,c=this.vertices,e=this.faces;for(b.length=0,a=0;athis.vertices.length-1-this.detailX;b--)a.add(this.vertexNormals[b]);for(a=d.Vector.div(a,this.detailX),b=this.vertices.length-1;b>this.vertices.length-1-this.detailX;b--)this.vertexNormals[b]=a;return this},d.Geometry.prototype._makeTriangleEdges=function(){if(this.edges.length=0,Array.isArray(this.strokeIndices))for(var a=0,b=this.strokeIndices.length;a0){for(var a=this.vertices[0].copy(),b=this.vertices[0].copy(),c=0;c1){if(this._useImmediateModeShader(),this._doStroke&&this.drawMode!==e.TEXTURE){for(var i=0;i1e3){var b=Object.keys(this.gHash)[0];delete this.gHash[b],e--}this.gHash[a]={}},d.RendererGL.prototype._freeBuffers=function(a){var b=this.gHash[a];if(b){delete this.gHash[a],e--;var c=this.GL;b.vertexBuffer&&c.deleteBuffer(b.vertexBuffer),b.normalBuffer&&c.deleteBuffer(b.normalBuffer),b.lineNormalBuffer&&c.deleteBuffer(b.lineNormalBuffer),b.uvBuffer&&c.deleteBuffer(b.uvBuffer),b.indexBuffer&&c.deleteBuffer(b.indexBuffer),b.lineVertexBuffer&&c.deleteBuffer(b.lineVertexBuffer)}},d.RendererGL.prototype.createBuffers=function(a,b){var c=this.GL;this._initBufferDefaults(a);var d=this.gHash[a];return d.numberOfItems=3*b.faces.length,d.lineVertexCount=b.lineVertices.length,this._useColorShader(),this.curStrokeShader.attributes.aPosition&&(d.lineVertexBuffer=c.createBuffer(),this._bindBuffer(d.lineVertexBuffer,c.ARRAY_BUFFER,this._flatten(b.lineVertices),Float32Array,c.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aPosition.location,3,c.FLOAT,!1,0,0)),this.curStrokeShader.attributes.aDirection&&(d.lineNormalBuffer=c.createBuffer(),this._bindBuffer(d.lineNormalBuffer,c.ARRAY_BUFFER,this._flatten(b.lineNormals),Float32Array,c.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aDirection.location,4,c.FLOAT,!1,0,0)),this.curFillShader.attributes.aPosition&&(d.vertexBuffer=c.createBuffer(),this._bindBuffer(d.vertexBuffer,c.ARRAY_BUFFER,this._vToNArray(b.vertices),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aPosition.location,3,c.FLOAT,!1,0,0)),d.indexBuffer=c.createBuffer(),this._bindBuffer(d.indexBuffer,c.ELEMENT_ARRAY_BUFFER,this._flatten(b.faces),Uint16Array,c.STATIC_DRAW),this.curFillShader.attributes.aNormal&&(d.normalBuffer=c.createBuffer(),this._bindBuffer(d.normalBuffer,c.ARRAY_BUFFER,this._vToNArray(b.vertexNormals),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aNormal.location,3,c.FLOAT,!1,0,0)),this.curFillShader.attributes.aTexCoord&&(d.uvBuffer=c.createBuffer(),this._bindBuffer(d.uvBuffer,c.ARRAY_BUFFER,this._flatten(b.uvs),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aTexCoord.location,2,c.FLOAT,!1,0,0)),d},d.RendererGL.prototype.drawBuffers=function(a){var b=this.GL;this._useColorShader();var c=this.gHash[a];return this._doStroke&&c.lineVertexCount>0&&(this.curStrokeShader.bindShader(),c.lineVertexBuffer&&(this._bindBuffer(c.lineVertexBuffer,b.ARRAY_BUFFER),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aPosition.location,3,b.FLOAT,!1,0,0)),c.lineNormalBuffer&&(this._bindBuffer(c.lineNormalBuffer,b.ARRAY_BUFFER),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aDirection.location,4,b.FLOAT,!1,0,0)),this._applyColorBlend(this.curStrokeColor),this._drawArrays(b.TRIANGLES,a),this.curStrokeShader.unbindShader()),!1!==this._doFill&&(this.curFillShader.bindShader(),c.vertexBuffer&&(this._bindBuffer(c.vertexBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aPosition.location,3,b.FLOAT,!1,0,0)),c.indexBuffer&&this._bindBuffer(c.indexBuffer,b.ELEMENT_ARRAY_BUFFER),c.normalBuffer&&(this._bindBuffer(c.normalBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aNormal.location,3,b.FLOAT,!1,0,0)),c.uvBuffer&&(this._bindBuffer(c.uvBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aTexCoord.location,2,b.FLOAT,!1,0,0)),this._applyColorBlend(this.curFillColor),this._drawElements(b.TRIANGLES,a),this.curFillShader.unbindShader()),this},d.RendererGL.prototype.drawBuffersScaled=function(a,b,c,d){var e=this.uMVMatrix.copy();try{this.uMVMatrix.scale(b,c,d),this.drawBuffers(a)}finally{this.uMVMatrix=e}},d.RendererGL.prototype._drawArrays=function(a,b){return this.GL.drawArrays(a,0,this.gHash[b].lineVertexCount),this._pInst._pixelsDirty=!0,this},d.RendererGL.prototype._drawElements=function(a,b){this.GL.drawElements(a,this.gHash[b].numberOfItems,this.GL.UNSIGNED_SHORT,0),this._pInst._pixelsDirty=!0},d.RendererGL.prototype._drawPoints=function(a,b){var c=this.GL;this._bindBuffer(b,c.ARRAY_BUFFER,this._vToNArray(a),Float32Array,c.STATIC_DRAW),this.curPointShader.enableAttrib(this.curPointShader.attributes.aPosition.location,3,c.FLOAT,!1,0,0),c.drawArrays(c.Points,0,a.length)},b.exports=d.RendererGL},{"../core/main":24}],74:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants"),f=a("libtess");a("./p5.Shader"),a("./p5.Camera"),a("../core/p5.Renderer"),a("./p5.Matrix");var g={immediateVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform float uResolution;\nuniform float uPointSize;\n\nvarying vec4 vColor;\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vColor = aVertexColor;\n gl_PointSize = uPointSize;\n}\n",vertexColorVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vColor = aVertexColor;\n}\n",vertexColorFrag:"precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}",normalVert:"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvarying vec3 vVertexNormal;\nvarying highp vec2 vVertTexCoord;\n\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vVertexNormal = normalize(vec3( uNormalMatrix * aNormal ));\n vVertTexCoord = aTexCoord;\n}\n",normalFrag:"precision mediump float;\nvarying vec3 vVertexNormal;\nvoid main(void) {\n gl_FragColor = vec4(vVertexNormal, 1.0);\n}",basicFrag:"precision mediump float;\nvarying vec3 vVertexNormal;\nuniform vec4 uMaterialColor;\nvoid main(void) {\n gl_FragColor = uMaterialColor;\n}",lightVert:"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uViewMatrix;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\nuniform int uAmbientLightCount;\nuniform int uDirectionalLightCount;\nuniform int uPointLightCount;\n\nuniform vec3 uAmbientColor[8];\nuniform vec3 uLightingDirection[8];\nuniform vec3 uDirectionalColor[8];\nuniform vec3 uPointLightLocation[8];\nuniform vec3 uPointLightColor[8];\nuniform bool uSpecular;\n\nvarying vec3 vVertexNormal;\nvarying vec2 vVertTexCoord;\nvarying vec3 vLightWeighting;\n\nvoid main(void){\n\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n\n vec3 vertexNormal = normalize(vec3( uNormalMatrix * aNormal ));\n vVertexNormal = vertexNormal;\n vVertTexCoord = aTexCoord;\n\n vec4 mvPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n vec3 eyeDirection = normalize(-mvPosition.xyz);\n\n float shininess = 32.0;\n float specularFactor = 2.0;\n float diffuseFactor = 0.3;\n\n vec3 ambientLightFactor = vec3(0.0);\n\n for (int i = 0; i < 8; i++) {\n if (uAmbientLightCount == i) break;\n ambientLightFactor += uAmbientColor[i];\n }\n\n\n vec3 directionalLightFactor = vec3(0.0);\n\n for (int j = 0; j < 8; j++) {\n if (uDirectionalLightCount == j) break;\n vec3 dir = uLightingDirection[j];\n float directionalLightWeighting = max(dot(vertexNormal, -dir), 0.0);\n directionalLightFactor += uDirectionalColor[j] * directionalLightWeighting;\n }\n\n\n vec3 pointLightFactor = vec3(0.0);\n\n for (int k = 0; k < 8; k++) {\n if (uPointLightCount == k) break;\n vec3 loc = (uViewMatrix * vec4(uPointLightLocation[k], 1.0)).xyz;\n vec3 lightDirection = normalize(loc - mvPosition.xyz);\n\n float directionalLightWeighting = max(dot(vertexNormal, lightDirection), 0.0);\n\n float specularLightWeighting = 0.0;\n if (uSpecular ){\n vec3 reflectionDirection = reflect(-lightDirection, vertexNormal);\n specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininess);\n }\n\n pointLightFactor += uPointLightColor[k] * (specularFactor * specularLightWeighting\n + directionalLightWeighting * diffuseFactor);\n }\n\n vLightWeighting = ambientLightFactor + directionalLightFactor + pointLightFactor;\n}\n",lightTextureFrag:"precision mediump float;\n\nuniform vec4 uMaterialColor;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uUseLighting;\n\nvarying vec3 vLightWeighting;\nvarying highp vec2 vVertTexCoord;\n\nvoid main(void) {\n gl_FragColor = isTexture ? texture2D(uSampler, vVertTexCoord) : uMaterialColor;\n if (uUseLighting)\n gl_FragColor.rgb *= vLightWeighting;\n}",phongVert:"precision mediump float;\n\nattribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform vec3 uAmbientColor[8];\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\nuniform int uAmbientLightCount;\n\nvarying vec3 vNormal;\nvarying vec2 vTexCoord;\nvarying vec3 vViewPosition;\nvarying vec3 vAmbientColor;\n\nvoid main(void){\n\n vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n\n // Pass varyings to fragment shader\n vViewPosition = viewModelPosition.xyz;\n gl_Position = uProjectionMatrix * viewModelPosition; \n\n vNormal = normalize(uNormalMatrix * normalize(aNormal));\n vTexCoord = aTexCoord;\n\n vAmbientColor = vec3(0.0);\n for (int i = 0; i < 8; i++) {\n if (uAmbientLightCount == i) break;\n vAmbientColor += uAmbientColor[i];\n }\n}\n", +phongFrag:"precision mediump float;\n\n//uniform mat4 uModelViewMatrix;\nuniform mat4 uViewMatrix;\n\nuniform vec4 uMaterialColor;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uUseLighting;\n\nuniform vec3 uLightingDirection[8];\nuniform vec3 uDirectionalColor[8];\nuniform vec3 uPointLightLocation[8];\nuniform vec3 uPointLightColor[8];\nuniform bool uSpecular;\n\nuniform int uDirectionalLightCount;\nuniform int uPointLightCount;\n\nvarying vec3 vNormal;\nvarying vec2 vTexCoord;\nvarying vec3 vViewPosition;\nvarying vec3 vAmbientColor;\n\nvec3 V;\nvec3 N;\n\nconst float shininess = 32.0;\nconst float specularFactor = 2.0;\nconst float diffuseFactor = 0.73;\n\nstruct LightResult {\n\tfloat specular;\n\tfloat diffuse;\n};\n\nfloat phongSpecular(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float shininess) {\n\n vec3 R = normalize(reflect(-lightDirection, surfaceNormal)); \n return pow(max(0.0, dot(R, viewDirection)), shininess);\n}\n\nfloat lambertDiffuse(\n vec3 lightDirection,\n vec3 surfaceNormal) {\n return max(0.0, dot(-lightDirection, surfaceNormal));\n}\n\nLightResult light(vec3 lightVector) {\n\n vec3 L = normalize(lightVector);\n\n //compute our diffuse & specular terms\n LightResult lr;\n if (uSpecular)\n lr.specular = phongSpecular(L, V, N, shininess);\n lr.diffuse = lambertDiffuse(L, N);\n return lr;\n}\n\nvoid main(void) {\n\n V = normalize(vViewPosition);\n N = vNormal;\n\n vec3 diffuse = vec3(0.0);\n float specular = 0.0;\n\n for (int j = 0; j < 8; j++) {\n if (uDirectionalLightCount == j) break;\n\n LightResult result = light(uLightingDirection[j]);\n diffuse += result.diffuse * uDirectionalColor[j];\n specular += result.specular;\n }\n\n for (int k = 0; k < 8; k++) {\n if (uPointLightCount == k) break;\n\n vec3 lightPosition = (uViewMatrix * vec4(uPointLightLocation[k], 1.0)).xyz;\n vec3 lightVector = vViewPosition - lightPosition;\n\t\n //calculate attenuation\n float lightDistance = length(lightVector);\n float falloff = 500.0 / (lightDistance + 500.0);\n\n LightResult result = light(lightVector);\n diffuse += result.diffuse * falloff * uPointLightColor[k];\n specular += result.specular * falloff;\n }\n\n gl_FragColor = isTexture ? texture2D(uSampler, vTexCoord) : uMaterialColor;\n gl_FragColor.rgb = gl_FragColor.rgb * (diffuse * diffuseFactor + vAmbientColor) + specular * specularFactor;\n}",fontVert:"precision mediump float;\n\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uGlyphRect;\nuniform float uGlyphOffset;\n\nvarying vec2 vTexCoord;\nvarying float w;\n\nvoid main() {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n\n // scale by the size of the glyph's rectangle\n positionVec4.xy *= uGlyphRect.zw - uGlyphRect.xy;\n\n // move to the corner of the glyph\n positionVec4.xy += uGlyphRect.xy;\n\n // move to the letter's line offset\n positionVec4.x += uGlyphOffset;\n \n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vTexCoord = aTexCoord;\n w = gl_Position.w;\n}\n",fontFrag:"#extension GL_OES_standard_derivatives : enable\nprecision mediump float;\n\n#if 0\n // simulate integer math using floats\n\t#define int float\n\t#define ivec2 vec2\n\t#define INT(x) float(x)\n\n\tint ifloor(float v) { return floor(v); }\n\tivec2 ifloor(vec2 v) { return floor(v); }\n\n#else\n // use native integer math\n\tprecision mediump int;\n\t#define INT(x) x\n\n\tint ifloor(float v) { return int(v); }\n\tint ifloor(int v) { return v; }\n\tivec2 ifloor(vec2 v) { return ivec2(v); }\n\n#endif\n\nuniform sampler2D uSamplerStrokes;\nuniform sampler2D uSamplerRowStrokes;\nuniform sampler2D uSamplerRows;\nuniform sampler2D uSamplerColStrokes;\nuniform sampler2D uSamplerCols;\n\nuniform ivec2 uStrokeImageSize;\nuniform ivec2 uCellsImageSize;\nuniform ivec2 uGridImageSize;\n\nuniform ivec2 uGridOffset;\nuniform ivec2 uGridSize;\nuniform vec4 uMaterialColor;\n\nvarying vec2 vTexCoord;\n\n// some helper functions\nint round(float v) { return ifloor(v + 0.5); }\nivec2 round(vec2 v) { return ifloor(v + 0.5); }\nfloat saturate(float v) { return clamp(v, 0.0, 1.0); }\nvec2 saturate(vec2 v) { return clamp(v, 0.0, 1.0); }\n\nint mul(float v1, int v2) {\n return ifloor(v1 * float(v2));\n}\n\nivec2 mul(vec2 v1, ivec2 v2) {\n return ifloor(v1 * vec2(v2) + 0.5);\n}\n\n// unpack a 16-bit integer from a float vec2\nint getInt16(vec2 v) {\n ivec2 iv = round(v * 255.0);\n return iv.x * INT(128) + iv.y;\n}\n\nvec2 pixelScale;\nvec2 coverage = vec2(0.0);\nvec2 weight = vec2(0.5);\nconst float minDistance = 1.0/8192.0;\nconst float hardness = 1.05; // amount of antialias\n\n// the maximum number of curves in a glyph\nconst int N = INT(250);\n\n// retrieves an indexed pixel from a sampler\nvec4 getTexel(sampler2D sampler, int pos, ivec2 size) {\n int width = size.x;\n int y = ifloor(pos / width);\n int x = pos - y * width; // pos % width\n\n return texture2D(sampler, (vec2(x, y) + 0.5) / vec2(size));\n}\n\nvoid calulateCrossings(vec2 p0, vec2 p1, vec2 p2, out vec2 C1, out vec2 C2) {\n\n // get the coefficients of the quadratic in t\n vec2 a = p0 - p1 * 2.0 + p2;\n vec2 b = p0 - p1;\n vec2 c = p0 - vTexCoord;\n\n // found out which values of 't' it crosses the axes\n vec2 surd = sqrt(max(vec2(0.0), b * b - a * c));\n vec2 t1 = ((b - surd) / a).yx;\n vec2 t2 = ((b + surd) / a).yx;\n\n // approximate straight lines to avoid rounding errors\n if (abs(a.y) < 0.001)\n t1.x = t2.x = c.y / (2.0 * b.y);\n\n if (abs(a.x) < 0.001)\n t1.y = t2.y = c.x / (2.0 * b.x);\n\n // plug into quadratic formula to find the corrdinates of the crossings\n C1 = ((a * t1 - b * 2.0) * t1 + c) * pixelScale;\n C2 = ((a * t2 - b * 2.0) * t2 + c) * pixelScale;\n}\n\nvoid coverageX(vec2 p0, vec2 p1, vec2 p2) {\n\n vec2 C1, C2;\n calulateCrossings(p0, p1, p2, C1, C2);\n\n // determine on which side of the x-axis the points lie\n bool y0 = p0.y > vTexCoord.y;\n bool y1 = p1.y > vTexCoord.y;\n bool y2 = p2.y > vTexCoord.y;\n\n // could web be under the curve (after t1)?\n if (y1 ? !y2 : y0) {\n // add the coverage for t1\n coverage.x += saturate(C1.x + 0.5);\n // calculate the anti-aliasing for t1\n weight.x = min(weight.x, abs(C1.x));\n }\n\n // are we outside the curve (after t2)?\n if (y1 ? !y0 : y2) {\n // subtract the coverage for t2\n coverage.x -= saturate(C2.x + 0.5);\n // calculate the anti-aliasing for t2\n weight.x = min(weight.x, abs(C2.x));\n }\n}\n\n// this is essentially the same as coverageX, but with the axes swapped\nvoid coverageY(vec2 p0, vec2 p1, vec2 p2) {\n\n vec2 C1, C2;\n calulateCrossings(p0, p1, p2, C1, C2);\n\n bool x0 = p0.x > vTexCoord.x;\n bool x1 = p1.x > vTexCoord.x;\n bool x2 = p2.x > vTexCoord.x;\n\n if (x1 ? !x2 : x0) {\n coverage.y -= saturate(C1.y + 0.5);\n weight.y = min(weight.y, abs(C1.y));\n }\n\n if (x1 ? !x0 : x2) {\n coverage.y += saturate(C2.y + 0.5);\n weight.y = min(weight.y, abs(C2.y));\n }\n}\n\nvoid main() {\n\n // calculate the pixel scale based on screen-coordinates\n pixelScale = hardness / fwidth(vTexCoord);\n\n // which grid cell is this pixel in?\n ivec2 gridCoord = ifloor(vTexCoord * vec2(uGridSize));\n\n // intersect curves in this row\n {\n // the index into the row info bitmap\n int rowIndex = gridCoord.y + uGridOffset.y;\n // fetch the info texel\n vec4 rowInfo = getTexel(uSamplerRows, rowIndex, uGridImageSize);\n // unpack the rowInfo\n int rowStrokeIndex = getInt16(rowInfo.xy);\n int rowStrokeCount = getInt16(rowInfo.zw);\n\n for (int iRowStroke = INT(0); iRowStroke < N; iRowStroke++) {\n if (iRowStroke >= rowStrokeCount)\n break;\n\n // each stroke is made up of 3 points: the start and control point\n // and the start of the next curve.\n // fetch the indices of this pair of strokes:\n vec4 strokeIndices = getTexel(uSamplerRowStrokes, rowStrokeIndex++, uCellsImageSize);\n\n // unpack the stroke index\n int strokePos = getInt16(strokeIndices.xy);\n\n // fetch the two strokes\n vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n\n // calculate the coverage\n coverageX(stroke0.xy, stroke0.zw, stroke1.xy);\n }\n }\n\n // intersect curves in this column\n {\n int colIndex = gridCoord.x + uGridOffset.x;\n vec4 colInfo = getTexel(uSamplerCols, colIndex, uGridImageSize);\n int colStrokeIndex = getInt16(colInfo.xy);\n int colStrokeCount = getInt16(colInfo.zw);\n \n for (int iColStroke = INT(0); iColStroke < N; iColStroke++) {\n if (iColStroke >= colStrokeCount)\n break;\n\n vec4 strokeIndices = getTexel(uSamplerColStrokes, colStrokeIndex++, uCellsImageSize);\n\n int strokePos = getInt16(strokeIndices.xy);\n vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n coverageY(stroke0.xy, stroke0.zw, stroke1.xy);\n }\n }\n\n weight = saturate(1.0 - weight * 2.0);\n float distance = max(weight.x + weight.y, minDistance); // manhattan approx.\n float antialias = abs(dot(coverage, weight) / distance);\n float cover = min(abs(coverage.x), abs(coverage.y));\n gl_FragColor = uMaterialColor;\n gl_FragColor.a *= saturate(max(antialias, cover));\n}",lineVert:"/*\n Part of the Processing project - http://processing.org\n Copyright (c) 2012-15 The Processing Foundation\n Copyright (c) 2004-12 Ben Fry and Casey Reas\n Copyright (c) 2001-04 Massachusetts Institute of Technology\n This library is free software; you can redistribute it and/or\n modify it under the terms of the GNU Lesser General Public\n License as published by the Free Software Foundation, version 2.1.\n This library is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n Lesser General Public License for more details.\n You should have received a copy of the GNU Lesser General\n Public License along with this library; if not, write to the\n Free Software Foundation, Inc., 59 Temple Place, Suite 330,\n Boston, MA 02111-1307 USA\n*/\n\n#define PROCESSING_LINE_SHADER\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform float uStrokeWeight;\n\nuniform vec4 uViewport;\n\n// using a scale <1 moves the lines towards the camera\n// in order to prevent popping effects due to half of\n// the line disappearing behind the geometry faces.\nvec3 scale = vec3(0.9995);\n\nattribute vec4 aPosition;\nattribute vec4 aDirection;\n \nvoid main() {\n vec4 posp = uModelViewMatrix * aPosition;\n vec4 posq = uModelViewMatrix * (aPosition + vec4(aDirection.xyz, 0));\n\n // Moving vertices slightly toward the camera\n // to avoid depth-fighting with the fill triangles.\n // Discussed here:\n // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848 \n posp.xyz = posp.xyz * scale;\n posq.xyz = posq.xyz * scale;\n\n vec4 p = uProjectionMatrix * posp;\n vec4 q = uProjectionMatrix * posq;\n\n // formula to convert from clip space (range -1..1) to screen space (range 0..[width or height])\n // screen_p = (p.xy/p.w + <1,1>) * 0.5 * uViewport.zw\n\n // prevent division by W by transforming the tangent formula (div by 0 causes\n // the line to disappear, see https://github.com/processing/processing/issues/5183)\n // t = screen_q - screen_p\n //\n // tangent is normalized and we don't care which aDirection it points to (+-)\n // t = +- normalize( screen_q - screen_p )\n // t = +- normalize( (q.xy/q.w+<1,1>)*0.5*uViewport.zw - (p.xy/p.w+<1,1>)*0.5*uViewport.zw )\n //\n // extract common factor, <1,1> - <1,1> cancels out\n // t = +- normalize( (q.xy/q.w - p.xy/p.w) * 0.5 * uViewport.zw )\n //\n // convert to common divisor\n // t = +- normalize( ((q.xy*p.w - p.xy*q.w) / (p.w*q.w)) * 0.5 * uViewport.zw )\n //\n // remove the common scalar divisor/factor, not needed due to normalize and +-\n // (keep uViewport - can't remove because it has different components for x and y\n // and corrects for aspect ratio, see https://github.com/processing/processing/issues/5181)\n // t = +- normalize( (q.xy*p.w - p.xy*q.w) * uViewport.zw )\n\n vec2 tangent = normalize((q.xy*p.w - p.xy*q.w) * uViewport.zw);\n\n // flip tangent to normal (it's already normalized)\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float thickness = aDirection.w * uStrokeWeight;\n vec2 offset = normal * thickness / 2.0;\n\n // Perspective ---\n // convert from world to clip by multiplying with projection scaling factor\n // to get the right thickness (see https://github.com/processing/processing/issues/5182)\n // invert Y, projections in Processing invert Y\n vec2 perspScale = (uProjectionMatrix * vec4(1, -1, 0, 0)).xy;\n\n // No Perspective ---\n // multiply by W (to cancel out division by W later in the pipeline) and\n // convert from screen to clip (derived from clip to screen above)\n vec2 noPerspScale = p.w / (0.5 * uViewport.zw);\n\n //gl_Position.xy = p.xy + offset.xy * mix(noPerspScale, perspScale, float(perspective > 0));\n gl_Position.xy = p.xy + offset.xy * perspScale;\n gl_Position.zw = p.zw;\n}\n",lineFrag:"precision mediump float;\nprecision mediump int;\n\nuniform vec4 uMaterialColor;\n\nvoid main() {\n gl_FragColor = uMaterialColor;\n}",pointVert:"attribute vec3 aPosition;\nuniform float uPointSize;\nvarying float vStrokeWeight;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nvoid main() {\n\tvec4 positionVec4 = vec4(aPosition, 1.0);\n\tgl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n\tgl_PointSize = uPointSize;\n\tvStrokeWeight = uPointSize;\n}",pointFrag:"precision mediump float;\nprecision mediump int;\nuniform vec4 uMaterialColor;\nvarying float vStrokeWeight;\n\nvoid main(){\n\tfloat mask = 0.0;\n\n\t// make a circular mask using the gl_PointCoord (goes from 0 - 1 on a point)\n // might be able to get a nicer edge on big strokeweights with smoothstep but slightly less performant\n\n\tmask = step(0.98, length(gl_PointCoord * 2.0 - 1.0));\n\n\t// if strokeWeight is 1 or less lets just draw a square\n\t// this prevents weird artifacting from carving circles when our points are really small\n\t// if strokeWeight is larger than 1, we just use it as is\n\n\tmask = mix(0.0, mask, clamp(floor(vStrokeWeight - 0.5),0.0,1.0));\n\n\t// throw away the borders of the mask\n // otherwise we get weird alpha blending issues\n\n\tif(mask > 0.98){\n discard;\n \t}\n\n \tgl_FragColor = vec4(uMaterialColor.rgb * (1.0 - mask), uMaterialColor.a) ;\n}"};d.RendererGL=function(a,b,c,e){return d.Renderer.call(this,a,b,c),this.attributes={},e=e||{},this.attributes.alpha=void 0===e.alpha||e.alpha,this.attributes.depth=void 0===e.depth||e.depth,this.attributes.stencil=void 0===e.stencil||e.stencil,this.attributes.antialias=void 0!==e.antialias&&e.antialias,this.attributes.premultipliedAlpha=void 0!==e.premultipliedAlpha&&e.premultipliedAlpha,this.attributes.preserveDrawingBuffer=void 0===e.preserveDrawingBuffer||e.preserveDrawingBuffer,this.attributes.perPixelLighting=void 0!==e.perPixelLighting&&e.perPixelLighting,this._initContext(),this.isP3D=!0,this.GL=this.drawingContext,this.ambientLightColors=[],this.directionalLightDirections=[],this.directionalLightColors=[],this.pointLightPositions=[],this.pointLightColors=[],this.uMVMatrix=new d.Matrix,this.uPMatrix=new d.Matrix,this.uNMatrix=new d.Matrix("mat3"),this._curCamera=new d.Camera(this),this._curCamera._computeCameraDefaultSettings(),this._curCamera._setDefaultCamera(),this.gHash={},this._defaultLightShader=void 0,this._defaultImmediateModeShader=void 0,this._defaultNormalShader=void 0,this._defaultColorShader=void 0,this._defaultPointShader=void 0,this.curFillShader=void 0,this.curStrokeShader=void 0,this.curPointShader=void 0,this._useColorShader(),this.setStrokeShader(this._getLineShader()),this._usePointShader(),this._pointVertexBuffer=this.GL.createBuffer(),this.isImmediateDrawing=!1,this.immediateMode={},this.fill(255,255,255,255),this.pointSize=5,this.strokeWeight(1),this.stroke(0,0,0),this.textures=[],this._curveTightness=6,this._lookUpTableBezier=[],this._lookUpTableQuadratic=[],this._lutBezierDetail=0,this._lutQuadraticDetail=0,this._tessy=this._initTessy(),this.fontInfos={},this},d.RendererGL.prototype=Object.create(d.Renderer.prototype),d.RendererGL.prototype._initContext=function(){try{if(this.drawingContext=this.canvas.getContext("webgl",this.attributes)||this.canvas.getContext("experimental-webgl",this.attributes),null===this.drawingContext)throw new Error("Error creating webgl context");console.log("p5.RendererGL: enabled webgl context");var a=this.drawingContext;a.enable(a.DEPTH_TEST),a.depthFunc(a.LEQUAL),a.viewport(0,0,a.drawingBufferWidth,a.drawingBufferHeight),this._viewport=this.drawingContext.getParameter(this.drawingContext.VIEWPORT)}catch(a){throw a}},d.RendererGL.prototype._resetContext=function(a,b,c){var e=this.width,f=this.height,g=this.canvas.id,h=this.canvas;h&&h.parentNode.removeChild(h),h=document.createElement("canvas"),h.id=g,this._pInst._userNode?this._pInst._userNode.appendChild(h):document.body.appendChild(h),this._pInst.canvas=h;var i=new d.RendererGL(this._pInst.canvas,this._pInst,!0,a);this._pInst._setProperty("_renderer",i),i.resize(e,f),i._applyDefaults(),this._pInst._elements.push(i),"function"==typeof c&&setTimeout(function(){c.apply(window._renderer,b)},0)},d.prototype.setAttributes=function(a,b){this._assert3d("setAttributes");var c;void 0!==b?(c={},c[a]=b):a instanceof Object&&(c=a),this.push(),this._renderer._resetContext(c),this.pop()},d.RendererGL.prototype._update=function(){this.uMVMatrix.set(this._curCamera.cameraMatrix.mat4[0],this._curCamera.cameraMatrix.mat4[1],this._curCamera.cameraMatrix.mat4[2],this._curCamera.cameraMatrix.mat4[3],this._curCamera.cameraMatrix.mat4[4],this._curCamera.cameraMatrix.mat4[5],this._curCamera.cameraMatrix.mat4[6],this._curCamera.cameraMatrix.mat4[7],this._curCamera.cameraMatrix.mat4[8],this._curCamera.cameraMatrix.mat4[9],this._curCamera.cameraMatrix.mat4[10],this._curCamera.cameraMatrix.mat4[11],this._curCamera.cameraMatrix.mat4[12],this._curCamera.cameraMatrix.mat4[13],this._curCamera.cameraMatrix.mat4[14],this._curCamera.cameraMatrix.mat4[15]),this.ambientLightColors.length=0,this.directionalLightDirections.length=0,this.directionalLightColors.length=0,this.pointLightPositions.length=0,this.pointLightColors.length=0},d.RendererGL.prototype.background=function(){var a=this._pInst.color.apply(this._pInst,arguments),b=a.levels[0]/255,c=a.levels[1]/255,d=a.levels[2]/255,e=a.levels[3]/255;this.GL.clearColor(b,c,d,e),this.GL.depthMask(!0),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},d.RendererGL.prototype.fill=function(a,b,c,f){var g=d.prototype.color.apply(this._pInst,arguments);this.curFillColor=g._array,this.isImmediateDrawing?this.setFillShader(this._getImmediateModeShader()):this.setFillShader(this._getColorShader()),this.drawMode=e.FILL,this.curFillShader.setUniform("uMaterialColor",this.curFillColor)},d.RendererGL.prototype.stroke=function(a,b,c,e){arguments[3]=255;var f=d.prototype.color.apply(this._pInst,arguments);this.curStrokeColor=f._array,this.curStrokeShader.setUniform("uMaterialColor",this.curStrokeColor),this.curPointShader.setUniform("uMaterialColor",f._array)},d.RendererGL.prototype.strokeWeight=function(a){this.curStrokeWeight!==a&&(this.pointSize=a,this.curStrokeWeight=a,this.curStrokeShader.setUniform("uStrokeWeight",a),this.curPointShader.setUniform("uPointSize",a))},d.RendererGL.prototype.get=function(a,b,c,e){return d.Renderer2D.prototype.get.apply(this,[a,b,c,e])},d.RendererGL.prototype.loadPixels=function(){if(!0!==this.attributes.preserveDrawingBuffer)return void console.log("loadPixels only works in WebGL when preserveDrawingBuffer is true.");var a=this._pInst._pixelDensity,b=this.width,c=this.height;b*=a,c*=a,void 0===this.pixels&&(this.pixels=new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4)),this.GL.readPixels(0,0,b,c,this.GL.RGBA,this.GL.UNSIGNED_BYTE,this.pixels),this._pInst._setProperty("pixels",this.pixels)},d.RendererGL.prototype.geometryInHash=function(a){return void 0!==this.gHash[a]},d.RendererGL.prototype.resize=function(a,b){d.Renderer.prototype.resize.call(this,a,b),this.GL.viewport(0,0,this.GL.drawingBufferWidth,this.GL.drawingBufferHeight),this._viewport=this.GL.getParameter(this.GL.VIEWPORT),this._curCamera._resize(),void 0!==this.pixels&&(this.pixels=new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4))},d.RendererGL.prototype.clear=function(){var a=arguments[0]||0,b=arguments[1]||0,c=arguments[2]||0,d=arguments[3]||0;this.GL.clearColor(a,b,c,d),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},d.RendererGL.prototype.translate=function(a,b,c){return a instanceof d.Vector&&(c=a.z,b=a.y,a=a.x),this.uMVMatrix.translate([a,b,c]),this},d.RendererGL.prototype.scale=function(a,b,c){return this.uMVMatrix.scale(a,b,c),this},d.RendererGL.prototype.rotate=function(a,b){return void 0===b?this.rotateZ(a):(arguments[0]=this._pInst._fromRadians(a),d.Matrix.prototype.rotate.apply(this.uMVMatrix,arguments),this)},d.RendererGL.prototype.rotateX=function(a){return this.rotate(a,1,0,0),this},d.RendererGL.prototype.rotateY=function(a){return this.rotate(a,0,1,0),this},d.RendererGL.prototype.rotateZ=function(a){return this.rotate(a,0,0,1),this},d.RendererGL.prototype.push=function(){var a=d.Renderer.prototype.push.apply(this),b=a.properties;return b.uMVMatrix=this.uMVMatrix.copy(),b.uPMatrix=this.uPMatrix.copy(),b._curCamera=this._curCamera,this._curCamera=this._curCamera.copy(),a},d.RendererGL.prototype.resetMatrix=function(){return this.uMVMatrix=d.Matrix.identity(this._pInst),this},d.RendererGL.prototype.setFillShader=function(a){return this.curFillShader!==a&&(this.curFillShader=a,this.curFillShader.init()),this.curFillShader},d.RendererGL.prototype.setPointShader=function(a){return this.curPointShader!==a&&(this.curPointShader=a,this.curPointShader.init()),this.curPointShader},d.RendererGL.prototype.setStrokeShader=function(a){return this.curStrokeShader!==a&&(this.curStrokeShader=a,this.curStrokeShader.init()),this.curStrokeShader},d.RendererGL.prototype._useLightShader=function(){return this.curFillShader&&this.curFillShader.isLightShader()||this.setFillShader(this._getLightShader()),this.curFillShader},d.RendererGL.prototype._useColorShader=function(){return this.curFillShader&&this.curFillShader!==this._defaultImmediateModeShader||this.setFillShader(this._getColorShader()),this.curFillShader},d.RendererGL.prototype._usePointShader=function(){return this.curPointShader||this.setPointShader(this._getPointShader()),this.curPointShader},d.RendererGL.prototype._useImmediateModeShader=function(){return this.curFillShader&&this.curFillShader!==this._defaultColorShader||this.setFillShader(this._getImmediateModeShader()),this.curFillShader},d.RendererGL.prototype._getLightShader=function(){return this._defaultLightShader||(this.attributes.perPixelLighting?this._defaultLightShader=new d.Shader(this,g.phongVert,g.phongFrag):this._defaultLightShader=new d.Shader(this,g.lightVert,g.lightTextureFrag)),this._defaultLightShader},d.RendererGL.prototype._getImmediateModeShader=function(){return this._defaultImmediateModeShader||(this._defaultImmediateModeShader=new d.Shader(this,g.immediateVert,g.vertexColorFrag)),this._defaultImmediateModeShader},d.RendererGL.prototype._getNormalShader=function(){return this._defaultNormalShader||(this._defaultNormalShader=new d.Shader(this,g.normalVert,g.normalFrag)),this._defaultNormalShader},d.RendererGL.prototype._getColorShader=function(){return this._defaultColorShader||(this._defaultColorShader=new d.Shader(this,g.normalVert,g.basicFrag)),this._defaultColorShader},d.RendererGL.prototype._getPointShader=function(){return this._defaultPointShader||(this._defaultPointShader=new d.Shader(this,g.pointVert,g.pointFrag)),this._defaultPointShader},d.RendererGL.prototype._getLineShader=function(){return this._defaultLineShader||(this._defaultLineShader=new d.Shader(this,g.lineVert,g.lineFrag)),this._defaultLineShader},d.RendererGL.prototype._getFontShader=function(){return this._defaultFontShader||(this.GL.getExtension("OES_standard_derivatives"),this._defaultFontShader=new d.Shader(this,g.fontVert,g.fontFrag)),this._defaultFontShader},d.RendererGL.prototype._getEmptyTexture=function(){if(!this._emptyTexture){var a=new d.Image(1,1);a.set(0,0,255),this._emptyTexture=new d.Texture(this,a)}return this._emptyTexture},d.RendererGL.prototype.getTexture=function(a){for(var b=this.textures,c=0;c2e4){var b,c=Object.prototype.toString,d="[object Array]",e=[],f=a.slice();b=f.pop();do{c.call(b)===d?f.push.apply(f,b):e.push(b)}while(f.length&&void 0!==(b=f.pop()));return e.reverse(),e}return[].concat.apply([],a)},d.RendererGL.prototype._vToNArray=function(a){return this._flatten(a.map(function(a){return[a.x,a.y,a.z]}))},d.prototype._assert3d=function(a){if(!this._renderer.isP3D)throw new Error(a+"() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/form-3d-primitives.html for more information.")},d.RendererGL.prototype._initTessy=function(){function a(a,b){b[b.length]=a[0],b[b.length]=a[1],b[b.length]=a[2]}function b(a){a!==f.primitiveType.GL_TRIANGLES&&console.log("expected TRIANGLES but got type: "+a)}function c(a){console.log("error callback"),console.log("error number: "+a)}function d(a,b,c){return[a[0],a[1],a[2]]}function e(a){}var g=new f.GluTesselator;return g.gluTessCallback(f.gluEnum.GLU_TESS_VERTEX_DATA,a),g.gluTessCallback(f.gluEnum.GLU_TESS_BEGIN,b),g.gluTessCallback(f.gluEnum.GLU_TESS_ERROR,c),g.gluTessCallback(f.gluEnum.GLU_TESS_COMBINE,d),g.gluTessCallback(f.gluEnum.GLU_TESS_EDGE_FLAG,e),g},d.RendererGL.prototype._triangulate=function(a){this._tessy.gluTessNormal(0,0,1);var b=[];this._tessy.gluTessBeginPolygon(b);for(var c=0;c1&&(g=g.substring(0,g.indexOf("[0]"))),f.name=g,f.type=e.type,f.type===a.SAMPLER_2D&&(f.samplerIndex=c,c++,this.samplers.push(f)),this.uniforms[g]=f}this._loadedUniforms=!0}},d.Shader.prototype.compile=function(){},d.Shader.prototype.bindShader=function(){this.init(),this._bound||(this.useProgram(),this._bound=!0,this.bindTextures(),this._setMatrixUniforms(),this===this._renderer.curStrokeShader&&this._setViewportUniform())},d.Shader.prototype.unbindShader=function(){return this._bound&&(this.unbindTextures(),this._bound=!1),this},d.Shader.prototype.bindTextures=function(){for(var a=this._renderer.GL,b=0;b1?b.length&&e.uniform1iv(d,b):e.uniform1i(d,b);break;case e.FLOAT:c.size>1?b.length&&e.uniform1fv(d,b):e.uniform1f(d,b);break;case e.FLOAT_MAT3:e.uniformMatrix3fv(d,!1,b);break;case e.FLOAT_MAT4:e.uniformMatrix4fv(d,!1,b);break;case e.FLOAT_VEC2:c.size>1?b.length&&e.uniform2fv(d,b):e.uniform2f(d,b[0],b[1]);break;case e.FLOAT_VEC3: +c.size>1?b.length&&e.uniform3fv(d,b):e.uniform3f(d,b[0],b[1],b[2]);break;case e.FLOAT_VEC4:c.size>1?b.length&&e.uniform4fv(d,b):e.uniform4f(d,b[0],b[1],b[2],b[3]);break;case e.INT_VEC2:c.size>1?b.length&&e.uniform2iv(d,b):e.uniform2i(d,b[0],b[1]);break;case e.INT_VEC3:c.size>1?b.length&&e.uniform3iv(d,b):e.uniform3i(d,b[0],b[1],b[2]);break;case e.INT_VEC4:c.size>1?b.length&&e.uniform4iv(d,b):e.uniform4i(d,b[0],b[1],b[2],b[3]);break;case e.SAMPLER_2D:e.activeTexture(e.TEXTURE0+c.samplerIndex),c.texture=this._renderer.getTexture(b),e.uniform1i(c.location,c.samplerIndex)}return this}},d.Shader.prototype.isLightShader=function(){return void 0!==this.uniforms.uUseLighting||void 0!==this.uniforms.uAmbientLightCount||void 0!==this.uniforms.uDirectionalLightCount||void 0!==this.uniforms.uPointLightCount||void 0!==this.uniforms.uAmbientColor||void 0!==this.uniforms.uDirectionalColor||void 0!==this.uniforms.uPointLightLocation||void 0!==this.uniforms.uPointLightColor||void 0!==this.uniforms.uLightingDirection||void 0!==this.uniforms.uSpecular},d.Shader.prototype.isTextureShader=function(){return this.samplerIndex>0},d.Shader.prototype.isColorShader=function(){return void 0!==this.attributes.aVertexColor||void 0!==this.uniforms.uMaterialColor},d.Shader.prototype.isTexLightShader=function(){return this.isLightShader()&&this.isTextureShader()},d.Shader.prototype.isStrokeShader=function(){return void 0!==this.uniforms.uStrokeWeight},d.Shader.prototype.enableAttrib=function(a,b,c,d,e,f){var g=this._renderer.GL;return-1!==a&&(g.enableVertexAttribArray(a),g.vertexAttribPointer(a,b,c,d,e,f)),this},b.exports=d.Shader},{"../core/main":24}],76:[function(a,b,c){"use strict";var d=a("../core/main"),e=a("../core/constants");d.Texture=function(a,b){this._renderer=a;var c=this._renderer.GL;this.src=b,this.glTex=void 0,this.glTarget=c.TEXTURE_2D,this.glFormat=c.RGBA,this.mipmaps=!1,this.glMinFilter=c.LINEAR,this.glMagFilter=c.LINEAR,this.glWrapS=c.CLAMP_TO_EDGE,this.glWrapT=c.CLAMP_TO_EDGE,this.isSrcMediaElement=void 0!==d.MediaElement&&b instanceof d.MediaElement,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==d.Element&&b instanceof d.Element&&!(b instanceof d.Graphics),this.isSrcP5Image=b instanceof d.Image,this.isSrcP5Graphics=b instanceof d.Graphics,this.isImageData="undefined"!=typeof ImageData&&b instanceof ImageData;var e=this._getTextureDataFromSource();return this.width=e.width,this.height=e.height,this.init(e),this},d.Texture.prototype._getTextureDataFromSource=function(){var a;return this.isSrcP5Image?a=this.src.canvas:this.isSrcMediaElement||this.isSrcP5Graphics||this.isSrcHTMLElement?a=this.src.elt:this.isImageData&&(a=this.src),a},d.Texture.prototype.init=function(a){var b=this._renderer.GL;if(this.glTex=b.createTexture(),this.bindTexture(),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,this.glMagFilter),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,this.glMinFilter),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,this.glWrapS),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,this.glWrapT),0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata){var c=new Uint8Array([1,1,1,1]);b.texImage2D(this.glTarget,0,b.RGBA,1,1,0,this.glFormat,b.UNSIGNED_BYTE,c)}else b.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,b.UNSIGNED_BYTE,a)},d.Texture.prototype.update=function(){var a=this.src;if(0===a.width||0===a.height)return!1;var b=this._getTextureDataFromSource(),c=!1,d=this._renderer.GL;return b.width!==this.width||b.height!==this.height?(c=!0,this.width=b.width,this.height=b.height,this.isSrcP5Image?a.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&a.setModified(!0)):this.isSrcP5Image?a.isModified()&&(c=!0,a.setModified(!1)):this.isSrcMediaElement?a.isModified()?(c=!0,a.setModified(!1)):a.loadedmetadata&&this._videoPrevUpdateTime!==a.time()&&(this._videoPrevUpdateTime=a.time(),c=!0):this.isImageData?a._dirty&&(a._dirty=!1,c=!0):c=!0,c&&(this.bindTexture(),d.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,d.UNSIGNED_BYTE,b)),c},d.Texture.prototype.bindTexture=function(){return this._renderer.GL.bindTexture(this.glTarget,this.glTex),this},d.Texture.prototype.unbindTexture=function(){this._renderer.GL.bindTexture(this.glTarget,null)},d.Texture.prototype.setInterpolation=function(a,b){var c=this._renderer.GL;a===e.NEAREST?this.glMinFilter=c.NEAREST:this.glMinFilter=c.LINEAR,b===e.NEAREST?this.glMagFilter=c.NEAREST:this.glMagFilter=c.LINEAR,this.bindTexture(),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,this.glMinFilter),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,this.glMagFilter),this.unbindTexture()},d.Texture.prototype.setWrapMode=function(a,b){var c=this._renderer.GL,d=function(a){return 0==(a&a-1)},f=d(this.width),g=d(this.width);a===e.REPEAT?f&&g?this.glWrapS=c.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=c.CLAMP_TO_EDGE):a===e.MIRROR?f&&g?this.glWrapS=c.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=c.CLAMP_TO_EDGE):this.glWrapS=c.CLAMP_TO_EDGE,b===e.REPEAT?f&&g?this.glWrapT=c.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=c.CLAMP_TO_EDGE):b===e.MIRROR?f&&g?this.glWrapT=c.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=c.CLAMP_TO_EDGE):this.glWrapT=c.CLAMP_TO_EDGE,this.bindTexture(),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,this.glWrapS),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()},b.exports=d.Texture},{"../core/constants":18,"../core/main":24}],77:[function(a,b,c){"use strict";function d(a,b){this.width=a,this.height=b,this.infos=[],this.findImage=function(a){var b=this.width*this.height;if(a>b)throw new Error("font is too complex to render in 3D");for(var c,d,e=this.infos.length-1;e>=0;--e){var f=this.infos[e];if(f.index+a0;){var e=a[d];b>e&&(b=e),cc?c:a}function d(a){return c(255*a,0,255)}function g(a,b,c,d){this.p0=a,this.c0=b,this.c1=c,this.p1=d,this.toQuadratic=function(){return{x:this.p0.x,y:this.p0.y,x1:this.p1.x,y1:this.p1.y,cx:(3*(this.c0.x+this.c1.x)-(this.p0.x+this.p1.x))/4,cy:(3*(this.c0.y+this.c1.y)-(this.p0.y+this.p1.y))/4}},this.quadError=function(){return f.Vector.sub(f.Vector.sub(this.p1,this.p0),f.Vector.mult(f.Vector.sub(this.c1,this.c0),3)).mag()/2},this.split=function(a){var b=f.Vector.lerp(this.p0,this.c0,a),c=f.Vector.lerp(this.c0,this.c1,a),d=f.Vector.lerp(b,c,a);this.c1=f.Vector.lerp(this.c1,this.p1,a),this.c0=f.Vector.lerp(c,this.c1,a);var e=f.Vector.lerp(d,this.c0,a),h=new g(this.p0,b,d,e);return this.p0=e,h},this.splitInflections=function(){var a=f.Vector.sub(this.c0,this.p0),b=f.Vector.sub(f.Vector.sub(this.c1,this.c0),a),c=f.Vector.sub(f.Vector.sub(f.Vector.sub(this.p1,this.c1),a),f.Vector.mult(b,2)),d=[],e=b.x*c.y-b.y*c.x;if(0!==e){var g=a.x*c.y-a.y*c.x,h=a.x*b.y-a.y*b.x,i=g*g-4*e*h;if(i>=0){e<0&&(e=-e,g=-g,h=-h);var j=Math.sqrt(i),k=(-g-j)/(2*e),l=(-g+j)/(2*e);k>0&&k<1&&(d.push(this.split(k)),l=1-(1-l)/(1-k)),l>0&&l<1&&d.push(this.split(l))}}return d.push(this),d}}function j(a,b,c,d,e,h,i,j){for(var k=new g(new f.Vector(a,b),new f.Vector(c,d),new f.Vector(e,h),new f.Vector(i,j)).splitInflections(),l=[],m=30/p,n=0;n=.125);){var s=Math.pow(o,1/3),t=q.split(s),u=q.split(1-s/(1-s));l.push(t),r.push(q),q=u}o<1&&l.push(q.split(.5)),l.push(q),Array.prototype.push.apply(l,r.reverse())}return l}function k(a,c,d,e){b([a,d],[c,e],{x:a,y:c,cx:(a+d)/2,cy:(c+e)/2})}function l(a,b,c,d){return Math.abs(c-a)<1e-5&&Math.abs(d-b)<1e-5}function m(a,b,c){for(var d=a.length,f=b.findImage(d),g=f.index,h=0,i=0;i>7,127&n,m>>7,127&m);for(var o=0;o>7,127&p,0,0)}}return{cellImageInfo:j,dimOffset:g,dimImageInfo:f}}var n=this.glyphInfos[a.index];if(n)return n;var o=a.getBoundingBox(),q=o.x1,r=o.y1,s=o.x2-q,t=o.y2-r,u=a.path.commands;if(0===s||0===t||!u.length)return this.glyphInfos[a.index]={};var v,w=[],x=[],y=[];for(v=h-1;v>=0;--v)y.push([]);for(v=i-1;v>=0;--v)x.push([]);for(var z,A,B,C,D=0;D=e)&&this._doFill){if(!this._isOpenType())return console.log("WEBGL: only opentype fonts are supported"),a;a.push();var p=this.curFillShader,r=this._doStroke,s=this.drawMode;this.curFillShader=null,this._doStroke=!1,this.drawMode=g.TEXTURE;var t=this._textFont.font,u=this._textFont._fontInfo;u||(u=this._textFont._fontInfo=new q(t));var v=this._textFont._handleAlignment(this,b,c,d),w=this._textSize,x=w/t.unitsPerEm;this.translate(v.x,v.y,0),this.scale(x,x,1);var y=this.GL,z=!this._defaultFontShader,A=this.setFillShader(this._getFontShader());z&&(A.setUniform("uGridImageSize",[l,m]),A.setUniform("uCellsImageSize",[n,o]),A.setUniform("uStrokeImageSize",[j,k]),A.setUniform("uGridSize",[h,i])),this._applyColorBlend(this.curFillColor);var B=this.gHash.glyph;if(!B){var C=this._textGeom=new f.Geometry(1,1,function(){for(var a=0;a<=1;a++)for(var b=0;b<=1;b++)this.vertices.push(new f.Vector(b,a,0)),this.uvs.push(b,a)});C.computeFaces().computeNormals(),B=this.createBuffers("glyph",C)}this._bindBuffer(B.vertexBuffer,y.ARRAY_BUFFER),A.enableAttrib(A.attributes.aPosition.location,3,y.FLOAT,!1,0,0),this._bindBuffer(B.indexBuffer,y.ELEMENT_ARRAY_BUFFER),this._bindBuffer(B.uvBuffer,y.ARRAY_BUFFER),A.enableAttrib(A.attributes.aTexCoord.location,2,y.FLOAT,!1,0,0),A.setUniform("uMaterialColor",this.curFillColor);try{for(var D=0,E=null,F=!1,G=t.stringToGlyphs(b),H=0;H + + + + + + + + + + + + + + diff --git a/sierpinski/sketch.js b/sierpinski/sketch.js new file mode 100644 index 0000000..878dd27 --- /dev/null +++ b/sierpinski/sketch.js @@ -0,0 +1,33 @@ +let v1, v2, v3; + +function setup() { + createCanvas(500, 450); + v1 = createVector(250, 50); + v2 = createVector(50, 396); + v3 = createVector(450, 396); + background(0); + stroke(255); + sierpinski(v1, v2, v3, 8); +} + +function sierpinski(p1, p2, p3, i) { + if (i === 1) tri(p1, p2, p3) + else { + let m1 = half(p2, p3); + let m2 = half(p3, p1); + let m3 = half(p1, p2) + sierpinski(p1, m3, m2, i-1); + sierpinski(p2, m3, m1, i-1); + sierpinski(p3, m1, m2, i-1); + } +} + +function tri(p1, p2, p3) { + line(p1.x, p1.y, p2.x, p2.y); + line(p1.x, p1.y, p3.x, p3.y); + line(p3.x, p3.y, p2.x, p2.y); +} + +function half(p1, p2) { + return p1.copy().add(p2).div(2); +}