!function r(t,n,e){function i(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var f=n[s]={exports:{}};t[s][0].call(f.exports,function(r){var n=t[s][1][r];return i(n?n:r)},f,f.exports,r,t,n,e)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;se;e+=1)n[i++]=r[t[e][0]][0],n[i++]=r[t[e][0]][1],n[i++]=r[t[e][1]][0],n[i++]=r[t[e][1]][1],n[i++]=r[t[e][2]][0],n[i++]=r[t[e][2]][1];return n}function s(r,t,n){if(!p[t]){var e=t+2,i=new Float32Array(2*e),o=2*Math.PI,s=0;i[s++]=0,i[s++]=0;for(var a=0;e>=a;a++)i[s++]=Math.cos(a*o/t),i[s++]=Math.sin(a*o/t);p[t]=g(f,i)}return{c:n,s:[r,r,0],t:[0,0,0],vertices:p[t],d:f.TRIANGLE_FAN,l:t+2}}function a(r,t,n,e){if(!p[r+n]){var i=v(r,{font:n,triangles:!0,orientation:"ccw",textAlign:"start",textBaseline:"top"});p[r+n]=g(f,o(i))}return{c:e,t:[0,0,0],s:[t,t,0],vertices:p[r+n],d:f.TRIANGLES,l:p[r+n].length/2/4}}function u(r){l(f);for(var t=0;t1?arguments[1]:"utf8"):u(this,r)):arguments.length>1?new o(r,arguments[1]):new o(r)}function s(r,t){if(r=v(r,0>t?0:0|d(t)),!o.TYPED_ARRAY_SUPPORT)for(var n=0;t>n;n++)r[n]=0;return r}function a(r,t,n){("string"!=typeof n||""===n)&&(n="utf8");var e=0|m(t,n);return r=v(r,e),r.write(t,n),r}function u(r,t){if(o.isBuffer(t))return h(r,t);if(X(t))return f(r,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(t.buffer instanceof ArrayBuffer)return l(r,t);if(t instanceof ArrayBuffer)return c(r,t)}return t.length?p(r,t):g(r,t)}function h(r,t){var n=0|d(t.length);return r=v(r,n),t.copy(r,0,0,n),r}function f(r,t){var n=0|d(t.length);r=v(r,n);for(var e=0;n>e;e+=1)r[e]=255&t[e];return r}function l(r,t){var n=0|d(t.length);r=v(r,n);for(var e=0;n>e;e+=1)r[e]=255&t[e];return r}function c(r,t){return o.TYPED_ARRAY_SUPPORT?(t.byteLength,r=o._augment(new Uint8Array(t))):r=l(r,new Uint8Array(t)),r}function p(r,t){var n=0|d(t.length);r=v(r,n);for(var e=0;n>e;e+=1)r[e]=255&t[e];return r}function g(r,t){var n,e=0;"Buffer"===t.type&&X(t.data)&&(n=t.data,e=0|d(n.length)),r=v(r,e);for(var i=0;e>i;i+=1)r[i]=255&n[i];return r}function v(r,t){o.TYPED_ARRAY_SUPPORT?(r=o._augment(new Uint8Array(t)),r.__proto__=o.prototype):(r.length=t,r._isBuffer=!0);var n=0!==t&&t<=o.poolSize>>>1;return n&&(r.parent=J),r}function d(r){if(r>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|r}function y(r,t){if(!(this instanceof y))return new y(r,t);var n=new o(r,t);return delete n.parent,n}function m(r,t){"string"!=typeof r&&(r=""+r);var n=r.length;if(0===n)return 0;for(var e=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return n;case"utf8":case"utf-8":return Y(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(r).length;default:if(e)return Y(r).length;t=(""+t).toLowerCase(),e=!0}}function b(r,t,n){var e=!1;if(t=0|t,n=void 0===n||n===1/0?this.length:0|n,r||(r="utf8"),0>t&&(t=0),n>this.length&&(n=this.length),t>=n)return"";for(;;)switch(r){case"hex":return R(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return P(this,t,n);case"binary":return B(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,n);default:if(e)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),e=!0}}function w(r,t,n,e){n=Number(n)||0;var i=r.length-n;e?(e=Number(e),e>i&&(e=i)):e=i;var o=t.length;if(o%2!==0)throw new Error("Invalid hex string");e>o/2&&(e=o/2);for(var s=0;e>s;s++){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))throw new Error("Invalid hex string");r[n+s]=a}return s}function _(r,t,n,e){return W(Y(t,r.length-n),r,n,e)}function A(r,t,n,e){return W(z(t),r,n,e)}function x(r,t,n,e){return A(r,t,n,e)}function E(r,t,n,e){return W(H(t),r,n,e)}function j(r,t,n,e){return W(G(t,r.length-n),r,n,e)}function k(r,t,n){return 0===t&&n===r.length?Q.fromByteArray(r):Q.fromByteArray(r.slice(t,n))}function I(r,t,n){n=Math.min(r.length,n);for(var e=[],i=t;n>i;){var o=r[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(n>=i+a){var u,h,f,l;switch(a){case 1:128>o&&(s=o);break;case 2:u=r[i+1],128===(192&u)&&(l=(31&o)<<6|63&u,l>127&&(s=l));break;case 3:u=r[i+1],h=r[i+2],128===(192&u)&&128===(192&h)&&(l=(15&o)<<12|(63&u)<<6|63&h,l>2047&&(55296>l||l>57343)&&(s=l));break;case 4:u=r[i+1],h=r[i+2],f=r[i+3],128===(192&u)&&128===(192&h)&&128===(192&f)&&(l=(15&o)<<18|(63&u)<<12|(63&h)<<6|63&f,l>65535&&1114112>l&&(s=l))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,e.push(s>>>10&1023|55296),s=56320|1023&s),e.push(s),i+=a}return M(e)}function M(r){var t=r.length;if(Z>=t)return String.fromCharCode.apply(String,r);for(var n="",e=0;t>e;)n+=String.fromCharCode.apply(String,r.slice(e,e+=Z));return n}function P(r,t,n){var e="";n=Math.min(r.length,n);for(var i=t;n>i;i++)e+=String.fromCharCode(127&r[i]);return e}function B(r,t,n){var e="";n=Math.min(r.length,n);for(var i=t;n>i;i++)e+=String.fromCharCode(r[i]);return e}function R(r,t,n){var e=r.length;(!t||0>t)&&(t=0),(!n||0>n||n>e)&&(n=e);for(var i="",o=t;n>o;o++)i+=D(r[o]);return i}function T(r,t,n){for(var e=r.slice(t,n),i="",o=0;or)throw new RangeError("offset is not uint");if(r+t>n)throw new RangeError("Trying to access beyond buffer length")}function S(r,t,n,e,i,s){if(!o.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");if(t>i||s>t)throw new RangeError("value is out of bounds");if(n+e>r.length)throw new RangeError("index out of range")}function L(r,t,n,e){0>t&&(t=65535+t+1);for(var i=0,o=Math.min(r.length-n,2);o>i;i++)r[n+i]=(t&255<<8*(e?i:1-i))>>>8*(e?i:1-i)}function V(r,t,n,e){0>t&&(t=4294967295+t+1);for(var i=0,o=Math.min(r.length-n,4);o>i;i++)r[n+i]=t>>>8*(e?i:3-i)&255}function N(r,t,n,e,i,o){if(t>i||o>t)throw new RangeError("value is out of bounds");if(n+e>r.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function F(r,t,n,e,i){return i||N(r,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(r,t,n,e,23,4),n+4}function O(r,t,n,e,i){return i||N(r,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(r,t,n,e,52,8),n+8}function C(r){if(r=q(r).replace(rr,""),r.length<2)return"";for(;r.length%4!==0;)r+="=";return r}function q(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function D(r){return 16>r?"0"+r.toString(16):r.toString(16)}function Y(r,t){t=t||1/0;for(var n,e=r.length,i=null,o=[],s=0;e>s;s++){if(n=r.charCodeAt(s),n>55295&&57344>n){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===e){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(56320>n){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=i-55296<<10|n-56320|65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,128>n){if((t-=1)<0)break;o.push(n)}else if(2048>n){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(65536>n){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(1114112>n))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function z(r){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(e);return o}function H(r){return Q.toByteArray(C(r))}function W(r,t,n,e){for(var i=0;e>i&&!(i+n>=t.length||i>=r.length);i++)t[i+n]=r[i];return i}var Q=r("base64-js"),K=r("ieee754"),X=r("is-array");n.Buffer=o,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50,o.poolSize=8192;var J={};o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:e(),o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array),o.isBuffer=function(r){return!(null==r||!r._isBuffer)},o.compare=function(r,t){if(!o.isBuffer(r)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(r===t)return 0;for(var n=r.length,e=t.length,i=0,s=Math.min(n,e);s>i&&r[i]===t[i];)++i;return i!==s&&(n=r[i],e=t[i]),e>n?-1:n>e?1:0},o.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(r,t){if(!X(r))throw new TypeError("list argument must be an Array of Buffers.");if(0===r.length)return new o(0);var n;if(void 0===t)for(t=0,n=0;n0&&(r=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(r+=" ... ")),""},o.prototype.compare=function(r){if(!o.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?0:o.compare(this,r)},o.prototype.indexOf=function(r,t){function n(r,t,n){for(var e=-1,i=0;n+i2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof r)return 0===r.length?-1:String.prototype.indexOf.call(this,r,t);if(o.isBuffer(r))return n(this,r,t);if("number"==typeof r)return o.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,r,t):n(this,[r],t);throw new TypeError("val must be string, number or Buffer")},o.prototype.get=function(r){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(r)},o.prototype.set=function(r,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(r,t)},o.prototype.write=function(r,t,n,e){if(void 0===t)e="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)e=t,n=this.length,t=0;else if(isFinite(t))t=0|t,isFinite(n)?(n=0|n,void 0===e&&(e="utf8")):(e=n,n=void 0);else{var i=e;e=t,t=0|n,n=i}var o=this.length-t;if((void 0===n||n>o)&&(n=o),r.length>0&&(0>n||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");e||(e="utf8");for(var s=!1;;)switch(e){case"hex":return w(this,r,t,n);case"utf8":case"utf-8":return _(this,r,t,n);case"ascii":return A(this,r,t,n);case"binary":return x(this,r,t,n);case"base64":return E(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,r,t,n);default:if(s)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),s=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;o.prototype.slice=function(r,t){var n=this.length;r=~~r,t=void 0===t?n:~~t,0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),r>t&&(t=r);var e;if(o.TYPED_ARRAY_SUPPORT)e=o._augment(this.subarray(r,t));else{var i=t-r;e=new o(i,void 0);for(var s=0;i>s;s++)e[s]=this[s+r]}return e.length&&(e.parent=this.parent||this),e},o.prototype.readUIntLE=function(r,t,n){r=0|r,t=0|t,n||U(r,t,this.length);for(var e=this[r],i=1,o=0;++o0&&(i*=256);)e+=this[r+--t]*i;return e},o.prototype.readUInt8=function(r,t){return t||U(r,1,this.length),this[r]},o.prototype.readUInt16LE=function(r,t){return t||U(r,2,this.length),this[r]|this[r+1]<<8},o.prototype.readUInt16BE=function(r,t){return t||U(r,2,this.length),this[r]<<8|this[r+1]},o.prototype.readUInt32LE=function(r,t){return t||U(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+16777216*this[r+3]},o.prototype.readUInt32BE=function(r,t){return t||U(r,4,this.length),16777216*this[r]+(this[r+1]<<16|this[r+2]<<8|this[r+3])},o.prototype.readIntLE=function(r,t,n){r=0|r,t=0|t,n||U(r,t,this.length);for(var e=this[r],i=1,o=0;++o=i&&(e-=Math.pow(2,8*t)),e},o.prototype.readIntBE=function(r,t,n){r=0|r,t=0|t,n||U(r,t,this.length);for(var e=t,i=1,o=this[r+--e];e>0&&(i*=256);)o+=this[r+--e]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(r,t){return t||U(r,1,this.length),128&this[r]?-1*(255-this[r]+1):this[r]},o.prototype.readInt16LE=function(r,t){t||U(r,2,this.length);var n=this[r]|this[r+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(r,t){t||U(r,2,this.length);var n=this[r+1]|this[r]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(r,t){return t||U(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},o.prototype.readInt32BE=function(r,t){return t||U(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},o.prototype.readFloatLE=function(r,t){return t||U(r,4,this.length),K.read(this,r,!0,23,4)},o.prototype.readFloatBE=function(r,t){return t||U(r,4,this.length),K.read(this,r,!1,23,4)},o.prototype.readDoubleLE=function(r,t){return t||U(r,8,this.length),K.read(this,r,!0,52,8)},o.prototype.readDoubleBE=function(r,t){return t||U(r,8,this.length),K.read(this,r,!1,52,8)},o.prototype.writeUIntLE=function(r,t,n,e){r=+r,t=0|t,n=0|n,e||S(this,r,t,n,Math.pow(2,8*n),0);var i=1,o=0;for(this[t]=255&r;++o=0&&(o*=256);)this[t+i]=r/o&255;return t+n},o.prototype.writeUInt8=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[t]=255&r,t+1},o.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&r,this[t+1]=r>>>8):L(this,r,t,!0),t+2},o.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=r>>>8,this[t+1]=255&r):L(this,r,t,!1),t+2},o.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=255&r):V(this,r,t,!0),t+4},o.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=255&r):V(this,r,t,!1),t+4},o.prototype.writeIntLE=function(r,t,n,e){if(r=+r,t=0|t,!e){var i=Math.pow(2,8*n-1);S(this,r,t,n,i-1,-i)}var o=0,s=1,a=0>r?1:0;for(this[t]=255&r;++o>0)-a&255;return t+n},o.prototype.writeIntBE=function(r,t,n,e){if(r=+r,t=0|t,!e){var i=Math.pow(2,8*n-1);S(this,r,t,n,i-1,-i)}var o=n-1,s=1,a=0>r?1:0;for(this[t+o]=255&r;--o>=0&&(s*=256);)this[t+o]=(r/s>>0)-a&255;return t+n},o.prototype.writeInt8=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),0>r&&(r=255+r+1),this[t]=255&r,t+1},o.prototype.writeInt16LE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&r,this[t+1]=r>>>8):L(this,r,t,!0),t+2},o.prototype.writeInt16BE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=r>>>8,this[t+1]=255&r):L(this,r,t,!1),t+2},o.prototype.writeInt32LE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&r,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24):V(this,r,t,!0),t+4},o.prototype.writeInt32BE=function(r,t,n){return r=+r,t=0|t,n||S(this,r,t,4,2147483647,-2147483648),0>r&&(r=4294967295+r+1),o.TYPED_ARRAY_SUPPORT?(this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=255&r):V(this,r,t,!1),t+4},o.prototype.writeFloatLE=function(r,t,n){return F(this,r,t,!0,n)},o.prototype.writeFloatBE=function(r,t,n){return F(this,r,t,!1,n)},o.prototype.writeDoubleLE=function(r,t,n){return O(this,r,t,!0,n)},o.prototype.writeDoubleBE=function(r,t,n){return O(this,r,t,!1,n)},o.prototype.copy=function(r,t,n,e){if(n||(n=0),e||0===e||(e=this.length),t>=r.length&&(t=r.length),t||(t=0),e>0&&n>e&&(e=n),e===n)return 0;if(0===r.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>e)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),r.length-tn&&e>t)for(i=s-1;i>=0;i--)r[i+t]=this[i+n];else if(1e3>s||!o.TYPED_ARRAY_SUPPORT)for(i=0;s>i;i++)r[i+t]=this[i+n];else r._set(this.subarray(n,n+s),t);return s},o.prototype.fill=function(r,t,n){if(r||(r=0),t||(t=0),n||(n=this.length),t>n)throw new RangeError("end < start");if(n!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var e;if("number"==typeof r)for(e=t;n>e;e++)this[e]=r;else{var i=Y(r.toString()),o=i.length;for(e=t;n>e;e++)this[e]=i[e%o]}return this}},o.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(o.TYPED_ARRAY_SUPPORT)return new o(this).buffer;for(var r=new Uint8Array(this.length),t=0,n=r.length;n>t;t+=1)r[t]=this[t];return r.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var $=o.prototype;o._augment=function(r){return r.constructor=o,r._isBuffer=!0,r._set=r.set,r.get=$.get,r.set=$.set,r.write=$.write,r.toString=$.toString,r.toLocaleString=$.toString,r.toJSON=$.toJSON,r.equals=$.equals,r.compare=$.compare,r.indexOf=$.indexOf,r.copy=$.copy,r.slice=$.slice,r.readUIntLE=$.readUIntLE,r.readUIntBE=$.readUIntBE,r.readUInt8=$.readUInt8,r.readUInt16LE=$.readUInt16LE,r.readUInt16BE=$.readUInt16BE,r.readUInt32LE=$.readUInt32LE,r.readUInt32BE=$.readUInt32BE,r.readIntLE=$.readIntLE,r.readIntBE=$.readIntBE,r.readInt8=$.readInt8,r.readInt16LE=$.readInt16LE,r.readInt16BE=$.readInt16BE,r.readInt32LE=$.readInt32LE,r.readInt32BE=$.readInt32BE,r.readFloatLE=$.readFloatLE,r.readFloatBE=$.readFloatBE,r.readDoubleLE=$.readDoubleLE,r.readDoubleBE=$.readDoubleBE,r.writeUInt8=$.writeUInt8,r.writeUIntLE=$.writeUIntLE,r.writeUIntBE=$.writeUIntBE,r.writeUInt16LE=$.writeUInt16LE,r.writeUInt16BE=$.writeUInt16BE,r.writeUInt32LE=$.writeUInt32LE,r.writeUInt32BE=$.writeUInt32BE,r.writeIntLE=$.writeIntLE,r.writeIntBE=$.writeIntBE,r.writeInt8=$.writeInt8,r.writeInt16LE=$.writeInt16LE,r.writeInt16BE=$.writeInt16BE,r.writeInt32LE=$.writeInt32LE,r.writeInt32BE=$.writeInt32BE,r.writeFloatLE=$.writeFloatLE,r.writeFloatBE=$.writeFloatBE,r.writeDoubleLE=$.writeDoubleLE,r.writeDoubleBE=$.writeDoubleBE,r.fill=$.fill,r.inspect=$.inspect,r.toArrayBuffer=$.toArrayBuffer,r};var rr=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(r,t,n){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(r){"use strict";function t(r){var t=r.charCodeAt(0);return t===s||t===l?62:t===a||t===c?63:u>t?-1:u+10>t?t-u+26+26:f+26>t?t-f:h+26>t?t-h+26:void 0}function n(r){function n(r){h[l++]=r}var e,i,s,a,u,h;if(r.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=r.length;u="="===r.charAt(f-2)?2:"="===r.charAt(f-1)?1:0,h=new o(3*r.length/4-u),s=u>0?r.length-4:r.length;var l=0;for(e=0,i=0;s>e;e+=4,i+=3)a=t(r.charAt(e))<<18|t(r.charAt(e+1))<<12|t(r.charAt(e+2))<<6|t(r.charAt(e+3)),n((16711680&a)>>16),n((65280&a)>>8),n(255&a);return 2===u?(a=t(r.charAt(e))<<2|t(r.charAt(e+1))>>4,n(255&a)):1===u&&(a=t(r.charAt(e))<<10|t(r.charAt(e+1))<<4|t(r.charAt(e+2))>>2,n(a>>8&255),n(255&a)),h}function i(r){function t(r){return e.charAt(r)}function n(r){return t(r>>18&63)+t(r>>12&63)+t(r>>6&63)+t(63&r)}var i,o,s,a=r.length%3,u="";for(i=0,s=r.length-a;s>i;i+=3)o=(r[i]<<16)+(r[i+1]<<8)+r[i+2],u+=n(o);switch(a){case 1:o=r[r.length-1],u+=t(o>>2),u+=t(o<<4&63),u+="==";break;case 2:o=(r[r.length-2]<<8)+r[r.length-1],u+=t(o>>10),u+=t(o>>4&63),u+=t(o<<2&63),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),h="a".charCodeAt(0),f="A".charCodeAt(0),l="-".charCodeAt(0),c="_".charCodeAt(0);r.toByteArray=n,r.fromByteArray=i}("undefined"==typeof n?this.base64js={}:n)},{}],4:[function(r,t,n){n.read=function(r,t,n,e,i){var o,s,a=8*i-e-1,u=(1<>1,f=-7,l=n?i-1:0,c=n?-1:1,p=r[t+l];for(l+=c,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+r[t+l],l+=c,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=e;f>0;s=256*s+r[t+l],l+=c,f-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:(p?-1:1)*(1/0);s+=Math.pow(2,e),o-=h}return(p?-1:1)*s*Math.pow(2,o-e)},n.write=function(r,t,n,e,i,o){var s,a,u,h=8*o-i-1,f=(1<>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:o-1,g=e?1:-1,v=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+l>=1?c/u:c*Math.pow(2,1-l),t*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*u-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;r[n+p]=255&a,p+=g,a/=256,i-=8);for(s=s<0;r[n+p]=255&s,p+=g,s/=256,h-=8);r[n+p-g]|=128*v}},{}],5:[function(r,t,n){var e=Array.isArray,i=Object.prototype.toString;t.exports=e||function(r){return!!r&&"[object Array]"==i.call(r)}},{}],6:[function(r,t,n){"use strict";function e(r,t,n,e,i){this.gl=r,this.type=t,this.handle=n,this.length=e,this.usage=i}function i(r,t,n,e,i,o){var s=i.length*i.BYTES_PER_ELEMENT;if(0>o)return r.bufferData(t,i,e),s;if(s+o>n)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return r.bufferSubData(t,o,i),n}function o(r,t){for(var n=u.malloc(r.length,t),e=r.length,i=0;e>i;++i)n[i]=r[i];return n}function s(r,t){for(var n=1,e=t.length-1;e>=0;--e){if(t[e]!==n)return!1;n*=r[e]}return!0}function a(r,t,n,i){if(n=n||r.ARRAY_BUFFER,i=i||r.DYNAMIC_DRAW,n!==r.ARRAY_BUFFER&&n!==r.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(i!==r.DYNAMIC_DRAW&&i!==r.STATIC_DRAW&&i!==r.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var o=r.createBuffer(),s=new e(r,n,o,0,i);return s.update(t),s}var u=r("typedarray-pool"),h=r("ndarray-ops"),f=r("ndarray"),l=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],c=e.prototype;c.bind=function(){this.gl.bindBuffer(this.type,this.handle)},c.unbind=function(){this.gl.bindBuffer(this.type,null)},c.dispose=function(){this.gl.deleteBuffer(this.handle)},c.update=function(r,t){if("number"!=typeof t&&(t=-1),this.bind(),"object"==typeof r&&"undefined"!=typeof r.shape){var n=r.dtype;if(l.indexOf(n)<0&&(n="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var e=gl.getExtension("OES_element_index_uint");n=e&&"uint16"!==n?"uint32":"uint16"}if(n===r.dtype&&s(r.shape,r.stride))0===r.offset&&r.data.length===r.shape[0]?this.length=i(this.gl,this.type,this.length,this.usage,r.data,t):this.length=i(this.gl,this.type,this.length,this.usage,r.data.subarray(r.offset,r.shape[0]),t);else{var a=u.malloc(r.size,n),c=f(a,r.shape);h.assign(c,r),0>t?this.length=i(this.gl,this.type,this.length,this.usage,a,t):this.length=i(this.gl,this.type,this.length,this.usage,a.subarray(0,r.size),t),u.free(a)}}else if(Array.isArray(r)){var p;p=this.type===this.gl.ELEMENT_ARRAY_BUFFER?o(r,"uint16"):o(r,"float32"),0>t?this.length=i(this.gl,this.type,this.length,this.usage,p,t):this.length=i(this.gl,this.type,this.length,this.usage,p.subarray(0,r.length),t),u.free(p)}else if("object"==typeof r&&"number"==typeof r.length)this.length=i(this.gl,this.type,this.length,this.usage,r,t);else{if("number"!=typeof r&&void 0!==r)throw new Error("gl-buffer: Invalid data type");if(t>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");r=0|r,0>=r&&(r=1),this.gl.bufferData(this.type,0|r,this.usage),this.length=r}},t.exports=a},{ndarray:12,"ndarray-ops":7,"typedarray-pool":17}],7:[function(r,t,n){"use strict";function e(r){if(!r)return a;for(var t=0;t>",rrshift:">>>"};!function(){for(var r in u){var t=u[r];n[r]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:r}),n[r+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+t+"=b"},rvalue:!0,funcName:r+"eq"}),n[r+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:r+"s"}),n[r+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+t+"=s"},rvalue:!0,funcName:r+"seq"})}}();var h={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var r in h){var t=h[r];n[r]=o({args:["array","array"],body:{args:["a","b"],body:"a="+t+"b"},funcName:r}),n[r+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+t+"a"},rvalue:!0,count:2,funcName:r+"eq"})}}();var f={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var r in f){var t=f[r];n[r]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+t+"c"},funcName:r}),n[r+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+t+"s"},funcName:r+"s"}),n[r+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+t+"b"},rvalue:!0,count:2,funcName:r+"eq"}),n[r+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+t+"s"},rvalue:!0,count:2,funcName:r+"seq"})}}();var l=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var r=0;rthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),n.norm1=s({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),n.sup=s({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),n.inf=s({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),n.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),n.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),n.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),n.equals=s({args:["array","array"],pre:a,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":8}],8:[function(r,t,n){"use strict";function e(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(r){var t=new e;t.pre=r.pre,t.body=r.body,t.post=r.post;var n=r.args.slice(0);t.argTypes=n;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===s)t.scalarArgs.push(i),t.shimArgs.push("scalar"+i);else if("index"===s){if(t.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===s){if(t.shapeArgs.push(i),in.length)throw new Error("cwise: Too many arguments in pre() block");if(t.body.args.length>n.length)throw new Error("cwise: Too many arguments in body() block");if(t.post.args.length>n.length)throw new Error("cwise: Too many arguments in post() block");return t.debug=!!r.printCode||!!r.debug,t.funcName=r.funcName||"cwise",t.blockSize=r.blockSize||64,o(t)}var o=r("./lib/thunk.js");t.exports=i},{"./lib/thunk.js":10}],9:[function(r,t,n){"use strict";function e(r,t,n){var e,i,o=r.length,s=t.arrayArgs.length,a=t.indexArgs.length>0,u=[],h=[],f=0,l=0;for(e=0;o>e;++e)h.push(["i",e,"=0"].join(""));for(i=0;s>i;++i)for(e=0;o>e;++e)l=f,f=r[e],0===e?h.push(["d",i,"s",e,"=t",i,"p",f].join("")):h.push(["d",i,"s",e,"=(t",i,"p",f,"-s",l,"*t",i,"p",l,")"].join(""));for(u.push("var "+h.join(",")),e=o-1;e>=0;--e)f=r[e],u.push(["for(i",e,"=0;i",e,"e;++e){for(l=f,f=r[e],i=0;s>i;++i)u.push(["p",i,"+=d",i,"s",e].join(""));a&&(e>0&&u.push(["index[",l,"]-=s",l].join("")),u.push(["++index[",f,"]"].join(""))),u.push("}")}return u.join("\n")}function i(r,t,n,i){for(var o=t.length,s=n.arrayArgs.length,a=n.blockSize,u=n.indexArgs.length>0,h=[],f=0;s>f;++f)h.push(["var offset",f,"=p",f].join(""));for(var f=r;o>f;++f)h.push(["for(var j"+f+"=SS[",t[f],"]|0;j",f,">0;){"].join("")),h.push(["if(j",f,"<",a,"){"].join("")),h.push(["s",t[f],"=j",f].join("")),h.push(["j",f,"=0"].join("")),h.push(["}else{s",t[f],"=",a].join("")),h.push(["j",f,"-=",a,"}"].join("")),u&&h.push(["index[",t[f],"]=j",f].join(""));for(var f=0;s>f;++f){for(var l=["offset"+f],c=r;o>c;++c)l.push(["j",c,"*t",f,"p",t[c]].join(""));h.push(["p",f,"=(",l.join("+"),")"].join(""))}h.push(e(t,n,i));for(var f=r;o>f;++f)h.push("}");return h.join("\n")}function o(r){for(var t=0,n=r[0].length;n>t;){for(var e=1;e0&&(n=n&&t[e]===t[e-1])}return n?t[0]:t.join("")}function u(r,t){for(var n=t[1].length-Math.abs(r.arrayBlockIndices[0])|0,u=new Array(r.arrayArgs.length),f=new Array(r.arrayArgs.length),l=0;lm;++m)_.push(["s",m,"=SS[",m,"]"].join(""));for(var l=0;lm;++m)_.push(["t",l,"p",m,"=t",l,"[",g[l]+m,"]"].join(""));for(var m=0;m0&&_.push("shape=SS.slice(0)"),r.indexArgs.length>0){for(var A=new Array(n),l=0;n>l;++l)A[l]="0";_.push(["index=[",A.join(","),"]"].join(""))}for(var l=0;l3&&w.push(s(r.pre,r,f));var k=s(r.body,r,f),I=o(d);n>I?w.push(i(I,d[0],r,k)):w.push(e(d[0],r,k)),r.post.body.length>3&&w.push(s(r.post,r,f)),r.debug&&console.log("-----Generated cwise routine for ",t,":\n"+w.join("\n")+"\n----------");var M=[r.funcName||"unnamed","_cwise_loop_",u[0].join("s"),"m",I,a(f)].join(""),P=new Function(["function ",M,"(",b.join(","),"){",w.join("\n"),"} return ",M].join(""));return P()}var h=r("uniq");t.exports=u},{uniq:11}],10:[function(r,t,n){"use strict";function e(r){var t=["'use strict'","var CACHED={}"],n=[],e=r.funcName+"_cwise_thunk";t.push(["return function ",e,"(",r.shimArgs.join(","),"){"].join(""));for(var o=[],s=[],a=[["array",r.arrayArgs[0],".shape.slice(",Math.max(0,r.arrayBlockIndices[0]),r.arrayBlockIndices[0]<0?","+r.arrayBlockIndices[0]+")":")"].join("")],u=[],h=[],f=0;f0&&(u.push("array"+r.arrayArgs[0]+".shape.length===array"+l+".shape.length+"+(Math.abs(r.arrayBlockIndices[0])-Math.abs(r.arrayBlockIndices[f]))),h.push("array"+r.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,r.arrayBlockIndices[0])+"]===array"+l+".shape[shapeIndex+"+Math.max(0,r.arrayBlockIndices[f])+"]"))}r.arrayArgs.length>1&&(t.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),t.push("for(var shapeIndex=array"+r.arrayArgs[0]+".shape.length-"+Math.abs(r.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),t.push("if (!("+h.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),t.push("}"));for(var f=0;fs;++s)if(o=i,i=r[s],t(i,o)){if(s===n){n++;continue}r[n++]=i}return r.length=n,r}function i(r){for(var t=1,n=r.length,e=r[0],i=r[0],o=1;n>o;++o,i=e)if(i=e,e=r[o],e!==i){if(o===t){t++;continue}r[t++]=e}return r.length=t,r}function o(r,t,n){return 0===r.length?r:t?(n||r.sort(t),e(r,t)):(n||r.sort(),i(r))}t.exports=o},{}],12:[function(r,t,n){function e(r,t){return r[0]-t[0]}function i(){var r,t=this.stride,n=new Array(t.length);for(r=0;rt&&(n="View_Nil"+r);var e="generic"===r;if(-1===t){var o="function "+n+"(a){this.data=a;};var proto="+n+".prototype;proto.dtype='"+r+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+n+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+n+"(a){return new "+n+"(a);}",s=new Function(o);return s()}if(0===t){var o="function "+n+"(a,d) {this.data = a;this.offset = d};var proto="+n+".prototype;proto.dtype='"+r+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+n+"_copy() {return new "+n+"(this.data,this.offset)};proto.pick=function "+n+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+n+"_get(){return "+(e?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+n+"_set(v){return "+(e?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+n+"(a,b,c,d){return new "+n+"(a,d)}",s=new Function("TrivialArray",o);return s(l[r][0])}var o=["'use strict'"],a=u(t),h=a.map(function(r){return"i"+r}),f="this.offset+"+a.map(function(r){return"this.stride["+r+"]*i"+r}).join("+"),c=a.map(function(r){return"b"+r}).join(","),p=a.map(function(r){return"c"+r}).join(",");o.push("function "+n+"(a,"+c+","+p+",d){this.data=a","this.shape=["+c+"]","this.stride=["+p+"]","this.offset=d|0}","var proto="+n+".prototype","proto.dtype='"+r+"'","proto.dimension="+t),o.push("Object.defineProperty(proto,'size',{get:function "+n+"_size(){return "+a.map(function(r){return"this.shape["+r+"]"}).join("*"),"}})"),1===t?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>t?(o.push("function "+n+"_order(){"),2===t?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===t&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+n+"_set("+h.join(",")+",v){"),e?o.push("return this.data.set("+f+",v)}"):o.push("return this.data["+f+"]=v}"),o.push("proto.get=function "+n+"_get("+h.join(",")+"){"),e?o.push("return this.data.get("+f+")}"):o.push("return this.data["+f+"]}"),o.push("proto.index=function "+n+"_index(",h.join(),"){return "+f+"}"),o.push("proto.hi=function "+n+"_hi("+h.join(",")+"){return new "+n+"(this.data,"+a.map(function(r){return["(typeof i",r,"!=='number'||i",r,"<0)?this.shape[",r,"]:i",r,"|0"].join("")}).join(",")+","+a.map(function(r){return"this.stride["+r+"]"}).join(",")+",this.offset)}");var g=a.map(function(r){return"a"+r+"=this.shape["+r+"]"}),v=a.map(function(r){return"c"+r+"=this.stride["+r+"]"});o.push("proto.lo=function "+n+"_lo("+h.join(",")+"){var b=this.offset,d=0,"+g.join(",")+","+v.join(","));for(var d=0;t>d;++d)o.push("if(typeof i"+d+"==='number'&&i"+d+">=0){d=i"+d+"|0;b+=c"+d+"*d;a"+d+"-=d}");o.push("return new "+n+"(this.data,"+a.map(function(r){return"a"+r}).join(",")+","+a.map(function(r){return"c"+r}).join(",")+",b)}"),o.push("proto.step=function "+n+"_step("+h.join(",")+"){var "+a.map(function(r){return"a"+r+"=this.shape["+r+"]"}).join(",")+","+a.map(function(r){return"b"+r+"=this.stride["+r+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var d=0;t>d;++d)o.push("if(typeof i"+d+"==='number'){d=i"+d+"|0;if(d<0){c+=b"+d+"*(a"+d+"-1);a"+d+"=ceil(-a"+d+"/d)}else{a"+d+"=ceil(a"+d+"/d)}b"+d+"*=d}");o.push("return new "+n+"(this.data,"+a.map(function(r){return"a"+r}).join(",")+","+a.map(function(r){return"b"+r}).join(",")+",c)}");for(var y=new Array(t),m=new Array(t),d=0;t>d;++d)y[d]="a[i"+d+"]",m[d]="b[i"+d+"]";o.push("proto.transpose=function "+n+"_transpose("+h+"){"+h.map(function(r,t){return r+"=("+r+"===undefined?"+t+":"+r+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+n+"(this.data,"+y.join(",")+","+m.join(",")+",this.offset)}"),o.push("proto.pick=function "+n+"_pick("+h+"){var a=[],b=[],c=this.offset");for(var d=0;t>d;++d)o.push("if(typeof i"+d+"==='number'&&i"+d+">=0){c=(c+this.stride["+d+"]*i"+d+")|0}else{a.push(this.shape["+d+"]);b.push(this.stride["+d+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+n+"(data,shape,stride,offset){return new "+n+"(data,"+a.map(function(r){return"shape["+r+"]"}).join(",")+","+a.map(function(r){return"stride["+r+"]"}).join(",")+",offset)}");var s=new Function("CTOR_LIST","ORDER",o.join("\n"));return s(l[r],i)}function s(r){if(h(r))return"buffer";if(f)switch(Object.prototype.toString.call(r)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(r)?"array":"generic"}function a(r,t,n,e){if(void 0===r){var i=l.array[0];return i([])}"number"==typeof r&&(r=[r]),void 0===t&&(t=[r.length]);var a=t.length;if(void 0===n){n=new Array(a);for(var u=a-1,h=1;u>=0;--u)n[u]=h,h*=t[u]}if(void 0===e){e=0;for(var u=0;a>u;++u)n[u]<0&&(e-=(t[u]-1)*n[u])}for(var f=s(r),c=l[f];c.length<=a+1;)c.push(o(f,c.length-1));var i=c[a+1];return i(r,t,n,e)}var u=r("iota-array"),h=r("is-buffer"),f="undefined"!=typeof Float64Array,l={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};t.exports=a},{"iota-array":13,"is-buffer":14}],13:[function(r,t,n){"use strict";function e(r){for(var t=new Array(r),n=0;r>n;++n)t[n]=n;return t}t.exports=e},{}],14:[function(r,t,n){t.exports=function(r){return!(null==r||!(r._isBuffer||r.constructor&&"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r)))}},{}],15:[function(r,t,n){"use strict";"use restrict";function e(r){var t=32;return r&=-r,r&&t--,65535&r&&(t-=16),16711935&r&&(t-=8),252645135&r&&(t-=4),858993459&r&&(t-=2),1431655765&r&&(t-=1),t}var i=32;n.INT_BITS=i,n.INT_MAX=2147483647,n.INT_MIN=-1<0)-(0>r)},n.abs=function(r){var t=r>>i-1;return(r^t)-t},n.min=function(r,t){return t^(r^t)&-(t>r)},n.max=function(r,t){return r^(r^t)&-(t>r)},n.isPow2=function(r){return!(r&r-1||!r)},n.log2=function(r){var t,n;return t=(r>65535)<<4,r>>>=t,n=(r>255)<<3,r>>>=n,t|=n,n=(r>15)<<2,r>>>=n,t|=n,n=(r>3)<<1,r>>>=n,t|=n,t|r>>1},n.log10=function(r){return r>=1e9?9:r>=1e8?8:r>=1e7?7:r>=1e6?6:r>=1e5?5:r>=1e4?4:r>=1e3?3:r>=100?2:r>=10?1:0},n.popCount=function(r){return r-=r>>>1&1431655765,r=(858993459&r)+(r>>>2&858993459),16843009*(r+(r>>>4)&252645135)>>>24},n.countTrailingZeros=e,n.nextPow2=function(r){return r+=0===r,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1},n.prevPow2=function(r){return r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r-(r>>>1)},n.parity=function(r){return r^=r>>>16,r^=r>>>8,r^=r>>>4,r&=15,27030>>>r&1};var o=new Array(256);!function(r){for(var t=0;256>t;++t){var n=t,e=t,i=7;for(n>>>=1;n;n>>>=1)e<<=1,e|=1&n,--i;r[t]=e<>>8&255]<<16|o[r>>>16&255]<<8|o[r>>>24&255]},n.interleave2=function(r,t){return r&=65535,r=16711935&(r|r<<8),r=252645135&(r|r<<4),r=858993459&(r|r<<2),r=1431655765&(r|r<<1),t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),r|t<<1},n.deinterleave2=function(r,t){return r=r>>>t&1431655765,r=858993459&(r|r>>>1),r=252645135&(r|r>>>2),r=16711935&(r|r>>>4),r=65535&(r|r>>>16),r<<16>>16},n.interleave3=function(r,t,n){return r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),r|=t<<1,n&=1023,n=4278190335&(n|n<<16),n=251719695&(n|n<<8),n=3272356035&(n|n<<4),n=1227133513&(n|n<<2),r|n<<2},n.deinterleave3=function(r,t){return r=r>>>t&1227133513,r=3272356035&(r|r>>>2),r=251719695&(r|r>>>4),r=4278190335&(r|r>>>8),r=1023&(r|r>>>16),r<<22>>22},n.nextCombination=function(r){var t=r|r-1;return t+1|(~t&-~t)-1>>>e(r)+1}},{}],16:[function(r,t,n){"use strict";function e(r,t,n){var i=0|r[n];if(0>=i)return[];var o,s=new Array(i);if(n===r.length-1)for(o=0;i>o;++o)s[o]=t;else for(o=0;i>o;++o)s[o]=e(r,t,n+1);return s}function i(r,t){var n,e;for(n=new Array(r),e=0;r>e;++e)n[e]=t;return n}function o(r,t){switch("undefined"==typeof t&&(t=0),typeof r){case"number":if(r>0)return i(0|r,t);break;case"object":if("number"==typeof r.length)return e(r,t,0)}return[]}t.exports=o},{}],17:[function(r,t,n){(function(t,e){"use strict";function i(r){if(r){var t=r.length||r.byteLength,n=m.log2(t);A[n].push(r)}}function o(r){i(r.buffer)}function s(r){var r=m.nextPow2(r),t=m.log2(r),n=A[t];return n.length>0?n.pop():new ArrayBuffer(r)}function a(r){return new Uint8Array(s(r),0,r)}function u(r){return new Uint16Array(s(2*r),0,r)}function h(r){return new Uint32Array(s(4*r),0,r)}function f(r){return new Int8Array(s(r),0,r)}function l(r){return new Int16Array(s(2*r),0,r)}function c(r){return new Int32Array(s(4*r),0,r)}function p(r){return new Float32Array(s(4*r),0,r)}function g(r){return new Float64Array(s(8*r),0,r)}function v(r){return w?new Uint8ClampedArray(s(r),0,r):a(r)}function d(r){return new DataView(s(r),0,r)}function y(r){r=m.nextPow2(r);var t=m.log2(r),n=x[t];return n.length>0?n.pop():new e(r)}var m=r("bit-twiddle"),b=r("dup");t.__TYPEDARRAY_POOL||(t.__TYPEDARRAY_POOL={UINT8:b([32,0]),UINT16:b([32,0]),UINT32:b([32,0]),INT8:b([32,0]),INT16:b([32,0]),INT32:b([32,0]),FLOAT:b([32,0]),DOUBLE:b([32,0]),DATA:b([32,0]),UINT8C:b([32,0]),BUFFER:b([32,0])});var w="undefined"!=typeof Uint8ClampedArray,_=t.__TYPEDARRAY_POOL;_.UINT8C||(_.UINT8C=b([32,0])),_.BUFFER||(_.BUFFER=b([32,0]));var A=_.DATA,x=_.BUFFER;n.free=function(r){if(e.isBuffer(r))x[m.log2(r.length)].push(r);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(r)&&(r=r.buffer),!r)return;var t=r.length||r.byteLength,n=0|m.log2(t);A[n].push(r)}},n.freeUint8=n.freeUint16=n.freeUint32=n.freeInt8=n.freeInt16=n.freeInt32=n.freeFloat32=n.freeFloat=n.freeFloat64=n.freeDouble=n.freeUint8Clamped=n.freeDataView=o,n.freeArrayBuffer=i,n.freeBuffer=function(r){x[m.log2(r.length)].push(r)},n.malloc=function(r,t){if(void 0===t||"arraybuffer"===t)return s(r);switch(t){case"uint8":return a(r);case"uint16":return u(r);case"uint32":return h(r);case"int8":return f(r);case"int16":return l(r);case"int32":return c(r);case"float":case"float32":return p(r);case"double":case"float64":return g(r);case"uint8_clamped":return v(r);case"buffer":return y(r);case"data":case"dataview":return d(r);default:return null}return null},n.mallocArrayBuffer=s,n.mallocUint8=a,n.mallocUint16=u,n.mallocUint32=h,n.mallocInt8=f,n.mallocInt16=l,n.mallocInt32=c,n.mallocFloat32=n.mallocFloat=p,n.mallocFloat64=n.mallocDouble=g,n.mallocUint8Clamped=v,n.mallocDataView=d,n.mallocBuffer=y,n.clearCache=function(){for(var r=0;32>r;++r)_.UINT8[r].length=0,_.UINT16[r].length=0,_.UINT32[r].length=0,_.INT8[r].length=0,_.INT16[r].length=0,_.INT32[r].length=0,_.FLOAT[r].length=0,_.DOUBLE[r].length=0,_.UINT8C[r].length=0,A[r].length=0,x[r].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r("buffer").Buffer)},{"bit-twiddle":15,buffer:2,dup:16}],18:[function(r,t,n){function e(r,t){return r===!1?!1:"undefined"==typeof r?t:r+0}function i(r,t){return r===!1?!1:Array.isArray(r)?r||t:t}n.color=function(r){return i(r,[0,0,0,1])},n.depth=function(r){return e(r,1)},n.stencil=function(r){return e(r,!1)}},{}],19:[function(r,t,n){function e(r){function t(r){var t=0;return n!==!1&&(r.clearColor(n[0],n[1],n[2],n[3]),t|=r.COLOR_BUFFER_BIT),e!==!1&&(r.clearDepth(e),t|=r.DEPTH_BUFFER_BIT),o!==!1&&(r.clearStencil(o),t|=r.STENCIL_BUFFER_BIT),r.clear(t),r}r=r||{};var n=i.color(r.color);Object.defineProperty(t,"color",{get:function(){return n},set:function(r){return n=i.color(r)}});var e=i.depth(r.depth);Object.defineProperty(t,"depth",{get:function(){return e},set:function(r){return e=i.depth(r)}});var o=i.stencil(r.stencil);return Object.defineProperty(t,"stencil",{get:function(){return o},set:function(r){return o=i.stencil(r)}}),t}var i=r("./defaults");t.exports=e},{"./defaults":18}],20:[function(r,t,n){function e(r,t,n){function e(){n(o),i(e)}"function"==typeof t?(n=t,t={}):t=t||{};var o=r.getContext("webgl",t)||r.getContext("webgl-experimental",t)||r.getContext("experimental-webgl",t);if(!o)throw new Error("Unable to initialize WebGL");return n&&i(e),o}var i=r("raf-component");t.exports=e},{"raf-component":21}],21:[function(r,t,n){function e(r){var t=(new Date).getTime(),n=Math.max(0,16-(t-i)),e=setTimeout(r,n);return i=t,e}n=t.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||e;var i=(new Date).getTime(),o=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout;n.cancel=function(r){o.call(window,r)}},{}],22:[function(r,t,n){function e(){var r=new Float32Array(16);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}t.exports=e},{}],23:[function(r,t,n){function e(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}t.exports=e},{}],24:[function(r,t,n){function e(r,t,n,e,i,o,s){var a=1/(t-n),u=1/(e-i),h=1/(o-s);return r[0]=-2*a,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*h,r[11]=0,r[12]=(t+n)*a,r[13]=(i+e)*u,r[14]=(s+o)*h,r[15]=1,r}t.exports=e},{}],25:[function(r,t,n){function e(r,t,n){var e=n[0],i=n[1],o=n[2];return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*o,r[9]=t[9]*o,r[10]=t[10]*o,r[11]=t[11]*o,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}t.exports=e},{}],26:[function(r,t,n){function e(r,t,n){var e,i,o,s,a,u,h,f,l,c,p,g,v=n[0],d=n[1],y=n[2];return t===r?(r[12]=t[0]*v+t[4]*d+t[8]*y+t[12],r[13]=t[1]*v+t[5]*d+t[9]*y+t[13],r[14]=t[2]*v+t[6]*d+t[10]*y+t[14],r[15]=t[3]*v+t[7]*d+t[11]*y+t[15]):(e=t[0],i=t[1],o=t[2],s=t[3],a=t[4],u=t[5],h=t[6],f=t[7],l=t[8],c=t[9],p=t[10],g=t[11],r[0]=e,r[1]=i,r[2]=o,r[3]=s,r[4]=a,r[5]=u,r[6]=h,r[7]=f,r[8]=l,r[9]=c,r[10]=p,r[11]=g,r[12]=e*v+a*d+l*y+t[12],r[13]=i*v+u*d+c*y+t[13],r[14]=o*v+h*d+p*y+t[14],r[15]=s*v+f*d+g*y+t[15]),r}t.exports=e},{}],27:[function(r,t,n){function e(r,t,n,e){return function(o){return i(o,r,t,n,e)}}t.exports=e;var i=r("gl-shader-core")},{"gl-shader-core":33}],28:[function(r,t,n){function e(){throw new Error("You should bundle your code using `glslify` as a transform.")}t.exports=e},{}],29:[function(r,t,n){"use strict";function e(r,t,n,e,i,o,s){this._gl=r,this._program=t,this._location=n,this._dimension=e,this._name=i,this._constFunc=o,this._relink=s}function i(r,t,n,i,o,s,a){for(var u=["gl","v"],h=[],f=0;i>f;++f)u.push("x"+f),h.push("x"+f);u.push(["if(x0.length===void 0){return gl.vertexAttrib",i,"f(v,",h.join(),")}else{return gl.vertexAttrib",i,"fv(v,x0)}"].join(""));var l=Function.apply(void 0,u),c=new e(r,t,n,i,s,l,a);Object.defineProperty(o,s,{set:function(t){return r.disableVertexAttribArray(c._location),l(r,c._location,t),t},get:function(){return c},enumerable:!0})}function o(r,t,n,e){for(var o={},s=0,a=n.length;a>s;++s){var u=n[s],h=u.name,f=u.type,l=r.getAttribLocation(t,h);switch(f){case"bool":case"int":case"float":i(r,t,l,1,o,h,e);break;default:if(!(f.indexOf("vec")>=0))throw new Error("gl-shader: Unknown data type for attribute "+h+": "+f);var c=f.charCodeAt(f.length-1)-48;if(2>c||c>4)throw new Error("gl-shader: Invalid data type for attribute "+h+": "+f);i(r,t,l,c,o,h,e)}}return o}t.exports=o;var s=e.prototype;s.pointer=function(r,t,n,e){var i=this._gl;i.vertexAttribPointer(this._location,this._dimension,r||i.FLOAT,!!t,n||0,e||0),this._gl.enableVertexAttribArray(this._location)},Object.defineProperty(s,"location",{get:function(){return this._location},set:function(r){r!==this._location&&(this._location=r,this._gl.bindAttribLocation(this._program,r,this._name),this._gl.linkProgram(this._program),this._relink())}})},{}],30:[function(r,t,n){"use strict";function e(r){var t=new Function("y","return function(){return y}");return t(r)}function i(r,t,n,i){function a(n){var e=new Function("gl","prog","locations","return function(){return gl.getUniform(prog,locations["+n+"])}");return e(r,t,i)}function u(r,t,n){switch(n){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+t+"],obj"+r+")";case"float":return"gl.uniform1f(locations["+t+"],obj"+r+")";default:var e=n.indexOf("vec");if(!(e>=0&&1>=e&&n.length===4+e)){if(0===n.indexOf("mat")&&4===n.length){var i=n.charCodeAt(n.length-1)-48;if(2>i||i>4)throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+n);return"gl.uniformMatrix"+i+"fv(locations["+t+"],false,obj"+r+")"}throw new Error("gl-shader: Unknown uniform data type for "+name+": "+n)}var i=n.charCodeAt(n.length-1)-48;if(2>i||i>4)throw new Error("gl-shader: Invalid data type");switch(n.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+t+"],obj"+r+")";case"v":return"gl.uniform"+i+"fv(locations["+t+"],obj"+r+")";default:throw new Error("gl-shader: Unrecognized data type for vector "+name+": "+n); }}}function h(r,t){if("object"!=typeof t)return[[r,t]];var n=[];for(var e in t){var i=t[e],o=r;o+=parseInt(e)+""===e?"["+e+"]":"."+e,"object"==typeof i?n.push.apply(n,h(o,i)):n.push([o,i])}return n}function f(e){for(var o=["return function updateProperty(obj){"],s=h("",e),a=0;a=0&&1>=t&&r.length===4+t){var n=r.charCodeAt(r.length-1)-48;if(2>n||n>4)throw new Error("gl-shader: Invalid data type");return"b"===r.charAt(0)?o(n,!1):o(n)}if(0===r.indexOf("mat")&&4===r.length){var n=r.charCodeAt(r.length-1)-48;if(2>n||n>4)throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+r);return o([n,n])}throw new Error("gl-shader: Unknown uniform data type for "+name+": "+r)}}function c(r,t,o){if("object"==typeof o){var s=p(o);Object.defineProperty(r,t,{get:e(s),set:f(o),enumerable:!0,configurable:!1})}else i[o]?Object.defineProperty(r,t,{get:a(o),set:f(o),enumerable:!0,configurable:!1}):r[t]=l(n[o].type)}function p(r){var t;if(Array.isArray(r)){t=new Array(r.length);for(var n=0;n1){u[0]in s||(s[u[0]]=[]),s=s[u[0]];for(var h=1;hu;++u)for(var h=r[u],f=0;2>f;++f)o[f]=0|Math.min(o[f],h[f]),s[f]=0|Math.max(s[f],h[f]);var l=0;switch(e){case"center":l=-.5*(o[0]+s[0]);break;case"right":case"end":l=-s[0];break;case"left":case"start":l=-o[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+e+"'")}var c=0;switch(i){case"hanging":case"top":c=-o[1];break;case"middle":c=-.5*(o[1]+s[1]);break;case"alphabetic":case"ideographic":c=-3*n;break;case"bottom":c=-s[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var p=1/n;return"lineHeight"in t?p*=+t.lineHeight:"width"in t?p=t.width/(s[0]-o[0]):"height"in t&&(p=t.height/(s[1]-o[1])),r.map(function(r){return[p*(r[0]+l),p*(r[1]+c)]})}function i(r,t,n,e){var i=0|Math.ceil(t.measureText(n).width+2*e);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*e;r.heighta)){if(e>i){var u=e;e=i,i=u,u=s,s=a,a=u}t.isConstraint(e,i)||o(r[e],r[i],r[s],r[a])<0&&n.push(e,i)}}function i(r,t){for(var n=[],i=r.length,s=t.stars,a=0;i>a;++a)for(var u=s[a],h=1;hf||t.isConstraint(a,f))){for(var l=u[h-1],c=-1,p=1;pc||o(r[a],r[f],r[l],r[c])<0&&n.push(a,f)}}for(;n.length>0;){for(var f=n.pop(),a=n.pop(),l=-1,c=-1,u=s[a],g=1;gl||0>c||o(r[a],r[f],r[l],r[c])>=0||(t.flip(a,f),e(r,t,n,l,a,c),e(r,t,n,a,c,l),e(r,t,n,c,f,l),e(r,t,n,f,l,c))}}var o=r("robust-in-sphere")[4];r("binary-search-bounds");t.exports=i},{"binary-search-bounds":41,"robust-in-sphere":42}],38:[function(r,t,n){"use strict";function e(r,t,n,e,i,o,s){this.cells=r,this.neighbor=t,this.flags=e,this.constraint=n,this.active=i,this.next=o,this.boundary=s}function i(r,t){return r[0]-t[0]||r[1]-t[1]||r[2]-t[2]}function o(r,t){for(var n=r.cells(),o=n.length,s=0;o>s;++s){var a=n[s],u=a[0],h=a[1],f=a[2];f>h?u>h&&(a[0]=h,a[1]=f,a[2]=u):u>f&&(a[0]=f,a[1]=u,a[2]=h)}n.sort(i);for(var l=new Array(o),s=0;ss;++s)for(var a=n[s],m=0;3>m;++m){var u=a[m],h=a[(m+1)%3],b=g[3*s+m]=y.locate(h,u,r.opposite(h,u)),w=v[3*s+m]=r.isConstraint(u,h);0>b&&(w?p.push(s):(c.push(s),l[s]=1),t&&d.push([h,u,-1]))}return y}function s(r,t,n){for(var e=0,i=0;i0||u.length>0;){for(;a.length>0;){var p=a.pop();if(h[p]!==-i){h[p]=i;for(var g=(f[p],0);3>g;++g){var v=c[3*p+g];v>=0&&0===h[v]&&(l[3*p+g]?u.push(v):(a.push(v),h[v]=i))}}}var d=u;u=a,a=d,u.length=0,i=-i}var y=s(f,h,t);return n?y.concat(e.boundary):y}var u=r("binary-search-bounds");t.exports=a;var h=e.prototype;h.locate=function(){var r=[0,0,0];return function(t,n,e){var o=t,s=n,a=e;return e>n?t>n&&(o=n,s=e,a=t):t>e&&(o=e,s=t,a=n),0>o?-1:(r[0]=o,r[1]=s,r[2]=a,u.eq(this.cells,r,i))}}()},{"binary-search-bounds":41}],39:[function(r,t,n){"use strict";function e(r,t,n,e,i){this.a=r,this.b=t,this.idx=n,this.lowerIds=e,this.upperIds=i}function i(r,t,n,e){this.a=r,this.b=t,this.type=n,this.idx=e}function o(r,t){var n=r.a[0]-t.a[0]||r.a[1]-t.a[1]||r.type-t.type;return n?n:r.type!==g&&(n=p(r.a,r.b,t.b))?n:r.idx-t.idx}function s(r,t){return p(r.a,r.b,t)}function a(r,t,n,e,i){for(var o=c.lt(t,e,s),a=c.gt(t,e,s),u=o;a>u;++u){for(var h=t[u],f=h.lowerIds,l=f.length;l>1&&p(n[f[l-2]],n[f[l-1]],e)>0;)r.push([f[l-1],f[l-2],i]),l-=1;f.length=l,f.push(i);for(var g=h.upperIds,l=g.length;l>1&&p(n[g[l-2]],n[g[l-1]],e)<0;)r.push([g[l-2],g[l-1],i]),l-=1;g.length=l,g.push(i)}}function u(r,t){var n;return(n=r.a[0]l;++l)u.push(new i(r[l],null,g,l));for(var l=0;s>l;++l){var c=t[l],p=r[c[0]],y=r[c[1]];p[0]y[0]&&u.push(new i(y,p,d,l),new i(p,y,v,l))}u.sort(o);for(var m=u[0].a[0]-(1+Math.abs(u[0].a[0]))*Math.pow(2,-52),b=[new e([m,1],[m,0],-1,[],[],[],[])],w=[],l=0,_=u.length;_>l;++l){var A=u[l],x=A.type;x===g?a(w,b,r,A.a,A.idx):x===d?h(b,r,A):f(b,r,A)}return w}var c=r("binary-search-bounds"),p=r("robust-orientation")[3],g=0,v=1,d=2;t.exports=l},{"binary-search-bounds":41,"robust-orientation":53}],40:[function(r,t,n){"use strict";function e(r,t){this.stars=r,this.edges=t}function i(r,t,n){for(var e=1,i=r.length;i>e;e+=2)if(r[e-1]===t&&r[e]===n)return r[e-1]=r[i-2],r[e]=r[i-1],void(r.length=i-2)}function o(r,t){for(var n=new Array(r),i=0;r>i;++i)n[i]=[];return new e(n,t)}var s=r("binary-search-bounds");t.exports=o;var a=e.prototype;a.isConstraint=function(){function r(r,t){return r[0]-t[0]||r[1]-t[1]}var t=[0,0];return function(n,e){return t[0]=Math.min(n,e),t[1]=Math.max(n,e),s.eq(this.edges,t,r)>=0}}(),a.removeTriangle=function(r,t,n){var e=this.stars;i(e[r],t,n),i(e[t],n,r),i(e[n],r,t)},a.addTriangle=function(r,t,n){var e=this.stars;e[r].push(t,n),e[t].push(n,r),e[n].push(r,t)},a.opposite=function(r,t){for(var n=this.stars[t],e=1,i=n.length;i>e;e+=2)if(n[e]===r)return n[e-1];return-1},a.flip=function(r,t){var n=this.opposite(r,t),e=this.opposite(t,r);this.removeTriangle(r,t,n),this.removeTriangle(t,r,e),this.addTriangle(r,e,n),this.addTriangle(t,n,e)},a.edges=function(){for(var r=this.stars,t=[],n=0,e=r.length;e>n;++n)for(var i=r[n],o=0,s=i.length;s>o;o+=2)t.push([i[o],i[o+1]]);return t},a.cells=function(){for(var r=this.stars,t=[],n=0,e=r.length;e>n;++n)for(var i=r[n],o=0,s=i.length;s>o;o+=2){var a=i[o],u=i[o+1];n>>1,x=a[m]"];return i?t.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",t,"){i=m;"),n?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function i(r,t,n,i){var o=new Function([e("A","x"+r+"y",t,["y"],i),e("P","c(x,y)"+r+"0",t,["y","c"],i),"function dispatchBsearch",n,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",n].join(""));return o()}t.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],42:[function(r,t,n){"use strict";function e(r,t){for(var n=new Array(r.length-1),e=1;en;++n){t[n]=new Array(r);for(var e=0;r>e;++e)t[n][e]=["m",e,"[",r-n-2,"]"].join("")}return t}function o(r){if(1===r.length)return r[0];if(2===r.length)return["sum(",r[0],",",r[1],")"].join("");var t=r.length>>1;return["sum(",o(r.slice(0,t)),",",o(r.slice(t)),")"].join("")}function s(r,t){if("m"===r.charAt(0)){if("w"===t.charAt(0)){var n=r.split("[");return["w",t.substr(1),"m",n[0].substr(1)].join("")}return["prod(",r,",",t,")"].join("")}return s(t,r)}function a(r){return r&!0?"-":""}function u(r){if(2===r.length)return[["diff(",s(r[0][0],r[1][1]),",",s(r[1][0],r[0][1]),")"].join("")];for(var t=[],n=0;ne;++e)n.push(["prod(m",r,"[",e,"],m",r,"[",e,"])"].join(""));return o(n)}function f(r){for(var t=[],n=[],s=i(r),a=0;r>a;++a)s[0][a]="1",s[r-1][a]="w"+a;for(var a=0;r>a;++a)0===(1&a)?t.push.apply(t,u(e(s,a))):n.push.apply(n,u(e(s,a)));for(var f=o(t),l=o(n),c="exactInSphere"+r,p=[],a=0;r>a;++a)p.push("m"+a);for(var g=["function ",c,"(",p.join(),"){"],a=0;r>a;++a){g.push("var w",a,"=",h(a,r),";");for(var v=0;r>v;++v)v!==a&&g.push("var w",a,"m",v,"=scale(w",a,",m",v,"[0]);")}g.push("var p=",f,",n=",l,",d=diff(p,n);return d[d.length-1];}return ",c);var w=new Function("sum","diff","prod","scale",g.join(""));return w(y,m,d,b)}function l(){return 0}function c(){return 0}function p(){return 0}function g(r){var t=_[r.length];return t||(t=_[r.length]=f(r.length)),t.apply(void 0,r)}function v(){for(;_.length<=w;)_.push(f(_.length));for(var r=[],n=["slow"],e=0;w>=e;++e)r.push("a"+e),n.push("o"+e);for(var i=["function testInSphere(",r.join(),"){switch(arguments.length){case 0:case 1:return 0;"],e=2;w>=e;++e)i.push("case ",e,":return o",e,"(",r.slice(0,e).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=e;++e)t.exports[e]=_[e]}var d=r("two-product"),y=r("robust-sum"),m=r("robust-subtract"),b=r("robust-scale"),w=6,_=[l,c,p];v()},{"robust-scale":44,"robust-subtract":45,"robust-sum":46,"two-product":47}],43:[function(r,t,n){"use strict";function e(r,t,n){var e=r+t,i=e-r,o=e-i,s=t-i,a=r-o;return n?(n[0]=a+s,n[1]=e,n):[a+s,e]}t.exports=e},{}],44:[function(r,t,n){"use strict";function e(r,t){var n=r.length;if(1===n){var e=i(r[0],t);return e[0]?e:[e[1]]}var s=new Array(2*n),a=[.1,.1],u=[.1,.1],h=0;i(r[0],t,a),a[0]&&(s[h++]=a[0]);for(var f=1;n>f;++f){i(r[f],t,u);var l=a[1];o(l,u[0],a),a[0]&&(s[h++]=a[0]);var c=u[1],p=a[1],g=c+p,v=g-c,d=p-v;a[1]=g,d&&(s[h++]=d)}return a[1]&&(s[h++]=a[1]),0===h&&(s[h++]=0),s.length=h,s}var i=r("two-product"),o=r("two-sum");t.exports=e},{"two-product":47,"two-sum":43}],45:[function(r,t,n){"use strict";function e(r,t){var n=r+t,e=n-r,i=n-e,o=t-e,s=r-i,a=s+o;return a?[a,n]:[n]}function i(r,t){var n=0|r.length,i=0|t.length;if(1===n&&1===i)return e(r[0],-t[0]);var o,s,a=n+i,u=new Array(a),h=0,f=0,l=0,c=Math.abs,p=r[f],g=c(p),v=-t[l],d=c(v);d>g?(s=p,f+=1,n>f&&(p=r[f],g=c(p))):(s=v,l+=1,i>l&&(v=-t[l],d=c(v))),n>f&&d>g||l>=i?(o=p,f+=1,n>f&&(p=r[f],g=c(p))):(o=v,l+=1,i>l&&(v=-t[l],d=c(v)));for(var y,m,b,w,_,A=o+s,x=A-o,E=s-x,j=E,k=A;n>f&&i>l;)d>g?(o=p,f+=1,n>f&&(p=r[f],g=c(p))):(o=v,l+=1,i>l&&(v=-t[l],d=c(v))),s=j,A=o+s,x=A-o,E=s-x,E&&(u[h++]=E),y=k+A,m=y-k,b=y-m,w=A-m,_=k-b,j=_+w,k=y;for(;n>f;)o=p,s=j,A=o+s,x=A-o,E=s-x,E&&(u[h++]=E),y=k+A,m=y-k,b=y-m,w=A-m,_=k-b,j=_+w,k=y,f+=1,n>f&&(p=r[f]);for(;i>l;)o=v,s=j,A=o+s,x=A-o,E=s-x,E&&(u[h++]=E),y=k+A,m=y-k,b=y-m,w=A-m,_=k-b,j=_+w,k=y,l+=1,i>l&&(v=-t[l]);return j&&(u[h++]=j),k&&(u[h++]=k),h||(u[h++]=0),u.length=h,u}t.exports=i},{}],46:[function(r,t,n){"use strict";function e(r,t){var n=r+t,e=n-r,i=n-e,o=t-e,s=r-i,a=s+o;return a?[a,n]:[n]}function i(r,t){var n=0|r.length,i=0|t.length;if(1===n&&1===i)return e(r[0],t[0]);var o,s,a=n+i,u=new Array(a),h=0,f=0,l=0,c=Math.abs,p=r[f],g=c(p),v=t[l],d=c(v);d>g?(s=p,f+=1,n>f&&(p=r[f],g=c(p))):(s=v,l+=1,i>l&&(v=t[l],d=c(v))),n>f&&d>g||l>=i?(o=p,f+=1,n>f&&(p=r[f],g=c(p))):(o=v,l+=1,i>l&&(v=t[l],d=c(v)));for(var y,m,b,w,_,A=o+s,x=A-o,E=s-x,j=E,k=A;n>f&&i>l;)d>g?(o=p,f+=1,n>f&&(p=r[f],g=c(p))):(o=v,l+=1,i>l&&(v=t[l],d=c(v))),s=j,A=o+s,x=A-o,E=s-x,E&&(u[h++]=E),y=k+A,m=y-k,b=y-m,w=A-m,_=k-b,j=_+w,k=y;for(;n>f;)o=p,s=j,A=o+s,x=A-o,E=s-x,E&&(u[h++]=E),y=k+A,m=y-k,b=y-m,w=A-m,_=k-b,j=_+w,k=y,f+=1,n>f&&(p=r[f]);for(;i>l;)o=v,s=j,A=o+s,x=A-o,E=s-x,E&&(u[h++]=E),y=k+A,m=y-k,b=y-m,w=A-m,_=k-b,j=_+w,k=y,l+=1,i>l&&(v=t[l]);return j&&(u[h++]=j),k&&(u[h++]=k),h||(u[h++]=0),u.length=h,u}t.exports=i},{}],47:[function(r,t,n){"use strict";function e(r,t,n){var e=r*t,o=i*r,s=o-r,a=o-s,u=r-a,h=i*t,f=h-t,l=h-f,c=t-l,p=e-a*l,g=p-u*l,v=g-a*c,d=u*c-v;return n?(n[0]=d,n[1]=e,n):[d,e]}t.exports=e;var i=+(Math.pow(2,27)+1)},{}],48:[function(r,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43}],49:[function(r,t,n){arguments[4][44][0].apply(n,arguments)},{dup:44,"two-product":52,"two-sum":48}],50:[function(r,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],51:[function(r,t,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],52:[function(r,t,n){arguments[4][47][0].apply(n,arguments)},{dup:47}],53:[function(r,t,n){"use strict";function e(r,t){for(var n=new Array(r.length-1),e=1;en;++n){t[n]=new Array(r);for(var e=0;r>e;++e)t[n][e]=["m",e,"[",r-n-1,"]"].join("")}return t}function o(r){return 1&r?"-":""}function s(r){if(1===r.length)return r[0];if(2===r.length)return["sum(",r[0],",",r[1],")"].join("");var t=r.length>>1;return["sum(",s(r.slice(0,t)),",",s(r.slice(t)),")"].join("")}function a(r){if(2===r.length)return[["sum(prod(",r[0][0],",",r[1][1],"),prod(-",r[0][1],",",r[1][0],"))"].join("")];for(var t=[],n=0;nh;++h)0===(1&h)?t.push.apply(t,a(e(o,h))):n.push.apply(n,a(e(o,h))),u.push("m"+h);var f=s(t),v=s(n),d="orientation"+r+"Exact",y=["function ",d,"(",u.join(),"){var p=",f,",n=",v,",d=sub(p,n);return d[d.length-1];};return ",d].join(""),m=new Function("sum","prod","scale","sub",y);return m(c,l,p,g)}function h(r){var t=_[r.length];return t||(t=_[r.length]=u(r.length)),t.apply(void 0,r)}function f(){for(;_.length<=v;)_.push(u(_.length));for(var r=[],n=["slow"],e=0;v>=e;++e)r.push("a"+e),n.push("o"+e);for(var i=["function getOrientation(",r.join(),"){switch(arguments.length){case 0:case 1:return 0;"],e=2;v>=e;++e)i.push("case ",e,":return o",e,"(",r.slice(0,e).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i=e;++e)t.exports[e]=_[e]}var l=r("two-product"),c=r("robust-sum"),p=r("robust-scale"),g=r("robust-subtract"),v=5,d=1.1102230246251565e-16,y=(3+16*d)*d,m=(7+56*d)*d,b=u(3),w=u(4),_=[function(){return 0},function(){return 0},function(r,t){return t[0]-r[0]},function(r,t,n){var e,i=(r[1]-n[1])*(t[0]-n[0]),o=(r[0]-n[0])*(t[1]-n[1]),s=i-o;if(i>0){if(0>=o)return s;e=i+o}else{if(!(0>i))return s;if(o>=0)return s;e=-(i+o)}var a=y*e;return s>=a||-a>=s?s:b(r,t,n)},function(r,t,n,e){var i=r[0]-e[0],o=t[0]-e[0],s=n[0]-e[0],a=r[1]-e[1],u=t[1]-e[1],h=n[1]-e[1],f=r[2]-e[2],l=t[2]-e[2],c=n[2]-e[2],p=o*h,g=s*u,v=s*a,d=i*h,y=i*u,b=o*a,_=f*(p-g)+l*(v-d)+c*(y-b),A=(Math.abs(p)+Math.abs(g))*Math.abs(f)+(Math.abs(v)+Math.abs(d))*Math.abs(l)+(Math.abs(y)+Math.abs(b))*Math.abs(c),x=m*A;return _>x||-_>x?_:w(r,t,n,e)}];f()},{"robust-scale":49,"robust-subtract":50,"robust-sum":51,"two-product":52}],54:[function(r,t,n){"use strict";function e(r){var t=w(r),n=b(m(t),r);return 0>n?[t,A(t,1/0)]:n>0?[A(t,-(1/0)),t]:[t,t]}function i(r,t){for(var n=new Array(t.length),e=0;e=r.length)return s[t-r.length];var n=r[t];return[m(n[0]),m(n[1])]}for(var s=[],a=0;a=0;--a){var v=e[a],h=v[0],d=t[h],y=d[0],w=d[1],A=r[y],E=r[w];if((A[0]-E[0]||A[1]-E[1])<0){var j=y;y=w,w=j}d[0]=y;var k,I=d[1]=v[1];for(i&&(k=d[2]);a>0&&e[a-1][0]===h;){var v=e[--a],M=v[1];i?t.push([I,M,k]):t.push([I,M]),I=M}i?t.push([I,w,k]):t.push([I,w])}return s}function h(r,t,n){for(var i=r.length+t.length,o=new v(i),s=n,a=0;aa;++a){var g=o.find(a);g===a?(p[a]=l,r[l++]=r[a]):(c=!1,p[a]=-1)}if(r.length=l,c)return null;for(var a=0;i>a;++a)p[a]<0&&(p[a]=p[o.find(a)]);return p}function f(r,t){return r[0]-t[0]||r[1]-t[1]}function l(r,t){var n=r[0]-t[0]||r[1]-t[1];return n?n:r[2]t[2]?1:0}function c(r,t,n){if(0!==r.length){if(t)for(var e=0;e0||p.length>0}function g(r,t,n){var e,i=!1;if(n){e=t;for(var o=new Array(t.length),s=0;s0?n=n.shln(l):0>l&&(f=f.shln(-l)),u(n,f)}var i=r("./is-rat"),o=r("./lib/is-bn"),s=r("./lib/num-to-bn"),a=r("./lib/str-to-bn"),u=r("./lib/rationalize"),h=r("./div");t.exports=e},{"./div":58,"./is-rat":60,"./lib/is-bn":64,"./lib/num-to-bn":65,"./lib/rationalize":66,"./lib/str-to-bn":67}],60:[function(r,t,n){"use strict";function e(r){return Array.isArray(r)&&2===r.length&&i(r[0])&&i(r[1])}var i=r("./lib/is-bn");t.exports=e},{"./lib/is-bn":64}],61:[function(r,t,n){"use strict";function e(r){return r.cmp(new i(0))}var i=r("bn.js");t.exports=e},{"bn.js":70}],62:[function(r,t,n){"use strict";function e(r){var t=r.length,n=r.words,e=0;if(1===t)e=n[0];else if(2===t)e=n[0]+67108864*n[1];else for(var e=0,i=0;t>i;i++){var o=n[i];e+=o*Math.pow(67108864,i)}return r.sign?-e:e}t.exports=e},{}],63:[function(r,t,n){"use strict";function e(r){var t=o(i.lo(r));if(32>t)return t;var n=o(i.hi(r));return n>20?52:n+32}var i=r("double-bits"),o=r("bit-twiddle").countTrailingZeros;t.exports=e},{"bit-twiddle":69,"double-bits":71}],64:[function(r,t,n){"use strict";function e(r){return r&&"object"==typeof r&&Boolean(r.words)}r("bn.js");t.exports=e},{"bn.js":70}],65:[function(r,t,n){"use strict";function e(r){var t=o.exponent(r);return 52>t?new i(r):new i(r*Math.pow(2,52-t)).shln(t-52)}var i=r("bn.js"),o=r("double-bits");t.exports=e},{"bn.js":70,"double-bits":71}],66:[function(r,t,n){"use strict";function e(r,t){var n=o(r),e=o(t);if(0===n)return[i(0),i(1)];if(0===e)return[i(0),i(0)];0>e&&(r=r.neg(),t=t.neg());var s=r.gcd(t);return s.cmpn(1)?[r.div(s),t.div(s)]:[r,t]}var i=r("./num-to-bn"),o=r("./bn-sign");t.exports=e},{"./bn-sign":61,"./num-to-bn":65}],67:[function(r,t,n){"use strict";function e(r){return new i(r)}var i=r("bn.js");t.exports=e},{"bn.js":70}],68:[function(r,t,n){"use strict";function e(r,t){return i(r[0].mul(t[0]),r[1].mul(t[1]))}var i=r("./lib/rationalize");t.exports=e},{"./lib/rationalize":66}],69:[function(r,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],70:[function(r,t,n){!function(r,t){"use strict";function n(r,t){if(!r)throw new Error(t||"Assertion failed")}function e(r,t){r.super_=t;var n=function(){};n.prototype=t.prototype,r.prototype=new n,r.prototype.constructor=r}function i(r,t,n){return null!==r&&"object"==typeof r&&Array.isArray(r.words)?r:(this.sign=!1,this.words=null,this.length=0,this.red=null,("le"===t||"be"===t)&&(n=t,t=10),void(null!==r&&this._init(r||0,t||10,n||"be")))}function o(r,t,n){for(var e=0,i=Math.min(r.length,n),o=t;i>o;o++){var s=r.charCodeAt(o)-48;e<<=4,e|=s>=49&&54>=s?s-49+10:s>=17&&22>=s?s-17+10:15&s}return e}function s(r,t,n,e){for(var i=0,o=Math.min(r.length,n),s=t;o>s;s++){var a=r.charCodeAt(s)-48;i*=e,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}function a(r,t){this.name=r,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function u(){a.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function h(){a.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function f(){a.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function l(){a.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function c(r){if("string"==typeof r){var t=i._prime(r);this.m=t.p,this.prime=t}else this.m=r,this.prime=null}function p(r){c.call(this,r),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof r?r.exports=i:t.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(r,t,e){if("number"==typeof r)return this._initNumber(r,t,e);if("object"==typeof r)return this._initArray(r,t,e);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&36>=t),r=r.toString().replace(/\s+/g,"");var i=0;"-"===r[0]&&i++,16===t?this._parseHex(r,i):this._parseBase(r,t,i),"-"===r[0]&&(this.sign=!0),this.strip(),"le"===e&&this._initArray(this.toArray(),t,e)},i.prototype._initNumber=function(r,t,e){0>r&&(this.sign=!0,r=-r),67108864>r?(this.words=[67108863&r],this.length=1):4503599627370496>r?(this.words=[67108863&r,r/67108864&67108863],this.length=2):(n(9007199254740992>r),this.words=[67108863&r,r/67108864&67108863,1],this.length=3),"le"===e&&this._initArray(this.toArray(),t,e)},i.prototype._initArray=function(r,t,e){if(n("number"==typeof r.length),r.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(r.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var a=r[i]|r[i-1]<<8|r[i-2]<<16;this.words[s]|=a<>>26-o&67108863,o+=24,o>=26&&(o-=26,s++)}else if("le"===e)for(var i=0,s=0;i>>26-o&67108863,o+=24,o>=26&&(o-=26,s++)}return this.strip()},i.prototype._parseHex=function(r,t){this.length=Math.ceil((r.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=6){var s=o(r,n,n+6);this.words[i]|=s<>>26-e&4194303,e+=24,e>=26&&(e-=26,i++)}if(n+6!==t){var s=o(r,t,n+6);this.words[i]|=s<>>26-e&4194303}this.strip()},i.prototype._parseBase=function(r,t,n){ this.words=[0],this.length=1;for(var e=0,i=1;67108863>=i;i*=t)e++;e--,i=i/t|0;for(var o=r.length-n,a=o%e,u=Math.min(o,o-a)+n,h=0,f=n;u>f;f+=e)h=s(r,f,f+e,t),this.imuln(i),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h);if(0!==a){for(var l=1,h=s(r,f,r.length,t),f=0;a>f;f++)l*=t;this.imuln(l),this.words[0]+h<67108864?this.words[0]+=h:this._iaddn(h)}},i.prototype.copy=function(r){r.words=new Array(this.length);for(var t=0;t1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var g=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(r,t){if(r=r||10,16===r||"hex"===r){for(var e="",i=0,t=0|t||1,o=0,s=0;s>>24-i&16777215,e=0!==o||s!==this.length-1?g[6-u.length]+u+e:u+e,i+=2,i>=26&&(i-=26,s--)}for(0!==o&&(e=o.toString(16)+e);e.length%t!==0;)e="0"+e;return this.sign&&(e="-"+e),e}if(r===(0|r)&&r>=2&&36>=r){var h=v[r],f=d[r],e="",l=this.clone();for(l.sign=!1;0!==l.cmpn(0);){var c=l.modn(f).toString(r);l=l.idivn(f),e=0!==l.cmpn(0)?g[h-c.length]+c+e:c+e}return 0===this.cmpn(0)&&(e="0"+e),this.sign&&(e="-"+e),e}n(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(r){this.strip();var t=new Array(this.byteLength());t[0]=0;var n=this.clone();if("le"!==r)for(var e=0;0!==n.cmpn(0);e++){var i=n.andln(255);n.ishrn(8),t[t.length-e-1]=i}else for(var e=0;0!==n.cmpn(0);e++){var i=n.andln(255);n.ishrn(8),t[e]=i}return t},Math.clz32?i.prototype._countBits=function(r){return 32-Math.clz32(r)}:i.prototype._countBits=function(r){var t=r,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(r){if(0===r)return 26;var t=r,n=0;return 0===(8191&t)&&(n+=13,t>>>=13),0===(127&t)&&(n+=7,t>>>=7),0===(15&t)&&(n+=4,t>>>=4),0===(3&t)&&(n+=2,t>>>=2),0===(1&t)&&n++,n},i.prototype.bitLength=function(){var r=0,t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var r=0,t=0;tr.length?this.clone().ior(r):r.clone().ior(this)},i.prototype.iand=function(r){this.sign=this.sign&&r.sign;var t;t=this.length>r.length?r:this;for(var n=0;nr.length?this.clone().iand(r):r.clone().iand(this)},i.prototype.ixor=function(r){this.sign=this.sign||r.sign;var t,n;this.length>r.length?(t=this,n=r):(t=r,n=this);for(var e=0;er.length?this.clone().ixor(r):r.clone().ixor(this)},i.prototype.setn=function(r,t){n("number"==typeof r&&r>=0);for(var e=r/26|0,i=r%26;this.length<=e;)this.words[this.length++]=0;return t?this.words[e]=this.words[e]|1<r.length?(n=this,e=r):(n=r,e=this);for(var i=0,o=0;o>>26}for(;0!==i&&o>>26}if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;or.length?this.clone().iadd(r):r.clone().iadd(this)},i.prototype.isub=function(r){if(r.sign){r.sign=!1;var t=this.iadd(r);return r.sign=!0,t._normSign()}if(this.sign)return this.sign=!1,this.iadd(r),this.sign=!0,this._normSign();var n=this.cmp(r);if(0===n)return this.sign=!1,this.length=1,this.words[0]=0,this;var e,i;n>0?(e=this,i=r):(e=r,i=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t}for(;0!==o&&s>26,this.words[s]=67108863&t}if(0===o&&s>>26,o=67108863&n,s=Math.min(e,r.length-1),a=Math.max(0,e-this.length+1);s>=a;a++){var u=e-a,h=0|this.words[u],f=0|r.words[a],l=h*f,c=67108863&l;i=i+(l/67108864|0)|0,c=c+o|0,o=67108863&c,i=i+(c>>>26)|0}t.words[e]=o,n=i}return 0!==n?t.words[e]=n:t.length--,t.strip()},i.prototype._bigMulTo=function(r,t){t.sign=r.sign!==this.sign,t.length=this.length+r.length;for(var n=0,e=0,i=0;i=u;u++){var h=i-u,f=0|this.words[h],l=0|r.words[u],c=f*l,p=67108863&c;o=o+(c/67108864|0)|0,p=p+s|0,s=67108863&p,o=o+(p>>>26)|0,e+=o>>>26,o&=67108863}t.words[i]=s,n=o,o=e}return 0!==n?t.words[i]=n:t.length--,t.strip()},i.prototype.mulTo=function(r,t){var n;return n=this.length+r.length<63?this._smallMulTo(r,t):this._bigMulTo(r,t)},i.prototype.mul=function(r){var t=new i(null);return t.words=new Array(this.length+r.length),this.mulTo(r,t)},i.prototype.imul=function(r){if(0===this.cmpn(0)||0===r.cmpn(0))return this.words[0]=0,this.length=1,this;var t=this.length,n=r.length;this.sign=r.sign!==this.sign,this.length=this.length+r.length,this.words[this.length-1]=0;for(var e=this.length-2;e>=0;e--){for(var i=0,o=0,s=Math.min(e,n-1),a=Math.max(0,e-t+1);s>=a;a++){var u=e-a,h=this.words[u],f=r.words[a],l=h*f,c=67108863&l;i+=l/67108864|0,c+=o,o=67108863&c,i+=c>>>26}this.words[e]=o,this.words[e+1]+=i,i=0}for(var i=0,u=1;u>>26}return this.strip()},i.prototype.imuln=function(r){n("number"==typeof r);for(var t=0,e=0;e>=26,t+=i/67108864|0,t+=o>>>26,this.words[e]=67108863&o}return 0!==t&&(this.words[e]=t,this.length++),this},i.prototype.muln=function(r){return this.clone().imuln(r)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(r){n("number"==typeof r&&r>=0);var t=r%26,e=(r-t)/26,i=67108863>>>26-t<<26-t;if(0!==t){for(var o=0,s=0;s>>26-t}o&&(this.words[s]=o,this.length++)}if(0!==e){for(var s=this.length-1;s>=0;s--)this.words[s+e]=this.words[s];for(var s=0;e>s;s++)this.words[s]=0;this.length+=e}return this.strip()},i.prototype.ishrn=function(r,t,e){n("number"==typeof r&&r>=0);var i;i=t?(t-t%26)/26:0;var o=r%26,s=Math.min((r-o)/26,this.length),a=67108863^67108863>>>o<h;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s){this.length-=s;for(var h=0;h=0&&(0!==f||h>=i);h--){var l=this.words[h];this.words[h]=f<<26-o|l>>>o,f=l&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(r){return this.clone().ishln(r)},i.prototype.shrn=function(r){return this.clone().ishrn(r)},i.prototype.testn=function(r){n("number"==typeof r&&r>=0);var t=r%26,e=(r-t)/26,i=1<=0);var t=r%26,e=(r-t)/26;if(n(!this.sign,"imaskn works only with positive numbers"),0!==t&&e++,this.length=Math.min(e,this.length),0!==t){var i=67108863^67108863>>>t<r?this.isubn(-r):this.sign?1===this.length&&this.words[0]=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(r){if(n("number"==typeof r),0>r)return this.iaddn(-r);if(this.sign)return this.sign=!1,this.iaddn(r),this.sign=!0,this;this.words[0]-=r;for(var t=0;t>26)-(h/67108864|0),this.words[i+e]=67108863&u}for(;i>26,this.words[i+e]=67108863&u}if(0===a)return this.strip();n(-1===a),a=0;for(var i=0;i>26,this.words[i]=67108863&u}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(r,t){var n=this.length-r.length,e=this.clone(),o=r,s=o.words[o.length-1],a=this._countBits(s);n=26-a,0!==n&&(o=o.shln(n),e.ishln(n),s=o.words[o.length-1]);var u,h=e.length-o.length;if("mod"!==t){u=new i(null),u.length=h+1,u.words=new Array(u.length);for(var f=0;f=0;c--){var p=67108864*e.words[o.length+c]+e.words[o.length+c-1];for(p=Math.min(p/s|0,67108863),e._ishlnsubmul(o,p,c);e.sign;)p--,e.sign=!1,e._ishlnsubmul(o,1,c),0!==e.cmpn(0)&&(e.sign=!e.sign);u&&(u.words[c]=p)}return u&&u.strip(),e.strip(),"div"!==t&&0!==n&&e.ishrn(n),{div:u?u:null,mod:e}},i.prototype.divmod=function(r,t){if(n(0!==r.cmpn(0)),this.sign&&!r.sign){var e,o,s=this.neg().divmod(r,t);return"mod"!==t&&(e=s.div.neg()),"div"!==t&&(o=0===s.mod.cmpn(0)?s.mod:r.sub(s.mod)),{div:e,mod:o}}if(!this.sign&&r.sign){var e,s=this.divmod(r.neg(),t);return"mod"!==t&&(e=s.div.neg()),{div:e,mod:s.mod}}return this.sign&&r.sign?this.neg().divmod(r.neg(),t):r.length>this.length||this.cmp(r)<0?{div:new i(0),mod:this}:1===r.length?"div"===t?{div:this.divn(r.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modn(r.words[0]))}:{div:this.divn(r.words[0]),mod:new i(this.modn(r.words[0]))}:this._wordDiv(r,t)},i.prototype.div=function(r){return this.divmod(r,"div").div},i.prototype.mod=function(r){return this.divmod(r,"mod").mod},i.prototype.divRound=function(r){var t=this.divmod(r);if(0===t.mod.cmpn(0))return t.div;var n=t.div.sign?t.mod.isub(r):t.mod,e=r.shrn(1),i=r.andln(1),o=n.cmp(e);return 0>o||1===i&&0===o?t.div:t.div.sign?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modn=function(r){n(67108863>=r);for(var t=(1<<26)%r,e=0,i=this.length-1;i>=0;i--)e=(t*e+this.words[i])%r;return e},i.prototype.idivn=function(r){n(67108863>=r);for(var t=0,e=this.length-1;e>=0;e--){var i=this.words[e]+67108864*t;this.words[e]=i/r|0,t=i%r}return this.strip()},i.prototype.divn=function(r){return this.clone().idivn(r)},i.prototype.egcd=function(r){n(!r.sign),n(0!==r.cmpn(0));var t=this,e=r.clone();t=t.sign?t.mod(r):t.clone();for(var o=new i(1),s=new i(0),a=new i(0),u=new i(1),h=0;t.isEven()&&e.isEven();)t.ishrn(1),e.ishrn(1),++h;for(var f=e.clone(),l=t.clone();0!==t.cmpn(0);){for(;t.isEven();)t.ishrn(1),o.isEven()&&s.isEven()?(o.ishrn(1),s.ishrn(1)):(o.iadd(f).ishrn(1),s.isub(l).ishrn(1));for(;e.isEven();)e.ishrn(1),a.isEven()&&u.isEven()?(a.ishrn(1),u.ishrn(1)):(a.iadd(f).ishrn(1),u.isub(l).ishrn(1));t.cmp(e)>=0?(t.isub(e),o.isub(a),s.isub(u)):(e.isub(t),a.isub(o),u.isub(s))}return{a:a,b:u,gcd:e.ishln(h)}},i.prototype._invmp=function(r){n(!r.sign),n(0!==r.cmpn(0));var t=this,e=r.clone();t=t.sign?t.mod(r):t.clone();for(var o=new i(1),s=new i(0),a=e.clone();t.cmpn(1)>0&&e.cmpn(1)>0;){for(;t.isEven();)t.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(a).ishrn(1);for(;e.isEven();)e.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(a).ishrn(1);t.cmp(e)>=0?(t.isub(e),o.isub(s)):(e.isub(t),s.isub(o))}return 0===t.cmpn(1)?o:s},i.prototype.gcd=function(r){if(0===this.cmpn(0))return r.clone();if(0===r.cmpn(0))return this.clone();var t=this.clone(),n=r.clone();t.sign=!1,n.sign=!1;for(var e=0;t.isEven()&&n.isEven();e++)t.ishrn(1),n.ishrn(1);for(;;){for(;t.isEven();)t.ishrn(1);for(;n.isEven();)n.ishrn(1);var i=t.cmp(n);if(0>i){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.ishln(e)},i.prototype.invm=function(r){return this.egcd(r).a.mod(r)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(r){return this.words[0]&r},i.prototype.bincn=function(r){n("number"==typeof r);var t=r%26,e=(r-t)/26,i=1<o;o++)this.words[o]=0;return this.words[e]|=i,this.length=e+1,this}for(var s=i,o=e;0!==s&&o>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},i.prototype.cmpn=function(r){var t=0>r;if(t&&(r=-r),this.sign&&!t)return-1;if(!this.sign&&t)return 1;r&=67108863,this.strip();var n;if(this.length>1)n=1;else{var e=this.words[0];n=e===r?0:r>e?-1:1}return this.sign&&(n=-n),n},i.prototype.cmp=function(r){if(this.sign&&!r.sign)return-1;if(!this.sign&&r.sign)return 1;var t=this.ucmp(r);return this.sign?-t:t},i.prototype.ucmp=function(r){if(this.length>r.length)return 1;if(this.length=0;n--){var e=this.words[n],i=r.words[n];if(e!==i){i>e?t=-1:e>i&&(t=1);break}}return t},i.red=function(r){return new c(r)},i.prototype.toRed=function(r){return n(!this.red,"Already a number in reduction context"),n(!this.sign,"red works only with positives"),r.convertTo(this)._forceRed(r)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(r){return this.red=r,this},i.prototype.forceRed=function(r){return n(!this.red,"Already a number in reduction context"),this._forceRed(r)},i.prototype.redAdd=function(r){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,r)},i.prototype.redIAdd=function(r){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,r)},i.prototype.redSub=function(r){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,r)},i.prototype.redISub=function(r){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,r)},i.prototype.redShl=function(r){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,r)},i.prototype.redMul=function(r){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,r),this.red.mul(this,r)},i.prototype.redIMul=function(r){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,r),this.red.imul(this,r)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(r){return n(this.red&&!r.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,r)};var y={k256:null,p224:null,p192:null,p25519:null};a.prototype._tmp=function(){var r=new i(null);return r.words=new Array(Math.ceil(this.n/13)),r},a.prototype.ireduce=function(r){var t,n=r;do this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),t=n.bitLength();while(t>this.n);var e=t0?n.isub(this.p):n.strip(),n},a.prototype.split=function(r,t){r.ishrn(this.n,0,t)},a.prototype.imulK=function(r){return r.imul(this.k)},e(u,a),u.prototype.split=function(r,t){for(var n=4194303,e=Math.min(r.length,9),i=0;e>i;i++)t.words[i]=r.words[i];if(t.length=e,r.length<=9)return r.words[0]=0,void(r.length=1);var o=r.words[9];t.words[t.length++]=o&n;for(var i=10;i>>22,o=s}r.words[i-10]=o>>>22,r.length-=9},u.prototype.imulK=function(r){r.words[r.length]=0,r.words[r.length+1]=0,r.length+=2;for(var t,n=0,e=0;e>>=26,r.words[n]=i,t=e}return 0!==t&&(r.words[r.length++]=t),r},i._prime=function m(r){if(y[r])return y[r];var m;if("k256"===r)m=new u;else if("p224"===r)m=new h;else if("p192"===r)m=new f;else{if("p25519"!==r)throw new Error("Unknown prime "+r);m=new l}return y[r]=m,m},c.prototype._verify1=function(r){n(!r.sign,"red works only with positives"),n(r.red,"red works only with red numbers")},c.prototype._verify2=function(r,t){n(!r.sign&&!t.sign,"red works only with positives"),n(r.red&&r.red===t.red,"red works only with red numbers")},c.prototype.imod=function(r){return this.prime?this.prime.ireduce(r)._forceRed(this):r.mod(this.m)._forceRed(this)},c.prototype.neg=function(r){var t=r.clone();return t.sign=!t.sign,t.iadd(this.m)._forceRed(this)},c.prototype.add=function(r,t){this._verify2(r,t);var n=r.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},c.prototype.iadd=function(r,t){this._verify2(r,t);var n=r.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},c.prototype.sub=function(r,t){this._verify2(r,t);var n=r.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},c.prototype.isub=function(r,t){this._verify2(r,t);var n=r.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},c.prototype.shl=function(r,t){return this._verify1(r),this.imod(r.shln(t))},c.prototype.imul=function(r,t){return this._verify2(r,t),this.imod(r.imul(t))},c.prototype.mul=function(r,t){return this._verify2(r,t),this.imod(r.mul(t))},c.prototype.isqr=function(r){return this.imul(r,r)},c.prototype.sqr=function(r){return this.mul(r,r)},c.prototype.sqrt=function(r){if(0===r.cmpn(0))return r.clone();var t=this.m.andln(3);if(n(t%2===1),3===t){var e=this.m.add(new i(1)).ishrn(2),o=this.pow(r,e);return o}for(var s=this.m.subn(1),a=0;0!==s.cmpn(0)&&0===s.andln(1);)a++,s.ishrn(1);n(0!==s.cmpn(0));var u=new i(1).toRed(this),h=u.redNeg(),f=this.m.subn(1).ishrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,f).cmp(h);)l.redIAdd(h);for(var c=this.pow(l,s),o=this.pow(r,s.addn(1).ishrn(1)),p=this.pow(r,s),g=a;0!==p.cmp(u);){for(var v=p,d=0;0!==v.cmp(u);d++)v=v.redSqr();n(g>d);var y=this.pow(c,new i(1).ishln(g-d-1));o=o.redMul(y),c=y.redSqr(),p=p.redMul(c),g=d}return o},c.prototype.invm=function(r){var t=r._invmp(this.m);return t.sign?(t.sign=!1,this.imod(t).redNeg()):this.imod(t)},c.prototype.pow=function(r,t){var n=[];if(0===t.cmpn(0))return new i(1);for(var e=t.clone();0!==e.cmpn(0);)n.push(e.andln(1)),e.ishrn(1);for(var o=r,s=0;s=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},p.prototype.mul=function(r,t){if(0===r.cmpn(0)||0===t.cmpn(0))return new i(0)._forceRed(this);var n=r.mul(t),e=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(e).ishrn(this.shift),s=o;return o.cmp(this.m)>=0?s=o.isub(this.m):o.cmpn(0)<0&&(s=o.iadd(this.m)),s._forceRed(this)},p.prototype.invm=function(r){var t=this.imod(r._invmp(this.m).mul(this.r2));return t._forceRed(this)}}("undefined"==typeof t||t,this)},{}],71:[function(r,t,n){(function(r){function n(r,t){return p[0]=r,p[1]=t,c[0]}function e(r){return c[0]=r,p[0]}function i(r){return c[0]=r,p[1]}function o(r,t){return p[1]=r,p[0]=t,c[0]}function s(r){return c[0]=r,p[1]}function a(r){return c[0]=r,p[0]}function u(r,t){return g.writeUInt32LE(r,0,!0),g.writeUInt32LE(t,4,!0),g.readDoubleLE(0,!0)}function h(r){return g.writeDoubleLE(r,0,!0),g.readUInt32LE(0,!0)}function f(r){return g.writeDoubleLE(r,0,!0),g.readUInt32LE(4,!0)}var l=!1;if("undefined"!=typeof Float64Array){var c=new Float64Array(1),p=new Uint32Array(c.buffer);c[0]=1,l=!0,1072693248===p[1]?(t.exports=function(r){return c[0]=r,[p[0],p[1]]},t.exports.pack=n,t.exports.lo=e,t.exports.hi=i):1072693248===p[0]?(t.exports=function(r){return c[0]=r,[p[1],p[0]]},t.exports.pack=o,t.exports.lo=s,t.exports.hi=a):l=!1}if(!l){var g=new r(8);t.exports=function(r){return g.writeDoubleLE(r,0,!0),[g.readUInt32LE(0,!0),g.readUInt32LE(4,!0)]},t.exports.pack=u,t.exports.lo=h,t.exports.hi=f}t.exports.sign=function(r){return t.exports.hi(r)>>>31},t.exports.exponent=function(r){var n=t.exports.hi(r);return(n<<1>>>21)-1023},t.exports.fraction=function(r){var n=t.exports.lo(r),e=t.exports.hi(r),i=1048575&e;return 2146435072&e&&(i+=1<<20),[n,i]},t.exports.denormalized=function(r){var n=t.exports.hi(r);return!(2146435072&n)}}).call(this,r("buffer").Buffer)},{buffer:2}],72:[function(r,t,n){"use strict";function e(r){return i(r[0])*i(r[1])}var i=r("./lib/bn-sign");t.exports=e},{"./lib/bn-sign":61}],73:[function(r,t,n){"use strict";function e(r,t){return i(r[0].mul(t[1]).sub(r[1].mul(t[0])),r[1].mul(t[1]))}var i=r("./lib/rationalize");t.exports=e},{"./lib/rationalize":66}],74:[function(r,t,n){"use strict";function e(r){var t=r[0],n=r[1];if(0===t.cmpn(0))return 0;var e=t.divmod(n),s=e.div,a=i(s),u=e.mod;if(0===u.cmpn(0))return a;if(a){var h=o(a)+4,f=i(u.shln(h).divRound(n));return 0>a&&(f=-f),a+f*Math.pow(2,-h)}var l=n.bitLength()-u.bitLength()+53,f=i(u.shln(l).divRound(n));return 1023>l?f*Math.pow(2,-l):(f*=Math.pow(2,-1023),f*Math.pow(2,1023-l))}var i=r("./lib/bn-to-num"),o=r("./lib/ctz");t.exports=e},{"./lib/bn-to-num":62,"./lib/ctz":63}],75:[function(r,t,n){"use strict";function e(r,t){for(var n=0;r>n;++n)if(!(t[n]<=t[n+r]))return!0;return!1}function i(r,t,n,i){for(var o=0,s=0,a=0,u=r.length;u>a;++a){var h=r[a];if(!e(t,h)){for(var f=0;2*t>f;++f)n[o++]=h[f];i[s++]=a}}return s}function o(r,t,n,e){var o=r.length,s=t.length;if(!(0>=o||0>=s)){var a=r[0].length>>>1;if(!(0>=a)){var u,h=l.mallocDouble(2*a*o),f=l.mallocInt32(o);if(o=i(r,a,h,f),o>0){if(1===a&&e)c.init(o),u=c.sweepComplete(a,n,0,o,h,f,0,o,h,f);else{var g=l.mallocDouble(2*a*s),v=l.mallocInt32(s);s=i(t,a,g,v),s>0&&(c.init(o+s),u=1===a?c.sweepBipartite(a,n,0,o,h,f,0,s,g,v):p(a,n,e,o,h,f,s,g,v),l.free(g),l.free(v))}l.free(h),l.free(f)}return u}}}function s(r,t){f.push([r,t])}function a(r){return f=[],o(r,r,s,!0),f}function u(r,t){return f=[],o(r,t,s,!1),f}function h(r,t,n){switch(arguments.length){case 1:return a(r);case 2:return"function"==typeof t?o(r,r,t,!0):u(r,t);case 3:return o(r,t,n,!1);default:throw new Error("box-intersect: Invalid arguments")}}t.exports=h;var f,l=r("typedarray-pool"),c=r("./lib/sweep"),p=r("./lib/intersect")},{"./lib/intersect":77,"./lib/sweep":81,"typedarray-pool":84}],76:[function(r,t,n){"use strict";function e(r,t,n){var e="bruteForce"+(r?"Red":"Blue")+(t?"Flip":"")+(n?"Full":""),i=["function ",e,"(",A.join(),"){","var ",h,"=2*",o,";"],u="for(var i="+f+","+g+"="+h+"*"+f+";i<"+l+";++i,"+g+"+="+h+"){var x0="+c+"["+s+"+"+g+"],x1="+c+"["+s+"+"+g+"+"+o+"],xi="+p+"[i];",x="for(var j="+v+","+b+"="+h+"*"+v+";j<"+d+";++j,"+b+"+="+h+"){var y0="+y+"["+s+"+"+b+"],"+(n?"y1="+y+"["+s+"+"+b+"+"+o+"],":"")+"yi="+m+"[j];";return r?i.push(u,_,":",x):i.push(x,_,":",u),n?i.push("if(y1"+d+"-"+v+"){"),r?(t(!0,!1),s.push("}else{"),t(!1,!1)):(s.push("if("+u+"){"),t(!0,!0),s.push("}else{"),t(!0,!1),s.push("}}else{if("+u+"){"),t(!1,!0),s.push("}else{"),t(!1,!1),s.push("}")),s.push("}}return "+n);var a=i.join("")+s.join(""),h=new Function(a);return h()}var o="d",s="ax",a="vv",u="fp",h="es",f="rs",l="re",c="rb",p="ri",g="rp",v="bs",d="be",y="bb",m="bi",b="bp",w="rv",_="Q",A=[o,s,a,f,l,c,p,v,d,y,m];n.partial=i(!1),n.full=i(!0)},{}],77:[function(r,t,n){"use strict";function e(r,t){var n=8*h.log2(t+1)*(r+1)|0,e=h.nextPow2(j*n);M.lengthP&&(u.free(P),P=u.mallocDouble(i))}function i(r,t,n,e,i,o,s,a,u){var h=j*r;M[h]=t,M[h+1]=n,M[h+2]=e,M[h+3]=i,M[h+4]=o,M[h+5]=s;var f=k*r;P[f]=a,P[f+1]=u}function o(r,t,n,e,i,o,s,a,u,h,f){var l=2*r,c=u*l,p=h[c+t];r:for(var g=i,v=i*l;o>g;++g,v+=l){var d=s[v+t],y=s[v+t+r];if(!(d>p||p>y||e&&p===d)){for(var m=a[g],b=t+1;r>b;++b){var d=s[v+b],y=s[v+b+r],w=h[c+b],_=h[c+b+r];if(w>y||d>_)continue r}var A;if(A=e?n(f,m):n(m,f),void 0!==A)return A}}}function s(r,t,n,e,i,o,s,a,u,h){var f=2*r,l=a*f,c=u[l+t];r:for(var p=e,g=e*f;i>p;++p,g+=f){var v=s[p];if(v!==h){var d=o[g+t],y=o[g+t+r];if(!(d>c||c>y)){for(var m=t+1;r>m;++m){var d=o[g+m],y=o[g+m+r],b=u[l+m],w=u[l+m+r];if(b>y||d>w)continue r}var _=n(v,h);if(void 0!==_)return _}}}}function a(r,t,n,a,u,h,f,v,I){e(r,a+f);var B,R=0,T=2*r;for(i(R++,0,0,a,0,f,n?16:0,-(1/0),1/0),n||i(R++,0,0,f,0,a,1,-(1/0),1/0);R>0;){R-=1;var U=R*j,S=M[U],L=M[U+1],V=M[U+2],N=M[U+3],F=M[U+4],O=M[U+5],C=R*k,q=P[C],D=P[C+1],Y=1&O,z=!!(16&O),G=u,H=h,W=v,Q=I;if(Y&&(G=v,H=I,W=u,Q=h),!(2&O&&(V=_(r,S,L,V,G,H,D),L>=V)||4&O&&(L=A(r,S,L,V,G,H,q),L>=V))){var K=V-L,X=F-N;if(z){if(m>r*K*(K+X)){if(B=p.scanComplete(r,S,t,L,V,G,H,N,F,W,Q),void 0!==B)return B;continue}}else{if(r*Math.min(K,X)r*K*X){if(B=p.scanBipartite(r,S,t,Y,L,V,G,H,N,F,W,Q),void 0!==B)return B;continue}}var J=b(r,S,L,V,G,H,q,D);if(J>L)if(d>r*(J-L)){if(B=c(r,S+1,t,L,J,G,H,N,F,W,Q),void 0!==B)return B}else if(S===r-2){if(B=Y?p.sweepBipartite(r,t,N,F,W,Q,L,J,G,H):p.sweepBipartite(r,t,L,J,G,H,N,F,W,Q),void 0!==B)return B}else i(R++,S+1,L,J,N,F,Y,-(1/0),1/0),i(R++,S+1,N,F,L,J,1^Y,-(1/0),1/0);if(V>J){var Z=g(r,S,N,F,W,Q),$=W[T*Z+S],rr=w(r,S,Z,F,W,Q,$);if(F>rr&&i(R++,S,J,V,rr,F,(4|Y)+(z?16:0),$,D),Z>N&&i(R++,S,J,V,N,Z,(2|Y)+(z?16:0),q,$),Z+1===rr){if(B=z?s(r,S,t,J,V,G,H,Z,W,Q[Z]):o(r,S,t,Y,J,V,G,H,Z,W,Q[Z]),void 0!==B)return B}else if(rr>Z){var tr;if(z){if(tr=x(r,S,J,V,G,H,$),tr>J){var nr=w(r,S,J,tr,G,H,$);if(S===r-2){if(nr>J&&(B=p.sweepComplete(r,t,J,nr,G,H,Z,rr,W,Q),void 0!==B))return B;if(tr>nr&&(B=p.sweepBipartite(r,t,nr,tr,G,H,Z,rr,W,Q),void 0!==B))return B}else nr>J&&i(R++,S+1,J,nr,Z,rr,16,-(1/0),1/0),tr>nr&&(i(R++,S+1,nr,tr,Z,rr,0,-(1/0),1/0),i(R++,S+1,Z,rr,nr,tr,1,-(1/0),1/0))}}else tr=Y?E(r,S,J,V,G,H,$):x(r,S,J,V,G,H,$),tr>J&&(S===r-2?B=Y?p.sweepBipartite(r,t,Z,rr,W,Q,J,tr,G,H):p.sweepBipartite(r,t,J,tr,G,H,Z,rr,W,Q):(i(R++,S+1,J,tr,Z,rr,Y,-(1/0),1/0),i(R++,S+1,Z,rr,J,tr,1^Y,-(1/0),1/0)))}}}}}t.exports=a;var u=r("typedarray-pool"),h=r("bit-twiddle"),f=r("./brute"),l=f.partial,c=f.full,p=r("./sweep"),g=r("./median"),v=r("./partition"),d=128,y=1<<22,m=1<<22,b=v("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),w=v("lo===p0",["p0"]),_=v("lou;++u,a+=s)for(var h=i[a],f=u,l=s*(u-1);f>n&&i[l+t]>h;--f,l-=s){for(var c=l,p=l+s,g=0;s>g;++g,++c,++p){var v=i[c];i[c]=i[p],i[p]=v}var d=o[f];o[f]=o[f-1],o[f-1]=d}}function i(r,t,n,i,o,u){if(n+1>=i)return n;for(var h=n,f=i,l=i+n>>>1,c=2*r,p=l,g=o[c*l+t];f>h;){if(a>f-h){e(r,t,h,f,o,u),g=o[c*l+t];break}var v=f-h,d=Math.random()*v+h|0,y=o[c*d+t],m=Math.random()*v+h|0,b=o[c*m+t],w=Math.random()*v+h|0,_=o[c*w+t];b>=y?_>=b?(p=m,g=b):y>=_?(p=d,g=y):(p=w,g=_):b>=_?(p=m,g=b):_>=y?(p=d,g=y):(p=w,g=_);for(var A=c*(f-1),x=c*p,E=0;c>E;++E,++A,++x){var j=o[A];o[A]=o[x],o[x]=j}var k=u[f-1];u[f-1]=u[p],u[p]=k,p=s(r,t,h,f-1,o,u,g);for(var A=c*(f-1),x=c*p,E=0;c>E;++E,++A,++x){var j=o[A];o[A]=o[x],o[x]=j}var k=u[f-1];if(u[f-1]=u[p],u[p]=k,p>l){for(f=p-1;f>h&&o[c*(f-1)+t]===g;)f-=1;f+=1}else{if(!(l>p))break;for(h=p+1;f>h&&o[c*h+t]===g;)h+=1; }}return s(r,t,n,l,o,u,o[c*l+t])}t.exports=i;var o=r("./partition"),s=o("lo=0&&e.push("lo=e[k+n]"),r.indexOf("hi")>=0&&e.push("hi=e[k+o]"),n.push(i.replace("_",e.join()).replace("$",r)),Function.apply(void 0,n)}t.exports=e;var i="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],80:[function(r,t,n){"use strict";function e(r,t){4*c>=t?i(0,t-1,r):l(0,t-1,r)}function i(r,t,n){for(var e=2*(r+1),i=r+1;t>=i;++i){for(var o=n[e++],s=n[e++],a=i,u=e-2;a-->r;){var h=n[u-2],f=n[u-1];if(o>h)break;if(h===o&&s>f)break;n[u]=h,n[u+1]=f,u-=2}n[u]=o,n[u+1]=s}}function o(r,t,n){r*=2,t*=2;var e=n[r],i=n[r+1];n[r]=n[t],n[r+1]=n[t+1],n[t]=e,n[t+1]=i}function s(r,t,n){r*=2,t*=2,n[r]=n[t],n[r+1]=n[t+1]}function a(r,t,n,e){r*=2,t*=2,n*=2;var i=e[r],o=e[r+1];e[r]=e[t],e[r+1]=e[t+1],e[t]=e[n],e[t+1]=e[n+1],e[n]=i,e[n+1]=o}function u(r,t,n,e,i){r*=2,t*=2,i[r]=i[t],i[t]=n,i[r+1]=i[t+1],i[t+1]=e}function h(r,t,n){r*=2,t*=2;var e=n[r],i=n[t];return i>e?!1:e===i?n[r+1]>n[t+1]:!0}function f(r,t,n,e){r*=2;var i=e[r];return t>i?!0:i===t?e[r+1]>1,d=v-e,y=v+e,m=p,b=d,w=v,_=y,A=g,x=r+1,E=t-1,j=0;h(m,b,n)&&(j=m,m=b,b=j),h(_,A,n)&&(j=_,_=A,A=j),h(m,w,n)&&(j=m,m=w,w=j),h(b,w,n)&&(j=b,b=w,w=j),h(m,_,n)&&(j=m,m=_,_=j),h(w,_,n)&&(j=w,w=_,_=j),h(b,A,n)&&(j=b,b=A,A=j),h(b,w,n)&&(j=b,b=w,w=j),h(_,A,n)&&(j=_,_=A,A=j);for(var k=n[2*b],I=n[2*b+1],M=n[2*_],P=n[2*_+1],B=2*m,R=2*w,T=2*A,U=2*p,S=2*v,L=2*g,V=0;2>V;++V){var N=n[B+V],F=n[R+V],O=n[T+V];n[U+V]=N,n[S+V]=F,n[L+V]=O}s(d,r,n),s(y,t,n);for(var C=x;E>=C;++C)if(f(C,k,I,n))C!==x&&o(C,x,n),++x;else if(!f(C,M,P,n))for(;;){if(f(E,M,P,n)){f(E,k,I,n)?(a(C,x,E,n),++x,--E):(o(C,E,n),--E);break}if(--E=x-2-r?i(r,x-2,n):l(r,x-2,n),c>=t-(E+2)?i(E+2,t,n):l(E+2,t,n),c>=E-x?i(x,E,n):l(x,E,n)}t.exports=e;var c=32},{}],81:[function(r,t,n){"use strict";function e(r){var t=l.nextPow2(r);v.lengthx;++x){var E=a[x],j=b*x;_[g++]=s[j+w],_[g++]=-(E+1),_[g++]=s[j+A],_[g++]=E}for(var x=u;h>x;++x){var E=l[x]+p,k=b*x;_[g++]=f[k+w],_[g++]=-E,_[g++]=f[k+A],_[g++]=E}var I=g>>>1;c(_,I);for(var M=0,P=0,x=0;I>x;++x){var B=0|_[2*x+1];if(B>=p)B=B-p|0,i(y,m,P--,B);else if(B>=0)i(v,d,M--,B);else if(-p>=B){B=-B-p|0;for(var R=0;M>R;++R){var T=t(v[R],B);if(void 0!==T)return T}o(y,m,P++,B)}else{B=-B-1|0;for(var R=0;P>R;++R){var T=t(B,y[R]);if(void 0!==T)return T}o(v,d,M++,B)}}}function a(r,t,n,e,s,a,u,h,f,l){for(var p=0,g=2*r,A=r-1,x=g-1,E=n;e>E;++E){var j=a[E]+1<<1,k=g*E;_[p++]=s[k+A],_[p++]=-j,_[p++]=s[k+x],_[p++]=j}for(var E=u;h>E;++E){var j=l[E]+1<<1,I=g*E;_[p++]=f[I+A],_[p++]=1|-j,_[p++]=f[I+x],_[p++]=1|j}var M=p>>>1;c(_,M);for(var P=0,B=0,R=0,E=0;M>E;++E){var T=0|_[2*E+1],U=1&T;if(M-1>E&&T>>1===_[2*E+3]>>1&&(U=2,E+=1),0>T){for(var S=-(T>>1)-1,L=0;R>L;++L){var V=t(b[L],S);if(void 0!==V)return V}if(0!==U)for(var L=0;P>L;++L){var V=t(v[L],S);if(void 0!==V)return V}if(1!==U)for(var L=0;B>L;++L){var V=t(y[L],S);if(void 0!==V)return V}0===U?o(v,d,P++,S):1===U?o(y,m,B++,S):2===U&&o(b,w,R++,S)}else{var S=(T>>1)-1;0===U?i(v,d,P--,S):1===U?i(y,m,B--,S):2===U&&i(b,w,R--,S)}}}function u(r,t,n,e,s,a,u,h,f,l,g,y){var m=0,b=2*r,w=t,A=t+r,x=1,E=1;e?E=p:x=p;for(var j=s;a>j;++j){var k=j+x,I=b*j;_[m++]=u[I+w],_[m++]=-k,_[m++]=u[I+A],_[m++]=k}for(var j=f;l>j;++j){var k=j+E,M=b*j;_[m++]=g[M+w],_[m++]=-k}var P=m>>>1;c(_,P);for(var B=0,j=0;P>j;++j){var R=0|_[2*j+1];if(0>R){var k=-R,T=!1;if(k>=p?(T=!e,k-=p):(T=!!e,k-=1),T)o(v,d,B++,k);else{var U=y[k],S=b*k,L=g[S+t+1],V=g[S+t+1+r];r:for(var N=0;B>N;++N){var F=v[N],O=b*F;if(!(VC;++C)if(g[S+C+r]m;++m){var b=m+p,w=g*m;_[l++]=o[w+d],_[l++]=-b,_[l++]=o[w+y],_[l++]=b}for(var m=a;u>m;++m){var b=m+1,A=g*m;_[l++]=h[A+d],_[l++]=-b}var x=l>>>1;c(_,x);for(var E=0,m=0;x>m;++m){var j=0|_[2*m+1];if(0>j){var b=-j;if(b>=p)v[E++]=b-p;else{b-=1;var k=f[b],I=g*b,M=h[I+t+1],P=h[I+t+1+r];r:for(var B=0;E>B;++B){var R=v[B],T=s[R];if(T===k)break;var U=g*R;if(!(PS;++S)if(h[I+S+r]=0;--B)if(v[B]===b){for(var S=B+1;E>S;++S)v[S-1]=v[S];break}--E}}}t.exports={init:e,sweepBipartite:s,sweepComplete:a,scanBipartite:u,scanComplete:h};var f=r("typedarray-pool"),l=r("bit-twiddle"),c=r("./sort"),p=1<<28,g=1024,v=f.mallocInt32(g),d=f.mallocInt32(g),y=f.mallocInt32(g),m=f.mallocInt32(g),b=f.mallocInt32(g),w=f.mallocInt32(g),_=f.mallocDouble(8*g)},{"./sort":80,"bit-twiddle":82,"typedarray-pool":84}],82:[function(r,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],83:[function(r,t,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],84:[function(r,t,n){arguments[4][17][0].apply(n,arguments)},{"bit-twiddle":82,buffer:2,dup:17}],85:[function(r,t,n){function e(r,t){return r-t}function i(r,t){var n=r.length,i=r.length-t.length;if(i)return i;switch(n){case 0:return 0;case 1:return r[0]-t[0];case 2:return r[0]+r[1]-t[0]-t[1]||o(r[0],r[1])-o(t[0],t[1]);case 3:var s=r[0]+r[1],a=t[0]+t[1];if(i=s+r[2]-(a+t[2]))return i;var u=o(r[0],r[1]),h=o(t[0],t[1]);return o(u,r[2])-o(h,t[2])||o(u+r[2],s)-o(h+t[2],a);case 4:var f=r[0],l=r[1],c=r[2],p=r[3],g=t[0],v=t[1],d=t[2],y=t[3];return f+l+c+p-(g+v+d+y)||o(f,l,c,p)-o(g,v,d,y,g)||o(f+l,f+c,f+p,l+c,l+p,c+p)-o(g+v,g+d,g+y,v+d,v+y,d+y)||o(f+l+c,f+l+p,f+c+p,l+c+p)-o(g+v+d,g+v+y,g+d+y,v+d+y);default:for(var m=r.slice().sort(e),b=t.slice().sort(e),w=0;n>w;++w)if(i=m[w]-b[w])return i;return 0}}t.exports=i;var o=Math.min},{}],86:[function(r,t,n){"use strict";function e(r,t){if(isNaN(r)||isNaN(t))return NaN;if(r===t)return r;if(0===r)return 0>t?-o:o;var n=i.hi(r),e=i.lo(r);return t>r==r>0?e===s?(n+=1,e=0):e+=1:0===e?(e=s,n-=1):e-=1,i.pack(e,n)}var i=r("double-bits"),o=Math.pow(2,-1074),s=-1>>>0;t.exports=e},{"double-bits":87}],87:[function(r,t,n){arguments[4][71][0].apply(n,arguments)},{buffer:2,dup:71}],88:[function(r,t,n){"use strict";function e(r,t){for(var n=r.length,e=new Array(n),o=0;n>o;++o)e[o]=i(r[o],t[o]);return e}var i=r("big-rat/add");t.exports=e},{"big-rat/add":56}],89:[function(r,t,n){"use strict";function e(r){for(var t=new Array(r.length),n=0;na;++a)s[a]=o(r[a],n);return s}var i=r("big-rat"),o=r("big-rat/mul");t.exports=e},{"big-rat":59,"big-rat/mul":68}],91:[function(r,t,n){"use strict";function e(r,t){for(var n=r.length,e=new Array(n),o=0;n>o;++o)e[o]=i(r[o],t[o]);return e}var i=r("big-rat/sub");t.exports=e},{"big-rat/sub":73}],92:[function(r,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43}],93:[function(r,t,n){arguments[4][44][0].apply(n,arguments)},{dup:44,"two-product":96,"two-sum":92}],94:[function(r,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],95:[function(r,t,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],96:[function(r,t,n){arguments[4][47][0].apply(n,arguments)},{dup:47}],97:[function(r,t,n){arguments[4][53][0].apply(n,arguments)},{dup:53,"robust-scale":93,"robust-subtract":94,"robust-sum":95,"two-product":96}],98:[function(r,t,n){"use strict";function e(r,t,n,e){for(var i=0;2>i;++i){var o=r[i],s=t[i],a=Math.min(o,s),u=Math.max(o,s),h=n[i],f=e[i],l=Math.min(h,f),c=Math.max(h,f);if(a>c||l>u)return!1}return!0}function i(r,t,n,i){var s=o(r,n,i),a=o(t,n,i);if(s>0&&a>0||0>s&&0>a)return!1;var u=o(n,r,t),h=o(i,r,t);return u>0&&h>0||0>u&&0>h?!1:0===s&&0===a&&0===u&&0===h?e(r,t,n,i):!0}t.exports=i;var o=r("robust-orientation")[3]},{"robust-orientation":97}],99:[function(r,t,n){"use strict";"use restrict";function e(r){this.roots=new Array(r),this.ranks=new Array(r);for(var t=0;r>t;++t)this.roots[t]=t,this.ranks[t]=0}t.exports=e;var i=e.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var r=this.roots.length;return this.roots.push(r),this.ranks.push(0),r},i.find=function(r){for(var t=r,n=this.roots;n[r]!==r;)r=n[r];for(;n[t]!==r;){var e=n[t];n[t]=r,t=e}return r},i.link=function(r,t){var n=this.find(r),e=this.find(t);if(n!==e){var i=this.ranks,o=this.roots,s=i[n],a=i[e];a>s?o[n]=e:s>a?o[e]=n:(o[e]=n,++i[n])}}},{}],100:[function(r,t,n){arguments[4][12][0].apply(n,arguments)},{dup:12,"iota-array":101,"is-buffer":102}],101:[function(r,t,n){arguments[4][13][0].apply(n,arguments)},{dup:13}],102:[function(r,t,n){arguments[4][14][0].apply(n,arguments)},{dup:14}],103:[function(r,t,n){"use strict";function e(r,t){for(var n=i(r,t.length),e=new Array(t.length),o=new Array(t.length),s=[],a=0;a=u&&s.push(a)}for(;s.length>0;){var h=s.pop();e[h]=!1;for(var f=n[h],a=0;ae;++e){var o=r[e];t=Math.max(t,o[0],o[1])}t=(0|t)+1}t=0|t;for(var s=new Array(t),e=0;t>e;++e)s[e]=[];for(var e=0;n>e;++e){var o=r[e];s[o[0]].push(o[1]),s[o[1]].push(o[0])}for(var a=0;t>a;++a)i(s[a],function(r,t){return r-t});return s}t.exports=e;var i=r("uniq")},{uniq:123}],105:[function(r,t,n){"use strict";function e(r,t){function n(r,t){var n=h[t][r[t]];n.splice(n.indexOf(r),1)}function e(r,e,o){for(var s,a,u,f=0;2>f;++f)if(h[f][e].length>0){s=h[f][e][0],u=f;break}a=s[1^u];for(var l=0;2>l;++l)for(var c=h[l][e],p=0;p0&&(s=g,a=v,u=l)}return o?a:(s&&n(s,u),a)}function o(r,o){var s=h[o][r][0],a=[r];n(s,o);for(var u=s[1^o];;){for(;u!==r;)a.push(u),u=e(a[a.length-2],u,!1);if(h[0][r].length+h[1][r].length===0)break;var f=a[a.length-1],l=r,c=a[1],p=e(f,l,!0);if(i(t[f],t[l],t[c],t[p])<0)break;a.push(r),u=e(f,l)}return a}function s(r,t){return t[1]===t[t.length-1]}for(var a=0|t.length,u=r.length,h=[new Array(a),new Array(a)],f=0;a>f;++f)h[0][f]=[],h[1][f]=[];for(var f=0;u>f;++f){var l=r[f];h[0][l[0]].push(l),h[1][l[1]].push(l)}for(var c=[],f=0;a>f;++f)h[0][f].length+h[1][f].length===0&&c.push([f]);for(var f=0;a>f;++f)for(var p=0;2>p;++p){for(var g=[];h[p][f].length>0;){var v=(h[0][f].length,o(f,p));s(g,v)?g.push.apply(g,v):(g.length>0&&c.push(g),g=v)}g.length>0&&c.push(g)}return c}t.exports=e;var i=r("compare-angle")},{"compare-angle":106}],106:[function(r,t,n){"use strict";function e(r,t,n){var e=a(r[0],-t[0]),i=a(r[1],-t[1]),o=a(n[0],-t[0]),s=a(n[1],-t[1]),f=h(u(e,o),u(i,s));return f[f.length-1]>=0}function i(r,t,n,i){var a=o(t,n,i);if(0===a){var u=s(o(r,t,n)),h=s(o(r,t,i));if(u===h){if(0===u){var f=e(r,t,n),l=e(r,t,i);return f===l?0:f?1:-1}return 0}return 0===h?u>0?-1:e(r,t,i)?-1:1:0===u?h>0?1:e(r,t,n)?1:-1:s(h-u)}var c=o(r,t,n);if(c>0)return a>0&&o(r,t,i)>0?1:-1;if(0>c)return a>0||o(r,t,i)>0?1:-1;var p=o(r,t,i);return p>0?1:e(r,t,n)?1:-1}t.exports=i;var o=r("robust-orientation"),s=r("signum"),a=r("two-sum"),u=r("robust-product"),h=r("robust-sum")},{"robust-orientation":120,"robust-product":108,"robust-sum":121,signum:109,"two-sum":110}],107:[function(r,t,n){arguments[4][44][0].apply(n,arguments)},{dup:44,"two-product":122,"two-sum":110}],108:[function(r,t,n){"use strict";function e(r,t){if(1===r.length)return o(t,r[0]);if(1===t.length)return o(r,t[0]);if(0===r.length||0===t.length)return[0];var n=[0];if(r.lengthr?-1:r>0?1:0}},{}],110:[function(r,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43}],111:[function(r,t,n){"use strict";function e(r,t,n,e,i,o){var s=["function ",r,"(a,l,h,",e.join(","),"){",o?"":"var i=",n?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return o?t.indexOf("c")<0?s.push(";if(x===y){return m}else if(x<=y){"):s.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):s.push(";if(",t,"){i=m;"),n?s.push("l=m+1}else{h=m-1}"):s.push("h=m-1}else{l=m+1}"),s.push("}"),o?s.push("return -1};"):s.push("return i};"),s.join("")}function i(r,t,n,i){var o=new Function([e("A","x"+r+"y",t,["y"],!1,i),e("B","x"+r+"y",t,["y"],!0,i),e("P","c(x,y)"+r+"0",t,["y","c"],!1,i),e("Q","c(x,y)"+r+"0",t,["y","c"],!0,i),"function dispatchBsearch",n,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",n].join(""));return o()}t.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],112:[function(r,t,n){"use strict";function e(r,t,n,e,i){this.mid=r,this.left=t,this.right=n,this.leftPoints=e,this.rightPoints=i,this.count=(t?t.count:0)+(n?n.count:0)+e.length}function i(r,t){r.mid=t.mid,r.left=t.left,r.right=t.right,r.leftPoints=t.leftPoints,r.rightPoints=t.rightPoints,r.count=t.count}function o(r,t){var n=g(t);r.mid=n.mid,r.left=n.left,r.right=n.right,r.leftPoints=n.leftPoints,r.rightPoints=n.rightPoints,r.count=n.count}function s(r,t){var n=r.intervals([]);n.push(t),o(r,n)}function a(r,t){var n=r.intervals([]),e=n.indexOf(t);return 0>e?m:(n.splice(e,1),o(r,n),b)}function u(r,t,n){for(var e=0;e=0&&r[e][1]>=t;--e){var i=n(r[e]);if(i)return i}}function f(r,t){for(var n=0;n>1],o=[],s=[],a=[],n=0;n3*(t+1)?s(this,r):this.left.insert(r):this.left=g([r]);else if(r[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?s(this,r):this.right.insert(r):this.right=g([r]);else{var n=y.ge(this.leftPoints,r,c),e=y.ge(this.rightPoints,r,p);this.leftPoints.splice(n,0,r),this.rightPoints.splice(e,0,r)}},_.remove=function(r){var t=this.count-this.leftPoints;if(r[1]3*(t-1))return a(this,r);var e=this.left.remove(r);return e===w?(this.left=null,this.count-=1,b):(e===b&&(this.count-=1),e)}if(r[0]>this.mid){if(!this.right)return m;var o=this.left?this.left.count:0;if(4*o>3*(t-1))return a(this,r);var e=this.right.remove(r);return e===w?(this.right=null,this.count-=1,b):(e===b&&(this.count-=1),e)}if(1===this.count)return this.leftPoints[0]===r?w:m;if(1===this.leftPoints.length&&this.leftPoints[0]===r){if(this.left&&this.right){for(var s=this,u=this.left;u.right;)s=u,u=u.right;if(s===this)u.right=this.right;else{var h=this.left,e=this.right;s.count-=u.count,s.right=u.left,u.left=h,u.right=e}i(this,u),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return b}for(var h=y.ge(this.leftPoints,r,c);hthis.mid){if(this.right){var n=this.right.queryPoint(r,t);if(n)return n}return h(this.rightPoints,r,t)}return f(this.leftPoints,t)},_.queryInterval=function(r,t,n){if(rthis.mid&&this.right){var e=this.right.queryInterval(r,t,n);if(e)return e}return tthis.mid?h(this.rightPoints,r,n):f(this.leftPoints,n)};var A=v.prototype;A.insert=function(r){this.root?this.root.insert(r):this.root=new e(r[0],null,null,[r],[r])},A.remove=function(r){if(this.root){var t=this.root.remove(r);return t===w&&(this.root=null),t!==m}return!1},A.queryPoint=function(r,t){return this.root?this.root.queryPoint(r,t):void 0},A.queryInterval=function(r,t,n){return t>=r&&this.root?this.root.queryInterval(r,t,n):void 0},Object.defineProperty(A,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(A,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":111}],113:[function(r,t,n){"use strict";function e(r,t){var n,e;if(t[0][0]t[1][0])){var i=Math.min(r[0][1],r[1][1]),s=Math.max(r[0][1],r[1][1]),a=Math.min(t[0][1],t[1][1]),u=Math.max(t[0][1],t[1][1]);return a>s?s-a:i>u?i-u:s-u}n=t[1],e=t[0]}var h,f;r[0][1]t[1][0]))return e(t,r);n=t[1],i=t[0]}var s,a;if(r[0][0]r[1][0]))return-e(r,t);s=r[1],a=r[0]}var u=o(n,i,a),h=o(n,i,s);if(0>u){if(0>=h)return u}else if(u>0){if(h>=0)return u}else if(h)return h;if(u=o(a,s,i),h=o(a,s,n),0>u){if(0>=h)return u}else if(u>0){if(h>=0)return u}else if(h)return h;return i[0]-a[0]}t.exports=i;var o=r("robust-orientation")},{"robust-orientation":120}],114:[function(r,t,n){"use strict";function e(r,t,n,e,i,o){this._color=r,this.key=t,this.value=n,this.left=e,this.right=i,this._count=o}function i(r){return new e(r._color,r.key,r.value,r.left,r.right,r._count)}function o(r,t){return new e(r,t.key,t.value,t.left,t.right,t._count)}function s(r){r._count=1+(r.left?r.left._count:0)+(r.right?r.right._count:0)}function a(r,t){this._compare=r,this.root=t}function u(r,t){if(t.left){var n=u(r,t.left);if(n)return n}var n=r(t.key,t.value);return n?n:t.right?u(r,t.right):void 0}function h(r,t,n,e){var i=t(r,e.key);if(0>=i){if(e.left){var o=h(r,t,n,e.left);if(o)return o}var o=n(e.key,e.value);if(o)return o}return e.right?h(r,t,n,e.right):void 0}function f(r,t,n,e,i){var o,s=n(r,i.key),a=n(t,i.key);if(0>=s){if(i.left&&(o=f(r,t,n,e,i.left)))return o;if(a>0&&(o=e(i.key,i.value)))return o}return a>0&&i.right?f(r,t,n,e,i.right):void 0}function l(r,t){this.tree=r,this._stack=t}function c(r,t){r.key=t.key,r.value=t.value,r.left=t.left,r.right=t.right,r._color=t._color,r._count=t._count}function p(r){for(var t,n,e,a,u=r.length-1;u>=0;--u){if(t=r[u],0===u)return void(t._color=y);if(n=r[u-1],n.left===t){if(e=n.right,e.right&&e.right._color===d){if(e=n.right=i(e),a=e.right=i(e.right),n.right=e.left,e.left=n,e.right=a,e._color=n._color,t._color=y,n._color=y,a._color=y,s(n),s(e),u>1){var h=r[u-2];h.left===n?h.left=e:h.right=e}return void(r[u-1]=e)}if(e.left&&e.left._color===d){if(e=n.right=i(e),a=e.left=i(e.left),n.right=a.left,e.left=a.right,a.left=n,a.right=e,a._color=n._color,n._color=y,e._color=y,t._color=y,s(n),s(e),s(a),u>1){var h=r[u-2];h.left===n?h.left=a:h.right=a}return void(r[u-1]=a)}if(e._color===y){if(n._color===d)return n._color=y,void(n.right=o(d,e));n.right=o(d,e);continue}if(e=i(e),n.right=e.left,e.left=n,e._color=n._color,n._color=d,s(n),s(e),u>1){var h=r[u-2];h.left===n?h.left=e:h.right=e}r[u-1]=e,r[u]=n,u+11){var h=r[u-2];h.right===n?h.right=e:h.left=e}return void(r[u-1]=e)}if(e.right&&e.right._color===d){if(e=n.left=i(e),a=e.right=i(e.right),n.left=a.right,e.right=a.left,a.right=n,a.left=e,a._color=n._color,n._color=y,e._color=y,t._color=y,s(n),s(e),s(a),u>1){var h=r[u-2];h.right===n?h.right=a:h.left=a}return void(r[u-1]=a)}if(e._color===y){if(n._color===d)return n._color=y,void(n.left=o(d,e));n.left=o(d,e);continue}if(e=i(e),n.left=e.right,e.right=n,e._color=n._color,n._color=d,s(n),s(e),u>1){var h=r[u-2];h.right===n?h.right=e:h.left=e}r[u-1]=e,r[u]=n,u+1r?-1:r>t?1:0}function v(r){return new a(r||g,null)}t.exports=v;var d=0,y=1,m=a.prototype;Object.defineProperty(m,"keys",{get:function(){var r=[];return this.forEach(function(t,n){r.push(t)}),r}}),Object.defineProperty(m,"values",{get:function(){var r=[];return this.forEach(function(t,n){r.push(n)}),r}}),Object.defineProperty(m,"length",{get:function(){return this.root?this.root._count:0}}),m.insert=function(r,t){for(var n=this._compare,i=this.root,u=[],h=[];i;){var f=n(r,i.key);u.push(i),h.push(f),i=0>=f?i.left:i.right}u.push(new e(d,r,t,null,null,1));for(var l=u.length-2;l>=0;--l){var i=u[l];h[l]<=0?u[l]=new e(i._color,i.key,i.value,u[l+1],i.right,i._count+1):u[l]=new e(i._color,i.key,i.value,i.left,u[l+1],i._count+1)}for(var l=u.length-1;l>1;--l){var c=u[l-1],i=u[l];if(c._color===y||i._color===y)break;var p=u[l-2];if(p.left===c)if(c.left===i){var g=p.right;if(!g||g._color!==d){if(p._color=d,p.left=c.right,c._color=y,c.right=p,u[l-2]=c,u[l-1]=i,s(p),s(c),l>=3){var v=u[l-3];v.left===p?v.left=c:v.right=c}break}c._color=y,p.right=o(y,g),p._color=d,l-=1}else{var g=p.right;if(!g||g._color!==d){if(c.right=i.left,p._color=d,p.left=i.right,i._color=y,i.left=c,i.right=p,u[l-2]=i,u[l-1]=c,s(p),s(c),s(i),l>=3){var v=u[l-3];v.left===p?v.left=i:v.right=i}break}c._color=y,p.right=o(y,g),p._color=d,l-=1}else if(c.right===i){var g=p.left;if(!g||g._color!==d){if(p._color=d,p.right=c.left,c._color=y,c.left=p,u[l-2]=c,u[l-1]=i,s(p),s(c),l>=3){var v=u[l-3];v.right===p?v.right=c:v.left=c}break}c._color=y,p.left=o(y,g),p._color=d,l-=1}else{var g=p.left;if(!g||g._color!==d){if(c.left=i.right,p._color=d,p.right=i.left,i._color=y,i.right=c,i.left=p,u[l-2]=i,u[l-1]=c,s(p),s(c),s(i),l>=3){var v=u[l-3];v.right===p?v.right=i:v.left=i}break}c._color=y,p.left=o(y,g),p._color=d,l-=1}}return u[0]._color=y,new a(n,u[0])},m.forEach=function(r,t,n){if(this.root)switch(arguments.length){case 1:return u(r,this.root);case 2:return h(t,this._compare,r,this.root);case 3:if(this._compare(t,n)>=0)return;return f(t,n,this._compare,r,this.root)}},Object.defineProperty(m,"begin",{get:function(){for(var r=[],t=this.root;t;)r.push(t),t=t.left;return new l(this,r)}}),Object.defineProperty(m,"end",{get:function(){for(var r=[],t=this.root;t;)r.push(t),t=t.right;return new l(this,r)}}),m.at=function(r){if(0>r)return new l(this,[]);for(var t=this.root,n=[];;){if(n.push(t),t.left){if(r=t.right._count)break;t=t.right}return new l(this,[])},m.ge=function(r){for(var t=this._compare,n=this.root,e=[],i=0;n;){var o=t(r,n.key);e.push(n),0>=o&&(i=e.length),n=0>=o?n.left:n.right}return e.length=i,new l(this,e)},m.gt=function(r){for(var t=this._compare,n=this.root,e=[],i=0;n;){var o=t(r,n.key);e.push(n),0>o&&(i=e.length),n=0>o?n.left:n.right}return e.length=i,new l(this,e)},m.lt=function(r){for(var t=this._compare,n=this.root,e=[],i=0;n;){var o=t(r,n.key);e.push(n),o>0&&(i=e.length),n=0>=o?n.left:n.right}return e.length=i,new l(this,e)},m.le=function(r){for(var t=this._compare,n=this.root,e=[],i=0;n;){var o=t(r,n.key);e.push(n),o>=0&&(i=e.length),n=0>o?n.left:n.right}return e.length=i,new l(this,e)},m.find=function(r){for(var t=this._compare,n=this.root,e=[];n;){var i=t(r,n.key);if(e.push(n),0===i)return new l(this,e);n=0>=i?n.left:n.right}return new l(this,[])},m.remove=function(r){var t=this.find(r);return t?t.remove():this},m.get=function(r){for(var t=this._compare,n=this.root;n;){var e=t(r,n.key);if(0===e)return n.value;n=0>=e?n.left:n.right}};var b=l.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new l(this.tree,this._stack.slice())},b.remove=function(){var r=this._stack;if(0===r.length)return this.tree;var t=new Array(r.length),n=r[r.length-1];t[t.length-1]=new e(n._color,n.key,n.value,n.left,n.right,n._count);for(var i=r.length-2;i>=0;--i){var n=r[i];n.left===r[i+1]?t[i]=new e(n._color,n.key,n.value,t[i+1],n.right,n._count):t[i]=new e(n._color,n.key,n.value,n.left,t[i+1],n._count)}if(n=t[t.length-1],n.left&&n.right){var o=t.length;for(n=n.left;n.right;)t.push(n),n=n.right;var s=t[o-1];t.push(new e(n._color,s.key,s.value,n.left,n.right,n._count)),t[o-1].key=n.key,t[o-1].value=n.value;for(var i=t.length-2;i>=o;--i)n=t[i],t[i]=new e(n._color,n.key,n.value,n.left,t[i+1],n._count);t[o-1].left=t[o]}if(n=t[t.length-1],n._color===d){var u=t[t.length-2];u.left===n?u.left=null:u.right===n&&(u.right=null),t.pop();for(var i=0;i0?this._stack[this._stack.length-1].key:void 0},enumerable:!0}),Object.defineProperty(b,"value",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1].value:void 0},enumerable:!0}),Object.defineProperty(b,"index",{get:function(){var r=0,t=this._stack;if(0===t.length){var n=this.tree.root;return n?n._count:0}t[t.length-1].left&&(r=t[t.length-1].left._count);for(var e=t.length-2;e>=0;--e)t[e+1]===t[e].right&&(++r,t[e].left&&(r+=t[e].left._count));return r},enumerable:!0}),b.next=function(){var r=this._stack;if(0!==r.length){var t=r[r.length-1];if(t.right)for(t=t.right;t;)r.push(t),t=t.left;else for(r.pop();r.length>0&&r[r.length-1].right===t;)t=r[r.length-1],r.pop()}},Object.defineProperty(b,"hasNext",{get:function(){var r=this._stack;if(0===r.length)return!1;if(r[r.length-1].right)return!0;for(var t=r.length-1;t>0;--t)if(r[t-1].left===r[t])return!0;return!1}}),b.update=function(r){var t=this._stack;if(0===t.length)throw new Error("Can't update empty node!");var n=new Array(t.length),i=t[t.length-1];n[n.length-1]=new e(i._color,i.key,r,i.left,i.right,i._count);for(var o=t.length-2;o>=0;--o)i=t[o],i.left===t[o+1]?n[o]=new e(i._color,i.key,i.value,n[o+1],i.right,i._count):n[o]=new e(i._color,i.key,i.value,i.left,n[o+1],i._count);return new a(this.tree._compare,n[0])},b.prev=function(){var r=this._stack;if(0!==r.length){var t=r[r.length-1];if(t.left)for(t=t.left;t;)r.push(t),t=t.right;else for(r.pop();r.length>0&&r[r.length-1].left===t;)t=r[r.length-1],r.pop()}},Object.defineProperty(b,"hasPrev",{get:function(){var r=this._stack;if(0===r.length)return!1;if(r[r.length-1].left)return!0;for(var t=r.length-1;t>0;--t)if(r[t-1].right===r[t])return!0;return!1}})},{}],115:[function(r,t,n){"use strict";function e(r,t,n){this.slabs=r,this.coordinates=t,this.horizontal=n}function i(r,t){return r.y-t}function o(r,t){for(var n=null;r;){var e,i,s=r.key;s[0][0]a)r=r.left;else if(a>0)if(t[0]!==s[1][0])n=r,r=r.right;else{var u=o(r.right,t);if(u)return u;r=r.left}else{if(t[0]!==s[1][0])return r;var u=o(r.right,t);if(u)return u;r=r.left}}return n}function s(r,t,n,e){this.y=r,this.index=t,this.start=n,this.closed=e}function a(r,t,n,e){this.x=r,this.segment=t,this.create=n,this.index=e}function u(r){for(var t=r.length,n=2*t,i=new Array(n),o=0;t>o;++o){var u=r[o],h=u[0][0]o;){for(var d=i[o].x,y=[];n>o;){var m=i[o];if(m.x!==d)break;o+=1,m.segment[0][0]===m.x&&m.segment[1][0]===m.x?m.create&&(m.segment[0][1]t)return-1;var n=(this.slabs[t],o(this.slabs[t],r)),e=-1;if(n&&(e=n.value),this.coordinates[t]===r[0]){var s=null;if(n&&(s=n.key),t>0){var a=o(this.slabs[t-1],r);a&&(s?c(a.key,s)>0&&(s=a.key,e=a.value):(e=a.value,s=a.key))}var u=this.horizontal[t];if(u.length>0){var f=h.ge(u,r[1],i);if(f=u.length)return e;p=u[f]}}if(p.start)if(s){var g=l(s[0],s[1],[r[0],p.y]);s[0][0]>s[1][0]&&(g=-g),g>0&&(e=p.index)}else e=p.index;else p.y!==r[1]&&(e=p.index)}}}return e}},{"./lib/order-segments":113,"binary-search-bounds":111,"functional-red-black-tree":114,"robust-orientation":120}],116:[function(r,t,n){function e(){return!0}function i(r){return function(t,n){var i=r[t];return i?!!i.queryPoint(n,e):!1}}function o(r){for(var t={},n=0;ne)return 1;var i=r[e];if(!i){if(!(e>0&&t[e]===n[0]))return 1;i=r[e-1]}for(var o=1;i;){var s=i.key,a=l(n,s[0],s[1]);if(s[0][0]a)i=i.left;else{if(!(a>0))return 0;o=-1,i=i.right}else if(a>0)i=i.left;else{if(!(0>a))return 0;o=1,i=i.right}}return o}}function a(r){return 1}function u(r){return function(t){return r(t[0],t[1])?0:1}}function h(r,t){return function(n){ return r(n[0],n[1])?0:t(n)}}function f(r){for(var t=r.length,n=[],e=[],i=0;t>i;++i)for(var f=r[i],l=f.length,p=l-1,g=0;l>g;p=g++){var v=f[p],d=f[g];v[0]===d[0]?e.push([v,d]):n.push([v,d])}if(0===n.length)return 0===e.length?a:u(o(e));var y=c(n),m=s(y.slabs,y.coordinates);return 0===e.length?m:h(o(e),m)}t.exports=f;var l=r("robust-orientation")[3],c=r("slab-decomposition"),p=r("interval-tree-1d"),g=r("binary-search-bounds")},{"binary-search-bounds":111,"interval-tree-1d":112,"robust-orientation":120,"slab-decomposition":115}],117:[function(r,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43}],118:[function(r,t,n){arguments[4][44][0].apply(n,arguments)},{dup:44,"two-product":122,"two-sum":117}],119:[function(r,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],120:[function(r,t,n){arguments[4][53][0].apply(n,arguments)},{dup:53,"robust-scale":118,"robust-subtract":119,"robust-sum":121,"two-product":122}],121:[function(r,t,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],122:[function(r,t,n){arguments[4][47][0].apply(n,arguments)},{dup:47}],123:[function(r,t,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],124:[function(r,t,n){"use strict";function e(r,t){for(var n=new Array(r),e=0;r>e;++e)n[e]=t;return n}function i(r){for(var t=new Array(r),n=0;r>n;++n)t[n]=[];return t}function o(r,t){function n(r){for(var n=r.length,e=[0],i=0;n>i;++i){var o=t[r[i]],s=t[r[(i+1)%n]],a=h(-o[0],o[1]),u=h(-o[0],s[1]),l=h(s[0],o[1]),c=h(s[0],s[1]);e=f(e,f(f(a,u),f(l,c)))}return e[e.length-1]>0}function o(r){for(var t=r.length,n=0;t>n;++n)if(!S[r[n]])return!1;return!0}var p=c(r,t);r=p[0],t=p[1];for(var g=t.length,v=(r.length,s(r,t.length)),d=0;g>d;++d)if(v[d].length%2===1)throw new Error("planar-graph-to-polyline: graph must be manifold");var y=a(r,t);y=y.filter(n);for(var m=y.length,b=new Array(m),w=new Array(m),d=0;m>d;++d){b[d]=d;var _=new Array(m),A=y[d].map(function(r){return t[r]}),x=u([A]),E=0;r:for(var j=0;m>j;++j)if(_[j]=0,d!==j){for(var k=y[j],I=k.length,M=0;I>M;++M){var P=x(t[k[M]]);if(0!==P){0>P&&(_[j]=1,E+=1);continue r}}_[j]=1,E+=1}w[d]=[E,d,_]}w.sort(function(r,t){return t[0]-r[0]});for(var d=0;m>d;++d)for(var _=w[d],B=_[1],R=_[2],j=0;m>j;++j)R[j]&&(b[j]=B);for(var T=i(m),d=0;m>d;++d)T[d].push(b[d]),T[b[d]].push(d);for(var U={},S=e(g,!1),d=0;m>d;++d)for(var k=y[d],I=k.length,j=0;I>j;++j){var L=k[j],V=k[(j+1)%I],N=Math.min(L,V)+":"+Math.max(L,V);if(N in U){var F=U[N];T[F].push(d),T[d].push(F),S[L]=S[V]=!0}else U[N]=d}for(var O=[],C=e(m,-1),d=0;m>d;++d)b[d]!==d||o(y[d])?C[d]=-1:(O.push(d),C[d]=0);for(var p=[];O.length>0;){var q=O.pop(),D=T[q];l(D,function(r,t){return r-t});var Y,z=D.length,G=C[q];if(0===G){var k=y[q];Y=[k]}for(var d=0;z>d;++d){var H=D[d];if(!(C[H]>=0)&&(C[H]=1^G,O.push(H),0===G)){var k=y[H];o(k)||(k.reverse(),Y.push(k))}}0===G&&p.push(Y)}return p}t.exports=o;var s=r("edges-to-adjacency-list"),a=r("planar-dual"),u=r("point-in-big-polygon"),h=r("two-product"),f=r("robust-sum"),l=r("uniq"),c=r("./lib/trim-leaves")},{"./lib/trim-leaves":103,"edges-to-adjacency-list":104,"planar-dual":105,"point-in-big-polygon":116,"robust-sum":121,"two-product":122,uniq:123}],125:[function(r,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43}],126:[function(r,t,n){arguments[4][44][0].apply(n,arguments)},{dup:44,"two-product":129,"two-sum":125}],127:[function(r,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],128:[function(r,t,n){arguments[4][46][0].apply(n,arguments)},{dup:46}],129:[function(r,t,n){arguments[4][47][0].apply(n,arguments)},{dup:47}],130:[function(r,t,n){arguments[4][53][0].apply(n,arguments)},{dup:53,"robust-scale":126,"robust-subtract":127,"robust-sum":128,"two-product":129}],131:[function(r,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],132:[function(r,t,n){"use strict";"use restrict";function e(r){this.roots=new Array(r),this.ranks=new Array(r);for(var t=0;r>t;++t)this.roots[t]=t,this.ranks[t]=0}t.exports=e,e.prototype.length=function(){return this.roots.length},e.prototype.makeSet=function(){var r=this.roots.length;return this.roots.push(r),this.ranks.push(0),r},e.prototype.find=function(r){for(var t=this.roots;t[r]!==r;){var n=t[r];t[r]=t[n],r=n}return r},e.prototype.link=function(r,t){var n=this.find(r),e=this.find(t);if(n!==e){var i=this.ranks,o=this.roots,s=i[n],a=i[e];a>s?o[n]=e:s>a?o[e]=n:(o[e]=n,++i[n])}}},{}],133:[function(r,t,n){"use strict";"use restrict";function e(r){for(var t=0,n=Math.max,e=0,i=r.length;i>e;++e)t=n(t,r[e].length);return t-1}function i(r){for(var t=-1,n=Math.max,e=0,i=r.length;i>e;++e)for(var o=r[e],s=0,a=o.length;a>s;++s)t=n(t,o[s]);return t+1}function o(r){for(var t=new Array(r.length),n=0,e=r.length;e>n;++n)t[n]=r[n].slice(0);return t}function s(r,t){var n=r.length,e=r.length-t.length,i=Math.min;if(e)return e;switch(n){case 0:return 0;case 1:return r[0]-t[0];case 2:var o=r[0]+r[1]-t[0]-t[1];return o?o:i(r[0],r[1])-i(t[0],t[1]);case 3:var s=r[0]+r[1],a=t[0]+t[1];if(o=s+r[2]-(a+t[2]))return o;var u=i(r[0],r[1]),h=i(t[0],t[1]),o=i(u,r[2])-i(h,t[2]);return o?o:i(u+r[2],s)-i(h+t[2],a);default:var f=r.slice(0);f.sort();var l=t.slice(0);l.sort();for(var c=0;n>c;++c)if(e=f[c]-l[c])return e;return 0}}function a(r,t){return s(r[0],t[0])}function u(r,t){if(t){for(var n=r.length,e=new Array(n),i=0;n>i;++i)e[i]=[r[i],t[i]];e.sort(a);for(var i=0;n>i;++i)r[i]=e[i][0],t[i]=e[i][1];return r}return r.sort(s),r}function h(r){if(0===r.length)return[];for(var t=1,n=r.length,e=1;n>e;++e){var i=r[e];if(s(i,r[e-1])){if(e===t){t++;continue}r[t++]=i}}return r.length=t,r}function f(r,t){for(var n=0,e=r.length-1,i=-1;e>=n;){var o=n+e>>1,a=s(r[o],t);0>=a?(0===a&&(i=o),n=o+1):a>0&&(e=o-1)}return i}function l(r,t){for(var n=new Array(r.length),e=0,i=n.length;i>e;++e)n[e]=[];for(var o=[],e=0,a=t.length;a>e;++e)for(var u=t[e],h=u.length,l=1,c=1<l;++l){o.length=b.popCount(l);for(var p=0,g=0;h>g;++g)l&1<v))for(;;)if(n[v++].push(e),v>=r.length||0!==s(r[v],o))break}return n}function c(r,t){if(!t)return l(h(g(r,0)),r,0);for(var n=new Array(t),e=0;t>e;++e)n[e]=[];for(var e=0,i=r.length;i>e;++e)for(var o=r[e],s=0,a=o.length;a>s;++s)n[o[s]].push(e);return n}function p(r){for(var t=[],n=0,e=r.length;e>n;++n)for(var i=r[n],o=0|i.length,s=1,a=1<s;++s){for(var h=[],f=0;o>f;++f)s>>>f&1&&h.push(i[f]);t.push(h)}return u(t)}function g(r,t){if(0>t)return[];for(var n=[],e=(1<n;++n)for(var i=r[n],o=0,s=i.length;s>o;++o){for(var a=new Array(i.length-1),h=0,f=0;s>h;++h)h!==o&&(a[f++]=i[h]);t.push(a)}return u(t)}function d(r,t){for(var n=new w(t),e=0;en||0>i?1/0:e(t[r],t[n],t[i])}function o(r,t){var n=j[r],e=j[t];j[r]=e,j[t]=n,k[n]=t,k[e]=r}function a(r){return b[j[r]]}function u(r){return 1&r?r-1>>1:(r>>1)-1}function h(r){for(var t=a(r);;){var n=t,e=2*r+1,i=2*(r+1),s=r;if(M>e){var u=a(e);n>u&&(s=e,n=u)}if(M>i){var h=a(i);n>h&&(s=i)}if(s===r)return r;o(r,s),r=s}}function f(r){for(var t=a(r);r>0;){var n=u(r);if(n>=0){var e=a(n);if(e>t){o(r,n),r=n;continue}}return r}}function l(){if(M>0){var r=j[0];return o(0,M-1),M-=1,h(0),r}return-1}function c(r,t){var n=j[r];return b[n]===t?r:(b[n]=-(1/0),f(r),l(),b[n]=t,M+=1,f(M-1))}function p(r){if(!w[r]){w[r]=!0;var t=y[r],n=m[r];y[n]>=0&&(y[n]=t),m[t]>=0&&(m[t]=n),k[t]>=0&&c(k[t],i(t)),k[n]>=0&&c(k[n],i(n))}}function g(r,t){if(r[t]<0)return t;var n=t,e=t;do{var i=r[e];if(!w[e]||0>i||i===e)break;if(e=i,i=r[e],!w[e]||0>i||i===e)break;e=i,n=r[n]}while(n!==e);for(var o=t;o!==e;o=r[o])r[o]=e;return e}for(var v=t.length,d=r.length,y=new Array(v),m=new Array(v),b=new Array(v),w=new Array(v),_=0;v>_;++_)y[_]=m[_]=-1,b[_]=1/0,w[_]=!1;for(var _=0;d>_;++_){var A=r[_];if(2!==A.length)throw new Error("Input must be a graph");var x=A[1],E=A[0];-1!==m[E]?m[E]=-2:m[E]=x,-1!==y[x]?y[x]=-2:y[x]=E}for(var j=[],k=new Array(v),_=0;v>_;++_){var I=b[_]=i(_);1/0>I?(k[_]=j.length,j.push(_)):k[_]=-1}for(var M=j.length,_=M>>1;_>=0;--_)h(_);for(;;){var P=l();if(0>P||b[P]>n)break;p(P)}for(var B=[],_=0;v>_;++_)w[_]||(k[_]=B.length,B.push(t[_].slice()));var R=(B.length,[]);return r.forEach(function(r){var t=g(y,r[0]),n=g(m,r[1]);if(t>=0&&n>=0&&t!==n){var e=k[t],i=k[n];e!==i&&R.push([e,i])}}),s.unique(s.normalize(R)),{positions:B,edges:R}}t.exports=i;var o=r("robust-orientation"),s=r("simplicial-complex")},{"robust-orientation":130,"simplicial-complex":133}],135:[function(r,t,n){"use strict";function e(r){return"a"+r}function i(r){return"d"+r}function o(r,t){return"c"+r+"_"+t}function s(r){return"s"+r}function a(r,t){return"t"+r+"_"+t}function u(r){return"o"+r}function h(r){return"x"+r}function f(r){return"p"+r}function l(r,t){return"d"+r+"_"+t}function c(r){return"i"+r}function p(r,t){return"u"+r+"_"+t}function g(r){return"b"+r}function v(r){return"y"+r}function d(r){return"e"+r}function y(r){return"v"+r}function m(r,t,n){for(var e=0,i=0;r>i;++i)t&1<t;++t)F.push(f(t),"+=",p(t,w[r]),";");F.push("}")}function R(r){for(var t=r-1;t>=0;--t)P(t,0);for(var n=[],t=0;L>t;++t)M[t]?n.push(i(t)+".get("+f(t)+")"):n.push(i(t)+"["+f(t)+"]");for(var t=0;b>t;++t)n.push(h(t));F.push(x,"[",k,"++]=phase(",n.join(),");");for(var t=0;r>t;++t)B(t);for(var e=0;L>e;++e)F.push(f(e),"+=",p(e,w[r]),";")}function T(r){for(var t=0;L>t;++t)M[t]?F.push(o(t,0),"=",i(t),".get(",f(t),");"):F.push(o(t,0),"=",i(t),"[",f(t),"];");for(var n=[],t=0;L>t;++t)n.push(o(t,0));for(var t=0;b>t;++t)n.push(h(t));F.push(g(0),"=",x,"[",k,"]=phase(",n.join(),");");for(var e=1;1<e;++e)F.push(g(e),"=",x,"[",k,"+",d(e),"];");for(var s=[],e=1;1<e;++e)s.push("("+g(0)+"!=="+g(e)+")");F.push("if(",s.join("||"),"){");for(var a=[],t=0;V>t;++t)a.push(c(t));for(var t=0;L>t;++t){a.push(o(t,0));for(var e=1;1<e;++e)M[t]?F.push(o(t,e),"=",i(t),".get(",f(t),"+",l(t,e),");"):F.push(o(t,e),"=",i(t),"[",f(t),"+",l(t,e),"];"),a.push(o(t,e))}for(var t=0;1<t;++t)a.push(g(t));for(var t=0;b>t;++t)a.push(h(t));F.push("vertex(",a.join(),");",y(0),"=",A,"[",k,"]=",E,"++;");for(var u=(1<e;++e)if(0===(r&~(1<0;_=_-1&v)w.push(A+"["+k+"+"+d(_)+"]");w.push(y(0));for(var _=0;L>_;++_)1&e?w.push(o(_,u),o(_,v)):w.push(o(_,v),o(_,u));1&e?w.push(p,m):w.push(m,p);for(var _=0;b>_;++_)w.push(h(_));F.push("if(",p,"!==",m,"){","face(",w.join(),")}")}F.push("}",k,"+=1;")}function U(){for(var r=1;1<r;++r)F.push(I,"=",d(r),";",d(r),"=",v(r),";",v(r),"=",I,";")}function S(r,t){if(0>r)return void T(t);R(r),F.push("if(",s(w[r]),">0){",c(w[r]),"=1;"),S(r-1,t|1<n;++n)F.push(f(n),"+=",p(n,w[r]),";");r===V-1&&(F.push(k,"=0;"),U()),P(r,2),S(r-1,t),r===V-1&&(F.push("if(",c(w[V-1]),"&1){",k,"=0;}"),U()),B(r),F.push("}")}var L=M.length,V=w.length;if(2>V)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var N="extractContour"+w.join("_"),F=[],O=[],C=[],q=0;L>q;++q)C.push(e(q));for(var q=0;b>q;++q)C.push(h(q));for(var q=0;V>q;++q)O.push(s(q)+"="+e(0)+".shape["+q+"]|0");for(var q=0;L>q;++q){O.push(i(q)+"="+e(q)+".data",u(q)+"="+e(q)+".offset|0");for(var D=0;V>D;++D)O.push(a(q,D)+"="+e(q)+".stride["+D+"]|0")}for(var q=0;L>q;++q){O.push(f(q)+"="+u(q)),O.push(o(q,0));for(var D=1;1<D;++D){for(var Y=[],z=0;V>z;++z)D&1<q;++q)for(var D=0;V>D;++D){var G=[a(q,w[D])];D>0&&G.push(a(q,w[D-1])+"*"+s(w[D-1])),O.push(p(q,w[D])+"=("+G.join("-")+")|0")}for(var q=0;V>q;++q)O.push(c(q)+"=0");O.push(E+"=0");for(var H=["2"],q=V-2;q>=0;--q)H.push(s(w[q]));O.push(j+"=("+H.join("*")+")|0",x+"=mallocUint32("+j+")",A+"=mallocUint32("+j+")",k+"=0"),O.push(g(0)+"=0");for(var D=1;1<D;++D){for(var W=[],Q=[],z=0;V>z;++z)D&1<e&&t("Must have at least one array argument");var i=r.scalarArguments||0;0>i&&t("Scalar arg count must be > 0"),"function"!=typeof r.vertex&&t("Must specify vertex creation function"),"function"!=typeof r.cell&&t("Must specify cell creation function"),"function"!=typeof r.phase&&t("Must specify phase function");for(var o=r.getters||[],s=new Array(e),a=0;e>a;++a)o.indexOf(a)>=0?s[a]=!0:s[a]=!1;return b(r.vertex,r.cell,r.phase,i,n,s)}var _=r("typedarray-pool");t.exports=w;var A="V",x="P",E="N",j="Q",k="X",I="T"},{"typedarray-pool":138}],136:[function(r,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],137:[function(r,t,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],138:[function(r,t,n){arguments[4][17][0].apply(n,arguments)},{"bit-twiddle":136,buffer:2,dup:17}],139:[function(r,t,n){function e(r){if(0>r)return Number("0/0");for(var t=a[0],n=a.length-1;n>0;--n)t+=a[n]/(r+n);var e=r+s+.5;return.5*Math.log(2*Math.PI)+(r+.5)*Math.log(e)-e+Math.log(t)-Math.log(r)}var i=7,o=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],s=607/128,a=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];t.exports=function u(r){if(.5>r)return Math.PI/(Math.sin(Math.PI*r)*u(1-r));if(r>100)return Math.exp(e(r));r-=1;for(var t=o[0],n=1;i+2>n;n++)t+=o[n]/(r+n);var s=r+i+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,r+.5)*Math.exp(-s)*t},t.exports.log=e},{}],140:[function(r,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],141:[function(r,t,n){arguments[4][16][0].apply(n,arguments)},{dup:16}],142:[function(r,t,n){arguments[4][17][0].apply(n,arguments)},{"bit-twiddle":140,buffer:2,dup:17}],143:[function(r,t,n){"use strict";function e(r){var t=r.length;if(i>t){for(var n=1,e=0;t>e;++e)for(var s=0;e>s;++s)if(r[e]e;++e)a[e]=0;for(var n=1,e=0;t>e;++e)if(!a[e]){var u=1;a[e]=1;for(var s=r[e];s!==e;s=r[s]){if(a[s])return o.freeUint8(a),0;u+=1,a[s]=1}1&u||(n=-n)}return o.freeUint8(a),n}t.exports=e;var i=32,o=r("typedarray-pool")},{"typedarray-pool":142}],144:[function(r,t,n){"use strict";function e(r){var t=r.length;switch(t){case 0:case 1:return 0;case 2:return r[1]}var n,e,i,a=o.mallocUint32(t),u=o.mallocUint32(t),h=0;for(s(r,u),i=0;t>i;++i)a[i]=r[i];for(i=t-1;i>0;--i)e=u[i],n=a[i],a[i]=a[e],a[e]=n,u[i]=u[n],u[n]=e,h=(h+n)*i;return o.freeUint32(u),o.freeUint32(a),h}function i(r,t,n){switch(r){case 0:return n?n:[];case 1:return n?(n[0]=0,n):[0];case 2:return n?(t?(n[0]=0,n[1]=1):(n[0]=1,n[1]=0),n):t?[0,1]:[1,0]}n=n||new Array(r);var e,i,o,s=1;for(n[0]=0,o=1;r>o;++o)n[o]=o,s=s*o|0;for(o=r-1;o>0;--o)e=t/s|0,t=t-e*s|0,s=s/o|0,i=0|n[o],n[o]=0|n[e],n[e]=0|i;return n}var o=r("typedarray-pool"),s=r("invert-permutation");n.rank=e,n.unrank=i},{"invert-permutation":145,"typedarray-pool":148}],145:[function(r,t,n){"use strict";function e(r,t){t=t||new Array(r.length);for(var n=0;nr)return[];if(0===r)return[[0]];for(var t=0|Math.round(s(r+1)),n=[],e=0;t>e;++e){for(var a=i.unrank(r,e),u=[0],h=0,f=0;f= 0) !== (_inline_1_db >= 0)) {\n _inline_1_arg2_.push(_inline_1_arg4_[0] + 0.5 + 0.5 * (_inline_1_da + _inline_1_db) / (_inline_1_da - _inline_1_db))\n }\n }",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg3_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":151}],151:[function(r,t,n){arguments[4][8][0].apply(n,arguments)},{"./lib/thunk.js":153,dup:8}],152:[function(r,t,n){arguments[4][9][0].apply(n,arguments)},{dup:9,uniq:154}],153:[function(r,t,n){arguments[4][10][0].apply(n,arguments)},{"./compile.js":152,dup:10}],154:[function(r,t,n){arguments[4][11][0].apply(n,arguments)},{dup:11}],155:[function(r,t,n){"use strict";function e(r,t){var n=[];return t=+t||0,i(r.hi(r.shape[0]-1),n,t),n}t.exports=e;var i=r("./lib/zc-core")},{"./lib/zc-core":150}],156:[function(r,t,n){"use strict";function e(r,t){var n=r.length,e=["'use strict';"],i="surfaceNets"+r.join("_")+"d"+t;e.push("var contour=genContour({","order:[",r.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===t&&e.push("getters:[0],");for(var o=[],u=[],h=0;n>h;++h)o.push("d"+h),u.push("d"+h);for(var h=0;1<h;++h)o.push("v"+h),u.push("v"+h);for(var h=0;1<h;++h)o.push("p"+h),u.push("p"+h);o.push("a","b","c"),u.push("a","c"),e.push("vertex:function vertexFunc(",o.join(),"){");for(var f=[],h=0;1<h;++h)f.push("(p"+h+"<<"+h+")");e.push("var m=(",f.join("+"),")|0;if(m===0||m===",(1<<(1<=1<<(1<>>7){");for(var h=0;1<<(1<h;++h){if(1<<(1<128&&h%128===0){l.length>0&&c.push("}}");var p="vExtra"+l.length;e.push("case ",h>>>7,":",p,"(m&0x7f,",u.join(),");break;"),c=["function ",p,"(m,",u.join(),"){switch(m){"],l.push(c)}c.push("case ",127&h,":");for(var g=new Array(n),v=new Array(n),d=new Array(n),y=new Array(n),m=0,b=0;n>b;++b)g[b]=[],v[b]=[],d[b]=0,y[b]=0;for(var b=0;1<b;++b)for(var w=0;n>w;++w){var _=b^1<b)&&!(h&1<<_)!=!(h&1<A?(g[w].push("-v"+b+"-v"+_),d[w]+=2):(g[w].push("v"+b+"+v"+_),d[w]-=2),m+=1;for(var x=0;n>x;++x)x!==w&&(_&1<w;++w)if(0===g[w].length)E.push("d"+w+"-0.5");else{var j="";d[w]<0?j=d[w]+"*c":d[w]>0&&(j="+"+d[w]+"*c");var k=.5*(g[w].length/m),I=.5+.5*(y[w]/m);E.push("d"+w+"-"+I+"-"+k+"*("+g[w].join("+")+j+")/("+v[w].join("+")+")")}c.push("a.push([",E.join(),"]);","break;")}e.push("}},"),l.length>0&&c.push("}}");for(var M=[],h=0;1<h;++h)M.push("v"+h);M.push("c0","c1","p0","p1","a","b","c"),e.push("cell:function cellFunc(",M.join(),"){");var P=a(n-1);e.push("if(p0){b.push(",P.map(function(r){return"["+r.map(function(r){return"v"+r})+"]"}).join(),")}else{b.push(",P.map(function(r){var t=r.slice();return t.reverse(),"["+t.map(function(r){return"v"+r})+"]"}).join(),")}}});function ",i,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",i,";");for(var h=0;hs;++s)i[s]=[n[s]],o[s]=[s];return{positions:i,cells:o}}function o(r,t){if(r.dimension<=0)return{positions:[],cells:[]};if(1===r.dimension)return i(r,t);var n=r.order.join()+"-"+r.dtype,o=h[n],t=+t||0;return o||(o=h[n]=e(r.order,r.dtype)),o(r,t)}t.exports=o;var s=r("ndarray-extract-contour"),a=r("triangulate-hypercube"),u=r("zero-crossings"),h={}},{"ndarray-extract-contour":135,"triangulate-hypercube":149,"zero-crossings":155}]},{},[1]);