UNPKG

centrifuge

Version:

JavaScript client SDK for bidirectional communication with Centrifugo and Centrifuge-based server from browser, NodeJS and React Native

9 lines 159 kB
"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=(l,r)=>()=>(r||l((r={exports:{}}).exports,r),r.exports);var en=(l,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Qe(r))!tn.call(l,o)&&o!==i&&Bt(l,o,{get:()=>r[o],enumerable:!(n=Xe(r,o))||n.enumerable});return l};var Q=(l,r,i)=>(i=l!=null?Ze(Ye(l)):{},en(r||!l||!l.__esModule?Bt(i,"default",{value:l,enumerable:!0}):i,l));var gt=P((jn,_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(l){console&&console.warn&&console.warn(l)}var Nt=Number.isNaN||function(r){return r!==r};function v(){v.init.call(this)}_t.exports=v;_t.exports.once=ln;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var Ft=10;function tt(l){if(typeof l!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof l)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return Ft},set:function(l){if(typeof l!="number"||l<0||Nt(l))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+l+".");Ft=l}});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 zt(l){return l._maxListeners===void 0?v.defaultMaxListeners:l._maxListeners}v.prototype.getMaxListeners=function(){return zt(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 u=new Error("Unhandled error."+(e?" ("+e.message+")":""));throw u.context=e,u}var c=t[r];if(c===void 0)return!1;if(typeof c=="function")Ut(c,this,i);else for(var s=c.length,p=$t(c,s),n=0;n<s;++n)Ut(p[n],this,i);return!0};function Mt(l,r,i,n){var o,t,e;if(tt(i),t=l._events,t===void 0?(t=l._events=Object.create(null),l._eventsCount=0):(t.newListener!==void 0&&(l.emit("newListener",r,i.listener?i.listener:i),t=l._events),e=t[r]),e===void 0)e=t[r]=i,++l._eventsCount;else if(typeof e=="function"?e=t[r]=n?[i,e]:[e,i]:n?e.unshift(i):e.push(i),o=zt(l),o>0&&e.length>o&&!e.warned){e.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+e.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=l,u.type=r,u.count=e.length,nn(u)}return l}v.prototype.addListener=function(r,i){return Mt(this,r,i,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(r,i){return Mt(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(l,r,i){var n={fired:!1,wrapFn:void 0,target:l,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,u;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){u=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,u||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(l,r,i){var n=l._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(l,r){return typeof l.listenerCount=="function"?l.listenerCount(r):Jt.call(l,r)};v.prototype.listenerCount=Jt;function Jt(l){var r=this._events;if(r!==void 0){var i=r[l];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(l,r){for(var i=new Array(r),n=0;n<r;++n)i[n]=l[n];return i}function rn(l,r){for(;r+1<l.length;r++)l[r]=l[r+1];l.pop()}function cn(l){for(var r=new Array(l.length),i=0;i<r.length;++i)r[i]=l[i].listener||l[i];return r}function ln(l,r){return new Promise(function(i,n){function o(e){l.removeListener(r,t),n(e)}function t(){typeof l.removeListener=="function"&&l.removeListener("error",o),i([].slice.call(arguments))}Vt(l,r,t,{once:!0}),r!=="error"&&un(l,o,{once:!0})})}function un(l,r,i){typeof l.on=="function"&&Vt(l,"error",r,i)}function Vt(l,r,i,n){if(typeof l.on=="function")n.once?l.once(r,i):l.on(r,i);else if(typeof l.addEventListener=="function")l.addEventListener(r,function o(t){n.once&&l.removeEventListener(r,o),i(t)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof l)}});var te=P((mi,Yt)=>{"use strict";Yt.exports=yn;function yn(l,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(u,c){i[n]=function(p){if(t)if(t=!1,p)c(p);else{for(var y=new Array(arguments.length-1),k=0;k<y.length;)y[k++]=arguments[k];u.apply(null,y)}};try{l.apply(r||null,i)}catch(s){t&&(t=!1,c(s))}})}});var oe=P(ie=>{"use strict";var st=ie;st.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;st.encode=function(r,i,n){for(var o=null,t=[],e=0,u=0,c;i<n;){var s=r[i++];switch(u){case 0:t[e++]=$[s>>2],c=(s&3)<<4,u=1;break;case 1:t[e++]=$[c|s>>4],c=(s&15)<<2,u=2;break;case 2:t[e++]=$[c|s>>6],t[e++]=$[s&63],u=0;break}e>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,t)),e=0)}return u&&(t[e++]=$[c],t[e++]=61,u===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";st.decode=function(r,i,n){for(var o=n,t=0,e,u=0;u<r.length;){var c=r.charCodeAt(u++);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};st.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}});var ce=P((Ei,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((Di,he)=>{"use strict";he.exports=le(le);function le(l){return typeof Float32Array<"u"?(function(){var r=new Float32Array([-0]),i=new Uint8Array(r.buffer),n=i[3]===128;function o(c,s,p){r[0]=c,s[p]=i[0],s[p+1]=i[1],s[p+2]=i[2],s[p+3]=i[3]}function t(c,s,p){r[0]=c,s[p]=i[3],s[p+1]=i[2],s[p+2]=i[1],s[p+3]=i[0]}l.writeFloatLE=n?o:t,l.writeFloatBE=n?t:o;function e(c,s){return i[0]=c[s],i[1]=c[s+1],i[2]=c[s+2],i[3]=c[s+3],r[0]}function u(c,s){return i[3]=c[s],i[2]=c[s+1],i[1]=c[s+2],i[0]=c[s+3],r[0]}l.readFloatLE=n?e:u,l.readFloatBE=n?u:e})():(function(){function r(n,o,t,e){var u=o<0?1:0;if(u&&(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((u<<31|2139095040)>>>0,t,e);else if(o<11754943508222875e-54)n((u<<31|Math.round(o/1401298464324817e-60))>>>0,t,e);else{var c=Math.floor(Math.log(o)/Math.LN2),s=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((u<<31|c+127<<23|s)>>>0,t,e)}}l.writeFloatLE=r.bind(null,ue),l.writeFloatBE=r.bind(null,se);function i(n,o,t){var e=n(o,t),u=(e>>31)*2+1,c=e>>>23&255,s=e&8388607;return c===255?s?NaN:u*(1/0):c===0?u*1401298464324817e-60*s:u*Math.pow(2,c-150)*(s+8388608)}l.readFloatLE=i.bind(null,fe),l.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,s,p){r[0]=c,s[p]=i[0],s[p+1]=i[1],s[p+2]=i[2],s[p+3]=i[3],s[p+4]=i[4],s[p+5]=i[5],s[p+6]=i[6],s[p+7]=i[7]}function t(c,s,p){r[0]=c,s[p]=i[7],s[p+1]=i[6],s[p+2]=i[5],s[p+3]=i[4],s[p+4]=i[3],s[p+5]=i[2],s[p+6]=i[1],s[p+7]=i[0]}l.writeDoubleLE=n?o:t,l.writeDoubleBE=n?t:o;function e(c,s){return i[0]=c[s],i[1]=c[s+1],i[2]=c[s+2],i[3]=c[s+3],i[4]=c[s+4],i[5]=c[s+5],i[6]=c[s+6],i[7]=c[s+7],r[0]}function u(c,s){return i[7]=c[s],i[6]=c[s+1],i[5]=c[s+2],i[4]=c[s+3],i[3]=c[s+4],i[2]=c[s+5],i[1]=c[s+6],i[0]=c[s+7],r[0]}l.readDoubleLE=n?e:u,l.readDoubleBE=n?u:e})():(function(){function r(n,o,t,e,u,c){var s=e<0?1:0;if(s&&(e=-e),e===0)n(0,u,c+o),n(1/e>0?0:2147483648,u,c+t);else if(isNaN(e))n(0,u,c+o),n(2146959360,u,c+t);else if(e>17976931348623157e292)n(0,u,c+o),n((s<<31|2146435072)>>>0,u,c+t);else{var p;if(e<22250738585072014e-324)p=e/5e-324,n(p>>>0,u,c+o),n((s<<31|p/4294967296)>>>0,u,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,u,c+o),n((s<<31|y+1023<<20|p*1048576&1048575)>>>0,u,c+t)}}}l.writeDoubleLE=r.bind(null,ue,0,4),l.writeDoubleBE=r.bind(null,se,4,0);function i(n,o,t,e,u){var c=n(e,u+o),s=n(e,u+t),p=(s>>31)*2+1,y=s>>>20&2047,k=4294967296*(s&1048575)+c;return y===2047?k?NaN:p*(1/0):y===0?p*5e-324*k:p*Math.pow(2,y-1075)*(k+4503599627370496)}l.readDoubleLE=i.bind(null,fe,0,4),l.readDoubleBE=i.bind(null,ae,4,0)})(),l}function ue(l,r,i){r[i]=l&255,r[i+1]=l>>>8&255,r[i+2]=l>>>16&255,r[i+3]=l>>>24}function se(l,r,i){r[i]=l>>>24,r[i+1]=l>>>16&255,r[i+2]=l>>>8&255,r[i+3]=l&255}function fe(l,r){return(l[r]|l[r+1]<<8|l[r+2]<<16|l[r+3]<<24)>>>0}function ae(l,r){return(l[r]<<24|l[r+1]<<16|l[r+2]<<8|l[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(l){}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=[],u=0,c;i<n;)c=r[i++],c<128?e[u++]=c:c>191&&c<224?e[u++]=(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[u++]=55296+(c>>10),e[u++]=56320+(c&1023)):e[u++]=(c&15)<<12|(r[i++]&63)<<6|r[i++]&63,u>8191&&((t||(t=[])).push(String.fromCharCode.apply(String,e)),u=0);return t?(u&&t.push(String.fromCharCode.apply(String,e.slice(0,u))),t.join("")):String.fromCharCode.apply(String,e.slice(0,u))};wt.write=function(r,i,n){for(var o=n,t,e,u=0;u<r.length;++u)t=r.charCodeAt(u),t<128?i[n++]=t:t<2048?(i[n++]=t>>6|192,i[n++]=t&63|128):(t&64512)===55296&&((e=r.charCodeAt(u+1))&64512)===56320?(t=65536+((t&1023)<<10)+(e&1023),++u,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((Li,_e)=>{"use strict";_e.exports=_n;function _n(l,r,i){var n=i||8192,o=n>>>1,t=null,e=n;return function(c){if(c<1||c>o)return l(c);e+c>n&&(t=l(n),e=0);var s=r.call(t,e,e+=c);return e&7&&(e=(e|7)+1),s}}});var Oe=P((Ii,ve)=>{"use strict";ve.exports=x;var K=B();function x(l,r){this.lo=l>>>0,this.hi=r>>>0}var z=x.zero=new x(0,0);z.toNumber=function(){return 0};z.zzEncode=z.zzDecode=function(){return this};z.length=function(){return 1};var gn=x.zeroHash="\0\0\0\0\0\0\0\0";x.fromNumber=function(r){if(r===0)return z;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 x(n,o)};x.from=function(r){if(typeof r=="number")return x.fromNumber(r);if(K.isString(r))if(K.Long)r=K.Long.fromString(r);else return x.fromNumber(parseInt(r,10));return r.low||r.high?new x(r.low>>>0,r.high>>>0):z};x.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};x.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;x.fromHash=function(r){return r===gn?z:new x((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)};x.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)};x.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};x.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};x.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=Oe();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 l=d.inquire("buffer").Buffer;return l.prototype.utf8Write?l: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 ke(l,r,i){for(var n=Object.keys(r),o=0;o<n.length;++o)(l[n[o]]===void 0||!i)&&(l[n[o]]=r[n[o]]);return l}d.merge=ke;d.lcFirst=function(r){return r.charAt(0).toLowerCase()+r.substring(1)};function we(l){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&&ke(this,n)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return l},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 l=d.Buffer;if(!l){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=l.from!==Uint8Array.from&&l.from||function(i,n){return new l(i,n)},d._Buffer_allocUnsafe=l.allocUnsafe||function(i){return new l(i)}}});var Et=P((Ai,Re)=>{"use strict";Re.exports=_;var E=B(),St,at=E.LongBits,Pe=E.base64,Se=E.utf8;function Z(l,r,i){this.fn=l,this.len=r,this.next=void 0,this.val=i}function Rt(){}function vn(l){this.head=l.head,this.tail=l.tail,this.len=l.len,this.next=l.states}function _(){this.len=0,this.head=new Z(Rt,0,0),this.tail=this.head,this.states=null}var xe=function(){return E.Buffer?function(){return(_.create=function(){return new St})()}:function(){return new _}};_.create=xe();_.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 jt(l,r,i){r[i]=l&255}function On(l,r,i){for(;l>127;)r[i++]=l&127|128,l>>>=7;r[i]=l}function mt(l,r){this.len=l,this.next=void 0,this.val=r}mt.prototype=Object.create(Z.prototype);mt.prototype.fn=On;_.prototype.uint32=function(r){return this.len+=(this.tail=this.tail.next=new mt((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(l,r,i){for(;l.hi;)r[i++]=l.lo&127|128,l.lo=(l.lo>>>7|l.hi<<25)>>>0,l.hi>>>=7;for(;l.lo>127;)r[i++]=l.lo&127|128,l.lo=l.lo>>>7;r[i++]=l.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(jt,1,r?1:0)};function xt(l,r,i){r[i]=l&255,r[i+1]=l>>>8&255,r[i+2]=l>>>16&255,r[i+3]=l>>>24}_.prototype.fixed32=function(r){return this._push(xt,4,r>>>0)};_.prototype.sfixed32=_.prototype.fixed32;_.prototype.fixed64=function(r){var i=at.from(r);return this._push(xt,4,i.lo)._push(xt,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 kn=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(jt,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(kn,i,r)};_.prototype.string=function(r){var i=Se.length(r);return i?this.uint32(i)._push(Se.write,i,r):this._push(jt,1,0)};_.prototype.fork=function(){return this.states=new vn(this),this.head=this.tail=new Z(Rt,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(Rt,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(l){St=l,_.create=xe(),St._configure()}});var Te=P((Bi,me)=>{"use strict";me.exports=I;var je=Et();(I.prototype=Object.create(je.prototype)).constructor=I;var U=B();function I(){je.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(l,r,i){l.length<40?U.utf8.write(l,r,i):r.utf8Write?r.utf8Write(l,i):r.write(l,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((Ui,Ie)=>{"use strict";Ie.exports=w;var C=B(),Ct,Ce=C.LongBits,Pn=C.utf8;function L(l,r){return RangeError("index out of range: "+l.pos+" + "+(r||1)+" > "+l.len)}function w(l){this.buf=l,this.pos=0,this.len=l.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 l=new Ce(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(l.lo=(l.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return l;if(l.lo=(l.lo|(this.buf[this.pos]&127)<<28)>>>0,l.hi=(l.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return l;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw L(this);if(l.lo=(l.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return l}return l.lo=(l.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,l}if(this.len-this.pos>4){for(;r<5;++r)if(l.hi=(l.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return l}else for(;r<5;++r){if(this.pos>=this.len)throw L(this);if(l.hi=(l.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return l}throw Error("invalid varint encoding")}w.prototype.bool=function(){return this.uint32()!==0};function ht(l,r){return(l[r-4]|l[r-3]<<8|l[r-2]<<16|l[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(l){switch(l){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(l=this.uint32()&7)!==4;)this.skipType(l);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+l+" at offset "+this.pos)}return this};w._configure=function(l){Ct=l,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((Fi,Be)=>{"use strict";Be.exports=M;var Ae=Lt();(M.prototype=Object.create(Ae.prototype)).constructor=M;var qe=B();function M(l){Ae.call(this,l)}M._configure=function(){qe.Buffer&&(M.prototype._slice=qe.Buffer.prototype.slice)};M.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))};M._configure()});var Ne=P((Ni,Fe)=>{"use strict";Fe.exports=X;var It=B();(X.prototype=Object.create(It.EventEmitter.prototype)).constructor=X;function X(l,r,i){if(typeof l!="function")throw TypeError("rpcImpl must be a function");It.EventEmitter.call(this),this.rpcImpl=l,this.requestDelimited=!!r,this.responseDelimited=!!i}X.prototype.rpcCall=function l(r,i,n,o,t){if(!o)throw TypeError("request must be specified");var e=this;if(!t)return It.asPromise(l,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,s){if(c)return e.emit("error",c,r),t(c);if(s===null){e.end(!0);return}if(!(s instanceof n))try{s=n[e.responseDelimited?"decodeDelimited":"decode"](s)}catch(p){return e.emit("error",p,r),t(p)}return e.emit("data",s,r),t(null,s)})}catch(u){e.emit("error",u,r),setTimeout(function(){t(u)},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 Me=P(ze=>{"use strict";var Sn=ze;Sn.Service=Ne()});var He=P((Mi,We)=>{"use strict";We.exports={}});var Ve=P($e=>{"use strict";var m=$e;m.build="minimal";m.Writer=Et();m.BufferWriter=Te();m.Reader=Lt();m.BufferReader=Ue();m.util=B();m.rpc=Me();m.roots=He();m.configure=Je;function Je(){m.util._configure(),m.Writer._configure(m.BufferWriter),m.Reader._configure(m.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(l,r){return l.lastIndexOf(r,0)===0}function vt(l){return l==null?!1:typeof l=="function"}function Kt(l,r){if(globalThis.console){let i=globalThis.console[l];vt(i)&&i.apply(globalThis.console,r)}}function sn(l,r){return Math.floor(Math.random()*(r-l+1)+l)}function H(l,r,i){l>31&&(l=31);let n=sn(0,Math.min(i,r*Math.pow(2,l)));return Math.min(i,r+n)}function Zt(l){return"error"in l&&l.error!==null}function J(l){return Math.min(l*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._id=0,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,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._tagsFilter=null,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)}setTagsFilter(i){if(i&&this._delta)throw new Error("cannot use delta and tagsFilter together");this._tagsFilter=i}setData(i){this._data=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.id&&(this._id=i.id),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),n.flag=1,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._tagsFilter&&(n.tf=this._tagsFilter),{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}if(i.tagsFilter&&(this._tagsFilter=i.tagsFilter),this._tagsFilter&&this._delta)throw new Error("cannot use delta and tagsFilter together")}}_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 u=e.reply.sub_refresh;i._refreshResponse(u),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 u="",c=0,s=new Uint8Array,p=e.body.getReader();return new r.options.readableStream({start(y){function k(){return p.read().then(({done:g,value:O})=>{if(g){o.dispatchEvent(new Event("close")),y.close();return}try{if(r._protocol==="json")for(u+=r._utf8decoder.decode(O);c<u.length;)if(u[c]===`
`){let R=u.substring(0,c);o.dispatchEvent(new MessageEvent("message",{data:R})),u=u.substring(c+1),c=0}else++c;else{let R=new Uint8Array(s.length+O.length);for(R.set(s),R.set(O,s.length),s=R;;){let j=r.options.decoder.decodeReply(s);if(j.ok){let S=s.slice(0,j.pos);o.dispatchEvent(new MessageEvent("message",{data:S})),s=s.slice(j.pos);continue}break}}}catch(R){o.dispatchEvent(new Event("error",{detail:R})),o.dispatchEvent(new Event("close")),y.close();return}k()}).catch(function(g){o.dispatchEvent(new Event("error",{detail:g})),o.dispatchEvent(new Event("close")),y.close()})}return k()}})}).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},u=this._fetchEventTarget(this,this.endpoint,e);u.addEventListener("open",()=>{i.onOpen()}),u.addEventListener("error",c=>{this._abortController.abort(),i.onError(c)}),u.addEventListener("close",()=>{this._abortController.abort(),i.onClose({code:4,reason:"connection closed"})}),u.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 u=this.options.fetch,c={method:"POST",headers:o,body:t,mode:"cors",credentials:"same-origin"};u(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 u=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)},u._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),u=this.options.fetch,c={method:"POST",headers:t,body:e,mode:"cors",credentials:"same-origin"};u(this.options.emulationEndpoint,c)}};var lt=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:u}=await i.read();if(u.length>0)if(this._protocol==="json")for(n+=this._utf8decoder.decode(u);o<n.length;)if(n[o]===`
`){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+u.length);for(c.set(t),c.set(u,t.length),t=c;;){let s=this.options.decoder.decodeReply(t);if(s.ok){let p=t.slice(0,s.pos);r.dispatchEvent(new MessageEvent("message",{data:p})),t=t.slice(s.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+`
`):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],Ot=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}},kt=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(l){let r=0,i=0,n=0,o=0,t=0,e=l.length;for(;e>=16;)r=r+l[t+0]|0,i=i+l[t+1]|0,n=n+l[t+2]|0,o=o+l[t+3]|0,r=r+l[t+4]|0,i=i+l[t+5]|0,n=n+l[t+6]|0,o=o+l[t+7]|0,r=r+l[t+8]|0,i=i+l[t+9]|0,n=n+l[t+10]|0,o=o+l[t+11]|0,r=r+l[t+12]|0,i=i+l[t+13]|0,n=n+l[t+14]|0,o=o+l[t+15]|0,t+=16,e-=16;for(;e>=4;)r=r+l[t+0]|0,i=i+l[t+1]|0,n=n+l[t+2]|0,o=o+l[t+3]|0,t+=4,e-=4;switch(o=((o+(n<<8)|0)+(i<<16)|0)+(r<<24)|0,e){case 3:o=o+(l[t+2]<<8)|0;case 2:o=o+(l[t+1]<<16)|0;case 1:o=o+(l[t+0]<<24)|0}return o>>>0}function ut(l,r){let i=0,n=new Ot(r),o=l.length,t=r.length,e=n.getInt();if(n.getChar()!==`
`)throw new Error("size integer not terminated by '\\n'");let u=new kt;for(;n.haveBytes();){let c=n.getInt(),s;switch(n.getChar()){case"@":if(s=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(s+c>o)throw new Error("copy extends past end of input");u.putArray(l,s,s+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");u.putArray(n.a,n.pos,n.pos+c),n.pos+=c;break;case";":{let p=u.toByteArray(l);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(`
`)}decodeReplies(r){return r.trim().split(`
`).map(i=>JSON.parse(i))}applyDeltaIfNeeded(r,i){let n,o;if(r.delta){let t=ut(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}async ready(i){switch(this.state){case"disconnected":throw{code:3,message:"client disconnected"};case"connected":return;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}setData(i){this._data=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,u=>u.history),e=[];if(t.publications)for(let u=0;u<t.publications.length;u++)e.push(this._getPublicationContext(i,t.publications[u]));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 u=t[e],c=u.conn_info,s=u.chan_info;c&&(u.connInfo=c),s&&(u.chanInfo=s)}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"&&typeof localStorage.getItem=="function"&&localStorage.getItem("centrifuge.debug"))&&(this._debugEnabled=!0),this._debug("config",this._config),typeof this._endpoint!="string")if(Array.isArray(this._endpoint)){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 O=0;for(;;){if(O>=this._transports.length)throw new Error("no supported transport found");let R=this._transports[this._currentTransportIndex],j=R.transport,S=R.endpoint;if(j==="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++,O++;continue}}else if(j==="webtransport"){if(this._debug("trying webtransport transport"),this._transport=new lt(S,{webtransport:globalThis.WebTransport,decoder:this._codec,encoder:this._codec}),!this._transport.supported()){this._debug("webtransport transport not available"),this._currentTransportIndex++,O++;continue}}else if(j==="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++,O++;continue}}else if(j==="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++,O++;continue}}else if(j==="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++,O++;continue}}else throw new Error("unknown transport "+j);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 u=this,c=this._transport,s=this._nextTransportId();u._debug("id of transport",s);let p=!1,y=[];if(this._transport.emulation()){let O=u._sendConnect(!0);y.push(O)}this._setNetworkEvents();let k=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),u._transportId!=s){u._debug("open callback from non-actual transport"),c.close();return}p=!0,u._debug(c.subName(),"transport open"),!c.emulation()&&(u._transportIsOpen=!0,u._transportWasOpen=!0,u.startBatching(),u._sendConnect(!1),u._sendSubscribeCommands(),u.stopBatching(),u.emit("__centrifuge_debug:connect_frame_sent",{}))},onError:function(O){if(u._transportId!=s){u._debug("error callback from non-actual transport");return}u._debug("transport level error",O)},onClose:function(O){if(g&&(clearTimeout(g),g=null),u._transportId!=s){u._debug("close callback from non-actual transport");return}u._debug(c.subName(),"transport closed"),u._transportClosed=!0,u._transportIsOpen=!1;let R="connection closed",j=!0,S=0;if(O&&"code"in O&&O.code&&(S=O.code),O&&O.reason)try{let yt=JSON.parse(O.reason);R=yt.reason,j=yt.reconnect}catch{R=O.reason,(S>=3500&&S<4e3||S>=4500&&S<5e3)&&(j=!1)}S<3e3?(S===1009?(S=3,R="message size limit exceeded",j=!1):(S=1,R="transport closed"),u._emulation&&!u._transportWasOpen&&(u._currentTransportIndex++,u._currentTransportIndex>=u._transports.length&&(u._triedAllTransports=!0,u._currentTransportIndex=0))):u._transportWasOpen=!0,u._isConnecting()&&!p&&u.emit("error",{type:"transport",error:{code:2,message:"transport closed"},transport:c.name()}),u._reconnecting=!1,u._disconnect(S,R,j)},onMessage:function(O){u._dataReceived(O)}},k),u.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 u=n(e.reply);o(u),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},u=!1;if(o?u=this._setState("connecting"):(u=this._setState("disconnected"),this._rejectPromises({code:3,message:"disconnected"})),this._clearOutgoingRequests(),t==="connecting"&&this._clearReconnectTimeout(),t==="connected"&&this._clearConnectedState(),u&&(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 u=e.reply.refresh;n._refreshResponse(u),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((u,c)=>{this._call(o,!1).then(s=>{u(),s.next&&s.next()},s=>{u(),s.next&&s.next(),t._disconnect(4,"unsubscribe error",!0)})})}_getSub(i,n){if(n&&n>0){for(let t in this._subs)if(this._subs.hasOwnProperty(t)){let e=this._subs[t];if(e._id===n)return e}return null}let o=this._subs[i];return o||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 u={code:i.error.code,message:i.error.message||"",temporary:i.error.temporary||!1};e({error:u,next:n})}else{let e=t.callback;if(!e)return;e({reply:i,next:n})}}_handleJoin(i,n,o){let t=this._getSub(i,o);if(!t&&i){if(this._isServerSub(i)){let e={channel:i,info:this._getJoinLeaveContext(n.info)};this.emit("join",e)}return}t._handleJoin(n)}_handleLeave(i,n,o){let t=this._getSub(i,o);if(!t&&i){if(this._isServerSub(i)){let e={channel:i,info:this._getJoinLeaveContext(n.info)};this.emit("leave",e)}return}t._handleLeave(n)}_handleUnsubscribe(i,n){let o=this._getSub(i,0);if(!o&&i){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,o){let t=this._getSub(i,o);if(!t&&i){if(this._isServerSub(i)){let e=this._getPublicationContext(i,n);this.emit("publication",e),n.offset!==void 0&&(this._serverSubs[i].offset=n.offset)}return}t._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,t=i.id;i.pub?this._handlePublication(o,i.pub,t):i.message?this._handleMessage(i.message):i.join?this._handleJoin(o,i.join,t):i.leave?this._handleLeave(o,i.leave,t):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 F=Q(qt());var q=Q(qt()),h=q.Reader,b=q.Writer,f=q.util,a=q.roots.default||(q.roots.default={}),pt=a.centrifugal=(()=>{let l={};return l.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Error;for(;t.pos<u;){let s=t.uint32();switch(s>>>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(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!f.isInteger(t.code)?"code: integer expected":t.message!=null&&t.hasOwnProperty("message")&&!f.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=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.EmulationRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>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(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.node!=null&&t.hasOwnProperty("node")&&!f.isString(t.node)?"node: string expected":t.session!=null&&t.hasOwnProperty("session")&&!f.isString(t.session)?"session: string expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||f.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")&&a.centrifugal.centrifuge.protocol.ConnectRequest.encode(t.connect,e.uint32(34).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&a.centrifugal.centrifuge.protocol.SubscribeRequest.encode(t.subscribe,e.uint32(42).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&a.centrifugal.centrifuge.protocol.UnsubscribeRequest.encode(t.unsubscribe,e.uint32(50).fork()).ldelim(),t.publish!=null&&Object.hasOwnProperty.call(t,"publish")&&a.centrifugal.centrifuge.protocol.PublishRequest.encode(t.publish,e.uint32(58).fork()).ldelim(),t.presence!=null&&Object.hasOwnProperty.call(t,"presence")&&a.centrifugal.centrifuge.protocol.PresenceRequest.encode(t.presence,e.uint32(66).fork()).ldelim(),t.presence_stats!=null&&Object.hasOwnProperty.call(t,"presence_stats")&&a.centrifugal.centrifuge.protocol.PresenceStatsRequest.encode(t.presence_stats,e.uint32(74).fork()).ldelim(),t.history!=null&&Object.hasOwnProperty.call(t,"history")&&a.centrifugal.centrifuge.protocol.HistoryRequest.encode(t.history,e.uint32(82).fork()).ldelim(),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&a.centrifugal.centrifuge.protocol.PingRequest.encode(t.ping,e.uint32(90).fork()).ldelim(),t.send!=null&&Object.hasOwnProperty.call(t,"send")&&a.centrifugal.centrifuge.protocol.SendRequest.encode(t.send,e.uint32(98).fork()).ldelim(),t.rpc!=null&&Object.hasOwnProperty.call(t,"rpc")&&a.centrifugal.centrifuge.protocol.RPCRequest.encode(t.rpc,e.uint32(106).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&a.centrifugal.centrifuge.protocol.RefreshRequest.encode(t.refresh,e.uint32(114).fork()).ldelim(),t.sub_refresh!=null&&Object.hasOwnProperty.call(t,"sub_refresh")&&a.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Command;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.id=t.uint32();break}case 4:{c.connect=a.centrifugal.centrifuge.protocol.ConnectRequest.decode(t,t.uint32());break}case 5:{c.subscribe=a.centrifugal.centrifuge.protocol.SubscribeRequest.decode(t,t.uint32());break}case 6:{c.unsubscribe=a.centrifugal.centrifuge.protocol.UnsubscribeRequest.decode(t,t.uint32());break}case 7:{c.publish=a.centrifugal.centrifuge.protocol.PublishRequest.decode(t,t.uint32());break}case 8:{c.presence=a.centrifugal.centrifuge.protocol.PresenceRequest.decode(t,t.uint32());break}case 9:{c.presence_stats=a.centrifugal.centrifuge.protocol.PresenceStatsRequest.decode(t,t.uint32());break}case 10:{c.history=a.centrifugal.centrifuge.protocol.HistoryRequest.decode(t,t.uint32());break}case 11:{c.ping=a.centrifugal.centrifuge.protocol.PingRequest.decode(t,t.uint32());break}case 12:{c.send=a.centrifugal.centrifuge.protocol.SendRequest.decode(t,t.uint32());break}case 13:{c.rpc=a.centrifugal.centrifuge.protocol.RPCRequest.decode(t,t.uint32());break}case 14:{c.refresh=a.centrifugal.centrifuge.protocol.RefreshRequest.decode(t,t.uint32());break}case 15:{c.sub_refresh=a.centrifugal.centrifuge.protocol.SubRefreshRequest.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isInteger(t.id))return"id: integer expected";if(t.connect!=null&&t.hasOwnProperty("connect")){let e=a.centrifugal.centrifuge.protocol.ConnectRequest.verify(t.connect);if(e)return"connect."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=a.centrifugal.centrifuge.protocol.SubscribeRequest.verify(t.subscribe);if(e)return"subscribe."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=a.centrifugal.centrifuge.protocol.UnsubscribeRequest.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.publish!=null&&t.hasOwnProperty("publish")){let e=a.centrifugal.centrifuge.protocol.PublishRequest.verify(t.publish);if(e)return"publish."+e}if(t.presence!=null&&t.hasOwnProperty("presence")){let e=a.centrifugal.centrifuge.protocol.PresenceRequest.verify(t.presence);if(e)return"presence."+e}if(t.presence_stats!=null&&t.hasOwnProperty("presence_stats")){let e=a.centrifugal.centrifuge.protocol.PresenceStatsRequest.verify(t.presence_stats);if(e)return"presence_stats."+e}if(t.history!=null&&t.hasOwnProperty("history")){let e=a.centrifugal.centrifuge.protocol.HistoryRequest.verify(t.history);if(e)return"history."+e}if(t.ping!=null&&t.hasOwnProperty("ping")){let e=a.centrifugal.centrifuge.protocol.PingRequest.verify(t.ping);if(e)return"ping."+e}if(t.send!=null&&t.hasOwnProperty("send")){let e=a.centrifugal.centrifuge.protocol.SendRequest.verify(t.send);if(e)return"send."+e}if(t.rpc!=null&&t.hasOwnProperty("rpc")){let e=a.centrifugal.centrifuge.protocol.RPCRequest.verify(t.rpc);if(e)return"rpc."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=a.centrifugal.centrifuge.protocol.RefreshRequest.verify(t.refresh);if(e)return"refresh."+e}if(t.sub_refresh!=null&&t.hasOwnProperty("sub_refresh")){let e=a.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")&&a.centrifugal.centrifuge.protocol.Error.encode(t.error,e.uint32(18).fork()).ldelim(),t.push!=null&&Object.hasOwnProperty.call(t,"push")&&a.centrifugal.centrifuge.protocol.Push.encode(t.push,e.uint32(34).fork()).ldelim(),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&a.centrifugal.centrifuge.protocol.ConnectResult.encode(t.connect,e.uint32(42).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&a.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subscribe,e.uint32(50).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&a.centrifugal.centrifuge.protocol.UnsubscribeResult.encode(t.unsubscribe,e.uint32(58).fork()).ldelim(),t.publish!=null&&Object.hasOwnProperty.call(t,"publish")&&a.centrifugal.centrifuge.protocol.PublishResult.encode(t.publish,e.uint32(66).fork()).ldelim(),t.presence!=null&&Object.hasOwnProperty.call(t,"presence")&&a.centrifugal.centrifuge.protocol.PresenceResult.encode(t.presence,e.uint32(74).fork()).ldelim(),t.presence_stats!=null&&Object.hasOwnProperty.call(t,"presence_stats")&&a.centrifugal.centrifuge.protocol.PresenceStatsResult.encode(t.presence_stats,e.uint32(82).fork()).ldelim(),t.history!=null&&Object.hasOwnProperty.call(t,"history")&&a.centrifugal.centrifuge.protocol.HistoryResult.encode(t.history,e.uint32(90).fork()).ldelim(),t.ping!=null&&Object.hasOwnProperty.call(t,"ping")&&a.centrifugal.centrifuge.protocol.PingResult.encode(t.ping,e.uint32(98).fork()).ldelim(),t.rpc!=null&&Object.hasOwnProperty.call(t,"rpc")&&a.centrifugal.centrifuge.protocol.RPCResult.encode(t.rpc,e.uint32(106).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&a.centrifugal.centrifuge.protocol.RefreshResult.encode(t.refresh,e.uint32(114).fork()).ldelim(),t.sub_refresh!=null&&Object.hasOwnProperty.call(t,"sub_refresh")&&a.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Reply;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.id=t.uint32();break}case 2:{c.error=a.centrifugal.centrifuge.protocol.Error.decode(t,t.uint32());break}case 4:{c.push=a.centrifugal.centrifuge.protocol.Push.decode(t,t.uint32());break}case 5:{c.connect=a.centrifugal.centrifuge.protocol.ConnectResult.decode(t,t.uint32());break}case 6:{c.subscribe=a.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break}case 7:{c.unsubscribe=a.centrifugal.centrifuge.protocol.UnsubscribeResult.decode(t,t.uint32());break}case 8:{c.publish=a.centrifugal.centrifuge.protocol.PublishResult.decode(t,t.uint32());break}case 9:{c.presence=a.centrifugal.centrifuge.protocol.PresenceResult.decode(t,t.uint32());break}case 10:{c.presence_stats=a.centrifugal.centrifuge.protocol.PresenceStatsResult.decode(t,t.uint32());break}case 11:{c.history=a.centrifugal.centrifuge.protocol.HistoryResult.decode(t,t.uint32());break}case 12:{c.ping=a.centrifugal.centrifuge.protocol.PingResult.decode(t,t.uint32());break}case 13:{c.rpc=a.centrifugal.centrifuge.protocol.RPCResult.decode(t,t.uint32());break}case 14:{c.refresh=a.centrifugal.centrifuge.protocol.RefreshResult.decode(t,t.uint32());break}case 15:{c.sub_refresh=a.centrifugal.centrifuge.protocol.SubRefreshResult.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isInteger(t.id))return"id: integer expected";if(t.error!=null&&t.hasOwnProperty("error")){let e=a.centrifugal.centrifuge.protocol.Error.verify(t.error);if(e)return"error."+e}if(t.push!=null&&t.hasOwnProperty("push")){let e=a.centrifugal.centrifuge.protocol.Push.verify(t.push);if(e)return"push."+e}if(t.connect!=null&&t.hasOwnProperty("connect")){let e=a.centrifugal.centrifuge.protocol.ConnectResult.verify(t.connect);if(e)return"connect."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=a.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subscribe);if(e)return"subscribe."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=a.centrifugal.centrifuge.protocol.UnsubscribeResult.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.publish!=null&&t.hasOwnProperty("publish")){let e=a.centrifugal.centrifuge.protocol.PublishResult.verify(t.publish);if(e)return"publish."+e}if(t.presence!=null&&t.hasOwnProperty("presence")){let e=a.centrifugal.centrifuge.protocol.PresenceResult.verify(t.presence);if(e)return"presence."+e}if(t.presence_stats!=null&&t.hasOwnProperty("presence_stats")){let e=a.centrifugal.centrifuge.protocol.PresenceStatsResult.verify(t.presence_stats);if(e)return"presence_stats."+e}if(t.history!=null&&t.hasOwnProperty("history")){let e=a.centrifugal.centrifuge.protocol.HistoryResult.verify(t.history);if(e)return"history."+e}if(t.ping!=null&&t.hasOwnProperty("ping")){let e=a.centrifugal.centrifuge.protocol.PingResult.verify(t.ping);if(e)return"ping."+e}if(t.rpc!=null&&t.hasOwnProperty("rpc")){let e=a.centrifugal.centrifuge.protocol.RPCResult.verify(t.rpc);if(e)return"rpc."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=a.centrifugal.centrifuge.protocol.RefreshResult.verify(t.refresh);if(e)return"refresh."+e}if(t.sub_refresh!=null&&t.hasOwnProperty("sub_refresh")){let e=a.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.id=f.Long?f.Long.fromBits(0,0,!1):0,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.id!=null&&Object.hasOwnProperty.call(t,"id")&&e.uint32(8).int64(t.id),t.channel!=null&&Object.hasOwnProperty.call(t,"channel")&&e.uint32(18).string(t.channel),t.pub!=null&&Object.hasOwnProperty.call(t,"pub")&&a.centrifugal.centrifuge.protocol.Publication.encode(t.pub,e.uint32(34).fork()).ldelim(),t.join!=null&&Object.hasOwnProperty.call(t,"join")&&a.centrifugal.centrifuge.protocol.Join.encode(t.join,e.uint32(42).fork()).ldelim(),t.leave!=null&&Object.hasOwnProperty.call(t,"leave")&&a.centrifugal.centrifuge.protocol.Leave.encode(t.leave,e.uint32(50).fork()).ldelim(),t.unsubscribe!=null&&Object.hasOwnProperty.call(t,"unsubscribe")&&a.centrifugal.centrifuge.protocol.Unsubscribe.encode(t.unsubscribe,e.uint32(58).fork()).ldelim(),t.message!=null&&Object.hasOwnProperty.call(t,"message")&&a.centrifugal.centrifuge.protocol.Message.encode(t.message,e.uint32(66).fork()).ldelim(),t.subscribe!=null&&Object.hasOwnProperty.call(t,"subscribe")&&a.centrifugal.centrifuge.protocol.Subscribe.encode(t.subscribe,e.uint32(74).fork()).ldelim(),t.connect!=null&&Object.hasOwnProperty.call(t,"connect")&&a.centrifugal.centrifuge.protocol.Connect.encode(t.connect,e.uint32(82).fork()).ldelim(),t.disconnect!=null&&Object.hasOwnProperty.call(t,"disconnect")&&a.centrifugal.centrifuge.protocol.Disconnect.encode(t.disconnect,e.uint32(90).fork()).ldelim(),t.refresh!=null&&Object.hasOwnProperty.call(t,"refresh")&&a.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Push;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.id=t.int64();break}case 2:{c.channel=t.string();break}case 4:{c.pub=a.centrifugal.centrifuge.protocol.Publication.decode(t,t.uint32());break}case 5:{c.join=a.centrifugal.centrifuge.protocol.Join.decode(t,t.uint32());break}case 6:{c.leave=a.centrifugal.centrifuge.protocol.Leave.decode(t,t.uint32());break}case 7:{c.unsubscribe=a.centrifugal.centrifuge.protocol.Unsubscribe.decode(t,t.uint32());break}case 8:{c.message=a.centrifugal.centrifuge.protocol.Message.decode(t,t.uint32());break}case 9:{c.subscribe=a.centrifugal.centrifuge.protocol.Subscribe.decode(t,t.uint32());break}case 10:{c.connect=a.centrifugal.centrifuge.protocol.Connect.decode(t,t.uint32());break}case 11:{c.disconnect=a.centrifugal.centrifuge.protocol.Disconnect.decode(t,t.uint32());break}case 12:{c.refresh=a.centrifugal.centrifuge.protocol.Refresh.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isInteger(t.id)&&!(t.id&&f.isInteger(t.id.low)&&f.isInteger(t.id.high)))return"id: integer|Long expected";if(t.channel!=null&&t.hasOwnProperty("channel")&&!f.isString(t.channel))return"channel: string expected";if(t.pub!=null&&t.hasOwnProperty("pub")){let e=a.centrifugal.centrifuge.protocol.Publication.verify(t.pub);if(e)return"pub."+e}if(t.join!=null&&t.hasOwnProperty("join")){let e=a.centrifugal.centrifuge.protocol.Join.verify(t.join);if(e)return"join."+e}if(t.leave!=null&&t.hasOwnProperty("leave")){let e=a.centrifugal.centrifuge.protocol.Leave.verify(t.leave);if(e)return"leave."+e}if(t.unsubscribe!=null&&t.hasOwnProperty("unsubscribe")){let e=a.centrifugal.centrifuge.protocol.Unsubscribe.verify(t.unsubscribe);if(e)return"unsubscribe."+e}if(t.message!=null&&t.hasOwnProperty("message")){let e=a.centrifugal.centrifuge.protocol.Message.verify(t.message);if(e)return"message."+e}if(t.subscribe!=null&&t.hasOwnProperty("subscribe")){let e=a.centrifugal.centrifuge.protocol.Subscribe.verify(t.subscribe);if(e)return"subscribe."+e}if(t.connect!=null&&t.hasOwnProperty("connect")){let e=a.centrifugal.centrifuge.protocol.Connect.verify(t.connect);if(e)return"connect."+e}if(t.disconnect!=null&&t.hasOwnProperty("disconnect")){let e=a.centrifugal.centrifuge.protocol.Disconnect.verify(t.disconnect);if(e)return"disconnect."+e}if(t.refresh!=null&&t.hasOwnProperty("refresh")){let e=a.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=f.newBuffer([]),n.prototype.chan_info=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.ClientInfo;for(;t.pos<u;){let s=t.uint32();switch(s>>>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(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.user!=null&&t.hasOwnProperty("user")&&!f.isString(t.user)?"user: string expected":t.client!=null&&t.hasOwnProperty("client")&&!f.isString(t.client)?"client: string expected":t.conn_info!=null&&t.hasOwnProperty("conn_info")&&!(t.conn_info&&typeof t.conn_info.length=="number"||f.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"||f.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=f.newBuffer([]),n.prototype.info=null,n.prototype.offset=f.Long?f.Long.fromBits(0,0,!0):0,n.prototype.tags=f.emptyObject,n.prototype.delta=!1,n.prototype.time=f.Long?f.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")&&a.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 u=Object.keys(t.tags),c=0;c<u.length;++c)e.uint32(58).fork().uint32(10).string(u[c]).uint32(18).string(t.tags[u[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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Publication,s,p;for(;t.pos<u;){let y=t.uint32();switch(y>>>3){case 4:{c.data=t.bytes();break}case 5:{c.info=a.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}case 6:{c.offset=t.uint64();break}case 7:{c.tags===f.emptyObject&&(c.tags={});let k=t.uint32()+t.pos;for(s="",p="";t.pos<k;){let g=t.uint32();switch(g>>>3){case 1:s=t.string();break;case 2:p=t.string();break;default:t.skipType(g&7);break}}c.tags[s]=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 h||(t=new h(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"||f.isString(t.data)))return"data: buffer expected";if(t.info!=null&&t.hasOwnProperty("info")){let e=a.centrifugal.centrifuge.protocol.ClientInfo.verify(t.info);if(e)return"info."+e}if(t.offset!=null&&t.hasOwnProperty("offset")&&!f.isInteger(t.offset)&&!(t.offset&&f.isInteger(t.offset.low)&&f.isInteger(t.offset.high)))return"offset: integer|Long expected";if(t.tags!=null&&t.hasOwnProperty("tags")){if(!f.isObject(t.tags))return"tags: object expected";let e=Object.keys(t.tags);for(let u=0;u<e.length;++u)if(!f.isString(t.tags[e[u]]))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")&&!f.isInteger(t.time)&&!(t.time&&f.isInteger(t.time.low)&&f.isInteger(t.time.high))?"time: integer|Long expected":t.channel!=null&&t.hasOwnProperty("channel")&&!f.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")&&a.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Join;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.info=a.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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=a.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")&&a.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Leave;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.info=a.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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=a.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Unsubscribe;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 2:{c.code=t.uint32();break}case 3:{c.reason=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!f.isInteger(t.code)?"code: integer expected":t.reason!=null&&t.hasOwnProperty("reason")&&!f.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=f.Long?f.Long.fromBits(0,0,!0):0,n.prototype.positioned=!1,n.prototype.data=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Subscribe;for(;t.pos<u;){let s=t.uint32();switch(s>>>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(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!f.isInteger(t.offset)&&!(t.offset&&f.isInteger(t.offset.low)&&f.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"||f.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=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Message;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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"||f.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=f.newBuffer([]),n.prototype.subs=f.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=f.Long?f.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 u=Object.keys(t.subs),c=0;c<u.length;++c)e.uint32(34).fork().uint32(10).string(u[c]),a.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subs[u[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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Connect,s,p;for(;t.pos<u;){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===f.emptyObject&&(c.subs={});let k=t.uint32()+t.pos;for(s="",p=null;t.pos<k;){let g=t.uint32();switch(g>>>3){case 1:s=t.string();break;case 2:p=a.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[s]=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 h||(t=new h(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")&&!f.isString(t.client))return"client: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!f.isString(t.version))return"version: string expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||f.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!f.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let u=0;u<e.length;++u){let c=a.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subs[e[u]]);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")&&!f.isInteger(t.ttl)?"ttl: integer expected":t.ping!=null&&t.hasOwnProperty("ping")&&!f.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")&&!f.isString(t.session)?"session: string expected":t.node!=null&&t.hasOwnProperty("node")&&!f.isString(t.node)?"node: string expected":t.time!=null&&t.hasOwnProperty("time")&&!f.isInteger(t.time)&&!(t.time&&f.isInteger(t.time.low)&&f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Disconnect;for(;t.pos<u;){let s=t.uint32();switch(s>>>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(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.code!=null&&t.hasOwnProperty("code")&&!f.isInteger(t.code)?"code: integer expected":t.reason!=null&&t.hasOwnProperty("reason")&&!f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.Refresh;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.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=f.newBuffer([]),n.prototype.subs=f.emptyObject,n.prototype.name="",n.prototype.version="",n.prototype.headers=f.emptyObject,n.prototype.flag=f.Long?f.Long.fromBits(0,0,!1):0,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 u=Object.keys(t.subs),c=0;c<u.length;++c)e.uint32(26).fork().uint32(10).string(u[c]),a.centrifugal.centrifuge.protocol.SubscribeRequest.encode(t.subs[u[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 u=Object.keys(t.headers),c=0;c<u.length;++c)e.uint32(50).fork().uint32(10).string(u[c]).uint32(18).string(t.headers[u[c]]).ldelim();return t.flag!=null&&Object.hasOwnProperty.call(t,"flag")&&e.uint32(56).int64(t.flag),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.ConnectRequest,s,p;for(;t.pos<u;){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===f.emptyObject&&(c.subs={});let k=t.uint32()+t.pos;for(s="",p=null;t.pos<k;){let g=t.uint32();switch(g>>>3){case 1:s=t.string();break;case 2:p=a.centrifugal.centrifuge.protocol.SubscribeRequest.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[s]=p;break}case 4:{c.name=t.string();break}case 5:{c.version=t.string();break}case 6:{c.headers===f.emptyObject&&(c.headers={});let k=t.uint32()+t.pos;for(s="",p="";t.pos<k;){let g=t.uint32();switch(g>>>3){case 1:s=t.string();break;case 2:p=t.string();break;default:t.skipType(g&7);break}}c.headers[s]=p;break}case 7:{c.flag=t.int64();break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isString(t.token))return"token: string expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||f.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!f.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let u=0;u<e.length;++u){let c=a.centrifugal.centrifuge.protocol.SubscribeRequest.verify(t.subs[e[u]]);if(c)return"subs."+c}}if(t.name!=null&&t.hasOwnProperty("name")&&!f.isString(t.name))return"name: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!f.isString(t.version))return"version: string expected";if(t.headers!=null&&t.hasOwnProperty("headers")){if(!f.isObject(t.headers))return"headers: object expected";let e=Object.keys(t.headers);for(let u=0;u<e.length;++u)if(!f.isString(t.headers[e[u]]))return"headers: string{k:string} expected"}return t.flag!=null&&t.hasOwnProperty("flag")&&!f.isInteger(t.flag)&&!(t.flag&&f.isInteger(t.flag.low)&&f.isInteger(t.flag.high))?"flag: integer|Long expected":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=f.newBuffer([]),n.prototype.subs=f.emptyObject,n.prototype.ping=0,n.prototype.pong=!1,n.prototype.session="",n.prototype.node="",n.prototype.time=f.Long?f.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 u=Object.keys(t.subs),c=0;c<u.length;++c)e.uint32(50).fork().uint32(10).string(u[c]),a.centrifugal.centrifuge.protocol.SubscribeResult.encode(t.subs[u[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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.ConnectResult,s,p;for(;t.pos<u;){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===f.emptyObject&&(c.subs={});let k=t.uint32()+t.pos;for(s="",p=null;t.pos<k;){let g=t.uint32();switch(g>>>3){case 1:s=t.string();break;case 2:p=a.centrifugal.centrifuge.protocol.SubscribeResult.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.subs[s]=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 h||(t=new h(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")&&!f.isString(t.client))return"client: string expected";if(t.version!=null&&t.hasOwnProperty("version")&&!f.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")&&!f.isInteger(t.ttl))return"ttl: integer expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||f.isString(t.data)))return"data: buffer expected";if(t.subs!=null&&t.hasOwnProperty("subs")){if(!f.isObject(t.subs))return"subs: object expected";let e=Object.keys(t.subs);for(let u=0;u<e.length;++u){let c=a.centrifugal.centrifuge.protocol.SubscribeResult.verify(t.subs[e[u]]);if(c)return"subs."+c}}return t.ping!=null&&t.hasOwnProperty("ping")&&!f.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")&&!f.isString(t.session)?"session: string expected":t.node!=null&&t.hasOwnProperty("node")&&!f.isString(t.node)?"node: string expected":t.time!=null&&t.hasOwnProperty("time")&&!f.isInteger(t.time)&&!(t.time&&f.isInteger(t.time.low)&&f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.RefreshRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.token=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.token!=null&&t.hasOwnProperty("token")&&!f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.RefreshResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>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(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.client!=null&&t.hasOwnProperty("client")&&!f.isString(t.client)?"client: string expected":t.version!=null&&t.hasOwnProperty("version")&&!f.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")&&!f.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=f.Long?f.Long.fromBits(0,0,!0):0,n.prototype.data=f.newBuffer([]),n.prototype.positioned=!1,n.prototype.recoverable=!1,n.prototype.join_leave=!1,n.prototype.delta="",n.prototype.tf=null,n.prototype.flag=f.Long?f.Long.fromBits(0,0,!1):0,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),t.tf!=null&&Object.hasOwnProperty.call(t,"tf")&&a.centrifugal.centrifuge.protocol.FilterNode.encode(t.tf,e.uint32(106).fork()).ldelim(),t.flag!=null&&Object.hasOwnProperty.call(t,"flag")&&e.uint32(112).int64(t.flag),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.SubscribeRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>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}case 13:{c.tf=a.centrifugal.centrifuge.protocol.FilterNode.decode(t,t.uint32());break}case 14:{c.flag=t.int64();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isString(t.channel))return"channel: string expected";if(t.token!=null&&t.hasOwnProperty("token")&&!f.isString(t.token))return"token: string expected";if(t.recover!=null&&t.hasOwnProperty("recover")&&typeof t.recover!="boolean")return"recover: boolean expected";if(t.epoch!=null&&t.hasOwnProperty("epoch")&&!f.isString(t.epoch))return"epoch: string expected";if(t.offset!=null&&t.hasOwnProperty("offset")&&!f.isInteger(t.offset)&&!(t.offset&&f.isInteger(t.offset.low)&&f.isInteger(t.offset.high)))return"offset: integer|Long expected";if(t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||f.isString(t.data)))return"data: buffer expected";if(t.positioned!=null&&t.hasOwnProperty("positioned")&&typeof t.positioned!="boolean")return"positioned: boolean expected";if(t.recoverable!=null&&t.hasOwnProperty("recoverable")&&typeof t.recoverable!="boolean")return"recoverable: boolean expected";if(t.join_leave!=null&&t.hasOwnProperty("join_leave")&&typeof t.join_leave!="boolean")return"join_leave: boolean expected";if(t.delta!=null&&t.hasOwnProperty("delta")&&!f.isString(t.delta))return"delta: string expected";if(t.tf!=null&&t.hasOwnProperty("tf")){let e=a.centrifugal.centrifuge.protocol.FilterNode.verify(t.tf);if(e)return"tf."+e}return t.flag!=null&&t.hasOwnProperty("flag")&&!f.isInteger(t.flag)&&!(t.flag&&f.isInteger(t.flag.low)&&f.isInteger(t.flag.high))?"flag: integer|Long 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=f.emptyArray,n.prototype.recovered=!1,n.prototype.offset=f.Long?f.Long.fromBits(0,0,!0):0,n.prototype.positioned=!1,n.prototype.data=f.newBuffer([]),n.prototype.was_recovering=!1,n.prototype.delta=!1,n.prototype.id=f.Long?f.Long.fromBits(0,0,!1):0,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 u=0;u<t.publications.length;++u)a.centrifugal.centrifuge.protocol.Publication.encode(t.publications[u],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),t.id!=null&&Object.hasOwnProperty.call(t,"id")&&e.uint32(112).int64(t.id),e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.SubscribeResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>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(a.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}case 14:{c.id=t.int64();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.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")&&!f.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 u=a.centrifugal.centrifuge.protocol.Publication.verify(t.publications[e]);if(u)return"publications."+u}}return t.recovered!=null&&t.hasOwnProperty("recovered")&&typeof t.recovered!="boolean"?"recovered: boolean expected":t.offset!=null&&t.hasOwnProperty("offset")&&!f.isInteger(t.offset)&&!(t.offset&&f.isInteger(t.offset.low)&&f.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"||f.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":t.id!=null&&t.hasOwnProperty("id")&&!f.isInteger(t.id)&&!(t.id&&f.isInteger(t.id.low)&&f.isInteger(t.id.high))?"id: integer|Long 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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.SubRefreshRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.channel=t.string();break}case 2:{c.token=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!f.isString(t.channel)?"channel: string expected":t.token!=null&&t.hasOwnProperty("token")&&!f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.SubRefreshResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.expires=t.bool();break}case 2:{c.ttl=t.uint32();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.UnsubscribeRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.channel=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.UnsubscribeResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PublishRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.channel=t.string();break}case 2:{c.data=t.bytes();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!f.isString(t.channel)?"channel: string expected":t.data!=null&&t.hasOwnProperty("data")&&!(t.data&&typeof t.data.length=="number"||f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PublishResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PresenceRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.channel=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!f.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=f.emptyObject,n.encode=function(t,e){if(e||(e=b.create()),t.presence!=null&&Object.hasOwnProperty.call(t,"presence"))for(let u=Object.keys(t.presence),c=0;c<u.length;++c)e.uint32(10).fork().uint32(10).string(u[c]),a.centrifugal.centrifuge.protocol.ClientInfo.encode(t.presence[u[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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PresenceResult,s,p;for(;t.pos<u;){let y=t.uint32();switch(y>>>3){case 1:{c.presence===f.emptyObject&&(c.presence={});let k=t.uint32()+t.pos;for(s="",p=null;t.pos<k;){let g=t.uint32();switch(g>>>3){case 1:s=t.string();break;case 2:p=a.centrifugal.centrifuge.protocol.ClientInfo.decode(t,t.uint32());break;default:t.skipType(g&7);break}}c.presence[s]=p;break}default:t.skipType(y&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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(!f.isObject(t.presence))return"presence: object expected";let e=Object.keys(t.presence);for(let u=0;u<e.length;++u){let c=a.centrifugal.centrifuge.protocol.ClientInfo.verify(t.presence[e[u]]);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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PresenceStatsRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.channel=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.channel!=null&&t.hasOwnProperty("channel")&&!f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PresenceStatsResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.num_clients=t.uint32();break}case 2:{c.num_users=t.uint32();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isInteger(t.num_clients)?"num_clients: integer expected":t.num_users!=null&&t.hasOwnProperty("num_users")&&!f.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=f.Long?f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.StreamPosition;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.offset=t.uint64();break}case 2:{c.epoch=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){return typeof t!="object"||t===null?"object expected":t.offset!=null&&t.hasOwnProperty("offset")&&!f.isInteger(t.offset)&&!(t.offset&&f.isInteger(t.offset.low)&&f.isInteger(t.offset.high))?"offset: integer|Long expected":t.epoch!=null&&t.hasOwnProperty("epoch")&&!f.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")&&a.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.HistoryRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.channel=t.string();break}case 7:{c.limit=t.int32();break}case 8:{c.since=a.centrifugal.centrifuge.protocol.StreamPosition.decode(t,t.uint32());break}case 9:{c.reverse=t.bool();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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")&&!f.isString(t.channel))return"channel: string expected";if(t.limit!=null&&t.hasOwnProperty("limit")&&!f.isInteger(t.limit))return"limit: integer expected";if(t.since!=null&&t.hasOwnProperty("since")){let e=a.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=f.emptyArray,n.prototype.epoch="",n.prototype.offset=f.Long?f.Long.fromBits(0,0,!0):0,n.encode=function(t,e){if(e||(e=b.create()),t.publications!=null&&t.publications.length)for(let u=0;u<t.publications.length;++u)a.centrifugal.centrifuge.protocol.Publication.encode(t.publications[u],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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.HistoryResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.publications&&c.publications.length||(c.publications=[]),c.publications.push(a.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(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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 u=a.centrifugal.centrifuge.protocol.Publication.verify(t.publications[e]);if(u)return"publications."+u}}return t.epoch!=null&&t.hasOwnProperty("epoch")&&!f.isString(t.epoch)?"epoch: string expected":t.offset!=null&&t.hasOwnProperty("offset")&&!f.isInteger(t.offset)&&!(t.offset&&f.isInteger(t.offset.low)&&f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PingRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.PingResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.RPCRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.data=t.bytes();break}case 2:{c.method=t.string();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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"||f.isString(t.data))?"data: buffer expected":t.method!=null&&t.hasOwnProperty("method")&&!f.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=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.RPCResult;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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"||f.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=f.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 h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.SendRequest;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.data=t.bytes();break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(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"||f.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.FilterNode=(function(){function n(o){if(this.vals=[],this.nodes=[],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.op="",n.prototype.key="",n.prototype.cmp="",n.prototype.val="",n.prototype.vals=f.emptyArray,n.prototype.nodes=f.emptyArray,n.encode=function(t,e){if(e||(e=b.create()),t.op!=null&&Object.hasOwnProperty.call(t,"op")&&e.uint32(10).string(t.op),t.key!=null&&Object.hasOwnProperty.call(t,"key")&&e.uint32(18).string(t.key),t.cmp!=null&&Object.hasOwnProperty.call(t,"cmp")&&e.uint32(26).string(t.cmp),t.val!=null&&Object.hasOwnProperty.call(t,"val")&&e.uint32(34).string(t.val),t.vals!=null&&t.vals.length)for(let u=0;u<t.vals.length;++u)e.uint32(42).string(t.vals[u]);if(t.nodes!=null&&t.nodes.length)for(let u=0;u<t.nodes.length;++u)a.centrifugal.centrifuge.protocol.FilterNode.encode(t.nodes[u],e.uint32(50).fork()).ldelim();return e},n.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},n.decode=function(t,e){t instanceof h||(t=h.create(t));let u=e===void 0?t.len:t.pos+e,c=new a.centrifugal.centrifuge.protocol.FilterNode;for(;t.pos<u;){let s=t.uint32();switch(s>>>3){case 1:{c.op=t.string();break}case 2:{c.key=t.string();break}case 3:{c.cmp=t.string();break}case 4:{c.val=t.string();break}case 5:{c.vals&&c.vals.length||(c.vals=[]),c.vals.push(t.string());break}case 6:{c.nodes&&c.nodes.length||(c.nodes=[]),c.nodes.push(a.centrifugal.centrifuge.protocol.FilterNode.decode(t,t.uint32()));break}default:t.skipType(s&7);break}}return c},n.decodeDelimited=function(t){return t instanceof h||(t=new h(t)),this.decode(t,t.uint32())},n.verify=function(t){if(typeof t!="object"||t===null)return"object expected";if(t.op!=null&&t.hasOwnProperty("op")&&!f.isString(t.op))return"op: string expected";if(t.key!=null&&t.hasOwnProperty("key")&&!f.isString(t.key))return"key: string expected";if(t.cmp!=null&&t.hasOwnProperty("cmp")&&!f.isString(t.cmp))return"cmp: string expected";if(t.val!=null&&t.hasOwnProperty("val")&&!f.isString(t.val))return"val: string expected";if(t.vals!=null&&t.hasOwnProperty("vals")){if(!Array.isArray(t.vals))return"vals: array expected";for(let e=0;e<t.vals.length;++e)if(!f.isString(t.vals[e]))return"vals: string[] expected"}if(t.nodes!=null&&t.hasOwnProperty("nodes")){if(!Array.isArray(t.nodes))return"nodes: array expected";for(let e=0;e<t.nodes.length;++e){let u=a.centrifugal.centrifuge.protocol.FilterNode.verify(t.nodes[e]);if(u)return"nodes."+u}}return null},n.getTypeUrl=function(t){return t===void 0&&(t="type.googleapis.com"),t+"/centrifugal.centrifuge.protocol.FilterNode"},n})(),i})(),r})(),l})();var Ke=pt.centrifuge.protocol.Command,At=pt.centrifuge.protocol.Reply,xn=pt.centrifuge.protocol.EmulationRequest,dt=class{name(){return"protobuf"}encodeEmulationRequest(r){let i=F.Writer.create();return xn.encode(r,i),i.finish()}encodeCommands(r){let i=F.Writer.create();for(let n of r)i.fork(),Ke.encodeDelimited(n,i);return i.finish()}encodeReplies(r){let i=F.Writer.create();for(let n of r)i.fork(),At.encodeDelimited(n,i);return i.finish()}decodeReplies(r){let i=[],n=F.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=F.Reader.create(new Uint8Array(r));for(;n.pos<n.len;){let o=Ke.decodeDelimited(n);i.push(o)}return i}decodeReply(r){let i=F.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=ut(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;})();
//# sourceMappingURL=centrifuge.protobuf.js.map