UNPKG

centrifuge

Version:

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

1 lines 205 kB
"use strict";(()=>{var En=Object.create;var de=Object.defineProperty;var Dn=Object.getOwnPropertyDescriptor;var Cn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,Ln=Object.prototype.hasOwnProperty;var zt=(l=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(l,{get:(o,i)=>(typeof require<"u"?require:o)[i]}):l)(function(l){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+l+'" is not supported')});var L=(l,o)=>()=>(o||l((o={exports:{}}).exports,o),o.exports);var Bn=(l,o,i,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of Cn(o))!Ln.call(l,r)&&r!==i&&de(l,r,{get:()=>o[r],enumerable:!(n=Dn(o,r))||n.enumerable});return l};var Pt=(l,o,i)=>(i=l!=null?En(In(l)):{},Bn(o||!l||!l.__esModule?de(i,"default",{value:l,enumerable:!0}):i,l));var Ht=L((ui,Wt)=>{"use strict";var at=typeof Reflect=="object"?Reflect:null,be=at&&typeof at.apply=="function"?at.apply:function(o,i,n){return Function.prototype.apply.call(o,i,n)},wt;at&&typeof at.ownKeys=="function"?wt=at.ownKeys:Object.getOwnPropertySymbols?wt=function(o){return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o))}:wt=function(o){return Object.getOwnPropertyNames(o)};function Mn(l){console&&console.warn&&console.warn(l)}var _e=Number.isNaN||function(o){return o!==o};function T(){T.init.call(this)}Wt.exports=T;Wt.exports.once=Nn;T.EventEmitter=T;T.prototype._events=void 0;T.prototype._eventsCount=0;T.prototype._maxListeners=void 0;var ye=10;function Ot(l){if(typeof l!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof l)}Object.defineProperty(T,"defaultMaxListeners",{enumerable:!0,get:function(){return ye},set:function(l){if(typeof l!="number"||l<0||_e(l))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+l+".");ye=l}});T.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};T.prototype.setMaxListeners=function(o){if(typeof o!="number"||o<0||_e(o))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+o+".");return this._maxListeners=o,this};function ge(l){return l._maxListeners===void 0?T.defaultMaxListeners:l._maxListeners}T.prototype.getMaxListeners=function(){return ge(this)};T.prototype.emit=function(o){for(var i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);var r=o==="error",t=this._events;if(t!==void 0)r=r&&t.error===void 0;else if(!r)return!1;if(r){var e;if(i.length>0&&(e=i[0]),e instanceof Error)throw e;var c=new Error("Unhandled error."+(e?" ("+e.message+")":""));throw c.context=e,c}var s=t[o];if(s===void 0)return!1;if(typeof s=="function")be(s,this,i);else for(var u=s.length,d=we(s,u),n=0;n<u;++n)be(d[n],this,i);return!0};function ve(l,o,i,n){var r,t,e;if(Ot(i),t=l._events,t===void 0?(t=l._events=Object.create(null),l._eventsCount=0):(t.newListener!==void 0&&(l.emit("newListener",o,i.listener?i.listener:i),t=l._events),e=t[o]),e===void 0)e=t[o]=i,++l._eventsCount;else if(typeof e=="function"?e=t[o]=n?[i,e]:[e,i]:n?e.unshift(i):e.push(i),r=ge(l),r>0&&e.length>r&&!e.warned){e.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+e.length+" "+String(o)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=l,c.type=o,c.count=e.length,Mn(c)}return l}T.prototype.addListener=function(o,i){return ve(this,o,i,!1)};T.prototype.on=T.prototype.addListener;T.prototype.prependListener=function(o,i){return ve(this,o,i,!0)};function qn(){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 ke(l,o,i){var n={fired:!1,wrapFn:void 0,target:l,type:o,listener:i},r=qn.bind(n);return r.listener=i,n.wrapFn=r,r}T.prototype.once=function(o,i){return Ot(i),this.on(o,ke(this,o,i)),this};T.prototype.prependOnceListener=function(o,i){return Ot(i),this.prependListener(o,ke(this,o,i)),this};T.prototype.removeListener=function(o,i){var n,r,t,e,c;if(Ot(i),r=this._events,r===void 0)return this;if(n=r[o],n===void 0)return this;if(n===i||n.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete r[o],r.removeListener&&this.emit("removeListener",o,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){c=n[e].listener,t=e;break}if(t<0)return this;t===0?n.shift():An(n,t),n.length===1&&(r[o]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",o,c||i)}return this};T.prototype.off=T.prototype.removeListener;T.prototype.removeAllListeners=function(o){var i,n,r;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[o]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[o]),this;if(arguments.length===0){var t=Object.keys(n),e;for(r=0;r<t.length;++r)e=t[r],e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=n[o],typeof i=="function")this.removeListener(o,i);else if(i!==void 0)for(r=i.length-1;r>=0;r--)this.removeListener(o,i[r]);return this};function Se(l,o,i){var n=l._events;if(n===void 0)return[];var r=n[o];return r===void 0?[]:typeof r=="function"?i?[r.listener||r]:[r]:i?Un(r):we(r,r.length)}T.prototype.listeners=function(o){return Se(this,o,!0)};T.prototype.rawListeners=function(o){return Se(this,o,!1)};T.listenerCount=function(l,o){return typeof l.listenerCount=="function"?l.listenerCount(o):Pe.call(l,o)};T.prototype.listenerCount=Pe;function Pe(l){var o=this._events;if(o!==void 0){var i=o[l];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}T.prototype.eventNames=function(){return this._eventsCount>0?wt(this._events):[]};function we(l,o){for(var i=new Array(o),n=0;n<o;++n)i[n]=l[n];return i}function An(l,o){for(;o+1<l.length;o++)l[o]=l[o+1];l.pop()}function Un(l){for(var o=new Array(l.length),i=0;i<o.length;++i)o[i]=l[i].listener||l[i];return o}function Nn(l,o){return new Promise(function(i,n){function r(e){l.removeListener(o,t),n(e)}function t(){typeof l.removeListener=="function"&&l.removeListener("error",r),i([].slice.call(arguments))}Oe(l,o,t,{once:!0}),o!=="error"&&Fn(l,r,{once:!0})})}function Fn(l,o,i){typeof l.on=="function"&&Oe(l,"error",o,i)}function Oe(l,o,i,n){if(typeof l.on=="function")n.once?l.once(o,i):l.on(o,i);else if(typeof l.addEventListener=="function")l.addEventListener(o,function r(t){n.once&&l.removeEventListener(o,r),i(t)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof l)}});var De=L((mr,Ee)=>{"use strict";Ee.exports=$n;function $n(l,o){for(var i=new Array(arguments.length-1),n=0,r=2,t=!0;r<arguments.length;)i[n++]=arguments[r++];return new Promise(function(c,s){i[n]=function(d){if(t)if(t=!1,d)s(d);else{for(var g=new Array(arguments.length-1),k=0;k<g.length;)g[k++]=arguments[k];c.apply(null,g)}};try{l.apply(o||null,i)}catch(u){t&&(t=!1,s(u))}})}});var Be=L(Le=>{"use strict";var Lt=Le;Lt.length=function(o){var i=o.length;if(!i)return 0;for(var n=0;--i%4>1&&o.charAt(i)==="=";)++n;return Math.ceil(o.length*3)/4-n};var pt=new Array(64),Ie=new Array(123);for(K=0;K<64;)Ie[pt[K]=K<26?K+65:K<52?K+71:K<62?K-4:K-59|43]=K++;var K;Lt.encode=function(o,i,n){for(var r=null,t=[],e=0,c=0,s;i<n;){var u=o[i++];switch(c){case 0:t[e++]=pt[u>>2],s=(u&3)<<4,c=1;break;case 1:t[e++]=pt[s|u>>4],s=(u&15)<<2,c=2;break;case 2:t[e++]=pt[s|u>>6],t[e++]=pt[u&63],c=0;break}e>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,t)),e=0)}return c&&(t[e++]=pt[s],t[e++]=61,c===1&&(t[e++]=61)),r?(e&&r.push(String.fromCharCode.apply(String,t.slice(0,e))),r.join("")):String.fromCharCode.apply(String,t.slice(0,e))};var Ce="invalid encoding";Lt.decode=function(o,i,n){for(var r=n,t=0,e,c=0;c<o.length;){var s=o.charCodeAt(c++);if(s===61&&t>1)break;if((s=Ie[s])===void 0)throw Error(Ce);switch(t){case 0:e=s,t=1;break;case 1:i[n++]=e<<2|(s&48)>>4,e=s,t=2;break;case 2:i[n++]=(e&15)<<4|(s&60)>>2,e=s,t=3;break;case 3:i[n++]=(e&3)<<6|s,t=0;break}}if(t===1)throw Error(Ce);return n-r};Lt.test=function(o){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o)}});var qe=L((Tr,Me)=>{"use strict";Me.exports=Bt;function Bt(){this._listeners={}}Bt.prototype.on=function(o,i,n){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:i,ctx:n||this}),this};Bt.prototype.off=function(o,i){if(o===void 0)this._listeners={};else if(i===void 0)this._listeners[o]=[];else for(var n=this._listeners[o],r=0;r<n.length;)n[r].fn===i?n.splice(r,1):++r;return this};Bt.prototype.emit=function(o){var i=this._listeners[o];if(i){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<i.length;)i[r].fn.apply(i[r++].ctx,n)}return this}});var He=L((Rr,We)=>{"use strict";We.exports=Ae(Ae);function Ae(l){return typeof Float32Array<"u"?(function(){var o=new Float32Array([-0]),i=new Uint8Array(o.buffer),n=i[3]===128;function r(s,u,d){o[0]=s,u[d]=i[0],u[d+1]=i[1],u[d+2]=i[2],u[d+3]=i[3]}function t(s,u,d){o[0]=s,u[d]=i[3],u[d+1]=i[2],u[d+2]=i[1],u[d+3]=i[0]}l.writeFloatLE=n?r:t,l.writeFloatBE=n?t:r;function e(s,u){return i[0]=s[u],i[1]=s[u+1],i[2]=s[u+2],i[3]=s[u+3],o[0]}function c(s,u){return i[3]=s[u],i[2]=s[u+1],i[1]=s[u+2],i[0]=s[u+3],o[0]}l.readFloatLE=n?e:c,l.readFloatBE=n?c:e})():(function(){function o(n,r,t,e){var c=r<0?1:0;if(c&&(r=-r),r===0)n(1/r>0?0:2147483648,t,e);else if(isNaN(r))n(2143289344,t,e);else if(r>34028234663852886e22)n((c<<31|2139095040)>>>0,t,e);else if(r<11754943508222875e-54)n((c<<31|Math.round(r/1401298464324817e-60))>>>0,t,e);else{var s=Math.floor(Math.log(r)/Math.LN2),u=Math.round(r*Math.pow(2,-s)*8388608)&8388607;n((c<<31|s+127<<23|u)>>>0,t,e)}}l.writeFloatLE=o.bind(null,Ue),l.writeFloatBE=o.bind(null,Ne);function i(n,r,t){var e=n(r,t),c=(e>>31)*2+1,s=e>>>23&255,u=e&8388607;return s===255?u?NaN:c*(1/0):s===0?c*1401298464324817e-60*u:c*Math.pow(2,s-150)*(u+8388608)}l.readFloatLE=i.bind(null,Fe),l.readFloatBE=i.bind(null,ze)})(),typeof Float64Array<"u"?(function(){var o=new Float64Array([-0]),i=new Uint8Array(o.buffer),n=i[7]===128;function r(s,u,d){o[0]=s,u[d]=i[0],u[d+1]=i[1],u[d+2]=i[2],u[d+3]=i[3],u[d+4]=i[4],u[d+5]=i[5],u[d+6]=i[6],u[d+7]=i[7]}function t(s,u,d){o[0]=s,u[d]=i[7],u[d+1]=i[6],u[d+2]=i[5],u[d+3]=i[4],u[d+4]=i[3],u[d+5]=i[2],u[d+6]=i[1],u[d+7]=i[0]}l.writeDoubleLE=n?r:t,l.writeDoubleBE=n?t:r;function e(s,u){return i[0]=s[u],i[1]=s[u+1],i[2]=s[u+2],i[3]=s[u+3],i[4]=s[u+4],i[5]=s[u+5],i[6]=s[u+6],i[7]=s[u+7],o[0]}function c(s,u){return i[7]=s[u],i[6]=s[u+1],i[5]=s[u+2],i[4]=s[u+3],i[3]=s[u+4],i[2]=s[u+5],i[1]=s[u+6],i[0]=s[u+7],o[0]}l.readDoubleLE=n?e:c,l.readDoubleBE=n?c:e})():(function(){function o(n,r,t,e,c,s){var u=e<0?1:0;if(u&&(e=-e),e===0)n(0,c,s+r),n(1/e>0?0:2147483648,c,s+t);else if(isNaN(e))n(0,c,s+r),n(2146959360,c,s+t);else if(e>17976931348623157e292)n(0,c,s+r),n((u<<31|2146435072)>>>0,c,s+t);else{var d;if(e<22250738585072014e-324)d=e/5e-324,n(d>>>0,c,s+r),n((u<<31|d/4294967296)>>>0,c,s+t);else{var g=Math.floor(Math.log(e)/Math.LN2);g===1024&&(g=1023),d=e*Math.pow(2,-g),n(d*4503599627370496>>>0,c,s+r),n((u<<31|g+1023<<20|d*1048576&1048575)>>>0,c,s+t)}}}l.writeDoubleLE=o.bind(null,Ue,0,4),l.writeDoubleBE=o.bind(null,Ne,4,0);function i(n,r,t,e,c){var s=n(e,c+r),u=n(e,c+t),d=(u>>31)*2+1,g=u>>>20&2047,k=4294967296*(u&1048575)+s;return g===2047?k?NaN:d*(1/0):g===0?d*5e-324*k:d*Math.pow(2,g-1075)*(k+4503599627370496)}l.readDoubleLE=i.bind(null,Fe,0,4),l.readDoubleBE=i.bind(null,ze,4,0)})(),l}function Ue(l,o,i){o[i]=l&255,o[i+1]=l>>>8&255,o[i+2]=l>>>16&255,o[i+3]=l>>>24}function Ne(l,o,i){o[i]=l>>>24,o[i+1]=l>>>16&255,o[i+2]=l>>>8&255,o[i+3]=l&255}function Fe(l,o){return(l[o]|l[o+1]<<8|l[o+2]<<16|l[o+3]<<24)>>>0}function ze(l,o){return(l[o]<<24|l[o+1]<<16|l[o+2]<<8|l[o+3])>>>0}});var Ge=L((jr,Ve)=>{"use strict";Ve.exports=Xn;function Xn(l){try{if(typeof zt!="function")return null;var o=zt(l);return o&&(o.length||Object.keys(o).length)?o:null}catch{return null}}});var Ze=L(Je=>{"use strict";var Kt=Je,Zt="\uFFFD";Kt.length=function(o){for(var i=0,n=0,r=0;r<o.length;++r)n=o.charCodeAt(r),n<128?i+=1:n<2048?i+=2:(n&64512)===55296&&(o.charCodeAt(r+1)&64512)===56320?(++r,i+=4):i+=3;return i};Kt.read=function(o,i,n){if(n-i<1)return"";for(var r="",t=i;t<n;){var e=o[t++];if(e<=127)r+=String.fromCharCode(e);else if(e>=192&&e<224){var c=(e&31)<<6|o[t++]&63;r+=c>=128?String.fromCharCode(c):Zt}else if(e>=224&&e<240){var s=(e&15)<<12|(o[t++]&63)<<6|o[t++]&63;r+=s>=2048?String.fromCharCode(s):Zt}else if(e>=240){var u=(e&7)<<18|(o[t++]&63)<<12|(o[t++]&63)<<6|o[t++]&63;u<65536||u>1114111?r+=Zt:(u-=65536,r+=String.fromCharCode(55296+(u>>10)),r+=String.fromCharCode(56320+(u&1023)))}}return r};Kt.write=function(o,i,n){for(var r=n,t,e,c=0;c<o.length;++c)t=o.charCodeAt(c),t<128?i[n++]=t:t<2048?(i[n++]=t>>6|192,i[n++]=t&63|128):(t&64512)===55296&&((e=o.charCodeAt(c+1))&64512)===56320?(t=65536+((t&1023)<<10)+(e&1023),++c,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-r}});var $e=L((Cr,Ke)=>{"use strict";Ke.exports=Qn;function Qn(l,o,i){var n=i||8192,r=n>>>1,t=null,e=n;return function(s){if(s<1||s>r)return l(s);e+s>n&&(t=l(n),e=0);var u=o.call(t,e,e+=s);return e&7&&(e=(e|7)+1),u}}});var Qe=L((Ir,Xe)=>{"use strict";Xe.exports=q;var _t=nt();function q(l,o){this.lo=l>>>0,this.hi=o>>>0}var ct=q.zero=new q(0,0);ct.toNumber=function(){return 0};ct.zzEncode=ct.zzDecode=function(){return this};ct.length=function(){return 1};var Yn=q.zeroHash="\0\0\0\0\0\0\0\0";q.fromNumber=function(o){if(o===0)return ct;var i=o<0;i&&(o=-o);var n=o>>>0,r=(o-n)/4294967296>>>0;return i&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new q(n,r)};q.from=function(o){if(typeof o=="number")return q.fromNumber(o);if(_t.isString(o))if(_t.Long)o=_t.Long.fromString(o);else return q.fromNumber(parseInt(o,10));return o.low||o.high?new q(o.low>>>0,o.high>>>0):ct};q.prototype.toNumber=function(o){if(!o&&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};q.prototype.toLong=function(o){return _t.Long?new _t.Long(this.lo|0,this.hi|0,!!o):{low:this.lo|0,high:this.hi|0,unsigned:!!o}};var et=String.prototype.charCodeAt;q.fromHash=function(o){return o===Yn?ct:new q((et.call(o,0)|et.call(o,1)<<8|et.call(o,2)<<16|et.call(o,3)<<24)>>>0,(et.call(o,4)|et.call(o,5)<<8|et.call(o,6)<<16|et.call(o,7)<<24)>>>0)};q.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)};q.prototype.zzEncode=function(){var o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this};q.prototype.zzDecode=function(){var o=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this};q.prototype.length=function(){var o=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?i===0?o<16384?o<128?1:2:o<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}});var Ye=L((gt,$t)=>{(function(l,o){function i(n){return n.default||n}typeof define=="function"&&define.amd?define([],function(){var n={};return o(n),i(n)}):typeof gt=="object"?(o(gt),typeof $t=="object"&&($t.exports=i(gt))):(function(){var n={};o(n),l.Long=i(n)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:gt,function(l){"use strict";Object.defineProperty(l,"__esModule",{value:!0}),l.default=void 0;var o=null;try{o=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function i(b,f,_){this.low=b|0,this.high=f|0,this.unsigned=!!_}i.prototype.__isLong__,Object.defineProperty(i.prototype,"__isLong__",{value:!0});function n(b){return(b&&b.__isLong__)===!0}function r(b){var f=Math.clz32(b&-b);return b?31-f:f}i.isLong=n;var t={},e={};function c(b,f){var _,O,j;return f?(b>>>=0,(j=0<=b&&b<256)&&(O=e[b],O)?O:(_=u(b,0,!0),j&&(e[b]=_),_)):(b|=0,(j=-128<=b&&b<128)&&(O=t[b],O)?O:(_=u(b,b<0?-1:0,!1),j&&(t[b]=_),_))}i.fromInt=c;function s(b,f){if(isNaN(b))return f?Q:Z;if(f){if(b<0)return Q;if(b>=D)return pe}else{if(b<=-C)return U;if(b+1>=C)return he}return b<0?s(-b,f).neg():u(b%w|0,b/w|0,f)}i.fromNumber=s;function u(b,f,_){return new i(b,f,_)}i.fromBits=u;var d=Math.pow;function g(b,f,_){if(b.length===0)throw Error("empty string");if(typeof f=="number"?(_=f,f=!1):f=!!f,b==="NaN"||b==="Infinity"||b==="+Infinity"||b==="-Infinity")return f?Q:Z;if(_=_||10,_<2||36<_)throw RangeError("radix");var O;if((O=b.indexOf("-"))>0)throw Error("interior hyphen");if(O===0)return g(b.substring(1),f,_).neg();for(var j=s(d(_,8)),R=Z,B=0;B<b.length;B+=8){var N=Math.min(8,b.length-B),W=parseInt(b.substring(B,B+N),_);if(N<8){var A=s(d(_,N));R=R.mul(A).add(s(W))}else R=R.mul(j),R=R.add(s(W))}return R.unsigned=f,R}i.fromString=g;function k(b,f){return typeof b=="number"?s(b,f):typeof b=="string"?g(b,f):u(b.low,b.high,typeof f=="boolean"?f:b.unsigned)}i.fromValue=k;var P=65536,x=1<<24,w=P*P,D=w*w,C=D/2,ut=c(x),Z=c(0);i.ZERO=Z;var Q=c(0,!0);i.UZERO=Q;var ft=c(1);i.ONE=ft;var ae=c(1,!0);i.UONE=ae;var Ft=c(-1);i.NEG_ONE=Ft;var he=u(-1,2147483647,!1);i.MAX_VALUE=he;var pe=u(-1,-1,!0);i.MAX_UNSIGNED_VALUE=pe;var U=u(0,-2147483648,!1);i.MIN_VALUE=U;var y=i.prototype;y.toInt=function(){return this.unsigned?this.low>>>0:this.low},y.toNumber=function(){return this.unsigned?(this.high>>>0)*w+(this.low>>>0):this.high*w+(this.low>>>0)},y.toString=function(f){if(f=f||10,f<2||36<f)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(U)){var _=s(f),O=this.div(_),j=O.mul(_).sub(this);return O.toString(f)+j.toInt().toString(f)}else return"-"+this.neg().toString(f);for(var R=s(d(f,6),this.unsigned),B=this,N="";;){var W=B.div(R),A=B.sub(W.mul(R)).toInt()>>>0,I=A.toString(f);if(B=W,B.isZero())return I+N;for(;I.length<6;)I="0"+I;N=""+I+N}},y.getHighBits=function(){return this.high},y.getHighBitsUnsigned=function(){return this.high>>>0},y.getLowBits=function(){return this.low},y.getLowBitsUnsigned=function(){return this.low>>>0},y.getNumBitsAbs=function(){if(this.isNegative())return this.eq(U)?64:this.neg().getNumBitsAbs();for(var f=this.high!=0?this.high:this.low,_=31;_>0&&(f&1<<_)==0;_--);return this.high!=0?_+33:_+1},y.isSafeInteger=function(){var f=this.high>>21;return f?this.unsigned?!1:f===-1&&!(this.low===0&&this.high===-2097152):!0},y.isZero=function(){return this.high===0&&this.low===0},y.eqz=y.isZero,y.isNegative=function(){return!this.unsigned&&this.high<0},y.isPositive=function(){return this.unsigned||this.high>=0},y.isOdd=function(){return(this.low&1)===1},y.isEven=function(){return(this.low&1)===0},y.equals=function(f){return n(f)||(f=k(f)),this.unsigned!==f.unsigned&&this.high>>>31===1&&f.high>>>31===1?!1:this.high===f.high&&this.low===f.low},y.eq=y.equals,y.notEquals=function(f){return!this.eq(f)},y.neq=y.notEquals,y.ne=y.notEquals,y.lessThan=function(f){return this.comp(f)<0},y.lt=y.lessThan,y.lessThanOrEqual=function(f){return this.comp(f)<=0},y.lte=y.lessThanOrEqual,y.le=y.lessThanOrEqual,y.greaterThan=function(f){return this.comp(f)>0},y.gt=y.greaterThan,y.greaterThanOrEqual=function(f){return this.comp(f)>=0},y.gte=y.greaterThanOrEqual,y.ge=y.greaterThanOrEqual,y.compare=function(f){if(n(f)||(f=k(f)),this.eq(f))return 0;var _=this.isNegative(),O=f.isNegative();return _&&!O?-1:!_&&O?1:this.unsigned?f.high>>>0>this.high>>>0||f.high===this.high&&f.low>>>0>this.low>>>0?-1:1:this.sub(f).isNegative()?-1:1},y.comp=y.compare,y.negate=function(){return!this.unsigned&&this.eq(U)?U:this.not().add(ft)},y.neg=y.negate,y.add=function(f){n(f)||(f=k(f));var _=this.high>>>16,O=this.high&65535,j=this.low>>>16,R=this.low&65535,B=f.high>>>16,N=f.high&65535,W=f.low>>>16,A=f.low&65535,I=0,H=0,M=0,z=0;return z+=R+A,M+=z>>>16,z&=65535,M+=j+W,H+=M>>>16,M&=65535,H+=O+N,I+=H>>>16,H&=65535,I+=_+B,I&=65535,u(M<<16|z,I<<16|H,this.unsigned)},y.subtract=function(f){return n(f)||(f=k(f)),this.add(f.neg())},y.sub=y.subtract,y.multiply=function(f){if(this.isZero())return this;if(n(f)||(f=k(f)),o){var _=o.mul(this.low,this.high,f.low,f.high);return u(_,o.get_high(),this.unsigned)}if(f.isZero())return this.unsigned?Q:Z;if(this.eq(U))return f.isOdd()?U:Z;if(f.eq(U))return this.isOdd()?U:Z;if(this.isNegative())return f.isNegative()?this.neg().mul(f.neg()):this.neg().mul(f).neg();if(f.isNegative())return this.mul(f.neg()).neg();if(this.lt(ut)&&f.lt(ut))return s(this.toNumber()*f.toNumber(),this.unsigned);var O=this.high>>>16,j=this.high&65535,R=this.low>>>16,B=this.low&65535,N=f.high>>>16,W=f.high&65535,A=f.low>>>16,I=f.low&65535,H=0,M=0,z=0,St=0;return St+=B*I,z+=St>>>16,St&=65535,z+=R*I,M+=z>>>16,z&=65535,z+=B*A,M+=z>>>16,z&=65535,M+=j*I,H+=M>>>16,M&=65535,M+=R*A,H+=M>>>16,M&=65535,M+=B*W,H+=M>>>16,M&=65535,H+=O*I+j*A+R*W+B*N,H&=65535,u(z<<16|St,H<<16|M,this.unsigned)},y.mul=y.multiply,y.divide=function(f){if(n(f)||(f=k(f)),f.isZero())throw Error("division by zero");if(o){if(!this.unsigned&&this.high===-2147483648&&f.low===-1&&f.high===-1)return this;var _=(this.unsigned?o.div_u:o.div_s)(this.low,this.high,f.low,f.high);return u(_,o.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?Q:Z;var O,j,R;if(this.unsigned){if(f.unsigned||(f=f.toUnsigned()),f.gt(this))return Q;if(f.gt(this.shru(1)))return ae;R=Q}else{if(this.eq(U)){if(f.eq(ft)||f.eq(Ft))return U;if(f.eq(U))return ft;var B=this.shr(1);return O=B.div(f).shl(1),O.eq(Z)?f.isNegative()?ft:Ft:(j=this.sub(f.mul(O)),R=O.add(j.div(f)),R)}else if(f.eq(U))return this.unsigned?Q:Z;if(this.isNegative())return f.isNegative()?this.neg().div(f.neg()):this.neg().div(f).neg();if(f.isNegative())return this.div(f.neg()).neg();R=Z}for(j=this;j.gte(f);){O=Math.max(1,Math.floor(j.toNumber()/f.toNumber()));for(var N=Math.ceil(Math.log(O)/Math.LN2),W=N<=48?1:d(2,N-48),A=s(O),I=A.mul(f);I.isNegative()||I.gt(j);)O-=W,A=s(O,this.unsigned),I=A.mul(f);A.isZero()&&(A=ft),R=R.add(A),j=j.sub(I)}return R},y.div=y.divide,y.modulo=function(f){if(n(f)||(f=k(f)),o){var _=(this.unsigned?o.rem_u:o.rem_s)(this.low,this.high,f.low,f.high);return u(_,o.get_high(),this.unsigned)}return this.sub(this.div(f).mul(f))},y.mod=y.modulo,y.rem=y.modulo,y.not=function(){return u(~this.low,~this.high,this.unsigned)},y.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},y.clz=y.countLeadingZeros,y.countTrailingZeros=function(){return this.low?r(this.low):r(this.high)+32},y.ctz=y.countTrailingZeros,y.and=function(f){return n(f)||(f=k(f)),u(this.low&f.low,this.high&f.high,this.unsigned)},y.or=function(f){return n(f)||(f=k(f)),u(this.low|f.low,this.high|f.high,this.unsigned)},y.xor=function(f){return n(f)||(f=k(f)),u(this.low^f.low,this.high^f.high,this.unsigned)},y.shiftLeft=function(f){return n(f)&&(f=f.toInt()),(f&=63)===0?this:f<32?u(this.low<<f,this.high<<f|this.low>>>32-f,this.unsigned):u(0,this.low<<f-32,this.unsigned)},y.shl=y.shiftLeft,y.shiftRight=function(f){return n(f)&&(f=f.toInt()),(f&=63)===0?this:f<32?u(this.low>>>f|this.high<<32-f,this.high>>f,this.unsigned):u(this.high>>f-32,this.high>=0?0:-1,this.unsigned)},y.shr=y.shiftRight,y.shiftRightUnsigned=function(f){return n(f)&&(f=f.toInt()),(f&=63)===0?this:f<32?u(this.low>>>f|this.high<<32-f,this.high>>>f,this.unsigned):f===32?u(this.high,0,this.unsigned):u(this.high>>>f-32,0,this.unsigned)},y.shru=y.shiftRightUnsigned,y.shr_u=y.shiftRightUnsigned,y.rotateLeft=function(f){var _;return n(f)&&(f=f.toInt()),(f&=63)===0?this:f===32?u(this.high,this.low,this.unsigned):f<32?(_=32-f,u(this.low<<f|this.high>>>_,this.high<<f|this.low>>>_,this.unsigned)):(f-=32,_=32-f,u(this.high<<f|this.low>>>_,this.low<<f|this.high>>>_,this.unsigned))},y.rotl=y.rotateLeft,y.rotateRight=function(f){var _;return n(f)&&(f=f.toInt()),(f&=63)===0?this:f===32?u(this.high,this.low,this.unsigned):f<32?(_=32-f,u(this.high<<_|this.low>>>f,this.low<<_|this.high>>>f,this.unsigned)):(f-=32,_=32-f,u(this.low<<_|this.high>>>f,this.high<<_|this.low>>>f,this.unsigned))},y.rotr=y.rotateRight,y.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},y.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},y.toBytes=function(f){return f?this.toBytesLE():this.toBytesBE()},y.toBytesLE=function(){var f=this.high,_=this.low;return[_&255,_>>>8&255,_>>>16&255,_>>>24,f&255,f>>>8&255,f>>>16&255,f>>>24]},y.toBytesBE=function(){var f=this.high,_=this.low;return[f>>>24,f>>>16&255,f>>>8&255,f&255,_>>>24,_>>>16&255,_>>>8&255,_&255]},i.fromBytes=function(f,_,O){return O?i.fromBytesLE(f,_):i.fromBytesBE(f,_)},i.fromBytesLE=function(f,_){return new i(f[0]|f[1]<<8|f[2]<<16|f[3]<<24,f[4]|f[5]<<8|f[6]<<16|f[7]<<24,_)},i.fromBytesBE=function(f,_){return new i(f[4]<<24|f[5]<<16|f[6]<<8|f[7],f[0]<<24|f[1]<<16|f[2]<<8|f[3],_)},typeof BigInt=="function"&&(i.fromBigInt=function(f,_){var O=Number(BigInt.asIntN(32,f)),j=Number(BigInt.asIntN(32,f>>BigInt(32)));return u(O,j,_)},i.fromValue=function(f,_){return typeof f=="bigint"?i.fromBigInt(f,_):k(f,_)},y.toBigInt=function(){var f=BigInt(this.low>>>0),_=BigInt(this.unsigned?this.high>>>0:this.high);return _<<BigInt(32)|f});var ci=l.default=i})});var nt=L(Xt=>{"use strict";var v=Xt;v.asPromise=De();v.base64=Be();v.EventEmitter=qe();v.float=He();v.inquire=Ge();v.utf8=Ze();v.pool=$e();v.LongBits=Qe();v.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);v.global=v.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Xt;v.emptyArray=Object.freeze?Object.freeze([]):[];v.emptyObject=Object.freeze?Object.freeze({}):{};v.isInteger=Number.isInteger||function(o){return typeof o=="number"&&isFinite(o)&&Math.floor(o)===o};v.isString=function(o){return typeof o=="string"||o instanceof String};v.isObject=function(o){return o&&typeof o=="object"};v.isset=v.isSet=function(o,i){var n=o[i];return n!=null&&o.hasOwnProperty(i)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};v.Buffer=(function(){try{var l=v.global.Buffer;return l.prototype.utf8Write?l:null}catch{return null}})();v._Buffer_from=null;v._Buffer_allocUnsafe=null;v.newBuffer=function(o){return typeof o=="number"?v.Buffer?v._Buffer_allocUnsafe(o):new v.Array(o):v.Buffer?v._Buffer_from(o):typeof Uint8Array>"u"?o:new Uint8Array(o)};v.Array=typeof Uint8Array<"u"?Uint8Array:Array;v.Long=v.global.dcodeIO&&v.global.dcodeIO.Long||v.global.Long||(function(){try{var l=Ye();return l&&l.isLong?l:null}catch{return null}})();v.key2Re=/^true|false|0|1$/;v.key32Re=/^-?(?:0|[1-9][0-9]*)$/;v.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;v.longToHash=function(o){return o?v.LongBits.from(o).toHash():v.LongBits.zeroHash};v.longFromHash=function(o,i){var n=v.LongBits.fromHash(o);return v.Long?v.Long.fromBits(n.lo,n.hi,i):n.toNumber(!!i)};function tn(l,o,i){for(var n=Object.keys(o),r=0;r<n.length;++r)(l[n[r]]===void 0||!i)&&n[r]!=="__proto__"&&(l[n[r]]=o[n[r]]);return l}v.merge=tn;v.recursionLimit=100;v.makeProp=function(o,i){Object.defineProperty(o,i,{enumerable:!0,configurable:!0,writable:!0})};v.lcFirst=function(o){return o.charAt(0).toLowerCase()+o.substring(1)};function en(l){function o(i,n){if(!(this instanceof o))return new o(i,n);Object.defineProperty(this,"message",{get:function(){return i}}),Error.captureStackTrace?Error.captureStackTrace(this,o):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&tn(this,n)}return o.prototype=Object.create(Error.prototype,{constructor:{value:o,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}}),o}v.newError=en;v.ProtocolError=en("ProtocolError");v.oneOfGetter=function(o){for(var i={},n=0;n<o.length;++n)i[o[n]]=1;return function(){for(var r=Object.keys(this),t=r.length-1;t>-1;--t)if(i[r[t]]===1&&this[r[t]]!==void 0&&this[r[t]]!==null)return r[t]}};v.oneOfSetter=function(o){return function(i){for(var n=0;n<o.length;++n)o[n]!==i&&delete this[o[n]]}};v.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};v._configure=function(){var l=v.Buffer;if(!l){v._Buffer_from=v._Buffer_allocUnsafe=null;return}v._Buffer_from=l.from!==Uint8Array.from&&l.from||function(i,n){return new l(i,n)},v._Buffer_allocUnsafe=l.allocUnsafe||function(i){return new l(i)}}});var re=L((Br,sn)=>{"use strict";sn.exports=m;var G=nt(),Qt,Mt=G.LongBits,nn=G.base64,rn=G.utf8;function vt(l,o,i){this.fn=l,this.len=o,this.next=void 0,this.val=i}function te(){}function ti(l){this.head=l.head,this.tail=l.tail,this.len=l.len,this.next=l.states}function m(){this.len=0,this.head=new vt(te,0,0),this.tail=this.head,this.states=null}var on=function(){return G.Buffer?function(){return(m.create=function(){return new Qt})()}:function(){return new m}};m.create=on();m.alloc=function(o){return new G.Array(o)};G.Array!==Array&&(m.alloc=G.pool(m.alloc,G.Array.prototype.subarray));m.prototype._push=function(o,i,n){return this.tail=this.tail.next=new vt(o,i,n),this.len+=i,this};function ee(l,o,i){o[i]=l&255}function ei(l,o,i){for(;l>127;)o[i++]=l&127|128,l>>>=7;o[i]=l}function ne(l,o){this.len=l,this.next=void 0,this.val=o}ne.prototype=Object.create(vt.prototype);ne.prototype.fn=ei;m.prototype.uint32=function(o){return this.len+=(this.tail=this.tail.next=new ne((o=o>>>0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this};m.prototype.int32=function(o){return o<0?this._push(ie,10,Mt.fromNumber(o)):this.uint32(o)};m.prototype.sint32=function(o){return this.uint32((o<<1^o>>31)>>>0)};function ie(l,o,i){for(;l.hi;)o[i++]=l.lo&127|128,l.lo=(l.lo>>>7|l.hi<<25)>>>0,l.hi>>>=7;for(;l.lo>127;)o[i++]=l.lo&127|128,l.lo=l.lo>>>7;o[i++]=l.lo}m.prototype.uint64=function(o){var i=Mt.from(o);return this._push(ie,i.length(),i)};m.prototype.int64=m.prototype.uint64;m.prototype.sint64=function(o){var i=Mt.from(o).zzEncode();return this._push(ie,i.length(),i)};m.prototype.bool=function(o){return this._push(ee,1,o?1:0)};function Yt(l,o,i){o[i]=l&255,o[i+1]=l>>>8&255,o[i+2]=l>>>16&255,o[i+3]=l>>>24}m.prototype.fixed32=function(o){return this._push(Yt,4,o>>>0)};m.prototype.sfixed32=m.prototype.fixed32;m.prototype.fixed64=function(o){var i=Mt.from(o);return this._push(Yt,4,i.lo)._push(Yt,4,i.hi)};m.prototype.sfixed64=m.prototype.fixed64;m.prototype.float=function(o){return this._push(G.float.writeFloatLE,4,o)};m.prototype.double=function(o){return this._push(G.float.writeDoubleLE,8,o)};var ni=G.Array.prototype.set?function(o,i,n){i.set(o,n)}:function(o,i,n){for(var r=0;r<o.length;++r)i[n+r]=o[r]};m.prototype.bytes=function(o){var i=o.length>>>0;if(!i)return this._push(ee,1,0);if(G.isString(o)){var n=m.alloc(i=nn.length(o));nn.decode(o,n,0),o=n}return this.uint32(i)._push(ni,i,o)};m.prototype.string=function(o){var i=rn.length(o);return i?this.uint32(i)._push(rn.write,i,o):this._push(ee,1,0)};m.prototype.fork=function(){return this.states=new ti(this),this.head=this.tail=new vt(te,0,0),this.len=0,this};m.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 vt(te,0,0),this.len=0),this};m.prototype.ldelim=function(){var o=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=o.next,this.tail=i,this.len+=n),this};m.prototype.finish=function(){for(var o=this.head.next,i=this.constructor.alloc(this.len),n=0;o;)o.fn(o.val,i,n),n+=o.len,o=o.next;return i};m._configure=function(l){Qt=l,m.create=on(),Qt._configure()}});var un=L((Mr,ln)=>{"use strict";ln.exports=X;var cn=re();(X.prototype=Object.create(cn.prototype)).constructor=X;var it=nt();function X(){cn.call(this)}X._configure=function(){X.alloc=it._Buffer_allocUnsafe,X.writeBytesBuffer=it.Buffer&&it.Buffer.prototype instanceof Uint8Array&&it.Buffer.prototype.set.name==="set"?function(o,i,n){i.set(o,n)}:function(o,i,n){if(o.copy)o.copy(i,n,0,o.length);else for(var r=0;r<o.length;)i[n++]=o[r++]}};X.prototype.bytes=function(o){it.isString(o)&&(o=it._Buffer_from(o,"base64"));var i=o.length>>>0;return this.uint32(i),i&&this._push(X.writeBytesBuffer,i,o),this};function ii(l,o,i){l.length<40?it.utf8.write(l,o,i):o.utf8Write?o.utf8Write(l,i):o.write(l,i)}X.prototype.string=function(o){var i=it.Buffer.byteLength(o);return this.uint32(i),i&&this._push(ii,i,o),this};X._configure()});var ce=L((qr,dn)=>{"use strict";dn.exports=E;var J=nt(),se,hn=J.LongBits,ri=J.utf8;function $(l,o){return RangeError("index out of range: "+l.pos+" + "+(o||1)+" > "+l.len)}function E(l){this.buf=l,this.pos=0,this.len=l.length}var fn=typeof Uint8Array<"u"?function(o){if(o instanceof Uint8Array||Array.isArray(o))return new E(o);throw Error("illegal buffer")}:function(o){if(Array.isArray(o))return new E(o);throw Error("illegal buffer")},pn=function(){return J.Buffer?function(i){return(E.create=function(r){return J.Buffer.isBuffer(r)?new se(r):fn(r)})(i)}:fn};E.create=pn();E.prototype._slice=J.Array.prototype.subarray||J.Array.prototype.slice;E.prototype.uint32=(function(){var o=4294967295;return function(){if(o=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(o=(o|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return o;if((this.pos+=5)>this.len)throw this.pos=this.len,$(this,10);return o}})();E.prototype.int32=function(){return this.uint32()|0};E.prototype.sint32=function(){var o=this.uint32();return o>>>1^-(o&1)|0};function oe(){var l=new hn(0,0),o=0;if(this.len-this.pos>4){for(;o<4;++o)if(l.lo=(l.lo|(this.buf[this.pos]&127)<<o*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;o=0}else{for(;o<3;++o){if(this.pos>=this.len)throw $(this);if(l.lo=(l.lo|(this.buf[this.pos]&127)<<o*7)>>>0,this.buf[this.pos++]<128)return l}return l.lo=(l.lo|(this.buf[this.pos++]&127)<<o*7)>>>0,l}if(this.len-this.pos>4){for(;o<5;++o)if(l.hi=(l.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return l}else for(;o<5;++o){if(this.pos>=this.len)throw $(this);if(l.hi=(l.hi|(this.buf[this.pos]&127)<<o*7+3)>>>0,this.buf[this.pos++]<128)return l}throw Error("invalid varint encoding")}E.prototype.bool=function(){return this.uint32()!==0};function qt(l,o){return(l[o-4]|l[o-3]<<8|l[o-2]<<16|l[o-1]<<24)>>>0}E.prototype.fixed32=function(){if(this.pos+4>this.len)throw $(this,4);return qt(this.buf,this.pos+=4)};E.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $(this,4);return qt(this.buf,this.pos+=4)|0};function an(){if(this.pos+8>this.len)throw $(this,8);return new hn(qt(this.buf,this.pos+=4),qt(this.buf,this.pos+=4))}E.prototype.float=function(){if(this.pos+4>this.len)throw $(this,4);var o=J.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o};E.prototype.double=function(){if(this.pos+8>this.len)throw $(this,4);var o=J.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o};E.prototype.bytes=function(){var o=this.uint32(),i=this.pos,n=this.pos+o;if(n>this.len)throw $(this,o);if(this.pos+=o,Array.isArray(this.buf))return this.buf.slice(i,n);if(i===n){var r=J.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,i,n)};E.prototype.string=function(){var o=this.bytes();return ri.read(o,0,o.length)};E.prototype.skip=function(o){if(typeof o=="number"){if(this.pos+o>this.len)throw $(this,o);this.pos+=o}else do if(this.pos>=this.len)throw $(this);while(this.buf[this.pos++]&128);return this};E.recursionLimit=J.recursionLimit;E.prototype.skipType=function(l,o){if(o===void 0&&(o=0),o>E.recursionLimit)throw Error("maximum nesting depth exceeded");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,o+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+l+" at offset "+this.pos)}return this};E._configure=function(l){se=l,E.create=pn(),se._configure();var o=J.Long?"toLong":"toNumber";J.merge(E.prototype,{int64:function(){return oe.call(this)[o](!1)},uint64:function(){return oe.call(this)[o](!0)},sint64:function(){return oe.call(this).zzDecode()[o](!1)},fixed64:function(){return an.call(this)[o](!0)},sfixed64:function(){return an.call(this)[o](!1)}})}});var gn=L((Ar,_n)=>{"use strict";_n.exports=lt;var yn=ce();(lt.prototype=Object.create(yn.prototype)).constructor=lt;var bn=nt();function lt(l){yn.call(this,l)}lt._configure=function(){bn.Buffer&&(lt.prototype._slice=bn.Buffer.prototype.slice)};lt.prototype.string=function(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))};lt._configure()});var kn=L((Ur,vn)=>{"use strict";vn.exports=kt;var le=nt();(kt.prototype=Object.create(le.EventEmitter.prototype)).constructor=kt;function kt(l,o,i){if(typeof l!="function")throw TypeError("rpcImpl must be a function");le.EventEmitter.call(this),this.rpcImpl=l,this.requestDelimited=!!o,this.responseDelimited=!!i}kt.prototype.rpcCall=function l(o,i,n,r,t){if(!r)throw TypeError("request must be specified");var e=this;if(!t)return le.asPromise(l,e,o,i,n,r);if(!e.rpcImpl){setTimeout(function(){t(Error("already ended"))},0);return}try{return e.rpcImpl(o,i[e.requestDelimited?"encodeDelimited":"encode"](r).finish(),function(s,u){if(s)return e.emit("error",s,o),t(s);if(u===null){e.end(!0);return}if(!(u instanceof n))try{u=n[e.responseDelimited?"decodeDelimited":"decode"](u)}catch(d){return e.emit("error",d,o),t(d)}return e.emit("data",u,o),t(null,u)})}catch(c){e.emit("error",c,o),setTimeout(function(){t(c)},0);return}};kt.prototype.end=function(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Pn=L(Sn=>{"use strict";var oi=Sn;oi.Service=kn()});var On=L((Fr,wn)=>{"use strict";wn.exports={}});var Tn=L(xn=>{"use strict";var F=xn;F.build="minimal";F.Writer=re();F.BufferWriter=un();F.Reader=ce();F.BufferReader=gn();F.util=nt();F.rpc=Pn();F.roots=On();F.configure=mn;function mn(){F.util._configure(),F.Writer._configure(F.BufferWriter),F.Reader._configure(F.BufferReader)}mn()});var ue=L((Wr,Rn)=>{"use strict";Rn.exports=Tn()});var Re=Pt(Ht());var mt=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected",n))(mt||{}),xt=(n=>(n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed",n))(xt||{});function me(l,o){return l.lastIndexOf(o,0)===0}function Vt(l){return l==null?!1:typeof l=="function"}function xe(l,o){if(globalThis.console){let i=globalThis.console[l];Vt(i)&&i.apply(globalThis.console,o)}}function zn(l,o){return Math.floor(Math.random()*(o-l+1)+l)}function Y(l,o,i){l>31&&(l=31);let n=zn(0,Math.min(i,o*Math.pow(2,l)));return Math.min(i,o+n)}function Te(l){return"error"in l&&l.error!==null}function ot(l){return Math.min(l*1e3,2147483647)}var dt=class extends Re.default{constructor(i,n,r){super();this._resubscribeTimeout=null;this._refreshTimeout=null;this._getState=null;this._map=!1;this._mapPresenceType=1;this._mapPhase=null;this._mapStateBuffer=[];this._mapStreamBuffer=[];this._mapCursor="";this._mapPageSize=0;this._mapUnrecoverableStrategy="from_scratch";this._debounceMs=0;this._debouncePending=new Map;this._sharedPoll=!1;this._sharedPollEpoch="";this._sharedPollTrackedItems=new Map;this._sharedPollGetSignature=null;this._sharedPollSignatureRefreshTimeout=null;this._sharedPollSignatureRefreshAttempts=0;this._sharedPollTrackRetryTimeout=null;this._sharedPollTrackRetryAttempts=0;this._sharedPollReplayRetryTimeout=null;this._sharedPollReplayRetryAttempts=0;this._sharedPollSignatures=[];this._sharedPollSignatureRefreshTargetMs=null;this._sharedPollSignatureRefreshInFlight=!1;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._prevValueMap=new Map,this._unsubPromise=Promise.resolve(),this._deltaNumPubs=0,this._deltaNumFull=0,this._deltaNumDelta=0,this._deltaBytesReceived=0,this._deltaBytesDecoded=0,this._setOptions(r),this.type=this._sharedPoll?"shared_poll":this._map?"map":"stream",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,r)=>{let t={resolve:n,reject:r};i&&(t.timeout=setTimeout(function(){r({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)}_debouncedPublish(i,n,r){let t=this._debouncePending.get(i);if(t)return t.data=n,t.dirty=!0,Promise.resolve({});let e={data:n,dirty:!1,timer:null};return e.timer=setTimeout(()=>{let s=this._debouncePending.get(i);if(!s||!s.dirty){this._debouncePending.delete(i);return}s.dirty=!1;let u=s.data;(r?this._centrifuge.mapPublish(this.channel,i,u):this._centrifuge.publish(this.channel,u)).catch(()=>{}),s.timer=setTimeout(()=>{let g=this._debouncePending.get(i);if(!g||!g.dirty){this._debouncePending.delete(i);return}this._debouncePending.delete(i),this._debouncedPublish(i,g.data,r)},this._debounceMs)},this._debounceMs),this._debouncePending.set(i,e),r?this._centrifuge.mapPublish(this.channel,i,n):this._centrifuge.publish(this.channel,n)}_cancelDebounce(i){let n=this._debouncePending.get(i);n&&(clearTimeout(n.timer),this._debouncePending.delete(i))}_cancelAllDebounce(){for(let[,i]of this._debouncePending)clearTimeout(i.timer);this._debouncePending.clear()}async presence(){return await this._methodCall(),this._centrifuge.presence(this.channel)}async presenceStats(){return await this._methodCall(),this._centrifuge.presenceStats(this.channel)}setTagsFilter(i){if(i&&this._delta)throw new Error("cannot use delta and tagsFilter together");this._tagsFilter=i,this._map&&(this._recover=!1,this._offset=null,this._epoch=null)}setData(i){this._data=i}deltaStats(){let i=this._deltaBytesDecoded;return{numPublications:this._deltaNumPubs,numFullPayloads:this._deltaNumFull,numDeltaPayloads:this._deltaNumDelta,bytesReceived:this._deltaBytesReceived,bytesDecoded:i,compressionRatio:i>0?1-this._deltaBytesReceived/i:0}}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:7,message:this.state}):new Promise((i,n)=>{let r=this._centrifuge._config.timeout,t=setTimeout(()=>{n({code:1,message:"timeout"})},r);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(),this._clearSharedPollSignatureRefresh(),this._clearSharedPollTrackRetry(),this._clearSharedPollReplayRetry(),this._sharedPollSignatureRefreshTargetMs=null,this._sharedPollSignatureRefreshInFlight=!1}_invalidateState(){this._token="",this._prevValueMap=new Map,this._map?(this._offset=null,this._epoch=null,this._recover=!1,this._mapStateBuffer=[],this._mapStreamBuffer=[],this._mapCursor="",this._mapPhase=null):(this._offset=0,this._epoch="_")}_setSubscribed(i){if(!this._isSubscribing())return;if(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,i.publish_debounce&&(this._debounceMs=i.publish_debounce),this._sharedPoll){let t=i.epoch||"";if(this._sharedPollEpoch!==""&&this._sharedPollEpoch!==t)for(let e of this._sharedPollTrackedItems.keys())this._sharedPollTrackedItems.set(e,0);this._sharedPollEpoch=t}this._setState("subscribed");let n=this._centrifuge._getSubscribeContext(this.channel,i);this.emit("subscribed",n),this._resolvePromises();let r=i.publications;if(r&&r.length>0)for(let t in r)r.hasOwnProperty(t)&&this._handlePublication(r[t]);i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),ot(i.ttl)))}async _setSubscribing(i,n){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._id=0,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._map?(this._mapSubscribe(),null):this._getState&&this._offset===null?(this._loadStreamState(),null):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)}_loadStreamState(){if(!this._isSubscribing()){this._inflight=!1;return}this._getState().then(i=>{if(!this._isSubscribing()){this._inflight=!1;return}this._offset=i.offset,this._epoch=i.epoch,this._recover=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():this._getSubscriptionToken().then(n=>this._handleTokenResponse(n)).catch(n=>this._handleTokenError(n))}).catch(i=>{if(!this._isSubscribing()){this._inflight=!1;return}this._inflight=!1,this._subscribeError({code:13,message:i?.toString()||"getState failed",temporary:!0})})}_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 V){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 V){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(r=>{this._inflight=!1;let t=r.reply.subscribe;this._handleSubscribeResponse(t),r.next&&r.next()},r=>{this._inflight=!1,this._handleSubscribeError(r.error),r.next&&r.next()}),n}_buildSubscribeCommand(i){let n={channel:this.channel};if(i&&(n.token=i),this._data&&(n.data=this._data),this._sharedPoll)return n.type=4,this._delta&&(n.delta=this._delta),{subscribe:n};if(this._positioned&&(n.positioned=!0),this._recoverable&&(n.recoverable=!0),this._joinLeave&&(n.join_leave=!0),n.flag=1,this._getState&&(n.flag|=2),this._needRecover()){n.recover=!0;let r=this._getOffset();r&&(n.offset=r);let t=this._getEpoch();t&&(n.epoch=t)}return this._delta&&(n.delta