diff --git a/dist/colyseus.js b/dist/colyseus.js index eb51861..e58aecb 100644 --- a/dist/colyseus.js +++ b/dist/colyseus.js @@ -1 +1 @@ -var Colyseus=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=9)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encode=r(13),e.decode=r(14)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});!function(t){t[t.USER_ID=1]="USER_ID",t[t.JOIN_ROOM=10]="JOIN_ROOM",t[t.JOIN_ERROR=11]="JOIN_ERROR",t[t.LEAVE_ROOM=12]="LEAVE_ROOM",t[t.ROOM_DATA=13]="ROOM_DATA",t[t.ROOM_STATE=14]="ROOM_STATE",t[t.ROOM_STATE_PATCH=15]="ROOM_STATE_PATCH",t[t.ROOM_LIST=20]="ROOM_LIST",t[t.BAD_REQUEST=50]="BAD_REQUEST"}(e.Protocol||(e.Protocol={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(3);e.OnceSignal=n.OnceSignal;var i=r(12);e.Signal=i.Signal;var o=r(5);e.Slot=o.Slot;var s=r(4);e.SlotList=s.SlotList},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(4),i=r(5),o=function(){function t(){for(var t=[],e=0;e."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.once=function(t){return this.addOnce(t)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=n.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new i.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();e.OnceSignal=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!0,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;)n=n.tail=new t(i.head),i=i.tail;return n.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var n=new t(this.head),i=n,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return i.tail=o.prepend(e),n;i=i.tail=new t(o.head),o=o.tail}return i.tail=new t(e),n},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;){if(i.head.listener===e)return n.tail=i.tail,r;n=n.tail=new t(i.head),i=i.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();e.SlotList=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e,r,n){void 0===r&&(r=!1),void 0===n&&(n=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=n,this.verifyListener(t)}return t.prototype.execute0=function(){if(this._enabled){if(this._once&&this.remove(),this._params&&this._params.length)return void this._listener.apply(null,this._params);this._listener()}},t.prototype.execute1=function(t){if(this._enabled){if(this._once&&this.remove(),this._params&&this._params.length)return void this._listener.apply(null,[t].concat(this._params));this._listener(t)}},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!0,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();e.Slot=n},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(15),o=r(0),s=function(t){function e(e,r){void 0===r&&(r=!0);var n=t.call(this,e,void 0,{connect:r})||this;return n._enqueuedCalls=[],n}return n(e,t),e.prototype.onOpenCallback=function(e){if(t.prototype.onOpenCallback.call(this),this.binaryType="arraybuffer",this._enqueuedCalls.length>0){for(var r=0,n=this._enqueuedCalls;r>6),t.setUint8(e++,128|63&n)):n<55296||n>=57344?(t.setUint8(e++,224|n>>12),t.setUint8(e++,128|n>>6&63),t.setUint8(e++,128|63&n)):(i++,n=65536+((1023&n)<<10|1023&r.charCodeAt(i)),t.setUint8(e++,240|n>>18),t.setUint8(e++,128|n>>12&63),t.setUint8(e++,128|n>>6&63),t.setUint8(e++,128|63&n))}function i(t){for(var e=0,r=0,n=0,i=t.length;n=57344?r+=3:(n++,r+=4);return r}function o(t,e,r){var n=typeof r,s=0,a=0,u=0,f=0,h=0,c=0;if("string"===n){if((h=i(r))<32)t.push(160|h),c=1;else if(h<256)t.push(217,h),c=2;else if(h<65536)t.push(218,h>>8,h),c=3;else{if(!(h<4294967296))throw new Error("String too long");t.push(219,h>>24,h>>16,h>>8,h),c=5}return e.push({str:r,length:h,offset:t.length}),c+h}if("number"===n)return Math.floor(r)===r&&isFinite(r)?r>=0?r<128?(t.push(r),1):r<256?(t.push(204,r),2):r<65536?(t.push(205,r>>8,r),3):r<4294967296?(t.push(206,r>>24,r>>16,r>>8,r),5):(u=r/Math.pow(2,32)>>0,f=r>>>0,t.push(207,u>>24,u>>16,u>>8,u,f>>24,f>>16,f>>8,f),9):r>=-32?(t.push(r),1):r>=-128?(t.push(208,r),2):r>=-32768?(t.push(209,r>>8,r),3):r>=-2147483648?(t.push(210,r>>24,r>>16,r>>8,r),5):(u=Math.floor(r/Math.pow(2,32)),f=r>>>0,t.push(211,u>>24,u>>16,u>>8,u,f>>24,f>>16,f>>8,f),9):(t.push(203),e.push({float:r,length:8,offset:t.length}),9);if("object"===n){if(null===r)return t.push(192),1;if(Array.isArray(r)){if((h=r.length)<16)t.push(144|h),c=1;else if(h<65536)t.push(220,h>>8,h),c=3;else{if(!(h<4294967296))throw new Error("Array too large");t.push(221,h>>24,h>>16,h>>8,h),c=5}for(s=0;s>>0,t.push(215,0,u>>24,u>>16,u>>8,u,f>>24,f>>16,f>>8,f),10}if(r instanceof ArrayBuffer){if((h=r.byteLength)<256)t.push(196,h),c=2;else if(h<65536)t.push(197,h>>8,h),c=3;else{if(!(h<4294967296))throw new Error("Buffer too large");t.push(198,h>>24,h>>16,h>>8,h),c=5}return e.push({bin:r,length:h,offset:t.length}),c+h}if("function"==typeof r.toJSON)return o(t,e,r.toJSON());var p=[],y="",d=Object.keys(r);for(s=0,a=d.length;s>8,h),c=3;else{if(!(h<4294967296))throw new Error("Object too large");t.push(223,h>>24,h>>16,h>>8,h),c=5}for(s=0;s0&&(h=r[0].offset);for(var c,l=0,p=0,y=0,d=e.length;y=65536?(i-=65536,n+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):n+=String.fromCharCode(i)}else n+=String.fromCharCode((15&a)<<12|(63&t.getUint8(++o))<<6|(63&t.getUint8(++o))<<0);else n+=String.fromCharCode((31&a)<<6|63&t.getUint8(++o));else n+=String.fromCharCode(a)}return n}function o(t){var e=new n(t),r=e.parse();if(e.offset!==t.byteLength)throw new Error(t.byteLength-e.offset+" trailing bytes");return r}n.prototype.array=function(t){for(var e=new Array(t),r=0;r223)return-1*(255-e+1);switch(e){case 192:return null;case 194:return!1;case 195:return!0;case 196:return r=this.view.getUint8(this.offset),this.offset+=1,this.bin(r);case 197:return r=this.view.getUint16(this.offset),this.offset+=2,this.bin(r);case 198:return r=this.view.getUint32(this.offset),this.offset+=4,this.bin(r);case 199:return r=this.view.getUint8(this.offset),n=this.view.getInt8(this.offset+1),this.offset+=2,[n,this.bin(r)];case 200:return r=this.view.getUint16(this.offset),n=this.view.getInt8(this.offset+2),this.offset+=3,[n,this.bin(r)];case 201:return r=this.view.getUint32(this.offset),n=this.view.getInt8(this.offset+4),this.offset+=5,[n,this.bin(r)];case 202:return t=this.view.getFloat32(this.offset),this.offset+=4,t;case 203:return t=this.view.getFloat64(this.offset),this.offset+=8,t;case 204:return t=this.view.getUint8(this.offset),this.offset+=1,t;case 205:return t=this.view.getUint16(this.offset),this.offset+=2,t;case 206:return t=this.view.getUint32(this.offset),this.offset+=4,t;case 207:return i=this.view.getUint32(this.offset)*Math.pow(2,32),o=this.view.getUint32(this.offset+4),this.offset+=8,i+o;case 208:return t=this.view.getInt8(this.offset),this.offset+=1,t;case 209:return t=this.view.getInt16(this.offset),this.offset+=2,t;case 210:return t=this.view.getInt32(this.offset),this.offset+=4,t;case 211:return i=this.view.getInt32(this.offset)*Math.pow(2,32),o=this.view.getUint32(this.offset+4),this.offset+=8,i+o;case 212:return n=this.view.getInt8(this.offset),this.offset+=1,0===n?void(this.offset+=1):[n,this.bin(1)];case 213:return n=this.view.getInt8(this.offset),this.offset+=1,[n,this.bin(2)];case 214:return n=this.view.getInt8(this.offset),this.offset+=1,[n,this.bin(4)];case 215:return n=this.view.getInt8(this.offset),this.offset+=1,0===n?(i=this.view.getInt32(this.offset)*Math.pow(2,32),o=this.view.getUint32(this.offset+4),this.offset+=8,new Date(i+o)):[n,this.bin(8)];case 216:return n=this.view.getInt8(this.offset),this.offset+=1,[n,this.bin(16)];case 217:return r=this.view.getUint8(this.offset),this.offset+=1,this.str(r);case 218:return r=this.view.getUint16(this.offset),this.offset+=2,this.str(r);case 219:return r=this.view.getUint32(this.offset),this.offset+=4,this.str(r);case 220:return r=this.view.getUint16(this.offset),this.offset+=2,this.array(r);case 221:return r=this.view.getUint32(this.offset),this.offset+=4,this.array(r);case 222:return r=this.view.getUint16(this.offset),this.offset+=2,this.map(r);case 223:return r=this.view.getUint32(this.offset),this.offset+=4,this.map(r)}throw new Error("Could not parse")},t.exports=o},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:{};n(this,t),this.url=e,this.protocols=r,this.reconnectEnabled=!0,this.listeners={},this.backoff=o(i.backoff||"exponential",i),this.backoff.onReady=this.onBackoffReady.bind(this),(void 0===i.connect||i.connect)&&this.open()}return i(t,[{key:"open",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isReconnect=t;var e=this.ws&&this.ws.binaryType;this.ws=new WebSocket(this.url,this.protocols),this.ws.onclose=this.onCloseCallback.bind(this),this.ws.onerror=this.onErrorCallback.bind(this),this.ws.onmessage=this.onMessageCallback.bind(this),this.ws.onopen=this.onOpenCallback.bind(this),e&&(this.ws.binaryType=e)}},{key:"onBackoffReady",value:function(t,e){this.open(!0)}},{key:"onCloseCallback",value:function(t){!this.isReconnect&&this.listeners.onclose&&this.listeners.onclose.apply(null,arguments),this.reconnectEnabled&&t.code<3e3&&this.backoff.backoff()}},{key:"onErrorCallback",value:function(){this.listeners.onerror&&this.listeners.onerror.apply(null,arguments)}},{key:"onMessageCallback",value:function(){this.listeners.onmessage&&this.listeners.onmessage.apply(null,arguments)}},{key:"onOpenCallback",value:function(){this.listeners.onopen&&this.listeners.onopen.apply(null,arguments),this.isReconnect&&this.listeners.onreconnect&&this.listeners.onreconnect.apply(null,arguments),this.isReconnect=!1}},{key:"close",value:function(t,e){void 0===t&&(t=1e3),this.reconnectEnabled=!1,this.ws.close(t,e)}},{key:"send",value:function(t){this.ws.send(t)}},{key:"bufferedAmount",get:function(){return this.ws.bufferedAmount}},{key:"readyState",get:function(){return this.ws.readyState}},{key:"binaryType",get:function(){return this.ws.binaryType},set:function(t){this.ws.binaryType=t}},{key:"extensions",get:function(){return this.ws.extensions},set:function(t){this.ws.extensions=t}},{key:"protocol",get:function(){return this.ws.protocol},set:function(t){this.ws.protocol=t}},{key:"onclose",set:function(t){this.listeners.onclose=t},get:function(){return this.listeners.onclose}},{key:"onerror",set:function(t){this.listeners.onerror=t},get:function(){return this.listeners.onerror}},{key:"onmessage",set:function(t){this.listeners.onmessage=t},get:function(){return this.listeners.onmessage}},{key:"onopen",set:function(t){this.listeners.onopen=t},get:function(){return this.listeners.onopen}},{key:"onreconnect",set:function(t){this.listeners.onreconnect=t},get:function(){return this.listeners.onreconnect}}]),t}();s.CONNECTING=WebSocket.CONNECTING,s.OPEN=WebSocket.OPEN,s.CLOSING=WebSocket.CLOSING,s.CLOSED=WebSocket.CLOSED,e.default=s},function(t,e,r){"use strict";function n(t,e){return new i(o[t],e)}function i(t,e){this.func=t,this.attempts=0,this.delay=void 0!==e.initialDelay?e.initialDelay:100}Object.defineProperty(e,"__esModule",{value:!0}),e.createBackoff=n;var o={exponential:function(t,e){return Math.floor(Math.random()*Math.pow(2,t)*e)},fibonacci:function(t,e){var r=1;if(t>r)for(var n=1,r=2,i=2;i=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),o.alloc(+t)}function v(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(n)return J(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}var f;if(i){var h=-1;for(f=r;fa&&(r=a-u),f=r;f>=0;f--){for(var c=!0,l=0;li&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var u,f,h,c;switch(a){case 1:o<128&&(s=o);break;case 2:u=t[i+1],128==(192&u)&&(c=(31&o)<<6|63&u)>127&&(s=c);break;case 3:u=t[i+1],f=t[i+2],128==(192&u)&&128==(192&f)&&(c=(15&o)<<12|(63&u)<<6|63&f)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:u=t[i+1],f=t[i+2],h=t[i+3],128==(192&u)&&128==(192&f)&&128==(192&h)&&(c=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&h)>65535&&c<1114112&&(s=c)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return I(n)}function I(t){var e=t.length;if(e<=K)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function x(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,r,n,52,8),r+8}function z(t){if(t=q(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function J(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function $(t){return Q.toByteArray(z(t))}function G(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function H(t){return t!==t}var Q=r(19),X=r(20),Z=r(21);e.Buffer=o,e.SlowBuffer=d,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=n(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return f(null,t)},o.allocUnsafeSlow=function(t){return f(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var s=i-n,a=r-e,u=Math.min(s,a),f=this.slice(n,i),h=t.slice(e,r),c=0;ci)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return A(this,t,e,r);case"latin1":case"binary":return O(this,t,e,r);case"base64":return P(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var K=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),X.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),X.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),X.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),X.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){B(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):x(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):x(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return 3*t.length/4-n(t)}function o(t){var e,r,i,o,s,a=t.length;o=n(t),s=new c(3*a/4-o),r=o>0?a-4:a;var u=0;for(e=0;e>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[u++]=255&i):1===o&&(i=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function s(t){return f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}function a(t,e,r){for(var n,i=[],o=e;ou?u:s+16383));return 1===n?(e=t[r-1],i+=f[e>>2],i+=f[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=f[e>>10],i+=f[e>>4&63],i+=f[e<<2&63],i+="="),o.push(i),o.join("")}e.byteLength=i,e.toByteArray=o,e.fromByteArray=u;for(var f=[],h=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,y=l.length;p>1,h=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,f=8*o-i-1,h=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),e+=s+c>=1?l/u:l*Math.pow(2,1-c),e*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=y,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=y,s/=256,f-=8);t[r+p-y]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=function(){function t(t){void 0===t&&(t=!1),this.running=!1,this.now="undefined"!=typeof window&&window.performance&&window.performance.now&&window.performance.now.bind(window.performance)||Date.now,this.start(t)}return t.prototype.start=function(t){void 0===t&&(t=!1),this.deltaTime=0,this.currentTime=this.now(),this.elapsedTime=0,this.running=!0,t&&(this._interval=setInterval(this.tick.bind(this),1e3/60))},t.prototype.stop=function(){this.running=!1,this._interval&&clearInterval(this._interval)},t.prototype.tick=function(t){void 0===t&&(t=this.now()),this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime+=this.deltaTime},t}();t.exports=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(24);e.StateContainer=n.StateContainer},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(25),i=function(){function t(t){this.listeners=[],this.matcherPlaceholders={":id":/^([a-zA-Z0-9\-_]+)$/,":number":/^([0-9]+)$/,":string":/^(\w+)$/,":axis":/^([xyz])$/,":*":/(.*)/},this.state=t,this.reset()}return t.prototype.set=function(t){var e=n.compare(this.state,t);return this.state=t,this.checkPatches(e,this.listeners,this.defaultListener),e},t.prototype.registerPlaceholder=function(t,e){this.matcherPlaceholders[t]=e},t.prototype.listen=function(t,e,r){var i,o=this;"function"==typeof t?(i=[],e=t):i=t.split("/"),e.length>1&&console.warn(".listen() accepts only one parameter.");var s={callback:e,rawRules:i,rules:i.map(function(t){return"string"==typeof t?0===t.indexOf(":")?o.matcherPlaceholders[t]||o.matcherPlaceholders[":*"]:new RegExp("^"+t+"$"):t})};return 0===i.length?this.defaultListener=s:this.listeners.push(s),r&&this.checkPatches(n.compare({},this.state),[s]),s},t.prototype.removeListener=function(t){for(var e=this.listeners.length-1;e>=0;e--)this.listeners[e]===t&&this.listeners.splice(e,1)},t.prototype.removeAllListeners=function(){this.reset()},t.prototype.checkPatches=function(t,e,r){for(var n=0,i=e.length;n=0;s--){var a=o&&this.getPathVariables(t[s],o);a&&(o.callback({path:a,rawPath:t[s].path,operation:t[s].operation,value:t[s].value}),t[s].matched=!0)}if(r)for(var s=t.length-1;s>=0;s--)t[s].matched||r.callback(t[s])},t.prototype.getPathVariables=function(t,e){if(t.path.length!==e.rules.length)return!1;for(var r={},n=0,i=e.rules.length;n2)return!1;":"===e.rawRules[n].substr(0,1)&&(r[e.rawRules[n].substr(1)]=o[1])}return r},t.prototype.reset=function(){this.listeners=[]},t}();e.StateContainer=i},function(t,e,r){"use strict";function n(t,e){var r=[];return s(t,e,r,[]),r}function i(t,e){var r=t.slice();return r.push(e),r}function o(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r=0;h--){var c=u[h],l=t[c];if(!e.hasOwnProperty(c)||void 0===e[c]&&void 0!==l&&!1===Array.isArray(e))r.push({operation:"remove",path:i(n,c)}),f=!0;else{var p=e[c];"object"==typeof l&&null!=l&&"object"==typeof p&&null!=p?s(l,p,r,i(n,c)):l!==p&&r.push({operation:"replace",path:i(n,c),value:p,previousValue:l})}}if(f||a.length!=u.length)for(var h=a.length-1;h>=0;h--){var c=a[h];if(!t.hasOwnProperty(c)&&void 0!==e[c]){var p=e[c],y=i(n,c);"object"==typeof p&&null!=p&&s({},p,r,y),r.push({operation:"add",path:y,value:p})}}}Object.defineProperty(e,"__esModule",{value:!0}),e.compare=n},function(t,e){!function(e,r){void 0!==t&&t.exports?t.exports=r():e.fossilDelta=r()}(this,function(){"use strict";function t(){this.a=0,this.b=0,this.i=0,this.z=new Array(s)}function e(t){this.a=t,this.pos=0}function r(){this.a=[]}function n(t){var e,r;for(e=1,r=64;t>=r;e++,r<<=6);return e}function i(t){for(var e=0,r=0,n=0,i=0,o=0,s=t.length;s>=16;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,e=e+t[o+4]|0,r=r+t[o+5]|0,n=n+t[o+6]|0,i=i+t[o+7]|0,e=e+t[o+8]|0,r=r+t[o+9]|0,n=n+t[o+10]|0,i=i+t[o+11]|0,e=e+t[o+12]|0,r=r+t[o+13]|0,n=n+t[o+14]|0,i=i+t[o+15]|0,o+=16,s-=16;for(;s>=4;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,o+=4,s-=4;switch(i=((i+(n<<8)|0)+(r<<16)|0)+(e<<24)|0,s){case 3:i=i+(t[o+2]<<8)|0;case 2:i=i+(t[o+1]<<16)|0;case 1:i=i+(t[o+0]<<24)|0}return i>>>0}var o={},s=16;t.prototype.init=function(t,e){var r,n,i=0,o=0;for(r=0;r>>0};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~".split("").map(function(t){return t.charCodeAt(0)}),u=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];return e.prototype.haveBytes=function(){return this.posthis.a.length)throw new RangeError("out of bounds");return t},e.prototype.getChar=function(){return String.fromCharCode(this.getByte())},e.prototype.getInt=function(){for(var t,e=0;this.haveBytes()&&(t=u[127&this.getByte()])>=0;)e=(e<<6)+t;return this.pos--,e>>>0},r.prototype.toArray=function(){return this.a},r.prototype.putByte=function(t){this.a.push(255&t)},r.prototype.putChar=function(t){this.putByte(t.charCodeAt(0))},r.prototype.putInt=function(t){var e,r,n=[];if(0===t)return void this.putChar("0");for(e=0;t>0;e++,t>>>=6)n.push(a[63&t]);for(r=e-1;r>=0;r--)this.putByte(n[r])},r.prototype.putArray=function(t,e,r){for(var n=e;n=0&&A-- >0;){var O,P,R,C,S,I,T,U;for(g=w*s,C=0,I=g,T=E+a;I=U&&O>b&&(b=O,m=g-S,_=R),w=p[w]}if(b>0){_>0&&(u.putInt(_),u.putChar(":"),u.putArray(o,E,E+_),E+=_),E+=b,u.putInt(b),u.putChar("@"),u.putInt(m),u.putChar(","),m+b-1>c&&(c=m+b-1),b=0;break}if(E+a+s>=f){u.putInt(f-E),u.putChar(":"),u.putArray(o,E,E+f-E),E=f;break}v.next(o[E+a+s]),a++}return Es)throw new Error("copy exceeds output file size");if(p+l>f)throw new Error("copy extends past end of input");c.putArray(t,p,p+l);break;case":":if((a+=l)>s)throw new Error("insert command gives an output larger than predicted");if(l>h)throw new Error("insert count exceeds size of delta");c.putArray(u.a,u.pos,u.pos+l),u.pos+=l;break;case";":var y=c.toArray();if((!o||!1!==o.verifyChecksum)&&l!==i(y))throw new Error("bad checksum");if(a!==s)throw new Error("generated size does not match predicted size");return y;default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")},o})},function(t,e,r){"use strict";function n(){return"undefined"!=typeof cc&&cc.sys&&cc.sys.localStorage?cc.sys.localStorage:window.localStorage}function i(t,e){n().setItem(t,e)}function o(t,e){var r=n().getItem(t);"undefined"!=typeof Promise&&r instanceof Promise?r.then(function(t){return e(t)}):e(r)}Object.defineProperty(e,"__esModule",{value:!0}),e.setItem=i,e.getItem=o},function(t,e,r){"use strict";function n(t,e,r,n,i){"var"===e.holderType?t[r]=n:"key"===e.holderType&&(t[r]=i)}function i(t,e,r,i){for(var o in e)e.hasOwnProperty(o)&&n(t,e[o],o,r[o],i)}function o(t,e,r){void 0===r&&(r=0);for(var n=t,i=0,o=e.length;i."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.once=function(t){return this.addOnce(t)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=n.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new i.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();e.OnceSignal=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!0,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;)n=n.tail=new t(i.head),i=i.tail;return n.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var n=new t(this.head),i=n,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return i.tail=o.prepend(e),n;i=i.tail=new t(o.head),o=o.tail}return i.tail=new t(e),n},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;){if(i.head.listener===e)return n.tail=i.tail,r;n=n.tail=new t(i.head),i=i.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();e.SlotList=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e,r,n){void 0===r&&(r=!1),void 0===n&&(n=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=n,this.verifyListener(t)}return t.prototype.execute0=function(){if(this._enabled){if(this._once&&this.remove(),this._params&&this._params.length)return void this._listener.apply(null,this._params);this._listener()}},t.prototype.execute1=function(t){if(this._enabled){if(this._once&&this.remove(),this._params&&this._params.length)return void this._listener.apply(null,[t].concat(this._params));this._listener(t)}},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!0,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();e.Slot=n},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=r(15),o=r(0),s=function(t){function e(e,r){void 0===r&&(r=!0);var n=t.call(this,e,void 0,{connect:r})||this;return n._enqueuedCalls=[],n}return n(e,t),e.prototype.onOpenCallback=function(e){if(t.prototype.onOpenCallback.call(this),this.binaryType="arraybuffer",this._enqueuedCalls.length>0){for(var r=0,n=this._enqueuedCalls;r=65536?(i-=65536,n+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):n+=String.fromCharCode(i)}else n+=String.fromCharCode((15&a)<<12|(63&t.getUint8(++o))<<6|(63&t.getUint8(++o))<<0);else n+=String.fromCharCode((31&a)<<6|63&t.getUint8(++o));else n+=String.fromCharCode(a)}return n}function o(t){var e=new n(t),r=e._parse();if(e._offset!==t.byteLength)throw new Error(t.byteLength-e._offset+" trailing bytes");return r}n.prototype._array=function(t){for(var e=new Array(t),r=0;r223)return-1*(255-e+1);switch(e){case 192:return null;case 194:return!1;case 195:return!0;case 196:return r=this._view.getUint8(this._offset),this._offset+=1,this._bin(r);case 197:return r=this._view.getUint16(this._offset),this._offset+=2,this._bin(r);case 198:return r=this._view.getUint32(this._offset),this._offset+=4,this._bin(r);case 199:return r=this._view.getUint8(this._offset),n=this._view.getInt8(this._offset+1),this._offset+=2,[n,this._bin(r)];case 200:return r=this._view.getUint16(this._offset),n=this._view.getInt8(this._offset+2),this._offset+=3,[n,this._bin(r)];case 201:return r=this._view.getUint32(this._offset),n=this._view.getInt8(this._offset+4),this._offset+=5,[n,this._bin(r)];case 202:return t=this._view.getFloat32(this._offset),this._offset+=4,t;case 203:return t=this._view.getFloat64(this._offset),this._offset+=8,t;case 204:return t=this._view.getUint8(this._offset),this._offset+=1,t;case 205:return t=this._view.getUint16(this._offset),this._offset+=2,t;case 206:return t=this._view.getUint32(this._offset),this._offset+=4,t;case 207:return i=this._view.getUint32(this._offset)*Math.pow(2,32),o=this._view.getUint32(this._offset+4),this._offset+=8,i+o;case 208:return t=this._view.getInt8(this._offset),this._offset+=1,t;case 209:return t=this._view.getInt16(this._offset),this._offset+=2,t;case 210:return t=this._view.getInt32(this._offset),this._offset+=4,t;case 211:return i=this._view.getInt32(this._offset)*Math.pow(2,32),o=this._view.getUint32(this._offset+4),this._offset+=8,i+o;case 212:return n=this._view.getInt8(this._offset),this._offset+=1,0===n?void(this._offset+=1):[n,this._bin(1)];case 213:return n=this._view.getInt8(this._offset),this._offset+=1,[n,this._bin(2)];case 214:return n=this._view.getInt8(this._offset),this._offset+=1,[n,this._bin(4)];case 215:return n=this._view.getInt8(this._offset),this._offset+=1,0===n?(i=this._view.getInt32(this._offset)*Math.pow(2,32),o=this._view.getUint32(this._offset+4),this._offset+=8,new Date(i+o)):[n,this._bin(8)];case 216:return n=this._view.getInt8(this._offset),this._offset+=1,[n,this._bin(16)];case 217:return r=this._view.getUint8(this._offset),this._offset+=1,this._str(r);case 218:return r=this._view.getUint16(this._offset),this._offset+=2,this._str(r);case 219:return r=this._view.getUint32(this._offset),this._offset+=4,this._str(r);case 220:return r=this._view.getUint16(this._offset),this._offset+=2,this._array(r);case 221:return r=this._view.getUint32(this._offset),this._offset+=4,this._array(r);case 222:return r=this._view.getUint16(this._offset),this._offset+=2,this._map(r);case 223:return r=this._view.getUint32(this._offset),this._offset+=4,this._map(r)}throw new Error("Could not parse")},t.exports=o},function(t,e,r){"use strict";function n(t,e,r){for(var n=0,i=0,o=r.length;i>6),t.setUint8(e++,128|63&n)):n<55296||n>=57344?(t.setUint8(e++,224|n>>12),t.setUint8(e++,128|n>>6&63),t.setUint8(e++,128|63&n)):(i++,n=65536+((1023&n)<<10|1023&r.charCodeAt(i)),t.setUint8(e++,240|n>>18),t.setUint8(e++,128|n>>12&63),t.setUint8(e++,128|n>>6&63),t.setUint8(e++,128|63&n))}function i(t){for(var e=0,r=0,n=0,i=t.length;n=57344?r+=3:(n++,r+=4);return r}function o(t,e,r){var n=typeof r,s=0,a=0,u=0,f=0,h=0,c=0;if("string"===n){if((h=i(r))<32)t.push(160|h),c=1;else if(h<256)t.push(217,h),c=2;else if(h<65536)t.push(218,h>>8,h),c=3;else{if(!(h<4294967296))throw new Error("String too long");t.push(219,h>>24,h>>16,h>>8,h),c=5}return e.push({_str:r,_length:h,_offset:t.length}),c+h}if("number"===n)return Math.floor(r)===r&&isFinite(r)?r>=0?r<128?(t.push(r),1):r<256?(t.push(204,r),2):r<65536?(t.push(205,r>>8,r),3):r<4294967296?(t.push(206,r>>24,r>>16,r>>8,r),5):(u=r/Math.pow(2,32)>>0,f=r>>>0,t.push(207,u>>24,u>>16,u>>8,u,f>>24,f>>16,f>>8,f),9):r>=-32?(t.push(r),1):r>=-128?(t.push(208,r),2):r>=-32768?(t.push(209,r>>8,r),3):r>=-2147483648?(t.push(210,r>>24,r>>16,r>>8,r),5):(u=Math.floor(r/Math.pow(2,32)),f=r>>>0,t.push(211,u>>24,u>>16,u>>8,u,f>>24,f>>16,f>>8,f),9):(t.push(203),e.push({_float:r,_length:8,_offset:t.length}),9);if("object"===n){if(null===r)return t.push(192),1;if(Array.isArray(r)){if((h=r.length)<16)t.push(144|h),c=1;else if(h<65536)t.push(220,h>>8,h),c=3;else{if(!(h<4294967296))throw new Error("Array too large");t.push(221,h>>24,h>>16,h>>8,h),c=5}for(s=0;s>>0,t.push(215,0,u>>24,u>>16,u>>8,u,f>>24,f>>16,f>>8,f),10}if(r instanceof ArrayBuffer){if((h=r.byteLength)<256)t.push(196,h),c=2;else if(h<65536)t.push(197,h>>8,h),c=3;else{if(!(h<4294967296))throw new Error("Buffer too large");t.push(198,h>>24,h>>16,h>>8,h),c=5}return e.push({_bin:r,_length:h,_offset:t.length}),c+h}if("function"==typeof r.toJSON)return o(t,e,r.toJSON());var p=[],y="",d=Object.keys(r);for(s=0,a=d.length;s>8,h),c=3;else{if(!(h<4294967296))throw new Error("Object too large");t.push(223,h>>24,h>>16,h>>8,h),c=5}for(s=0;s0&&(h=r[0]._offset);for(var c,l=0,p=0,y=0,d=e.length;y2&&void 0!==arguments[2]?arguments[2]:{};n(this,t),this.url=e,this.protocols=r,this.reconnectEnabled=!0,this.listeners={},this.backoff=o(i.backoff||"exponential",i),this.backoff.onReady=this.onBackoffReady.bind(this),(void 0===i.connect||i.connect)&&this.open()}return i(t,[{key:"open",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isReconnect=t;var e=this.ws&&this.ws.binaryType;this.ws=new s(this.url,this.protocols),this.ws.onclose=this.onCloseCallback.bind(this),this.ws.onerror=this.onErrorCallback.bind(this),this.ws.onmessage=this.onMessageCallback.bind(this),this.ws.onopen=this.onOpenCallback.bind(this),e&&(this.ws.binaryType=e)}},{key:"onBackoffReady",value:function(t,e){this.open(!0)}},{key:"onCloseCallback",value:function(t){!this.isReconnect&&this.listeners.onclose&&this.listeners.onclose.apply(null,arguments),this.reconnectEnabled&&t.code<3e3&&this.backoff.backoff()}},{key:"onErrorCallback",value:function(){this.listeners.onerror&&this.listeners.onerror.apply(null,arguments)}},{key:"onMessageCallback",value:function(){this.listeners.onmessage&&this.listeners.onmessage.apply(null,arguments)}},{key:"onOpenCallback",value:function(){this.listeners.onopen&&this.listeners.onopen.apply(null,arguments),this.isReconnect&&this.listeners.onreconnect&&this.listeners.onreconnect.apply(null,arguments),this.isReconnect=!1}},{key:"close",value:function(t,e){void 0===t&&(t=1e3),this.reconnectEnabled=!1,this.ws.close(t,e)}},{key:"send",value:function(t){this.ws.send(t)}},{key:"bufferedAmount",get:function(){return this.ws.bufferedAmount}},{key:"readyState",get:function(){return this.ws.readyState}},{key:"binaryType",get:function(){return this.ws.binaryType},set:function(t){this.ws.binaryType=t}},{key:"extensions",get:function(){return this.ws.extensions},set:function(t){this.ws.extensions=t}},{key:"protocol",get:function(){return this.ws.protocol},set:function(t){this.ws.protocol=t}},{key:"onclose",set:function(t){this.listeners.onclose=t},get:function(){return this.listeners.onclose}},{key:"onerror",set:function(t){this.listeners.onerror=t},get:function(){return this.listeners.onerror}},{key:"onmessage",set:function(t){this.listeners.onmessage=t},get:function(){return this.listeners.onmessage}},{key:"onopen",set:function(t){this.listeners.onopen=t},get:function(){return this.listeners.onopen}},{key:"onreconnect",set:function(t){this.listeners.onreconnect=t},get:function(){return this.listeners.onreconnect}}]),t}();a.CONNECTING=s.CONNECTING,a.OPEN=s.OPEN,a.CLOSING=s.CLOSING,a.CLOSED=s.CLOSED,e.default=a},function(t,e,r){"use strict";function n(t,e){return new i(o[t],e)}function i(t,e){this.func=t,this.attempts=0,this.delay=void 0!==e.initialDelay?e.initialDelay:100}Object.defineProperty(e,"__esModule",{value:!0}),e.createBackoff=n;var o={exponential:function(t,e){return Math.floor(Math.random()*Math.pow(2,t)*e)},fibonacci:function(t,e){var r=1;if(t>r)for(var n=1,r=2,i=2;i=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),o.alloc(+t)}function v(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return J(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return M(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function _(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}var f;if(i){var h=-1;for(f=r;fa&&(r=a-u),f=r;f>=0;f--){for(var c=!0,l=0;li&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var u,f,h,c;switch(a){case 1:o<128&&(s=o);break;case 2:u=t[i+1],128==(192&u)&&(c=(31&o)<<6|63&u)>127&&(s=c);break;case 3:u=t[i+1],f=t[i+2],128==(192&u)&&128==(192&f)&&(c=(15&o)<<12|(63&u)<<6|63&f)>2047&&(c<55296||c>57343)&&(s=c);break;case 4:u=t[i+1],f=t[i+2],h=t[i+3],128==(192&u)&&128==(192&f)&&128==(192&h)&&(c=(15&o)<<18|(63&u)<<12|(63&f)<<6|63&h)>65535&&c<1114112&&(s=c)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return I(n)}function I(t){var e=t.length;if(e<=K)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,n,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function x(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return i||N(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return i||N(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,r,n,52,8),r+8}function z(t){if(t=q(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function J(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function G(t){return Q.toByteArray(z(t))}function W(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function H(t){return t!==t}var Q=r(20),X=r(21),Z=r(22);e.Buffer=o,e.SlowBuffer=d,e.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=n(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,e,r){return s(null,t,e,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,e,r){return u(null,t,e,r)},o.allocUnsafe=function(t){return f(null,t)},o.allocUnsafeSlow=function(t){return f(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},o.prototype.compare=function(t,e,r,n,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var s=i-n,a=r-e,u=Math.min(s,a),f=this.slice(n,i),h=t.slice(e,r),c=0;ci)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return A(this,t,e,r);case"latin1":case"binary":return O(this,t,e,r);case"base64":return P(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var K=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)n+=this[t+--e]*i;return n},o.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),X.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),X.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),X.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),X.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){B(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):x(this,t,e,!0),e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):j(this,t,e,!0),e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):j(this,t,e,!1),e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):x(this,t,e,!0),e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):x(this,t,e,!1),e+4},o.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(s<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var s;if("number"==typeof t)for(s=e;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function i(t){var e=n(t),r=e[0],i=e[1];return 3*(r+i)/4-i}function o(t,e,r){return 3*(e+r)/4-r}function s(t){for(var e,r=n(t),i=r[0],s=r[1],a=new l(o(t,i,s)),u=0,f=s>0?i-4:i,h=0;h>16&255,a[u++]=e>>8&255,a[u++]=255&e;return 2===s&&(e=c[t.charCodeAt(h)]<<2|c[t.charCodeAt(h+1)]>>4,a[u++]=255&e),1===s&&(e=c[t.charCodeAt(h)]<<10|c[t.charCodeAt(h+1)]<<4|c[t.charCodeAt(h+2)]>>2,a[u++]=e>>8&255,a[u++]=255&e),a}function a(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function u(t,e,r){for(var n,i=[],o=e;os?s:o+16383));return 1===n?(e=t[r-1],i.push(h[e>>2]+h[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(h[e>>10]+h[e>>4&63]+h[e<<2&63]+"=")),i.join("")}e.byteLength=i,e.toByteArray=s,e.fromByteArray=f;for(var h=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,d=p.length;y>1,h=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=f}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,f=8*o-i-1,h=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),e+=s+c>=1?l/u:l*Math.pow(2,1-c),e*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=y,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=y,s/=256,f-=8);t[r+p-y]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=function(){function t(t){void 0===t&&(t=!1),this.running=!1,this.now="undefined"!=typeof window&&window.performance&&window.performance.now&&window.performance.now.bind(window.performance)||Date.now,this.start(t)}return t.prototype.start=function(t){void 0===t&&(t=!1),this.deltaTime=0,this.currentTime=this.now(),this.elapsedTime=0,this.running=!0,t&&(this._interval=setInterval(this.tick.bind(this),1e3/60))},t.prototype.stop=function(){this.running=!1,this._interval&&clearInterval(this._interval)},t.prototype.tick=function(t){void 0===t&&(t=this.now()),this.deltaTime=t-this.currentTime,this.currentTime=t,this.elapsedTime+=this.deltaTime},t}();t.exports=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(25);e.StateContainer=n.StateContainer},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(26),i=function(){function t(t){this.listeners=[],this.matcherPlaceholders={":id":/^([a-zA-Z0-9\-_]+)$/,":number":/^([0-9]+)$/,":string":/^(\w+)$/,":axis":/^([xyz])$/,":*":/(.*)/},this.state=t,this.reset()}return t.prototype.set=function(t){var e=n.compare(this.state,t);return this.state=t,this.checkPatches(e,this.listeners,this.defaultListener),e},t.prototype.registerPlaceholder=function(t,e){this.matcherPlaceholders[t]=e},t.prototype.listen=function(t,e,r){var i,o=this;"function"==typeof t?(i=[],e=t):i=t.split("/"),e.length>1&&console.warn(".listen() accepts only one parameter.");var s={callback:e,rawRules:i,rules:i.map(function(t){return"string"==typeof t?0===t.indexOf(":")?o.matcherPlaceholders[t]||o.matcherPlaceholders[":*"]:new RegExp("^"+t+"$"):t})};return 0===i.length?this.defaultListener=s:this.listeners.push(s),r&&this.checkPatches(n.compare({},this.state),[s]),s},t.prototype.removeListener=function(t){for(var e=this.listeners.length-1;e>=0;e--)this.listeners[e]===t&&this.listeners.splice(e,1)},t.prototype.removeAllListeners=function(){this.reset()},t.prototype.checkPatches=function(t,e,r){for(var n=0,i=e.length;n=0;s--){var a=o&&this.getPathVariables(t[s],o);a&&(o.callback({path:a,rawPath:t[s].path,operation:t[s].operation,value:t[s].value}),t[s].matched=!0)}if(r)for(var s=t.length-1;s>=0;s--)t[s].matched||r.callback(t[s])},t.prototype.getPathVariables=function(t,e){if(t.path.length!==e.rules.length)return!1;for(var r={},n=0,i=e.rules.length;n2)return!1;":"===e.rawRules[n].substr(0,1)&&(r[e.rawRules[n].substr(1)]=o[1])}return r},t.prototype.reset=function(){this.listeners=[]},t}();e.StateContainer=i},function(t,e,r){"use strict";function n(t,e){var r=[];return s(t,e,r,[]),r}function i(t,e){var r=t.slice();return r.push(e),r}function o(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r=0;h--){var c=u[h],l=t[c];if(!e.hasOwnProperty(c)||void 0===e[c]&&void 0!==l&&!1===Array.isArray(e))r.push({operation:"remove",path:i(n,c)}),f=!0;else{var p=e[c];"object"==typeof l&&null!=l&&"object"==typeof p&&null!=p?s(l,p,r,i(n,c)):l!==p&&r.push({operation:"replace",path:i(n,c),value:p,previousValue:l})}}if(f||a.length!=u.length)for(var h=a.length-1;h>=0;h--){var c=a[h];if(!t.hasOwnProperty(c)&&void 0!==e[c]){var p=e[c],y=i(n,c);"object"==typeof p&&null!=p&&s({},p,r,y),r.push({operation:"add",path:y,value:p})}}}Object.defineProperty(e,"__esModule",{value:!0}),e.compare=n},function(t,e){!function(e,r){void 0!==t&&t.exports?t.exports=r():e.fossilDelta=r()}(this,function(){"use strict";function t(){this.a=0,this.b=0,this.i=0,this.z=new Array(s)}function e(t){this.a=t,this.pos=0}function r(){this.a=[]}function n(t){var e,r;for(e=1,r=64;t>=r;e++,r<<=6);return e}function i(t){for(var e=0,r=0,n=0,i=0,o=0,s=t.length;s>=16;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,e=e+t[o+4]|0,r=r+t[o+5]|0,n=n+t[o+6]|0,i=i+t[o+7]|0,e=e+t[o+8]|0,r=r+t[o+9]|0,n=n+t[o+10]|0,i=i+t[o+11]|0,e=e+t[o+12]|0,r=r+t[o+13]|0,n=n+t[o+14]|0,i=i+t[o+15]|0,o+=16,s-=16;for(;s>=4;)e=e+t[o+0]|0,r=r+t[o+1]|0,n=n+t[o+2]|0,i=i+t[o+3]|0,o+=4,s-=4;switch(i=((i+(n<<8)|0)+(r<<16)|0)+(e<<24)|0,s){case 3:i=i+(t[o+2]<<8)|0;case 2:i=i+(t[o+1]<<16)|0;case 1:i=i+(t[o+0]<<24)|0}return i>>>0}var o={},s=16;t.prototype.init=function(t,e){var r,n,i=0,o=0;for(r=0;r>>0};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~".split("").map(function(t){return t.charCodeAt(0)}),u=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1];return e.prototype.haveBytes=function(){return this.posthis.a.length)throw new RangeError("out of bounds");return t},e.prototype.getChar=function(){return String.fromCharCode(this.getByte())},e.prototype.getInt=function(){for(var t,e=0;this.haveBytes()&&(t=u[127&this.getByte()])>=0;)e=(e<<6)+t;return this.pos--,e>>>0},r.prototype.toArray=function(){return this.a},r.prototype.putByte=function(t){this.a.push(255&t)},r.prototype.putChar=function(t){this.putByte(t.charCodeAt(0))},r.prototype.putInt=function(t){var e,r,n=[];if(0===t)return void this.putChar("0");for(e=0;t>0;e++,t>>>=6)n.push(a[63&t]);for(r=e-1;r>=0;r--)this.putByte(n[r])},r.prototype.putArray=function(t,e,r){for(var n=e;n=0&&A-- >0;){var O,P,R,C,S,I,T,U;for(g=_*s,C=0,I=g,T=E+a;I=U&&O>w&&(w=O,b=g-S,m=R),_=p[_]}if(w>0){m>0&&(u.putInt(m),u.putChar(":"),u.putArray(o,E,E+m),E+=m),E+=w,u.putInt(w),u.putChar("@"),u.putInt(b),u.putChar(","),b+w-1>c&&(c=b+w-1),w=0;break}if(E+a+s>=f){u.putInt(f-E),u.putChar(":"),u.putArray(o,E,E+f-E),E=f;break}v.next(o[E+a+s]),a++}return Es)throw new Error("copy exceeds output file size");if(p+l>f)throw new Error("copy extends past end of input");c.putArray(t,p,p+l);break;case":":if((a+=l)>s)throw new Error("insert command gives an output larger than predicted");if(l>h)throw new Error("insert count exceeds size of delta");c.putArray(u.a,u.pos,u.pos+l),u.pos+=l;break;case";":var y=c.toArray();if((!o||!1!==o.verifyChecksum)&&l!==i(y))throw new Error("bad checksum");if(a!==s)throw new Error("generated size does not match predicted size");return y;default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")},o})},function(t,e,r){"use strict";function n(){return s||(s="undefined"!=typeof cc&&cc.sys&&cc.sys.localStorage?cc.sys.localStorage:"undefined"!=typeof window?window.localStorage:{cache:{},setItem:function(t,e){this.cache[t]=e},getItem:function(t){this.cache[t]}}),s}function i(t,e){n().setItem(t,e)}function o(t,e){var r=n().getItem(t);"undefined"!=typeof Promise&&r instanceof Promise?r.then(function(t){return e(t)}):e(r)}Object.defineProperty(e,"__esModule",{value:!0});var s;e.setItem=i,e.getItem=o},function(t,e,r){"use strict";function n(t,e,r,n,i){"var"===e.holderType?t[r]=n:"key"===e.holderType&&(t[r]=i)}function i(t,e,r,i){for(var o in e)e.hasOwnProperty(o)&&n(t,e[o],o,r[o],i)}function o(t,e,r){void 0===r&&(r=0);for(var n=t,i=0,o=e.length;i