@chainstream-io/centrifuge 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/centrifuge.d.ts +10 -0
- package/build/index.js +35 -4
- package/build/index.mjs +35 -4
- package/build/protobuf/centrifuge.d.ts +10 -0
- package/build/protobuf/index.js +35 -4
- package/build/protobuf/index.mjs +35 -4
- package/build/protobuf/types.d.ts +3 -0
- package/build/types.d.ts +3 -0
- package/dist/centrifuge.js +2 -2
- package/dist/centrifuge.js.map +3 -3
- package/dist/centrifuge.protobuf.js +5 -5
- package/dist/centrifuge.protobuf.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";(()=>{var Ze=Object.create;var Bt=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var P=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports);var en=(s,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Qe(r))!tn.call(s,o)&&o!==i&&Bt(s,o,{get:()=>r[o],enumerable:!(n=Xe(r,o))||n.enumerable});return s};var Q=(s,r,i)=>(i=s!=null?Ze(Ye(s)):{},en(r||!s||!s.__esModule?Bt(i,"default",{value:s,enumerable:!0}):i,s));var gt=P((Rn,_t)=>{"use strict";var W=typeof Reflect=="object"?Reflect:null,Ut=W&&typeof W.apply=="function"?W.apply:function(r,i,n){return Function.prototype.apply.call(r,i,n)},Y;W&&typeof W.ownKeys=="function"?Y=W.ownKeys:Object.getOwnPropertySymbols?Y=function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:Y=function(r){return Object.getOwnPropertyNames(r)};function nn(s){console&&console.warn&&console.warn(s)}var Nt=Number.isNaN||function(r){return r!==r};function v(){v.init.call(this)}_t.exports=v;_t.exports.once=sn;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var zt=10;function tt(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return zt},set:function(s){if(typeof s!="number"||s<0||Nt(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");zt=s}});v.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};v.prototype.setMaxListeners=function(r){if(typeof r!="number"||r<0||Nt(r))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+r+".");return this._maxListeners=r,this};function Mt(s){return s._maxListeners===void 0?v.defaultMaxListeners:s._maxListeners}v.prototype.getMaxListeners=function(){return Mt(this)};v.prototype.emit=function(r){for(var i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);var o=r==="error",t=this._events;if(t!==void 0)o=o&&t.error===void 0;else if(!o)return!1;if(o){var e;if(i.length>0&&(e=i[0]),e instanceof Error)throw e;var l=new Error("Unhandled error."+(e?" ("+e.message+")":""));throw l.context=e,l}var c=t[r];if(c===void 0)return!1;if(typeof c=="function")Ut(c,this,i);else for(var u=c.length,p=$t(c,u),n=0;n<u;++n)Ut(p[n],this,i);return!0};function Ft(s,r,i,n){var o,t,e;if(tt(i),t=s._events,t===void 0?(t=s._events=Object.create(null),s._eventsCount=0):(t.newListener!==void 0&&(s.emit("newListener",r,i.listener?i.listener:i),t=s._events),e=t[r]),e===void 0)e=t[r]=i,++s._eventsCount;else if(typeof e=="function"?e=t[r]=n?[i,e]:[e,i]:n?e.unshift(i):e.push(i),o=Mt(s),o>0&&e.length>o&&!e.warned){e.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+e.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=s,l.type=r,l.count=e.length,nn(l)}return s}v.prototype.addListener=function(r,i){return Ft(this,r,i,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(r,i){return Ft(this,r,i,!0)};function on(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Wt(s,r,i){var n={fired:!1,wrapFn:void 0,target:s,type:r,listener:i},o=on.bind(n);return o.listener=i,n.wrapFn=o,o}v.prototype.once=function(r,i){return tt(i),this.on(r,Wt(this,r,i)),this};v.prototype.prependOnceListener=function(r,i){return tt(i),this.prependListener(r,Wt(this,r,i)),this};v.prototype.removeListener=function(r,i){var n,o,t,e,l;if(tt(i),o=this._events,o===void 0)return this;if(n=o[r],n===void 0)return this;if(n===i||n.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete o[r],o.removeListener&&this.emit("removeListener",r,n.listener||i));else if(typeof n!="function"){for(t=-1,e=n.length-1;e>=0;e--)if(n[e]===i||n[e].listener===i){l=n[e].listener,t=e;break}if(t<0)return this;t===0?n.shift():rn(n,t),n.length===1&&(o[r]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",r,l||i)}return this};v.prototype.off=v.prototype.removeListener;v.prototype.removeAllListeners=function(r){var i,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[r]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[r]),this;if(arguments.length===0){var t=Object.keys(n),e;for(o=0;o<t.length;++o)e=t[o],e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=n[r],typeof i=="function")this.removeListener(r,i);else if(i!==void 0)for(o=i.length-1;o>=0;o--)this.removeListener(r,i[o]);return this};function Ht(s,r,i){var n=s._events;if(n===void 0)return[];var o=n[r];return o===void 0?[]:typeof o=="function"?i?[o.listener||o]:[o]:i?cn(o):$t(o,o.length)}v.prototype.listeners=function(r){return Ht(this,r,!0)};v.prototype.rawListeners=function(r){return Ht(this,r,!1)};v.listenerCount=function(s,r){return typeof s.listenerCount=="function"?s.listenerCount(r):Jt.call(s,r)};v.prototype.listenerCount=Jt;function Jt(s){var r=this._events;if(r!==void 0){var i=r[s];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?Y(this._events):[]};function $t(s,r){for(var i=new Array(r),n=0;n<r;++n)i[n]=s[n];return i}function rn(s,r){for(;r+1<s.length;r++)s[r]=s[r+1];s.pop()}function cn(s){for(var r=new Array(s.length),i=0;i<r.length;++i)r[i]=s[i].listener||s[i];return r}function sn(s,r){return new Promise(function(i,n){function o(e){s.removeListener(r,t),n(e)}function t(){typeof s.removeListener=="function"&&s.removeListener("error",o),i([].slice.call(arguments))}Vt(s,r,t,{once:!0}),r!=="error"&&ln(s,o,{once:!0})})}function ln(s,r,i){typeof s.on=="function"&&Vt(s,"error",r,i)}function Vt(s,r,i,n){if(typeof s.on=="function")n.once?s.once(r,i):s.on(r,i);else if(typeof s.addEventListener=="function")s.addEventListener(r,function o(t){n.once&&s.removeEventListener(r,o),i(t)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var te=P((xi,Yt)=>{"use strict";Yt.exports=yn;function yn(s,r){for(var i=new Array(arguments.length-1),n=0,o=2,t=!0;o<arguments.length;)i[n++]=arguments[o++];return new Promise(function(l,c){i[n]=function(p){if(t)if(t=!1,p)c(p);else{for(var y=new Array(arguments.length-1),O=0;O<y.length;)y[O++]=arguments[O];l.apply(null,y)}};try{s.apply(r||null,i)}catch(u){t&&(t=!1,c(u))}})}});var oe=P(ie=>{"use strict";var ut=ie;ut.length=function(r){var i=r.length;if(!i)return 0;for(var n=0;--i%4>1&&r.charAt(i)==="=";)++n;return Math.ceil(r.length*3)/4-n};var $=new Array(64),ne=new Array(123);for(D=0;D<64;)ne[$[D]=D<26?D+65:D<52?D+71:D<62?D-4:D-59|43]=D++;var D;ut.encode=function(r,i,n){for(var o=null,t=[],e=0,l=0,c;i<n;){var u=r[i++];switch(l){case 0:t[e++]=$[u>>2],c=(u&3)<<4,l=1;break;case 1:t[e++]=$[c|u>>4],c=(u&15)<<2,l=2;break;case 2:t[e++]=$[c|u>>6],t[e++]=$[u&63],l=0;break}e>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,t)),e=0)}return l&&(t[e++]=$[c],t[e++]=61,l===1&&(t[e++]=61)),o?(e&&o.push(String.fromCharCode.apply(String,t.slice(0,e))),o.join("")):String.fromCharCode.apply(String,t.slice(0,e))};var ee="invalid encoding";ut.decode=function(r,i,n){for(var o=n,t=0,e,l=0;l<r.length;){var c=r.charCodeAt(l++);if(c===61&&t>1)break;if((c=ne[c])===void 0)throw Error(ee);switch(t){case 0:e=c,t=1;break;case 1:i[n++]=e<<2|(c&48)>>4,e=c,t=2;break;case 2:i[n++]=(e&15)<<4|(c&60)>>2,e=c,t=3;break;case 3:i[n++]=(e&3)<<6|c,t=0;break}}if(t===1)throw Error(ee);return n-o};ut.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}});var ce=P((ji,re)=>{"use strict";re.exports=ft;function ft(){this._listeners={}}ft.prototype.on=function(r,i,n){return(this._listeners[r]||(this._listeners[r]=[])).push({fn:i,ctx:n||this}),this};ft.prototype.off=function(r,i){if(r===void 0)this._listeners={};else if(i===void 0)this._listeners[r]=[];else for(var n=this._listeners[r],o=0;o<n.length;)n[o].fn===i?n.splice(o,1):++o;return this};ft.prototype.emit=function(r){var i=this._listeners[r];if(i){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<i.length;)i[o].fn.apply(i[o++].ctx,n)}return this}});var pe=P((Ti,he)=>{"use strict";he.exports=se(se);function se(s){return typeof Float32Array<"u"?function(){var r=new Float32Array([-0]),i=new Uint8Array(r.buffer),n=i[3]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3]}function t(c,u,p){r[0]=c,u[p]=i[3],u[p+1]=i[2],u[p+2]=i[1],u[p+3]=i[0]}s.writeFloatLE=n?o:t,s.writeFloatBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],r[0]}function l(c,u){return i[3]=c[u],i[2]=c[u+1],i[1]=c[u+2],i[0]=c[u+3],r[0]}s.readFloatLE=n?e:l,s.readFloatBE=n?l:e}():function(){function r(n,o,t,e){var l=o<0?1:0;if(l&&(o=-o),o===0)n(1/o>0?0:2147483648,t,e);else if(isNaN(o))n(2143289344,t,e);else if(o>34028234663852886e22)n((l<<31|2139095040)>>>0,t,e);else if(o<11754943508222875e-54)n((l<<31|Math.round(o/1401298464324817e-60))>>>0,t,e);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((l<<31|c+127<<23|u)>>>0,t,e)}}s.writeFloatLE=r.bind(null,le),s.writeFloatBE=r.bind(null,ue);function i(n,o,t){var e=n(o,t),l=(e>>31)*2+1,c=e>>>23&255,u=e&8388607;return c===255?u?NaN:l*(1/0):c===0?l*1401298464324817e-60*u:l*Math.pow(2,c-150)*(u+8388608)}s.readFloatLE=i.bind(null,fe),s.readFloatBE=i.bind(null,ae)}(),typeof Float64Array<"u"?function(){var r=new Float64Array([-0]),i=new Uint8Array(r.buffer),n=i[7]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3],u[p+4]=i[4],u[p+5]=i[5],u[p+6]=i[6],u[p+7]=i[7]}function t(c,u,p){r[0]=c,u[p]=i[7],u[p+1]=i[6],u[p+2]=i[5],u[p+3]=i[4],u[p+4]=i[3],u[p+5]=i[2],u[p+6]=i[1],u[p+7]=i[0]}s.writeDoubleLE=n?o:t,s.writeDoubleBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],i[4]=c[u+4],i[5]=c[u+5],i[6]=c[u+6],i[7]=c[u+7],r[0]}function l(c,u){return i[7]=c[u],i[6]=c[u+1],i[5]=c[u+2],i[4]=c[u+3],i[3]=c[u+4],i[2]=c[u+5],i[1]=c[u+6],i[0]=c[u+7],r[0]}s.readDoubleLE=n?e:l,s.readDoubleBE=n?l:e}():function(){function r(n,o,t,e,l,c){var u=e<0?1:0;if(u&&(e=-e),e===0)n(0,l,c+o),n(1/e>0?0:2147483648,l,c+t);else if(isNaN(e))n(0,l,c+o),n(2146959360,l,c+t);else if(e>17976931348623157e292)n(0,l,c+o),n((u<<31|2146435072)>>>0,l,c+t);else{var p;if(e<22250738585072014e-324)p=e/5e-324,n(p>>>0,l,c+o),n((u<<31|p/4294967296)>>>0,l,c+t);else{var y=Math.floor(Math.log(e)/Math.LN2);y===1024&&(y=1023),p=e*Math.pow(2,-y),n(p*4503599627370496>>>0,l,c+o),n((u<<31|y+1023<<20|p*1048576&1048575)>>>0,l,c+t)}}}s.writeDoubleLE=r.bind(null,le,0,4),s.writeDoubleBE=r.bind(null,ue,4,0);function i(n,o,t,e,l){var c=n(e,l+o),u=n(e,l+t),p=(u>>31)*2+1,y=u>>>20&2047,O=4294967296*(u&1048575)+c;return y===2047?O?NaN:p*(1/0):y===0?p*5e-324*O:p*Math.pow(2,y-1075)*(O+4503599627370496)}s.readDoubleLE=i.bind(null,fe,0,4),s.readDoubleBE=i.bind(null,ae,4,0)}(),s}function le(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}function ue(s,r,i){r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255}function fe(s,r){return(s[r]|s[r+1]<<8|s[r+2]<<16|s[r+3]<<24)>>>0}function ae(s,r){return(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3])>>>0}});var de=P((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(s){}return null}});var ye=P(be=>{"use strict";var wt=be;wt.length=function(r){for(var i=0,n=0,o=0;o<r.length;++o)n=r.charCodeAt(o),n<128?i+=1:n<2048?i+=2:(n&64512)===55296&&(r.charCodeAt(o+1)&64512)===56320?(++o,i+=4):i+=3;return i};wt.read=function(r,i,n){var o=n-i;if(o<1)return"";for(var t=null,e=[],l=0,c;i<n;)c=r[i++],c<128?e[l++]=c:c>191&&c<224?e[l++]=(c&31)<<6|r[i++]&63:c>239&&c<365?(c=((c&7)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,e[l++]=55296+(c>>10),e[l++]=56320+(c&1023)):e[l++]=(c&15)<<12|(r[i++]&63)<<6|r[i++]&63,l>8191&&((t||(t=[])).push(String.fromCharCode.apply(String,e)),l=0);return t?(l&&t.push(String.fromCharCode.apply(String,e.slice(0,l))),t.join("")):String.fromCharCode.apply(String,e.slice(0,l))};wt.write=function(r,i,n){for(var o=n,t,e,l=0;l<r.length;++l)t=r.charCodeAt(l),t<128?i[n++]=t:t<2048?(i[n++]=t>>6|192,i[n++]=t&63|128):(t&64512)===55296&&((e=r.charCodeAt(l+1))&64512)===56320?(t=65536+((t&1023)<<10)+(e&1023),++l,i[n++]=t>>18|240,i[n++]=t>>12&63|128,i[n++]=t>>6&63|128,i[n++]=t&63|128):(i[n++]=t>>12|224,i[n++]=t>>6&63|128,i[n++]=t&63|128);return n-o}});var ge=P((Di,_e)=>{"use strict";_e.exports=_n;function _n(s,r,i){var n=i||8192,o=n>>>1,t=null,e=n;return function(c){if(c<1||c>o)return s(c);e+c>n&&(t=s(n),e=0);var u=r.call(t,e,e+=c);return e&7&&(e=(e|7)+1),u}}});var ke=P((Ci,ve)=>{"use strict";ve.exports=m;var K=B();function m(s,r){this.lo=s>>>0,this.hi=r>>>0}var M=m.zero=new m(0,0);M.toNumber=function(){return 0};M.zzEncode=M.zzDecode=function(){return this};M.length=function(){return 1};var gn=m.zeroHash="\0\0\0\0\0\0\0\0";m.fromNumber=function(r){if(r===0)return M;var i=r<0;i&&(r=-r);var n=r>>>0,o=(r-n)/4294967296>>>0;return i&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new m(n,o)};m.from=function(r){if(typeof r=="number")return m.fromNumber(r);if(K.isString(r))if(K.Long)r=K.Long.fromString(r);else return m.fromNumber(parseInt(r,10));return r.low||r.high?new m(r.low>>>0,r.high>>>0):M};m.prototype.toNumber=function(r){if(!r&&this.hi>>>31){var i=~this.lo+1>>>0,n=~this.hi>>>0;return i||(n=n+1>>>0),-(i+n*4294967296)}return this.lo+this.hi*4294967296};m.prototype.toLong=function(r){return K.Long?new K.Long(this.lo|0,this.hi|0,!!r):{low:this.lo|0,high:this.hi|0,unsigned:!!r}};var A=String.prototype.charCodeAt;m.fromHash=function(r){return r===gn?M:new m((A.call(r,0)|A.call(r,1)<<8|A.call(r,2)<<16|A.call(r,3)<<24)>>>0,(A.call(r,4)|A.call(r,5)<<8|A.call(r,6)<<16|A.call(r,7)<<24)>>>0)};m.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};m.prototype.zzEncode=function(){var r=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^r)>>>0,this.lo=(this.lo<<1^r)>>>0,this};m.prototype.zzDecode=function(){var r=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^r)>>>0,this.hi=(this.hi>>>1^r)>>>0,this};m.prototype.length=function(){var r=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?i===0?r<16384?r<128?1:2:r<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}});var B=P(Pt=>{"use strict";var d=Pt;d.asPromise=te();d.base64=oe();d.EventEmitter=ce();d.float=pe();d.inquire=de();d.utf8=ye();d.pool=ge();d.LongBits=ke();d.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);d.global=d.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Pt;d.emptyArray=Object.freeze?Object.freeze([]):[];d.emptyObject=Object.freeze?Object.freeze({}):{};d.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};d.isString=function(r){return typeof r=="string"||r instanceof String};d.isObject=function(r){return r&&typeof r=="object"};d.isset=d.isSet=function(r,i){var n=r[i];return n!=null&&r.hasOwnProperty(i)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};d.Buffer=function(){try{var s=d.inquire("buffer").Buffer;return s.prototype.utf8Write?s:null}catch{return null}}();d._Buffer_from=null;d._Buffer_allocUnsafe=null;d.newBuffer=function(r){return typeof r=="number"?d.Buffer?d._Buffer_allocUnsafe(r):new d.Array(r):d.Buffer?d._Buffer_from(r):typeof Uint8Array>"u"?r:new Uint8Array(r)};d.Array=typeof Uint8Array<"u"?Uint8Array:Array;d.Long=d.global.dcodeIO&&d.global.dcodeIO.Long||d.global.Long||d.inquire("long");d.key2Re=/^true|false|0|1$/;d.key32Re=/^-?(?:0|[1-9][0-9]*)$/;d.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;d.longToHash=function(r){return r?d.LongBits.from(r).toHash():d.LongBits.zeroHash};d.longFromHash=function(r,i){var n=d.LongBits.fromHash(r);return d.Long?d.Long.fromBits(n.lo,n.hi,i):n.toNumber(!!i)};function Oe(s,r,i){for(var n=Object.keys(r),o=0;o<n.length;++o)(s[n[o]]===void 0||!i)&&(s[n[o]]=r[n[o]]);return s}d.merge=Oe;d.lcFirst=function(r){return r.charAt(0).toLowerCase()+r.substring(1)};function we(s){function r(i,n){if(!(this instanceof r))return new r(i,n);Object.defineProperty(this,"message",{get:function(){return i}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Oe(this,n)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return s},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}d.newError=we;d.ProtocolError=we("ProtocolError");d.oneOfGetter=function(r){for(var i={},n=0;n<r.length;++n)i[r[n]]=1;return function(){for(var o=Object.keys(this),t=o.length-1;t>-1;--t)if(i[o[t]]===1&&this[o[t]]!==void 0&&this[o[t]]!==null)return o[t]}};d.oneOfSetter=function(r){return function(i){for(var n=0;n<r.length;++n)r[n]!==i&&delete this[r[n]]}};d.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};d._configure=function(){var s=d.Buffer;if(!s){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=s.from!==Uint8Array.from&&s.from||function(i,n){return new s(i,n)},d._Buffer_allocUnsafe=s.allocUnsafe||function(i){return new s(i)}}});var Et=P((Ii,xe)=>{"use strict";xe.exports=_;var E=B(),St,at=E.LongBits,Pe=E.base64,Se=E.utf8;function Z(s,r,i){this.fn=s,this.len=r,this.next=void 0,this.val=i}function xt(){}function vn(s){this.head=s.head,this.tail=s.tail,this.len=s.len,this.next=s.states}function _(){this.len=0,this.head=new Z(xt,0,0),this.tail=this.head,this.states=null}var me=function(){return E.Buffer?function(){return(_.create=function(){return new St})()}:function(){return new _}};_.create=me();_.alloc=function(r){return new E.Array(r)};E.Array!==Array&&(_.alloc=E.pool(_.alloc,E.Array.prototype.subarray));_.prototype._push=function(r,i,n){return this.tail=this.tail.next=new Z(r,i,n),this.len+=i,this};function Rt(s,r,i){r[i]=s&255}function kn(s,r,i){for(;s>127;)r[i++]=s&127|128,s>>>=7;r[i]=s}function jt(s,r){this.len=s,this.next=void 0,this.val=r}jt.prototype=Object.create(Z.prototype);jt.prototype.fn=kn;_.prototype.uint32=function(r){return this.len+=(this.tail=this.tail.next=new jt((r=r>>>0)<128?1:r<16384?2:r<2097152?3:r<268435456?4:5,r)).len,this};_.prototype.int32=function(r){return r<0?this._push(Tt,10,at.fromNumber(r)):this.uint32(r)};_.prototype.sint32=function(r){return this.uint32((r<<1^r>>31)>>>0)};function Tt(s,r,i){for(;s.hi;)r[i++]=s.lo&127|128,s.lo=(s.lo>>>7|s.hi<<25)>>>0,s.hi>>>=7;for(;s.lo>127;)r[i++]=s.lo&127|128,s.lo=s.lo>>>7;r[i++]=s.lo}_.prototype.uint64=function(r){var i=at.from(r);return this._push(Tt,i.length(),i)};_.prototype.int64=_.prototype.uint64;_.prototype.sint64=function(r){var i=at.from(r).zzEncode();return this._push(Tt,i.length(),i)};_.prototype.bool=function(r){return this._push(Rt,1,r?1:0)};function mt(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}_.prototype.fixed32=function(r){return this._push(mt,4,r>>>0)};_.prototype.sfixed32=_.prototype.fixed32;_.prototype.fixed64=function(r){var i=at.from(r);return this._push(mt,4,i.lo)._push(mt,4,i.hi)};_.prototype.sfixed64=_.prototype.fixed64;_.prototype.float=function(r){return this._push(E.float.writeFloatLE,4,r)};_.prototype.double=function(r){return this._push(E.float.writeDoubleLE,8,r)};var On=E.Array.prototype.set?function(r,i,n){i.set(r,n)}:function(r,i,n){for(var o=0;o<r.length;++o)i[n+o]=r[o]};_.prototype.bytes=function(r){var i=r.length>>>0;if(!i)return this._push(Rt,1,0);if(E.isString(r)){var n=_.alloc(i=Pe.length(r));Pe.decode(r,n,0),r=n}return this.uint32(i)._push(On,i,r)};_.prototype.string=function(r){var i=Se.length(r);return i?this.uint32(i)._push(Se.write,i,r):this._push(Rt,1,0)};_.prototype.fork=function(){return this.states=new vn(this),this.head=this.tail=new Z(xt,0,0),this.len=0,this};_.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Z(xt,0,0),this.len=0),this};_.prototype.ldelim=function(){var r=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=r.next,this.tail=i,this.len+=n),this};_.prototype.finish=function(){for(var r=this.head.next,i=this.constructor.alloc(this.len),n=0;r;)r.fn(r.val,i,n),n+=r.len,r=r.next;return i};_._configure=function(s){St=s,_.create=me(),St._configure()}});var Te=P((qi,je)=>{"use strict";je.exports=I;var Re=Et();(I.prototype=Object.create(Re.prototype)).constructor=I;var U=B();function I(){Re.call(this)}I._configure=function(){I.alloc=U._Buffer_allocUnsafe,I.writeBytesBuffer=U.Buffer&&U.Buffer.prototype instanceof Uint8Array&&U.Buffer.prototype.set.name==="set"?function(r,i,n){i.set(r,n)}:function(r,i,n){if(r.copy)r.copy(i,n,0,r.length);else for(var o=0;o<r.length;)i[n++]=r[o++]}};I.prototype.bytes=function(r){U.isString(r)&&(r=U._Buffer_from(r,"base64"));var i=r.length>>>0;return this.uint32(i),i&&this._push(I.writeBytesBuffer,i,r),this};function wn(s,r,i){s.length<40?U.utf8.write(s,r,i):r.utf8Write?r.utf8Write(s,i):r.write(s,i)}I.prototype.string=function(r){var i=U.Buffer.byteLength(r);return this.uint32(i),i&&this._push(wn,i,r),this};I._configure()});var Lt=P((Ai,Ie)=>{"use strict";Ie.exports=w;var C=B(),Ct,Ce=C.LongBits,Pn=C.utf8;function L(s,r){return RangeError("index out of range: "+s.pos+" + "+(r||1)+" > "+s.len)}function w(s){this.buf=s,this.pos=0,this.len=s.length}var Ee=typeof Uint8Array<"u"?function(r){if(r instanceof Uint8Array||Array.isArray(r))return new w(r);throw Error("illegal buffer")}:function(r){if(Array.isArray(r))return new w(r);throw Error("illegal buffer")},Le=function(){return C.Buffer?function(i){return(w.create=function(o){return C.Buffer.isBuffer(o)?new Ct(o):Ee(o)})(i)}:Ee};w.create=Le();w.prototype._slice=C.Array.prototype.subarray||C.Array.prototype.slice;w.prototype.uint32=function(){var r=4294967295;return function(){if(r=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(r=(r|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return r;if((this.pos+=5)>this.len)throw this.pos=this.len,L(this,10);return r}}();w.prototype.int32=function(){return this.uint32()|0};w.prototype.sint32=function(){var r=this.uint32();return r>>>1^-(r&1)|0};function Dt(){var s=new Ce(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return s;if(s.lo=(s.lo|(this.buf[this.pos]&127)<<28)>>>0,s.hi=(s.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return s;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw L(this);if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return s}return s.lo=(s.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,s}if(this.len-this.pos>4){for(;r<5;++r)if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}else for(;r<5;++r){if(this.pos>=this.len)throw L(this);if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}throw Error("invalid varint encoding")}w.prototype.bool=function(){return this.uint32()!==0};function ht(s,r){return(s[r-4]|s[r-3]<<8|s[r-2]<<16|s[r-1]<<24)>>>0}w.prototype.fixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)};w.prototype.sfixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)|0};function De(){if(this.pos+8>this.len)throw L(this,8);return new Ce(ht(this.buf,this.pos+=4),ht(this.buf,this.pos+=4))}w.prototype.float=function(){if(this.pos+4>this.len)throw L(this,4);var r=C.float.readFloatLE(this.buf,this.pos);return this.pos+=4,r};w.prototype.double=function(){if(this.pos+8>this.len)throw L(this,4);var r=C.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,r};w.prototype.bytes=function(){var r=this.uint32(),i=this.pos,n=this.pos+r;if(n>this.len)throw L(this,r);if(this.pos+=r,Array.isArray(this.buf))return this.buf.slice(i,n);if(i===n){var o=C.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,i,n)};w.prototype.string=function(){var r=this.bytes();return Pn.read(r,0,r.length)};w.prototype.skip=function(r){if(typeof r=="number"){if(this.pos+r>this.len)throw L(this,r);this.pos+=r}else do if(this.pos>=this.len)throw L(this);while(this.buf[this.pos++]&128);return this};w.prototype.skipType=function(s){switch(s){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(s=this.uint32()&7)!==4;)this.skipType(s);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+s+" at offset "+this.pos)}return this};w._configure=function(s){Ct=s,w.create=Le(),Ct._configure();var r=C.Long?"toLong":"toNumber";C.merge(w.prototype,{int64:function(){return Dt.call(this)[r](!1)},uint64:function(){return Dt.call(this)[r](!0)},sint64:function(){return Dt.call(this).zzDecode()[r](!1)},fixed64:function(){return De.call(this)[r](!0)},sfixed64:function(){return De.call(this)[r](!1)}})}});var Ue=P((Bi,Be)=>{"use strict";Be.exports=F;var Ae=Lt();(F.prototype=Object.create(Ae.prototype)).constructor=F;var qe=B();function F(s){Ae.call(this,s)}F._configure=function(){qe.Buffer&&(F.prototype._slice=qe.Buffer.prototype.slice)};F.prototype.string=function(){var r=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+r,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+r,this.len))};F._configure()});var Ne=P((Ui,ze)=>{"use strict";ze.exports=X;var It=B();(X.prototype=Object.create(It.EventEmitter.prototype)).constructor=X;function X(s,r,i){if(typeof s!="function")throw TypeError("rpcImpl must be a function");It.EventEmitter.call(this),this.rpcImpl=s,this.requestDelimited=!!r,this.responseDelimited=!!i}X.prototype.rpcCall=function s(r,i,n,o,t){if(!o)throw TypeError("request must be specified");var e=this;if(!t)return It.asPromise(s,e,r,i,n,o);if(!e.rpcImpl){setTimeout(function(){t(Error("already ended"))},0);return}try{return e.rpcImpl(r,i[e.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return e.emit("error",c,r),t(c);if(u===null){e.end(!0);return}if(!(u instanceof n))try{u=n[e.responseDelimited?"decodeDelimited":"decode"](u)}catch(p){return e.emit("error",p,r),t(p)}return e.emit("data",u,r),t(null,u)})}catch(l){e.emit("error",l,r),setTimeout(function(){t(l)},0);return}};X.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Fe=P(Me=>{"use strict";var Sn=Me;Sn.Service=Ne()});var He=P((Ni,We)=>{"use strict";We.exports={}});var Ve=P($e=>{"use strict";var j=$e;j.build="minimal";j.Writer=Et();j.BufferWriter=Te();j.Reader=Lt();j.BufferReader=Ue();j.util=B();j.rpc=Fe();j.roots=He();j.configure=Je;function Je(){j.util._configure(),j.Writer._configure(j.BufferWriter),j.Reader._configure(j.BufferReader)}Je()});var qt=P((Fi,Ge)=>{"use strict";Ge.exports=Ve()});var Xt=Q(gt());var et=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected",n))(et||{}),nt=(n=>(n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed",n))(nt||{});function Gt(s,r){return s.lastIndexOf(r,0)===0}function vt(s){return s==null?!1:typeof s=="function"}function Kt(s,r){if(globalThis.console){let i=globalThis.console[s];vt(i)&&i.apply(globalThis.console,r)}}function un(s,r){return Math.floor(Math.random()*(r-s+1)+s)}function H(s,r,i){s>31&&(s=31);let n=un(0,Math.min(i,r*Math.pow(2,s)));return Math.min(i,r+n)}function Zt(s){return"error"in s&&s.error!==null}function J(s){return Math.min(s*1e3,2147483647)}var it=class extends Xt.default{constructor(i,n,o){super();this._resubscribeTimeout=null;this._refreshTimeout=null;this.channel=n,this.state="unsubscribed",this._centrifuge=i,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._filter="",this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(o),this._centrifuge._debugEnabled?(this.on("state",t=>{this._debug("subscription state",n,t.oldState,"->",t.newState)}),this.on("error",t=>{this._debug("subscription error",n,t)})):this.on("error",function(){Function.prototype()})}ready(i){return this.state==="unsubscribed"?Promise.reject({code:7,message:this.state}):this.state==="subscribed"?Promise.resolve():new Promise((n,o)=>{let t={resolve:n,reject:o};i&&(t.timeout=setTimeout(function(){o({code:1,message:"timeout"})},i)),this._promises[this._nextPromiseId()]=t})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(0,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(0,"unsubscribe called",!0)}async publish(i){return await this._methodCall(),this._centrifuge.publish(this.channel,i)}async presence(){return await this._methodCall(),this._centrifuge.presence(this.channel)}async presenceStats(){return await this._methodCall(),this._centrifuge.presenceStats(this.channel)}async history(i){return await this._methodCall(),this._centrifuge.history(this.channel,i)}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:7,message:this.state}):new Promise((i,n)=>{let o=this._centrifuge._config.timeout,t=setTimeout(()=>{n({code:1,message:"timeout"})},o);this._promises[this._nextPromiseId()]={timeout:t,resolve:i,reject:n}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state==="unsubscribed"}_isSubscribing(){return this.state==="subscribing"}_isSubscribed(){return this.state==="subscribed"}_setState(i){if(this.state!==i){let n=this.state;return this.state=i,this.emit("state",{newState:i,oldState:n,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(i){if(!this._isSubscribing())return;this._clearSubscribingState(),i.recoverable&&(this._recover=!0,this._offset=i.offset||0,this._epoch=i.epoch||""),i.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState("subscribed");let n=this._centrifuge._getSubscribeContext(this.channel,i);this.emit("subscribed",n),this._resolvePromises();let o=i.publications;if(o&&o.length>0)for(let t in o)o.hasOwnProperty(t)&&this._handlePublication(o[t]);i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl)))}async _setSubscribing(i,n){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState("subscribing")&&this.emit("subscribing",{channel:this.channel,code:i,reason:n}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&await this._unsubPromise,this._isSubscribing()&&this._subscribe())}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(i=>this._handleTokenResponse(i)).catch(i=>this._handleTokenError(i)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(i){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(n=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=n,this._sendSubscribe(i)}).catch(n=>this._handleGetDataError(n))}_handleGetDataError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:12,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(i){if(!this._isSubscribing()){this._inflight=!1;return}if(!i){this._inflight=!1,this._failUnauthorized();return}this._token=i,this._getData?this._getDataAndSubscribe(i):this._sendSubscribe(i)}_handleTokenError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:8,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(i){if(!this._isTransportOpen())return this._inflight=!1,null;let n=this._buildSubscribeCommand(i);return this._centrifuge._call(n).then(o=>{this._inflight=!1;let t=o.reply.subscribe;this._handleSubscribeResponse(t),o.next&&o.next()},o=>{this._inflight=!1,this._handleSubscribeError(o.error),o.next&&o.next()}),n}_buildSubscribeCommand(i){let n={channel:this.channel};if(i&&(n.token=i),this._data&&(n.data=this._data),this._positioned&&(n.positioned=!0),this._recoverable&&(n.recoverable=!0),this._joinLeave&&(n.join_leave=!0),this._needRecover()){n.recover=!0;let o=this._getOffset();o&&(n.offset=o);let t=this._getEpoch();t&&(n.epoch=t)}return this._delta&&(n.delta=this._delta),this._filter&&(n.filter=this._filter),{subscribe:n}}_debug(...i){this._centrifuge._debug(...i)}_handleSubscribeError(i){if(this._isSubscribing()){if(i.code===1){this._centrifuge._disconnect(3,"subscribe timeout",!0);return}this._subscribeError(i)}}_handleSubscribeResponse(i){this._isSubscribing()&&this._setSubscribed(i)}_setUnsubscribed(i,n,o){if(this._isUnsubscribed())return Promise.resolve();let t=Promise.resolve();return this._isSubscribed()?(o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState("unsubscribed")&&this.emit("unsubscribed",{channel:this.channel,code:i,reason:n}),this._rejectPromises({code:7,message:this.state}),t}_handlePublication(i){if(this._delta&&this._delta_negotiated){let{newData:o,newPrevValue:t}=this._centrifuge._codec.applyDeltaIfNeeded(i,this._prevValue);i.data=o,this._prevValue=t}let n=this._centrifuge._getPublicationContext(this.channel,i);this.emit("publication",n),i.offset&&(this._offset=i.offset)}_handleJoin(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("join",{channel:this.channel,info:n})}_handleLeave(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("leave",{channel:this.channel,info:n})}_resolvePromises(){for(let i in this._promises)this._promises.hasOwnProperty(i)&&(this._promises[i].timeout&&clearTimeout(this._promises[i].timeout),this._promises[i].resolve(),delete this._promises[i])}_rejectPromises(i){for(let n in this._promises)this._promises.hasOwnProperty(n)&&(this._promises[n].timeout&&clearTimeout(this._promises[n].timeout),this._promises[n].reject(i),delete this._promises[n])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}let i=this,n=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){i._isSubscribing()&&i._subscribe()},n),this._debug("resubscribe scheduled after "+n,this.channel)}_subscribeError(i){if(this._isSubscribing())if(i.code<100||i.code===109||i.temporary===!0){i.code===109&&(this._token="");let n={channel:this.channel,type:"subscribe",error:i};this._centrifuge.state==="connected"&&this.emit("error",n),this._scheduleResubscribe()}else this._setUnsubscribed(i.code,i.message,!1)}_getResubscribeDelay(){let i=H(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,i}_setOptions(i){if(i){if(i.since&&(this._offset=i.since.offset||0,this._epoch=i.since.epoch||"",this._recover=!0),i.data&&(this._data=i.data),i.getData&&(this._getData=i.getData),i.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=i.minResubscribeDelay),i.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=i.maxResubscribeDelay),i.token&&(this._token=i.token),i.getToken&&(this._getToken=i.getToken),i.positioned===!0&&(this._positioned=!0),i.recoverable===!0&&(this._recoverable=!0),i.joinLeave===!0&&(this._joinLeave=!0),i.delta){if(i.delta!=="fossil")throw new Error("unsupported delta format");this._delta=i.delta}i.filter&&(this._filter=i.filter)}}_getOffset(){let i=this._offset;return i!==null?i:0}_getEpoch(){let i=this._epoch;return i!==null?i:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);let i={channel:this.channel},n=this._getToken;return n===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:12,message:"provide a function to get channel subscription token"}}),Promise.reject(new T(""))):n(i)}_refresh(){this._clearRefreshTimeout();let i=this;this._getSubscriptionToken().then(function(n){if(!i._isSubscribed())return;if(!n){i._failUnauthorized();return}i._token=n;let t={sub_refresh:{channel:i.channel,token:n}};i._centrifuge._call(t).then(e=>{let l=e.reply.sub_refresh;i._refreshResponse(l),e.next&&e.next()},e=>{i._refreshError(e.error),e.next&&e.next()})}).catch(function(n){if(n instanceof T){i._failUnauthorized();return}i.emit("error",{type:"refreshToken",channel:i.channel,error:{code:9,message:n!==void 0?n.toString():""}}),i._refreshTimeout=setTimeout(()=>i._refresh(),i._getRefreshRetryDelay())})}_refreshResponse(i){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl))))}_refreshError(i){this._isSubscribed()&&(i.code<100||i.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:i}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(i.code,i.message,!0))}_getRefreshRetryDelay(){return H(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(1,"unauthorized",!0)}};var ot=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(r,i){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=n=>{i.onError(n)},this._transport.onclose=n=>{i.onClose(n)},this._transport.onmessage=n=>{i.onMessage(n.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var V=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(r,i){let n="";r==="protobuf"&&(n="centrifuge-protobuf"),n!==""?this._transport=new this.options.websocket(this.endpoint,n):this._transport=new this.options.websocket(this.endpoint),r==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=o=>{i.onError(o)},this._transport.onclose=o=>{i.onClose(o)},this._transport.onmessage=o=>{i.onMessage(o.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var rt=class{constructor(r,i){this.endpoint=r,this.options=i,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(r){if(!r.ok)throw new Error(r.status);return r}_fetchEventTarget(r,i,n){let o=new EventTarget,t=r.options.fetch;return t(i,n).then(r._handleErrors).then(e=>{o.dispatchEvent(new Event("open"));let l="",c=0,u=new Uint8Array,p=e.body.getReader();return new r.options.readableStream({start(y){function O(){return p.read().then(({done:g,value:k})=>{if(g){o.dispatchEvent(new Event("close")),y.close();return}try{if(r._protocol==="json")for(l+=r._utf8decoder.decode(k);c<l.length;)if(l[c]===`
|
|
2
|
-
`){let x=l.substring(0,c);o.dispatchEvent(new MessageEvent("message",{data:x})),l=l.substring(c+1),c=0}else++c;else{let x=new Uint8Array(u.length+k.length);for(x.set(u),x.set(k,u.length),u=x;;){let R=r.options.decoder.decodeReply(u);if(R.ok){let S=u.slice(0,R.pos);o.dispatchEvent(new MessageEvent("message",{data:S})),u=u.slice(R.pos);continue}break}}}catch(x){o.dispatchEvent(new Event("error",{detail:x})),o.dispatchEvent(new Event("close")),y.close();return}
|
|
1
|
+
"use strict";(()=>{var Ze=Object.create;var Bt=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var P=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports);var en=(s,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Qe(r))!tn.call(s,o)&&o!==i&&Bt(s,o,{get:()=>r[o],enumerable:!(n=Xe(r,o))||n.enumerable});return s};var Q=(s,r,i)=>(i=s!=null?Ze(Ye(s)):{},en(r||!s||!s.__esModule?Bt(i,"default",{value:s,enumerable:!0}):i,s));var gt=P((Rn,_t)=>{"use strict";var F=typeof Reflect=="object"?Reflect:null,Ut=F&&typeof F.apply=="function"?F.apply:function(r,i,n){return Function.prototype.apply.call(r,i,n)},Y;F&&typeof F.ownKeys=="function"?Y=F.ownKeys:Object.getOwnPropertySymbols?Y=function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:Y=function(r){return Object.getOwnPropertyNames(r)};function nn(s){console&&console.warn&&console.warn(s)}var Nt=Number.isNaN||function(r){return r!==r};function v(){v.init.call(this)}_t.exports=v;_t.exports.once=sn;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var zt=10;function tt(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return zt},set:function(s){if(typeof s!="number"||s<0||Nt(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");zt=s}});v.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};v.prototype.setMaxListeners=function(r){if(typeof r!="number"||r<0||Nt(r))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+r+".");return this._maxListeners=r,this};function Mt(s){return s._maxListeners===void 0?v.defaultMaxListeners:s._maxListeners}v.prototype.getMaxListeners=function(){return Mt(this)};v.prototype.emit=function(r){for(var i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);var o=r==="error",t=this._events;if(t!==void 0)o=o&&t.error===void 0;else if(!o)return!1;if(o){var e;if(i.length>0&&(e=i[0]),e instanceof Error)throw e;var l=new Error("Unhandled error."+(e?" ("+e.message+")":""));throw l.context=e,l}var c=t[r];if(c===void 0)return!1;if(typeof c=="function")Ut(c,this,i);else for(var u=c.length,p=$t(c,u),n=0;n<u;++n)Ut(p[n],this,i);return!0};function Ht(s,r,i,n){var o,t,e;if(tt(i),t=s._events,t===void 0?(t=s._events=Object.create(null),s._eventsCount=0):(t.newListener!==void 0&&(s.emit("newListener",r,i.listener?i.listener:i),t=s._events),e=t[r]),e===void 0)e=t[r]=i,++s._eventsCount;else if(typeof e=="function"?e=t[r]=n?[i,e]:[e,i]:n?e.unshift(i):e.push(i),o=Mt(s),o>0&&e.length>o&&!e.warned){e.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+e.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=s,l.type=r,l.count=e.length,nn(l)}return s}v.prototype.addListener=function(r,i){return Ht(this,r,i,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(r,i){return Ht(this,r,i,!0)};function on(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ft(s,r,i){var n={fired:!1,wrapFn:void 0,target:s,type:r,listener:i},o=on.bind(n);return o.listener=i,n.wrapFn=o,o}v.prototype.once=function(r,i){return tt(i),this.on(r,Ft(this,r,i)),this};v.prototype.prependOnceListener=function(r,i){return tt(i),this.prependListener(r,Ft(this,r,i)),this};v.prototype.removeListener=function(r,i){var n,o,t,e,l;if(tt(i),o=this._events,o===void 0)return this;if(n=o[r],n===void 0)return this;if(n===i||n.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete o[r],o.removeListener&&this.emit("removeListener",r,n.listener||i));else if(typeof n!="function"){for(t=-1,e=n.length-1;e>=0;e--)if(n[e]===i||n[e].listener===i){l=n[e].listener,t=e;break}if(t<0)return this;t===0?n.shift():rn(n,t),n.length===1&&(o[r]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",r,l||i)}return this};v.prototype.off=v.prototype.removeListener;v.prototype.removeAllListeners=function(r){var i,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[r]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[r]),this;if(arguments.length===0){var t=Object.keys(n),e;for(o=0;o<t.length;++o)e=t[o],e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=n[r],typeof i=="function")this.removeListener(r,i);else if(i!==void 0)for(o=i.length-1;o>=0;o--)this.removeListener(r,i[o]);return this};function Wt(s,r,i){var n=s._events;if(n===void 0)return[];var o=n[r];return o===void 0?[]:typeof o=="function"?i?[o.listener||o]:[o]:i?cn(o):$t(o,o.length)}v.prototype.listeners=function(r){return Wt(this,r,!0)};v.prototype.rawListeners=function(r){return Wt(this,r,!1)};v.listenerCount=function(s,r){return typeof s.listenerCount=="function"?s.listenerCount(r):Jt.call(s,r)};v.prototype.listenerCount=Jt;function Jt(s){var r=this._events;if(r!==void 0){var i=r[s];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?Y(this._events):[]};function $t(s,r){for(var i=new Array(r),n=0;n<r;++n)i[n]=s[n];return i}function rn(s,r){for(;r+1<s.length;r++)s[r]=s[r+1];s.pop()}function cn(s){for(var r=new Array(s.length),i=0;i<r.length;++i)r[i]=s[i].listener||s[i];return r}function sn(s,r){return new Promise(function(i,n){function o(e){s.removeListener(r,t),n(e)}function t(){typeof s.removeListener=="function"&&s.removeListener("error",o),i([].slice.call(arguments))}Vt(s,r,t,{once:!0}),r!=="error"&&ln(s,o,{once:!0})})}function ln(s,r,i){typeof s.on=="function"&&Vt(s,"error",r,i)}function Vt(s,r,i,n){if(typeof s.on=="function")n.once?s.once(r,i):s.on(r,i);else if(typeof s.addEventListener=="function")s.addEventListener(r,function o(t){n.once&&s.removeEventListener(r,o),i(t)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var te=P((xi,Yt)=>{"use strict";Yt.exports=yn;function yn(s,r){for(var i=new Array(arguments.length-1),n=0,o=2,t=!0;o<arguments.length;)i[n++]=arguments[o++];return new Promise(function(l,c){i[n]=function(p){if(t)if(t=!1,p)c(p);else{for(var y=new Array(arguments.length-1),w=0;w<y.length;)y[w++]=arguments[w];l.apply(null,y)}};try{s.apply(r||null,i)}catch(u){t&&(t=!1,c(u))}})}});var oe=P(ie=>{"use strict";var ut=ie;ut.length=function(r){var i=r.length;if(!i)return 0;for(var n=0;--i%4>1&&r.charAt(i)==="=";)++n;return Math.ceil(r.length*3)/4-n};var $=new Array(64),ne=new Array(123);for(D=0;D<64;)ne[$[D]=D<26?D+65:D<52?D+71:D<62?D-4:D-59|43]=D++;var D;ut.encode=function(r,i,n){for(var o=null,t=[],e=0,l=0,c;i<n;){var u=r[i++];switch(l){case 0:t[e++]=$[u>>2],c=(u&3)<<4,l=1;break;case 1:t[e++]=$[c|u>>4],c=(u&15)<<2,l=2;break;case 2:t[e++]=$[c|u>>6],t[e++]=$[u&63],l=0;break}e>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,t)),e=0)}return l&&(t[e++]=$[c],t[e++]=61,l===1&&(t[e++]=61)),o?(e&&o.push(String.fromCharCode.apply(String,t.slice(0,e))),o.join("")):String.fromCharCode.apply(String,t.slice(0,e))};var ee="invalid encoding";ut.decode=function(r,i,n){for(var o=n,t=0,e,l=0;l<r.length;){var c=r.charCodeAt(l++);if(c===61&&t>1)break;if((c=ne[c])===void 0)throw Error(ee);switch(t){case 0:e=c,t=1;break;case 1:i[n++]=e<<2|(c&48)>>4,e=c,t=2;break;case 2:i[n++]=(e&15)<<4|(c&60)>>2,e=c,t=3;break;case 3:i[n++]=(e&3)<<6|c,t=0;break}}if(t===1)throw Error(ee);return n-o};ut.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}});var ce=P((ji,re)=>{"use strict";re.exports=ft;function ft(){this._listeners={}}ft.prototype.on=function(r,i,n){return(this._listeners[r]||(this._listeners[r]=[])).push({fn:i,ctx:n||this}),this};ft.prototype.off=function(r,i){if(r===void 0)this._listeners={};else if(i===void 0)this._listeners[r]=[];else for(var n=this._listeners[r],o=0;o<n.length;)n[o].fn===i?n.splice(o,1):++o;return this};ft.prototype.emit=function(r){var i=this._listeners[r];if(i){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<i.length;)i[o].fn.apply(i[o++].ctx,n)}return this}});var pe=P((Ti,he)=>{"use strict";he.exports=se(se);function se(s){return typeof Float32Array<"u"?function(){var r=new Float32Array([-0]),i=new Uint8Array(r.buffer),n=i[3]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3]}function t(c,u,p){r[0]=c,u[p]=i[3],u[p+1]=i[2],u[p+2]=i[1],u[p+3]=i[0]}s.writeFloatLE=n?o:t,s.writeFloatBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],r[0]}function l(c,u){return i[3]=c[u],i[2]=c[u+1],i[1]=c[u+2],i[0]=c[u+3],r[0]}s.readFloatLE=n?e:l,s.readFloatBE=n?l:e}():function(){function r(n,o,t,e){var l=o<0?1:0;if(l&&(o=-o),o===0)n(1/o>0?0:2147483648,t,e);else if(isNaN(o))n(2143289344,t,e);else if(o>34028234663852886e22)n((l<<31|2139095040)>>>0,t,e);else if(o<11754943508222875e-54)n((l<<31|Math.round(o/1401298464324817e-60))>>>0,t,e);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((l<<31|c+127<<23|u)>>>0,t,e)}}s.writeFloatLE=r.bind(null,le),s.writeFloatBE=r.bind(null,ue);function i(n,o,t){var e=n(o,t),l=(e>>31)*2+1,c=e>>>23&255,u=e&8388607;return c===255?u?NaN:l*(1/0):c===0?l*1401298464324817e-60*u:l*Math.pow(2,c-150)*(u+8388608)}s.readFloatLE=i.bind(null,fe),s.readFloatBE=i.bind(null,ae)}(),typeof Float64Array<"u"?function(){var r=new Float64Array([-0]),i=new Uint8Array(r.buffer),n=i[7]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3],u[p+4]=i[4],u[p+5]=i[5],u[p+6]=i[6],u[p+7]=i[7]}function t(c,u,p){r[0]=c,u[p]=i[7],u[p+1]=i[6],u[p+2]=i[5],u[p+3]=i[4],u[p+4]=i[3],u[p+5]=i[2],u[p+6]=i[1],u[p+7]=i[0]}s.writeDoubleLE=n?o:t,s.writeDoubleBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],i[4]=c[u+4],i[5]=c[u+5],i[6]=c[u+6],i[7]=c[u+7],r[0]}function l(c,u){return i[7]=c[u],i[6]=c[u+1],i[5]=c[u+2],i[4]=c[u+3],i[3]=c[u+4],i[2]=c[u+5],i[1]=c[u+6],i[0]=c[u+7],r[0]}s.readDoubleLE=n?e:l,s.readDoubleBE=n?l:e}():function(){function r(n,o,t,e,l,c){var u=e<0?1:0;if(u&&(e=-e),e===0)n(0,l,c+o),n(1/e>0?0:2147483648,l,c+t);else if(isNaN(e))n(0,l,c+o),n(2146959360,l,c+t);else if(e>17976931348623157e292)n(0,l,c+o),n((u<<31|2146435072)>>>0,l,c+t);else{var p;if(e<22250738585072014e-324)p=e/5e-324,n(p>>>0,l,c+o),n((u<<31|p/4294967296)>>>0,l,c+t);else{var y=Math.floor(Math.log(e)/Math.LN2);y===1024&&(y=1023),p=e*Math.pow(2,-y),n(p*4503599627370496>>>0,l,c+o),n((u<<31|y+1023<<20|p*1048576&1048575)>>>0,l,c+t)}}}s.writeDoubleLE=r.bind(null,le,0,4),s.writeDoubleBE=r.bind(null,ue,4,0);function i(n,o,t,e,l){var c=n(e,l+o),u=n(e,l+t),p=(u>>31)*2+1,y=u>>>20&2047,w=4294967296*(u&1048575)+c;return y===2047?w?NaN:p*(1/0):y===0?p*5e-324*w:p*Math.pow(2,y-1075)*(w+4503599627370496)}s.readDoubleLE=i.bind(null,fe,0,4),s.readDoubleBE=i.bind(null,ae,4,0)}(),s}function le(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}function ue(s,r,i){r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255}function fe(s,r){return(s[r]|s[r+1]<<8|s[r+2]<<16|s[r+3]<<24)>>>0}function ae(s,r){return(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3])>>>0}});var de=P((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(s){}return null}});var ye=P(be=>{"use strict";var Ot=be;Ot.length=function(r){for(var i=0,n=0,o=0;o<r.length;++o)n=r.charCodeAt(o),n<128?i+=1:n<2048?i+=2:(n&64512)===55296&&(r.charCodeAt(o+1)&64512)===56320?(++o,i+=4):i+=3;return i};Ot.read=function(r,i,n){var o=n-i;if(o<1)return"";for(var t=null,e=[],l=0,c;i<n;)c=r[i++],c<128?e[l++]=c:c>191&&c<224?e[l++]=(c&31)<<6|r[i++]&63:c>239&&c<365?(c=((c&7)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,e[l++]=55296+(c>>10),e[l++]=56320+(c&1023)):e[l++]=(c&15)<<12|(r[i++]&63)<<6|r[i++]&63,l>8191&&((t||(t=[])).push(String.fromCharCode.apply(String,e)),l=0);return t?(l&&t.push(String.fromCharCode.apply(String,e.slice(0,l))),t.join("")):String.fromCharCode.apply(String,e.slice(0,l))};Ot.write=function(r,i,n){for(var o=n,t,e,l=0;l<r.length;++l)t=r.charCodeAt(l),t<128?i[n++]=t:t<2048?(i[n++]=t>>6|192,i[n++]=t&63|128):(t&64512)===55296&&((e=r.charCodeAt(l+1))&64512)===56320?(t=65536+((t&1023)<<10)+(e&1023),++l,i[n++]=t>>18|240,i[n++]=t>>12&63|128,i[n++]=t>>6&63|128,i[n++]=t&63|128):(i[n++]=t>>12|224,i[n++]=t>>6&63|128,i[n++]=t&63|128);return n-o}});var ge=P((Di,_e)=>{"use strict";_e.exports=_n;function _n(s,r,i){var n=i||8192,o=n>>>1,t=null,e=n;return function(c){if(c<1||c>o)return s(c);e+c>n&&(t=s(n),e=0);var u=r.call(t,e,e+=c);return e&7&&(e=(e|7)+1),u}}});var ke=P((Ci,ve)=>{"use strict";ve.exports=m;var K=B();function m(s,r){this.lo=s>>>0,this.hi=r>>>0}var M=m.zero=new m(0,0);M.toNumber=function(){return 0};M.zzEncode=M.zzDecode=function(){return this};M.length=function(){return 1};var gn=m.zeroHash="\0\0\0\0\0\0\0\0";m.fromNumber=function(r){if(r===0)return M;var i=r<0;i&&(r=-r);var n=r>>>0,o=(r-n)/4294967296>>>0;return i&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new m(n,o)};m.from=function(r){if(typeof r=="number")return m.fromNumber(r);if(K.isString(r))if(K.Long)r=K.Long.fromString(r);else return m.fromNumber(parseInt(r,10));return r.low||r.high?new m(r.low>>>0,r.high>>>0):M};m.prototype.toNumber=function(r){if(!r&&this.hi>>>31){var i=~this.lo+1>>>0,n=~this.hi>>>0;return i||(n=n+1>>>0),-(i+n*4294967296)}return this.lo+this.hi*4294967296};m.prototype.toLong=function(r){return K.Long?new K.Long(this.lo|0,this.hi|0,!!r):{low:this.lo|0,high:this.hi|0,unsigned:!!r}};var A=String.prototype.charCodeAt;m.fromHash=function(r){return r===gn?M:new m((A.call(r,0)|A.call(r,1)<<8|A.call(r,2)<<16|A.call(r,3)<<24)>>>0,(A.call(r,4)|A.call(r,5)<<8|A.call(r,6)<<16|A.call(r,7)<<24)>>>0)};m.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};m.prototype.zzEncode=function(){var r=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^r)>>>0,this.lo=(this.lo<<1^r)>>>0,this};m.prototype.zzDecode=function(){var r=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^r)>>>0,this.hi=(this.hi>>>1^r)>>>0,this};m.prototype.length=function(){var r=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?i===0?r<16384?r<128?1:2:r<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}});var B=P(Pt=>{"use strict";var d=Pt;d.asPromise=te();d.base64=oe();d.EventEmitter=ce();d.float=pe();d.inquire=de();d.utf8=ye();d.pool=ge();d.LongBits=ke();d.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);d.global=d.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Pt;d.emptyArray=Object.freeze?Object.freeze([]):[];d.emptyObject=Object.freeze?Object.freeze({}):{};d.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};d.isString=function(r){return typeof r=="string"||r instanceof String};d.isObject=function(r){return r&&typeof r=="object"};d.isset=d.isSet=function(r,i){var n=r[i];return n!=null&&r.hasOwnProperty(i)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};d.Buffer=function(){try{var s=d.inquire("buffer").Buffer;return s.prototype.utf8Write?s:null}catch{return null}}();d._Buffer_from=null;d._Buffer_allocUnsafe=null;d.newBuffer=function(r){return typeof r=="number"?d.Buffer?d._Buffer_allocUnsafe(r):new d.Array(r):d.Buffer?d._Buffer_from(r):typeof Uint8Array>"u"?r:new Uint8Array(r)};d.Array=typeof Uint8Array<"u"?Uint8Array:Array;d.Long=d.global.dcodeIO&&d.global.dcodeIO.Long||d.global.Long||d.inquire("long");d.key2Re=/^true|false|0|1$/;d.key32Re=/^-?(?:0|[1-9][0-9]*)$/;d.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;d.longToHash=function(r){return r?d.LongBits.from(r).toHash():d.LongBits.zeroHash};d.longFromHash=function(r,i){var n=d.LongBits.fromHash(r);return d.Long?d.Long.fromBits(n.lo,n.hi,i):n.toNumber(!!i)};function we(s,r,i){for(var n=Object.keys(r),o=0;o<n.length;++o)(s[n[o]]===void 0||!i)&&(s[n[o]]=r[n[o]]);return s}d.merge=we;d.lcFirst=function(r){return r.charAt(0).toLowerCase()+r.substring(1)};function Oe(s){function r(i,n){if(!(this instanceof r))return new r(i,n);Object.defineProperty(this,"message",{get:function(){return i}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&we(this,n)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return s},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}d.newError=Oe;d.ProtocolError=Oe("ProtocolError");d.oneOfGetter=function(r){for(var i={},n=0;n<r.length;++n)i[r[n]]=1;return function(){for(var o=Object.keys(this),t=o.length-1;t>-1;--t)if(i[o[t]]===1&&this[o[t]]!==void 0&&this[o[t]]!==null)return o[t]}};d.oneOfSetter=function(r){return function(i){for(var n=0;n<r.length;++n)r[n]!==i&&delete this[r[n]]}};d.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};d._configure=function(){var s=d.Buffer;if(!s){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=s.from!==Uint8Array.from&&s.from||function(i,n){return new s(i,n)},d._Buffer_allocUnsafe=s.allocUnsafe||function(i){return new s(i)}}});var Et=P((Ii,xe)=>{"use strict";xe.exports=_;var E=B(),St,at=E.LongBits,Pe=E.base64,Se=E.utf8;function Z(s,r,i){this.fn=s,this.len=r,this.next=void 0,this.val=i}function xt(){}function vn(s){this.head=s.head,this.tail=s.tail,this.len=s.len,this.next=s.states}function _(){this.len=0,this.head=new Z(xt,0,0),this.tail=this.head,this.states=null}var me=function(){return E.Buffer?function(){return(_.create=function(){return new St})()}:function(){return new _}};_.create=me();_.alloc=function(r){return new E.Array(r)};E.Array!==Array&&(_.alloc=E.pool(_.alloc,E.Array.prototype.subarray));_.prototype._push=function(r,i,n){return this.tail=this.tail.next=new Z(r,i,n),this.len+=i,this};function Rt(s,r,i){r[i]=s&255}function kn(s,r,i){for(;s>127;)r[i++]=s&127|128,s>>>=7;r[i]=s}function jt(s,r){this.len=s,this.next=void 0,this.val=r}jt.prototype=Object.create(Z.prototype);jt.prototype.fn=kn;_.prototype.uint32=function(r){return this.len+=(this.tail=this.tail.next=new jt((r=r>>>0)<128?1:r<16384?2:r<2097152?3:r<268435456?4:5,r)).len,this};_.prototype.int32=function(r){return r<0?this._push(Tt,10,at.fromNumber(r)):this.uint32(r)};_.prototype.sint32=function(r){return this.uint32((r<<1^r>>31)>>>0)};function Tt(s,r,i){for(;s.hi;)r[i++]=s.lo&127|128,s.lo=(s.lo>>>7|s.hi<<25)>>>0,s.hi>>>=7;for(;s.lo>127;)r[i++]=s.lo&127|128,s.lo=s.lo>>>7;r[i++]=s.lo}_.prototype.uint64=function(r){var i=at.from(r);return this._push(Tt,i.length(),i)};_.prototype.int64=_.prototype.uint64;_.prototype.sint64=function(r){var i=at.from(r).zzEncode();return this._push(Tt,i.length(),i)};_.prototype.bool=function(r){return this._push(Rt,1,r?1:0)};function mt(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}_.prototype.fixed32=function(r){return this._push(mt,4,r>>>0)};_.prototype.sfixed32=_.prototype.fixed32;_.prototype.fixed64=function(r){var i=at.from(r);return this._push(mt,4,i.lo)._push(mt,4,i.hi)};_.prototype.sfixed64=_.prototype.fixed64;_.prototype.float=function(r){return this._push(E.float.writeFloatLE,4,r)};_.prototype.double=function(r){return this._push(E.float.writeDoubleLE,8,r)};var wn=E.Array.prototype.set?function(r,i,n){i.set(r,n)}:function(r,i,n){for(var o=0;o<r.length;++o)i[n+o]=r[o]};_.prototype.bytes=function(r){var i=r.length>>>0;if(!i)return this._push(Rt,1,0);if(E.isString(r)){var n=_.alloc(i=Pe.length(r));Pe.decode(r,n,0),r=n}return this.uint32(i)._push(wn,i,r)};_.prototype.string=function(r){var i=Se.length(r);return i?this.uint32(i)._push(Se.write,i,r):this._push(Rt,1,0)};_.prototype.fork=function(){return this.states=new vn(this),this.head=this.tail=new Z(xt,0,0),this.len=0,this};_.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Z(xt,0,0),this.len=0),this};_.prototype.ldelim=function(){var r=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=r.next,this.tail=i,this.len+=n),this};_.prototype.finish=function(){for(var r=this.head.next,i=this.constructor.alloc(this.len),n=0;r;)r.fn(r.val,i,n),n+=r.len,r=r.next;return i};_._configure=function(s){St=s,_.create=me(),St._configure()}});var Te=P((qi,je)=>{"use strict";je.exports=I;var Re=Et();(I.prototype=Object.create(Re.prototype)).constructor=I;var U=B();function I(){Re.call(this)}I._configure=function(){I.alloc=U._Buffer_allocUnsafe,I.writeBytesBuffer=U.Buffer&&U.Buffer.prototype instanceof Uint8Array&&U.Buffer.prototype.set.name==="set"?function(r,i,n){i.set(r,n)}:function(r,i,n){if(r.copy)r.copy(i,n,0,r.length);else for(var o=0;o<r.length;)i[n++]=r[o++]}};I.prototype.bytes=function(r){U.isString(r)&&(r=U._Buffer_from(r,"base64"));var i=r.length>>>0;return this.uint32(i),i&&this._push(I.writeBytesBuffer,i,r),this};function On(s,r,i){s.length<40?U.utf8.write(s,r,i):r.utf8Write?r.utf8Write(s,i):r.write(s,i)}I.prototype.string=function(r){var i=U.Buffer.byteLength(r);return this.uint32(i),i&&this._push(On,i,r),this};I._configure()});var Lt=P((Ai,Ie)=>{"use strict";Ie.exports=O;var C=B(),Ct,Ce=C.LongBits,Pn=C.utf8;function L(s,r){return RangeError("index out of range: "+s.pos+" + "+(r||1)+" > "+s.len)}function O(s){this.buf=s,this.pos=0,this.len=s.length}var Ee=typeof Uint8Array<"u"?function(r){if(r instanceof Uint8Array||Array.isArray(r))return new O(r);throw Error("illegal buffer")}:function(r){if(Array.isArray(r))return new O(r);throw Error("illegal buffer")},Le=function(){return C.Buffer?function(i){return(O.create=function(o){return C.Buffer.isBuffer(o)?new Ct(o):Ee(o)})(i)}:Ee};O.create=Le();O.prototype._slice=C.Array.prototype.subarray||C.Array.prototype.slice;O.prototype.uint32=function(){var r=4294967295;return function(){if(r=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(r=(r|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return r;if((this.pos+=5)>this.len)throw this.pos=this.len,L(this,10);return r}}();O.prototype.int32=function(){return this.uint32()|0};O.prototype.sint32=function(){var r=this.uint32();return r>>>1^-(r&1)|0};function Dt(){var s=new Ce(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return s;if(s.lo=(s.lo|(this.buf[this.pos]&127)<<28)>>>0,s.hi=(s.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return s;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw L(this);if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return s}return s.lo=(s.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,s}if(this.len-this.pos>4){for(;r<5;++r)if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}else for(;r<5;++r){if(this.pos>=this.len)throw L(this);if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}throw Error("invalid varint encoding")}O.prototype.bool=function(){return this.uint32()!==0};function ht(s,r){return(s[r-4]|s[r-3]<<8|s[r-2]<<16|s[r-1]<<24)>>>0}O.prototype.fixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)};O.prototype.sfixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)|0};function De(){if(this.pos+8>this.len)throw L(this,8);return new Ce(ht(this.buf,this.pos+=4),ht(this.buf,this.pos+=4))}O.prototype.float=function(){if(this.pos+4>this.len)throw L(this,4);var r=C.float.readFloatLE(this.buf,this.pos);return this.pos+=4,r};O.prototype.double=function(){if(this.pos+8>this.len)throw L(this,4);var r=C.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,r};O.prototype.bytes=function(){var r=this.uint32(),i=this.pos,n=this.pos+r;if(n>this.len)throw L(this,r);if(this.pos+=r,Array.isArray(this.buf))return this.buf.slice(i,n);if(i===n){var o=C.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,i,n)};O.prototype.string=function(){var r=this.bytes();return Pn.read(r,0,r.length)};O.prototype.skip=function(r){if(typeof r=="number"){if(this.pos+r>this.len)throw L(this,r);this.pos+=r}else do if(this.pos>=this.len)throw L(this);while(this.buf[this.pos++]&128);return this};O.prototype.skipType=function(s){switch(s){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(s=this.uint32()&7)!==4;)this.skipType(s);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+s+" at offset "+this.pos)}return this};O._configure=function(s){Ct=s,O.create=Le(),Ct._configure();var r=C.Long?"toLong":"toNumber";C.merge(O.prototype,{int64:function(){return Dt.call(this)[r](!1)},uint64:function(){return Dt.call(this)[r](!0)},sint64:function(){return Dt.call(this).zzDecode()[r](!1)},fixed64:function(){return De.call(this)[r](!0)},sfixed64:function(){return De.call(this)[r](!1)}})}});var Ue=P((Bi,Be)=>{"use strict";Be.exports=H;var Ae=Lt();(H.prototype=Object.create(Ae.prototype)).constructor=H;var qe=B();function H(s){Ae.call(this,s)}H._configure=function(){qe.Buffer&&(H.prototype._slice=qe.Buffer.prototype.slice)};H.prototype.string=function(){var r=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+r,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+r,this.len))};H._configure()});var Ne=P((Ui,ze)=>{"use strict";ze.exports=X;var It=B();(X.prototype=Object.create(It.EventEmitter.prototype)).constructor=X;function X(s,r,i){if(typeof s!="function")throw TypeError("rpcImpl must be a function");It.EventEmitter.call(this),this.rpcImpl=s,this.requestDelimited=!!r,this.responseDelimited=!!i}X.prototype.rpcCall=function s(r,i,n,o,t){if(!o)throw TypeError("request must be specified");var e=this;if(!t)return It.asPromise(s,e,r,i,n,o);if(!e.rpcImpl){setTimeout(function(){t(Error("already ended"))},0);return}try{return e.rpcImpl(r,i[e.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return e.emit("error",c,r),t(c);if(u===null){e.end(!0);return}if(!(u instanceof n))try{u=n[e.responseDelimited?"decodeDelimited":"decode"](u)}catch(p){return e.emit("error",p,r),t(p)}return e.emit("data",u,r),t(null,u)})}catch(l){e.emit("error",l,r),setTimeout(function(){t(l)},0);return}};X.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var He=P(Me=>{"use strict";var Sn=Me;Sn.Service=Ne()});var We=P((Ni,Fe)=>{"use strict";Fe.exports={}});var Ve=P($e=>{"use strict";var j=$e;j.build="minimal";j.Writer=Et();j.BufferWriter=Te();j.Reader=Lt();j.BufferReader=Ue();j.util=B();j.rpc=He();j.roots=We();j.configure=Je;function Je(){j.util._configure(),j.Writer._configure(j.BufferWriter),j.Reader._configure(j.BufferReader)}Je()});var qt=P((Hi,Ge)=>{"use strict";Ge.exports=Ve()});var Xt=Q(gt());var et=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected",n))(et||{}),nt=(n=>(n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed",n))(nt||{});function Gt(s,r){return s.lastIndexOf(r,0)===0}function vt(s){return s==null?!1:typeof s=="function"}function Kt(s,r){if(globalThis.console){let i=globalThis.console[s];vt(i)&&i.apply(globalThis.console,r)}}function un(s,r){return Math.floor(Math.random()*(r-s+1)+s)}function W(s,r,i){s>31&&(s=31);let n=un(0,Math.min(i,r*Math.pow(2,s)));return Math.min(i,r+n)}function Zt(s){return"error"in s&&s.error!==null}function J(s){return Math.min(s*1e3,2147483647)}var it=class extends Xt.default{constructor(i,n,o){super();this._resubscribeTimeout=null;this._refreshTimeout=null;this.channel=n,this.state="unsubscribed",this._centrifuge=i,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._filter="",this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(o),this._centrifuge._debugEnabled?(this.on("state",t=>{this._debug("subscription state",n,t.oldState,"->",t.newState)}),this.on("error",t=>{this._debug("subscription error",n,t)})):this.on("error",function(){Function.prototype()})}ready(i){return this.state==="unsubscribed"?Promise.reject({code:7,message:this.state}):this.state==="subscribed"?Promise.resolve():new Promise((n,o)=>{let t={resolve:n,reject:o};i&&(t.timeout=setTimeout(function(){o({code:1,message:"timeout"})},i)),this._promises[this._nextPromiseId()]=t})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(0,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(0,"unsubscribe called",!0)}async publish(i){return await this._methodCall(),this._centrifuge.publish(this.channel,i)}async presence(){return await this._methodCall(),this._centrifuge.presence(this.channel)}async presenceStats(){return await this._methodCall(),this._centrifuge.presenceStats(this.channel)}async history(i){return await this._methodCall(),this._centrifuge.history(this.channel,i)}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:7,message:this.state}):new Promise((i,n)=>{let o=this._centrifuge._config.timeout,t=setTimeout(()=>{n({code:1,message:"timeout"})},o);this._promises[this._nextPromiseId()]={timeout:t,resolve:i,reject:n}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state==="unsubscribed"}_isSubscribing(){return this.state==="subscribing"}_isSubscribed(){return this.state==="subscribed"}_setState(i){if(this.state!==i){let n=this.state;return this.state=i,this.emit("state",{newState:i,oldState:n,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(i){if(!this._isSubscribing())return;this._clearSubscribingState(),i.recoverable&&(this._recover=!0,this._offset=i.offset||0,this._epoch=i.epoch||""),i.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState("subscribed");let n=this._centrifuge._getSubscribeContext(this.channel,i);this.emit("subscribed",n),this._resolvePromises();let o=i.publications;if(o&&o.length>0)for(let t in o)o.hasOwnProperty(t)&&this._handlePublication(o[t]);i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl)))}async _setSubscribing(i,n){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState("subscribing")&&this.emit("subscribing",{channel:this.channel,code:i,reason:n}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&await this._unsubPromise,this._isSubscribing()&&this._subscribe())}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(i=>this._handleTokenResponse(i)).catch(i=>this._handleTokenError(i)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(i){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(n=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=n,this._sendSubscribe(i)}).catch(n=>this._handleGetDataError(n))}_handleGetDataError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:12,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(i){if(!this._isSubscribing()){this._inflight=!1;return}if(!i){this._inflight=!1,this._failUnauthorized();return}this._token=i,this._getData?this._getDataAndSubscribe(i):this._sendSubscribe(i)}_handleTokenError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:8,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(i){if(!this._isTransportOpen())return this._inflight=!1,null;let n=this._buildSubscribeCommand(i);return this._centrifuge._call(n).then(o=>{this._inflight=!1;let t=o.reply.subscribe;this._handleSubscribeResponse(t),o.next&&o.next()},o=>{this._inflight=!1,this._handleSubscribeError(o.error),o.next&&o.next()}),n}_buildSubscribeCommand(i){let n={channel:this.channel};if(i&&(n.token=i),this._data&&(n.data=this._data),this._positioned&&(n.positioned=!0),this._recoverable&&(n.recoverable=!0),this._joinLeave&&(n.join_leave=!0),this._needRecover()){n.recover=!0;let o=this._getOffset();o&&(n.offset=o);let t=this._getEpoch();t&&(n.epoch=t)}return this._delta&&(n.delta=this._delta),this._filter&&(n.filter=this._filter),{subscribe:n}}_debug(...i){this._centrifuge._debug(...i)}_handleSubscribeError(i){if(this._isSubscribing()){if(i.code===1){this._centrifuge._disconnect(3,"subscribe timeout",!0);return}this._subscribeError(i)}}_handleSubscribeResponse(i){this._isSubscribing()&&this._setSubscribed(i)}_setUnsubscribed(i,n,o){if(this._isUnsubscribed())return Promise.resolve();let t=Promise.resolve();return this._isSubscribed()?(o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState("unsubscribed")&&this.emit("unsubscribed",{channel:this.channel,code:i,reason:n}),this._rejectPromises({code:7,message:this.state}),t}_handlePublication(i){if(this._delta&&this._delta_negotiated){let{newData:o,newPrevValue:t}=this._centrifuge._codec.applyDeltaIfNeeded(i,this._prevValue);i.data=o,this._prevValue=t}let n=this._centrifuge._getPublicationContext(this.channel,i);this.emit("publication",n),i.offset&&(this._offset=i.offset)}_handleJoin(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("join",{channel:this.channel,info:n})}_handleLeave(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("leave",{channel:this.channel,info:n})}_resolvePromises(){for(let i in this._promises)this._promises.hasOwnProperty(i)&&(this._promises[i].timeout&&clearTimeout(this._promises[i].timeout),this._promises[i].resolve(),delete this._promises[i])}_rejectPromises(i){for(let n in this._promises)this._promises.hasOwnProperty(n)&&(this._promises[n].timeout&&clearTimeout(this._promises[n].timeout),this._promises[n].reject(i),delete this._promises[n])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}let i=this,n=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){i._isSubscribing()&&i._subscribe()},n),this._debug("resubscribe scheduled after "+n,this.channel)}_subscribeError(i){if(this._isSubscribing())if(i.code<100||i.code===109||i.temporary===!0){i.code===109&&(this._token="");let n={channel:this.channel,type:"subscribe",error:i};this._centrifuge.state==="connected"&&this.emit("error",n),this._scheduleResubscribe()}else this._setUnsubscribed(i.code,i.message,!1)}_getResubscribeDelay(){let i=W(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,i}_setOptions(i){if(i){if(i.since&&(this._offset=i.since.offset||0,this._epoch=i.since.epoch||"",this._recover=!0),i.data&&(this._data=i.data),i.getData&&(this._getData=i.getData),i.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=i.minResubscribeDelay),i.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=i.maxResubscribeDelay),i.token&&(this._token=i.token),i.getToken&&(this._getToken=i.getToken),i.positioned===!0&&(this._positioned=!0),i.recoverable===!0&&(this._recoverable=!0),i.joinLeave===!0&&(this._joinLeave=!0),i.delta){if(i.delta!=="fossil")throw new Error("unsupported delta format");this._delta=i.delta}i.filter&&(this._filter=i.filter)}}_getOffset(){let i=this._offset;return i!==null?i:0}_getEpoch(){let i=this._epoch;return i!==null?i:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);let i={channel:this.channel},n=this._getToken;return n===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:12,message:"provide a function to get channel subscription token"}}),Promise.reject(new T(""))):n(i)}_refresh(){this._clearRefreshTimeout();let i=this;this._getSubscriptionToken().then(function(n){if(!i._isSubscribed())return;if(!n){i._failUnauthorized();return}i._token=n;let t={sub_refresh:{channel:i.channel,token:n}};i._centrifuge._call(t).then(e=>{let l=e.reply.sub_refresh;i._refreshResponse(l),e.next&&e.next()},e=>{i._refreshError(e.error),e.next&&e.next()})}).catch(function(n){if(n instanceof T){i._failUnauthorized();return}i.emit("error",{type:"refreshToken",channel:i.channel,error:{code:9,message:n!==void 0?n.toString():""}}),i._refreshTimeout=setTimeout(()=>i._refresh(),i._getRefreshRetryDelay())})}_refreshResponse(i){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl))))}_refreshError(i){this._isSubscribed()&&(i.code<100||i.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:i}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(i.code,i.message,!0))}_getRefreshRetryDelay(){return W(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(1,"unauthorized",!0)}};var ot=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(r,i){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=n=>{i.onError(n)},this._transport.onclose=n=>{i.onClose(n)},this._transport.onmessage=n=>{i.onMessage(n.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var V=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(r,i){let n="";r==="protobuf"&&(n="centrifuge-protobuf");let o=this.options.httpHeaders,t=o&&Object.keys(o).length>0;n!==""?t?this._transport=new this.options.websocket(this.endpoint,n,{headers:o}):this._transport=new this.options.websocket(this.endpoint,n):t?this._transport=new this.options.websocket(this.endpoint,void 0,{headers:o}):this._transport=new this.options.websocket(this.endpoint),r==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=e=>{i.onError(e)},this._transport.onclose=e=>{i.onClose(e)},this._transport.onmessage=e=>{i.onMessage(e.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var rt=class{constructor(r,i){this.endpoint=r,this.options=i,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(r){if(!r.ok)throw new Error(r.status);return r}_fetchEventTarget(r,i,n){let o=new EventTarget,t=r.options.fetch;return t(i,n).then(r._handleErrors).then(e=>{o.dispatchEvent(new Event("open"));let l="",c=0,u=new Uint8Array,p=e.body.getReader();return new r.options.readableStream({start(y){function w(){return p.read().then(({done:g,value:k})=>{if(g){o.dispatchEvent(new Event("close")),y.close();return}try{if(r._protocol==="json")for(l+=r._utf8decoder.decode(k);c<l.length;)if(l[c]===`
|
|
2
|
+
`){let x=l.substring(0,c);o.dispatchEvent(new MessageEvent("message",{data:x})),l=l.substring(c+1),c=0}else++c;else{let x=new Uint8Array(u.length+k.length);for(x.set(u),x.set(k,u.length),u=x;;){let R=r.options.decoder.decodeReply(u);if(R.ok){let S=u.slice(0,R.pos);o.dispatchEvent(new MessageEvent("message",{data:S})),u=u.slice(R.pos);continue}break}}}catch(x){o.dispatchEvent(new Event("error",{detail:x})),o.dispatchEvent(new Event("close")),y.close();return}w()}).catch(function(g){o.dispatchEvent(new Event("error",{detail:g})),o.dispatchEvent(new Event("close")),y.close()})}return w()}})}).catch(e=>{o.dispatchEvent(new Event("error",{detail:e})),o.dispatchEvent(new Event("close"))}),o}supported(){return this.options.fetch!==null&&this.options.readableStream!==null&&typeof TextDecoder<"u"&&typeof AbortController<"u"&&typeof EventTarget<"u"&&typeof Event<"u"&&typeof MessageEvent<"u"&&typeof Error<"u"}initialize(r,i,n){this._protocol=r,this._abortController=new AbortController;let o,t;r==="json"?(o={Accept:"application/json","Content-Type":"application/json"},t=n):(o={Accept:"application/octet-stream","Content-Type":"application/octet-stream"},t=n);let e={method:"POST",headers:o,body:t,mode:"cors",credentials:"same-origin",signal:this._abortController.signal},l=this._fetchEventTarget(this,this.endpoint,e);l.addEventListener("open",()=>{i.onOpen()}),l.addEventListener("error",c=>{this._abortController.abort(),i.onError(c)}),l.addEventListener("close",()=>{this._abortController.abort(),i.onClose({code:4,reason:"connection closed"})}),l.addEventListener("message",c=>{i.onMessage(c.data)})}close(){this._abortController.abort()}send(r,i,n){let o,t,e={session:i,node:n,data:r};this._protocol==="json"?(o={"Content-Type":"application/json"},t=JSON.stringify(e)):(o={"Content-Type":"application/octet-stream"},t=this.options.encoder.encodeEmulationRequest(e));let l=this.options.fetch,c={method:"POST",headers:o,body:t,mode:"cors",credentials:"same-origin"};l(this.options.emulationEndpoint,c)}};var ct=class{constructor(r,i){this.endpoint=r,this.options=i,this._protocol="json",this._transport=null,this._onClose=null}name(){return"sse"}subName(){return"sse"}emulation(){return!0}supported(){return this.options.eventsource!==null&&this.options.fetch!==null}initialize(r,i,n){let o;globalThis&&globalThis.document&&globalThis.document.baseURI?o=new URL(this.endpoint,globalThis.document.baseURI):o=new URL(this.endpoint),o.searchParams.append("cf_connect",n);let t={},e=new this.options.eventsource(o.toString(),t);this._transport=e;let l=this;e.onopen=function(){i.onOpen()},e.onerror=function(c){e.close(),i.onError(c),i.onClose({code:4,reason:"connection closed"})},e.onmessage=function(c){i.onMessage(c.data)},l._onClose=function(){i.onClose({code:4,reason:"connection closed"})}}close(){this._transport.close(),this._onClose!==null&&this._onClose()}send(r,i,n){let o={session:i,node:n,data:r},t={"Content-Type":"application/json"},e=JSON.stringify(o),l=this.options.fetch,c={method:"POST",headers:t,body:e,mode:"cors",credentials:"same-origin"};l(this.options.emulationEndpoint,c)}};var st=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null,this._stream=null,this._writer=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"webtransport"}subName(){return"webtransport"}emulation(){return!1}supported(){return this.options.webtransport!==void 0&&this.options.webtransport!==null}async initialize(r,i){let n;globalThis&&globalThis.document&&globalThis.document.baseURI?n=new URL(this.endpoint,globalThis.document.baseURI):n=new URL(this.endpoint),r==="protobuf"&&n.searchParams.append("cf_protocol","protobuf"),this._protocol=r;let o=new EventTarget;this._transport=new this.options.webtransport(n.toString()),this._transport.closed.then(()=>{i.onClose({code:4,reason:"connection closed"})}).catch(()=>{i.onClose({code:4,reason:"connection closed"})});try{await this._transport.ready}catch{this.close();return}let t;try{t=await this._transport.createBidirectionalStream()}catch{this.close();return}this._stream=t,this._writer=this._stream.writable.getWriter(),o.addEventListener("close",()=>{i.onClose({code:4,reason:"connection closed"})}),o.addEventListener("message",e=>{i.onMessage(e.data)}),this._startReading(o),i.onOpen()}async _startReading(r){let i=this._stream.readable.getReader(),n="",o=0,t=new Uint8Array;try{for(;;){let{done:e,value:l}=await i.read();if(l.length>0)if(this._protocol==="json")for(n+=this._utf8decoder.decode(l);o<n.length;)if(n[o]===`
|
|
3
3
|
`){let c=n.substring(0,o);r.dispatchEvent(new MessageEvent("message",{data:c})),n=n.substring(o+1),o=0}else++o;else{let c=new Uint8Array(t.length+l.length);for(c.set(t),c.set(l,t.length),t=c;;){let u=this.options.decoder.decodeReply(t);if(u.ok){let p=t.slice(0,u.pos);r.dispatchEvent(new MessageEvent("message",{data:p})),t=t.slice(u.pos);continue}break}}if(e)break}}catch{r.dispatchEvent(new Event("close"))}}async close(){try{this._writer&&await this._writer.close(),this._transport.close()}catch{}}async send(r){let i;this._protocol==="json"?i=new TextEncoder().encode(r+`
|
|
4
|
-
`):i=r;try{await this._writer.write(i)}catch{this.close()}}};var pn=[-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],kt=class{constructor(r){this.a=r,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){let r=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw new RangeError("out of bounds");return r}getChar(){return String.fromCharCode(this.getByte())}getInt(){let r=0,i;for(;this.haveBytes()&&(i=pn[127&this.getByte()])>=0;)r=(r<<6)+i;return this.pos--,r>>>0}},
|
|
5
|
-
`)throw new Error("size integer not terminated by '\\n'");let l=new
|
|
4
|
+
`):i=r;try{await this._writer.write(i)}catch{this.close()}}};var pn=[-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],kt=class{constructor(r){this.a=r,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){let r=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw new RangeError("out of bounds");return r}getChar(){return String.fromCharCode(this.getByte())}getInt(){let r=0,i;for(;this.haveBytes()&&(i=pn[127&this.getByte()])>=0;)r=(r<<6)+i;return this.pos--,r>>>0}},wt=class{constructor(){this.a=[]}toByteArray(r){return Array.isArray(r)?this.a:new Uint8Array(this.a)}putArray(r,i,n){for(let o=i;o<n;o++)this.a.push(r[o])}};function dn(s){let r=0,i=0,n=0,o=0,t=0,e=s.length;for(;e>=16;)r=r+s[t+0]|0,i=i+s[t+1]|0,n=n+s[t+2]|0,o=o+s[t+3]|0,r=r+s[t+4]|0,i=i+s[t+5]|0,n=n+s[t+6]|0,o=o+s[t+7]|0,r=r+s[t+8]|0,i=i+s[t+9]|0,n=n+s[t+10]|0,o=o+s[t+11]|0,r=r+s[t+12]|0,i=i+s[t+13]|0,n=n+s[t+14]|0,o=o+s[t+15]|0,t+=16,e-=16;for(;e>=4;)r=r+s[t+0]|0,i=i+s[t+1]|0,n=n+s[t+2]|0,o=o+s[t+3]|0,t+=4,e-=4;switch(o=((o+(n<<8)|0)+(i<<16)|0)+(r<<24)|0,e){case 3:o=o+(s[t+2]<<8)|0;case 2:o=o+(s[t+1]<<16)|0;case 1:o=o+(s[t+0]<<24)|0}return o>>>0}function lt(s,r){let i=0,n=new kt(r),o=s.length,t=r.length,e=n.getInt();if(n.getChar()!==`
|
|
5
|
+
`)throw new Error("size integer not terminated by '\\n'");let l=new wt;for(;n.haveBytes();){let c=n.getInt(),u;switch(n.getChar()){case"@":if(u=n.getInt(),n.haveBytes()&&n.getChar()!==",")throw new Error("copy command not terminated by ','");if(i+=c,i>e)throw new Error("copy exceeds output file size");if(u+c>o)throw new Error("copy extends past end of input");l.putArray(s,u,u+c);break;case":":if(i+=c,i>e)throw new Error("insert command gives an output larger than predicted");if(c>t)throw new Error("insert count exceeds size of delta");l.putArray(n.a,n.pos,n.pos+c),n.pos+=c;break;case";":{let p=l.toByteArray(s);if(c!==dn(p))throw new Error("bad checksum");if(i!==e)throw new Error("generated size does not match predicted size");return p}default:throw new Error("unknown delta operator")}}throw new Error("unterminated delta")}var G=class{name(){return"json"}encodeCommands(r){return r.map(i=>JSON.stringify(i)).join(`
|
|
6
6
|
`)}decodeReplies(r){return r.trim().split(`
|
|
7
|
-
`).map(i=>JSON.parse(i))}applyDeltaIfNeeded(r,i){let n,o;if(r.delta){let t=lt(i,new TextEncoder().encode(r.data));n=JSON.parse(new TextDecoder().decode(t)),o=t}else n=JSON.parse(r.data),o=new TextEncoder().encode(r.data);return{newData:n,newPrevValue:o}}};var Qt=Q(gt()),bn={headers:{},token:"",getToken:null,data:null,getData:null,debug:!1,name:"js",version:"",fetch:null,readableStream:null,websocket:null,eventsource:null,sockjs:null,sockjsOptions:{},emulationEndpoint:"/emulation",minReconnectDelay:500,maxReconnectDelay:2e4,timeout:5e3,maxServerPingDelay:1e4,networkEventTarget:null},T=class extends Error{constructor(r){super(r),this.name=this.constructor.name}},N=class extends Qt.default{constructor(i,n){super();this._reconnectTimeout=null;this._refreshTimeout=null;this._serverPingTimeout=null;this.state="disconnected",this._transportIsOpen=!1,this._endpoint=i,this._emulation=!1,this._transports=[],this._currentTransportIndex=0,this._triedAllTransports=!1,this._transportWasOpen=!1,this._transport=null,this._transportId=0,this._deviceWentOffline=!1,this._transportClosed=!0,this._codec=new G,this._reconnecting=!1,this._reconnectTimeout=null,this._reconnectAttempts=0,this._client=null,this._session="",this._node="",this._subs={},this._serverSubs={},this._commandId=0,this._commands=[],this._batching=!1,this._refreshRequired=!1,this._refreshTimeout=null,this._callbacks={},this._token="",this._data=null,this._dispatchPromise=Promise.resolve(),this._serverPing=0,this._serverPingTimeout=null,this._sendPong=!1,this._promises={},this._promiseId=0,this._debugEnabled=!1,this._networkEventsSet=!1,this._config={...bn,...n},this._configure(),this._debugEnabled?(this.on("state",o=>{this._debug("client state",o.oldState,"->",o.newState)}),this.on("error",o=>{this._debug("client error",o)})):this.on("error",function(){Function.prototype()})}newSubscription(i,n){if(this.getSubscription(i)!==null)throw new Error("Subscription to the channel "+i+" already exists");let o=new it(this,i,n);return this._subs[i]=o,o}getSubscription(i){return this._getSub(i)}removeSubscription(i){i&&(i.state!=="unsubscribed"&&i.unsubscribe(),this._removeSubscription(i))}subscriptions(){return this._subs}ready(i){switch(this.state){case"disconnected":return Promise.reject({code:3,message:"client disconnected"});case"connected":return Promise.resolve();default:return new Promise((n,o)=>{let t={resolve:n,reject:o};i&&(t.timeout=setTimeout(()=>{o({code:1,message:"timeout"})},i)),this._promises[this._nextPromiseId()]=t})}}connect(){if(this._isConnected()){this._debug("connect called when already connected");return}if(this._isConnecting()){this._debug("connect called when already connecting");return}this._debug("connect called"),this._reconnectAttempts=0,this._startConnecting()}disconnect(){this._disconnect(0,"disconnect called",!1)}setToken(i){this._token=i}setHeaders(i){this._config.headers=i}async send(i){let n={send:{data:i}};if(await this._methodCall(),!this._transportSendCommands([n]))throw this._createErrorObject(10,"transport write error")}async rpc(i,n){let o={rpc:{method:i,data:n}};return await this._methodCall(),{data:(await this._callPromise(o,e=>e.rpc)).data}}async publish(i,n){let o={publish:{channel:i,data:n}};return await this._methodCall(),await this._callPromise(o,()=>({})),{}}async history(i,n){let o={history:this._getHistoryRequest(i,n)};await this._methodCall();let t=await this._callPromise(o,l=>l.history),e=[];if(t.publications)for(let l=0;l<t.publications.length;l++)e.push(this._getPublicationContext(i,t.publications[l]));return{publications:e,epoch:t.epoch||"",offset:t.offset||0}}async presence(i){let n={presence:{channel:i}};await this._methodCall();let t=(await this._callPromise(n,e=>e.presence)).presence;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let l=t[e],c=l.conn_info,u=l.chan_info;c&&(l.connInfo=c),u&&(l.chanInfo=u)}return{clients:t}}async presenceStats(i){let n={presence_stats:{channel:i}};await this._methodCall();let o=await this._callPromise(n,t=>t.presence_stats);return{numUsers:o.num_users,numClients:o.num_clients}}startBatching(){this._batching=!0}stopBatching(){let i=this;Promise.resolve().then(function(){Promise.resolve().then(function(){i._batching=!1,i._flush()})})}_debug(...i){this._debugEnabled&&Kt("debug",i)}_codecName(){return this._codec.name()}_formatOverride(){}_configure(){if(!("Promise"in globalThis))throw new Error("Promise polyfill required");if(!this._endpoint)throw new Error("endpoint configuration required");if(this._config.token!==null&&(this._token=this._config.token),this._config.data!==null&&(this._data=this._config.data),this._codec=new G,this._formatOverride(),(this._config.debug===!0||typeof localStorage<"u"&&localStorage.getItem("centrifuge.debug"))&&(this._debugEnabled=!0),this._debug("config",this._config),typeof this._endpoint!="string")if(typeof this._endpoint=="object"&&this._endpoint instanceof Array){this._transports=this._endpoint,this._emulation=!0;for(let i in this._transports)if(this._transports.hasOwnProperty(i)){let n=this._transports[i];if(!n.endpoint||!n.transport)throw new Error("malformed transport configuration");let o=n.transport;if(["websocket","http_stream","sse","sockjs","webtransport"].indexOf(o)<0)throw new Error("unsupported transport name: "+o)}}else throw new Error("unsupported url configuration type: only string or array of objects are supported")}_setState(i){if(this.state!==i){this._reconnecting=!1;let n=this.state;return this.state=i,this.emit("state",{newState:i,oldState:n}),!0}return!1}_isDisconnected(){return this.state==="disconnected"}_isConnecting(){return this.state==="connecting"}_isConnected(){return this.state==="connected"}_nextCommandId(){return++this._commandId}_setNetworkEvents(){if(this._networkEventsSet)return;let i=null;this._config.networkEventTarget!==null?i=this._config.networkEventTarget:typeof globalThis.addEventListener<"u"&&(i=globalThis),i&&(i.addEventListener("offline",()=>{this._debug("offline event triggered"),(this.state==="connected"||this.state==="connecting")&&(this._disconnect(1,"transport closed",!0),this._deviceWentOffline=!0)}),i.addEventListener("online",()=>{this._debug("online event triggered"),this.state==="connecting"&&(this._deviceWentOffline&&!this._transportClosed&&(this._deviceWentOffline=!1,this._transportClosed=!0),this._clearReconnectTimeout(),this._startReconnecting())}),this._networkEventsSet=!0)}_getReconnectDelay(){let i=H(this._reconnectAttempts,this._config.minReconnectDelay,this._config.maxReconnectDelay);return this._reconnectAttempts+=1,i}_clearOutgoingRequests(){for(let i in this._callbacks)if(this._callbacks.hasOwnProperty(i)){let n=this._callbacks[i];clearTimeout(n.timeout);let o=n.errback;if(!o)continue;o({error:this._createErrorObject(11,"connection closed")})}this._callbacks={}}_clearConnectedState(){this._client=null,this._clearServerPingTimeout(),this._clearRefreshTimeout();for(let i in this._subs){if(!this._subs.hasOwnProperty(i))continue;let n=this._subs[i];n.state==="subscribed"&&n._setSubscribing(1,"transport closed")}for(let i in this._serverSubs)this._serverSubs.hasOwnProperty(i)&&this.emit("subscribing",{channel:i})}_handleWriteError(i){for(let n of i){let o=n.id;if(!(o in this._callbacks))continue;let t=this._callbacks[o];clearTimeout(this._callbacks[o].timeout),delete this._callbacks[o];let e=t.errback;e({error:this._createErrorObject(10,"transport write error")})}}_transportSendCommands(i){if(!i.length)return!0;if(!this._transport)return!1;try{this._transport.send(this._codec.encodeCommands(i),this._session,this._node)}catch(n){return this._debug("error writing commands",n),this._handleWriteError(i),!1}return!0}_initializeTransport(){let i;this._config.websocket!==null?i=this._config.websocket:typeof globalThis.WebSocket!="function"&&typeof globalThis.WebSocket!="object"||(i=globalThis.WebSocket);let n=null;this._config.sockjs!==null?n=this._config.sockjs:typeof globalThis.SockJS<"u"&&(n=globalThis.SockJS);let o=null;this._config.eventsource!==null?o=this._config.eventsource:typeof globalThis.EventSource<"u"&&(o=globalThis.EventSource);let t=null;this._config.fetch!==null?t=this._config.fetch:typeof globalThis.fetch<"u"&&(t=globalThis.fetch);let e=null;if(this._config.readableStream!==null?e=this._config.readableStream:typeof globalThis.ReadableStream<"u"&&(e=globalThis.ReadableStream),this._emulation){this._currentTransportIndex>=this._transports.length&&(this._triedAllTransports=!0,this._currentTransportIndex=0);let k=0;for(;;){if(k>=this._transports.length)throw new Error("no supported transport found");let x=this._transports[this._currentTransportIndex],R=x.transport,S=x.endpoint;if(R==="websocket"){if(this._debug("trying websocket transport"),this._transport=new V(S,{websocket:i}),!this._transport.supported()){this._debug("websocket transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="webtransport"){if(this._debug("trying webtransport transport"),this._transport=new st(S,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="http_stream"){if(this._debug("trying http_stream transport"),this._transport=new rt(S,{fetch:t,readableStream:e,emulationEndpoint:this._config.emulationEndpoint,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("http_stream transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="sse"){if(this._debug("trying sse transport"),this._transport=new ct(S,{eventsource:o,fetch:t,emulationEndpoint:this._config.emulationEndpoint}),!this._transport.supported()){this._debug("sse transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="sockjs"){if(this._debug("trying sockjs"),this._transport=new ot(S,{sockjs:n,sockjsOptions:this._config.sockjsOptions}),!this._transport.supported()){this._debug("sockjs transport not available"),this._currentTransportIndex++,k++;continue}}else throw new Error("unknown transport "+R);break}}else{if(Gt(this._endpoint,"http"))throw new Error("Provide explicit transport endpoints configuration in case of using HTTP (i.e. using array of TransportEndpoint instead of a single string), or use ws(s):// scheme in an endpoint if you aimed using WebSocket transport");if(this._debug("client will use websocket"),this._transport=new V(this._endpoint,{websocket:i}),!this._transport.supported())throw new Error("WebSocket constructor not found, make sure it is available globally or passed as a dependency in Centrifuge options")}let l=this,c=this._transport,u=this._nextTransportId();l._debug("id of transport",u);let p=!1,y=[];if(this._transport.emulation()){let k=l._sendConnect(!0);y.push(k)}this._setNetworkEvents();let O=this._codec.encodeCommands(y);this._transportClosed=!1;let g;g=setTimeout(function(){c.close()},this._config.timeout),this._transport.initialize(this._codecName(),{onOpen:function(){if(g&&(clearTimeout(g),g=null),l._transportId!=u){l._debug("open callback from non-actual transport"),c.close();return}p=!0,l._debug(c.subName(),"transport open"),!c.emulation()&&(l._transportIsOpen=!0,l._transportWasOpen=!0,l.startBatching(),l._sendConnect(!1),l._sendSubscribeCommands(),l.stopBatching(),l.emit("__centrifuge_debug:connect_frame_sent",{}))},onError:function(k){if(l._transportId!=u){l._debug("error callback from non-actual transport");return}l._debug("transport level error",k)},onClose:function(k){if(g&&(clearTimeout(g),g=null),l._transportId!=u){l._debug("close callback from non-actual transport");return}l._debug(c.subName(),"transport closed"),l._transportClosed=!0,l._transportIsOpen=!1;let x="connection closed",R=!0,S=0;if(k&&"code"in k&&k.code&&(S=k.code),k&&k.reason)try{let yt=JSON.parse(k.reason);x=yt.reason,R=yt.reconnect}catch{x=k.reason,(S>=3500&&S<4e3||S>=4500&&S<5e3)&&(R=!1)}S<3e3?(S===1009?(S=3,x="message size limit exceeded",R=!1):(S=1,x="transport closed"),l._emulation&&!l._transportWasOpen&&(l._currentTransportIndex++,l._currentTransportIndex>=l._transports.length&&(l._triedAllTransports=!0,l._currentTransportIndex=0))):l._transportWasOpen=!0,l._isConnecting()&&!p&&l.emit("error",{type:"transport",error:{code:2,message:"transport closed"},transport:c.name()}),l._reconnecting=!1,l._disconnect(S,x,R)},onMessage:function(k){l._dataReceived(k)}},O),l.emit("__centrifuge_debug:transport_initialized",{})}_sendConnect(i){let n=this._constructConnectCommand(),o=this;return this._call(n,i).then(t=>{let e=t.reply.connect;o._connectResponse(e),t.next&&t.next()},t=>{o._connectError(t.error),t.next&&t.next()}),n}_startReconnecting(){if(this._debug("start reconnecting"),!this._isConnecting()){this._debug("stop reconnecting: client not in connecting state");return}if(this._reconnecting){this._debug("reconnect already in progress, return from reconnect routine");return}if(this._transportClosed===!1){this._debug("waiting for transport close");return}this._reconnecting=!0;let i=this._token==="";if(!(this._refreshRequired||i&&this._config.getToken!==null)){this._config.getData?this._config.getData().then(t=>{this._isConnecting()&&(this._data=t,this._initializeTransport())}).catch(t=>this._handleGetDataError(t)):this._initializeTransport();return}let o=this;this._getToken().then(function(t){if(o._isConnecting()){if(t==null||t==null){o._failUnauthorized();return}o._token=t,o._debug("connection token refreshed"),o._config.getData?o._config.getData().then(function(e){o._isConnecting()&&(o._data=e,o._initializeTransport())}).catch(e=>o._handleGetDataError(e)):o._initializeTransport()}}).catch(function(t){if(!o._isConnecting())return;if(t instanceof T){o._failUnauthorized();return}o.emit("error",{type:"connectToken",error:{code:5,message:t!==void 0?t.toString():""}});let e=o._getReconnectDelay();o._debug("error on getting connection token, reconnect after "+e+" milliseconds",t),o._reconnecting=!1,o._reconnectTimeout=setTimeout(()=>{o._startReconnecting()},e)})}_handleGetDataError(i){if(i instanceof T){this._failUnauthorized();return}this.emit("error",{type:"connectData",error:{code:12,message:i?.toString()||""}});let n=this._getReconnectDelay();this._debug("error on getting connect data, reconnect after "+n+" milliseconds",i),this._reconnecting=!1,this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},n)}_connectError(i){this.state==="connecting"&&(i.code===109&&(this._refreshRequired=!0),i.code<100||i.temporary===!0||i.code===109?(this.emit("error",{type:"connect",error:i}),this._debug("closing transport due to connect error"),this._disconnect(i.code,i.message,!0)):this._disconnect(i.code,i.message,!1))}_scheduleReconnect(){if(!this._isConnecting())return;let i=!1;this._emulation&&!this._transportWasOpen&&!this._triedAllTransports&&(i=!0);let n=this._getReconnectDelay();i&&(n=0),this._debug("reconnect after "+n+" milliseconds"),this._clearReconnectTimeout(),this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},n)}_constructConnectCommand(){let i={};this._token&&(i.token=this._token),this._data&&(i.data=this._data),this._config.name&&(i.name=this._config.name),this._config.version&&(i.version=this._config.version),Object.keys(this._config.headers).length>0&&(i.headers=this._config.headers);let n={},o=!1;for(let t in this._serverSubs)if(this._serverSubs.hasOwnProperty(t)&&this._serverSubs[t].recoverable){o=!0;let e={recover:!0};this._serverSubs[t].offset&&(e.offset=this._serverSubs[t].offset),this._serverSubs[t].epoch&&(e.epoch=this._serverSubs[t].epoch),n[t]=e}return o&&(i.subs=n),{connect:i}}_getHistoryRequest(i,n){let o={channel:i};return n!==void 0&&(n.since&&(o.since={offset:n.since.offset},n.since.epoch&&(o.since.epoch=n.since.epoch)),n.limit!==void 0&&(o.limit=n.limit),n.reverse===!0&&(o.reverse=!0)),o}_methodCall(){return this._isConnected()?Promise.resolve():new Promise((i,n)=>{let o=setTimeout(function(){n({code:1,message:"timeout"})},this._config.timeout);this._promises[this._nextPromiseId()]={timeout:o,resolve:i,reject:n}})}_callPromise(i,n){return new Promise((o,t)=>{this._call(i,!1).then(e=>{let l=n(e.reply);o(l),e.next?.()},e=>{t(e.error),e.next?.()})})}_dataReceived(i){this._serverPing>0&&this._waitServerPing();let n=this._codec.decodeReplies(i);this._dispatchPromise=this._dispatchPromise.then(()=>{let o;this._dispatchPromise=new Promise(t=>{o=t}),this._dispatchSynchronized(n,o)})}_dispatchSynchronized(i,n){let o=Promise.resolve();for(let t in i)i.hasOwnProperty(t)&&(o=o.then(()=>this._dispatchReply(i[t])));o=o.then(()=>{n()})}_dispatchReply(i){let n,o=new Promise(e=>{n=e});if(i==null)return this._debug("dispatch: got undefined or null reply"),n(),o;let t=i.id;return t&&t>0?this._handleReply(i,n):i.push?this._handlePush(i.push,n):this._handleServerPing(n),o}_call(i,n){return new Promise((o,t)=>{i.id=this._nextCommandId(),this._registerCall(i.id,o,t),n||this._addCommand(i)})}_startConnecting(){this._debug("start connecting"),this._setState("connecting")&&this.emit("connecting",{code:0,reason:"connect called"}),this._client=null,this._startReconnecting()}_disconnect(i,n,o){if(this._isDisconnected())return;this._transportIsOpen=!1;let t=this.state;this._reconnecting=!1;let e={code:i,reason:n},l=!1;if(o?l=this._setState("connecting"):(l=this._setState("disconnected"),this._rejectPromises({code:3,message:"disconnected"})),this._clearOutgoingRequests(),t==="connecting"&&this._clearReconnectTimeout(),t==="connected"&&this._clearConnectedState(),l&&(this._isConnecting()?this.emit("connecting",e):this.emit("disconnected",e)),this._transport){this._debug("closing existing transport");let c=this._transport;this._transport=null,c.close(),this._transportClosed=!0,this._nextTransportId()}else this._debug("no transport to close");this._scheduleReconnect()}_failUnauthorized(){this._disconnect(1,"unauthorized",!1)}_getToken(){return this._debug("get connection token"),this._config.getToken?this._config.getToken({}):(this.emit("error",{type:"configuration",error:{code:12,message:"token expired but no getToken function set in the configuration"}}),Promise.reject(new T("")))}_refresh(){let i=this._client,n=this;this._getToken().then(function(o){if(i!==n._client)return;if(!o){n._failUnauthorized();return}if(n._token=o,n._debug("connection token refreshed"),!n._isConnected())return;let t={refresh:{token:n._token}};n._call(t,!1).then(e=>{let l=e.reply.refresh;n._refreshResponse(l),e.next&&e.next()},e=>{n._refreshError(e.error),e.next&&e.next()})}).catch(function(o){if(n._isConnected()){if(o instanceof T){n._failUnauthorized();return}n.emit("error",{type:"refreshToken",error:{code:6,message:o!==void 0?o.toString():""}}),n._refreshTimeout=setTimeout(()=>n._refresh(),n._getRefreshRetryDelay())}})}_refreshError(i){i.code<100||i.temporary===!0?(this.emit("error",{type:"refresh",error:i}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._disconnect(i.code,i.message,!1)}_getRefreshRetryDelay(){return H(0,5e3,1e4)}_refreshResponse(i){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),i.expires&&(this._client=i.client,this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl)))}_removeSubscription(i){i!==null&&delete this._subs[i.channel]}_unsubscribe(i){if(!this._transportIsOpen)return Promise.resolve();let o={unsubscribe:{channel:i.channel}},t=this;return new Promise((l,c)=>{this._call(o,!1).then(u=>{l(),u.next&&u.next()},u=>{l(),u.next&&u.next(),t._disconnect(4,"unsubscribe error",!0)})})}_getSub(i){let n=this._subs[i];return n||null}_isServerSub(i){return this._serverSubs[i]!==void 0}_sendSubscribeCommands(){let i=[];for(let n in this._subs){if(!this._subs.hasOwnProperty(n))continue;let o=this._subs[n];if(o._inflight!==!0&&o.state==="subscribing"){let t=o._subscribe();t&&i.push(t)}}return i}_connectResponse(i){if(this._transportIsOpen=!0,this._transportWasOpen=!0,this._reconnectAttempts=0,this._refreshRequired=!1,this._isConnected())return;this._client=i.client,this._setState("connected"),this._refreshTimeout&&clearTimeout(this._refreshTimeout),i.expires&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl))),this._session=i.session,this._node=i.node,this.startBatching(),this._sendSubscribeCommands(),this.stopBatching();let n={client:i.client,transport:this._transport.subName()};i.data&&(n.data=i.data),this.emit("connected",n),this._resolvePromises(),this._processServerSubs(i.subs||{}),i.ping&&i.ping>0?(this._serverPing=i.ping*1e3,this._sendPong=i.pong===!0,this._waitServerPing()):this._serverPing=0}_processServerSubs(i){for(let n in i){if(!i.hasOwnProperty(n))continue;let o=i[n];this._serverSubs[n]={offset:o.offset,epoch:o.epoch,recoverable:o.recoverable||!1};let t=this._getSubscribeContext(n,o);this.emit("subscribed",t)}for(let n in i){if(!i.hasOwnProperty(n))continue;let o=i[n];if(o.recovered){let t=o.publications;if(t&&t.length>0)for(let e in t)t.hasOwnProperty(e)&&this._handlePublication(n,t[e])}}for(let n in this._serverSubs)this._serverSubs.hasOwnProperty(n)&&(i[n]||(this.emit("unsubscribed",{channel:n}),delete this._serverSubs[n]))}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearReconnectTimeout(){this._reconnectTimeout!==null&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null)}_clearServerPingTimeout(){this._serverPingTimeout!==null&&(clearTimeout(this._serverPingTimeout),this._serverPingTimeout=null)}_waitServerPing(){this._config.maxServerPingDelay!==0&&this._isConnected()&&(this._clearServerPingTimeout(),this._serverPingTimeout=setTimeout(()=>{this._isConnected()&&this._disconnect(2,"no ping",!0)},this._serverPing+this._config.maxServerPingDelay))}_getSubscribeContext(i,n){let o={channel:i,positioned:!1,recoverable:!1,wasRecovering:!1,recovered:!1,hasRecoveredPublications:!1};n.recovered&&(o.recovered=!0),n.positioned&&(o.positioned=!0),n.recoverable&&(o.recoverable=!0),n.was_recovering&&(o.wasRecovering=!0);let t="";"epoch"in n&&(t=n.epoch);let e=0;return"offset"in n&&(e=n.offset),(o.positioned||o.recoverable)&&(o.streamPosition={offset:e,epoch:t}),Array.isArray(n.publications)&&n.publications.length>0&&(o.hasRecoveredPublications=!0),n.data&&(o.data=n.data),o}_handleReply(i,n){let o=i.id;if(!(o in this._callbacks)){n();return}let t=this._callbacks[o];if(clearTimeout(this._callbacks[o].timeout),delete this._callbacks[o],Zt(i)){let e=t.errback;if(!e){n();return}let l={code:i.error.code,message:i.error.message||"",temporary:i.error.temporary||!1};e({error:l,next:n})}else{let e=t.callback;if(!e)return;e({reply:i,next:n})}}_handleJoin(i,n){let o=this._getSub(i);if(!o){if(this._isServerSub(i)){let t={channel:i,info:this._getJoinLeaveContext(n.info)};this.emit("join",t)}return}o._handleJoin(n)}_handleLeave(i,n){let o=this._getSub(i);if(!o){if(this._isServerSub(i)){let t={channel:i,info:this._getJoinLeaveContext(n.info)};this.emit("leave",t)}return}o._handleLeave(n)}_handleUnsubscribe(i,n){let o=this._getSub(i);if(!o){this._isServerSub(i)&&(delete this._serverSubs[i],this.emit("unsubscribed",{channel:i}));return}n.code<2500?o._setUnsubscribed(n.code,n.reason,!1):o._setSubscribing(n.code,n.reason)}_handleSubscribe(i,n){this._serverSubs[i]={offset:n.offset,epoch:n.epoch,recoverable:n.recoverable||!1},this.emit("subscribed",this._getSubscribeContext(i,n))}_handleDisconnect(i){let n=i.code,o=!0;(n>=3500&&n<4e3||n>=4500&&n<5e3)&&(o=!1),this._disconnect(n,i.reason,o)}_getPublicationContext(i,n){let o={channel:i,data:n.data};return n.offset&&(o.offset=n.offset),n.info&&(o.info=this._getJoinLeaveContext(n.info)),n.tags&&(o.tags=n.tags),o}_getJoinLeaveContext(i){let n={client:i.client,user:i.user},o=i.conn_info;o&&(n.connInfo=o);let t=i.chan_info;return t&&(n.chanInfo=t),n}_handlePublication(i,n){let o=this._getSub(i);if(!o){if(this._isServerSub(i)){let t=this._getPublicationContext(i,n);this.emit("publication",t),n.offset!==void 0&&(this._serverSubs[i].offset=n.offset)}return}o._handlePublication(n)}_handleMessage(i){this.emit("message",{data:i.data})}_handleServerPing(i){if(this._sendPong){let n={};this._transportSendCommands([n])}i()}_handlePush(i,n){let o=i.channel;i.pub?this._handlePublication(o,i.pub):i.message?this._handleMessage(i.message):i.join?this._handleJoin(o,i.join):i.leave?this._handleLeave(o,i.leave):i.unsubscribe?this._handleUnsubscribe(o,i.unsubscribe):i.subscribe?this._handleSubscribe(o,i.subscribe):i.disconnect&&this._handleDisconnect(i.disconnect),n()}_flush(){let i=this._commands.slice(0);this._commands=[],this._transportSendCommands(i)}_createErrorObject(i,n,o){let t={code:i,message:n};return o&&(t.temporary=!0),t}_registerCall(i,n,o){this._callbacks[i]={callback:n,errback:o,timeout:null},this._callbacks[i].timeout=setTimeout(()=>{delete this._callbacks[i],vt(o)&&o({error:this._createErrorObject(1,"timeout")})},this._config.timeout)}_addCommand(i){this._batching?this._commands.push(i):this._transportSendCommands([i])}_nextPromiseId(){return++this._promiseId}_nextTransportId(){return++this._transportId}_resolvePromises(){for(let i in this._promises)this._promises.hasOwnProperty(i)&&(this._promises[i].timeout&&clearTimeout(this._promises[i].timeout),this._promises[i].resolve(),delete this._promises[i])}_rejectPromises(i){for(let n in this._promises)this._promises.hasOwnProperty(n)&&(this._promises[n].timeout&&clearTimeout(this._promises[n].timeout),this._promises[n].reject(i),delete this._promises[n])}};N.SubscriptionState=nt;N.State=et;N.UnauthorizedError=T;var z=Q(qt());var q=Q(qt()),a=q.Reader,b=q.Writer,h=q.util,f=q.roots.default||(q.roots.default={}),pt=f.centrifugal=(()=>{let s={};return s.centrifuge=function(){let r={};return r.protocol=function(){let i={};return i.Error=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.code=0,n.prototype.message="",n.prototype.temporary=!1,n.encode=function(t,e){return e||(e=b.create()),t.code!=null&&Object.hasOwnProperty.call(t,"code")&&e.uint32(8).uint32(t.code),t.message!=null&&Object.hasOwnProperty.call(t,"message")&&e.uint32(18).string(t.message),t.temporary!=null&&Object.hasOwnProperty.call(t,"temporary")&&e.uint32(24).bool(t.temporary),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Error;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.code=t.uint32();break}case 2:{c.message=t.string();break}case 3:{c.temporary=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!h.isInteger(t.code)?"code: integer expected":t.message!=null&&t.hasOwnProperty("message")&&!h.isString(t.message)?"message: string expected":t.temporary!=null&&t.hasOwnProperty("temporary")&&typeof t.temporary!="boolean"?"temporary: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Error"},n}(),i.EmulationRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.node="",n.prototype.session="",n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.node!=null&&Object.hasOwnProperty.call(t,"node")&&e.uint32(10).string(t.node),t.session!=null&&Object.hasOwnProperty.call(t,"session")&&e.uint32(18).string(t.session),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(26).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.EmulationRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.node=t.string();break}case 2:{c.session=t.string();break}case 3:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.node!=null&&t.hasOwnProperty("node")&&!h.isString(t.node)?"node: string expected":t.session!=null&&t.hasOwnProperty("session")&&!h.isString(t.session)?"session: string expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.EmulationRequest"},n}(),i.Command=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.id=0,n.prototype.connect=null,n.prototype.subscribe=null,n.prototype.unsubscribe=null,n.prototype.publish=null,n.prototype.presence=null,n.prototype.presence_stats=null,n.prototype.history=null,n.prototype.ping=null,n.prototype.send=null,n.prototype.rpc=null,n.prototype.refresh=null,n.prototype.sub_refresh=null,n.encode=function(t,e){return e||(e=b.create()),t.id!=null&&Object.hasOwnProperty.call(t,"id")&&e.uint32(8).uint32(t.id),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&f.centrifugal.centrifuge.protocol.ConnectRequest.encode(t.connect,e.uint32(34).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&f.centrifugal.centrifuge.protocol.SubscribeRequest.encode(t.subscribe,e.uint32(42).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&f.centrifugal.centrifuge.protocol.UnsubscribeRequest.encode(t.unsubscribe,e.uint32(50).fork()).ldelim(),t.publish!=null&&Object.hasOwnProperty.call(t,"publish")&&f.centrifugal.centrifuge.protocol.PublishRequest.encode(t.publish,e.uint32(58).fork()).ldelim(),t.presence!=null&&Object.hasOwnProperty.call(t,"presence")&&f.centrifugal.centrifuge.protocol.PresenceRequest.encode(t.presence,e.uint32(66).fork()).ldelim(),t.presence_stats!=null&&Object.hasOwnProperty.call(t,"presence_stats")&&f.centrifugal.centrifuge.protocol.PresenceStatsRequest.encode(t.presence_stats,e.uint32(74).fork()).ldelim(),t.history!=null&&Object.hasOwnProperty.call(t,"history")&&f.centrifugal.centrifuge.protocol.HistoryRequest.encode(t.history,e.uint32(82).fork()).ldelim(),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&f.centrifugal.centrifuge.protocol.PingRequest.encode(t.ping,e.uint32(90).fork()).ldelim(),t.send!=null&&Object.hasOwnProperty.call(t,"send")&&f.centrifugal.centrifuge.protocol.SendRequest.encode(t.send,e.uint32(98).fork()).ldelim(),t.rpc!=null&&Object.hasOwnProperty.call(t,"rpc")&&f.centrifugal.centrifuge.protocol.RPCRequest.encode(t.rpc,e.uint32(106).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&f.centrifugal.centrifuge.protocol.RefreshRequest.encode(t.refresh,e.uint32(114).fork()).ldelim(),t.sub_refresh!=null&&Object.hasOwnProperty.call(t,"sub_refresh")&&f.centrifugal.centrifuge.protocol.SubRefreshRequest.encode(t.sub_refresh,e.uint32(122).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Command;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.id=t.uint32();break}case 4:{c.connect=f.centrifugal.centrifuge.protocol.ConnectRequest.decode(t,t.uint32());break}case 5:{c.subscribe=f.centrifugal.centrifuge.protocol.SubscribeRequest.decode(t,t.uint32());break}case 6:{c.unsubscribe=f.centrifugal.centrifuge.protocol.UnsubscribeRequest.decode(t,t.uint32());break}case 7:{c.publish=f.centrifugal.centrifuge.protocol.PublishRequest.decode(t,t.uint32());break}case 8:{c.presence=f.centrifugal.centrifuge.protocol.PresenceRequest.decode(t,t.uint32());break}case 9:{c.presence_stats=f.centrifugal.centrifuge.protocol.PresenceStatsRequest.decode(t,t.uint32());break}case 10:{c.history=f.centrifugal.centrifuge.protocol.HistoryRequest.decode(t,t.uint32());break}case 11:{c.ping=f.centrifugal.centrifuge.protocol.PingRequest.decode(t,t.uint32());break}case 12:{c.send=f.centrifugal.centrifuge.protocol.SendRequest.decode(t,t.uint32());break}case 13:{c.rpc=f.centrifugal.centrifuge.protocol.RPCRequest.decode(t,t.uint32());break}case 14:{c.refresh=f.centrifugal.centrifuge.protocol.RefreshRequest.decode(t,t.uint32());break}case 15:{c.sub_refresh=f.centrifugal.centrifuge.protocol.SubRefreshRequest.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.id!=null&&t.hasOwnProperty("id")&&!h.isInteger(t.id))return"id: integer expected";if(t.connect!=null&&t.hasOwnProperty("connect")){let e=f.centrifugal.centrifuge.protocol.ConnectRequest.verify(t.connect);if(e)return"connect."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=f.centrifugal.centrifuge.protocol.SubscribeRequest.verify(t.subscribe);if(e)return"subscribe."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=f.centrifugal.centrifuge.protocol.UnsubscribeRequest.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.publish!=null&&t.hasOwnProperty("publish")){let e=f.centrifugal.centrifuge.protocol.PublishRequest.verify(t.publish);if(e)return"publish."+e}if(t.presence!=null&&t.hasOwnProperty("presence")){let e=f.centrifugal.centrifuge.protocol.PresenceRequest.verify(t.presence);if(e)return"presence."+e}if(t.presence_stats!=null&&t.hasOwnProperty("presence_stats")){let e=f.centrifugal.centrifuge.protocol.PresenceStatsRequest.verify(t.presence_stats);if(e)return"presence_stats."+e}if(t.history!=null&&t.hasOwnProperty("history")){let e=f.centrifugal.centrifuge.protocol.HistoryRequest.verify(t.history);if(e)return"history."+e}if(t.ping!=null&&t.hasOwnProperty("ping")){let e=f.centrifugal.centrifuge.protocol.PingRequest.verify(t.ping);if(e)return"ping."+e}if(t.send!=null&&t.hasOwnProperty("send")){let e=f.centrifugal.centrifuge.protocol.SendRequest.verify(t.send);if(e)return"send."+e}if(t.rpc!=null&&t.hasOwnProperty("rpc")){let e=f.centrifugal.centrifuge.protocol.RPCRequest.verify(t.rpc);if(e)return"rpc."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=f.centrifugal.centrifuge.protocol.RefreshRequest.verify(t.refresh);if(e)return"refresh."+e}if(t.sub_refresh!=null&&t.hasOwnProperty("sub_refresh")){let e=f.centrifugal.centrifuge.protocol.SubRefreshRequest.verify(t.sub_refresh);if(e)return"sub_refresh."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Command"},n}(),i.Reply=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.id=0,n.prototype.error=null,n.prototype.push=null,n.prototype.connect=null,n.prototype.subscribe=null,n.prototype.unsubscribe=null,n.prototype.publish=null,n.prototype.presence=null,n.prototype.presence_stats=null,n.prototype.history=null,n.prototype.ping=null,n.prototype.rpc=null,n.prototype.refresh=null,n.prototype.sub_refresh=null,n.encode=function(t,e){return e||(e=b.create()),t.id!=null&&Object.hasOwnProperty.call(t,"id")&&e.uint32(8).uint32(t.id),t.error!=null&&Object.hasOwnProperty.call(t,"error")&&f.centrifugal.centrifuge.protocol.Error.encode(t.error,e.uint32(18).fork()).ldelim(),t.push!=null&&Object.hasOwnProperty.call(t,"push")&&f.centrifugal.centrifuge.protocol.Push.encode(t.push,e.uint32(34).fork()).ldelim(),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&f.centrifugal.centrifuge.protocol.ConnectResult.encode(t.connect,e.uint32(42).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&f.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subscribe,e.uint32(50).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&f.centrifugal.centrifuge.protocol.UnsubscribeResult.encode(t.unsubscribe,e.uint32(58).fork()).ldelim(),t.publish!=null&&Object.hasOwnProperty.call(t,"publish")&&f.centrifugal.centrifuge.protocol.PublishResult.encode(t.publish,e.uint32(66).fork()).ldelim(),t.presence!=null&&Object.hasOwnProperty.call(t,"presence")&&f.centrifugal.centrifuge.protocol.PresenceResult.encode(t.presence,e.uint32(74).fork()).ldelim(),t.presence_stats!=null&&Object.hasOwnProperty.call(t,"presence_stats")&&f.centrifugal.centrifuge.protocol.PresenceStatsResult.encode(t.presence_stats,e.uint32(82).fork()).ldelim(),t.history!=null&&Object.hasOwnProperty.call(t,"history")&&f.centrifugal.centrifuge.protocol.HistoryResult.encode(t.history,e.uint32(90).fork()).ldelim(),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&f.centrifugal.centrifuge.protocol.PingResult.encode(t.ping,e.uint32(98).fork()).ldelim(),t.rpc!=null&&Object.hasOwnProperty.call(t,"rpc")&&f.centrifugal.centrifuge.protocol.RPCResult.encode(t.rpc,e.uint32(106).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&f.centrifugal.centrifuge.protocol.RefreshResult.encode(t.refresh,e.uint32(114).fork()).ldelim(),t.sub_refresh!=null&&Object.hasOwnProperty.call(t,"sub_refresh")&&f.centrifugal.centrifuge.protocol.SubRefreshResult.encode(t.sub_refresh,e.uint32(122).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Reply;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.id=t.uint32();break}case 2:{c.error=f.centrifugal.centrifuge.protocol.Error.decode(t,t.uint32());break}case 4:{c.push=f.centrifugal.centrifuge.protocol.Push.decode(t,t.uint32());break}case 5:{c.connect=f.centrifugal.centrifuge.protocol.ConnectResult.decode(t,t.uint32());break}case 6:{c.subscribe=f.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break}case 7:{c.unsubscribe=f.centrifugal.centrifuge.protocol.UnsubscribeResult.decode(t,t.uint32());break}case 8:{c.publish=f.centrifugal.centrifuge.protocol.PublishResult.decode(t,t.uint32());break}case 9:{c.presence=f.centrifugal.centrifuge.protocol.PresenceResult.decode(t,t.uint32());break}case 10:{c.presence_stats=f.centrifugal.centrifuge.protocol.PresenceStatsResult.decode(t,t.uint32());break}case 11:{c.history=f.centrifugal.centrifuge.protocol.HistoryResult.decode(t,t.uint32());break}case 12:{c.ping=f.centrifugal.centrifuge.protocol.PingResult.decode(t,t.uint32());break}case 13:{c.rpc=f.centrifugal.centrifuge.protocol.RPCResult.decode(t,t.uint32());break}case 14:{c.refresh=f.centrifugal.centrifuge.protocol.RefreshResult.decode(t,t.uint32());break}case 15:{c.sub_refresh=f.centrifugal.centrifuge.protocol.SubRefreshResult.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.id!=null&&t.hasOwnProperty("id")&&!h.isInteger(t.id))return"id: integer expected";if(t.error!=null&&t.hasOwnProperty("error")){let e=f.centrifugal.centrifuge.protocol.Error.verify(t.error);if(e)return"error."+e}if(t.push!=null&&t.hasOwnProperty("push")){let e=f.centrifugal.centrifuge.protocol.Push.verify(t.push);if(e)return"push."+e}if(t.connect!=null&&t.hasOwnProperty("connect")){let e=f.centrifugal.centrifuge.protocol.ConnectResult.verify(t.connect);if(e)return"connect."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=f.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subscribe);if(e)return"subscribe."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=f.centrifugal.centrifuge.protocol.UnsubscribeResult.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.publish!=null&&t.hasOwnProperty("publish")){let e=f.centrifugal.centrifuge.protocol.PublishResult.verify(t.publish);if(e)return"publish."+e}if(t.presence!=null&&t.hasOwnProperty("presence")){let e=f.centrifugal.centrifuge.protocol.PresenceResult.verify(t.presence);if(e)return"presence."+e}if(t.presence_stats!=null&&t.hasOwnProperty("presence_stats")){let e=f.centrifugal.centrifuge.protocol.PresenceStatsResult.verify(t.presence_stats);if(e)return"presence_stats."+e}if(t.history!=null&&t.hasOwnProperty("history")){let e=f.centrifugal.centrifuge.protocol.HistoryResult.verify(t.history);if(e)return"history."+e}if(t.ping!=null&&t.hasOwnProperty("ping")){let e=f.centrifugal.centrifuge.protocol.PingResult.verify(t.ping);if(e)return"ping."+e}if(t.rpc!=null&&t.hasOwnProperty("rpc")){let e=f.centrifugal.centrifuge.protocol.RPCResult.verify(t.rpc);if(e)return"rpc."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=f.centrifugal.centrifuge.protocol.RefreshResult.verify(t.refresh);if(e)return"refresh."+e}if(t.sub_refresh!=null&&t.hasOwnProperty("sub_refresh")){let e=f.centrifugal.centrifuge.protocol.SubRefreshResult.verify(t.sub_refresh);if(e)return"sub_refresh."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Reply"},n}(),i.Push=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.pub=null,n.prototype.join=null,n.prototype.leave=null,n.prototype.unsubscribe=null,n.prototype.message=null,n.prototype.subscribe=null,n.prototype.connect=null,n.prototype.disconnect=null,n.prototype.refresh=null,n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(18).string(t.channel),t.pub!=null&&Object.hasOwnProperty.call(t,"pub")&&f.centrifugal.centrifuge.protocol.Publication.encode(t.pub,e.uint32(34).fork()).ldelim(),t.join!=null&&Object.hasOwnProperty.call(t,"join")&&f.centrifugal.centrifuge.protocol.Join.encode(t.join,e.uint32(42).fork()).ldelim(),t.leave!=null&&Object.hasOwnProperty.call(t,"leave")&&f.centrifugal.centrifuge.protocol.Leave.encode(t.leave,e.uint32(50).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&f.centrifugal.centrifuge.protocol.Unsubscribe.encode(t.unsubscribe,e.uint32(58).fork()).ldelim(),t.message!=null&&Object.hasOwnProperty.call(t,"message")&&f.centrifugal.centrifuge.protocol.Message.encode(t.message,e.uint32(66).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&f.centrifugal.centrifuge.protocol.Subscribe.encode(t.subscribe,e.uint32(74).fork()).ldelim(),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&f.centrifugal.centrifuge.protocol.Connect.encode(t.connect,e.uint32(82).fork()).ldelim(),t.disconnect!=null&&Object.hasOwnProperty.call(t,"disconnect")&&f.centrifugal.centrifuge.protocol.Disconnect.encode(t.disconnect,e.uint32(90).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&f.centrifugal.centrifuge.protocol.Refresh.encode(t.refresh,e.uint32(98).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Push;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 2:{c.channel=t.string();break}case 4:{c.pub=f.centrifugal.centrifuge.protocol.Publication.decode(t,t.uint32());break}case 5:{c.join=f.centrifugal.centrifuge.protocol.Join.decode(t,t.uint32());break}case 6:{c.leave=f.centrifugal.centrifuge.protocol.Leave.decode(t,t.uint32());break}case 7:{c.unsubscribe=f.centrifugal.centrifuge.protocol.Unsubscribe.decode(t,t.uint32());break}case 8:{c.message=f.centrifugal.centrifuge.protocol.Message.decode(t,t.uint32());break}case 9:{c.subscribe=f.centrifugal.centrifuge.protocol.Subscribe.decode(t,t.uint32());break}case 10:{c.connect=f.centrifugal.centrifuge.protocol.Connect.decode(t,t.uint32());break}case 11:{c.disconnect=f.centrifugal.centrifuge.protocol.Disconnect.decode(t,t.uint32());break}case 12:{c.refresh=f.centrifugal.centrifuge.protocol.Refresh.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel))return"channel: string expected";if(t.pub!=null&&t.hasOwnProperty("pub")){let e=f.centrifugal.centrifuge.protocol.Publication.verify(t.pub);if(e)return"pub."+e}if(t.join!=null&&t.hasOwnProperty("join")){let e=f.centrifugal.centrifuge.protocol.Join.verify(t.join);if(e)return"join."+e}if(t.leave!=null&&t.hasOwnProperty("leave")){let e=f.centrifugal.centrifuge.protocol.Leave.verify(t.leave);if(e)return"leave."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=f.centrifugal.centrifuge.protocol.Unsubscribe.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.message!=null&&t.hasOwnProperty("message")){let e=f.centrifugal.centrifuge.protocol.Message.verify(t.message);if(e)return"message."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=f.centrifugal.centrifuge.protocol.Subscribe.verify(t.subscribe);if(e)return"subscribe."+e}if(t.connect!=null&&t.hasOwnProperty("connect")){let e=f.centrifugal.centrifuge.protocol.Connect.verify(t.connect);if(e)return"connect."+e}if(t.disconnect!=null&&t.hasOwnProperty("disconnect")){let e=f.centrifugal.centrifuge.protocol.Disconnect.verify(t.disconnect);if(e)return"disconnect."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=f.centrifugal.centrifuge.protocol.Refresh.verify(t.refresh);if(e)return"refresh."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Push"},n}(),i.ClientInfo=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.user="",n.prototype.client="",n.prototype.conn_info=h.newBuffer([]),n.prototype.chan_info=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.user!=null&&Object.hasOwnProperty.call(t,"user")&&e.uint32(10).string(t.user),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(18).string(t.client),t.conn_info!=null&&Object.hasOwnProperty.call(t,"conn_info")&&e.uint32(26).bytes(t.conn_info),t.chan_info!=null&&Object.hasOwnProperty.call(t,"chan_info")&&e.uint32(34).bytes(t.chan_info),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.ClientInfo;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.user=t.string();break}case 2:{c.client=t.string();break}case 3:{c.conn_info=t.bytes();break}case 4:{c.chan_info=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.user!=null&&t.hasOwnProperty("user")&&!h.isString(t.user)?"user: string expected":t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client)?"client: string expected":t.conn_info!=null&&t.hasOwnProperty("conn_info")&&!(t.conn_info&&typeof t.conn_info.length=="number"||h.isString(t.conn_info))?"conn_info: buffer expected":t.chan_info!=null&&t.hasOwnProperty("chan_info")&&!(t.chan_info&&typeof t.chan_info.length=="number"||h.isString(t.chan_info))?"chan_info: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.ClientInfo"},n}(),i.Publication=function(){function n(o){if(this.tags={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.prototype.info=null,n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.tags=h.emptyObject,n.prototype.delta=!1,n.prototype.time=h.Long?h.Long.fromBits(0,0,!1):0,n.prototype.channel="",n.encode=function(t,e){if(e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(34).bytes(t.data),t.info!=null&&Object.hasOwnProperty.call(t,"info")&&f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.info,e.uint32(42).fork()).ldelim(),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(48).uint64(t.offset),t.tags!=null&&Object.hasOwnProperty.call(t,"tags"))for(let l=Object.keys(t.tags),c=0;c<l.length;++c)e.uint32(58).fork().uint32(10).string(l[c]).uint32(18).string(t.tags[l[c]]).ldelim();return t.delta!=null&&Object.hasOwnProperty.call(t,"delta")&&e.uint32(64).bool(t.delta),t.time!=null&&Object.hasOwnProperty.call(t,"time")&&e.uint32(72).int64(t.time),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(82).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Publication,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 4:{c.data=t.bytes();break}case 5:{c.info=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}case 6:{c.offset=t.uint64();break}case 7:{c.tags===h.emptyObject&&(c.tags={});let O=t.uint32()+t.pos;for(u="",p="";t.pos<O;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=t.string();break;default:t.skipType(g&7);break}}c.tags[u]=p;break}case 8:{c.delta=t.bool();break}case 9:{c.time=t.int64();break}case 10:{c.channel=t.string();break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.info!=null&&t.hasOwnProperty("info")){let e=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.info);if(e)return"info."+e}if(t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high)))return"offset: integer|Long expected";if(t.tags!=null&&t.hasOwnProperty("tags")){if(!h.isObject(t.tags))return"tags: object expected";let e=Object.keys(t.tags);for(let l=0;l<e.length;++l)if(!h.isString(t.tags[e[l]]))return"tags: string{k:string} expected"}return t.delta!=null&&t.hasOwnProperty("delta")&&typeof t.delta!="boolean"?"delta: boolean expected":t.time!=null&&t.hasOwnProperty("time")&&!h.isInteger(t.time)&&!(t.time&&h.isInteger(t.time.low)&&h.isInteger(t.time.high))?"time: integer|Long expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Publication"},n}(),i.Join=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.info=null,n.encode=function(t,e){return e||(e=b.create()),t.info!=null&&Object.hasOwnProperty.call(t,"info")&&f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.info,e.uint32(10).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Join;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.info=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.info!=null&&t.hasOwnProperty("info")){let e=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.info);if(e)return"info."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Join"},n}(),i.Leave=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.info=null,n.encode=function(t,e){return e||(e=b.create()),t.info!=null&&Object.hasOwnProperty.call(t,"info")&&f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.info,e.uint32(10).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Leave;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.info=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.info!=null&&t.hasOwnProperty("info")){let e=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.info);if(e)return"info."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Leave"},n}(),i.Unsubscribe=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.code=0,n.prototype.reason="",n.encode=function(t,e){return e||(e=b.create()),t.code!=null&&Object.hasOwnProperty.call(t,"code")&&e.uint32(16).uint32(t.code),t.reason!=null&&Object.hasOwnProperty.call(t,"reason")&&e.uint32(26).string(t.reason),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Unsubscribe;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 2:{c.code=t.uint32();break}case 3:{c.reason=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!h.isInteger(t.code)?"code: integer expected":t.reason!=null&&t.hasOwnProperty("reason")&&!h.isString(t.reason)?"reason: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Unsubscribe"},n}(),i.Subscribe=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.recoverable=!1,n.prototype.epoch="",n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.positioned=!1,n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.recoverable!=null&&Object.hasOwnProperty.call(t,"recoverable")&&e.uint32(8).bool(t.recoverable),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(34).string(t.epoch),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(40).uint64(t.offset),t.positioned!=null&&Object.hasOwnProperty.call(t,"positioned")&&e.uint32(48).bool(t.positioned),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(58).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Subscribe;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.recoverable=t.bool();break}case 4:{c.epoch=t.string();break}case 5:{c.offset=t.uint64();break}case 6:{c.positioned=t.bool();break}case 7:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.recoverable!=null&&t.hasOwnProperty("recoverable")&&typeof t.recoverable!="boolean"?"recoverable: boolean expected":t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.positioned!=null&&t.hasOwnProperty("positioned")&&typeof t.positioned!="boolean"?"positioned: boolean expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Subscribe"},n}(),i.Message=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Message;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Message"},n}(),i.Connect=function(){function n(o){if(this.subs={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.client="",n.prototype.version="",n.prototype.data=h.newBuffer([]),n.prototype.subs=h.emptyObject,n.prototype.expires=!1,n.prototype.ttl=0,n.prototype.ping=0,n.prototype.pong=!1,n.prototype.session="",n.prototype.node="",n.prototype.time=h.Long?h.Long.fromBits(0,0,!1):0,n.encode=function(t,e){if(e||(e=b.create()),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(10).string(t.client),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(18).string(t.version),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(26).bytes(t.data),t.subs!=null&&Object.hasOwnProperty.call(t,"subs"))for(let l=Object.keys(t.subs),c=0;c<l.length;++c)e.uint32(34).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subs[l[c]],e.uint32(18).fork()).ldelim().ldelim();return t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(40).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(48).uint32(t.ttl),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&e.uint32(56).uint32(t.ping),t.pong!=null&&Object.hasOwnProperty.call(t,"pong")&&e.uint32(64).bool(t.pong),t.session!=null&&Object.hasOwnProperty.call(t,"session")&&e.uint32(74).string(t.session),t.node!=null&&Object.hasOwnProperty.call(t,"node")&&e.uint32(82).string(t.node),t.time!=null&&Object.hasOwnProperty.call(t,"time")&&e.uint32(88).int64(t.time),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Connect,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.client=t.string();break}case 2:{c.version=t.string();break}case 3:{c.data=t.bytes();break}case 4:{c.subs===h.emptyObject&&(c.subs={});let O=t.uint32()+t.pos;for(u="",p=null;t.pos<O;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[u]=p;break}case 5:{c.expires=t.bool();break}case 6:{c.ttl=t.uint32();break}case 7:{c.ping=t.uint32();break}case 8:{c.pong=t.bool();break}case 9:{c.session=t.string();break}case 10:{c.node=t.string();break}case 11:{c.time=t.int64();break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client))return"client: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version))return"version: string expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!h.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subs[e[l]]);if(c)return"subs."+c}}return t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":t.ping!=null&&t.hasOwnProperty("ping")&&!h.isInteger(t.ping)?"ping: integer expected":t.pong!=null&&t.hasOwnProperty("pong")&&typeof t.pong!="boolean"?"pong: boolean expected":t.session!=null&&t.hasOwnProperty("session")&&!h.isString(t.session)?"session: string expected":t.node!=null&&t.hasOwnProperty("node")&&!h.isString(t.node)?"node: string expected":t.time!=null&&t.hasOwnProperty("time")&&!h.isInteger(t.time)&&!(t.time&&h.isInteger(t.time.low)&&h.isInteger(t.time.high))?"time: integer|Long expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Connect"},n}(),i.Disconnect=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.code=0,n.prototype.reason="",n.prototype.reconnect=!1,n.encode=function(t,e){return e||(e=b.create()),t.code!=null&&Object.hasOwnProperty.call(t,"code")&&e.uint32(8).uint32(t.code),t.reason!=null&&Object.hasOwnProperty.call(t,"reason")&&e.uint32(18).string(t.reason),t.reconnect!=null&&Object.hasOwnProperty.call(t,"reconnect")&&e.uint32(24).bool(t.reconnect),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Disconnect;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.code=t.uint32();break}case 2:{c.reason=t.string();break}case 3:{c.reconnect=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!h.isInteger(t.code)?"code: integer expected":t.reason!=null&&t.hasOwnProperty("reason")&&!h.isString(t.reason)?"reason: string expected":t.reconnect!=null&&t.hasOwnProperty("reconnect")&&typeof t.reconnect!="boolean"?"reconnect: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Disconnect"},n}(),i.Refresh=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.expires=!1,n.prototype.ttl=0,n.encode=function(t,e){return e||(e=b.create()),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(8).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(16).uint32(t.ttl),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Refresh;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Refresh"},n}(),i.ConnectRequest=function(){function n(o){if(this.subs={},this.headers={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.token="",n.prototype.data=h.newBuffer([]),n.prototype.subs=h.emptyObject,n.prototype.name="",n.prototype.version="",n.prototype.headers=h.emptyObject,n.encode=function(t,e){if(e||(e=b.create()),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(10).string(t.token),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(18).bytes(t.data),t.subs!=null&&Object.hasOwnProperty.call(t,"subs"))for(let l=Object.keys(t.subs),c=0;c<l.length;++c)e.uint32(26).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.SubscribeRequest.encode(t.subs[l[c]],e.uint32(18).fork()).ldelim().ldelim();if(t.name!=null&&Object.hasOwnProperty.call(t,"name")&&e.uint32(34).string(t.name),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(42).string(t.version),t.headers!=null&&Object.hasOwnProperty.call(t,"headers"))for(let l=Object.keys(t.headers),c=0;c<l.length;++c)e.uint32(50).fork().uint32(10).string(l[c]).uint32(18).string(t.headers[l[c]]).ldelim();return e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.ConnectRequest,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.token=t.string();break}case 2:{c.data=t.bytes();break}case 3:{c.subs===h.emptyObject&&(c.subs={});let O=t.uint32()+t.pos;for(u="",p=null;t.pos<O;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.SubscribeRequest.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[u]=p;break}case 4:{c.name=t.string();break}case 5:{c.version=t.string();break}case 6:{c.headers===h.emptyObject&&(c.headers={});let O=t.uint32()+t.pos;for(u="",p="";t.pos<O;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=t.string();break;default:t.skipType(g&7);break}}c.headers[u]=p;break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token))return"token: string expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!h.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.SubscribeRequest.verify(t.subs[e[l]]);if(c)return"subs."+c}}if(t.name!=null&&t.hasOwnProperty("name")&&!h.isString(t.name))return"name: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version))return"version: string expected";if(t.headers!=null&&t.hasOwnProperty("headers")){if(!h.isObject(t.headers))return"headers: object expected";let e=Object.keys(t.headers);for(let l=0;l<e.length;++l)if(!h.isString(t.headers[e[l]]))return"headers: string{k:string} expected"}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.ConnectRequest"},n}(),i.ConnectResult=function(){function n(o){if(this.subs={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.client="",n.prototype.version="",n.prototype.expires=!1,n.prototype.ttl=0,n.prototype.data=h.newBuffer([]),n.prototype.subs=h.emptyObject,n.prototype.ping=0,n.prototype.pong=!1,n.prototype.session="",n.prototype.node="",n.prototype.time=h.Long?h.Long.fromBits(0,0,!1):0,n.encode=function(t,e){if(e||(e=b.create()),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(10).string(t.client),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(18).string(t.version),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(24).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(32).uint32(t.ttl),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(42).bytes(t.data),t.subs!=null&&Object.hasOwnProperty.call(t,"subs"))for(let l=Object.keys(t.subs),c=0;c<l.length;++c)e.uint32(50).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subs[l[c]],e.uint32(18).fork()).ldelim().ldelim();return t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&e.uint32(56).uint32(t.ping),t.pong!=null&&Object.hasOwnProperty.call(t,"pong")&&e.uint32(64).bool(t.pong),t.session!=null&&Object.hasOwnProperty.call(t,"session")&&e.uint32(74).string(t.session),t.node!=null&&Object.hasOwnProperty.call(t,"node")&&e.uint32(82).string(t.node),t.time!=null&&Object.hasOwnProperty.call(t,"time")&&e.uint32(88).int64(t.time),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.ConnectResult,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.client=t.string();break}case 2:{c.version=t.string();break}case 3:{c.expires=t.bool();break}case 4:{c.ttl=t.uint32();break}case 5:{c.data=t.bytes();break}case 6:{c.subs===h.emptyObject&&(c.subs={});let O=t.uint32()+t.pos;for(u="",p=null;t.pos<O;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[u]=p;break}case 7:{c.ping=t.uint32();break}case 8:{c.pong=t.bool();break}case 9:{c.session=t.string();break}case 10:{c.node=t.string();break}case 11:{c.time=t.int64();break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client))return"client: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version))return"version: string expected";if(t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean")return"expires: boolean expected";if(t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl))return"ttl: integer expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!h.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subs[e[l]]);if(c)return"subs."+c}}return t.ping!=null&&t.hasOwnProperty("ping")&&!h.isInteger(t.ping)?"ping: integer expected":t.pong!=null&&t.hasOwnProperty("pong")&&typeof t.pong!="boolean"?"pong: boolean expected":t.session!=null&&t.hasOwnProperty("session")&&!h.isString(t.session)?"session: string expected":t.node!=null&&t.hasOwnProperty("node")&&!h.isString(t.node)?"node: string expected":t.time!=null&&t.hasOwnProperty("time")&&!h.isInteger(t.time)&&!(t.time&&h.isInteger(t.time.low)&&h.isInteger(t.time.high))?"time: integer|Long expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.ConnectResult"},n}(),i.RefreshRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.token="",n.encode=function(t,e){return e||(e=b.create()),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(10).string(t.token),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RefreshRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.token=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token)?"token: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RefreshRequest"},n}(),i.RefreshResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.client="",n.prototype.version="",n.prototype.expires=!1,n.prototype.ttl=0,n.encode=function(t,e){return e||(e=b.create()),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(10).string(t.client),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(18).string(t.version),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(24).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(32).uint32(t.ttl),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RefreshResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.client=t.string();break}case 2:{c.version=t.string();break}case 3:{c.expires=t.bool();break}case 4:{c.ttl=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client)?"client: string expected":t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version)?"version: string expected":t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RefreshResult"},n}(),i.SubscribeRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.token="",n.prototype.recover=!1,n.prototype.epoch="",n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.data=h.newBuffer([]),n.prototype.positioned=!1,n.prototype.recoverable=!1,n.prototype.join_leave=!1,n.prototype.delta="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(18).string(t.token),t.recover!=null&&Object.hasOwnProperty.call(t,"recover")&&e.uint32(24).bool(t.recover),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(50).string(t.epoch),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(56).uint64(t.offset),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(66).bytes(t.data),t.positioned!=null&&Object.hasOwnProperty.call(t,"positioned")&&e.uint32(72).bool(t.positioned),t.recoverable!=null&&Object.hasOwnProperty.call(t,"recoverable")&&e.uint32(80).bool(t.recoverable),t.join_leave!=null&&Object.hasOwnProperty.call(t,"join_leave")&&e.uint32(88).bool(t.join_leave),t.delta!=null&&Object.hasOwnProperty.call(t,"delta")&&e.uint32(98).string(t.delta),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubscribeRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 2:{c.token=t.string();break}case 3:{c.recover=t.bool();break}case 6:{c.epoch=t.string();break}case 7:{c.offset=t.uint64();break}case 8:{c.data=t.bytes();break}case 9:{c.positioned=t.bool();break}case 10:{c.recoverable=t.bool();break}case 11:{c.join_leave=t.bool();break}case 12:{c.delta=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token)?"token: string expected":t.recover!=null&&t.hasOwnProperty("recover")&&typeof t.recover!="boolean"?"recover: boolean expected":t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":t.positioned!=null&&t.hasOwnProperty("positioned")&&typeof t.positioned!="boolean"?"positioned: boolean expected":t.recoverable!=null&&t.hasOwnProperty("recoverable")&&typeof t.recoverable!="boolean"?"recoverable: boolean expected":t.join_leave!=null&&t.hasOwnProperty("join_leave")&&typeof t.join_leave!="boolean"?"join_leave: boolean expected":t.delta!=null&&t.hasOwnProperty("delta")&&!h.isString(t.delta)?"delta: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubscribeRequest"},n}(),i.SubscribeResult=function(){function n(o){if(this.publications=[],o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.expires=!1,n.prototype.ttl=0,n.prototype.recoverable=!1,n.prototype.epoch="",n.prototype.publications=h.emptyArray,n.prototype.recovered=!1,n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.positioned=!1,n.prototype.data=h.newBuffer([]),n.prototype.was_recovering=!1,n.prototype.delta=!1,n.encode=function(t,e){if(e||(e=b.create()),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(8).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(16).uint32(t.ttl),t.recoverable!=null&&Object.hasOwnProperty.call(t,"recoverable")&&e.uint32(24).bool(t.recoverable),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(50).string(t.epoch),t.publications!=null&&t.publications.length)for(let l=0;l<t.publications.length;++l)f.centrifugal.centrifuge.protocol.Publication.encode(t.publications[l],e.uint32(58).fork()).ldelim();return t.recovered!=null&&Object.hasOwnProperty.call(t,"recovered")&&e.uint32(64).bool(t.recovered),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(72).uint64(t.offset),t.positioned!=null&&Object.hasOwnProperty.call(t,"positioned")&&e.uint32(80).bool(t.positioned),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(90).bytes(t.data),t.was_recovering!=null&&Object.hasOwnProperty.call(t,"was_recovering")&&e.uint32(96).bool(t.was_recovering),t.delta!=null&&Object.hasOwnProperty.call(t,"delta")&&e.uint32(104).bool(t.delta),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubscribeResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}case 3:{c.recoverable=t.bool();break}case 6:{c.epoch=t.string();break}case 7:{c.publications&&c.publications.length||(c.publications=[]),c.publications.push(f.centrifugal.centrifuge.protocol.Publication.decode(t,t.uint32()));break}case 8:{c.recovered=t.bool();break}case 9:{c.offset=t.uint64();break}case 10:{c.positioned=t.bool();break}case 11:{c.data=t.bytes();break}case 12:{c.was_recovering=t.bool();break}case 13:{c.delta=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean")return"expires: boolean expected";if(t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl))return"ttl: integer expected";if(t.recoverable!=null&&t.hasOwnProperty("recoverable")&&typeof t.recoverable!="boolean")return"recoverable: boolean expected";if(t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch))return"epoch: string expected";if(t.publications!=null&&t.hasOwnProperty("publications")){if(!Array.isArray(t.publications))return"publications: array expected";for(let e=0;e<t.publications.length;++e){let l=f.centrifugal.centrifuge.protocol.Publication.verify(t.publications[e]);if(l)return"publications."+l}}return t.recovered!=null&&t.hasOwnProperty("recovered")&&typeof t.recovered!="boolean"?"recovered: boolean expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.positioned!=null&&t.hasOwnProperty("positioned")&&typeof t.positioned!="boolean"?"positioned: boolean expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":t.was_recovering!=null&&t.hasOwnProperty("was_recovering")&&typeof t.was_recovering!="boolean"?"was_recovering: boolean expected":t.delta!=null&&t.hasOwnProperty("delta")&&typeof t.delta!="boolean"?"delta: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubscribeResult"},n}(),i.SubRefreshRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.token="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(18).string(t.token),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubRefreshRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 2:{c.token=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token)?"token: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubRefreshRequest"},n}(),i.SubRefreshResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.expires=!1,n.prototype.ttl=0,n.encode=function(t,e){return e||(e=b.create()),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(8).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(16).uint32(t.ttl),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubRefreshResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubRefreshResult"},n}(),i.UnsubscribeRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.UnsubscribeRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.UnsubscribeRequest"},n}(),i.UnsubscribeResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.UnsubscribeResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.UnsubscribeResult"},n}(),i.PublishRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(18).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PublishRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 2:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PublishRequest"},n}(),i.PublishResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PublishResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PublishResult"},n}(),i.PresenceRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceRequest"},n}(),i.PresenceResult=function(){function n(o){if(this.presence={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.presence=h.emptyObject,n.encode=function(t,e){if(e||(e=b.create()),t.presence!=null&&Object.hasOwnProperty.call(t,"presence"))for(let l=Object.keys(t.presence),c=0;c<l.length;++c)e.uint32(10).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.presence[l[c]],e.uint32(18).fork()).ldelim().ldelim();return e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceResult,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.presence===h.emptyObject&&(c.presence={});let O=t.uint32()+t.pos;for(u="",p=null;t.pos<O;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.presence[u]=p;break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.presence!=null&&t.hasOwnProperty("presence")){if(!h.isObject(t.presence))return"presence: object expected";let e=Object.keys(t.presence);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.presence[e[l]]);if(c)return"presence."+c}}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceResult"},n}(),i.PresenceStatsRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceStatsRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceStatsRequest"},n}(),i.PresenceStatsResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.num_clients=0,n.prototype.num_users=0,n.encode=function(t,e){return e||(e=b.create()),t.num_clients!=null&&Object.hasOwnProperty.call(t,"num_clients")&&e.uint32(8).uint32(t.num_clients),t.num_users!=null&&Object.hasOwnProperty.call(t,"num_users")&&e.uint32(16).uint32(t.num_users),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceStatsResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.num_clients=t.uint32();break}case 2:{c.num_users=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.num_clients!=null&&t.hasOwnProperty("num_clients")&&!h.isInteger(t.num_clients)?"num_clients: integer expected":t.num_users!=null&&t.hasOwnProperty("num_users")&&!h.isInteger(t.num_users)?"num_users: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceStatsResult"},n}(),i.StreamPosition=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.epoch="",n.encode=function(t,e){return e||(e=b.create()),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(8).uint64(t.offset),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(18).string(t.epoch),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.StreamPosition;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.offset=t.uint64();break}case 2:{c.epoch=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.StreamPosition"},n}(),i.HistoryRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.limit=0,n.prototype.since=null,n.prototype.reverse=!1,n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.limit!=null&&Object.hasOwnProperty.call(t,"limit")&&e.uint32(56).int32(t.limit),t.since!=null&&Object.hasOwnProperty.call(t,"since")&&f.centrifugal.centrifuge.protocol.StreamPosition.encode(t.since,e.uint32(66).fork()).ldelim(),t.reverse!=null&&Object.hasOwnProperty.call(t,"reverse")&&e.uint32(72).bool(t.reverse),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.HistoryRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 7:{c.limit=t.int32();break}case 8:{c.since=f.centrifugal.centrifuge.protocol.StreamPosition.decode(t,t.uint32());break}case 9:{c.reverse=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel))return"channel: string expected";if(t.limit!=null&&t.hasOwnProperty("limit")&&!h.isInteger(t.limit))return"limit: integer expected";if(t.since!=null&&t.hasOwnProperty("since")){let e=f.centrifugal.centrifuge.protocol.StreamPosition.verify(t.since);if(e)return"since."+e}return t.reverse!=null&&t.hasOwnProperty("reverse")&&typeof t.reverse!="boolean"?"reverse: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.HistoryRequest"},n}(),i.HistoryResult=function(){function n(o){if(this.publications=[],o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.publications=h.emptyArray,n.prototype.epoch="",n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.encode=function(t,e){if(e||(e=b.create()),t.publications!=null&&t.publications.length)for(let l=0;l<t.publications.length;++l)f.centrifugal.centrifuge.protocol.Publication.encode(t.publications[l],e.uint32(10).fork()).ldelim();return t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(18).string(t.epoch),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(24).uint64(t.offset),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.HistoryResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.publications&&c.publications.length||(c.publications=[]),c.publications.push(f.centrifugal.centrifuge.protocol.Publication.decode(t,t.uint32()));break}case 2:{c.epoch=t.string();break}case 3:{c.offset=t.uint64();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.publications!=null&&t.hasOwnProperty("publications")){if(!Array.isArray(t.publications))return"publications: array expected";for(let e=0;e<t.publications.length;++e){let l=f.centrifugal.centrifuge.protocol.Publication.verify(t.publications[e]);if(l)return"publications."+l}}return t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.HistoryResult"},n}(),i.PingRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PingRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PingRequest"},n}(),i.PingResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PingResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PingResult"},n}(),i.RPCRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.prototype.method="",n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),t.method!=null&&Object.hasOwnProperty.call(t,"method")&&e.uint32(18).string(t.method),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RPCRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}case 2:{c.method=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":t.method!=null&&t.hasOwnProperty("method")&&!h.isString(t.method)?"method: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RPCRequest"},n}(),i.RPCResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RPCResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RPCResult"},n}(),i.SendRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SendRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SendRequest"},n}(),i}(),r}(),s})();var Ke=pt.centrifuge.protocol.Command,At=pt.centrifuge.protocol.Reply,mn=pt.centrifuge.protocol.EmulationRequest,dt=class{name(){return"protobuf"}encodeEmulationRequest(r){let i=z.Writer.create();return mn.encode(r,i),i.finish()}encodeCommands(r){let i=z.Writer.create();for(let n of r)i.fork(),Ke.encodeDelimited(n,i);return i.finish()}encodeReplies(r){let i=z.Writer.create();for(let n of r)i.fork(),At.encodeDelimited(n,i);return i.finish()}decodeReplies(r){let i=[],n=z.Reader.create(new Uint8Array(r));for(;n.pos<n.len;){let o=At.decodeDelimited(n);i.push(o)}return i}decodeCommands(r){let i=[],n=z.Reader.create(new Uint8Array(r));for(;n.pos<n.len;){let o=Ke.decodeDelimited(n);i.push(o)}return i}decodeReply(r){let i=z.Reader.create(new Uint8Array(r));for(;i.pos<i.len;)return At.decodeDelimited(i),{ok:!0,pos:i.pos};return{ok:!1}}applyDeltaIfNeeded(r,i){let n,o;if(r.delta){let t=lt(i,r.data);n=new Uint8Array(t),o=t}else n=r.data,o=r.data;return{newData:n,newPrevValue:o}}};var bt=class extends N{_formatOverride(){this._codec=new dt}};globalThis.Centrifuge=bt;})();
|
|
7
|
+
`).map(i=>JSON.parse(i))}applyDeltaIfNeeded(r,i){let n,o;if(r.delta){let t=lt(i,new TextEncoder().encode(r.data));n=JSON.parse(new TextDecoder().decode(t)),o=t}else n=JSON.parse(r.data),o=new TextEncoder().encode(r.data);return{newData:n,newPrevValue:o}}};var Qt=Q(gt()),bn={headers:{},httpHeaders:{},token:"",getToken:null,data:null,getData:null,debug:!1,name:"js",version:"",fetch:null,readableStream:null,websocket:null,eventsource:null,sockjs:null,sockjsOptions:{},emulationEndpoint:"/emulation",minReconnectDelay:500,maxReconnectDelay:2e4,timeout:5e3,maxServerPingDelay:1e4,networkEventTarget:null},T=class extends Error{constructor(r){super(r),this.name=this.constructor.name}},N=class extends Qt.default{constructor(i,n){super();this._reconnectTimeout=null;this._refreshTimeout=null;this._serverPingTimeout=null;this.state="disconnected",this._transportIsOpen=!1,this._endpoint=i,this._emulation=!1,this._transports=[],this._currentTransportIndex=0,this._triedAllTransports=!1,this._transportWasOpen=!1,this._transport=null,this._transportId=0,this._deviceWentOffline=!1,this._transportClosed=!0,this._codec=new G,this._reconnecting=!1,this._reconnectTimeout=null,this._reconnectAttempts=0,this._client=null,this._session="",this._node="",this._subs={},this._serverSubs={},this._commandId=0,this._commands=[],this._batching=!1,this._refreshRequired=!1,this._refreshTimeout=null,this._callbacks={},this._token="",this._data=null,this._dispatchPromise=Promise.resolve(),this._serverPing=0,this._serverPingTimeout=null,this._sendPong=!1,this._promises={},this._promiseId=0,this._debugEnabled=!1,this._networkEventsSet=!1,this._config={...bn,...n},this._configure(),this._debugEnabled?(this.on("state",o=>{this._debug("client state",o.oldState,"->",o.newState)}),this.on("error",o=>{this._debug("client error",o)})):this.on("error",function(){Function.prototype()})}newSubscription(i,n){if(this.getSubscription(i)!==null)throw new Error("Subscription to the channel "+i+" already exists");let o=new it(this,i,n);return this._subs[i]=o,o}getSubscription(i){return this._getSub(i)}removeSubscription(i){i&&(i.state!=="unsubscribed"&&i.unsubscribe(),this._removeSubscription(i))}subscriptions(){return this._subs}ready(i){switch(this.state){case"disconnected":return Promise.reject({code:3,message:"client disconnected"});case"connected":return Promise.resolve();default:return new Promise((n,o)=>{let t={resolve:n,reject:o};i&&(t.timeout=setTimeout(()=>{o({code:1,message:"timeout"})},i)),this._promises[this._nextPromiseId()]=t})}}connect(){if(this._isConnected()){this._debug("connect called when already connected");return}if(this._isConnecting()){this._debug("connect called when already connecting");return}this._debug("connect called"),this._reconnectAttempts=0,this._startConnecting()}disconnect(){this._disconnect(0,"disconnect called",!1)}setToken(i){this._token=i}setHeaders(i){this._config.headers=i}setHttpHeaders(i){this._config.httpHeaders=i}setWebsocket(i){this._config.websocket=i}async send(i){let n={send:{data:i}};if(await this._methodCall(),!this._transportSendCommands([n]))throw this._createErrorObject(10,"transport write error")}async rpc(i,n){let o={rpc:{method:i,data:n}};return await this._methodCall(),{data:(await this._callPromise(o,e=>e.rpc)).data}}async publish(i,n){let o={publish:{channel:i,data:n}};return await this._methodCall(),await this._callPromise(o,()=>({})),{}}async history(i,n){let o={history:this._getHistoryRequest(i,n)};await this._methodCall();let t=await this._callPromise(o,l=>l.history),e=[];if(t.publications)for(let l=0;l<t.publications.length;l++)e.push(this._getPublicationContext(i,t.publications[l]));return{publications:e,epoch:t.epoch||"",offset:t.offset||0}}async presence(i){let n={presence:{channel:i}};await this._methodCall();let t=(await this._callPromise(n,e=>e.presence)).presence;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let l=t[e],c=l.conn_info,u=l.chan_info;c&&(l.connInfo=c),u&&(l.chanInfo=u)}return{clients:t}}async presenceStats(i){let n={presence_stats:{channel:i}};await this._methodCall();let o=await this._callPromise(n,t=>t.presence_stats);return{numUsers:o.num_users,numClients:o.num_clients}}startBatching(){this._batching=!0}stopBatching(){let i=this;Promise.resolve().then(function(){Promise.resolve().then(function(){i._batching=!1,i._flush()})})}_debug(...i){this._debugEnabled&&Kt("debug",i)}_codecName(){return this._codec.name()}_formatOverride(){}_configure(){if(!("Promise"in globalThis))throw new Error("Promise polyfill required");if(!this._endpoint)throw new Error("endpoint configuration required");if(this._config.token!==null&&(this._token=this._config.token),this._config.data!==null&&(this._data=this._config.data),this._codec=new G,this._formatOverride(),(this._config.debug===!0||typeof localStorage<"u"&&localStorage.getItem("centrifuge.debug"))&&(this._debugEnabled=!0),this._debug("config",this._config),typeof this._endpoint!="string")if(typeof this._endpoint=="object"&&this._endpoint instanceof Array){this._transports=this._endpoint,this._emulation=!0;for(let i in this._transports)if(this._transports.hasOwnProperty(i)){let n=this._transports[i];if(!n.endpoint||!n.transport)throw new Error("malformed transport configuration");let o=n.transport;if(["websocket","http_stream","sse","sockjs","webtransport"].indexOf(o)<0)throw new Error("unsupported transport name: "+o)}}else throw new Error("unsupported url configuration type: only string or array of objects are supported")}_setState(i){if(this.state!==i){this._reconnecting=!1;let n=this.state;return this.state=i,this.emit("state",{newState:i,oldState:n}),!0}return!1}_isDisconnected(){return this.state==="disconnected"}_isConnecting(){return this.state==="connecting"}_isConnected(){return this.state==="connected"}_nextCommandId(){return++this._commandId}_setNetworkEvents(){if(this._networkEventsSet)return;let i=null;this._config.networkEventTarget!==null?i=this._config.networkEventTarget:typeof globalThis.addEventListener<"u"&&(i=globalThis),i&&(i.addEventListener("offline",()=>{this._debug("offline event triggered"),(this.state==="connected"||this.state==="connecting")&&(this._disconnect(1,"transport closed",!0),this._deviceWentOffline=!0)}),i.addEventListener("online",()=>{this._debug("online event triggered"),this.state==="connecting"&&(this._deviceWentOffline&&!this._transportClosed&&(this._deviceWentOffline=!1,this._transportClosed=!0),this._clearReconnectTimeout(),this._startReconnecting())}),this._networkEventsSet=!0)}_getReconnectDelay(){let i=W(this._reconnectAttempts,this._config.minReconnectDelay,this._config.maxReconnectDelay);return this._reconnectAttempts+=1,i}_clearOutgoingRequests(){for(let i in this._callbacks)if(this._callbacks.hasOwnProperty(i)){let n=this._callbacks[i];clearTimeout(n.timeout);let o=n.errback;if(!o)continue;o({error:this._createErrorObject(11,"connection closed")})}this._callbacks={}}_clearConnectedState(){this._client=null,this._clearServerPingTimeout(),this._clearRefreshTimeout();for(let i in this._subs){if(!this._subs.hasOwnProperty(i))continue;let n=this._subs[i];n.state==="subscribed"&&n._setSubscribing(1,"transport closed")}for(let i in this._serverSubs)this._serverSubs.hasOwnProperty(i)&&this.emit("subscribing",{channel:i})}_handleWriteError(i){for(let n of i){let o=n.id;if(!(o in this._callbacks))continue;let t=this._callbacks[o];clearTimeout(this._callbacks[o].timeout),delete this._callbacks[o];let e=t.errback;e({error:this._createErrorObject(10,"transport write error")})}}_transportSendCommands(i){if(!i.length)return!0;if(!this._transport)return!1;try{this._transport.send(this._codec.encodeCommands(i),this._session,this._node)}catch(n){return this._debug("error writing commands",n),this._handleWriteError(i),!1}return!0}_initializeTransport(){let i;this._config.websocket!==null?i=this._config.websocket:typeof globalThis.WebSocket!="function"&&typeof globalThis.WebSocket!="object"||(i=globalThis.WebSocket);let n=null;this._config.sockjs!==null?n=this._config.sockjs:typeof globalThis.SockJS<"u"&&(n=globalThis.SockJS);let o=null;this._config.eventsource!==null?o=this._config.eventsource:typeof globalThis.EventSource<"u"&&(o=globalThis.EventSource);let t=null;this._config.fetch!==null?t=this._config.fetch:typeof globalThis.fetch<"u"&&(t=globalThis.fetch);let e=null;if(this._config.readableStream!==null?e=this._config.readableStream:typeof globalThis.ReadableStream<"u"&&(e=globalThis.ReadableStream),this._emulation){this._currentTransportIndex>=this._transports.length&&(this._triedAllTransports=!0,this._currentTransportIndex=0);let k=0;for(;;){if(k>=this._transports.length)throw new Error("no supported transport found");let x=this._transports[this._currentTransportIndex],R=x.transport,S=x.endpoint;if(R==="websocket"){if(this._debug("trying websocket transport"),this._transport=new V(S,{websocket:i,httpHeaders:this._config.httpHeaders}),!this._transport.supported()){this._debug("websocket transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="webtransport"){if(this._debug("trying webtransport transport"),this._transport=new st(S,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="http_stream"){if(this._debug("trying http_stream transport"),this._transport=new rt(S,{fetch:t,readableStream:e,emulationEndpoint:this._config.emulationEndpoint,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("http_stream transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="sse"){if(this._debug("trying sse transport"),this._transport=new ct(S,{eventsource:o,fetch:t,emulationEndpoint:this._config.emulationEndpoint}),!this._transport.supported()){this._debug("sse transport not available"),this._currentTransportIndex++,k++;continue}}else if(R==="sockjs"){if(this._debug("trying sockjs"),this._transport=new ot(S,{sockjs:n,sockjsOptions:this._config.sockjsOptions}),!this._transport.supported()){this._debug("sockjs transport not available"),this._currentTransportIndex++,k++;continue}}else throw new Error("unknown transport "+R);break}}else{if(Gt(this._endpoint,"http"))throw new Error("Provide explicit transport endpoints configuration in case of using HTTP (i.e. using array of TransportEndpoint instead of a single string), or use ws(s):// scheme in an endpoint if you aimed using WebSocket transport");if(this._debug("client will use websocket"),this._transport=new V(this._endpoint,{websocket:i,httpHeaders:this._config.httpHeaders}),!this._transport.supported())throw new Error("WebSocket constructor not found, make sure it is available globally or passed as a dependency in Centrifuge options")}let l=this,c=this._transport,u=this._nextTransportId();l._debug("id of transport",u);let p=!1,y=[];if(this._transport.emulation()){let k=l._sendConnect(!0);y.push(k)}this._setNetworkEvents();let w=this._codec.encodeCommands(y);this._transportClosed=!1;let g;g=setTimeout(function(){c.close()},this._config.timeout),this._transport.initialize(this._codecName(),{onOpen:function(){if(g&&(clearTimeout(g),g=null),l._transportId!=u){l._debug("open callback from non-actual transport"),c.close();return}p=!0,l._debug(c.subName(),"transport open"),!c.emulation()&&(l._transportIsOpen=!0,l._transportWasOpen=!0,l.startBatching(),l._sendConnect(!1),l._sendSubscribeCommands(),l.stopBatching(),l.emit("__centrifuge_debug:connect_frame_sent",{}))},onError:function(k){if(l._transportId!=u){l._debug("error callback from non-actual transport");return}l._debug("transport level error",k)},onClose:function(k){if(g&&(clearTimeout(g),g=null),l._transportId!=u){l._debug("close callback from non-actual transport");return}l._debug(c.subName(),"transport closed"),l._transportClosed=!0,l._transportIsOpen=!1;let x="connection closed",R=!0,S=0;if(k&&"code"in k&&k.code&&(S=k.code),k&&k.reason)try{let yt=JSON.parse(k.reason);x=yt.reason,R=yt.reconnect}catch{x=k.reason,(S>=3500&&S<4e3||S>=4500&&S<5e3)&&(R=!1)}S<3e3?(S===1009?(S=3,x="message size limit exceeded",R=!1):(S=1,x="transport closed"),l._emulation&&!l._transportWasOpen&&(l._currentTransportIndex++,l._currentTransportIndex>=l._transports.length&&(l._triedAllTransports=!0,l._currentTransportIndex=0))):l._transportWasOpen=!0,l._isConnecting()&&!p&&l.emit("error",{type:"transport",error:{code:2,message:"transport closed"},transport:c.name()}),l._reconnecting=!1,l._disconnect(S,x,R)},onMessage:function(k){l._dataReceived(k)}},w),l.emit("__centrifuge_debug:transport_initialized",{})}_sendConnect(i){let n=this._constructConnectCommand(),o=this;return this._call(n,i).then(t=>{let e=t.reply.connect;o._connectResponse(e),t.next&&t.next()},t=>{o._connectError(t.error),t.next&&t.next()}),n}_startReconnecting(){if(this._debug("start reconnecting"),!this._isConnecting()){this._debug("stop reconnecting: client not in connecting state");return}if(this._reconnecting){this._debug("reconnect already in progress, return from reconnect routine");return}if(this._transportClosed===!1){this._debug("waiting for transport close");return}this._reconnecting=!0;let i=this._token==="";if(!(this._refreshRequired||i&&this._config.getToken!==null)){this._config.getData?this._config.getData().then(t=>{this._isConnecting()&&(this._data=t,this._initializeTransport())}).catch(t=>this._handleGetDataError(t)):this._initializeTransport();return}let o=this;this._getToken().then(function(t){if(o._isConnecting()){if(t==null||t==null){o._failUnauthorized();return}o._token=t,o._debug("connection token refreshed"),o._config.getData?o._config.getData().then(function(e){o._isConnecting()&&(o._data=e,o._initializeTransport())}).catch(e=>o._handleGetDataError(e)):o._initializeTransport()}}).catch(function(t){if(!o._isConnecting())return;if(t instanceof T){o._failUnauthorized();return}o.emit("error",{type:"connectToken",error:{code:5,message:t!==void 0?t.toString():""}});let e=o._getReconnectDelay();o._debug("error on getting connection token, reconnect after "+e+" milliseconds",t),o._reconnecting=!1,o._reconnectTimeout=setTimeout(()=>{o._startReconnecting()},e)})}_handleGetDataError(i){if(i instanceof T){this._failUnauthorized();return}this.emit("error",{type:"connectData",error:{code:12,message:i?.toString()||""}});let n=this._getReconnectDelay();this._debug("error on getting connect data, reconnect after "+n+" milliseconds",i),this._reconnecting=!1,this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},n)}_connectError(i){this.state==="connecting"&&(i.code===109&&(this._refreshRequired=!0),i.code<100||i.temporary===!0||i.code===109?(this.emit("error",{type:"connect",error:i}),this._debug("closing transport due to connect error"),this._disconnect(i.code,i.message,!0)):this._disconnect(i.code,i.message,!1))}_scheduleReconnect(){if(!this._isConnecting())return;let i=!1;this._emulation&&!this._transportWasOpen&&!this._triedAllTransports&&(i=!0);let n=this._getReconnectDelay();i&&(n=0),this._debug("reconnect after "+n+" milliseconds"),this._clearReconnectTimeout(),this._reconnectTimeout=setTimeout(()=>{this._startReconnecting()},n)}_constructConnectCommand(){let i={};this._token&&(i.token=this._token),this._data&&(i.data=this._data),this._config.name&&(i.name=this._config.name),this._config.version&&(i.version=this._config.version),Object.keys(this._config.headers).length>0&&(i.headers=this._config.headers);let n={},o=!1;for(let t in this._serverSubs)if(this._serverSubs.hasOwnProperty(t)&&this._serverSubs[t].recoverable){o=!0;let e={recover:!0};this._serverSubs[t].offset&&(e.offset=this._serverSubs[t].offset),this._serverSubs[t].epoch&&(e.epoch=this._serverSubs[t].epoch),n[t]=e}return o&&(i.subs=n),{connect:i}}_getHistoryRequest(i,n){let o={channel:i};return n!==void 0&&(n.since&&(o.since={offset:n.since.offset},n.since.epoch&&(o.since.epoch=n.since.epoch)),n.limit!==void 0&&(o.limit=n.limit),n.reverse===!0&&(o.reverse=!0)),o}_methodCall(){return this._isConnected()?Promise.resolve():new Promise((i,n)=>{let o=setTimeout(function(){n({code:1,message:"timeout"})},this._config.timeout);this._promises[this._nextPromiseId()]={timeout:o,resolve:i,reject:n}})}_callPromise(i,n){return new Promise((o,t)=>{this._call(i,!1).then(e=>{let l=n(e.reply);o(l),e.next?.()},e=>{t(e.error),e.next?.()})})}_dataReceived(i){this._serverPing>0&&this._waitServerPing();let n=this._codec.decodeReplies(i);this._dispatchPromise=this._dispatchPromise.then(()=>{let o;this._dispatchPromise=new Promise(t=>{o=t}),this._dispatchSynchronized(n,o)})}_dispatchSynchronized(i,n){let o=Promise.resolve();for(let t in i)i.hasOwnProperty(t)&&(o=o.then(()=>this._dispatchReply(i[t])));o=o.then(()=>{n()})}_dispatchReply(i){let n,o=new Promise(e=>{n=e});if(i==null)return this._debug("dispatch: got undefined or null reply"),n(),o;let t=i.id;return t&&t>0?this._handleReply(i,n):i.push?this._handlePush(i.push,n):this._handleServerPing(n),o}_call(i,n){return new Promise((o,t)=>{i.id=this._nextCommandId(),this._registerCall(i.id,o,t),n||this._addCommand(i)})}_startConnecting(){this._debug("start connecting"),this._setState("connecting")&&this.emit("connecting",{code:0,reason:"connect called"}),this._client=null,this._startReconnecting()}_disconnect(i,n,o){if(this._isDisconnected())return;this._transportIsOpen=!1;let t=this.state;this._reconnecting=!1;let e={code:i,reason:n},l=!1;if(o?l=this._setState("connecting"):(l=this._setState("disconnected"),this._rejectPromises({code:3,message:"disconnected"})),this._clearOutgoingRequests(),t==="connecting"&&this._clearReconnectTimeout(),t==="connected"&&this._clearConnectedState(),l&&(this._isConnecting()?this.emit("connecting",e):this.emit("disconnected",e)),this._transport){this._debug("closing existing transport");let c=this._transport;this._transport=null,c.close(),this._transportClosed=!0,this._nextTransportId()}else this._debug("no transport to close");this._scheduleReconnect()}_failUnauthorized(){this._disconnect(1,"unauthorized",!1)}_getToken(){return this._debug("get connection token"),this._config.getToken?this._config.getToken({}):(this.emit("error",{type:"configuration",error:{code:12,message:"token expired but no getToken function set in the configuration"}}),Promise.reject(new T("")))}_refresh(){let i=this._client,n=this;this._getToken().then(function(o){if(i!==n._client)return;if(!o){n._failUnauthorized();return}if(n._token=o,n._debug("connection token refreshed"),!n._isConnected())return;let t={refresh:{token:n._token}};n._call(t,!1).then(e=>{let l=e.reply.refresh;n._refreshResponse(l),e.next&&e.next()},e=>{n._refreshError(e.error),e.next&&e.next()})}).catch(function(o){if(n._isConnected()){if(o instanceof T){n._failUnauthorized();return}n.emit("error",{type:"refreshToken",error:{code:6,message:o!==void 0?o.toString():""}}),n._refreshTimeout=setTimeout(()=>n._refresh(),n._getRefreshRetryDelay())}})}_refreshError(i){i.code<100||i.temporary===!0?(this.emit("error",{type:"refresh",error:i}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._disconnect(i.code,i.message,!1)}_getRefreshRetryDelay(){return W(0,5e3,1e4)}_refreshResponse(i){this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),i.expires&&(this._client=i.client,this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl)))}_removeSubscription(i){i!==null&&delete this._subs[i.channel]}_unsubscribe(i){if(!this._transportIsOpen)return Promise.resolve();let o={unsubscribe:{channel:i.channel}},t=this;return new Promise((l,c)=>{this._call(o,!1).then(u=>{l(),u.next&&u.next()},u=>{l(),u.next&&u.next(),t._disconnect(4,"unsubscribe error",!0)})})}_getSub(i){let n=this._subs[i];return n||null}_isServerSub(i){return this._serverSubs[i]!==void 0}_sendSubscribeCommands(){let i=[];for(let n in this._subs){if(!this._subs.hasOwnProperty(n))continue;let o=this._subs[n];if(o._inflight!==!0&&o.state==="subscribing"){let t=o._subscribe();t&&i.push(t)}}return i}_connectResponse(i){if(this._transportIsOpen=!0,this._transportWasOpen=!0,this._reconnectAttempts=0,this._refreshRequired=!1,this._isConnected())return;this._client=i.client,this._setState("connected"),this._refreshTimeout&&clearTimeout(this._refreshTimeout),i.expires&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl))),this._session=i.session,this._node=i.node,this.startBatching(),this._sendSubscribeCommands(),this.stopBatching();let n={client:i.client,transport:this._transport.subName()};i.data&&(n.data=i.data),this.emit("connected",n),this._resolvePromises(),this._processServerSubs(i.subs||{}),i.ping&&i.ping>0?(this._serverPing=i.ping*1e3,this._sendPong=i.pong===!0,this._waitServerPing()):this._serverPing=0}_processServerSubs(i){for(let n in i){if(!i.hasOwnProperty(n))continue;let o=i[n];this._serverSubs[n]={offset:o.offset,epoch:o.epoch,recoverable:o.recoverable||!1};let t=this._getSubscribeContext(n,o);this.emit("subscribed",t)}for(let n in i){if(!i.hasOwnProperty(n))continue;let o=i[n];if(o.recovered){let t=o.publications;if(t&&t.length>0)for(let e in t)t.hasOwnProperty(e)&&this._handlePublication(n,t[e])}}for(let n in this._serverSubs)this._serverSubs.hasOwnProperty(n)&&(i[n]||(this.emit("unsubscribed",{channel:n}),delete this._serverSubs[n]))}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearReconnectTimeout(){this._reconnectTimeout!==null&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=null)}_clearServerPingTimeout(){this._serverPingTimeout!==null&&(clearTimeout(this._serverPingTimeout),this._serverPingTimeout=null)}_waitServerPing(){this._config.maxServerPingDelay!==0&&this._isConnected()&&(this._clearServerPingTimeout(),this._serverPingTimeout=setTimeout(()=>{this._isConnected()&&this._disconnect(2,"no ping",!0)},this._serverPing+this._config.maxServerPingDelay))}_getSubscribeContext(i,n){let o={channel:i,positioned:!1,recoverable:!1,wasRecovering:!1,recovered:!1,hasRecoveredPublications:!1};n.recovered&&(o.recovered=!0),n.positioned&&(o.positioned=!0),n.recoverable&&(o.recoverable=!0),n.was_recovering&&(o.wasRecovering=!0);let t="";"epoch"in n&&(t=n.epoch);let e=0;return"offset"in n&&(e=n.offset),(o.positioned||o.recoverable)&&(o.streamPosition={offset:e,epoch:t}),Array.isArray(n.publications)&&n.publications.length>0&&(o.hasRecoveredPublications=!0),n.data&&(o.data=n.data),o}_handleReply(i,n){let o=i.id;if(!(o in this._callbacks)){n();return}let t=this._callbacks[o];if(clearTimeout(this._callbacks[o].timeout),delete this._callbacks[o],Zt(i)){let e=t.errback;if(!e){n();return}let l={code:i.error.code,message:i.error.message||"",temporary:i.error.temporary||!1};e({error:l,next:n})}else{let e=t.callback;if(!e)return;e({reply:i,next:n})}}_handleJoin(i,n){let o=this._getSub(i);if(!o){if(this._isServerSub(i)){let t={channel:i,info:this._getJoinLeaveContext(n.info)};this.emit("join",t)}return}o._handleJoin(n)}_handleLeave(i,n){let o=this._getSub(i);if(!o){if(this._isServerSub(i)){let t={channel:i,info:this._getJoinLeaveContext(n.info)};this.emit("leave",t)}return}o._handleLeave(n)}_handleUnsubscribe(i,n){let o=this._getSub(i);if(!o){this._isServerSub(i)&&(delete this._serverSubs[i],this.emit("unsubscribed",{channel:i}));return}n.code<2500?o._setUnsubscribed(n.code,n.reason,!1):o._setSubscribing(n.code,n.reason)}_handleSubscribe(i,n){this._serverSubs[i]={offset:n.offset,epoch:n.epoch,recoverable:n.recoverable||!1},this.emit("subscribed",this._getSubscribeContext(i,n))}_handleDisconnect(i){let n=i.code,o=!0;(n>=3500&&n<4e3||n>=4500&&n<5e3)&&(o=!1),this._disconnect(n,i.reason,o)}_getPublicationContext(i,n){let o={channel:i,data:n.data};return n.offset&&(o.offset=n.offset),n.info&&(o.info=this._getJoinLeaveContext(n.info)),n.tags&&(o.tags=n.tags),o}_getJoinLeaveContext(i){let n={client:i.client,user:i.user},o=i.conn_info;o&&(n.connInfo=o);let t=i.chan_info;return t&&(n.chanInfo=t),n}_handlePublication(i,n){let o=this._getSub(i);if(!o){if(this._isServerSub(i)){let t=this._getPublicationContext(i,n);this.emit("publication",t),n.offset!==void 0&&(this._serverSubs[i].offset=n.offset)}return}o._handlePublication(n)}_handleMessage(i){this.emit("message",{data:i.data})}_handleServerPing(i){if(this._sendPong){let n={};this._transportSendCommands([n])}i()}_handlePush(i,n){let o=i.channel;i.pub?this._handlePublication(o,i.pub):i.message?this._handleMessage(i.message):i.join?this._handleJoin(o,i.join):i.leave?this._handleLeave(o,i.leave):i.unsubscribe?this._handleUnsubscribe(o,i.unsubscribe):i.subscribe?this._handleSubscribe(o,i.subscribe):i.disconnect&&this._handleDisconnect(i.disconnect),n()}_flush(){let i=this._commands.slice(0);this._commands=[],this._transportSendCommands(i)}_createErrorObject(i,n,o){let t={code:i,message:n};return o&&(t.temporary=!0),t}_registerCall(i,n,o){this._callbacks[i]={callback:n,errback:o,timeout:null},this._callbacks[i].timeout=setTimeout(()=>{delete this._callbacks[i],vt(o)&&o({error:this._createErrorObject(1,"timeout")})},this._config.timeout)}_addCommand(i){this._batching?this._commands.push(i):this._transportSendCommands([i])}_nextPromiseId(){return++this._promiseId}_nextTransportId(){return++this._transportId}_resolvePromises(){for(let i in this._promises)this._promises.hasOwnProperty(i)&&(this._promises[i].timeout&&clearTimeout(this._promises[i].timeout),this._promises[i].resolve(),delete this._promises[i])}_rejectPromises(i){for(let n in this._promises)this._promises.hasOwnProperty(n)&&(this._promises[n].timeout&&clearTimeout(this._promises[n].timeout),this._promises[n].reject(i),delete this._promises[n])}};N.SubscriptionState=nt;N.State=et;N.UnauthorizedError=T;var z=Q(qt());var q=Q(qt()),a=q.Reader,b=q.Writer,h=q.util,f=q.roots.default||(q.roots.default={}),pt=f.centrifugal=(()=>{let s={};return s.centrifuge=function(){let r={};return r.protocol=function(){let i={};return i.Error=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.code=0,n.prototype.message="",n.prototype.temporary=!1,n.encode=function(t,e){return e||(e=b.create()),t.code!=null&&Object.hasOwnProperty.call(t,"code")&&e.uint32(8).uint32(t.code),t.message!=null&&Object.hasOwnProperty.call(t,"message")&&e.uint32(18).string(t.message),t.temporary!=null&&Object.hasOwnProperty.call(t,"temporary")&&e.uint32(24).bool(t.temporary),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Error;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.code=t.uint32();break}case 2:{c.message=t.string();break}case 3:{c.temporary=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!h.isInteger(t.code)?"code: integer expected":t.message!=null&&t.hasOwnProperty("message")&&!h.isString(t.message)?"message: string expected":t.temporary!=null&&t.hasOwnProperty("temporary")&&typeof t.temporary!="boolean"?"temporary: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Error"},n}(),i.EmulationRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.node="",n.prototype.session="",n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.node!=null&&Object.hasOwnProperty.call(t,"node")&&e.uint32(10).string(t.node),t.session!=null&&Object.hasOwnProperty.call(t,"session")&&e.uint32(18).string(t.session),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(26).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.EmulationRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.node=t.string();break}case 2:{c.session=t.string();break}case 3:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.node!=null&&t.hasOwnProperty("node")&&!h.isString(t.node)?"node: string expected":t.session!=null&&t.hasOwnProperty("session")&&!h.isString(t.session)?"session: string expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.EmulationRequest"},n}(),i.Command=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.id=0,n.prototype.connect=null,n.prototype.subscribe=null,n.prototype.unsubscribe=null,n.prototype.publish=null,n.prototype.presence=null,n.prototype.presence_stats=null,n.prototype.history=null,n.prototype.ping=null,n.prototype.send=null,n.prototype.rpc=null,n.prototype.refresh=null,n.prototype.sub_refresh=null,n.encode=function(t,e){return e||(e=b.create()),t.id!=null&&Object.hasOwnProperty.call(t,"id")&&e.uint32(8).uint32(t.id),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&f.centrifugal.centrifuge.protocol.ConnectRequest.encode(t.connect,e.uint32(34).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&f.centrifugal.centrifuge.protocol.SubscribeRequest.encode(t.subscribe,e.uint32(42).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&f.centrifugal.centrifuge.protocol.UnsubscribeRequest.encode(t.unsubscribe,e.uint32(50).fork()).ldelim(),t.publish!=null&&Object.hasOwnProperty.call(t,"publish")&&f.centrifugal.centrifuge.protocol.PublishRequest.encode(t.publish,e.uint32(58).fork()).ldelim(),t.presence!=null&&Object.hasOwnProperty.call(t,"presence")&&f.centrifugal.centrifuge.protocol.PresenceRequest.encode(t.presence,e.uint32(66).fork()).ldelim(),t.presence_stats!=null&&Object.hasOwnProperty.call(t,"presence_stats")&&f.centrifugal.centrifuge.protocol.PresenceStatsRequest.encode(t.presence_stats,e.uint32(74).fork()).ldelim(),t.history!=null&&Object.hasOwnProperty.call(t,"history")&&f.centrifugal.centrifuge.protocol.HistoryRequest.encode(t.history,e.uint32(82).fork()).ldelim(),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&f.centrifugal.centrifuge.protocol.PingRequest.encode(t.ping,e.uint32(90).fork()).ldelim(),t.send!=null&&Object.hasOwnProperty.call(t,"send")&&f.centrifugal.centrifuge.protocol.SendRequest.encode(t.send,e.uint32(98).fork()).ldelim(),t.rpc!=null&&Object.hasOwnProperty.call(t,"rpc")&&f.centrifugal.centrifuge.protocol.RPCRequest.encode(t.rpc,e.uint32(106).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&f.centrifugal.centrifuge.protocol.RefreshRequest.encode(t.refresh,e.uint32(114).fork()).ldelim(),t.sub_refresh!=null&&Object.hasOwnProperty.call(t,"sub_refresh")&&f.centrifugal.centrifuge.protocol.SubRefreshRequest.encode(t.sub_refresh,e.uint32(122).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Command;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.id=t.uint32();break}case 4:{c.connect=f.centrifugal.centrifuge.protocol.ConnectRequest.decode(t,t.uint32());break}case 5:{c.subscribe=f.centrifugal.centrifuge.protocol.SubscribeRequest.decode(t,t.uint32());break}case 6:{c.unsubscribe=f.centrifugal.centrifuge.protocol.UnsubscribeRequest.decode(t,t.uint32());break}case 7:{c.publish=f.centrifugal.centrifuge.protocol.PublishRequest.decode(t,t.uint32());break}case 8:{c.presence=f.centrifugal.centrifuge.protocol.PresenceRequest.decode(t,t.uint32());break}case 9:{c.presence_stats=f.centrifugal.centrifuge.protocol.PresenceStatsRequest.decode(t,t.uint32());break}case 10:{c.history=f.centrifugal.centrifuge.protocol.HistoryRequest.decode(t,t.uint32());break}case 11:{c.ping=f.centrifugal.centrifuge.protocol.PingRequest.decode(t,t.uint32());break}case 12:{c.send=f.centrifugal.centrifuge.protocol.SendRequest.decode(t,t.uint32());break}case 13:{c.rpc=f.centrifugal.centrifuge.protocol.RPCRequest.decode(t,t.uint32());break}case 14:{c.refresh=f.centrifugal.centrifuge.protocol.RefreshRequest.decode(t,t.uint32());break}case 15:{c.sub_refresh=f.centrifugal.centrifuge.protocol.SubRefreshRequest.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.id!=null&&t.hasOwnProperty("id")&&!h.isInteger(t.id))return"id: integer expected";if(t.connect!=null&&t.hasOwnProperty("connect")){let e=f.centrifugal.centrifuge.protocol.ConnectRequest.verify(t.connect);if(e)return"connect."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=f.centrifugal.centrifuge.protocol.SubscribeRequest.verify(t.subscribe);if(e)return"subscribe."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=f.centrifugal.centrifuge.protocol.UnsubscribeRequest.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.publish!=null&&t.hasOwnProperty("publish")){let e=f.centrifugal.centrifuge.protocol.PublishRequest.verify(t.publish);if(e)return"publish."+e}if(t.presence!=null&&t.hasOwnProperty("presence")){let e=f.centrifugal.centrifuge.protocol.PresenceRequest.verify(t.presence);if(e)return"presence."+e}if(t.presence_stats!=null&&t.hasOwnProperty("presence_stats")){let e=f.centrifugal.centrifuge.protocol.PresenceStatsRequest.verify(t.presence_stats);if(e)return"presence_stats."+e}if(t.history!=null&&t.hasOwnProperty("history")){let e=f.centrifugal.centrifuge.protocol.HistoryRequest.verify(t.history);if(e)return"history."+e}if(t.ping!=null&&t.hasOwnProperty("ping")){let e=f.centrifugal.centrifuge.protocol.PingRequest.verify(t.ping);if(e)return"ping."+e}if(t.send!=null&&t.hasOwnProperty("send")){let e=f.centrifugal.centrifuge.protocol.SendRequest.verify(t.send);if(e)return"send."+e}if(t.rpc!=null&&t.hasOwnProperty("rpc")){let e=f.centrifugal.centrifuge.protocol.RPCRequest.verify(t.rpc);if(e)return"rpc."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=f.centrifugal.centrifuge.protocol.RefreshRequest.verify(t.refresh);if(e)return"refresh."+e}if(t.sub_refresh!=null&&t.hasOwnProperty("sub_refresh")){let e=f.centrifugal.centrifuge.protocol.SubRefreshRequest.verify(t.sub_refresh);if(e)return"sub_refresh."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Command"},n}(),i.Reply=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.id=0,n.prototype.error=null,n.prototype.push=null,n.prototype.connect=null,n.prototype.subscribe=null,n.prototype.unsubscribe=null,n.prototype.publish=null,n.prototype.presence=null,n.prototype.presence_stats=null,n.prototype.history=null,n.prototype.ping=null,n.prototype.rpc=null,n.prototype.refresh=null,n.prototype.sub_refresh=null,n.encode=function(t,e){return e||(e=b.create()),t.id!=null&&Object.hasOwnProperty.call(t,"id")&&e.uint32(8).uint32(t.id),t.error!=null&&Object.hasOwnProperty.call(t,"error")&&f.centrifugal.centrifuge.protocol.Error.encode(t.error,e.uint32(18).fork()).ldelim(),t.push!=null&&Object.hasOwnProperty.call(t,"push")&&f.centrifugal.centrifuge.protocol.Push.encode(t.push,e.uint32(34).fork()).ldelim(),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&f.centrifugal.centrifuge.protocol.ConnectResult.encode(t.connect,e.uint32(42).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&f.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subscribe,e.uint32(50).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&f.centrifugal.centrifuge.protocol.UnsubscribeResult.encode(t.unsubscribe,e.uint32(58).fork()).ldelim(),t.publish!=null&&Object.hasOwnProperty.call(t,"publish")&&f.centrifugal.centrifuge.protocol.PublishResult.encode(t.publish,e.uint32(66).fork()).ldelim(),t.presence!=null&&Object.hasOwnProperty.call(t,"presence")&&f.centrifugal.centrifuge.protocol.PresenceResult.encode(t.presence,e.uint32(74).fork()).ldelim(),t.presence_stats!=null&&Object.hasOwnProperty.call(t,"presence_stats")&&f.centrifugal.centrifuge.protocol.PresenceStatsResult.encode(t.presence_stats,e.uint32(82).fork()).ldelim(),t.history!=null&&Object.hasOwnProperty.call(t,"history")&&f.centrifugal.centrifuge.protocol.HistoryResult.encode(t.history,e.uint32(90).fork()).ldelim(),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&f.centrifugal.centrifuge.protocol.PingResult.encode(t.ping,e.uint32(98).fork()).ldelim(),t.rpc!=null&&Object.hasOwnProperty.call(t,"rpc")&&f.centrifugal.centrifuge.protocol.RPCResult.encode(t.rpc,e.uint32(106).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&f.centrifugal.centrifuge.protocol.RefreshResult.encode(t.refresh,e.uint32(114).fork()).ldelim(),t.sub_refresh!=null&&Object.hasOwnProperty.call(t,"sub_refresh")&&f.centrifugal.centrifuge.protocol.SubRefreshResult.encode(t.sub_refresh,e.uint32(122).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Reply;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.id=t.uint32();break}case 2:{c.error=f.centrifugal.centrifuge.protocol.Error.decode(t,t.uint32());break}case 4:{c.push=f.centrifugal.centrifuge.protocol.Push.decode(t,t.uint32());break}case 5:{c.connect=f.centrifugal.centrifuge.protocol.ConnectResult.decode(t,t.uint32());break}case 6:{c.subscribe=f.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break}case 7:{c.unsubscribe=f.centrifugal.centrifuge.protocol.UnsubscribeResult.decode(t,t.uint32());break}case 8:{c.publish=f.centrifugal.centrifuge.protocol.PublishResult.decode(t,t.uint32());break}case 9:{c.presence=f.centrifugal.centrifuge.protocol.PresenceResult.decode(t,t.uint32());break}case 10:{c.presence_stats=f.centrifugal.centrifuge.protocol.PresenceStatsResult.decode(t,t.uint32());break}case 11:{c.history=f.centrifugal.centrifuge.protocol.HistoryResult.decode(t,t.uint32());break}case 12:{c.ping=f.centrifugal.centrifuge.protocol.PingResult.decode(t,t.uint32());break}case 13:{c.rpc=f.centrifugal.centrifuge.protocol.RPCResult.decode(t,t.uint32());break}case 14:{c.refresh=f.centrifugal.centrifuge.protocol.RefreshResult.decode(t,t.uint32());break}case 15:{c.sub_refresh=f.centrifugal.centrifuge.protocol.SubRefreshResult.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.id!=null&&t.hasOwnProperty("id")&&!h.isInteger(t.id))return"id: integer expected";if(t.error!=null&&t.hasOwnProperty("error")){let e=f.centrifugal.centrifuge.protocol.Error.verify(t.error);if(e)return"error."+e}if(t.push!=null&&t.hasOwnProperty("push")){let e=f.centrifugal.centrifuge.protocol.Push.verify(t.push);if(e)return"push."+e}if(t.connect!=null&&t.hasOwnProperty("connect")){let e=f.centrifugal.centrifuge.protocol.ConnectResult.verify(t.connect);if(e)return"connect."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=f.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subscribe);if(e)return"subscribe."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=f.centrifugal.centrifuge.protocol.UnsubscribeResult.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.publish!=null&&t.hasOwnProperty("publish")){let e=f.centrifugal.centrifuge.protocol.PublishResult.verify(t.publish);if(e)return"publish."+e}if(t.presence!=null&&t.hasOwnProperty("presence")){let e=f.centrifugal.centrifuge.protocol.PresenceResult.verify(t.presence);if(e)return"presence."+e}if(t.presence_stats!=null&&t.hasOwnProperty("presence_stats")){let e=f.centrifugal.centrifuge.protocol.PresenceStatsResult.verify(t.presence_stats);if(e)return"presence_stats."+e}if(t.history!=null&&t.hasOwnProperty("history")){let e=f.centrifugal.centrifuge.protocol.HistoryResult.verify(t.history);if(e)return"history."+e}if(t.ping!=null&&t.hasOwnProperty("ping")){let e=f.centrifugal.centrifuge.protocol.PingResult.verify(t.ping);if(e)return"ping."+e}if(t.rpc!=null&&t.hasOwnProperty("rpc")){let e=f.centrifugal.centrifuge.protocol.RPCResult.verify(t.rpc);if(e)return"rpc."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=f.centrifugal.centrifuge.protocol.RefreshResult.verify(t.refresh);if(e)return"refresh."+e}if(t.sub_refresh!=null&&t.hasOwnProperty("sub_refresh")){let e=f.centrifugal.centrifuge.protocol.SubRefreshResult.verify(t.sub_refresh);if(e)return"sub_refresh."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Reply"},n}(),i.Push=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.pub=null,n.prototype.join=null,n.prototype.leave=null,n.prototype.unsubscribe=null,n.prototype.message=null,n.prototype.subscribe=null,n.prototype.connect=null,n.prototype.disconnect=null,n.prototype.refresh=null,n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(18).string(t.channel),t.pub!=null&&Object.hasOwnProperty.call(t,"pub")&&f.centrifugal.centrifuge.protocol.Publication.encode(t.pub,e.uint32(34).fork()).ldelim(),t.join!=null&&Object.hasOwnProperty.call(t,"join")&&f.centrifugal.centrifuge.protocol.Join.encode(t.join,e.uint32(42).fork()).ldelim(),t.leave!=null&&Object.hasOwnProperty.call(t,"leave")&&f.centrifugal.centrifuge.protocol.Leave.encode(t.leave,e.uint32(50).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&f.centrifugal.centrifuge.protocol.Unsubscribe.encode(t.unsubscribe,e.uint32(58).fork()).ldelim(),t.message!=null&&Object.hasOwnProperty.call(t,"message")&&f.centrifugal.centrifuge.protocol.Message.encode(t.message,e.uint32(66).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&f.centrifugal.centrifuge.protocol.Subscribe.encode(t.subscribe,e.uint32(74).fork()).ldelim(),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&f.centrifugal.centrifuge.protocol.Connect.encode(t.connect,e.uint32(82).fork()).ldelim(),t.disconnect!=null&&Object.hasOwnProperty.call(t,"disconnect")&&f.centrifugal.centrifuge.protocol.Disconnect.encode(t.disconnect,e.uint32(90).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&f.centrifugal.centrifuge.protocol.Refresh.encode(t.refresh,e.uint32(98).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Push;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 2:{c.channel=t.string();break}case 4:{c.pub=f.centrifugal.centrifuge.protocol.Publication.decode(t,t.uint32());break}case 5:{c.join=f.centrifugal.centrifuge.protocol.Join.decode(t,t.uint32());break}case 6:{c.leave=f.centrifugal.centrifuge.protocol.Leave.decode(t,t.uint32());break}case 7:{c.unsubscribe=f.centrifugal.centrifuge.protocol.Unsubscribe.decode(t,t.uint32());break}case 8:{c.message=f.centrifugal.centrifuge.protocol.Message.decode(t,t.uint32());break}case 9:{c.subscribe=f.centrifugal.centrifuge.protocol.Subscribe.decode(t,t.uint32());break}case 10:{c.connect=f.centrifugal.centrifuge.protocol.Connect.decode(t,t.uint32());break}case 11:{c.disconnect=f.centrifugal.centrifuge.protocol.Disconnect.decode(t,t.uint32());break}case 12:{c.refresh=f.centrifugal.centrifuge.protocol.Refresh.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel))return"channel: string expected";if(t.pub!=null&&t.hasOwnProperty("pub")){let e=f.centrifugal.centrifuge.protocol.Publication.verify(t.pub);if(e)return"pub."+e}if(t.join!=null&&t.hasOwnProperty("join")){let e=f.centrifugal.centrifuge.protocol.Join.verify(t.join);if(e)return"join."+e}if(t.leave!=null&&t.hasOwnProperty("leave")){let e=f.centrifugal.centrifuge.protocol.Leave.verify(t.leave);if(e)return"leave."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=f.centrifugal.centrifuge.protocol.Unsubscribe.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.message!=null&&t.hasOwnProperty("message")){let e=f.centrifugal.centrifuge.protocol.Message.verify(t.message);if(e)return"message."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=f.centrifugal.centrifuge.protocol.Subscribe.verify(t.subscribe);if(e)return"subscribe."+e}if(t.connect!=null&&t.hasOwnProperty("connect")){let e=f.centrifugal.centrifuge.protocol.Connect.verify(t.connect);if(e)return"connect."+e}if(t.disconnect!=null&&t.hasOwnProperty("disconnect")){let e=f.centrifugal.centrifuge.protocol.Disconnect.verify(t.disconnect);if(e)return"disconnect."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=f.centrifugal.centrifuge.protocol.Refresh.verify(t.refresh);if(e)return"refresh."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Push"},n}(),i.ClientInfo=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.user="",n.prototype.client="",n.prototype.conn_info=h.newBuffer([]),n.prototype.chan_info=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.user!=null&&Object.hasOwnProperty.call(t,"user")&&e.uint32(10).string(t.user),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(18).string(t.client),t.conn_info!=null&&Object.hasOwnProperty.call(t,"conn_info")&&e.uint32(26).bytes(t.conn_info),t.chan_info!=null&&Object.hasOwnProperty.call(t,"chan_info")&&e.uint32(34).bytes(t.chan_info),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.ClientInfo;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.user=t.string();break}case 2:{c.client=t.string();break}case 3:{c.conn_info=t.bytes();break}case 4:{c.chan_info=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.user!=null&&t.hasOwnProperty("user")&&!h.isString(t.user)?"user: string expected":t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client)?"client: string expected":t.conn_info!=null&&t.hasOwnProperty("conn_info")&&!(t.conn_info&&typeof t.conn_info.length=="number"||h.isString(t.conn_info))?"conn_info: buffer expected":t.chan_info!=null&&t.hasOwnProperty("chan_info")&&!(t.chan_info&&typeof t.chan_info.length=="number"||h.isString(t.chan_info))?"chan_info: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.ClientInfo"},n}(),i.Publication=function(){function n(o){if(this.tags={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.prototype.info=null,n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.tags=h.emptyObject,n.prototype.delta=!1,n.prototype.time=h.Long?h.Long.fromBits(0,0,!1):0,n.prototype.channel="",n.encode=function(t,e){if(e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(34).bytes(t.data),t.info!=null&&Object.hasOwnProperty.call(t,"info")&&f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.info,e.uint32(42).fork()).ldelim(),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(48).uint64(t.offset),t.tags!=null&&Object.hasOwnProperty.call(t,"tags"))for(let l=Object.keys(t.tags),c=0;c<l.length;++c)e.uint32(58).fork().uint32(10).string(l[c]).uint32(18).string(t.tags[l[c]]).ldelim();return t.delta!=null&&Object.hasOwnProperty.call(t,"delta")&&e.uint32(64).bool(t.delta),t.time!=null&&Object.hasOwnProperty.call(t,"time")&&e.uint32(72).int64(t.time),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(82).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Publication,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 4:{c.data=t.bytes();break}case 5:{c.info=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}case 6:{c.offset=t.uint64();break}case 7:{c.tags===h.emptyObject&&(c.tags={});let w=t.uint32()+t.pos;for(u="",p="";t.pos<w;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=t.string();break;default:t.skipType(g&7);break}}c.tags[u]=p;break}case 8:{c.delta=t.bool();break}case 9:{c.time=t.int64();break}case 10:{c.channel=t.string();break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.info!=null&&t.hasOwnProperty("info")){let e=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.info);if(e)return"info."+e}if(t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high)))return"offset: integer|Long expected";if(t.tags!=null&&t.hasOwnProperty("tags")){if(!h.isObject(t.tags))return"tags: object expected";let e=Object.keys(t.tags);for(let l=0;l<e.length;++l)if(!h.isString(t.tags[e[l]]))return"tags: string{k:string} expected"}return t.delta!=null&&t.hasOwnProperty("delta")&&typeof t.delta!="boolean"?"delta: boolean expected":t.time!=null&&t.hasOwnProperty("time")&&!h.isInteger(t.time)&&!(t.time&&h.isInteger(t.time.low)&&h.isInteger(t.time.high))?"time: integer|Long expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Publication"},n}(),i.Join=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.info=null,n.encode=function(t,e){return e||(e=b.create()),t.info!=null&&Object.hasOwnProperty.call(t,"info")&&f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.info,e.uint32(10).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Join;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.info=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.info!=null&&t.hasOwnProperty("info")){let e=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.info);if(e)return"info."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Join"},n}(),i.Leave=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.info=null,n.encode=function(t,e){return e||(e=b.create()),t.info!=null&&Object.hasOwnProperty.call(t,"info")&&f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.info,e.uint32(10).fork()).ldelim(),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Leave;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.info=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.info!=null&&t.hasOwnProperty("info")){let e=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.info);if(e)return"info."+e}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Leave"},n}(),i.Unsubscribe=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.code=0,n.prototype.reason="",n.encode=function(t,e){return e||(e=b.create()),t.code!=null&&Object.hasOwnProperty.call(t,"code")&&e.uint32(16).uint32(t.code),t.reason!=null&&Object.hasOwnProperty.call(t,"reason")&&e.uint32(26).string(t.reason),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Unsubscribe;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 2:{c.code=t.uint32();break}case 3:{c.reason=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!h.isInteger(t.code)?"code: integer expected":t.reason!=null&&t.hasOwnProperty("reason")&&!h.isString(t.reason)?"reason: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Unsubscribe"},n}(),i.Subscribe=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.recoverable=!1,n.prototype.epoch="",n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.positioned=!1,n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.recoverable!=null&&Object.hasOwnProperty.call(t,"recoverable")&&e.uint32(8).bool(t.recoverable),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(34).string(t.epoch),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(40).uint64(t.offset),t.positioned!=null&&Object.hasOwnProperty.call(t,"positioned")&&e.uint32(48).bool(t.positioned),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(58).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Subscribe;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.recoverable=t.bool();break}case 4:{c.epoch=t.string();break}case 5:{c.offset=t.uint64();break}case 6:{c.positioned=t.bool();break}case 7:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.recoverable!=null&&t.hasOwnProperty("recoverable")&&typeof t.recoverable!="boolean"?"recoverable: boolean expected":t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.positioned!=null&&t.hasOwnProperty("positioned")&&typeof t.positioned!="boolean"?"positioned: boolean expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Subscribe"},n}(),i.Message=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Message;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Message"},n}(),i.Connect=function(){function n(o){if(this.subs={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.client="",n.prototype.version="",n.prototype.data=h.newBuffer([]),n.prototype.subs=h.emptyObject,n.prototype.expires=!1,n.prototype.ttl=0,n.prototype.ping=0,n.prototype.pong=!1,n.prototype.session="",n.prototype.node="",n.prototype.time=h.Long?h.Long.fromBits(0,0,!1):0,n.encode=function(t,e){if(e||(e=b.create()),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(10).string(t.client),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(18).string(t.version),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(26).bytes(t.data),t.subs!=null&&Object.hasOwnProperty.call(t,"subs"))for(let l=Object.keys(t.subs),c=0;c<l.length;++c)e.uint32(34).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subs[l[c]],e.uint32(18).fork()).ldelim().ldelim();return t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(40).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(48).uint32(t.ttl),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&e.uint32(56).uint32(t.ping),t.pong!=null&&Object.hasOwnProperty.call(t,"pong")&&e.uint32(64).bool(t.pong),t.session!=null&&Object.hasOwnProperty.call(t,"session")&&e.uint32(74).string(t.session),t.node!=null&&Object.hasOwnProperty.call(t,"node")&&e.uint32(82).string(t.node),t.time!=null&&Object.hasOwnProperty.call(t,"time")&&e.uint32(88).int64(t.time),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Connect,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.client=t.string();break}case 2:{c.version=t.string();break}case 3:{c.data=t.bytes();break}case 4:{c.subs===h.emptyObject&&(c.subs={});let w=t.uint32()+t.pos;for(u="",p=null;t.pos<w;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[u]=p;break}case 5:{c.expires=t.bool();break}case 6:{c.ttl=t.uint32();break}case 7:{c.ping=t.uint32();break}case 8:{c.pong=t.bool();break}case 9:{c.session=t.string();break}case 10:{c.node=t.string();break}case 11:{c.time=t.int64();break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client))return"client: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version))return"version: string expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!h.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subs[e[l]]);if(c)return"subs."+c}}return t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":t.ping!=null&&t.hasOwnProperty("ping")&&!h.isInteger(t.ping)?"ping: integer expected":t.pong!=null&&t.hasOwnProperty("pong")&&typeof t.pong!="boolean"?"pong: boolean expected":t.session!=null&&t.hasOwnProperty("session")&&!h.isString(t.session)?"session: string expected":t.node!=null&&t.hasOwnProperty("node")&&!h.isString(t.node)?"node: string expected":t.time!=null&&t.hasOwnProperty("time")&&!h.isInteger(t.time)&&!(t.time&&h.isInteger(t.time.low)&&h.isInteger(t.time.high))?"time: integer|Long expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Connect"},n}(),i.Disconnect=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.code=0,n.prototype.reason="",n.prototype.reconnect=!1,n.encode=function(t,e){return e||(e=b.create()),t.code!=null&&Object.hasOwnProperty.call(t,"code")&&e.uint32(8).uint32(t.code),t.reason!=null&&Object.hasOwnProperty.call(t,"reason")&&e.uint32(18).string(t.reason),t.reconnect!=null&&Object.hasOwnProperty.call(t,"reconnect")&&e.uint32(24).bool(t.reconnect),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Disconnect;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.code=t.uint32();break}case 2:{c.reason=t.string();break}case 3:{c.reconnect=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!h.isInteger(t.code)?"code: integer expected":t.reason!=null&&t.hasOwnProperty("reason")&&!h.isString(t.reason)?"reason: string expected":t.reconnect!=null&&t.hasOwnProperty("reconnect")&&typeof t.reconnect!="boolean"?"reconnect: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Disconnect"},n}(),i.Refresh=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.expires=!1,n.prototype.ttl=0,n.encode=function(t,e){return e||(e=b.create()),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(8).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(16).uint32(t.ttl),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.Refresh;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.Refresh"},n}(),i.ConnectRequest=function(){function n(o){if(this.subs={},this.headers={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.token="",n.prototype.data=h.newBuffer([]),n.prototype.subs=h.emptyObject,n.prototype.name="",n.prototype.version="",n.prototype.headers=h.emptyObject,n.encode=function(t,e){if(e||(e=b.create()),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(10).string(t.token),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(18).bytes(t.data),t.subs!=null&&Object.hasOwnProperty.call(t,"subs"))for(let l=Object.keys(t.subs),c=0;c<l.length;++c)e.uint32(26).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.SubscribeRequest.encode(t.subs[l[c]],e.uint32(18).fork()).ldelim().ldelim();if(t.name!=null&&Object.hasOwnProperty.call(t,"name")&&e.uint32(34).string(t.name),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(42).string(t.version),t.headers!=null&&Object.hasOwnProperty.call(t,"headers"))for(let l=Object.keys(t.headers),c=0;c<l.length;++c)e.uint32(50).fork().uint32(10).string(l[c]).uint32(18).string(t.headers[l[c]]).ldelim();return e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.ConnectRequest,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.token=t.string();break}case 2:{c.data=t.bytes();break}case 3:{c.subs===h.emptyObject&&(c.subs={});let w=t.uint32()+t.pos;for(u="",p=null;t.pos<w;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.SubscribeRequest.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[u]=p;break}case 4:{c.name=t.string();break}case 5:{c.version=t.string();break}case 6:{c.headers===h.emptyObject&&(c.headers={});let w=t.uint32()+t.pos;for(u="",p="";t.pos<w;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=t.string();break;default:t.skipType(g&7);break}}c.headers[u]=p;break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token))return"token: string expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!h.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.SubscribeRequest.verify(t.subs[e[l]]);if(c)return"subs."+c}}if(t.name!=null&&t.hasOwnProperty("name")&&!h.isString(t.name))return"name: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version))return"version: string expected";if(t.headers!=null&&t.hasOwnProperty("headers")){if(!h.isObject(t.headers))return"headers: object expected";let e=Object.keys(t.headers);for(let l=0;l<e.length;++l)if(!h.isString(t.headers[e[l]]))return"headers: string{k:string} expected"}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.ConnectRequest"},n}(),i.ConnectResult=function(){function n(o){if(this.subs={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.client="",n.prototype.version="",n.prototype.expires=!1,n.prototype.ttl=0,n.prototype.data=h.newBuffer([]),n.prototype.subs=h.emptyObject,n.prototype.ping=0,n.prototype.pong=!1,n.prototype.session="",n.prototype.node="",n.prototype.time=h.Long?h.Long.fromBits(0,0,!1):0,n.encode=function(t,e){if(e||(e=b.create()),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(10).string(t.client),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(18).string(t.version),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(24).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(32).uint32(t.ttl),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(42).bytes(t.data),t.subs!=null&&Object.hasOwnProperty.call(t,"subs"))for(let l=Object.keys(t.subs),c=0;c<l.length;++c)e.uint32(50).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subs[l[c]],e.uint32(18).fork()).ldelim().ldelim();return t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&e.uint32(56).uint32(t.ping),t.pong!=null&&Object.hasOwnProperty.call(t,"pong")&&e.uint32(64).bool(t.pong),t.session!=null&&Object.hasOwnProperty.call(t,"session")&&e.uint32(74).string(t.session),t.node!=null&&Object.hasOwnProperty.call(t,"node")&&e.uint32(82).string(t.node),t.time!=null&&Object.hasOwnProperty.call(t,"time")&&e.uint32(88).int64(t.time),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.ConnectResult,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.client=t.string();break}case 2:{c.version=t.string();break}case 3:{c.expires=t.bool();break}case 4:{c.ttl=t.uint32();break}case 5:{c.data=t.bytes();break}case 6:{c.subs===h.emptyObject&&(c.subs={});let w=t.uint32()+t.pos;for(u="",p=null;t.pos<w;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[u]=p;break}case 7:{c.ping=t.uint32();break}case 8:{c.pong=t.bool();break}case 9:{c.session=t.string();break}case 10:{c.node=t.string();break}case 11:{c.time=t.int64();break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client))return"client: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version))return"version: string expected";if(t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean")return"expires: boolean expected";if(t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl))return"ttl: integer expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!h.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subs[e[l]]);if(c)return"subs."+c}}return t.ping!=null&&t.hasOwnProperty("ping")&&!h.isInteger(t.ping)?"ping: integer expected":t.pong!=null&&t.hasOwnProperty("pong")&&typeof t.pong!="boolean"?"pong: boolean expected":t.session!=null&&t.hasOwnProperty("session")&&!h.isString(t.session)?"session: string expected":t.node!=null&&t.hasOwnProperty("node")&&!h.isString(t.node)?"node: string expected":t.time!=null&&t.hasOwnProperty("time")&&!h.isInteger(t.time)&&!(t.time&&h.isInteger(t.time.low)&&h.isInteger(t.time.high))?"time: integer|Long expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.ConnectResult"},n}(),i.RefreshRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.token="",n.encode=function(t,e){return e||(e=b.create()),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(10).string(t.token),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RefreshRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.token=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token)?"token: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RefreshRequest"},n}(),i.RefreshResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.client="",n.prototype.version="",n.prototype.expires=!1,n.prototype.ttl=0,n.encode=function(t,e){return e||(e=b.create()),t.client!=null&&Object.hasOwnProperty.call(t,"client")&&e.uint32(10).string(t.client),t.version!=null&&Object.hasOwnProperty.call(t,"version")&&e.uint32(18).string(t.version),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(24).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(32).uint32(t.ttl),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RefreshResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.client=t.string();break}case 2:{c.version=t.string();break}case 3:{c.expires=t.bool();break}case 4:{c.ttl=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.client!=null&&t.hasOwnProperty("client")&&!h.isString(t.client)?"client: string expected":t.version!=null&&t.hasOwnProperty("version")&&!h.isString(t.version)?"version: string expected":t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RefreshResult"},n}(),i.SubscribeRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.token="",n.prototype.recover=!1,n.prototype.epoch="",n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.data=h.newBuffer([]),n.prototype.positioned=!1,n.prototype.recoverable=!1,n.prototype.join_leave=!1,n.prototype.delta="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(18).string(t.token),t.recover!=null&&Object.hasOwnProperty.call(t,"recover")&&e.uint32(24).bool(t.recover),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(50).string(t.epoch),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(56).uint64(t.offset),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(66).bytes(t.data),t.positioned!=null&&Object.hasOwnProperty.call(t,"positioned")&&e.uint32(72).bool(t.positioned),t.recoverable!=null&&Object.hasOwnProperty.call(t,"recoverable")&&e.uint32(80).bool(t.recoverable),t.join_leave!=null&&Object.hasOwnProperty.call(t,"join_leave")&&e.uint32(88).bool(t.join_leave),t.delta!=null&&Object.hasOwnProperty.call(t,"delta")&&e.uint32(98).string(t.delta),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubscribeRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 2:{c.token=t.string();break}case 3:{c.recover=t.bool();break}case 6:{c.epoch=t.string();break}case 7:{c.offset=t.uint64();break}case 8:{c.data=t.bytes();break}case 9:{c.positioned=t.bool();break}case 10:{c.recoverable=t.bool();break}case 11:{c.join_leave=t.bool();break}case 12:{c.delta=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token)?"token: string expected":t.recover!=null&&t.hasOwnProperty("recover")&&typeof t.recover!="boolean"?"recover: boolean expected":t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":t.positioned!=null&&t.hasOwnProperty("positioned")&&typeof t.positioned!="boolean"?"positioned: boolean expected":t.recoverable!=null&&t.hasOwnProperty("recoverable")&&typeof t.recoverable!="boolean"?"recoverable: boolean expected":t.join_leave!=null&&t.hasOwnProperty("join_leave")&&typeof t.join_leave!="boolean"?"join_leave: boolean expected":t.delta!=null&&t.hasOwnProperty("delta")&&!h.isString(t.delta)?"delta: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubscribeRequest"},n}(),i.SubscribeResult=function(){function n(o){if(this.publications=[],o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.expires=!1,n.prototype.ttl=0,n.prototype.recoverable=!1,n.prototype.epoch="",n.prototype.publications=h.emptyArray,n.prototype.recovered=!1,n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.positioned=!1,n.prototype.data=h.newBuffer([]),n.prototype.was_recovering=!1,n.prototype.delta=!1,n.encode=function(t,e){if(e||(e=b.create()),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(8).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(16).uint32(t.ttl),t.recoverable!=null&&Object.hasOwnProperty.call(t,"recoverable")&&e.uint32(24).bool(t.recoverable),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(50).string(t.epoch),t.publications!=null&&t.publications.length)for(let l=0;l<t.publications.length;++l)f.centrifugal.centrifuge.protocol.Publication.encode(t.publications[l],e.uint32(58).fork()).ldelim();return t.recovered!=null&&Object.hasOwnProperty.call(t,"recovered")&&e.uint32(64).bool(t.recovered),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(72).uint64(t.offset),t.positioned!=null&&Object.hasOwnProperty.call(t,"positioned")&&e.uint32(80).bool(t.positioned),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(90).bytes(t.data),t.was_recovering!=null&&Object.hasOwnProperty.call(t,"was_recovering")&&e.uint32(96).bool(t.was_recovering),t.delta!=null&&Object.hasOwnProperty.call(t,"delta")&&e.uint32(104).bool(t.delta),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubscribeResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}case 3:{c.recoverable=t.bool();break}case 6:{c.epoch=t.string();break}case 7:{c.publications&&c.publications.length||(c.publications=[]),c.publications.push(f.centrifugal.centrifuge.protocol.Publication.decode(t,t.uint32()));break}case 8:{c.recovered=t.bool();break}case 9:{c.offset=t.uint64();break}case 10:{c.positioned=t.bool();break}case 11:{c.data=t.bytes();break}case 12:{c.was_recovering=t.bool();break}case 13:{c.delta=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean")return"expires: boolean expected";if(t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl))return"ttl: integer expected";if(t.recoverable!=null&&t.hasOwnProperty("recoverable")&&typeof t.recoverable!="boolean")return"recoverable: boolean expected";if(t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch))return"epoch: string expected";if(t.publications!=null&&t.hasOwnProperty("publications")){if(!Array.isArray(t.publications))return"publications: array expected";for(let e=0;e<t.publications.length;++e){let l=f.centrifugal.centrifuge.protocol.Publication.verify(t.publications[e]);if(l)return"publications."+l}}return t.recovered!=null&&t.hasOwnProperty("recovered")&&typeof t.recovered!="boolean"?"recovered: boolean expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.positioned!=null&&t.hasOwnProperty("positioned")&&typeof t.positioned!="boolean"?"positioned: boolean expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":t.was_recovering!=null&&t.hasOwnProperty("was_recovering")&&typeof t.was_recovering!="boolean"?"was_recovering: boolean expected":t.delta!=null&&t.hasOwnProperty("delta")&&typeof t.delta!="boolean"?"delta: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubscribeResult"},n}(),i.SubRefreshRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.token="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.token!=null&&Object.hasOwnProperty.call(t,"token")&&e.uint32(18).string(t.token),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubRefreshRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 2:{c.token=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":t.token!=null&&t.hasOwnProperty("token")&&!h.isString(t.token)?"token: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubRefreshRequest"},n}(),i.SubRefreshResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.expires=!1,n.prototype.ttl=0,n.encode=function(t,e){return e||(e=b.create()),t.expires!=null&&Object.hasOwnProperty.call(t,"expires")&&e.uint32(8).bool(t.expires),t.ttl!=null&&Object.hasOwnProperty.call(t,"ttl")&&e.uint32(16).uint32(t.ttl),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SubRefreshResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.expires!=null&&t.hasOwnProperty("expires")&&typeof t.expires!="boolean"?"expires: boolean expected":t.ttl!=null&&t.hasOwnProperty("ttl")&&!h.isInteger(t.ttl)?"ttl: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SubRefreshResult"},n}(),i.UnsubscribeRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.UnsubscribeRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.UnsubscribeRequest"},n}(),i.UnsubscribeResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.UnsubscribeResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.UnsubscribeResult"},n}(),i.PublishRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(18).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PublishRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 2:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PublishRequest"},n}(),i.PublishResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PublishResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PublishResult"},n}(),i.PresenceRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceRequest"},n}(),i.PresenceResult=function(){function n(o){if(this.presence={},o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.presence=h.emptyObject,n.encode=function(t,e){if(e||(e=b.create()),t.presence!=null&&Object.hasOwnProperty.call(t,"presence"))for(let l=Object.keys(t.presence),c=0;c<l.length;++c)e.uint32(10).fork().uint32(10).string(l[c]),f.centrifugal.centrifuge.protocol.ClientInfo.encode(t.presence[l[c]],e.uint32(18).fork()).ldelim().ldelim();return e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceResult,u,p;for(;t.pos<l;){let y=t.uint32();switch(y>>>3){case 1:{c.presence===h.emptyObject&&(c.presence={});let w=t.uint32()+t.pos;for(u="",p=null;t.pos<w;){let g=t.uint32();switch(g>>>3){case 1:u=t.string();break;case 2:p=f.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.presence[u]=p;break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.presence!=null&&t.hasOwnProperty("presence")){if(!h.isObject(t.presence))return"presence: object expected";let e=Object.keys(t.presence);for(let l=0;l<e.length;++l){let c=f.centrifugal.centrifuge.protocol.ClientInfo.verify(t.presence[e[l]]);if(c)return"presence."+c}}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceResult"},n}(),i.PresenceStatsRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceStatsRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel)?"channel: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceStatsRequest"},n}(),i.PresenceStatsResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.num_clients=0,n.prototype.num_users=0,n.encode=function(t,e){return e||(e=b.create()),t.num_clients!=null&&Object.hasOwnProperty.call(t,"num_clients")&&e.uint32(8).uint32(t.num_clients),t.num_users!=null&&Object.hasOwnProperty.call(t,"num_users")&&e.uint32(16).uint32(t.num_users),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PresenceStatsResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.num_clients=t.uint32();break}case 2:{c.num_users=t.uint32();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.num_clients!=null&&t.hasOwnProperty("num_clients")&&!h.isInteger(t.num_clients)?"num_clients: integer expected":t.num_users!=null&&t.hasOwnProperty("num_users")&&!h.isInteger(t.num_users)?"num_users: integer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PresenceStatsResult"},n}(),i.StreamPosition=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.prototype.epoch="",n.encode=function(t,e){return e||(e=b.create()),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(8).uint64(t.offset),t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(18).string(t.epoch),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.StreamPosition;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.offset=t.uint64();break}case 2:{c.epoch=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.StreamPosition"},n}(),i.HistoryRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.channel="",n.prototype.limit=0,n.prototype.since=null,n.prototype.reverse=!1,n.encode=function(t,e){return e||(e=b.create()),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(10).string(t.channel),t.limit!=null&&Object.hasOwnProperty.call(t,"limit")&&e.uint32(56).int32(t.limit),t.since!=null&&Object.hasOwnProperty.call(t,"since")&&f.centrifugal.centrifuge.protocol.StreamPosition.encode(t.since,e.uint32(66).fork()).ldelim(),t.reverse!=null&&Object.hasOwnProperty.call(t,"reverse")&&e.uint32(72).bool(t.reverse),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.HistoryRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.channel=t.string();break}case 7:{c.limit=t.int32();break}case 8:{c.since=f.centrifugal.centrifuge.protocol.StreamPosition.decode(t,t.uint32());break}case 9:{c.reverse=t.bool();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.channel!=null&&t.hasOwnProperty("channel")&&!h.isString(t.channel))return"channel: string expected";if(t.limit!=null&&t.hasOwnProperty("limit")&&!h.isInteger(t.limit))return"limit: integer expected";if(t.since!=null&&t.hasOwnProperty("since")){let e=f.centrifugal.centrifuge.protocol.StreamPosition.verify(t.since);if(e)return"since."+e}return t.reverse!=null&&t.hasOwnProperty("reverse")&&typeof t.reverse!="boolean"?"reverse: boolean expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.HistoryRequest"},n}(),i.HistoryResult=function(){function n(o){if(this.publications=[],o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.publications=h.emptyArray,n.prototype.epoch="",n.prototype.offset=h.Long?h.Long.fromBits(0,0,!0):0,n.encode=function(t,e){if(e||(e=b.create()),t.publications!=null&&t.publications.length)for(let l=0;l<t.publications.length;++l)f.centrifugal.centrifuge.protocol.Publication.encode(t.publications[l],e.uint32(10).fork()).ldelim();return t.epoch!=null&&Object.hasOwnProperty.call(t,"epoch")&&e.uint32(18).string(t.epoch),t.offset!=null&&Object.hasOwnProperty.call(t,"offset")&&e.uint32(24).uint64(t.offset),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.HistoryResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.publications&&c.publications.length||(c.publications=[]),c.publications.push(f.centrifugal.centrifuge.protocol.Publication.decode(t,t.uint32()));break}case 2:{c.epoch=t.string();break}case 3:{c.offset=t.uint64();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.publications!=null&&t.hasOwnProperty("publications")){if(!Array.isArray(t.publications))return"publications: array expected";for(let e=0;e<t.publications.length;++e){let l=f.centrifugal.centrifuge.protocol.Publication.verify(t.publications[e]);if(l)return"publications."+l}}return t.epoch!=null&&t.hasOwnProperty("epoch")&&!h.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!h.isInteger(t.offset)&&!(t.offset&&h.isInteger(t.offset.low)&&h.isInteger(t.offset.high))?"offset: integer|Long expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.HistoryResult"},n}(),i.PingRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PingRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PingRequest"},n}(),i.PingResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.encode=function(t,e){return e||(e=b.create()),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.PingResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.PingResult"},n}(),i.RPCRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.prototype.method="",n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),t.method!=null&&Object.hasOwnProperty.call(t,"method")&&e.uint32(18).string(t.method),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RPCRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}case 2:{c.method=t.string();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":t.method!=null&&t.hasOwnProperty("method")&&!h.isString(t.method)?"method: string expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RPCRequest"},n}(),i.RPCResult=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.RPCResult;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.RPCResult"},n}(),i.SendRequest=function(){function n(o){if(o)for(let t=Object.keys(o),e=0;e<t.length;++e)o[t[e]]!=null&&(this[t[e]]=o[t[e]])}return n.prototype.data=h.newBuffer([]),n.encode=function(t,e){return e||(e=b.create()),t.data!=null&&Object.hasOwnProperty.call(t,"data")&&e.uint32(10).bytes(t.data),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof a||(t=a.create(t));let l=e===void 0?t.len:t.pos+e,c=new f.centrifugal.centrifuge.protocol.SendRequest;for(;t.pos<l;){let u=t.uint32();switch(u>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(u&7);break}}return c},n.decodeDelimited=function(t){return t instanceof a||(t=new a(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||h.isString(t.data))?"data: buffer expected":null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.SendRequest"},n}(),i}(),r}(),s})();var Ke=pt.centrifuge.protocol.Command,At=pt.centrifuge.protocol.Reply,mn=pt.centrifuge.protocol.EmulationRequest,dt=class{name(){return"protobuf"}encodeEmulationRequest(r){let i=z.Writer.create();return mn.encode(r,i),i.finish()}encodeCommands(r){let i=z.Writer.create();for(let n of r)i.fork(),Ke.encodeDelimited(n,i);return i.finish()}encodeReplies(r){let i=z.Writer.create();for(let n of r)i.fork(),At.encodeDelimited(n,i);return i.finish()}decodeReplies(r){let i=[],n=z.Reader.create(new Uint8Array(r));for(;n.pos<n.len;){let o=At.decodeDelimited(n);i.push(o)}return i}decodeCommands(r){let i=[],n=z.Reader.create(new Uint8Array(r));for(;n.pos<n.len;){let o=Ke.decodeDelimited(n);i.push(o)}return i}decodeReply(r){let i=z.Reader.create(new Uint8Array(r));for(;i.pos<i.len;)return At.decodeDelimited(i),{ok:!0,pos:i.pos};return{ok:!1}}applyDeltaIfNeeded(r,i){let n,o;if(r.delta){let t=lt(i,r.data);n=new Uint8Array(t),o=t}else n=r.data,o=r.data;return{newData:n,newPrevValue:o}}};var bt=class extends N{_formatOverride(){this._codec=new dt}};globalThis.Centrifuge=bt;})();
|
|
8
8
|
//# sourceMappingURL=centrifuge.protobuf.js.map
|