(window.webpackJsonp=window.webpackJsonp||[]).push([[1],[function(e,t,r){(function(t){e.exports=function e(t,r,i){function a(o,s){if(!r[o]){if(!t[o]){if(n)return n(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return a(t[o][1][e]||e)}),u,u.exports,e,t,r,i)}return r[o].exports}for(var n=!1,o=0;o<i.length;o++)a(i[o]);return a}({1:[function(e,t,r){"use strict";r.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},r.toByteArray=function(e){for(var t,r=u(e),i=r[0],o=r[1],s=new n(3*(i+(c=o))/4-c),l=0,h=0<o?i-4:i,d=0;d<h;d+=4)t=a[e.charCodeAt(d)]<<18|a[e.charCodeAt(d+1)]<<12|a[e.charCodeAt(d+2)]<<6|a[e.charCodeAt(d+3)],s[l++]=t>>16&255,s[l++]=t>>8&255,s[l++]=255&t;var c;return 2===o&&(t=a[e.charCodeAt(d)]<<2|a[e.charCodeAt(d+1)]>>4,s[l++]=255&t),1===o&&(t=a[e.charCodeAt(d)]<<10|a[e.charCodeAt(d+1)]<<4|a[e.charCodeAt(d+2)]>>2,s[l++]=t>>8&255,s[l++]=255&t),s},r.fromByteArray=function(e){for(var t,r=e.length,a=r%3,n=[],o=0,s=r-a;o<s;o+=16383)n.push(h(e,o,s<o+16383?s:o+16383));return 1===a?(t=e[r-1],n.push(i[t>>2]+i[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-1],n.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"=")),n.join("")};for(var i=[],a=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=o.length;s<l;++s)i[s]=o[s],a[o.charCodeAt(s)]=s;function u(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function h(e,t,r){for(var a,n,o=[],s=t;s<r;s+=3)a=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(i[(n=a)>>18&63]+i[n>>12&63]+i[n>>6&63]+i[63&n]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],2:[function(e,t,r){},{}],3:[function(e,t,r){"use strict";var i=e("base64-js"),a=e("ieee754");r.Buffer=s,r.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},r.INSPECT_MAX_BYTES=50;var n=2147483647;function o(e){if(n<e)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"!=typeof e)return l(e,t,r);if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}function l(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|f(e,t),i=o(r),a=i.write(e,t);return a!==r&&(i=i.slice(0,a)),i}(e,t);if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(U(e,ArrayBuffer)||e&&U(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return(i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=s.prototype,i}(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return s.from(i,t,r);var a=function(e){if(s.isBuffer(e)){var t=0|c(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||F(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return u(e),o(e<0?0:0|c(e))}function d(e){for(var t=e.length<0?0:0|c(e.length),r=o(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}function c(e){if(n<=e)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function f(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||U(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=2<arguments.length&&!0===arguments[2];if(!i&&0===r)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return I(e).length;default:if(a)return i?-1:A(e).length;t=(""+t).toLowerCase(),a=!0}}function p(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function m(e,t,r,i,a){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=s.from(t,i)),s.isBuffer(t))return 0===t.length?-1:v(e,t,r,i,a);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,i,a);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,i,a){var n,o=1,s=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s/=o=2,l/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var h=-1;for(n=r;n<s;n++)if(u(e,n)===u(t,-1===h?0:n-h)){if(-1===h&&(h=n),n-h+1===l)return h*o}else-1!==h&&(n-=n-h),h=-1}else for(s<r+l&&(r=s-l),n=r;0<=n;n--){for(var d=!0,c=0;c<l;c++)if(u(e,n+c)!==u(t,c)){d=!1;break}if(d)return n}return-1}function g(e,t,r,i){r=Number(r)||0;var a=e.length-r;i?a<(i=Number(i))&&(i=a):i=a;var n=t.length;n/2<i&&(i=n/2);for(var o=0;o<i;++o){var s=parseInt(t.substr(2*o,2),16);if(F(s))return o;e[r+o]=s}return o}function y(e,t,r,i){return k(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function _(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function b(e,t,r){r=Math.min(e.length,r);for(var i=[],a=t;a<r;){var n,o,s,l,u=e[a],h=null,d=239<u?4:223<u?3:191<u?2:1;if(a+d<=r)switch(d){case 1:u<128&&(h=u);break;case 2:128==(192&(n=e[a+1]))&&127<(l=(31&u)<<6|63&n)&&(h=l);break;case 3:n=e[a+1],o=e[a+2],128==(192&n)&&128==(192&o)&&2047<(l=(15&u)<<12|(63&n)<<6|63&o)&&(l<55296||57343<l)&&(h=l);break;case 4:n=e[a+1],o=e[a+2],s=e[a+3],128==(192&n)&&128==(192&o)&&128==(192&s)&&65535<(l=(15&u)<<18|(63&n)<<12|(63&o)<<6|63&s)&&l<1114112&&(h=l)}null===h?(h=65533,d=1):65535<h&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),a+=d}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=x));return r}(i)}r.kMaxLength=n,(s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return l(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return a=t,n=r,u(i=e),i<=0?o(i):void 0!==a?"string"==typeof n?o(i).fill(a,n):o(i).fill(a):o(i);var i,a,n},s.allocUnsafe=function(e){return h(e)},s.allocUnsafeSlow=function(e){return h(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(U(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),U(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,i=t.length,a=0,n=Math.min(r,i);a<n;++a)if(e[a]!==t[a]){r=e[a],i=t[a];break}return r<i?-1:i<r?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(r=t=0;r<e.length;++r)t+=e[r].length;var i=s.allocUnsafe(t),a=0;for(r=0;r<e.length;++r){var n=e[r];if(U(n,Uint8Array)&&(n=s.from(n)),!s.isBuffer(n))throw new TypeError('"list" argument must be an Array of Buffers');n.copy(i,a),a+=n.length}return i},s.byteLength=f,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)p(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},s.prototype.toLocaleString=s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?b(this,0,e):function(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return w(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return _(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,i,a){if(U(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===a&&(a=this.length),t<0||r>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(a<=i&&r<=t)return 0;if(a<=i)return-1;if(r<=t)return 1;if(this===e)return 0;for(var n=(a>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0),l=Math.min(n,o),u=this.slice(i,a),h=e.slice(t,r),d=0;d<l;++d)if(u[d]!==h[d]){n=u[d],o=h[d];break}return n<o?-1:o<n?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},s.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var a=this.length-t;if((void 0===r||a<r)&&(r=a),0<e.length&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var n,o,s,l,u,h,d=!1;;)switch(i){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return u=t,h=r,k(A(e,this.length-u),this,u,h);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return y(this,e,t,r);case"base64":return s=t,l=r,k(I(e),this,s,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n=t,o=r,k(function(e,t){for(var r,i,a,n=[],o=0;o<e.length&&!((t-=2)<0);++o)i=(r=e.charCodeAt(o))>>8,a=r%256,n.push(a),n.push(i);return n}(e,this.length-n),this,n,o);default:if(d)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),d=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function w(e,t,r){var i="";r=Math.min(e.length,r);for(var a=t;a<r;++a)i+=String.fromCharCode(127&e[a]);return i}function S(e,t,r){var i="";r=Math.min(e.length,r);for(var a=t;a<r;++a)i+=String.fromCharCode(e[a]);return i}function M(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||i<r)&&(r=i);for(var a="",n=t;n<r;++n)a+=D(e[n]);return a}function E(e,t,r){for(var i=e.slice(t,r),a="",n=0;n<i.length;n+=2)a+=String.fromCharCode(i[n]+256*i[n+1]);return a}function T(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(r<e+t)throw new RangeError("Trying to access beyond buffer length")}function C(e,t,r,i,a,n){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(a<t||t<n)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function P(e,t,r,i,a,n){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,n){return t=+t,r>>>=0,n||P(e,0,r,4),a.write(e,t,r,i,23,4),r+4}function R(e,t,r,i,n){return t=+t,r>>>=0,n||P(e,0,r,8),a.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e);var i=this.subarray(e,t);return i.__proto__=s.prototype,i},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var i=this[e],a=1,n=0;++n<t&&(a*=256);)i+=this[e+n]*a;return i},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var i=this[e+--t],a=1;0<t&&(a*=256);)i+=this[e+--t]*a;return i},s.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var i=this[e],a=1,n=0;++n<t&&(a*=256);)i+=this[e+n]*a;return(a*=128)<=i&&(i-=Math.pow(2,8*t)),i},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var i=t,a=1,n=this[e+--i];0<i&&(a*=256);)n+=this[e+--i]*a;return(a*=128)<=n&&(n-=Math.pow(2,8*t)),n},s.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||T(e,4,this.length),a.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),a.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),a.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),a.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||C(this,e,t,r,Math.pow(2,8*r)-1,0);var a=1,n=0;for(this[t]=255&e;++n<r&&(a*=256);)this[t+n]=e/a&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||C(this,e,t,r,Math.pow(2,8*r)-1,0);var a=r-1,n=1;for(this[t+a]=255&e;0<=--a&&(n*=256);)this[t+a]=e/n&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var a=Math.pow(2,8*r-1);C(this,e,t,r,a-1,-a)}var n=0,o=1,s=0;for(this[t]=255&e;++n<r&&(o*=256);)e<0&&0===s&&0!==this[t+n-1]&&(s=1),this[t+n]=(e/o>>0)-s&255;return t+r},s.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){var a=Math.pow(2,8*r-1);C(this,e,t,r,a-1,-a)}var n=r-1,o=1,s=0;for(this[t+n]=255&e;0<=--n&&(o*=256);)e<0&&0===s&&0!==this[t+n+1]&&(s=1),this[t+n]=(e/o>>0)-s&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||C(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,i){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),0<i&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var a=i-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,i);else if(this===e&&r<t&&t<i)for(var n=a-1;0<=n;--n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return a},s.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var a=e.charCodeAt(0);("utf8"===i&&a<128||"latin1"===i)&&(e=a)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{var o=s.isBuffer(e)?e:s.from(e,i),l=o.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=o[n%l]}return this};var O=/[^+/0-9A-Za-z-_]/g;function D(e){return e<16?"0"+e.toString(16):e.toString(16)}function A(e,t){var r;t=t||1/0;for(var i=e.length,a=null,n=[],o=0;o<i;++o){if(55295<(r=e.charCodeAt(o))&&r<57344){if(!a){if(56319<r){-1<(t-=3)&&n.push(239,191,189);continue}if(o+1===i){-1<(t-=3)&&n.push(239,191,189);continue}a=r;continue}if(r<56320){-1<(t-=3)&&n.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&-1<(t-=3)&&n.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;n.push(r)}else if(r<2048){if((t-=2)<0)break;n.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;n.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;n.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return n}function I(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function k(e,t,r,i){for(var a=0;a<i&&!(a+r>=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function U(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}},{"base64-js":1,ieee754:8}],4:[function(e,t,r){"use strict";t.exports=e("./").polyfill()},{"./":5}],5:[function(e,r,i){(function(t,a){var n;n=function(){"use strict";function r(e){return"function"==typeof e}var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,o=void 0,s=void 0,l=function(e,t){m[n]=e,m[n+1]=t,2===(n+=2)&&(s?s(v):x())},u="undefined"!=typeof window?window:void 0,h=u||{},d=h.MutationObserver||h.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(v,1)}}var m=new Array(1e3);function v(){for(var e=0;e<n;e+=2)(0,m[e])(m[e+1]),m[e]=void 0,m[e+1]=void 0;n=0}var g,y,_,b,x=void 0;function w(e,t){var r=this,i=new this.constructor(E);void 0===i[M]&&N(i);var a=r._state;if(a){var n=arguments[a-1];l((function(){return U(a,i,n,r._result)}))}else I(r,i,e,t);return i}function S(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(E);return R(t,e),t}x=c?function(){return t.nextTick(v)}:d?(y=0,_=new d(v),b=document.createTextNode(""),_.observe(b,{characterData:!0}),function(){b.data=y=++y%2}):f?((g=new MessageChannel).port1.onmessage=v,function(){return g.port2.postMessage(0)}):void 0===u&&"function"==typeof e?function(){try{var e=Function("return this")().require("vertx");return void 0!==(o=e.runOnLoop||e.runOnContext)?function(){o(v)}:p()}catch(e){return p()}}():p();var M=Math.random().toString(36).substring(2);function E(){}var T=void 0,C={error:null};function P(e){try{return e.then}catch(e){return C.error=e,C}}function L(e,t,i){var a,n,o,s;t.constructor===e.constructor&&i===w&&t.constructor.resolve===S?(o=e,1===(s=t)._state?D(o,s._result):2===s._state?A(o,s._result):I(s,void 0,(function(e){return R(o,e)}),(function(e){return A(o,e)}))):i===C?(A(e,C.error),C.error=null):void 0===i?D(e,t):r(i)?(a=t,n=i,l((function(e){var t=!1,r=function(e,t,r,i){try{e.call(t,r,i)}catch(e){return e}}(n,a,(function(r){t||(t=!0,a!==r?R(e,r):D(e,r))}),(function(r){t||(t=!0,A(e,r))}),e._label);!t&&r&&(t=!0,A(e,r))}),e)):D(e,t)}function R(e,t){var r,i;e===t?A(e,new TypeError("You cannot resolve a promise with itself")):(i=typeof(r=t),null===r||"object"!==i&&"function"!==i?D(e,t):L(e,t,P(t)))}function O(e){e._onerror&&e._onerror(e._result),k(e)}function D(e,t){e._state===T&&(e._result=t,e._state=1,0!==e._subscribers.length&&l(k,e))}function A(e,t){e._state===T&&(e._state=2,e._result=t,l(O,e))}function I(e,t,r,i){var a=e._subscribers,n=a.length;e._onerror=null,a[n]=t,a[n+1]=r,a[n+2]=i,0===n&&e._state&&l(k,e)}function k(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var i=void 0,a=void 0,n=e._result,o=0;o<t.length;o+=3)i=t[o],a=t[o+r],i?U(r,i,a,n):a(n);e._subscribers.length=0}}function U(e,t,i,a){var n=r(i),o=void 0,s=void 0,l=void 0,u=void 0;if(n){if((o=function(e,t){try{return e(t)}catch(e){return C.error=e,C}}(i,a))===C?(u=!0,s=o.error,o.error=null):l=!0,t===o)return void A(t,new TypeError("A promises callback cannot return that same promise."))}else o=a,l=!0;t._state!==T||(n&&l?R(t,o):u?A(t,s):1===e?D(t,o):2===e&&A(t,o))}var F=0;function N(e){e[M]=F++,e._state=void 0,e._result=void 0,e._subscribers=[]}var B=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(E),this.promise[M]||N(this.promise),i(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&D(this.promise,this._result))):A(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===T&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,i=r.resolve;if(i===S){var a=P(e);if(a===w&&e._state!==T)this._settledAt(e._state,t,e._result);else if("function"!=typeof a)this._remaining--,this._result[t]=e;else if(r===G){var n=new r(E);L(n,e,a),this._willSettleAt(n,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e,t,r){var i=this.promise;i._state===T&&(this._remaining--,2===e?A(i,r):this._result[t]=r),0===this._remaining&&D(i,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;I(e,void 0,(function(e){return r._settledAt(1,t,e)}),(function(e){return r._settledAt(2,t,e)}))},e}(),G=function(){function e(t){this[M]=F++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t((function(t){R(e,t)}),(function(t){A(e,t)}))}catch(t){A(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var t=this.constructor;return r(e)?this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){throw r}))})):this.then(e,e)},e}();return G.prototype.then=w,G.all=function(e){return new B(this,e).promise},G.race=function(e){var t=this;return i(e)?new t((function(r,i){for(var a=e.length,n=0;n<a;n++)t.resolve(e[n]).then(r,i)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))},G.resolve=S,G.reject=function(e){var t=new this(E);return A(t,e),t},G._setScheduler=function(e){s=e},G._setAsap=function(e){l=e},G._asap=l,G.polyfill=function(){var e=void 0;if(void 0!==a)e=a;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=G},G.Promise=G},"object"==typeof i&&void 0!==r?r.exports=n():this.ES6Promise=n()}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:13}],6:[function(e,t,r){!function(e,i){if(void 0!==r&&void 0!==t)i(0,t);else{var a={exports:{}};i(0,a),e.fetchJsonp=a.exports}}(this,(function(e,t){"use strict";var r="callback";function i(e){try{delete window[e]}catch(t){window[e]=void 0}}function a(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=e,o=t.timeout||5e3,s=t.jsonpCallback||r,l=void 0;return new Promise((function(r,u){var h=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),d=s+"_"+h;window[h]=function(e){r({ok:!0,json:function(){return Promise.resolve(e)}}),l&&clearTimeout(l),a(d),i(h)},n+=-1===n.indexOf("?")?"?":"&";var c=document.createElement("script");c.setAttribute("src",""+n+s+"="+h),t.charset&&c.setAttribute("charset",t.charset),c.id=d,document.getElementsByTagName("head")[0].appendChild(c),l=setTimeout((function(){u(new Error("JSONP request to "+e+" timed out")),i(h),a(d),window[h]=function(){i(h)}}),o),c.onerror=function(){u(new Error("JSONP request to "+e+" failed")),i(h),a(d),l&&clearTimeout(l)}}))}}))},{}],7:[function(e,t,r){var i=i||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,r=function(){return e.URL||e.webkitURL||e},i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),a="download"in i,n=/constructor/i.test(e.HTMLElement)||e.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent),s=function(t){(e.setImmediate||e.setTimeout)((function(){throw t}),0)},l=function(e){setTimeout((function(){"string"==typeof e?r().revokeObjectURL(e):e.remove()}),4e4)},u=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},h=function(t,h,d){d||(t=u(t));var c,f=this,p="application/octet-stream"===t.type,m=function(){!function(e,t,r){for(var i=(t=[].concat(t)).length;i--;){var a=e["on"+t[i]];if("function"==typeof a)try{a.call(e,e)}catch(e){s(e)}}}(f,"writestart progress write writeend".split(" "))};if(f.readyState=f.INIT,a)return c=r().createObjectURL(t),void setTimeout((function(){var e,t;i.href=c,i.download=h,e=i,t=new MouseEvent("click"),e.dispatchEvent(t),m(),l(c),f.readyState=f.DONE}));!function(){if((o||p&&n)&&e.FileReader){var i=new FileReader;return i.onloadend=function(){var t=o?i.result:i.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,f.readyState=f.DONE,m()},i.readAsDataURL(t),f.readyState=f.INIT}c||(c=r().createObjectURL(t)),p?e.location.href=c:e.open(c,"_blank")||(e.location.href=c),f.readyState=f.DONE,m(),l(c)}()},d=h.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,r){return t=t||e.name||"download",r||(e=u(e)),navigator.msSaveOrOpenBlob(e,t)}:(d.abort=function(){},d.readyState=d.INIT=0,d.WRITING=1,d.DONE=2,d.error=d.onwritestart=d.onprogress=d.onwrite=d.onabort=d.onerror=d.onwriteend=null,function(e,t,r){return new h(e,t||e.name||"download",r)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);void 0!==t&&t.exports&&(t.exports.saveAs=i)},{}],8:[function(e,t,r){r.read=function(e,t,r,i,a){var n,o,s=8*a-i-1,l=(1<<s)-1,u=l>>1,h=-7,d=r?a-1:0,c=r?-1:1,f=e[t+d];for(d+=c,n=f&(1<<-h)-1,f>>=-h,h+=s;0<h;n=256*n+e[t+d],d+=c,h-=8);for(o=n&(1<<-h)-1,n>>=-h,h+=i;0<h;o=256*o+e[t+d],d+=c,h-=8);if(0===n)n=1-u;else{if(n===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,i),n-=u}return(f?-1:1)*o*Math.pow(2,n-i)},r.write=function(e,t,r,i,a,n){var o,s,l,u=8*n-a-1,h=(1<<u)-1,d=h>>1,c=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:n-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),2<=(t+=1<=o+d?c/l:c*Math.pow(2,1-d))*l&&(o++,l/=2),h<=o+d?(s=0,o=h):1<=o+d?(s=(t*l-1)*Math.pow(2,a),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,a),o=0));8<=a;e[r+f]=255&s,f+=p,s/=256,a-=8);for(o=o<<a|s,u+=a;0<u;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*m}},{}],9:[function(e,t,r){"use strict";var i;function a(e,t){return e.b===t.b&&e.a===t.a}function n(e,t){return e.b<t.b||e.b===t.b&&e.a<=t.a}function o(e,t,r){var i=t.b-e.b,a=r.b-t.b;return 0<i+a?i<a?t.a-e.a+i/(i+a)*(e.a-r.a):t.a-r.a+a/(i+a)*(r.a-e.a):0}function s(e,t,r){var i=t.b-e.b,a=r.b-t.b;return 0<i+a?(t.a-r.a)*i+(t.a-e.a)*a:0}function l(e,t){return e.a<t.a||e.a===t.a&&e.b<=t.b}function u(e,t,r){var i=t.a-e.a,a=r.a-t.a;return 0<i+a?i<a?t.b-e.b+i/(i+a)*(e.b-r.b):t.b-r.b+a/(i+a)*(r.b-e.b):0}function h(e,t,r){var i=t.a-e.a,a=r.a-t.a;return 0<i+a?(t.b-r.b)*i+(t.b-e.b)*a:0}function d(e,t,r,i){return(e=e<0?0:e)<=(r=r<0?0:r)?0===r?(t+i)/2:t+e/(e+r)*(i-t):i+r/(e+r)*(t-i)}function c(e){var t=g(e.b);return _(t,e.c),_(t.b,e.c),b(t,e.a),t}function f(e,t){var r=!1,i=!1;e!==t&&(t.a!==e.a&&(i=!0,w(t.a,e.a)),t.d!==e.d&&(r=!0,S(t.d,e.d)),y(t,e),i||(_(t,e.a),e.a.c=e),r||(b(t,e.d),e.d.a=e))}function p(e){var t=e.b,r=!1;e.d!==e.b.d&&(r=!0,S(e.d,e.b.d)),e.c===e?w(e.a,null):(e.b.d.a=J(e),e.a.c=e.c,y(e,J(e)),r||b(e,e.d)),t.c===t?(w(t.a,null),S(t.d,null)):(e.d.a=J(t),t.a.c=t.c,y(t,J(t))),x(e)}function m(e){var t=g(e),r=t.b;return y(t,e.e),t.a=e.b.a,_(r,t.a),t.d=r.d=e.d,t=t.b,y(e.b,J(e.b)),y(e.b,t),e.b.a=t.a,t.b.a.c=t.b,t.b.d=e.b.d,t.f=e.f,t.b.f=e.b.f,t}function v(e,t){var r=!1,i=g(e),a=i.b;return t.d!==e.d&&(r=!0,S(t.d,e.d)),y(i,e.e),y(a,t),i.a=e.b.a,a.a=t.a,i.d=a.d=e.d,e.d.a=a,r||b(i,e.d),i}function g(e){var t=new K,r=new K,i=e.b.h;return(((r.h=i).b.h=t).h=e).b.h=r,t.b=r,((t.c=t).e=r).b=t,(r.c=r).e=t}function y(e,t){var r=e.c,i=t.c;r.b.e=t,(i.b.e=e).c=i,t.c=r}function _(e,t){var r=t.f,i=new ee(t,r);for(r.e=i,r=(t.f=i).c=e;r.a=i,(r=r.c)!==e;);}function b(e,t){var r=t.d,i=new Q(t,r);for(r.b=i,(t.d=i).a=e,i.c=t.c,r=e;r.d=i,(r=r.e)!==e;);}function x(e){var t=e.h;e=e.b.h,(t.b.h=e).b.h=t}function w(e,t){for(var r=e.c,i=r;i.a=t,(i=i.c)!==r;);r=e.f,((i=e.e).f=r).e=i}function S(e,t){for(var r=e.a,i=r;i.d=t,(i=i.e)!==r;);r=e.d,((i=e.b).d=r).b=i}function M(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t}var E=4e150;function T(e,t){e.f+=t.f,e.b.f+=t.b.f}function C(e,t,r){return e=e.a,t=t.a,r=r.a,t.b.a===e?r.b.a===e?n(t.a,r.a)?s(r.b.a,t.a,r.a)<=0:0<=s(t.b.a,r.a,t.a):s(r.b.a,e,r.a)<=0:r.b.a===e?0<=s(t.b.a,e,t.a):(t=o(t.b.a,e,t.a),(e=o(r.b.a,e,r.a))<=t)}function P(e){e.a.i=null;var t=e.e;t.a.c=t.c,t.c.a=t.a,e.e=null}function L(e,t){p(e.a),e.c=!1,(e.a=t).i=e}function R(e){for(var t=e.a.a;(e=ce(e)).a.a===t;);return e.c&&(L(e,t=v(de(e).a.b,e.a.e)),e=ce(e)),e}function O(e,t,r){var i=new he;return i.a=r,i.e=W(e.f,t.e,i),r.i=i}function D(e,t){switch(e.s){case 100130:return 0!=(1&t);case 100131:return 0!==t;case 100132:return 0<t;case 100133:return t<0;case 100134:return 2<=t||t<=-2}return!1}function A(e){var t=e.a,r=t.d;r.c=e.d,r.a=t,P(e)}function I(e,t,r){for(t=(e=t).a;e!==r;){e.c=!1;var i=de(e),a=i.a;if(a.a!==t.a){if(!i.c){A(e);break}L(i,a=v(t.c.b,a.b))}t.c!==a&&(f(J(a),a),f(t,a)),A(e),t=i.a,e=i}return t}function k(e,t,r,i,a,n){for(var o=!0;O(e,t,r.b),(r=r.c)!==i;);for(null===a&&(a=de(t).a.b.c);(r=(i=de(t)).a.b).a===a.a;)r.c!==a&&(f(J(r),r),f(J(a),r)),i.f=t.f-r.f,i.d=D(e,i.f),t.b=!0,!o&&B(e,t)&&(T(r,a),P(t),p(a)),o=!1,t=i,a=r;t.b=!0,n&&j(e,t)}function U(e,t,r,i,a){var n=[t.g[0],t.g[1],t.g[2]];t.d=null,t.d=e.o&&e.o(n,r,i,e.c)||null,null===t.d&&(a?e.n||(Z(e,100156),e.n=!0):t.d=r[0])}function F(e,t,r){var i=[null,null,null,null];i[0]=t.a.d,i[1]=r.a.d,U(e,t.a,i,[.5,.5,0,0],!1),f(t,r)}function N(e,t,r,i,a){var n=Math.abs(t.b-e.b)+Math.abs(t.a-e.a),o=Math.abs(r.b-e.b)+Math.abs(r.a-e.a),s=a+1;i[a]=.5*o/(n+o),i[s]=.5*n/(n+o),e.g[0]+=i[a]*t.g[0]+i[s]*r.g[0],e.g[1]+=i[a]*t.g[1]+i[s]*r.g[1],e.g[2]+=i[a]*t.g[2]+i[s]*r.g[2]}function B(e,t){var r=de(t),i=t.a,o=r.a;if(n(i.a,o.a)){if(0<s(o.b.a,i.a,o.a))return!1;if(a(i.a,o.a)){if(i.a!==o.a){r=e.e;var l=i.a.h;if(0<=l){var u=(r=r.b).d,h=r.e,d=r.c,c=d[l];u[c]=u[r.a],(d[u[c]]=c)<=--r.a&&(c<=1?le(r,c):n(h[u[c>>1]],h[u[c]])?le(r,c):ue(r,c)),h[l]=null,d[l]=r.b,r.b=l}else for(r.c[-(l+1)]=null;0<r.a&&null===r.c[r.d[r.a-1]];)--r.a;F(e,J(o),i)}}else m(o.b),f(i,J(o)),t.b=r.b=!0}else{if(s(i.b.a,o.a,i.a)<0)return!1;ce(t).b=t.b=!0,m(i.b),f(J(o),i)}return!0}function G(e,t){var r=de(t),i=t.a,c=r.a,p=i.a,v=c.a,g=i.b.a,y=c.b.a,_=new ee;if(s(g,e.a,p),s(y,e.a,v),p===v||Math.min(p.a,g.a)>Math.max(v.a,y.a))return!1;if(n(p,v)){if(0<s(y,p,v))return!1}else if(s(g,v,p)<0)return!1;var b,x,w=g,S=p,M=y,E=v;if(n(w,S)||(b=w,w=S,S=b),n(M,E)||(b=M,M=E,E=b),n(w,M)||(b=w,w=M,M=b,b=S,S=E,E=b),n(M,S)?n(S,E)?((b=o(w,M,S))+(x=o(M,S,E))<0&&(b=-b,x=-x),_.b=d(b,M.b,x,S.b)):((b=s(w,M,S))+(x=-s(w,E,S))<0&&(b=-b,x=-x),_.b=d(b,M.b,x,E.b)):_.b=(M.b+S.b)/2,l(w,S)||(b=w,w=S,S=b),l(M,E)||(b=M,M=E,E=b),l(w,M)||(b=w,w=M,M=b,b=S,S=E,E=b),l(M,S)?l(S,E)?((b=u(w,M,S))+(x=u(M,S,E))<0&&(b=-b,x=-x),_.a=d(b,M.a,x,S.a)):((b=h(w,M,S))+(x=-h(w,E,S))<0&&(b=-b,x=-x),_.a=d(b,M.a,x,E.a)):_.a=(M.a+S.a)/2,n(_,e.a)&&(_.b=e.a.b,_.a=e.a.a),n(w=n(p,v)?p:v,_)&&(_.b=w.b,_.a=w.a),a(_,p)||a(_,v))return B(e,t),!1;if(!a(g,e.a)&&0<=s(g,e.a,_)||!a(y,e.a)&&s(y,e.a,_)<=0){if(y===e.a)return m(i.b),f(c.b,i),i=de(t=R(t)).a,I(e,de(t),r),k(e,t,J(i),i,i,!0),!0;if(g!==e.a)return 0<=s(g,e.a,_)&&(ce(t).b=t.b=!0,m(i.b),i.a.b=e.a.b,i.a.a=e.a.a),s(y,e.a,_)<=0&&(t.b=r.b=!0,m(c.b),c.a.b=e.a.b,c.a.a=e.a.a),!1;for(m(c.b),f(i.e,J(c)),v=(p=r=t).a.b.a;(p=ce(p)).a.b.a===v;);return p=de(t=p).a.b.c,r.a=J(c),k(e,t,(c=I(e,r,null)).c,i.b.c,p,!0),!0}return m(i.b),m(c.b),f(J(c),i),i.a.b=_.b,i.a.a=_.a,i.a.h=re(e.e,i.a),i=i.a,c=[0,0,0,0],_=[p.d,g.d,v.d,y.d],i.g[0]=i.g[1]=i.g[2]=0,N(i,p,g,c,0),N(i,v,y,c,2),U(e,i,_,c,!0),ce(t).b=t.b=r.b=!0,!1}function j(e,t){for(var r=de(t);;){for(;r.b;)r=de(t=r);if(!(t.b||null!==(t=ce(r=t))&&t.b))break;t.b=!1;var i,a=t.a,o=r.a;if(i=a.b.a!==o.b.a)e:{var l=de(i=t),u=i.a,h=l.a,d=void 0;if(n(u.b.a,h.b.a)){if(s(u.b.a,h.b.a,u.a)<0){i=!1;break e}ce(i).b=i.b=!0,d=m(u),f(h.b,d),d.d.c=i.d}else{if(0<s(h.b.a,u.b.a,h.a)){i=!1;break e}i.b=l.b=!0,d=m(h),f(u.e,h.b),d.b.d.c=i.d}i=!0}if(i&&(r.c?(P(r),p(o),o=(r=de(t)).a):t.c&&(P(t),p(a),a=(t=ce(r)).a)),a.a!==o.a)if(a.b.a===o.b.a||t.c||r.c||a.b.a!==e.a&&o.b.a!==e.a)B(e,t);else if(G(e,t))break;a.a===o.a&&a.b.a===o.b.a&&(T(o,a),P(t),p(a),t=ce(r))}}function V(e,t){for(var r=(e.a=t).c;null===r.i;)if((r=r.c)===t.c){r=e;var i=t;(u=new he).a=i.c.b;for(var o=(d=r.f).a;null!==(o=o.a).b&&!d.c(d.b,u,o.b););var l=de(d=o.b),u=d.a;if(o=l.a,0===s(u.b.a,i,u.a))a((u=d.a).a,i)||a(u.b.a,i)||(m(u.b),d.c&&(p(u.c),d.c=!1),f(i.c,u),V(r,i));else{var h=n(o.b.a,u.b.a)?d:l;l=void 0,d.d||h.c?(l=h===d?v(i.c.b,u.e):v(o.b.c.b,i.c).b,h.c?L(h,l):((d=O(u=r,d,l)).f=ce(d).f+d.a.f,d.d=D(u,d.f)),V(r,i)):k(r,d,i.c,i.c,null,!0)}return}if(d=(u=de(r=R(r.i))).a,(u=I(e,u,null)).c===d){u=(d=u).c,o=de(r),l=r.a,h=o.a;var d,c=!1;l.b.a!==h.b.a&&G(e,r),a(l.a,e.a)&&(f(J(u),l),u=de(r=R(r)).a,I(e,de(r),o),c=!0),a(h.a,e.a)&&(f(d,J(h)),d=I(e,o,null),c=!0),c?k(e,r,d.c,u,u,!0):(i=n(h.a,l.a)?J(h):l,k(e,r,i=v(d.c.b,i),i.c,i.c,!1),i.b.i.c=!0,j(e,r))}else k(e,r,u.c,d,d,!0)}function z(e,t){var r=new he,i=c(e.b);i.a.b=E,i.a.a=t,i.b.a.b=-E,i.b.a.a=t,e.a=i.b.a,r.a=i,r.f=0,r.d=!1,r.c=!1,r.h=!0,r.b=!1,i=W(i=e.f,i.a,r),r.e=i}function H(e){this.a=new X,this.b=e,this.c=C}function W(e,t,r){for(;null!==(t=t.c).b&&!e.c(e.b,t.b,r););return e=new X(r,t.a,t),t.a.c=e,t.a=e}function X(e,t,r){this.b=e||null,this.a=t||this,this.c=r||this}function q(){this.d=0,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}function Y(e,t){if(e.d!==t)for(;e.d!==t;)if(e.d<t)switch(e.d){case 0:Z(e,100151),e.u(null);break;case 1:Z(e,100152),e.t()}else switch(e.d){case 2:Z(e,100154),e.v();break;case 1:Z(e,100153),e.w()}}function Z(e,t){e.p&&e.p(t,e.c)}function Q(e,t){this.b=e||this,this.d=t||this,this.a=null,this.c=!1}function K(){(this.h=this).i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function J(e){return e.b.e}function $(){this.c=new ee,this.a=new Q,this.b=new K,this.d=new K,this.b.b=this.d,this.d.b=this.b}function ee(e,t){this.e=e||this,this.f=t||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function te(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ae}function re(e,t){if(e.e){var r,i=e.b,a=++i.a;return 2*a>i.f&&(i.f*=2,i.c=ne(i.c,i.f+1)),0===i.b?r=a:(r=i.b,i.b=i.c[i.b]),i.e[r]=t,i.c[r]=a,i.d[a]=r,i.h&&ue(i,a),r}return i=e.a++,e.c[i]=t,-(i+1)}function ie(e){if(0===e.a)return se(e.b);var t=e.c[e.d[e.a-1]];if(0!==e.b.a&&n(oe(e.b),t))return se(e.b);for(;--e.a,0<e.a&&null===e.c[e.d[e.a-1]];);return t}function ae(){this.d=ne([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function ne(e,t){for(var r=Array(t),i=0;i<e.length;i++)r[i]=e[i];for(;i<t;i++)r[i]=0;return r}function oe(e){return e.e[e.d[1]]}function se(e){var t=e.d,r=e.e,i=e.c,a=t[1],n=r[a];return 0<e.a&&(t[1]=t[e.a],i[t[1]]=1,r[a]=null,i[a]=e.b,e.b=a,0<--e.a&&le(e,1)),n}function le(e,t){for(var r=e.d,i=e.e,a=e.c,o=t,s=r[o];;){var l=o<<1;l<e.a&&n(i[r[l+1]],i[r[l]])&&(l+=1);var u=r[l];if(l>e.a||n(i[s],i[u])){a[r[o]=s]=o;break}a[r[o]=u]=o,o=l}}function ue(e,t){for(var r=e.d,i=e.e,a=e.c,o=t,s=r[o];;){var l=o>>1,u=r[l];if(0===l||n(i[u],i[s])){a[r[o]=s]=o;break}a[r[o]=u]=o,o=l}}function he(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function de(e){return e.e.c.b}function ce(e){return e.e.a.b}(i=q.prototype).x=function(){Y(this,0)},i.B=function(e,t){switch(e){case 100142:return;case 100140:switch(t){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=t)}break;case 100141:return void(this.m=!!t);default:return void Z(this,100900)}Z(this,100901)},i.y=function(e){switch(e){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Z(this,100900)}return!1},i.A=function(e,t,r){this.j[0]=e,this.j[1]=t,this.j[2]=r},i.z=function(e,t){var r=t||null;switch(e){case 100100:case 100106:this.h=r;break;case 100104:case 100110:this.l=r;break;case 100101:case 100107:this.k=r;break;case 100102:case 100108:this.i=r;break;case 100103:case 100109:this.p=r;break;case 100105:case 100111:this.o=r;break;case 100112:this.r=r;break;default:Z(this,100900)}},i.C=function(e,t){var r=!1,i=[0,0,0];Y(this,2);for(var a=0;a<3;++a){var n=e[a];n<-1e150&&(n=-1e150,r=!0),1e150<n&&(n=1e150,r=!0),i[a]=n}r&&Z(this,100155),null===(r=this.q)?f(r=c(this.b),r.b):(m(r),r=r.e),r.a.d=t,r.a.g[0]=i[0],r.a.g[1]=i[1],r.a.g[2]=i[2],r.f=1,r.b.f=-1,this.q=r},i.u=function(e){Y(this,0),this.d=1,this.b=new $,this.c=e},i.t=function(){Y(this,1),this.d=2,this.q=null},i.v=function(){Y(this,2),this.d=1},i.w=function(){Y(this,1),this.d=0;var e,t,r=!1,i=[d=this.j[0],o=this.j[1],u=this.j[2]];if(0===d&&0===o&&0===u){for(var o=[-2e150,-2e150,-2e150],l=[2e150,2e150,2e150],u=[],h=[],d=(r=this.b.c).e;d!==r;d=d.e)for(var c=0;c<3;++c){var f=d.g[c];f<l[c]&&(l[c]=f,h[c]=d),f>o[c]&&(o[c]=f,u[c]=d)}if(d=0,o[1]-l[1]>o[0]-l[0]&&(d=1),o[2]-l[2]>o[d]-l[d]&&(d=2),l[d]>=o[d])i[0]=0,i[1]=0,i[2]=1;else{for(o=0,l=h[d],u=u[d],h=[0,0,0],l=[l.g[0]-u.g[0],l.g[1]-u.g[1],l.g[2]-u.g[2]],c=[0,0,0],d=r.e;d!==r;d=d.e)c[0]=d.g[0]-u.g[0],c[1]=d.g[1]-u.g[1],c[2]=d.g[2]-u.g[2],h[0]=l[1]*c[2]-l[2]*c[1],h[1]=l[2]*c[0]-l[0]*c[2],h[2]=l[0]*c[1]-l[1]*c[0],o<(f=h[0]*h[0]+h[1]*h[1]+h[2]*h[2])&&(o=f,i[0]=h[0],i[1]=h[1],i[2]=h[2]);o<=0&&(i[0]=i[1]=i[2]=0,i[M(l)]=1)}r=!0}for(h=M(i),d=this.b.c,o=(h+1)%3,u=(h+2)%3,h=0<i[h]?1:-1,i=d.e;i!==d;i=i.e)i.b=i.g[o],i.a=h*i.g[u];if(r){for(i=0,d=(r=this.b.a).b;d!==r;d=d.b)if(!((o=d.a).f<=0))for(;i+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),(o=o.e)!==d.a;);if(i<0)for(r=(i=this.b.c).e;r!==i;r=r.e)r.a=-r.a}for(this.n=!1,d=(i=this.b.b).h;d!==i;d=r)r=d.h,o=d.e,a(d.a,d.b.a)&&d.e.e!==d&&(F(this,o,d),p(d),o=(d=o).e),o.e===d&&(o!==d&&(o!==r&&o!==r.b||(r=r.h),p(o)),d!==r&&d!==r.b||(r=r.h),p(d));for(this.e=i=new te,d=(r=this.b.c).e;d!==r;d=d.e)d.h=re(i,d);for(function(e){e.d=[];for(var t=0;t<e.a;t++)e.d[t]=t;var r;e.d.sort((r=e.c,function(e,t){return n(r[e],r[t])?1:-1})),e.e=!0,function(e){for(var t=e.a;1<=t;--t)le(e,t);e.h=!0}(e.b)}(i),this.f=new H(this),z(this,-E),z(this,E);null!==(i=ie(this.e));){for(;;){e:if(d=this.e,0===d.a)r=oe(d.b);else if(r=d.c[d.d[d.a-1]],0!==d.b.a&&(d=oe(d.b),n(d,r))){r=d;break e}if(null===r||!a(r,i))break;r=ie(this.e),F(this,i.c,r.c)}V(this,i)}for(this.a=this.f.a.a.b.a.a,i=0;null!==(r=this.f.a.a.b);)r.h||++i,P(r);for(this.f=null,(i=this.e).b=null,i.d=null,this.e=i.c=null,d=(i=this.b).a.b;d!==i.a;d=r)r=d.b,(d=d.a).e.e===d&&(T(d.c,d),p(d));if(!this.n){if(i=this.b,this.m)for(d=i.b.h;d!==i.b;d=r)r=d.h,d.b.d.c!==d.d.c?d.f=d.d.c?1:-1:p(d);else for(d=i.a.b;d!==i.a;d=r)if(r=d.b,d.c){for(d=d.a;n(d.b.a,d.a);d=d.c.b);for(;n(d.a,d.b.a);d=d.e);for(o=d.c.b,u=void 0;d.e!==o;)if(n(d.b.a,o.a)){for(;o.e!==d&&(n((t=o.e).b.a,t.a)||s(o.a,o.b.a,o.e.b.a)<=0);)o=(u=v(o.e,o)).b;o=o.c.b}else{for(;o.e!==d&&(n((e=d.c.b).a,e.b.a)||0<=s(d.b.a,d.a,d.c.b.a));)d=(u=v(d,d.c.b)).b;d=d.e}for(;o.e.e!==d;)o=(u=v(o.e,o)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(r=(i=this.b).a.b;r!==i.a;r=r.b)if(r.c){for(this.h&&this.h(2,this.c),d=r.a;this.k&&this.k(d.a.d,this.c),(d=d.e)!==r.a;);this.i&&this.i(this.c)}}else{for(i=this.b,r=!!this.l,d=!1,o=-1,u=i.a.d;u!==i.a;u=u.d)if(u.c)for(d||(this.h&&this.h(4,this.c),d=!0),h=u.a;r&&o!==(l=h.b.d.c?0:1)&&(o=l,this.l&&this.l(!!o,this.c)),this.k&&this.k(h.a.d,this.c),(h=h.e)!==u.a;);d&&this.i&&this.i(this.c)}if(this.r){for(d=(i=this.b).a.b;d!==i.a;d=r)if(r=d.b,!d.c){for(u=(o=d.a).e,h=void 0;u=(h=u).e,(h.d=null)===h.b.d&&(h.c===h?w(h.a,null):(h.a.c=h.c,y(h,J(h))),(l=h.b).c===l?w(l.a,null):(l.a.c=l.c,y(l,J(l))),x(h)),h!==o;);o=d.d,((d=d.b).d=o).b=d}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},this.libtess={GluTesselator:q,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}},q.prototype.gluDeleteTess=q.prototype.x,q.prototype.gluTessProperty=q.prototype.B,q.prototype.gluGetTessProperty=q.prototype.y,q.prototype.gluTessNormal=q.prototype.A,q.prototype.gluTessCallback=q.prototype.z,q.prototype.gluTessVertex=q.prototype.C,q.prototype.gluTessBeginPolygon=q.prototype.u,q.prototype.gluTessBeginContour=q.prototype.t,q.prototype.gluTessEndContour=q.prototype.v,q.prototype.gluTessEndPolygon=q.prototype.w,void 0!==t&&(t.exports=this.libtess)},{}],10:[function(e,t,r){"use strict";function i(e,t,r,i){for(var a=e[t++],n=1<<a,o=n+1,s=o+1,l=a+1,u=(1<<l)-1,h=0,d=0,c=0,f=e[t++],p=new Int32Array(4096),m=null;;){for(;h<16&&0!==f;)d|=e[t++]<<h,h+=8,1===f?f=e[t++]:--f;if(h<l)break;var v=d&u;if(d>>=l,h-=l,v!==n){if(v===o)break;for(var g=v<s?v:m,y=0,_=g;n<_;)_=p[_]>>8,++y;var b=_;if(i<c+y+(g!==v?1:0))return void console.log("Warning, gif stream longer than expected.");r[c++]=b;var x=c+=y;for(g!==v&&(r[c++]=b),_=g;y--;)_=p[_],r[--x]=255&_,_>>=8;null!==m&&s<4096&&(p[s++]=m<<8|b,u+1<=s&&l<12&&(++l,u=u<<1|1)),m=v}else s=o+1,u=(1<<(l=a+1))-1,m=null}return c!==i&&console.log("Warning, gif stream shorter than expected."),r}try{r.GifWriter=function(e,t,r,i){var a=0,n=void 0===(i=void 0===i?{}:i).loop?null:i.loop,o=void 0===i.palette?null:i.palette;if(t<=0||r<=0||65535<t||65535<r)throw new Error("Width/Height invalid.");function s(e){var t=e.length;if(t<2||256<t||t&t-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return t}e[a++]=71,e[a++]=73,e[a++]=70,e[a++]=56,e[a++]=57,e[a++]=97;var l=0,u=0;if(null!==o){for(var h=s(o);h>>=1;)++l;if(h=1<<l,--l,void 0!==i.background){if(h<=(u=i.background))throw new Error("Background index out of range.");if(0===u)throw new Error("Background index explicitly passed as 0.")}}if(e[a++]=255&t,e[a++]=t>>8&255,e[a++]=255&r,e[a++]=r>>8&255,e[a++]=(null!==o?128:0)|l,e[a++]=u,e[a++]=0,null!==o)for(var d=0,c=o.length;d<c;++d){var f=o[d];e[a++]=f>>16&255,e[a++]=f>>8&255,e[a++]=255&f}if(null!==n){if(n<0||65535<n)throw new Error("Loop count invalid.");e[a++]=33,e[a++]=255,e[a++]=11,e[a++]=78,e[a++]=69,e[a++]=84,e[a++]=83,e[a++]=67,e[a++]=65,e[a++]=80,e[a++]=69,e[a++]=50,e[a++]=46,e[a++]=48,e[a++]=3,e[a++]=1,e[a++]=255&n,e[a++]=n>>8&255,e[a++]=0}var p=!1;this.addFrame=function(t,r,i,n,l,u){if(!0===p&&(--a,p=!1),u=void 0===u?{}:u,t<0||r<0||65535<t||65535<r)throw new Error("x/y invalid.");if(i<=0||n<=0||65535<i||65535<n)throw new Error("Width/Height invalid.");if(l.length<i*n)throw new Error("Not enough pixels for the frame size.");var h=!0,d=u.palette;if(null==d&&(h=!1,d=o),null==d)throw new Error("Must supply either a local or global palette.");for(var c=s(d),f=0;c>>=1;)++f;c=1<<f;var m=void 0===u.delay?0:u.delay,v=void 0===u.disposal?0:u.disposal;if(v<0||3<v)throw new Error("Disposal out of range.");var g=!1,y=0;if(void 0!==u.transparent&&null!==u.transparent&&(g=!0,(y=u.transparent)<0||c<=y))throw new Error("Transparent color index.");if((0!==v||g||0!==m)&&(e[a++]=33,e[a++]=249,e[a++]=4,e[a++]=v<<2|(!0===g?1:0),e[a++]=255&m,e[a++]=m>>8&255,e[a++]=y,e[a++]=0),e[a++]=44,e[a++]=255&t,e[a++]=t>>8&255,e[a++]=255&r,e[a++]=r>>8&255,e[a++]=255&i,e[a++]=i>>8&255,e[a++]=255&n,e[a++]=n>>8&255,e[a++]=!0===h?128|f-1:0,!0===h)for(var _=0,b=d.length;_<b;++_){var x=d[_];e[a++]=x>>16&255,e[a++]=x>>8&255,e[a++]=255&x}return a=function(e,t,r,i){e[t++]=r;var a=t++,n=1<<r,o=n-1,s=n+1,l=s+1,u=r+1,h=0,d=0;function c(r){for(;r<=h;)e[t++]=255&d,d>>=8,h-=8,t===a+256&&(e[a]=255,a=t++)}function f(e){d|=e<<h,h+=u,c(8)}var p=i[0]&o,m={};f(n);for(var v=1,g=i.length;v<g;++v){var y=i[v]&o,_=p<<8|y,b=m[_];if(void 0===b){for(d|=p<<h,h+=u;8<=h;)e[t++]=255&d,d>>=8,h-=8,t===a+256&&(e[a]=255,a=t++);4096===l?(f(n),l=s+1,u=r+1,m={}):(1<<u<=l&&++u,m[_]=l++),p=y}else p=b}return f(p),f(s),c(1),a+1===t?e[a]=0:(e[a]=t-a-1,e[t++]=0),t}(e,a,f<2?2:f,l)},this.end=function(){return!1===p&&(e[a++]=59,p=!0),a},this.getOutputBuffer=function(){return e},this.setOutputBuffer=function(t){e=t},this.getOutputBufferPosition=function(){return a},this.setOutputBufferPosition=function(e){a=e}},r.GifReader=function(e){var t=0;if(71!==e[t++]||73!==e[t++]||70!==e[t++]||56!==e[t++]||56!=(e[t++]+1&253)||97!==e[t++])throw new Error("Invalid GIF 87a/89a header.");var r=e[t++]|e[t++]<<8,a=e[t++]|e[t++]<<8,n=e[t++],o=n>>7,s=1<<1+(7&n);e[t++],e[t++];var l=null,u=null;o&&(l=t,t+=3*(u=s));var h=!0,d=[],c=0,f=null,p=0,m=null;for(this.width=r,this.height=a;h&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(11!==e[t]||78==e[t+1]&&69==e[t+2]&&84==e[t+3]&&83==e[t+4]&&67==e[t+5]&&65==e[t+6]&&80==e[t+7]&&69==e[t+8]&&50==e[t+9]&&46==e[t+10]&&48==e[t+11]&&3==e[t+12]&&1==e[t+13]&&0==e[t+16])t+=14,m=e[t++]|e[t++]<<8,t++;else for(t+=12;;){if(!(0<=(C=e[t++])))throw Error("Invalid block size");if(0===C)break;t+=C}break;case 249:if(4!==e[t++]||0!==e[t+4])throw new Error("Invalid graphics extension block.");var v=e[t++];c=e[t++]|e[t++]<<8,f=e[t++],0==(1&v)&&(f=null),p=v>>2&7,t++;break;case 254:for(;;){if(!(0<=(C=e[t++])))throw Error("Invalid block size");if(0===C)break;t+=C}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var g=e[t++]|e[t++]<<8,y=e[t++]|e[t++]<<8,_=e[t++]|e[t++]<<8,b=e[t++]|e[t++]<<8,x=e[t++],w=x>>6&1,S=l,M=u,E=!1;x>>7&&(E=!0,S=t,t+=3*(M=1<<1+(7&x)));var T=t;for(t++;;){var C;if(!(0<=(C=e[t++])))throw Error("Invalid block size");if(0===C)break;t+=C}d.push({x:g,y:y,width:_,height:b,has_local_palette:E,palette_offset:S,palette_size:M,data_offset:T,data_length:t-T,transparent_index:f,interlaced:!!w,delay:c,disposal:p});break;case 59:h=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return d.length},this.loopCount=function(){return m},this.frameInfo=function(e){if(e<0||e>=d.length)throw new Error("Frame index out of range.");return d[e]},this.decodeAndBlitFrameBGRA=function(t,a){var n=this.frameInfo(t),o=n.width*n.height,s=new Uint8Array(o);i(e,n.data_offset,s,o);var l=n.palette_offset,u=n.transparent_index;null===u&&(u=256);var h=n.width,d=r-h,c=h,f=4*(n.y*r+n.x),p=4*((n.y+n.height)*r+n.x),m=f,v=4*d;!0===n.interlaced&&(v+=4*r*7);for(var g=8,y=0,_=s.length;y<_;++y){var b=s[y];if(0===c&&(c=h,p<=(m+=v)&&(v=4*d+4*r*(g-1),m=f+(h+d)*(g<<1),g>>=1)),b===u)m+=4;else{var x=e[l+3*b],w=e[l+3*b+1],S=e[l+3*b+2];a[m++]=S,a[m++]=w,a[m++]=x,a[m++]=255}--c}},this.decodeAndBlitFrameRGBA=function(t,a){var n=this.frameInfo(t),o=n.width*n.height,s=new Uint8Array(o);i(e,n.data_offset,s,o);var l=n.palette_offset,u=n.transparent_index;null===u&&(u=256);var h=n.width,d=r-h,c=h,f=4*(n.y*r+n.x),p=4*((n.y+n.height)*r+n.x),m=f,v=4*d;!0===n.interlaced&&(v+=4*r*7);for(var g=8,y=0,_=s.length;y<_;++y){var b=s[y];if(0===c&&(c=h,p<=(m+=v)&&(v=4*d+4*r*(g-1),m=f+(h+d)*(g<<1),g>>=1)),b===u)m+=4;else{var x=e[l+3*b],w=e[l+3*b+1],S=e[l+3*b+2];a[m++]=x,a[m++]=w,a[m++]=S,a[m++]=255}--c}}}}catch(e){}},{}],11:[function(e,t,r){(function(i){!function(t){"use strict";var r,a;function n(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function o(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new n,this.dtree=new n}String.prototype.codePointAt||(r=function(){try{var e={},t=Object.defineProperty,r=t(e,e,e)&&t}catch(e){}return r}(),a=function(e){if(null==this)throw TypeError();var t=String(this),r=t.length,i=e?Number(e):0;if(i!=i&&(i=0),!(i<0||r<=i)){var a,n=t.charCodeAt(i);return 55296<=n&&n<=56319&&i+1<r&&56320<=(a=t.charCodeAt(i+1))&&a<=57343?1024*(n-55296)+a-56320+65536:n}},r?r(String.prototype,"codePointAt",{value:a,configurable:!0,writable:!0}):String.prototype.codePointAt=a);var s=new n,l=new n,u=new Uint8Array(30),h=new Uint16Array(30),d=new Uint8Array(30),c=new Uint16Array(30),f=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),p=new n,m=new Uint8Array(320);function v(e,t,r,i){var a,n;for(a=0;a<r;++a)e[a]=0;for(a=0;a<30-r;++a)e[a+r]=a/r|0;for(n=i,a=0;a<30;++a)t[a]=n,n+=1<<e[a]}var g=new Uint16Array(16);function y(e,t,r,i){var a,n;for(a=0;a<16;++a)e.table[a]=0;for(a=0;a<i;++a)e.table[t[r+a]]++;for(a=n=e.table[0]=0;a<16;++a)g[a]=n,n+=e.table[a];for(a=0;a<i;++a)t[r+a]&&(e.trans[g[t[r+a]]++]=a)}function _(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function b(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var i=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,i+r}function x(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;for(var r=0,i=0,a=0,n=e.tag;i=2*i+(1&n),n>>>=1,++a,r+=t.table[a],0<=(i-=t.table[a]););return e.tag=n,e.bitcount-=a,t.trans[r+i]}function w(e,t,r){var i,a,n,o,s,l;for(i=b(e,5,257),a=b(e,5,1),n=b(e,4,4),o=0;o<19;++o)m[o]=0;for(o=0;o<n;++o){var u=b(e,3,0);m[f[o]]=u}for(y(p,m,0,19),s=0;s<i+a;){var h=x(e,p);switch(h){case 16:var d=m[s-1];for(l=b(e,2,3);l;--l)m[s++]=d;break;case 17:for(l=b(e,3,3);l;--l)m[s++]=0;break;case 18:for(l=b(e,7,11);l;--l)m[s++]=0;break;default:m[s++]=h}}y(t,m,0,i),y(r,m,i,a)}function S(e,t,r){for(;;){var i,a,n,o,s=x(e,t);if(256===s)return 0;if(s<256)e.dest[e.destLen++]=s;else for(i=b(e,u[s-=257],h[s]),a=x(e,r),o=n=e.destLen-b(e,d[a],c[a]);o<n+i;++o)e.dest[e.destLen++]=e.dest[o]}}function M(e){for(var t,r;8<e.bitcount;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return-3;for(e.sourceIndex+=4,r=t;r;--r)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,0}function E(e,t,r,i,a){return Math.pow(1-a,3)*e+3*Math.pow(1-a,2)*a*t+3*(1-a)*Math.pow(a,2)*r+Math.pow(a,3)*i}function T(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}function C(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}function P(e){throw new Error(e)}function L(e,t){e||P(t)}!function(e,t){var r;for(r=0;r<7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r<24;++r)e.trans[r]=256+r;for(r=0;r<144;++r)e.trans[24+r]=r;for(r=0;r<8;++r)e.trans[168+r]=280+r;for(r=0;r<112;++r)e.trans[176+r]=144+r;for(r=0;r<5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r<32;++r)t.trans[r]=r}(s,l),v(u,h,4,3),v(d,c,2,1),u[28]=0,h[28]=258,T.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},T.prototype.addPoint=function(e,t){"number"==typeof e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),"number"==typeof t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},T.prototype.addX=function(e){this.addPoint(e,null)},T.prototype.addY=function(e){this.addPoint(null,e)},T.prototype.addBezier=function(e,t,r,i,a,n,o,s){var l=this,u=[e,t],h=[r,i],d=[a,n],c=[o,s];this.addPoint(e,t),this.addPoint(o,s);for(var f=0;f<=1;f++){var p=6*u[f]-12*h[f]+6*d[f],m=-3*u[f]+9*h[f]-9*d[f]+3*c[f],v=3*h[f]-3*u[f];if(0!==m){var g=Math.pow(p,2)-4*v*m;if(!(g<0)){var y=(-p+Math.sqrt(g))/(2*m);0<y&&y<1&&(0===f&&l.addX(E(u[f],h[f],d[f],c[f],y)),1===f&&l.addY(E(u[f],h[f],d[f],c[f],y)));var _=(-p-Math.sqrt(g))/(2*m);0<_&&_<1&&(0===f&&l.addX(E(u[f],h[f],d[f],c[f],_)),1===f&&l.addY(E(u[f],h[f],d[f],c[f],_)))}}else{if(0===p)continue;var b=-v/p;0<b&&b<1&&(0===f&&l.addX(E(u[f],h[f],d[f],c[f],b)),1===f&&l.addY(E(u[f],h[f],d[f],c[f],b)))}}},T.prototype.addQuad=function(e,t,r,i,a,n){var o=e+2/3*(r-e),s=t+2/3*(i-t),l=o+1/3*(a-e),u=s+1/3*(n-t);this.addBezier(e,t,o,s,l,u,a,n)},C.prototype.moveTo=function(e,t){this.commands.push({type:"M",x:e,y:t})},C.prototype.lineTo=function(e,t){this.commands.push({type:"L",x:e,y:t})},C.prototype.curveTo=C.prototype.bezierCurveTo=function(e,t,r,i,a,n){this.commands.push({type:"C",x1:e,y1:t,x2:r,y2:i,x:a,y:n})},C.prototype.quadTo=C.prototype.quadraticCurveTo=function(e,t,r,i){this.commands.push({type:"Q",x1:e,y1:t,x:r,y:i})},C.prototype.close=C.prototype.closePath=function(){this.commands.push({type:"Z"})},C.prototype.extend=function(e){if(e.commands)e=e.commands;else if(e instanceof T){var t=e;return this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),void this.close()}Array.prototype.push.apply(this.commands,e)},C.prototype.getBoundingBox=function(){for(var e=new T,t=0,r=0,i=0,a=0,n=0;n<this.commands.length;n++){var o=this.commands[n];switch(o.type){case"M":e.addPoint(o.x,o.y),t=i=o.x,r=a=o.y;break;case"L":e.addPoint(o.x,o.y),i=o.x,a=o.y;break;case"Q":e.addQuad(i,a,o.x1,o.y1,o.x,o.y),i=o.x,a=o.y;break;case"C":e.addBezier(i,a,o.x1,o.y1,o.x2,o.y2,o.x,o.y),i=o.x,a=o.y;break;case"Z":i=t,a=r;break;default:throw new Error("Unexpected path command "+o.type)}}return e.isEmpty()&&e.addPoint(0,0),e},C.prototype.draw=function(e){e.beginPath();for(var t=0;t<this.commands.length;t+=1){var r=this.commands[t];"M"===r.type?e.moveTo(r.x,r.y):"L"===r.type?e.lineTo(r.x,r.y):"C"===r.type?e.bezierCurveTo(r.x1,r.y1,r.x2,r.y2,r.x,r.y):"Q"===r.type?e.quadraticCurveTo(r.x1,r.y1,r.x,r.y):"Z"===r.type&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())},C.prototype.toPathData=function(e){function t(){for(var t,r=arguments,i="",a=0;a<arguments.length;a+=1){var n=r[a];0<=n&&0<a&&(i+=" "),i+=(t=n,Math.round(t)===t?""+Math.round(t):t.toFixed(e))}return i}e=void 0!==e?e:2;for(var r="",i=0;i<this.commands.length;i+=1){var a=this.commands[i];"M"===a.type?r+="M"+t(a.x,a.y):"L"===a.type?r+="L"+t(a.x,a.y):"C"===a.type?r+="C"+t(a.x1,a.y1,a.x2,a.y2,a.x,a.y):"Q"===a.type?r+="Q"+t(a.x1,a.y1,a.x,a.y):"Z"===a.type&&(r+="Z")}return r},C.prototype.toSVG=function(e){var t='<path d="';return t+=this.toPathData(e),t+='"',this.fill&&"black"!==this.fill&&(null===this.fill?t+=' fill="none"':t+=' fill="'+this.fill+'"'),this.stroke&&(t+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),t+"/>"},C.prototype.toDOMElement=function(e){var t=this.toPathData(e),r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",t),r};var R={fail:P,argument:L,assert:L},O=2147483648,D={},A={},I={};function k(e){return function(){return e}}A.BYTE=function(e){return R.argument(0<=e&&e<=255,"Byte value should be between 0 and 255."),[e]},I.BYTE=k(1),A.CHAR=function(e){return[e.charCodeAt(0)]},I.CHAR=k(1),A.CHARARRAY=function(e){for(var t=[],r=0;r<e.length;r+=1)t[r]=e.charCodeAt(r);return t},I.CHARARRAY=function(e){return e.length},A.USHORT=function(e){return[e>>8&255,255&e]},I.USHORT=k(2),A.SHORT=function(e){return 32768<=e&&(e=-(65536-e)),[e>>8&255,255&e]},I.SHORT=k(2),A.UINT24=function(e){return[e>>16&255,e>>8&255,255&e]},I.UINT24=k(3),A.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},I.ULONG=k(4),A.LONG=function(e){return O<=e&&(e=-(2*O-e)),[e>>24&255,e>>16&255,e>>8&255,255&e]},I.LONG=k(4),A.FIXED=A.ULONG,I.FIXED=I.ULONG,A.FWORD=A.SHORT,I.FWORD=I.SHORT,A.UFWORD=A.USHORT,I.UFWORD=I.USHORT,A.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,255&e]},I.LONGDATETIME=k(8),A.TAG=function(e){return R.argument(4===e.length,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},I.TAG=k(4),A.Card8=A.BYTE,I.Card8=I.BYTE,A.Card16=A.USHORT,I.Card16=I.USHORT,A.OffSize=A.BYTE,I.OffSize=I.BYTE,A.SID=A.USHORT,I.SID=I.USHORT,A.NUMBER=function(e){return-107<=e&&e<=107?[e+139]:108<=e&&e<=1131?[247+((e-=108)>>8),255&e]:-1131<=e&&e<=-108?[251+((e=-e-108)>>8),255&e]:-32768<=e&&e<=32767?A.NUMBER16(e):A.NUMBER32(e)},I.NUMBER=function(e){return A.NUMBER(e).length},A.NUMBER16=function(e){return[28,e>>8&255,255&e]},I.NUMBER16=k(3),A.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,255&e]},I.NUMBER32=k(5),A.REAL=function(e){var t=e.toString(),r=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(r){var i=parseFloat("1e"+((r[2]?+r[2]:0)+r[1].length));t=(Math.round(e*i)/i).toString()}for(var a="",n=0,o=t.length;n<o;n+=1){var s=t[n];a+="e"===s?"-"===t[++n]?"c":"b":"."===s?"a":"-"===s?"e":s}for(var l=[30],u=0,h=(a+=1&a.length?"f":"ff").length;u<h;u+=2)l.push(parseInt(a.substr(u,2),16));return l},I.REAL=function(e){return A.REAL(e).length},A.NAME=A.CHARARRAY,I.NAME=I.CHARARRAY,A.STRING=A.CHARARRAY,I.STRING=I.CHARARRAY,D.UTF8=function(e,t,r){for(var i=[],a=r,n=0;n<a;n++,t+=1)i[n]=e.getUint8(t);return String.fromCharCode.apply(null,i)},D.UTF16=function(e,t,r){for(var i=[],a=r/2,n=0;n<a;n++,t+=2)i[n]=e.getUint16(t);return String.fromCharCode.apply(null,i)},A.UTF16=function(e){for(var t=[],r=0;r<e.length;r+=1){var i=e.charCodeAt(r);t[t.length]=i>>8&255,t[t.length]=255&i}return t},I.UTF16=function(e){return 2*e.length};var U={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ä¹²É³ÖÜ΅àâä΄¨çéèêë£™îï•½‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆćéŹźĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņŃ¬√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›ﬁﬂ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};D.MACSTRING=function(e,t,r,i){var a=U[i];if(void 0!==a){for(var n="",o=0;o<r;o++){var s=e.getUint8(t+o);n+=s<=127?String.fromCharCode(s):a[127&s]}return n}};var F,N="function"==typeof WeakMap&&new WeakMap;function B(e){return-128<=e&&e<=127}function G(e,t,r){for(var i=0,a=e.length;t<a&&i<64&&0===e[t];)++t,++i;return r.push(128|i-1),t}function j(e,t,r){for(var i=0,a=e.length,n=t;n<a&&i<64;){var o=e[n];if(!B(o))break;if(0===o&&n+1<a&&0===e[n+1])break;++n,++i}r.push(i-1);for(var s=t;s<n;++s)r.push(e[s]+256&255);return n}function V(e,t,r){for(var i=0,a=e.length,n=t;n<a&&i<64;){var o=e[n];if(0===o)break;if(B(o)&&n+1<a&&B(e[n+1]))break;++n,++i}r.push(64|i-1);for(var s=t;s<n;++s){var l=e[s];r.push(l+65536>>8&255,l+256&255)}return n}A.MACSTRING=function(e,t){var r=function(e){if(!F)for(var t in F={},U)F[t]=new String(t);var r=F[e];if(void 0!==r){if(N){var i=N.get(r);if(void 0!==i)return i}var a=U[e];if(void 0!==a){for(var n={},o=0;o<a.length;o++)n[a.charCodeAt(o)]=o+128;return N&&N.set(r,n),n}}}(t);if(void 0!==r){for(var i=[],a=0;a<e.length;a++){var n=e.charCodeAt(a);if(128<=n&&void 0===(n=r[n]))return;i[a]=n}return i}},I.MACSTRING=function(e,t){var r=A.MACSTRING(e,t);return void 0!==r?r.length:0},A.VARDELTAS=function(e){for(var t=0,r=[];t<e.length;){var i=e[t];t=0===i?G(e,t,r):-128<=i&&i<=127?j(e,t,r):V(e,t,r)}return r},A.INDEX=function(e){for(var t=1,r=[t],i=[],a=0;a<e.length;a+=1){var n=A.OBJECT(e[a]);Array.prototype.push.apply(i,n),t+=n.length,r.push(t)}if(0===i.length)return[0,0];for(var o=[],s=1+Math.floor(Math.log(t)/Math.log(2))/8|0,l=[void 0,A.BYTE,A.USHORT,A.UINT24,A.ULONG][s],u=0;u<r.length;u+=1){var h=l(r[u]);Array.prototype.push.apply(o,h)}return Array.prototype.concat(A.Card16(e.length),A.OffSize(s),o,i)},I.INDEX=function(e){return A.INDEX(e).length},A.DICT=function(e){for(var t=[],r=Object.keys(e),i=r.length,a=0;a<i;a+=1){var n=parseInt(r[a],0),o=e[n];t=(t=t.concat(A.OPERAND(o.value,o.type))).concat(A.OPERATOR(n))}return t},I.DICT=function(e){return A.DICT(e).length},A.OPERATOR=function(e){return e<1200?[e]:[12,e-1200]},A.OPERAND=function(e,t){var r=[];if(Array.isArray(t))for(var i=0;i<t.length;i+=1)R.argument(e.length===t.length,"Not enough arguments given for type"+t),r=r.concat(A.OPERAND(e[i],t[i]));else if("SID"===t)r=r.concat(A.NUMBER(e));else if("offset"===t)r=r.concat(A.NUMBER32(e));else if("number"===t)r=r.concat(A.NUMBER(e));else{if("real"!==t)throw new Error("Unknown operand type "+t);r=r.concat(A.REAL(e))}return r},A.OP=A.BYTE,I.OP=I.BYTE;var z="function"==typeof WeakMap&&new WeakMap;function H(e,t,r){for(var i=0;i<t.length;i+=1){var a=t[i];this[a.name]=a.value}if(this.tableName=e,this.fields=t,r)for(var n=Object.keys(r),o=0;o<n.length;o+=1){var s=n[o],l=r[s];void 0!==this[s]&&(this[s]=l)}}function W(e,t,r){void 0===r&&(r=t.length);var i=new Array(t.length+1);i[0]={name:e+"Count",type:"USHORT",value:r};for(var a=0;a<t.length;a++)i[a+1]={name:e+a,type:"USHORT",value:t[a]};return i}function X(e,t,r){var i=t.length,a=new Array(i+1);a[0]={name:e+"Count",type:"USHORT",value:i};for(var n=0;n<i;n++)a[n+1]={name:e+n,type:"TABLE",value:r(t[n],n)};return a}function q(e,t,r){var i=t.length,a=[];a[0]={name:e+"Count",type:"USHORT",value:i};for(var n=0;n<i;n++)a=a.concat(r(t[n],n));return a}function Y(e){1===e.format?H.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(W("glyph",e.glyphs))):R.assert(!1,"Can't create coverage table format 2 yet.")}function Z(e){H.call(this,"scriptListTable",q("scriptRecord",e,(function(e,t){var r=e.script,i=r.defaultLangSys;return R.assert(!!i,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new H("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new H("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:i.reqFeatureIndex}].concat(W("featureIndex",i.featureIndexes)))}].concat(q("langSys",r.langSysRecords,(function(e,t){var r=e.langSys;return[{name:"langSysTag"+t,type:"TAG",value:e.tag},{name:"langSys"+t,type:"TABLE",value:new H("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:r.reqFeatureIndex}].concat(W("featureIndex",r.featureIndexes)))}]}))))}]})))}function Q(e){H.call(this,"featureListTable",q("featureRecord",e,(function(e,t){var r=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new H("featureTable",[{name:"featureParams",type:"USHORT",value:r.featureParams}].concat(W("lookupListIndex",r.lookupListIndexes)))}]})))}function K(e,t){H.call(this,"lookupListTable",X("lookup",e,(function(e){var r=t[e.lookupType];return R.assert(!!r,"Unable to write GSUB lookup type "+e.lookupType+" tables."),new H("lookupTable",[{name:"lookupType",type:"USHORT",value:e.lookupType},{name:"lookupFlag",type:"USHORT",value:e.lookupFlag}].concat(X("subtable",e.subtables,r)))})))}A.CHARSTRING=function(e){if(z){var t=z.get(e);if(void 0!==t)return t}for(var r=[],i=e.length,a=0;a<i;a+=1){var n=e[a];r=r.concat(A[n.type](n.value))}return z&&z.set(e,r),r},I.CHARSTRING=function(e){return A.CHARSTRING(e).length},A.OBJECT=function(e){var t=A[e.type];return R.argument(void 0!==t,"No encoding function for type "+e.type),t(e.value)},I.OBJECT=function(e){var t=I[e.type];return R.argument(void 0!==t,"No sizeOf function for type "+e.type),t(e.value)},A.TABLE=function(e){for(var t=[],r=e.fields.length,i=[],a=[],n=0;n<r;n+=1){var o=e.fields[n],s=A[o.type];R.argument(void 0!==s,"No encoding function for field type "+o.type+" ("+o.name+")");var l=e[o.name];void 0===l&&(l=o.value);var u=s(l);"TABLE"===o.type?(a.push(t.length),t=t.concat([0,0]),i.push(u)):t=t.concat(u)}for(var h=0;h<i.length;h+=1){var d=a[h],c=t.length;R.argument(c<65536,"Table "+e.tableName+" too big."),t[d]=c>>8,t[d+1]=255&c,t=t.concat(i[h])}return t},I.TABLE=function(e){for(var t=0,r=e.fields.length,i=0;i<r;i+=1){var a=e.fields[i],n=I[a.type];R.argument(void 0!==n,"No sizeOf function for field type "+a.type+" ("+a.name+")");var o=e[a.name];void 0===o&&(o=a.value),t+=n(o),"TABLE"===a.type&&(t+=2)}return t},A.RECORD=A.TABLE,I.RECORD=I.TABLE,A.LITERAL=function(e){return e},I.LITERAL=function(e){return e.length},H.prototype.encode=function(){return A.TABLE(this)},H.prototype.sizeOf=function(){return I.TABLE(this)};var J={Table:H,Record:H,Coverage:(Y.prototype=Object.create(H.prototype)).constructor=Y,ScriptList:(Z.prototype=Object.create(H.prototype)).constructor=Z,FeatureList:(Q.prototype=Object.create(H.prototype)).constructor=Q,LookupList:(K.prototype=Object.create(H.prototype)).constructor=K,ushortList:W,tableList:X,recordList:q};function $(e,t){return e.getUint8(t)}function ee(e,t){return e.getUint16(t,!1)}function te(e,t){return e.getUint32(t,!1)}function re(e,t){return e.getInt16(t,!1)+e.getUint16(t+2,!1)/65535}var ie={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function ae(e,t){this.data=e,this.offset=t,this.relativeOffset=0}ae.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},ae.prototype.parseChar=function(){var e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},ae.prototype.parseCard8=ae.prototype.parseByte,ae.prototype.parseCard16=ae.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},ae.prototype.parseSID=ae.prototype.parseUShort,ae.prototype.parseOffset16=ae.prototype.parseUShort,ae.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},ae.prototype.parseF2Dot14=function(){var e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e},ae.prototype.parseOffset32=ae.prototype.parseULong=function(){var e=te(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},ae.prototype.parseFixed=function(){var e=re(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},ae.prototype.parseString=function(e){var t=this.data,r=this.offset+this.relativeOffset,i="";this.relativeOffset+=e;for(var a=0;a<e;a++)i+=String.fromCharCode(t.getUint8(r+a));return i},ae.prototype.parseTag=function(){return this.parseString(4)},ae.prototype.parseLongDateTime=function(){var e=te(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e},ae.prototype.parseVersion=function(e){var t=ee(this.data,this.offset+this.relativeOffset),r=ee(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,void 0===e&&(e=4096),t+r/e/10},ae.prototype.skip=function(e,t){void 0===t&&(t=1),this.relativeOffset+=ie[e]*t},ae.prototype.parseULongList=function(e){void 0===e&&(e=this.parseULong());for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getUint32(i),i+=4;return this.relativeOffset+=4*e,t},ae.prototype.parseOffset16List=ae.prototype.parseUShortList=function(e){void 0===e&&(e=this.parseUShort());for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getUint16(i),i+=2;return this.relativeOffset+=2*e,t},ae.prototype.parseShortList=function(e){for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getInt16(i),i+=2;return this.relativeOffset+=2*e,t},ae.prototype.parseByteList=function(e){for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,a=0;a<e;a++)t[a]=r.getUint8(i++);return this.relativeOffset+=e,t},ae.prototype.parseList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),i=0;i<e;i++)r[i]=t.call(this);return r},ae.prototype.parseList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),i=0;i<e;i++)r[i]=t.call(this);return r},ae.prototype.parseRecordList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),i=Object.keys(t),a=0;a<e;a++){for(var n={},o=0;o<i.length;o++){var s=i[o],l=t[s];n[s]=l.call(this)}r[a]=n}return r},ae.prototype.parseRecordList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),i=Object.keys(t),a=0;a<e;a++){for(var n={},o=0;o<i.length;o++){var s=i[o],l=t[s];n[s]=l.call(this)}r[a]=n}return r},ae.prototype.parseStruct=function(e){if("function"==typeof e)return e.call(this);for(var t=Object.keys(e),r={},i=0;i<t.length;i++){var a=t[i],n=e[a];r[a]=n.call(this)}return r},ae.prototype.parseValueRecord=function(e){if(void 0===e&&(e=this.parseUShort()),0!==e){var t={};return 1&e&&(t.xPlacement=this.parseShort()),2&e&&(t.yPlacement=this.parseShort()),4&e&&(t.xAdvance=this.parseShort()),8&e&&(t.yAdvance=this.parseShort()),16&e&&(t.xPlaDevice=void 0,this.parseShort()),32&e&&(t.yPlaDevice=void 0,this.parseShort()),64&e&&(t.xAdvDevice=void 0,this.parseShort()),128&e&&(t.yAdvDevice=void 0,this.parseShort()),t}},ae.prototype.parseValueRecordList=function(){for(var e=this.parseUShort(),t=this.parseUShort(),r=new Array(t),i=0;i<t;i++)r[i]=this.parseValueRecord(e);return r},ae.prototype.parsePointer=function(e){var t=this.parseOffset16();if(0<t)return new ae(this.data,this.offset+t).parseStruct(e)},ae.prototype.parsePointer32=function(e){var t=this.parseOffset32();if(0<t)return new ae(this.data,this.offset+t).parseStruct(e)},ae.prototype.parseListOfLists=function(e){for(var t=this,r=this.parseOffset16List(),i=r.length,a=this.relativeOffset,n=new Array(i),o=0;o<i;o++){var s=r[o];if(0!==s)if(t.relativeOffset=s,e){for(var l=t.parseOffset16List(),u=new Array(l.length),h=0;h<l.length;h++)t.relativeOffset=s+l[h],u[h]=e.call(t);n[o]=u}else n[o]=t.parseUShortList();else n[o]=void 0}return this.relativeOffset=a,n},ae.prototype.parseCoverage=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort(),r=this.parseUShort();if(1===t)return{format:1,glyphs:this.parseUShortList(r)};if(2!==t)throw new Error("0x"+e.toString(16)+": Coverage format must be 1 or 2.");for(var i=new Array(r),a=0;a<r;a++)i[a]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:i}},ae.prototype.parseClassDef=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(1===t)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(2===t)return{format:2,ranges:this.parseRecordList({start:ae.uShort,end:ae.uShort,classId:ae.uShort})};throw new Error("0x"+e.toString(16)+": ClassDef format must be 1 or 2.")},ae.list=function(e,t){return function(){return this.parseList(e,t)}},ae.list32=function(e,t){return function(){return this.parseList32(e,t)}},ae.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}},ae.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}},ae.pointer=function(e){return function(){return this.parsePointer(e)}},ae.pointer32=function(e){return function(){return this.parsePointer32(e)}},ae.tag=ae.prototype.parseTag,ae.byte=ae.prototype.parseByte,ae.uShort=ae.offset16=ae.prototype.parseUShort,ae.uShortList=ae.prototype.parseUShortList,ae.uLong=ae.offset32=ae.prototype.parseULong,ae.uLongList=ae.prototype.parseULongList,ae.struct=ae.prototype.parseStruct,ae.coverage=ae.prototype.parseCoverage,ae.classDef=ae.prototype.parseClassDef;var ne={reserved:ae.uShort,reqFeatureIndex:ae.uShort,featureIndexes:ae.uShortList};ae.prototype.parseScriptList=function(){return this.parsePointer(ae.recordList({tag:ae.tag,script:ae.pointer({defaultLangSys:ae.pointer(ne),langSysRecords:ae.recordList({tag:ae.tag,langSys:ae.pointer(ne)})})}))||[]},ae.prototype.parseFeatureList=function(){return this.parsePointer(ae.recordList({tag:ae.tag,feature:ae.pointer({featureParams:ae.offset16,lookupListIndexes:ae.uShortList})}))||[]},ae.prototype.parseLookupList=function(e){return this.parsePointer(ae.list(ae.pointer((function(){var t=this.parseUShort();R.argument(1<=t&&t<=9,"GPOS/GSUB lookup type "+t+" unknown.");var r=this.parseUShort(),i=16&r;return{lookupType:t,lookupFlag:r,subtables:this.parseList(ae.pointer(e[t])),markFilteringSet:i?this.parseUShort():void 0}}))))||[]},ae.prototype.parseFeatureVariationsList=function(){return this.parsePointer32((function(){var e=this.parseUShort(),t=this.parseUShort();return R.argument(1===e&&t<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:ae.offset32,featureTableSubstitutionOffset:ae.offset32})}))||[]};var oe={getByte:$,getCard8:$,getUShort:ee,getCard16:ee,getShort:function(e,t){return e.getInt16(t,!1)},getULong:te,getFixed:re,getTag:function(e,t){for(var r="",i=t;i<t+4;i+=1)r+=String.fromCharCode(e.getInt8(i));return r},getOffset:function(e,t,r){for(var i=0,a=0;a<r;a+=1)i<<=8,i+=e.getUint8(t+a);return i},getBytes:function(e,t,r){for(var i=[],a=t;a<r;a+=1)i.push(e.getUint8(a));return i},bytesToString:function(e){for(var t="",r=0;r<e.length;r+=1)t+=String.fromCharCode(e[r]);return t},Parser:ae},se=function(e,t){var r={};r.version=oe.getUShort(e,t),R.argument(0===r.version,"cmap table version should be 0."),r.numTables=oe.getUShort(e,t+2);for(var i=-1,a=r.numTables-1;0<=a;a-=1){var n=oe.getUShort(e,t+4+8*a),o=oe.getUShort(e,t+4+8*a+2);if(3===n&&(0===o||1===o||10===o)||0===n&&(0===o||1===o||2===o||3===o||4===o)){i=oe.getULong(e,t+4+8*a+4);break}}if(-1===i)throw new Error("No valid cmap sub-tables found.");var s=new oe.Parser(e,t+i);if(r.format=s.parseUShort(),12===r.format)!function(e,t){var r;t.parseUShort(),e.length=t.parseULong(),e.language=t.parseULong(),e.groupCount=r=t.parseULong(),e.glyphIndexMap={};for(var i=0;i<r;i+=1)for(var a=t.parseULong(),n=t.parseULong(),o=t.parseULong(),s=a;s<=n;s+=1)e.glyphIndexMap[s]=o,o++}(r,s);else{if(4!==r.format)throw new Error("Only format 4 and 12 cmap tables are supported (found format "+r.format+").");!function(e,t,r,i,a){var n;e.length=t.parseUShort(),e.language=t.parseUShort(),e.segCount=n=t.parseUShort()>>1,t.skip("uShort",3),e.glyphIndexMap={};for(var o=new oe.Parser(r,i+a+14),s=new oe.Parser(r,i+a+16+2*n),l=new oe.Parser(r,i+a+16+4*n),u=new oe.Parser(r,i+a+16+6*n),h=i+a+16+8*n,d=0;d<n-1;d+=1)for(var c=void 0,f=o.parseUShort(),p=s.parseUShort(),m=l.parseShort(),v=u.parseUShort(),g=p;g<=f;g+=1)0!==v?(h=u.offset+u.relativeOffset-2,h+=v,h+=2*(g-p),0!==(c=oe.getUShort(r,h))&&(c=c+m&65535)):c=g+m&65535,e.glyphIndexMap[g]=c}(r,s,e,t,i)}return r},le=function(e){var t,r=!0;for(t=e.length-1;0<t;t-=1)if(65535<e.get(t).unicode){console.log("Adding CMAP format 12 (needed!)"),r=!1;break}var i=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:r?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:r?12:20}];r||(i=i.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),i=i.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 a,n,o,s=new J.Table("cmap",i);for(s.segments=[],t=0;t<e.length;t+=1){for(var l=e.get(t),u=0;u<l.unicodes.length;u+=1)a=s,n=l.unicodes[u],o=t,a.segments.push({end:n,start:n,delta:-(n-o),offset:0,glyphIndex:o});s.segments=s.segments.sort((function(e,t){return e.start-t.start}))}s.segments.push({end:65535,start:65535,delta:1,offset:0});var h=s.segments.length,d=0,c=[],f=[],p=[],m=[],v=[],g=[];for(t=0;t<h;t+=1){var y=s.segments[t];y.end<=65535&&y.start<=65535?(c=c.concat({name:"end_"+t,type:"USHORT",value:y.end}),f=f.concat({name:"start_"+t,type:"USHORT",value:y.start}),p=p.concat({name:"idDelta_"+t,type:"SHORT",value:y.delta}),m=m.concat({name:"idRangeOffset_"+t,type:"USHORT",value:y.offset}),void 0!==y.glyphId&&(v=v.concat({name:"glyph_"+t,type:"USHORT",value:y.glyphId}))):d+=1,r||void 0===y.glyphIndex||(g=(g=(g=g.concat({name:"cmap12Start_"+t,type:"ULONG",value:y.start})).concat({name:"cmap12End_"+t,type:"ULONG",value:y.end})).concat({name:"cmap12Glyph_"+t,type:"ULONG",value:y.glyphIndex}))}if(s.segCountX2=2*(h-d),s.searchRange=2*Math.pow(2,Math.floor(Math.log(h-d)/Math.log(2))),s.entrySelector=Math.log(s.searchRange/2)/Math.log(2),s.rangeShift=s.segCountX2-s.searchRange,s.fields=s.fields.concat(c),s.fields.push({name:"reservedPad",type:"USHORT",value:0}),s.fields=s.fields.concat(f),s.fields=s.fields.concat(p),s.fields=s.fields.concat(m),s.fields=s.fields.concat(v),s.cmap4Length=14+2*c.length+2+2*f.length+2*p.length+2*m.length+2*v.length,!r){var _=16+4*g.length;s.cmap12Offset=20+s.cmap4Length,s.fields=s.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:_},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:g.length/3}]),s.fields=s.fields.concat(g)}return s},ue=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],he=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],de=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ce=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function fe(e){this.font=e}function pe(e){this.cmap=e}function me(e,t){this.encoding=e,this.charset=t}function ve(e){switch(e.version){case 1:this.names=ce.slice();break;case 2:this.names=new Array(e.numberOfGlyphs);for(var t=0;t<e.numberOfGlyphs;t++)e.glyphNameIndex[t]<ce.length?this.names[t]=ce[e.glyphNameIndex[t]]:this.names[t]=e.names[e.glyphNameIndex[t]-ce.length];break;case 2.5:this.names=new Array(e.numberOfGlyphs);for(var r=0;r<e.numberOfGlyphs;r++)this.names[r]=ce[r+e.glyphNameIndex[r]];break;case 3:default:this.names=[]}}fe.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),r=this.font.glyphs;if(r)for(var i=0;i<r.length;i+=1)for(var a=r.get(i),n=0;n<a.unicodes.length;n+=1)if(a.unicodes[n]===t)return i;return null},pe.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.codePointAt(0)]||0},me.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),r=this.encoding[t];return this.charset.indexOf(r)},ve.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},ve.prototype.glyphIndexToName=function(e){return this.names[e]};var ge=function(e,t,r,i,a){e.beginPath(),e.moveTo(t,r),e.lineTo(i,a),e.stroke()};function ye(e){this.bindConstructorValues(e)}function _e(e,t,r){Object.defineProperty(e,t,{get:function(){return e.path,e[r]},set:function(t){e[r]=t},enumerable:!0,configurable:!0})}function be(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(var r=0;r<t.length;r++)this.glyphs[r]=t[r];this.length=t&&t.length||0}ye.prototype.bindConstructorValues=function(e){var t,r;this.index=e.index||0,this.name=e.name||null,this.unicode=e.unicode||void 0,this.unicodes=e.unicodes||void 0!==e.unicode?[e.unicode]:[],e.xMin&&(this.xMin=e.xMin),e.yMin&&(this.yMin=e.yMin),e.xMax&&(this.xMax=e.xMax),e.yMax&&(this.yMax=e.yMax),e.advanceWidth&&(this.advanceWidth=e.advanceWidth),Object.defineProperty(this,"path",(t=e.path,r=t||new C,{configurable:!0,get:function(){return"function"==typeof r&&(r=r()),r},set:function(e){r=e}}))},ye.prototype.addUnicode=function(e){0===this.unicodes.length&&(this.unicode=e),this.unicodes.push(e)},ye.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},ye.prototype.getPath=function(e,t,r,i,a){var n,o;e=void 0!==e?e:0,t=void 0!==t?t:0,r=void 0!==r?r:72,i||(i={});var s=i.xScale,l=i.yScale;if(i.hinting&&a&&a.hinting&&(o=this.path&&a.hinting.exec(this,r)),o)n=a.hinting.getCommands(o),e=Math.round(e),t=Math.round(t),s=l=1;else{n=this.path.commands;var u=1/this.path.unitsPerEm*r;void 0===s&&(s=u),void 0===l&&(l=u)}for(var h=new C,d=0;d<n.length;d+=1){var c=n[d];"M"===c.type?h.moveTo(e+c.x*s,t+-c.y*l):"L"===c.type?h.lineTo(e+c.x*s,t+-c.y*l):"Q"===c.type?h.quadraticCurveTo(e+c.x1*s,t+-c.y1*l,e+c.x*s,t+-c.y*l):"C"===c.type?h.curveTo(e+c.x1*s,t+-c.y1*l,e+c.x2*s,t+-c.y2*l,e+c.x*s,t+-c.y*l):"Z"===c.type&&h.closePath()}return h},ye.prototype.getContours=function(){if(void 0===this.points)return[];for(var e=[],t=[],r=0;r<this.points.length;r+=1){var i=this.points[r];t.push(i),i.lastPointOfContour&&(e.push(t),t=[])}return R.argument(0===t.length,"There are still points left in the current contour."),e},ye.prototype.getMetrics=function(){for(var e=this.path.commands,t=[],r=[],i=0;i<e.length;i+=1){var a=e[i];"Z"!==a.type&&(t.push(a.x),r.push(a.y)),"Q"!==a.type&&"C"!==a.type||(t.push(a.x1),r.push(a.y1)),"C"===a.type&&(t.push(a.x2),r.push(a.y2))}var n={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,r),leftSideBearing:this.leftSideBearing};return isFinite(n.xMin)||(n.xMin=0),isFinite(n.xMax)||(n.xMax=this.advanceWidth),isFinite(n.yMin)||(n.yMin=0),isFinite(n.yMax)||(n.yMax=0),n.rightSideBearing=this.advanceWidth-n.leftSideBearing-(n.xMax-n.xMin),n},ye.prototype.draw=function(e,t,r,i,a){this.getPath(t,r,i,a).draw(e)},ye.prototype.drawPoints=function(e,t,r,i){function a(t,r,i,a){var n=2*Math.PI;e.beginPath();for(var o=0;o<t.length;o+=1)e.moveTo(r+t[o].x*a,i+t[o].y*a),e.arc(r+t[o].x*a,i+t[o].y*a,2,0,n,!1);e.closePath(),e.fill()}t=void 0!==t?t:0,r=void 0!==r?r:0,i=void 0!==i?i:24;for(var n=1/this.path.unitsPerEm*i,o=[],s=[],l=this.path,u=0;u<l.commands.length;u+=1){var h=l.commands[u];void 0!==h.x&&o.push({x:h.x,y:-h.y}),void 0!==h.x1&&s.push({x:h.x1,y:-h.y1}),void 0!==h.x2&&s.push({x:h.x2,y:-h.y2})}e.fillStyle="blue",a(o,t,r,n),e.fillStyle="red",a(s,t,r,n)},ye.prototype.drawMetrics=function(e,t,r,i){var a;t=void 0!==t?t:0,r=void 0!==r?r:0,i=void 0!==i?i:24,a=1/this.path.unitsPerEm*i,e.lineWidth=1,e.strokeStyle="black",ge(e,t,-1e4,t,1e4),ge(e,-1e4,r,1e4,r);var n=this.xMin||0,o=this.yMin||0,s=this.xMax||0,l=this.yMax||0,u=this.advanceWidth||0;e.strokeStyle="blue",ge(e,t+n*a,-1e4,t+n*a,1e4),ge(e,t+s*a,-1e4,t+s*a,1e4),ge(e,-1e4,r+-o*a,1e4,r+-o*a),ge(e,-1e4,r+-l*a,1e4,r+-l*a),e.strokeStyle="green",ge(e,t+u*a,-1e4,t+u*a,1e4)},be.prototype.get=function(e){return"function"==typeof this.glyphs[e]&&(this.glyphs[e]=this.glyphs[e]()),this.glyphs[e]},be.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};var xe={GlyphSet:be,glyphLoader:function(e,t){return new ye({index:t,font:e})},ttfGlyphLoader:function(e,t,r,i,a,n){return function(){var o=new ye({index:t,font:e});return o.path=function(){r(o,i,a);var t=n(e.glyphs,o);return t.unitsPerEm=e.unitsPerEm,t},_e(o,"xMin","_xMin"),_e(o,"xMax","_xMax"),_e(o,"yMin","_yMin"),_e(o,"yMax","_yMax"),o}},cffGlyphLoader:function(e,t,r,i){return function(){var a=new ye({index:t,font:e});return a.path=function(){var t=r(e,a,i);return t.unitsPerEm=e.unitsPerEm,t},a}}};function we(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r+=1)if(!we(e[r],t[r]))return!1;return!0}return!1}function Se(e){return e.length<1240?107:e.length<33900?1131:32768}function Me(e,t,r){var i,a,n=[],o=[],s=oe.getCard16(e,t);if(0!==s){var l=oe.getByte(e,t+2);i=t+(s+1)*l+2;for(var u=t+3,h=0;h<s+1;h+=1)n.push(oe.getOffset(e,u,l)),u+=l;a=i+n[s]}else a=t+2;for(var d=0;d<n.length-1;d+=1){var c=oe.getBytes(e,i+n[d],i+n[d+1]);r&&(c=r(c)),o.push(c)}return{objects:o,startOffset:t,endOffset:a}}function Ee(e,t){if(28===t)return e.parseByte()<<8|e.parseByte();if(29===t)return e.parseByte()<<24|e.parseByte()<<16|e.parseByte()<<8|e.parseByte();if(30===t)return function(e){for(var t="",r=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var i=e.parseByte(),a=i>>4,n=15&i;if(15===a)break;if(t+=r[a],15===n)break;t+=r[n]}return parseFloat(t)}(e);if(32<=t&&t<=246)return t-139;if(247<=t&&t<=250)return 256*(t-247)+e.parseByte()+108;if(251<=t&&t<=254)return 256*-(t-251)-e.parseByte()-108;throw new Error("Invalid b0 "+t)}function Te(e,t,r){t=void 0!==t?t:0;var i=new oe.Parser(e,t),a=[],n=[];for(r=void 0!==r?r:e.length;i.relativeOffset<r;){var o=i.parseByte();o<=21?(12===o&&(o=1200+i.parseByte()),a.push([o,n]),n=[]):n.push(Ee(i,o))}return function(e){for(var t={},r=0;r<e.length;r+=1){var i,a=e[r][0],n=e[r][1];if(i=1===n.length?n[0]:n,t.hasOwnProperty(a)&&!isNaN(t[a]))throw new Error("Object "+t+" already has key "+a);t[a]=i}return t}(a)}function Ce(e,t){return t<=390?ue[t]:e[t-391]}function Pe(e,t,r){for(var i,a={},n=0;n<t.length;n+=1){var o=t[n];if(Array.isArray(o.type)){var s=[];s.length=o.type.length;for(var l=0;l<o.type.length;l++)void 0===(i=void 0!==e[o.op]?e[o.op][l]:void 0)&&(i=void 0!==o.value&&void 0!==o.value[l]?o.value[l]:null),"SID"===o.type[l]&&(i=Ce(r,i)),s[l]=i;a[o.name]=s}else void 0===(i=e[o.op])&&(i=void 0!==o.value?o.value:null),"SID"===o.type&&(i=Ce(r,i)),a[o.name]=i}return a}var Le=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],Re=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function Oe(e,t,r,i){return Pe(Te(e,t,r),Re,i)}function De(e,t,r,i){for(var a,n,o=[],s=0;s<r.length;s+=1){var l=(n=i,Pe(Te(a=new DataView(new Uint8Array(r[s]).buffer),0,a.byteLength),Le,n));l._subrs=[],l._subrsBias=0;var u=l.private[0],h=l.private[1];if(0!==u&&0!==h){var d=Oe(e,h+t,u,i);if(l._defaultWidthX=d.defaultWidthX,l._nominalWidthX=d.nominalWidthX,0!==d.subrs){var c=Me(e,h+d.subrs+t);l._subrs=c.objects,l._subrsBias=Se(l._subrs)}l._privateDict=d}o.push(l)}return o}function Ae(e,t,r){var i,a,n,o,s,l,u,h,d=new C,c=[],f=0,p=!1,m=!1,v=0,g=0;if(e.isCIDFont){var y=e.tables.cff.topDict._fdSelect[t.index],_=e.tables.cff.topDict._fdArray[y];s=_._subrs,l=_._subrsBias,u=_._defaultWidthX,h=_._nominalWidthX}else s=e.tables.cff.topDict._subrs,l=e.tables.cff.topDict._subrsBias,u=e.tables.cff.topDict._defaultWidthX,h=e.tables.cff.topDict._nominalWidthX;var b=u;function x(e,t){m&&d.closePath(),d.moveTo(e,t),m=!0}function w(){c.length%2!=0&&!p&&(b=c.shift()+h),f+=c.length>>1,c.length=0,p=!0}return function r(u){for(var y,_,S,M,E,T,C,P,L,R,O,D,A=0;A<u.length;){var I=u[A];switch(A+=1,I){case 1:case 3:w();break;case 4:1<c.length&&!p&&(b=c.shift()+h,p=!0),g+=c.pop(),x(v,g);break;case 5:for(;0<c.length;)v+=c.shift(),g+=c.shift(),d.lineTo(v,g);break;case 6:for(;0<c.length&&(v+=c.shift(),d.lineTo(v,g),0!==c.length);)g+=c.shift(),d.lineTo(v,g);break;case 7:for(;0<c.length&&(g+=c.shift(),d.lineTo(v,g),0!==c.length);)v+=c.shift(),d.lineTo(v,g);break;case 8:for(;0<c.length;)i=v+c.shift(),a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),v=n+c.shift(),g=o+c.shift(),d.curveTo(i,a,n,o,v,g);break;case 10:E=c.pop()+l,(T=s[E])&&r(T);break;case 11:return;case 12:switch(I=u[A],A+=1,I){case 35:i=v+c.shift(),a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),C=n+c.shift(),P=o+c.shift(),L=C+c.shift(),R=P+c.shift(),O=L+c.shift(),D=R+c.shift(),v=O+c.shift(),g=D+c.shift(),c.shift(),d.curveTo(i,a,n,o,C,P),d.curveTo(L,R,O,D,v,g);break;case 34:i=v+c.shift(),a=g,n=i+c.shift(),o=a+c.shift(),C=n+c.shift(),P=o,L=C+c.shift(),R=o,O=L+c.shift(),D=g,v=O+c.shift(),d.curveTo(i,a,n,o,C,P),d.curveTo(L,R,O,D,v,g);break;case 36:i=v+c.shift(),a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),C=n+c.shift(),P=o,L=C+c.shift(),R=o,O=L+c.shift(),D=R+c.shift(),v=O+c.shift(),d.curveTo(i,a,n,o,C,P),d.curveTo(L,R,O,D,v,g);break;case 37:i=v+c.shift(),a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),C=n+c.shift(),P=o+c.shift(),L=C+c.shift(),R=P+c.shift(),O=L+c.shift(),D=R+c.shift(),Math.abs(O-v)>Math.abs(D-g)?v=O+c.shift():g=D+c.shift(),d.curveTo(i,a,n,o,C,P),d.curveTo(L,R,O,D,v,g);break;default:console.log("Glyph "+t.index+": unknown operator 1200"+I),c.length=0}break;case 14:0<c.length&&!p&&(b=c.shift()+h,p=!0),m&&(d.closePath(),m=!1);break;case 18:w();break;case 19:case 20:w(),A+=f+7>>3;break;case 21:2<c.length&&!p&&(b=c.shift()+h,p=!0),g+=c.pop(),x(v+=c.pop(),g);break;case 22:1<c.length&&!p&&(b=c.shift()+h,p=!0),x(v+=c.pop(),g);break;case 23:w();break;case 24:for(;2<c.length;)i=v+c.shift(),a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),v=n+c.shift(),g=o+c.shift(),d.curveTo(i,a,n,o,v,g);v+=c.shift(),g+=c.shift(),d.lineTo(v,g);break;case 25:for(;6<c.length;)v+=c.shift(),g+=c.shift(),d.lineTo(v,g);i=v+c.shift(),a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),v=n+c.shift(),g=o+c.shift(),d.curveTo(i,a,n,o,v,g);break;case 26:for(c.length%2&&(v+=c.shift());0<c.length;)i=v,a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),v=n,g=o+c.shift(),d.curveTo(i,a,n,o,v,g);break;case 27:for(c.length%2&&(g+=c.shift());0<c.length;)i=v+c.shift(),a=g,n=i+c.shift(),o=a+c.shift(),v=n+c.shift(),g=o,d.curveTo(i,a,n,o,v,g);break;case 28:y=u[A],_=u[A+1],c.push((y<<24|_<<16)>>16),A+=2;break;case 29:E=c.pop()+e.gsubrsBias,(T=e.gsubrs[E])&&r(T);break;case 30:for(;0<c.length&&(i=v,a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),v=n+c.shift(),g=o+(1===c.length?c.shift():0),d.curveTo(i,a,n,o,v,g),0!==c.length);)i=v+c.shift(),a=g,n=i+c.shift(),o=a+c.shift(),g=o+c.shift(),v=n+(1===c.length?c.shift():0),d.curveTo(i,a,n,o,v,g);break;case 31:for(;0<c.length&&(i=v+c.shift(),a=g,n=i+c.shift(),o=a+c.shift(),g=o+c.shift(),v=n+(1===c.length?c.shift():0),d.curveTo(i,a,n,o,v,g),0!==c.length);)i=v,a=g+c.shift(),n=i+c.shift(),o=a+c.shift(),v=n+c.shift(),g=o+(1===c.length?c.shift():0),d.curveTo(i,a,n,o,v,g);break;default:I<32?console.log("Glyph "+t.index+": unknown operator "+I):I<247?c.push(I-139):I<251?(y=u[A],A+=1,c.push(256*(I-247)+y+108)):I<255?(y=u[A],A+=1,c.push(256*-(I-251)-y-108)):(y=u[A],_=u[A+1],S=u[A+2],M=u[A+3],A+=4,c.push((y<<24|_<<16|S<<8|M)/65536))}}}(r),t.advanceWidth=b,d}function Ie(e,t){var r,i=ue.indexOf(e);return 0<=i&&(r=i),0<=(i=t.indexOf(e))?r=i+ue.length:(r=ue.length+t.length,t.push(e)),r}function ke(e,t,r){for(var i={},a=0;a<e.length;a+=1){var n=e[a],o=t[n.name];void 0===o||we(o,n.value)||("SID"===n.type&&(o=Ie(o,r)),i[n.op]={name:n.name,type:n.type,value:o})}return i}function Ue(e,t){var r=new J.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=ke(Le,e,t),r}function Fe(e){var t=new J.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return t.topDicts=[{name:"topDict_0",type:"TABLE",value:e}],t}function Ne(e){var t=[],r=e.path;t.push({name:"width",type:"NUMBER",value:e.advanceWidth});for(var i=0,a=0,n=0;n<r.commands.length;n+=1){var o=void 0,s=void 0,l=r.commands[n];if("Q"===l.type&&(l={type:"C",x:l.x,y:l.y,x1:1/3*i+2/3*l.x1,y1:1/3*a+2/3*l.y1,x2:1/3*l.x+2/3*l.x1,y2:1/3*l.y+2/3*l.y1}),"M"===l.type)o=Math.round(l.x-i),s=Math.round(l.y-a),t.push({name:"dx",type:"NUMBER",value:o}),t.push({name:"dy",type:"NUMBER",value:s}),t.push({name:"rmoveto",type:"OP",value:21}),i=Math.round(l.x),a=Math.round(l.y);else if("L"===l.type)o=Math.round(l.x-i),s=Math.round(l.y-a),t.push({name:"dx",type:"NUMBER",value:o}),t.push({name:"dy",type:"NUMBER",value:s}),t.push({name:"rlineto",type:"OP",value:5}),i=Math.round(l.x),a=Math.round(l.y);else if("C"===l.type){var u=Math.round(l.x1-i),h=Math.round(l.y1-a),d=Math.round(l.x2-l.x1),c=Math.round(l.y2-l.y1);o=Math.round(l.x-l.x2),s=Math.round(l.y-l.y2),t.push({name:"dx1",type:"NUMBER",value:u}),t.push({name:"dy1",type:"NUMBER",value:h}),t.push({name:"dx2",type:"NUMBER",value:d}),t.push({name:"dy2",type:"NUMBER",value:c}),t.push({name:"dx",type:"NUMBER",value:o}),t.push({name:"dy",type:"NUMBER",value:s}),t.push({name:"rrcurveto",type:"OP",value:8}),i=Math.round(l.x),a=Math.round(l.y)}}return t.push({name:"endchar",type:"OP",value:14}),t}var Be=function(e,t,r){r.tables.cff={};var i,a,n,o=Me(e,Me(e,(i=e,a=t,(n={}).formatMajor=oe.getCard8(i,a),n.formatMinor=oe.getCard8(i,a+1),n.size=oe.getCard8(i,a+2),n.offsetSize=oe.getCard8(i,a+3),n.startOffset=a,n.endOffset=a+4,n).endOffset,oe.bytesToString).endOffset),s=Me(e,o.endOffset,oe.bytesToString),l=Me(e,s.endOffset);r.gsubrs=l.objects,r.gsubrsBias=Se(r.gsubrs);var u=De(e,t,o.objects,s.objects);if(1!==u.length)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+u.length);var h=u[0];if((r.tables.cff.topDict=h)._privateDict&&(r.defaultWidthX=h._privateDict.defaultWidthX,r.nominalWidthX=h._privateDict.nominalWidthX),void 0!==h.ros[0]&&void 0!==h.ros[1]&&(r.isCIDFont=!0),r.isCIDFont){var d=h.fdArray,c=h.fdSelect;if(0===d||0===c)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");var f=De(e,t,Me(e,d+=t).objects,s.objects);h._fdArray=f,c+=t,h._fdSelect=function(e,t,r,i){var a,n=[],o=new oe.Parser(e,t),s=o.parseCard8();if(0===s)for(var l=0;l<r;l++){if(i<=(a=o.parseCard8()))throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+i+")");n.push(a)}else{if(3!==s)throw new Error("CFF Table CID Font FDSelect table has unsupported format "+s);var u,h=o.parseCard16(),d=o.parseCard16();if(0!==d)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+d);for(var c=0;c<h;c++){if(a=o.parseCard8(),u=o.parseCard16(),i<=a)throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+i+")");if(r<u)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+u);for(;d<u;d++)n.push(a);d=u}if(u!==r)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+u)}return n}(e,c,r.numGlyphs,f.length)}var p=t+h.private[1],m=Oe(e,p,h.private[0],s.objects);if(r.defaultWidthX=m.defaultWidthX,r.nominalWidthX=m.nominalWidthX,0!==m.subrs){var v=Me(e,p+m.subrs);r.subrs=v.objects,r.subrsBias=Se(r.subrs)}else r.subrs=[],r.subrsBias=0;var g=Me(e,t+h.charStrings);r.nGlyphs=g.objects.length;var y=function(e,t,r,i){var a,n,o=new oe.Parser(e,t);r-=1;var s=[".notdef"],l=o.parseCard8();if(0===l)for(var u=0;u<r;u+=1)a=o.parseSID(),s.push(Ce(i,a));else if(1===l)for(;s.length<=r;){a=o.parseSID(),n=o.parseCard8();for(var h=0;h<=n;h+=1)s.push(Ce(i,a)),a+=1}else{if(2!==l)throw new Error("Unknown charset format "+l);for(;s.length<=r;){a=o.parseSID(),n=o.parseCard16();for(var d=0;d<=n;d+=1)s.push(Ce(i,a)),a+=1}}return s}(e,t+h.charset,r.nGlyphs,s.objects);0===h.encoding?r.cffEncoding=new me(he,y):1===h.encoding?r.cffEncoding=new me(de,y):r.cffEncoding=function(e,t,r){var i,a={},n=new oe.Parser(e,t),o=n.parseCard8();if(0===o)for(var s=n.parseCard8(),l=0;l<s;l+=1)a[i=n.parseCard8()]=l;else{if(1!==o)throw new Error("Unknown encoding format "+o);var u=n.parseCard8();i=1;for(var h=0;h<u;h+=1)for(var d=n.parseCard8(),c=n.parseCard8(),f=d;f<=d+c;f+=1)a[f]=i,i+=1}return new me(a,r)}(e,t+h.encoding,y),r.encoding=r.encoding||r.cffEncoding,r.glyphs=new xe.GlyphSet(r);for(var _=0;_<r.nGlyphs;_+=1){var b=g.objects[_];r.glyphs.push(_,xe.cffGlyphLoader(r,_,Ae,b))}},Ge=function(e,t){for(var r,i=new J.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),a=1/t.unitsPerEm,n={version:t.version,fullName:t.fullName,familyName:t.familyName,weight:t.weightName,fontBBox:t.fontBBox||[0,0,0,0],fontMatrix:[a,0,0,a,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},o=[],s=1;s<e.length;s+=1)r=e.get(s),o.push(r.name);var l=[];i.header=new J.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}]),i.nameIndex=function(e){var t=new J.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);t.names=[];for(var r=0;r<e.length;r+=1)t.names.push({name:"name_"+r,type:"NAME",value:e[r]});return t}([t.postScriptName]);var u,h,d,c=Ue(n,l);i.topDictIndex=Fe(c),i.globalSubrIndex=new J.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}]),i.charsets=function(e,t){for(var r=new J.Record("Charsets",[{name:"format",type:"Card8",value:0}]),i=0;i<e.length;i+=1){var a=Ie(e[i],t);r.fields.push({name:"glyph_"+i,type:"SID",value:a})}return r}(o,l),i.charStringsIndex=function(e){for(var t=new J.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),r=0;r<e.length;r+=1){var i=e.get(r),a=Ne(i);t.charStrings.push({name:i.name,type:"CHARSTRING",value:a})}return t}(e),i.privateDict=(u={},h=l,(d=new J.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}])).dict=ke(Re,u,h),d),i.stringIndex=function(e){var t=new J.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);t.strings=[];for(var r=0;r<e.length;r+=1)t.strings.push({name:"string_"+r,type:"STRING",value:e[r]});return t}(l);var f=i.header.sizeOf()+i.nameIndex.sizeOf()+i.topDictIndex.sizeOf()+i.stringIndex.sizeOf()+i.globalSubrIndex.sizeOf();return n.charset=f,n.encoding=0,n.charStrings=n.charset+i.charsets.sizeOf(),n.private[1]=n.charStrings+i.charStringsIndex.sizeOf(),c=Ue(n,l),i.topDictIndex=Fe(c),i},je=function(e,t){var r={},i=new oe.Parser(e,t);return r.version=i.parseVersion(),r.fontRevision=Math.round(1e3*i.parseFixed())/1e3,r.checkSumAdjustment=i.parseULong(),r.magicNumber=i.parseULong(),R.argument(1594834165===r.magicNumber,"Font header has wrong magic number."),r.flags=i.parseUShort(),r.unitsPerEm=i.parseUShort(),r.created=i.parseLongDateTime(),r.modified=i.parseLongDateTime(),r.xMin=i.parseShort(),r.yMin=i.parseShort(),r.xMax=i.parseShort(),r.yMax=i.parseShort(),r.macStyle=i.parseUShort(),r.lowestRecPPEM=i.parseUShort(),r.fontDirectionHint=i.parseShort(),r.indexToLocFormat=i.parseShort(),r.glyphDataFormat=i.parseShort(),r},Ve=function(e){var t=Math.round((new Date).getTime()/1e3)+2082844800,r=t;return e.createdTimestamp&&(r=e.createdTimestamp+2082844800),new J.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:r},{name:"modified",type:"LONGDATETIME",value:t},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],e)},ze=function(e,t){var r={},i=new oe.Parser(e,t);return r.version=i.parseVersion(),r.ascender=i.parseShort(),r.descender=i.parseShort(),r.lineGap=i.parseShort(),r.advanceWidthMax=i.parseUShort(),r.minLeftSideBearing=i.parseShort(),r.minRightSideBearing=i.parseShort(),r.xMaxExtent=i.parseShort(),r.caretSlopeRise=i.parseShort(),r.caretSlopeRun=i.parseShort(),r.caretOffset=i.parseShort(),i.relativeOffset+=8,r.metricDataFormat=i.parseShort(),r.numberOfHMetrics=i.parseUShort(),r},He=function(e){return new J.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],e)},We=function(e,t,r,i,a){for(var n,o,s=new oe.Parser(e,t),l=0;l<i;l+=1){l<r&&(n=s.parseUShort(),o=s.parseShort());var u=a.get(l);u.advanceWidth=n,u.leftSideBearing=o}},Xe=function(e){for(var t=new J.Table("hmtx",[]),r=0;r<e.length;r+=1){var i=e.get(r),a=i.advanceWidth||0,n=i.leftSideBearing||0;t.fields.push({name:"advanceWidth_"+r,type:"USHORT",value:a}),t.fields.push({name:"leftSideBearing_"+r,type:"SHORT",value:n})}return t},qe=function(e){for(var t=new J.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:e.length}]),r="",i=12+4*e.length,a=0;a<e.length;++a){var n=r.indexOf(e[a]);n<0&&(n=r.length,r+=e[a]),t.fields.push({name:"offset "+a,type:"USHORT",value:i+n}),t.fields.push({name:"length "+a,type:"USHORT",value:e[a].length})}return t.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),t},Ye=function(e,t){var r=new oe.Parser(e,t),i=r.parseULong();R.argument(1===i,"Unsupported ltag table version."),r.skip("uLong",1);for(var a=r.parseULong(),n=[],o=0;o<a;o++){for(var s="",l=t+r.parseUShort(),u=r.parseUShort(),h=l;h<l+u;++h)s+=String.fromCharCode(e.getInt8(h));n.push(s)}return n},Ze=function(e,t){var r={},i=new oe.Parser(e,t);return r.version=i.parseVersion(),r.numGlyphs=i.parseUShort(),1===r.version&&(r.maxPoints=i.parseUShort(),r.maxContours=i.parseUShort(),r.maxCompositePoints=i.parseUShort(),r.maxCompositeContours=i.parseUShort(),r.maxZones=i.parseUShort(),r.maxTwilightPoints=i.parseUShort(),r.maxStorage=i.parseUShort(),r.maxFunctionDefs=i.parseUShort(),r.maxInstructionDefs=i.parseUShort(),r.maxStackElements=i.parseUShort(),r.maxSizeOfInstructions=i.parseUShort(),r.maxComponentElements=i.parseUShort(),r.maxComponentDepth=i.parseUShort()),r},Qe=function(e){return new J.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:e}])},Ke=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Je={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},$e={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},et={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function tt(e,t,r){switch(e){case 0:if(65535===t)return"und";if(r)return r[t];break;case 1:return Je[t];case 3:return et[t]}}var rt="utf-16",it={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},at={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function nt(e,t,r){switch(e){case 0:return rt;case 1:return at[r]||it[t];case 3:if(1===t||10===t)return rt}}function ot(e){var t={};for(var r in e)t[e[r]]=parseInt(r);return t}function st(e,t,r,i,a,n){return new J.Record("NameRecord",[{name:"platformID",type:"USHORT",value:e},{name:"encodingID",type:"USHORT",value:t},{name:"languageID",type:"USHORT",value:r},{name:"nameID",type:"USHORT",value:i},{name:"length",type:"USHORT",value:a},{name:"offset",type:"USHORT",value:n}])}function lt(e,t){var r=function(e,t){var r=e.length,i=t.length-r+1;e:for(var a=0;a<i;a++)for(;a<i;a++){for(var n=0;n<r;n++)if(t[a+n]!==e[n])continue e;return a}return-1}(e,t);if(r<0){r=t.length;for(var i=0,a=e.length;i<a;++i)t.push(e[i])}return r}var ut=function(e,t,r){for(var i={},a=new oe.Parser(e,t),n=a.parseUShort(),o=a.parseUShort(),s=a.offset+a.parseUShort(),l=0;l<o;l++){var u,h=a.parseUShort(),d=a.parseUShort(),c=a.parseUShort(),f=a.parseUShort(),p=Ke[f]||f,m=a.parseUShort(),v=a.parseUShort(),g=tt(h,c,r),y=nt(h,d,c);if(void 0!==y&&void 0!==g&&(u=y===rt?D.UTF16(e,s+v,m):D.MACSTRING(e,s+v,m,y))){var _=i[p];void 0===_&&(_=i[p]={}),_[g]=u}}return 1===n&&a.parseUShort(),i},ht=function(e,t){var r,i=[],a={},n=ot(Ke);for(var o in e){var s=n[o];if(void 0===s&&(s=o),r=parseInt(s),isNaN(r))throw new Error('Name table entry "'+o+'" does not exist, see nameTableNames for complete list.');a[r]=e[o],i.push(r)}for(var l=ot(Je),u=ot(et),h=[],d=[],c=0;c<i.length;c++){var f=a[r=i[c]];for(var p in f){var m=f[p],v=1,g=l[p],y=$e[g],_=nt(v,y,g),b=A.MACSTRING(m,_);void 0===b&&(v=0,(g=t.indexOf(p))<0&&(g=t.length,t.push(p)),y=4,b=A.UTF16(m));var x=lt(b,d);h.push(st(v,y,g,r,b.length,x));var w=u[p];if(void 0!==w){var S=A.UTF16(m),M=lt(S,d);h.push(st(3,1,w,r,S.length,M))}}}h.sort((function(e,t){return e.platformID-t.platformID||e.encodingID-t.encodingID||e.languageID-t.languageID||e.nameID-t.nameID}));for(var E=new J.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:h.length},{name:"stringOffset",type:"USHORT",value:6+12*h.length}]),T=0;T<h.length;T++)E.fields.push({name:"record_"+T,type:"RECORD",value:h[T]});return E.fields.push({name:"strings",type:"LITERAL",value:d}),E},dt=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}],ct=function(e,t){var r={},i=new oe.Parser(e,t);r.version=i.parseUShort(),r.xAvgCharWidth=i.parseShort(),r.usWeightClass=i.parseUShort(),r.usWidthClass=i.parseUShort(),r.fsType=i.parseUShort(),r.ySubscriptXSize=i.parseShort(),r.ySubscriptYSize=i.parseShort(),r.ySubscriptXOffset=i.parseShort(),r.ySubscriptYOffset=i.parseShort(),r.ySuperscriptXSize=i.parseShort(),r.ySuperscriptYSize=i.parseShort(),r.ySuperscriptXOffset=i.parseShort(),r.ySuperscriptYOffset=i.parseShort(),r.yStrikeoutSize=i.parseShort(),r.yStrikeoutPosition=i.parseShort(),r.sFamilyClass=i.parseShort(),r.panose=[];for(var a=0;a<10;a++)r.panose[a]=i.parseByte();return r.ulUnicodeRange1=i.parseULong(),r.ulUnicodeRange2=i.parseULong(),r.ulUnicodeRange3=i.parseULong(),r.ulUnicodeRange4=i.parseULong(),r.achVendID=String.fromCharCode(i.parseByte(),i.parseByte(),i.parseByte(),i.parseByte()),r.fsSelection=i.parseUShort(),r.usFirstCharIndex=i.parseUShort(),r.usLastCharIndex=i.parseUShort(),r.sTypoAscender=i.parseShort(),r.sTypoDescender=i.parseShort(),r.sTypoLineGap=i.parseShort(),r.usWinAscent=i.parseUShort(),r.usWinDescent=i.parseUShort(),1<=r.version&&(r.ulCodePageRange1=i.parseULong(),r.ulCodePageRange2=i.parseULong()),2<=r.version&&(r.sxHeight=i.parseShort(),r.sCapHeight=i.parseShort(),r.usDefaultChar=i.parseUShort(),r.usBreakChar=i.parseUShort(),r.usMaxContent=i.parseUShort()),r},ft=function(e){return new J.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}],e)},pt=function(e){for(var t=0;t<dt.length;t+=1){var r=dt[t];if(e>=r.begin&&e<r.end)return t}return-1},mt=function(e,t){var r={},i=new oe.Parser(e,t);switch(r.version=i.parseVersion(),r.italicAngle=i.parseFixed(),r.underlinePosition=i.parseShort(),r.underlineThickness=i.parseShort(),r.isFixedPitch=i.parseULong(),r.minMemType42=i.parseULong(),r.maxMemType42=i.parseULong(),r.minMemType1=i.parseULong(),r.maxMemType1=i.parseULong(),r.version){case 1:r.names=ce.slice();break;case 2:r.numberOfGlyphs=i.parseUShort(),r.glyphNameIndex=new Array(r.numberOfGlyphs);for(var a=0;a<r.numberOfGlyphs;a++)r.glyphNameIndex[a]=i.parseUShort();r.names=[];for(var n=0;n<r.numberOfGlyphs;n++)if(r.glyphNameIndex[n]>=ce.length){var o=i.parseChar();r.names.push(i.parseString(o))}break;case 2.5:r.numberOfGlyphs=i.parseUShort(),r.offset=new Array(r.numberOfGlyphs);for(var s=0;s<r.numberOfGlyphs;s++)r.offset[s]=i.parseChar()}return r},vt=function(){return new J.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])},gt=new Array(9);gt[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{substFormat:1,coverage:this.parsePointer(ae.coverage),deltaGlyphId:this.parseUShort()}:2===t?{substFormat:2,coverage:this.parsePointer(ae.coverage),substitute:this.parseOffset16List()}:void R.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},gt[2]=function(){var e=this.parseUShort();return R.argument(1===e,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ae.coverage),sequences:this.parseListOfLists()}},gt[3]=function(){var e=this.parseUShort();return R.argument(1===e,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ae.coverage),alternateSets:this.parseListOfLists()}},gt[4]=function(){var e=this.parseUShort();return R.argument(1===e,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ae.coverage),ligatureSets:this.parseListOfLists((function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}}))}};var yt={sequenceIndex:ae.uShort,lookupListIndex:ae.uShort};gt[5]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(1===t)return{substFormat:t,coverage:this.parsePointer(ae.coverage),ruleSets:this.parseListOfLists((function(){var e=this.parseUShort(),t=this.parseUShort();return{input:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,yt)}}))};if(2===t)return{substFormat:t,coverage:this.parsePointer(ae.coverage),classDef:this.parsePointer(ae.classDef),classSets:this.parseListOfLists((function(){var e=this.parseUShort(),t=this.parseUShort();return{classes:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,yt)}}))};if(3===t){var r=this.parseUShort(),i=this.parseUShort();return{substFormat:t,coverages:this.parseList(r,ae.pointer(ae.coverage)),lookupRecords:this.parseRecordList(i,yt)}}R.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},gt[6]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{substFormat:1,coverage:this.parsePointer(ae.coverage),chainRuleSets:this.parseListOfLists((function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(yt)}}))}:2===t?{substFormat:2,coverage:this.parsePointer(ae.coverage),backtrackClassDef:this.parsePointer(ae.classDef),inputClassDef:this.parsePointer(ae.classDef),lookaheadClassDef:this.parsePointer(ae.classDef),chainClassSet:this.parseListOfLists((function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(yt)}}))}:3===t?{substFormat:3,backtrackCoverage:this.parseList(ae.pointer(ae.coverage)),inputCoverage:this.parseList(ae.pointer(ae.coverage)),lookaheadCoverage:this.parseList(ae.pointer(ae.coverage)),lookupRecords:this.parseRecordList(yt)}:void R.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},gt[7]=function(){var e=this.parseUShort();R.argument(1===e,"GSUB Extension Substitution subtable identifier-format must be 1");var t=this.parseUShort(),r=new ae(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:gt[t].call(r)}},gt[8]=function(){var e=this.parseUShort();return R.argument(1===e,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ae.coverage),backtrackCoverage:this.parseList(ae.pointer(ae.coverage)),lookaheadCoverage:this.parseList(ae.pointer(ae.coverage)),substitutes:this.parseUShortList()}};var _t=new Array(9);_t[1]=function(e){return 1===e.substFormat?new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.ushortList("substitute",e.substitute)))},_t[3]=function(e){return R.assert(1===e.substFormat,"Lookup type 3 substFormat must be 1."),new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.tableList("altSet",e.alternateSets,(function(e){return new J.Table("alternateSetTable",J.ushortList("alternate",e))}))))},_t[4]=function(e){return R.assert(1===e.substFormat,"Lookup type 4 substFormat must be 1."),new J.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new J.Coverage(e.coverage)}].concat(J.tableList("ligSet",e.ligatureSets,(function(e){return new J.Table("ligatureSetTable",J.tableList("ligature",e,(function(e){return new J.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:e.ligGlyph}].concat(J.ushortList("component",e.components,e.components.length+1)))})))}))))};var bt=function(e,t){var r=new ae(e,t=t||0),i=r.parseVersion(1);return R.argument(1===i||1.1===i,"Unsupported GSUB table version."),1===i?{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(gt)}:{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(gt),variations:r.parseFeatureVariationsList()}},xt=function(e){return new J.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new J.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new J.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new J.LookupList(e.lookups,_t)}])},wt=function(e,t){var r=new oe.Parser(e,t),i=r.parseULong();R.argument(1===i,"Unsupported META table version."),r.parseULong(),r.parseULong();for(var a=r.parseULong(),n={},o=0;o<a;o++){var s=r.parseTag(),l=r.parseULong(),u=r.parseULong(),h=D.UTF8(e,t+l,u);n[s]=h}return n},St=function(e){var t=Object.keys(e).length,r="",i=16+12*t,a=new J.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:i},{name:"numTags",type:"ULONG",value:t}]);for(var n in e){var o=r.length;r+=e[n],a.fields.push({name:"tag "+n,type:"TAG",value:n}),a.fields.push({name:"offset "+n,type:"ULONG",value:i+o}),a.fields.push({name:"length "+n,type:"ULONG",value:e[n].length})}return a.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),a};function Mt(e){return Math.log(e)/Math.log(2)|0}function Et(e){for(;e.length%4!=0;)e.push(0);for(var t=0,r=0;r<e.length;r+=4)t+=(e[r]<<24)+(e[r+1]<<16)+(e[r+2]<<8)+e[r+3];return t%Math.pow(2,32)}function Tt(e,t,r,i){return new J.Record("Table Record",[{name:"tag",type:"TAG",value:void 0!==e?e:""},{name:"checkSum",type:"ULONG",value:void 0!==t?t:0},{name:"offset",type:"ULONG",value:void 0!==r?r:0},{name:"length",type:"ULONG",value:void 0!==i?i:0}])}function Ct(e){var t=new J.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);t.tables=e,t.numTables=e.length;var r=Math.pow(2,Mt(t.numTables));t.searchRange=16*r,t.entrySelector=Mt(r),t.rangeShift=16*t.numTables-t.searchRange;for(var i=[],a=[],n=t.sizeOf()+Tt().sizeOf()*t.numTables;n%4!=0;)n+=1,a.push({name:"padding",type:"BYTE",value:0});for(var o=0;o<e.length;o+=1){var s=e[o];R.argument(4===s.tableName.length,"Table name"+s.tableName+" is invalid.");var l=s.sizeOf(),u=Tt(s.tableName,Et(s.encode()),n,l);for(i.push({name:u.tag+" Table Record",type:"RECORD",value:u}),a.push({name:s.tableName+" table",type:"RECORD",value:s}),n+=l,R.argument(!isNaN(n),"Something went wrong calculating the offset.");n%4!=0;)n+=1,a.push({name:"padding",type:"BYTE",value:0})}return i.sort((function(e,t){return e.value.tag>t.value.tag?1:-1})),t.fields=t.fields.concat(i),t.fields=t.fields.concat(a),t}function Pt(e,t,r){for(var i=0;i<t.length;i+=1){var a=e.charToGlyphIndex(t[i]);if(0<a)return e.glyphs.get(a).getMetrics()}return r}var Lt=function(e){for(var t,r=[],i=[],a=[],n=[],o=[],s=[],l=[],u=0,h=0,d=0,c=0,f=0,p=0;p<e.glyphs.length;p+=1){var m=e.glyphs.get(p),v=0|m.unicode;if(isNaN(m.advanceWidth))throw new Error("Glyph "+m.name+" ("+p+"): advanceWidth is not a number.");(v<t||void 0===t)&&0<v&&(t=v),u<v&&(u=v);var g=pt(v);if(g<32)h|=1<<g;else if(g<64)d|=1<<g-32;else if(g<96)c|=1<<g-64;else{if(!(g<123))throw new Error("Unicode ranges bits > 123 are reserved for internal usage");f|=1<<g-96}if(".notdef"!==m.name){var y=m.getMetrics();r.push(y.xMin),i.push(y.yMin),a.push(y.xMax),n.push(y.yMax),s.push(y.leftSideBearing),l.push(y.rightSideBearing),o.push(m.advanceWidth)}}var _={xMin:Math.min.apply(null,r),yMin:Math.min.apply(null,i),xMax:Math.max.apply(null,a),yMax:Math.max.apply(null,n),advanceWidthMax:Math.max.apply(null,o),advanceWidthAvg:function(e){for(var t=0,r=0;r<e.length;r+=1)t+=e[r];return t/e.length}(o),minLeftSideBearing:Math.min.apply(null,s),maxLeftSideBearing:Math.max.apply(null,s),minRightSideBearing:Math.min.apply(null,l)};_.ascender=e.ascender,_.descender=e.descender;var b=Ve({flags:3,unitsPerEm:e.unitsPerEm,xMin:_.xMin,yMin:_.yMin,xMax:_.xMax,yMax:_.yMax,lowestRecPPEM:3,createdTimestamp:e.createdTimestamp}),x=He({ascender:_.ascender,descender:_.descender,advanceWidthMax:_.advanceWidthMax,minLeftSideBearing:_.minLeftSideBearing,minRightSideBearing:_.minRightSideBearing,xMaxExtent:_.maxLeftSideBearing+(_.xMax-_.xMin),numberOfHMetrics:e.glyphs.length}),w=Qe(e.glyphs.length),S=ft({xAvgCharWidth:Math.round(_.advanceWidthAvg),usWeightClass:e.tables.os2.usWeightClass,usWidthClass:e.tables.os2.usWidthClass,usFirstCharIndex:t,usLastCharIndex:u,ulUnicodeRange1:h,ulUnicodeRange2:d,ulUnicodeRange3:c,ulUnicodeRange4:f,fsSelection:e.tables.os2.fsSelection,sTypoAscender:_.ascender,sTypoDescender:_.descender,sTypoLineGap:0,usWinAscent:_.yMax,usWinDescent:Math.abs(_.yMin),ulCodePageRange1:1,sxHeight:Pt(e,"xyvw",{yMax:Math.round(_.ascender/2)}).yMax,sCapHeight:Pt(e,"HIKLEFJMNTZBDPRAGOQSUVWXY",_).yMax,usDefaultChar:e.hasChar(" ")?32:0,usBreakChar:e.hasChar(" ")?32:0}),M=Xe(e.glyphs),E=le(e.glyphs),T=e.getEnglishName("fontFamily"),C=e.getEnglishName("fontSubfamily"),P=T+" "+C,L=e.getEnglishName("postScriptName");L||(L=T.replace(/\s/g,"")+"-"+C);var R={};for(var O in e.names)R[O]=e.names[O];R.uniqueID||(R.uniqueID={en:e.getEnglishName("manufacturer")+":"+P}),R.postScriptName||(R.postScriptName={en:L}),R.preferredFamily||(R.preferredFamily=e.names.fontFamily),R.preferredSubfamily||(R.preferredSubfamily=e.names.fontSubfamily);var D=[],A=ht(R,D),I=0<D.length?qe(D):void 0,k=vt(),U=Ge(e.glyphs,{version:e.getEnglishName("version"),fullName:P,familyName:T,weightName:C,postScriptName:L,unitsPerEm:e.unitsPerEm,fontBBox:[0,_.yMin,_.ascender,_.advanceWidthMax]}),F=e.metas&&0<Object.keys(e.metas).length?St(e.metas):void 0,N=[b,x,w,S,A,E,k,U,M];I&&N.push(I),e.tables.gsub&&N.push(xt(e.tables.gsub)),F&&N.push(F);for(var B=Ct(N),G=Et(B.encode()),j=B.fields,V=!1,z=0;z<j.length;z+=1)if("head table"===j[z].name){j[z].value.checkSumAdjustment=2981146554-G,V=!0;break}if(!V)throw new Error("Could not find head table with checkSum to adjust.");return B};function Rt(e,t){for(var r=0,i=e.length-1;r<=i;){var a=r+i>>>1,n=e[a].tag;if(n===t)return a;n<t?r=a+1:i=a-1}return-r-1}function Ot(e,t){for(var r=0,i=e.length-1;r<=i;){var a=r+i>>>1,n=e[a];if(n===t)return a;n<t?r=a+1:i=a-1}return-r-1}function Dt(e,t){for(var r,i=0,a=e.length-1;i<=a;){var n=i+a>>>1,o=(r=e[n]).start;if(o===t)return r;o<t?i=n+1:a=n-1}if(0<i)return t>(r=e[i-1]).end?0:r}function At(e,t){this.font=e,this.tableName=t}function It(e){At.call(this,e,"gpos")}function kt(e){At.call(this,e,"gsub")}function Ut(e,t){var r=e.length;if(r!==t.length)return!1;for(var i=0;i<r;i++)if(e[i]!==t[i])return!1;return!0}function Ft(e,t,r){for(var i=e.subtables,a=0;a<i.length;a++){var n=i[a];if(n.substFormat===t)return n}if(r)return i.push(r),r}function Nt(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),i=0;i<e.length;++i)r[i]=e[i];return t}function Bt(e,t){if(!e)throw t}function Gt(e,t,r,i,a){var n;return 0<(t&i)?(n=e.parseByte(),0==(t&a)&&(n=-n),r+n):0<(t&a)?r:r+e.parseShort()}function jt(e,t,r){var i,a,n=new oe.Parser(t,r);if(e.numberOfContours=n.parseShort(),e._xMin=n.parseShort(),e._yMin=n.parseShort(),e._xMax=n.parseShort(),e._yMax=n.parseShort(),0<e.numberOfContours){for(var o=e.endPointIndices=[],s=0;s<e.numberOfContours;s+=1)o.push(n.parseUShort());e.instructionLength=n.parseUShort(),e.instructions=[];for(var l=0;l<e.instructionLength;l+=1)e.instructions.push(n.parseByte());var u=o[o.length-1]+1;i=[];for(var h=0;h<u;h+=1)if(a=n.parseByte(),i.push(a),0<(8&a))for(var d=n.parseByte(),c=0;c<d;c+=1)i.push(a),h+=1;if(R.argument(i.length===u,"Bad flags."),0<o.length){var f,p=[];if(0<u){for(var m=0;m<u;m+=1)a=i[m],(f={}).onCurve=!!(1&a),f.lastPointOfContour=0<=o.indexOf(m),p.push(f);for(var v=0,g=0;g<u;g+=1)a=i[g],(f=p[g]).x=Gt(n,a,v,2,16),v=f.x;for(var y=0,_=0;_<u;_+=1)a=i[_],(f=p[_]).y=Gt(n,a,y,4,32),y=f.y}e.points=p}else e.points=[]}else if(0===e.numberOfContours)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];for(var b=!0;b;){i=n.parseUShort();var x={glyphIndex:n.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};0<(1&i)?0<(2&i)?(x.dx=n.parseShort(),x.dy=n.parseShort()):x.matchedPoints=[n.parseUShort(),n.parseUShort()]:0<(2&i)?(x.dx=n.parseChar(),x.dy=n.parseChar()):x.matchedPoints=[n.parseByte(),n.parseByte()],0<(8&i)?x.xScale=x.yScale=n.parseF2Dot14():0<(64&i)?(x.xScale=n.parseF2Dot14(),x.yScale=n.parseF2Dot14()):0<(128&i)&&(x.xScale=n.parseF2Dot14(),x.scale01=n.parseF2Dot14(),x.scale10=n.parseF2Dot14(),x.yScale=n.parseF2Dot14()),e.components.push(x),b=!!(32&i)}if(256&i){e.instructionLength=n.parseUShort(),e.instructions=[];for(var w=0;w<e.instructionLength;w+=1)e.instructions.push(n.parseByte())}}}function Vt(e,t){for(var r=[],i=0;i<e.length;i+=1){var a=e[i],n={x:t.xScale*a.x+t.scale01*a.y+t.dx,y:t.scale10*a.x+t.yScale*a.y+t.dy,onCurve:a.onCurve,lastPointOfContour:a.lastPointOfContour};r.push(n)}return r}function zt(e){var t=new C;if(!e)return t;for(var r=function(e){for(var t=[],r=[],i=0;i<e.length;i+=1){var a=e[i];r.push(a),a.lastPointOfContour&&(t.push(r),r=[])}return R.argument(0===r.length,"There are still points left in the current contour."),t}(e),i=0;i<r.length;++i){var a=r[i],n=null,o=a[a.length-1],s=a[0];if(o.onCurve)t.moveTo(o.x,o.y);else if(s.onCurve)t.moveTo(s.x,s.y);else{var l={x:.5*(o.x+s.x),y:.5*(o.y+s.y)};t.moveTo(l.x,l.y)}for(var u=0;u<a.length;++u)if(n=o,o=s,s=a[(u+1)%a.length],o.onCurve)t.lineTo(o.x,o.y);else{var h=s;n.onCurve||(o.x,n.x,o.y,n.y),s.onCurve||(h={x:.5*(o.x+s.x),y:.5*(o.y+s.y)}),t.quadraticCurveTo(o.x,o.y,h.x,h.y)}t.closePath()}return t}function Ht(e,t){if(t.isComposite)for(var r=0;r<t.components.length;r+=1){var i=t.components[r],a=e.get(i.glyphIndex);if(a.getPath(),a.points){var n=void 0;if(void 0===i.matchedPoints)n=Vt(a.points,i);else{if(i.matchedPoints[0]>t.points.length-1||i.matchedPoints[1]>a.points.length-1)throw Error("Matched points out of range in "+t.name);var o=t.points[i.matchedPoints[0]],s=a.points[i.matchedPoints[1]],l={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};s=Vt([s],l)[0],l.dx=o.x-s.x,l.dy=o.y-s.y,n=Vt(a.points,l)}t.points=t.points.concat(n)}}return zt(t.points)}(It.prototype=At.prototype={searchTag:Rt,binSearch:Ot,getTable:function(e){var t=this.font.tables[this.tableName];return!t&&e&&(t=this.font.tables[this.tableName]=this.createDefaultTable()),t},getScriptNames:function(){var e=this.getTable();return e?e.scripts.map((function(e){return e.tag})):[]},getDefaultScriptName:function(){var e=this.getTable();if(e){for(var t=!1,r=0;r<e.scripts.length;r++){var i=e.scripts[r].tag;if("DFLT"===i)return i;"latn"===i&&(t=!0)}return t?"latn":void 0}},getScriptTable:function(e,t){var r=this.getTable(t);if(r){e=e||"DFLT";var i=r.scripts,a=Rt(r.scripts,e);if(0<=a)return i[a].script;if(t){var n={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-a,0,n),n.script}}},getLangSysTable:function(e,t,r){var i=this.getScriptTable(e,r);if(i){if(!t||"dflt"===t||"DFLT"===t)return i.defaultLangSys;var a=Rt(i.langSysRecords,t);if(0<=a)return i.langSysRecords[a].langSys;if(r){var n={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-a,0,n),n.langSys}}},getFeatureTable:function(e,t,r,i){var a=this.getLangSysTable(e,t,i);if(a){for(var n,o=a.featureIndexes,s=this.font.tables[this.tableName].features,l=0;l<o.length;l++)if((n=s[o[l]]).tag===r)return n.feature;if(i){var u=s.length;return R.assert(0===u||r>=s[u-1].tag,"Features must be added in alphabetical order."),n={tag:r,feature:{params:0,lookupListIndexes:[]}},s.push(n),o.push(u),n.feature}}},getLookupTables:function(e,t,r,i,a){var n=this.getFeatureTable(e,t,r,a),o=[];if(n){for(var s,l=n.lookupListIndexes,u=this.font.tables[this.tableName].lookups,h=0;h<l.length;h++)(s=u[l[h]]).lookupType===i&&o.push(s);if(0===o.length&&a){s={lookupType:i,lookupFlag:0,subtables:[],markFilteringSet:void 0};var d=u.length;return u.push(s),l.push(d),[s]}}return o},getGlyphClass:function(e,t){switch(e.format){case 1:return e.startGlyph<=t&&t<e.startGlyph+e.classes.length?e.classes[t-e.startGlyph]:0;case 2:var r=Dt(e.ranges,t);return r?r.classId:0}},getCoverageIndex:function(e,t){switch(e.format){case 1:var r=Ot(e.glyphs,t);return 0<=r?r:-1;case 2:var i=Dt(e.ranges,t);return i?i.index+t-i.start:-1}},expandCoverage:function(e){if(1===e.format)return e.glyphs;for(var t=[],r=e.ranges,i=0;i<r.length;i++)for(var a=r[i],n=a.start,o=a.end,s=n;s<=o;s++)t.push(s);return t}}).init=function(){var e=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(e)},It.prototype.getKerningValue=function(e,t,r){for(var i=0;i<e.length;i++)for(var a=e[i].subtables,n=0;n<a.length;n++){var o=a[n],s=this.getCoverageIndex(o.coverage,t);if(!(s<0))switch(o.posFormat){case 1:for(var l=o.pairSets[s],u=0;u<l.length;u++){var h=l[u];if(h.secondGlyph===r)return h.value1&&h.value1.xAdvance||0}break;case 2:var d=this.getGlyphClass(o.classDef1,t),c=this.getGlyphClass(o.classDef2,r),f=o.classRecords[d][c];return f.value1&&f.value1.xAdvance||0}}return 0},It.prototype.getKerningTables=function(e,t){if(this.font.tables.gpos)return this.getLookupTables(e,t,"kern",2)},(kt.prototype=At.prototype).createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},kt.prototype.getSingle=function(e,t,r){for(var i=[],a=this.getLookupTables(t,r,e,1),n=0;n<a.length;n++)for(var o=a[n].subtables,s=0;s<o.length;s++){var l=o[s],u=this.expandCoverage(l.coverage),h=void 0;if(1===l.substFormat){var d=l.deltaGlyphId;for(h=0;h<u.length;h++){var c=u[h];i.push({sub:c,by:c+d})}}else{var f=l.substitute;for(h=0;h<u.length;h++)i.push({sub:u[h],by:f[h]})}}return i},kt.prototype.getAlternates=function(e,t,r){for(var i=[],a=this.getLookupTables(t,r,e,3),n=0;n<a.length;n++)for(var o=a[n].subtables,s=0;s<o.length;s++)for(var l=o[s],u=this.expandCoverage(l.coverage),h=l.alternateSets,d=0;d<u.length;d++)i.push({sub:u[d],by:h[d]});return i},kt.prototype.getLigatures=function(e,t,r){for(var i=[],a=this.getLookupTables(t,r,e,4),n=0;n<a.length;n++)for(var o=a[n].subtables,s=0;s<o.length;s++)for(var l=o[s],u=this.expandCoverage(l.coverage),h=l.ligatureSets,d=0;d<u.length;d++)for(var c=u[d],f=h[d],p=0;p<f.length;p++){var m=f[p];i.push({sub:[c].concat(m.components),by:m.ligGlyph})}return i},kt.prototype.addSingle=function(e,t,r,i){var a=Ft(this.getLookupTables(r,i,e,1,!0)[0],2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});R.assert(1===a.coverage.format,"Ligature: unable to modify coverage table format "+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o<0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.substitute.splice(o,0,0)),a.substitute[o]=t.by},kt.prototype.addAlternate=function(e,t,r,i){var a=Ft(this.getLookupTables(r,i,e,3,!0)[0],1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});R.assert(1===a.coverage.format,"Ligature: unable to modify coverage table format "+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o<0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.alternateSets.splice(o,0,0)),a.alternateSets[o]=t.by},kt.prototype.addLigature=function(e,t,r,i){var a=this.getLookupTables(r,i,e,4,!0)[0],n=a.subtables[0];n||(n={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},a.subtables[0]=n),R.assert(1===n.coverage.format,"Ligature: unable to modify coverage table format "+n.coverage.format);var o=t.sub[0],s=t.sub.slice(1),l={ligGlyph:t.by,components:s},u=this.binSearch(n.coverage.glyphs,o);if(0<=u){for(var h=n.ligatureSets[u],d=0;d<h.length;d++)if(Ut(h[d].components,s))return;h.push(l)}else u=-1-u,n.coverage.glyphs.splice(u,0,o),n.ligatureSets.splice(u,0,[l])},kt.prototype.getFeature=function(e,t,r){if(/ss\d\d/.test(e))return this.getSingle(e,t,r);switch(e){case"aalt":case"salt":return this.getSingle(e,t,r).concat(this.getAlternates(e,t,r));case"dlig":case"liga":case"rlig":return this.getLigatures(e,t,r)}},kt.prototype.add=function(e,t,r,i){if(/ss\d\d/.test(e))return this.addSingle(e,t,r,i);switch(e){case"aalt":case"salt":return"number"==typeof t.by?this.addSingle(e,t,r,i):this.addAlternate(e,t,r,i);case"dlig":case"liga":case"rlig":return this.addLigature(e,t,r,i)}};var Wt,Xt,qt,Yt,Zt={getPath:zt,parse:function(e,t,r,i){for(var a=new xe.GlyphSet(i),n=0;n<r.length-1;n+=1){var o=r[n];o!==r[n+1]?a.push(n,xe.ttfGlyphLoader(i,n,jt,e,t+o,Ht)):a.push(n,xe.glyphLoader(i,n))}return a}};function Qt(e){this.font=e,this.getCommands=function(e){return Zt.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function Kt(e){return e}function Jt(e){return Math.sign(e)*Math.round(Math.abs(e))}function $t(e){return Math.sign(e)*Math.round(Math.abs(2*e))/2}function er(e){return Math.sign(e)*(Math.round(Math.abs(e)+.5)-.5)}function tr(e){return Math.sign(e)*Math.ceil(Math.abs(e))}function rr(e){return Math.sign(e)*Math.floor(Math.abs(e))}var ir=function(e){var t=this.srPeriod,r=this.srPhase,i=1;return e<0&&(e=-e,i=-1),e+=this.srThreshold-r,e=Math.trunc(e/t)*t,(e+=r)<0?r*i:e*i},ar={x:1,y:0,axis:"x",distance:function(e,t,r,i){return(r?e.xo:e.x)-(i?t.xo:t.x)},interpolate:function(e,t,r,i){var a,n,o,s,l,u,h;if(!i||i===this)return a=e.xo-t.xo,n=e.xo-r.xo,l=t.x-t.xo,u=r.x-r.xo,0===(h=(o=Math.abs(a))+(s=Math.abs(n)))?void(e.x=e.xo+(l+u)/2):void(e.x=e.xo+(l*s+u*o)/h);a=i.distance(e,t,!0,!0),n=i.distance(e,r,!0,!0),l=i.distance(t,t,!1,!0),u=i.distance(r,r,!1,!0),0!==(h=(o=Math.abs(a))+(s=Math.abs(n)))?ar.setRelative(e,e,(l*s+u*o)/h,i,!0):ar.setRelative(e,e,(l+u)/2,i,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(e,t,r,i,a){if(i&&i!==this){var n=a?t.xo:t.x,o=a?t.yo:t.y,s=n+r*i.x,l=o+r*i.y;e.x=s+(e.y-l)/i.normalSlope}else e.x=(a?t.xo:t.x)+r},slope:0,touch:function(e){e.xTouched=!0},touched:function(e){return e.xTouched},untouch:function(e){e.xTouched=!1}},nr={x:0,y:1,axis:"y",distance:function(e,t,r,i){return(r?e.yo:e.y)-(i?t.yo:t.y)},interpolate:function(e,t,r,i){var a,n,o,s,l,u,h;if(!i||i===this)return a=e.yo-t.yo,n=e.yo-r.yo,l=t.y-t.yo,u=r.y-r.yo,0===(h=(o=Math.abs(a))+(s=Math.abs(n)))?void(e.y=e.yo+(l+u)/2):void(e.y=e.yo+(l*s+u*o)/h);a=i.distance(e,t,!0,!0),n=i.distance(e,r,!0,!0),l=i.distance(t,t,!1,!0),u=i.distance(r,r,!1,!0),0!==(h=(o=Math.abs(a))+(s=Math.abs(n)))?nr.setRelative(e,e,(l*s+u*o)/h,i,!0):nr.setRelative(e,e,(l+u)/2,i,!0)},normalSlope:0,setRelative:function(e,t,r,i,a){if(i&&i!==this){var n=a?t.xo:t.x,o=a?t.yo:t.y,s=n+r*i.x,l=o+r*i.y;e.y=l+i.normalSlope*(e.x-s)}else e.y=(a?t.yo:t.y)+r},slope:Number.POSITIVE_INFINITY,touch:function(e){e.yTouched=!0},touched:function(e){return e.yTouched},untouch:function(e){e.yTouched=!1}};function or(e,t){this.x=e,this.y=t,this.axis=void 0,this.slope=t/e,this.normalSlope=-e/t,Object.freeze(this)}function sr(e,t){var r=Math.sqrt(e*e+t*t);return t/=r,1==(e/=r)&&0===t?ar:0===e&&1===t?nr:new or(e,t)}function lr(e,t,r,i){this.x=this.xo=Math.round(64*e)/64,this.y=this.yo=Math.round(64*t)/64,this.lastPointOfContour=r,this.onCurve=i,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Object.freeze(ar),Object.freeze(nr),or.prototype.distance=function(e,t,r,i){return this.x*ar.distance(e,t,r,i)+this.y*nr.distance(e,t,r,i)},or.prototype.interpolate=function(e,t,r,i){var a,n,o,s,l,u,h;o=i.distance(e,t,!0,!0),s=i.distance(e,r,!0,!0),a=i.distance(t,t,!1,!0),n=i.distance(r,r,!1,!0),0!==(h=(l=Math.abs(o))+(u=Math.abs(s)))?this.setRelative(e,e,(a*u+n*l)/h,i,!0):this.setRelative(e,e,(a+n)/2,i,!0)},or.prototype.setRelative=function(e,t,r,i,a){i=i||this;var n=a?t.xo:t.x,o=a?t.yo:t.y,s=n+r*i.x,l=o+r*i.y,u=i.normalSlope,h=this.slope,d=e.x,c=e.y;e.x=(h*d-u*s+l-c)/(h-u),e.y=h*(e.x-d)+c},or.prototype.touch=function(e){e.xTouched=!0,e.yTouched=!0},lr.prototype.nextTouched=function(e){for(var t=this.nextPointOnContour;!e.touched(t)&&t!==this;)t=t.nextPointOnContour;return t},lr.prototype.prevTouched=function(e){for(var t=this.prevPointOnContour;!e.touched(t)&&t!==this;)t=t.prevPointOnContour;return t};var ur=Object.freeze(new lr(0,0)),hr={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function dr(e,t){switch(this.env=e,this.stack=[],this.prog=t,e){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=ar,this.round=Jt}}function cr(e){for(var t=e.tZone=new Array(e.gZone.length),r=0;r<t.length;r++)t[r]=new lr(0,0)}function fr(e,t){var r,i=e.prog,a=e.ip,n=1;do{if(88===(r=i[++a]))n++;else if(89===r)n--;else if(64===r)a+=i[a+1]+1;else if(65===r)a+=2*i[a+1]+1;else if(176<=r&&r<=183)a+=r-176+1;else if(184<=r&&r<=191)a+=2*(r-184+1);else if(t&&1===n&&27===r)break}while(0<n);e.ip=a}function pr(e,r){t.DEBUG&&console.log(r.step,"SVTCA["+e.axis+"]"),r.fv=r.pv=r.dpv=e}function mr(e,r){t.DEBUG&&console.log(r.step,"SPVTCA["+e.axis+"]"),r.pv=r.dpv=e}function vr(e,r){t.DEBUG&&console.log(r.step,"SFVTCA["+e.axis+"]"),r.fv=e}function gr(e,r){var i,a,n=r.stack,o=n.pop(),s=n.pop(),l=r.z2[o],u=r.z1[s];t.DEBUG&&console.log("SPVTL["+e+"]",o,s),a=e?(i=l.y-u.y,u.x-l.x):(i=u.x-l.x,u.y-l.y),r.pv=r.dpv=sr(i,a)}function yr(e,r){var i,a,n=r.stack,o=n.pop(),s=n.pop(),l=r.z2[o],u=r.z1[s];t.DEBUG&&console.log("SFVTL["+e+"]",o,s),a=e?(i=l.y-u.y,u.x-l.x):(i=u.x-l.x,u.y-l.y),r.fv=sr(i,a)}function _r(e){t.DEBUG&&console.log(e.step,"POP[]"),e.stack.pop()}function br(e,r){var i=r.stack.pop(),a=r.z0[i],n=r.fv,o=r.pv;t.DEBUG&&console.log(r.step,"MDAP["+e+"]",i);var s=o.distance(a,ur);e&&(s=r.round(s)),n.setRelative(a,ur,s,o),n.touch(a),r.rp0=r.rp1=i}function xr(e,r){var i,a,n,o=r.z2,s=o.length-2;t.DEBUG&&console.log(r.step,"IUP["+e.axis+"]");for(var l=0;l<s;l++)i=o[l],e.touched(i)||(a=i.prevTouched(e))!==i&&(a===(n=i.nextTouched(e))&&e.setRelative(i,i,e.distance(a,a,!1,!0),e,!0),e.interpolate(i,a,n,e))}function wr(e,r){for(var i=r.stack,a=e?r.rp1:r.rp2,n=(e?r.z0:r.z1)[a],o=r.fv,s=r.pv,l=r.loop,u=r.z2;l--;){var h=i.pop(),d=u[h],c=s.distance(n,n,!1,!0);o.setRelative(d,d,c,s),o.touch(d),t.DEBUG&&console.log(r.step,(1<r.loop?"loop "+(r.loop-l)+": ":"")+"SHP["+(e?"rp1":"rp2")+"]",h)}r.loop=1}function Sr(e,r){var i=r.stack,a=e?r.rp1:r.rp2,n=(e?r.z0:r.z1)[a],o=r.fv,s=r.pv,l=i.pop(),u=r.z2[r.contours[l]],h=u;t.DEBUG&&console.log(r.step,"SHC["+e+"]",l);for(var d=s.distance(n,n,!1,!0);h!==n&&o.setRelative(h,h,d,s),(h=h.nextPointOnContour)!==u;);}function Mr(e,r){var i,a,n=r.stack,o=e?r.rp1:r.rp2,s=(e?r.z0:r.z1)[o],l=r.fv,u=r.pv,h=n.pop();switch(t.DEBUG&&console.log(r.step,"SHZ["+e+"]",h),h){case 0:i=r.tZone;break;case 1:i=r.gZone;break;default:throw new Error("Invalid zone")}for(var d=u.distance(s,s,!1,!0),c=i.length-2,f=0;f<c;f++)a=i[f],l.setRelative(a,a,d,u)}function Er(e,r){var i=r.stack,a=i.pop()/64,n=i.pop(),o=r.z1[n],s=r.z0[r.rp0],l=r.fv,u=r.pv;l.setRelative(o,s,a,u),l.touch(o),t.DEBUG&&console.log(r.step,"MSIRP["+e+"]",a,n),r.rp1=r.rp0,r.rp2=n,e&&(r.rp0=n)}function Tr(e,r){var i=r.stack,a=i.pop(),n=i.pop(),o=r.z0[n],s=r.fv,l=r.pv,u=r.cvt[a];t.DEBUG&&console.log(r.step,"MIAP["+e+"]",a,"(",u,")",n);var h=l.distance(o,ur);e&&(Math.abs(h-u)<r.cvCutIn&&(h=u),h=r.round(h)),s.setRelative(o,ur,h,l),0===r.zp0&&(o.xo=o.x,o.yo=o.y),s.touch(o),r.rp0=r.rp1=n}function Cr(e,r){var i=r.stack,a=i.pop(),n=r.z2[a];t.DEBUG&&console.log(r.step,"GC["+e+"]",a),i.push(64*r.dpv.distance(n,ur,e,!1))}function Pr(e,r){var i=r.stack,a=i.pop(),n=i.pop(),o=r.z1[a],s=r.z0[n],l=r.dpv.distance(s,o,e,e);t.DEBUG&&console.log(r.step,"MD["+e+"]",a,n,"->",l),r.stack.push(Math.round(64*l))}function Lr(e,r){var i=r.stack,a=i.pop(),n=r.fv,o=r.pv,s=r.ppem,l=r.deltaBase+16*(e-1),u=r.deltaShift,h=r.z0;t.DEBUG&&console.log(r.step,"DELTAP["+e+"]",a,i);for(var d=0;d<a;d++){var c=i.pop(),f=i.pop();if(l+((240&f)>>4)===s){var p=(15&f)-8;0<=p&&p++,t.DEBUG&&console.log(r.step,"DELTAPFIX",c,"by",p*u);var m=h[c];n.setRelative(m,m,p*u,o)}}}function Rr(e,r){var i=r.stack,a=i.pop();t.DEBUG&&console.log(r.step,"ROUND[]"),i.push(64*r.round(a/64))}function Or(e,r){var i=r.stack,a=i.pop(),n=r.ppem,o=r.deltaBase+16*(e-1),s=r.deltaShift;t.DEBUG&&console.log(r.step,"DELTAC["+e+"]",a,i);for(var l=0;l<a;l++){var u=i.pop(),h=i.pop();if(o+((240&h)>>4)===n){var d=(15&h)-8;0<=d&&d++;var c=d*s;t.DEBUG&&console.log(r.step,"DELTACFIX",u,"by",c),r.cvt[u]+=c}}}function Dr(e,r){var i,a,n=r.stack,o=n.pop(),s=n.pop(),l=r.z2[o],u=r.z1[s];t.DEBUG&&console.log(r.step,"SDPVTL["+e+"]",o,s),a=e?(i=l.y-u.y,u.x-l.x):(i=u.x-l.x,u.y-l.y),r.dpv=sr(i,a)}function Ar(e,r){var i=r.stack,a=r.prog,n=r.ip;t.DEBUG&&console.log(r.step,"PUSHB["+e+"]");for(var o=0;o<e;o++)i.push(a[++n]);r.ip=n}function Ir(e,r){var i=r.ip,a=r.prog,n=r.stack;t.DEBUG&&console.log(r.ip,"PUSHW["+e+"]");for(var o=0;o<e;o++){var s=a[++i]<<8|a[++i];32768&s&&(s=-(1+(65535^s))),n.push(s)}r.ip=i}function kr(e,r,i,a,n,o){var s,l,u,h,d=o.stack,c=e&&d.pop(),f=d.pop(),p=o.rp0,m=o.z0[p],v=o.z1[f],g=o.minDis,y=o.fv,_=o.dpv;u=0<=(l=s=_.distance(v,m,!0,!0))?1:-1,l=Math.abs(l),e&&(h=o.cvt[c],a&&Math.abs(l-h)<o.cvCutIn&&(l=h)),i&&l<g&&(l=g),a&&(l=o.round(l)),y.setRelative(v,m,u*l,_),y.touch(v),t.DEBUG&&console.log(o.step,(e?"MIRP[":"MDRP[")+(r?"M":"m")+(i?">":"_")+(a?"R":"_")+(0===n?"Gr":1===n?"Bl":2===n?"Wh":"")+"]",e?c+"("+o.cvt[c]+","+h+")":"",f,"(d =",s,"->",u*l,")"),o.rp1=o.rp0,o.rp2=f,r&&(o.rp0=f)}Qt.prototype.exec=function(e,r){if("number"!=typeof r)throw new Error("Point size is not a number!");if(!(2<this._errorState)){var i=this.font,a=this._prepState;if(!a||a.ppem!==r){var n=this._fpgmState;if(!n){dr.prototype=hr,(n=this._fpgmState=new dr("fpgm",i.tables.fpgm)).funcs=[],n.font=i,t.DEBUG&&(console.log("---EXEC FPGM---"),n.step=-1);try{Xt(n)}catch(e){return console.log("Hinting error in FPGM:"+e),void(this._errorState=3)}}dr.prototype=n,(a=this._prepState=new dr("prep",i.tables.prep)).ppem=r;var o=i.tables.cvt;if(o)for(var s=a.cvt=new Array(o.length),l=r/i.unitsPerEm,u=0;u<o.length;u++)s[u]=o[u]*l;else a.cvt=[];t.DEBUG&&(console.log("---EXEC PREP---"),a.step=-1);try{Xt(a)}catch(e){this._errorState<2&&console.log("Hinting error in PREP:"+e),this._errorState=2}}if(!(1<this._errorState))try{return qt(e,a)}catch(e){return this._errorState<1&&(console.log("Hinting error:"+e),console.log("Note: further hinting errors are silenced")),void(this._errorState=1)}}},qt=function(e,r){var i,a,n,o=r.ppem/r.font.unitsPerEm,s=o,l=e.components;if(dr.prototype=r,l){var u=r.font;a=[],i=[];for(var h=0;h<l.length;h++){var d=l[h],c=u.glyphs.get(d.glyphIndex);n=new dr("glyf",c.instructions),t.DEBUG&&(console.log("---EXEC COMP "+h+"---"),n.step=-1),Yt(c,n,o,s);for(var f=Math.round(d.dx*o),p=Math.round(d.dy*s),m=n.gZone,v=n.contours,g=0;g<m.length;g++){var y=m[g];y.xTouched=y.yTouched=!1,y.xo=y.x=y.x+f,y.yo=y.y=y.y+p}var _=a.length;a.push.apply(a,m);for(var b=0;b<v.length;b++)i.push(v[b]+_)}e.instructions&&!n.inhibitGridFit&&((n=new dr("glyf",e.instructions)).gZone=n.z0=n.z1=n.z2=a,n.contours=i,a.push(new lr(0,0),new lr(Math.round(e.advanceWidth*o),0)),t.DEBUG&&(console.log("---EXEC COMPOSITE---"),n.step=-1),Xt(n),a.length-=2)}else n=new dr("glyf",e.instructions),t.DEBUG&&(console.log("---EXEC GLYPH---"),n.step=-1),Yt(e,n,o,s),a=n.gZone;return a},Yt=function(e,r,i,a){for(var n,o,s,l=e.points||[],u=l.length,h=r.gZone=r.z0=r.z1=r.z2=[],d=r.contours=[],c=0;c<u;c++)n=l[c],h[c]=new lr(n.x*i,n.y*a,n.lastPointOfContour,n.onCurve);for(var f=0;f<u;f++)n=h[f],o||(o=n,d.push(f)),n.lastPointOfContour?((n.nextPointOnContour=o).prevPointOnContour=n,o=void 0):(s=h[f+1],(n.nextPointOnContour=s).prevPointOnContour=n);if(!r.inhibitGridFit){if(t.DEBUG){console.log("PROCESSING GLYPH",r.stack);for(var p=0;p<u;p++)console.log(p,h[p].x,h[p].y)}if(h.push(new lr(0,0),new lr(Math.round(e.advanceWidth*i),0)),Xt(r),h.length-=2,t.DEBUG){console.log("FINISHED GLYPH",r.stack);for(var m=0;m<u;m++)console.log(m,h[m].x,h[m].y)}}},Xt=function(e){var r=e.prog;if(r){var i,a=r.length;for(e.ip=0;e.ip<a;e.ip++){if(t.DEBUG&&e.step++,!(i=Wt[r[e.ip]]))throw new Error("unknown instruction: 0x"+Number(r[e.ip]).toString(16));i(e)}}},Wt=[pr.bind(void 0,nr),pr.bind(void 0,ar),mr.bind(void 0,nr),mr.bind(void 0,ar),vr.bind(void 0,nr),vr.bind(void 0,ar),gr.bind(void 0,0),gr.bind(void 0,1),yr.bind(void 0,0),yr.bind(void 0,1),function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"SPVFS[]",i,a),e.pv=e.dpv=sr(a,i)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"SPVFS[]",i,a),e.fv=sr(a,i)},function(e){var r=e.stack,i=e.pv;t.DEBUG&&console.log(e.step,"GPV[]"),r.push(16384*i.x),r.push(16384*i.y)},function(e){var r=e.stack,i=e.fv;t.DEBUG&&console.log(e.step,"GFV[]"),r.push(16384*i.x),r.push(16384*i.y)},function(e){e.fv=e.pv,t.DEBUG&&console.log(e.step,"SFVTPV[]")},function(e){var r=e.stack,i=r.pop(),a=r.pop(),n=r.pop(),o=r.pop(),s=r.pop(),l=e.z0,u=e.z1,h=l[i],d=l[a],c=u[n],f=u[o],p=e.z2[s];t.DEBUG&&console.log("ISECT[], ",i,a,n,o,s);var m=h.x,v=h.y,g=d.x,y=d.y,_=c.x,b=c.y,x=f.x,w=f.y,S=(m-g)*(b-w)-(v-y)*(_-x),M=m*y-v*g,E=_*w-b*x;p.x=(M*(_-x)-E*(m-g))/S,p.y=(M*(b-w)-E*(v-y))/S},function(e){e.rp0=e.stack.pop(),t.DEBUG&&console.log(e.step,"SRP0[]",e.rp0)},function(e){e.rp1=e.stack.pop(),t.DEBUG&&console.log(e.step,"SRP1[]",e.rp1)},function(e){e.rp2=e.stack.pop(),t.DEBUG&&console.log(e.step,"SRP2[]",e.rp2)},function(e){var r=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZP0[]",r),e.zp0=r){case 0:e.tZone||cr(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){var r=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZP1[]",r),e.zp1=r){case 0:e.tZone||cr(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){var r=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZP2[]",r),e.zp2=r){case 0:e.tZone||cr(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){var r=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZPS[]",r),e.zp0=e.zp1=e.zp2=r,r){case 0:e.tZone||cr(e),e.z0=e.z1=e.z2=e.tZone;break;case 1:e.z0=e.z1=e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){e.loop=e.stack.pop(),t.DEBUG&&console.log(e.step,"SLOOP[]",e.loop)},function(e){t.DEBUG&&console.log(e.step,"RTG[]"),e.round=Jt},function(e){t.DEBUG&&console.log(e.step,"RTHG[]"),e.round=er},function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"SMD[]",r),e.minDis=r/64},function(e){t.DEBUG&&console.log(e.step,"ELSE[]"),fr(e,!1)},function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"JMPR[]",r),e.ip+=r-1},function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"SCVTCI[]",r),e.cvCutIn=r/64},void 0,void 0,function(e){var r=e.stack;t.DEBUG&&console.log(e.step,"DUP[]"),r.push(r[r.length-1])},_r,function(e){t.DEBUG&&console.log(e.step,"CLEAR[]"),e.stack.length=0},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"SWAP[]"),r.push(i),r.push(a)},function(e){var r=e.stack;t.DEBUG&&console.log(e.step,"DEPTH[]"),r.push(r.length)},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"CINDEX[]",i),r.push(r[r.length-i])},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"MINDEX[]",i),r.push(r.splice(r.length-i,1)[0])},void 0,void 0,void 0,function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"LOOPCALL[]",i,a);var n=e.ip,o=e.prog;e.prog=e.funcs[i];for(var s=0;s<a;s++)Xt(e),t.DEBUG&&console.log(++e.step,s+1<a?"next loopcall":"done loopcall",s);e.ip=n,e.prog=o},function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"CALL[]",r);var i=e.ip,a=e.prog;e.prog=e.funcs[r],Xt(e),e.ip=i,e.prog=a,t.DEBUG&&console.log(++e.step,"returning from",r)},function(e){if("fpgm"!==e.env)throw new Error("FDEF not allowed here");var r=e.stack,i=e.prog,a=e.ip,n=r.pop(),o=a;for(t.DEBUG&&console.log(e.step,"FDEF[]",n);45!==i[++a];);e.ip=a,e.funcs[n]=i.slice(o+1,a)},void 0,br.bind(void 0,0),br.bind(void 0,1),xr.bind(void 0,nr),xr.bind(void 0,ar),wr.bind(void 0,0),wr.bind(void 0,1),Sr.bind(void 0,0),Sr.bind(void 0,1),Mr.bind(void 0,0),Mr.bind(void 0,1),function(e){for(var r=e.stack,i=e.loop,a=e.fv,n=r.pop()/64,o=e.z2;i--;){var s=r.pop(),l=o[s];t.DEBUG&&console.log(e.step,(1<e.loop?"loop "+(e.loop-i)+": ":"")+"SHPIX[]",s,n),a.setRelative(l,l,n),a.touch(l)}e.loop=1},function(e){for(var r=e.stack,i=e.rp1,a=e.rp2,n=e.loop,o=e.z0[i],s=e.z1[a],l=e.fv,u=e.dpv,h=e.z2;n--;){var d=r.pop(),c=h[d];t.DEBUG&&console.log(e.step,(1<e.loop?"loop "+(e.loop-n)+": ":"")+"IP[]",d,i,"<->",a),l.interpolate(c,o,s,u),l.touch(c)}e.loop=1},Er.bind(void 0,0),Er.bind(void 0,1),function(e){for(var r=e.stack,i=e.rp0,a=e.z0[i],n=e.loop,o=e.fv,s=e.pv,l=e.z1;n--;){var u=r.pop(),h=l[u];t.DEBUG&&console.log(e.step,(1<e.loop?"loop "+(e.loop-n)+": ":"")+"ALIGNRP[]",u),o.setRelative(h,a,0,s),o.touch(h)}e.loop=1},function(e){t.DEBUG&&console.log(e.step,"RTDG[]"),e.round=$t},Tr.bind(void 0,0),Tr.bind(void 0,1),function(e){var r=e.prog,i=e.ip,a=e.stack,n=r[++i];t.DEBUG&&console.log(e.step,"NPUSHB[]",n);for(var o=0;o<n;o++)a.push(r[++i]);e.ip=i},function(e){var r=e.ip,i=e.prog,a=e.stack,n=i[++r];t.DEBUG&&console.log(e.step,"NPUSHW[]",n);for(var o=0;o<n;o++){var s=i[++r]<<8|i[++r];32768&s&&(s=-(1+(65535^s))),a.push(s)}e.ip=r},function(e){var r=e.stack,i=e.store;i||(i=e.store=[]);var a=r.pop(),n=r.pop();t.DEBUG&&console.log(e.step,"WS",a,n),i[n]=a},function(e){var r=e.stack,i=e.store,a=r.pop();t.DEBUG&&console.log(e.step,"RS",a);var n=i&&i[a]||0;r.push(n)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"WCVTP",i,a),e.cvt[a]=i/64},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"RCVT",i),r.push(64*e.cvt[i])},Cr.bind(void 0,0),Cr.bind(void 0,1),void 0,Pr.bind(void 0,0),Pr.bind(void 0,1),function(e){t.DEBUG&&console.log(e.step,"MPPEM[]"),e.stack.push(e.ppem)},void 0,function(e){t.DEBUG&&console.log(e.step,"FLIPON[]"),e.autoFlip=!0},void 0,void 0,function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"LT[]",i,a),r.push(a<i?1:0)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"LTEQ[]",i,a),r.push(a<=i?1:0)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"GT[]",i,a),r.push(i<a?1:0)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"GTEQ[]",i,a),r.push(i<=a?1:0)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"EQ[]",i,a),r.push(i===a?1:0)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"NEQ[]",i,a),r.push(i!==a?1:0)},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"ODD[]",i),r.push(Math.trunc(i)%2?1:0)},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"EVEN[]",i),r.push(Math.trunc(i)%2?0:1)},function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"IF[]",r),r||(fr(e,!0),t.DEBUG&&console.log(e.step,"EIF[]"))},function(e){t.DEBUG&&console.log(e.step,"EIF[]")},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"AND[]",i,a),r.push(i&&a?1:0)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"OR[]",i,a),r.push(i||a?1:0)},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"NOT[]",i),r.push(i?0:1)},Lr.bind(void 0,1),function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"SDB[]",r),e.deltaBase=r},function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"SDS[]",r),e.deltaShift=Math.pow(.5,r)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"ADD[]",i,a),r.push(a+i)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"SUB[]",i,a),r.push(a-i)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"DIV[]",i,a),r.push(64*a/i)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"MUL[]",i,a),r.push(a*i/64)},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"ABS[]",i),r.push(Math.abs(i))},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"NEG[]",i),r.push(-i)},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"FLOOR[]",i),r.push(64*Math.floor(i/64))},function(e){var r=e.stack,i=r.pop();t.DEBUG&&console.log(e.step,"CEILING[]",i),r.push(64*Math.ceil(i/64))},Rr.bind(void 0,0),Rr.bind(void 0,1),Rr.bind(void 0,2),Rr.bind(void 0,3),void 0,void 0,void 0,void 0,function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"WCVTF[]",i,a),e.cvt[a]=i*e.ppem/e.font.unitsPerEm},Lr.bind(void 0,2),Lr.bind(void 0,3),Or.bind(void 0,1),Or.bind(void 0,2),Or.bind(void 0,3),function(e){var r,i=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SROUND[]",i),e.round=ir,192&i){case 0:r=.5;break;case 64:r=1;break;case 128:r=2;break;default:throw new Error("invalid SROUND value")}switch(e.srPeriod=r,48&i){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error("invalid SROUND value")}i&=15,e.srThreshold=0===i?0:(i/8-.5)*r},function(e){var r,i=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"S45ROUND[]",i),e.round=ir,192&i){case 0:r=Math.sqrt(2)/2;break;case 64:r=Math.sqrt(2);break;case 128:r=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(e.srPeriod=r,48&i){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error("invalid S45ROUND value")}i&=15,e.srThreshold=0===i?0:(i/8-.5)*r},void 0,void 0,function(e){t.DEBUG&&console.log(e.step,"ROFF[]"),e.round=Kt},void 0,function(e){t.DEBUG&&console.log(e.step,"RUTG[]"),e.round=tr},function(e){t.DEBUG&&console.log(e.step,"RDTG[]"),e.round=rr},_r,_r,void 0,void 0,void 0,void 0,void 0,function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"SCANCTRL[]",r)},Dr.bind(void 0,0),Dr.bind(void 0,1),function(e){var r=e.stack,i=r.pop(),a=0;t.DEBUG&&console.log(e.step,"GETINFO[]",i),1&i&&(a=35),32&i&&(a|=4096),r.push(a)},void 0,function(e){var r=e.stack,i=r.pop(),a=r.pop(),n=r.pop();t.DEBUG&&console.log(e.step,"ROLL[]"),r.push(a),r.push(i),r.push(n)},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"MAX[]",i,a),r.push(Math.max(a,i))},function(e){var r=e.stack,i=r.pop(),a=r.pop();t.DEBUG&&console.log(e.step,"MIN[]",i,a),r.push(Math.min(a,i))},function(e){var r=e.stack.pop();t.DEBUG&&console.log(e.step,"SCANTYPE[]",r)},function(e){var r=e.stack.pop(),i=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"INSTCTRL[]",r,i),r){case 1:return void(e.inhibitGridFit=!!i);case 2:return void(e.ignoreCvt=!!i);default:throw new Error("invalid INSTCTRL[] selector")}},void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Ar.bind(void 0,1),Ar.bind(void 0,2),Ar.bind(void 0,3),Ar.bind(void 0,4),Ar.bind(void 0,5),Ar.bind(void 0,6),Ar.bind(void 0,7),Ar.bind(void 0,8),Ir.bind(void 0,1),Ir.bind(void 0,2),Ir.bind(void 0,3),Ir.bind(void 0,4),Ir.bind(void 0,5),Ir.bind(void 0,6),Ir.bind(void 0,7),Ir.bind(void 0,8),kr.bind(void 0,0,0,0,0,0),kr.bind(void 0,0,0,0,0,1),kr.bind(void 0,0,0,0,0,2),kr.bind(void 0,0,0,0,0,3),kr.bind(void 0,0,0,0,1,0),kr.bind(void 0,0,0,0,1,1),kr.bind(void 0,0,0,0,1,2),kr.bind(void 0,0,0,0,1,3),kr.bind(void 0,0,0,1,0,0),kr.bind(void 0,0,0,1,0,1),kr.bind(void 0,0,0,1,0,2),kr.bind(void 0,0,0,1,0,3),kr.bind(void 0,0,0,1,1,0),kr.bind(void 0,0,0,1,1,1),kr.bind(void 0,0,0,1,1,2),kr.bind(void 0,0,0,1,1,3),kr.bind(void 0,0,1,0,0,0),kr.bind(void 0,0,1,0,0,1),kr.bind(void 0,0,1,0,0,2),kr.bind(void 0,0,1,0,0,3),kr.bind(void 0,0,1,0,1,0),kr.bind(void 0,0,1,0,1,1),kr.bind(void 0,0,1,0,1,2),kr.bind(void 0,0,1,0,1,3),kr.bind(void 0,0,1,1,0,0),kr.bind(void 0,0,1,1,0,1),kr.bind(void 0,0,1,1,0,2),kr.bind(void 0,0,1,1,0,3),kr.bind(void 0,0,1,1,1,0),kr.bind(void 0,0,1,1,1,1),kr.bind(void 0,0,1,1,1,2),kr.bind(void 0,0,1,1,1,3),kr.bind(void 0,1,0,0,0,0),kr.bind(void 0,1,0,0,0,1),kr.bind(void 0,1,0,0,0,2),kr.bind(void 0,1,0,0,0,3),kr.bind(void 0,1,0,0,1,0),kr.bind(void 0,1,0,0,1,1),kr.bind(void 0,1,0,0,1,2),kr.bind(void 0,1,0,0,1,3),kr.bind(void 0,1,0,1,0,0),kr.bind(void 0,1,0,1,0,1),kr.bind(void 0,1,0,1,0,2),kr.bind(void 0,1,0,1,0,3),kr.bind(void 0,1,0,1,1,0),kr.bind(void 0,1,0,1,1,1),kr.bind(void 0,1,0,1,1,2),kr.bind(void 0,1,0,1,1,3),kr.bind(void 0,1,1,0,0,0),kr.bind(void 0,1,1,0,0,1),kr.bind(void 0,1,1,0,0,2),kr.bind(void 0,1,1,0,0,3),kr.bind(void 0,1,1,0,1,0),kr.bind(void 0,1,1,0,1,1),kr.bind(void 0,1,1,0,1,2),kr.bind(void 0,1,1,0,1,3),kr.bind(void 0,1,1,1,0,0),kr.bind(void 0,1,1,1,0,1),kr.bind(void 0,1,1,1,0,2),kr.bind(void 0,1,1,1,0,3),kr.bind(void 0,1,1,1,1,0),kr.bind(void 0,1,1,1,1,1),kr.bind(void 0,1,1,1,1,2),kr.bind(void 0,1,1,1,1,3)];var Ur=Array.from||function(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]};function Fr(e){(e=e||{}).empty||(Bt(e.familyName,"When creating a new Font object, familyName is required."),Bt(e.styleName,"When creating a new Font object, styleName is required."),Bt(e.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Bt(e.ascender,"When creating a new Font object, ascender is required."),Bt(e.descender,"When creating a new Font object, descender is required."),Bt(e.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:e.familyName||" "},fontSubfamily:{en:e.styleName||" "},fullName:{en:e.fullName||e.familyName+" "+e.styleName},postScriptName:{en:e.postScriptName||(e.familyName+e.styleName).replace(/\s/g,"")},designer:{en:e.designer||" "},designerURL:{en:e.designerURL||" "},manufacturer:{en:e.manufacturer||" "},manufacturerURL:{en:e.manufacturerURL||" "},license:{en:e.license||" "},licenseURL:{en:e.licenseURL||" "},version:{en:e.version||"Version 0.1"},description:{en:e.description||" "},copyright:{en:e.copyright||" "},trademark:{en:e.trademark||" "}},this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.tables={os2:{usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,fsSelection:e.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new xe.GlyphSet(this,e.glyphs||[]),this.encoding=new fe(this),this.position=new It(this),this.substitution=new kt(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:"truetype"===this.outlinesFormat?this._hinting=new Qt(this):void 0}})}function Nr(e,t,r,i){var a={},n=new oe.Parser(e,t);a.name=i[n.parseUShort()]||{},n.skip("uShort",1),a.coordinates={};for(var o=0;o<r.length;++o)a.coordinates[r[o].tag]=n.parseFixed();return a}Fr.prototype.hasChar=function(e){return null!==this.encoding.charToGlyphIndex(e)},Fr.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},Fr.prototype.charToGlyph=function(e){var t=this.charToGlyphIndex(e),r=this.glyphs.get(t);return r||(r=this.glyphs.get(0)),r},Fr.prototype.stringToGlyphs=function(e,t){t=t||this.defaultRenderOptions;for(var r=Ur(e),i=[],a=0;a<r.length;a+=1){var n=r[a];i.push(this.charToGlyphIndex(n))}var o=i.length;if(t.features){var s=t.script||this.substitution.getDefaultScriptName(),l=[];t.features.liga&&(l=l.concat(this.substitution.getFeature("liga",s,t.language))),t.features.rlig&&(l=l.concat(this.substitution.getFeature("rlig",s,t.language)));for(var u=0;u<o;u+=1)for(var h=0;h<l.length;h++){for(var d=l[h],c=d.sub,f=c.length,p=0;p<f&&c[p]===i[u+p];)p++;p===f&&(i.splice(u,f,d.by),o=o-f+1)}}for(var m=new Array(o),v=this.glyphs.get(0),g=0;g<o;g+=1)m[g]=this.glyphs.get(i[g])||v;return m},Fr.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)},Fr.prototype.nameToGlyph=function(e){var t=this.nameToGlyphIndex(e),r=this.glyphs.get(t);return r||(r=this.glyphs.get(0)),r},Fr.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):""},Fr.prototype.getKerningValue=function(e,t){e=e.index||e,t=t.index||t;var r=this.position.defaultKerningTables;return r?this.position.getKerningValue(r,e,t):this.kerningPairs[e+","+t]||0},Fr.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},Fr.prototype.forEachGlyph=function(e,t,r,i,a,n){t=void 0!==t?t:0,r=void 0!==r?r:0,i=void 0!==i?i:72,a=a||this.defaultRenderOptions;var o,s=1/this.unitsPerEm*i,l=this.stringToGlyphs(e,a);if(a.kerning){var u=a.script||this.position.getDefaultScriptName();o=this.position.getKerningTables(u,a.language)}for(var h=0;h<l.length;h+=1){var d=l[h];n.call(this,d,t,r,i,a),d.advanceWidth&&(t+=d.advanceWidth*s),a.kerning&&h<l.length-1&&(t+=(o?this.position.getKerningValue(o,d.index,l[h+1].index):this.getKerningValue(d,l[h+1]))*s),a.letterSpacing?t+=a.letterSpacing*i:a.tracking&&(t+=a.tracking/1e3*i)}return t},Fr.prototype.getPath=function(e,t,r,i,a){var n=new C;return this.forEachGlyph(e,t,r,i,a,(function(e,t,r,i){var o=e.getPath(t,r,i,a,this);n.extend(o)})),n},Fr.prototype.getPaths=function(e,t,r,i,a){var n=[];return this.forEachGlyph(e,t,r,i,a,(function(e,t,r,i){var o=e.getPath(t,r,i,a,this);n.push(o)})),n},Fr.prototype.getAdvanceWidth=function(e,t,r){return this.forEachGlyph(e,0,0,t,r,(function(){}))},Fr.prototype.draw=function(e,t,r,i,a,n){this.getPath(t,r,i,a,n).draw(e)},Fr.prototype.drawPoints=function(e,t,r,i,a,n){this.forEachGlyph(t,r,i,a,n,(function(t,r,i,a){t.drawPoints(e,r,i,a)}))},Fr.prototype.drawMetrics=function(e,t,r,i,a,n){this.forEachGlyph(t,r,i,a,n,(function(t,r,i,a){t.drawMetrics(e,r,i,a)}))},Fr.prototype.getEnglishName=function(e){var t=this.names[e];if(t)return t.en},Fr.prototype.validate=function(){var e=this;function t(t){var r=e.getEnglishName(t);r&&r.trim().length}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm},Fr.prototype.toTables=function(){return Lt(this)},Fr.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},Fr.prototype.toArrayBuffer=function(){for(var e=this.toTables().encode(),t=new ArrayBuffer(e.length),r=new Uint8Array(t),i=0;i<e.length;i++)r[i]=e[i];return t},Fr.prototype.download=function(t){var r=this.getEnglishName("fontFamily"),a=this.getEnglishName("fontSubfamily");t=t||r.replace(/\s/g,"")+"-"+a+".otf";var n=this.toArrayBuffer();if("undefined"!=typeof window)window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem,window.requestFileSystem(window.TEMPORARY,n.byteLength,(function(e){e.root.getFile(t,{create:!0},(function(e){e.createWriter((function(t){var r=new DataView(n),i=new Blob([r],{type:"font/opentype"});t.write(i),t.addEventListener("writeend",(function(){location.href=e.toURL()}),!1)}))}))}),(function(e){throw new Error(e.name+": "+e.message)}));else{var o=e("fs"),s=function(e){for(var t=new i(e.byteLength),r=new Uint8Array(e),a=0;a<t.length;++a)t[a]=r[a];return t}(n);o.writeFileSync(t,s)}},Fr.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Fr.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Fr.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var Br=function(e,t,r){var i=new oe.Parser(e,t),a=i.parseULong();R.argument(65536===a,"Unsupported fvar table version.");var n=i.parseOffset16();i.skip("uShort",1);for(var o,s,l,u,h,d=i.parseUShort(),c=i.parseUShort(),f=i.parseUShort(),p=i.parseUShort(),m=[],v=0;v<d;v++)m.push((o=e,s=t+n+v*c,l=r,h=u=void 0,u={},h=new oe.Parser(o,s),u.tag=h.parseTag(),u.minValue=h.parseFixed(),u.defaultValue=h.parseFixed(),u.maxValue=h.parseFixed(),h.skip("uShort",1),u.name=l[h.parseUShort()]||{},u));for(var g=[],y=t+n+d*c,_=0;_<f;_++)g.push(Nr(e,y+_*p,m,r));return{axes:m,instances:g}},Gr=new Array(10);Gr[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{posFormat:1,coverage:this.parsePointer(ae.coverage),value:this.parseValueRecord()}:2===t?{posFormat:2,coverage:this.parsePointer(ae.coverage),values:this.parseValueRecordList()}:void R.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},Gr[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();R.assert(1===t||2===t,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var r=this.parsePointer(ae.coverage),i=this.parseUShort(),a=this.parseUShort();if(1===t)return{posFormat:t,coverage:r,valueFormat1:i,valueFormat2:a,pairSets:this.parseList(ae.pointer(ae.list((function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(i),value2:this.parseValueRecord(a)}}))))};if(2===t){var n=this.parsePointer(ae.classDef),o=this.parsePointer(ae.classDef),s=this.parseUShort(),l=this.parseUShort();return{posFormat:t,coverage:r,valueFormat1:i,valueFormat2:a,classDef1:n,classDef2:o,class1Count:s,class2Count:l,classRecords:this.parseList(s,ae.list(l,(function(){return{value1:this.parseValueRecord(i),value2:this.parseValueRecord(a)}})))}}},Gr[3]=function(){return{error:"GPOS Lookup 3 not supported"}},Gr[4]=function(){return{error:"GPOS Lookup 4 not supported"}},Gr[5]=function(){return{error:"GPOS Lookup 5 not supported"}},Gr[6]=function(){return{error:"GPOS Lookup 6 not supported"}},Gr[7]=function(){return{error:"GPOS Lookup 7 not supported"}},Gr[8]=function(){return{error:"GPOS Lookup 8 not supported"}},Gr[9]=function(){return{error:"GPOS Lookup 9 not supported"}},new Array(10);var jr=function(e,t){var r=new ae(e,t=t||0),i=r.parseVersion(1);return R.argument(1===i||1.1===i,"Unsupported GPOS table version "+i),1===i?{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(Gr)}:{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(Gr),variations:r.parseFeatureVariationsList()}},Vr=function(e,t){var r=new oe.Parser(e,t),i=r.parseUShort();if(0===i)return function(e){var t={};e.skip("uShort");var r=e.parseUShort();R.argument(0===r,"Unsupported kern sub-table version."),e.skip("uShort",2);var i=e.parseUShort();e.skip("uShort",3);for(var a=0;a<i;a+=1){var n=e.parseUShort(),o=e.parseUShort(),s=e.parseShort();t[n+","+o]=s}return t}(r);if(1===i)return function(e){var t={};e.skip("uShort"),1<e.parseULong()&&console.warn("Only the first kern subtable is supported."),e.skip("uLong");var r=255&e.parseUShort();if(e.skip("uShort"),0===r){var i=e.parseUShort();e.skip("uShort",3);for(var a=0;a<i;a+=1){var n=e.parseUShort(),o=e.parseUShort(),s=e.parseShort();t[n+","+o]=s}}return t}(r);throw new Error("Unsupported kern table version ("+i+").")},zr=function(e,t,r,i){for(var a=new oe.Parser(e,t),n=i?a.parseUShort:a.parseULong,o=[],s=0;s<r+1;s+=1){var l=n.call(a);i&&(l*=2),o.push(l)}return o};function Hr(t,r){e("fs").readFile(t,(function(e,t){if(e)return r(e.message);r(null,Nt(t))}))}function Wr(e,t){var r=new XMLHttpRequest;r.open("get",e,!0),r.responseType="arraybuffer",r.onload=function(){return r.response?t(null,r.response):t("Font could not be loaded: "+r.statusText)},r.onerror=function(){t("Font could not be loaded")},r.send()}function Xr(e,t){for(var r=[],i=12,a=0;a<t;a+=1){var n=oe.getTag(e,i),o=oe.getULong(e,i+4),s=oe.getULong(e,i+8),l=oe.getULong(e,i+12);r.push({tag:n,checksum:o,offset:s,length:l,compression:!1}),i+=16}return r}function qr(e,t){if("WOFF"!==t.compression)return{data:e,offset:t.offset};var r=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),i=new Uint8Array(t.length);if(function(e,t){var r,i,a=new o(e,t);do{switch(r=_(a),b(a,2,0)){case 0:i=M(a);break;case 1:i=S(a,s,l);break;case 2:w(a,a.ltree,a.dtree),i=S(a,a.ltree,a.dtree);break;default:i=-3}if(0!==i)throw new Error("Data error")}while(!r);a.destLen<a.dest.length?"function"==typeof a.dest.slice?a.dest.slice(0,a.destLen):a.dest.subarray(0,a.destLen):a.dest}(r,i),i.byteLength!==t.length)throw new Error("Decompression error: "+t.tag+" decompressed length doesn't match recorded length");return{data:new DataView(i.buffer,0),offset:0}}function Yr(e){var t,r,i,a,n,o,s,l,u,h,d,c,f,p,m=new Fr({empty:!0}),v=new DataView(e,0),g=[],y=oe.getTag(v,0);if(y===String.fromCharCode(0,1,0,0)||"true"===y||"typ1"===y)m.outlinesFormat="truetype",g=Xr(v,i=oe.getUShort(v,4));else if("OTTO"===y)m.outlinesFormat="cff",g=Xr(v,i=oe.getUShort(v,4));else{if("wOFF"!==y)throw new Error("Unsupported OpenType signature "+y);var _=oe.getTag(v,4);if(_===String.fromCharCode(0,1,0,0))m.outlinesFormat="truetype";else{if("OTTO"!==_)throw new Error("Unsupported OpenType flavor "+y);m.outlinesFormat="cff"}g=function(e,t){for(var r=[],i=44,a=0;a<t;a+=1){var n,o=oe.getTag(e,i),s=oe.getULong(e,i+4),l=oe.getULong(e,i+8),u=oe.getULong(e,i+12);n=l<u&&"WOFF",r.push({tag:o,offset:s,compression:n,compressedLength:l,length:u}),i+=20}return r}(v,i=oe.getUShort(v,12))}for(var b=0;b<i;b+=1){var x=g[b],w=void 0;switch(x.tag){case"cmap":w=qr(v,x),m.tables.cmap=se(w.data,w.offset),m.encoding=new pe(m.tables.cmap);break;case"cvt ":w=qr(v,x),p=new oe.Parser(w.data,w.offset),m.tables.cvt=p.parseShortList(x.length/2);break;case"fvar":n=x;break;case"fpgm":w=qr(v,x),p=new oe.Parser(w.data,w.offset),m.tables.fpgm=p.parseByteList(x.length);break;case"head":w=qr(v,x),m.tables.head=je(w.data,w.offset),m.unitsPerEm=m.tables.head.unitsPerEm,t=m.tables.head.indexToLocFormat;break;case"hhea":w=qr(v,x),m.tables.hhea=ze(w.data,w.offset),m.ascender=m.tables.hhea.ascender,m.descender=m.tables.hhea.descender,m.numberOfHMetrics=m.tables.hhea.numberOfHMetrics;break;case"hmtx":u=x;break;case"ltag":w=qr(v,x),r=Ye(w.data,w.offset);break;case"maxp":w=qr(v,x),m.tables.maxp=Ze(w.data,w.offset),m.numGlyphs=m.tables.maxp.numGlyphs;break;case"name":c=x;break;case"OS/2":w=qr(v,x),m.tables.os2=ct(w.data,w.offset);break;case"post":w=qr(v,x),m.tables.post=mt(w.data,w.offset),m.glyphNames=new ve(m.tables.post);break;case"prep":w=qr(v,x),p=new oe.Parser(w.data,w.offset),m.tables.prep=p.parseByteList(x.length);break;case"glyf":o=x;break;case"loca":d=x;break;case"CFF ":a=x;break;case"kern":h=x;break;case"GPOS":s=x;break;case"GSUB":l=x;break;case"meta":f=x}}var S=qr(v,c);if(m.tables.name=ut(S.data,S.offset,r),m.names=m.tables.name,o&&d){var M=0===t,E=qr(v,d),T=zr(E.data,E.offset,m.numGlyphs,M),C=qr(v,o);m.glyphs=Zt.parse(C.data,C.offset,T,m)}else{if(!a)throw new Error("Font doesn't contain TrueType or CFF outlines.");var P=qr(v,a);Be(P.data,P.offset,m)}var L=qr(v,u);if(We(L.data,L.offset,m.numberOfHMetrics,m.numGlyphs,m.glyphs),function(e){for(var t,r=e.tables.cmap.glyphIndexMap,i=Object.keys(r),a=0;a<i.length;a+=1){var n=i[a],o=r[n];(t=e.glyphs.get(o)).addUnicode(parseInt(n))}for(var s=0;s<e.glyphs.length;s+=1)t=e.glyphs.get(s),e.cffEncoding?e.isCIDFont?t.name="gid"+s:t.name=e.cffEncoding.charset[s]:e.glyphNames.names&&(t.name=e.glyphNames.glyphIndexToName(s))}(m),h){var R=qr(v,h);m.kerningPairs=Vr(R.data,R.offset)}else m.kerningPairs={};if(s){var O=qr(v,s);m.tables.gpos=jr(O.data,O.offset),m.position.init()}if(l){var D=qr(v,l);m.tables.gsub=bt(D.data,D.offset)}if(n){var A=qr(v,n);m.tables.fvar=Br(A.data,A.offset,m.names)}if(f){var I=qr(v,f);m.tables.meta=wt(I.data,I.offset),m.metas=m.tables.meta}return m}t.Font=Fr,t.Glyph=ye,t.Path=C,t.BoundingBox=T,t._parse=oe,t.parse=Yr,t.load=function(e,t){("undefined"==typeof window?Hr:Wr)(e,(function(e,r){if(e)return t(e);var i;try{i=Yr(r)}catch(e){return t(e,null)}return t(null,i)}))},t.loadSync=function(t){return Yr(Nt(e("fs").readFileSync(t)))},Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&void 0!==t?r:this.opentype={})}).call(this,e("buffer").Buffer)},{buffer:3,fs:2}],12:[function(e,t,r){(function(e){function t(e,t){for(var r=0,i=e.length-1;0<=i;i--){var a=e[i];"."===a?e.splice(i,1):".."===a?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function i(e,t){if(e.filter)return e.filter(t);for(var r=[],i=0;i<e.length;i++)t(e[i],i,e)&&r.push(e[i]);return r}r.resolve=function(){for(var r="",a=!1,n=arguments.length-1;-1<=n&&!a;n--){var o=0<=n?arguments[n]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(r=o+"/"+r,a="/"===o.charAt(0))}return(a?"/":"")+(r=t(i(r.split("/"),(function(e){return!!e})),!a).join("/"))||"."},r.normalize=function(e){var n=r.isAbsolute(e),o="/"===a(e,-1);return(e=t(i(e.split("/"),(function(e){return!!e})),!n).join("/"))||n||(e="."),e&&o&&(e+="/"),(n?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(i(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},r.relative=function(e,t){function i(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;0<=r&&""===e[r];r--);return r<t?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var a=i(e.split("/")),n=i(t.split("/")),o=Math.min(a.length,n.length),s=o,l=0;l<o;l++)if(a[l]!==n[l]){s=l;break}var u=[];for(l=s;l<a.length;l++)u.push("..");return(u=u.concat(n.slice(s))).join("/")},r.sep="/",r.delimiter=":",r.dirname=function(e){if("string"!=typeof e&&(e+=""),0===e.length)return".";for(var t=e.charCodeAt(0),r=47===t,i=-1,a=!0,n=e.length-1;1<=n;--n)if(47===(t=e.charCodeAt(n))){if(!a){i=n;break}}else a=!1;return-1===i?r?"/":".":r&&1===i?"/":e.slice(0,i)},r.basename=function(e,t){var r=function(e){"string"!=typeof e&&(e+="");var t,r=0,i=-1,a=!0;for(t=e.length-1;0<=t;--t)if(47===e.charCodeAt(t)){if(!a){r=t+1;break}}else-1===i&&(a=!1,i=t+1);return-1===i?"":e.slice(r,i)}(e);return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},r.extname=function(e){"string"!=typeof e&&(e+="");for(var t=-1,r=0,i=-1,a=!0,n=0,o=e.length-1;0<=o;--o){var s=e.charCodeAt(o);if(47===s){if(a)continue;r=o+1;break}-1===i&&(a=!1,i=o+1),46===s?-1===t?t=o:1!==n&&(n=1):-1!==t&&(n=-1)}return-1===t||-1===i||0===n||1===n&&t===i-1&&t===r+1?"":e.slice(t,i)};var a="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)}}).call(this,e("_process"))},{_process:13}],13:[function(e,t,r){var i,a,n=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(i===setTimeout)return setTimeout(e,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(e){i=o}try{a="function"==typeof clearTimeout?clearTimeout:s}catch(e){a=s}}();var u,h=[],d=!1,c=-1;function f(){d&&u&&(d=!1,u.length?h=u.concat(h):c=-1,h.length&&p())}function p(){if(!d){var e=l(f);d=!0;for(var t=h.length;t;){for(u=h,h=[];++c<t;)u&&u[c].run();c=-1,t=h.length}u=null,d=!1,function(e){if(a===clearTimeout)return clearTimeout(e);if((a===s||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(e);try{a(e)}catch(t){try{return a.call(null,e)}catch(t){return a.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function v(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];h.push(new m(e,t)),1!==h.length||d||l(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=v,n.addListener=v,n.once=v,n.off=v,n.removeListener=v,n.removeAllListeners=v,n.emit=v,n.prependListener=v,n.prependOnceListener=v,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],14:[function(e,t,r){!function(e){"use strict";if(!e.fetch){var t="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,n="ArrayBuffer"in e;if(n)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=function(e){return e&&DataView.prototype.isPrototypeOf(e)},l=ArrayBuffer.isView||function(e){return e&&-1<o.indexOf(Object.prototype.toString.call(e))};p.prototype.append=function(e,t){e=d(e),t=c(t);var r=this.map[e];this.map[e]=r?r+","+t:t},p.prototype.delete=function(e){delete this.map[d(e)]},p.prototype.get=function(e){return e=d(e),this.has(e)?this.map[e]:null},p.prototype.has=function(e){return this.map.hasOwnProperty(d(e))},p.prototype.set=function(e,t){this.map[d(e)]=c(t)},p.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},p.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),f(e)},p.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),f(e)},p.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),f(e)},r&&(p.prototype[Symbol.iterator]=p.prototype.entries);var u=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},_.call(b.prototype),_.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var h=[301,302,303,307,308];w.redirect=function(e,t){if(-1===h.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.Headers=p,e.Request=b,e.Response=w,e.fetch=function(e,t){return new Promise((function(r,a){var n=new b(e,t),o=new XMLHttpRequest;o.onload=function(){var e,t,i={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new p,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var a=r.join(":").trim();t.append(i,a)}})),t)};i.url="responseURL"in o?o.responseURL:i.headers.get("X-Request-URL");var a="response"in o?o.response:o.responseText;r(new w(a,i))},o.onerror=function(){a(new TypeError("Network request failed"))},o.ontimeout=function(){a(new TypeError("Network request failed"))},o.open(n.method,n.url,!0),"include"===n.credentials?o.withCredentials=!0:"omit"===n.credentials&&(o.withCredentials=!1),"responseType"in o&&i&&(o.responseType="blob"),n.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),o.send(void 0===n._bodyInit?null:n._bodyInit)}))},e.fetch.polyfill=!0}function d(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function c(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function p(e){this.map={},e instanceof p?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function m(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function v(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=v(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e)if("string"==typeof e)this._bodyText=e;else if(i&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(a&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(n&&i&&s(e))this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!n||!ArrayBuffer.prototype.isPrototypeOf(e)&&!l(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=y(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=m(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?m(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e,t,r,i=m(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,r=v(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(x)}),this.json=function(){return this.text().then(JSON.parse)},this}function b(e,t){var r,i,a=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new p(e.headers)),this.method=e.method,this.mode=e.mode,a||null==e._bodyInit||(a=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new p(t.headers)),this.method=(i=(r=t.method||this.method||"GET").toUpperCase(),-1<u.indexOf(i)?i:r),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&a)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(a)}function x(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),a=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(a))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new p(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},{}],15:[function(e,t,r){"use strict";var i,a=(i=e("./core/main"))&&i.__esModule?i:{default:i};e("./core/constants"),e("./core/environment"),e("./core/error_helpers"),e("./core/helpers"),e("./core/legacy"),e("./core/preload"),e("./core/p5.Element"),e("./core/p5.Graphics"),e("./core/p5.Renderer"),e("./core/p5.Renderer2D"),e("./core/rendering"),e("./core/shim"),e("./core/structure"),e("./core/transform"),e("./core/shape/2d_primitives"),e("./core/shape/attributes"),e("./core/shape/curves"),e("./core/shape/vertex"),e("./color/color_conversion"),e("./color/creating_reading"),e("./color/p5.Color"),e("./color/setting"),e("./data/p5.TypedDict"),e("./data/local_storage.js"),e("./dom/dom"),e("./events/acceleration"),e("./events/keyboard"),e("./events/mouse"),e("./events/touch"),e("./image/filters"),e("./image/image"),e("./image/loading_displaying"),e("./image/p5.Image"),e("./image/pixels"),e("./io/files"),e("./io/p5.Table"),e("./io/p5.TableRow"),e("./io/p5.XML"),e("./math/calculation"),e("./math/math"),e("./math/noise"),e("./math/p5.Vector"),e("./math/random"),e("./math/trigonometry"),e("./typography/attributes"),e("./typography/loading_displaying"),e("./typography/p5.Font"),e("./utilities/array_functions"),e("./utilities/conversion"),e("./utilities/string_functions"),e("./utilities/time_date"),e("./webgl/3d_primitives"),e("./webgl/interaction"),e("./webgl/light"),e("./webgl/loading"),e("./webgl/material"),e("./webgl/p5.Camera"),e("./webgl/p5.Geometry"),e("./webgl/p5.Matrix"),e("./webgl/p5.RendererGL.Immediate"),e("./webgl/p5.RendererGL"),e("./webgl/p5.RendererGL.Retained"),e("./webgl/p5.Shader"),e("./webgl/p5.Texture"),e("./webgl/text"),e("./core/init"),t.exports=a.default},{"./color/color_conversion":16,"./color/creating_reading":17,"./color/p5.Color":18,"./color/setting":19,"./core/constants":20,"./core/environment":21,"./core/error_helpers":22,"./core/helpers":23,"./core/init":24,"./core/legacy":25,"./core/main":26,"./core/p5.Element":27,"./core/p5.Graphics":28,"./core/p5.Renderer":29,"./core/p5.Renderer2D":30,"./core/preload":31,"./core/rendering":32,"./core/shape/2d_primitives":33,"./core/shape/attributes":34,"./core/shape/curves":35,"./core/shape/vertex":36,"./core/shim":37,"./core/structure":38,"./core/transform":39,"./data/local_storage.js":40,"./data/p5.TypedDict":41,"./dom/dom":42,"./events/acceleration":43,"./events/keyboard":44,"./events/mouse":45,"./events/touch":46,"./image/filters":47,"./image/image":48,"./image/loading_displaying":49,"./image/p5.Image":50,"./image/pixels":51,"./io/files":52,"./io/p5.Table":53,"./io/p5.TableRow":54,"./io/p5.XML":55,"./math/calculation":56,"./math/math":57,"./math/noise":58,"./math/p5.Vector":59,"./math/random":60,"./math/trigonometry":61,"./typography/attributes":62,"./typography/loading_displaying":63,"./typography/p5.Font":64,"./utilities/array_functions":65,"./utilities/conversion":66,"./utilities/string_functions":67,"./utilities/time_date":68,"./webgl/3d_primitives":69,"./webgl/interaction":70,"./webgl/light":71,"./webgl/loading":72,"./webgl/material":73,"./webgl/p5.Camera":74,"./webgl/p5.Geometry":75,"./webgl/p5.Matrix":76,"./webgl/p5.RendererGL":79,"./webgl/p5.RendererGL.Immediate":77,"./webgl/p5.RendererGL.Retained":78,"./webgl/p5.Shader":80,"./webgl/p5.Texture":81,"./webgl/text":82}],16:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.ColorConversion={},a.default.ColorConversion._hsbaToHSLA=function(e){var t=e[0],r=e[1],i=e[2],a=(2-r)*i/2;return 0!==a&&(1===a?r=0:a<.5?r/=2-r:r=r*i/(2-2*a)),[t,r,a,e[3]]},a.default.ColorConversion._hsbaToRGBA=function(e){var t=6*e[0],r=e[1],i=e[2],a=[];if(0===r)a=[i,i,i,e[3]];else{var n,o,s,l=Math.floor(t),u=i*(1-r),h=i*(1-r*(t-l)),d=i*(1-r*(1+l-t));s=1===l?(n=h,o=i,u):2===l?(n=u,o=i,d):3===l?(n=u,o=h,i):4===l?(n=d,o=u,i):5===l?(n=i,o=u,h):(n=i,o=d,u),a=[n,o,s,e[3]]}return a},a.default.ColorConversion._hslaToHSBA=function(e){var t,r=e[0],i=e[1],a=e[2];return[r,i=2*((t=a<.5?(1+i)*a:a+i-a*i)-a)/t,t,e[3]]},a.default.ColorConversion._hslaToRGBA=function(e){var t=6*e[0],r=e[1],i=e[2],a=[];if(0===r)a=[i,i,i,e[3]];else{var n,o=2*i-(n=i<.5?(1+r)*i:i+r-i*r),s=function(e,t,r){return e<0?e+=6:6<=e&&(e-=6),e<1?t+(r-t)*e:e<3?r:e<4?t+(r-t)*(4-e):t};a=[s(t+2,o,n),s(t,o,n),s(t-2,o,n),e[3]]}return a},a.default.ColorConversion._rgbaToHSBA=function(e){var t,r,i=e[0],a=e[1],n=e[2],o=Math.max(i,a,n),s=o-Math.min(i,a,n);return 0===s?r=t=0:(r=s/o,i===o?t=(a-n)/s:a===o?t=2+(n-i)/s:n===o&&(t=4+(i-a)/s),t<0?t+=6:6<=t&&(t-=6)),[t/6,r,o,e[3]]},a.default.ColorConversion._rgbaToHSLA=function(e){var t,r,i=e[0],a=e[1],n=e[2],o=Math.max(i,a,n),s=Math.min(i,a,n),l=o+s,u=o-s;return 0===u?r=t=0:(r=l<1?u/l:u/(2-l),i===o?t=(a-n)/u:a===o?t=2+(n-i)/u:n===o&&(t=4+(i-a)/u),t<0?t+=6:6<=t&&(t-=6)),[t/6,r,l/2,e[3]]};var n=a.default.ColorConversion;r.default=n},{"../core/main":26}],17:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));e("./p5.Color"),e("../core/error_helpers"),a.default.prototype.alpha=function(e){return a.default._validateParameters("alpha",arguments),this.color(e)._getAlpha()},a.default.prototype.blue=function(e){return a.default._validateParameters("blue",arguments),this.color(e)._getBlue()},a.default.prototype.brightness=function(e){return a.default._validateParameters("brightness",arguments),this.color(e)._getBrightness()},a.default.prototype.color=function(){if(a.default._validateParameters("color",arguments),arguments[0]instanceof a.default.Color)return arguments[0];var e=arguments[0]instanceof Array?arguments[0]:arguments;return new a.default.Color(this,e)},a.default.prototype.green=function(e){return a.default._validateParameters("green",arguments),this.color(e)._getGreen()},a.default.prototype.hue=function(e){return a.default._validateParameters("hue",arguments),this.color(e)._getHue()},a.default.prototype.lerpColor=function(e,t,r){a.default._validateParameters("lerpColor",arguments);var i,o,s,l,u,h,d=this._colorMode,c=this._colorMaxes;if(d===n.RGB)u=e.levels.map((function(e){return e/255})),h=t.levels.map((function(e){return e/255}));else if(d===n.HSB)e._getBrightness(),t._getBrightness(),u=e.hsba,h=t.hsba;else{if(d!==n.HSL)throw new Error("".concat(d,"cannot be used for interpolation."));e._getLightness(),t._getLightness(),u=e.hsla,h=t.hsla}return r=Math.max(Math.min(r,1),0),void 0===this.lerp&&(this.lerp=function(e,t,r){return r*(t-e)+e}),i=this.lerp(u[0],h[0],r),o=this.lerp(u[1],h[1],r),s=this.lerp(u[2],h[2],r),l=this.lerp(u[3],h[3],r),i*=c[d][0],o*=c[d][1],s*=c[d][2],l*=c[d][3],this.color(i,o,s,l)},a.default.prototype.lightness=function(e){return a.default._validateParameters("lightness",arguments),this.color(e)._getLightness()},a.default.prototype.red=function(e){return a.default._validateParameters("red",arguments),this.color(e)._getRed()},a.default.prototype.saturation=function(e){return a.default._validateParameters("saturation",arguments),this.color(e)._getSaturation()};var o=a.default;r.default=o},{"../core/constants":20,"../core/error_helpers":22,"../core/main":26,"./p5.Color":18}],18:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(e("../core/main")),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants")),n=o(e("./color_conversion"));function o(e){return e&&e.__esModule?e:{default:e}}i.default.Color=function(e,t){if(this._storeModeAndMaxes(e._colorMode,e._colorMaxes),this.mode!==a.RGB&&this.mode!==a.HSL&&this.mode!==a.HSB)throw new Error("".concat(this.mode," is an invalid colorMode."));return this._array=i.default.Color._parseInputs.apply(this,t),this._calculateLevels(),this},i.default.Color.prototype.toString=function(e){var t=this.levels,r=this._array,i=r[3];switch(e){case"#rrggbb":return"#".concat(t[0]<16?"0".concat(t[0].toString(16)):t[0].toString(16),t[1]<16?"0".concat(t[1].toString(16)):t[1].toString(16),t[2]<16?"0".concat(t[2].toString(16)):t[2].toString(16));case"#rrggbbaa":return"#".concat(t[0]<16?"0".concat(t[0].toString(16)):t[0].toString(16),t[1]<16?"0".concat(t[1].toString(16)):t[1].toString(16),t[2]<16?"0".concat(t[2].toString(16)):t[2].toString(16),t[3]<16?"0".concat(t[2].toString(16)):t[3].toString(16));case"#rgb":return"#".concat(Math.round(15*r[0]).toString(16),Math.round(15*r[1]).toString(16),Math.round(15*r[2]).toString(16));case"#rgba":return"#".concat(Math.round(15*r[0]).toString(16),Math.round(15*r[1]).toString(16),Math.round(15*r[2]).toString(16),Math.round(15*r[3]).toString(16));case"rgb":return"rgb(".concat(t[0],", ",t[1],", ",t[2],")");case"rgb%":return"rgb(".concat((100*r[0]).toPrecision(3),"%, ",(100*r[1]).toPrecision(3),"%, ",(100*r[2]).toPrecision(3),"%)");case"rgba%":return"rgba(".concat((100*r[0]).toPrecision(3),"%, ",(100*r[1]).toPrecision(3),"%, ",(100*r[2]).toPrecision(3),"%, ",(100*r[3]).toPrecision(3),"%)");case"hsb":case"hsv":return this.hsba||(this.hsba=n.default._rgbaToHSBA(this._array)),"hsb(".concat(this.hsba[0]*this.maxes[a.HSB][0],", ",this.hsba[1]*this.maxes[a.HSB][1],", ",this.hsba[2]*this.maxes[a.HSB][2],")");case"hsb%":case"hsv%":return this.hsba||(this.hsba=n.default._rgbaToHSBA(this._array)),"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 this.hsba||(this.hsba=n.default._rgbaToHSBA(this._array)),"hsba(".concat(this.hsba[0]*this.maxes[a.HSB][0],", ",this.hsba[1]*this.maxes[a.HSB][1],", ",this.hsba[2]*this.maxes[a.HSB][2],", ",i,")");case"hsba%":case"hsva%":return this.hsba||(this.hsba=n.default._rgbaToHSBA(this._array)),"hsba(".concat((100*this.hsba[0]).toPrecision(3),"%, ",(100*this.hsba[1]).toPrecision(3),"%, ",(100*this.hsba[2]).toPrecision(3),"%, ",(100*i).toPrecision(3),"%)");case"hsl":return this.hsla||(this.hsla=n.default._rgbaToHSLA(this._array)),"hsl(".concat(this.hsla[0]*this.maxes[a.HSL][0],", ",this.hsla[1]*this.maxes[a.HSL][1],", ",this.hsla[2]*this.maxes[a.HSL][2],")");case"hsl%":return this.hsla||(this.hsla=n.default._rgbaToHSLA(this._array)),"hsl(".concat((100*this.hsla[0]).toPrecision(3),"%, ",(100*this.hsla[1]).toPrecision(3),"%, ",(100*this.hsla[2]).toPrecision(3),"%)");case"hsla":return this.hsla||(this.hsla=n.default._rgbaToHSLA(this._array)),"hsla(".concat(this.hsla[0]*this.maxes[a.HSL][0],", ",this.hsla[1]*this.maxes[a.HSL][1],", ",this.hsla[2]*this.maxes[a.HSL][2],", ",i,")");case"hsla%":return this.hsla||(this.hsla=n.default._rgbaToHSLA(this._array)),"hsl(".concat((100*this.hsla[0]).toPrecision(3),"%, ",(100*this.hsla[1]).toPrecision(3),"%, ",(100*this.hsla[2]).toPrecision(3),"%, ",(100*i).toPrecision(3),"%)");case"rgba":default:return"rgba(".concat(t[0],",",t[1],",",t[2],",",i,")")}},i.default.Color.prototype.setRed=function(e){this._array[0]=e/this.maxes[a.RGB][0],this._calculateLevels()},i.default.Color.prototype.setGreen=function(e){this._array[1]=e/this.maxes[a.RGB][1],this._calculateLevels()},i.default.Color.prototype.setBlue=function(e){this._array[2]=e/this.maxes[a.RGB][2],this._calculateLevels()},i.default.Color.prototype.setAlpha=function(e){this._array[3]=e/this.maxes[this.mode][3],this._calculateLevels()},i.default.Color.prototype._calculateLevels=function(){for(var e=this._array,t=this.levels=new Array(e.length),r=e.length-1;0<=r;--r)t[r]=Math.round(255*e[r])},i.default.Color.prototype._getAlpha=function(){return this._array[3]*this.maxes[this.mode][3]},i.default.Color.prototype._storeModeAndMaxes=function(e,t){this.mode=e,this.maxes=t},i.default.Color.prototype._getMode=function(){return this.mode},i.default.Color.prototype._getMaxes=function(){return this.maxes},i.default.Color.prototype._getBlue=function(){return this._array[2]*this.maxes[a.RGB][2]},i.default.Color.prototype._getBrightness=function(){return this.hsba||(this.hsba=n.default._rgbaToHSBA(this._array)),this.hsba[2]*this.maxes[a.HSB][2]},i.default.Color.prototype._getGreen=function(){return this._array[1]*this.maxes[a.RGB][1]},i.default.Color.prototype._getHue=function(){return this.mode===a.HSB?(this.hsba||(this.hsba=n.default._rgbaToHSBA(this._array)),this.hsba[0]*this.maxes[a.HSB][0]):(this.hsla||(this.hsla=n.default._rgbaToHSLA(this._array)),this.hsla[0]*this.maxes[a.HSL][0])},i.default.Color.prototype._getLightness=function(){return this.hsla||(this.hsla=n.default._rgbaToHSLA(this._array)),this.hsla[2]*this.maxes[a.HSL][2]},i.default.Color.prototype._getRed=function(){return this._array[0]*this.maxes[a.RGB][0]},i.default.Color.prototype._getSaturation=function(){return this.mode===a.HSB?(this.hsba||(this.hsba=n.default._rgbaToHSBA(this._array)),this.hsba[1]*this.maxes[a.HSB][1]):(this.hsla||(this.hsla=n.default._rgbaToHSLA(this._array)),this.hsla[1]*this.maxes[a.HSL][1])};var s={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",rebeccapurple:"#663399",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"},l=/\s*/,u=/(\d{1,3})/,h=/((?:\d+(?:\.\d+)?)|(?:\.\d+))/,d=new RegExp("".concat(h.source,"%")),c={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\\(",u.source,",",u.source,",",u.source,"\\)$"].join(l.source),"i"),RGB_PERCENT:new RegExp(["^rgb\\(",d.source,",",d.source,",",d.source,"\\)$"].join(l.source),"i"),RGBA:new RegExp(["^rgba\\(",u.source,",",u.source,",",u.source,",",h.source,"\\)$"].join(l.source),"i"),RGBA_PERCENT:new RegExp(["^rgba\\(",d.source,",",d.source,",",d.source,",",h.source,"\\)$"].join(l.source),"i"),HSL:new RegExp(["^hsl\\(",u.source,",",d.source,",",d.source,"\\)$"].join(l.source),"i"),HSLA:new RegExp(["^hsla\\(",u.source,",",d.source,",",d.source,",",h.source,"\\)$"].join(l.source),"i"),HSB:new RegExp(["^hsb\\(",u.source,",",d.source,",",d.source,"\\)$"].join(l.source),"i"),HSBA:new RegExp(["^hsba\\(",u.source,",",d.source,",",d.source,",",h.source,"\\)$"].join(l.source),"i")};i.default.Color._parseInputs=function(e,t,r,o){var l,u=arguments.length,h=this.mode,d=this.maxes[h],f=[];if(3<=u){for(f[0]=e/d[0],f[1]=t/d[1],f[2]=r/d[2],f[3]="number"==typeof o?o/d[3]:1,l=f.length-1;0<=l;--l){var p=f[l];p<0?f[l]=0:1<p&&(f[l]=1)}return h===a.HSL?n.default._hslaToRGBA(f):h===a.HSB?n.default._hsbaToRGBA(f):f}if(1===u&&"string"==typeof e){var m=e.trim().toLowerCase();if(s[m])return i.default.Color._parseInputs.call(this,s[m]);if(c.HEX3.test(m))return(f=c.HEX3.exec(m).slice(1).map((function(e){return parseInt(e+e,16)/255})))[3]=1,f;if(c.HEX6.test(m))return(f=c.HEX6.exec(m).slice(1).map((function(e){return parseInt(e,16)/255})))[3]=1,f;if(c.HEX4.test(m))return c.HEX4.exec(m).slice(1).map((function(e){return parseInt(e+e,16)/255}));if(c.HEX8.test(m))return c.HEX8.exec(m).slice(1).map((function(e){return parseInt(e,16)/255}));if(c.RGB.test(m))return(f=c.RGB.exec(m).slice(1).map((function(e){return e/255})))[3]=1,f;if(c.RGB_PERCENT.test(m))return(f=c.RGB_PERCENT.exec(m).slice(1).map((function(e){return parseFloat(e)/100})))[3]=1,f;if(c.RGBA.test(m))return c.RGBA.exec(m).slice(1).map((function(e,t){return 3===t?parseFloat(e):e/255}));if(c.RGBA_PERCENT.test(m))return c.RGBA_PERCENT.exec(m).slice(1).map((function(e,t){return 3===t?parseFloat(e):parseFloat(e)/100}));if(c.HSL.test(m)?(f=c.HSL.exec(m).slice(1).map((function(e,t){return 0===t?parseInt(e,10)/360:parseInt(e,10)/100})))[3]=1:c.HSLA.test(m)&&(f=c.HSLA.exec(m).slice(1).map((function(e,t){return 0===t?parseInt(e,10)/360:3===t?parseFloat(e):parseInt(e,10)/100}))),(f=f.map((function(e){return Math.max(Math.min(e,1),0)}))).length)return n.default._hslaToRGBA(f);if(c.HSB.test(m)?(f=c.HSB.exec(m).slice(1).map((function(e,t){return 0===t?parseInt(e,10)/360:parseInt(e,10)/100})))[3]=1:c.HSBA.test(m)&&(f=c.HSBA.exec(m).slice(1).map((function(e,t){return 0===t?parseInt(e,10)/360:3===t?parseFloat(e):parseInt(e,10)/100}))),f.length){for(l=f.length-1;0<=l;--l)f[l]=Math.max(Math.min(f[l],1),0);return n.default._hsbaToRGBA(f)}f=[1,1,1,1]}else{if(1!==u&&2!==u||"number"!=typeof e)throw new Error("".concat(arguments,"is not a valid color representation."));f[0]=e/d[2],f[1]=e/d[2],f[2]=e/d[2],f[3]="number"==typeof t?t/d[3]:1,f=f.map((function(e){return Math.max(Math.min(e,1),0)}))}return f};var f=i.default.Color;r.default=f},{"../core/constants":20,"../core/main":26,"./color_conversion":16}],19:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));e("./p5.Color"),a.default.prototype.background=function(){var e;return(e=this._renderer).background.apply(e,arguments),this},a.default.prototype.clear=function(){return this._renderer.clear(),this},a.default.prototype.colorMode=function(e,t,r,i,o){if(a.default._validateParameters("colorMode",arguments),e===n.RGB||e===n.HSB||e===n.HSL){this._colorMode=e;var s=this._colorMaxes[e];2===arguments.length?(s[0]=t,s[1]=t,s[2]=t,s[3]=t):4===arguments.length?(s[0]=t,s[1]=r,s[2]=i):5===arguments.length&&(s[0]=t,s[1]=r,s[2]=i,s[3]=o)}return this},a.default.prototype.fill=function(){var e;return this._renderer._setProperty("_fillSet",!0),this._renderer._setProperty("_doFill",!0),(e=this._renderer).fill.apply(e,arguments),this},a.default.prototype.noFill=function(){return this._renderer._setProperty("_doFill",!1),this},a.default.prototype.noStroke=function(){return this._renderer._setProperty("_doStroke",!1),this},a.default.prototype.stroke=function(){var e;return this._renderer._setProperty("_strokeSet",!0),this._renderer._setProperty("_doStroke",!0),(e=this._renderer).stroke.apply(e,arguments),this},a.default.prototype.erase=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:255,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:255;return this._renderer.erase(e,t),this},a.default.prototype.noErase=function(){return this._renderer.noErase(),this};var o=a.default;r.default=o},{"../core/constants":20,"../core/main":26,"./p5.Color":18}],20:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TEXTURE=r.FILL=r.STROKE=r.CURVE=r.BEZIER=r.QUADRATIC=r.LINEAR=r._CTX_MIDDLE=r._DEFAULT_LEADMULT=r._DEFAULT_TEXT_FILL=r.BOLDITALIC=r.BOLD=r.ITALIC=r.NORMAL=r.BLUR=r.ERODE=r.DILATE=r.POSTERIZE=r.INVERT=r.OPAQUE=r.GRAY=r.THRESHOLD=r.BURN=r.DODGE=r.SOFT_LIGHT=r.HARD_LIGHT=r.OVERLAY=r.REPLACE=r.SCREEN=r.MULTIPLY=r.EXCLUSION=r.SUBTRACT=r.DIFFERENCE=r.LIGHTEST=r.DARKEST=r.ADD=r.REMOVE=r.BLEND=r.UP_ARROW=r.TAB=r.SHIFT=r.RIGHT_ARROW=r.RETURN=r.OPTION=r.LEFT_ARROW=r.ESCAPE=r.ENTER=r.DOWN_ARROW=r.DELETE=r.CONTROL=r.BACKSPACE=r.ALT=r.AUTO=r.HSL=r.HSB=r.RGB=r.MITER=r.BEVEL=r.ROUND=r.SQUARE=r.PROJECT=r.PIE=r.CHORD=r.OPEN=r.CLOSE=r.QUAD_STRIP=r.QUADS=r.TRIANGLE_STRIP=r.TRIANGLE_FAN=r.TRIANGLES=r.LINE_LOOP=r.LINE_STRIP=r.LINES=r.POINTS=r.BASELINE=r.BOTTOM=r.TOP=r.CENTER=r.LEFT=r.RIGHT=r.RADIUS=r.CORNERS=r.CORNER=r.RAD_TO_DEG=r.DEG_TO_RAD=r.RADIANS=r.DEGREES=r.TWO_PI=r.TAU=r.QUARTER_PI=r.PI=r.HALF_PI=r.WAIT=r.TEXT=r.MOVE=r.HAND=r.CROSS=r.ARROW=r.WEBGL=r.P2D=void 0,r.AXES=r.GRID=r._DEFAULT_FILL=r._DEFAULT_STROKE=r.PORTRAIT=r.LANDSCAPE=r.MIRROR=r.CLAMP=r.REPEAT=r.NEAREST=r.IMAGE=r.IMMEDIATE=void 0;var i=Math.PI;r.P2D="p2d",r.WEBGL="webgl",r.ARROW="default",r.CROSS="crosshair",r.HAND="pointer",r.MOVE="move",r.TEXT="text",r.WAIT="wait";var a=i/2;r.HALF_PI=a;var n=i;r.PI=n;var o=i/4;r.QUARTER_PI=o;var s=2*i;r.TAU=s;var l=2*i;r.TWO_PI=l,r.DEGREES="degrees",r.RADIANS="radians";var u=i/180;r.DEG_TO_RAD=u;var h=180/i;r.RAD_TO_DEG=h,r.CORNER="corner",r.CORNERS="corners",r.RADIUS="radius",r.RIGHT="right",r.LEFT="left",r.CENTER="center",r.TOP="top",r.BOTTOM="bottom",r.BASELINE="alphabetic",r.POINTS=0,r.LINES=1,r.LINE_STRIP=3,r.LINE_LOOP=2,r.TRIANGLES=4,r.TRIANGLE_FAN=6,r.TRIANGLE_STRIP=5,r.QUADS="quads",r.QUAD_STRIP="quad_strip",r.CLOSE="close",r.OPEN="open",r.CHORD="chord",r.PIE="pie",r.PROJECT="square",r.SQUARE="butt",r.ROUND="round",r.BEVEL="bevel",r.MITER="miter",r.RGB="rgb",r.HSB="hsb",r.HSL="hsl",r.AUTO="auto",r.ALT=18,r.BACKSPACE=8,r.CONTROL=17,r.DELETE=46,r.DOWN_ARROW=40,r.ENTER=13,r.ESCAPE=27,r.LEFT_ARROW=37,r.OPTION=18,r.RETURN=13,r.RIGHT_ARROW=39,r.SHIFT=16,r.TAB=9,r.UP_ARROW=38,r.BLEND="source-over",r.REMOVE="destination-out",r.ADD="lighter",r.DARKEST="darken",r.LIGHTEST="lighten",r.DIFFERENCE="difference",r.SUBTRACT="subtract",r.EXCLUSION="exclusion",r.MULTIPLY="multiply",r.SCREEN="screen",r.REPLACE="copy",r.OVERLAY="overlay",r.HARD_LIGHT="hard-light",r.SOFT_LIGHT="soft-light",r.DODGE="color-dodge",r.BURN="color-burn",r.THRESHOLD="threshold",r.GRAY="gray",r.OPAQUE="opaque",r.INVERT="invert",r.POSTERIZE="posterize",r.DILATE="dilate",r.ERODE="erode",r.BLUR="blur",r.NORMAL="normal",r.ITALIC="italic",r.BOLD="bold",r.BOLDITALIC="bold italic",r._DEFAULT_TEXT_FILL="#000000",r._DEFAULT_LEADMULT=1.25,r._CTX_MIDDLE="middle",r.LINEAR="linear",r.QUADRATIC="quadratic",r.BEZIER="bezier",r.CURVE="curve",r.STROKE="stroke",r.FILL="fill",r.TEXTURE="texture",r.IMMEDIATE="immediate",r.IMAGE="image",r.NEAREST="nearest",r.REPEAT="repeat",r.CLAMP="clamp",r.MIRROR="mirror",r.LANDSCAPE="landscape",r.PORTRAIT="portrait",r._DEFAULT_STROKE="#000000",r._DEFAULT_FILL="#FFFFFF",r.GRID="grid",r.AXES="axes"},{}],21:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("./constants")),o=[n.ARROW,n.CROSS,n.HAND,n.MOVE,n.TEXT,n.WAIT];a.default.prototype._frameRate=0,a.default.prototype._lastFrameTime=window.performance.now(),a.default.prototype._targetFrameRate=60;var s=window.print;function l(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function u(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}a.default.prototype.print=function(){var e;arguments.length?(e=console).log.apply(e,arguments):s()},a.default.prototype.frameCount=0,a.default.prototype.deltaTime=0,a.default.prototype.focused=document.hasFocus(),a.default.prototype.cursor=function(e,t,r){var i="auto",a=this._curElement.elt;if(o.includes(e))i=e;else if("string"==typeof e){var n="";t&&r&&"number"==typeof t&&"number"==typeof r&&(n="".concat(t," ").concat(r)),i="http://"===e.substring(0,7)||"https://"===e.substring(0,8)?"url(".concat(e,") ").concat(n,", auto"):/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(e)?"url(".concat(e,") ").concat(n,", auto"):e}a.style.cursor=i},a.default.prototype.frameRate=function(e){return a.default._validateParameters("frameRate",arguments),"number"!=typeof e||e<0?this._frameRate:(this._setProperty("_targetFrameRate",e),0===e&&this._setProperty("_frameRate",e),this)},a.default.prototype.getFrameRate=function(){return this.frameRate()},a.default.prototype.setFrameRate=function(e){return this.frameRate(e)},a.default.prototype.noCursor=function(){this._curElement.elt.style.cursor="none"},a.default.prototype.displayWidth=screen.width,a.default.prototype.displayHeight=screen.height,a.default.prototype.windowWidth=l(),a.default.prototype.windowHeight=u(),a.default.prototype._onresize=function(e){this._setProperty("windowWidth",l()),this._setProperty("windowHeight",u());var t,r=this._isGlobal?window:this;"function"==typeof r.windowResized&&(void 0===(t=r.windowResized(e))||t||e.preventDefault())},a.default.prototype.width=0,a.default.prototype.height=0,a.default.prototype.fullscreen=function(e){if(a.default._validateParameters("fullscreen",arguments),void 0===e)return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;e?function(e){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))throw new Error("Fullscreen not enabled in this browser.");e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()}(document.documentElement):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()},a.default.prototype.pixelDensity=function(e){var t;return a.default._validateParameters("pixelDensity",arguments),"number"==typeof e?(e!==this._pixelDensity&&(this._pixelDensity=e),(t=this).resizeCanvas(this.width,this.height,!0)):t=this._pixelDensity,t},a.default.prototype.displayDensity=function(){return window.devicePixelRatio},a.default.prototype.getURL=function(){return location.href},a.default.prototype.getURLPath=function(){return location.pathname.split("/").filter((function(e){return""!==e}))},a.default.prototype.getURLParams=function(){for(var e,t=/[?&]([^&=]+)(?:[&=])([^&=]+)/gim,r={};null!=(e=t.exec(location.search));)e.index===t.lastIndex&&t.lastIndex++,r[e[1]]=e[2];return r};var h=a.default;r.default=h},{"./constants":20,"./main":26}],22:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i};!function(e){if(!e||!e.__esModule){var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}t.default=e}}(e("./constants")),a.default._validateParameters=a.default._friendlyFileLoadError=a.default._friendlyError=function(){};var n=null,o=function(t,r){var i,o;r||(r=console.log.bind(console)),n||(i={},(n=[].concat((o=function(e){return Object.getOwnPropertyNames(e).filter((function(e){return"_"!==e[0]&&!(e in i)&&(i[e]=!0)})).map((function(t){var r;return r="function"==typeof e[t]?"function":t===t.toUpperCase()?"constant":"variable",{name:t,type:r}}))})(a.default.prototype),o(e("./constants")))).sort((function(e,t){return t.name.length-e.name.length}))),n.some((function(e){if(t.message&&null!==t.message.match("\\W?".concat(e.name,"\\W")))return r("Did you just try to use p5.js's ".concat(e.name).concat("function"===e.type?"() ":" ").concat(e.type,"? If so, you may want to move it into your sketch's setup() function.\n\nFor more details, see: ").concat("https://github.com/processing/p5.js/wiki/p5.js-overview#why-cant-i-assign-variables-using-p5-functions-and-variables-before-setup")),!0}))};a.default.prototype._helpForMisusedAtTopLevelCode=o,"complete"!==document.readyState&&(window.addEventListener("error",o,!1),window.addEventListener("load",(function(){window.removeEventListener("error",o,!1)})));var s=a.default;r.default=s},{"../../docs/reference/data.json":void 0,"./constants":20,"./main":26}],23:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("./constants")),a={modeAdjust:function(e,t,r,a,n){return n===i.CORNER?{x:e,y:t,w:r,h:a}:n===i.CORNERS?{x:e,y:t,w:r-e,h:a-t}:n===i.RADIUS?{x:e-r,y:t-a,w:2*r,h:2*a}:n===i.CENTER?{x:e-.5*r,y:t-.5*a,w:r,h:a}:void 0}};r.default=a},{"./constants":20}],24:[function(e,t,r){"use strict";var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(){window.mocha||(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&!a.default.instance&&new a.default};"complete"===document.readyState?n():window.addEventListener("load",n,!1)},{"../core/main":26}],25:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i};a.default.prototype.pushStyle=function(){throw new Error("pushStyle() not used, see push()")},a.default.prototype.popStyle=function(){throw new Error("popStyle() not used, see pop()")},a.default.prototype.popMatrix=function(){throw new Error("popMatrix() not used, see pop()")},a.default.prototype.printMatrix=function(){throw new Error("printMatrix() is not implemented in p5.js, refer to [https://simonsarris.com/a-transformation-class-for-canvas-to-keep-track-of-the-transformation-matrix/] to add your own implementation.")},a.default.prototype.pushMatrix=function(){throw new Error("pushMatrix() not used, see push()")};var n=a.default;r.default=n},{"./main":26}],26:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,e("./shim");var i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("./constants"));function a(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var n=function(){function e(t,r,i){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._setupDone=!1,this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this._userNode=r,this._curElement=null,this._elements=[],this._glAttributes=null,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._lcg_random_state=null,this._gaussian_previous=!1,this._events.wheel=null,this._loadingScreenId="p5_loading",this._registeredMethods={};var n=Object.getOwnPropertyNames(e.prototype._registeredMethods),o=!0,s=!1,l=void 0;try{for(var u,h=n[Symbol.iterator]();!(o=(u=h.next()).done);o=!0){var d=u.value;this._registeredMethods[d]=e.prototype._registeredMethods[d].slice()}}catch(t){s=!0,l=t}finally{try{o||null==h.return||h.return()}finally{if(s)throw l}}window.DeviceOrientationEvent&&(this._events.deviceorientation=null),window.DeviceMotionEvent&&!window._isNodeWebkit&&(this._events.devicemotion=null),this._start=function(){a._userNode&&"string"==typeof a._userNode&&(a._userNode=document.getElementById(a._userNode));var t=(a._isGlobal?window:a).preload;if(t){var r=document.getElementById(a._loadingScreenId);r||((r=document.createElement("div")).innerHTML="Loading...",r.style.position="absolute",r.id=a._loadingScreenId,(a._userNode||document.body).appendChild(r));var i=a._preloadMethods;for(var n in i){i[n]=i[n]||e;var o=i[n];o!==e.prototype&&o!==e||(a._isGlobal&&(window[n]=a._wrapPreload(a,n)),o=a),a._registeredPreloadMethods[n]=o[n],o[n]=a._wrapPreload(o,n)}t(),a._runIfPreloadsAreDone()}else a._setup(),a._draw()},this._runIfPreloadsAreDone=function(){var e=this._isGlobal?window:this;if(0===e._preloadCount){var t=document.getElementById(e._loadingScreenId);t&&t.parentNode.removeChild(t),this._lastFrameTime=window.performance.now(),e._setup(),e._draw()}},this._decrementPreload=function(){var e=this._isGlobal?window:this;"function"==typeof e.preload&&(e._setProperty("_preloadCount",e._preloadCount-1),e._runIfPreloadsAreDone())},this._wrapPreload=function(e,t){var r=this;return function(){r._incrementPreload();for(var i=arguments.length,a=new Array(i),n=0;n<i;n++)a[n]=arguments[n];return r._registeredPreloadMethods[t].apply(e,a)}},this._incrementPreload=function(){var e=this._isGlobal?window:this;e._setProperty("_preloadCount",e._preloadCount+1)},this._setup=function(){a.createCanvas(a._defaultCanvasSize.width,a._defaultCanvasSize.height,"p2d");var e=a._isGlobal?window:a;if("function"==typeof e.preload)for(var t in a._preloadMethods)e[t]=a._preloadMethods[t][t],e[t]&&a&&(e[t]=e[t].bind(a));"function"==typeof e.setup&&e.setup();var r=document.getElementsByTagName("canvas"),i=!0,n=!1,o=void 0;try{for(var s,l=r[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=s.value;"true"===u.dataset.hidden&&(u.style.visibility="",delete u.dataset.hidden)}}catch(e){n=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw o}}a._lastFrameTime=window.performance.now(),a._setupDone=!0},this._draw=function(){var e=window.performance.now(),t=e-a._lastFrameTime,r=1e3/a._targetFrameRate;(!a._loop||r-5<=t)&&(a.redraw(),a._frameRate=1e3/(e-a._lastFrameTime),a.deltaTime=e-a._lastFrameTime,a._setProperty("deltaTime",a.deltaTime),a._lastFrameTime=e,void 0!==a._updateMouseCoords&&(a._updateMouseCoords(),a._setProperty("movedX",0),a._setProperty("movedY",0))),a._loop&&(a._requestAnimId=window.requestAnimationFrame(a._draw))},this._setProperty=function(e,t){a[e]=t,a._isGlobal&&(window[e]=t)},this.remove=function(){var t=document.getElementById(a._loadingScreenId);if(t&&(t.parentNode.removeChild(t),a._incrementPreload()),a._curElement){for(var r in a._loop=!1,a._requestAnimId&&window.cancelAnimationFrame(a._requestAnimId),a._events)window.removeEventListener(r,a._events[r]);var i=!0,n=!1,o=void 0;try{for(var s,l=a._elements[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=s.value;for(var h in u.elt&&u.elt.parentNode&&u.elt.parentNode.removeChild(u.elt),u._events)u.elt.removeEventListener(h,u._events[h])}}catch(t){n=!0,o=t}finally{try{i||null==l.return||l.return()}finally{if(n)throw o}}var d=a;a._registeredMethods.remove.forEach((function(e){void 0!==e&&e.call(d)}))}if(a._isGlobal){for(var c in e.prototype)try{delete window[c]}catch(t){window[c]=void 0}for(var f in a)if(a.hasOwnProperty(f))try{delete window[f]}catch(t){window[f]=void 0}e.instance=null}},this._registeredMethods.init.forEach((function(e){void 0!==e&&e.call(this)}),this),this._setupPromisePreloads();var c=this._createFriendlyGlobalFunctionBinder();if(t)t(this);else{for(var f in this._isGlobal=!0,e.instance=this,e.prototype)if("function"==typeof e.prototype[f]){var p=f.substring(2);this._events.hasOwnProperty(p)||(Math.hasOwnProperty(f)&&Math[f]===e.prototype[f]?c(f,e.prototype[f]):c(f,e.prototype[f].bind(this)))}else c(f,e.prototype[f]);for(var m in this)this.hasOwnProperty(m)&&c(m,this[m])}for(var v in this._events){var g=this["_on".concat(v)];if(g){var y=g.bind(this);window.addEventListener(v,y,{passive:!1}),this._events[v]=y}}var _=function(){a._setProperty("focused",!0)},b=function(){a._setProperty("focused",!1)};window.addEventListener("focus",_),window.addEventListener("blur",b),this.registerMethod("remove",(function(){window.removeEventListener("focus",_),window.removeEventListener("blur",b)})),"complete"===document.readyState?this._start():window.addEventListener("load",this._start.bind(this),!1)}var t,r;return t=e,(r=[{key:"_initializeInstanceVariables",value:function(){this._styles=[],this._bezierDetail=20,this._curveDetail=20,this._colorMode=i.RGB,this._colorMaxes={rgb:[255,255,255,255],hsb:[360,100,100,1],hsl:[360,100,100,1]},this._downKeys={}}},{key:"registerPreloadMethod",value:function(t,r){e.prototype._preloadMethods.hasOwnProperty(t)||(e.prototype._preloadMethods[t]=r)}},{key:"registerMethod",value:function(t,r){var i=this||e.prototype;i._registeredMethods.hasOwnProperty(t)||(i._registeredMethods[t]=[]),i._registeredMethods[t].push(r)}},{key:"_createFriendlyGlobalFunctionBinder",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.globalObject||window;return e.log||console.log.bind(console),function(e,r){t[e]=r}}}])&&a(t.prototype,r),e}();for(var o in n.instance=null,n.disableFriendlyErrors=!1,i)n.prototype[o]=i[o];n.prototype._preloadMethods={loadJSON:n.prototype,loadImage:n.prototype,loadStrings:n.prototype,loadXML:n.prototype,loadBytes:n.prototype,loadTable:n.prototype,loadFont:n.prototype,loadModel:n.prototype,loadShader:n.prototype},n.prototype._registeredMethods={init:[],pre:[],post:[],remove:[]},n.prototype._registeredPreloadMethods={};var s=n;r.default=s},{"./constants":20,"./shim":37}],27:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i};a.default.Element=function(e,t){this.elt=e,this._pInst=this._pixelsState=t,this._events={},this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight},a.default.Element.prototype.parent=function(e){return void 0===e?this.elt.parentNode:("string"==typeof e?("#"===e[0]&&(e=e.substring(1)),e=document.getElementById(e)):e instanceof a.default.Element&&(e=e.elt),e.appendChild(this.elt),this)},a.default.Element.prototype.id=function(e){return void 0===e?this.elt.id:(this.elt.id=e,this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,this)},a.default.Element.prototype.class=function(e){return void 0===e?this.elt.className:(this.elt.className=e,this)},a.default.Element.prototype.mousePressed=function(e){return a.default.Element._adjustListener("mousedown",(function(t){return this._pInst._setProperty("mouseIsPressed",!0),this._pInst._setMouseButton(t),e.call(this)}),this),this},a.default.Element.prototype.doubleClicked=function(e){return a.default.Element._adjustListener("dblclick",e,this),this},a.default.Element.prototype.mouseWheel=function(e){return a.default.Element._adjustListener("wheel",e,this),this},a.default.Element.prototype.mouseReleased=function(e){return a.default.Element._adjustListener("mouseup",e,this),this},a.default.Element.prototype.mouseClicked=function(e){return a.default.Element._adjustListener("click",e,this),this},a.default.Element.prototype.mouseMoved=function(e){return a.default.Element._adjustListener("mousemove",e,this),this},a.default.Element.prototype.mouseOver=function(e){return a.default.Element._adjustListener("mouseover",e,this),this},a.default.Element.prototype.mouseOut=function(e){return a.default.Element._adjustListener("mouseout",e,this),this},a.default.Element.prototype.touchStarted=function(e){return a.default.Element._adjustListener("touchstart",e,this),this},a.default.Element.prototype.touchMoved=function(e){return a.default.Element._adjustListener("touchmove",e,this),this},a.default.Element.prototype.touchEnded=function(e){return a.default.Element._adjustListener("touchend",e,this),this},a.default.Element.prototype.dragOver=function(e){return a.default.Element._adjustListener("dragover",e,this),this},a.default.Element.prototype.dragLeave=function(e){return a.default.Element._adjustListener("dragleave",e,this),this},a.default.Element._adjustListener=function(e,t,r){return!1===t?a.default.Element._detachListener(e,r):a.default.Element._attachListener(e,t,r),this},a.default.Element._attachListener=function(e,t,r){r._events[e]&&a.default.Element._detachListener(e,r);var i=t.bind(r);r.elt.addEventListener(e,i,!1),r._events[e]=i},a.default.Element._detachListener=function(e,t){var r=t._events[e];t.elt.removeEventListener(e,r,!1),t._events[e]=null},a.default.Element.prototype._setProperty=function(e,t){this[e]=t};var n=a.default.Element;r.default=n},{"./main":26}],28:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("./constants"));a.default.Graphics=function(e,t,r,i){var o=r||n.P2D;this.canvas=document.createElement("canvas");var s=i._userNode||document.body;for(var l in s.appendChild(this.canvas),a.default.Element.call(this,this.canvas,i),a.default.prototype)this[l]||("function"==typeof a.default.prototype[l]?this[l]=a.default.prototype[l].bind(this):this[l]=a.default.prototype[l]);return a.default.prototype._initializeInstanceVariables.apply(this),this.width=e,this.height=t,this._pixelDensity=i._pixelDensity,o===n.WEBGL?this._renderer=new a.default.RendererGL(this.canvas,this,!1):this._renderer=new a.default.Renderer2D(this.canvas,this,!1),i._elements.push(this),this._renderer.resize(e,t),this._renderer._applyDefaults(),this},a.default.Graphics.prototype=Object.create(a.default.Element.prototype),a.default.Graphics.prototype.reset=function(){this._renderer.resetMatrix(),this._renderer.isP3D&&this._renderer._update()},a.default.Graphics.prototype.remove=function(){this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt);var e=this._pInst._elements.indexOf(this);for(var t in-1!==e&&this._pInst._elements.splice(e,1),this._events)this.elt.removeEventListener(t,this._events[t])};var o=a.default.Graphics;r.default=o},{"./constants":20,"./main":26}],29:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e){var t=0,r=0;if(e.offsetParent)for(;t+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;);else t+=e.offsetLeft,r+=e.offsetTop;return[t,r]}a.default.Renderer=function(e,t,r){a.default.Element.call(this,e,t),this.canvas=e,this._pixelsState=t,r?(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=n.NORMAL,this._textAscent=null,this._textDescent=null,this._textAlign=n.LEFT,this._textBaseline=n.BASELINE,this._rectMode=n.CORNER,this._ellipseMode=n.CENTER,this._curveTightness=0,this._imageMode=n.CORNER,this._tint=null,this._doStroke=!0,this._doFill=!0,this._strokeSet=!1,this._fillSet=!1},a.default.Renderer.prototype=Object.create(a.default.Element.prototype),a.default.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}}},a.default.Renderer.prototype.pop=function(e){e.properties&&Object.assign(this,e.properties)},a.default.Renderer.prototype.resize=function(e,t){this.width=e,this.height=t,this.elt.width=e*this._pInst._pixelDensity,this.elt.height=t*this._pInst._pixelDensity,this.elt.style.width="".concat(e,"px"),this.elt.style.height="".concat(t,"px"),this._isMainCanvas&&(this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height))},a.default.Renderer.prototype.get=function(e,t,r,i){var n=this._pixelsState,o=n._pixelDensity,s=this.canvas;if(void 0===e&&void 0===t)e=t=0,r=n.width,i=n.height;else if(e*=o,t*=o,void 0===r&&void 0===i)return e<0||t<0||e>=s.width||t>=s.height?[0,0,0,0]:this._getPixel(e,t);var l=new a.default.Image(r,i);return l.canvas.getContext("2d").drawImage(s,e,t,r*o,i*o,0,0,r,i),l},a.default.Renderer.prototype.textLeading=function(e){return"number"==typeof e?(this._setProperty("_textLeading",e),this._pInst):this._textLeading},a.default.Renderer.prototype.textSize=function(e){return"number"==typeof e?(this._setProperty("_textSize",e),this._setProperty("_textLeading",e*n._DEFAULT_LEADMULT),this._applyTextProperties()):this._textSize},a.default.Renderer.prototype.textStyle=function(e){return e?(e!==n.NORMAL&&e!==n.ITALIC&&e!==n.BOLD&&e!==n.BOLDITALIC||this._setProperty("_textStyle",e),this._applyTextProperties()):this._textStyle},a.default.Renderer.prototype.textAscent=function(){return null===this._textAscent&&this._updateTextMetrics(),this._textAscent},a.default.Renderer.prototype.textDescent=function(){return null===this._textDescent&&this._updateTextMetrics(),this._textDescent},a.default.Renderer.prototype.textAlign=function(e,t){return void 0!==e?(this._setProperty("_textAlign",e),void 0!==t&&this._setProperty("_textBaseline",t),this._applyTextProperties()):{horizontal:this._textAlign,vertical:this._textBaseline}},a.default.Renderer.prototype.text=function(e,t,r,i,a){var o,s,l,u,h,d,c,f,p=this._pInst,m=Number.MAX_VALUE;if((this._doFill||this._doStroke)&&void 0!==e){if("string"!=typeof e&&(e=e.toString()),o=(e=e.replace(/(\t)/g,"  ")).split("\n"),void 0!==i){for(l=f=0;l<o.length;l++)for(h="",c=o[l].split(" "),s=0;s<c.length;s++)d="".concat(h+c[s]," "),i<this.textWidth(d)?(h="".concat(c[s]," "),f+=p.textLeading()):h=d;switch(this._rectMode===n.CENTER&&(t-=i/2,r-=a/2),this._textAlign){case n.CENTER:t+=i/2;break;case n.RIGHT:t+=i}var v=!1;if(void 0!==a){switch(this._textBaseline){case n.BOTTOM:r+=a-f;break;case n.CENTER:r+=(a-f)/2;break;case n.BASELINE:v=!0,this._textBaseline=n.TOP}m=r+a-p.textAscent()}for(l=0;l<o.length;l++){for(h="",c=o[l].split(" "),s=0;s<c.length;s++)d="".concat(h+c[s]," "),i<this.textWidth(d)&&0<h.length?(this._renderText(p,h,t,r,m),h="".concat(c[s]," "),r+=p.textLeading()):h=d;this._renderText(p,h,t,r,m),r+=p.textLeading(),v&&(this._textBaseline=n.BASELINE)}}else{var g=0,y=p.textAlign().vertical;for(y===n.CENTER?g=(o.length-1)*p.textLeading()/2:y===n.BOTTOM&&(g=(o.length-1)*p.textLeading()),u=0;u<o.length;u++)this._renderText(p,o[u],t,r-g,m),r+=p.textLeading()}return p}},a.default.Renderer.prototype._applyDefaults=function(){return this},a.default.Renderer.prototype._isOpenType=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._textFont;return"object"===o(e)&&e.font&&e.font.supported},a.default.Renderer.prototype._updateTextMetrics=function(){if(this._isOpenType())return this._setProperty("_textAscent",this._textFont._textAscent()),this._setProperty("_textDescent",this._textFont._textDescent()),this;var e=document.createElement("span");e.style.fontFamily=this._textFont,e.style.fontSize="".concat(this._textSize,"px"),e.innerHTML="ABCjgq|";var t=document.createElement("div");t.style.display="inline-block",t.style.width="1px",t.style.height="0px";var r=document.createElement("div");r.appendChild(e),r.appendChild(t),r.style.height="0px",r.style.overflow="hidden",document.body.appendChild(r),t.style.verticalAlign="baseline";var i=s(t),a=s(e),n=i[1]-a[1];t.style.verticalAlign="bottom",i=s(t),a=s(e);var o=i[1]-a[1]-n;return document.body.removeChild(r),this._setProperty("_textAscent",n),this._setProperty("_textDescent",o),this};var l=a.default.Renderer;r.default=l},{"../core/constants":20,"./main":26}],30:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(e("./main")),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("./constants")),n=o(e("../image/filters"));function o(e){return e&&e.__esModule?e:{default:e}}e("./p5.Renderer");var s="rgba(0,0,0,0)";i.default.Renderer2D=function(e,t,r){return i.default.Renderer.call(this,e,t,r),this.drawingContext=this.canvas.getContext("2d"),this._pInst._setProperty("drawingContext",this.drawingContext),this},i.default.Renderer2D.prototype=Object.create(i.default.Renderer.prototype),i.default.Renderer2D.prototype._applyDefaults=function(){this._cachedFillStyle=this._cachedStrokeStyle=void 0,this._cachedBlendMode=a.BLEND,this._setFill(a._DEFAULT_FILL),this._setStroke(a._DEFAULT_STROKE),this.drawingContext.lineCap=a.ROUND,this.drawingContext.font="normal 12px sans-serif"},i.default.Renderer2D.prototype.resize=function(e,t){i.default.Renderer.prototype.resize.call(this,e,t),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity)},i.default.Renderer2D.prototype.background=function(){if(this.drawingContext.save(),this.resetMatrix(),(arguments.length<=0?void 0:arguments[0])instanceof i.default.Image)this._pInst.image(arguments.length<=0?void 0:arguments[0],0,0,this.width,this.height);else{var e,t=this._getFill(),r=(e=this._pInst).color.apply(e,arguments).toString();this._setFill(r),this._isErasing&&this.blendMode(this._cachedBlendMode),this.drawingContext.fillRect(0,0,this.width,this.height),this._setFill(t),this._isErasing&&this._pInst.erase()}this.drawingContext.restore()},i.default.Renderer2D.prototype.clear=function(){this.drawingContext.save(),this.resetMatrix(),this.drawingContext.clearRect(0,0,this.width,this.height),this.drawingContext.restore()},i.default.Renderer2D.prototype.fill=function(){var e,t=(e=this._pInst).color.apply(e,arguments);this._setFill(t.toString())},i.default.Renderer2D.prototype.stroke=function(){var e,t=(e=this._pInst).color.apply(e,arguments);this._setStroke(t.toString())},i.default.Renderer2D.prototype.erase=function(e,t){if(!this._isErasing){this._cachedFillStyle=this.drawingContext.fillStyle;var r=this._pInst.color(255,e).toString();this.drawingContext.fillStyle=r,this._cachedStrokeStyle=this.drawingContext.strokeStyle;var i=this._pInst.color(255,t).toString();this.drawingContext.strokeStyle=i;var n=this._cachedBlendMode;this.blendMode(a.REMOVE),this._cachedBlendMode=n,this._isErasing=!0}},i.default.Renderer2D.prototype.noErase=function(){this._isErasing&&(this.drawingContext.fillStyle=this._cachedFillStyle,this.drawingContext.strokeStyle=this._cachedStrokeStyle,this.blendMode(this._cachedBlendMode),this._isErasing=!1)},i.default.Renderer2D.prototype.image=function(e,t,r,a,n,o,s,l,u){var h;e.gifProperties&&e._animateGif(this._pInst);try{this._tint&&(i.default.MediaElement&&e instanceof i.default.MediaElement&&e.loadPixels(),e.canvas&&(h=this._getTintedImageCanvas(e))),h||(h=e.canvas||e.elt);var d=1;e.width&&0<e.width&&(d=h.width/e.width),this._isErasing&&this.blendMode(this._cachedBlendMode),this.drawingContext.drawImage(h,d*t,d*r,d*a,d*n,o,s,l,u),this._isErasing&&this._pInst.erase()}catch(e){if("NS_ERROR_NOT_AVAILABLE"!==e.name)throw e}},i.default.Renderer2D.prototype._getTintedImageCanvas=function(e){if(!e.canvas)return e;var t=n.default._toPixels(e.canvas),r=document.createElement("canvas");r.width=e.canvas.width,r.height=e.canvas.height;for(var i=r.getContext("2d"),a=i.createImageData(e.canvas.width,e.canvas.height),o=a.data,s=0;s<t.length;s+=4){var l=t[s],u=t[s+1],h=t[s+2],d=t[s+3];o[s]=l*this._tint[0]/255,o[s+1]=u*this._tint[1]/255,o[s+2]=h*this._tint[2]/255,o[s+3]=d*this._tint[3]/255}return i.putImageData(a,0,0),r},i.default.Renderer2D.prototype.blendMode=function(e){if(e===a.SUBTRACT)console.warn("blendMode(SUBTRACT) only works in WEBGL mode.");else{if(e!==a.BLEND&&e!==a.REMOVE&&e!==a.DARKEST&&e!==a.LIGHTEST&&e!==a.DIFFERENCE&&e!==a.MULTIPLY&&e!==a.EXCLUSION&&e!==a.SCREEN&&e!==a.REPLACE&&e!==a.OVERLAY&&e!==a.HARD_LIGHT&&e!==a.SOFT_LIGHT&&e!==a.DODGE&&e!==a.BURN&&e!==a.ADD)throw new Error("Mode ".concat(e," not recognized."));this._cachedBlendMode=e,this.drawingContext.globalCompositeOperation=e}},i.default.Renderer2D.prototype.blend=function(){for(var e=this.drawingContext.globalCompositeOperation,t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];var n=r[r.length-1],o=Array.prototype.slice.call(r,0,r.length-1);this.drawingContext.globalCompositeOperation=n,i.default.prototype.copy.apply(this,o),this.drawingContext.globalCompositeOperation=e},i.default.Renderer2D.prototype._getPixel=function(e,t){var r;return[(r=this.drawingContext.getImageData(e,t,1,1).data)[0],r[1],r[2],r[3]]},i.default.Renderer2D.prototype.loadPixels=function(){var e=this._pixelsState,t=e._pixelDensity,r=this.width*t,i=this.height*t,a=this.drawingContext.getImageData(0,0,r,i);e._setProperty("imageData",a),e._setProperty("pixels",a.data)},i.default.Renderer2D.prototype.set=function(e,t,r){e=Math.floor(e),t=Math.floor(t);var a=this._pixelsState;if(r instanceof i.default.Image)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(a._pixelDensity,a._pixelDensity),this.drawingContext.drawImage(r.canvas,e,t),this.drawingContext.restore();else{var n=0,o=0,s=0,l=0,u=4*(t*a._pixelDensity*(this.width*a._pixelDensity)+e*a._pixelDensity);if(a.imageData||a.loadPixels.call(a),"number"==typeof r)u<a.pixels.length&&(s=o=n=r,l=255);else if(r instanceof Array){if(r.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");u<a.pixels.length&&(n=r[0],o=r[1],s=r[2],l=r[3])}else r instanceof i.default.Color&&u<a.pixels.length&&(n=r.levels[0],o=r.levels[1],s=r.levels[2],l=r.levels[3]);for(var h=0;h<a._pixelDensity;h++)for(var d=0;d<a._pixelDensity;d++)u=4*((t*a._pixelDensity+d)*this.width*a._pixelDensity+(e*a._pixelDensity+h)),a.pixels[u]=n,a.pixels[u+1]=o,a.pixels[u+2]=s,a.pixels[u+3]=l}},i.default.Renderer2D.prototype.updatePixels=function(e,t,r,i){var a=this._pixelsState,n=a._pixelDensity;void 0===e&&void 0===t&&void 0===r&&void 0===i&&(t=e=0,r=this.width,i=this.height),e*=n,t*=n,r*=n,i*=n,this.gifProperties&&(this.gifProperties.frames[this.gifProperties.displayIndex]=a.imageData),this.drawingContext.putImageData(a.imageData,e,t,0,0,r,i)},i.default.Renderer2D.prototype._acuteArcToBezier=function(e,t){var r=t/2,i=Math.cos(r),a=Math.sin(r),n=1/Math.tan(r),o=e+r,s=Math.cos(o),l=Math.sin(o),u=(4-i)/3,h=a+(i-u)*n;return{ax:Math.cos(e).toFixed(7),ay:Math.sin(e).toFixed(7),bx:(u*s+h*l).toFixed(7),by:(u*l-h*s).toFixed(7),cx:(u*s-h*l).toFixed(7),cy:(u*l+h*s).toFixed(7),dx:Math.cos(e+t).toFixed(7),dy:Math.sin(e+t).toFixed(7)}},i.default.Renderer2D.prototype.arc=function(e,t,r,i,n,o,s){var l=this.drawingContext,u=r/2,h=i/2,d=0,c=[];for(e+=u,t+=h;1e-5<=o-n;)d=Math.min(o-n,a.HALF_PI),c.push(this._acuteArcToBezier(n,d)),n+=d;return this._doFill&&(l.beginPath(),c.forEach((function(r,i){0===i&&l.moveTo(e+r.ax*u,t+r.ay*h),l.bezierCurveTo(e+r.bx*u,t+r.by*h,e+r.cx*u,t+r.cy*h,e+r.dx*u,t+r.dy*h)})),s!==a.PIE&&null!=s||l.lineTo(e,t),l.closePath(),l.fill()),this._doStroke&&(l.beginPath(),c.forEach((function(r,i){0===i&&l.moveTo(e+r.ax*u,t+r.ay*h),l.bezierCurveTo(e+r.bx*u,t+r.by*h,e+r.cx*u,t+r.cy*h,e+r.dx*u,t+r.dy*h)})),s===a.PIE?(l.lineTo(e,t),l.closePath()):s===a.CHORD&&l.closePath(),l.stroke()),this},i.default.Renderer2D.prototype.ellipse=function(e){var t=this.drawingContext,r=this._doFill,i=this._doStroke,a=parseFloat(e[0]),n=parseFloat(e[1]),o=parseFloat(e[2]),l=parseFloat(e[3]);if(r&&!i){if(this._getFill()===s)return this}else if(!r&&i&&this._getStroke()===s)return this;var u=o/2*.5522847498,h=l/2*.5522847498,d=a+o,c=n+l,f=a+o/2,p=n+l/2;t.beginPath(),t.moveTo(a,p),t.bezierCurveTo(a,p-h,f-u,n,f,n),t.bezierCurveTo(f+u,n,d,p-h,d,p),t.bezierCurveTo(d,p+h,f+u,c,f,c),t.bezierCurveTo(f-u,c,a,p+h,a,p),t.closePath(),r&&t.fill(),i&&t.stroke()},i.default.Renderer2D.prototype.line=function(e,t,r,i){var a=this.drawingContext;return this._doStroke&&(this._getStroke()===s||(a.beginPath(),a.moveTo(e,t),a.lineTo(r,i),a.stroke())),this},i.default.Renderer2D.prototype.point=function(e,t){var r=this.drawingContext;if(!this._doStroke)return this;if(this._getStroke()===s)return this;var i=this._getStroke(),n=this._getFill();e=Math.round(e),t=Math.round(t),this._setFill(i),1<r.lineWidth?(r.beginPath(),r.arc(e,t,r.lineWidth/2,0,a.TWO_PI,!1),r.fill()):r.fillRect(e,t,1,1),this._setFill(n)},i.default.Renderer2D.prototype.quad=function(e,t,r,i,a,n,o,l){var u=this.drawingContext,h=this._doFill,d=this._doStroke;if(h&&!d){if(this._getFill()===s)return this}else if(!h&&d&&this._getStroke()===s)return this;return u.beginPath(),u.moveTo(e,t),u.lineTo(r,i),u.lineTo(a,n),u.lineTo(o,l),u.closePath(),h&&u.fill(),d&&u.stroke(),this},i.default.Renderer2D.prototype.rect=function(e){var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],o=e[5],l=e[6],u=e[7],h=this.drawingContext,d=this._doFill,c=this._doStroke;if(d&&!c){if(this._getFill()===s)return this}else if(!d&&c&&this._getStroke()===s)return this;if(h.beginPath(),void 0===n)h.rect(t,r,i,a);else{void 0===o&&(o=n),void 0===l&&(l=o),void 0===u&&(u=l);var f=Math.abs(i),p=Math.abs(a),m=f/2,v=p/2;f<2*n&&(n=m),p<2*n&&(n=v),f<2*o&&(o=m),p<2*o&&(o=v),f<2*l&&(l=m),p<2*l&&(l=v),f<2*u&&(u=m),p<2*u&&(u=v),h.beginPath(),h.moveTo(t+n,r),h.arcTo(t+i,r,t+i,r+a,o),h.arcTo(t+i,r+a,t,r+a,l),h.arcTo(t,r+a,t,r,u),h.arcTo(t,r,t+i,r,n),h.closePath()}return this._doFill&&h.fill(),this._doStroke&&h.stroke(),this},i.default.Renderer2D.prototype.triangle=function(e){var t=this.drawingContext,r=this._doFill,i=this._doStroke,a=e[0],n=e[1],o=e[2],l=e[3],u=e[4],h=e[5];if(r&&!i){if(this._getFill()===s)return this}else if(!r&&i&&this._getStroke()===s)return this;t.beginPath(),t.moveTo(a,n),t.lineTo(o,l),t.lineTo(u,h),t.closePath(),r&&t.fill(),i&&t.stroke()},i.default.Renderer2D.prototype.endShape=function(e,t,r,i,n,o,s){if(0===t.length)return this;if(!this._doStroke&&!this._doFill)return this;var l,u,h,d=e===a.CLOSE;d&&!o&&t.push(t[0]);var c=t.length;if(!r||s!==a.POLYGON&&null!==s)if(!i||s!==a.POLYGON&&null!==s)if(!n||s!==a.POLYGON&&null!==s)if(s===a.POINTS)for(u=0;u<c;u++)l=t[u],this._doStroke&&this._pInst.stroke(l[6]),this._pInst.point(l[0],l[1]);else if(s===a.LINES)for(u=0;u+1<c;u+=2)l=t[u],this._doStroke&&this._pInst.stroke(t[u+1][6]),this._pInst.line(l[0],l[1],t[u+1][0],t[u+1][1]);else if(s===a.TRIANGLES)for(u=0;u+2<c;u+=3)l=t[u],this.drawingContext.beginPath(),this.drawingContext.moveTo(l[0],l[1]),this.drawingContext.lineTo(t[u+1][0],t[u+1][1]),this.drawingContext.lineTo(t[u+2][0],t[u+2][1]),this.drawingContext.closePath(),this._doFill&&(this._pInst.fill(t[u+2][5]),this.drawingContext.fill()),this._doStroke&&(this._pInst.stroke(t[u+2][6]),this.drawingContext.stroke());else if(s===a.TRIANGLE_STRIP)for(u=0;u+1<c;u++)l=t[u],this.drawingContext.beginPath(),this.drawingContext.moveTo(t[u+1][0],t[u+1][1]),this.drawingContext.lineTo(l[0],l[1]),this._doStroke&&this._pInst.stroke(t[u+1][6]),this._doFill&&this._pInst.fill(t[u+1][5]),u+2<c&&(this.drawingContext.lineTo(t[u+2][0],t[u+2][1]),this._doStroke&&this._pInst.stroke(t[u+2][6]),this._doFill&&this._pInst.fill(t[u+2][5])),this._doFillStrokeClose(d);else if(s===a.TRIANGLE_FAN){if(2<c){for(this.drawingContext.beginPath(),u=2;u<c;u++)l=t[u],this.drawingContext.moveTo(t[0][0],t[0][1]),this.drawingContext.lineTo(t[u-1][0],t[u-1][1]),this.drawingContext.lineTo(l[0],l[1]),this.drawingContext.lineTo(t[0][0],t[0][1]),u<c-1&&(this._doFill&&l[5]!==t[u+1][5]||this._doStroke&&l[6]!==t[u+1][6])&&(this._doFill&&(this._pInst.fill(l[5]),this.drawingContext.fill(),this._pInst.fill(t[u+1][5])),this._doStroke&&(this._pInst.stroke(l[6]),this.drawingContext.stroke(),this._pInst.stroke(t[u+1][6])),this.drawingContext.closePath(),this.drawingContext.beginPath());this._doFillStrokeClose(d)}}else if(s===a.QUADS)for(u=0;u+3<c;u+=4){for(l=t[u],this.drawingContext.beginPath(),this.drawingContext.moveTo(l[0],l[1]),h=1;h<4;h++)this.drawingContext.lineTo(t[u+h][0],t[u+h][1]);this.drawingContext.lineTo(l[0],l[1]),this._doFill&&this._pInst.fill(t[u+3][5]),this._doStroke&&this._pInst.stroke(t[u+3][6]),this._doFillStrokeClose(d)}else if(s===a.QUAD_STRIP){if(3<c)for(u=0;u+1<c;u+=2)l=t[u],this.drawingContext.beginPath(),u+3<c?(this.drawingContext.moveTo(t[u+2][0],t[u+2][1]),this.drawingContext.lineTo(l[0],l[1]),this.drawingContext.lineTo(t[u+1][0],t[u+1][1]),this.drawingContext.lineTo(t[u+3][0],t[u+3][1]),this._doFill&&this._pInst.fill(t[u+3][5]),this._doStroke&&this._pInst.stroke(t[u+3][6])):(this.drawingContext.moveTo(l[0],l[1]),this.drawingContext.lineTo(t[u+1][0],t[u+1][1])),this._doFillStrokeClose(d)}else{for(this.drawingContext.beginPath(),this.drawingContext.moveTo(t[0][0],t[0][1]),u=1;u<c;u++)(l=t[u]).isVert&&(l.moveTo?this.drawingContext.moveTo(l[0],l[1]):this.drawingContext.lineTo(l[0],l[1]));this._doFillStrokeClose(d)}else{for(this.drawingContext.beginPath(),u=0;u<c;u++)t[u].isVert?t[u].moveTo?this.drawingContext.moveTo(t[u][0],t[u][1]):this.drawingContext.lineTo(t[u][0],t[u][1]):this.drawingContext.quadraticCurveTo(t[u][0],t[u][1],t[u][2],t[u][3]);this._doFillStrokeClose(d)}else{for(this.drawingContext.beginPath(),u=0;u<c;u++)t[u].isVert?t[u].moveTo?this.drawingContext.moveTo(t[u][0],t[u][1]):this.drawingContext.lineTo(t[u][0],t[u][1]):this.drawingContext.bezierCurveTo(t[u][0],t[u][1],t[u][2],t[u][3],t[u][4],t[u][5]);this._doFillStrokeClose(d)}else if(3<c){var f=[],p=1-this._curveTightness;for(this.drawingContext.beginPath(),this.drawingContext.moveTo(t[1][0],t[1][1]),u=1;u+2<c;u++)l=t[u],f[0]=[l[0],l[1]],f[1]=[l[0]+(p*t[u+1][0]-p*t[u-1][0])/6,l[1]+(p*t[u+1][1]-p*t[u-1][1])/6],f[2]=[t[u+1][0]+(p*t[u][0]-p*t[u+2][0])/6,t[u+1][1]+(p*t[u][1]-p*t[u+2][1])/6],f[3]=[t[u+1][0],t[u+1][1]],this.drawingContext.bezierCurveTo(f[1][0],f[1][1],f[2][0],f[2][1],f[3][0],f[3][1]);d&&this.drawingContext.lineTo(t[u+1][0],t[u+1][1]),this._doFillStrokeClose(d)}return o=n=i=r=!1,d&&t.pop(),this},i.default.Renderer2D.prototype.strokeCap=function(e){return e!==a.ROUND&&e!==a.SQUARE&&e!==a.PROJECT||(this.drawingContext.lineCap=e),this},i.default.Renderer2D.prototype.strokeJoin=function(e){return e!==a.ROUND&&e!==a.BEVEL&&e!==a.MITER||(this.drawingContext.lineJoin=e),this},i.default.Renderer2D.prototype.strokeWeight=function(e){return this.drawingContext.lineWidth=void 0===e||0===e?1e-4:e,this},i.default.Renderer2D.prototype._getFill=function(){return this._cachedFillStyle||(this._cachedFillStyle=this.drawingContext.fillStyle),this._cachedFillStyle},i.default.Renderer2D.prototype._setFill=function(e){e!==this._cachedFillStyle&&(this.drawingContext.fillStyle=e,this._cachedFillStyle=e)},i.default.Renderer2D.prototype._getStroke=function(){return this._cachedStrokeStyle||(this._cachedStrokeStyle=this.drawingContext.strokeStyle),this._cachedStrokeStyle},i.default.Renderer2D.prototype._setStroke=function(e){e!==this._cachedStrokeStyle&&(this.drawingContext.strokeStyle=e,this._cachedStrokeStyle=e)},i.default.Renderer2D.prototype.bezier=function(e,t,r,i,a,n,o,s){return this._pInst.beginShape(),this._pInst.vertex(e,t),this._pInst.bezierVertex(r,i,a,n,o,s),this._pInst.endShape(),this},i.default.Renderer2D.prototype.curve=function(e,t,r,i,a,n,o,s){return this._pInst.beginShape(),this._pInst.curveVertex(e,t),this._pInst.curveVertex(r,i),this._pInst.curveVertex(a,n),this._pInst.curveVertex(o,s),this._pInst.endShape(),this},i.default.Renderer2D.prototype._doFillStrokeClose=function(e){e&&this.drawingContext.closePath(),this._doFill&&this.drawingContext.fill(),this._doStroke&&this.drawingContext.stroke()},i.default.Renderer2D.prototype.applyMatrix=function(e,t,r,i,a,n){this.drawingContext.transform(e,t,r,i,a,n)},i.default.Renderer2D.prototype.resetMatrix=function(){return this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),this},i.default.Renderer2D.prototype.rotate=function(e){this.drawingContext.rotate(e)},i.default.Renderer2D.prototype.scale=function(e,t){return this.drawingContext.scale(e,t),this},i.default.Renderer2D.prototype.translate=function(e,t){return e instanceof i.default.Vector&&(t=e.y,e=e.x),this.drawingContext.translate(e,t),this},i.default.Renderer2D.prototype.text=function(e,t,r,n,o){var s;void 0!==n&&this.drawingContext.textBaseline===a.BASELINE&&(s=!0,this.drawingContext.textBaseline=a.TOP);var l=i.default.Renderer.prototype.text.apply(this,arguments);return s&&(this.drawingContext.textBaseline=a.BASELINE),l},i.default.Renderer2D.prototype._renderText=function(e,t,r,i,n){if(!(n<=i))return e.push(),this._isOpenType()?this._textFont._renderPath(t,r,i,{renderer:this}):(this._doStroke&&this._strokeSet&&this.drawingContext.strokeText(t,r,i),this._doFill&&(this._fillSet||this._setFill(a._DEFAULT_TEXT_FILL),this.drawingContext.fillText(t,r,i))),e.pop(),e},i.default.Renderer2D.prototype.textWidth=function(e){return this._isOpenType()?this._textFont._textWidth(e,this._textSize):this.drawingContext.measureText(e).width},i.default.Renderer2D.prototype._applyTextProperties=function(){var e,t=this._pInst;return this._setProperty("_textAscent",null),this._setProperty("_textDescent",null),e=this._textFont,this._isOpenType()&&(e=this._textFont.font.familyName,this._setProperty("_textStyle",this._textFont.font.styleName)),this.drawingContext.font="".concat(this._textStyle||"normal"," ").concat(this._textSize||12,"px ").concat(e||"sans-serif"),this.drawingContext.textAlign=this._textAlign,this._textBaseline===a.CENTER?this.drawingContext.textBaseline=a._CTX_MIDDLE:this.drawingContext.textBaseline=this._textBaseline,t},i.default.Renderer2D.prototype.push=function(){return this.drawingContext.save(),i.default.Renderer.prototype.push.apply(this)},i.default.Renderer2D.prototype.pop=function(e){this.drawingContext.restore(),this._cachedFillStyle=this.drawingContext.fillStyle,this._cachedStrokeStyle=this.drawingContext.strokeStyle,i.default.Renderer.prototype.pop.call(this,e)};var l=i.default.Renderer2D;r.default=l},{"../image/filters":47,"./constants":20,"./main":26,"./p5.Renderer":29}],31:[function(e,t,r){"use strict";var i,a=(i=e("./main"))&&i.__esModule?i:{default:i};a.default.prototype._promisePreloads=[];var n=!(a.default.prototype.registerPromisePreload=function(e){a.default.prototype._promisePreloads.push(e)});a.default.prototype._setupPromisePreloads=function(){var e=!0,t=!1,r=void 0;try{for(var i,o=this._promisePreloads[Symbol.iterator]();!(e=(i=o.next()).done);e=!0){var s=i.value,l=this,u=s.method,h=s.addCallbacks,d=s.legacyPreloadSetup,c=s.target||this,f=c[u].bind(c);if(c===a.default.prototype){if(n)continue;l=null,f=c[u]}c[u]=this._wrapPromisePreload(l,f,h),d&&(c[d.method]=this._legacyPreloadGenerator(l,d,c[u]))}}catch(e){t=!0,r=e}finally{try{e||null==o.return||o.return()}finally{if(t)throw r}}n=!0},a.default.prototype._wrapPromisePreload=function(e,t,r){var i=function(){var e=this;this._incrementPreload();for(var i=null,a=null,n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];if(r)for(var l=o.length-1;0<=l&&!a&&"function"==typeof o[l];l--)a=i,i=o.pop();var u=Promise.resolve(t.apply(this,o));return i&&u.then(i),a&&u.catch(a),u.then((function(){return e._decrementPreload()})),u};return e&&(i=i.bind(e)),i};var o=function(){return{}};a.default.prototype._legacyPreloadGenerator=function(e,t,r){var i=t.createBaseObject||o,a=function(){var e=this;this._incrementPreload();var t=i.apply(this,arguments);return r.apply(this,arguments).then((function(r){Object.assign(t,r),e._decrementPreload()})),t};return e&&(a=a.bind(e)),a}},{"./main":26}],32:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("./constants"));function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}e("./p5.Graphics"),e("./p5.Renderer2D"),e("../webgl/p5.RendererGL");var s="defaultCanvas0";a.default.prototype.createCanvas=function(e,t,r){a.default._validateParameters("createCanvas",arguments);var i,o=r||n.P2D;if(o===n.WEBGL){if(i=document.getElementById(s)){i.parentNode.removeChild(i);var l=this._renderer;this._elements=this._elements.filter((function(e){return e!==l}))}(i=document.createElement("canvas")).id=s,i.classList.add("p5Canvas")}else if(this._defaultGraphicsCreated)i=this.canvas;else{i=document.createElement("canvas");for(var u=0;document.getElementById("defaultCanvas".concat(u));)u++;s="defaultCanvas".concat(u),i.id=s,i.classList.add("p5Canvas")}return this._setupDone||(i.dataset.hidden=!0,i.style.visibility="hidden"),this._userNode?this._userNode.appendChild(i):document.body.appendChild(i),o===n.WEBGL?(this._setProperty("_renderer",new a.default.RendererGL(i,this,!0)),this._elements.push(this._renderer)):this._defaultGraphicsCreated||(this._setProperty("_renderer",new a.default.Renderer2D(i,this,!0)),this._defaultGraphicsCreated=!0,this._elements.push(this._renderer)),this._renderer.resize(e,t),this._renderer._applyDefaults(),this._renderer},a.default.prototype.resizeCanvas=function(e,t,r){if(a.default._validateParameters("resizeCanvas",arguments),this._renderer){var i={};for(var n in this.drawingContext){var s=this.drawingContext[n];"object"!==o(s)&&"function"!=typeof s&&(i[n]=s)}for(var l in this._renderer.resize(e,t),this.width=e,this.height=t,i)try{this.drawingContext[l]=i[l]}catch(e){}r||this.redraw()}},a.default.prototype.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},a.default.prototype.createGraphics=function(e,t,r){return a.default._validateParameters("createGraphics",arguments),new a.default.Graphics(e,t,r,this)},a.default.prototype.blendMode=function(e){a.default._validateParameters("blendMode",arguments),e===n.NORMAL&&(console.warn("NORMAL has been deprecated for use in blendMode. defaulting to BLEND instead."),e=n.BLEND),this._renderer.blendMode(e)};var l=a.default;r.default=l},{"../webgl/p5.RendererGL":79,"./constants":20,"./main":26,"./p5.Graphics":28,"./p5.Renderer2D":30}],33:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(e("../main")),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../constants")),n=o(e("../helpers"));function o(e){return e&&e.__esModule?e:{default:e}}function s(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}e("../error_helpers"),i.default.prototype._normalizeArcAngles=function(e,t,r,i,n){var o;return e-=a.TWO_PI*Math.floor(e/a.TWO_PI),t-=a.TWO_PI*Math.floor(t/a.TWO_PI),o=Math.min(Math.abs(e-t),a.TWO_PI-Math.abs(e-t)),n&&(e=e<=a.HALF_PI?Math.atan(r/i*Math.tan(e)):e>a.HALF_PI&&e<=3*a.HALF_PI?Math.atan(r/i*Math.tan(e))+a.PI:Math.atan(r/i*Math.tan(e))+a.TWO_PI,t=t<=a.HALF_PI?Math.atan(r/i*Math.tan(t)):t>a.HALF_PI&&t<=3*a.HALF_PI?Math.atan(r/i*Math.tan(t))+a.PI:Math.atan(r/i*Math.tan(t))+a.TWO_PI),t<e&&(t+=a.TWO_PI),{start:e,stop:t,correspondToSamePoint:o<1e-5}},i.default.prototype.arc=function(e,t,r,a,o,s,l,u){if(i.default._validateParameters("arc",arguments),!this._renderer._doStroke&&!this._renderer._doFill)return this;o=this._toRadians(o),s=this._toRadians(s),r=Math.abs(r),a=Math.abs(a);var h=n.default.modeAdjust(e,t,r,a,this._renderer._ellipseMode),d=this._normalizeArcAngles(o,s,h.w,h.h,!0);return d.correspondToSamePoint?this._renderer.ellipse([h.x,h.y,h.w,h.h,u]):this._renderer.arc(h.x,h.y,h.w,h.h,d.start,d.stop,l,u),this},i.default.prototype.ellipse=function(e,t,r,a,o){if(i.default._validateParameters("ellipse",arguments),!this._renderer._doStroke&&!this._renderer._doFill)return this;r<0&&(r=Math.abs(r)),void 0===a?a=r:a<0&&(a=Math.abs(a));var s=n.default.modeAdjust(e,t,r,a,this._renderer._ellipseMode);return this._renderer.ellipse([s.x,s.y,s.w,s.h,o]),this},i.default.prototype.circle=function(){var e=Array.prototype.slice.call(arguments,0,2);return e.push(arguments[2]),e.push(arguments[2]),this.ellipse.apply(this,s(e))},i.default.prototype.line=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a;return i.default._validateParameters("line",t),this._renderer._doStroke&&(a=this._renderer).line.apply(a,t),this},i.default.prototype.point=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a;return i.default._validateParameters("point",t),this._renderer._doStroke&&(1===t.length&&t[0]instanceof i.default.Vector?this._renderer.point.call(this._renderer,t[0].x,t[0].y,t[0].z):(a=this._renderer).point.apply(a,t)),this},i.default.prototype.quad=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a;return i.default._validateParameters("quad",t),(this._renderer._doStroke||this._renderer._doFill)&&(this._renderer.isP3D&&12!==t.length?this._renderer.quad.call(this._renderer,t[0],t[1],0,t[2],t[3],0,t[4],t[5],0,t[6],t[7],0):(a=this._renderer).quad.apply(a,t)),this},i.default.prototype.rect=function(){if(i.default._validateParameters("rect",arguments),this._renderer._doStroke||this._renderer._doFill){for(var e=n.default.modeAdjust(arguments[0],arguments[1],arguments[2],arguments[3],this._renderer._rectMode),t=[e.x,e.y,e.w,e.h],r=4;r<arguments.length;r++)t[r]=arguments[r];this._renderer.rect(t)}return this},i.default.prototype.square=function(e,t,r,i,a,n,o){return this.rect(e,t,r,r,i,a,n,o)},i.default.prototype.triangle=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.default._validateParameters("triangle",t),(this._renderer._doStroke||this._renderer._doFill)&&this._renderer.triangle(t),this};var l=i.default;r.default=l},{"../constants":20,"../error_helpers":22,"../helpers":23,"../main":26}],34:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../constants"));a.default.prototype.ellipseMode=function(e){return a.default._validateParameters("ellipseMode",arguments),e!==n.CORNER&&e!==n.CORNERS&&e!==n.RADIUS&&e!==n.CENTER||(this._renderer._ellipseMode=e),this},a.default.prototype.noSmooth=function(){return this.setAttributes("antialias",!1),this._renderer.isP3D||"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!1),this},a.default.prototype.rectMode=function(e){return a.default._validateParameters("rectMode",arguments),e!==n.CORNER&&e!==n.CORNERS&&e!==n.RADIUS&&e!==n.CENTER||(this._renderer._rectMode=e),this},a.default.prototype.smooth=function(){return this.setAttributes("antialias",!0),this._renderer.isP3D||"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!0),this},a.default.prototype.strokeCap=function(e){return a.default._validateParameters("strokeCap",arguments),e!==n.ROUND&&e!==n.SQUARE&&e!==n.PROJECT||this._renderer.strokeCap(e),this},a.default.prototype.strokeJoin=function(e){return a.default._validateParameters("strokeJoin",arguments),e!==n.ROUND&&e!==n.BEVEL&&e!==n.MITER||this._renderer.strokeJoin(e),this},a.default.prototype.strokeWeight=function(e){return a.default._validateParameters("strokeWeight",arguments),this._renderer.strokeWeight(e),this};var o=a.default;r.default=o},{"../constants":20,"../main":26}],35:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../main"))&&i.__esModule?i:{default:i};e("../error_helpers"),a.default.prototype.bezier=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return a.default._validateParameters("bezier",r),(this._renderer._doStroke||this._renderer._doFill)&&(e=this._renderer).bezier.apply(e,r),this},a.default.prototype.bezierDetail=function(e){return a.default._validateParameters("bezierDetail",arguments),this._bezierDetail=e,this},a.default.prototype.bezierPoint=function(e,t,r,i,n){a.default._validateParameters("bezierPoint",arguments);var o=1-n;return Math.pow(o,3)*e+3*Math.pow(o,2)*n*t+3*o*Math.pow(n,2)*r+Math.pow(n,3)*i},a.default.prototype.bezierTangent=function(e,t,r,i,n){a.default._validateParameters("bezierTangent",arguments);var o=1-n;return 3*i*Math.pow(n,2)-3*r*Math.pow(n,2)+6*r*o*n-6*t*o*n+3*t*Math.pow(o,2)-3*e*Math.pow(o,2)},a.default.prototype.curve=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i;return a.default._validateParameters("curve",t),this._renderer._doStroke&&(i=this._renderer).curve.apply(i,t),this},a.default.prototype.curveDetail=function(e){return a.default._validateParameters("curveDetail",arguments),this._curveDetail=e<3?3:e,this},a.default.prototype.curveTightness=function(e){return a.default._validateParameters("curveTightness",arguments),this._renderer._curveTightness=e,this},a.default.prototype.curvePoint=function(e,t,r,i,n){a.default._validateParameters("curvePoint",arguments);var o=n*n*n,s=n*n;return e*(-.5*o+s-.5*n)+t*(1.5*o-2.5*s+1)+r*(-1.5*o+2*s+.5*n)+i*(.5*o-.5*s)},a.default.prototype.curveTangent=function(e,t,r,i,n){a.default._validateParameters("curveTangent",arguments);var o=n*n;return e*(-3*o/2+2*n-.5)+t*(9*o/2-5*n)+r*(-9*o/2+4*n+.5)+i*(3*o/2-n)};var n=a.default;r.default=n},{"../error_helpers":22,"../main":26}],36:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../constants")),o=null,s=[],l=[],u=!1,h=!1,d=!1,c=!1,f=!0;a.default.prototype.beginContour=function(){return l=[],c=!0,this},a.default.prototype.beginShape=function(e){var t;return a.default._validateParameters("beginShape",arguments),this._renderer.isP3D?(t=this._renderer).beginShape.apply(t,arguments):(o=e===n.POINTS||e===n.LINES||e===n.TRIANGLES||e===n.TRIANGLE_FAN||e===n.TRIANGLE_STRIP||e===n.QUADS||e===n.QUAD_STRIP?e:null,s=[],l=[]),this},a.default.prototype.bezierVertex=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i;if(a.default._validateParameters("bezierVertex",t),this._renderer.isP3D)(i=this._renderer).bezierVertex.apply(i,t);else if(0===s.length)a.default._friendlyError("vertex() must be used once before calling bezierVertex()","bezierVertex");else{u=!0;for(var n=[],o=0;o<t.length;o++)n[o]=t[o];n.isVert=!1,c?l.push(n):s.push(n)}return this},a.default.prototype.curveVertex=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i;return a.default._validateParameters("curveVertex",t),this._renderer.isP3D?(i=this._renderer).curveVertex.apply(i,t):(h=!0,this.vertex(t[0],t[1])),this},a.default.prototype.endContour=function(){var e=l[0].slice();e.isVert=l[0].isVert,e.moveTo=!1,l.push(e),f&&(s.push(s[0]),f=!1);for(var t=0;t<l.length;t++)s.push(l[t]);return this},a.default.prototype.endShape=function(e){if(a.default._validateParameters("endShape",arguments),this._renderer.isP3D)this._renderer.endShape(e,h,u,d,c,o);else{if(0===s.length)return this;if(!this._renderer._doStroke&&!this._renderer._doFill)return this;var t=e===n.CLOSE;t&&!c&&s.push(s[0]),this._renderer.endShape(e,s,h,u,d,c,o),f=!(c=d=u=h=!1),t&&s.pop()}return this},a.default.prototype.quadraticVertex=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(a.default._validateParameters("quadraticVertex",t),this._renderer.isP3D){var i;(i=this._renderer).quadraticVertex.apply(i,t)}else{if(this._contourInited){var o={};return o.x=t[0],o.y=t[1],o.x3=t[2],o.y3=t[3],o.type=n.QUADRATIC,this._contourVertices.push(o),this}if(0<s.length){d=!0;for(var u=[],h=0;h<t.length;h++)u[h]=t[h];u.isVert=!1,c?l.push(u):s.push(u)}else a.default._friendlyError("vertex() must be used once before calling quadraticVertex()","quadraticVertex")}return this},a.default.prototype.vertex=function(e,t,r,i,a){if(this._renderer.isP3D){var n;(n=this._renderer).vertex.apply(n,arguments)}else{var o=[];o.isVert=!0,o[0]=e,o[1]=t,o[2]=0,o[3]=0,o[4]=0,o[5]=this._renderer._getFill(),o[6]=this._renderer._getStroke(),r&&(o.moveTo=r),c?(0===l.length&&(o.moveTo=!0),l.push(o)):s.push(o)}return this};var p=a.default;r.default=p},{"../constants":20,"../main":26}],37:[function(e,t,r){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)},"undefined"==typeof Uint8ClampedArray||Uint8ClampedArray.prototype.slice||Object.defineProperty(Uint8ClampedArray.prototype,"slice",{value:Array.prototype.slice,writable:!0,configurable:!0,enumerable:!1}),function(){if(!Object.assign){var e=Object.keys,t=Object.defineProperty,r="function"==typeof Symbol&&"symbol"===i(Symbol()),a=Object.prototype.propertyIsEnumerable,n=function(e){return function(t){return a.call(e,t)}};t(Object,"assign",{value:function(t,i){if(null==t)throw new TypeError("target must be an object");var a,o,s,l,u=Object(t);for(a=1;a<arguments.length;++a)for(o=Object(arguments[a]),l=e(o),r&&Object.getOwnPropertySymbols&&l.push.apply(l,Object.getOwnPropertySymbols(o).filter(n(o))),s=0;s<l.length;++s)u[l[s]]=o[l[s]];return u},configurable:!0,enumerable:!1,writable:!0})}}()},{}],38:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i};a.default.prototype.noLoop=function(){this._loop=!1},a.default.prototype.loop=function(){this._loop||(this._loop=!0,this._setupDone&&this._draw())},a.default.prototype.push=function(){this._styles.push({props:{_colorMode:this._colorMode},renderer:this._renderer.push()})},a.default.prototype.pop=function(){var e=this._styles.pop();e?(this._renderer.pop(e.renderer),Object.assign(this,e.props)):console.warn("pop() was called without matching push()")},a.default.prototype.redraw=function(e){if(!this._inUserDraw&&this._setupDone){var t=parseInt(e);(isNaN(t)||t<1)&&(t=1);var r=this._isGlobal?window:this,i=r.setup,a=r.draw;if("function"==typeof a){void 0===i&&r.scale(r._pixelDensity,r._pixelDensity);for(var n=function(e){e.call(r)},o=0;o<t;o++){r.resetMatrix(),r._renderer.isP3D&&r._renderer._update(),r._setProperty("frameCount",r.frameCount+1),r._registeredMethods.pre.forEach(n),this._inUserDraw=!0;try{a()}finally{this._inUserDraw=!1}r._registeredMethods.post.forEach(n)}}}};var n=a.default;r.default=n},{"./main":26}],39:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("./main"))&&i.__esModule?i:{default:i};a.default.prototype.applyMatrix=function(e,t,r,i,a,n){var o;return(o=this._renderer).applyMatrix.apply(o,arguments),this},a.default.prototype.resetMatrix=function(){return this._renderer.resetMatrix(),this},a.default.prototype.rotate=function(e,t){return a.default._validateParameters("rotate",arguments),this._renderer.rotate(this._toRadians(e),t),this},a.default.prototype.rotateX=function(e){return this._assert3d("rotateX"),a.default._validateParameters("rotateX",arguments),this._renderer.rotateX(this._toRadians(e)),this},a.default.prototype.rotateY=function(e){return this._assert3d("rotateY"),a.default._validateParameters("rotateY",arguments),this._renderer.rotateY(this._toRadians(e)),this},a.default.prototype.rotateZ=function(e){return this._assert3d("rotateZ"),a.default._validateParameters("rotateZ",arguments),this._renderer.rotateZ(this._toRadians(e)),this},a.default.prototype.scale=function(e,t,r){if(a.default._validateParameters("scale",arguments),e instanceof a.default.Vector){var i=e;e=i.x,t=i.y,r=i.z}else if(e instanceof Array){var n=e;e=n[0],t=n[1],r=n[2]||1}return isNaN(t)?t=r=e:isNaN(r)&&(r=1),this._renderer.scale.call(this._renderer,e,t,r),this},a.default.prototype.shearX=function(e){a.default._validateParameters("shearX",arguments);var t=this._toRadians(e);return this._renderer.applyMatrix(1,0,Math.tan(t),1,0,0),this},a.default.prototype.shearY=function(e){a.default._validateParameters("shearY",arguments);var t=this._toRadians(e);return this._renderer.applyMatrix(1,Math.tan(t),0,1,0,0),this},a.default.prototype.translate=function(e,t,r){return a.default._validateParameters("translate",arguments),this._renderer.isP3D?this._renderer.translate(e,t,r):this._renderer.translate(e,t),this};var n=a.default;r.default=n},{"./main":26}],40:[function(e,t,r){"use strict";var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};function n(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}a.default.prototype.storeItem=function(e,t){void 0===t&&console.log("You cannot store undefined variables using storeItem()");var r=o(t);switch(r){case"number":case"boolean":t=t.toString();break;case"object":t instanceof a.default.Color?r="p5.Color":t instanceof a.default.Vector&&(r="p5.Vector",t=[t.x,t.y,t.z]),t=JSON.stringify(t)}localStorage.setItem(e,t);var i="".concat(e,"p5TypeID");localStorage.setItem(i,r)},a.default.prototype.getItem=function(e){var t=localStorage.getItem(e),r=localStorage.getItem("".concat(e,"p5TypeID"));if(void 0===r)console.log("Unable to determine type of item stored under ".concat(e,"in local storage. Did you save the item with something other than setItem()?"));else if(null!==t)switch(r){case"number":t=parseInt(t);break;case"boolean":t="true"===t;break;case"object":t=JSON.parse(t);break;case"p5.Color":t=JSON.parse(t),t=this.color.apply(this,n(t.levels));break;case"p5.Vector":t=JSON.parse(t),t=this.createVector.apply(this,n(t))}return t},a.default.prototype.clearStorage=function(){localStorage.clear()},a.default.prototype.removeItem=function(e){"string"!=typeof e&&console.log("The argument that you passed to removeItem() - ".concat(e," is not a string.")),localStorage.removeItem(e),localStorage.removeItem("".concat(e,"p5TypeID"))}},{"../core/main":26}],41:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.createStringDict=function(e,t){return a.default._validateParameters("createStringDict",arguments),new a.default.StringDict(e,t)},a.default.prototype.createNumberDict=function(e,t){return a.default._validateParameters("createNumberDict",arguments),new a.default.NumberDict(e,t)},a.default.TypedDict=function(e,t){return e instanceof Object?this.data=e:(this.data={},this.data[e]=t),this},a.default.TypedDict.prototype.size=function(){return Object.keys(this.data).length},a.default.TypedDict.prototype.hasKey=function(e){return this.data.hasOwnProperty(e)},a.default.TypedDict.prototype.get=function(e){if(this.data.hasOwnProperty(e))return this.data[e];console.log("".concat(e," does not exist in this Dictionary"))},a.default.TypedDict.prototype.set=function(e,t){this._validate(t)?this.data[e]=t:console.log("Those values dont work for this dictionary type.")},a.default.TypedDict.prototype._addObj=function(e){for(var t in e)this.set(t,e[t])},a.default.TypedDict.prototype.create=function(e,t){e instanceof Object&&void 0===t?this._addObj(e):void 0!==e?this.set(e,t):console.log("In order to create a new Dictionary entry you must pass an object or a key, value pair")},a.default.TypedDict.prototype.clear=function(){this.data={}},a.default.TypedDict.prototype.remove=function(e){if(!this.data.hasOwnProperty(e))throw new Error("".concat(e," does not exist in this Dictionary"));delete this.data[e]},a.default.TypedDict.prototype.print=function(){for(var e in this.data)console.log("key:".concat(e," value:").concat(this.data[e]))},a.default.TypedDict.prototype.saveTable=function(e){var t="";for(var r in this.data)t+="".concat(r,",").concat(this.data[r],"\n");var i=new Blob([t],{type:"text/csv"});a.default.prototype.downloadFile(i,e||"mycsv","csv")},a.default.TypedDict.prototype.saveJSON=function(e,t){a.default.prototype.saveJSON(this.data,e,t)},a.default.TypedDict.prototype._validate=function(e){return!0},a.default.StringDict=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.default.TypedDict.apply(this,t)},a.default.StringDict.prototype=Object.create(a.default.TypedDict.prototype),a.default.StringDict.prototype._validate=function(e){return"string"==typeof e},a.default.NumberDict=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.default.TypedDict.apply(this,t)},a.default.NumberDict.prototype=Object.create(a.default.TypedDict.prototype),a.default.NumberDict.prototype._validate=function(e){return"number"==typeof e},a.default.NumberDict.prototype.add=function(e,t){this.data.hasOwnProperty(e)?this.data[e]+=t:console.log("The key - ".concat(e," does not exist in this dictionary."))},a.default.NumberDict.prototype.sub=function(e,t){this.add(e,-t)},a.default.NumberDict.prototype.mult=function(e,t){this.data.hasOwnProperty(e)?this.data[e]*=t:console.log("The key - ".concat(e," does not exist in this dictionary."))},a.default.NumberDict.prototype.div=function(e,t){this.data.hasOwnProperty(e)?this.data[e]/=t:console.log("The key - ".concat(e," does not exist in this dictionary."))},a.default.NumberDict.prototype._valueTest=function(e){if(0===Object.keys(this.data).length)throw new Error("Unable to search for a minimum or maximum value on an empty NumberDict");if(1===Object.keys(this.data).length)return this.data[Object.keys(this.data)[0]];var t=this.data[Object.keys(this.data)[0]];for(var r in this.data)this.data[r]*e<t*e&&(t=this.data[r]);return t},a.default.NumberDict.prototype.minValue=function(){return this._valueTest(1)},a.default.NumberDict.prototype.maxValue=function(){return this._valueTest(-1)},a.default.NumberDict.prototype._keyTest=function(e){if(0===Object.keys(this.data).length)throw new Error("Unable to use minValue on an empty NumberDict");if(1===Object.keys(this.data).length)return Object.keys(this.data)[0];for(var t=Object.keys(this.data)[0],r=1;r<Object.keys(this.data).length;r++)Object.keys(this.data)[r]*e<t*e&&(t=Object.keys(this.data)[r]);return t},a.default.NumberDict.prototype.minKey=function(){return this._keyTest(1)},a.default.NumberDict.prototype.maxKey=function(){return this._keyTest(-1)};var n=a.default.TypedDict;r.default=n},{"../core/main":26}],42:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){var t=document;return"string"==typeof e&&"#"===e[0]?(e=e.slice(1),t=document.getElementById(e)||document):e instanceof a.default.Element?t=e.elt:e instanceof HTMLElement&&(t=e),t}function s(e,t,r){(t._userNode?t._userNode:document.body).appendChild(e);var i=r?new a.default.MediaElement(e,t):new a.default.Element(e,t);return t._elements.push(i),i}function l(e,t,r,i){var a=document.createElement(t);"string"==typeof(r=r||"")&&(r=[r]);for(var n=0;n<r.length;n++){var o=document.createElement("source");o.src=r[n],a.appendChild(o)}void 0!==i&&a.addEventListener("canplaythrough",(function e(){i(),a.removeEventListener("canplaythrough",e)}));var l=s(a,e,!0);return l.loadedmetadata=!1,a.addEventListener("loadedmetadata",(function(){l.width=a.videoWidth,l.height=a.videoHeight,0===l.elt.width&&(l.elt.width=a.videoWidth),0===l.elt.height&&(l.elt.height=a.videoHeight),l.presetPlaybackRate&&(l.elt.playbackRate=l.presetPlaybackRate,delete l.presetPlaybackRate),l.loadedmetadata=!0})),l}a.default.prototype.select=function(e,t){a.default._validateParameters("select",arguments);var r=null,i=o(t);return(r="."===e[0]?(e=e.slice(1),(r=i.getElementsByClassName(e)).length?r[0]:null):"#"===e[0]?(e=e.slice(1),i.getElementById(e)):(r=i.getElementsByTagName(e)).length?r[0]:null)?this._wrapElement(r):null},a.default.prototype.selectAll=function(e,t){a.default._validateParameters("selectAll",arguments);var r,i=[],n=o(t);if(r="."===e[0]?(e=e.slice(1),n.getElementsByClassName(e)):n.getElementsByTagName(e))for(var s=0;s<r.length;s++){var l=this._wrapElement(r[s]);i.push(l)}return i},a.default.prototype._wrapElement=function(e){var t=Array.prototype.slice.call(e.children);if("INPUT"!==e.tagName||"checkbox"!==e.type)return"VIDEO"===e.tagName||"AUDIO"===e.tagName?new a.default.MediaElement(e,this):"SELECT"===e.tagName?this.createSelect(new a.default.Element(e,this)):0<t.length&&t.every((function(e){return"INPUT"===e.tagName||"LABEL"===e.tagName}))?this.createRadio(new a.default.Element(e,this)):new a.default.Element(e,this);var r=new a.default.Element(e,this);return r.checked=function(){return 0===arguments.length?this.elt.checked:(arguments[0]?this.elt.checked=!0:this.elt.checked=!1,this)},r},a.default.prototype.removeElements=function(e){a.default._validateParameters("removeElements",arguments);for(var t=0;t<this._elements.length;t++)this._elements[t].elt instanceof HTMLCanvasElement||this._elements[t].remove()},a.default.Element.prototype.changed=function(e){return a.default.Element._adjustListener("change",e,this),this},a.default.Element.prototype.input=function(e){return a.default.Element._adjustListener("input",e,this),this},["div","p","span"].forEach((function(e){var t="create"+e.charAt(0).toUpperCase()+e.slice(1);a.default.prototype[t]=function(t){var r=document.createElement(e);return r.innerHTML=void 0===t?"":t,s(r,this)}})),a.default.prototype.createImg=function(){a.default._validateParameters("createImg",arguments);var e,t=document.createElement("img"),r=arguments;return t.alt=r[1],2<r.length&&"string"==typeof r[2]&&(t.crossOrigin=r[2]),t.addEventListener("load",(function(){e.width=t.offsetWidth||t.width,e.height=t.offsetHeight||t.height;var i=r[r.length-1];"function"==typeof i&&i()})),t.src=r[0],e=s(t,this)},a.default.prototype.createA=function(e,t,r){a.default._validateParameters("createA",arguments);var i=document.createElement("a");return i.href=e,i.innerHTML=t,r&&(i.target=r),s(i,this)},a.default.prototype.createSlider=function(e,t,r,i){a.default._validateParameters("createSlider",arguments);var n=document.createElement("input");return n.type="range",n.min=e,n.max=t,0===i?n.step=1e-18:i&&(n.step=i),"number"==typeof r&&(n.value=r),s(n,this)},a.default.prototype.createButton=function(e,t){a.default._validateParameters("createButton",arguments);var r=document.createElement("button");return r.innerHTML=e,t&&(r.value=t),s(r,this)},a.default.prototype.createCheckbox=function(){a.default._validateParameters("createCheckbox",arguments);var e=document.createElement("div"),t=document.createElement("input");t.type="checkbox",e.appendChild(t);var r=s(e,this);if(r.checked=function(){var e=r.elt.getElementsByTagName("input")[0];if(e){if(0===arguments.length)return e.checked;arguments[0]?e.checked=!0:e.checked=!1}return r},this.value=function(e){return r.value=e,this},arguments[0]){var i=Math.random().toString(36).slice(2),n=document.createElement("label");t.setAttribute("id",i),n.htmlFor=i,r.value(arguments[0]),n.appendChild(document.createTextNode(arguments[0])),e.appendChild(n)}return arguments[1]&&(t.checked=!0),r},a.default.prototype.createSelect=function(){var e,t;a.default._validateParameters("createSelect",arguments);var r=arguments[0];return"object"===n(r)&&"SELECT"===r.elt.nodeName?(t=r,e=this.elt=r.elt):(e=document.createElement("select"),r&&"boolean"==typeof r&&e.setAttribute("multiple","true"),t=s(e,this)),t.option=function(t,r){for(var i,a=0;a<this.elt.length;a++)if(this.elt[a].innerHTML===t){i=a;break}if(void 0!==i)!1===r?this.elt.remove(i):this.elt[i].innerHTML===this.elt[i].value?this.elt[i].innerHTML=this.elt[i].value=r:this.elt[i].value=r;else{var n=document.createElement("option");n.innerHTML=t,1<arguments.length?n.value=r:n.value=t,e.appendChild(n),this._pInst._elements.push(n)}},t.selected=function(e){var t,r=[];if(0<arguments.length){for(t=0;t<this.elt.length;t++)e.toString()===this.elt[t].value&&(this.elt.selectedIndex=t);return this}if(this.elt.getAttribute("multiple")){for(t=0;t<this.elt.selectedOptions.length;t++)r.push(this.elt.selectedOptions[t].value);return r}return this.elt.value},t},a.default.prototype.createRadio=function(e){a.default._validateParameters("createRadio",arguments);var t,r,i=document.querySelectorAll("input[type=radio]"),o=0;if(1<i.length)for(var l=i.length,u=i[0].name,h=i[1].name,d=o=1;d<l;d++)u!==(h=i[d].name)&&o++,u=h;else 1===i.length&&(o=1);"object"===n(e)?(r=e,t=this.elt=e.elt):(t=document.createElement("div"),r=s(t,this)),r._getInputChildrenArray=function(){return Array.prototype.slice.call(this.elt.children).filter((function(e){return"INPUT"===e.tagName}))};var c=-1;return r.option=function(e,r){var i=document.createElement("input");if(i.type="radio",i.innerHTML=e,i.value=r||e,i.setAttribute("name","defaultradio"+o),t.appendChild(i),e){c++;var a=document.createElement("label");i.setAttribute("id","defaultradio"+o+"-"+c),a.htmlFor="defaultradio"+o+"-"+c,a.appendChild(document.createTextNode(e)),t.appendChild(a)}return i},r.selected=function(e){var t,i=r._getInputChildrenArray();if(e){for(t=0;t<i.length;t++)i[t].value===e&&(i[t].checked=!0);return this}for(t=0;t<i.length;t++)if(!0===i[t].checked)return i[t].value},r.value=function(e){var t,i=r._getInputChildrenArray();if(e){for(t=0;t<i.length;t++)i[t].value===e&&(i[t].checked=!0);return this}for(t=0;t<i.length;t++)if(!0===i[t].checked)return i[t].value;return""},r},a.default.prototype.createColorPicker=function(e){a.default._validateParameters("createColorPicker",arguments);var t,r=document.createElement("input");return r.type="color",e?e instanceof a.default.Color?r.value=e.toString("#rrggbb"):(a.default.prototype._colorMode="rgb",a.default.prototype._colorMaxes={rgb:[255,255,255,255],hsb:[360,100,100,1],hsl:[360,100,100,1]},r.value=a.default.prototype.color(e).toString("#rrggbb")):r.value="#000000",(t=s(r,this)).color=function(){return e.mode&&(a.default.prototype._colorMode=e.mode),e.maxes&&(a.default.prototype._colorMaxes=e.maxes),a.default.prototype.color(this.elt.value)},t},a.default.prototype.createInput=function(e,t){a.default._validateParameters("createInput",arguments);var r=document.createElement("input");return r.type=t||"text",e&&(r.value=e),s(r,this)},a.default.prototype.createFileInput=function(e,t){if(a.default._validateParameters("createFileInput",arguments),window.File&&window.FileReader&&window.FileList&&window.Blob){var r=document.createElement("input");return r.type="file",t&&(r.multiple="multiple"),r.addEventListener("change",(function(t){for(var r=t.target.files,i=0;i<r.length;i++){var n=r[i];a.default.File._load(n,e)}}),!1),s(r,this)}console.log("The File APIs are not fully supported in this browser. Cannot create element.")},a.default.prototype.createVideo=function(e,t){return a.default._validateParameters("createVideo",arguments),l(this,"video",e,t)},a.default.prototype.createAudio=function(e,t){return a.default._validateParameters("createAudio",arguments),l(this,"audio",e,t)},a.default.prototype.VIDEO="video",a.default.prototype.AUDIO="audio",void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(e){var t=navigator.webkitGetUserMedia||navigator.mozGetUserMedia;return t?new Promise((function(r,i){t.call(navigator,e,r,i)})):Promise.reject(new Error("getUserMedia is not implemented in this browser"))}),a.default.prototype.createCapture=function(){a.default._validateParameters("createCapture",arguments);for(var e,t,r=!0,i=!0,o=0;o<arguments.length;o++)arguments[o]===a.default.prototype.VIDEO?i=!1:arguments[o]===a.default.prototype.AUDIO?r=!1:"object"===n(arguments[o])?e=arguments[o]:"function"==typeof arguments[o]&&(t=arguments[o]);if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw"getUserMedia not supported in this browser";var l=document.createElement("video");l.setAttribute("playsinline",""),e||(e={video:r,audio:i}),navigator.mediaDevices.getUserMedia(e).then((function(e){try{"srcObject"in l?l.srcObject=e:l.src=window.URL.createObjectURL(e)}catch(t){l.src=e}}),(function(e){console.log(e)}));var u=s(l,this,!0);return u.loadedmetadata=!1,l.addEventListener("loadedmetadata",(function(){l.play(),l.width?(u.width=l.videoWidth=l.width,u.height=l.videoHeight=l.height):(u.width=u.elt.width=l.videoWidth,u.height=u.elt.height=l.videoHeight),u.loadedmetadata=!0,t&&t(l.srcObject)})),u},a.default.prototype.createElement=function(e,t){a.default._validateParameters("createElement",arguments);var r=document.createElement(e);return void 0!==t&&(r.innerHTML=t),s(r,this)},a.default.Element.prototype.addClass=function(e){return this.elt.className?this.hasClass(e)||(this.elt.className=this.elt.className+" "+e):this.elt.className=e,this},a.default.Element.prototype.removeClass=function(e){return this.elt.classList.remove(e),this},a.default.Element.prototype.hasClass=function(e){return this.elt.classList.contains(e)},a.default.Element.prototype.toggleClass=function(e){return this.elt.classList.contains(e)?this.elt.classList.remove(e):this.elt.classList.add(e),this},a.default.Element.prototype.child=function(e){return void 0===e?this.elt.childNodes:("string"==typeof e?("#"===e[0]&&(e=e.substring(1)),e=document.getElementById(e)):e instanceof a.default.Element&&(e=e.elt),this.elt.appendChild(e),this)},a.default.Element.prototype.center=function(e){var t=this.elt.style.display,r="none"===this.elt.style.display,i="none"===this.parent().style.display,a={x:this.elt.offsetLeft,y:this.elt.offsetTop};r&&this.show(),this.elt.style.display="block",this.position(0,0),i&&(this.parent().style.display="block");var n=Math.abs(this.parent().offsetWidth-this.elt.offsetWidth),o=Math.abs(this.parent().offsetHeight-this.elt.offsetHeight),s=a.y,l=a.x;return"both"===e||void 0===e?this.position(n/2,o/2):"horizontal"===e?this.position(n/2,s):"vertical"===e&&this.position(l,o/2),this.style("display",t),r&&this.hide(),i&&(this.parent().style.display="none"),this},a.default.Element.prototype.html=function(){return 0===arguments.length?this.elt.innerHTML:(arguments[1]?this.elt.innerHTML+=arguments[0]:this.elt.innerHTML=arguments[0],this)},a.default.Element.prototype.position=function(){return 0===arguments.length?{x:this.elt.offsetLeft,y:this.elt.offsetTop}:(this.elt.style.position="absolute",this.elt.style.left=arguments[0]+"px",this.elt.style.top=arguments[1]+"px",this.x=arguments[0],this.y=arguments[1],this)},a.default.Element.prototype._translate=function(){this.elt.style.position="absolute";var e="";return this.elt.style.transform&&(e=(e=this.elt.style.transform.replace(/translate3d\(.*\)/g,"")).replace(/translate[X-Z]?\(.*\)/g,"")),2===arguments.length?this.elt.style.transform="translate("+arguments[0]+"px, "+arguments[1]+"px)":2<arguments.length&&(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+=e,this},a.default.Element.prototype._rotate=function(){var e="";return this.elt.style.transform&&(e=(e=this.elt.style.transform.replace(/rotate3d\(.*\)/g,"")).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+=e,this},a.default.Element.prototype.style=function(e,t){if(t instanceof a.default.Color&&(t="rgba("+t.levels[0]+","+t.levels[1]+","+t.levels[2]+","+t.levels[3]/255+")"),void 0===t){if(-1===e.indexOf(":"))return window.getComputedStyle(this.elt).getPropertyValue(e);for(var r=e.split(";"),i=0;i<r.length;i++){var n=r[i].split(":");n[0]&&n[1]&&(this.elt.style[n[0].trim()]=n[1].trim())}}else if(this.elt.style[e]=t,"width"===e||"height"===e||"left"===e||"top"===e){var o=t.replace(/\D+/g,"");this[e]=parseInt(o,10)}return this},a.default.Element.prototype.attribute=function(e,t){if(null==this.elt.firstChild||"checkbox"!==this.elt.firstChild.type&&"radio"!==this.elt.firstChild.type)return void 0===t?this.elt.getAttribute(e):(this.elt.setAttribute(e,t),this);if(void 0===t)return this.elt.firstChild.getAttribute(e);for(var r=0;r<this.elt.childNodes.length;r++)this.elt.childNodes[r].setAttribute(e,t)},a.default.Element.prototype.removeAttribute=function(e){if(null!=this.elt.firstChild&&("checkbox"===this.elt.firstChild.type||"radio"===this.elt.firstChild.type))for(var t=0;t<this.elt.childNodes.length;t++)this.elt.childNodes[t].removeAttribute(e);return this.elt.removeAttribute(e),this},a.default.Element.prototype.value=function(){return 0<arguments.length?(this.elt.value=arguments[0],this):"range"===this.elt.type?parseFloat(this.elt.value):this.elt.value},a.default.Element.prototype.show=function(){return this.elt.style.display="block",this},a.default.Element.prototype.hide=function(){return this.elt.style.display="none",this},a.default.Element.prototype.size=function(e,t){if(0===arguments.length)return{width:this.elt.offsetWidth,height:this.elt.offsetHeight};var r=e,i=t,n=a.default.prototype.AUTO;if(r!==n||i!==n){if(r===n?r=t*this.width/this.height:i===n&&(i=e*this.height/this.width),this.elt instanceof HTMLCanvasElement){var o,s={},l=this.elt.getContext("2d");for(o in l)s[o]=l[o];for(o in this.elt.setAttribute("width",r*this._pInst._pixelDensity),this.elt.setAttribute("height",i*this._pInst._pixelDensity),this.elt.style.width=r+"px",this.elt.style.height=i+"px",this._pInst.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),s)this.elt.getContext("2d")[o]=s[o]}else this.elt.style.width=r+"px",this.elt.style.height=i+"px",this.elt.width=r,this.elt.height=i;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.default.Element.prototype.remove=function(){for(var e in this._events)this.elt.removeEventListener(e,this._events[e]);this.elt&&this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt)},a.default.Element.prototype.drop=function(e,t){if(window.File&&window.FileReader&&window.FileList&&window.Blob){if(!this._dragDisabled){this._dragDisabled=!0;var r=function(e){e.preventDefault()};this.elt.addEventListener("dragover",r),this.elt.addEventListener("dragleave",r)}a.default.Element._attachListener("drop",(function(r){r.preventDefault(),"function"==typeof t&&t.call(this,r);for(var i=r.dataTransfer.files,n=0;n<i.length;n++){var o=i[n];a.default.File._load(o,e)}}),this)}else console.log("The File APIs are not fully supported in this browser.");return this},a.default.MediaElement=function(e,t){a.default.Element.call(this,e,t);var r=this;this.elt.crossOrigin="anonymous",this._prevTime=0,this._cueIDCounter=0,this._cues=[],(this._pixelsState=this)._pixelDensity=1,this._modified=!1,Object.defineProperty(r,"src",{get:function(){var e=r.elt.children[0].src,t=r.elt.src===window.location.href?"":r.elt.src;return e===window.location.href?t:e},set:function(t){for(var i=0;i<r.elt.children.length;i++)r.elt.removeChild(r.elt.children[i]);var a=document.createElement("source");a.src=t,e.appendChild(a),r.elt.src=t,r.modified=!0}}),r._onended=function(){},r.elt.onended=function(){r._onended(r)}},a.default.MediaElement.prototype=Object.create(a.default.Element.prototype),a.default.MediaElement.prototype.play=function(){var e;return this.elt.currentTime===this.elt.duration&&(this.elt.currentTime=0),1<this.elt.readyState||this.elt.load(),(e=this.elt.play())&&e.catch&&e.catch((function(e){console.log("WARN: Element play method raised an error asynchronously",e)})),this},a.default.MediaElement.prototype.stop=function(){return this.elt.pause(),this.elt.currentTime=0,this},a.default.MediaElement.prototype.pause=function(){return this.elt.pause(),this},a.default.MediaElement.prototype.loop=function(){return this.elt.setAttribute("loop",!0),this.play(),this},a.default.MediaElement.prototype.noLoop=function(){return this.elt.setAttribute("loop",!1),this},a.default.MediaElement.prototype.autoplay=function(e){return this.elt.setAttribute("autoplay",e),this},a.default.MediaElement.prototype.volume=function(e){if(void 0===e)return this.elt.volume;this.elt.volume=e},a.default.MediaElement.prototype.speed=function(e){if(void 0===e)return this.presetPlaybackRate||this.elt.playbackRate;this.loadedmetadata?this.elt.playbackRate=e:this.presetPlaybackRate=e},a.default.MediaElement.prototype.time=function(e){return void 0===e?this.elt.currentTime:(this.elt.currentTime=e,this)},a.default.MediaElement.prototype.duration=function(){return this.elt.duration},a.default.MediaElement.prototype.pixels=[],a.default.MediaElement.prototype._ensureCanvas=function(){this.canvas||(this.canvas=document.createElement("canvas"),this.drawingContext=this.canvas.getContext("2d"),this.setModified(!0)),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.drawingContext.drawImage(this.elt,0,0,this.canvas.width,this.canvas.height),this.setModified(!0))},a.default.MediaElement.prototype.loadPixels=function(){return this._ensureCanvas(),a.default.Renderer2D.prototype.loadPixels.apply(this,arguments)},a.default.MediaElement.prototype.updatePixels=function(e,t,r,i){return this.loadedmetadata&&(this._ensureCanvas(),a.default.Renderer2D.prototype.updatePixels.call(this,e,t,r,i)),this.setModified(!0),this},a.default.MediaElement.prototype.get=function(){return this._ensureCanvas(),a.default.Renderer2D.prototype.get.apply(this,arguments)},a.default.MediaElement.prototype._getPixel=function(){return this.loadPixels(),a.default.Renderer2D.prototype._getPixel.apply(this,arguments)},a.default.MediaElement.prototype.set=function(e,t,r){this.loadedmetadata&&(this._ensureCanvas(),a.default.Renderer2D.prototype.set.call(this,e,t,r),this.setModified(!0))},a.default.MediaElement.prototype.copy=function(){this._ensureCanvas(),a.default.prototype.copy.apply(this,arguments)},a.default.MediaElement.prototype.mask=function(){this.loadPixels(),this.setModified(!0),a.default.Image.prototype.mask.apply(this,arguments)},a.default.MediaElement.prototype.isModified=function(){return this._modified},a.default.MediaElement.prototype.setModified=function(e){this._modified=e},a.default.MediaElement.prototype.onended=function(e){return this._onended=e,this},a.default.MediaElement.prototype.connect=function(e){var t,r;if("function"==typeof a.default.prototype.getAudioContext)t=a.default.prototype.getAudioContext(),r=a.default.soundOut.input;else try{r=(t=e.context).destination}catch(e){throw"connect() is meant to be used with Web Audio API or p5.sound.js"}this.audioSourceNode||(this.audioSourceNode=t.createMediaElementSource(this.elt),this.audioSourceNode.connect(r)),e?e.input?this.audioSourceNode.connect(e.input):this.audioSourceNode.connect(e):this.audioSourceNode.connect(r)},a.default.MediaElement.prototype.disconnect=function(){if(!this.audioSourceNode)throw"nothing to disconnect";this.audioSourceNode.disconnect()},a.default.MediaElement.prototype.showControls=function(){this.elt.style["text-align"]="inherit",this.elt.controls=!0},a.default.MediaElement.prototype.hideControls=function(){this.elt.controls=!1};var u=function(e,t,r,i){this.callback=e,this.time=t,this.id=r,this.val=i};a.default.MediaElement.prototype.addCue=function(e,t,r){var i=this._cueIDCounter++,a=new u(t,e,i,r);return this._cues.push(a),this.elt.ontimeupdate||(this.elt.ontimeupdate=this._onTimeUpdate.bind(this)),i},a.default.MediaElement.prototype.removeCue=function(e){for(var t=0;t<this._cues.length;t++)this._cues[t].id===e&&(console.log(e),this._cues.splice(t,1));0===this._cues.length&&(this.elt.ontimeupdate=null)},a.default.MediaElement.prototype.clearCues=function(){this._cues=[],this.elt.ontimeupdate=null},a.default.MediaElement.prototype._onTimeUpdate=function(){for(var e=this.time(),t=0;t<this._cues.length;t++){var r=this._cues[t].time,i=this._cues[t].val;this._prevTime<r&&r<=e&&this._cues[t].callback(i)}this._prevTime=e},a.default.File=function(e,t){this.file=e,this._pInst=t;var r=e.type.split("/");this.type=r[0],this.subtype=r[1],this.name=e.name,this.size=e.size,this.data=void 0},a.default.File._createLoader=function(e,t){var r=new FileReader;return r.onload=function(r){var i=new a.default.File(e);i.data=r.target.result,t(i)},r},a.default.File._load=function(e,t){if(/^text\//.test(e.type))a.default.File._createLoader(e,t).readAsText(e);else if(/^(video|audio)\//.test(e.type)){var r=new a.default.File(e);r.data=URL.createObjectURL(e),t(r)}else a.default.File._createLoader(e,t).readAsDataURL(e)};var h=a.default;r.default=h},{"../core/main":26}],43:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.deviceOrientation=void 0,a.default.prototype.accelerationX=0,a.default.prototype.accelerationY=0,a.default.prototype.accelerationZ=0,a.default.prototype.pAccelerationX=0,a.default.prototype.pAccelerationY=0,a.default.prototype.pAccelerationZ=0,a.default.prototype._updatePAccelerations=function(){this._setProperty("pAccelerationX",this.accelerationX),this._setProperty("pAccelerationY",this.accelerationY),this._setProperty("pAccelerationZ",this.accelerationZ)},a.default.prototype.rotationX=0,a.default.prototype.rotationY=0,a.default.prototype.rotationZ=0,a.default.prototype.pRotationX=0,a.default.prototype.pRotationY=0;var n=a.default.prototype.pRotationZ=0,o=0,s=0,l="clockwise",u="clockwise",h="clockwise";a.default.prototype.pRotateDirectionX=void 0,a.default.prototype.pRotateDirectionY=void 0,a.default.prototype.pRotateDirectionZ=void 0,a.default.prototype._updatePRotations=function(){this._setProperty("pRotationX",this.rotationX),this._setProperty("pRotationY",this.rotationY),this._setProperty("pRotationZ",this.rotationZ)},a.default.prototype.turnAxis=void 0;var d=.5,c=30;a.default.prototype.setMoveThreshold=function(e){a.default._validateParameters("setMoveThreshold",arguments),d=e},a.default.prototype.setShakeThreshold=function(e){a.default._validateParameters("setShakeThreshold",arguments),c=e},a.default.prototype._ondeviceorientation=function(e){this._updatePRotations(),this._setProperty("rotationX",e.beta),this._setProperty("rotationY",e.gamma),this._setProperty("rotationZ",e.alpha),this._handleMotion()},a.default.prototype._ondevicemotion=function(e){this._updatePAccelerations(),this._setProperty("accelerationX",2*e.acceleration.x),this._setProperty("accelerationY",2*e.acceleration.y),this._setProperty("accelerationZ",2*e.acceleration.z),this._handleMotion()},a.default.prototype._handleMotion=function(){90===window.orientation||-90===window.orientation?this._setProperty("deviceOrientation","landscape"):0===window.orientation?this._setProperty("deviceOrientation","portrait"):void 0===window.orientation&&this._setProperty("deviceOrientation","undefined");var e=this.deviceMoved||window.deviceMoved;"function"==typeof e&&(Math.abs(this.accelerationX-this.pAccelerationX)>d||Math.abs(this.accelerationY-this.pAccelerationY)>d||Math.abs(this.accelerationZ-this.pAccelerationZ)>d)&&e();var t=this.deviceTurned||window.deviceTurned;if("function"==typeof t){var r=this.rotationX+180,i=this.pRotationX+180,a=n+180;0<r-i&&r-i<270||r-i<-270?l="clockwise":(r-i<0||270<r-i)&&(l="counter-clockwise"),l!==this.pRotateDirectionX&&(a=r),90<Math.abs(r-a)&&Math.abs(r-a)<270&&(a=r,this._setProperty("turnAxis","X"),t()),this.pRotateDirectionX=l,n=a-180;var f=this.rotationY+180,p=this.pRotationY+180,m=o+180;0<f-p&&f-p<270||f-p<-270?u="clockwise":(f-p<0||270<f-this.pRotationY)&&(u="counter-clockwise"),u!==this.pRotateDirectionY&&(m=f),90<Math.abs(f-m)&&Math.abs(f-m)<270&&(m=f,this._setProperty("turnAxis","Y"),t()),this.pRotateDirectionY=u,o=m-180,0<this.rotationZ-this.pRotationZ&&this.rotationZ-this.pRotationZ<270||this.rotationZ-this.pRotationZ<-270?h="clockwise":(this.rotationZ-this.pRotationZ<0||270<this.rotationZ-this.pRotationZ)&&(h="counter-clockwise"),h!==this.pRotateDirectionZ&&(s=this.rotationZ),90<Math.abs(this.rotationZ-s)&&Math.abs(this.rotationZ-s)<270&&(s=this.rotationZ,this._setProperty("turnAxis","Z"),t()),this.pRotateDirectionZ=h,this._setProperty("turnAxis",void 0)}var v,g,y=this.deviceShaken||window.deviceShaken;"function"==typeof y&&(null!==this.pAccelerationX&&(v=Math.abs(this.accelerationX-this.pAccelerationX),g=Math.abs(this.accelerationY-this.pAccelerationY)),c<v+g&&y())};var f=a.default;r.default=f},{"../core/main":26}],44:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.isKeyPressed=!1,a.default.prototype.keyIsPressed=!1,a.default.prototype.key="",a.default.prototype.keyCode=0,a.default.prototype._onkeydown=function(e){if(!this._downKeys[e.which]){this._setProperty("isKeyPressed",!0),this._setProperty("keyIsPressed",!0),this._setProperty("keyCode",e.which),this._downKeys[e.which]=!0,this._setProperty("key",e.key||String.fromCharCode(e.which)||e.which);var t=this.keyPressed||window.keyPressed;"function"!=typeof t||e.charCode||!1===t(e)&&e.preventDefault()}},a.default.prototype._onkeyup=function(e){var t=this.keyReleased||window.keyReleased;this._downKeys[e.which]=!1,this._areDownKeys()||(this._setProperty("isKeyPressed",!1),this._setProperty("keyIsPressed",!1)),this._setProperty("_lastKeyCodeTyped",null),this._setProperty("key",e.key||String.fromCharCode(e.which)||e.which),this._setProperty("keyCode",e.which),"function"==typeof t&&!1===t(e)&&e.preventDefault()},a.default.prototype._onkeypress=function(e){if(e.which!==this._lastKeyCodeTyped){this._setProperty("_lastKeyCodeTyped",e.which),this._setProperty("key",String.fromCharCode(e.which));var t=this.keyTyped||window.keyTyped;"function"==typeof t&&!1===t(e)&&e.preventDefault()}},a.default.prototype._onblur=function(e){this._downKeys={}},a.default.prototype.keyIsDown=function(e){return a.default._validateParameters("keyIsDown",arguments),this._downKeys[e]||!1},a.default.prototype._areDownKeys=function(){for(var e in this._downKeys)if(this._downKeys.hasOwnProperty(e)&&!0===this._downKeys[e])return!0;return!1};var n=a.default;r.default=n},{"../core/main":26}],45:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));a.default.prototype.movedX=0,a.default.prototype.movedY=0,a.default.prototype._hasMouseInteracted=!1,a.default.prototype.mouseX=0,a.default.prototype.mouseY=0,a.default.prototype.pmouseX=0,a.default.prototype.pmouseY=0,a.default.prototype.winMouseX=0,a.default.prototype.winMouseY=0,a.default.prototype.pwinMouseX=0,a.default.prototype.pwinMouseY=0,a.default.prototype.mouseButton=0,a.default.prototype.mouseIsPressed=!1,a.default.prototype._updateNextMouseCoords=function(e){if(null!==this._curElement&&(!e.touches||0<e.touches.length)){var t=function(e,t,r,i){i&&!i.clientX&&(i.touches?i=i.touches[0]:i.changedTouches&&(i=i.changedTouches[0]));var a=e.getBoundingClientRect(),n=e.scrollWidth/t||1,o=e.scrollHeight/r||1;return{x:(i.clientX-a.left)/n,y:(i.clientY-a.top)/o,winX:i.clientX,winY:i.clientY,id:i.identifier}}(this._curElement.elt,this.width,this.height,e);this._setProperty("movedX",e.movementX),this._setProperty("movedY",e.movementY),this._setProperty("mouseX",t.x),this._setProperty("mouseY",t.y),this._setProperty("winMouseX",t.winX),this._setProperty("winMouseY",t.winY)}this._hasMouseInteracted||(this._updateMouseCoords(),this._setProperty("_hasMouseInteracted",!0))},a.default.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)},a.default.prototype._setMouseButton=function(e){1===e.button?this._setProperty("mouseButton",n.CENTER):2===e.button?this._setProperty("mouseButton",n.RIGHT):this._setProperty("mouseButton",n.LEFT)},a.default.prototype._onmousemove=function(e){var t=this._isGlobal?window:this;this._updateNextMouseCoords(e),this.mouseIsPressed?"function"==typeof t.mouseDragged?!1===t.mouseDragged(e)&&e.preventDefault():"function"==typeof t.touchMoved&&!1===t.touchMoved(e)&&e.preventDefault():"function"==typeof t.mouseMoved&&!1===t.mouseMoved(e)&&e.preventDefault()},a.default.prototype._onmousedown=function(e){var t=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!0),this._setMouseButton(e),this._updateNextMouseCoords(e),"function"==typeof t.mousePressed?!1===t.mousePressed(e)&&e.preventDefault():navigator.userAgent.toLowerCase().includes("safari")&&"function"==typeof t.touchStarted&&!1===t.touchStarted(e)&&e.preventDefault()},a.default.prototype._onmouseup=function(e){var t=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!1),"function"==typeof t.mouseReleased?!1===t.mouseReleased(e)&&e.preventDefault():"function"==typeof t.touchEnded&&!1===t.touchEnded(e)&&e.preventDefault()},a.default.prototype._ondragend=a.default.prototype._onmouseup,a.default.prototype._ondragover=a.default.prototype._onmousemove,a.default.prototype._onclick=function(e){var t=this._isGlobal?window:this;"function"==typeof t.mouseClicked&&!1===t.mouseClicked(e)&&e.preventDefault()},a.default.prototype._ondblclick=function(e){var t=this._isGlobal?window:this;"function"==typeof t.doubleClicked&&!1===t.doubleClicked(e)&&e.preventDefault()},a.default.prototype._mouseWheelDeltaY=0,a.default.prototype._pmouseWheelDeltaY=0,a.default.prototype._onwheel=function(e){var t=this._isGlobal?window:this;this._setProperty("_mouseWheelDeltaY",e.deltaY),"function"==typeof t.mouseWheel&&(e.delta=e.deltaY,!1===t.mouseWheel(e)&&e.preventDefault())},a.default.prototype.requestPointerLock=function(){var e=this._curElement.elt;return e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock,e.requestPointerLock?(e.requestPointerLock(),!0):(console.log("requestPointerLock is not implemented in this browser"),!1)},a.default.prototype.exitPointerLock=function(){document.exitPointerLock()};var o=a.default;r.default=o},{"../core/constants":20,"../core/main":26}],46:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};function n(e,t,r,i){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,n=e.getBoundingClientRect(),o=e.scrollWidth/t||1,s=e.scrollHeight/r||1,l=i.touches[a]||i.changedTouches[a];return{x:(l.clientX-n.left)/o,y:(l.clientY-n.top)/s,winX:l.clientX,winY:l.clientY,id:l.identifier}}a.default.prototype.touches=[],a.default.prototype._updateTouchCoords=function(e){if(null!==this._curElement){for(var t=[],r=0;r<e.touches.length;r++)t[r]=n(this._curElement.elt,this.width,this.height,e,r);this._setProperty("touches",t)}},a.default.prototype._ontouchstart=function(e){var t=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!0),this._updateTouchCoords(e),this._updateNextMouseCoords(e),this._updateMouseCoords(),"function"==typeof t.touchStarted?!1===t.touchStarted(e)&&e.preventDefault():navigator.userAgent.toLowerCase().includes("safari")&&"function"==typeof t.touchStarted&&!1===t.mousePressed(e)&&e.preventDefault()},a.default.prototype._ontouchmove=function(e){var t=this._isGlobal?window:this;this._updateTouchCoords(e),this._updateNextMouseCoords(e),"function"==typeof t.touchMoved?!1===t.touchMoved(e)&&e.preventDefault():"function"==typeof t.mouseDragged&&!1===t.mouseDragged(e)&&e.preventDefault()},a.default.prototype._ontouchend=function(e){this._setProperty("mouseIsPressed",!1),this._updateTouchCoords(e),this._updateNextMouseCoords(e);var t=this._isGlobal?window:this;"function"==typeof t.touchEnded?!1===t.touchEnded(e)&&e.preventDefault():"function"==typeof t.mouseReleased&&!1===t.mouseReleased(e)&&e.preventDefault()};var o=a.default;r.default=o},{"../core/main":26}],47:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a,n,o,s={_toPixels:function(e){return e instanceof ImageData?e.data:e.getContext("2d").getImageData(0,0,e.width,e.height).data},_getARGB:function(e,t){var r=4*t;return e[r+3]<<24&4278190080|e[r]<<16&16711680|e[r+1]<<8&65280|255&e[r+2]},_setPixels:function(e,t){for(var r=0,i=0,a=e.length;i<a;i++)e[0+(r=4*i)]=(16711680&t[i])>>>16,e[r+1]=(65280&t[i])>>>8,e[r+2]=255&t[i],e[r+3]=(4278190080&t[i])>>>24},_toImageData:function(e){return e instanceof ImageData?e:e.getContext("2d").getImageData(0,0,e.width,e.height)},_createImageData:function(e,t){return s._tmpCanvas=document.createElement("canvas"),s._tmpCtx=s._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(e,t)},apply:function(e,t,r){var i=e.getContext("2d"),a=i.getImageData(0,0,e.width,e.height),n=t(a,r);n instanceof ImageData?i.putImageData(n,0,0,0,0,e.width,e.height):i.putImageData(a,0,0,0,0,e.width,e.height)},threshold:function(e,t){var r=s._toPixels(e);void 0===t&&(t=.5);for(var i=Math.floor(255*t),a=0;a<r.length;a+=4){var n;n=i<=.2126*r[a]+.7152*r[a+1]+.0722*r[a+2]?255:0,r[a]=r[a+1]=r[a+2]=n}},gray:function(e){for(var t=s._toPixels(e),r=0;r<t.length;r+=4){var i=.2126*t[r]+.7152*t[r+1]+.0722*t[r+2];t[r]=t[r+1]=t[r+2]=i}},opaque:function(e){for(var t=s._toPixels(e),r=0;r<t.length;r+=4)t[r+3]=255;return t},invert:function(e){for(var t=s._toPixels(e),r=0;r<t.length;r+=4)t[r]=255-t[r],t[r+1]=255-t[r+1],t[r+2]=255-t[r+2]},posterize:function(e,t){var r=s._toPixels(e);if(t<2||255<t)throw new Error("Level must be greater than 2 and less than 255 for posterize");for(var i=t-1,a=0;a<r.length;a+=4){var n=r[a],o=r[a+1],l=r[a+2];r[a]=255*(n*t>>8)/i,r[a+1]=255*(o*t>>8)/i,r[a+2]=255*(l*t>>8)/i}},dilate:function(e){for(var t,r,i,a,n,o,l,u,h,d,c,f,p,m,v,g,y,_=s._toPixels(e),b=0,x=_.length?_.length/4:0,w=new Int32Array(x);b<x;)for(r=(t=b)+e.width;b<r;)i=a=s._getARGB(_,b),(l=b-1)<t&&(l=b),r<=(o=b+1)&&(o=b),(u=b-e.width)<0&&(u=0),x<=(h=b+e.width)&&(h=b),f=s._getARGB(_,u),c=s._getARGB(_,l),p=s._getARGB(_,h),(n=77*(i>>16&255)+151*(i>>8&255)+28*(255&i))<(v=77*(c>>16&255)+151*(c>>8&255)+28*(255&c))&&(a=c,n=v),n<(m=77*((d=s._getARGB(_,o))>>16&255)+151*(d>>8&255)+28*(255&d))&&(a=d,n=m),n<(g=77*(f>>16&255)+151*(f>>8&255)+28*(255&f))&&(a=f,n=g),n<(y=77*(p>>16&255)+151*(p>>8&255)+28*(255&p))&&(a=p,n=y),w[b++]=a;s._setPixels(_,w)},erode:function(e){for(var t,r,i,a,n,o,l,u,h,d,c,f,p,m,v,g,y,_=s._toPixels(e),b=0,x=_.length?_.length/4:0,w=new Int32Array(x);b<x;)for(r=(t=b)+e.width;b<r;)i=a=s._getARGB(_,b),(l=b-1)<t&&(l=b),r<=(o=b+1)&&(o=b),(u=b-e.width)<0&&(u=0),x<=(h=b+e.width)&&(h=b),f=s._getARGB(_,u),c=s._getARGB(_,l),p=s._getARGB(_,h),(v=77*(c>>16&255)+151*(c>>8&255)+28*(255&c))<(n=77*(i>>16&255)+151*(i>>8&255)+28*(255&i))&&(a=c,n=v),(m=77*((d=s._getARGB(_,o))>>16&255)+151*(d>>8&255)+28*(255&d))<n&&(a=d,n=m),(g=77*(f>>16&255)+151*(f>>8&255)+28*(255&f))<n&&(a=f,n=g),(y=77*(p>>16&255)+151*(p>>8&255)+28*(255&p))<n&&(a=p,n=y),w[b++]=a;s._setPixels(_,w)},blur:function(e,t){!function(e,t){for(var r,l,u,h,d,c,f,p,m,v,g=s._toPixels(e),y=e.width,_=e.height,b=y*_,x=new Int32Array(b),w=0;w<b;w++)x[w]=s._getARGB(g,w);var S,M,E,T,C=new Int32Array(b),P=new Int32Array(b),L=new Int32Array(b),R=new Int32Array(b),O=0;for(function(e){var t=3.5*e|0;if(i!==(t=t<1?1:t<248?t:248)){a=1+(i=t)<<1,n=new Int32Array(a),o=new Array(a);for(var r=0;r<a;r++)o[r]=new Int32Array(256);for(var s,l,u,h,d=1,c=t-1;d<t;d++){n[t+d]=n[c]=l=c*c,u=o[t+d],h=o[c--];for(var f=0;f<256;f++)u[f]=h[f]=l*f}s=n[t]=t*t,u=o[t];for(var p=0;p<256;p++)u[p]=s*p}}(t),M=0;M<_;M++){for(S=0;S<y;S++){if(h=u=l=d=r=0,(c=S-i)<0)v=-c,c=0;else{if(y<=c)break;v=0}for(E=v;E<a&&!(y<=c);E++){var D=x[c+O];d+=(T=o[E])[(-16777216&D)>>>24],l+=T[(16711680&D)>>16],u+=T[(65280&D)>>8],h+=T[255&D],r+=n[E],c++}C[f=O+S]=d/r,P[f]=l/r,L[f]=u/r,R[f]=h/r}O+=y}for(m=(p=-i)*y,M=O=0;M<_;M++){for(S=0;S<y;S++){if(h=u=l=d=r=0,p<0)v=f=-p,c=S;else{if(_<=p)break;v=0,f=p,c=S+m}for(E=v;E<a&&!(_<=f);E++)d+=(T=o[E])[C[c]],l+=T[P[c]],u+=T[L[c]],h+=T[R[c]],r+=n[E],f++,c+=y;x[S+O]=d/r<<24|l/r<<16|u/r<<8|h/r}O+=y,m+=y,p++}s._setPixels(g,x)}(e,t)}},l=s;r.default=l},{}],48:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=n(e("../core/main")),a=n(e("omggif"));function n(e){return e&&e.__esModule?e:{default:e}}var o=[];i.default.prototype.createImage=function(e,t){return i.default._validateParameters("createImage",arguments),new i.default.Image(e,t)},i.default.prototype.saveCanvas=function(){i.default._validateParameters("saveCanvas",arguments);var e,t,r,a,n=[].slice.call(arguments);switch(arguments[0]instanceof HTMLCanvasElement?(e=arguments[0],n.shift()):arguments[0]instanceof i.default.Element?(e=arguments[0].elt,n.shift()):e=this._curElement&&this._curElement.elt,1<=n.length&&(t=n[0]),2<=n.length&&(r=n[1]),r=r||i.default.prototype._checkFileExtension(t,r)[1]||"png"){default:a="image/png";break;case"jpeg":case"jpg":a="image/jpeg"}e.toBlob((function(e){i.default.prototype.downloadFile(e,t,r)}),a)},i.default.prototype.saveGif=function(e,t){var r=e.gifProperties,n=r.loopLimit;1===n?n=null:null===n&&(n=0);for(var o=r.delay/10,s={loop:n,delay:o},l=new Uint8Array(e.width*e.height*r.numFrames*o),u=new a.default.GifWriter(l,e.width,e.height,s),h=[],d=0;d<r.numFrames;d++){for(var c=new Uint8Array(e.width*e.height),f=r.frames[d].data,p=f.length,m=0,v=0;m<p;m+=4,v++){var g=f[m+0]<<16|f[m+1]<<8|f[m+2]<<0,y=h.indexOf(g);-1===y?(c[v]=h.length,h.push(g)):c[v]=y}for(var _=1;_<h.length;)_<<=1;h.length=_,s.palette=new Uint32Array(h),u.addFrame(0,0,e.width,e.height,c,s)}u.end();var b=new Blob([l],{type:"image/gif"});i.default.prototype.downloadFile(b,t,"gif")},i.default.prototype.saveFrames=function(e,t,r,a,n){i.default._validateParameters("saveFrames",arguments);var s=r||3;s=i.default.prototype.constrain(s,0,15),s*=1e3;var l=a||15;l=i.default.prototype.constrain(l,0,22);var u=0,h=i.default.prototype._makeFrame,d=this._curElement.elt,c=setInterval((function(){h(e+u,t,d),u++}),1e3/l);setTimeout((function(){if(clearInterval(c),n)n(o);else for(var e=o,t=0;t<e.length;t++){var r=e[t];i.default.prototype.downloadFile(r.imageData,r.filename,r.ext)}o=[]}),s+.01)},i.default.prototype._makeFrame=function(e,t,r){var i,a;if(i=this?this._curElement.elt:r,t)switch(t.toLowerCase()){case"png":a="image/png";break;case"jpeg":case"jpg":a="image/jpeg";break;default:a="image/png"}else t="png",a="image/png";var n=i.toDataURL(a);n=n.replace(a,"image/octet-stream");var s={};s.imageData=n,s.filename=e,s.ext=t,o.push(s)};var s=i.default;r.default=s},{"../core/main":26,omggif:10}],49:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=l(e("../core/main")),a=l(e("./filters")),n=l(e("../core/helpers")),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants")),s=l(e("omggif"));function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){return 0<e&&e<t?e:t}e("../core/error_helpers"),i.default.prototype.loadImage=function(e,t,r){i.default._validateParameters("loadImage",arguments);var a=new i.default.Image(1,1,this),n=this,o=new Request(e,{method:"GET",mode:"cors"});return fetch(e,o).then((function(o){if(o.headers.get("content-type").includes("image/gif"))o.arrayBuffer().then((function(e){e&&function(e,t,r,a,n){var o=new s.default.GifReader(e);t.width=t.canvas.width=o.width,t.height=t.canvas.height=o.height;var l=[],u=o.numFrames(),h=new Uint8ClampedArray(t.width*t.height*4),d=0;if(1<u){for(var c=function(e,r){try{r.decodeAndBlitFrameRGBA(e,h)}catch(e){i.default._friendlyFileLoadError(8,t.src),"function"==typeof a?a(e):console.error(e)}},f=0;f<u;f++){d+=o.frameInfo(f).delay,1===o.frameInfo(f).disposal&&0<f?t.drawingContext.putImageData(l[f-1],0,0):(t.drawingContext.clearRect(0,0,t.width,t.height),h=new Uint8ClampedArray(t.width*t.height*4)),c(f,o);var p=new ImageData(h,t.width,t.height);t.drawingContext.putImageData(p,0,0),l.push(t.drawingContext.getImageData(0,0,t.width,t.height))}var m=o.loopCount();null===m?m=1:0===m&&(m=null),d/=u,t.gifProperties={displayIndex:0,delay:10*d,loopLimit:m,loopCount:0,frames:l,numFrames:u,playing:!0,timeDisplayed:0}}"function"==typeof r&&r(t),n()}(new Uint8Array(e),a,t,r,function(e){n._decrementPreload()}.bind(n))}),(function(e){"function"==typeof r?r(e):console.error(e)}));else{var l=new Image;l.onload=function(){a.width=a.canvas.width=l.width,a.height=a.canvas.height=l.height,a.drawingContext.drawImage(l,0,0),a.modified=!0,"function"==typeof t&&t(a),n._decrementPreload()},l.onerror=function(e){i.default._friendlyFileLoadError(0,l.src),"function"==typeof r?r(e):console.error(e)},0!==e.indexOf("data:image/")&&(l.crossOrigin="Anonymous"),l.src=e}a.modified=!0})),a},i.default.prototype.image=function(e,t,r,a,o,s,l,h,d){i.default._validateParameters("image",arguments);var c=e.width,f=e.height;e.elt&&e.elt.videoWidth&&!e.canvas&&(c=e.elt.videoWidth,f=e.elt.videoHeight);var p=t,m=r,v=a||c,g=o||f,y=s||0,_=l||0,b=h||c,x=d||f;b=u(b,c),x=u(x,f);var w=1;e.elt&&!e.canvas&&e.elt.style.width&&(w=e.elt.videoWidth&&!a?e.elt.videoWidth:e.elt.width,w/=parseInt(e.elt.style.width,10)),y*=w,_*=w,x*=w,b*=w;var S=n.default.modeAdjust(p,m,v,g,this._renderer._imageMode);this._renderer.image(e,y,_,b,x,S.x,S.y,S.w,S.h)},i.default.prototype.tint=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.default._validateParameters("tint",t);var a=this.color.apply(this,t);this._renderer._tint=a.levels},i.default.prototype.noTint=function(){this._renderer._tint=null},i.default.prototype._getTintedImageCanvas=function(e){if(!e.canvas)return e;var t=a.default._toPixels(e.canvas),r=document.createElement("canvas");r.width=e.canvas.width,r.height=e.canvas.height;for(var i=r.getContext("2d"),n=i.createImageData(e.canvas.width,e.canvas.height),o=n.data,s=0;s<t.length;s+=4){var l=t[s],u=t[s+1],h=t[s+2],d=t[s+3];o[s]=l*this._renderer._tint[0]/255,o[s+1]=u*this._renderer._tint[1]/255,o[s+2]=h*this._renderer._tint[2]/255,o[s+3]=d*this._renderer._tint[3]/255}return i.putImageData(n,0,0),r},i.default.prototype.imageMode=function(e){i.default._validateParameters("imageMode",arguments),e!==o.CORNER&&e!==o.CORNERS&&e!==o.CENTER||(this._renderer._imageMode=e)};var h=i.default;r.default=h},{"../core/constants":20,"../core/error_helpers":22,"../core/helpers":23,"../core/main":26,"./filters":47,omggif:10}],50:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=n(e("../core/main")),a=n(e("./filters"));function n(e){return e&&e.__esModule?e:{default:e}}i.default.Image=function(e,t){this.width=e,this.height=t,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.drawingContext=this.canvas.getContext("2d"),(this._pixelsState=this)._pixelDensity=1,this.gifProperties=null,this._modified=!1,this.pixels=[]},i.default.Image.prototype._animateGif=function(e){var t=this.gifProperties;if(t.playing&&(t.timeDisplayed+=e.deltaTime),t.timeDisplayed>=t.delay){var r=Math.floor(t.timeDisplayed/t.delay);if(t.timeDisplayed=0,t.displayIndex+=r,t.loopCount=Math.floor(t.displayIndex/t.numFrames),null!==t.loopLimit&&t.loopCount>=t.loopLimit)t.playing=!1;else{var i=t.displayIndex%t.numFrames;this.drawingContext.putImageData(t.frames[i],0,0),t.displayIndex=i,this.setModified(!0)}}},i.default.Image.prototype._setProperty=function(e,t){this[e]=t,this.setModified(!0)},i.default.Image.prototype.loadPixels=function(){i.default.Renderer2D.prototype.loadPixels.call(this),this.setModified(!0)},i.default.Image.prototype.updatePixels=function(e,t,r,a){i.default.Renderer2D.prototype.updatePixels.call(this,e,t,r,a),this.setModified(!0)},i.default.Image.prototype.get=function(e,t,r,a){return i.default._validateParameters("p5.Image.get",arguments),i.default.Renderer2D.prototype.get.apply(this,arguments)},i.default.Image.prototype._getPixel=i.default.Renderer2D.prototype._getPixel,i.default.Image.prototype.set=function(e,t,r){i.default.Renderer2D.prototype.set.call(this,e,t,r),this.setModified(!0)},i.default.Image.prototype.resize=function(e,t){0===e&&0===t?(e=this.canvas.width,t=this.canvas.height):0===e?e=this.canvas.width*t/this.canvas.height:0===t&&(t=this.canvas.height*e/this.canvas.width),e=Math.floor(e),t=Math.floor(t);var r=document.createElement("canvas");if(r.width=e,r.height=t,this.gifProperties)for(var i=this.gifProperties,a=function(e,t){for(var r=0,i=0;i<t.height;i++)for(var a=0;a<t.width;a++){var n=Math.floor(a*e.width/t.width),o=4*(Math.floor(i*e.height/t.height)*e.width+n);t.data[r++]=e.data[o++],t.data[r++]=e.data[o++],t.data[r++]=e.data[o++],t.data[r++]=e.data[o++]}},n=0;n<i.numFrames;n++){var o=this.drawingContext.createImageData(e,t);a(i.frames[n],o),i.frames[n]=o}r.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,r.width,r.height),this.canvas.width=this.width=e,this.canvas.height=this.height=t,this.drawingContext.drawImage(r,0,0,e,t,0,0,e,t),0<this.pixels.length&&this.loadPixels(),this.setModified(!0)},i.default.Image.prototype.copy=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.default.prototype.copy.apply(this,t)},i.default.Image.prototype.mask=function(e){void 0===e&&(e=this);var t=this.drawingContext.globalCompositeOperation,r=1;e instanceof i.default.Renderer&&(r=e._pInst._pixelDensity);var a=[e,0,0,r*e.width,r*e.height,0,0,this.width,this.height];this.drawingContext.globalCompositeOperation="destination-in",i.default.Image.prototype.copy.apply(this,a),this.drawingContext.globalCompositeOperation=t,this.setModified(!0)},i.default.Image.prototype.filter=function(e,t){a.default.apply(this.canvas,a.default[e],t),this.setModified(!0)},i.default.Image.prototype.blend=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.default.prototype.blend.apply(this,t),this.setModified(!0)},i.default.Image.prototype.setModified=function(e){this._modified=e},i.default.Image.prototype.isModified=function(){return this._modified},i.default.Image.prototype.save=function(e,t){this.gifProperties?i.default.prototype.saveGif(this,e):i.default.prototype.saveCanvas(this.canvas,e,t)},i.default.Image.prototype.reset=function(){if(this.gifProperties){var e=this.gifProperties;e.playing=!0,e.timeSinceStart=0,e.timeDisplayed=0,e.loopCount=0,e.displayIndex=0,this.drawingContext.putImageData(e.frames[0],0,0)}},i.default.Image.prototype.getCurrentFrame=function(){if(this.gifProperties){var e=this.gifProperties;return e.displayIndex%e.numFrames}},i.default.Image.prototype.setFrame=function(e){if(this.gifProperties){var t=this.gifProperties;e<t.numFrames&&0<=e?(t.timeDisplayed=0,t.displayIndex=e,this.drawingContext.putImageData(t.frames[e],0,0)):console.log("Cannot set GIF to a frame number that is higher than total number of frames or below zero.")}},i.default.Image.prototype.numFrames=function(){if(this.gifProperties)return this.gifProperties.numFrames},i.default.Image.prototype.play=function(){this.gifProperties&&(this.gifProperties.playing=!0)},i.default.Image.prototype.pause=function(){this.gifProperties&&(this.gifProperties.playing=!1)},i.default.Image.prototype.delay=function(e){this.gifProperties&&(this.gifProperties.delay=e)};var o=i.default.Image;r.default=o},{"../core/main":26,"./filters":47}],51:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=n(e("../core/main")),a=n(e("./filters"));function n(e){return e&&e.__esModule?e:{default:e}}e("../color/p5.Color"),i.default.prototype.pixels=[],i.default.prototype.blend=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a;i.default._validateParameters("blend",t),this._renderer?(a=this._renderer).blend.apply(a,t):i.default.Renderer2D.prototype.blend.apply(this,t)},i.default.prototype.copy=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var a,n,o,s,l,u,h,d,c;if(i.default._validateParameters("copy",t),9===t.length)a=t[0],n=t[1],o=t[2],s=t[3],l=t[4],u=t[5],h=t[6],d=t[7],c=t[8];else{if(8!==t.length)throw new Error("Signature not supported");a=this,n=t[0],o=t[1],s=t[2],l=t[3],u=t[4],h=t[5],d=t[6],c=t[7]}i.default.prototype._copyHelper(this,a,n,o,s,l,u,h,d,c)},i.default.prototype._copyHelper=function(e,t,r,a,n,o,s,l,u,h){t.loadPixels();var d=t.canvas.width/t.width,c=0,f=0;t._renderer&&t._renderer.isP3D&&(c=t.width/2,f=t.height/2),e._renderer&&e._renderer.isP3D?i.default.RendererGL.prototype.image.call(e._renderer,t,r+c,a+f,n,o,s,l,u,h):e.drawingContext.drawImage(t.canvas,d*(r+c),d*(a+f),d*n,d*o,s,l,u,h)},i.default.prototype.filter=function(e,t){i.default._validateParameters("filter",arguments),void 0!==this.canvas?a.default.apply(this.canvas,a.default[e],t):a.default.apply(this.elt,a.default[e],t)},i.default.prototype.get=function(e,t,r,a){var n;return i.default._validateParameters("get",arguments),(n=this._renderer).get.apply(n,arguments)},i.default.prototype.loadPixels=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.default._validateParameters("loadPixels",t),this._renderer.loadPixels()},i.default.prototype.set=function(e,t,r){this._renderer.set(e,t,r)},i.default.prototype.updatePixels=function(e,t,r,a){i.default._validateParameters("updatePixels",arguments),0!==this.pixels.length&&this._renderer.updatePixels(e,t,r,a)};var o=i.default;r.default=o},{"../color/p5.Color":18,"../core/main":26,"./filters":47}],52:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(e("../core/main"));e("whatwg-fetch"),e("es6-promise/auto");var a=o(e("fetch-jsonp")),n=o(e("file-saver"));function o(e){return e&&e.__esModule?e:{default:e}}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){var r={};if(void 0===(t=t||[]))for(var i=0;i<e.length;i++)t[i.toString()]=i;for(var a=0;a<t.length;a++){var n=t[a],o=e[a];r[n]=o}return r}function u(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function h(e,t){t&&!0!==t&&"true"!==t||(t=""),e||(e="untitled");var r="";return e&&e.includes(".")&&(r=e.split(".").pop()),t&&r!==t&&(r=t,e="".concat(e,".").concat(r)),[e,r]}e("../core/error_helpers"),i.default.prototype.loadJSON=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.default._validateParameters("loadJSON",t);for(var a,n,o,l=t[0],u={},h="json",d=1;d<t.length;d++){var c=t[d];"string"==typeof c?"jsonp"!==c&&"json"!==c||(h=c):"function"==typeof c?a?n=c:a=c:"object"===s(c)&&(c.hasOwnProperty("jsonpCallback")||c.hasOwnProperty("jsonpCallbackFunction"))&&(h="jsonp",o=c)}var f=this;return this.httpDo(l,"GET",o,h,(function(e){for(var t in e)u[t]=e[t];void 0!==a&&a(e),f._decrementPreload()}),(function(e){if(i.default._friendlyFileLoadError(5,l),!n)throw e;n(e)})),u},i.default.prototype.loadStrings=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.default._validateParameters("loadStrings",t);for(var a,n,o=[],s=1;s<t.length;s++){var l=t[s];"function"==typeof l&&(void 0===a?a=l:void 0===n&&(n=l))}var u=this;return i.default.prototype.httpDo.call(this,t[0],"GET","text",(function(e){var t=e.replace(/\r\n/g,"\r").replace(/\n/g,"\r").split(/\r/);Array.prototype.push.apply(o,t),void 0!==a&&a(o),u._decrementPreload()}),(function(e){if(i.default._friendlyFileLoadError(3,e),!n)throw e;n(e)})),o},i.default.prototype.loadTable=function(e){var t,r,a=[],n=!1,o=e.substring(e.lastIndexOf(".")+1,e.length),s=",",u=!1;"tsv"===o&&(s="\t");for(var h=1;h<arguments.length;h++)if("function"==typeof arguments[h])void 0===t?t=arguments[h]:void 0===r&&(r=arguments[h]);else if("string"==typeof arguments[h])if(a.push(arguments[h]),"header"===arguments[h]&&(n=!0),"csv"===arguments[h]){if(u)throw new Error("Cannot set multiple separator types.");s=",",u=!0}else if("tsv"===arguments[h]){if(u)throw new Error("Cannot set multiple separator types.");s="\t",u=!0}var d=new i.default.Table,c=this;return this.httpDo(e,"GET","table",(function(e){for(var r,a,o={},u=[],h=0,f=null,p=function(){o.currentState=0,o.token=""},m=function(){f.push(o.token),p()},v=function(){o.currentState=4,u.push(f),f=null};;){if(null==(r=e[h++])){if(o.escaped)throw new Error("Unclosed quote in file.");if(f){m(),v();break}}if(null===f&&(o.escaped=!1,f=[],p()),0===o.currentState){if('"'===r){o.escaped=!0,o.currentState=1;continue}o.currentState=1}if(1===o.currentState&&o.escaped)if('"'===r)'"'===e[h]?(o.token+='"',h++):(o.escaped=!1,o.currentState=2);else{if("\r"===r)continue;o.token+=r}else"\r"===r?("\n"===e[h]&&h++,m(),v()):"\n"===r?(m(),v()):r===s?m():1===o.currentState&&(o.token+=r)}if(n)d.columns=u.shift();else for(var g=0;g<u[0].length;g++)d.columns[g]="null";for(var y=0;y<u.length;y++)(1!==u[y].length||"undefined"!==u[y][0]&&""!==u[y][0])&&((a=new i.default.TableRow).arr=u[y],a.obj=l(u[y],d.columns),d.addRow(a));"function"==typeof t&&t(d),c._decrementPreload()}),(function(t){i.default._friendlyFileLoadError(2,e),r?r(t):console.error(t)})),d},i.default.prototype.loadXML=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var a,n,o=new i.default.XML,s=1;s<t.length;s++){var l=t[s];"function"==typeof l&&(void 0===a?a=l:void 0===n&&(n=l))}var u=this;return this.httpDo(t[0],"GET","xml",(function(e){for(var t in e)o[t]=e[t];void 0!==a&&a(o),u._decrementPreload()}),(function(e){if(i.default._friendlyFileLoadError(1,e),!n)throw e;n(e)})),o},i.default.prototype.loadBytes=function(e,t,r){var a={},n=this;return this.httpDo(e,"GET","arrayBuffer",(function(e){a.bytes=new Uint8Array(e),"function"==typeof t&&t(a),n._decrementPreload()}),(function(t){if(i.default._friendlyFileLoadError(6,e),!r)throw t;r(t)})),a},i.default.prototype.httpGet=function(){i.default._validateParameters("httpGet",arguments);var e=Array.prototype.slice.call(arguments);return e.splice(1,0,"GET"),i.default.prototype.httpDo.apply(this,e)},i.default.prototype.httpPost=function(){i.default._validateParameters("httpPost",arguments);var e=Array.prototype.slice.call(arguments);return e.splice(1,0,"POST"),i.default.prototype.httpDo.apply(this,e)},i.default.prototype.httpDo=function(){for(var e,t,r,n,o,l={},u=0,h="text/plain",d=arguments.length-1;0<d&&"function"==typeof(d<0||arguments.length<=d?void 0:arguments[d]);d--)u++;var c=arguments.length-u,f=arguments.length<=0?void 0:arguments[0];if(2===c&&"string"==typeof f&&"object"===s(arguments.length<=1?void 0:arguments[1]))n=new Request(f,arguments.length<=1?void 0:arguments[1]),t=arguments.length<=2?void 0:arguments[2],r=arguments.length<=3?void 0:arguments[3];else{for(var p,m="GET",v=1;v<arguments.length;v++){var g=v<0||arguments.length<=v?void 0:arguments[v];if("string"==typeof g)"GET"===g||"POST"===g||"PUT"===g||"DELETE"===g?m=g:"json"===g||"jsonp"===g||"binary"===g||"arrayBuffer"===g||"xml"===g||"text"===g||"table"===g?e=g:p=g;else if("number"==typeof g)p=g.toString();else if("object"===s(g))if(g.hasOwnProperty("jsonpCallback")||g.hasOwnProperty("jsonpCallbackFunction"))for(var y in g)l[y]=g[y];else h=g instanceof i.default.XML?(p=g.serialize(),"application/xml"):(p=JSON.stringify(g),"application/json");else"function"==typeof g&&(t?r=g:t=g)}n=new Request(f,{method:m,mode:"cors",body:p,headers:new Headers({"Content-Type":h})})}return e||(e=f.includes("json")?"json":f.includes("xml")?"xml":"text"),(o=(o="jsonp"===e?(0,a.default)(f,l):fetch(n)).then((function(t){if(!t.ok){var r=new Error(t.body);throw r.status=t.status,r.ok=!1,r}var a=0;switch("jsonp"!==e&&(a=t.headers.get("content-length")),a&&64e6<a&&i.default._friendlyFileLoadError(7,f),e){case"json":case"jsonp":return t.json();case"binary":return t.blob();case"arrayBuffer":return t.arrayBuffer();case"xml":return t.text().then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml");return new i.default.XML(t.documentElement)}));default:return t.text()}}))).then(t||function(){}),o.catch(r||console.error),o},window.URL=window.URL||window.webkitURL,i.default.prototype._pWriters=[],i.default.prototype.createWriter=function(e,t){var r;for(var a in i.default.prototype._pWriters)if(i.default.prototype._pWriters[a].name===e)return r=new i.default.PrintWriter(e+this.millis(),t),i.default.prototype._pWriters.push(r),r;return r=new i.default.PrintWriter(e,t),i.default.prototype._pWriters.push(r),r},i.default.PrintWriter=function(e,t){var r=this;this.name=e,this.content="",this.write=function(e){this.content+=e},this.print=function(e){this.content+="".concat(e,"\n")},this.clear=function(){this.content=""},this.close=function(){var a=[];for(var n in a.push(this.content),i.default.prototype.writeFile(a,e,t),i.default.prototype._pWriters)i.default.prototype._pWriters[n].name===this.name&&i.default.prototype._pWriters.splice(n,1);r.clear(),r={}}},i.default.prototype.save=function(e,t,r){var a=arguments,n=this._curElement?this._curElement.elt:this.elt;if(0!==a.length)if(a[0]instanceof i.default.Renderer||a[0]instanceof i.default.Graphics)i.default.prototype.saveCanvas(a[0].elt,a[1],a[2]);else if(1===a.length&&"string"==typeof a[0])i.default.prototype.saveCanvas(n,a[0]);else switch(h(a[1],a[2])[1]){case"json":return void i.default.prototype.saveJSON(a[0],a[1],a[2]);case"txt":return void i.default.prototype.saveStrings(a[0],a[1],a[2]);default:a[0]instanceof Array?i.default.prototype.saveStrings(a[0],a[1],a[2]):a[0]instanceof i.default.Table?i.default.prototype.saveTable(a[0],a[1],a[2]):a[0]instanceof i.default.Image?i.default.prototype.saveCanvas(a[0].canvas,a[1]):a[0]instanceof i.default.SoundFile&&i.default.prototype.saveSound(a[0],a[1],a[2],a[3])}else i.default.prototype.saveCanvas(n)},i.default.prototype.saveJSON=function(e,t,r){var a;i.default._validateParameters("saveJSON",arguments),a=r?JSON.stringify(e):JSON.stringify(e,void 0,2),this.saveStrings(a.split("\n"),t,"json")},i.default.prototype.saveJSONObject=i.default.prototype.saveJSON,i.default.prototype.saveJSONArray=i.default.prototype.saveJSON,i.default.prototype.saveStrings=function(e,t,r){i.default._validateParameters("saveStrings",arguments);for(var a=r||"txt",n=this.createWriter(t,a),o=0;o<e.length;o++)e.length,n.print(e[o]);n.close(),n.clear()},i.default.prototype.saveTable=function(e,t,r){var a;i.default._validateParameters("saveTable",arguments),a=void 0===r?t.substring(t.lastIndexOf(".")+1,t.length):r;var n=this.createWriter(t,a),o=e.columns,s=",";if("tsv"===a&&(s="\t"),"html"!==a){if("0"!==o[0]){for(var l=0;l<o.length;l++)l<o.length-1?n.write(o[l]+s):n.write(o[l]);n.write("\n")}for(var h=0;h<e.rows.length;h++){var d=void 0;for(d=0;d<e.rows[h].arr.length;d++)d<e.rows[h].arr.length-1?n.write(e.rows[h].arr[d]+s):(e.rows.length,n.write(e.rows[h].arr[d]));n.write("\n")}}else{if(n.print("<html>"),n.print("<head>"),n.print('  <meta http-equiv="content-type" content="text/html;charset=utf-8" />'),n.print("</head>"),n.print("<body>"),n.print("  <table>"),"0"!==o[0]){n.print("    <tr>");for(var c=0;c<o.length;c++){var f=u(o[c]);n.print("      <td>".concat(f)),n.print("      </td>")}n.print("    </tr>")}for(var p=0;p<e.rows.length;p++){n.print("    <tr>");for(var m=0;m<e.columns.length;m++){var v=u(e.rows[p].getString(m));n.print("      <td>".concat(v)),n.print("      </td>")}n.print("    </tr>")}n.print("  </table>"),n.print("</body>"),n.print("</html>")}n.close(),n.clear()},i.default.prototype.writeFile=function(e,t,r){var a="application/octet-stream";i.default.prototype._isSafari()&&(a="text/plain");var n=new Blob(e,{type:a});i.default.prototype.downloadFile(n,t,r)},i.default.prototype.downloadFile=function(e,t,r){var a=h(t,r),o=a[0];if(e instanceof Blob)n.default.saveAs(e,o);else{var s=document.createElement("a");if(s.href=e,s.download=o,s.onclick=function(e){var t;t=e,document.body.removeChild(t.target),e.stopPropagation()},s.style.display="none",document.body.appendChild(s),i.default.prototype._isSafari()){var l="Hello, Safari user! To download this file...\n";l+="1. Go to File --\x3e Save As.\n",l+='2. Choose "Page Source" as the Format.\n',l+='3. Name it with this extension: ."'.concat(a[1],'"'),alert(l)}s.click()}},i.default.prototype._checkFileExtension=h,i.default.prototype._isSafari=function(){return 0<Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")};var d=i.default;r.default=d},{"../core/error_helpers":22,"../core/main":26,"es6-promise/auto":4,"fetch-jsonp":6,"file-saver":7,"whatwg-fetch":14}],53:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.Table=function(e){this.columns=[],this.rows=[]},a.default.Table.prototype.addRow=function(e){var t=e||new a.default.TableRow;if(void 0===t.arr||void 0===t.obj)throw new Error("invalid TableRow: ".concat(t));return(t.table=this).rows.push(t),t},a.default.Table.prototype.removeRow=function(e){this.rows[e].table=null;var t=this.rows.splice(e+1,this.rows.length);this.rows.pop(),this.rows=this.rows.concat(t)},a.default.Table.prototype.getRow=function(e){return this.rows[e]},a.default.Table.prototype.getRows=function(){return this.rows},a.default.Table.prototype.findRow=function(e,t){if("string"==typeof t){for(var r=0;r<this.rows.length;r++)if(this.rows[r].obj[t]===e)return this.rows[r]}else for(var i=0;i<this.rows.length;i++)if(this.rows[i].arr[t]===e)return this.rows[i];return null},a.default.Table.prototype.findRows=function(e,t){var r=[];if("string"==typeof t)for(var i=0;i<this.rows.length;i++)this.rows[i].obj[t]===e&&r.push(this.rows[i]);else for(var a=0;a<this.rows.length;a++)this.rows[a].arr[t]===e&&r.push(this.rows[a]);return r},a.default.Table.prototype.matchRow=function(e,t){if("number"==typeof t){for(var r=0;r<this.rows.length;r++)if(this.rows[r].arr[t].match(e))return this.rows[r]}else for(var i=0;i<this.rows.length;i++)if(this.rows[i].obj[t].match(e))return this.rows[i];return null},a.default.Table.prototype.matchRows=function(e,t){var r=[];if("number"==typeof t)for(var i=0;i<this.rows.length;i++)this.rows[i].arr[t].match(e)&&r.push(this.rows[i]);else for(var a=0;a<this.rows.length;a++)this.rows[a].obj[t].match(e)&&r.push(this.rows[a]);return r},a.default.Table.prototype.getColumn=function(e){var t=[];if("string"==typeof e)for(var r=0;r<this.rows.length;r++)t.push(this.rows[r].obj[e]);else for(var i=0;i<this.rows.length;i++)t.push(this.rows[i].arr[e]);return t},a.default.Table.prototype.clearRows=function(){delete this.rows,this.rows=[]},a.default.Table.prototype.addColumn=function(e){var t=e||null;this.columns.push(t)},a.default.Table.prototype.getColumnCount=function(){return this.columns.length},a.default.Table.prototype.getRowCount=function(){return this.rows.length},a.default.Table.prototype.removeTokens=function(e,t){for(var r=[],i=0;i<e.length;i++)r.push(e.charAt(i).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"));var a=new RegExp(r.join("|"),"g");if(void 0===t)for(var n=0;n<this.columns.length;n++)for(var o=0;o<this.rows.length;o++){var s=this.rows[o].arr[n];s=s.replace(a,""),this.rows[o].arr[n]=s,this.rows[o].obj[this.columns[n]]=s}else if("string"==typeof t)for(var l=0;l<this.rows.length;l++){var u=this.rows[l].obj[t];u=u.replace(a,""),this.rows[l].obj[t]=u;var h=this.columns.indexOf(t);this.rows[l].arr[h]=u}else for(var d=0;d<this.rows.length;d++){var c=this.rows[d].arr[t];c=c.replace(a,""),this.rows[d].arr[t]=c,this.rows[d].obj[this.columns[t]]=c}},a.default.Table.prototype.trim=function(e){var t=new RegExp(" ","g");if(void 0===e)for(var r=0;r<this.columns.length;r++)for(var i=0;i<this.rows.length;i++){var a=this.rows[i].arr[r];a=a.replace(t,""),this.rows[i].arr[r]=a,this.rows[i].obj[this.columns[r]]=a}else if("string"==typeof e)for(var n=0;n<this.rows.length;n++){var o=this.rows[n].obj[e];o=o.replace(t,""),this.rows[n].obj[e]=o;var s=this.columns.indexOf(e);this.rows[n].arr[s]=o}else for(var l=0;l<this.rows.length;l++){var u=this.rows[l].arr[e];u=u.replace(t,""),this.rows[l].arr[e]=u,this.rows[l].obj[this.columns[e]]=u}},a.default.Table.prototype.removeColumn=function(e){var t,r;"string"==typeof e?(t=e,r=this.columns.indexOf(e)):(r=e,t=this.columns[e]);var i=this.columns.splice(r+1,this.columns.length);this.columns.pop(),this.columns=this.columns.concat(i);for(var a=0;a<this.rows.length;a++){var n=this.rows[a].arr,o=n.splice(r+1,n.length);n.pop(),this.rows[a].arr=n.concat(o),delete this.rows[a].obj[t]}},a.default.Table.prototype.set=function(e,t,r){this.rows[e].set(t,r)},a.default.Table.prototype.setNum=function(e,t,r){this.rows[e].setNum(t,r)},a.default.Table.prototype.setString=function(e,t,r){this.rows[e].setString(t,r)},a.default.Table.prototype.get=function(e,t){return this.rows[e].get(t)},a.default.Table.prototype.getNum=function(e,t){return this.rows[e].getNum(t)},a.default.Table.prototype.getString=function(e,t){return this.rows[e].getString(t)},a.default.Table.prototype.getObject=function(e){for(var t,r={},i=0;i<this.rows.length;i++)if(t=this.rows[i].obj,"string"==typeof e){if(!(0<=this.columns.indexOf(e)))throw new Error('This table has no column named "'.concat(e,'"'));r[t[e]]=t}else r[i]=this.rows[i].obj;return r},a.default.Table.prototype.getArray=function(){for(var e=[],t=0;t<this.rows.length;t++)e.push(this.rows[t].arr);return e};var n=a.default;r.default=n},{"../core/main":26}],54:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.TableRow=function(e,t){var r=[],i={};e&&(t=t||",",r=e.split(t));for(var a=0;a<r.length;a++){var n=a,o=r[a];i[n]=o}this.arr=r,this.obj=i,this.table=null},a.default.TableRow.prototype.set=function(e,t){if("string"==typeof e){var r=this.table.columns.indexOf(e);if(!(0<=r))throw new Error('This table has no column named "'.concat(e,'"'));this.obj[e]=t,this.arr[r]=t}else{if(!(e<this.table.columns.length))throw new Error("Column #".concat(e," is out of the range of this table"));this.arr[e]=t;var i=this.table.columns[e];this.obj[i]=t}},a.default.TableRow.prototype.setNum=function(e,t){var r=parseFloat(t);this.set(e,r)},a.default.TableRow.prototype.setString=function(e,t){var r=t.toString();this.set(e,r)},a.default.TableRow.prototype.get=function(e){return"string"==typeof e?this.obj[e]:this.arr[e]},a.default.TableRow.prototype.getNum=function(e){var t;if("NaN"===(t="string"==typeof e?parseFloat(this.obj[e]):parseFloat(this.arr[e])).toString())throw"Error: ".concat(this.obj[e]," is NaN (Not a Number)");return t},a.default.TableRow.prototype.getString=function(e){return"string"==typeof e?this.obj[e].toString():this.arr[e].toString()};var n=a.default;r.default=n},{"../core/main":26}],55:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.XML=function(e){if(e)this.DOM=e;else{var t=document.implementation.createDocument(null,"doc");this.DOM=t.createElement("root")}},a.default.XML.prototype.getParent=function(){return new a.default.XML(this.DOM.parentElement)},a.default.XML.prototype.getName=function(){return this.DOM.tagName},a.default.XML.prototype.setName=function(e){var t=this.DOM.innerHTML,r=this.DOM.attributes,i=document.implementation.createDocument(null,"default").createElement(e);i.innerHTML=t;for(var a=0;a<r.length;a++)i.setAttribute(r[a].nodeName,r.nodeValue);this.DOM=i},a.default.XML.prototype.hasChildren=function(){return 0<this.DOM.children.length},a.default.XML.prototype.listChildren=function(){for(var e=[],t=0;t<this.DOM.childNodes.length;t++)e.push(this.DOM.childNodes[t].nodeName);return e},a.default.XML.prototype.getChildren=function(e){return function(e){for(var t=[],r=0;r<e.length;r++)t.push(new a.default.XML(e[r]));return t}(e?this.DOM.getElementsByTagName(e):this.DOM.children)},a.default.XML.prototype.getChild=function(e){if("string"!=typeof e)return new a.default.XML(this.DOM.children[e]);var t=!0,r=!1,i=void 0;try{for(var n,o=this.DOM.children[Symbol.iterator]();!(t=(n=o.next()).done);t=!0){var s=n.value;if(s.tagName===e)return new a.default.XML(s)}}catch(e){r=!0,i=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw i}}},a.default.XML.prototype.addChild=function(e){e instanceof a.default.XML&&this.DOM.appendChild(e.DOM)},a.default.XML.prototype.removeChild=function(e){var t=-1;if("string"==typeof e){for(var r=0;r<this.DOM.children.length;r++)if(this.DOM.children[r].tagName===e){t=r;break}}else t=e;-1!==t&&this.DOM.removeChild(this.DOM.children[t])},a.default.XML.prototype.getAttributeCount=function(){return this.DOM.attributes.length},a.default.XML.prototype.listAttributes=function(){var e=[],t=!0,r=!1,i=void 0;try{for(var a,n=this.DOM.attributes[Symbol.iterator]();!(t=(a=n.next()).done);t=!0){var o=a.value;e.push(o.nodeName)}}catch(e){r=!0,i=e}finally{try{t||null==n.return||n.return()}finally{if(r)throw i}}return e},a.default.XML.prototype.hasAttribute=function(e){var t={},r=!0,i=!1,a=void 0;try{for(var n,o=this.DOM.attributes[Symbol.iterator]();!(r=(n=o.next()).done);r=!0){var s=n.value;t[s.nodeName]=s.nodeValue}}catch(e){i=!0,a=e}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return!!t[e]},a.default.XML.prototype.getNum=function(e,t){var r={},i=!0,a=!1,n=void 0;try{for(var o,s=this.DOM.attributes[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var l=o.value;r[l.nodeName]=l.nodeValue}}catch(e){a=!0,n=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw n}}return Number(r[e])||t||0},a.default.XML.prototype.getString=function(e,t){var r={},i=!0,a=!1,n=void 0;try{for(var o,s=this.DOM.attributes[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var l=o.value;r[l.nodeName]=l.nodeValue}}catch(e){a=!0,n=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw n}}return r[e]?String(r[e]):t||null},a.default.XML.prototype.setAttribute=function(e,t){this.DOM.setAttribute(e,t)},a.default.XML.prototype.getContent=function(e){return this.DOM.textContent.replace(/\s\s+/g,",")||e||null},a.default.XML.prototype.setContent=function(e){this.DOM.children.length||(this.DOM.textContent=e)},a.default.XML.prototype.serialize=function(){return(new XMLSerializer).serializeToString(this.DOM)};var n=a.default;r.default=n},{"../core/main":26}],56:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};function n(e,t,r){if("function"==typeof Math.hypot)return Math.hypot.apply(null,arguments);for(var i=arguments.length,a=[],n=0,o=0;o<i;o++){var s=arguments[o];if((s=+s)==1/0||s===-1/0)return 1/0;n<(s=Math.abs(s))&&(n=s),a[o]=s}0===n&&(n=1);for(var l=0,u=0,h=0;h<i;h++){var d=a[h]/n,c=d*d-u,f=l+c;u=f-l-c,l=f}return Math.sqrt(l)*n}a.default.prototype.abs=Math.abs,a.default.prototype.ceil=Math.ceil,a.default.prototype.constrain=function(e,t,r){return a.default._validateParameters("constrain",arguments),Math.max(Math.min(e,r),t)},a.default.prototype.dist=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a.default._validateParameters("dist",t),4===t.length?n(t[2]-t[0],t[3]-t[1]):6===t.length?n(t[3]-t[0],t[4]-t[1],t[5]-t[2]):void 0},a.default.prototype.exp=Math.exp,a.default.prototype.floor=Math.floor,a.default.prototype.lerp=function(e,t,r){return a.default._validateParameters("lerp",arguments),r*(t-e)+e},a.default.prototype.log=Math.log,a.default.prototype.mag=function(e,t){return a.default._validateParameters("mag",arguments),n(e,t)},a.default.prototype.map=function(e,t,r,i,n,o){a.default._validateParameters("map",arguments);var s=(e-t)/(r-t)*(n-i)+i;return o?i<n?this.constrain(s,i,n):this.constrain(s,n,i):s},a.default.prototype.max=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a.default._validateParameters("max",t),t[0]instanceof Array?Math.max.apply(null,t[0]):Math.max.apply(null,t)},a.default.prototype.min=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a.default._validateParameters("min",t),t[0]instanceof Array?Math.min.apply(null,t[0]):Math.min.apply(null,t)},a.default.prototype.norm=function(e,t,r){return a.default._validateParameters("norm",arguments),this.map(e,t,r,0,1)},a.default.prototype.pow=Math.pow,a.default.prototype.round=Math.round,a.default.prototype.sq=function(e){return e*e},a.default.prototype.sqrt=Math.sqrt;var o=a.default;r.default=o},{"../core/main":26}],57:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.createVector=function(e,t,r){return this instanceof a.default?new a.default.Vector(this,arguments):new a.default.Vector(e,t,r)};var n=a.default;r.default=n},{"../core/main":26}],58:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a,n=(i=e("../core/main"))&&i.__esModule?i:{default:i},o=4095,s=4,l=.5,u=function(e){return.5*(1-Math.cos(e*Math.PI))};n.default.prototype.noise=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(null==a){a=new Array(4096);for(var i=0;i<4096;i++)a[i]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),r<0&&(r=-r);for(var n,h,d,c,f,p=Math.floor(e),m=Math.floor(t),v=Math.floor(r),g=e-p,y=t-m,_=r-v,b=0,x=.5,w=0;w<s;w++){var S=p+(m<<4)+(v<<8);n=u(g),h=u(y),d=a[S&o],d+=n*(a[S+1&o]-d),c=a[S+16&o],d+=h*((c+=n*(a[S+16+1&o]-c))-d),c=a[(S+=256)&o],c+=n*(a[S+1&o]-c),f=a[S+16&o],c+=h*((f+=n*(a[S+16+1&o]-f))-c),b+=(d+=u(_)*(c-d))*x,x*=l,p<<=1,m<<=1,v<<=1,1<=(g*=2)&&(p++,g--),1<=(y*=2)&&(m++,y--),1<=(_*=2)&&(v++,_--)}return b},n.default.prototype.noiseDetail=function(e,t){0<e&&(s=e),0<t&&(l=t)},n.default.prototype.noiseSeed=function(e){var t,r,i,n=(i=4294967296,{setSeed:function(e){r=t=(null==e?Math.random()*i:e)>>>0},getSeed:function(){return t},rand:function(){return(r=(1664525*r+1013904223)%i)/i}});n.setSeed(e),a=new Array(4096);for(var o=0;o<4096;o++)a[o]=n.rand()};var h=n.default;r.default=h},{"../core/main":26}],59:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));a.default.Vector=function(){var e,t,r;r=arguments[0]instanceof a.default?(this.p5=arguments[0],e=arguments[1][0]||0,t=arguments[1][1]||0,arguments[1][2]||0):(e=arguments[0]||0,t=arguments[1]||0,arguments[2]||0),this.x=e,this.y=t,this.z=r},a.default.Vector.prototype.toString=function(){return"p5.Vector Object : [".concat(this.x,", ").concat(this.y,", ").concat(this.z,"]")},a.default.Vector.prototype.set=function(e,t,r){return e instanceof a.default.Vector?(this.x=e.x||0,this.y=e.y||0,this.z=e.z||0):e instanceof Array?(this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0):(this.x=e||0,this.y=t||0,this.z=r||0),this},a.default.Vector.prototype.copy=function(){return this.p5?new a.default.Vector(this.p5,[this.x,this.y,this.z]):new a.default.Vector(this.x,this.y,this.z)},a.default.Vector.prototype.add=function(e,t,r){return e instanceof a.default.Vector?(this.x+=e.x||0,this.y+=e.y||0,this.z+=e.z||0):e instanceof Array?(this.x+=e[0]||0,this.y+=e[1]||0,this.z+=e[2]||0):(this.x+=e||0,this.y+=t||0,this.z+=r||0),this},a.default.Vector.prototype.sub=function(e,t,r){return e instanceof a.default.Vector?(this.x-=e.x||0,this.y-=e.y||0,this.z-=e.z||0):e instanceof Array?(this.x-=e[0]||0,this.y-=e[1]||0,this.z-=e[2]||0):(this.x-=e||0,this.y-=t||0,this.z-=r||0),this},a.default.Vector.prototype.mult=function(e){return"number"==typeof e&&isFinite(e)?(this.x*=e,this.y*=e,this.z*=e):console.warn("p5.Vector.prototype.mult:","n is undefined or not a finite number"),this},a.default.Vector.prototype.div=function(e){return"number"==typeof e&&isFinite(e)?0===e?console.warn("p5.Vector.prototype.div:","divide by 0"):(this.x/=e,this.y/=e,this.z/=e):console.warn("p5.Vector.prototype.div:","n is undefined or not a finite number"),this},a.default.Vector.prototype.mag=function(){return Math.sqrt(this.magSq())},a.default.Vector.prototype.magSq=function(){var e=this.x,t=this.y,r=this.z;return e*e+t*t+r*r},a.default.Vector.prototype.dot=function(e,t,r){return e instanceof a.default.Vector?this.dot(e.x,e.y,e.z):this.x*(e||0)+this.y*(t||0)+this.z*(r||0)},a.default.Vector.prototype.cross=function(e){var t=this.y*e.z-this.z*e.y,r=this.z*e.x-this.x*e.z,i=this.x*e.y-this.y*e.x;return this.p5?new a.default.Vector(this.p5,[t,r,i]):new a.default.Vector(t,r,i)},a.default.Vector.prototype.dist=function(e){return e.copy().sub(this).mag()},a.default.Vector.prototype.normalize=function(){var e=this.mag();return 0!==e&&this.mult(1/e),this},a.default.Vector.prototype.limit=function(e){var t=this.magSq();return e*e<t&&this.div(Math.sqrt(t)).mult(e),this},a.default.Vector.prototype.setMag=function(e){return this.normalize().mult(e)},a.default.Vector.prototype.heading=function(){var e=Math.atan2(this.y,this.x);return this.p5?this.p5._fromRadians(e):e},a.default.Vector.prototype.rotate=function(e){var t=this.heading()+e;this.p5&&(t=this.p5._toRadians(t));var r=this.mag();return this.x=Math.cos(t)*r,this.y=Math.sin(t)*r,this},a.default.Vector.prototype.angleBetween=function(e){var t,r=this.dot(e)/(this.mag()*e.mag());return t=Math.acos(Math.min(1,Math.max(-1,r))),t*=Math.sign(this.cross(e).z||1),this.p5&&(t=this.p5._fromRadians(t)),t},a.default.Vector.prototype.lerp=function(e,t,r,i){return e instanceof a.default.Vector?this.lerp(e.x,e.y,e.z,t):(this.x+=(e-this.x)*i||0,this.y+=(t-this.y)*i||0,this.z+=(r-this.z)*i||0,this)},a.default.Vector.prototype.array=function(){return[this.x||0,this.y||0,this.z||0]},a.default.Vector.prototype.equals=function(e,t,r){var i,n,o;return o=e instanceof a.default.Vector?(i=e.x||0,n=e.y||0,e.z||0):e instanceof Array?(i=e[0]||0,n=e[1]||0,e[2]||0):(i=e||0,n=t||0,r||0),this.x===i&&this.y===n&&this.z===o},a.default.Vector.fromAngle=function(e,t){return void 0===t&&(t=1),new a.default.Vector(t*Math.cos(e),t*Math.sin(e),0)},a.default.Vector.fromAngles=function(e,t,r){void 0===r&&(r=1);var i=Math.cos(t),n=Math.sin(t),o=Math.cos(e),s=Math.sin(e);return new a.default.Vector(r*s*n,-r*o,r*s*i)},a.default.Vector.random2D=function(){return this.fromAngle(Math.random()*n.TWO_PI)},a.default.Vector.random3D=function(){var e=Math.random()*n.TWO_PI,t=2*Math.random()-1,r=Math.sqrt(1-t*t),i=r*Math.cos(e),o=r*Math.sin(e);return new a.default.Vector(i,o,t)},a.default.Vector.add=function(e,t,r){return r?r.set(e):r=e.copy(),r.add(t),r},a.default.Vector.sub=function(e,t,r){return r?r.set(e):r=e.copy(),r.sub(t),r},a.default.Vector.mult=function(e,t,r){return r?r.set(e):r=e.copy(),r.mult(t),r},a.default.Vector.div=function(e,t,r){return r?r.set(e):r=e.copy(),r.div(t),r},a.default.Vector.dot=function(e,t){return e.dot(t)},a.default.Vector.cross=function(e,t){return e.cross(t)},a.default.Vector.dist=function(e,t){return e.dist(t)},a.default.Vector.lerp=function(e,t,r,i){return i?i.set(e):i=e.copy(),i.lerp(t,r),i},a.default.Vector.mag=function(e){var t=e.x,r=e.y,i=e.z,a=t*t+r*r+i*i;return Math.sqrt(a)};var o=a.default.Vector;r.default=o},{"../core/constants":20,"../core/main":26}],60:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n="_lcg_random_state",o=4294967296,s=0;a.default.prototype._lcg=function(e){return this[e]=(1664525*this[e]+1013904223)%o,this[e]/o},a.default.prototype._lcgSetSeed=function(e,t){this[e]=(null==t?Math.random()*o:t)>>>0},a.default.prototype.randomSeed=function(e){this._lcgSetSeed(n,e),this._gaussian_previous=!1},a.default.prototype.random=function(e,t){var r;if(a.default._validateParameters("random",arguments),r=null!=this[n]?this._lcg(n):Math.random(),void 0===e)return r;if(void 0===t)return e instanceof Array?e[Math.floor(r*e.length)]:r*e;if(t<e){var i=e;e=t,t=i}return r*(t-e)+e},a.default.prototype.randomGaussian=function(e,t){var r,i,a,n;if(this._gaussian_previous)r=s,this._gaussian_previous=!1;else{for(;1<=(n=(i=this.random(2)-1)*i+(a=this.random(2)-1)*a););r=i*(n=Math.sqrt(-2*Math.log(n)/n)),s=a*n,this._gaussian_previous=!0}return r*(t||1)+(e||0)};var l=a.default;r.default=l},{"../core/main":26}],61:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));a.default.prototype._angleMode=n.RADIANS,a.default.prototype.acos=function(e){return this._fromRadians(Math.acos(e))},a.default.prototype.asin=function(e){return this._fromRadians(Math.asin(e))},a.default.prototype.atan=function(e){return this._fromRadians(Math.atan(e))},a.default.prototype.atan2=function(e,t){return this._fromRadians(Math.atan2(e,t))},a.default.prototype.cos=function(e){return Math.cos(this._toRadians(e))},a.default.prototype.sin=function(e){return Math.sin(this._toRadians(e))},a.default.prototype.tan=function(e){return Math.tan(this._toRadians(e))},a.default.prototype.degrees=function(e){return e*n.RAD_TO_DEG},a.default.prototype.radians=function(e){return e*n.DEG_TO_RAD},a.default.prototype.angleMode=function(e){e!==n.DEGREES&&e!==n.RADIANS||(this._angleMode=e)},a.default.prototype._toRadians=function(e){return this._angleMode===n.DEGREES?e*n.DEG_TO_RAD:e},a.default.prototype._toDegrees=function(e){return this._angleMode===n.RADIANS?e*n.RAD_TO_DEG:e},a.default.prototype._fromRadians=function(e){return this._angleMode===n.DEGREES?e*n.RAD_TO_DEG:e};var o=a.default;r.default=o},{"../core/constants":20,"../core/main":26}],62:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.textAlign=function(e,t){var r;return a.default._validateParameters("textAlign",arguments),(r=this._renderer).textAlign.apply(r,arguments)},a.default.prototype.textLeading=function(e){var t;return a.default._validateParameters("textLeading",arguments),(t=this._renderer).textLeading.apply(t,arguments)},a.default.prototype.textSize=function(e){var t;return a.default._validateParameters("textSize",arguments),(t=this._renderer).textSize.apply(t,arguments)},a.default.prototype.textStyle=function(e){var t;return a.default._validateParameters("textStyle",arguments),(t=this._renderer).textStyle.apply(t,arguments)},a.default.prototype.textWidth=function(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return r[0]+="",a.default._validateParameters("textWidth",r),0===r[0].length?0:(e=this._renderer).textWidth.apply(e,r)},a.default.prototype.textAscent=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a.default._validateParameters("textAscent",t),this._renderer.textAscent()},a.default.prototype.textDescent=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a.default._validateParameters("textDescent",t),this._renderer.textDescent()},a.default.prototype._updateTextMetrics=function(){return this._renderer._updateTextMetrics()};var n=a.default;r.default=n},{"../core/main":26}],63:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=s(e("../core/constants")),o=s(e("opentype.js"));function s(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}e("../core/error_helpers"),a.default.prototype.loadFont=function(e,t,r){a.default._validateParameters("loadFont",arguments);var i=new a.default.Font(this),n=this;return o.load(e,(function(o,s){if(o)return a.default._friendlyFileLoadError(4,e),void 0!==r?r(o):void console.error(o,e);i.font=s,void 0!==t&&t(i),n._decrementPreload();var l,u,h=e.split("\\").pop().split("/").pop(),d=h.lastIndexOf("."),c=d<1?null:h.substr(d+1);["ttf","otf","woff","woff2"].includes(c)&&(l=h.substr(0,d),(u=document.createElement("style")).appendChild(document.createTextNode("\n@font-face {\nfont-family: ".concat(l,";\nsrc: url(").concat(e,");\n}\n"))),document.head.appendChild(u))})),i},a.default.prototype.text=function(e,t,r,i,n){var o;return a.default._validateParameters("text",arguments),this._renderer._doFill||this._renderer._doStroke?(o=this._renderer).text.apply(o,arguments):this},a.default.prototype.textFont=function(e,t){if(a.default._validateParameters("textFont",arguments),arguments.length){if(!e)throw new Error("null font passed to textFont");return this._renderer._setProperty("_textFont",e),t&&(this._renderer._setProperty("_textSize",t),this._renderer._setProperty("_textLeading",t*n._DEFAULT_LEADMULT)),this._renderer._applyTextProperties()}return this._renderer._textFont};var l=a.default;r.default=l},{"../core/constants":20,"../core/error_helpers":22,"../core/main":26,"opentype.js":11}],64:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var r=function(e,t){if("object"!==o(e))e=t;else for(var r in t)void 0===e[r]&&(e[r]=t[r]);return e}(t,{sampleFactor:.1,simplifyThreshold:0}),i=p(e,0,1),a=i/(i*r.sampleFactor),n=[],s=0;s<i;s+=a)n.push(p(e,s));return r.simplifyThreshold&&function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=e.length-1;3<e.length&&0<=r;--r)d(h(e,r-1),h(e,r),h(e,r+1),t)&&e.splice(r%e.length,1)}(n,r.simplifyThreshold),n}function l(e){for(var t,r=[],i=0;i<e.length;i++)"M"===e[i].type&&(t&&r.push(t),t=[]),t.push(u(e[i]));return r.push(t),r}function u(e){var t=[e.type];return"M"===e.type||"L"===e.type?t.push(e.x,e.y):"C"===e.type?t.push(e.x1,e.y1,e.x2,e.y2,e.x,e.y):"Q"===e.type&&t.push(e.x1,e.y1,e.x,e.y),t}function h(e,t){var r=e.length;return e[t<0?t%r+r:t%r]}function d(e,t,r,i){if(!i)return 0==(a=e,o=r,((n=t)[0]-a[0])*(o[1]-a[1])-(o[0]-a[0])*(n[1]-a[1]));var a,n,o;void 0===d.tmpPoint1&&(d.tmpPoint1=[],d.tmpPoint2=[]);var s=d.tmpPoint1,l=d.tmpPoint2;s.x=t.x-e.x,s.y=t.y-e.y,l.x=r.x-t.x,l.y=r.y-t.y;var u=s.x*l.x+s.y*l.y,h=Math.sqrt(s.x*s.x+s.y*s.y),c=Math.sqrt(l.x*l.x+l.y*l.y);return Math.acos(u/(h*c))<i}function c(e,t,r,i,a,n,o,s,l){var u=1-l,h=Math.pow(u,3),d=Math.pow(u,2),c=l*l,f=c*l,p=h*e+3*d*l*r+3*u*l*l*a+f*o,m=h*t+3*d*l*i+3*u*l*l*n+f*s,v=e+2*l*(r-e)+c*(a-2*r+e),g=t+2*l*(i-t)+c*(n-2*i+t),y=r+2*l*(a-r)+c*(o-2*a+r),_=i+2*l*(n-i)+c*(s-2*n+i),b=u*e+l*r,x=u*t+l*i,w=u*a+l*o,S=u*n+l*s,M=90-180*Math.atan2(v-y,g-_)/Math.PI;return(y<v||g<_)&&(M+=180),{x:p,y:m,m:{x:v,y:g},n:{x:y,y:_},start:{x:b,y:x},end:{x:w,y:S},alpha:M}}function f(e,t,r,i,a,n,o,s,l){return null==l?_(e,t,r,i,a,n,o,s):c(e,t,r,i,a,n,o,s,function(e,t,r,i,a,n,o,s,l){if(!(l<0||_(e,t,r,i,a,n,o,s)<l)){var u,h=.5,d=1-h;for(u=_(e,t,r,i,a,n,o,s,d);.01<Math.abs(u-l);)u=_(e,t,r,i,a,n,o,s,d+=(u<l?1:-1)*(h/=2));return d}}(e,t,r,i,a,n,o,s,l))}function p(e,t,r){for(var i,a,n,o,s,l=0,u=0,h=(e=function(e,t){var r,i=m(e),a=t,n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=[],l=[],u=function(e,t,r){var i,a;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(e[0]in{T:1,Q:1}||(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(function e(t,r,i,a,n,o,s,l,u,h){var d,c,f,p,m,v=Math.PI,g=120*v/180,y=v/180*(+n||0),_=[],b=function(e,t,r){return{x:e*Math.cos(r)-t*Math.sin(r),y:e*Math.sin(r)+t*Math.cos(r)}};if(h)d=h[0],c=h[1],f=h[2],p=h[3];else{t=(m=b(t,r,-y)).x,r=m.y;var x=(t-(l=(m=b(l,u,-y)).x))/2,w=(r-(u=m.y))/2,S=x*x/(i*i)+w*w/(a*a);1<S&&(i*=S=Math.sqrt(S),a*=S);var M=i*i,E=a*a,T=(o===s?-1:1)*Math.sqrt(Math.abs((M*E-M*w*w-E*x*x)/(M*w*w+E*x*x)));f=T*i*w/a+(t+l)/2,p=T*-a*x/i+(r+u)/2,d=Math.asin(((r-p)/a).toFixed(9)),c=Math.asin(((u-p)/a).toFixed(9)),(d=t<f?v-d:d)<0&&(d=2*v+d),(c=l<f?v-c:c)<0&&(c=2*v+c),s&&c<d&&(d-=2*v),!s&&d<c&&(c-=2*v)}var C=c-d;if(Math.abs(C)>g){var P=c,L=l,R=u;c=d+g*(s&&d<c?1:-1),_=e(l=f+i*Math.cos(c),u=p+a*Math.sin(c),i,a,n,0,s,L,R,[c,P,f,p])}C=c-d;var O=Math.cos(d),D=Math.sin(d),A=Math.cos(c),I=Math.sin(c),k=Math.tan(C/4),U=4/3*i*k,F=4/3*a*k,N=[t,r],B=[t+U*D,r-F*O],G=[l+U*I,u-F*A],j=[l,u];if(B[0]=2*N[0]-B[0],B[1]=2*N[1]-B[1],h)return[B,G,j].concat(_);for(var V=[],z=0,H=(_=[B,G,j].concat(_).join().split(",")).length;z<H;z++)V[z]=z%2?b(_[z-1],_[z],y).y:b(_[z],_[z+1],y).x;return V}.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":a="C"===r||"S"===r?(i=2*t.x-t.bx,2*t.y-t.by):(i=t.x,t.y),e=["C",i,a].concat(e.slice(1));break;case"T":t.qy="Q"===r||"T"===r?(t.qx=2*t.x-t.qx,2*t.y-t.qy):(t.qx=t.x,t.y),e=["C"].concat(y(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(y(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(g(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(g(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(g(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(g(t.x,t.y,t.X,t.Y))}return e},h=function(e,t){if(7<e[t].length){e[t].shift();for(var n=e[t];n.length;)s[t]="A",a&&(l[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),r=Math.max(i.length,a&&a.length||0)}},d=function(e,t,n,o,s){e&&t&&"M"===e[s][0]&&"M"!==t[s][0]&&(t.splice(s,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=e[s][1],n.y=e[s][2],r=Math.max(i.length,a&&a.length||0))},c="",f="";r=Math.max(i.length,a&&a.length||0);for(var p=0;p<r;p++){i[p]&&(c=i[p][0]),"C"!==c&&(s[p]=c,p&&(f=s[p-1])),i[p]=u(i[p],n,f),"A"!==s[p]&&"C"===c&&(s[p]="C"),h(i,p),a&&(a[p]&&(c=a[p][0]),"C"!==c&&(l[p]=c,p&&(f=l[p-1])),a[p]=u(a[p],o,f),"A"!==l[p]&&"C"===c&&(l[p]="C"),h(a,p)),d(i,a,n,o,p),d(a,i,o,n,p);var v=i[p],_=a&&a[p],b=v.length,x=a&&_.length;n.x=v[b-2],n.y=v[b-1],n.bx=parseFloat(v[b-4])||n.x,n.by=parseFloat(v[b-3])||n.y,o.bx=a&&(parseFloat(_[x-4])||o.x),o.by=a&&(parseFloat(_[x-3])||o.y),o.x=a&&_[x-2],o.y=a&&_[x-1]}return a?[i,a]:i}(e)).length;u<h;u++){if("M"===(n=e[u])[0])i=+n[1],a=+n[2];else{if(t<l+(o=f(i,a,n[1],n[2],n[3],n[4],n[5],n[6]))&&!r)return{x:(s=f(i,a,n[1],n[2],n[3],n[4],n[5],n[6],t-l)).x,y:s.y,alpha:s.alpha};l+=o,i=+n[5],a=+n[6]}n.shift()}return(s=r?l:c(i,a,n[0],n[1],n[2],n[3],n[4],n[5],1)).alpha&&(s={x:s.x,y:s.y,alpha:s.alpha}),s}function m(e){var t,r=[],i=0,a=0,n=0,o=0,s=0;if(!e)return r;"M"===e[0][0]&&(n=i=+e[0][1],o=a=+e[0][2],s++,r[0]=["M",i,a]);for(var l,u,h=3===e.length&&"M"===e[0][0]&&"R"===e[1][0].toUpperCase()&&"Z"===e[2][0].toUpperCase(),d=s,c=e.length;d<c;d++){if(r.push(l=[]),(u=e[d])[0]!==String.prototype.toUpperCase.call(u[0]))switch(l[0]=String.prototype.toUpperCase.call(u[0]),l[0]){case"A":l[1]=u[1],l[2]=u[2],l[3]=u[3],l[4]=u[4],l[5]=u[5],l[6]=+(u[6]+i),l[7]=+(u[7]+a);break;case"V":l[1]=+u[1]+a;break;case"H":l[1]=+u[1]+i;break;case"R":for(var f=2,p=(t=[i,a].concat(u.slice(1))).length;f<p;f++)t[f]=+t[f]+i,t[++f]=+t[f]+a;r.pop(),r=r.concat(v(t,h));break;case"M":n=+u[1]+i,o=+u[2]+a;break;default:for(var m=1,g=u.length;m<g;m++)l[m]=+u[m]+(m%2?i:a)}else if("R"===u[0])t=[i,a].concat(u.slice(1)),r.pop(),r=r.concat(v(t,h)),l=["R"].concat(u.slice(-2));else for(var y=0,_=u.length;y<_;y++)l[y]=u[y];switch(l[0]){case"Z":i=n,a=o;break;case"H":i=l[1];break;case"V":a=l[1];break;case"M":n=l[l.length-2],o=l[l.length-1];break;default:i=l[l.length-2],a=l[l.length-1]}}return r}function v(e,t){for(var r=[],i=0,a=e.length;i<a-2*!t;i+=2){var n=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?a-4===i?n[3]={x:+e[0],y:+e[1]}:a-2===i&&(n[2]={x:+e[0],y:+e[1]},n[3]={x:+e[2],y:+e[3]}):n[0]={x:+e[a-2],y:+e[a-1]}:a-4===i?n[3]=n[2]:i||(n[0]={x:+e[i],y:+e[i+1]}),r.push(["C",(-n[0].x+6*n[1].x+n[2].x)/6,(-n[0].y+6*n[1].y+n[2].y)/6,(n[1].x+6*n[2].x-n[3].x)/6,(n[1].y+6*n[2].y-n[3].y)/6,n[2].x,n[2].y])}return r}function g(e,t,r,i){return[e,t,r,i,r,i]}function y(e,t,r,i,a,n){return[1/3*e+2/3*r,1/3*t+2/3*i,1/3*a+2/3*r,1/3*n+2/3*i,a,n]}function _(e,t,r,i,a,n,o,s,l){null==l&&(l=1);for(var u=(l=1<l?1:l<0?0:l)/2,h=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],d=0,c=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0;f<12;f++){var p=u*h[f]+u,m=b(p,e,r,a,o),v=b(p,t,i,n,s),g=m*m+v*v;d+=c[f]*Math.sqrt(g)}return u*d}function b(e,t,r,i,a){return e*(e*(-3*t+9*r-9*i+3*a)+6*t-12*r+6*i)-3*t+3*r}a.default.Font=function(e){this.parent=e,this.cache={},this.font=void 0},a.default.Font.prototype.textBounds=function(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,a=3<arguments.length?arguments[3]:void 0,o=4<arguments.length?arguments[4]:void 0,s=o&&o.renderer&&o.renderer._pInst||this.parent,l=s._renderer.drawingContext;if(l.textAlign||n.LEFT,l.textBaseline||n.BASELINE,a=a||s._renderer._textSize,!t){var u,h,d,c,f=[],p=[],m=this._scale(a);this.font.forEachGlyph(e,r,i,a,o,(function(e,t,r,i){var a=e.getMetrics();f.push(t+a.xMin*m),f.push(t+a.xMax*m),p.push(r+-a.yMin*m),p.push(r+-a.yMax*m)})),u=Math.min.apply(null,f),h=Math.min.apply(null,p),d=Math.max.apply(null,f),t={x:u,y:h,h:Math.max.apply(null,p)-h,w:d-u,advance:u-r},c=this._handleAlignment(s._renderer,e,t.x,t.y,t.w+t.advance),t.x=c.x,t.y=c.y}return t},a.default.Font.prototype.textToPoints=function(e,t,r,i,a){var n,o=0,u=[],h=this._getGlyphs(e);i=i||this.parent._renderer._textSize;for(var d=0;d<h.length;d++){if(!(h[n=d].name&&"space"===h[n].name||e.length===h.length&&" "===e[n]||h[n].index&&3===h[n].index))for(var c=l(h[d].getPath(t,r,i).commands),f=0;f<c.length;f++)for(var p=s(c[f],a),m=0;m<p.length;m++)p[m].x+=o,u.push(p[m]);o+=h[d].advanceWidth*this._scale(i)}return u},a.default.Font.prototype._getGlyphs=function(e){return this.font.stringToGlyphs(e)},a.default.Font.prototype._getPath=function(e,t,r,i){var a=(i&&i.renderer&&i.renderer._pInst||this.parent)._renderer,n=this._handleAlignment(a,e,t,r);return this.font.getPath(e,n.x,n.y,a._textSize,i)},a.default.Font.prototype._getPathData=function(e,t,r,i){var a=3;return"string"==typeof e&&2<arguments.length?e=this._getPath(e,t,r,i):"object"===o(t)&&(i=t),i&&"number"==typeof i.decimals&&(a=i.decimals),e.toPathData(a)},a.default.Font.prototype._getSVG=function(e,t,r,i){var a=3;return"string"==typeof e&&2<arguments.length?e=this._getPath(e,t,r,i):"object"===o(t)&&(i=t),i&&("number"==typeof i.decimals&&(a=i.decimals),"number"==typeof i.strokeWidth&&(e.strokeWidth=i.strokeWidth),void 0!==i.fill&&(e.fill=i.fill),void 0!==i.stroke&&(e.stroke=i.stroke)),e.toSVG(a)},a.default.Font.prototype._renderPath=function(e,t,r,i){var a,s=i&&i.renderer||this.parent._renderer,l=s.drawingContext;a="object"===o(e)&&e.commands?e.commands:this._getPath(e,t,r,i).commands,l.beginPath();var u=!0,h=!1,d=void 0;try{for(var c,f=a[Symbol.iterator]();!(u=(c=f.next()).done);u=!0){var p=c.value;"M"===p.type?l.moveTo(p.x,p.y):"L"===p.type?l.lineTo(p.x,p.y):"C"===p.type?l.bezierCurveTo(p.x1,p.y1,p.x2,p.y2,p.x,p.y):"Q"===p.type?l.quadraticCurveTo(p.x1,p.y1,p.x,p.y):"Z"===p.type&&l.closePath()}}catch(e){h=!0,d=e}finally{try{u||null==f.return||f.return()}finally{if(h)throw d}}return s._doStroke&&s._strokeSet&&l.stroke(),s._doFill&&(s._fillSet||s._setFill(n._DEFAULT_TEXT_FILL),l.fill()),this},a.default.Font.prototype._textWidth=function(e,t){return this.font.getAdvanceWidth(e,t)},a.default.Font.prototype._textAscent=function(e){return this.font.ascender*this._scale(e)},a.default.Font.prototype._textDescent=function(e){return-this.font.descender*this._scale(e)},a.default.Font.prototype._scale=function(e){return 1/this.font.unitsPerEm*(e||this.parent._renderer._textSize)},a.default.Font.prototype._handleAlignment=function(e,t,r,i,a){var o=e._textSize;switch(void 0===a&&(a=this._textWidth(t,o)),e._textAlign){case n.CENTER:r-=a/2;break;case n.RIGHT:r-=a}switch(e._textBaseline){case n.TOP:i+=this._textAscent(o);break;case n.CENTER:i+=this._textAscent(o)/2;break;case n.BOTTOM:i-=this._textDescent(o)}return{x:r,y:i}};var x=a.default;r.default=x},{"../core/constants":20,"../core/main":26}],65:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.append=function(e,t){return e.push(t),e},a.default.prototype.arrayCopy=function(e,t,r,i,a){var n,o;e=void 0!==a?(o=Math.min(a,e.length),n=i,e.slice(t,o+t)):(o=void 0!==r?(o=r,Math.min(o,e.length)):e.length,n=0,r=t,e.slice(0,o)),Array.prototype.splice.apply(r,[n,o].concat(e))},a.default.prototype.concat=function(e,t){return e.concat(t)},a.default.prototype.reverse=function(e){return e.reverse()},a.default.prototype.shorten=function(e){return e.pop(),e},a.default.prototype.shuffle=function(e,t){for(var r,i,a=ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(e),n=(e=t||a?e:e.slice()).length;1<n;)r=Math.random()*n|0,i=e[--n],e[n]=e[r],e[r]=i;return e},a.default.prototype.sort=function(e,t){var r=t?e.slice(0,Math.min(t,e.length)):e,i=t?e.slice(Math.min(t,e.length)):[];return(r="string"==typeof r[0]?r.sort():r.sort((function(e,t){return e-t}))).concat(i)},a.default.prototype.splice=function(e,t,r){return Array.prototype.splice.apply(e,[r,0].concat(t)),e},a.default.prototype.subset=function(e,t,r){return void 0!==r?e.slice(t,t+r):e.slice(t,e.length)};var n=a.default;r.default=n},{"../core/main":26}],66:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.float=function(e){return e instanceof Array?e.map(parseFloat):parseFloat(e)},a.default.prototype.int=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10;return e===1/0||"Infinity"===e?1/0:e===-1/0||"-Infinity"===e?-1/0:"string"==typeof e?parseInt(e,t):"number"==typeof e?0|e:"boolean"==typeof e?e?1:0:e instanceof Array?e.map((function(e){return a.default.prototype.int(e,t)})):void 0},a.default.prototype.str=function(e){return e instanceof Array?e.map(a.default.prototype.str):String(e)},a.default.prototype.boolean=function(e){return"number"==typeof e?0!==e:"string"==typeof e?"true"===e.toLowerCase():"boolean"==typeof e?e:e instanceof Array?e.map(a.default.prototype.boolean):void 0},a.default.prototype.byte=function(e){var t=a.default.prototype.int(e,10);return"number"==typeof t?(t+128)%256-128:t instanceof Array?t.map(a.default.prototype.byte):void 0},a.default.prototype.char=function(e){return"number"!=typeof e||isNaN(e)?e instanceof Array?e.map(a.default.prototype.char):"string"==typeof e?a.default.prototype.char(parseInt(e,10)):void 0:String.fromCharCode(e)},a.default.prototype.unchar=function(e){return"string"==typeof e&&1===e.length?e.charCodeAt(0):e instanceof Array?e.map(a.default.prototype.unchar):void 0},a.default.prototype.hex=function(e,t){if(t=null==t?t=8:t,e instanceof Array)return e.map((function(e){return a.default.prototype.hex(e,t)}));if(e===1/0||e===-1/0)return(e===1/0?"F":"0").repeat(t);if("number"==typeof e){e<0&&(e=4294967295+e+1);for(var r=Number(e).toString(16).toUpperCase();r.length<t;)r="0".concat(r);return r.length>=t&&(r=r.substring(r.length-t,r.length)),r}},a.default.prototype.unhex=function(e){return e instanceof Array?e.map(a.default.prototype.unhex):parseInt("0x".concat(e),16)};var n=a.default;r.default=n},{"../core/main":26}],67:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};function n(e,t,r){var i=e<0,a=i?e.toString().substring(1):e.toString(),n=a.indexOf("."),o=-1!==n?a.substring(0,n):a,s=-1!==n?a.substring(n+1):"",l=i?"-":"";if(void 0!==r){var u="";(-1!==n||0<r-s.length)&&(u="."),s.length>r&&(s=s.substring(0,r));for(var h=0;h<t-o.length;h++)l+="0";l+=o,l+=u,l+=s;for(var d=0;d<r-s.length;d++)l+="0";return l}for(var c=0;c<Math.max(t-o.length,0);c++)l+="0";return l+a}function o(e,t){var r=(e=e.toString()).indexOf("."),i=-1!==r?e.substring(r):"",a=-1!==r?e.substring(0,r):e;if(a=a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),0===t)i="";else if(void 0!==t)if(t>i.length)for(var n=t-(i+=-1===r?".":"").length+1,o=0;o<n;o++)i+="0";else i=i.substring(0,t+1);return a+i}function s(e){return 0<parseFloat(e)?"+".concat(e.toString()):e.toString()}function l(e){return 0<=parseFloat(e)?" ".concat(e.toString()):e.toString()}e("../core/error_helpers"),a.default.prototype.join=function(e,t){return a.default._validateParameters("join",arguments),e.join(t)},a.default.prototype.match=function(e,t){return a.default._validateParameters("match",arguments),e.match(t)},a.default.prototype.matchAll=function(e,t){a.default._validateParameters("matchAll",arguments);for(var r=new RegExp(t,"g"),i=r.exec(e),n=[];null!==i;)n.push(i),i=r.exec(e);return n},a.default.prototype.nf=function(e,t,r){return a.default._validateParameters("nf",arguments),e instanceof Array?e.map((function(e){return n(e,t,r)})):"[object Arguments]"===Object.prototype.toString.call(e)?3===e.length?this.nf(e[0],e[1],e[2]):2===e.length?this.nf(e[0],e[1]):this.nf(e[0]):n(e,t,r)},a.default.prototype.nfc=function(e,t){return a.default._validateParameters("nfc",arguments),e instanceof Array?e.map((function(e){return o(e,t)})):o(e,t)},a.default.prototype.nfp=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.default._validateParameters("nfp",t);var i=a.default.prototype.nf.apply(this,t);return i instanceof Array?i.map(s):s(i)},a.default.prototype.nfs=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.default._validateParameters("nfs",t);var i=a.default.prototype.nf.apply(this,t);return i instanceof Array?i.map(l):l(i)},a.default.prototype.split=function(e,t){return a.default._validateParameters("split",arguments),e.split(t)},a.default.prototype.splitTokens=function(e,t){var r;if(a.default._validateParameters("splitTokens",arguments),void 0!==t){var i=t,n=/\]/g.exec(i),o=/\[/g.exec(i);r=o&&n?(i=i.slice(0,n.index)+i.slice(n.index+1),o=/\[/g.exec(i),i=i.slice(0,o.index)+i.slice(o.index+1),new RegExp("[\\[".concat(i,"\\]]"),"g")):n?(i=i.slice(0,n.index)+i.slice(n.index+1),new RegExp("[".concat(i,"\\]]"),"g")):o?(i=i.slice(0,o.index)+i.slice(o.index+1),new RegExp("[".concat(i,"\\[]"),"g")):new RegExp("[".concat(i,"]"),"g")}else r=/\s/g;return e.split(r).filter((function(e){return e}))},a.default.prototype.trim=function(e){return a.default._validateParameters("trim",arguments),e instanceof Array?e.map(this.trim):e.trim()};var u=a.default;r.default=u},{"../core/error_helpers":22,"../core/main":26}],68:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.day=function(){return(new Date).getDate()},a.default.prototype.hour=function(){return(new Date).getHours()},a.default.prototype.minute=function(){return(new Date).getMinutes()},a.default.prototype.millis=function(){return window.performance.now()},a.default.prototype.month=function(){return(new Date).getMonth()+1},a.default.prototype.second=function(){return(new Date).getSeconds()},a.default.prototype.year=function(){return(new Date).getFullYear()};var n=a.default;r.default=n},{"../core/main":26}],69:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};e("./p5.Geometry");var n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));a.default.prototype.plane=function(e,t,r,i){this._assert3d("plane"),a.default._validateParameters("plane",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===r&&(r=1),void 0===i&&(i=1);var n="plane|".concat(r,"|").concat(i);if(!this._renderer.geometryInHash(n)){var o=new a.default.Geometry(r,i,(function(){for(var e,t,r,i=0;i<=this.detailY;i++){t=i/this.detailY;for(var n=0;n<=this.detailX;n++)e=n/this.detailX,r=new a.default.Vector(e-.5,t-.5,0),this.vertices.push(r),this.uvs.push(e,t)}}));o.computeFaces().computeNormals(),r<=1&&i<=1?o._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on plane objects with more than 1 detailX or 1 detailY"),this._renderer.createBuffers(n,o)}return this._renderer.drawBuffersScaled(n,e,t,1),this},a.default.prototype.box=function(e,t,r,i,n){this._assert3d("box"),a.default._validateParameters("box",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===r&&(r=t);var o=this._renderer.attributes&&this._renderer.attributes.perPixelLighting;void 0===i&&(i=o?1:4),void 0===n&&(n=o?1:4);var s="box|".concat(i,"|").concat(n);if(!this._renderer.geometryInHash(s)){var l=new a.default.Geometry(i,n,(function(){var e=[[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 t=0;t<e.length;t++){for(var r=e[t],i=4*t,n=0;n<4;n++){var o=r[n],s=new a.default.Vector((2*(1&o)-1)/2,((2&o)-1)/2,((4&o)/2-1)/2);this.vertices.push(s),this.uvs.push(1&n,(2&n)/2)}this.faces.push([i,i+1,i+2]),this.faces.push([i+2,i+1,i+3])}}));l.computeNormals(),i<=4&&n<=4?l._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on box objects with more than 4 detailX or 4 detailY"),this._renderer.createBuffers(s,l)}return this._renderer.drawBuffersScaled(s,e,t,r),this},a.default.prototype.sphere=function(e,t,r){return this._assert3d("sphere"),a.default._validateParameters("sphere",arguments),void 0===e&&(e=50),void 0===t&&(t=24),void 0===r&&(r=16),this.ellipsoid(e,e,e,t,r),this};var o=function(e,t,r,i,n,o,s){e=e<=0?1:e,t=t<0?0:t,r=r<=0?e:r,i=i<3?3:i;var l,u,h,d=(o=void 0===o||o)?-2:0,c=(n=n<1?1:n)+((s=void 0===s?0!==t:s)?2:0),f=Math.atan2(e-t,r),p=Math.sin(f),m=Math.cos(f);for(l=d;l<=c;++l){var v=l/n,g=r*v,y=void 0;for(y=l<0?(v=g=0,e):n<l?(g=r,v=1,t):e+(t-e)*v,-2!==l&&l!==n+2||(y=0),g-=r/2,u=0;u<i;++u){var _,b=u/i,x=2*Math.PI*b,w=Math.sin(x),S=Math.cos(x);this.vertices.push(new a.default.Vector(w*y,g,S*y)),_=l<0?new a.default.Vector(0,-1,0):n<l&&t?new a.default.Vector(0,1,0):new a.default.Vector(w*m,p,S*m),this.vertexNormals.push(_),this.uvs.push(b,v)}}var M=0;if(o){for(h=0;h<i;++h){var E=(h+1)%i;this.faces.push([M+h,M+i+E,M+i+h])}M+=2*i}for(l=0;l<n;++l){for(u=0;u<i;++u){var T=(u+1)%i;this.faces.push([M+u,M+T,M+i+T]),this.faces.push([M+u,M+i+T,M+i+u])}M+=i}if(s)for(M+=i,u=0;u<i;++u)this.faces.push([M+u,M+(u+1)%i,M+i])};a.default.prototype.cylinder=function(e,t,r,i,n,s){this._assert3d("cylinder"),a.default._validateParameters("cylinder",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===r&&(r=24),void 0===i&&(i=1),void 0===s&&(s=!0),void 0===n&&(n=!0);var l="cylinder|".concat(r,"|").concat(i,"|").concat(n,"|").concat(s);if(!this._renderer.geometryInHash(l)){var u=new a.default.Geometry(r,i);o.call(u,1,1,1,r,i,n,s),r<=24&&i<=16?u._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on cylinder objects with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(l,u)}return this._renderer.drawBuffersScaled(l,e,t,e),this},a.default.prototype.cone=function(e,t,r,i,n){this._assert3d("cone"),a.default._validateParameters("cone",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===r&&(r=24),void 0===i&&(i=1),void 0===n&&(n=!0);var s="cone|".concat(r,"|").concat(i,"|").concat(n);if(!this._renderer.geometryInHash(s)){var l=new a.default.Geometry(r,i);o.call(l,1,0,1,r,i,n,!1),r<=24&&i<=16?l._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on cone objects with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(s,l)}return this._renderer.drawBuffersScaled(s,e,t,e),this},a.default.prototype.ellipsoid=function(e,t,r,i,n){this._assert3d("ellipsoid"),a.default._validateParameters("ellipsoid",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===r&&(r=e),void 0===i&&(i=24),void 0===n&&(n=16);var o="ellipsoid|".concat(i,"|").concat(n);if(!this._renderer.geometryInHash(o)){var s=new a.default.Geometry(i,n,(function(){for(var e=0;e<=this.detailY;e++)for(var t=e/this.detailY,r=Math.PI*t-Math.PI/2,i=Math.cos(r),n=Math.sin(r),o=0;o<=this.detailX;o++){var s=o/this.detailX,l=2*Math.PI*s,u=Math.cos(l),h=Math.sin(l),d=new a.default.Vector(i*h,n,i*u);this.vertices.push(d),this.vertexNormals.push(d),this.uvs.push(s,t)}}));s.computeFaces(),i<=24&&n<=24?s._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on ellipsoids with more than 24 detailX or 24 detailY"),this._renderer.createBuffers(o,s)}return this._renderer.drawBuffersScaled(o,e,t,r),this},a.default.prototype.torus=function(e,t,r,i){if(this._assert3d("torus"),a.default._validateParameters("torus",arguments),void 0===e)e=50;else if(!e)return;if(void 0===t)t=10;else if(!t)return;void 0===r&&(r=24),void 0===i&&(i=16);var n=(t/e).toPrecision(4),o="torus|".concat(n,"|").concat(r,"|").concat(i);if(!this._renderer.geometryInHash(o)){var s=new a.default.Geometry(r,i,(function(){for(var e=0;e<=this.detailY;e++)for(var t=e/this.detailY,r=2*Math.PI*t,i=Math.cos(r),o=Math.sin(r),s=1+n*i,l=0;l<=this.detailX;l++){var u=l/this.detailX,h=2*Math.PI*u,d=Math.cos(h),c=Math.sin(h),f=new a.default.Vector(s*d,s*c,n*o),p=new a.default.Vector(i*d,i*c,o);this.vertices.push(f),this.vertexNormals.push(p),this.uvs.push(u,t)}}));s.computeFaces(),r<=24&&i<=16?s._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw strokes on torus object with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(o,s)}return this._renderer.drawBuffersScaled(o,e,e,e),this},a.default.RendererGL.prototype.point=function(e,t,r){void 0===r&&(r=0);var i=[];return i.push(new a.default.Vector(e,t,r)),this._drawPoints(i,this._pointVertexBuffer),this},a.default.RendererGL.prototype.triangle=function(e){var t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],s=e[5];if(!this.geometryInHash("tri")){var l=new a.default.Geometry(1,1,(function(){var e=[];e.push(new a.default.Vector(0,0,0)),e.push(new a.default.Vector(0,1,0)),e.push(new a.default.Vector(1,0,0)),this.strokeIndices=[[0,1],[1,2],[2,0]],this.vertices=e,this.faces=[[0,1,2]],this.uvs=[0,0,0,1,1,1]}));l._makeTriangleEdges()._edgesToVertices(),l.computeNormals(),this.createBuffers("tri",l)}var u=this.uMVMatrix.copy();try{var h=new a.default.Matrix([i-t,n-r,0,0,o-t,s-r,0,0,0,0,1,0,t,r,0,1]).mult(this.uMVMatrix);this.uMVMatrix=h,this.drawBuffers("tri")}finally{this.uMVMatrix=u}return this},a.default.RendererGL.prototype.ellipse=function(e){this.arc(e[0],e[1],e[2],e[3],0,n.TWO_PI,n.OPEN,e[4])},a.default.RendererGL.prototype.arc=function(e){var t,r,i=e,o=arguments[1],s=arguments[2],l=arguments[3],u=arguments[4],h=arguments[5],d=arguments[6],c=arguments[7]||25;if(r=Math.abs(h-u)>=n.TWO_PI?"".concat(t="ellipse","|").concat(c,"|"):"".concat(t="arc","|").concat(u,"|").concat(h,"|").concat(d,"|").concat(c,"|"),!this.geometryInHash(r)){var f=new a.default.Geometry(c,1,(function(){if(this.strokeIndices=[],u.toFixed(10)!==h.toFixed(10)){d!==n.PIE&&void 0!==d||(this.vertices.push(new a.default.Vector(.5,.5,0)),this.uvs.push([.5,.5]));for(var e=0;e<=c;e++){var t=e/c*(h-u)+u,r=.5+Math.cos(t)/2,i=.5+Math.sin(t)/2;this.vertices.push(new a.default.Vector(r,i,0)),this.uvs.push([r,i]),e<c-1&&(this.faces.push([0,e+1,e+2]),this.strokeIndices.push([e+1,e+2]))}switch(d){case n.PIE:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.strokeIndices.push([0,1]),this.strokeIndices.push([this.vertices.length-2,this.vertices.length-1]),this.strokeIndices.push([0,this.vertices.length-1]);break;case n.CHORD:this.strokeIndices.push([0,1]),this.strokeIndices.push([0,this.vertices.length-1]);break;case n.OPEN:this.strokeIndices.push([0,1]);break;default:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.strokeIndices.push([this.vertices.length-2,this.vertices.length-1])}}}));f.computeNormals(),c<=50?f._makeTriangleEdges()._edgesToVertices(f):console.log("Cannot stroke ".concat(t," with more than 50 detail")),this.createBuffers(r,f)}var p=this.uMVMatrix.copy();try{this.uMVMatrix.translate([i,o,0]),this.uMVMatrix.scale(s,l,1),this.drawBuffers(r)}finally{this.uMVMatrix=p}return this},a.default.RendererGL.prototype.rect=function(e){var t=this._pInst._glAttributes.perPixelLighting,r=e[0],i=e[1],n=e[2],o=e[3],s=e[4]||(t?1:24),l=e[5]||(t?1:16),u="rect|".concat(s,"|").concat(l);if(!this.geometryInHash(u)){var h=new a.default.Geometry(s,l,(function(){for(var e=0;e<=this.detailY;e++)for(var t=e/this.detailY,r=0;r<=this.detailX;r++){var i=r/this.detailX,n=new a.default.Vector(i,t,0);this.vertices.push(n),this.uvs.push(i,t)}0<s&&0<l&&(this.strokeIndices=[[0,s],[s,(s+1)*(l+1)-1],[(s+1)*(l+1)-1,(s+1)*l],[(s+1)*l,0]])}));h.computeFaces().computeNormals()._makeTriangleEdges()._edgesToVertices(),this.createBuffers(u,h)}var d=this.uMVMatrix.copy();try{this.uMVMatrix.translate([r,i,0]),this.uMVMatrix.scale(n,o,1),this.drawBuffers(u)}finally{this.uMVMatrix=d}return this},a.default.RendererGL.prototype.quad=function(e,t,r,i,n,o,s,l,u,h,d,c){var f="quad|".concat(e,"|").concat(t,"|").concat(r,"|").concat(i,"|").concat(n,"|").concat(o,"|").concat(s,"|").concat(l,"|").concat(u,"|").concat(h,"|").concat(d,"|").concat(c);if(!this.geometryInHash(f)){var p=new a.default.Geometry(2,2,(function(){this.vertices.push(new a.default.Vector(e,t,r)),this.vertices.push(new a.default.Vector(i,n,o)),this.vertices.push(new a.default.Vector(s,l,u)),this.vertices.push(new a.default.Vector(h,d,c)),this.uvs.push(0,0,1,0,1,1,0,1),this.strokeIndices=[[0,1],[1,2],[2,3],[3,0]]}));p.computeNormals()._makeTriangleEdges()._edgesToVertices(),p.faces=[[0,1,2],[2,3,0]],this.createBuffers(f,p)}return this.drawBuffers(f),this},a.default.RendererGL.prototype.bezier=function(e,t,r,i,a,n,o,s,l,u,h,d){8===arguments.length&&(h=s,u=o,s=n,o=a,a=i,i=r,r=n=l=d=0);var c=this._pInst._bezierDetail||20;this.beginShape();for(var f=0;f<=c;f++){var p=Math.pow(1-f/c,3),m=f/c*3*Math.pow(1-f/c,2),v=3*Math.pow(f/c,2)*(1-f/c),g=Math.pow(f/c,3);this.vertex(e*p+i*m+o*v+u*g,t*p+a*m+s*v+h*g,r*p+n*m+l*v+d*g)}return this.endShape(),this},a.default.RendererGL.prototype.curve=function(e,t,r,i,a,n,o,s,l,u,h,d){8===arguments.length&&(u=o,h=s,o=a,s=i,a=i=r,r=n=l=d=0);var c=this._pInst._curveDetail;this.beginShape();for(var f=0;f<=c;f++){var p=.5*Math.pow(f/c,3),m=.5*Math.pow(f/c,2),v=f/c*.5,g=p*(3*i-e-3*o+u)+m*(2*e-5*i+4*o-u)+v*(-e+o)+2*i*.5,y=p*(3*a-t-3*s+h)+m*(2*t-5*a+4*s-h)+v*(-t+s)+2*a*.5,_=p*(3*n-r-3*l+d)+m*(2*r-5*n+4*l-d)+v*(-r+l)+2*n*.5;this.vertex(g,y,_)}return this.endShape(),this},a.default.RendererGL.prototype.line=function(){return 6===arguments.length?(this.beginShape(),this.vertex(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]),this.vertex(arguments.length<=3?void 0:arguments[3],arguments.length<=4?void 0:arguments[4],arguments.length<=5?void 0:arguments[5]),this.endShape()):4===arguments.length&&(this.beginShape(),this.vertex(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],0),this.vertex(arguments.length<=2?void 0:arguments[2],arguments.length<=3?void 0:arguments[3],0),this.endShape()),this},a.default.RendererGL.prototype.bezierVertex=function(){if(0===this.immediateMode._bezierVertex.length)throw Error("vertex() must be used once before calling bezierVertex()");var e,t,r,i,a,n=[],o=[],s=[],l=arguments.length;if((e=0)===this._lookUpTableBezier.length||this._lutBezierDetail!==this._pInst._curveDetail){this._lookUpTableBezier=[],this._lutBezierDetail=this._pInst._curveDetail;for(var u=1/this._lutBezierDetail,h=0,d=1,c=0;h<1;){if(e=parseFloat(h.toFixed(6)),this._lookUpTableBezier[c]=this._bezierCoefficients(e),d.toFixed(6)===u.toFixed(6)){e=parseFloat(d.toFixed(6))+parseFloat(h.toFixed(6)),++c,this._lookUpTableBezier[c]=this._bezierCoefficients(e);break}h+=u,d-=u,++c}}var f=this._lookUpTableBezier.length;if(6===l){for(this.isBezier=!0,n=[this.immediateMode._bezierVertex[0],arguments.length<=0?void 0:arguments[0],arguments.length<=2?void 0:arguments[2],arguments.length<=4?void 0:arguments[4]],o=[this.immediateMode._bezierVertex[1],arguments.length<=1?void 0:arguments[1],arguments.length<=3?void 0:arguments[3],arguments.length<=5?void 0:arguments[5]],a=0;a<f;a++)t=n[0]*this._lookUpTableBezier[a][0]+n[1]*this._lookUpTableBezier[a][1]+n[2]*this._lookUpTableBezier[a][2]+n[3]*this._lookUpTableBezier[a][3],r=o[0]*this._lookUpTableBezier[a][0]+o[1]*this._lookUpTableBezier[a][1]+o[2]*this._lookUpTableBezier[a][2]+o[3]*this._lookUpTableBezier[a][3],this.vertex(t,r);this.immediateMode._bezierVertex[0]=arguments.length<=4?void 0:arguments[4],this.immediateMode._bezierVertex[1]=arguments.length<=5?void 0:arguments[5]}else if(9===l){for(this.isBezier=!0,n=[this.immediateMode._bezierVertex[0],arguments.length<=0?void 0:arguments[0],arguments.length<=3?void 0:arguments[3],arguments.length<=6?void 0:arguments[6]],o=[this.immediateMode._bezierVertex[1],arguments.length<=1?void 0:arguments[1],arguments.length<=4?void 0:arguments[4],arguments.length<=7?void 0:arguments[7]],s=[this.immediateMode._bezierVertex[2],arguments.length<=2?void 0:arguments[2],arguments.length<=5?void 0:arguments[5],arguments.length<=8?void 0:arguments[8]],a=0;a<f;a++)t=n[0]*this._lookUpTableBezier[a][0]+n[1]*this._lookUpTableBezier[a][1]+n[2]*this._lookUpTableBezier[a][2]+n[3]*this._lookUpTableBezier[a][3],r=o[0]*this._lookUpTableBezier[a][0]+o[1]*this._lookUpTableBezier[a][1]+o[2]*this._lookUpTableBezier[a][2]+o[3]*this._lookUpTableBezier[a][3],i=s[0]*this._lookUpTableBezier[a][0]+s[1]*this._lookUpTableBezier[a][1]+s[2]*this._lookUpTableBezier[a][2]+s[3]*this._lookUpTableBezier[a][3],this.vertex(t,r,i);this.immediateMode._bezierVertex[0]=arguments.length<=6?void 0:arguments[6],this.immediateMode._bezierVertex[1]=arguments.length<=7?void 0:arguments[7],this.immediateMode._bezierVertex[2]=arguments.length<=8?void 0:arguments[8]}},a.default.RendererGL.prototype.quadraticVertex=function(){if(0===this.immediateMode._quadraticVertex.length)throw Error("vertex() must be used once before calling quadraticVertex()");var e,t,r,i,a,n=[],o=[],s=[],l=arguments.length;if((e=0)===this._lookUpTableQuadratic.length||this._lutQuadraticDetail!==this._pInst._curveDetail){this._lookUpTableQuadratic=[],this._lutQuadraticDetail=this._pInst._curveDetail;for(var u=1/this._lutQuadraticDetail,h=0,d=1,c=0;h<1;){if(e=parseFloat(h.toFixed(6)),this._lookUpTableQuadratic[c]=this._quadraticCoefficients(e),d.toFixed(6)===u.toFixed(6)){e=parseFloat(d.toFixed(6))+parseFloat(h.toFixed(6)),++c,this._lookUpTableQuadratic[c]=this._quadraticCoefficients(e);break}h+=u,d-=u,++c}}var f=this._lookUpTableQuadratic.length;if(4===l){for(this.isQuadratic=!0,n=[this.immediateMode._quadraticVertex[0],arguments.length<=0?void 0:arguments[0],arguments.length<=2?void 0:arguments[2]],o=[this.immediateMode._quadraticVertex[1],arguments.length<=1?void 0:arguments[1],arguments.length<=3?void 0:arguments[3]],a=0;a<f;a++)t=n[0]*this._lookUpTableQuadratic[a][0]+n[1]*this._lookUpTableQuadratic[a][1]+n[2]*this._lookUpTableQuadratic[a][2],r=o[0]*this._lookUpTableQuadratic[a][0]+o[1]*this._lookUpTableQuadratic[a][1]+o[2]*this._lookUpTableQuadratic[a][2],this.vertex(t,r);this.immediateMode._quadraticVertex[0]=arguments.length<=2?void 0:arguments[2],this.immediateMode._quadraticVertex[1]=arguments.length<=3?void 0:arguments[3]}else if(6===l){for(this.isQuadratic=!0,n=[this.immediateMode._quadraticVertex[0],arguments.length<=0?void 0:arguments[0],arguments.length<=3?void 0:arguments[3]],o=[this.immediateMode._quadraticVertex[1],arguments.length<=1?void 0:arguments[1],arguments.length<=4?void 0:arguments[4]],s=[this.immediateMode._quadraticVertex[2],arguments.length<=2?void 0:arguments[2],arguments.length<=5?void 0:arguments[5]],a=0;a<f;a++)t=n[0]*this._lookUpTableQuadratic[a][0]+n[1]*this._lookUpTableQuadratic[a][1]+n[2]*this._lookUpTableQuadratic[a][2],r=o[0]*this._lookUpTableQuadratic[a][0]+o[1]*this._lookUpTableQuadratic[a][1]+o[2]*this._lookUpTableQuadratic[a][2],i=s[0]*this._lookUpTableQuadratic[a][0]+s[1]*this._lookUpTableQuadratic[a][1]+s[2]*this._lookUpTableQuadratic[a][2],this.vertex(t,r,i);this.immediateMode._quadraticVertex[0]=arguments.length<=3?void 0:arguments[3],this.immediateMode._quadraticVertex[1]=arguments.length<=4?void 0:arguments[4],this.immediateMode._quadraticVertex[2]=arguments.length<=5?void 0:arguments[5]}},a.default.RendererGL.prototype.curveVertex=function(){var e,t,r,i,a,n=[],o=[],s=[];e=0;var l=arguments.length;if(0===this._lookUpTableBezier.length||this._lutBezierDetail!==this._pInst._curveDetail){this._lookUpTableBezier=[],this._lutBezierDetail=this._pInst._curveDetail;for(var u=1/this._lutBezierDetail,h=0,d=1,c=0;h<1;){if(e=parseFloat(h.toFixed(6)),this._lookUpTableBezier[c]=this._bezierCoefficients(e),d.toFixed(6)===u.toFixed(6)){e=parseFloat(d.toFixed(6))+parseFloat(h.toFixed(6)),++c,this._lookUpTableBezier[c]=this._bezierCoefficients(e);break}h+=u,d-=u,++c}}var f=this._lookUpTableBezier.length;if(2===l){if(this.immediateMode._curveVertex.push(arguments.length<=0?void 0:arguments[0]),this.immediateMode._curveVertex.push(arguments.length<=1?void 0:arguments[1]),8===this.immediateMode._curveVertex.length){for(this.isCurve=!0,n=this._bezierToCatmull([this.immediateMode._curveVertex[0],this.immediateMode._curveVertex[2],this.immediateMode._curveVertex[4],this.immediateMode._curveVertex[6]]),o=this._bezierToCatmull([this.immediateMode._curveVertex[1],this.immediateMode._curveVertex[3],this.immediateMode._curveVertex[5],this.immediateMode._curveVertex[7]]),a=0;a<f;a++)t=n[0]*this._lookUpTableBezier[a][0]+n[1]*this._lookUpTableBezier[a][1]+n[2]*this._lookUpTableBezier[a][2]+n[3]*this._lookUpTableBezier[a][3],r=o[0]*this._lookUpTableBezier[a][0]+o[1]*this._lookUpTableBezier[a][1]+o[2]*this._lookUpTableBezier[a][2]+o[3]*this._lookUpTableBezier[a][3],this.vertex(t,r);for(a=0;a<l;a++)this.immediateMode._curveVertex.shift()}}else if(3===l&&(this.immediateMode._curveVertex.push(arguments.length<=0?void 0:arguments[0]),this.immediateMode._curveVertex.push(arguments.length<=1?void 0:arguments[1]),this.immediateMode._curveVertex.push(arguments.length<=2?void 0:arguments[2]),12===this.immediateMode._curveVertex.length)){for(this.isCurve=!0,n=this._bezierToCatmull([this.immediateMode._curveVertex[0],this.immediateMode._curveVertex[3],this.immediateMode._curveVertex[6],this.immediateMode._curveVertex[9]]),o=this._bezierToCatmull([this.immediateMode._curveVertex[1],this.immediateMode._curveVertex[4],this.immediateMode._curveVertex[7],this.immediateMode._curveVertex[10]]),s=this._bezierToCatmull([this.immediateMode._curveVertex[2],this.immediateMode._curveVertex[5],this.immediateMode._curveVertex[8],this.immediateMode._curveVertex[11]]),a=0;a<f;a++)t=n[0]*this._lookUpTableBezier[a][0]+n[1]*this._lookUpTableBezier[a][1]+n[2]*this._lookUpTableBezier[a][2]+n[3]*this._lookUpTableBezier[a][3],r=o[0]*this._lookUpTableBezier[a][0]+o[1]*this._lookUpTableBezier[a][1]+o[2]*this._lookUpTableBezier[a][2]+o[3]*this._lookUpTableBezier[a][3],i=s[0]*this._lookUpTableBezier[a][0]+s[1]*this._lookUpTableBezier[a][1]+s[2]*this._lookUpTableBezier[a][2]+s[3]*this._lookUpTableBezier[a][3],this.vertex(t,r,i);for(a=0;a<l;a++)this.immediateMode._curveVertex.shift()}},a.default.RendererGL.prototype.image=function(e,t,r,i,a,o,s,l,u){this._isErasing&&this.blendMode(this._cachedBlendMode),this._pInst.push(),this._pInst.texture(e),this._pInst.textureMode(n.NORMAL);var h=0;t<=e.width&&(h=t/e.width);var d=1;t+i<=e.width&&(d=(t+i)/e.width);var c=0;r<=e.height&&(c=r/e.height);var f=1;r+a<=e.height&&(f=(r+a)/e.height),this.beginShape(),this.vertex(o,s,0,h,c),this.vertex(o+l,s,0,d,c),this.vertex(o+l,s+u,0,d,f),this.vertex(o,s+u,0,h,f),this.endShape(n.CLOSE),this._pInst.pop(),this._isErasing&&this.blendMode(n.REMOVE)};var s=a.default;r.default=s},{"../core/constants":20,"../core/main":26,"./p5.Geometry":75}],70:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));a.default.prototype.orbitControl=function(e,t,r){if(this._assert3d("orbitControl"),a.default._validateParameters("orbitControl",arguments),this.mouseX<this.width&&0<this.mouseX&&this.mouseY<this.height&&0<this.mouseY){var i=this._renderer._curCamera;void 0===e&&(e=1),void 0===t&&(t=e),void 0===r&&(r=.5),!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 n=this.height<this.width?this.height:this.width;if(this._mouseWheelDeltaY!==this._pmouseWheelDeltaY&&(0<this._mouseWheelDeltaY?this._renderer._curCamera._orbit(0,0,r*n):this._renderer._curCamera._orbit(0,0,-r*n)),this.mouseIsPressed)if(this.mouseButton===this.LEFT){var o=-e*(this.mouseX-this.pmouseX)/n,s=t*(this.mouseY-this.pmouseY)/n;this._renderer._curCamera._orbit(o,s,0)}else if(this.mouseButton===this.RIGHT){var l=i._getLocalAxes(),u=Math.sqrt(l.x[0]*l.x[0]+l.x[2]*l.x[2]);0!==u&&(l.x[0]/=u,l.x[2]/=u);var h=Math.sqrt(l.y[0]*l.y[0]+l.y[2]*l.y[2]);0!==h&&(l.y[0]/=h,l.y[2]/=h);var d=-1*e*(this.mouseX-this.pmouseX),c=-1*t*(this.mouseY-this.pmouseY);i.setPosition(i.eyeX+d*l.x[0]+c*l.z[0],i.eyeY,i.eyeZ+d*l.x[2]+c*l.z[2])}return this}},a.default.prototype.debugMode=function(){this._assert3d("debugMode");for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];a.default._validateParameters("debugMode",t);for(var i=this._registeredMethods.post.length-1;0<=i;i--)this._registeredMethods.post[i].toString()!==this._grid().toString()&&this._registeredMethods.post[i].toString()!==this._axesIcon().toString()||this._registeredMethods.post.splice(i,1);t[0]===n.GRID?this.registerMethod("post",this._grid.call(this,t[1],t[2],t[3],t[4],t[5])):t[0]===n.AXES?this.registerMethod("post",this._axesIcon.call(this,t[1],t[2],t[3],t[4])):(this.registerMethod("post",this._grid.call(this,t[0],t[1],t[2],t[3],t[4])),this.registerMethod("post",this._axesIcon.call(this,t[5],t[6],t[7],t[8])))},a.default.prototype.noDebugMode=function(){this._assert3d("noDebugMode");for(var e=this._registeredMethods.post.length-1;0<=e;e--)this._registeredMethods.post[e].toString()!==this._grid().toString()&&this._registeredMethods.post[e].toString()!==this._axesIcon().toString()||this._registeredMethods.post.splice(e,1)},a.default.prototype._grid=function(e,t,r,i,a){void 0===e&&(e=this.width/2),void 0===t&&(t=Math.round(e/30)<4?4:Math.round(e/30)),void 0===r&&(r=0),void 0===i&&(i=0),void 0===a&&(a=0);var n=e/t,o=e/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 e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(-o+r,i,e*n-o+a),this.vertex(+o+r,i,e*n-o+a),this.endShape();for(var s=0;s<=t;s++)this.beginShape(this.LINES),this.vertex(s*n-o+r,i,-o+a),this.vertex(s*n-o+r,i,+o+a),this.endShape();this.pop()}},a.default.prototype._axesIcon=function(e,t,r,i){return void 0===e&&(e=40<this.width/20?this.width/20:40),void 0===t&&(t=-this.width/4),void 0===r&&(r=t),void 0===i&&(i=t),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(t,r,i),this.vertex(t+e,r,i),this.endShape(),this.stroke(0,255,0),this.beginShape(this.LINES),this.vertex(t,r,i),this.vertex(t,r+e,i),this.endShape(),this.stroke(0,0,255),this.beginShape(this.LINES),this.vertex(t,r,i),this.vertex(t,r,i+e),this.endShape(),this.pop()}};var o=a.default;r.default=o},{"../core/constants":20,"../core/main":26}],71:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.ambientLight=function(e,t,r,i){this._assert3d("ambientLight"),a.default._validateParameters("ambientLight",arguments);var n=this.color.apply(this,arguments);return this._renderer.ambientLightColors.push(n._array[0],n._array[1],n._array[2]),this._renderer._enableLighting=!0,this},a.default.prototype.specularColor=function(e,t,r){this._assert3d("specularColor"),a.default._validateParameters("specularColor",arguments);var i=this.color.apply(this,arguments);return this._renderer.specularColors=[i._array[0],i._array[1],i._array[2]],this},a.default.prototype.directionalLight=function(e,t,r,i,n,o){var s,l,u,h;this._assert3d("directionalLight"),a.default._validateParameters("directionalLight",arguments),s=e instanceof a.default.Color?e:this.color(e,t,r);var d=arguments[arguments.length-1];h="number"==typeof d?(l=arguments[arguments.length-3],u=arguments[arguments.length-2],arguments[arguments.length-1]):(l=d.x,u=d.y,d.z);var c=Math.sqrt(l*l+u*u+h*h);return this._renderer.directionalLightDirections.push(l/c,u/c,h/c),this._renderer.directionalLightDiffuseColors.push(s._array[0],s._array[1],s._array[2]),Array.prototype.push.apply(this._renderer.directionalLightSpecularColors,this._renderer.specularColors),this._renderer._enableLighting=!0,this},a.default.prototype.pointLight=function(e,t,r,i,n,o){var s,l,u,h;this._assert3d("pointLight"),a.default._validateParameters("pointLight",arguments),s=e instanceof a.default.Color?e:this.color(e,t,r);var d=arguments[arguments.length-1];return h="number"==typeof d?(l=arguments[arguments.length-3],u=arguments[arguments.length-2],arguments[arguments.length-1]):(l=d.x,u=d.y,d.z),this._renderer.pointLightPositions.push(l,u,h),this._renderer.pointLightDiffuseColors.push(s._array[0],s._array[1],s._array[2]),Array.prototype.push.apply(this._renderer.pointLightSpecularColors,this._renderer.specularColors),this._renderer._enableLighting=!0,this},a.default.prototype.lights=function(){return this._assert3d("lights"),this.ambientLight(128,128,128),this.directionalLight(128,128,128,0,0,-1),this},a.default.prototype.lightFalloff=function(e,t,r){return this._assert3d("lightFalloff"),a.default._validateParameters("lightFalloff",arguments),e<0&&(e=0,console.warn("Value of constant argument in lightFalloff() should be never be negative. Set to 0.")),t<0&&(t=0,console.warn("Value of linear argument in lightFalloff() should be never be negative. Set to 0.")),r<0&&(r=0,console.warn("Value of quadratic argument in lightFalloff() should be never be negative. Set to 0.")),0===e&&0===t&&0===r&&(e=1,console.warn("Either one of the three arguments in lightFalloff() should be greater than zero. Set constant argument to 1.")),this._renderer.constantAttenuation=e,this._renderer.linearAttenuation=t,this._renderer.quadraticAttenuation=r,this},a.default.prototype.spotLight=function(e,t,r,i,n,o,s,l,u,h,d){var c,f,p;this._assert3d("spotLight"),a.default._validateParameters("spotLight",arguments);var m=arguments.length;switch(m){case 11:case 10:c=this.color(e,t,r),f=new a.default.Vector(i,n,o),p=new a.default.Vector(s,l,u);break;case 9:e instanceof a.default.Color?(c=e,f=new a.default.Vector(t,r,i),p=new a.default.Vector(n,o,s),h=l,d=u):i instanceof a.default.Vector?(c=this.color(e,t,r),f=i,p=new a.default.Vector(n,o,s),h=l,d=u):s instanceof a.default.Vector?(c=this.color(e,t,r),f=new a.default.Vector(i,n,o),p=s,h=l,d=u):(c=this.color(e,t,r),f=new a.default.Vector(i,n,o),p=new a.default.Vector(s,l,u));break;case 8:p=e instanceof a.default.Color?(c=e,f=new a.default.Vector(t,r,i),new a.default.Vector(n,o,s)):i instanceof a.default.Vector?(c=this.color(e,t,r),f=i,new a.default.Vector(n,o,s)):(c=this.color(e,t,r),f=new a.default.Vector(i,n,o),s),h=l;break;case 7:e instanceof a.default.Color&&t instanceof a.default.Vector?(c=e,f=t,p=new a.default.Vector(r,i,n),h=o,d=s):e instanceof a.default.Color&&n instanceof a.default.Vector?(c=e,f=new a.default.Vector(t,r,i),p=n,h=o,d=s):i instanceof a.default.Vector&&n instanceof a.default.Vector?(c=this.color(e,t,r),f=i,p=n,h=o,d=s):p=e instanceof a.default.Color?(c=e,f=new a.default.Vector(t,r,i),new a.default.Vector(n,o,s)):i instanceof a.default.Vector?(c=this.color(e,t,r),f=i,new a.default.Vector(n,o,s)):(c=this.color(e,t,r),f=new a.default.Vector(i,n,o),s);break;case 6:i instanceof a.default.Vector&&n instanceof a.default.Vector?(c=this.color(e,t,r),f=i,p=n,h=o):e instanceof a.default.Color&&n instanceof a.default.Vector?(c=e,f=new a.default.Vector(t,r,i),p=n,h=o):e instanceof a.default.Color&&t instanceof a.default.Vector&&(c=e,f=t,p=new a.default.Vector(r,i,n),h=o);break;case 5:e instanceof a.default.Color&&t instanceof a.default.Vector&&r instanceof a.default.Vector?(c=e,f=t,p=r,h=i,d=n):i instanceof a.default.Vector&&n instanceof a.default.Vector?(c=this.color(e,t,r),f=i,p=n):e instanceof a.default.Color&&n instanceof a.default.Vector?(c=e,f=new a.default.Vector(t,r,i),p=n):e instanceof a.default.Color&&t instanceof a.default.Vector&&(c=e,f=t,p=new a.default.Vector(r,i,n));break;case 4:c=e,f=t,p=r,h=i;break;case 3:c=e,f=t,p=r;break;default:return console.warn("Sorry, input for spotlight() is not in prescribed format. Too ".concat(m<3?"few":"many"," arguments were provided")),this}return this._renderer.spotLightDiffuseColors.push(c._array[0],c._array[1],c._array[2]),Array.prototype.push.apply(this._renderer.spotLightSpecularColors,this._renderer.specularColors),this._renderer.spotLightPositions.push(f.x,f.y,f.z),p.normalize(),this._renderer.spotLightDirections.push(p.x,p.y,p.z),void 0===h&&(h=Math.PI/3),void 0!==d&&d<1?(d=1,console.warn("Value of concentration needs to be greater than 1. Setting it to 1")):void 0===d&&(d=100),h=this._renderer._pInst._toRadians(h),this._renderer.spotLightAngle.push(Math.cos(h)),this._renderer.spotLightConc.push(d),this._renderer._enableLighting=!0,this},a.default.prototype.noLights=function(){return this._assert3d("noLights"),a.default._validateParameters("noLights",arguments),this._renderer.ambientLightColors.length=0,this._renderer.specularColors=[1,1,1],this._renderer.directionalLightDirections.length=0,this._renderer.directionalLightDiffuseColors.length=0,this._renderer.directionalLightSpecularColors.length=0,this._renderer.pointLightPositions.length=0,this._renderer.pointLightDiffuseColors.length=0,this._renderer.pointLightSpecularColors.length=0,this._renderer.spotLightPositions.length=0,this._renderer.spotLightDirections.length=0,this._renderer.spotLightDiffuseColors.length=0,this._renderer.spotLightSpecularColors.length=0,this._renderer.spotLightAngle.length=0,this._renderer.spotLightConc.length=0,this._renderer.constantAttenuation=1,this._renderer.linearAttenuation=0,this._renderer.quadraticAttenuation=0,this._renderer._useShininess=1,this};var n=a.default;r.default=n},{"../core/main":26}],72:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};function n(e,t,r){for(var i=0,a=e.length;i<a;i++)if(e[i]!==t.getUint8(r+i,!1))return!1;return!0}e("./p5.Geometry"),a.default.prototype.loadModel=function(e){var t,r,i;a.default._validateParameters("loadModel",arguments),i="boolean"==typeof arguments[1]?(t=arguments[1],r=arguments[2],arguments[3]):(t=!1,r=arguments[1],arguments[2]);var o=e.slice(-4),s=new a.default.Geometry;s.gid="".concat(e,"|").concat(t);var l=this;return".stl"===o?this.httpDo(e,"GET","arrayBuffer",(function(e){!function(e,t){if(function(e){for(var t=new DataView(e),r=[115,111,108,105,100],i=0;i<5;i++)if(n(r,t,i))return!1;return!0}(t))!function(e,t){for(var r,i,n,o,s,l,u,h=new DataView(t),d=h.getUint32(80,!0),c=!1,f=0;f<70;f++)1129270351===h.getUint32(f,!1)&&82===h.getUint8(f+4)&&61===h.getUint8(f+5)&&(c=!0,o=[],s=h.getUint8(f+6)/255,l=h.getUint8(f+7)/255,u=h.getUint8(f+8)/255);for(var p=0;p<d;p++){var m=84+50*p,v=h.getFloat32(m,!0),g=h.getFloat32(m+4,!0),y=h.getFloat32(m+8,!0);if(c){var _=h.getUint16(m+48,!0);n=0==(32768&_)?(r=(31&_)/31,i=(_>>5&31)/31,(_>>10&31)/31):(r=s,i=l,u)}for(var b=1;b<=3;b++){var x=m+12*b,w=new a.default.Vector(h.getFloat32(x,!0),h.getFloat32(x+8,!0),h.getFloat32(x+4,!0));e.vertices.push(w),c&&o.push(r,i,n)}var S=new a.default.Vector(v,g,y);e.vertexNormals.push(S,S,S),e.faces.push([3*p,3*p+1,3*p+2]),e.uvs.push([0,0],[0,0],[0,0])}}(e,t);else{var r=new DataView(t);if(!("TextDecoder"in window))return console.warn("Sorry, ASCII STL loading only works in browsers that support TextDecoder (https://caniuse.com/#feat=textencoder)");!function(e,t){for(var r,i,n="",o=[],s=0;s<t.length;++s){for(var l=t[s].trim(),u=l.split(" "),h=0;h<u.length;++h)""===u[h]&&u.splice(h,1);if(0!==u.length)switch(n){case"":if("solid"!==u[0])return console.error(l),console.error('Invalid state "'.concat(u[0],'", should be "solid"'));n="solid";break;case"solid":if("facet"!==u[0]||"normal"!==u[1])return console.error(l),console.error('Invalid state "'.concat(u[0],'", should be "facet normal"'));r=new a.default.Vector(parseFloat(u[2]),parseFloat(u[3]),parseFloat(u[4])),e.vertexNormals.push(r,r,r),n="facet normal";break;case"facet normal":if("outer"!==u[0]||"loop"!==u[1])return console.error(l),console.error('Invalid state "'.concat(u[0],'", should be "outer loop"'));n="vertex";break;case"vertex":if("vertex"===u[0])i=new a.default.Vector(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),e.vertices.push(i),e.uvs.push([0,0]),o.push(e.vertices.indexOf(i));else{if("endloop"!==u[0])return console.error(l),console.error('Invalid state "'.concat(u[0],'", should be "vertex" or "endloop"'));e.faces.push(o),o=[],n="endloop"}break;case"endloop":if("endfacet"!==u[0])return console.error(l),console.error('Invalid state "'.concat(u[0],'", should be "endfacet"'));n="endfacet";break;case"endfacet":if("endsolid"===u[0]);else{if("facet"!==u[0]||"normal"!==u[1])return console.error(l),console.error('Invalid state "'.concat(u[0],'", should be "endsolid" or "facet normal"'));r=new a.default.Vector(parseFloat(u[2]),parseFloat(u[3]),parseFloat(u[4])),e.vertexNormals.push(r,r,r),n="facet normal"}break;default:console.error('Invalid state "'.concat(n,'"'))}}}(e,new TextDecoder("utf-8").decode(r).split("\n"))}}(s,e),t&&s.normalize(),l._decrementPreload(),"function"==typeof r&&r(s)}),i):".obj"===o?this.loadStrings(e,(function(e){!function(e,t){for(var r={v:[],vt:[],vn:[]},i={},n=0;n<t.length;++n){var o=t[n].trim().split(/\b\s+/);if(0<o.length)if("v"===o[0]||"vn"===o[0]){var s=new a.default.Vector(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));r[o[0]].push(s)}else if("vt"===o[0]){var l=[parseFloat(o[1]),parseFloat(o[2])];r[o[0]].push(l)}else if("f"===o[0])for(var u=3;u<o.length;++u){for(var h=[],d=[1,u-1,u],c=0;c<d.length;++c){var f=o[d[c]],p=0;if(void 0!==i[f])p=i[f];else{for(var m=f.split("/"),v=0;v<m.length;v++)m[v]=parseInt(m[v])-1;p=i[f]=e.vertices.length,e.vertices.push(r.v[m[0]].copy()),r.vt[m[1]]?e.uvs.push(r.vt[m[1]].slice()):e.uvs.push([0,0]),r.vn[m[2]]&&e.vertexNormals.push(r.vn[m[2]].copy())}h.push(p)}h[0]!==h[1]&&h[0]!==h[2]&&h[1]!==h[2]&&e.faces.push(h)}}0===e.vertexNormals.length&&e.computeNormals()}(s,e),t&&s.normalize(),l._decrementPreload(),"function"==typeof r&&r(s)}),i):(a.default._friendlyFileLoadError(3,e),i?i():console.error("Sorry, the file type is invalid. Only OBJ and STL files are supported.")),s},a.default.prototype.model=function(e){this._assert3d("model"),a.default._validateParameters("model",arguments),0<e.vertices.length&&(this._renderer.geometryInHash(e.gid)||(e._makeTriangleEdges()._edgesToVertices(),this._renderer.createBuffers(e.gid,e)),this._renderer.drawBuffers(e.gid))};var o=a.default;r.default=o},{"../core/main":26,"./p5.Geometry":75}],73:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));e("./p5.Texture"),a.default.prototype.loadShader=function(e,t,r,i){a.default._validateParameters("loadShader",arguments),i||(i=console.error);var n=new a.default.Shader,o=this,s=!1,l=!1,u=function(){o._decrementPreload(),r&&r(n)};return this.loadStrings(e,(function(e){n._vertSrc=e.join("\n"),l=!0,s&&u()}),i),this.loadStrings(t,(function(e){n._fragSrc=e.join("\n"),s=!0,l&&u()}),i),n},a.default.prototype.createShader=function(e,t){return this._assert3d("createShader"),a.default._validateParameters("createShader",arguments),new a.default.Shader(this._renderer,e,t)},a.default.prototype.shader=function(e){return this._assert3d("shader"),a.default._validateParameters("shader",arguments),void 0===e._renderer&&(e._renderer=this._renderer),e.isStrokeShader()?this._renderer.userStrokeShader=e:(this._renderer.userFillShader=e,this._renderer._useNormalMaterial=!1),e.init(),this},a.default.prototype.resetShader=function(){return this._renderer.userFillShader=this._renderer.userStrokeShader=null,this},a.default.prototype.normalMaterial=function(){this._assert3d("normalMaterial");for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return a.default._validateParameters("normalMaterial",t),this._renderer.drawMode=n.FILL,this._renderer._useSpecularMaterial=!1,this._renderer._useEmissiveMaterial=!1,this._renderer._useNormalMaterial=!0,this._renderer.curFillColor=[1,1,1,1],this._renderer._setProperty("_doFill",!0),this.noStroke(),this},a.default.prototype.texture=function(e){return this._assert3d("texture"),a.default._validateParameters("texture",arguments),e.gifProperties&&e._animateGif(this),this._renderer.drawMode=n.TEXTURE,this._renderer._useSpecularMaterial=!1,this._renderer._useEmissiveMaterial=!1,this._renderer._useNormalMaterial=!1,this._renderer._tex=e,this._renderer._setProperty("_doFill",!0),this},a.default.prototype.textureMode=function(e){e!==n.IMAGE&&e!==n.NORMAL?console.warn("You tried to set ".concat(e," textureMode only supports IMAGE & NORMAL ")):this._renderer.textureMode=e},a.default.prototype.textureWrap=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:e;this._renderer.textureWrapX=e,this._renderer.textureWrapY=t;for(var r=this._renderer.textures,i=0;i<r.length;i++)r[i].setWrapMode(e,t)},a.default.prototype.ambientMaterial=function(e,t,r,i){this._assert3d("ambientMaterial"),a.default._validateParameters("ambientMaterial",arguments);var n=a.default.prototype.color.apply(this,arguments);return this._renderer.curFillColor=n._array,this._renderer._useSpecularMaterial=!1,this._renderer._useEmissiveMaterial=!1,this._renderer._useNormalMaterial=!1,this._renderer._enableLighting=!0,this._renderer._tex=null,this},a.default.prototype.emissiveMaterial=function(e,t,r,i){this._assert3d("emissiveMaterial"),a.default._validateParameters("emissiveMaterial",arguments);var n=a.default.prototype.color.apply(this,arguments);return this._renderer.curFillColor=n._array,this._renderer._useSpecularMaterial=!1,this._renderer._useEmissiveMaterial=!0,this._renderer._useNormalMaterial=!1,this._renderer._enableLighting=!0,this._renderer._tex=null,this},a.default.prototype.specularMaterial=function(e,t,r,i){this._assert3d("specularMaterial"),a.default._validateParameters("specularMaterial",arguments);var n=a.default.prototype.color.apply(this,arguments);return this._renderer.curFillColor=n._array,this._renderer._useSpecularMaterial=!0,this._renderer._useEmissiveMaterial=!1,this._renderer._useNormalMaterial=!1,this._renderer._enableLighting=!0,this._renderer._tex=null,this},a.default.prototype.shininess=function(e){return this._assert3d("shininess"),a.default._validateParameters("shininess",arguments),e<1&&(e=1),this._renderer._useShininess=e,this},a.default.RendererGL.prototype._applyColorBlend=function(e){var t=this.GL,r=this.drawMode===n.TEXTURE;return r||e[e.length-1]<1||this._isErasing?(t.depthMask(r),t.enable(t.BLEND),this._applyBlendMode()):(t.depthMask(!0),t.disable(t.BLEND)),e},a.default.RendererGL.prototype._applyBlendMode=function(){var e=this.GL;switch(this.curBlendMode){case n.BLEND:case n.ADD:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case n.REMOVE:e.blendEquation(e.FUNC_REVERSE_SUBTRACT),e.blendFunc(e.SRC_ALPHA,e.DST_ALPHA);break;case n.MULTIPLY:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ONE,e.ONE);break;case n.SCREEN:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE_MINUS_DST_COLOR,e.ONE,e.ONE,e.ONE);break;case n.EXCLUSION:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE_MINUS_DST_COLOR,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE);break;case n.REPLACE:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO);break;case n.SUBTRACT:e.blendEquationSeparate(e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case n.DARKEST:this.blendExt?(e.blendEquationSeparate(this.blendExt.MIN_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(DARKEST) does not work in your browser in WEBGL mode.");break;case n.LIGHTEST:this.blendExt?(e.blendEquationSeparate(this.blendExt.MAX_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(LIGHTEST) does not work in your browser in WEBGL mode.");break;default:console.error("Oops! Somehow RendererGL set curBlendMode to an unsupported mode.")}};var o=a.default;r.default=o},{"../core/constants":20,"../core/main":26,"./p5.Texture":81}],74:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.prototype.camera=function(){var e;this._assert3d("camera");for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return a.default._validateParameters("camera",r),(e=this._renderer._curCamera).camera.apply(e,r),this},a.default.prototype.perspective=function(){var e;this._assert3d("perspective");for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return a.default._validateParameters("perspective",r),(e=this._renderer._curCamera).perspective.apply(e,r),this},a.default.prototype.ortho=function(){var e;this._assert3d("ortho");for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return a.default._validateParameters("ortho",r),(e=this._renderer._curCamera).ortho.apply(e,r),this},a.default.prototype.frustum=function(){var e;this._assert3d("frustum");for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return a.default._validateParameters("frustum",r),(e=this._renderer._curCamera).frustum.apply(e,r),this},a.default.prototype.createCamera=function(){this._assert3d("createCamera");var e=new a.default.Camera(this._renderer);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),this._renderer._curCamera=e},a.default.Camera=function(e){this._renderer=e,this.cameraType="default",this.cameraMatrix=new a.default.Matrix,this.projMatrix=new a.default.Matrix},a.default.Camera.prototype.perspective=function(e,t,r,i){this.cameraType=0<arguments.length?"custom":"default",this.cameraFOV=void 0===e?e=this.defaultCameraFOV:this._renderer._pInst._toRadians(e),void 0===t&&(t=this.defaultAspectRatio),void 0===r&&(r=this.defaultCameraNear),void 0===i&&(i=this.defaultCameraFar),r<=1e-4&&(r=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),i<r&&console.log("Perspective far plane value is less than near plane value. Nothing will be shown."),this.aspectRatio=t,this.cameraNear=r,this.cameraFar=i,this.projMatrix=a.default.Matrix.identity();var n=1/Math.tan(this.cameraFOV/2),o=1/(this.cameraNear-this.cameraFar);this.projMatrix.set(n/t,0,0,0,0,-n,0,0,0,0,(i+r)*o,-1,0,0,2*i*r*o,0),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix.mat4[0],this.projMatrix.mat4[1],this.projMatrix.mat4[2],this.projMatrix.mat4[3],this.projMatrix.mat4[4],this.projMatrix.mat4[5],this.projMatrix.mat4[6],this.projMatrix.mat4[7],this.projMatrix.mat4[8],this.projMatrix.mat4[9],this.projMatrix.mat4[10],this.projMatrix.mat4[11],this.projMatrix.mat4[12],this.projMatrix.mat4[13],this.projMatrix.mat4[14],this.projMatrix.mat4[15])},a.default.Camera.prototype.ortho=function(e,t,r,i,n,o){void 0===e&&(e=-this._renderer.width/2),void 0===t&&(t=+this._renderer.width/2),void 0===r&&(r=-this._renderer.height/2),void 0===i&&(i=+this._renderer.height/2),void 0===n&&(n=0),void 0===o&&(o=Math.max(this._renderer.width,this._renderer.height));var s=t-e,l=i-r,u=o-n,h=2/s,d=2/l,c=-2/u,f=-(t+e)/s,p=-(i+r)/l,m=-(o+n)/u;this.projMatrix=a.default.Matrix.identity(),this.projMatrix.set(h,0,0,0,0,-d,0,0,0,0,c,0,f,p,m,1),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix.mat4[0],this.projMatrix.mat4[1],this.projMatrix.mat4[2],this.projMatrix.mat4[3],this.projMatrix.mat4[4],this.projMatrix.mat4[5],this.projMatrix.mat4[6],this.projMatrix.mat4[7],this.projMatrix.mat4[8],this.projMatrix.mat4[9],this.projMatrix.mat4[10],this.projMatrix.mat4[11],this.projMatrix.mat4[12],this.projMatrix.mat4[13],this.projMatrix.mat4[14],this.projMatrix.mat4[15]),this.cameraType="custom"},a.default.Camera.prototype.frustum=function(e,t,r,i,n,o){void 0===e&&(e=-this._renderer.width/2),void 0===t&&(t=+this._renderer.width/2),void 0===r&&(r=-this._renderer.height/2),void 0===i&&(i=+this._renderer.height/2),void 0===n&&(n=0),void 0===o&&(o=Math.max(this._renderer.width,this._renderer.height));var s=t-e,l=i-r,u=o-n,h=2*n/s,d=2*n/l,c=-2*o*n/u,f=(t+e)/s,p=(i+r)/l,m=-(o+n)/u;this.projMatrix=a.default.Matrix.identity(),this.projMatrix.set(h,0,0,0,0,d,0,0,f,p,m,-1,0,0,c,0),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix.mat4[0],this.projMatrix.mat4[1],this.projMatrix.mat4[2],this.projMatrix.mat4[3],this.projMatrix.mat4[4],this.projMatrix.mat4[5],this.projMatrix.mat4[6],this.projMatrix.mat4[7],this.projMatrix.mat4[8],this.projMatrix.mat4[9],this.projMatrix.mat4[10],this.projMatrix.mat4[11],this.projMatrix.mat4[12],this.projMatrix.mat4[13],this.projMatrix.mat4[14],this.projMatrix.mat4[15]),this.cameraType="custom"},a.default.Camera.prototype._rotateView=function(e,t,r,i){var n=this.centerX,o=this.centerY,s=this.centerZ;n-=this.eyeX,o-=this.eyeY,s-=this.eyeZ;var l=a.default.Matrix.identity(this._renderer._pInst);l.rotate(this._renderer._pInst._toRadians(e),t,r,i);var u=[n*l.mat4[0]+o*l.mat4[4]+s*l.mat4[8],n*l.mat4[1]+o*l.mat4[5]+s*l.mat4[9],n*l.mat4[2]+o*l.mat4[6]+s*l.mat4[10]];u[0]+=this.eyeX,u[1]+=this.eyeY,u[2]+=this.eyeZ,this.camera(this.eyeX,this.eyeY,this.eyeZ,u[0],u[1],u[2],this.upX,this.upY,this.upZ)},a.default.Camera.prototype.pan=function(e){var t=this._getLocalAxes();this._rotateView(e,t.y[0],t.y[1],t.y[2])},a.default.Camera.prototype.tilt=function(e){var t=this._getLocalAxes();this._rotateView(e,t.x[0],t.x[1],t.x[2])},a.default.Camera.prototype.lookAt=function(e,t,r){this.camera(this.eyeX,this.eyeY,this.eyeZ,e,t,r,this.upX,this.upY,this.upZ)},a.default.Camera.prototype.camera=function(e,t,r,i,a,n,o,s,l){void 0===e&&(e=this.defaultEyeX,t=this.defaultEyeY,r=this.defaultEyeZ,i=e,a=t,s=1,l=o=n=0),this.eyeX=e,this.eyeY=t,this.eyeZ=r,this.centerX=i,this.centerY=a,this.centerZ=n,this.upX=o,this.upY=s,this.upZ=l;var u=this._getLocalAxes();this.cameraMatrix.set(u.x[0],u.y[0],u.z[0],0,u.x[1],u.y[1],u.z[1],0,u.x[2],u.y[2],u.z[2],0,0,0,0,1);var h=-e,d=-t,c=-r;return this.cameraMatrix.translate([h,d,c]),this._isActive()&&this._renderer.uMVMatrix.set(this.cameraMatrix.mat4[0],this.cameraMatrix.mat4[1],this.cameraMatrix.mat4[2],this.cameraMatrix.mat4[3],this.cameraMatrix.mat4[4],this.cameraMatrix.mat4[5],this.cameraMatrix.mat4[6],this.cameraMatrix.mat4[7],this.cameraMatrix.mat4[8],this.cameraMatrix.mat4[9],this.cameraMatrix.mat4[10],this.cameraMatrix.mat4[11],this.cameraMatrix.mat4[12],this.cameraMatrix.mat4[13],this.cameraMatrix.mat4[14],this.cameraMatrix.mat4[15]),this},a.default.Camera.prototype.move=function(e,t,r){var i=this._getLocalAxes(),a=[i.x[0]*e,i.x[1]*e,i.x[2]*e],n=[i.y[0]*t,i.y[1]*t,i.y[2]*t],o=[i.z[0]*r,i.z[1]*r,i.z[2]*r];this.camera(this.eyeX+a[0]+n[0]+o[0],this.eyeY+a[1]+n[1]+o[1],this.eyeZ+a[2]+n[2]+o[2],this.centerX+a[0]+n[0]+o[0],this.centerY+a[1]+n[1]+o[1],this.centerZ+a[2]+n[2]+o[2],0,1,0)},a.default.Camera.prototype.setPosition=function(e,t,r){var i=e-this.eyeX,a=t-this.eyeY,n=r-this.eyeZ;this.camera(e,t,r,this.centerX+i,this.centerY+a,this.centerZ+n,0,1,0)},a.default.Camera.prototype._computeCameraDefaultSettings=function(){this.defaultCameraFOV=60/180*Math.PI,this.defaultAspectRatio=this._renderer.width/this._renderer.height,this.defaultEyeX=0,this.defaultEyeY=0,this.defaultEyeZ=this._renderer.height/2/Math.tan(this.defaultCameraFOV/2),this.defaultCenterX=0,this.defaultCenterY=0,this.defaultCenterZ=0,this.defaultCameraNear=.1*this.defaultEyeZ,this.defaultCameraFar=10*this.defaultEyeZ},a.default.Camera.prototype._setDefaultCamera=function(){this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.eyeX=this.defaultEyeX,this.eyeY=this.defaultEyeY,this.eyeZ=this.defaultEyeZ,this.centerX=this.defaultCenterX,this.centerY=this.defaultCenterY,this.centerZ=this.defaultCenterZ,this.upX=0,this.upY=1,this.upZ=0,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.perspective(),this.camera(),this.cameraType="default"},a.default.Camera.prototype._resize=function(){"default"===this.cameraType?(this._computeCameraDefaultSettings(),this._setDefaultCamera()):this.perspective(this.cameraFOV,this._renderer.width/this._renderer.height)},a.default.Camera.prototype.copy=function(){var e=new a.default.Camera(this._renderer);return e.cameraFOV=this.cameraFOV,e.aspectRatio=this.aspectRatio,e.eyeX=this.eyeX,e.eyeY=this.eyeY,e.eyeZ=this.eyeZ,e.centerX=this.centerX,e.centerY=this.centerY,e.centerZ=this.centerZ,e.cameraNear=this.cameraNear,e.cameraFar=this.cameraFar,e.cameraType=this.cameraType,e.cameraMatrix=this.cameraMatrix.copy(),e.projMatrix=this.projMatrix.copy(),e},a.default.Camera.prototype._getLocalAxes=function(){var e=this.eyeX-this.centerX,t=this.eyeY-this.centerY,r=this.eyeZ-this.centerZ,i=Math.sqrt(e*e+t*t+r*r);0!==i&&(e/=i,t/=i,r/=i);var a=this.upX,n=this.upY,o=this.upZ,s=n*r-o*t,l=-a*r+o*e,u=a*t-n*e;a=t*u-r*l,n=-e*u+r*s,o=e*l-t*s;var h=Math.sqrt(s*s+l*l+u*u);0!==h&&(s/=h,l/=h,u/=h);var d=Math.sqrt(a*a+n*n+o*o);return 0!==d&&(a/=d,n/=d,o/=d),{x:[s,l,u],y:[a,n,o],z:[e,t,r]}},a.default.Camera.prototype._orbit=function(e,t,r){var i=this.eyeX-this.centerX,a=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ,o=Math.sqrt(i*i+a*a+n*n),s=Math.atan2(i,n),l=Math.acos(Math.max(-1,Math.min(1,a/o)));s+=e,(o+=r)<0&&(o=.1),(l+=t)>Math.PI?l=Math.PI:l<=0&&(l=.001);var u=Math.sin(l)*o*Math.sin(s),h=Math.cos(l)*o,d=Math.sin(l)*o*Math.cos(s);this.camera(u+this.centerX,h+this.centerY,d+this.centerZ,this.centerX,this.centerY,this.centerZ,0,1,0)},a.default.Camera.prototype._isActive=function(){return this===this._renderer._curCamera},a.default.prototype.setCamera=function(e){this._renderer._curCamera=e,this._renderer.uPMatrix.set(e.projMatrix.mat4[0],e.projMatrix.mat4[1],e.projMatrix.mat4[2],e.projMatrix.mat4[3],e.projMatrix.mat4[4],e.projMatrix.mat4[5],e.projMatrix.mat4[6],e.projMatrix.mat4[7],e.projMatrix.mat4[8],e.projMatrix.mat4[9],e.projMatrix.mat4[10],e.projMatrix.mat4[11],e.projMatrix.mat4[12],e.projMatrix.mat4[13],e.projMatrix.mat4[14],e.projMatrix.mat4[15])};var n=a.default.Camera;r.default=n},{"../core/main":26}],75:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.Geometry=function(e,t,r){return this.vertices=[],this.lineVertices=[],this.lineNormals=[],this.vertexNormals=[],this.faces=[],this.uvs=[],this.edges=[],this.detailX=void 0!==e?e:1,this.detailY=void 0!==t?t:1,this.dirtyFlags={},r instanceof Function&&r.call(this),this},a.default.Geometry.prototype.reset=function(){this.lineVertices.length=0,this.lineNormals.length=0,this.vertices.length=0,this.edges.length=0,this.vertexColors.length=0,this.vertexNormals.length=0,this.uvs.length=0,this.dirtyFlags={}},a.default.Geometry.prototype.computeFaces=function(){this.faces.length=0;for(var e,t,r,i,a=this.detailX+1,n=0;n<this.detailY;n++)for(var o=0;o<this.detailX;o++)t=(e=n*a+o)+1,r=(n+1)*a+o+1,i=(n+1)*a+o,this.faces.push([e,t,i]),this.faces.push([i,t,r]);return this},a.default.Geometry.prototype._getFaceNormal=function(e){var t=this.faces[e],r=this.vertices[t[0]],i=this.vertices[t[1]],n=this.vertices[t[2]],o=a.default.Vector.sub(i,r),s=a.default.Vector.sub(n,r),l=a.default.Vector.cross(o,s),u=a.default.Vector.mag(l),h=u/(a.default.Vector.mag(o)*a.default.Vector.mag(s));return 0===h||isNaN(h)?(console.warn("p5.Geometry.prototype._getFaceNormal:","face has colinear sides or a repeated vertex"),l):(1<h&&(h=1),l.mult(Math.asin(h)/u))},a.default.Geometry.prototype.computeNormals=function(){var e,t=this.vertexNormals,r=this.vertices,i=this.faces;for(e=t.length=0;e<r.length;++e)t.push(new a.default.Vector);for(var n=0;n<i.length;++n)for(var o=i[n],s=this._getFaceNormal(n),l=0;l<3;++l)t[o[l]].add(s);for(e=0;e<r.length;++e)t[e].normalize();return this},a.default.Geometry.prototype.averageNormals=function(){for(var e=0;e<=this.detailY;e++){var t=this.detailX+1,r=a.default.Vector.add(this.vertexNormals[e*t],this.vertexNormals[e*t+this.detailX]);r=a.default.Vector.div(r,2),this.vertexNormals[e*t]=r,this.vertexNormals[e*t+this.detailX]=r}return this},a.default.Geometry.prototype.averagePoleNormals=function(){for(var e=new a.default.Vector(0,0,0),t=0;t<this.detailX;t++)e.add(this.vertexNormals[t]);e=a.default.Vector.div(e,this.detailX);for(var r=0;r<this.detailX;r++)this.vertexNormals[r]=e;e=new a.default.Vector(0,0,0);for(var i=this.vertices.length-1;i>this.vertices.length-1-this.detailX;i--)e.add(this.vertexNormals[i]);e=a.default.Vector.div(e,this.detailX);for(var n=this.vertices.length-1;n>this.vertices.length-1-this.detailX;n--)this.vertexNormals[n]=e;return this},a.default.Geometry.prototype._makeTriangleEdges=function(){if(this.edges.length=0,Array.isArray(this.strokeIndices))for(var e=0,t=this.strokeIndices.length;e<t;e++)this.edges.push(this.strokeIndices[e]);else for(var r=0;r<this.faces.length;r++)this.edges.push([this.faces[r][0],this.faces[r][1]]),this.edges.push([this.faces[r][1],this.faces[r][2]]),this.edges.push([this.faces[r][2],this.faces[r][0]]);return this},a.default.Geometry.prototype._edgesToVertices=function(){this.lineVertices.length=0;for(var e=this.lineNormals.length=0;e<this.edges.length;e++){var t=this.vertices[this.edges[e][0]],r=this.vertices[this.edges[e][1]],i=r.copy().sub(t).normalize(),a=t.array(),n=t.array(),o=r.array(),s=r.array(),l=i.array(),u=i.array();l.push(1),u.push(-1),this.lineNormals.push(l,u,l,l,u,u),this.lineVertices.push(a,n,o,o,n,s)}return this},a.default.Geometry.prototype.normalize=function(){if(0<this.vertices.length){for(var e=this.vertices[0].copy(),t=this.vertices[0].copy(),r=0;r<this.vertices.length;r++)e.x=Math.max(e.x,this.vertices[r].x),t.x=Math.min(t.x,this.vertices[r].x),e.y=Math.max(e.y,this.vertices[r].y),t.y=Math.min(t.y,this.vertices[r].y),e.z=Math.max(e.z,this.vertices[r].z),t.z=Math.min(t.z,this.vertices[r].z);for(var i=a.default.Vector.lerp(e,t,.5),n=a.default.Vector.sub(e,t),o=200/Math.max(Math.max(n.x,n.y),n.z),s=0;s<this.vertices.length;s++)this.vertices[s].sub(i),this.vertices[s].mult(o)}return this};var n=a.default.Geometry;r.default=n},{"../core/main":26}],76:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=Array,o=function(e){return e instanceof Array};"undefined"!=typeof Float32Array&&(n=Float32Array,o=function(e){return e instanceof Array||e instanceof Float32Array}),a.default.Matrix=function(){for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];return e.length&&e[e.length-1]instanceof a.default&&(this.p5=e[e.length-1]),"mat3"===e[0]?this.mat3=Array.isArray(e[1])?e[1]:new n([1,0,0,0,1,0,0,0,1]):this.mat4=Array.isArray(e[0])?e[0]:new n([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this},a.default.Matrix.prototype.set=function(e){return e instanceof a.default.Matrix?this.mat4=e.mat4:o(e)?this.mat4=e:16===arguments.length&&(this.mat4[0]=e,this.mat4[1]=arguments[1],this.mat4[2]=arguments[2],this.mat4[3]=arguments[3],this.mat4[4]=arguments[4],this.mat4[5]=arguments[5],this.mat4[6]=arguments[6],this.mat4[7]=arguments[7],this.mat4[8]=arguments[8],this.mat4[9]=arguments[9],this.mat4[10]=arguments[10],this.mat4[11]=arguments[11],this.mat4[12]=arguments[12],this.mat4[13]=arguments[13],this.mat4[14]=arguments[14],this.mat4[15]=arguments[15]),this},a.default.Matrix.prototype.get=function(){return new a.default.Matrix(this.mat4,this.p5)},a.default.Matrix.prototype.copy=function(){var e=new a.default.Matrix(this.p5);return e.mat4[0]=this.mat4[0],e.mat4[1]=this.mat4[1],e.mat4[2]=this.mat4[2],e.mat4[3]=this.mat4[3],e.mat4[4]=this.mat4[4],e.mat4[5]=this.mat4[5],e.mat4[6]=this.mat4[6],e.mat4[7]=this.mat4[7],e.mat4[8]=this.mat4[8],e.mat4[9]=this.mat4[9],e.mat4[10]=this.mat4[10],e.mat4[11]=this.mat4[11],e.mat4[12]=this.mat4[12],e.mat4[13]=this.mat4[13],e.mat4[14]=this.mat4[14],e.mat4[15]=this.mat4[15],e},a.default.Matrix.identity=function(e){return new a.default.Matrix(e)},a.default.Matrix.prototype.transpose=function(e){var t,r,i,n,s,l;return e instanceof a.default.Matrix?(t=e.mat4[1],r=e.mat4[2],i=e.mat4[3],n=e.mat4[6],s=e.mat4[7],l=e.mat4[11],this.mat4[0]=e.mat4[0],this.mat4[1]=e.mat4[4],this.mat4[2]=e.mat4[8],this.mat4[3]=e.mat4[12],this.mat4[4]=t,this.mat4[5]=e.mat4[5],this.mat4[6]=e.mat4[9],this.mat4[7]=e.mat4[13],this.mat4[8]=r,this.mat4[9]=n,this.mat4[10]=e.mat4[10],this.mat4[11]=e.mat4[14],this.mat4[12]=i,this.mat4[13]=s,this.mat4[14]=l,this.mat4[15]=e.mat4[15]):o(e)&&(t=e[1],r=e[2],i=e[3],n=e[6],s=e[7],l=e[11],this.mat4[0]=e[0],this.mat4[1]=e[4],this.mat4[2]=e[8],this.mat4[3]=e[12],this.mat4[4]=t,this.mat4[5]=e[5],this.mat4[6]=e[9],this.mat4[7]=e[13],this.mat4[8]=r,this.mat4[9]=n,this.mat4[10]=e[10],this.mat4[11]=e[14],this.mat4[12]=i,this.mat4[13]=s,this.mat4[14]=l,this.mat4[15]=e[15]),this},a.default.Matrix.prototype.invert=function(e){var t,r,i,n,s,l,u,h,d,c,f,p,m,v,g,y;e instanceof a.default.Matrix?(t=e.mat4[0],r=e.mat4[1],i=e.mat4[2],n=e.mat4[3],s=e.mat4[4],l=e.mat4[5],u=e.mat4[6],h=e.mat4[7],d=e.mat4[8],c=e.mat4[9],f=e.mat4[10],p=e.mat4[11],m=e.mat4[12],v=e.mat4[13],g=e.mat4[14],y=e.mat4[15]):o(e)&&(t=e[0],r=e[1],i=e[2],n=e[3],s=e[4],l=e[5],u=e[6],h=e[7],d=e[8],c=e[9],f=e[10],p=e[11],m=e[12],v=e[13],g=e[14],y=e[15]);var _=t*l-r*s,b=t*u-i*s,x=t*h-n*s,w=r*u-i*l,S=r*h-n*l,M=i*h-n*u,E=d*v-c*m,T=d*g-f*m,C=d*y-p*m,P=c*g-f*v,L=c*y-p*v,R=f*y-p*g,O=_*R-b*L+x*P+w*C-S*T+M*E;return O?(O=1/O,this.mat4[0]=(l*R-u*L+h*P)*O,this.mat4[1]=(i*L-r*R-n*P)*O,this.mat4[2]=(v*M-g*S+y*w)*O,this.mat4[3]=(f*S-c*M-p*w)*O,this.mat4[4]=(u*C-s*R-h*T)*O,this.mat4[5]=(t*R-i*C+n*T)*O,this.mat4[6]=(g*x-m*M-y*b)*O,this.mat4[7]=(d*M-f*x+p*b)*O,this.mat4[8]=(s*L-l*C+h*E)*O,this.mat4[9]=(r*C-t*L-n*E)*O,this.mat4[10]=(m*S-v*x+y*_)*O,this.mat4[11]=(c*x-d*S-p*_)*O,this.mat4[12]=(l*T-s*P-u*E)*O,this.mat4[13]=(t*P-r*T+i*E)*O,this.mat4[14]=(v*b-m*w-g*_)*O,this.mat4[15]=(d*w-c*b+f*_)*O,this):null},a.default.Matrix.prototype.invert3x3=function(){var e=this.mat3[0],t=this.mat3[1],r=this.mat3[2],i=this.mat3[3],a=this.mat3[4],n=this.mat3[5],o=this.mat3[6],s=this.mat3[7],l=this.mat3[8],u=l*a-n*s,h=-l*i+n*o,d=s*i-a*o,c=e*u+t*h+r*d;return c?(c=1/c,this.mat3[0]=u*c,this.mat3[1]=(-l*t+r*s)*c,this.mat3[2]=(n*t-r*a)*c,this.mat3[3]=h*c,this.mat3[4]=(l*e-r*o)*c,this.mat3[5]=(-n*e+r*i)*c,this.mat3[6]=d*c,this.mat3[7]=(-s*e+t*o)*c,this.mat3[8]=(a*e-t*i)*c,this):null},a.default.Matrix.prototype.transpose3x3=function(e){var t=e[1],r=e[2],i=e[5];return this.mat3[1]=e[3],this.mat3[2]=e[6],this.mat3[3]=t,this.mat3[5]=e[7],this.mat3[6]=r,this.mat3[7]=i,this},a.default.Matrix.prototype.inverseTranspose=function(e){void 0===this.mat3?console.error("sorry, this function only works with mat3"):(this.mat3[0]=e.mat4[0],this.mat3[1]=e.mat4[1],this.mat3[2]=e.mat4[2],this.mat3[3]=e.mat4[4],this.mat3[4]=e.mat4[5],this.mat3[5]=e.mat4[6],this.mat3[6]=e.mat4[8],this.mat3[7]=e.mat4[9],this.mat3[8]=e.mat4[10]);var t=this.invert3x3();if(t)t.transpose3x3(this.mat3);else for(var r=0;r<9;r++)this.mat3[r]=0;return this},a.default.Matrix.prototype.determinant=function(){var e=this.mat4[0]*this.mat4[5]-this.mat4[1]*this.mat4[4],t=this.mat4[0]*this.mat4[6]-this.mat4[2]*this.mat4[4],r=this.mat4[0]*this.mat4[7]-this.mat4[3]*this.mat4[4],i=this.mat4[1]*this.mat4[6]-this.mat4[2]*this.mat4[5],a=this.mat4[1]*this.mat4[7]-this.mat4[3]*this.mat4[5],n=this.mat4[2]*this.mat4[7]-this.mat4[3]*this.mat4[6],o=this.mat4[8]*this.mat4[13]-this.mat4[9]*this.mat4[12],s=this.mat4[8]*this.mat4[14]-this.mat4[10]*this.mat4[12],l=this.mat4[8]*this.mat4[15]-this.mat4[11]*this.mat4[12],u=this.mat4[9]*this.mat4[14]-this.mat4[10]*this.mat4[13],h=this.mat4[9]*this.mat4[15]-this.mat4[11]*this.mat4[13];return e*(this.mat4[10]*this.mat4[15]-this.mat4[11]*this.mat4[14])-t*h+r*u+i*l-a*s+n*o},a.default.Matrix.prototype.mult=function(e){var t;if(e===this||e===this.mat4)t=this.copy().mat4;else if(e instanceof a.default.Matrix)t=e.mat4;else if(o(e))t=e;else{if(16!==arguments.length)return;t=arguments}var r=this.mat4[0],i=this.mat4[1],n=this.mat4[2],s=this.mat4[3];return this.mat4[0]=r*t[0]+i*t[4]+n*t[8]+s*t[12],this.mat4[1]=r*t[1]+i*t[5]+n*t[9]+s*t[13],this.mat4[2]=r*t[2]+i*t[6]+n*t[10]+s*t[14],this.mat4[3]=r*t[3]+i*t[7]+n*t[11]+s*t[15],r=this.mat4[4],i=this.mat4[5],n=this.mat4[6],s=this.mat4[7],this.mat4[4]=r*t[0]+i*t[4]+n*t[8]+s*t[12],this.mat4[5]=r*t[1]+i*t[5]+n*t[9]+s*t[13],this.mat4[6]=r*t[2]+i*t[6]+n*t[10]+s*t[14],this.mat4[7]=r*t[3]+i*t[7]+n*t[11]+s*t[15],r=this.mat4[8],i=this.mat4[9],n=this.mat4[10],s=this.mat4[11],this.mat4[8]=r*t[0]+i*t[4]+n*t[8]+s*t[12],this.mat4[9]=r*t[1]+i*t[5]+n*t[9]+s*t[13],this.mat4[10]=r*t[2]+i*t[6]+n*t[10]+s*t[14],this.mat4[11]=r*t[3]+i*t[7]+n*t[11]+s*t[15],r=this.mat4[12],i=this.mat4[13],n=this.mat4[14],s=this.mat4[15],this.mat4[12]=r*t[0]+i*t[4]+n*t[8]+s*t[12],this.mat4[13]=r*t[1]+i*t[5]+n*t[9]+s*t[13],this.mat4[14]=r*t[2]+i*t[6]+n*t[10]+s*t[14],this.mat4[15]=r*t[3]+i*t[7]+n*t[11]+s*t[15],this},a.default.Matrix.prototype.apply=function(e){var t;if(e===this||e===this.mat4)t=this.copy().mat4;else if(e instanceof a.default.Matrix)t=e.mat4;else if(o(e))t=e;else{if(16!==arguments.length)return;t=arguments}var r=this.mat4,i=r[0],n=r[4],s=r[8],l=r[12];r[0]=t[0]*i+t[1]*n+t[2]*s+t[3]*l,r[4]=t[4]*i+t[5]*n+t[6]*s+t[7]*l,r[8]=t[8]*i+t[9]*n+t[10]*s+t[11]*l,r[12]=t[12]*i+t[13]*n+t[14]*s+t[15]*l;var u=r[1],h=r[5],d=r[9],c=r[13];r[1]=t[0]*u+t[1]*h+t[2]*d+t[3]*c,r[5]=t[4]*u+t[5]*h+t[6]*d+t[7]*c,r[9]=t[8]*u+t[9]*h+t[10]*d+t[11]*c,r[13]=t[12]*u+t[13]*h+t[14]*d+t[15]*c;var f=r[2],p=r[6],m=r[10],v=r[14];r[2]=t[0]*f+t[1]*p+t[2]*m+t[3]*v,r[6]=t[4]*f+t[5]*p+t[6]*m+t[7]*v,r[10]=t[8]*f+t[9]*p+t[10]*m+t[11]*v,r[14]=t[12]*f+t[13]*p+t[14]*m+t[15]*v;var g=r[3],y=r[7],_=r[11],b=r[15];return r[3]=t[0]*g+t[1]*y+t[2]*_+t[3]*b,r[7]=t[4]*g+t[5]*y+t[6]*_+t[7]*b,r[11]=t[8]*g+t[9]*y+t[10]*_+t[11]*b,r[15]=t[12]*g+t[13]*y+t[14]*_+t[15]*b,this},a.default.Matrix.prototype.scale=function(e,t,r){return e instanceof a.default.Vector?(t=e.y,r=e.z,e=e.x):e instanceof Array&&(t=e[1],r=e[2],e=e[0]),this.mat4[0]*=e,this.mat4[1]*=e,this.mat4[2]*=e,this.mat4[3]*=e,this.mat4[4]*=t,this.mat4[5]*=t,this.mat4[6]*=t,this.mat4[7]*=t,this.mat4[8]*=r,this.mat4[9]*=r,this.mat4[10]*=r,this.mat4[11]*=r,this},a.default.Matrix.prototype.rotate=function(e,t,r,i){t instanceof a.default.Vector?(r=t.y,i=t.z,t=t.x):t instanceof Array&&(r=t[1],i=t[2],t=t[0]);var n=Math.sqrt(t*t+r*r+i*i);t*=1/n,r*=1/n,i*=1/n;var o=this.mat4[0],s=this.mat4[1],l=this.mat4[2],u=this.mat4[3],h=this.mat4[4],d=this.mat4[5],c=this.mat4[6],f=this.mat4[7],p=this.mat4[8],m=this.mat4[9],v=this.mat4[10],g=this.mat4[11],y=Math.sin(e),_=Math.cos(e),b=1-_,x=t*t*b+_,w=r*t*b+i*y,S=i*t*b-r*y,M=t*r*b-i*y,E=r*r*b+_,T=i*r*b+t*y,C=t*i*b+r*y,P=r*i*b-t*y,L=i*i*b+_;return this.mat4[0]=o*x+h*w+p*S,this.mat4[1]=s*x+d*w+m*S,this.mat4[2]=l*x+c*w+v*S,this.mat4[3]=u*x+f*w+g*S,this.mat4[4]=o*M+h*E+p*T,this.mat4[5]=s*M+d*E+m*T,this.mat4[6]=l*M+c*E+v*T,this.mat4[7]=u*M+f*E+g*T,this.mat4[8]=o*C+h*P+p*L,this.mat4[9]=s*C+d*P+m*L,this.mat4[10]=l*C+c*P+v*L,this.mat4[11]=u*C+f*P+g*L,this},a.default.Matrix.prototype.translate=function(e){var t=e[0],r=e[1],i=e[2]||0;this.mat4[12]+=this.mat4[0]*t+this.mat4[4]*r+this.mat4[8]*i,this.mat4[13]+=this.mat4[1]*t+this.mat4[5]*r+this.mat4[9]*i,this.mat4[14]+=this.mat4[2]*t+this.mat4[6]*r+this.mat4[10]*i,this.mat4[15]+=this.mat4[3]*t+this.mat4[7]*r+this.mat4[11]*i},a.default.Matrix.prototype.rotateX=function(e){this.rotate(e,1,0,0)},a.default.Matrix.prototype.rotateY=function(e){this.rotate(e,0,1,0)},a.default.Matrix.prototype.rotateZ=function(e){this.rotate(e,0,0,1)},a.default.Matrix.prototype.perspective=function(e,t,r,i){var a=1/Math.tan(e/2),n=1/(r-i);return this.mat4[0]=a/t,this.mat4[1]=0,this.mat4[2]=0,this.mat4[3]=0,this.mat4[4]=0,this.mat4[5]=a,this.mat4[6]=0,this.mat4[7]=0,this.mat4[8]=0,this.mat4[9]=0,this.mat4[10]=(i+r)*n,this.mat4[11]=-1,this.mat4[12]=0,this.mat4[13]=0,this.mat4[14]=2*i*r*n,this.mat4[15]=0,this},a.default.Matrix.prototype.ortho=function(e,t,r,i,a,n){var o=1/(e-t),s=1/(r-i),l=1/(a-n);return this.mat4[0]=-2*o,this.mat4[1]=0,this.mat4[2]=0,this.mat4[3]=0,this.mat4[4]=0,this.mat4[5]=-2*s,this.mat4[6]=0,this.mat4[7]=0,this.mat4[8]=0,this.mat4[9]=0,this.mat4[10]=2*l,this.mat4[11]=0,this.mat4[12]=(e+t)*o,this.mat4[13]=(i+r)*s,this.mat4[14]=(n+a)*l,this.mat4[15]=1,this};var s=a.default.Matrix;r.default=s},{"../core/main":26}],77:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));a.default.RendererGL.prototype.beginShape=function(e){return this.immediateMode.shapeMode=void 0!==e?e:n.LINE_STRIP,void 0===this.immediateMode.vertices?(this.immediateMode.vertices=[],this.immediateMode.edges=[],this.immediateMode.lineVertices=[],this.immediateMode.vertexColors=[],this.immediateMode.lineNormals=[],this.immediateMode.uvCoords=[],this.immediateMode.vertexBuffer=this.GL.createBuffer(),this.immediateMode.colorBuffer=this.GL.createBuffer(),this.immediateMode.uvBuffer=this.GL.createBuffer(),this.immediateMode.lineVertexBuffer=this.GL.createBuffer(),this.immediateMode.lineNormalBuffer=this.GL.createBuffer(),this.immediateMode.pointVertexBuffer=this.GL.createBuffer(),this.immediateMode._bezierVertex=[],this.immediateMode._quadraticVertex=[],this.immediateMode._curveVertex=[],this.immediateMode._isCoplanar=!0,this.immediateMode._testIfCoplanar=null):(this.immediateMode.vertices.length=0,this.immediateMode.edges.length=0,this.immediateMode.lineVertices.length=0,this.immediateMode.lineNormals.length=0,this.immediateMode.vertexColors.length=0,this.immediateMode.uvCoords.length=0),this.isImmediateDrawing=!0,this},a.default.RendererGL.prototype.vertex=function(e,t){var r,i,o;r=i=o=0,3===arguments.length?r=arguments[2]:4===arguments.length?(i=arguments[2],o=arguments[3]):5===arguments.length&&(r=arguments[2],i=arguments[3],o=arguments[4]),null==this.immediateMode._testIfCoplanar?this.immediateMode._testIfCoplanar=r:this.immediateMode._testIfCoplanar!==r&&(this.immediateMode._isCoplanar=!1);var s=new a.default.Vector(e,t,r);this.immediateMode.vertices.push(s);var l=this.curFillColor||[.5,.5,.5,1];return this.immediateMode.vertexColors.push(l[0],l[1],l[2],l[3]),this.textureMode===n.IMAGE&&(null!==this._tex?0<this._tex.width&&0<this._tex.height&&(i/=this._tex.width,o/=this._tex.height):null===this._tex&&4<=arguments.length&&console.warn("You must first call texture() before using vertex() with image based u and v coordinates")),this.immediateMode.uvCoords.push(i,o),this.immediateMode._bezierVertex[0]=e,this.immediateMode._bezierVertex[1]=t,this.immediateMode._bezierVertex[2]=r,this.immediateMode._quadraticVertex[0]=e,this.immediateMode._quadraticVertex[1]=t,this.immediateMode._quadraticVertex[2]=r,this},a.default.RendererGL.prototype.endShape=function(e,t,r,i,o,s){if(this.immediateMode.shapeMode===n.POINTS)this._drawPoints(this.immediateMode.vertices,this.immediateMode.pointVertexBuffer);else if(1<this.immediateMode.vertices.length){if(this._doStroke&&this.drawMode!==n.TEXTURE){if(this.immediateMode.shapeMode===n.TRIANGLE_STRIP){var l;for(l=0;l<this.immediateMode.vertices.length-2;l++)this.immediateMode.edges.push([l,l+1]),this.immediateMode.edges.push([l,l+2]);this.immediateMode.edges.push([l,l+1])}else if(this.immediateMode.shapeMode===n.TRIANGLES)for(var u=0;u<this.immediateMode.vertices.length-2;u+=3)this.immediateMode.edges.push([u,u+1]),this.immediateMode.edges.push([u+1,u+2]),this.immediateMode.edges.push([u+2,u]);else if(this.immediateMode.shapeMode===n.LINES)for(var h=0;h<this.immediateMode.vertices.length-1;h+=2)this.immediateMode.edges.push([h,h+1]);else for(var d=0;d<this.immediateMode.vertices.length-1;d++)this.immediateMode.edges.push([d,d+1]);e===n.CLOSE&&this.immediateMode.edges.push([this.immediateMode.vertices.length-1,0]),a.default.Geometry.prototype._edgesToVertices.call(this.immediateMode),this._drawStrokeImmediateMode()}if(this._doFill&&this.immediateMode.shapeMode!==n.LINES){if(this.isBezier||this.isQuadratic||this.isCurve||this.immediateMode.shapeMode===n.LINE_STRIP&&this.drawMode===n.FILL&&!0===this.immediateMode._isCoplanar){this.immediateMode.shapeMode=n.TRIANGLES;var c=[new Float32Array(this._vToNArray(this.immediateMode.vertices))],f=this._triangulate(c);this.immediateMode.vertices=[];for(var p=0,m=f.length;p<m;p+=3)this.vertex(f[p],f[p+1],f[p+2])}0<this.immediateMode.vertices.length&&this._drawFillImmediateMode(e,t,r,i,o,s)}}return this.immediateMode.vertices.length=0,this.immediateMode.vertexColors.length=0,this.immediateMode.uvCoords.length=0,this.isImmediateDrawing=!1,this.isBezier=!1,this.isQuadratic=!1,this.isCurve=!1,this.immediateMode._bezierVertex.length=0,this.immediateMode._quadraticVertex.length=0,this.immediateMode._curveVertex.length=0,this.immediateMode._isCoplanar=!0,this.immediateMode._testIfCoplanar=null,this},a.default.RendererGL.prototype._drawFillImmediateMode=function(e,t,r,i,a,o){var s=this.GL,l=this._getImmediateFillShader();if(this._setFillUniforms(l),l.attributes.aPosition&&(this._bindBuffer(this.immediateMode.vertexBuffer,s.ARRAY_BUFFER,this._vToNArray(this.immediateMode.vertices),Float32Array,s.DYNAMIC_DRAW),l.enableAttrib(l.attributes.aPosition,3)),this.drawMode===n.FILL&&l.attributes.aVertexColor&&(this._bindBuffer(this.immediateMode.colorBuffer,s.ARRAY_BUFFER,this.immediateMode.vertexColors,Float32Array,s.DYNAMIC_DRAW),l.enableAttrib(l.attributes.aVertexColor,4)),this.drawMode===n.TEXTURE&&l.attributes.aTexCoord&&(this._bindBuffer(this.immediateMode.uvBuffer,s.ARRAY_BUFFER,this.immediateMode.uvCoords,Float32Array,s.DYNAMIC_DRAW),l.enableAttrib(l.attributes.aTexCoord,2)),this.drawMode===n.FILL||this.drawMode===n.TEXTURE)switch(this.immediateMode.shapeMode){case n.LINE_STRIP:case n.LINES:this.immediateMode.shapeMode=n.TRIANGLE_FAN}else switch(this.immediateMode.shapeMode){case n.LINE_STRIP:case n.LINES:this.immediateMode.shapeMode=n.LINE_LOOP}if(this.immediateMode.shapeMode===n.QUADS||this.immediateMode.shapeMode===n.QUAD_STRIP)throw new Error("sorry, ".concat(this.immediateMode.shapeMode," not yet implemented in webgl mode."));this._applyColorBlend(this.curFillColor),s.enable(s.BLEND),s.drawArrays(this.immediateMode.shapeMode,0,this.immediateMode.vertices.length),l.unbindShader()},a.default.RendererGL.prototype._drawStrokeImmediateMode=function(){var e=this.GL,t=this._getImmediateStrokeShader();this._setStrokeUniforms(t),t.attributes.aPosition&&(this._bindBuffer(this.immediateMode.lineVertexBuffer,e.ARRAY_BUFFER,this._flatten(this.immediateMode.lineVertices),Float32Array,e.STATIC_DRAW),t.enableAttrib(t.attributes.aPosition,3)),t.attributes.aDirection&&(this._bindBuffer(this.immediateMode.lineNormalBuffer,e.ARRAY_BUFFER,this._flatten(this.immediateMode.lineNormals),Float32Array,e.STATIC_DRAW),t.enableAttrib(t.attributes.aDirection,4)),this._applyColorBlend(this.curStrokeColor),e.drawArrays(e.TRIANGLES,0,this.immediateMode.lineVertices.length),t.unbindShader()};var o=a.default.RendererGL;r.default=o},{"../core/constants":20,"../core/main":26}],78:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};function n(e,t,r,i,a){this.size=e,this.src=t,this.dst=r,this.attr=i,this.map=a}e("./p5.RendererGL");var o=a.default.RendererGL.prototype._flatten,s=a.default.RendererGL.prototype._vToNArray,l=[new n(3,"lineVertices","lineVertexBuffer","aPosition",o),new n(4,"lineNormals","lineNormalBuffer","aDirection",o)],u=[new n(3,"vertices","vertexBuffer","aPosition",s),new n(3,"vertexNormals","normalBuffer","aNormal",s),new n(4,"vertexColors","colorBuffer","aMaterialColor"),new n(3,"vertexAmbients","ambientBuffer","aAmbientColor"),new n(2,"uvs","uvBuffer","aTexCoord",o)];a.default.RendererGL._textBuffers=[new n(3,"vertices","vertexBuffer","aPosition",s),new n(2,"uvs","uvBuffer","aTexCoord",o)];var h=0;a.default.RendererGL.prototype._initBufferDefaults=function(e){if(this._freeBuffers(e),1e3<++h){var t=Object.keys(this.gHash)[0];delete this.gHash[t],h--}return this.gHash[e]={}},a.default.RendererGL.prototype._freeBuffers=function(e){var t=this.gHash[e];if(t){delete this.gHash[e],h--;var r=this.GL;t.indexBuffer&&r.deleteBuffer(t.indexBuffer),i(l),i(u)}function i(e){var i=!0,a=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var l=o.value;t[l.dst]&&(r.deleteBuffer(t[l.dst]),t[l.dst]=null)}}catch(e){a=!0,n=e}finally{try{i||null==s.return||s.return()}finally{if(a)throw n}}}},a.default.RendererGL.prototype._prepareBuffers=function(e,t,r){var i=e.model,a=t.attributes,n=this.GL,o=!0,s=!1,l=void 0;try{for(var u,h=r[Symbol.iterator]();!(o=(u=h.next()).done);o=!0){var d=u.value,c=a[d.attr];if(c){var f=e[d.dst],p=i[d.src];if(p){var m=!f;if(m&&(e[d.dst]=f=n.createBuffer()),n.bindBuffer(n.ARRAY_BUFFER,f),m||!1!==i.dirtyFlags[d.src]){var v=d.map,g=v?v(p):p;this._bindBuffer(f,n.ARRAY_BUFFER,g),i.dirtyFlags[d.src]=!1}t.enableAttrib(c,d.size)}else f&&(n.deleteBuffer(f),e[d.dst]=null),n.disableVertexAttribArray(c.index)}}}catch(e){s=!0,l=e}finally{try{o||null==h.return||h.return()}finally{if(s)throw l}}},a.default.RendererGL.prototype.createBuffers=function(e,t){var r=this.GL,i=this._initBufferDefaults(e);i.model=t;var n=i.indexBuffer;if(t.faces.length){n||(n=i.indexBuffer=r.createBuffer());var o=a.default.RendererGL.prototype._flatten(t.faces);this._bindBuffer(n,r.ELEMENT_ARRAY_BUFFER,o,Uint16Array),i.vertexCount=3*t.faces.length}else n&&(r.deleteBuffer(n),i.indexBuffer=null),i.vertexCount=t.vertices?t.vertices.length:0;return i.lineVertexCount=t.lineVertices?t.lineVertices.length:0,i},a.default.RendererGL.prototype.drawBuffers=function(e){var t=this.GL,r=this.gHash[e];if(this._doStroke&&0<r.lineVertexCount){var i=this._getRetainedStrokeShader();this._setStrokeUniforms(i),this._prepareBuffers(r,i,l),this._applyColorBlend(this.curStrokeColor),this._drawArrays(t.TRIANGLES,e),i.unbindShader()}if(this._doFill){var a=this._getRetainedFillShader();this._setFillUniforms(a),this._prepareBuffers(r,a,u),r.indexBuffer&&this._bindBuffer(r.indexBuffer,t.ELEMENT_ARRAY_BUFFER),this._applyColorBlend(this.curFillColor),this._drawElements(t.TRIANGLES,e),a.unbindShader()}return this},a.default.RendererGL.prototype.drawBuffersScaled=function(e,t,r,i){var a=this.uMVMatrix.copy();try{this.uMVMatrix.scale(t,r,i),this.drawBuffers(e)}finally{this.uMVMatrix=a}},a.default.RendererGL.prototype._drawArrays=function(e,t){return this.GL.drawArrays(e,0,this.gHash[t].lineVertexCount),this},a.default.RendererGL.prototype._drawElements=function(e,t){var r=this.gHash[t],i=this.GL;r.indexBuffer?i.drawElements(i.TRIANGLES,r.vertexCount,i.UNSIGNED_SHORT,0):i.drawArrays(e||i.TRIANGLES,0,r.vertexCount)},a.default.RendererGL.prototype._drawPoints=function(e,t){var r=this.GL,i=this._getImmediatePointShader();this._setPointUniforms(i),this._bindBuffer(t,r.ARRAY_BUFFER,this._vToNArray(e),Float32Array,r.STATIC_DRAW),i.enableAttrib(i.attributes.aPosition,3),r.drawArrays(r.Points,0,e.length),i.unbindShader()};var d=a.default.RendererGL;r.default=d},{"../core/main":26,"./p5.RendererGL":79}],79:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(e("../core/main")),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants")),n=o(e("libtess"));function o(e){return e&&e.__esModule?e:{default:e}}function s(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}e("./p5.Shader"),e("./p5.Camera"),e("../core/p5.Renderer"),e("./p5.Matrix"),e("path");var l="precision mediump float;\n\nuniform mat4 uViewMatrix;\n\nuniform bool uUseLighting;\n\nuniform int uAmbientLightCount;\nuniform vec3 uAmbientColor[8];\n\nuniform int uDirectionalLightCount;\nuniform vec3 uLightingDirection[8];\nuniform vec3 uDirectionalDiffuseColors[8];\nuniform vec3 uDirectionalSpecularColors[8];\n\nuniform int uPointLightCount;\nuniform vec3 uPointLightLocation[8];\nuniform vec3 uPointLightDiffuseColors[8];\t\nuniform vec3 uPointLightSpecularColors[8];\n\nuniform int uSpotLightCount;\nuniform float uSpotLightAngle[8];\nuniform float uSpotLightConc[8];\nuniform vec3 uSpotLightDiffuseColors[8];\nuniform vec3 uSpotLightSpecularColors[8];\nuniform vec3 uSpotLightLocation[8];\nuniform vec3 uSpotLightDirection[8];\n\nuniform bool uSpecular;\nuniform float uShininess;\n\nuniform float uConstantAttenuation;\nuniform float uLinearAttenuation;\nuniform float uQuadraticAttenuation;\n\nconst float specularFactor = 2.0;\nconst float diffuseFactor = 0.73;\n\nstruct LightResult {\n  float specular;\n  float diffuse;\n};\n\nfloat _phongSpecular(\n  vec3 lightDirection,\n  vec3 viewDirection,\n  vec3 surfaceNormal,\n  float shininess) {\n\n  vec3 R = reflect(lightDirection, surfaceNormal);\n  return pow(max(0.0, dot(R, viewDirection)), shininess);\n}\n\nfloat _lambertDiffuse(vec3 lightDirection, vec3 surfaceNormal) {\n  return max(0.0, dot(-lightDirection, surfaceNormal));\n}\n\nLightResult _light(vec3 viewDirection, vec3 normal, vec3 lightVector) {\n\n  vec3 lightDir = normalize(lightVector);\n\n  //compute our diffuse & specular terms\n  LightResult lr;\n  if (uSpecular)\n    lr.specular = _phongSpecular(lightDir, viewDirection, normal, uShininess);\n  lr.diffuse = _lambertDiffuse(lightDir, normal);\n  return lr;\n}\n\nvoid totalLight(\n  vec3 modelPosition,\n  vec3 normal,\n  out vec3 totalDiffuse,\n  out vec3 totalSpecular\n) {\n\n  totalSpecular = vec3(0.0);\n\n  if (!uUseLighting) {\n    totalDiffuse = vec3(1.0);\n    return;\n  }\n\n  totalDiffuse = vec3(0.0);\n\n  vec3 viewDirection = normalize(-modelPosition);\n\n  for (int j = 0; j < 8; j++) {\n    if (j < uDirectionalLightCount) {\n      vec3 lightVector = (uViewMatrix * vec4(uLightingDirection[j], 0.0)).xyz;\n      vec3 lightColor = uDirectionalDiffuseColors[j];\n      vec3 specularColor = uDirectionalSpecularColors[j];\n      LightResult result = _light(viewDirection, normal, lightVector);\n      totalDiffuse += result.diffuse * lightColor;\n      totalSpecular += result.specular * lightColor * specularColor;\n    }\n\n    if (j < uPointLightCount) {\n      vec3 lightPosition = (uViewMatrix * vec4(uPointLightLocation[j], 1.0)).xyz;\n      vec3 lightVector = modelPosition - lightPosition;\n    \n      //calculate attenuation\n      float lightDistance = length(lightVector);\n      float lightFalloff = 1.0 / (uConstantAttenuation + lightDistance * uLinearAttenuation + (lightDistance * lightDistance) * uQuadraticAttenuation);\n      vec3 lightColor = lightFalloff * uPointLightDiffuseColors[j];\n      vec3 specularColor = lightFalloff * uPointLightSpecularColors[j];\n\n      LightResult result = _light(viewDirection, normal, lightVector);\n      totalDiffuse += result.diffuse * lightColor;\n      totalSpecular += result.specular * lightColor * specularColor;\n    }\n\n    if(j < uSpotLightCount) {\n      vec3 lightPosition = (uViewMatrix * vec4(uSpotLightLocation[j], 1.0)).xyz;\n      vec3 lightVector = modelPosition - lightPosition;\n    \n      float lightDistance = length(lightVector);\n      float lightFalloff = 1.0 / (uConstantAttenuation + lightDistance * uLinearAttenuation + (lightDistance * lightDistance) * uQuadraticAttenuation);\n\n      vec3 lightDirection = (uViewMatrix * vec4(uSpotLightDirection[j], 0.0)).xyz;\n      float spotDot = dot(normalize(lightVector), normalize(lightDirection));\n      float spotFalloff;\n      if(spotDot < uSpotLightAngle[j]) {\n        spotFalloff = 0.0;\n      }\n      else {\n        spotFalloff = pow(spotDot, uSpotLightConc[j]);\n      }\n      lightFalloff *= spotFalloff;\n\n      vec3 lightColor = uSpotLightDiffuseColors[j];\n      vec3 specularColor = uSpotLightSpecularColors[j];\n     \n      LightResult result = _light(viewDirection, normal, lightVector);\n      \n      totalDiffuse += result.diffuse * lightColor * lightFalloff;\n      totalSpecular += result.specular * lightColor * specularColor * lightFalloff;\n    }\n  }\n\n  totalDiffuse *= diffuseFactor;\n  totalSpecular *= specularFactor;\n}\n",u={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;\nuniform vec4 uMaterialColor;\nvoid main(void) {\n  gl_FragColor = uMaterialColor;\n}",lightVert:l+"// include lighting.glgl\n\nattribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvarying highp vec2 vVertTexCoord;\nvarying vec3 vDiffuseColor;\nvarying vec3 vSpecularColor;\n\nvoid main(void) {\n\n  vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n  gl_Position = uProjectionMatrix * viewModelPosition;\n\n  vec3 vertexNormal = normalize(uNormalMatrix * aNormal);\n  vVertTexCoord = aTexCoord;\n\n  totalLight(viewModelPosition.xyz, vertexNormal, vDiffuseColor, vSpecularColor);\n\n  for (int i = 0; i < 8; i++) {\n    if (i < uAmbientLightCount) {\n      vDiffuseColor += uAmbientColor[i];\n    }\n  }\n}\n",lightTextureFrag:"precision mediump float;\n\nuniform vec4 uMaterialColor;\nuniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uEmissive;\n\nvarying highp vec2 vVertTexCoord;\nvarying vec3 vDiffuseColor;\nvarying vec3 vSpecularColor;\n\nvoid main(void) {\n  if(uEmissive && !isTexture) {\n    gl_FragColor = uMaterialColor;\n  }\n  else {\n    gl_FragColor = isTexture ? texture2D(uSampler, vVertTexCoord) * (uTint / vec4(255, 255, 255, 255)) : uMaterialColor;\n    gl_FragColor.rgb = gl_FragColor.rgb * vDiffuseColor + vSpecularColor;\n  }\n}",phongVert:"precision mediump float;\nprecision mediump int;\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 = uNormalMatrix * aNormal;\n  vTexCoord = aTexCoord;\n\n  // TODO: this should be a uniform\n  vAmbientColor = vec3(0.0);\n  for (int i = 0; i < 8; i++) {\n    if (i < uAmbientLightCount) {\n      vAmbientColor += uAmbientColor[i];\n    }\n  }\n}\n",phongFrag:l+"// include lighting.glsl\nprecision highp float;\n\nuniform vec4 uMaterialColor;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uEmissive;\n\nvarying vec3 vNormal;\nvarying vec2 vTexCoord;\nvarying vec3 vViewPosition;\nvarying vec3 vAmbientColor;\n\nvoid main(void) {\n\n  vec3 diffuse;\n  vec3 specular;\n  totalLight(vViewPosition, normalize(vNormal), diffuse, specular);\n\n  if(uEmissive && !isTexture) {\n    gl_FragColor = uMaterialColor;\n  }\n  else {\n    gl_FragColor = isTexture ? texture2D(uSampler, vTexCoord) : uMaterialColor;\n    gl_FragColor.rgb = gl_FragColor.rgb * (diffuse + vAmbientColor) + specular;\n  }\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 highp 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;\nuniform int uPerspective;\n\nattribute vec4 aPosition;\nattribute vec4 aDirection;\n  \nvoid main() {\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.\n  vec3 scale = vec3(0.9995);\n\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  vec2 curPerspScale;\n\n  if(uPerspective == 1) {\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    curPerspScale = (uProjectionMatrix * vec4(1, -1, 0, 0)).xy;\n  } else {\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    curPerspScale = p.w / (0.5 * uViewport.zw);\n  }\n\n  gl_Position.xy = p.xy + offset.xy * curPerspScale;\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}"};i.default.RendererGL=function(e,t,r,n){return i.default.Renderer.call(this,e,t,r),this._setAttributeDefaults(t),this._initContext(),this.isP3D=!0,this.GL=this.drawingContext,this._isErasing=!1,this._enableLighting=!1,this.ambientLightColors=[],this.specularColors=[1,1,1],this.directionalLightDirections=[],this.directionalLightDiffuseColors=[],this.directionalLightSpecularColors=[],this.pointLightPositions=[],this.pointLightDiffuseColors=[],this.pointLightSpecularColors=[],this.spotLightPositions=[],this.spotLightDirections=[],this.spotLightDiffuseColors=[],this.spotLightSpecularColors=[],this.spotLightAngle=[],this.spotLightConc=[],this.drawMode=a.FILL,this.curFillColor=this._cachedFillStyle=[1,1,1,1],this.curStrokeColor=this._cachedStrokeStyle=[0,0,0,1],this.curBlendMode=this._cachedBlendMode=a.BLEND,this.blendExt=this.GL.getExtension("EXT_blend_minmax"),this._useSpecularMaterial=!1,this._useEmissiveMaterial=!1,this._useNormalMaterial=!1,this._useShininess=1,this._tint=[255,255,255,255],this.constantAttenuation=1,this.linearAttenuation=0,this.quadraticAttenuation=0,this.uMVMatrix=new i.default.Matrix,this.uPMatrix=new i.default.Matrix,this.uNMatrix=new i.default.Matrix("mat3"),this._curCamera=new i.default.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._pointVertexBuffer=this.GL.createBuffer(),this.userFillShader=void 0,this.userStrokeShader=void 0,this.userPointShader=void 0,this.isImmediateDrawing=!1,this.immediateMode={},this.pointSize=5,this.curStrokeWeight=1,this.textures=[],this.textureMode=a.IMAGE,this.textureWrapX=a.CLAMP,this.textureWrapY=a.CLAMP,this._tex=null,this._curveTightness=6,this._lookUpTableBezier=[],this._lookUpTableQuadratic=[],this._lutBezierDetail=0,this._lutQuadraticDetail=0,this._tessy=this._initTessy(),this.fontInfos={},this},i.default.RendererGL.prototype=Object.create(i.default.Renderer.prototype),i.default.RendererGL.prototype._setAttributeDefaults=function(e){var t={alpha:!0,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!0,perPixelLighting:!1};null===e._glAttributes?e._glAttributes=t:e._glAttributes=Object.assign(t,e._glAttributes)},i.default.RendererGL.prototype._initContext=function(){try{if(this.drawingContext=this.canvas.getContext("webgl",this._pInst._glAttributes)||this.canvas.getContext("experimental-webgl",this._pInst._glAttributes),null===this.drawingContext)throw new Error("Error creating webgl context");var e=this.drawingContext;e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),this._viewport=this.drawingContext.getParameter(this.drawingContext.VIEWPORT)}catch(e){throw e}},i.default.RendererGL.prototype._resetContext=function(e,t){var r=this.width,a=this.height,n=this.canvas.id,o=this._pInst instanceof i.default.Graphics;if(o){var s=this._pInst;s.canvas.parentNode.removeChild(s.canvas),s.canvas=document.createElement("canvas"),(s._pInst._userNode||document.body).appendChild(s.canvas),i.default.Element.call(s,s.canvas,s._pInst),s.width=r,s.height=a}else{var l=this.canvas;l&&l.parentNode.removeChild(l),(l=document.createElement("canvas")).id=n,this._pInst._userNode?this._pInst._userNode.appendChild(l):document.body.appendChild(l),this._pInst.canvas=l}var u=new i.default.RendererGL(this._pInst.canvas,this._pInst,!o);this._pInst._setProperty("_renderer",u),u.resize(r,a),u._applyDefaults(),o||this._pInst._elements.push(u),"function"==typeof t&&setTimeout((function(){t.apply(window._renderer,e)}),0)},i.default.prototype.setAttributes=function(e,t){if(void 0!==this._glAttributes){var r=!0;if(void 0!==t?(null===this._glAttributes&&(this._glAttributes={}),this._glAttributes[e]!==t&&(this._glAttributes[e]=t,r=!1)):e instanceof Object&&this._glAttributes!==e&&(this._glAttributes=e,r=!1),this._renderer.isP3D&&!r){if(!this._setupDone)for(var i in this._renderer.gHash)if(this._renderer.gHash.hasOwnProperty(i))return void console.error("Sorry, Could not set the attributes, you need to call setAttributes() before calling the other drawing methods in setup()");this.push(),this._renderer._resetContext(),this.pop(),this._renderer._curCamera&&(this._renderer._curCamera._renderer=this._renderer)}}else console.log("You are trying to use setAttributes on a p5.Graphics object that does not use a WEBGL renderer.")},i.default.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.specularColors=[1,1,1],this.directionalLightDirections.length=0,this.directionalLightDiffuseColors.length=0,this.directionalLightSpecularColors.length=0,this.pointLightPositions.length=0,this.pointLightDiffuseColors.length=0,this.pointLightSpecularColors.length=0,this.spotLightPositions.length=0,this.spotLightDirections.length=0,this.spotLightDiffuseColors.length=0,this.spotLightSpecularColors.length=0,this.spotLightAngle.length=0,this.spotLightConc.length=0,this._enableLighting=!1,this._tint=[255,255,255,255],this.GL.clear(this.GL.DEPTH_BUFFER_BIT)},i.default.RendererGL.prototype.background=function(){var e,t=(e=this._pInst).color.apply(e,arguments),r=t.levels[0]/255,i=t.levels[1]/255,a=t.levels[2]/255,n=t.levels[3]/255;this.GL.clearColor(r,i,a,n),this.GL.depthMask(!0),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},i.default.RendererGL.prototype.fill=function(e,t,r,n){var o=i.default.prototype.color.apply(this._pInst,arguments);this.curFillColor=o._array,this.drawMode=a.FILL,this._useNormalMaterial=!1,this._tex=null},i.default.RendererGL.prototype.stroke=function(e,t,r,a){a=255;var n=i.default.prototype.color.apply(this._pInst,arguments);this.curStrokeColor=n._array},i.default.RendererGL.prototype.strokeCap=function(e){console.error("Sorry, strokeCap() is not yet implemented in WEBGL mode")},i.default.RendererGL.prototype.strokeJoin=function(e){console.error("Sorry, strokeJoin() is not yet implemented in WEBGL mode")},i.default.RendererGL.prototype.blendMode=function(e){e===a.DARKEST||e===a.LIGHTEST||e===a.ADD||e===a.BLEND||e===a.SUBTRACT||e===a.SCREEN||e===a.EXCLUSION||e===a.REPLACE||e===a.MULTIPLY||e===a.REMOVE?this.curBlendMode=e:e!==a.BURN&&e!==a.OVERLAY&&e!==a.HARD_LIGHT&&e!==a.SOFT_LIGHT&&e!==a.DODGE||console.warn("BURN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, and DODGE only work for blendMode in 2D mode.")},i.default.RendererGL.prototype.erase=function(e,t){this._isErasing||(this._cachedBlendMode=this.curBlendMode,this.blendMode(a.REMOVE),this._cachedFillStyle=this.curFillColor.slice(),this.curFillColor=[1,1,1,e/255],this._cachedStrokeStyle=this.curStrokeColor.slice(),this.curStrokeColor=[1,1,1,t/255],this._isErasing=!0)},i.default.RendererGL.prototype.noErase=function(){this._isErasing&&(this.curFillColor=this._cachedFillStyle.slice(),this.curStrokeColor=this._cachedStrokeStyle.slice(),this.blendMode(this._cachedBlendMode),this._isErasing=!1)},i.default.RendererGL.prototype.strokeWeight=function(e){this.curStrokeWeight!==e&&(this.pointSize=e,this.curStrokeWeight=e)},i.default.RendererGL.prototype._getPixel=function(e,t){var r;return r=new Uint8Array(4),this.drawingContext.readPixels(e,t,1,1,this.drawingContext.RGBA,this.drawingContext.UNSIGNED_BYTE,r),[r[0],r[1],r[2],r[3]]},i.default.RendererGL.prototype.loadPixels=function(){var e=this._pixelsState;if(!0===this._pInst._glAttributes.preserveDrawingBuffer){var t=e.pixels,r=this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4;t instanceof Uint8Array&&t.length===r||(t=new Uint8Array(r),this._pixelsState._setProperty("pixels",t));var i=this._pInst._pixelDensity;this.GL.readPixels(0,0,this.width*i,this.height*i,this.GL.RGBA,this.GL.UNSIGNED_BYTE,t)}else console.log("loadPixels only works in WebGL when preserveDrawingBuffer is true.")},i.default.RendererGL.prototype.geometryInHash=function(e){return void 0!==this.gHash[e]},i.default.RendererGL.prototype.resize=function(e,t){i.default.Renderer.prototype.resize.call(this,e,t),this.GL.viewport(0,0,this.GL.drawingBufferWidth,this.GL.drawingBufferHeight),this._viewport=this.GL.getParameter(this.GL.VIEWPORT),this._curCamera._resize();var r=this._pixelsState;void 0!==r.pixels&&r._setProperty("pixels",new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4))},i.default.RendererGL.prototype.clear=function(){var e=(arguments.length<=0?void 0:arguments[0])||0,t=(arguments.length<=1?void 0:arguments[1])||0,r=(arguments.length<=2?void 0:arguments[2])||0,i=(arguments.length<=3?void 0:arguments[3])||0;this.GL.clearColor(e,t,r,i),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},i.default.RendererGL.prototype.applyMatrix=function(e,t,r,a,n,o){16===arguments.length?i.default.Matrix.prototype.apply.apply(this.uMVMatrix,arguments):this.uMVMatrix.apply([e,t,0,0,r,a,0,0,0,0,1,0,n,o,0,1])},i.default.RendererGL.prototype.translate=function(e,t,r){return e instanceof i.default.Vector&&(r=e.z,t=e.y,e=e.x),this.uMVMatrix.translate([e,t,r]),this},i.default.RendererGL.prototype.scale=function(e,t,r){return this.uMVMatrix.scale(e,t,r),this},i.default.RendererGL.prototype.rotate=function(e,t){return void 0===t?this.rotateZ(e):(i.default.Matrix.prototype.rotate.apply(this.uMVMatrix,arguments),this)},i.default.RendererGL.prototype.rotateX=function(e){return this.rotate(e,1,0,0),this},i.default.RendererGL.prototype.rotateY=function(e){return this.rotate(e,0,1,0),this},i.default.RendererGL.prototype.rotateZ=function(e){return this.rotate(e,0,0,1),this},i.default.RendererGL.prototype.push=function(){var e=i.default.Renderer.prototype.push.apply(this),t=e.properties;return t.uMVMatrix=this.uMVMatrix.copy(),t.uPMatrix=this.uPMatrix.copy(),t._curCamera=this._curCamera,this._curCamera=this._curCamera.copy(),t.ambientLightColors=this.ambientLightColors.slice(),t.specularColors=this.specularColors.slice(),t.directionalLightDirections=this.directionalLightDirections.slice(),t.directionalLightDiffuseColors=this.directionalLightDiffuseColors.slice(),t.directionalLightSpecularColors=this.directionalLightSpecularColors.slice(),t.pointLightPositions=this.pointLightPositions.slice(),t.pointLightDiffuseColors=this.pointLightDiffuseColors.slice(),t.pointLightSpecularColors=this.pointLightSpecularColors.slice(),t.spotLightPositions=this.spotLightPositions.slice(),t.spotLightDirections=this.spotLightDirections.slice(),t.spotLightDiffuseColors=this.spotLightDiffuseColors.slice(),t.spotLightSpecularColors=this.spotLightSpecularColors.slice(),t.spotLightAngle=this.spotLightAngle.slice(),t.spotLightConc=this.spotLightConc.slice(),t.userFillShader=this.userFillShader,t.userStrokeShader=this.userStrokeShader,t.userPointShader=this.userPointShader,t.pointSize=this.pointSize,t.curStrokeWeight=this.curStrokeWeight,t.curStrokeColor=this.curStrokeColor,t.curFillColor=this.curFillColor,t._useSpecularMaterial=this._useSpecularMaterial,t._useEmissiveMaterial=this._useEmissiveMaterial,t._useShininess=this._useShininess,t.constantAttenuation=this.constantAttenuation,t.linearAttenuation=this.linearAttenuation,t.quadraticAttenuation=this.quadraticAttenuation,t._enableLighting=this._enableLighting,t._useNormalMaterial=this._useNormalMaterial,t._tex=this._tex,t.drawMode=this.drawMode,e},i.default.RendererGL.prototype.resetMatrix=function(){return this.uMVMatrix=i.default.Matrix.identity(this._pInst),this},i.default.RendererGL.prototype._getImmediateStrokeShader=function(){var e=this.userStrokeShader;return e&&e.isStrokeShader()?e:this._getLineShader()},i.default.RendererGL.prototype._getRetainedStrokeShader=i.default.RendererGL.prototype._getImmediateStrokeShader,i.default.RendererGL.prototype._getImmediateFillShader=function(){if(this._useNormalMaterial)return console.log("Sorry, normalMaterial() does not currently work with custom WebGL geometry created with beginShape(). Falling back to standard fill material."),this._getImmediateModeShader();var e=this.userFillShader;if(this._enableLighting){if(!e||!e.isLightShader())return this._getLightShader()}else if(this._tex){if(!e||!e.isTextureShader())return this._getLightShader()}else if(!e)return this._getImmediateModeShader();return e},i.default.RendererGL.prototype._getRetainedFillShader=function(){if(this._useNormalMaterial)return this._getNormalShader();var e=this.userFillShader;if(this._enableLighting){if(!e||!e.isLightShader())return this._getLightShader()}else if(this._tex){if(!e||!e.isTextureShader())return this._getLightShader()}else if(!e)return this._getColorShader();return e},i.default.RendererGL.prototype._getImmediatePointShader=function(){var e=this.userPointShader;return e&&e.isPointShader()?e:this._getPointShader()},i.default.RendererGL.prototype._getRetainedLineShader=i.default.RendererGL.prototype._getImmediateLineShader,i.default.RendererGL.prototype._getLightShader=function(){return this._defaultLightShader||(this._pInst._glAttributes.perPixelLighting?this._defaultLightShader=new i.default.Shader(this,u.phongVert,u.phongFrag):this._defaultLightShader=new i.default.Shader(this,u.lightVert,u.lightTextureFrag)),this._defaultLightShader},i.default.RendererGL.prototype._getImmediateModeShader=function(){return this._defaultImmediateModeShader||(this._defaultImmediateModeShader=new i.default.Shader(this,u.immediateVert,u.vertexColorFrag)),this._defaultImmediateModeShader},i.default.RendererGL.prototype._getNormalShader=function(){return this._defaultNormalShader||(this._defaultNormalShader=new i.default.Shader(this,u.normalVert,u.normalFrag)),this._defaultNormalShader},i.default.RendererGL.prototype._getColorShader=function(){return this._defaultColorShader||(this._defaultColorShader=new i.default.Shader(this,u.normalVert,u.basicFrag)),this._defaultColorShader},i.default.RendererGL.prototype._getPointShader=function(){return this._defaultPointShader||(this._defaultPointShader=new i.default.Shader(this,u.pointVert,u.pointFrag)),this._defaultPointShader},i.default.RendererGL.prototype._getLineShader=function(){return this._defaultLineShader||(this._defaultLineShader=new i.default.Shader(this,u.lineVert,u.lineFrag)),this._defaultLineShader},i.default.RendererGL.prototype._getFontShader=function(){return this._defaultFontShader||(this.GL.getExtension("OES_standard_derivatives"),this._defaultFontShader=new i.default.Shader(this,u.fontVert,u.fontFrag)),this._defaultFontShader},i.default.RendererGL.prototype._getEmptyTexture=function(){if(!this._emptyTexture){var e=new i.default.Image(1,1);e.set(0,0,255),this._emptyTexture=new i.default.Texture(this,e)}return this._emptyTexture},i.default.RendererGL.prototype.getTexture=function(e){var t=this.textures,r=!0,a=!1,n=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;if(l.src===e)return l}}catch(e){a=!0,n=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw n}}var u=new i.default.Texture(this,e);return t.push(u),u},i.default.RendererGL.prototype._setStrokeUniforms=function(e){e.bindShader(),e.setUniform("uMaterialColor",this.curStrokeColor),e.setUniform("uStrokeWeight",this.curStrokeWeight)},i.default.RendererGL.prototype._setFillUniforms=function(e){e.bindShader(),e.setUniform("uMaterialColor",this.curFillColor),e.setUniform("isTexture",!!this._tex),this._tex&&e.setUniform("uSampler",this._tex),e.setUniform("uTint",this._tint),e.setUniform("uSpecular",this._useSpecularMaterial),e.setUniform("uEmissive",this._useEmissiveMaterial),e.setUniform("uShininess",this._useShininess),e.setUniform("uUseLighting",this._enableLighting);var t=this.pointLightDiffuseColors.length/3;e.setUniform("uPointLightCount",t),e.setUniform("uPointLightLocation",this.pointLightPositions),e.setUniform("uPointLightDiffuseColors",this.pointLightDiffuseColors),e.setUniform("uPointLightSpecularColors",this.pointLightSpecularColors);var r=this.directionalLightDiffuseColors.length/3;e.setUniform("uDirectionalLightCount",r),e.setUniform("uLightingDirection",this.directionalLightDirections),e.setUniform("uDirectionalDiffuseColors",this.directionalLightDiffuseColors),e.setUniform("uDirectionalSpecularColors",this.directionalLightSpecularColors);var i=this.ambientLightColors.length/3;e.setUniform("uAmbientLightCount",i),e.setUniform("uAmbientColor",this.ambientLightColors);var a=this.spotLightDiffuseColors.length/3;e.setUniform("uSpotLightCount",a),e.setUniform("uSpotLightAngle",this.spotLightAngle),e.setUniform("uSpotLightConc",this.spotLightConc),e.setUniform("uSpotLightDiffuseColors",this.spotLightDiffuseColors),e.setUniform("uSpotLightSpecularColors",this.spotLightSpecularColors),e.setUniform("uSpotLightLocation",this.spotLightPositions),e.setUniform("uSpotLightDirection",this.spotLightDirections),e.setUniform("uConstantAttenuation",this.constantAttenuation),e.setUniform("uLinearAttenuation",this.linearAttenuation),e.setUniform("uQuadraticAttenuation",this.quadraticAttenuation),e.bindTextures()},i.default.RendererGL.prototype._setPointUniforms=function(e){e.bindShader(),e.setUniform("uMaterialColor",this.curStrokeColor),e.setUniform("uPointSize",this.pointSize)},i.default.RendererGL.prototype._bindBuffer=function(e,t,r,i,a){if(t||(t=this.GL.ARRAY_BUFFER),this.GL.bindBuffer(t,e),void 0!==r){var n=new(i||Float32Array)(r);this.GL.bufferData(t,n,a||this.GL.STATIC_DRAW)}},i.default.RendererGL.prototype._flatten=function(e){if(0===e.length)return[];if(2e4<e.length){var t,r=Object.prototype.toString,i=[],a=e.slice();for(t=a.pop();"[object Array]"===r.call(t)?a.push.apply(a,s(t)):i.push(t),a.length&&void 0!==(t=a.pop()););return i.reverse(),i}var n;return(n=[]).concat.apply(n,s(e))},i.default.RendererGL.prototype._vToNArray=function(e){var t=[],r=!0,i=!1,a=void 0;try{for(var n,o=e[Symbol.iterator]();!(r=(n=o.next()).done);r=!0){var s=n.value;t.push(s.x,s.y,s.z)}}catch(e){i=!0,a=e}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return t},i.default.prototype._assert3d=function(e){if(!this._renderer.isP3D)throw new Error("".concat(e,"() 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."))},i.default.RendererGL.prototype._initTessy=function(){var e=new n.default.GluTesselator;return e.gluTessCallback(n.default.gluEnum.GLU_TESS_VERTEX_DATA,(function(e,t){t[t.length]=e[0],t[t.length]=e[1],t[t.length]=e[2]})),e.gluTessCallback(n.default.gluEnum.GLU_TESS_BEGIN,(function(e){e!==n.default.primitiveType.GL_TRIANGLES&&console.log("expected TRIANGLES but got type: ".concat(e))})),e.gluTessCallback(n.default.gluEnum.GLU_TESS_ERROR,(function(e){console.log("error callback"),console.log("error number: ".concat(e))})),e.gluTessCallback(n.default.gluEnum.GLU_TESS_COMBINE,(function(e,t,r){return[e[0],e[1],e[2]]})),e.gluTessCallback(n.default.gluEnum.GLU_TESS_EDGE_FLAG,(function(e){})),e},i.default.RendererGL.prototype._triangulate=function(e){this._tessy.gluTessNormal(0,0,1);var t=[];this._tessy.gluTessBeginPolygon(t);for(var r=0;r<e.length;r++){this._tessy.gluTessBeginContour();for(var i=e[r],a=0;a<i.length;a+=3){var n=[i[a],i[a+1],i[a+2]];this._tessy.gluTessVertex(n,n)}this._tessy.gluTessEndContour()}return this._tessy.gluTessEndPolygon(),t},i.default.RendererGL.prototype._bezierCoefficients=function(e){var t=e*e,r=1-e,i=r*r;return[i*r,3*i*e,3*r*t,t*e]},i.default.RendererGL.prototype._quadraticCoefficients=function(e){var t=1-e;return[t*t,2*t*e,e*e]},i.default.RendererGL.prototype._bezierToCatmull=function(e){return[e[1],e[1]+(e[2]-e[0])/this._curveTightness,e[2]-(e[3]-e[1])/this._curveTightness,e[2]]};var h=i.default.RendererGL;r.default=h},{"../core/constants":20,"../core/main":26,"../core/p5.Renderer":29,"./p5.Camera":74,"./p5.Matrix":76,"./p5.Shader":80,libtess:9,path:12}],80:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i};a.default.Shader=function(e,t,r){this._renderer=e,this._vertSrc=t,this._fragSrc=r,this._vertShader=-1,this._fragShader=-1,this._glProgram=0,this._loadedAttributes=!1,this.attributes={},this._loadedUniforms=!1,this.uniforms={},this._bound=!1,this.samplers=[]},a.default.Shader.prototype.init=function(){if(0===this._glProgram){var e=this._renderer.GL;if(this._vertShader=e.createShader(e.VERTEX_SHADER),e.shaderSource(this._vertShader,this._vertSrc),e.compileShader(this._vertShader),!e.getShaderParameter(this._vertShader,e.COMPILE_STATUS))return console.error("Yikes! An error occurred compiling the vertex shader:".concat(e.getShaderInfoLog(this._vertShader))),null;if(this._fragShader=e.createShader(e.FRAGMENT_SHADER),e.shaderSource(this._fragShader,this._fragSrc),e.compileShader(this._fragShader),!e.getShaderParameter(this._fragShader,e.COMPILE_STATUS))return console.error("Darn! An error occurred compiling the fragment shader:".concat(e.getShaderInfoLog(this._fragShader))),null;this._glProgram=e.createProgram(),e.attachShader(this._glProgram,this._vertShader),e.attachShader(this._glProgram,this._fragShader),e.linkProgram(this._glProgram),e.getProgramParameter(this._glProgram,e.LINK_STATUS)||console.error("Snap! Error linking shader program: ".concat(e.getProgramInfoLog(this._glProgram))),this._loadAttributes(),this._loadUniforms()}return this},a.default.Shader.prototype._loadAttributes=function(){if(!this._loadedAttributes){this.attributes={};for(var e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_ATTRIBUTES),r=0;r<t;++r){var i=e.getActiveAttrib(this._glProgram,r),a=i.name,n=e.getAttribLocation(this._glProgram,a),o={};o.name=a,o.location=n,o.index=r,o.type=i.type,o.size=i.size,this.attributes[a]=o}this._loadedAttributes=!0}},a.default.Shader.prototype._loadUniforms=function(){if(!this._loadedUniforms){for(var e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_UNIFORMS),r=0,i=0;i<t;++i){var a=e.getActiveUniform(this._glProgram,i),n={};n.location=e.getUniformLocation(this._glProgram,a.name),n.size=a.size;var o=a.name;1<a.size&&(o=o.substring(0,o.indexOf("[0]"))),n.name=o,n.type=a.type,n.type===e.SAMPLER_2D&&(n.samplerIndex=r,r++,this.samplers.push(n)),this.uniforms[o]=n}this._loadedUniforms=!0}},a.default.Shader.prototype.compile=function(){},a.default.Shader.prototype.bindShader=function(){this.init(),this._bound||(this.useProgram(),this._bound=!0,this._setMatrixUniforms(),this.setUniform("uViewport",this._renderer._viewport))},a.default.Shader.prototype.unbindShader=function(){return this._bound&&(this.unbindTextures(),this._bound=!1),this},a.default.Shader.prototype.bindTextures=function(){var e=this._renderer.GL,t=!0,r=!1,i=void 0;try{for(var a,n=this.samplers[Symbol.iterator]();!(t=(a=n.next()).done);t=!0){var o=a.value,s=o.texture;void 0===s&&(s=this._renderer._getEmptyTexture()),e.activeTexture(e.TEXTURE0+o.samplerIndex),s.bindTexture(),s.update(),e.uniform1i(o.location,o.samplerIndex)}}catch(e){r=!0,i=e}finally{try{t||null==n.return||n.return()}finally{if(r)throw i}}},a.default.Shader.prototype.updateTextures=function(){var e=!0,t=!1,r=void 0;try{for(var i,a=this.samplers[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var n=i.value.texture;n&&n.update()}}catch(e){t=!0,r=e}finally{try{e||null==a.return||a.return()}finally{if(t)throw r}}},a.default.Shader.prototype.unbindTextures=function(){},a.default.Shader.prototype._setMatrixUniforms=function(){this.setUniform("uProjectionMatrix",this._renderer.uPMatrix.mat4),this.isStrokeShader()&&("default"===this._renderer._curCamera.cameraType?this.setUniform("uPerspective",1):this.setUniform("uPerspective",0)),this.setUniform("uModelViewMatrix",this._renderer.uMVMatrix.mat4),this.setUniform("uViewMatrix",this._renderer._curCamera.cameraMatrix.mat4),this.uniforms.uNormalMatrix&&(this._renderer.uNMatrix.inverseTranspose(this._renderer.uMVMatrix),this.setUniform("uNormalMatrix",this._renderer.uNMatrix.mat3))},a.default.Shader.prototype.useProgram=function(){return this._renderer.GL.useProgram(this._glProgram),this},a.default.Shader.prototype.setUniform=function(e,t){var r=this.uniforms[e];if(r){var i=r.location,a=this._renderer.GL;switch(this.useProgram(),r.type){case a.BOOL:!0===t?a.uniform1i(i,1):a.uniform1i(i,0);break;case a.INT:1<r.size?t.length&&a.uniform1iv(i,t):a.uniform1i(i,t);break;case a.FLOAT:1<r.size?t.length&&a.uniform1fv(i,t):a.uniform1f(i,t);break;case a.FLOAT_MAT3:a.uniformMatrix3fv(i,!1,t);break;case a.FLOAT_MAT4:a.uniformMatrix4fv(i,!1,t);break;case a.FLOAT_VEC2:1<r.size?t.length&&a.uniform2fv(i,t):a.uniform2f(i,t[0],t[1]);break;case a.FLOAT_VEC3:1<r.size?t.length&&a.uniform3fv(i,t):a.uniform3f(i,t[0],t[1],t[2]);break;case a.FLOAT_VEC4:1<r.size?t.length&&a.uniform4fv(i,t):a.uniform4f(i,t[0],t[1],t[2],t[3]);break;case a.INT_VEC2:1<r.size?t.length&&a.uniform2iv(i,t):a.uniform2i(i,t[0],t[1]);break;case a.INT_VEC3:1<r.size?t.length&&a.uniform3iv(i,t):a.uniform3i(i,t[0],t[1],t[2]);break;case a.INT_VEC4:1<r.size?t.length&&a.uniform4iv(i,t):a.uniform4i(i,t[0],t[1],t[2],t[3]);break;case a.SAMPLER_2D:a.activeTexture(a.TEXTURE0+r.samplerIndex),r.texture=this._renderer.getTexture(t),a.uniform1i(r.location,r.samplerIndex)}return this}},a.default.Shader.prototype.isLightShader=function(){return void 0!==this.attributes.aNormal||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.uDirectionalDiffuseColors||void 0!==this.uniforms.uDirectionalSpecularColors||void 0!==this.uniforms.uPointLightLocation||void 0!==this.uniforms.uPointLightDiffuseColors||void 0!==this.uniforms.uPointLightSpecularColors||void 0!==this.uniforms.uLightingDirection||void 0!==this.uniforms.uSpecular},a.default.Shader.prototype.isTextureShader=function(){return 0<this.samplerIndex},a.default.Shader.prototype.isColorShader=function(){return void 0!==this.attributes.aVertexColor||void 0!==this.uniforms.uMaterialColor},a.default.Shader.prototype.isTexLightShader=function(){return this.isLightShader()&&this.isTextureShader()},a.default.Shader.prototype.isStrokeShader=function(){return void 0!==this.uniforms.uStrokeWeight},a.default.Shader.prototype.enableAttrib=function(e,t,r,i,a,n){if(e){var o=e.location;if(-1!==o){var s=this._renderer.GL;s.enableVertexAttribArray(o),s.vertexAttribPointer(o,t,r||s.FLOAT,i||!1,a||0,n||0)}}return this};var n=a.default.Shader;r.default=n},{"../core/main":26}],81:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));a.default.Texture=function(e,t){this._renderer=e;var r=this._renderer.GL;this.src=t,this.glTex=void 0,this.glTarget=r.TEXTURE_2D,this.glFormat=r.RGBA,this.mipmaps=!1,this.glMinFilter=r.LINEAR,this.glMagFilter=r.LINEAR,this.glWrapS=r.CLAMP_TO_EDGE,this.glWrapT=r.CLAMP_TO_EDGE,this.isSrcMediaElement=void 0!==a.default.MediaElement&&t instanceof a.default.MediaElement,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==a.default.Element&&t instanceof a.default.Element&&!(t instanceof a.default.Graphics),this.isSrcP5Image=t instanceof a.default.Image,this.isSrcP5Graphics=t instanceof a.default.Graphics,this.isImageData="undefined"!=typeof ImageData&&t instanceof ImageData;var i=this._getTextureDataFromSource();return this.width=i.width,this.height=i.height,this.init(i),this},a.default.Texture.prototype._getTextureDataFromSource=function(){var e;return this.isSrcP5Image?e=this.src.canvas:this.isSrcMediaElement||this.isSrcP5Graphics||this.isSrcHTMLElement?e=this.src.elt:this.isImageData&&(e=this.src),e},a.default.Texture.prototype.init=function(e){var t=this._renderer.GL;if(this.glTex=t.createTexture(),this.glWrapS=this._renderer.textureWrapX,this.glWrapT=this._renderer.textureWrapY,this.setWrapMode(this.glWrapS,this.glWrapT),this.bindTexture(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.glMagFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.glMinFilter),0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata){var r=new Uint8Array([1,1,1,1]);t.texImage2D(this.glTarget,0,t.RGBA,1,1,0,this.glFormat,t.UNSIGNED_BYTE,r)}else t.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,t.UNSIGNED_BYTE,e)},a.default.Texture.prototype.update=function(){var e=this.src;if(0===e.width||0===e.height)return!1;var t=this._getTextureDataFromSource(),r=!1,i=this._renderer.GL;return t.width!==this.width||t.height!==this.height?(r=!0,this.width=t.width,this.height=t.height,this.isSrcP5Image?e.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&e.setModified(!0)):this.isSrcP5Image?e.isModified()&&(r=!0,e.setModified(!1)):this.isSrcMediaElement?e.isModified()?(r=!0,e.setModified(!1)):e.loadedmetadata&&this._videoPrevUpdateTime!==e.time()&&(this._videoPrevUpdateTime=e.time(),r=!0):this.isImageData?e._dirty&&(r=!(e._dirty=!1)):r=!0,r&&(this.bindTexture(),i.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,i.UNSIGNED_BYTE,t)),r},a.default.Texture.prototype.bindTexture=function(){return this._renderer.GL.bindTexture(this.glTarget,this.glTex),this},a.default.Texture.prototype.unbindTexture=function(){this._renderer.GL.bindTexture(this.glTarget,null)},a.default.Texture.prototype.setInterpolation=function(e,t){var r=this._renderer.GL;e===n.NEAREST?this.glMinFilter=r.NEAREST:this.glMinFilter=r.LINEAR,t===n.NEAREST?this.glMagFilter=r.NEAREST:this.glMagFilter=r.LINEAR,this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,this.glMinFilter),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,this.glMagFilter),this.unbindTexture()},a.default.Texture.prototype.setWrapMode=function(e,t){var r=this._renderer.GL,i=function(e){return 0==(e&e-1)},a=i(this.width),o=i(this.height);e===n.REPEAT?this.glWrapS=a&&o?r.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"),r.CLAMP_TO_EDGE):e===n.MIRROR?this.glWrapS=a&&o?r.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"),r.CLAMP_TO_EDGE):this.glWrapS=r.CLAMP_TO_EDGE,t===n.REPEAT?this.glWrapT=a&&o?r.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"),r.CLAMP_TO_EDGE):t===n.MIRROR?this.glWrapT=a&&o?r.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"),r.CLAMP_TO_EDGE):this.glWrapT=r.CLAMP_TO_EDGE,this.bindTexture(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this.glWrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()};var o=a.default.Texture;r.default=o},{"../core/constants":20,"../core/main":26}],82:[function(e,t,r){"use strict";var i,a=(i=e("../core/main"))&&i.__esModule?i:{default:i},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,r):{};i.get||i.set?Object.defineProperty(t,r,i):t[r]=e[r]}return t.default=e,t}(e("../core/constants"));function o(e,t){this.width=e,this.height=t,this.infos=[],this.findImage=function(e){var t,r,i=this.width*this.height;if(i<e)throw new Error("font is too complex to render in 3D");for(var a=this.infos.length-1;0<=a;--a){var n=this.infos[a];if(n.index+e<i){r=(t=n).imageData;break}}if(!t){try{r=new ImageData(this.width,this.height)}catch(e){var o=document.getElementsByTagName("canvas")[0],s=!o;o||((o=document.createElement("canvas")).style.display="none",document.body.appendChild(o));var l=o.getContext("2d");l&&(r=l.createImageData(this.width,this.height)),s&&document.body.removeChild(o)}t={index:0,imageData:r},this.infos.push(t)}var u=t.index;return t.index+=e,r._dirty=!0,{imageData:r,index:u}}}function s(e,t,r,i,a){var n=e.imageData.data,o=4*e.index++;n[o++]=t,n[o++]=r,n[o++]=i,n[o++]=a}e("./p5.Shader"),e("./p5.RendererGL.Retained"),a.default.RendererGL.prototype._applyTextProperties=function(){},a.default.RendererGL.prototype.textWidth=function(e){return this._isOpenType()?this._textFont._textWidth(e,this._textSize):0};var l=Math.sqrt(3),u=function(e){this.font=e,this.strokeImageInfos=new o(64,64),this.colDimImageInfos=new o(64,64),this.rowDimImageInfos=new o(64,64),this.colCellImageInfos=new o(64,64),this.rowCellImageInfos=new o(64,64),this.glyphInfos={},this.getGlyphInfo=function(e){var t=this.glyphInfos[e.index];if(t)return t;var r,i=e.getBoundingBox(),n=i.x1,o=i.y1,u=i.x2-n,h=i.y2-o,d=e.path.commands;if(0===u||0===h||!d.length)return this.glyphInfos[e.index]={};var c,f,p,m,v=[],g=[],y=[];for(r=8;0<=r;--r)y.push([]);for(r=8;0<=r;--r)g.push([]);function _(e,t,r){var i=v.length;function a(e,t,r){for(var i=e.length;0<i--;){var a=e[i];a<t&&(t=a),r<a&&(r=a)}return{min:t,max:r}}v.push(r);for(var n=a(e,1,0),o=Math.max(Math.floor(9*n.min),0),s=Math.min(Math.ceil(9*n.max),9),l=o;l<s;++l)y[l].push(i);for(var u=a(t,1,0),h=Math.max(Math.floor(9*u.min),0),d=Math.min(Math.ceil(9*u.max),9),c=h;c<d;++c)g[c].push(i)}function b(e){return(t=255*e)<0?0:255<t?255:t;var t}function x(e,t,r,i){this.p0=e,this.c0=t,this.c1=r,this.p1=i,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 a.default.Vector.sub(a.default.Vector.sub(this.p1,this.p0),a.default.Vector.mult(a.default.Vector.sub(this.c1,this.c0),3)).mag()/2},this.split=function(e){var t=a.default.Vector.lerp(this.p0,this.c0,e),r=a.default.Vector.lerp(this.c0,this.c1,e),i=a.default.Vector.lerp(t,r,e);this.c1=a.default.Vector.lerp(this.c1,this.p1,e),this.c0=a.default.Vector.lerp(r,this.c1,e);var n=a.default.Vector.lerp(i,this.c0,e),o=new x(this.p0,t,i,n);return this.p0=n,o},this.splitInflections=function(){var e=a.default.Vector.sub(this.c0,this.p0),t=a.default.Vector.sub(a.default.Vector.sub(this.c1,this.c0),e),r=a.default.Vector.sub(a.default.Vector.sub(a.default.Vector.sub(this.p1,this.c1),e),a.default.Vector.mult(t,2)),i=[],n=t.x*r.y-t.y*r.x;if(0!==n){var o=e.x*r.y-e.y*r.x,s=e.x*t.y-e.y*t.x,l=o*o-4*n*s;if(0<=l){n<0&&(n=-n,o=-o,s=-s);var u=Math.sqrt(l),h=(-o-u)/(2*n),d=(-o+u)/(2*n);0<h&&h<1&&(i.push(this.split(h)),d=1-(1-d)/(1-h)),0<d&&d<1&&i.push(this.split(d))}}return i.push(this),i}}function w(e,t,r,i,n,o,s,u){var h=new x(new a.default.Vector(e,t),new a.default.Vector(r,i),new a.default.Vector(n,o),new a.default.Vector(s,u)).splitInflections(),d=[],c=30/l,f=!0,p=!1,m=void 0;try{for(var v,g=h[Symbol.iterator]();!(f=(v=g.next()).done);f=!0){for(var y=v.value,_=[],b=void 0;!(.125<=(b=c/y.quadError()));){var w=Math.pow(b,1/3),S=y.split(w),M=y.split(1-w/(1-w));d.push(S),_.push(y),y=M}b<1&&d.push(y.split(.5)),d.push(y),Array.prototype.push.apply(d,_.reverse())}}catch(e){p=!0,m=e}finally{try{f||null==g.return||g.return()}finally{if(p)throw m}}return d}function S(e,t,r,i){_([e,r],[t,i],{x:e,y:t,cx:(e+r)/2,cy:(t+i)/2})}function M(e,t,r,i){return Math.abs(r-e)<1e-5&&Math.abs(i-t)<1e-5}var E=!0,T=!1,C=void 0;try{for(var P,L=d[Symbol.iterator]();!(E=(P=L.next()).done);E=!0){var R=P.value,O=(R.x-n)/u,D=(R.y-o)/h;if(!M(c,f,O,D)){switch(R.type){case"M":p=O,m=D;break;case"L":S(c,f,O,D);break;case"Q":var A=(R.x1-n)/u,I=(R.y1-o)/h;_([c,O,A],[f,D,I],{x:c,y:f,cx:A,cy:I});break;case"Z":M(c,f,p,m)?v.push({x:c,y:f}):(S(c,f,p,m),v.push({x:p,y:m}));break;case"C":for(var k=w(c,f,(R.x1-n)/u,(R.y1-o)/h,(R.x2-n)/u,(R.y2-o)/h,O,D),U=0;U<k.length;U++){var F=k[U].toQuadratic();_([F.x,F.x1,F.cx],[F.y,F.y1,F.cy],F)}break;default:throw new Error("unknown command type: ".concat(R.type))}c=O,f=D}}}catch(e){T=!0,C=e}finally{try{E||null==L.return||L.return()}finally{if(T)throw C}}for(var N=v.length,B=this.strokeImageInfos.findImage(N),G=B.index,j=0;j<N;++j){var V=v[j];s(B,b(V.x),b(V.y),b(V.cx),b(V.cy))}function z(e,t,r){for(var i=e.length,a=t.findImage(i),n=a.index,o=0,l=0;l<i;++l)o+=e[l].length;for(var u=r.findImage(o),h=0;h<i;++h){var d=e[h],c=d.length,f=u.index;s(a,f>>7,127&f,c>>7,127&c);for(var p=0;p<c;++p){var m=d[p]+G;s(u,m>>7,127&m,0,0)}}return{cellImageInfo:u,dimOffset:n,dimImageInfo:a}}return(t=this.glyphInfos[e.index]={glyph:e,uGlyphRect:[i.x1,-i.y1,i.x2,-i.y2],strokeImageInfo:B,strokes:v,colInfo:z(y,this.colDimImageInfos,this.colCellImageInfos),rowInfo:z(g,this.rowDimImageInfos,this.rowCellImageInfos)}).uGridOffset=[t.colInfo.dimOffset,t.rowInfo.dimOffset],t}};a.default.RendererGL.prototype._renderText=function(e,t,r,i,o){if(this._textFont&&"string"!=typeof this._textFont){if(!(o<=i)&&this._doFill){if(!this._isOpenType())return console.log("WEBGL: only Opentype (.otf) and Truetype (.ttf) fonts are supported"),e;e.push();var s=this._doStroke,l=this.drawMode;this._doStroke=!1,this.drawMode=n.TEXTURE;var h=this._textFont.font,d=this._textFont._fontInfo;d||(d=this._textFont._fontInfo=new u(h));var c=this._textFont._handleAlignment(this,t,r,i),f=this._textSize/h.unitsPerEm;this.translate(c.x,c.y,0),this.scale(f,f,1);var p=this.GL,m=!this._defaultFontShader,v=this._getFontShader();v.init(),v.bindShader(),m&&(v.setUniform("uGridImageSize",[64,64]),v.setUniform("uCellsImageSize",[64,64]),v.setUniform("uStrokeImageSize",[64,64]),v.setUniform("uGridSize",[9,9])),this._applyColorBlend(this.curFillColor);var g=this.gHash.glyph;if(!g){var y=this._textGeom=new a.default.Geometry(1,1,(function(){for(var e=0;e<=1;e++)for(var t=0;t<=1;t++)this.vertices.push(new a.default.Vector(t,e,0)),this.uvs.push(t,e)}));y.computeFaces().computeNormals(),g=this.createBuffers("glyph",y)}this._prepareBuffers(g,v,a.default.RendererGL._textBuffers),this._bindBuffer(g.indexBuffer,p.ELEMENT_ARRAY_BUFFER),v.setUniform("uMaterialColor",this.curFillColor);try{var _=0,b=null,x=h.stringToGlyphs(t),w=!0,S=!1,M=void 0;try{for(var E,T=x[Symbol.iterator]();!(w=(E=T.next()).done);w=!0){var C=E.value;b&&(_+=h.getKerningValue(b,C));var P=d.getGlyphInfo(C);if(P.uGlyphRect){var L=P.rowInfo,R=P.colInfo;v.setUniform("uSamplerStrokes",P.strokeImageInfo.imageData),v.setUniform("uSamplerRowStrokes",L.cellImageInfo.imageData),v.setUniform("uSamplerRows",L.dimImageInfo.imageData),v.setUniform("uSamplerColStrokes",R.cellImageInfo.imageData),v.setUniform("uSamplerCols",R.dimImageInfo.imageData),v.setUniform("uGridOffset",P.uGridOffset),v.setUniform("uGlyphRect",P.uGlyphRect),v.setUniform("uGlyphOffset",_),v.bindTextures(),p.drawElements(p.TRIANGLES,6,this.GL.UNSIGNED_SHORT,0)}_+=C.advanceWidth,b=C}}catch(e){S=!0,M=e}finally{try{w||null==T.return||T.return()}finally{if(S)throw M}}}finally{v.unbindShader(),this._doStroke=s,this.drawMode=l,e.pop()}return e}}else console.log("WEBGL: you must load and set a font before drawing text. See `loadFont` and `textFont` for more details.")}},{"../core/constants":20,"../core/main":26,"./p5.RendererGL.Retained":78,"./p5.Shader":80}]},{},[15])(15)}).call(this,r(2))},function(e,t,r){"use strict";function i(e){const t={range:{step:1,min:0,max:255}};return t[e]?t[e]:{}}function a(e,t,r={x:0,y:0}){return`width: ${e}px; height: ${t}px; transform: translateX(${r.x}px) translateY(${r.y}px);`}r.d(t,"a",(function(){return n}));class n{constructor(e,t){this.variables=e;const r={uid:"ui-"+Math.floor(Math.random()*Date.now()),selector:"body",save:!1,width:320,height:450,xpos:0,ypos:0};t||(t={}),this.options=Object.assign(r,t),this.options.save&&this.readSavedState(),this.createUI(this.variables),this.revocable=this.createProxy(),this.proxy=this.revocable.proxy,window.sketchUI=window.ui||[],window.sketchUI.push(this)}destroy(){return this.panel.remove(),this.revocable.revoke(),null}readSavedState(){const e=window.localStorage.getItem(this.options.uid);if(e){const t=JSON.parse(e);t.values.forEach(e=>{const t=Object.keys(e)[0],r=Object.values(e)[0];this.variables[t]&&(this.variables[t].value=r)}),delete t.values,this.options=Object.assign(this.options,t)}}getState(){return{width:this.options.width,height:this.options.height,xpos:this.options.xpos,ypos:this.options.ypos,values:this.getValues()}}saveState(){if(this.options.save){const e=JSON.stringify(this.getState());window.localStorage.setItem(this.options.uid,e)}}getValues(){let e=[];for(let t in this.variables)"button"!=this.variables[t].type&&e.push({[t]:this.variables[t].value});return e}createProxy(){return Proxy.revocable(this.variables,{get:(e,t)=>e[t]?e[t].value:void console.warn(`No variable ${t} found`),set:(e,t,r)=>(r=function(e,t,r){return void 0!==e[t].min&&(r=Math.max(r,e[t].min)),void 0!==e[t].max&&(r=Math.min(r,e[t].max)),r}(e,t,r),e[t].value=r,this.updateField(t,r),e[t].callback&&e[t].callback(r,this.options.context),this.saveState(),!0)})}updateSize(){const e=this.options;e.width=this.panel.offsetWidth,e.height=this.panel.offsetHeight;const t=a(e.width,e.height,{x:e.xpos,y:e.ypos});this.panel.setAttribute("style",t),this.saveState()}updateField(e,t){const r=this.variables[e].type,i=document.getElementById(this.attrWithUid(e));"checkbox"===r?!0===t?i.checked=!0:i.removeAttribute("checked"):i.value=t,document.querySelector(`[for=${this.attrWithUid(e)}] span`).innerHTML=t}createUI(e){const t=this.buildPanel();for(let a in e){let n=e[a];n.type||(n.options?n.type="select":n.type="string"==typeof(r=n.value)&&"#"==r[0]&&7==r.length?"color":"number"==typeof r?"range":"boolean"==typeof r?"checkbox":"text");const o=i(n.type);e[a]=Object.assign(o,n),"button"!=n.type&&t.appendChild(this.buildLabel(a,e[a].label)),t.appendChild(this.buildInput(a,e[a]))}var r;return this.panel=t,this.updateSize(),t}buildPanel(e=this.options.selector){const t=document.querySelector(e);t.innerHTML=`\n    <div class='sketch-ui-panel' id='${this.options.uid}' style='${a(this.options.width,this.options.height)}'>\n      <div class='sketch-ui-handle'>Move</div>\n      <button class='ui-clear'>Clear saved</button>\n    </div>\n  `;const r=t.querySelector(`#${this.options.uid}`);return document.addEventListener("keyup",e=>{"h"==e.key&&r.classList.toggle("hidden")}),r.querySelector(".ui-clear").addEventListener("click",()=>window.localStorage.clear()),r.querySelector(".sketch-ui-handle").addEventListener("mousedown",e=>{e.preventDefault();const t=r.getBoundingClientRect(),i=document.querySelector(this.options.selector).getBoundingClientRect().top,a=this.options;a.xpos=t.left,a.ypos=t.top-i,a.xOffset=e.clientX-a.xpos,a.yOffset=e.clientY-a.ypos;const n=this.handlePanelDrag.bind(this);document.addEventListener("mousemove",n),document.addEventListener("mouseup",e=>{e.preventDefault(),document.removeEventListener("mousemove",n)})}),r.addEventListener("mouseup",()=>this.updateSize()),r}handlePanelDrag(e){this.options.xpos=e.clientX-this.options.xOffset,this.options.ypos=e.clientY-this.options.yOffset,this.updateSize()}buildLabel(e,t=e){const r=document.createElement("label");return r.setAttribute("for",this.attrWithUid(e)),r.innerHTML=`${t}<span></span>`,r}buildInput(e,t){if("button"===t.type)return this.buildButton(e,t);if("select"===t.type)return this.buildSelect(e,t);let r=document.createElement("input");r.setAttribute("id",this.attrWithUid(e)),document.querySelector(`[for=${this.attrWithUid(e)}] span`).innerHTML=t.value;const i=["callback","label","value"];for(let e in t)i.includes(e)||r.setAttribute(e,t[e]);return r.value=t.value,"checkbox"==t.type?(r.removeAttribute("value"),t.value&&r.setAttribute("checked",t.value),r.addEventListener("change",t=>{this.proxy[e]=t.target.checked})):r.addEventListener("input",t=>{this.proxy[e]=t.target.value}),r}buildButton(e,t){const r=document.createElement("div");if(r.classList.add("sketch-ui-button-wrapper"),r.innerHTML=`\n      <button id=${this.attrWithUid(e)}>\n        ${t.label?t.label:e}\n      </button>\n    `,t.callback){r.querySelector("button").addEventListener("click",e=>{e.preventDefault(),t.callback(this.options.context)})}return r}buildSelect(e,t){let r=document.createElement("select");r.setAttribute("id",this.attrWithUid(e));const i=t.value?t.value:t.options[0];return t.value=i,r.innerHTML=t.options.map(e=>`\n        <option ${e==i?"selected":""} value='${e}'>\n          ${e}\n        </option>\n      `).join(""),document.querySelector(`[for=${this.attrWithUid(e)}] span`).innerHTML=i,r.addEventListener("change",t=>this.proxy[e]=t.target.value),r}attrWithUid(e){return`${e}-${this.options.uid}`}}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){}]]);