Skip to content

Instantly share code, notes, and snippets.

@mauriciopoppe
Created October 14, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauriciopoppe/9c33dc4bff4f15df5c56 to your computer and use it in GitHub Desktop.
Save mauriciopoppe/9c33dc4bff4f15df5c56 to your computer and use it in GitHub Desktop.
requirebin sketch
var Interval = require('interval-arithmetic')
var nextafter = require('nextafter')
var a = Interval(3, nextafter(5, -Infinity))
var b = Interval(4, 6)
console.log(Interval.intersection(a, b))
console.log(Interval.union(a, b))
console.log(Interval.difference(a, b))
console.log(Interval.difference(b, a))
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}if(length>0&&length<=Buffer.poolSize)buf.parent=rootParent;return buf}function SlowBuffer(subject,encoding,noZero){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding,noZero);var buf=new Buffer(subject,encoding,noZero);delete buf.parent;return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).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 true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length,2);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;if(length<0||offset<0||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i]&127)}return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}}if(newBuf.length)newBuf.parent=this.parent||this;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;return val};Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256))val+=this[offset+--byteLength]*mul;return val};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256))val+=this[offset+--i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(target_start>=target.length)target_start=target.length;if(!target_start)target_start=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||source.length===0)return 0;if(target_start<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=source.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}return len};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new RangeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUIntLE=BP.readUIntLE;arr.readUIntBE=BP.readUIntBE;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readIntLE=BP.readIntLE;arr.readIntBE=BP.readIntBE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUIntLE=BP.writeUIntLE;arr.writeUIntBE=BP.writeUIntBE;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeIntLE=BP.writeIntLE;arr.writeIntBE=BP.writeIntBE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z\-]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){var codePoint,length=string.length;var leadSurrogate=null;units=units||Infinity;var bytes=[];var i=0;for(;i<length;i++){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}else{leadSurrogate=codePoint;continue}}}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=null}if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<2097152){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length,unitSize){if(unitSize)length-=length%unitSize;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":2,ieee754:3,"is-array":4}],2:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);var PLUS_URL_SAFE="-".charCodeAt(0);var SLASH_URL_SAFE="_".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS||code===PLUS_URL_SAFE)return 62;if(code===SLASH||code===SLASH_URL_SAFE)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],3:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],4:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],5:[function(require,module,exports){"use strict";var Interval=require("./interval");var piLow=(3373259426+273688/(1<<21))/(1<<30);var piHigh=(3373259426+273689/(1<<21))/(1<<30);var constants={};constants.PI_LOW=piLow;constants.PI_HIGH=piHigh;constants.PI_HALF_LOW=piLow/2;constants.PI_HALF_HIGH=piHigh/2;constants.PI_TWICE_LOW=piLow*2;constants.PI_TWICE_HIGH=piHigh*2;function getter(property,fn){Object.defineProperty(constants,property,{get:function(){return fn()},enumerable:true})}getter("PI",function(){return Interval(piLow,piHigh)});getter("PI_HALF",function(){return Interval(constants.PI_HALF_LOW,constants.PI_HALF_HIGH)});getter("PI_TWICE",function(){return Interval(constants.PI_TWICE_LOW,constants.PI_TWICE_HIGH)});getter("ZERO",function(){return Interval(0)});getter("ONE",function(){return Interval(1)});getter("WHOLE",function(){return Interval().setWhole()});getter("EMPTY",function(){return Interval().setEmpty()});module.exports=constants},{"./interval":6}],6:[function(require,module,exports){"use strict";var utils=require("./operations/utils");var rmath=require("./round-math");module.exports=Interval;function Interval(lo,hi){if(!(this instanceof Interval)){return new Interval(lo,hi)}function isValidNumber(v){return typeof v==="number"&&!isNaN(v)}if(typeof lo!=="undefined"&&typeof hi!=="undefined"){if(utils.isInterval(lo)){if(!utils.isSingleton(lo)){throw new TypeError("Interval: interval `lo` must be a singleton")}lo=lo.lo}if(utils.isInterval(hi)){if(!utils.isSingleton(hi)){throw TypeError("Interval: interval `hi` must be a singleton")}hi=hi.hi}}else if(typeof lo!=="undefined"){if(Array.isArray(lo)){return Interval(lo[0],lo[1])}return Interval(lo,lo)}else{lo=hi=0}if(!isValidNumber(lo)||!isValidNumber(hi)){throw TypeError("Interval: parameters must be numbers")}this.set(lo,hi)}Interval.factory=Interval;Interval.prototype.singleton=function(v){return this.set(v,v)};Interval.prototype.bounded=function(lo,hi){return this.set(rmath.prev(lo),rmath.next(hi))};Interval.prototype.boundedSingleton=function(v){return this.bounded(v,v)};Interval.prototype.set=function(lo,hi){this.lo=lo;this.hi=hi;return this};Interval.prototype.assign=function(lo,hi){if(isNaN(lo)||isNaN(hi)||lo>hi){return this.setEmpty()}return this.set(lo,hi)};Interval.prototype.setEmpty=function(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)};Interval.prototype.setWhole=function(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)};Interval.prototype.toArray=function(){return[this.lo,this.hi]};Interval.prototype.clone=function(){return Interval(this.lo,this.hi)}},{"./operations/utils":13,"./round-math":15}],7:[function(require,module,exports){"use strict";var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var arithmetic=require("./arithmetic");var constants=require("../constants");var algebra={};algebra.fmod=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}var yb=x.lo<0?y.lo:y.hi;var n=rmath.intLo(rmath.divLo(x.lo,yb));return arithmetic.sub(x,arithmetic.mul(y,Interval(n,n)))};algebra.multiplicativeInverse=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(utils.zeroIn(x)){if(x.lo!==0){if(x.hi!==0){return constants.WHOLE;
}else{return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(1,x.lo))}}else{if(x.hi!==0){return Interval(rmath.divLo(1,x.hi),Number.POSITIVE_INFINITY)}else{return constants.EMPTY}}}else{return Interval(rmath.divLo(1,x.hi),rmath.divHi(1,x.lo))}};algebra.pow=function(x,power){if(utils.isEmpty(x)){return constants.EMPTY}if(typeof power==="object"){if(!utils.isSingleton(power)){return constants.EMPTY}power=power.lo}if(power===0){if(x.lo===0&&x.hi===0){return constants.EMPTY}else{return constants.ONE}}else if(power<0){return algebra.multiplicativeInverse(algebra.pow(x,-power))}if(x.hi<0){var yl=rmath.powLo(-x.hi,power);var yh=rmath.powHi(-x.lo,power);if(power&1){return Interval(-yh,-yl)}else{return Interval(yl,yh)}}else if(x.lo<0){if(power&1){return Interval(-rmath.powLo(-x.lo,power),rmath.powHi(x.hi,power))}else{return Interval(0,rmath.powHi(Math.max(-x.lo,x.hi),power))}}else{return Interval(rmath.powLo(x.lo,power),rmath.powHi(x.hi,power))}};algebra.sqrt=function(x){if(utils.isEmpty(x)||x.hi<0){return constants.EMPTY}var t=x.lo<=0?0:rmath.sqrtLo(x.lo);return Interval(t,rmath.sqrtHi(x.hi))};module.exports=algebra},{"../constants":5,"../interval":6,"../round-math":15,"./arithmetic":8,"./utils":13}],8:[function(require,module,exports){"use strict";var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var constants=require("../constants");var division=require("./division");var arithmetic={};arithmetic.add=function(a,b){return Interval(rmath.addLo(a.lo,b.lo),rmath.addHi(a.hi,b.hi))};arithmetic.sub=function(a,b){return Interval(rmath.subLo(a.lo,b.hi),rmath.subHi(a.hi,b.lo))};arithmetic.mul=function(a,b){if(utils.isEmpty(a)||utils.isEmpty(b)){return constants.EMPTY}var al=a.lo;var ah=a.hi;var bl=b.lo;var bh=b.hi;var out=Interval();if(al<0){if(ah>0){if(bl<0){if(bh>0){out.lo=Math.min(rmath.mulLo(al,bh),rmath.mulLo(ah,bl));out.hi=Math.max(rmath.mulHi(al,bl),rmath.mulHi(ah,bh))}else{out.lo=rmath.mulLo(ah,bl);out.hi=rmath.mulHi(al,bl)}}else{if(bh>0){out.lo=rmath.mulLo(al,bh);out.hi=rmath.mulHi(ah,bh)}else{out.lo=0;out.hi=0}}}else{if(bl<0){if(bh>0){out.lo=rmath.mulLo(al,bh);out.hi=rmath.mulHi(al,bl)}else{out.lo=rmath.mulLo(ah,bh);out.hi=rmath.mulHi(al,bl)}}else{if(bh>0){out.lo=rmath.mulLo(al,bh);out.hi=rmath.mulHi(ah,bl)}else{out.lo=0;out.hi=0}}}}else{if(ah>0){if(bl<0){if(bh>0){out.lo=rmath.mulLo(ah,bl);out.hi=rmath.mulHi(ah,bh)}else{out.lo=rmath.mulLo(ah,bl);out.hi=rmath.mulHi(al,bh)}}else{if(bh>0){out.lo=rmath.mulLo(al,bl);out.hi=rmath.mulHi(ah,bh)}else{out.lo=0;out.hi=0}}}else{out.lo=0;out.hi=0}}return out};arithmetic.div=function(a,b){if(utils.isEmpty(a)||utils.isEmpty(b)){return constants.EMPTY}if(utils.zeroIn(b)){if(b.lo!==0){if(b.hi!==0){return division.zero(a)}else{return division.negative(a,b.lo)}}else{if(b.hi!==0){return division.positive(a,b.hi)}else{return constants.EMPTY}}}else{return division.nonZero(a,b)}};arithmetic.positive=function(a){return Interval(a.lo,a.hi)};arithmetic.negative=function(a){return Interval(-a.hi,-a.lo)};module.exports=arithmetic},{"../constants":5,"../interval":6,"../round-math":15,"./division":9,"./utils":13}],9:[function(require,module,exports){"use strict";var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var constants=require("../constants");var division={nonZero:function(x,y){var xl=x.lo;var xh=x.hi;var yl=y.lo;var yh=y.hi;var out=Interval();if(xh<0){if(yh<0){out.lo=rmath.divLo(xh,yl);out.hi=rmath.divHi(xl,yh)}else{out.lo=rmath.divLo(xl,yl);out.hi=rmath.divHi(xh,yh)}}else if(xl<0){if(yh<0){out.lo=rmath.divLo(xh,yh);out.hi=rmath.divHi(xl,yh)}else{out.lo=rmath.divLo(xl,yl);out.hi=rmath.divHi(xh,yl)}}else{if(yh<0){out.lo=rmath.divLo(xh,yh);out.hi=rmath.divHi(xl,yl)}else{out.lo=rmath.divLo(xl,yh);out.hi=rmath.divHi(xh,yl)}}return out},positive:function(x,v){if(x.lo===0&&x.hi===0){return x}if(utils.zeroIn(x)){return constants.WHOLE}if(x.hi<0){return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(x.hi,v))}else{return Interval(rmath.divLo(x.lo,v),Number.POSITIVE_INFINITY)}},negative:function(x,v){if(x.lo===0&&x.hi===0){return x}if(utils.zeroIn(x)){return constants.WHOLE}if(x.hi<0){return Interval(rmath.divLo(x.hi,v),Number.POSITIVE_INFINITY)}else{return Interval(Number.NEGATIVE_INFINITY,rmath.divHi(x.lo,v))}},zero:function(x){if(x.lo===0&&x.hi===0){return x}return constants.WHOLE}};module.exports=division},{"../constants":5,"../interval":6,"../round-math":15,"./utils":13}],10:[function(require,module,exports){"use strict";var constants=require("../constants");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var arithmetic=require("./arithmetic");var misc={};misc.exp=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.expLo(x.lo),rmath.expHi(x.hi))};misc.log=function(x){if(utils.isEmpty(x)){return constants.EMPTY}var l=x.lo<=0?Number.NEGATIVE_INFINITY:rmath.logLo(x.lo);return Interval(l,rmath.logHi(x.hi))};misc.ln=misc.log;misc.LOG_EXP_10=misc.log(Interval(10,10));misc.log10=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return arithmetic.div(misc.log(x),misc.LOG_EXP_10)};misc.LOG_EXP_2=misc.log(Interval(2,2));misc.log2=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return arithmetic.div(misc.log(x),misc.LOG_EXP_2)};misc.hull=function(x,y){var badX=utils.isEmpty(x);var badY=utils.isEmpty(y);if(badX){if(badY){return constants.EMPTY}else{return y.clone()}}else{if(badY){return x.clone()}else{return Interval(Math.min(x.lo,y.lo),Math.max(x.hi,y.hi))}}};misc.intersection=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}var lo=Math.max(x.lo,y.lo);var hi=Math.min(x.hi,y.hi);if(lo<=hi){return Interval(lo,hi)}return constants.EMPTY};misc.union=function(x,y){if(!utils.intervalsOverlap(x,y)){throw TypeError("Interval.union: intervals do not overlap")}return Interval(Math.min(x.lo,y.lo),Math.max(x.hi,y.hi))};misc.difference=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return constants.EMPTY}if(utils.intervalsOverlap(x,y)){if(x.lo<y.lo&&y.hi<x.hi){throw TypeError("Interval.difference: difference creates multiple intervals")}if(y.lo<x.lo){return Interval(rmath.next(y.hi),x.hi)}if(y.hi>x.hi){return Interval(x.lo,rmath.prev(y.lo))}}return Interval.clone(x)};misc.width=function(x){if(utils.isEmpty(x)){return 0}return rmath.subHi(x.hi,x.lo)};misc.abs=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.lo>=0){return Interval.clone(x)}if(x.hi<=0){return arithmetic.negative(x)}return Interval(0,Math.max(-x.lo,x.hi))};misc.max=function(x,y){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(Math.max(x.lo,y.lo),Math.max(x.hi,y.hi))};misc.min=function(x,y){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(Math.min(x.lo,y.lo),Math.min(x.hi,y.hi))};misc.clone=function(x){return Interval().set(x.lo,x.hi)};module.exports=misc},{"../constants":5,"../interval":6,"../round-math":15,"./arithmetic":8,"./utils":13}],11:[function(require,module,exports){"use strict";var utils=require("./utils");var relational={};relational.equal=function(x,y){if(utils.isEmpty(x)){return utils.isEmpty(y)}return!utils.isEmpty(y)&&x.lo===y.lo&&x.hi===y.hi};relational.almostEqual=function(x,y){var EPS=1e-7;function assert(a,message){if(!a){throw new Error(message||"assertion failed")}}function assertEps(a,b){assert(Math.abs(a-b)<EPS)}x=Array.isArray(x)?x:x.toArray();y=Array.isArray(y)?y:y.toArray();assertEps(x[0],y[0]);assertEps(x[1],y[1]);assert(x[0]<=x[1],"interval must not be.isEmpty")};relational.notEqual=function(x,y){if(utils.isEmpty(x)){return!utils.isEmpty(y)}return utils.isEmpty(y)||x.hi<y.lo||x.lo>y.hi};relational.lt=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.hi<y.lo};relational.gt=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.lo>y.hi};relational.leq=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.hi<=y.lo};relational.geq=function(x,y){if(utils.isEmpty(x)||utils.isEmpty(y)){return false}return x.lo>=y.hi};module.exports=relational},{"./utils":13}],12:[function(require,module,exports){"use strict";var constants=require("../constants");var Interval=require("../interval");var rmath=require("../round-math");var utils=require("./utils");var misc=require("./misc");var algebra=require("./algebra");var arithmetic=require("./arithmetic");var trigonometric={};trigonometric.cos=function(x){var rlo,rhi;if(utils.isEmpty(x)){return constants.EMPTY}if(x.lo<0){var mult=1e7;x.lo+=2*Math.PI*mult;x.hi+=2*Math.PI*mult}var pi2=constants.PI_TWICE;var t=algebra.fmod(x,pi2);if(misc.width(t)>=pi2.lo){return Interval(-1,1)}if(t.lo>=constants.PI_HIGH){var cos=trigonometric.cos(arithmetic.sub(t,constants.PI));return arithmetic.negative(cos)}var lo=t.lo;var hi=t.hi;rlo=rmath.cosLo(hi);rhi=rmath.cosHi(lo);if(hi<=constants.PI_LOW){return Interval(rlo,rhi)}else if(hi<=pi2.lo){return Interval(-1,Math.max(rlo,rhi))}else{return Interval(-1,1)}};trigonometric.sin=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return trigonometric.cos(arithmetic.sub(x,constants.PI_HALF))};trigonometric.tan=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.lo<0){var mult=1e7;x.lo+=2*Math.PI*mult;x.hi+=2*Math.PI*mult}var pi=constants.PI;var t=algebra.fmod(x,pi);if(t.lo>=constants.PI_HALF_LOW){t=arithmetic.sub(t,pi)}if(t.lo<=-constants.PI_HALF_LOW||t.hi>=constants.PI_HALF_LOW){return constants.WHOLE}return Interval(rmath.tanLo(t.lo),rmath.tanHi(t.hi))};trigonometric.asin=function(x){if(utils.isEmpty(x)||x.hi<-1||x.lo>1){return constants.EMPTY}var lo=x.lo<=-1?-constants.PI_HALF_HIGH:rmath.asinLo(x.lo);var hi=x.hi>=1?constants.PI_HALF_HIGH:rmath.asinHi(x.hi);return Interval(lo,hi)};trigonometric.acos=function(x){if(utils.isEmpty(x)||x.hi<-1||x.lo>1){return constants.EMPTY}var lo=x.hi>=1?0:rmath.acosLo(x.hi);var hi=x.lo<=-1?constants.PI_HIGH:rmath.acosHi(x.lo);return Interval(lo,hi)};trigonometric.atan=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.atanLo(x.lo),rmath.atanHi(x.hi))};trigonometric.sinh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.sinhLo(x.lo),rmath.sinhHi(x.hi))};trigonometric.cosh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}if(x.hi<0){return Interval(rmath.coshLo(x.hi),rmath.coshHi(x.lo))}else if(x.lo>=0){return Interval(rmath.coshLo(x.lo),rmath.coshHi(x.hi))}else{return Interval(1,rmath.coshHi(-x.lo>x.hi?x.lo:x.hi))}};trigonometric.tanh=function(x){if(utils.isEmpty(x)){return constants.EMPTY}return Interval(rmath.tanhLo(x.lo),rmath.tanhHi(x.hi))};module.exports=trigonometric},{"../constants":5,"../interval":6,"../round-math":15,"./algebra":7,"./arithmetic":8,"./misc":10,"./utils":13}],13:[function(require,module,exports){"use strict";var utils={};utils.isInterval=function(x){return typeof x==="object"&&typeof x.lo==="number"&&typeof x.hi==="number"};utils.isEmpty=function(a){return a.lo>a.hi};utils.isWhole=function(a){return a.lo===-Infinity&&a.hi===Infinity};utils.isSingleton=function(x){return!utils.isEmpty(x)&&x.lo===x.hi};utils.zeroIn=function(a){return utils.hasValue(a,0)};utils.hasValue=function(a,v){if(utils.isEmpty(a)){return false}return a.lo<=v&&v<=a.hi};utils.hasInterval=function(a,b){if(utils.isEmpty(a)){return true}return!utils.isEmpty(b)&&b.lo<=a.lo&&a.hi<=b.hi};utils.intervalsOverlap=function(a,b){if(utils.isEmpty(a)||utils.isEmpty(b)){return false}return a.lo<=b.lo&&b.lo<=a.hi||b.lo<=a.lo&&a.lo<=b.hi};module.exports=utils},{}],14:[function(require,module,exports){"use strict";Math.sinh=Math.sinh||function(x){var y=Math.exp(x);return(y-1/y)/2};Math.cosh=Math.cosh||function(x){var y=Math.exp(x);return(y+1/y)/2};Math.tanh=Math.tanh||function(x){if(x===Number.POSITIVE_INFINITY){return 1}else if(x===Number.NEGATIVE_INFINITY){return-1}else{var y=Math.exp(2*x);return(y-1)/(y+1)}}},{}],15:[function(require,module,exports){"use strict";var nextafter=require("nextafter");function identity(v){return v}function prev(v){if(v===Infinity){return v}return nextafter(v,-Infinity)}function next(v){if(v===-Infinity){return v}return nextafter(v,Infinity)}var round={prev:prev,next:next};round.addLo=function(x,y){return this.prev(x+y)};round.addHi=function(x,y){return this.next(x+y)};round.subLo=function(x,y){return this.prev(x-y)};round.subHi=function(x,y){return this.next(x-y)};round.mulLo=function(x,y){return this.prev(x*y)};round.mulHi=function(x,y){return this.next(x*y)};round.divLo=function(x,y){return this.prev(x/y)};round.divHi=function(x,y){return this.next(x/y)};function toInteger(x){return x<0?Math.ceil(x):Math.floor(x)}round.intLo=function(x){return toInteger(this.prev(x))};round.intHi=function(x){return toInteger(this.next(x))};round.logLo=function(x){return this.prev(Math.log(x))};round.logHi=function(x){return this.next(Math.log(x))};round.expLo=function(x){return this.prev(Math.exp(x))};round.expHi=function(x){return this.next(Math.exp(x))};round.sinLo=function(x){return this.prev(Math.sin(x))};round.sinHi=function(x){return this.next(Math.sin(x))};round.cosLo=function(x){return this.prev(Math.cos(x))};round.cosHi=function(x){return this.next(Math.cos(x))};round.tanLo=function(x){return this.prev(Math.tan(x))};round.tanHi=function(x){return this.next(Math.tan(x))};round.asinLo=function(x){return this.prev(Math.asin(x))};round.asinHi=function(x){return this.next(Math.asin(x))};round.acosLo=function(x){return this.prev(Math.acos(x))};round.acosHi=function(x){return this.next(Math.acos(x))};round.atanLo=function(x){return this.prev(Math.atan(x))};round.atanHi=function(x){return this.next(Math.atan(x))};round.sinhLo=function(x){return this.prev(Math.sinh(x))};round.sinhHi=function(x){return this.next(Math.sinh(x))};round.coshLo=function(x){return this.prev(Math.cosh(x))};round.coshHi=function(x){return this.next(Math.cosh(x))};round.tanhLo=function(x){return this.prev(Math.tanh(x))};round.tanhHi=function(x){return this.next(Math.tanh(x))};round.powLo=function(x,power){if(power%1!==0){return this.prev(Math.pow(x,power))}var y=power&1?x:1;power>>=1;while(power>0){x=round.mulLo(x,x);if(power&1){y=round.mulLo(x,y)}power>>=1}return y};round.powHi=function(x,power){if(power%1!==0){return this.next(Math.pow(x,power))}var y=power&1?x:1;power>>=1;while(power>0){x=round.mulHi(x,x);if(power&1){y=round.mulHi(x,y)}power>>=1}return y};round.sqrtLo=function(x){return this.prev(Math.sqrt(x))};round.sqrtHi=function(x){return this.next(Math.sqrt(x))};round.disable=function(){this.next=this.prev=identity};round.enable=function(){this.next=next;this.prev=prev};module.exports=round},{nextafter:16}],16:[function(require,module,exports){"use strict";var doubleBits=require("double-bits");var SMALLEST_DENORM=Math.pow(2,-1074);var UINT_MAX=-1>>>0;module.exports=nextafter;function nextafter(x,y){if(isNaN(x)||isNaN(y)){return NaN}if(x===y){return x}if(x===0){if(y<0){return-SMALLEST_DENORM}else{return SMALLEST_DENORM}}var hi=doubleBits.hi(x);var lo=doubleBits.lo(x);if(y>x===x>0){if(lo===UINT_MAX){hi+=1;lo=0}else{lo+=1}}else{if(lo===0){lo=UINT_MAX;hi-=1}else{lo-=1}}return doubleBits.pack(lo,hi)}},{"double-bits":17}],17:[function(require,module,exports){(function(Buffer){var hasTypedArrays=false;if(typeof Float64Array!=="undefined"){var DOUBLE_VIEW=new Float64Array(1),UINT_VIEW=new Uint32Array(DOUBLE_VIEW.buffer);DOUBLE_VIEW[0]=1;hasTypedArrays=true;if(UINT_VIEW[1]===1072693248){module.exports=function doubleBitsLE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[0],UINT_VIEW[1]]};function toDoubleLE(lo,hi){UINT_VIEW[0]=lo;UINT_VIEW[1]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleLE;function lowUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.lo=lowUintLE;function highUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.hi=highUintLE}else if(UINT_VIEW[0]===1072693248){module.exports=function doubleBitsBE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[1],UINT_VIEW[0]]};function toDoubleBE(lo,hi){UINT_VIEW[1]=lo;UINT_VIEW[0]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleBE;function lowUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.lo=lowUintBE;function highUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.hi=highUintBE}else{hasTypedArrays=false}}if(!hasTypedArrays){var buffer=new Buffer(8);module.exports=function doubleBits(n){buffer.writeDoubleLE(n,0,true);return[buffer.readUInt32LE(0,true),buffer.readUInt32LE(4,true)]};function toDouble(lo,hi){buffer.writeUInt32LE(lo,0,true);buffer.writeUInt32LE(hi,4,true);return buffer.readDoubleLE(0,true)}module.exports.pack=toDouble;function lowUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(0,true)}module.exports.lo=lowUint;function highUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(4,true)}module.exports.hi=highUint}module.exports.sign=function(n){return module.exports.hi(n)>>>31};module.exports.exponent=function(n){var b=module.exports.hi(n);return(b<<1>>>21)-1023};module.exports.fraction=function(n){var lo=module.exports.lo(n);var hi=module.exports.hi(n);var b=hi&(1<<20)-1;if(hi&2146435072){b+=1<<20}return[lo,b]};module.exports.denormalized=function(n){var hi=module.exports.hi(n);return!(hi&2146435072)}}).call(this,require("buffer").Buffer)},{buffer:1}],18:[function(require,module,exports){module.exports=extend;function extend(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(source.hasOwnProperty(key)){target[key]=source[key]}}}return target}},{}],"interval-arithmetic":[function(require,module,exports){"use strict";var extend=require("xtend/mutable");require("./lib/polyfill");module.exports=require("./lib/interval");module.exports.rmath=require("./lib/round-math");extend(module.exports,require("./lib/constants"),require("./lib/operations/relational"),require("./lib/operations/arithmetic"),require("./lib/operations/algebra"),require("./lib/operations/trigonometric"),require("./lib/operations/misc"),require("./lib/operations/utils"))},{"./lib/constants":5,"./lib/interval":6,"./lib/operations/algebra":7,"./lib/operations/arithmetic":8,"./lib/operations/misc":10,"./lib/operations/relational":11,"./lib/operations/trigonometric":12,"./lib/operations/utils":13,"./lib/polyfill":14,"./lib/round-math":15,"xtend/mutable":18}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("is-array");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var kMaxLength=1073741823;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;var length;if(type==="number")length=subject>0?subject>>>0:0;else if(type==="string"){length=Buffer.byteLength(subject,encoding)}else if(type==="object"&&subject!==null){if(subject.type==="Buffer"&&isArray(subject.data))subject=subject.data;length=+subject.length>0?Math.floor(+subject.length):0}else throw new TypeError("must start with number, buffer, array or string");if(length>kMaxLength)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength.toString(16)+" bytes");var buf;if(Buffer.TYPED_ARRAY_SUPPORT){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){if(Buffer.isBuffer(subject)){for(i=0;i<length;i++)buf[i]=subject.readUInt8(i)}else{for(i=0;i<length;i++)buf[i]=(subject[i]%256+256)%256}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer.TYPED_ARRAY_SUPPORT&&!noZero){for(i=0;i<length;i++){buf[i]=0}}if(length>0&&length<=Buffer.poolSize)buf.parent=rootParent;return buf}function SlowBuffer(subject,encoding,noZero){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding,noZero);var buf=new Buffer(subject,encoding,noZero);delete buf.parent;return buf}Buffer.isBuffer=function(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len&&a[i]===b[i];i++){}if(i!==len){x=a[i];y=b[i]}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function(encoding){switch(String(encoding).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 true;default:return false}};Buffer.concat=function(list,totalLength){if(!isArray(list))throw new TypeError("Usage: Buffer.concat(list[, length])");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(totalLength===undefined){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"ascii":case"binary":case"raw":ret=str.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;case"hex":ret=str.length>>>1;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"base64":ret=base64ToBytes(str).length;break;default:ret=str.length}return ret};Buffer.prototype.length=undefined;Buffer.prototype.parent=undefined;Buffer.prototype.toString=function(encoding,start,end){var loweredCase=false;start=start>>>0;end=end===undefined||end===Infinity?this.length:end>>>0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}};Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return Buffer.compare(this,b)};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);if(isNaN(byte))throw new Error("Invalid hex string");buf[offset+i]=byte}return i}function utf8Write(buf,string,offset,length){var charsWritten=blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length);return charsWritten}function asciiWrite(buf,string,offset,length){var charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){var charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function utf16leWrite(buf,string,offset,length){var charsWritten=blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length,2);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;if(length<0||offset<0||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=utf8Write(this,string,offset,length);break;case"ascii":ret=asciiWrite(this,string,offset,length);break;case"binary":ret=binaryWrite(this,string,offset,length);break;case"base64":ret=base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=utf16leWrite(this,string,offset,length);break;default:throw new TypeError("Unknown encoding: "+encoding)}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i]&127)}return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT){newBuf=Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}}if(newBuf.length)newBuf.parent=this.parent||this;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;return val};Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256))val+=this[offset+--byteLength]*mul;return val};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256))val+=this[offset+i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256))val+=this[offset+--i]*mul;mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);
var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=value/mul>>>0&255;return offset+byteLength};Buffer.prototype.writeUInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i<byteLength&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength-1)-1,-Math.pow(2,8*byteLength-1))}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256))this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength};Buffer.prototype.writeInt8=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value;return offset+1};Buffer.prototype.writeInt16LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8}else objectWriteUInt16(this,value,offset,true);return offset+2};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value}else objectWriteUInt16(this,value,offset,false);return offset+2};Buffer.prototype.writeInt32LE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else objectWriteUInt32(this,value,offset,true);return offset+4};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value}else objectWriteUInt32(this,value,offset,false);return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||value<min)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38);ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert)checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308);ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(target_start>=target.length)target_start=target.length;if(!target_start)target_start=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||source.length===0)return 0;if(target_start<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=source.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<len;i++){target[i+target_start]=this[i+start]}}else{target._set(this.subarray(start,start+len),target_start)}return len};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(end<start)throw new RangeError("end < start");if(end===start)return;if(this.length===0)return;if(start<0||start>=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i<end;i++){this[i]=value}}else{var bytes=utf8ToBytes(value.toString());var len=bytes.length;for(i=start;i<end;i++){this[i]=bytes[i%len]}}return this};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer.TYPED_ARRAY_SUPPORT){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1){buf[i]=this[i]}return buf.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var BP=Buffer.prototype;Buffer._augment=function(arr){arr.constructor=Buffer;arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.equals=BP.equals;arr.compare=BP.compare;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUIntLE=BP.readUIntLE;arr.readUIntBE=BP.readUIntBE;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readIntLE=BP.readIntLE;arr.readIntBE=BP.readIntBE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUIntLE=BP.writeUIntLE;arr.writeUIntBE=BP.writeUIntBE;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeIntLE=BP.writeIntLE;arr.writeIntBE=BP.writeIntBE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};var INVALID_BASE64_RE=/[^+\/0-9A-z\-]/g;function base64clean(str){str=stringtrim(str).replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){var codePoint,length=string.length;var leadSurrogate=null;units=units||Infinity;var bytes=[];var i=0;for(;i<length;i++){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}else{leadSurrogate=codePoint;continue}}}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=null}if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<2097152){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length,unitSize){if(unitSize)length-=length%unitSize;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}},{"base64-js":2,ieee754:3,"is-array":4}],2:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);var PLUS_URL_SAFE="-".charCodeAt(0);var SLASH_URL_SAFE="_".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS||code===PLUS_URL_SAFE)return 62;if(code===SLASH||code===SLASH_URL_SAFE)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],3:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],4:[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],5:[function(require,module,exports){(function(Buffer){var hasTypedArrays=false;if(typeof Float64Array!=="undefined"){var DOUBLE_VIEW=new Float64Array(1),UINT_VIEW=new Uint32Array(DOUBLE_VIEW.buffer);DOUBLE_VIEW[0]=1;hasTypedArrays=true;if(UINT_VIEW[1]===1072693248){module.exports=function doubleBitsLE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[0],UINT_VIEW[1]]};function toDoubleLE(lo,hi){UINT_VIEW[0]=lo;UINT_VIEW[1]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleLE;function lowUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.lo=lowUintLE;function highUintLE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.hi=highUintLE}else if(UINT_VIEW[0]===1072693248){module.exports=function doubleBitsBE(n){DOUBLE_VIEW[0]=n;return[UINT_VIEW[1],UINT_VIEW[0]]};function toDoubleBE(lo,hi){UINT_VIEW[1]=lo;UINT_VIEW[0]=hi;return DOUBLE_VIEW[0]}module.exports.pack=toDoubleBE;function lowUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[1]}module.exports.lo=lowUintBE;function highUintBE(n){DOUBLE_VIEW[0]=n;return UINT_VIEW[0]}module.exports.hi=highUintBE}else{hasTypedArrays=false}}if(!hasTypedArrays){var buffer=new Buffer(8);module.exports=function doubleBits(n){buffer.writeDoubleLE(n,0,true);return[buffer.readUInt32LE(0,true),buffer.readUInt32LE(4,true)]};function toDouble(lo,hi){buffer.writeUInt32LE(lo,0,true);buffer.writeUInt32LE(hi,4,true);return buffer.readDoubleLE(0,true)}module.exports.pack=toDouble;function lowUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(0,true)}module.exports.lo=lowUint;function highUint(n){buffer.writeDoubleLE(n,0,true);return buffer.readUInt32LE(4,true)}module.exports.hi=highUint}module.exports.sign=function(n){return module.exports.hi(n)>>>31};module.exports.exponent=function(n){var b=module.exports.hi(n);return(b<<1>>>21)-1023};module.exports.fraction=function(n){var lo=module.exports.lo(n);var hi=module.exports.hi(n);var b=hi&(1<<20)-1;if(hi&2146435072){b+=1<<20}return[lo,b]};module.exports.denormalized=function(n){var hi=module.exports.hi(n);return!(hi&2146435072)}}).call(this,require("buffer").Buffer)},{buffer:1}],nextafter:[function(require,module,exports){"use strict";var doubleBits=require("double-bits");var SMALLEST_DENORM=Math.pow(2,-1074);var UINT_MAX=-1>>>0;module.exports=nextafter;function nextafter(x,y){if(isNaN(x)||isNaN(y)){return NaN}if(x===y){return x}if(x===0){if(y<0){return-SMALLEST_DENORM}else{return SMALLEST_DENORM}}var hi=doubleBits.hi(x);var lo=doubleBits.lo(x);if(y>x===x>0){if(lo===UINT_MAX){hi+=1;lo=0}else{lo+=1}}else{if(lo===0){lo=UINT_MAX;hi-=1}else{lo-=1}}return doubleBits.pack(lo,hi)}},{"double-bits":5}]},{},[]);var Interval=require("interval-arithmetic");var nextafter=require("nextafter");var a=Interval(3,nextafter(5,-Infinity));var b=Interval(4,6);console.log(Interval.intersection(a,b));console.log(Interval.union(a,b));console.log(Interval.difference(a,b));console.log(Interval.difference(b,a));
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"interval-arithmetic": "0.5.1",
"nextafter": "1.0.0"
}
}
<!-- contents of this file will be placed inside the <body> -->
<div id="playground"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<!-- contents of this file will be placed inside the <head> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment