From 2c372b8b1802416de58442302886ce72899e9507 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Sat, 25 May 2019 17:59:29 -0300 Subject: [PATCH] use latest httpie version. bump 0.10.7 --- dist/colyseus.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/colyseus.js b/dist/colyseus.js index 391af2a..4c3e520 100644 --- a/dist/colyseus.js +++ b/dist/colyseus.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Colyseus=t():e.Colyseus=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=18)}([function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(21)),o=r(n(22));t.decode=i.default,t.encode=o.default},function(e,t,n){"use strict";function r(e,t,n,r){var i,o=!1;switch(t){case"number":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":case"int64":case"uint64":case"float32":case"float64":i="number";break;case"string":i="string",o=!0;break;case"boolean":return}if(typeof e!==i&&(!o||o&&null!==e)){var s="'"+JSON.stringify(e)+"'"+(e&&e.constructor&&" ("+e.constructor.name+")");throw new d("a '"+i+"' was expected, but "+s+" was provided in "+n.constructor.name+"#"+r)}}function i(e,t,n,r){if(!(e instanceof t))throw new d("a '"+t.name+"' was expected, but '"+e.constructor.name+"' was provided in "+n.constructor.name+"#"+r)}function o(e,t,n,i,o){var s=c[e];return void 0===n?t.push(u.NIL):r(n,e,i,o),!!s&&(s(t,n),!0)}function s(e,t,n){var r=h[e];return r?r(t,n):null}var a=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var u=n(15),c=n(35),h=n(36),f=n(2),l=n(3),p=n(16),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t}(Error),v=function(){function e(){for(var e=[],t=0;t0;var w=!1;v.length>m&&(b-=v.length-m,v.splice(m).forEach(function(e,t){e&&e.onRemove&&e.onRemove(),_.onRemove&&_.onRemove(e,m+t)}));for(var O=0;O0;for(var w=!1,R=Object.keys(E),O=0;O0&&this.onChange(r),this},e.prototype.encode=function(e,t,n){var r=this;void 0===e&&(e=this),void 0===t&&(t=!1);var s=[],a=function(){r!==e&&s.push(u.END_OF_STRUCTURE)};if(!this.$changes.changed&&!t)return a(),s;for(var h=this._schema,p=this._indexes,d=this._filters,v=t||n?this.$changes.allChanges:this.$changes.changes,y=0,g=v.length;y=65536?(i-=65536,r+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):r+=String.fromCharCode(i)}else r+=String.fromCharCode((15&a)<<12|(63&e.getUint8(++o))<<6|(63&e.getUint8(++o))<<0);else r+=String.fromCharCode((31&a)<<6|63&e.getUint8(++o));else r+=String.fromCharCode(a)}return r}function i(e){void 0===e&&(e="");for(var t=0,n=0,r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n+1}Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.USER_ID=1]="USER_ID",e[e.JOIN_REQUEST=9]="JOIN_REQUEST",e[e.JOIN_ROOM=10]="JOIN_ROOM",e[e.JOIN_ERROR=11]="JOIN_ERROR",e[e.LEAVE_ROOM=12]="LEAVE_ROOM",e[e.ROOM_DATA=13]="ROOM_DATA",e[e.ROOM_STATE=14]="ROOM_STATE",e[e.ROOM_STATE_PATCH=15]="ROOM_STATE_PATCH",e[e.ROOM_LIST=20]="ROOM_LIST",e[e.BAD_REQUEST=50]="BAD_REQUEST"}(t.Protocol||(t.Protocol={})),t.utf8Read=r,t.utf8Length=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.OnceSignal=r.OnceSignal;var i=n(23);t.Signal=i.Signal;var o=n(8);t.Slot=o.Slot;var s=n(7);t.SlotList=s.SlotList},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),i=n(8),o=function(){function e(){for(var e=[],t=0;t."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.once=function(e){return this.addOnce(e)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=r.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(e),o=o.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new i.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();t.OnceSignal=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),r=n,i=this.tail;i.nonEmpty;)r=r.tail=new e(i.head),i=i.tail;return r.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var r=new e(this.head),i=r,o=this.tail;o.nonEmpty;){if(n>o.head.priority)return i.tail=o.prepend(t),r;i=i.tail=new e(o.head),o=o.tail}return i.tail=new e(t),r},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),r=n,i=this.tail;i.nonEmpty;){if(i.head.listener===t)return r.tail=i.tail,n;r=r.tail=new e(i.head),i=i.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();t.SlotList=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=r,this.verifyListener(e)}return e.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()}},e.prototype.execute1=function(e){if(this._enabled){if(this._once&&this.remove(),this._params&&this._params.length)return void this._listener.apply(null,[e].concat(this._params));this._listener(e)}},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();t.Slot=r},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(24)),a=o(n(0)),u=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t,void 0,{connect:n})||this;return r._enqueuedCalls=[],r}return r(t,e),t.prototype.onOpenCallback=function(t){if(e.prototype.onOpenCallback.call(this),this.binaryType="arraybuffer",this._enqueuedCalls.length>0){for(var n=0,r=this._enqueuedCalls;nr&&this.serializer.handshake){var s=Array.from(new Uint8Array(t.buffer.slice(r)));this.serializer.handshake(s)}this.onJoin.dispatch()}else n===u.Protocol.JOIN_ERROR?this.onError.dispatch(u.utf8Read(t,1)):n===u.Protocol.LEAVE_ROOM?this.leave():this.previousCode=n}},e.prototype.setState=function(e){this.serializer.setState(e),this.onStateChange.dispatch(this.serializer.getState())},e.prototype.patch=function(e){this.serializer.patch(e),this.onStateChange.dispatch(this.serializer.getState())},e}();t.Room=c},function(e,t,n){"use strict";function r(e,t){o[e]=t}function i(e){return o[e]}Object.defineProperty(t,"__esModule",{value:!0});var o={};t.registerSerializer=r,t.getSerializer=i},function(e,t,n){"use strict";function r(){return a||(a="undefined"!=typeof cc&&cc.sys&&cc.sys.localStorage?cc.sys.localStorage:"undefined"!=typeof window&&window.localStorage?window.localStorage:{cache:{},setItem:function(e,t){this.cache[e]=t},getItem:function(e){this.cache[e]},removeItem:function(e){delete this.cache[e]}}),a}function i(e,t){r().setItem(e,t)}function o(e){r().removeItem(e)}function s(e,t){var n=r().getItem(e);"undefined"!=typeof Promise&&n instanceof Promise?n.then(function(e){return t(e)}):t(n)}Object.defineProperty(t,"__esModule",{value:!0});var a;t.setItem=i,t.removeItem=o,t.getItem=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]=0&&this.allChanges.splice(n,1):this.allChanges.push(e),this.parent&&this.parent.change(this.parentField)},e.prototype.mapIndex=function(e,t){this.indexMap||(this.indexMap=new Map,this.indexChange=new Map),this.indexMap.set(e,t)},e.prototype.getIndex=function(e){return this.indexMap&&this.indexMap.get(e)},e.prototype.deleteIndex=function(e){this.indexMap.delete(e)},e.prototype.mapIndexChange=function(e,t){this.indexChange.set(e,t)},e.prototype.getIndexChange=function(e){return this.indexChange&&this.indexChange.get(e)},e.prototype.deleteIndexChange=function(e){this.indexChange.delete(e)},e.prototype.changeAll=function(e){if(e instanceof r.Schema){var t=e._schema;for(var n in t)(e[n]instanceof r.Schema||e[n]instanceof i.ArraySchema||e[n]instanceof o.MapSchema)&&!e[n].$changes.parent.parent&&(e[n].$changes.parent=this),this.change(n)}else for(var s=Object.keys(e),a=0,u=s;af&&(h=a.utf8Read(o,f)+"/"),u.connect(this.buildEndpoint(h+u.id,u.options)),delete this.connectingRooms[n]}else if(s===a.Protocol.JOIN_ERROR){var l=a.utf8Read(o,1);console.error("colyseus.js: server error:",l),this.onError.dispatch(l)}else s===a.Protocol.ROOM_LIST&&(this.previousCode=s)}},e.prototype.getNextRequestId=function(){return++this.requestId%255},e}();t.Client=l},function(e,t,n){"use strict";function r(e){if(this._offset=0,e instanceof ArrayBuffer)this._buffer=e,this._view=new DataView(this._buffer);else{if(!ArrayBuffer.isView(e))throw new Error("Invalid argument");this._buffer=e.buffer,this._view=new DataView(this._buffer,e.byteOffset,e.byteLength)}}function i(e,t,n){for(var r="",i=0,o=t,s=t+n;o=65536?(i-=65536,r+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):r+=String.fromCharCode(i)}else r+=String.fromCharCode((15&a)<<12|(63&e.getUint8(++o))<<6|(63&e.getUint8(++o))<<0);else r+=String.fromCharCode((31&a)<<6|63&e.getUint8(++o));else r+=String.fromCharCode(a)}return r}function o(e){var t=new r(e),n=t._parse();if(t._offset!==e.byteLength)throw new Error(e.byteLength-t._offset+" trailing bytes");return n}r.prototype._array=function(e){for(var t=new Array(e),n=0;n223)return-1*(255-t+1);switch(t){case 192:return null;case 194:return!1;case 195:return!0;case 196:return n=this._view.getUint8(this._offset),this._offset+=1,this._bin(n);case 197:return n=this._view.getUint16(this._offset),this._offset+=2,this._bin(n);case 198:return n=this._view.getUint32(this._offset),this._offset+=4,this._bin(n);case 199:return n=this._view.getUint8(this._offset),r=this._view.getInt8(this._offset+1),this._offset+=2,[r,this._bin(n)];case 200:return n=this._view.getUint16(this._offset),r=this._view.getInt8(this._offset+2),this._offset+=3,[r,this._bin(n)];case 201:return n=this._view.getUint32(this._offset),r=this._view.getInt8(this._offset+4),this._offset+=5,[r,this._bin(n)];case 202:return e=this._view.getFloat32(this._offset),this._offset+=4,e;case 203:return e=this._view.getFloat64(this._offset),this._offset+=8,e;case 204:return e=this._view.getUint8(this._offset),this._offset+=1,e;case 205:return e=this._view.getUint16(this._offset),this._offset+=2,e;case 206:return e=this._view.getUint32(this._offset),this._offset+=4,e;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 e=this._view.getInt8(this._offset),this._offset+=1,e;case 209:return e=this._view.getInt16(this._offset),this._offset+=2,e;case 210:return e=this._view.getInt32(this._offset),this._offset+=4,e;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 r=this._view.getInt8(this._offset),this._offset+=1,0===r?void(this._offset+=1):[r,this._bin(1)];case 213:return r=this._view.getInt8(this._offset),this._offset+=1,[r,this._bin(2)];case 214:return r=this._view.getInt8(this._offset),this._offset+=1,[r,this._bin(4)];case 215:return r=this._view.getInt8(this._offset),this._offset+=1,0===r?(i=this._view.getInt32(this._offset)*Math.pow(2,32),o=this._view.getUint32(this._offset+4),this._offset+=8,new Date(i+o)):[r,this._bin(8)];case 216:return r=this._view.getInt8(this._offset),this._offset+=1,[r,this._bin(16)];case 217:return n=this._view.getUint8(this._offset),this._offset+=1,this._str(n);case 218:return n=this._view.getUint16(this._offset),this._offset+=2,this._str(n);case 219:return n=this._view.getUint32(this._offset),this._offset+=4,this._str(n);case 220:return n=this._view.getUint16(this._offset),this._offset+=2,this._array(n);case 221:return n=this._view.getUint32(this._offset),this._offset+=4,this._array(n);case 222:return n=this._view.getUint16(this._offset),this._offset+=2,this._map(n);case 223:return n=this._view.getUint32(this._offset),this._offset+=4,this._map(n)}throw new Error("Could not parse")},e.exports=o},function(e,t,n){"use strict";function r(e,t,n){for(var r=0,i=0,o=n.length;i>6),e.setUint8(t++,128|63&r)):r<55296||r>=57344?(e.setUint8(t++,224|r>>12),e.setUint8(t++,128|r>>6&63),e.setUint8(t++,128|63&r)):(i++,r=65536+((1023&r)<<10|1023&n.charCodeAt(i)),e.setUint8(t++,240|r>>18),e.setUint8(t++,128|r>>12&63),e.setUint8(t++,128|r>>6&63),e.setUint8(t++,128|63&r))}function i(e){for(var t=0,n=0,r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function o(e,t,n){var r=typeof n,s=0,a=0,u=0,c=0,h=0,f=0;if("string"===r){if((h=i(n))<32)e.push(160|h),f=1;else if(h<256)e.push(217,h),f=2;else if(h<65536)e.push(218,h>>8,h),f=3;else{if(!(h<4294967296))throw new Error("String too long");e.push(219,h>>24,h>>16,h>>8,h),f=5}return t.push({_str:n,_length:h,_offset:e.length}),f+h}if("number"===r)return Math.floor(n)===n&&isFinite(n)?n>=0?n<128?(e.push(n),1):n<256?(e.push(204,n),2):n<65536?(e.push(205,n>>8,n),3):n<4294967296?(e.push(206,n>>24,n>>16,n>>8,n),5):(u=n/Math.pow(2,32)>>0,c=n>>>0,e.push(207,u>>24,u>>16,u>>8,u,c>>24,c>>16,c>>8,c),9):n>=-32?(e.push(n),1):n>=-128?(e.push(208,n),2):n>=-32768?(e.push(209,n>>8,n),3):n>=-2147483648?(e.push(210,n>>24,n>>16,n>>8,n),5):(u=Math.floor(n/Math.pow(2,32)),c=n>>>0,e.push(211,u>>24,u>>16,u>>8,u,c>>24,c>>16,c>>8,c),9):(e.push(203),t.push({_float:n,_length:8,_offset:e.length}),9);if("object"===r){if(null===n)return e.push(192),1;if(Array.isArray(n)){if((h=n.length)<16)e.push(144|h),f=1;else if(h<65536)e.push(220,h>>8,h),f=3;else{if(!(h<4294967296))throw new Error("Array too large");e.push(221,h>>24,h>>16,h>>8,h),f=5}for(s=0;s>>0,e.push(215,0,u>>24,u>>16,u>>8,u,c>>24,c>>16,c>>8,c),10}if(n instanceof ArrayBuffer){if((h=n.byteLength)<256)e.push(196,h),f=2;else if(h<65536)e.push(197,h>>8,h),f=3;else{if(!(h<4294967296))throw new Error("Buffer too large");e.push(198,h>>24,h>>16,h>>8,h),f=5}return t.push({_bin:n,_length:h,_offset:e.length}),f+h}if("function"==typeof n.toJSON)return o(e,t,n.toJSON());var p=[],d="",v=Object.keys(n);for(s=0,a=v.length;s>8,h),f=3;else{if(!(h<4294967296))throw new Error("Object too large");e.push(223,h>>24,h>>16,h>>8,h),f=5}for(s=0;s0&&(h=n[0]._offset);for(var f,l=0,p=0,d=0,v=t.length;d2&&void 0!==arguments[2]?arguments[2]:{};r(this,e),this.url=t,this.protocols=n,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(e,[{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isReconnect=e;var t=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),t&&(this.ws.binaryType=t)}},{key:"onBackoffReady",value:function(e,t){this.open(!0)}},{key:"onCloseCallback",value:function(e){!this.isReconnect&&this.listeners.onclose&&this.listeners.onclose.apply(null,arguments),this.reconnectEnabled&&e.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(e,t){void 0===e&&(e=1e3),this.reconnectEnabled=!1,this.ws.close(e,t)}},{key:"send",value:function(e){this.ws.send(e)}},{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(e){this.ws.binaryType=e}},{key:"extensions",get:function(){return this.ws.extensions},set:function(e){this.ws.extensions=e}},{key:"protocol",get:function(){return this.ws.protocol},set:function(e){this.ws.protocol=e}},{key:"onclose",set:function(e){this.listeners.onclose=e},get:function(){return this.listeners.onclose}},{key:"onerror",set:function(e){this.listeners.onerror=e},get:function(){return this.listeners.onerror}},{key:"onmessage",set:function(e){this.listeners.onmessage=e},get:function(){return this.listeners.onmessage}},{key:"onopen",set:function(e){this.listeners.onopen=e},get:function(){return this.listeners.onopen}},{key:"onreconnect",set:function(e){this.listeners.onreconnect=e},get:function(){return this.listeners.onreconnect}}]),e}();a.CONNECTING=s.CONNECTING,a.OPEN=s.OPEN,a.CLOSING=s.CLOSING,a.CLOSED=s.CLOSED,t.default=a},function(e,t,n){"use strict";function r(e,t){return new i(o[e],t)}function i(e,t){this.func=e,this.attempts=0,this.delay=void 0!==t.initialDelay?t.initialDelay:100}Object.defineProperty(t,"__esModule",{value:!0}),t.createBackoff=r;var o={exponential:function(e,t){return Math.floor(Math.random()*Math.pow(2,e)*t)},fibonacci:function(e,t){var n=1;if(e>n)for(var r=1,n=2,i=2;i=400?o:i)(h)},(a=n.body)&&/Array|Object/.test(a.constructor.name)&&(f["content-type"]="application/json",a=JSON.stringify(a));for(s in f)h.setRequestHeader(s,f[s]);h.send(a)})}Object.defineProperty(t,"__esModule",{value:!0}),t.send=i,n.d(t,"get",function(){return o}),n.d(t,"post",function(){return s}),n.d(t,"patch",function(){return a}),n.d(t,"del",function(){return u}),n.d(t,"put",function(){return c});var o=i.bind(i,"GET"),s=i.bind(i,"POST"),a=i.bind(i,"PATCH"),u=i.bind(i,"DELETE"),c=i.bind(i,"PUT")},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]1&&console.warn(".listen() accepts only one parameter.");var s={callback:t,rawRules:i,rules:i.map(function(e){return"string"==typeof e?0===e.indexOf(":")?o.matcherPlaceholders[e]||o.matcherPlaceholders[":*"]:new RegExp("^"+e+"$"):e})};return 0===i.length?this.defaultListener=s:this.listeners.push(s),n&&this.checkPatches(r.compare({},this.state),[s]),s},e.prototype.removeListener=function(e){for(var t=this.listeners.length-1;t>=0;t--)this.listeners[t]===e&&this.listeners.splice(t,1)},e.prototype.removeAllListeners=function(){this.reset()},e.prototype.checkPatches=function(e,t,n){for(var r=0,i=t.length;r=0;s--){var a=o&&this.getPathVariables(e[s],o);a&&(o.callback({path:a,rawPath:e[s].path,operation:e[s].operation,value:e[s].value}),e[s].matched=!0)}if(n)for(var s=e.length-1;s>=0;s--)e[s].matched||n.callback(e[s])},e.prototype.getPathVariables=function(e,t){if(e.path.length!==t.rules.length)return!1;for(var n={},r=0,i=t.rules.length;r2)return!1;":"===t.rawRules[r].substr(0,1)&&(n[t.rawRules[r].substr(1)]=o[1])}return n},e.prototype.reset=function(){this.listeners=[]},e}();t.StateContainer=i},function(e,t,n){"use strict";function r(e,t){var n=[];return s(e,t,n,[]),n}function i(e,t){var n=e.slice();return n.push(t),n}function o(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=0;h--){var f=u[h],l=e[f];if(!t.hasOwnProperty(f)||void 0===t[f]&&void 0!==l&&!1===Array.isArray(t))n.push({operation:"remove",path:i(r,f)}),c=!0;else{var p=t[f];"object"==typeof l&&null!=l&&"object"==typeof p&&null!=p?s(l,p,n,i(r,f)):l!==p&&n.push({operation:"replace",path:i(r,f),value:p,previousValue:l})}}if(c||a.length!=u.length)for(var h=a.length-1;h>=0;h--){var f=a[h];if(!e.hasOwnProperty(f)&&void 0!==t[f]){var p=t[f],d=i(r,f);"object"==typeof p&&null!=p&&s({},p,n,d),n.push({operation:"add",path:d,value:p})}}}Object.defineProperty(t,"__esModule",{value:!0}),t.compare=r},function(e,t){!function(t,n){void 0!==e&&e.exports?e.exports=n():t.fossilDelta=n()}(this,function(){"use strict";function e(){this.a=0,this.b=0,this.i=0,this.z=new Array(s)}function t(e){this.a=e,this.pos=0}function n(){this.a=[]}function r(e){var t,n;for(t=1,n=64;e>=n;t++,n<<=6);return t}function i(e){for(var t=0,n=0,r=0,i=0,o=0,s=e.length;s>=16;)t=t+e[o+0]|0,n=n+e[o+1]|0,r=r+e[o+2]|0,i=i+e[o+3]|0,t=t+e[o+4]|0,n=n+e[o+5]|0,r=r+e[o+6]|0,i=i+e[o+7]|0,t=t+e[o+8]|0,n=n+e[o+9]|0,r=r+e[o+10]|0,i=i+e[o+11]|0,t=t+e[o+12]|0,n=n+e[o+13]|0,r=r+e[o+14]|0,i=i+e[o+15]|0,o+=16,s-=16;for(;s>=4;)t=t+e[o+0]|0,n=n+e[o+1]|0,r=r+e[o+2]|0,i=i+e[o+3]|0,o+=4,s-=4;switch(i=((i+(r<<8)|0)+(n<<16)|0)+(t<<24)|0,s){case 3:i=i+(e[o+2]<<8)|0;case 2:i=i+(e[o+1]<<16)|0;case 1:i=i+(e[o+0]<<24)|0}return i>>>0}var o={},s=16;e.prototype.init=function(e,t){var n,r,i=0,o=0;for(n=0;n>>0};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~".split("").map(function(e){return e.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 t.prototype.haveBytes=function(){return this.posthis.a.length)throw new RangeError("out of bounds");return e},t.prototype.getChar=function(){return String.fromCharCode(this.getByte())},t.prototype.getInt=function(){for(var e,t=0;this.haveBytes()&&(e=u[127&this.getByte()])>=0;)t=(t<<6)+e;return this.pos--,t>>>0},n.prototype.toArray=function(){return this.a},n.prototype.putByte=function(e){this.a.push(255&e)},n.prototype.putChar=function(e){this.putByte(e.charCodeAt(0))},n.prototype.putInt=function(e){var t,n,r=[];if(0===e)return void this.putChar("0");for(t=0;e>0;t++,e>>>=6)r.push(a[63&e]);for(n=t-1;n>=0;n--)this.putByte(r[n])},n.prototype.putArray=function(e,t,n){for(var r=t;r=0&&C-- >0;){var A,S,I,E,P,R,k,j;for(g=_*s,E=0,R=g,k=O+a;R=j&&A>m&&(m=A,b=g-P,w=I),_=p[_]}if(m>0){w>0&&(u.putInt(w),u.putChar(":"),u.putArray(o,O,O+w),O+=w),O+=m,u.putInt(m),u.putChar("@"),u.putInt(b),u.putChar(","),b+m-1>f&&(f=b+m-1),m=0;break}if(O+a+s>=c){u.putInt(c-O),u.putChar(":"),u.putArray(o,O,O+c-O),O=c;break}y.next(o[O+a+s]),a++}return Os)throw new Error("copy exceeds output file size");if(p+l>c)throw new Error("copy extends past end of input");f.putArray(e,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");f.putArray(u.a,u.pos,u.pos+l),u.pos+=l;break;case";":var d=f.toArray();if((!o||!1!==o.verifyChecksum)&&l!==i(d))throw new Error("bad checksum");if(a!==s)throw new Error("generated size does not match predicted size");return d;default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")},o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),i=function(){function e(){}return e.prototype.setState=function(e){this.state.decode(e)},e.prototype.getState=function(){return this.state},e.prototype.patch=function(e){this.state.decode(e)},e.prototype.teardown=function(){},e.prototype.handshake=function(e){if(this.state){(new r.Reflection).decode(e)}else this.state=r.Reflection.decode(e)},e}();t.SchemaSerializer=i},function(e,t,n){"use strict";function r(e){for(var t=0,n=0,r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function i(e,t,n){for(var r=0,i=0,o=n.length;i>6,e[t++]=128|63&r):r<55296||r>=57344?(e[t++]=224|r>>12,e[t++]=128|r>>6&63,e[t++]=128|63&r):(i++,r=65536+((1023&r)<<10|1023&n.charCodeAt(i)),e[t++]=240|r>>18,e[t++]=128|r>>12&63,e[t++]=128|r>>6&63,e[t++]=128|63&r)}function o(e,t){e.push(t)}function s(e,t){e.push(t)}function a(e,t){e.push(t),e.push(t>>8)}function u(e,t){e.push(t),e.push(t>>8)}function c(e,t){e.push(t),e.push(t>>8),e.push(t>>16),e.push(t>>24)}function h(e,t){var n=t>>24,r=t>>16,i=t>>8,o=t;e.push(o),e.push(i),e.push(r),e.push(n)}function f(e,t){var n=Math.floor(t/Math.pow(2,32));h(e,t>>>0),h(e,n)}function l(e,t){var n=t/Math.pow(2,32)>>0;h(e,t>>>0),h(e,n)}function p(e,t){v(e,t)}function d(e,t){y(e,t)}function v(e,t){O[0]=t,c(e,w[0])}function y(e,t){C[0]=t,c(e,w[b?0:1]),c(e,w[b?1:0])}function g(e,t){return s(e,t?1:0)}function _(e,t){t||(t="");var n=r(t),o=0;if(n<32)e.push(160|n),o=1;else if(n<256)e.push(217),s(e,n),o=2;else if(n<65536)e.push(218),u(e,n),o=3;else{if(!(n<4294967296))throw new Error("String too long");e.push(219),h(e,n),o=5}return i(e,e.length,t),o+n}function m(e,t){return isNaN(t)?(console.error("trying to encode a NaN value. will be encoded as `0`."),m(e,0)):isFinite(t)?Math.floor(t)===t&&isFinite(t)?t>=0?t<128?(s(e,t),1):t<256?(e.push(204),s(e,t),2):t<65536?(e.push(205),u(e,t),3):t<4294967296?(e.push(206),h(e,t),5):(e.push(207),l(e,t),9):t>=-32?(e.push(t),1):t>=-128?(e.push(208),o(e,t),2):t>=-32768?(e.push(209),a(e,t),3):t>=-2147483648?(e.push(210),c(e,t),5):(e.push(211),f(e,t),9):(e.push(203),y(e,t),9):m(e,t>0?Number.MAX_SAFE_INTEGER:-Number.MAX_SAFE_INTEGER)}Object.defineProperty(t,"__esModule",{value:!0}),t.utf8Write=i,t.int8=o,t.uint8=s,t.int16=a,t.uint16=u,t.int32=c,t.uint32=h,t.int64=f,t.uint64=l,t.float32=p,t.float64=d;var b=!0,w=new Int32Array(2),O=new Float32Array(w.buffer),C=new Float64Array(w.buffer);t.writeFloat32=v,t.writeFloat64=y,t.boolean=g,t.string=_,t.number=m},function(e,t,n){"use strict";function r(e,t,n){for(var r="",i=0,o=t,s=t+n;o=65536?(i-=65536,r+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):r+=String.fromCharCode(i)}else r+=String.fromCharCode((15&a)<<12|(63&e[++o])<<6|(63&e[++o])<<0);else r+=String.fromCharCode((31&a)<<6|63&e[++o]);else r+=String.fromCharCode(a)}return r}function i(e,t){return o(e,t)<<24>>24}function o(e,t){return e[t.offset++]}function s(e,t){return a(e,t)<<16>>16}function a(e,t){return e[t.offset++]|e[t.offset++]<<8}function u(e,t){return e[t.offset++]|e[t.offset++]<<8|e[t.offset++]<<16|e[t.offset++]<<24}function c(e,t){return u(e,t)>>>0}function h(e,t){return d(e,t)}function f(e,t){return v(e,t)}function l(e,t){var n=c(e,t);return u(e,t)*Math.pow(2,32)+n}function p(e,t){var n=c(e,t);return c(e,t)*Math.pow(2,32)+n}function d(e,t){return I[0]=u(e,t),E[0]}function v(e,t){return I[S?0:1]=u(e,t),I[S?1:0]=u(e,t),P[0]}function y(e,t){return o(e,t)>0}function g(e,t){var n,i=e[t.offset++];i<192?n=31&i:217===i?n=o(e,t):218===i?n=a(e,t):219===i&&(n=c(e,t));var s=r(e,t.offset,n);return t.offset+=n,s}function _(e,t){var n=e[t.offset];return n<192&&n>160||217===n||218===n||219===n}function m(e,t){var n=e[t.offset++];return n<128?n:202===n?d(e,t):203===n?v(e,t):204===n?o(e,t):205===n?a(e,t):206===n?c(e,t):207===n?p(e,t):208===n?i(e,t):209===n?s(e,t):210===n?u(e,t):211===n?l(e,t):n>223?-1*(255-n+1):void 0}function b(e,t){var n=e[t.offset];return n<128||n>=202&&n<=211}function w(e,t){return e[t.offset]<160}function O(e,t){return e[t.offset]===A.NIL}function C(e,t){return e[t.offset]===A.INDEX_CHANGE}Object.defineProperty(t,"__esModule",{value:!0});var A=n(15);t.int8=i,t.uint8=o,t.int16=s,t.uint16=a,t.int32=u,t.uint32=c,t.float32=h,t.float64=f,t.int64=l,t.uint64=p;var S=!0,I=new Int32Array(2),E=new Float32Array(I.buffer),P=new Float64Array(I.buffer);t.readFloat32=d,t.readFloat64=v,t.boolean=y,t.string=g,t.stringCheck=_,t.number=m,t.numberCheck=b,t.arrayCheck=w,t.nilCheck=O,t.indexChangeCheck=C},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=n(1),a=n(2),u=n(3),c=new o.Context,h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),i([o.type("string",c)],t.prototype,"name",void 0),i([o.type("string",c)],t.prototype,"type",void 0),i([o.type("uint8",c)],t.prototype,"referencedType",void 0),t}(s.Schema);t.ReflectionField=h;var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.fields=new a.ArraySchema,t}return r(t,e),i([o.type("uint8",c)],t.prototype,"id",void 0),i([o.type([h],c)],t.prototype,"fields",void 0),t}(s.Schema);t.ReflectionType=f;var l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.types=new a.ArraySchema,t}return r(t,e),t.encode=function(e){var n=e.constructor,r=new t;r.rootType=n._typeid;var i=n._context.types;for(var o in i){var s=new f;s.id=Number(o),function(e,t){for(var n in t){var i=new h;i.name=n;var o=void 0;if("string"==typeof t[n])o=t[n];else{var s="function"==typeof t[n],a=Array.isArray(t[n]),u=!a&&t[n].map,c=void 0;s?(o="ref",c=t[n]):a?(o="array","string"==typeof t[n][0]?o+=":"+t[n][0]:c=t[n][0]):u&&(o="map","string"==typeof t[n].map?o+=":"+t[n].map:c=t[n].map),i.referencedType=c?c._typeid:255}i.type=o,e.fields.push(i)}r.types.push(e)}(s,i[o]._schema)}return r.encodeAll()},t.decode=function(e){var n=new o.Context,i=new t;i.decode(e);var c=i.types.reduce(function(e,t){return e[t.id]=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(s.Schema),e},{});i.types.forEach(function(e,t){e.fields.forEach(function(t){var r=c[e.id];if(void 0!==t.referencedType){var i=c[t.referencedType];i||(i=t.type.split(":")[1]),0===t.type.indexOf("array")?o.type([i],n)(r.prototype,t.name):0===t.type.indexOf("map")?o.type({map:i},n)(r.prototype,t.name):"ref"===t.type&&o.type(i,n)(r.prototype,t.name)}else o.type(t.type,n)(r.prototype,t.name)})});var h=c[i.rootType],f=new h;for(var l in h._schema){var p=h._schema[l];if("string"!=typeof p){var d="function"==typeof p,v=Array.isArray(p),y=!v&&p.map;f[l]=v?new a.ArraySchema:y?new u.MapSchema:d?new p:void 0}}return f},i([o.type([f],c)],t.prototype,"types",void 0),i([o.type("uint8",c)],t.prototype,"rootType",void 0),t}(s.Schema);t.Reflection=l}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Colyseus=t():e.Colyseus=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=18)}([function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(21)),o=r(n(22));t.decode=i.default,t.encode=o.default},function(e,t,n){"use strict";function r(e,t,n,r){var i,o=!1;switch(t){case"number":case"int8":case"uint8":case"int16":case"uint16":case"int32":case"uint32":case"int64":case"uint64":case"float32":case"float64":i="number";break;case"string":i="string",o=!0;break;case"boolean":return}if(typeof e!==i&&(!o||o&&null!==e)){var s="'"+JSON.stringify(e)+"'"+(e&&e.constructor&&" ("+e.constructor.name+")");throw new d("a '"+i+"' was expected, but "+s+" was provided in "+n.constructor.name+"#"+r)}}function i(e,t,n,r){if(!(e instanceof t))throw new d("a '"+t.name+"' was expected, but '"+e.constructor.name+"' was provided in "+n.constructor.name+"#"+r)}function o(e,t,n,i,o){var s=c[e];return void 0===n?t.push(u.NIL):r(n,e,i,o),!!s&&(s(t,n),!0)}function s(e,t,n){var r=h[e];return r?r(t,n):null}var a=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var u=n(15),c=n(35),h=n(36),f=n(2),l=n(3),p=n(16),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a(t,e),t}(Error),v=function(){function e(){for(var e=[],t=0;t0;var w=!1;v.length>m&&(b-=v.length-m,v.splice(m).forEach(function(e,t){e&&e.onRemove&&e.onRemove(),_.onRemove&&_.onRemove(e,m+t)}));for(var O=0;O0;for(var w=!1,R=Object.keys(E),O=0;O0&&this.onChange(r),this},e.prototype.encode=function(e,t,n){var r=this;void 0===e&&(e=this),void 0===t&&(t=!1);var s=[],a=function(){r!==e&&s.push(u.END_OF_STRUCTURE)};if(!this.$changes.changed&&!t)return a(),s;for(var h=this._schema,p=this._indexes,d=this._filters,v=t||n?this.$changes.allChanges:this.$changes.changes,y=0,g=v.length;y=65536?(i-=65536,r+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):r+=String.fromCharCode(i)}else r+=String.fromCharCode((15&a)<<12|(63&e.getUint8(++o))<<6|(63&e.getUint8(++o))<<0);else r+=String.fromCharCode((31&a)<<6|63&e.getUint8(++o));else r+=String.fromCharCode(a)}return r}function i(e){void 0===e&&(e="");for(var t=0,n=0,r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n+1}Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.USER_ID=1]="USER_ID",e[e.JOIN_REQUEST=9]="JOIN_REQUEST",e[e.JOIN_ROOM=10]="JOIN_ROOM",e[e.JOIN_ERROR=11]="JOIN_ERROR",e[e.LEAVE_ROOM=12]="LEAVE_ROOM",e[e.ROOM_DATA=13]="ROOM_DATA",e[e.ROOM_STATE=14]="ROOM_STATE",e[e.ROOM_STATE_PATCH=15]="ROOM_STATE_PATCH",e[e.ROOM_LIST=20]="ROOM_LIST",e[e.BAD_REQUEST=50]="BAD_REQUEST"}(t.Protocol||(t.Protocol={})),t.utf8Read=r,t.utf8Length=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);t.OnceSignal=r.OnceSignal;var i=n(23);t.Signal=i.Signal;var o=n(8);t.Slot=o.Slot;var s=n(7);t.SlotList=s.SlotList},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),i=n(8),o=function(){function e(){for(var e=[],t=0;t."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.once=function(e){return this.addOnce(e)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=r.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(e),o=o.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new i.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();t.OnceSignal=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),r=n,i=this.tail;i.nonEmpty;)r=r.tail=new e(i.head),i=i.tail;return r.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var r=new e(this.head),i=r,o=this.tail;o.nonEmpty;){if(n>o.head.priority)return i.tail=o.prepend(t),r;i=i.tail=new e(o.head),o=o.tail}return i.tail=new e(t),r},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),r=n,i=this.tail;i.nonEmpty;){if(i.head.listener===t)return r.tail=i.tail,n;r=r.tail=new e(i.head),i=i.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();t.SlotList=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t,n,r){void 0===n&&(n=!1),void 0===r&&(r=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=r,this.verifyListener(e)}return e.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()}},e.prototype.execute1=function(e){if(this._enabled){if(this._once&&this.remove(),this._params&&this._params.length)return void this._listener.apply(null,[e].concat(this._params));this._listener(e)}},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();t.Slot=r},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(24)),a=o(n(0)),u=function(e){function t(t,n){void 0===n&&(n=!0);var r=e.call(this,t,void 0,{connect:n})||this;return r._enqueuedCalls=[],r}return r(t,e),t.prototype.onOpenCallback=function(t){if(e.prototype.onOpenCallback.call(this),this.binaryType="arraybuffer",this._enqueuedCalls.length>0){for(var n=0,r=this._enqueuedCalls;nr&&this.serializer.handshake){var s=Array.from(new Uint8Array(t.buffer.slice(r)));this.serializer.handshake(s)}this.onJoin.dispatch()}else n===u.Protocol.JOIN_ERROR?this.onError.dispatch(u.utf8Read(t,1)):n===u.Protocol.LEAVE_ROOM?this.leave():this.previousCode=n}},e.prototype.setState=function(e){this.serializer.setState(e),this.onStateChange.dispatch(this.serializer.getState())},e.prototype.patch=function(e){this.serializer.patch(e),this.onStateChange.dispatch(this.serializer.getState())},e}();t.Room=c},function(e,t,n){"use strict";function r(e,t){o[e]=t}function i(e){return o[e]}Object.defineProperty(t,"__esModule",{value:!0});var o={};t.registerSerializer=r,t.getSerializer=i},function(e,t,n){"use strict";function r(){return a||(a="undefined"!=typeof cc&&cc.sys&&cc.sys.localStorage?cc.sys.localStorage:"undefined"!=typeof window&&window.localStorage?window.localStorage:{cache:{},setItem:function(e,t){this.cache[e]=t},getItem:function(e){this.cache[e]},removeItem:function(e){delete this.cache[e]}}),a}function i(e,t){r().setItem(e,t)}function o(e){r().removeItem(e)}function s(e,t){var n=r().getItem(e);"undefined"!=typeof Promise&&n instanceof Promise?n.then(function(e){return t(e)}):t(n)}Object.defineProperty(t,"__esModule",{value:!0});var a;t.setItem=i,t.removeItem=o,t.getItem=s},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]=0&&this.allChanges.splice(n,1):this.allChanges.push(e),this.parent&&this.parent.change(this.parentField)},e.prototype.mapIndex=function(e,t){this.indexMap||(this.indexMap=new Map,this.indexChange=new Map),this.indexMap.set(e,t)},e.prototype.getIndex=function(e){return this.indexMap&&this.indexMap.get(e)},e.prototype.deleteIndex=function(e){this.indexMap.delete(e)},e.prototype.mapIndexChange=function(e,t){this.indexChange.set(e,t)},e.prototype.getIndexChange=function(e){return this.indexChange&&this.indexChange.get(e)},e.prototype.deleteIndexChange=function(e){this.indexChange.delete(e)},e.prototype.changeAll=function(e){if(e instanceof r.Schema){var t=e._schema;for(var n in t)(e[n]instanceof r.Schema||e[n]instanceof i.ArraySchema||e[n]instanceof o.MapSchema)&&!e[n].$changes.parent.parent&&(e[n].$changes.parent=this),this.change(n)}else for(var s=Object.keys(e),a=0,u=s;af&&(h=a.utf8Read(o,f)+"/"),u.connect(this.buildEndpoint(h+u.id,u.options)),delete this.connectingRooms[n]}else if(s===a.Protocol.JOIN_ERROR){var l=a.utf8Read(o,1);console.error("colyseus.js: server error:",l),this.onError.dispatch(l)}else s===a.Protocol.ROOM_LIST&&(this.previousCode=s)}},e.prototype.getNextRequestId=function(){return++this.requestId%255},e}();t.Client=l},function(e,t,n){"use strict";function r(e){if(this._offset=0,e instanceof ArrayBuffer)this._buffer=e,this._view=new DataView(this._buffer);else{if(!ArrayBuffer.isView(e))throw new Error("Invalid argument");this._buffer=e.buffer,this._view=new DataView(this._buffer,e.byteOffset,e.byteLength)}}function i(e,t,n){for(var r="",i=0,o=t,s=t+n;o=65536?(i-=65536,r+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):r+=String.fromCharCode(i)}else r+=String.fromCharCode((15&a)<<12|(63&e.getUint8(++o))<<6|(63&e.getUint8(++o))<<0);else r+=String.fromCharCode((31&a)<<6|63&e.getUint8(++o));else r+=String.fromCharCode(a)}return r}function o(e){var t=new r(e),n=t._parse();if(t._offset!==e.byteLength)throw new Error(e.byteLength-t._offset+" trailing bytes");return n}r.prototype._array=function(e){for(var t=new Array(e),n=0;n223)return-1*(255-t+1);switch(t){case 192:return null;case 194:return!1;case 195:return!0;case 196:return n=this._view.getUint8(this._offset),this._offset+=1,this._bin(n);case 197:return n=this._view.getUint16(this._offset),this._offset+=2,this._bin(n);case 198:return n=this._view.getUint32(this._offset),this._offset+=4,this._bin(n);case 199:return n=this._view.getUint8(this._offset),r=this._view.getInt8(this._offset+1),this._offset+=2,[r,this._bin(n)];case 200:return n=this._view.getUint16(this._offset),r=this._view.getInt8(this._offset+2),this._offset+=3,[r,this._bin(n)];case 201:return n=this._view.getUint32(this._offset),r=this._view.getInt8(this._offset+4),this._offset+=5,[r,this._bin(n)];case 202:return e=this._view.getFloat32(this._offset),this._offset+=4,e;case 203:return e=this._view.getFloat64(this._offset),this._offset+=8,e;case 204:return e=this._view.getUint8(this._offset),this._offset+=1,e;case 205:return e=this._view.getUint16(this._offset),this._offset+=2,e;case 206:return e=this._view.getUint32(this._offset),this._offset+=4,e;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 e=this._view.getInt8(this._offset),this._offset+=1,e;case 209:return e=this._view.getInt16(this._offset),this._offset+=2,e;case 210:return e=this._view.getInt32(this._offset),this._offset+=4,e;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 r=this._view.getInt8(this._offset),this._offset+=1,0===r?void(this._offset+=1):[r,this._bin(1)];case 213:return r=this._view.getInt8(this._offset),this._offset+=1,[r,this._bin(2)];case 214:return r=this._view.getInt8(this._offset),this._offset+=1,[r,this._bin(4)];case 215:return r=this._view.getInt8(this._offset),this._offset+=1,0===r?(i=this._view.getInt32(this._offset)*Math.pow(2,32),o=this._view.getUint32(this._offset+4),this._offset+=8,new Date(i+o)):[r,this._bin(8)];case 216:return r=this._view.getInt8(this._offset),this._offset+=1,[r,this._bin(16)];case 217:return n=this._view.getUint8(this._offset),this._offset+=1,this._str(n);case 218:return n=this._view.getUint16(this._offset),this._offset+=2,this._str(n);case 219:return n=this._view.getUint32(this._offset),this._offset+=4,this._str(n);case 220:return n=this._view.getUint16(this._offset),this._offset+=2,this._array(n);case 221:return n=this._view.getUint32(this._offset),this._offset+=4,this._array(n);case 222:return n=this._view.getUint16(this._offset),this._offset+=2,this._map(n);case 223:return n=this._view.getUint32(this._offset),this._offset+=4,this._map(n)}throw new Error("Could not parse")},e.exports=o},function(e,t,n){"use strict";function r(e,t,n){for(var r=0,i=0,o=n.length;i>6),e.setUint8(t++,128|63&r)):r<55296||r>=57344?(e.setUint8(t++,224|r>>12),e.setUint8(t++,128|r>>6&63),e.setUint8(t++,128|63&r)):(i++,r=65536+((1023&r)<<10|1023&n.charCodeAt(i)),e.setUint8(t++,240|r>>18),e.setUint8(t++,128|r>>12&63),e.setUint8(t++,128|r>>6&63),e.setUint8(t++,128|63&r))}function i(e){for(var t=0,n=0,r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function o(e,t,n){var r=typeof n,s=0,a=0,u=0,c=0,h=0,f=0;if("string"===r){if((h=i(n))<32)e.push(160|h),f=1;else if(h<256)e.push(217,h),f=2;else if(h<65536)e.push(218,h>>8,h),f=3;else{if(!(h<4294967296))throw new Error("String too long");e.push(219,h>>24,h>>16,h>>8,h),f=5}return t.push({_str:n,_length:h,_offset:e.length}),f+h}if("number"===r)return Math.floor(n)===n&&isFinite(n)?n>=0?n<128?(e.push(n),1):n<256?(e.push(204,n),2):n<65536?(e.push(205,n>>8,n),3):n<4294967296?(e.push(206,n>>24,n>>16,n>>8,n),5):(u=n/Math.pow(2,32)>>0,c=n>>>0,e.push(207,u>>24,u>>16,u>>8,u,c>>24,c>>16,c>>8,c),9):n>=-32?(e.push(n),1):n>=-128?(e.push(208,n),2):n>=-32768?(e.push(209,n>>8,n),3):n>=-2147483648?(e.push(210,n>>24,n>>16,n>>8,n),5):(u=Math.floor(n/Math.pow(2,32)),c=n>>>0,e.push(211,u>>24,u>>16,u>>8,u,c>>24,c>>16,c>>8,c),9):(e.push(203),t.push({_float:n,_length:8,_offset:e.length}),9);if("object"===r){if(null===n)return e.push(192),1;if(Array.isArray(n)){if((h=n.length)<16)e.push(144|h),f=1;else if(h<65536)e.push(220,h>>8,h),f=3;else{if(!(h<4294967296))throw new Error("Array too large");e.push(221,h>>24,h>>16,h>>8,h),f=5}for(s=0;s>>0,e.push(215,0,u>>24,u>>16,u>>8,u,c>>24,c>>16,c>>8,c),10}if(n instanceof ArrayBuffer){if((h=n.byteLength)<256)e.push(196,h),f=2;else if(h<65536)e.push(197,h>>8,h),f=3;else{if(!(h<4294967296))throw new Error("Buffer too large");e.push(198,h>>24,h>>16,h>>8,h),f=5}return t.push({_bin:n,_length:h,_offset:e.length}),f+h}if("function"==typeof n.toJSON)return o(e,t,n.toJSON());var p=[],d="",v=Object.keys(n);for(s=0,a=v.length;s>8,h),f=3;else{if(!(h<4294967296))throw new Error("Object too large");e.push(223,h>>24,h>>16,h>>8,h),f=5}for(s=0;s0&&(h=n[0]._offset);for(var f,l=0,p=0,d=0,v=t.length;d2&&void 0!==arguments[2]?arguments[2]:{};r(this,e),this.url=t,this.protocols=n,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(e,[{key:"open",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isReconnect=e;var t=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),t&&(this.ws.binaryType=t)}},{key:"onBackoffReady",value:function(e,t){this.open(!0)}},{key:"onCloseCallback",value:function(e){!this.isReconnect&&this.listeners.onclose&&this.listeners.onclose.apply(null,arguments),this.reconnectEnabled&&e.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(e,t){void 0===e&&(e=1e3),this.reconnectEnabled=!1,this.ws.close(e,t)}},{key:"send",value:function(e){this.ws.send(e)}},{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(e){this.ws.binaryType=e}},{key:"extensions",get:function(){return this.ws.extensions},set:function(e){this.ws.extensions=e}},{key:"protocol",get:function(){return this.ws.protocol},set:function(e){this.ws.protocol=e}},{key:"onclose",set:function(e){this.listeners.onclose=e},get:function(){return this.listeners.onclose}},{key:"onerror",set:function(e){this.listeners.onerror=e},get:function(){return this.listeners.onerror}},{key:"onmessage",set:function(e){this.listeners.onmessage=e},get:function(){return this.listeners.onmessage}},{key:"onopen",set:function(e){this.listeners.onopen=e},get:function(){return this.listeners.onopen}},{key:"onreconnect",set:function(e){this.listeners.onreconnect=e},get:function(){return this.listeners.onreconnect}}]),e}();a.CONNECTING=s.CONNECTING,a.OPEN=s.OPEN,a.CLOSING=s.CLOSING,a.CLOSED=s.CLOSED,t.default=a},function(e,t,n){"use strict";function r(e,t){return new i(o[e],t)}function i(e,t){this.func=e,this.attempts=0,this.delay=void 0!==t.initialDelay?t.initialDelay:100}Object.defineProperty(t,"__esModule",{value:!0}),t.createBackoff=r;var o={exponential:function(e,t){return Math.floor(Math.random()*Math.pow(2,e)*t)},fibonacci:function(e,t){var n=1;if(e>n)for(var r=1,n=2,i=2;i=400?o:i)(h)},(a=n.body)&&/Array|Object/.test(a.constructor)&&(f["content-type"]="application/json",a=JSON.stringify(a));for(s in f)h.setRequestHeader(s,f[s]);h.send(a)})}Object.defineProperty(t,"__esModule",{value:!0}),t.send=i,n.d(t,"get",function(){return o}),n.d(t,"post",function(){return s}),n.d(t,"patch",function(){return a}),n.d(t,"del",function(){return u}),n.d(t,"put",function(){return c});var o=i.bind(i,"GET"),s=i.bind(i,"POST"),a=i.bind(i,"PATCH"),u=i.bind(i,"DELETE"),c=i.bind(i,"PUT")},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):new n(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){function n(e){return function(t){return r([e,t])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&n[0]?o.return:n[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]1&&console.warn(".listen() accepts only one parameter.");var s={callback:t,rawRules:i,rules:i.map(function(e){return"string"==typeof e?0===e.indexOf(":")?o.matcherPlaceholders[e]||o.matcherPlaceholders[":*"]:new RegExp("^"+e+"$"):e})};return 0===i.length?this.defaultListener=s:this.listeners.push(s),n&&this.checkPatches(r.compare({},this.state),[s]),s},e.prototype.removeListener=function(e){for(var t=this.listeners.length-1;t>=0;t--)this.listeners[t]===e&&this.listeners.splice(t,1)},e.prototype.removeAllListeners=function(){this.reset()},e.prototype.checkPatches=function(e,t,n){for(var r=0,i=t.length;r=0;s--){var a=o&&this.getPathVariables(e[s],o);a&&(o.callback({path:a,rawPath:e[s].path,operation:e[s].operation,value:e[s].value}),e[s].matched=!0)}if(n)for(var s=e.length-1;s>=0;s--)e[s].matched||n.callback(e[s])},e.prototype.getPathVariables=function(e,t){if(e.path.length!==t.rules.length)return!1;for(var n={},r=0,i=t.rules.length;r2)return!1;":"===t.rawRules[r].substr(0,1)&&(n[t.rawRules[r].substr(1)]=o[1])}return n},e.prototype.reset=function(){this.listeners=[]},e}();t.StateContainer=i},function(e,t,n){"use strict";function r(e,t){var n=[];return s(e,t,n,[]),n}function i(e,t){var n=e.slice();return n.push(t),n}function o(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=0;h--){var f=u[h],l=e[f];if(!t.hasOwnProperty(f)||void 0===t[f]&&void 0!==l&&!1===Array.isArray(t))n.push({operation:"remove",path:i(r,f)}),c=!0;else{var p=t[f];"object"==typeof l&&null!=l&&"object"==typeof p&&null!=p?s(l,p,n,i(r,f)):l!==p&&n.push({operation:"replace",path:i(r,f),value:p,previousValue:l})}}if(c||a.length!=u.length)for(var h=a.length-1;h>=0;h--){var f=a[h];if(!e.hasOwnProperty(f)&&void 0!==t[f]){var p=t[f],d=i(r,f);"object"==typeof p&&null!=p&&s({},p,n,d),n.push({operation:"add",path:d,value:p})}}}Object.defineProperty(t,"__esModule",{value:!0}),t.compare=r},function(e,t){!function(t,n){void 0!==e&&e.exports?e.exports=n():t.fossilDelta=n()}(this,function(){"use strict";function e(){this.a=0,this.b=0,this.i=0,this.z=new Array(s)}function t(e){this.a=e,this.pos=0}function n(){this.a=[]}function r(e){var t,n;for(t=1,n=64;e>=n;t++,n<<=6);return t}function i(e){for(var t=0,n=0,r=0,i=0,o=0,s=e.length;s>=16;)t=t+e[o+0]|0,n=n+e[o+1]|0,r=r+e[o+2]|0,i=i+e[o+3]|0,t=t+e[o+4]|0,n=n+e[o+5]|0,r=r+e[o+6]|0,i=i+e[o+7]|0,t=t+e[o+8]|0,n=n+e[o+9]|0,r=r+e[o+10]|0,i=i+e[o+11]|0,t=t+e[o+12]|0,n=n+e[o+13]|0,r=r+e[o+14]|0,i=i+e[o+15]|0,o+=16,s-=16;for(;s>=4;)t=t+e[o+0]|0,n=n+e[o+1]|0,r=r+e[o+2]|0,i=i+e[o+3]|0,o+=4,s-=4;switch(i=((i+(r<<8)|0)+(n<<16)|0)+(t<<24)|0,s){case 3:i=i+(e[o+2]<<8)|0;case 2:i=i+(e[o+1]<<16)|0;case 1:i=i+(e[o+0]<<24)|0}return i>>>0}var o={},s=16;e.prototype.init=function(e,t){var n,r,i=0,o=0;for(n=0;n>>0};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~".split("").map(function(e){return e.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 t.prototype.haveBytes=function(){return this.posthis.a.length)throw new RangeError("out of bounds");return e},t.prototype.getChar=function(){return String.fromCharCode(this.getByte())},t.prototype.getInt=function(){for(var e,t=0;this.haveBytes()&&(e=u[127&this.getByte()])>=0;)t=(t<<6)+e;return this.pos--,t>>>0},n.prototype.toArray=function(){return this.a},n.prototype.putByte=function(e){this.a.push(255&e)},n.prototype.putChar=function(e){this.putByte(e.charCodeAt(0))},n.prototype.putInt=function(e){var t,n,r=[];if(0===e)return void this.putChar("0");for(t=0;e>0;t++,e>>>=6)r.push(a[63&e]);for(n=t-1;n>=0;n--)this.putByte(r[n])},n.prototype.putArray=function(e,t,n){for(var r=t;r=0&&C-- >0;){var A,S,I,E,P,R,k,j;for(g=_*s,E=0,R=g,k=O+a;R=j&&A>m&&(m=A,b=g-P,w=I),_=p[_]}if(m>0){w>0&&(u.putInt(w),u.putChar(":"),u.putArray(o,O,O+w),O+=w),O+=m,u.putInt(m),u.putChar("@"),u.putInt(b),u.putChar(","),b+m-1>f&&(f=b+m-1),m=0;break}if(O+a+s>=c){u.putInt(c-O),u.putChar(":"),u.putArray(o,O,O+c-O),O=c;break}y.next(o[O+a+s]),a++}return Os)throw new Error("copy exceeds output file size");if(p+l>c)throw new Error("copy extends past end of input");f.putArray(e,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");f.putArray(u.a,u.pos,u.pos+l),u.pos+=l;break;case";":var d=f.toArray();if((!o||!1!==o.verifyChecksum)&&l!==i(d))throw new Error("bad checksum");if(a!==s)throw new Error("generated size does not match predicted size");return d;default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")},o})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),i=function(){function e(){}return e.prototype.setState=function(e){this.state.decode(e)},e.prototype.getState=function(){return this.state},e.prototype.patch=function(e){this.state.decode(e)},e.prototype.teardown=function(){},e.prototype.handshake=function(e){if(this.state){(new r.Reflection).decode(e)}else this.state=r.Reflection.decode(e)},e}();t.SchemaSerializer=i},function(e,t,n){"use strict";function r(e){for(var t=0,n=0,r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function i(e,t,n){for(var r=0,i=0,o=n.length;i>6,e[t++]=128|63&r):r<55296||r>=57344?(e[t++]=224|r>>12,e[t++]=128|r>>6&63,e[t++]=128|63&r):(i++,r=65536+((1023&r)<<10|1023&n.charCodeAt(i)),e[t++]=240|r>>18,e[t++]=128|r>>12&63,e[t++]=128|r>>6&63,e[t++]=128|63&r)}function o(e,t){e.push(t)}function s(e,t){e.push(t)}function a(e,t){e.push(t),e.push(t>>8)}function u(e,t){e.push(t),e.push(t>>8)}function c(e,t){e.push(t),e.push(t>>8),e.push(t>>16),e.push(t>>24)}function h(e,t){var n=t>>24,r=t>>16,i=t>>8,o=t;e.push(o),e.push(i),e.push(r),e.push(n)}function f(e,t){var n=Math.floor(t/Math.pow(2,32));h(e,t>>>0),h(e,n)}function l(e,t){var n=t/Math.pow(2,32)>>0;h(e,t>>>0),h(e,n)}function p(e,t){v(e,t)}function d(e,t){y(e,t)}function v(e,t){O[0]=t,c(e,w[0])}function y(e,t){C[0]=t,c(e,w[b?0:1]),c(e,w[b?1:0])}function g(e,t){return s(e,t?1:0)}function _(e,t){t||(t="");var n=r(t),o=0;if(n<32)e.push(160|n),o=1;else if(n<256)e.push(217),s(e,n),o=2;else if(n<65536)e.push(218),u(e,n),o=3;else{if(!(n<4294967296))throw new Error("String too long");e.push(219),h(e,n),o=5}return i(e,e.length,t),o+n}function m(e,t){return isNaN(t)?(console.error("trying to encode a NaN value. will be encoded as `0`."),m(e,0)):isFinite(t)?Math.floor(t)===t&&isFinite(t)?t>=0?t<128?(s(e,t),1):t<256?(e.push(204),s(e,t),2):t<65536?(e.push(205),u(e,t),3):t<4294967296?(e.push(206),h(e,t),5):(e.push(207),l(e,t),9):t>=-32?(e.push(t),1):t>=-128?(e.push(208),o(e,t),2):t>=-32768?(e.push(209),a(e,t),3):t>=-2147483648?(e.push(210),c(e,t),5):(e.push(211),f(e,t),9):(e.push(203),y(e,t),9):m(e,t>0?Number.MAX_SAFE_INTEGER:-Number.MAX_SAFE_INTEGER)}Object.defineProperty(t,"__esModule",{value:!0}),t.utf8Write=i,t.int8=o,t.uint8=s,t.int16=a,t.uint16=u,t.int32=c,t.uint32=h,t.int64=f,t.uint64=l,t.float32=p,t.float64=d;var b=!0,w=new Int32Array(2),O=new Float32Array(w.buffer),C=new Float64Array(w.buffer);t.writeFloat32=v,t.writeFloat64=y,t.boolean=g,t.string=_,t.number=m},function(e,t,n){"use strict";function r(e,t,n){for(var r="",i=0,o=t,s=t+n;o=65536?(i-=65536,r+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):r+=String.fromCharCode(i)}else r+=String.fromCharCode((15&a)<<12|(63&e[++o])<<6|(63&e[++o])<<0);else r+=String.fromCharCode((31&a)<<6|63&e[++o]);else r+=String.fromCharCode(a)}return r}function i(e,t){return o(e,t)<<24>>24}function o(e,t){return e[t.offset++]}function s(e,t){return a(e,t)<<16>>16}function a(e,t){return e[t.offset++]|e[t.offset++]<<8}function u(e,t){return e[t.offset++]|e[t.offset++]<<8|e[t.offset++]<<16|e[t.offset++]<<24}function c(e,t){return u(e,t)>>>0}function h(e,t){return d(e,t)}function f(e,t){return v(e,t)}function l(e,t){var n=c(e,t);return u(e,t)*Math.pow(2,32)+n}function p(e,t){var n=c(e,t);return c(e,t)*Math.pow(2,32)+n}function d(e,t){return I[0]=u(e,t),E[0]}function v(e,t){return I[S?0:1]=u(e,t),I[S?1:0]=u(e,t),P[0]}function y(e,t){return o(e,t)>0}function g(e,t){var n,i=e[t.offset++];i<192?n=31&i:217===i?n=o(e,t):218===i?n=a(e,t):219===i&&(n=c(e,t));var s=r(e,t.offset,n);return t.offset+=n,s}function _(e,t){var n=e[t.offset];return n<192&&n>160||217===n||218===n||219===n}function m(e,t){var n=e[t.offset++];return n<128?n:202===n?d(e,t):203===n?v(e,t):204===n?o(e,t):205===n?a(e,t):206===n?c(e,t):207===n?p(e,t):208===n?i(e,t):209===n?s(e,t):210===n?u(e,t):211===n?l(e,t):n>223?-1*(255-n+1):void 0}function b(e,t){var n=e[t.offset];return n<128||n>=202&&n<=211}function w(e,t){return e[t.offset]<160}function O(e,t){return e[t.offset]===A.NIL}function C(e,t){return e[t.offset]===A.INDEX_CHANGE}Object.defineProperty(t,"__esModule",{value:!0});var A=n(15);t.int8=i,t.uint8=o,t.int16=s,t.uint16=a,t.int32=u,t.uint32=c,t.float32=h,t.float64=f,t.int64=l,t.uint64=p;var S=!0,I=new Int32Array(2),E=new Float32Array(I.buffer),P=new Float64Array(I.buffer);t.readFloat32=d,t.readFloat64=v,t.boolean=y,t.string=g,t.stringCheck=_,t.number=m,t.numberCheck=b,t.arrayCheck=w,t.nilCheck=O,t.indexChangeCheck=C},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};Object.defineProperty(t,"__esModule",{value:!0});var o=n(17),s=n(1),a=n(2),u=n(3),c=new o.Context,h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),i([o.type("string",c)],t.prototype,"name",void 0),i([o.type("string",c)],t.prototype,"type",void 0),i([o.type("uint8",c)],t.prototype,"referencedType",void 0),t}(s.Schema);t.ReflectionField=h;var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.fields=new a.ArraySchema,t}return r(t,e),i([o.type("uint8",c)],t.prototype,"id",void 0),i([o.type([h],c)],t.prototype,"fields",void 0),t}(s.Schema);t.ReflectionType=f;var l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.types=new a.ArraySchema,t}return r(t,e),t.encode=function(e){var n=e.constructor,r=new t;r.rootType=n._typeid;var i=n._context.types;for(var o in i){var s=new f;s.id=Number(o),function(e,t){for(var n in t){var i=new h;i.name=n;var o=void 0;if("string"==typeof t[n])o=t[n];else{var s="function"==typeof t[n],a=Array.isArray(t[n]),u=!a&&t[n].map,c=void 0;s?(o="ref",c=t[n]):a?(o="array","string"==typeof t[n][0]?o+=":"+t[n][0]:c=t[n][0]):u&&(o="map","string"==typeof t[n].map?o+=":"+t[n].map:c=t[n].map),i.referencedType=c?c._typeid:255}i.type=o,e.fields.push(i)}r.types.push(e)}(s,i[o]._schema)}return r.encodeAll()},t.decode=function(e){var n=new o.Context,i=new t;i.decode(e);var c=i.types.reduce(function(e,t){return e[t.id]=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(s.Schema),e},{});i.types.forEach(function(e,t){e.fields.forEach(function(t){var r=c[e.id];if(void 0!==t.referencedType){var i=c[t.referencedType];i||(i=t.type.split(":")[1]),0===t.type.indexOf("array")?o.type([i],n)(r.prototype,t.name):0===t.type.indexOf("map")?o.type({map:i},n)(r.prototype,t.name):"ref"===t.type&&o.type(i,n)(r.prototype,t.name)}else o.type(t.type,n)(r.prototype,t.name)})});var h=c[i.rootType],f=new h;for(var l in h._schema){var p=h._schema[l];if("string"!=typeof p){var d="function"==typeof p,v=Array.isArray(p),y=!v&&p.map;f[l]=v?new a.ArraySchema:y?new u.MapSchema:d?new p:void 0}}return f},i([o.type([f],c)],t.prototype,"types",void 0),i([o.type("uint8",c)],t.prototype,"rootType",void 0),t}(s.Schema);t.Reflection=l}])}); \ No newline at end of file diff --git a/package.json b/package.json index 65e4ba2..0957601 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@gamestdio/state-listener": "^3.1.0", "@gamestdio/websocket": "^0.3.2", "fossil-delta": "^1.0.0", - "httpie": "^2.0.0-next.0", + "httpie": "^2.0.0-next.2", "notepack.io": "^2.1.3" }, "devDependencies": {