UNPKG

vanilla-party

Version:

An easy to use library for simple multi-user JavaScript apps.

111 lines 242 kB
var qa=Object.create;var Oi=Object.defineProperty;var Wa=Object.getOwnPropertyDescriptor;var Ya=Object.getOwnPropertyNames,Dn=Object.getOwnPropertySymbols,$a=Object.getPrototypeOf,Pn=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable;var Un=r=>{throw TypeError(r)},U=Math.pow,wn=(r,t,e)=>t in r?Oi(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ue=(r,t)=>{for(var e in t||(t={}))Pn.call(t,e)&&wn(r,e,t[e]);if(Dn)for(var e of Dn(t))Ka.call(t,e)&&wn(r,e,t[e]);return r};var Ja=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Qa=(r,t)=>()=>(r&&(t=r(r=0)),t);var R=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var za=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ya(t))!Pn.call(r,n)&&n!==e&&Oi(r,n,{get:()=>t[n],enumerable:!(i=Wa(t,n))||i.enumerable});return r};var Nr=(r,t,e)=>(e=r!=null?qa($a(r)):{},za(t||!r||!r.__esModule?Oi(e,"default",{value:r,enumerable:!0}):e,r));var Ni=(r,t,e)=>t.has(r)||Un("Cannot "+e);var E=(r,t,e)=>(Ni(r,t,"read from private field"),e?e.call(r):t.get(r)),x=(r,t,e)=>t.has(r)?Un("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),M=(r,t,e,i)=>(Ni(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),ft=(r,t,e)=>(Ni(r,t,"access private method"),e);var it=(r,t,e)=>new Promise((i,n)=>{var o=c=>{try{a(e.next(c))}catch(l){n(l)}},s=c=>{try{a(e.throw(c))}catch(l){n(l)}},a=c=>c.done?i(c.value):Promise.resolve(c.value).then(o,s);a((e=e.apply(r,t)).next())});var Bn=R(Tr=>{"use strict";u();Tr.byteLength=Za;Tr.toByteArray=ec;Tr.fromByteArray=nc;var It=[],dt=[],Xa=typeof Uint8Array!="undefined"?Uint8Array:Array,Ti="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(le=0,Ln=Ti.length;le<Ln;++le)It[le]=Ti[le],dt[Ti.charCodeAt(le)]=le;var le,Ln;dt[45]=62;dt[95]=63;function Mn(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var i=e===t?0:4-e%4;return[e,i]}function Za(r){var t=Mn(r),e=t[0],i=t[1];return(e+i)*3/4-i}function tc(r,t,e){return(t+e)*3/4-e}function ec(r){var t,e=Mn(r),i=e[0],n=e[1],o=new Xa(tc(r,i,n)),s=0,a=n>0?i-4:i,c;for(c=0;c<a;c+=4)t=dt[r.charCodeAt(c)]<<18|dt[r.charCodeAt(c+1)]<<12|dt[r.charCodeAt(c+2)]<<6|dt[r.charCodeAt(c+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return n===2&&(t=dt[r.charCodeAt(c)]<<2|dt[r.charCodeAt(c+1)]>>4,o[s++]=t&255),n===1&&(t=dt[r.charCodeAt(c)]<<10|dt[r.charCodeAt(c+1)]<<4|dt[r.charCodeAt(c+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function rc(r){return It[r>>18&63]+It[r>>12&63]+It[r>>6&63]+It[r&63]}function ic(r,t,e){for(var i,n=[],o=t;o<e;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(rc(i));return n.join("")}function nc(r){for(var t,e=r.length,i=e%3,n=[],o=16383,s=0,a=e-i;s<a;s+=o)n.push(ic(r,s,s+o>a?a:s+o));return i===1?(t=r[e-1],n.push(It[t>>2]+It[t<<4&63]+"==")):i===2&&(t=(r[e-2]<<8)+r[e-1],n.push(It[t>>10]+It[t>>4&63]+It[t<<2&63]+"=")),n.join("")}});var kn=R(vi=>{u();vi.read=function(r,t,e,i,n){var o,s,a=n*8-i-1,c=(1<<a)-1,l=c>>1,h=-7,p=e?n-1:0,g=e?-1:1,N=r[t+p];for(p+=g,o=N&(1<<-h)-1,N>>=-h,h+=a;h>0;o=o*256+r[t+p],p+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=s*256+r[t+p],p+=g,h-=8);if(o===0)o=1-l;else{if(o===c)return s?NaN:(N?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-l}return(N?-1:1)*s*Math.pow(2,o-i)};vi.write=function(r,t,e,i,n,o){var s,a,c,l=o*8-n-1,h=(1<<l)-1,p=h>>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,N=i?0:o-1,B=i?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=h):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+p>=1?t+=g/c:t+=g*Math.pow(2,1-p),t*c>=2&&(s++,c/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(t*c-1)*Math.pow(2,n),s=s+p):(a=t*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;r[e+N]=a&255,N+=B,a/=256,n-=8);for(s=s<<n|a,l+=n;l>0;r[e+N]=s&255,N+=B,s/=256,l-=8);r[e+N-B]|=A*128}});var to=R(ge=>{"use strict";u();var bi=Bn(),ve=kn(),xn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ge.Buffer=f;ge.SlowBuffer=lc;ge.INSPECT_MAX_BYTES=50;var vr=2147483647;ge.kMaxLength=vr;f.TYPED_ARRAY_SUPPORT=oc();!f.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function oc(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch(r){return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}});function xt(r){if(r>vr)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,f.prototype),t}function f(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return mi(r)}return Hn(r,t,e)}f.poolSize=8192;function Hn(r,t,e){if(typeof r=="string")return ac(r,t);if(ArrayBuffer.isView(r))return cc(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(mt(r,ArrayBuffer)||r&&mt(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(mt(r,SharedArrayBuffer)||r&&mt(r.buffer,SharedArrayBuffer)))return Ci(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return f.from(i,t,e);let n=uc(r);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}f.from=function(r,t,e){return Hn(r,t,e)};Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f,Uint8Array);function Gn(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function sc(r,t,e){return Gn(r),r<=0?xt(r):t!==void 0?typeof e=="string"?xt(r).fill(t,e):xt(r).fill(t):xt(r)}f.alloc=function(r,t,e){return sc(r,t,e)};function mi(r){return Gn(r),xt(r<0?0:Ai(r)|0)}f.allocUnsafe=function(r){return mi(r)};f.allocUnsafeSlow=function(r){return mi(r)};function ac(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!f.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=qn(r,t)|0,i=xt(e),n=i.write(r,t);return n!==e&&(i=i.slice(0,n)),i}function gi(r){let t=r.length<0?0:Ai(r.length)|0,e=xt(t);for(let i=0;i<t;i+=1)e[i]=r[i]&255;return e}function cc(r){if(mt(r,Uint8Array)){let t=new Uint8Array(r);return Ci(t.buffer,t.byteOffset,t.byteLength)}return gi(r)}function Ci(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let i;return t===void 0&&e===void 0?i=new Uint8Array(r):e===void 0?i=new Uint8Array(r,t):i=new Uint8Array(r,t,e),Object.setPrototypeOf(i,f.prototype),i}function uc(r){if(f.isBuffer(r)){let t=Ai(r.length)|0,e=xt(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||wi(r.length)?xt(0):gi(r);if(r.type==="Buffer"&&Array.isArray(r.data))return gi(r.data)}function Ai(r){if(r>=vr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+vr.toString(16)+" bytes");return r|0}function lc(r){return+r!=r&&(r=0),f.alloc(+r)}f.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==f.prototype};f.compare=function(t,e){if(mt(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),mt(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let i=t.length,n=e.length;for(let o=0,s=Math.min(i,n);o<s;++o)if(t[o]!==e[o]){i=t[o],n=e[o];break}return i<n?-1:n<i?1:0};f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return f.alloc(0);let i;if(e===void 0)for(e=0,i=0;i<t.length;++i)e+=t[i].length;let n=f.allocUnsafe(e),o=0;for(i=0;i<t.length;++i){let s=t[i];if(mt(s,Uint8Array))o+s.length>n.length?(f.isBuffer(s)||(s=f.from(s)),s.copy(n,o)):Uint8Array.prototype.set.call(n,s,o);else if(f.isBuffer(s))s.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return n};function qn(r,t){if(f.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||mt(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&e===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Ii(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Zn(r).length;default:if(n)return i?-1:Ii(r).length;t=(""+t).toLowerCase(),n=!0}}f.byteLength=qn;function hc(r,t,e){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return Nc(this,t,e);case"utf8":case"utf-8":return Yn(this,t,e);case"ascii":return _c(this,t,e);case"latin1":case"binary":return Oc(this,t,e);case"base64":return Rc(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tc(this,t,e);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}f.prototype._isBuffer=!0;function he(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}f.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)he(this,e,e+1);return this};f.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)he(this,e,e+3),he(this,e+1,e+2);return this};f.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)he(this,e,e+7),he(this,e+1,e+6),he(this,e+2,e+5),he(this,e+3,e+4);return this};f.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Yn(this,0,t):hc.apply(this,arguments)};f.prototype.toLocaleString=f.prototype.toString;f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:f.compare(this,t)===0};f.prototype.inspect=function(){let t="",e=ge.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};xn&&(f.prototype[xn]=f.prototype.inspect);f.prototype.compare=function(t,e,i,n,o){if(mt(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),e<0||i>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=i)return 0;if(n>=o)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,n>>>=0,o>>>=0,this===t)return 0;let s=o-n,a=i-e,c=Math.min(s,a),l=this.slice(n,o),h=t.slice(e,i);for(let p=0;p<c;++p)if(l[p]!==h[p]){s=l[p],a=h[p];break}return s<a?-1:a<s?1:0};function Wn(r,t,e,i,n){if(r.length===0)return-1;if(typeof e=="string"?(i=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,wi(e)&&(e=n?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(n)return-1;e=r.length-1}else if(e<0)if(n)e=0;else return-1;if(typeof t=="string"&&(t=f.from(t,i)),f.isBuffer(t))return t.length===0?-1:jn(r,t,e,i,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):jn(r,[t],e,i,n);throw new TypeError("val must be string, number or Buffer")}function jn(r,t,e,i,n){let o=1,s=r.length,a=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||t.length<2)return-1;o=2,s/=2,a/=2,e/=2}function c(h,p){return o===1?h[p]:h.readUInt16BE(p*o)}let l;if(n){let h=-1;for(l=e;l<s;l++)if(c(r,l)===c(t,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===a)return h*o}else h!==-1&&(l-=l-h),h=-1}else for(e+a>s&&(e=s-a),l=e;l>=0;l--){let h=!0;for(let p=0;p<a;p++)if(c(r,l+p)!==c(t,p)){h=!1;break}if(h)return l}return-1}f.prototype.includes=function(t,e,i){return this.indexOf(t,e,i)!==-1};f.prototype.indexOf=function(t,e,i){return Wn(this,t,e,i,!0)};f.prototype.lastIndexOf=function(t,e,i){return Wn(this,t,e,i,!1)};function fc(r,t,e,i){e=Number(e)||0;let n=r.length-e;i?(i=Number(i),i>n&&(i=n)):i=n;let o=t.length;i>o/2&&(i=o/2);let s;for(s=0;s<i;++s){let a=parseInt(t.substr(s*2,2),16);if(wi(a))return s;r[e+s]=a}return s}function dc(r,t,e,i){return br(Ii(t,r.length-e),r,e,i)}function pc(r,t,e,i){return br(Cc(t),r,e,i)}function Ec(r,t,e,i){return br(Zn(t),r,e,i)}function yc(r,t,e,i){return br(Ic(t,r.length-e),r,e,i)}f.prototype.write=function(t,e,i,n){if(e===void 0)n="utf8",i=this.length,e=0;else if(i===void 0&&typeof e=="string")n=e,i=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-e;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return fc(this,t,e,i);case"utf8":case"utf-8":return dc(this,t,e,i);case"ascii":case"latin1":case"binary":return pc(this,t,e,i);case"base64":return Ec(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yc(this,t,e,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Rc(r,t,e){return t===0&&e===r.length?bi.fromByteArray(r):bi.fromByteArray(r.slice(t,e))}function Yn(r,t,e){e=Math.min(r.length,e);let i=[],n=t;for(;n<e;){let o=r[n],s=null,a=o>239?4:o>223?3:o>191?2:1;if(n+a<=e){let c,l,h,p;switch(a){case 1:o<128&&(s=o);break;case 2:c=r[n+1],(c&192)===128&&(p=(o&31)<<6|c&63,p>127&&(s=p));break;case 3:c=r[n+1],l=r[n+2],(c&192)===128&&(l&192)===128&&(p=(o&15)<<12|(c&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:c=r[n+1],l=r[n+2],h=r[n+3],(c&192)===128&&(l&192)===128&&(h&192)===128&&(p=(o&15)<<18|(c&63)<<12|(l&63)<<6|h&63,p>65535&&p<1114112&&(s=p))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=a}return Sc(i)}var Vn=4096;function Sc(r){let t=r.length;if(t<=Vn)return String.fromCharCode.apply(String,r);let e="",i=0;for(;i<t;)e+=String.fromCharCode.apply(String,r.slice(i,i+=Vn));return e}function _c(r,t,e){let i="";e=Math.min(r.length,e);for(let n=t;n<e;++n)i+=String.fromCharCode(r[n]&127);return i}function Oc(r,t,e){let i="";e=Math.min(r.length,e);for(let n=t;n<e;++n)i+=String.fromCharCode(r[n]);return i}function Nc(r,t,e){let i=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>i)&&(e=i);let n="";for(let o=t;o<e;++o)n+=mc[r[o]];return n}function Tc(r,t,e){let i=r.slice(t,e),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}f.prototype.slice=function(t,e){let i=this.length;t=~~t,e=e===void 0?i:~~e,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),e<t&&(e=t);let n=this.subarray(t,e);return Object.setPrototypeOf(n,f.prototype),n};function Y(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||Y(t,e,this.length);let n=this[t],o=1,s=0;for(;++s<e&&(o*=256);)n+=this[t+s]*o;return n};f.prototype.readUintBE=f.prototype.readUIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||Y(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n};f.prototype.readUint8=f.prototype.readUInt8=function(t,e){return t=t>>>0,e||Y(t,1,this.length),this[t]};f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||Y(t,2,this.length),this[t]|this[t+1]<<8};f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||Y(t,2,this.length),this[t]<<8|this[t+1]};f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||Y(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||Y(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};f.prototype.readBigUInt64LE=Vt(function(t){t=t>>>0,be(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ze(t,this.length-8);let n=e+this[++t]*U(2,8)+this[++t]*U(2,16)+this[++t]*U(2,24),o=this[++t]+this[++t]*U(2,8)+this[++t]*U(2,16)+i*U(2,24);return BigInt(n)+(BigInt(o)<<BigInt(32))});f.prototype.readBigUInt64BE=Vt(function(t){t=t>>>0,be(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ze(t,this.length-8);let n=e*U(2,24)+this[++t]*U(2,16)+this[++t]*U(2,8)+this[++t],o=this[++t]*U(2,24)+this[++t]*U(2,16)+this[++t]*U(2,8)+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});f.prototype.readIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||Y(t,e,this.length);let n=this[t],o=1,s=0;for(;++s<e&&(o*=256);)n+=this[t+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n};f.prototype.readIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||Y(t,e,this.length);let n=e,o=1,s=this[t+--n];for(;n>0&&(o*=256);)s+=this[t+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};f.prototype.readInt8=function(t,e){return t=t>>>0,e||Y(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};f.prototype.readInt16LE=function(t,e){t=t>>>0,e||Y(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};f.prototype.readInt16BE=function(t,e){t=t>>>0,e||Y(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};f.prototype.readInt32LE=function(t,e){return t=t>>>0,e||Y(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};f.prototype.readInt32BE=function(t,e){return t=t>>>0,e||Y(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};f.prototype.readBigInt64LE=Vt(function(t){t=t>>>0,be(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ze(t,this.length-8);let n=this[t+4]+this[t+5]*U(2,8)+this[t+6]*U(2,16)+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+this[++t]*U(2,8)+this[++t]*U(2,16)+this[++t]*U(2,24))});f.prototype.readBigInt64BE=Vt(function(t){t=t>>>0,be(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ze(t,this.length-8);let n=(e<<24)+this[++t]*U(2,16)+this[++t]*U(2,8)+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*U(2,24)+this[++t]*U(2,16)+this[++t]*U(2,8)+i)});f.prototype.readFloatLE=function(t,e){return t=t>>>0,e||Y(t,4,this.length),ve.read(this,t,!0,23,4)};f.prototype.readFloatBE=function(t,e){return t=t>>>0,e||Y(t,4,this.length),ve.read(this,t,!1,23,4)};f.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||Y(t,8,this.length),ve.read(this,t,!0,52,8)};f.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||Y(t,8,this.length),ve.read(this,t,!1,52,8)};function st(r,t,e,i,n,o){if(!f.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(e+i>r.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;st(this,t,e,i,a,0)}let o=1,s=0;for(this[e]=t&255;++s<i&&(o*=256);)this[e+s]=t/o&255;return e+i};f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;st(this,t,e,i,a,0)}let o=i-1,s=1;for(this[e+o]=t&255;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+i};f.prototype.writeUint8=f.prototype.writeUInt8=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,1,255,0),this[e]=t&255,e+1};f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function $n(r,t,e,i,n){Xn(t,i,n,r,e,7);let o=Number(t&BigInt(4294967295));r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,e}function Kn(r,t,e,i,n){Xn(t,i,n,r,e,7);let o=Number(t&BigInt(4294967295));r[e+7]=o,o=o>>8,r[e+6]=o,o=o>>8,r[e+5]=o,o=o>>8,r[e+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=s,s=s>>8,r[e+2]=s,s=s>>8,r[e+1]=s,s=s>>8,r[e]=s,e+8}f.prototype.writeBigUInt64LE=Vt(function(t,e=0){return $n(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeBigUInt64BE=Vt(function(t,e=0){return Kn(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);st(this,t,e,i,c-1,-c)}let o=0,s=1,a=0;for(this[e]=t&255;++o<i&&(s*=256);)t<0&&a===0&&this[e+o-1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i};f.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);st(this,t,e,i,c-1,-c)}let o=i-1,s=1,a=0;for(this[e+o]=t&255;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+i};f.prototype.writeInt8=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};f.prototype.writeInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};f.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};f.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};f.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||st(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};f.prototype.writeBigInt64LE=Vt(function(t,e=0){return $n(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});f.prototype.writeBigInt64BE=Vt(function(t,e=0){return Kn(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Jn(r,t,e,i,n,o){if(e+i>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Qn(r,t,e,i,n){return t=+t,e=e>>>0,n||Jn(r,t,e,4,34028234663852886e22,-34028234663852886e22),ve.write(r,t,e,i,23,4),e+4}f.prototype.writeFloatLE=function(t,e,i){return Qn(this,t,e,!0,i)};f.prototype.writeFloatBE=function(t,e,i){return Qn(this,t,e,!1,i)};function zn(r,t,e,i,n){return t=+t,e=e>>>0,n||Jn(r,t,e,8,17976931348623157e292,-17976931348623157e292),ve.write(r,t,e,i,52,8),e+8}f.prototype.writeDoubleLE=function(t,e,i){return zn(this,t,e,!0,i)};f.prototype.writeDoubleBE=function(t,e,i){return zn(this,t,e,!1,i)};f.prototype.copy=function(t,e,i,n){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-i&&(n=t.length-e+i);let o=n-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,i,n):Uint8Array.prototype.set.call(t,this.subarray(i,n),e),o};f.prototype.fill=function(t,e,i,n){if(typeof t=="string"){if(typeof e=="string"?(n=e,e=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let s=t.charCodeAt(0);(n==="utf8"&&s<128||n==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;e=e>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let o;if(typeof t=="number")for(o=e;o<i;++o)this[o]=t;else{let s=f.isBuffer(t)?t:f.from(t,n),a=s.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<i-e;++o)this[o+e]=s[o%a]}return this};var Te={};function Di(r,t,e){Te[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Di("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Di("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError);Di("ERR_OUT_OF_RANGE",function(r,t,e){let i=`The value of "${r}" is out of range.`,n=e;return Number.isInteger(e)&&Math.abs(e)>U(2,32)?n=Fn(String(e)):typeof e=="bigint"&&(n=String(e),(e>U(BigInt(2),BigInt(32))||e<-U(BigInt(2),BigInt(32)))&&(n=Fn(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function Fn(r){let t="",e=r.length,i=r[0]==="-"?1:0;for(;e>=i+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function vc(r,t,e){be(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Ze(t,r.length-(e+1))}function Xn(r,t,e,i,n,o){if(r>e||r<t){let s=typeof t=="bigint"?"n":"",a;throw o>3?t===0||t===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${t}${s} and <= ${e}${s}`,new Te.ERR_OUT_OF_RANGE("value",a,r)}vc(i,n,o)}function be(r,t){if(typeof r!="number")throw new Te.ERR_INVALID_ARG_TYPE(t,"number",r)}function Ze(r,t,e){throw Math.floor(r)!==r?(be(r,e),new Te.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new Te.ERR_BUFFER_OUT_OF_BOUNDS:new Te.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var bc=/[^+/0-9A-Za-z-_]/g;function gc(r){if(r=r.split("=")[0],r=r.trim().replace(bc,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Ii(r,t){t=t||1/0;let e,i=r.length,n=null,o=[];for(let s=0;s<i;++s){if(e=r.charCodeAt(s),e>55295&&e<57344){if(!n){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),n=e;continue}e=(n-55296<<10|e-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function Cc(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function Ic(r,t){let e,i,n,o=[];for(let s=0;s<r.length&&!((t-=2)<0);++s)e=r.charCodeAt(s),i=e>>8,n=e%256,o.push(n),o.push(i);return o}function Zn(r){return bi.toByteArray(gc(r))}function br(r,t,e,i){let n;for(n=0;n<i&&!(n+e>=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function mt(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function wi(r){return r!==r}var mc=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let i=e*16;for(let n=0;n<16;++n)t[i+n]=r[e]+r[n]}return t}();function Vt(r){return typeof BigInt=="undefined"?Ac:r}function Ac(){throw new Error("BigInt not supported")}});var Buffer,u=Qa(()=>{"use strict";Buffer=to().Buffer});var io=R(Ie=>{"use strict";u();Object.defineProperty(Ie,"__esModule",{value:!0});Ie.LOCAL_WINS=Ie.REMOTE_WINS=void 0;var Dc=function(r,t,e,i,n){n(null,e)};Ie.REMOTE_WINS=Dc;var wc=function(r,t,e,i,n){n(null,r)};Ie.LOCAL_WINS=wc});var no=R(Cr=>{"use strict";u();Object.defineProperty(Cr,"__esModule",{value:!0});Cr.DefaultOptions=void 0;var Pc=io();Cr.DefaultOptions={nativeTimerRegistry:!0,intervalTimerResolution:50,subscriptionInterval:100,heartbeatInterval:3e4,reconnectIntervalIncrement:4e3,maxReconnectInterval:18e4,maxReconnectAttempts:5,subscriptionTimeout:2e3,recordReadAckTimeout:15e3,recordReadTimeout:15e3,recordDeleteTimeout:15e3,offlineBufferTimeout:2e3,recordDiscardTimeout:5e3,offlineEnabled:!1,saveUpdatesOffline:!1,recordReadOnlyMode:!1,recordPrefixWriteWhitelist:[],path:"/deepstream",mergeStrategy:Pc.REMOTE_WINS,recordDeepCopy:!0,dirtyStorageName:"__ds__dirty_records",ignorePrefixes:[],storageName:"indexdb",indexdb:{autoVersion:!1,dbVersion:1,primaryKey:"id",storageDatabaseName:"deepstream",defaultObjectStoreName:"records",objectStoreNames:[],flushTimeout:50},localstorage:{nodeStoragePath:"./local-storage",nodeStorageSize:5},lazyConnect:!1,debug:!1,initialRecordVersion:1}});var oo=R(Ir=>{"use strict";u();Object.defineProperty(Ir,"__esModule",{value:!0});var Uc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.PARSER=1]="PARSER",r[r.CONNECTION=2]="CONNECTION",r[r.AUTH=3]="AUTH",r[r.EVENT=4]="EVENT",r[r.RECORD=5]="RECORD",r[r.RPC=6]="RPC",r[r.PRESENCE=7]="PRESENCE",r[r.MONITORING=8]="MONITORING",r[r.CLUSTER=9]="CLUSTER",r[r.LOCK=10]="LOCK",r[r.STATE_REGISTRY=11]="STATE_REGISTRY",r[r.ERROR=100]="ERROR"})(Uc=Ir.TOPIC||(Ir.TOPIC={}))});var so=R(mr=>{"use strict";u();Object.defineProperty(mr,"__esModule",{value:!0});var Lc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.NOTIFY=2]="NOTIFY",r[r.READ=3]="READ",r[r.READ_RESPONSE=4]="READ_RESPONSE",r[r.HEAD=5]="HEAD",r[r.HEAD_RESPONSE=6]="HEAD_RESPONSE",r[r.HEAD_BULK=7]="HEAD_BULK",r[r.HEAD_RESPONSE_BULK=8]="HEAD_RESPONSE_BULK",r[r.DELETE=9]="DELETE",r[r.DELETE_SUCCESS=10]="DELETE_SUCCESS",r[r.DELETE_BULK=11]="DELETE_BULK",r[r.DELETE_BULK_SUCCESS=12]="DELETE_BULK_SUCCESS",r[r.DELETED=13]="DELETED",r[r.WRITE_ACKNOWLEDGEMENT=14]="WRITE_ACKNOWLEDGEMENT",r[r.CREATE=15]="CREATE",r[r.CREATEANDUPDATE=16]="CREATEANDUPDATE",r[r.CREATEANDPATCH=17]="CREATEANDPATCH",r[r.UPDATE=18]="UPDATE",r[r.PATCH=19]="PATCH",r[r.ERASE=20]="ERASE",r[r.SUBSCRIBEANDHEAD=21]="SUBSCRIBEANDHEAD",r[r.SUBSCRIBEANDREAD=22]="SUBSCRIBEANDREAD",r[r.SUBSCRIBECREATEANDREAD=23]="SUBSCRIBECREATEANDREAD",r[r.SUBSCRIBECREATEANDUPDATE=24]="SUBSCRIBECREATEANDUPDATE",r[r.SUBSCRIBE=25]="SUBSCRIBE",r[r.UNSUBSCRIBE=26]="UNSUBSCRIBE",r[r.LISTEN=27]="LISTEN",r[r.UNLISTEN=28]="UNLISTEN",r[r.LISTEN_ACCEPT=29]="LISTEN_ACCEPT",r[r.LISTEN_REJECT=30]="LISTEN_REJECT",r[r.SUBSCRIPTION_HAS_PROVIDER=31]="SUBSCRIPTION_HAS_PROVIDER",r[r.SUBSCRIPTION_HAS_NO_PROVIDER=32]="SUBSCRIPTION_HAS_NO_PROVIDER",r[r.SUBSCRIPTION_FOR_PATTERN_FOUND=33]="SUBSCRIPTION_FOR_PATTERN_FOUND",r[r.SUBSCRIPTION_FOR_PATTERN_REMOVED=34]="SUBSCRIPTION_FOR_PATTERN_REMOVED",r[r.CACHE_RETRIEVAL_TIMEOUT=100]="CACHE_RETRIEVAL_TIMEOUT",r[r.STORAGE_RETRIEVAL_TIMEOUT=101]="STORAGE_RETRIEVAL_TIMEOUT",r[r.VERSION_EXISTS=102]="VERSION_EXISTS",r[r.RECORD_LOAD_ERROR=103]="RECORD_LOAD_ERROR",r[r.RECORD_CREATE_ERROR=104]="RECORD_CREATE_ERROR",r[r.RECORD_UPDATE_ERROR=105]="RECORD_UPDATE_ERROR",r[r.RECORD_DELETE_ERROR=106]="RECORD_DELETE_ERROR",r[r.RECORD_NOT_FOUND=107]="RECORD_NOT_FOUND",r[r.INVALID_VERSION=108]="INVALID_VERSION",r[r.INVALID_PATCH_ON_HOTPATH=109]="INVALID_PATCH_ON_HOTPATH",r[r.INVALID_LISTEN_REGEX=110]="INVALID_LISTEN_REGEX",r[r.LISTEN_RESPONSE_TIMEOUT=111]="LISTEN_RESPONSE_TIMEOUT",r[r.LISTEN_UNSUCCESSFUL=112]="LISTEN_UNSUCCESSFUL",r[r.RECORD_NOTIFY_ERROR=113]="RECORD_NOTIFY_ERROR",r[r.MESSAGE_PERMISSION_ERROR=114]="MESSAGE_PERMISSION_ERROR",r[r.MESSAGE_DENIED=115]="MESSAGE_DENIED",r[r.INVALID_MESSAGE_DATA=116]="INVALID_MESSAGE_DATA",r[r.MULTIPLE_SUBSCRIPTIONS=117]="MULTIPLE_SUBSCRIPTIONS",r[r.NOT_SUBSCRIBED=118]="NOT_SUBSCRIBED"})(Lc=mr.RECORD_ACTION||(mr.RECORD_ACTION={}))});var ao=R(Ar=>{"use strict";u();Object.defineProperty(Ar,"__esModule",{value:!0});var Mc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.REQUEST=2]="REQUEST",r[r.AUTH_SUCCESSFUL=3]="AUTH_SUCCESSFUL",r[r.AUTH_UNSUCCESSFUL=4]="AUTH_UNSUCCESSFUL",r[r.TOO_MANY_AUTH_ATTEMPTS=100]="TOO_MANY_AUTH_ATTEMPTS",r[r.INVALID_MESSAGE=101]="INVALID_MESSAGE",r[r.INVALID_MESSAGE_DATA=102]="INVALID_MESSAGE_DATA"})(Mc=Ar.AUTH_ACTION||(Ar.AUTH_ACTION={}))});var co=R(Dr=>{"use strict";u();Object.defineProperty(Dr,"__esModule",{value:!0});var Bc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.EMIT=2]="EMIT",r[r.SUBSCRIBE=3]="SUBSCRIBE",r[r.UNSUBSCRIBE=4]="UNSUBSCRIBE",r[r.LISTEN=5]="LISTEN",r[r.UNLISTEN=6]="UNLISTEN",r[r.LISTEN_ACCEPT=7]="LISTEN_ACCEPT",r[r.LISTEN_REJECT=8]="LISTEN_REJECT",r[r.SUBSCRIPTION_HAS_PROVIDER=9]="SUBSCRIPTION_HAS_PROVIDER",r[r.SUBSCRIPTION_HAS_NO_PROVIDER=10]="SUBSCRIPTION_HAS_NO_PROVIDER",r[r.SUBSCRIPTION_FOR_PATTERN_FOUND=11]="SUBSCRIPTION_FOR_PATTERN_FOUND",r[r.SUBSCRIPTION_FOR_PATTERN_REMOVED=12]="SUBSCRIPTION_FOR_PATTERN_REMOVED",r[r.INVALID_LISTEN_REGEX=100]="INVALID_LISTEN_REGEX",r[r.LISTEN_RESPONSE_TIMEOUT=101]="LISTEN_RESPONSE_TIMEOUT",r[r.LISTEN_UNSUCCESSFUL=102]="LISTEN_UNSUCCESSFUL",r[r.MESSAGE_PERMISSION_ERROR=103]="MESSAGE_PERMISSION_ERROR",r[r.MESSAGE_DENIED=104]="MESSAGE_DENIED",r[r.INVALID_MESSAGE_DATA=105]="INVALID_MESSAGE_DATA",r[r.MULTIPLE_SUBSCRIPTIONS=106]="MULTIPLE_SUBSCRIPTIONS",r[r.NOT_SUBSCRIBED=107]="NOT_SUBSCRIBED"})(Bc=Dr.EVENT_ACTION||(Dr.EVENT_ACTION={}))});var uo=R(wr=>{"use strict";u();Object.defineProperty(wr,"__esModule",{value:!0});var kc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.REQUEST=2]="REQUEST",r[r.ACCEPT=4]="ACCEPT",r[r.RESPONSE=5]="RESPONSE",r[r.REJECT=6]="REJECT",r[r.REQUEST_ERROR=7]="REQUEST_ERROR",r[r.PROVIDE=8]="PROVIDE",r[r.UNPROVIDE=9]="UNPROVIDE",r[r.NO_RPC_PROVIDER=100]="NO_RPC_PROVIDER",r[r.ACCEPT_TIMEOUT=101]="ACCEPT_TIMEOUT",r[r.MULTIPLE_ACCEPT=102]="MULTIPLE_ACCEPT",r[r.INVALID_RPC_CORRELATION_ID=103]="INVALID_RPC_CORRELATION_ID",r[r.RESPONSE_TIMEOUT=104]="RESPONSE_TIMEOUT",r[r.MULTIPLE_RESPONSE=105]="MULTIPLE_RESPONSE",r[r.MESSAGE_PERMISSION_ERROR=106]="MESSAGE_PERMISSION_ERROR",r[r.MESSAGE_DENIED=107]="MESSAGE_DENIED",r[r.INVALID_MESSAGE_DATA=108]="INVALID_MESSAGE_DATA",r[r.MULTIPLE_PROVIDERS=109]="MULTIPLE_PROVIDERS",r[r.NOT_PROVIDED=110]="NOT_PROVIDED"})(kc=wr.RPC_ACTION||(wr.RPC_ACTION={}))});var lo=R(Pr=>{"use strict";u();Object.defineProperty(Pr,"__esModule",{value:!0});var xc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.QUERY_ALL=2]="QUERY_ALL",r[r.QUERY_ALL_RESPONSE=3]="QUERY_ALL_RESPONSE",r[r.QUERY=4]="QUERY",r[r.QUERY_RESPONSE=5]="QUERY_RESPONSE",r[r.PRESENCE_JOIN=6]="PRESENCE_JOIN",r[r.PRESENCE_JOIN_ALL=7]="PRESENCE_JOIN_ALL",r[r.PRESENCE_LEAVE=8]="PRESENCE_LEAVE",r[r.PRESENCE_LEAVE_ALL=9]="PRESENCE_LEAVE_ALL",r[r.SUBSCRIBE=10]="SUBSCRIBE",r[r.UNSUBSCRIBE=11]="UNSUBSCRIBE",r[r.SUBSCRIBE_ALL=12]="SUBSCRIBE_ALL",r[r.UNSUBSCRIBE_ALL=13]="UNSUBSCRIBE_ALL",r[r.INVALID_PRESENCE_USERS=100]="INVALID_PRESENCE_USERS",r[r.MESSAGE_PERMISSION_ERROR=101]="MESSAGE_PERMISSION_ERROR",r[r.MESSAGE_DENIED=102]="MESSAGE_DENIED",r[r.MULTIPLE_SUBSCRIPTIONS=103]="MULTIPLE_SUBSCRIPTIONS",r[r.NOT_SUBSCRIBED=104]="NOT_SUBSCRIBED"})(xc=Pr.PRESENCE_ACTION||(Pr.PRESENCE_ACTION={}))});var ho=R(Ur=>{"use strict";u();Object.defineProperty(Ur,"__esModule",{value:!0});var jc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.PING=2]="PING",r[r.PONG=3]="PONG",r[r.ACCEPT=4]="ACCEPT",r[r.CHALLENGE=5]="CHALLENGE",r[r.REJECT=6]="REJECT",r[r.REDIRECT=7]="REDIRECT",r[r.CLOSING=8]="CLOSING",r[r.CLOSED=9]="CLOSED",r[r.AUTHENTICATION_TIMEOUT=100]="AUTHENTICATION_TIMEOUT",r[r.INVALID_MESSAGE=101]="INVALID_MESSAGE"})(jc=Ur.CONNECTION_ACTION||(Ur.CONNECTION_ACTION={}))});var fo=R(Lr=>{"use strict";u();Object.defineProperty(Lr,"__esModule",{value:!0});var Vc;(function(r){r[r.REMOVE=1]="REMOVE",r[r.STATUS=2]="STATUS"})(Vc=Lr.CLUSTER_ACTION||(Lr.CLUSTER_ACTION={}))});var po=R(Mr=>{"use strict";u();Object.defineProperty(Mr,"__esModule",{value:!0});var Fc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.REQUEST=2]="REQUEST",r[r.RESPONSE=3]="RESPONSE",r[r.RELEASE=4]="RELEASE"})(Fc=Mr.LOCK_ACTION||(Mr.LOCK_ACTION={}))});var Eo=R(Br=>{"use strict";u();Object.defineProperty(Br,"__esModule",{value:!0});var Hc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.UNKNOWN_TOPIC=1]="UNKNOWN_TOPIC",r[r.UNKNOWN_ACTION=2]="UNKNOWN_ACTION",r[r.INVALID_MESSAGE=3]="INVALID_MESSAGE",r[r.MESSAGE_PARSE_ERROR=4]="MESSAGE_PARSE_ERROR",r[r.MAXIMUM_MESSAGE_SIZE_EXCEEDED=5]="MAXIMUM_MESSAGE_SIZE_EXCEEDED",r[r.ERROR=6]="ERROR",r[r.INVALID_META_PARAMS=7]="INVALID_META_PARAMS"})(Hc=Br.PARSER_ACTION||(Br.PARSER_ACTION={}))});var yo=R(kr=>{"use strict";u();Object.defineProperty(kr,"__esModule",{value:!0});var Gc;Gc=kr.MONITORING_ACTION||(kr.MONITORING_ACTION={})});var Ro=R(me=>{"use strict";u();Object.defineProperty(me,"__esModule",{value:!0});var qc;(function(r){r[r.EVENT_SUBSCRIPTIONS=11]="EVENT_SUBSCRIPTIONS",r[r.RECORD_SUBSCRIPTIONS=12]="RECORD_SUBSCRIPTIONS",r[r.SUBSCRIPTIONS=9]="SUBSCRIPTIONS",r[r.ONLINE_USERS=10]="ONLINE_USERS",r[r.MONITORING_SUBSCRIPTIONS=24]="MONITORING_SUBSCRIPTIONS",r[r.RPC_SUBSCRIPTIONS=13]="RPC_SUBSCRIPTIONS",r[r.PRESENCE_SUBSCRIPTIONS=14]="PRESENCE_SUBSCRIPTIONS",r[r.RECORD_LISTEN_PATTERNS=15]="RECORD_LISTEN_PATTERNS",r[r.EVENT_LISTEN_PATTERNS=16]="EVENT_LISTEN_PATTERNS",r[r.RECORD_PUBLISHED_SUBSCRIPTIONS=17]="RECORD_PUBLISHED_SUBSCRIPTIONS",r[r.EVENT_PUBLISHED_SUBSCRIPTIONS=18]="EVENT_PUBLISHED_SUBSCRIPTIONS",r[r.RECORD_LISTENING=19]="RECORD_LISTENING",r[r.EVENT_LISTENING=20]="EVENT_LISTENING",r[r.STATE_REGISTRY=21]="STATE_REGISTRY"})(qc=me.STATE_REGISTRY_TOPIC||(me.STATE_REGISTRY_TOPIC={}));var Wc;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.ERROR=1]="ERROR",r[r.ADD=2]="ADD",r[r.REMOVE=3]="REMOVE",r[r.REQUEST_FULL_STATE=4]="REQUEST_FULL_STATE",r[r.FULL_STATE=5]="FULL_STATE",r[r.CHECKSUM=6]="CHECKSUM"})(Wc=me.STATE_ACTION||(me.STATE_ACTION={}))});var Ae=R(nt=>{"use strict";u();Object.defineProperty(nt,"__esModule",{value:!0});var Yc=oo();nt.TOPIC=Yc.TOPIC;var $c=so();nt.RECORD_ACTION=$c.RECORD_ACTION;var Kc=ao();nt.AUTH_ACTION=Kc.AUTH_ACTION;var Jc=co();nt.EVENT_ACTION=Jc.EVENT_ACTION;var Qc=uo();nt.RPC_ACTION=Qc.RPC_ACTION;var zc=lo();nt.PRESENCE_ACTION=zc.PRESENCE_ACTION;var Xc=ho();nt.CONNECTION_ACTION=Xc.CONNECTION_ACTION;var Zc=fo();nt.CLUSTER_ACTION=Zc.CLUSTER_ACTION;var tu=po();nt.LOCK_ACTION=tu.LOCK_ACTION;var eu=Eo();nt.PARSER_ACTION=eu.PARSER_ACTION;var ru=yo();nt.MONITORING_ACTION=ru.MONITORING_ACTION;var So=Ro();nt.STATE_ACTION=So.STATE_ACTION;nt.STATE_REGISTRY_TOPIC=So.STATE_REGISTRY_TOPIC});var Ui=R(Pi=>{"use strict";u();Object.defineProperty(Pi,"__esModule",{value:!0});var j=Ae();Pi.ACTIONS={[j.TOPIC.PARSER]:j.PARSER_ACTION,[j.TOPIC.CONNECTION]:j.CONNECTION_ACTION,[j.TOPIC.AUTH]:j.AUTH_ACTION,[j.TOPIC.EVENT]:j.EVENT_ACTION,[j.TOPIC.RECORD]:j.RECORD_ACTION,[j.TOPIC.RPC]:j.RPC_ACTION,[j.TOPIC.PRESENCE]:j.PRESENCE_ACTION,[j.TOPIC.LOCK]:j.LOCK_ACTION,[j.TOPIC.STATE_REGISTRY]:j.STATE_ACTION,[j.TOPIC.CLUSTER]:j.CLUSTER_ACTION,[j.TOPIC.MONITORING]:j.MONITORING_ACTION}});var k=R(et=>{"use strict";u();var iu=et&&et.__createBinding||(Object.create?function(r,t,e,i){i===void 0&&(i=e);var n=Object.getOwnPropertyDescriptor(t,e);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(r,i,n)}:function(r,t,e,i){i===void 0&&(i=e),r[i]=t[e]}),_o=et&&et.__exportStar||function(r,t){for(var e in r)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&iu(t,r,e)},De,er,xr,jr;Object.defineProperty(et,"__esModule",{value:!0});et.CONNECTION_STATE=et.EVENT=et.RESPONSE_TO_REQUEST=void 0;var $=Ae();_o(Ae(),et);_o(Ui(),et);et.RESPONSE_TO_REQUEST=(De={},De[$.TOPIC.RECORD]=(er={},er[$.RECORD_ACTION.HEAD_RESPONSE]=$.RECORD_ACTION.HEAD,er[$.RECORD_ACTION.READ_RESPONSE]=$.RECORD_ACTION.READ,er[$.RECORD_ACTION.DELETE_SUCCESS]=$.RECORD_ACTION.DELETE,er),De[$.TOPIC.PRESENCE]=(xr={},xr[$.PRESENCE_ACTION.QUERY_RESPONSE]=$.PRESENCE_ACTION.QUERY,xr[$.PRESENCE_ACTION.QUERY_ALL_RESPONSE]=$.PRESENCE_ACTION.QUERY_ALL,xr),De[$.TOPIC.RPC]=(jr={},jr[$.RPC_ACTION.ACCEPT]=$.RPC_ACTION.REQUEST,jr[$.RPC_ACTION.ERROR]=$.RPC_ACTION.REQUEST,jr),De[$.TOPIC.EVENT]={},De);var nu;(function(r){r.RECORD_READ_ONLY_MODE="RECORD_READ_ONLY_MODE",r.UNSOLICITED_MESSAGE="UNSOLICITED_MESSAGE",r.IS_CLOSED="IS_CLOSED",r.MAX_RECONNECTION_ATTEMPTS_REACHED="MAX_RECONNECTION_ATTEMPTS_REACHED",r.CONNECTION_ERROR="CONNECTION_ERROR",r.ACK_TIMEOUT="ACK_TIMEOUT",r.UNKNOWN_CORRELATION_ID="UNKNOWN_CORRELATION_ID",r.HEARTBEAT_TIMEOUT="HEARTBEAT_TIMEOUT",r.LISTENER_EXISTS="LISTENER_EXISTS",r.NOT_LISTENING="NOT_LISTENING",r.RECORD_ALREADY_DESTROYED="RECORD_ALREADY_DESTROYED",r.RECORD_DELETE_TIMEOUT="RECORD_DELETE_TIMEOUT",r.CLIENT_OFFLINE="client offline",r.INVALID_AUTHENTICATION_DETAILS="INVALID_AUTHENTICATION_DETAILS",r.CONNECTION_LOST="connectionLost",r.CONNECTION_REESTABLISHED="connectionReestablished",r.EXIT_LIMBO="exitLimbo",r.CONNECTION_STATE_CHANGED="connectionStateChanged",r.CLIENT_DATA_CHANGED="clientDataChanged",r.REAUTHENTICATION_FAILURE="reauthenticationFailure",r.AUTHENTICATION_TIMEOUT="AUTHENTICATION_TIMEOUT",r.RECORD_ERROR="error",r.RECORD_READY="ready",r.RECORD_DELETED="delete",r.RECORD_DISCARDED="discard",r.RECORD_VERSION_EXISTS="versionExists",r.RECORD_HAS_PROVIDER_CHANGED="hasProviderChanged",r.RECORD_STATE_CHANGED="onRecordStateChanged",r.ENTRY_ADDED_EVENT="entry-added",r.ENTRY_REMOVED_EVENT="entry-removed",r.ENTRY_MOVED_EVENT="entry-moved"})(nu=et.EVENT||(et.EVENT={}));var ou;(function(r){r.CLOSING="CLOSING",r.CLOSED="CLOSED",r.INITIALISING="INITIALISING",r.AWAITING_CONNECTION="AWAITING_CONNECTION",r.CHALLENGING="CHALLENGING",r.AWAITING_AUTHENTICATION="AWAITING_AUTHENTICATION",r.AUTHENTICATING="AUTHENTICATING",r.OPEN="OPEN",r.ERROR="ERROR",r.RECONNECTING="RECONNECTING",r.REDIRECTING="REDIRECTING",r.CHALLENGE_DENIED="CHALLENGE_DENIED",r.TOO_MANY_AUTH_ATTEMPTS="TOO_MANY_AUTH_ATTEMPTS",r.AUTHENTICATION_TIMEOUT="AUTHENTICATION_TIMEOUT",r.PAUSING="PAUSING",r.OFFLINE="OFFLINE"})(ou=et.CONNECTION_STATE||(et.CONNECTION_STATE={}))});var No=R(Vr=>{"use strict";u();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.Logger=void 0;var we=k(),Oo=Ui(),rr=Ae();function su(r){return we.EVENT[r]!==void 0}var au=function(){function r(t){this.emitter=t}return r.prototype.warn=function(t,e,i){var n="Warning: ".concat(rr.TOPIC[t.topic]),o=t.action;o&&(n+=" (".concat(Oo.ACTIONS[t.topic][o],")")),e&&(n+=": ".concat(we.EVENT[e])),i&&(n+=" \u2013 ".concat(typeof i=="string"?i:JSON.stringify(i))),console.warn(n)},r.prototype.error=function(t,e,i){if(su(e))e===we.EVENT.IS_CLOSED||e===we.EVENT.CONNECTION_ERROR?this.emitter.emit("error",i,we.EVENT[e],rr.TOPIC[rr.TOPIC.CONNECTION]):this.emitter.emit("error",i,we.EVENT[e],rr.TOPIC[t.topic]);else{var n=e||t.action;this.emitter.emit("error",i||t,Oo.ACTIONS[t.topic][n],rr.TOPIC[t.topic])}},r}();Vr.Logger=au});var _t=R(At=>{"use strict";u();var cu=At&&At.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},To=At&&At.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o},uu=At&&At.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(At,"__esModule",{value:!0});At.Emitter=void 0;var lu=function(){function r(){this.callbacks=null}return r.prototype.on=function(t,e,i){i===void 0&&(i=this),this.callbacks=this.callbacks||new Map;var n=this.callbacks.get(t);return n?n.push({fn:e,scope:i}):(n=[{fn:e,scope:i}],this.callbacks.set(t,n)),this},r.prototype.once=function(t,e,i){var n=this;i===void 0&&(i=this);var o=function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];n.off(t,o,n),e.apply(n,s)};return o.fn=e,this.on(t,o,i),this},r.prototype.off=function(t,e,i){if(t===void 0&&e===void 0&&i===void 0&&(this.callbacks=null),this.callbacks===null)return this;var n=this.callbacks.get(t);return n?e===void 0&&i===void 0?(this.callbacks.delete(t),this):(n=n.filter(function(o){var s=o.fn,a=o.scope;return!(t!==""&&e===void 0&&i===a||(s===e||s.fn===e)&&(i===void 0||i===a))}),n.length===0?this.callbacks.delete(t):this.callbacks.set(t,n),this):this},r.prototype.removeContext=function(t){var e,i;if(this.callbacks!==null)try{for(var n=cu(this.callbacks),o=n.next();!o.done;o=n.next()){var s=To(o.value,2),a=s[0],c=s[1];this.callbacks.set(a,c.filter(function(l){var h=l.scope;return h===t}))}}catch(l){e={error:l}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}},r.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(this.callbacks===null)return this;var n=this.callbacks.get(t);return!n||n.length===0?this:(n=n.slice(0),n.forEach(function(o){var s=o.fn,a=o.scope;return s.apply(a,e)}),this)},r.prototype.hasListeners=function(t){return this.callbacks===null?!1:this.callbacks.has(t)},r.prototype.eventNames=function(){return this.callbacks===null?[]:uu([],To(this.callbacks.keys()),!1)},r}();At.Emitter=lu});var bo=R(pt=>{"use strict";u();var hu=pt&&pt.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Fr=pt&&pt.__assign||function(){return Fr=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Fr.apply(this,arguments)},fu=pt&&pt.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},du=pt&&pt.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o};Object.defineProperty(pt,"__esModule",{value:!0});pt.TimeoutRegistry=void 0;var vo=k(),pu=_t(),Eu=function(r){hu(t,r);function t(e,i){var n=r.call(this)||this;return n.services=e,n.options=i,n.register=new Map,n}return t.prototype.add=function(e){if(e.duration===void 0&&(e.duration=this.options.subscriptionTimeout),e.event===void 0&&(e.event=vo.EVENT.ACK_TIMEOUT),!this.services.connection.isConnected)return null;this.remove(e.message);var i={timerId:-1,uniqueName:this.getUniqueName(e.message),timeout:e};return i.timerId=this.services.timerRegistry.add({context:this,callback:this.onTimeout,duration:e.duration,data:i}),this.register.set(i.uniqueName,i),i.uniqueName},t.prototype.remove=function(e){var i,n=vo.RESPONSE_TO_REQUEST[e.topic][e.action];n?i=Fr(Fr({},e),{action:n}):i=e;var o=this.getUniqueName(i);this.clear(o)},t.prototype.clear=function(e){var i=this.register.get(e);i&&(this.register.delete(e),this.services.timerRegistry.remove(i.timerId))},t.prototype.onTimeout=function(e){this.register.delete(e.uniqueName);var i=e.timeout;i.callback?i.callback(i.event,i.message):this.services.logger.warn(i.message,i.event)},t.prototype.getUniqueName=function(e){var i=e.originalAction||e.action,n="".concat(e.topic).concat(i,"_");return e.correlationId?n+=e.correlationId:e.name&&(n+=e.name),n},t.prototype.onConnectionLost=function(){var e,i;try{for(var n=fu(this.register),o=n.next();!o.done;o=n.next()){var s=du(o.value,2),a=s[0],c=s[1];this.services.timerRegistry.remove(c.timerId),this.register.delete(a)}}catch(l){e={error:l}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(e)throw e.error}}},t}(pu.Emitter);pt.TimeoutRegistry=Eu});var go=R(Ft=>{"use strict";u();var yu=Ft&&Ft.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ru=Ft&&Ft.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.IntervalTimerRegistry=void 0;var Su=function(){function r(t){this.timerResolution=t,this.registry=new Map,this.timerIdCounter=0,this.timerId=setTimeout(this.triggerTimeouts.bind(this),this.timerResolution)}return r.prototype.close=function(){clearInterval(this.timerId)},r.prototype.triggerTimeouts=function(){var t,e,i=Date.now();try{for(var n=yu(this.registry),o=n.next();!o.done;o=n.next()){var s=Ru(o.value,2),a=s[0],c=s[1];i-c.created>c.duration&&(c.callback.call(c.context,c.data),this.registry.delete(a))}}catch(l){t={error:l}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.timerId=setTimeout(this.triggerTimeouts.bind(this),this.timerResolution)},r.prototype.has=function(t){return this.registry.has(t)},r.prototype.add=function(t){return this.timerIdCounter++,t.created=Date.now(),this.registry.set(this.timerIdCounter,t),this.timerIdCounter},r.prototype.remove=function(t){return this.registry.delete(t)},r.prototype.requestIdleCallback=function(t){setTimeout(t,0)},r}();Ft.IntervalTimerRegistry=Su});var Co=R(Hr=>{"use strict";u();Object.defineProperty(Hr,"__esModule",{value:!0});Hr.NativeTimerRegistry=void 0;var _u=function(){function r(){this.registry=new Set}return r.prototype.close=function(){this.registry.forEach(clearTimeout),this.registry.clear()},r.prototype.has=function(t){return this.registry.has(t)},r.prototype.add=function(t){var e=this,i=setTimeout(function(){e.remove(i),t.callback.call(t.context,t.data)},t.duration);return this.registry.add(i),i},r.prototype.remove=function(t){return clearTimeout(t),this.registry.delete(t)},r.prototype.requestIdleCallback=function(t){setTimeout(t,0)},r}();Hr.NativeTimerRegistry=_u});var mo=R((Vf,Io)=>{"use strict";u();Io.exports=Ou;function Ou(r,t){for(var e=new Array(arguments.length-1),i=0,n=2,o=!0;n<arguments.length;)e[i++]=arguments[n++];return new Promise(function(a,c){e[i]=function(h){if(o)if(o=!1,h)c(h);else{for(var p=new Array(arguments.length-1),g=0;g<p.length;)p[g++]=arguments[g];a.apply(null,p)}};try{r.apply(t||null,e)}catch(l){o&&(o=!1,c(l))}})}});var Po=R(wo=>{"use strict";u();var Gr=wo;Gr.length=function(t){var e=t.length;if(!e)return 0;for(var i=0;--e%4>1&&t.charAt(e)==="=";)++i;return Math.ceil(t.length*3)/4-i};var Pe=new Array(64),Do=new Array(123);for(Ot=0;Ot<64;)Do[Pe[Ot]=Ot<26?Ot+65:Ot<52?Ot+71:Ot<62?Ot-4:Ot-59|43]=Ot++;var Ot;Gr.encode=function(t,e,i){for(var n=null,o=[],s=0,a=0,c;e<i;){var l=t[e++];switch(a){case 0:o[s++]=Pe[l>>2],c=(l&3)<<4,a=1;break;case 1:o[s++]=Pe[c|l>>4],c=(l&15)<<2,a=2;break;case 2:o[s++]=Pe[c|l>>6],o[s++]=Pe[l&63],a=0;break}s>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=Pe[c],o[s++]=61,a===1&&(o[s++]=61)),n?(s&&n.push(String.fromCharCode.apply(String,o.slice(0,s))),n.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var Ao="invalid encoding";Gr.decode=function(t,e,i){for(var n=i,o=0,s,a=0;a<t.length;){var c=t.charCodeAt(a++);if(c===61&&o>1)break;if((c=Do[c])===void 0)throw Error(Ao);switch(o){case 0:s=c,o=1;break;case 1:e[i++]=s<<2|(c&48)>>4,s=c,o=2;break;case 2:e[i++]=(s&15)<<4|(c&60)>>2,s=c,o=3;break;case 3:e[i++]=(s&3)<<6|c,o=0;break}}if(o===1)throw Error(Ao);return i-n};Gr.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Lo=R((qf,Uo)=>{"use strict";u();Uo.exports=qr;function qr(){this._listeners={}}qr.prototype.on=function(t,e,i){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:i||this}),this};qr.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var i=this._listeners[t],n=0;n<i.length;)i[n].fn===e?i.splice(n,1):++n;return this};qr.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<e.length;)e[n].fn.apply(e[n++].ctx,i)}return this}});var Fo=R((Yf,Vo)=>{"use strict";u();Vo.exports=Mo(Mo);function Mo(r){return typeof Float32Array!="undefined"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),i=e[3]===128;function n(c,l,h){t[0]=c,l[h]=e[0],l[h+1]=e[1],l[h+2]=e[2],l[h+3]=e[3]}function o(c,l,h){t[0]=c,l[h]=e[3],l[h+1]=e[2],l[h+2]=e[1],l[h+3]=e[0]}r.writeFloatLE=i?n:o,r.writeFloatBE=i?o:n;function s(c,l){return e[0]=c[l],e[1]=c[l+1],e[2]=c[l+2],e[3]=c[l+3],t[0]}function a(c,l){return e[3]=c[l],e[2]=c[l+1],e[1]=c[l+2],e[0]=c[l+3],t[0]}r.readFloatLE=i?s:a,r.readFloatBE=i?a:s}():function(){function t(i,n,o,s){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,o,s);else if(isNaN(n))i(2143289344,o,s);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,o,s);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,o,s);else{var c=Math.floor(Math.log(n)/Math.LN2),l=Math.round(n*Math.pow(2,-c)*8388608)&8388607;i((a<<31|c+127<<23|l)>>>0,o,s)}}r.writeFloatLE=t.bind(null,Bo),r.writeFloatBE=t.bind(null,ko);function e(i,n,o){var s=i(n,o),a=(s>>31)*2+1,c=s>>>23&255,l=s&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}r.readFloatLE=e.bind(null,xo),r.readFloatBE=e.bind(null,jo)}(),typeof Float64Array!="undefined"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),i=e[7]===128;function n(c,l,h){t[0]=c,l[h]=e[0],l[h+1]=e[1],l[h+2]=e[2],l[h+3]=e[3],l[h+4]=e[4],l[h+5]=e[5],l[h+6]=e[6],l[h+7]=e[7]}function o(c,l,h){t[0]=c,l[h]=e[7],l[h+1]=e[6],l[h+2]=e[5],l[h+3]=e[4],l[h+4]=e[3],l[h+5]=e[2],l[h+6]=e[1],l[h+7]=e[0]}r.writeDoubleLE=i?n:o,r.writeDoubleBE=i?o:n;function s(c,l){return e[0]=c[l],e[1]=c[l+1],e[2]=c[l+2],e[3]=c[l+3],e[4]=c[l+4],e[5]=c[l+5],e[6]=c[l+6],e[7]=c[l+7],t[0]}function a(c,l){return e[7]=c[l],e[6]=c[l+1],e[5]=c[l+2],e[4]=c[l+3],e[3]=c[l+4],e[2]=c[l+5],e[1]=c[l+6],e[0]=c[l+7],t[0]}r.readDoubleLE=i?s:a,r.readDoubleBE=i?a:s}():function(){function t(i,n,o,s,a,c){var l=s<0?1:0;if(l&&(s=-s),s===0)i(0,a,c+n),i(1/s>0?0:2147483648,a,c+o);else if(isNaN(s))i(0,a,c+n),i(2146959360,a,c+o);else if(s>17976931348623157e292)i(0,a,c+n),i((l<<31|2146435072)>>>0,a,c+o);else{var h;if(s<22250738585072014e-324)h=s/5e-324,i(h>>>0,a,c+n),i((l<<31|h/4294967296)>>>0,a,c+o);else{var p=Math.floor(Math.log(s)/Math.LN2);p===1024&&(p=1023),h=s*Math.pow(2,-p),i(h*4503599627370496>>>0,a,c+n),i((l<<31|p+1023<<20|h*1048576&1048575)>>>0,a,c+o)}}}r.writeDoubleLE=t.bind(null,Bo,0,4),r.writeDoubleBE=t.bind(null,ko,4,0);function e(i,n,o,s,a){var c=i(s,a+n),l=i(s,a+o),h=(l>>31)*2+1,p=l>>>20&2047,g=4294967296*(l&1048575)+c;return p===2047?g?NaN:h*(1/0):p===0?h*5e-324*g:h*Math.pow(2,p-1075)*(g+4503599627370496)}r.readDoubleLE=e.bind(null,xo,0,4),r.readDoubleBE=e.bind(null,jo,4,0)}(),r}function Bo(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function ko(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function xo(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function jo(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var Ho=R((exports,module)=>{"use strict";u();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(r){}return null}});var qo=R(Go=>{"use strict";u();var Li=Go;Li.length=function(t){for(var e=0,i=0,n=0;n<t.length;++n)i=t.charCodeAt(n),i<128?e+=1:i<2048?e+=2:(i&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e};Li.read=function(t,e,i){var n=i-e;if(n<1)return"";for(var o=null,s=[],a=0,c;e<i;)c=t[e++],c<128?s[a++]=c:c>191&&c<224?s[a++]=(c&31)<<6|t[e++]&63:c>239&&c<365?(c=((c&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,s[a++]=55296+(c>>10),s[a++]=56320+(c&1023)):s[a++]=(c&15)<<12|(t[e++]&63)<<6|t[e++]&63,a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0);return o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};Li.write=function(t,e,i){for(var n=i,o,s,a=0;a<t.length;++a)o=t.charCodeAt(a),o<128?e[i++]=o:o<2048?(e[i++]=o>>6|192,e[i++]=o&63|128):(o&64512)===55296&&((s=t.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=o&63|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=o&63|128);return i-n}});var Yo=R((zf,Wo)=>{"use strict";u();Wo.exports=Nu;function Nu(r,t,e){var i=e||8192,n=i>>>1,o=null,s=i;return function(c){if(c<1||c>n)return r(c);s+c>i&&(o=r(i),s=0);var l=t.call(o,s,s+=c);return s&7&&(s=(s|7)+1),l}}});var Ko=R((Zf,$o)=>{"use strict";u();$o.exports=K;var ir=Gt();function K(r,t){this.lo=r>>>0,this.hi=t>>>0}var fe=K.zero=new K(0,0);fe.toNumber=function(){return 0};fe.zzEncode=fe.zzDecode=function(){return this};fe.length=function(){return 1};var Tu=K.zeroHash="\0\0\0\0\0\0\0\0";K.fromNumber=function(t){if(t===0)return fe;var e=t<0;e&&(t=-t);var i=t>>>0,n=(t-i)/4294967296>>>0;return e&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new K(i,n)};K.from=function(t){if(typeof t=="number")return K.fromNumber(t);if(ir.isString(t))if(ir.Long)t=ir.Long.fromString(t);else return K.fromNumber(parseInt(t,10));return t.low||t.high?new K(t.low>>>0,t.high>>>0):fe};K.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,i=~this.hi>>>0;return e||(i=i+1>>>0),-(e+i*4294967296)}return this.lo+this.hi*4294967296};K.prototype.toLong=function(t){return ir.Long?new ir.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Ht=String.prototype.charCodeAt;K.fromHash=function(t){return t===Tu?fe:new K((Ht.call(t,0)|Ht.call(t,1)<<8|Ht.call(t,2)<<16|Ht.call(t,3)<<24)>>>0,(Ht.call(t,4)|Ht.call(t,5)<<8|Ht.call(t,6)<<16|Ht.call(t,7)<<24)>>>0)};K.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)};K.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};K.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};K.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:i<128?9:10}});var Gt=R(Mi=>{"use strict";u();var O=Mi;O.asPromise=mo();O.base64=Po();O.EventEmitter=Lo();O.float=Fo();O.inquire=Ho();O.utf8=qo();O.pool=Yo();O.LongBits=Ko();O.isNode=!!(typeof window!="undefined"&&window&&window.process&&window.process.versions&&window.process.versions.node);O.global=O.isNode&&window||typeof window!="undefined"&&window||typeof self!="undefined"&&self||Mi;O.emptyArray=Object.freeze?Object.freeze([]):[];O.emptyObject=Object.freeze?Object.freeze({}):{};O.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};O.isString=function(t){return typeof t=="string"||t instanceof String};O.isObject=function(t){return t&&typeof t=="object"};O.isset=O.isSet=function(t,e){var i=t[e];return i!=null&&t.hasOwnProperty(e)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};O.Buffer=function(){try{var r=O.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch(t){return null}}();O._Buffer_from=null;O._Buffer_allocUnsafe=null;O.newBuffer=function(t){return typeof t=="number"?O.Buffer?O._Buffer_allocUnsafe(t):new O.Array(t):O.Buffer?O._Buffer_from(t):typeof Uint8Array=="undefined"?t:new Uint8Array(t)};O.Array=typeof Uint8Array!="undefined"?Uint8Array:Array;O.Long=O.global.dcodeIO&&O.global.dcodeIO.Long||O.global.Long||O.inquire("long");O.key2Re=/^true|false|0|1$/;O.key32Re=/^-?(?:0|[1-9][0-9]*)$/;O.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;O.longToHash=function(t){return t?O.LongBits.from(t).toHash():O.LongBits.zeroHash};O.longFromHash=function(t,e){var i=O.LongBits.fromHash(t);return O.Long?O.Long.fromBits(i.lo,i.hi,e):i.toNumber(!!e)};function Jo(r,t,e){for(var i=Object.keys(t),n=0;n<i.length;++n)(r[i[n]]===void 0||!e)&&(r[i[n]]=t[i[n]]);return r}O.merge=Jo;O.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Qo(r){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),i&&Jo(this,i)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return r}}),t.prototype.toString=function(){return this.name+": "+this.message},t}O.newError=Qo;O.ProtocolError=Qo("ProtocolError");O.oneOfGetter=function(t){for(var e={},i=0;i<t.length;++i)e[t[i]]=1;return function(){for(var n=Object.keys(this),o=n.length-1;o>-1;--o)if(e[n[o]]===1&&this[n[o]]!==void 0&&this[n[o]]!==null)return n[o]}};O.oneOfSetter=function(t){return function(e){for(var i=0;i<t.length;++i)t[i]!==e&&delete this[t[i]]}};O.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};O._configure=function(){var r=O.Buffer;if(!r){O._Buffer_from=O._Buffer_allocUnsafe=null;return}O._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,i){return new r(e,i)},O._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var Hi=R((id,ts)=>{"use strict";u();ts.exports=D;var Et=Gt(),Bi,Wr=Et.LongBits,zo=Et.base64,Xo=Et.utf8;function nr(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function xi(){}function vu(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function D(){this.len=0,this.head=new nr(xi,0,0),this.tail=this.head,this.states=null}var Zo=function(){return Et.Buffer?function(){return(D.create=function(){return new Bi})()}:function(){return new D}};D.create=Zo();D.alloc=function(t){return new Et.Array(t)};Et.Array!==Array&&(D.alloc=Et.pool(D.alloc,Et.Array.prototype.subarray));D.prototype._push=function(t,e,i){return this.tail=this.tail.next=new nr(t,e,i),this.len+=e,this};function ji(r,t,e){t[e]=r&255}function bu(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function Vi(r,t){this.len=r,this.next=void 0,this.val=t}Vi.prototype=Object.create(nr.prototype);Vi.prototype.fn=bu;D.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Vi((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};D.prototype.int32=function(t){return t<0?this._push(Fi,10,Wr.fromNumber(t)):this.uint32(t)};D.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Fi(r,t,e){for(;r.hi;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}D.prototype.uint64=function(t){var e=Wr.from(t);return this._push(Fi,e.length(),e)};D.prototype.int64=D.prototype.uint64;D.prototype.sint64=function(t){var e=Wr.from(t).zzEncode();return this._push(Fi,e.length(),e)};D.prototype.bool=function(t){return this._push(ji,1,t?1:0)};function ki(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}D.prototype.fixed32=function(t){return this._push(ki,4,t>>>0)};D.prototype.sfixed32=D.prototype.fixed32;D.prototype.fixed64=function(t){var e=Wr.from(t);return this._push(ki,4,e.lo)._push(ki,4,e.hi)};D.prototype.sfixed64=D.prototype.fixed64;D.prototype.float=function(t){return this._push(Et.float.writeFloatLE,4,t)};D.prototype.double=function(t){return this._push(Et.float.writeDoubleLE,8,t)};var gu=Et.Array.prototype.set?function(t,e,i){e.set(t,i)}:function(t,e,i){for(var n=0;n<t.length;++n)e[i+n]=t[n]};D.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(ji,1,0);if(Et.isString(t)){var i=D.alloc(e=zo.length(t));zo.decode(t,i,0),t=i}return this.uint32(e)._push(gu,e,t)};D.prototype.string=function(t){var e=Xo.length(t);return e?this.uint32(e)._push(Xo.write,e,t):this._push(ji,1,0)};D.prototype.fork=function(){return this.states=new vu(this),this.head=this.tail=new nr(xi,0,0),this.len=0,this};D.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 nr(xi,0,0),this.len=0),this};D.prototype.ldelim=function(){var t=this.head,e=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=t.next,this.tail=e,this.len+=i),this};D.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),i=0;t;)t.fn(t.val,e,i),i+=t.len,t=t.next;return e};D._configure=function(r){Bi=r,D.create=Zo(),Bi._configure()}});var is=R((od,rs)=>{"use strict";u();rs.exports=Dt;var es=Hi();(Dt.prototype=Object.create(es.prototype)).constructor=Dt;var qt=Gt();function Dt(){es.call(this)}Dt._configure=function(){Dt.alloc=qt._Buffer_allocUnsafe,Dt.writeBytesBuffer=qt.Buffer&&qt.Buffer.prototype instanceof Uint8Array&&qt.Buffer.prototype.set.name==="set"?function(t,e,i){e.set(t,i)}:function(t,e,i){if(t.copy)t.copy(e,i,0,t.length);else for(var n=0;n<t.length;)e[i++]=t[n++]}};Dt.prototype.bytes=function(t){qt.isString(t)&&(t=qt._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(Dt.writeBytesBuffer,e,t),this};function Cu(r,t,e){r.length<40?qt.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}Dt.prototype.string=function(t){var e=qt.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Cu,e,t),this};Dt._configure()});var Wi=R((ad,cs)=>{"use strict";u();cs.exports=F;var wt=Gt(),qi,ss=wt.LongBits,Iu=wt.utf8;function Nt(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function F(r){this.buf=r,this.pos=0,this.len=r.length}var ns=typeof Uint8Array!="undefined"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new F(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new F(t);throw Error("illegal buffer")},as=function(){return wt.Buffer?function(e){return(F.create=function(n){return wt.Buffer.isBuffer(n)?new qi(n):ns(n)})(e)}:ns};F.create=as();F.prototype._slice=wt.Array.prototype.subarray||wt.Array.prototype.slice;F.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Nt(this,10);return t}}();F.prototype.int32=function(){return this.uint32()|0};F.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Gi(){var r=new ss(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Nt(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw Nt(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}F.prototype.bool=function(){return this.uint32()!==0};function Yr(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}F.prototype.fixed32=function(){if(this.pos+4>this.len)throw Nt(this,4);return Yr(this.buf,this.pos+=4)};F.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Nt(this,4);return Yr(this.buf,this.pos+=4)|0};function os(){if(this.pos+8>this.len)throw Nt(this,8);return new ss(Yr(this.buf,this.pos+=4),Yr(this.buf,this.pos+=4))}F.prototype.float=function(){if(this.pos+4>this.len)throw Nt(this,4);var t=wt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};F.prototype.double=function(){if(this.pos+8>this.len)throw Nt(this,4);var t=wt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};F.prototype.bytes=function(){var t=this.uint32(),e=this.pos,i=this.pos+t;if(i>this.len)throw Nt(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(e,i):e===i?new this.buf.constructor(0):this._slice.call(this.buf,e,i)};F.prototype.string=function(){var t=this.bytes();return Iu.read(t,0,t.length)};F.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Nt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Nt(this);while(this.buf[this.pos++]&128);return this};F.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};F._configure=function(r){qi=r,F.create=as(),qi._configure();var t=wt.Long?"toLong":"toNumber";wt.merge(F.prototype,{int64:function(){return Gi.call(this)[t](!1)},uint64:function(){return Gi.call(this)[t](!0)},sint64:function(){return Gi.call(this).zzDecode()[t](!1)},fixed64:function(){return os.call(this)[t](!0)},sfixed64:function(){return os.call(this)[t](!1)}})}});var fs=R((ud,hs)=>{"use strict";u();hs.exports=de;var ls=Wi();(de.prototype=Object.create(ls.prototype)).constructor=de;var us=Gt();function de(r){ls.call(this,r)}de._configure=function(){us.Buffer&&(de.prototype._slice=us.Buffer.prototype.slice)};de.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};de._configure()});var ps=R((hd,ds)=>{"use strict";u();ds.exports=or;var Yi=Gt();(or.prototype=Object.create(Yi.EventEmitter.prototype)).constructor=or;function or(r,t,e){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Yi.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!t,this.responseDelimited=!!e}or.prototype.rpcCall=function r(t,e,i,n,o){if(!n)throw TypeError("request must be specified");var s=this;if(!o)return Yi.asPromise(r,s,t,e,i,n);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(t,e[s.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(c,l){if(c)return s.emit("error",c,t),o(c);if(l===null){s.end(!0);return}if(!(l instanceof i))try{l=i[s.responseDelimited?"decodeDelimited":"decode"](l)}catch(h){return s.emit("error",h,t),o(h)}return s.emit("data",l,t),o(null,l)})}catch(a){s.emit("error",a,t),setTimeout(function(){o(a)},0);return}};or.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var ys=R(Es=>{"use strict";u();var mu=Es;mu.Service=ps()});var Ss=R((Ed,Rs)=>{"use strict";u();Rs.exports={}});var Ns=R(Os=>{"use strict";u();var ct=Os;ct.build="minimal";ct.Writer=Hi();ct.BufferWriter=is();ct.Reader=Wi();ct.BufferReader=fs();ct.util=Gt();ct.rpc=ys();ct.roots=Ss();ct.configure=_s;function _s(){ct.util._configure(),ct.Writer._configure(ct.BufferWriter),ct.Reader._configure(ct.BufferReader)}_s()});var vs=R((_d,Ts)=>{"use strict";u();Ts.exports=Ns()});var $r=R((Nd,bs)=>{"use strict";u();var sr=vs(),T=sr.Reader,yt=sr.Writer,Wt=sr.util,I=sr.roots.default||(sr.roots.default={});I.AUTH_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="AUTH_UNKNOWN"]=0,t[r[1]="AUTH_ERROR"]=1,t[r[2]="AUTH_REQUEST"]=2,t[r[3]="AUTH_AUTH_SUCCESSFUL"]=3,t[r[4]="AUTH_AUTH_UNSUCCESSFUL"]=4,t[r[100]="AUTH_TOO_MANY_AUTH_ATTEMPTS"]=100,t[r[101]="AUTH_INVALID_MESSAGE"]=101,t[r[102]="AUTH_INVALID_MESSAGE_DATA"]=102,t}();I.AuthMessage=function(){function r(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.isError=!1,r.prototype.isAck=!1,r.encode=function(e,i){return i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(24).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(32).bool(e.isAck),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.AuthMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.isError=e.bool();break;case 4:o.isAck=e.bool();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.CLUSTER_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="CLUSTER_UNKNOWN"]=0,t[r[1]="CLUSTER_REMOVE"]=1,t[r[2]="CLUSTER_STATUS"]=2,t}();I.ClusterMessage=function(){function r(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.isError=!1,r.prototype.isAck=!1,r.prototype.leaderScore=0,r.prototype.role="",r.encode=function(e,i){return i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(24).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(32).bool(e.isAck),e.leaderScore!=null&&Object.hasOwnProperty.call(e,"leaderScore")&&i.uint32(40).int32(e.leaderScore),e.role!=null&&Object.hasOwnProperty.call(e,"role")&&i.uint32(58).string(e.role),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.ClusterMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.isError=e.bool();break;case 4:o.isAck=e.bool();break;case 5:o.leaderScore=e.int32();break;case 7:o.role=e.string();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.CONNECTION_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="CONNECTION_UNKNOWN"]=0,t[r[1]="CONNECTION_ERROR"]=1,t[r[2]="CONNECTION_PING"]=2,t[r[3]="CONNECTION_PONG"]=3,t[r[4]="CONNECTION_ACCEPT"]=4,t[r[5]="CONNECTION_CHALLENGE"]=5,t[r[6]="CONNECTION_REJECT"]=6,t[r[7]="CONNECTION_REDIRECT"]=7,t[r[8]="CONNECTION_CLOSING"]=8,t[r[9]="CONNECTION_CLOSED"]=9,t[r[100]="CONNECTION_AUTHENTICATION_TIMEOUT"]=100,t[r[101]="CONNECTION_INVALID_MESSAGE"]=101,t}();I.ConnectionMessage=function(){function r(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.isError=!1,r.prototype.isAck=!1,r.prototype.url="",r.prototype.protocolVersion="",r.prototype.sdkType="",r.prototype.sdkVersion="",r.encode=function(e,i){return i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(24).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(32).bool(e.isAck),e.url!=null&&Object.hasOwnProperty.call(e,"url")&&i.uint32(42).string(e.url),e.protocolVersion!=null&&Object.hasOwnProperty.call(e,"protocolVersion")&&i.uint32(50).string(e.protocolVersion),e.sdkVersion!=null&&Object.hasOwnProperty.call(e,"sdkVersion")&&i.uint32(58).string(e.sdkVersion),e.sdkType!=null&&Object.hasOwnProperty.call(e,"sdkType")&&i.uint32(66).string(e.sdkType),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.ConnectionMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.isError=e.bool();break;case 4:o.isAck=e.bool();break;case 5:o.url=e.string();break;case 6:o.protocolVersion=e.string();break;case 8:o.sdkType=e.string();break;case 7:o.sdkVersion=e.string();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.EVENT_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="EVENT_UNKNOWN"]=0,t[r[1]="EVENT_ERROR"]=1,t[r[2]="EVENT_EMIT"]=2,t[r[3]="EVENT_SUBSCRIBE"]=3,t[r[4]="EVENT_UNSUBSCRIBE"]=4,t[r[5]="EVENT_LISTEN"]=5,t[r[6]="EVENT_UNLISTEN"]=6,t[r[7]="EVENT_LISTEN_ACCEPT"]=7,t[r[8]="EVENT_LISTEN_REJECT"]=8,t[r[9]="EVENT_SUBSCRIPTION_HAS_PROVIDER"]=9,t[r[10]="EVENT_SUBSCRIPTION_HAS_NO_PROVIDER"]=10,t[r[11]="EVENT_SUBSCRIPTION_FOR_PATTERN_FOUND"]=11,t[r[12]="EVENT_SUBSCRIPTION_FOR_PATTERN_REMOVED"]=12,t[r[100]="EVENT_INVALID_LISTEN_REGEX"]=100,t[r[101]="EVENT_LISTEN_RESPONSE_TIMEOUT"]=101,t[r[102]="EVENT_LISTEN_UNSUCCESSFUL"]=102,t[r[103]="EVENT_MESSAGE_PERMISSION_ERROR"]=103,t[r[104]="EVENT_MESSAGE_DENIED"]=104,t[r[105]="EVENT_INVALID_MESSAGE_DATA"]=105,t[r[106]="EVENT_MULTIPLE_SUBSCRIPTIONS"]=106,t[r[107]="EVENT_NOT_SUBSCRIBED"]=107,t}();I.EventMessage=function(){function r(t){if(this.names=[],t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.correlationId="",r.prototype.isError=!1,r.prototype.isAck=!1,r.prototype.name="",r.prototype.names=Wt.emptyArray,r.prototype.subscription="",r.prototype.originalTOPIC=0,r.prototype.originalAction=0,r.encode=function(e,i){if(i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.correlationId!=null&&Object.hasOwnProperty.call(e,"correlationId")&&i.uint32(26).string(e.correlationId),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(32).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(40).bool(e.isAck),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&i.uint32(50).string(e.name),e.names!=null&&e.names.length)for(var n=0;n<e.names.length;++n)i.uint32(58).string(e.names[n]);return e.subscription!=null&&Object.hasOwnProperty.call(e,"subscription")&&i.uint32(66).string(e.subscription),e.originalTOPIC!=null&&Object.hasOwnProperty.call(e,"originalTOPIC")&&i.uint32(80).int32(e.originalTOPIC),e.originalAction!=null&&Object.hasOwnProperty.call(e,"originalAction")&&i.uint32(88).int32(e.originalAction),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.EventMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.correlationId=e.string();break;case 4:o.isError=e.bool();break;case 5:o.isAck=e.bool();break;case 6:o.name=e.string();break;case 7:o.names&&o.names.length||(o.names=[]),o.names.push(e.string());break;case 8:o.subscription=e.string();break;case 10:o.originalTOPIC=e.int32();break;case 11:o.originalAction=e.int32();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.TOPIC=function(){var r={},t=Object.create(r);return t[r[0]="UNKNOWN"]=0,t[r[1]="PARSER"]=1,t[r[2]="CONNECTION"]=2,t[r[3]="AUTH"]=3,t[r[4]="EVENT"]=4,t[r[5]="RECORD"]=5,t[r[6]="RPC"]=6,t[r[7]="PRESENCE"]=7,t[r[8]="MONITORING"]=8,t[r[9]="CLUSTER"]=9,t[r[10]="LOCK"]=10,t[r[11]="STATE_REGISTRY"]=11,t[r[100]="ERROR"]=100,t}();I.Message=function(){function r(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.topic=0,r.prototype.message=Wt.newBuffer([]),r.encode=function(e,i){return i||(i=yt.create()),e.topic!=null&&Object.hasOwnProperty.call(e,"topic")&&i.uint32(16).int32(e.topic),e.message!=null&&Object.hasOwnProperty.call(e,"message")&&i.uint32(26).bytes(e.message),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.Message;e.pos<n;){var s=e.uint32();switch(s>>>3){case 2:o.topic=e.int32();break;case 3:o.message=e.bytes();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.LOCK_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="LOCK_UNKNOWN"]=0,t[r[1]="LOCK_ERROR"]=1,t[r[2]="LOCK_REQUEST"]=2,t[r[3]="LOCK_RESPONSE"]=3,t[r[4]="LOCK_RELEASE"]=4,t}();I.LockMessage=function(){function r(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.locked=!1,r.encode=function(e,i){return i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.locked!=null&&Object.hasOwnProperty.call(e,"locked")&&i.uint32(24).bool(e.locked),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.LockMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 3:o.locked=e.bool();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.MONITORING_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="MONITORING_UNKNOWN"]=0,t}();I.MonitoringMessage=function(){function r(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.correlationId="",r.prototype.isError=!1,r.prototype.isAck=!1,r.encode=function(e,i){return i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.correlationId!=null&&Object.hasOwnProperty.call(e,"correlationId")&&i.uint32(26).string(e.correlationId),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(32).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(40).bool(e.isAck),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.MonitoringMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.correlationId=e.string();break;case 4:o.isError=e.bool();break;case 5:o.isAck=e.bool();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.PARSER_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="PARSER_UNKNOWN"]=0,t[r[1]="PARSER_UNKNOWN_TOPIC"]=1,t[r[2]="PARSER_UNKNOWN_ACTION"]=2,t[r[3]="PARSER_INVALID_MESSAGE"]=3,t[r[4]="PARSER_MESSAGE_PARSE_ERROR"]=4,t[r[5]="PARSER_MAXIMUM_MESSAGE_SIZE_EXCEEDED"]=5,t[r[6]="PARSER_ERROR"]=6,t[r[7]="PARSER_INVALID_META_PARAMS"]=7,t}();I.ParserMessage=function(){function r(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.originalTOPIC=0,r.prototype.originalAction=0,r.encode=function(e,i){return i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.originalTOPIC!=null&&Object.hasOwnProperty.call(e,"originalTOPIC")&&i.uint32(64).int32(e.originalTOPIC),e.originalAction!=null&&Object.hasOwnProperty.call(e,"originalAction")&&i.uint32(72).int32(e.originalAction),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.ParserMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 8:o.originalTOPIC=e.int32();break;case 9:o.originalAction=e.int32();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.PRESENCE_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="PRESENCE_UNKNOWN"]=0,t[r[1]="PRESENCE_ERROR"]=1,t[r[2]="PRESENCE_QUERY_ALL"]=2,t[r[3]="PRESENCE_QUERY_ALL_RESPONSE"]=3,t[r[4]="PRESENCE_QUERY"]=4,t[r[5]="PRESENCE_QUERY_RESPONSE"]=5,t[r[6]="PRESENCE_PRESENCE_JOIN"]=6,t[r[7]="PRESENCE_PRESENCE_JOIN_ALL"]=7,t[r[8]="PRESENCE_PRESENCE_LEAVE"]=8,t[r[9]="PRESENCE_PRESENCE_LEAVE_ALL"]=9,t[r[10]="PRESENCE_SUBSCRIBE"]=10,t[r[11]="PRESENCE_UNSUBSCRIBE"]=11,t[r[12]="PRESENCE_SUBSCRIBE_ALL"]=12,t[r[13]="PRESENCE_UNSUBSCRIBE_ALL"]=13,t[r[100]="PRESENCE_INVALID_PRESENCE_USERS"]=100,t[r[101]="PRESENCE_MESSAGE_PERMISSION_ERROR"]=101,t[r[102]="PRESENCE_MESSAGE_DENIED"]=102,t[r[103]="PRESENCE_MULTIPLE_SUBSCRIPTIONS"]=103,t[r[104]="PRESENCE_NOT_SUBSCRIBED"]=104,t}();I.PresenceMessage=function(){function r(t){if(this.names=[],t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.originalTOPIC=0,r.prototype.originalAction=0,r.prototype.data="",r.prototype.correlationId="",r.prototype.isError=!1,r.prototype.isAck=!1,r.prototype.name="",r.prototype.names=Wt.emptyArray,r.encode=function(e,i){if(i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.originalTOPIC!=null&&Object.hasOwnProperty.call(e,"originalTOPIC")&&i.uint32(16).int32(e.originalTOPIC),e.originalAction!=null&&Object.hasOwnProperty.call(e,"originalAction")&&i.uint32(24).int32(e.originalAction),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(34).string(e.data),e.correlationId!=null&&Object.hasOwnProperty.call(e,"correlationId")&&i.uint32(42).string(e.correlationId),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(48).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(56).bool(e.isAck),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&i.uint32(66).string(e.name),e.names!=null&&e.names.length)for(var n=0;n<e.names.length;++n)i.uint32(74).string(e.names[n]);return i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.PresenceMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.originalTOPIC=e.int32();break;case 3:o.originalAction=e.int32();break;case 4:o.data=e.string();break;case 5:o.correlationId=e.string();break;case 6:o.isError=e.bool();break;case 7:o.isAck=e.bool();break;case 8:o.name=e.string();break;case 9:o.names&&o.names.length||(o.names=[]),o.names.push(e.string());break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.RECORD_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="RECORD_UNKNOWN"]=0,t[r[1]="RECORD_ERROR"]=1,t[r[2]="RECORD_NOTIFY"]=2,t[r[3]="RECORD_READ"]=3,t[r[4]="RECORD_READ_RESPONSE"]=4,t[r[5]="RECORD_HEAD"]=5,t[r[6]="RECORD_HEAD_RESPONSE"]=6,t[r[7]="RECORD_HEAD_BULK"]=7,t[r[8]="RECORD_HEAD_RESPONSE_BULK"]=8,t[r[9]="RECORD_DELETE"]=9,t[r[10]="RECORD_DELETE_SUCCESS"]=10,t[r[11]="RECORD_DELETE_BULK"]=11,t[r[12]="RECORD_DELETE_BULK_SUCCESS"]=12,t[r[13]="RECORD_DELETED"]=13,t[r[14]="RECORD_WRITE_ACKNOWLEDGEMENT"]=14,t[r[15]="RECORD_CREATE"]=15,t[r[16]="RECORD_CREATEANDUPDATE"]=16,t[r[17]="RECORD_CREATEANDPATCH"]=17,t[r[18]="RECORD_UPDATE"]=18,t[r[19]="RECORD_PATCH"]=19,t[r[20]="RECORD_ERASE"]=20,t[r[21]="RECORD_SUBSCRIBEANDHEAD"]=21,t[r[22]="RECORD_SUBSCRIBEANDREAD"]=22,t[r[23]="RECORD_SUBSCRIBECREATEANDREAD"]=23,t[r[24]="RECORD_SUBSCRIBECREATEANDUPDATE"]=24,t[r[25]="RECORD_SUBSCRIBE"]=25,t[r[26]="RECORD_UNSUBSCRIBE"]=26,t[r[27]="RECORD_LISTEN"]=27,t[r[28]="RECORD_UNLISTEN"]=28,t[r[29]="RECORD_LISTEN_ACCEPT"]=29,t[r[30]="RECORD_LISTEN_REJECT"]=30,t[r[31]="RECORD_SUBSCRIPTION_HAS_PROVIDER"]=31,t[r[32]="RECORD_SUBSCRIPTION_HAS_NO_PROVIDER"]=32,t[r[33]="RECORD_SUBSCRIPTION_FOR_PATTERN_FOUND"]=33,t[r[34]="RECORD_SUBSCRIPTION_FOR_PATTERN_REMOVED"]=34,t[r[100]="RECORD_CACHE_RETRIEVAL_TIMEOUT"]=100,t[r[101]="RECORD_STORAGE_RETRIEVAL_TIMEOUT"]=101,t[r[102]="RECORD_VERSION_EXISTS"]=102,t[r[103]="RECORD_RECORD_LOAD_ERROR"]=103,t[r[104]="RECORD_RECORD_CREATE_ERROR"]=104,t[r[105]="RECORD_RECORD_UPDATE_ERROR"]=105,t[r[106]="RECORD_RECORD_DELETE_ERROR"]=106,t[r[107]="RECORD_RECORD_NOT_FOUND"]=107,t[r[108]="RECORD_INVALID_VERSION"]=108,t[r[109]="RECORD_INVALID_PATCH_ON_HOTPATH"]=109,t[r[110]="RECORD_INVALID_LISTEN_REGEX"]=110,t[r[111]="RECORD_LISTEN_RESPONSE_TIMEOUT"]=111,t[r[112]="RECORD_LISTEN_UNSUCCESSFUL"]=112,t[r[113]="RECORD_RECORD_NOTIFY_ERROR"]=113,t[r[114]="RECORD_MESSAGE_PERMISSION_ERROR"]=114,t[r[115]="RECORD_MESSAGE_DENIED"]=115,t[r[116]="RECORD_INVALID_MESSAGE_DATA"]=116,t[r[117]="RECORD_MULTIPLE_SUBSCRIPTIONS"]=117,t[r[118]="RECORD_NOT_SUBSCRIBED"]=118,t}();I.RecordMessage=function(){function r(t){if(this.names=[],this.versions={},t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.correlationId="",r.prototype.isError=!1,r.prototype.isAck=!1,r.prototype.name="",r.prototype.names=Wt.emptyArray,r.prototype.pattern="",r.prototype.subscription="",r.prototype.originalAction=0,r.prototype.isWriteAck=!1,r.prototype.path="",r.prototype.version=0,r.prototype.versions=Wt.emptyObject,r.encode=function(e,i){if(i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.correlationId!=null&&Object.hasOwnProperty.call(e,"correlationId")&&i.uint32(26).string(e.correlationId),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(32).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(40).bool(e.isAck),e.name!=null&&Object.hasOwnProperty.call(e,"name")&&i.uint32(50).string(e.name),e.names!=null&&e.names.length)for(var n=0;n<e.names.length;++n)i.uint32(58).string(e.names[n]);if(e.pattern!=null&&Object.hasOwnProperty.call(e,"pattern")&&i.uint32(66).string(e.pattern),e.subscription!=null&&Object.hasOwnProperty.call(e,"subscription")&&i.uint32(74).string(e.subscription),e.originalAction!=null&&Object.hasOwnProperty.call(e,"originalAction")&&i.uint32(80).int32(e.originalAction),e.isWriteAck!=null&&Object.hasOwnProperty.call(e,"isWriteAck")&&i.uint32(88).bool(e.isWriteAck),e.path!=null&&Object.hasOwnProperty.call(e,"path")&&i.uint32(98).string(e.path),e.version!=null&&Object.hasOwnProperty.call(e,"version")&&i.uint32(104).int32(e.version),e.versions!=null&&Object.hasOwnProperty.call(e,"versions"))for(var o=Object.keys(e.versions),n=0;n<o.length;++n)i.uint32(114).fork().uint32(10).string(o[n]).uint32(16).int32(e.versions[o[n]]).ldelim();return i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.RecordMessage,s,a;e.pos<n;){var c=e.uint32();switch(c>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.correlationId=e.string();break;case 4:o.isError=e.bool();break;case 5:o.isAck=e.bool();break;case 6:o.name=e.string();break;case 7:o.names&&o.names.length||(o.names=[]),o.names.push(e.string());break;case 8:o.pattern=e.string();break;case 9:o.subscription=e.string();break;case 10:o.originalAction=e.int32();break;case 11:o.isWriteAck=e.bool();break;case 12:o.path=e.string();break;case 13:o.version=e.int32();break;case 14:o.versions===Wt.emptyObject&&(o.versions={});var l=e.uint32()+e.pos;for(s="",a=0;e.pos<l;){var h=e.uint32();switch(h>>>3){case 1:s=e.string();break;case 2:a=e.int32();break;default:e.skipType(h&7);break}}o.versions[s]=a;break;default:e.skipType(c&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.RPC_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="RPC_UNKNOWN"]=0,t[r[1]="RPC_ERROR"]=1,t[r[2]="RPC_REQUEST"]=2,t[r[4]="RPC_ACCEPT"]=4,t[r[5]="RPC_RESPONSE"]=5,t[r[6]="RPC_REJECT"]=6,t[r[7]="RPC_REQUEST_ERROR"]=7,t[r[8]="RPC_PROVIDE"]=8,t[r[9]="RPC_UNPROVIDE"]=9,t[r[100]="RPC_NO_RPC_PROVIDER"]=100,t[r[101]="RPC_ACCEPT_TIMEOUT"]=101,t[r[102]="RPC_MULTIPLE_ACCEPT"]=102,t[r[103]="RPC_INVALID_RPC_CORRELATION_ID"]=103,t[r[104]="RPC_RESPONSE_TIMEOUT"]=104,t[r[105]="RPC_MULTIPLE_RESPONSE"]=105,t[r[106]="RPC_MESSAGE_PERMISSION_ERROR"]=106,t[r[107]="RPC_MESSAGE_DENIED"]=107,t[r[108]="RPC_INVALID_MESSAGE_DATA"]=108,t[r[109]="RPC_MULTIPLE_PROVIDERS"]=109,t[r[110]="RPC_NOT_PROVIDED"]=110,t}();I.RpcMessage=function(){function r(t){if(this.names=[],t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.correlationId="",r.prototype.isError=!1,r.prototype.isAck=!1,r.prototype.names=Wt.emptyArray,r.prototype.name="",r.prototype.originalAction=0,r.prototype.requestorName="",r.prototype.requestorData="",r.encode=function(e,i){if(i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.correlationId!=null&&Object.hasOwnProperty.call(e,"correlationId")&&i.uint32(26).string(e.correlationId),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(32).bool(e.isError),e.isAck!=null&&Object.hasOwnProperty.call(e,"isAck")&&i.uint32(40).bool(e.isAck),e.names!=null&&e.names.length)for(var n=0;n<e.names.length;++n)i.uint32(50).string(e.names[n]);return e.name!=null&&Object.hasOwnProperty.call(e,"name")&&i.uint32(58).string(e.name),e.originalAction!=null&&Object.hasOwnProperty.call(e,"originalAction")&&i.uint32(72).int32(e.originalAction),e.requestorName!=null&&Object.hasOwnProperty.call(e,"requestorName")&&i.uint32(82).string(e.requestorName),e.requestorData!=null&&Object.hasOwnProperty.call(e,"requestorData")&&i.uint32(90).string(e.requestorData),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.RpcMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.correlationId=e.string();break;case 4:o.isError=e.bool();break;case 5:o.isAck=e.bool();break;case 6:o.names&&o.names.length||(o.names=[]),o.names.push(e.string());break;case 7:o.name=e.string();break;case 9:o.originalAction=e.int32();break;case 10:o.requestorName=e.string();break;case 11:o.requestorData=e.string();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();I.STATE_REGISTRY_TOPIC=function(){var r={},t=Object.create(r);return t[r[0]="STATE_REGISTRY_UNKNOWN"]=0,t[r[11]="STATE_REGISTRY_EVENT_SUBSCRIPTIONS"]=11,t[r[12]="STATE_REGISTRY_RECORD_SUBSCRIPTIONS"]=12,t[r[9]="STATE_REGISTRY_SUBSCRIPTIONS"]=9,t[r[10]="STATE_REGISTRY_ONLINE_USERS"]=10,t[r[24]="STATE_REGISTRY_MONITORING_SUBSCRIPTIONS"]=24,t[r[13]="STATE_REGISTRY_RPC_SUBSCRIPTIONS"]=13,t[r[14]="STATE_REGISTRY_PRESENCE_SUBSCRIPTIONS"]=14,t[r[15]="STATE_REGISTRY_RECORD_LISTEN_PATTERNS"]=15,t[r[16]="STATE_REGISTRY_EVENT_LISTEN_PATTERNS"]=16,t[r[17]="STATE_REGISTRY_RECORD_PUBLISHED_SUBSCRIPTIONS"]=17,t[r[18]="STATE_REGISTRY_EVENT_PUBLISHED_SUBSCRIPTIONS"]=18,t[r[19]="STATE_REGISTRY_RECORD_LISTENING"]=19,t[r[20]="STATE_REGISTRY_EVENT_LISTENING"]=20,t[r[21]="STATE_REGISTRY_STATE_REGISTRY"]=21,t}();I.STATE_ACTION=function(){var r={},t=Object.create(r);return t[r[0]="STATE_UNKNOWN"]=0,t[r[1]="STATE_ERROR"]=1,t[r[2]="STATE_ADD"]=2,t[r[3]="STATE_REMOVE"]=3,t[r[4]="STATE_REQUEST_FULL_STATE"]=4,t[r[5]="STATE_FULL_STATE"]=5,t[r[6]="STATE_CHECKSUM"]=6,t}();I.StateMessage=function(){function r(t){if(this.fullState=[],t)for(var e=Object.keys(t),i=0;i<e.length;++i)t[e[i]]!=null&&(this[e[i]]=t[e[i]])}return r.prototype.action=0,r.prototype.data="",r.prototype.isError=!1,r.prototype.checksum=0,r.prototype.fullState=Wt.emptyArray,r.prototype.serverName="",r.prototype.registryTOPIC=0,r.encode=function(e,i){if(i||(i=yt.create()),e.action!=null&&Object.hasOwnProperty.call(e,"action")&&i.uint32(8).int32(e.action),e.data!=null&&Object.hasOwnProperty.call(e,"data")&&i.uint32(18).string(e.data),e.isError!=null&&Object.hasOwnProperty.call(e,"isError")&&i.uint32(24).bool(e.isError),e.checksum!=null&&Object.hasOwnProperty.call(e,"checksum")&&i.uint32(152).int32(e.checksum),e.fullState!=null&&e.fullState.length)for(var n=0;n<e.fullState.length;++n)i.uint32(162).string(e.fullState[n]);return e.serverName!=null&&Object.hasOwnProperty.call(e,"serverName")&&i.uint32(170).string(e.serverName),e.registryTOPIC!=null&&Object.hasOwnProperty.call(e,"registryTOPIC")&&i.uint32(176).int32(e.registryTOPIC),i},r.encodeDelimited=function(e,i){return this.encode(e,i).ldelim()},r.decode=function(e,i){e instanceof T||(e=T.create(e));for(var n=i===void 0?e.len:e.pos+i,o=new I.StateMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.action=e.int32();break;case 2:o.data=e.string();break;case 3:o.isError=e.bool();break;case 19:o.checksum=e.int32();break;case 20:o.fullState&&o.fullState.length||(o.fullState=[]),o.fullState.push(e.string());break;case 21:o.serverName=e.string();break;case 22:o.registryTOPIC=e.int32();break;default:e.skipType(s&7);break}}return o},r.decodeDelimited=function(e){return e instanceof T||(e=new T(e)),this.decode(e,e.uint32())},r}();bs.exports=I});var Ki=R($i=>{"use strict";u();Object.defineProperty($i,"__esModule",{value:!0});var G=$r();$i.TopicMessage={[G.TOPIC.RECORD]:G.RecordMessage,[G.TOPIC.CLUSTER]:G.ClusterMessage,[G.TOPIC.CONNECTION]:G.ConnectionMessage,[G.TOPIC.AUTH]:G.AuthMessage,[G.TOPIC.EVENT]:G.EventMessage,[G.TOPIC.LOCK]:G.LockMessage,[G.TOPIC.MONITORING]:G.MonitoringMessage,[G.TOPIC.PARSER]:G.ParserMessage,[G.TOPIC.PRESENCE]:G.PresenceMessage,[G.TOPIC.RPC]:G.RpcMessage}});var Ji=R(Kr=>{"use strict";u();Object.defineProperty(Kr,"__esModule",{value:!0});var Au=Ki(),Du=$r(),gs=Ae();function wu(r){try{let t=Du.Message.decodeDelimited(r),e=Au.TopicMessage[t.topic].decode(t.message,t.message.length);return[Object.assign({topic:t.topic},e)]}catch(t){return[{topic:gs.TOPIC.PARSER,action:gs.PARSER_ACTION.ERROR}]}}Kr.parse=wu;function Pu(r){return r.requestorData&&(r.requestorData=JSON.parse(r.requestorData)),r.parsedData!==void 0||r.data===void 0?!0:(r.parsedData=JSON.parse(r.data),r.parsedData===void 0?new Error(`unable to parse data ${r.data}`):!0)}Kr.parseData=Pu});var Qi=R(Jr=>{"use strict";u();Object.defineProperty(Jr,"__esModule",{value:!0});Jr.StateMachine=void 0;var Uu=function(){function r(t,e){this.stateMachine=e,this.inEndState=!1,this.transitions=e.transitions,this.state=e.init,this.context=e.context,this.history=[{oldState:"-",newState:this.state,transitionName:"-"}]}return r.prototype.transition=function(t){for(var e,i=0;i<this.transitions.length;i++)if(e=this.transitions[i],t===e.name&&(this.state===e.from||e.from===void 0)){this.history.push({oldState:this.state,transitionName:t,newState:e.to});var n=this.state;this.state=e.to,this.stateMachine.onStateChanged&&this.stateMachine.onStateChanged.call(this.context,this.state,n),e.handler&&e.handler.call(this.context),e.isEndState===!0&&(this.inEndState=!0);return}var o=JSON.stringify({transition:t,fromState:this.state}),s=this.history.reverse().reduce(function(a,c){return a+=`
	From `.concat(c.oldState," to ").concat(c.newState," via ").concat(c.transitionName)},"");console.trace(`Invalid state transition.
Details: `.concat(o,` 
History: `).concat(s))},r}();Jr.StateMachine=Uu});var Pt=R(J=>{"use strict";u();Object.defineProperty(J,"__esModule",{value:!0});J.PromiseDelay=J.normalizeArguments=J.normalizeSetArguments=J.getUid=J.parseUrl=J.shallowCopy=J.deepCopy=J.deepEquals=void 0;var Lu=function(r,t){return r===t?!0:typeof r!="object"||typeof t!="object"?!1:JSON.stringify(r)===JSON.stringify(t)};J.deepEquals=Lu;var Mu=function(r){return typeof r=="object"?JSON.parse(JSON.stringify(r)):r};J.deepCopy=Mu;var Bu=function(r){if(Array.isArray(r))return r.slice(0);if(typeof r=="object"){for(var t=Object.create(null),e=Object.keys(r),i=0;i<e.length;i++)t[e[i]]=r[e[i]];return t}return r};J.shallowCopy=Bu;var ku=/^wss:|^ws:|^\/\//,xu=/^http:|^https:/,ju=function(r,t){var e=r;if(xu.test(e))throw new Error("Only ws and wss are supported");ku.test(e)?e.indexOf("//")===0&&(e="ws:".concat(e)):e="ws://".concat(e);var i=e.split("//")[0],n=e.split("//")[1];if(!n)throw new Error("Invalid URL: ws://");var o=null;return n.indexOf("/")>-1?(o=n.split("/"),n=o.shift()||"",o="/"+o.join("")):n.indexOf("?")>-1&&(o=n.split("?"),n=o.shift()||"",o=t+"?"+o.join("")),(!o||o==="/")&&(o=t),"".concat(i,"//").concat(n).concat(o)};J.parseUrl=ju;var Vu=function(){var r=new Date().getTime().toString(36),t=(Math.random()*1e16).toString(36).replace(".","");return"".concat(r,"-").concat(t)};J.getUid=Vu;var Fu=function(r,t){t===void 0&&(t=0);var e,i=function(a){return a!==void 0&&typeof a=="object"},n=function(a){return typeof a!="function"},o=function(a){return a!==void 0&&typeof a=="string"},s=function(a){return typeof a=="function"};if(r.length===t+1&&(e={path:void 0,data:i(r[t])?r[t]:void 0,callback:void 0}),r.length===t+2&&(e={path:void 0,data:void 0,callback:void 0},!s(r[t])&&n(r[t])&&(e.path=o(r[t])?r[t]:void 0),o(r[t])?e.data=n(r[t+1])?r[t+1]:void 0:e.data=i(r[t])?r[t]:void 0,o(r[t])||(e.callback=s(r[t+1])?r[t+1]:!1)),r.length===t+3&&(e={path:o(r[t])?r[t]:void 0,data:n(r[t+1])?r[t+1]:void 0,callback:s(r[t+2])?r[t+2]:void 0}),e){if(e.path!==void 0&&e.path.length===0||e.path===void 0&&!e.data)throw Error("Invalid set path argument");if(e.data===void 0&&e.path===void 0)throw Error("Invalid set data argument");if(e.callback!==void 0&&e.callback===!1||e.callback===void 0&&r.length===t+3)throw Error("Invalid set callback argument");return e}throw Error("Invalid set arguments")};J.normalizeSetArguments=Fu;var Hu=function(r){if(r.length===1&&typeof r[0]=="object")return r[0];for(var t=Object.create(null),e=0;e<r.length;e++)typeof r[e]=="string"?t.path=r[e]:typeof r[e]=="function"?t.callback=r[e]:typeof r[e]=="boolean"&&(t.triggerNow=r[e]);return t};J.normalizeArguments=Hu;var Gu=function(r){return new Promise(function(t){return setTimeout(t,r)})};J.PromiseDelay=Gu});var Cs=R((wd,qu)=>{qu.exports={name:"@deepstream/client",version:"7.0.5",description:"the javascript client for deepstreamIO",keywords:["deepstream","javascript","realtime","client"],mocha:{recursive:!0,reporter:"dot",require:"ts-node/register/transpile-only",exit:!0},main:"dist/src/deepstream.js",types:"dist/src/deepstream-client.d.ts",directories:{test:"src/test"},scripts:{tsc:"rm -rf dist && tsc",build:"npm run tsc && npm run build:dev && npm run build:prod","build:dev":"webpack --config webpack.dev.js","build:prod":"webpack --config webpack.prod.js",rebuild:"rimraf dist && webpack",clean:"rimraf dist",lint:"tslint src/*.ts src/**/*.ts -t verbose","lint:fix":"npm run lint -- --fix",test:"mocha src/**/*.spec.ts","test:coverage":"nyc npm test","bundle:analyse":"webpack --config webpack.prod.js --profile --json > ./dist/stats.json && webpack-bundle-analyzer ./dist/stats.json",postinstall:"node scripts/postinstall.js"},repository:{type:"git",url:"https://github.com/deepstreamIO/deepstream.io-client-js.git"},dependencies:{"@deepstream/protobuf":"^1.0.8",protobufjs:"^7.5.0",ws:"^7.4.0"},browser:{net:!1,ws:!1},devDependencies:{"@istanbuljs/nyc-config-typescript":"^1.0.1","@types/chai":"^4.3.20","@types/mocha":"^8.2.3","@types/node":"^14.18.63","@types/sinon":"^9.0.11","@types/ws":"^7.4.0",buffer:"^6.0.3",chai:"^4.5.0",coveralls:"^3.1.0",husky:"^4.3.0",mocha:"^10.2.0","mocha-lcov-reporter":"^1.3.0",nyc:"^15.1.0",rimraf:"^3.0.2",sinon:"^9.2.1","terser-webpack-plugin":"^4.2.3","ts-essentials":"^10.0.4","ts-loader":"^9.5.2","ts-node":"^10.9.2",tslint:"^6.1.3",typescript:"^4.9.5",webpack:"^5.75.0","webpack-bundle-analyzer":"^4.10.2","webpack-cli":"^5.0.1"},author:"deepstreamHub GmbH",license:"MIT",bugs:{url:"https://github.com/deepstreamIO/deepstream.io-client-js/issues"},homepage:"http://deepstreamio.github.io",eslintConfig:{extends:"deepstream"},husky:{hooks:{"pre-commit":"npm t && npm run lint && npm run build","pre-publish":"npm t && npm run build"}},nyc:{extends:"@istanbuljs/nyc-config-typescript",include:["src/**/*.ts"],exclude:["src/**/*.spec.ts"],extension:[".ts"],require:["ts-node/register"],reporter:["lcov"]}}});var ms=R(Qr=>{"use strict";u();Object.defineProperty(Qr,"__esModule",{value:!0});Qr.Connection=void 0;var d=k(),Wu=Ji(),Yu=Qi(),Is=Pt(),$u=_t(),Ku=Cs(),Ju=function(){function r(t,e,i,n){var o=this;this.services=t,this.options=e,this.reconnectTimeout=null,this.authParams=null,this.handlers=new Map,this.authCallback=null,this.resumeCallback=null,this.emitter=n,this.internalEmitter=new $u.Emitter,this.isInLimbo=!0,this.clientData=null,this.heartbeatIntervalTimeout=null,this.endpoint=null,this.reconnectionAttempt=0,this.limboTimeout=null;var s=!1,a=!0;this.stateMachine=new Yu.StateMachine(this.services.logger,{init:d.CONNECTION_STATE.CLOSED,onStateChanged:function(c,l){c!==l&&(n.emit(d.EVENT.CONNECTION_STATE_CHANGED,c),c===d.CONNECTION_STATE.RECONNECTING?(o.isInLimbo=!0,s=!0,l!==d.CONNECTION_STATE.CLOSED&&(o.internalEmitter.emit(d.EVENT.CONNECTION_LOST),o.limboTimeout=o.services.timerRegistry.add({duration:o.options.offlineBufferTimeout,context:o,callback:function(){o.isInLimbo=!1,o.internalEmitter.emit(d.EVENT.EXIT_LIMBO)}}))):c===d.CONNECTION_STATE.OPEN&&(s||a)&&(a=!1,o.isInLimbo=!1,o.internalEmitter.emit(d.EVENT.CONNECTION_REESTABLISHED),o.services.timerRegistry.remove(o.limboTimeout)))},transitions:[{name:"initialised",from:d.CONNECTION_STATE.CLOSED,to:d.CONNECTION_STATE.INITIALISING},{name:"connected",from:d.CONNECTION_STATE.INITIALISING,to:d.CONNECTION_STATE.AWAITING_CONNECTION},{name:"connected",from:d.CONNECTION_STATE.REDIRECTING,to:d.CONNECTION_STATE.AWAITING_CONNECTION},{name:"connected",from:d.CONNECTION_STATE.RECONNECTING,to:d.CONNECTION_STATE.AWAITING_CONNECTION},{name:"challenge",from:d.CONNECTION_STATE.AWAITING_CONNECTION,to:d.CONNECTION_STATE.CHALLENGING},{name:"redirected",from:d.CONNECTION_STATE.CHALLENGING,to:d.CONNECTION_STATE.REDIRECTING},{name:"challenge-denied",from:d.CONNECTION_STATE.CHALLENGING,to:d.CONNECTION_STATE.CHALLENGE_DENIED},{name:"accepted",from:d.CONNECTION_STATE.CHALLENGING,to:d.CONNECTION_STATE.AWAITING_AUTHENTICATION,handler:this.onAwaitingAuthentication.bind(this)},{name:"authentication-timeout",from:d.CONNECTION_STATE.AWAITING_CONNECTION,to:d.CONNECTION_STATE.AUTHENTICATION_TIMEOUT},{name:"authentication-timeout",from:d.CONNECTION_STATE.AWAITING_AUTHENTICATION,to:d.CONNECTION_STATE.AUTHENTICATION_TIMEOUT},{name:"authenticate",from:d.CONNECTION_STATE.AWAITING_AUTHENTICATION,to:d.CONNECTION_STATE.AUTHENTICATING},{name:"unsuccesful-login",from:d.CONNECTION_STATE.AUTHENTICATING,to:d.CONNECTION_STATE.AWAITING_AUTHENTICATION},{name:"succesful-login",from:d.CONNECTION_STATE.AUTHENTICATING,to:d.CONNECTION_STATE.OPEN},{name:"too-many-auth-attempts",from:d.CONNECTION_STATE.AUTHENTICATING,to:d.CONNECTION_STATE.TOO_MANY_AUTH_ATTEMPTS},{name:"too-many-auth-attempts",from:d.CONNECTION_STATE.AWAITING_AUTHENTICATION,to:d.CONNECTION_STATE.TOO_MANY_AUTH_ATTEMPTS},{name:"authentication-timeout",from:d.CONNECTION_STATE.AWAITING_AUTHENTICATION,to:d.CONNECTION_STATE.AUTHENTICATION_TIMEOUT},{name:"reconnect",from:d.CONNECTION_STATE.RECONNECTING,to:d.CONNECTION_STATE.RECONNECTING},{name:"closed",from:d.CONNECTION_STATE.CLOSING,to:d.CONNECTION_STATE.CLOSED},{name:"offline",from:d.CONNECTION_STATE.PAUSING,to:d.CONNECTION_STATE.OFFLINE},{name:"error",to:d.CONNECTION_STATE.RECONNECTING},{name:"connection-lost",to:d.CONNECTION_STATE.RECONNECTING},{name:"resume",to:d.CONNECTION_STATE.RECONNECTING},{name:"pause",to:d.CONNECTION_STATE.PAUSING},{name:"close",to:d.CONNECTION_STATE.CLOSING}]}),this.stateMachine.transition("initialised"),this.originalUrl=Is.parseUrl(i,this.options.path),this.url=this.originalUrl,e.lazyConnect||this.createEndpoint()}return Object.defineProperty(r.prototype,"isConnected",{get:function(){return this.stateMachine.state===d.CONNECTION_STATE.OPEN},enumerable:!1,configurable:!0}),r.prototype.onLost=function(t){this.internalEmitter.on(d.EVENT.CONNECTION_LOST,t)},r.prototype.removeOnLost=function(t){this.internalEmitter.off(d.EVENT.CONNECTION_LOST,t)},r.prototype.onReestablished=function(t){this.internalEmitter.on(d.EVENT.CONNECTION_REESTABLISHED,t)},r.prototype.removeOnReestablished=function(t){this.internalEmitter.off(d.EVENT.CONNECTION_REESTABLISHED,t)},r.prototype.onExitLimbo=function(t){this.internalEmitter.on(d.EVENT.EXIT_LIMBO,t)},r.prototype.registerHandler=function(t,e){this.handlers.set(t,e)},r.prototype.sendMessage=function(t){if(!this.isOpen()){this.services.logger.error(t,d.EVENT.IS_CLOSED);return}this.endpoint&&this.endpoint.sendParsedMessage(t)},r.prototype.authenticate=function(t,e){if(t&&typeof t!="object"&&typeof t!="function")throw new Error("invalid argument authParamsOrCallback");if(e&&typeof e!="function")throw new Error("invalid argument callback");if(this.stateMachine.state===d.CONNECTION_STATE.CHALLENGE_DENIED||this.stateMachine.state===d.CONNECTION_STATE.TOO_MANY_AUTH_ATTEMPTS||this.stateMachine.state===d.CONNECTION_STATE.AUTHENTICATION_TIMEOUT){this.services.logger.error({topic:d.TOPIC.CONNECTION},d.EVENT.IS_CLOSED);return}t&&(this.authParams=typeof t=="object"?t:{}),t&&typeof t=="function"?this.authCallback=t:e?this.authCallback=e:this.authCallback=function(){},this.stateMachine.state===d.CONNECTION_STATE.AWAITING_AUTHENTICATION&&this.authParams&&this.sendAuthParams(),this.endpoint||this.createEndpoint()},r.prototype.getConnectionState=function(){return this.stateMachine.state},r.prototype.isOpen=function(){var t=this.getConnectionState();return t!==d.CONNECTION_STATE.CLOSED&&t!==d.CONNECTION_STATE.ERROR&&t!==d.CONNECTION_STATE.CLOSING},r.prototype.close=function(){this.services.timerRegistry.remove(this.heartbeatIntervalTimeout),this.sendMessage({topic:d.TOPIC.CONNECTION,action:d.CONNECTION_ACTION.CLOSING}),this.stateMachine.transition("close")},r.prototype.pause=function(){this.stateMachine.transition("pause"),this.services.timerRegistry.remove(this.heartbeatIntervalTimeout),this.endpoint&&this.endpoint.close()},r.prototype.resume=function(t){this.stateMachine.transition("resume"),this.resumeCallback=t,this.tryReconnect()},r.prototype.createEndpoint=function(){this.endpoint=this.services.socketFactory(this.url,this.options.socketOptions,this.options.heartbeatInterval),this.endpoint.onopened=this.onOpen.bind(this),this.endpoint.onerror=this.onError.bind(this),this.endpoint.onclosed=this.onClose.bind(this),this.endpoint.onparsedmessages=this.onMessages.bind(this)},r.prototype.onOpen=function(){this.clearReconnect(),this.checkHeartBeat(),this.stateMachine.transition("connected"),this.sendMessage({topic:d.TOPIC.CONNECTION,action:d.CONNECTION_ACTION.CHALLENGE,url:this.originalUrl,protocolVersion:"0.1a",sdkVersion:Ku.version,sdkType:"javascript"}),this.stateMachine.transition("challenge")},r.prototype.onError=function(t){var e=this;setTimeout(function(){var i;t.code==="ECONNRESET"||t.code==="ECONNREFUSED"?i="Can't connect! Deepstream server unreachable on ".concat(e.originalUrl):i=t,e.services.logger.error({topic:d.TOPIC.CONNECTION},d.EVENT.CONNECTION_ERROR,i)},1),this.services.timerRegistry.remove(this.heartbeatIntervalTimeout),this.stateMachine.transition("error"),this.tryReconnect()},r.prototype.onClose=function(){if(this.services.timerRegistry.remove(this.heartbeatIntervalTimeout),this.stateMachine.state===d.CONNECTION_STATE.REDIRECTING){this.createEndpoint();return}if(!(this.stateMachine.state===d.CONNECTION_STATE.CHALLENGE_DENIED||this.stateMachine.state===d.CONNECTION_STATE.TOO_MANY_AUTH_ATTEMPTS||this.stateMachine.state===d.CONNECTION_STATE.AUTHENTICATION_TIMEOUT)){if(this.stateMachine.state===d.CONNECTION_STATE.CLOSING){this.stateMachine.transition("closed");return}if(this.stateMachine.state===d.CONNECTION_STATE.PAUSING){this.stateMachine.transition("offline");return}this.stateMachine.transition("connection-lost"),this.tryReconnect()}},r.prototype.onMessages=function(t){var e=this;t.forEach(function(i){if(i.parseError){e.services.logger.error({topic:d.TOPIC.PARSER},i.action,i.raw&&i.raw.toString());return}var n=i,o=(0,Wu.parseData)(n);if(o!==!0&&e.services.logger.error({topic:d.TOPIC.PARSER},d.PARSER_ACTION.INVALID_MESSAGE,o),n!==null){if(n.topic===d.TOPIC.CONNECTION){e.handleConnectionResponse(n);return}if(n.topic===d.TOPIC.AUTH){e.handleAuthResponse(n);return}var s=e.handlers.get(n.topic);s&&s(n)}})},r.prototype.sendAuthParams=function(){this.stateMachine.transition("authenticate"),this.sendMessage({topic:d.TOPIC.AUTH,action:d.AUTH_ACTION.REQUEST,parsedData:this.authParams})},r.prototype.checkHeartBeat=function(){var t=this.options.heartbeatInterval*2;if(this.endpoint){if(this.endpoint.getTimeSinceLastMessage()>t){this.services.timerRegistry.remove(this.heartbeatIntervalTimeout),this.services.logger.error({topic:d.TOPIC.CONNECTION},d.EVENT.HEARTBEAT_TIMEOUT),this.endpoint.close();return}this.heartbeatIntervalTimeout=this.services.timerRegistry.add({duration:this.options.heartbeatInterval,callback:this.checkHeartBeat,context:this})}},r.prototype.tryReconnect=function(){if(this.reconnectTimeout===null){if(this.reconnectionAttempt<this.options.maxReconnectAttempts){this.stateMachine.transition("reconnect"),this.reconnectTimeout=this.services.timerRegistry.add({callback:this.tryOpen,context:this,duration:Math.min(this.options.maxReconnectInterval,this.options.reconnectIntervalIncrement*this.reconnectionAttempt)}),this.reconnectionAttempt++;return}this.emitter.emit(d.EVENT[d.EVENT.MAX_RECONNECTION_ATTEMPTS_REACHED],this.reconnectionAttempt),this.clearReconnect(),this.close()}},r.prototype.tryOpen=function(){this.stateMachine.state!==d.CONNECTION_STATE.REDIRECTING&&(this.url=this.originalUrl),this.createEndpoint(),this.reconnectTimeout=null},r.prototype.clearReconnect=function(){this.services.timerRegistry.remove(this.reconnectTimeout),this.reconnectTimeout=null,this.reconnectionAttempt=0},r.prototype.handleConnectionResponse=function(t){if(t.action===d.CONNECTION_ACTION.ACCEPT){this.stateMachine.transition("accepted");return}if(t.action===d.CONNECTION_ACTION.REJECT){this.stateMachine.transition("challenge-denied"),this.endpoint&&this.endpoint.close();return}if(t.action===d.CONNECTION_ACTION.REDIRECT){this.url=t.url,this.stateMachine.transition("redirected"),this.endpoint&&this.endpoint.close();return}t.action===d.CONNECTION_ACTION.AUTHENTICATION_TIMEOUT&&(this.stateMachine.transition("authentication-timeout"),this.services.logger.error(t))},r.prototype.handleAuthResponse=function(t){if(t.action===d.AUTH_ACTION.TOO_MANY_AUTH_ATTEMPTS){this.stateMachine.transition("too-many-auth-attempts"),this.services.logger.error(t);return}if(t.action===d.AUTH_ACTION.AUTH_UNSUCCESSFUL){this.stateMachine.transition("unsuccesful-login"),this.onAuthUnSuccessful(t.parsedData);return}if(t.action===d.AUTH_ACTION.AUTH_SUCCESSFUL){this.stateMachine.transition("succesful-login"),this.onAuthSuccessful(t.parsedData);return}},r.prototype.onAwaitingAuthentication=function(){this.authParams&&this.sendAuthParams()},r.prototype.onAuthSuccessful=function(t){this.updateClientData(t),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null),this.authCallback!==null&&(this.authCallback(!0,this.clientData),this.authCallback=null)},r.prototype.onAuthUnSuccessful=function(t){var e={reason:t||d.EVENT[d.EVENT.INVALID_AUTHENTICATION_DETAILS]};if(this.resumeCallback&&(this.resumeCallback(e),this.resumeCallback=null),this.authCallback===null){this.emitter.emit(d.EVENT.REAUTHENTICATION_FAILURE,e);return}this.authCallback(!1,e),this.authCallback=null},r.prototype.updateClientData=function(t){var e=t||null;this.clientData===null&&(e===null||Object.keys(e).length===0)||Is.deepEquals(this.clientData,t)||(this.emitter.emit(d.EVENT.CLIENT_DATA_CHANGED,Object.assign({},e)),this.clientData=e)},r}();Qr.Connection=Ju});var As=R(zi=>{"use strict";u();Object.defineProperty(zi,"__esModule",{value:!0});var Qu=Ki(),zu=$r();function Xu(r,t){t&&!r.isAck&&(r=Object.assign(Object.assign({},r),{isAck:!0})),r.data===void 0&&r.parsedData!==void 0&&(r.data=JSON.stringify(r.parsedData)),r.requestorData&&(r.requestorData=JSON.stringify(r.requestorData));let e=Qu.TopicMessage[r.topic].encode(r).finish();return zu.Message.encodeDelimited({topic:r.topic,message:e}).finish()}zi.getMessage=Xu});var Ds=R(()=>{u()});var ws=R(Le=>{"use strict";u();var Xr=Le&&Le.__assign||function(){return Xr=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Xr.apply(this,arguments)};Object.defineProperty(Le,"__esModule",{value:!0});Le.socketFactory=void 0;var Zu=Ji(),tl=As(),Ue=k(),zr=window.WebSocket||window.MozWebSocket,el=function(r,t,e){t===void 0&&(t={jsonTransportMode:!1});var i=zr?new zr(r,[],t):new(Ds())(r,t);zr&&t.jsonTransportMode!==!0&&(i.binaryType="arraybuffer");var n=t.jsonTransportMode!==!0?tl.getMessage:function(c,l){return JSON.stringify(Xr(Xr({},c),{isAck:l}))},o=n({topic:Ue.TOPIC.CONNECTION,action:Ue.CONNECTION_ACTION.PING},!1),s=null,a=-1;return i.onparsedmessage=function(){},i.onmessage=function(c){a=Date.now();var l;t.jsonTransportMode!==!0?l=(0,Zu.parse)(zr?new Buffer(new Uint8Array(c.data)):c.data):l=[JSON.parse(c.data)],i.onparsedmessages(l)},i.getTimeSinceLastMessage=function(){return a<0?0:Date.now()-a},i.sendParsedMessage=function(c){if(c.topic===Ue.TOPIC.CONNECTION&&c.action===Ue.CONNECTION_ACTION.CLOSING){i.onparsedmessages([{topic:Ue.TOPIC.CONNECTION,action:Ue.CONNECTION_ACTION.CLOSED}]),i.close();return}c.parsedData&&(c.data=JSON.stringify(c.parsedData)),c.data===void 0&&delete c.data,i.send(n(c,!1))},i.onclosed=null,i.onclose=function(){clearInterval(s),i.onclosed()},i.onopened=null,i.onopen=function(){s=setInterval(function(){try{i.send(o)}catch(c){clearTimeout(s)}},e),i.onopened()},i};Le.socketFactory=el});var Xi=R(Zr=>{"use strict";u();Object.defineProperty(Zr,"__esModule",{value:!0});Zr.Listener=void 0;var pe=k(),rl=function(){function r(t,e){this.topic=t,this.services=e,this.listeners=new Map,this.stopCallbacks=new Map,t===pe.TOPIC.RECORD?this.actions=pe.RECORD_ACTION:t===pe.TOPIC.EVENT&&(this.actions=pe.EVENT_ACTION),this.services.connection.onLost(this.onConnectionLost.bind(this)),this.services.connection.onReestablished(this.onConnectionReestablished.bind(this))}return r.prototype.listen=function(t,e){if(typeof t!="string"||t.length===0)throw new Error("invalid argument pattern");if(typeof e!="function")throw new Error("invalid argument callback");if(this.listeners.has(t)){this.services.logger.warn({topic:this.topic,action:this.actions.LISTEN,name:t},pe.EVENT.LISTENER_EXISTS);return}this.listeners.set(t,e),this.sendListen(t)},r.prototype.unlisten=function(t){if(typeof t!="string"||t.length===0)throw new Error("invalid argument pattern");if(!this.listeners.has(t)){this.services.logger.warn({topic:this.topic,action:this.actions.UNLISTEN,name:t},pe.EVENT.NOT_LISTENING);return}this.listeners.delete(t),this.sendUnlisten(t)},r.prototype.accept=function(t,e){this.services.connection.sendMessage({topic:this.topic,action:this.actions.LISTEN_ACCEPT,name:t,subscription:e})},r.prototype.reject=function(t,e){this.services.connection.sendMessage({topic:this.topic,action:this.actions.LISTEN_REJECT,name:t,subscription:e})},r.prototype.stop=function(t,e){this.stopCallbacks.set(t,e)},r.prototype.handle=function(t){if(t.isAck){this.services.timeoutRegistry.remove(t);return}if(t.action===this.actions.SUBSCRIPTION_FOR_PATTERN_FOUND){var e=this.listeners.get(t.name);e&&e(t.subscription,{accept:this.accept.bind(this,t.name,t.subscription),reject:this.reject.bind(this,t.name,t.subscription),onStop:this.stop.bind(this,t.subscription)});return}if(t.action===this.actions.SUBSCRIPTION_FOR_PATTERN_REMOVED){var i=this.stopCallbacks.get(t.subscription);i&&(i(t.subscription),this.stopCallbacks.delete(t.subscription));return}this.services.logger.error(t,pe.EVENT.UNSOLICITED_MESSAGE)},r.prototype.onConnectionLost=function(){this.stopCallbacks.forEach(function(t,e){t(e)}),this.stopCallbacks.clear()},r.prototype.onConnectionReestablished=function(){var t=this;this.listeners.forEach(function(e,i){t.sendListen(i)})},r.prototype.sendListen=function(t){var e={topic:this.topic,action:this.actions.LISTEN,name:t};this.services.timeoutRegistry.add({message:e}),this.services.connection.sendMessage(e)},r.prototype.sendUnlisten=function(t){var e={topic:this.topic,action:this.actions.UNLISTEN,name:t};this.services.timeoutRegistry.add({message:e}),this.services.connection.sendMessage(e)},r}();Zr.Listener=rl});var ar=R(Yt=>{"use strict";u();var Ps=Yt&&Yt.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o},Us=Yt&&Yt.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.BulkSubscriptionService=void 0;var il=function(){function r(t,e,i,n,o,s){s===void 0&&(s=function(){}),this.services=t,this.subscriptionInterval=e,this.topic=i,this.subscribeBulkAction=n,this.unsubscribeBulkAction=o,this.onSubscriptionSent=s,this.subscribeNames=new Set,this.unsubscribeNames=new Set,this.timerRef=-1,this.correlationId=0,this.services.connection.onLost(this.onLost.bind(this))}return r.prototype.subscribe=function(t){if(this.subscriptionInterval>0){this.unsubscribeNames.has(t)?this.unsubscribeNames.delete(t):(this.subscribeNames.add(t),this.registerFlush());return}var e={topic:this.topic,action:this.subscribeBulkAction,names:[t],correlationId:(this.correlationId++).toString()};this.services.connection.sendMessage(e),this.onSubscriptionSent(e)},r.prototype.subscribeList=function(t){t.forEach(this.subscribe.bind(this))},r.prototype.unsubscribe=function(t){if(this.subscriptionInterval>0){this.subscribeNames.has(t)?this.subscribeNames.delete(t):(this.unsubscribeNames.add(t),this.registerFlush());return}var e={topic:this.topic,action:this.unsubscribeBulkAction,names:[t],correlationId:(this.correlationId++).toString()};this.services.connection.sendMessage(e),this.onSubscriptionSent(e)},r.prototype.unsubscribeList=function(t){t.forEach(this.unsubscribe.bind(this))},r.prototype.registerFlush=function(){this.services.timerRegistry.has(this.timerRef)||(this.timerRef=this.services.timerRegistry.add({callback:this.sendMessages,context:this,duration:this.subscriptionInterval}))},r.prototype.sendMessages=function(){if(!this.services.connection.isConnected){this.onLost();return}if(this.subscribeNames.size>0){var t={topic:this.topic,action:this.subscribeBulkAction,names:Us([],Ps(this.subscribeNames),!1),correlationId:(this.correlationId++).toString()};this.services.connection.sendMessage(t),this.onSubscriptionSent(t),this.subscribeNames.clear()}if(this.unsubscribeNames.size>0){var t={topic:this.topic,action:this.unsubscribeBulkAction,names:Us([],Ps(this.unsubscribeNames),!1),correlationId:(this.correlationId++).toString()};this.services.connection.sendMessage(t),this.onSubscriptionSent(t),this.unsubscribeNames.clear()}},r.prototype.onLost=function(){this.correlationId=0,this.services.timerRegistry.remove(this.timerRef),this.subscribeNames.clear(),this.unsubscribeNames.clear()},r}();Yt.BulkSubscriptionService=il});var Ls=R(Me=>{"use strict";u();var ti=Me&&Me.__assign||function(){return ti=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},ti.apply(this,arguments)};Object.defineProperty(Me,"__esModule",{value:!0});Me.EventHandler=void 0;var H=k(),nl=Xi(),ol=_t(),sl=ar(),al=function(){function r(t,e,i){this.services=t,this.emitter=new ol.Emitter,this.limboQueue=[],this.bulkSubscription=new sl.BulkSubscriptionService(this.services,e.subscriptionInterval,H.TOPIC.EVENT,H.EVENT_ACTION.SUBSCRIBE,H.EVENT_ACTION.UNSUBSCRIBE,this.onBulkSubscriptionSent.bind(this)),this.listeners=i||new nl.Listener(H.TOPIC.EVENT,t),this.services.connection.registerHandler(H.TOPIC.EVENT,this.handle.bind(this)),this.services.connection.onExitLimbo(this.onExitLimbo.bind(this)),this.services.connection.onReestablished(this.onConnectionReestablished.bind(this))}return r.prototype.eventNames=function(){return this.emitter.eventNames()},r.prototype.subscribe=function(t,e){if(typeof t!="string"||t.length===0)throw new Error("invalid argument name");if(typeof e!="function")throw new Error("invalid argument callback");this.emitter.hasListeners(t)||this.services.connection.isConnected&&this.bulkSubscription.subscribe(t),this.emitter.on(t,e)},r.prototype.unsubscribe=function(t,e){if(!t||typeof t!="string"||t.length===0)throw new Error("invalid argument name");if(e!==void 0&&typeof e!="function")throw new Error("invalid argument callback");if(!this.emitter.hasListeners(t)){this.services.logger.warn({topic:H.TOPIC.EVENT,action:H.EVENT_ACTION.NOT_SUBSCRIBED,name:t});return}this.emitter.off(t,e),this.emitter.hasListeners(t)||this.bulkSubscription.unsubscribe(t)},r.prototype.emit=function(t,e){if(typeof t!="string"||t.length===0)throw new Error("invalid argument name");var i={topic:H.TOPIC.EVENT,action:H.EVENT_ACTION.EMIT,name:t,parsedData:e};this.services.connection.isConnected?this.services.connection.sendMessage(i):this.services.connection.isInLimbo&&this.limboQueue.push(i),this.emitter.emit(t,e)},r.prototype.listen=function(t,e){this.listeners.listen(t,e)},r.prototype.unlisten=function(t){this.listeners.unlisten(t)},r.prototype.handle=function(t){if(t.isAck){this.services.timeoutRegistry.remove(t);return}if(t.action===H.EVENT_ACTION.EMIT){t.parsedData!==void 0?this.emitter.emit(t.name,t.parsedData):this.emitter.emit(t.name,void 0);return}if(t.action===H.EVENT_ACTION.MESSAGE_DENIED){this.services.logger.error({topic:H.TOPIC.EVENT},H.EVENT_ACTION.MESSAGE_DENIED),this.services.timeoutRegistry.remove(t),t.originalAction===H.EVENT_ACTION.SUBSCRIBE&&this.emitter.off(t.name);return}if(t.action===H.EVENT_ACTION.MULTIPLE_SUBSCRIPTIONS||t.action===H.EVENT_ACTION.NOT_SUBSCRIBED){this.services.timeoutRegistry.remove(ti(ti({},t),{action:H.EVENT_ACTION.SUBSCRIBE})),this.services.logger.warn(t);return}if(t.action===H.EVENT_ACTION.SUBSCRIPTION_FOR_PATTERN_FOUND||t.action===H.EVENT_ACTION.SUBSCRIPTION_FOR_PATTERN_REMOVED){this.listeners.handle(t);return}if(t.action===H.EVENT_ACTION.INVALID_LISTEN_REGEX){this.services.logger.error(t);return}this.services.logger.error(t,H.EVENT.UNSOLICITED_MESSAGE)},r.prototype.onConnectionReestablished=function(){this.bulkSubscription.subscribeList(this.emitter.eventNames());for(var t=0;t<this.limboQueue.length;t++)this.services.connection.sendMessage(this.limboQueue[t]);this.limboQueue=[]},r.prototype.onExitLimbo=function(){this.limboQueue=[]},r.prototype.onBulkSubscriptionSent=function(t){this.services.timeoutRegistry.add({message:t})},r}();Me.EventHandler=al});var Bs=R(ei=>{"use strict";u();Object.defineProperty(ei,"__esModule",{value:!0});ei.RPC=void 0;var Ms=k(),cl=function(){function r(t,e,i,n,o,s){this.response=n,this.services=s;var a={topic:Ms.TOPIC.RPC,action:Ms.RPC_ACTION.REQUEST,correlationId:e,name:t,parsedData:i};this.services.connection.sendMessage(a)}return r.prototype.accept=function(){},r.prototype.respond=function(t){this.response(null,t)},r.prototype.error=function(t){this.response(t)},r}();ei.RPC=cl});var ks=R(ri=>{"use strict";u();Object.defineProperty(ri,"__esModule",{value:!0});ri.RPCResponse=void 0;var $t=k(),ul=function(){function r(t,e,i){this.name=t.name,this.correlationId=t.correlationId,this.services=i,this.isAccepted=!1,this.isComplete=!1,this.autoAccept=!0,this.services.timerRegistry.requestIdleCallback(this.performAutoAck.bind(this))}return r.prototype.accept=function(){this.isAccepted===!1&&(this.services.connection.sendMessage({topic:$t.TOPIC.RPC,action:$t.RPC_ACTION.ACCEPT,name:this.name,correlationId:this.correlationId}),this.isAccepted=!0)},r.prototype.reject=function(){if(this.isComplete===!0)throw new Error("Rpc ".concat(this.name," already completed"));this.autoAccept=!1,this.isComplete=!0,this.isAccepted=!0,this.services.connection.sendMessage({topic:$t.TOPIC.RPC,action:$t.RPC_ACTION.REJECT,name:this.name,correlationId:this.correlationId})},r.prototype.error=function(t){if(this.isComplete===!0)throw new Error("Rpc ".concat(this.name," already completed"));this.autoAccept=!1,this.isComplete=!0,this.isAccepted=!0,this.services.connection.sendMessage({topic:$t.TOPIC.RPC,action:$t.RPC_ACTION.REQUEST_ERROR,name:this.name,correlationId:this.correlationId,parsedData:t})},r.prototype.send=function(t){if(this.isComplete===!0)throw new Error("Rpc ".concat(this.name," already completed"));this.accept(),this.services.connection.sendMessage({topic:$t.TOPIC.RPC,action:$t.RPC_ACTION.RESPONSE,name:this.name,correlationId:this.correlationId,parsedData:t}),this.isComplete=!0},r.prototype.performAutoAck=function(){this.autoAccept===!0&&this.accept()},r}();ri.RPCResponse=ul});var Fs=R(Kt=>{"use strict";u();var xs=Kt&&Kt.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o},js=Kt&&Kt.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.RPCHandler=void 0;var P=k(),Zi=Bs(),Vs=ks(),ll=Pt(),hl=ar(),fl=function(){function r(t,e){this.services=t,this.options=e,this.rpcs=new Map,this.providers=new Map,this.limboQueue=[],this.bulkSubscription=new hl.BulkSubscriptionService(this.services,e.subscriptionInterval,P.TOPIC.RPC,P.RPC_ACTION.PROVIDE,P.RPC_ACTION.UNPROVIDE,this.onBulkSubscriptionSent.bind(this)),this.services.connection.registerHandler(P.TOPIC.RPC,this.handle.bind(this)),this.services.connection.onReestablished(this.onConnectionReestablished.bind(this)),this.services.connection.onExitLimbo(this.onExitLimbo.bind(this)),this.services.connection.onLost(this.onConnectionLost.bind(this))}return r.prototype.providerNames=function(){return js([],xs(this.providers.keys()),!1)},r.prototype.provide=function(t,e){if(typeof t!="string"||t.length===0)throw new Error("invalid argument name");if(this.providers.has(t))throw new Error("RPC ".concat(t," already registered"));if(typeof e!="function")throw new Error("invalid argument callback");this.providers.set(t,e),this.services.connection.isConnected&&this.bulkSubscription.subscribe(t)},r.prototype.unprovide=function(t){if(typeof t!="string"||t.length===0)throw new Error("invalid argument name");if(!this.providers.has(t)){this.services.logger.warn({topic:P.TOPIC.RPC,action:P.RPC_ACTION.NOT_PROVIDED,name:t});return}this.providers.delete(t),this.services.connection.isConnected&&this.bulkSubscription.unsubscribe(t)},r.prototype.make=function(t,e,i){var n=this;if(typeof t!="string"||t.length===0)throw new Error("invalid argument name");if(i&&typeof i!="function")throw new Error("invalid argument callback");var o=(0,ll.getUid)();if(this.services.connection.isConnected){if(i){this.rpcs.set(o,new Zi.RPC(t,o,e,i,this.options,this.services));return}return new Promise(function(s,a){n.rpcs.set(o,new Zi.RPC(t,o,e,function(c,l){return c?a(c):s(l)},n.options,n.services))})}else if(this.services.connection.isInLimbo)if(i)this.limboQueue.push({correlationId:o,name:t,data:e,callback:i});else return new Promise(function(s,a){n.limboQueue.push({correlationId:o,name:t,data:e,callback:function(c,l){return c?a(c):s(l)}})});else if(i)i(P.EVENT.CLIENT_OFFLINE);else return Promise.reject(P.EVENT.CLIENT_OFFLINE)},r.prototype.respondToRpc=function(t){var e=this.providers.get(t.name);e?t.requestorName||t.requestorData?e(t.parsedData,new Vs.RPCResponse(t,this.options,this.services),{requestorName:t.requestorName,requestorData:t.requestorData}):e(t.parsedData,new Vs.RPCResponse(t,this.options,this.services)):this.services.connection.sendMessage({topic:P.TOPIC.RPC,action:P.RPC_ACTION.REJECT,name:t.name,correlationId:t.correlationId})},r.prototype.handle=function(t){if(t.action===P.RPC_ACTION.REQUEST){this.respondToRpc(t);return}if(t.isAck){this.services.timeoutRegistry.remove(t);return}if(t.action===P.RPC_ACTION.MESSAGE_PERMISSION_ERROR||t.action===P.RPC_ACTION.MESSAGE_DENIED){if(t.originalAction===P.RPC_ACTION.PROVIDE||t.originalAction===P.RPC_ACTION.UNPROVIDE){this.services.timeoutRegistry.remove(t),this.providers.delete(t.name),this.services.logger.error(t);return}if(t.originalAction===P.RPC_ACTION.REQUEST){var e=this.getRPC(t);if(e){e.error(P.RPC_ACTION[t.action]),this.rpcs.delete(t.correlationId);return}}}var i=this.getRPC(t);if(i){if(t.action===P.RPC_ACTION.ACCEPT){i.accept();return}t.action===P.RPC_ACTION.RESPONSE?i.respond(t.parsedData):t.action===P.RPC_ACTION.REQUEST_ERROR?i.error(t.parsedData):(t.action===P.RPC_ACTION.RESPONSE_TIMEOUT||t.action===P.RPC_ACTION.ACCEPT_TIMEOUT||t.action===P.RPC_ACTION.NO_RPC_PROVIDER)&&i.error(P.RPC_ACTION[t.action]),this.rpcs.delete(t.correlationId)}},r.prototype.getRPC=function(t){var e=this.rpcs.get(t.correlationId);return e===void 0&&this.services.logger.error(t,P.EVENT.UNKNOWN_CORRELATION_ID),e},r.prototype.onConnectionReestablished=function(){this.bulkSubscription.subscribeList(js([],xs(this.providers.keys()),!1));for(var t=0;t<this.limboQueue.length;t++){var e=this.limboQueue[t],i=e.correlationId,n=e.name,o=e.data,s=e.callback;this.rpcs.set(i,new Zi.RPC(n,i,o,s,this.options,this.services))}this.limboQueue=[]},r.prototype.onExitLimbo=function(){for(var t=0;t<this.limboQueue.length;t++)this.limboQueue[t].callback(P.EVENT.CLIENT_OFFLINE);this.limboQueue=[]},r.prototype.onConnectionLost=function(){this.rpcs.forEach(function(t){t.error(P.EVENT.CLIENT_OFFLINE)}),this.rpcs.clear()},r.prototype.onBulkSubscriptionSent=function(t){this.services.timeoutRegistry.add({message:t})},r}();Kt.RPCHandler=fl});var Gs=R(Be=>{"use strict";u();Object.defineProperty(Be,"__esModule",{value:!0});Be.setValue=Be.get=void 0;var tn=Pt(),dl=/[[\]]/g;function pl(r,t,e){e===void 0&&(e=!1);for(var i=Hs(t),n=r,o=0;o<i.length;o++){if(n===void 0)return;if(typeof n!="object")throw new Error("invalid data or path");n=n[i[o]]}return e!==!1?tn.deepCopy(n):n}Be.get=pl;function El(r,t,e){if(t===null)return e;var i=Hs(t),n=tn.deepCopy(r),o=tn.deepCopy(e),s=n,a;for(a=0;a<i.length-1;a++){var c=i[a];if(s[c]!==void 0&&s[c]!==null&&typeof s[c]=="object")s=s[c];else if(typeof i[a+1]=="number"){var l=new Array(i[a+1]);l.fill(null),s=s[c]=l}else s=s[c]={}}return e===void 0?delete s[i[a]]:s[i[a]]=o,n}Be.setValue=El;function Hs(r){if(r===null)return[];for(var t=[],e=r.split("."),i=0;i<e.length;i++){var n=e[i].trim();if(n.length!==0){var o=n.split(dl);if(o.length!==0){t.push(o[0]);for(var s=1;s<o.length;s++)o[s].length!==0&&t.push(Number(o[s]))}}}return t}});var Ws=R(Qt=>{"use strict";u();var yl=Qt&&Qt.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Jt=Qt&&Qt.__assign||function(){return Jt=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Jt.apply(this,arguments)};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.RecordCore=void 0;var y=k(),Ee=Gs(),qs=_t(),ke=Pt(),Rl=Qi(),X=function(r){yl(t,r);function t(e,i,n,o,s){var a=r.call(this)||this;if(a.name=e,a.services=i,a.options=n,a.recordServices=o,a.whenComplete=s,a.isReady=!1,a.hasProvider=!1,a.version=null,a.references=new Set,a.emitter=new qs.Emitter,a.data=Object.create(null),a.responseTimeout=null,a.discardTimeout=null,a.deletedTimeout=null,a.deleteResponse=null,a.pendingWrites=[],a.readyTimer=-1,a.recordReadOnlyMode=a.options.recordReadOnlyMode&&a.options.recordPrefixWriteWhitelist.every(function(c){return!a.name.startsWith(c)}),a.readyCallbacks=[],typeof e!="string"||e.length===0)throw new Error("invalid argument name");return a.onConnectionLost=a.onConnectionLost.bind(a),a.onConnectionReestablished=a.onConnectionReestablished.bind(a),a.stateMachine=new Rl.StateMachine(a.services.logger,{init:"LOADING_OFFLINE",context:a,onStateChanged:a.onStateChanged,transitions:Sl}),a.recordServices.dirtyService.whenLoaded(a,a.onDirtyServiceLoaded),a}return Object.defineProperty(t.prototype,"recordState",{get:function(){return this.stateMachine.state},enumerable:!1,configurable:!0}),t.prototype.addReference=function(e){this.references.size===0&&this.isReady&&(this.services.timeoutRegistry.clear(this.discardTimeout),this.services.timerRegistry.remove(this.readyTimer),this.readyTimer=-1,this.stateMachine.transition(y.RECORD_ACTION.SUBSCRIBE)),this.references.add(e)},t.prototype.removeReference=function(e){var i=this;this.checkDestroyed("discard")||this.whenReadyInternal(e,function(){i.references.delete(e),i.references.size===0&&i.readyTimer===-1&&(i.readyTimer=i.services.timerRegistry.add({duration:i.options.recordDiscardTimeout,callback:i.stateMachine.transition,context:i.stateMachine,data:"UNSUBSCRIBE_FOR_REAL"}),i.stateMachine.transition(y.RECORD_ACTION.UNSUBSCRIBE))})},t.prototype.onDirtyServiceLoaded=function(){var e=this;this.services.storage.get(this.name,function(i,n,o){if(e.services.connection.onReestablished(e.onConnectionReestablished),e.services.connection.onLost(e.onConnectionLost),!e.services.connection.isConnected){if(n===-1){if(e.recordReadOnlyMode)return;e.version=e.options.initialRecordVersion,e.data=Object.create(null),e.recordServices.dirtyService.setDirty(e.name,!0),e.services.storage.set(e.name,e.version,e.data,function(s){})}else e.version=n,e.data=o;e.stateMachine.transition("LOADED");return}n===-1&&!e.recordServices.dirtyService.isDirty(e.name)?e.stateMachine.transition(y.RECORD_ACTION.SUBSCRIBECREATEANDREAD):(e.version=n,e.data=o,e.stateMachine.transition("RESUBSCRIBE"))})},t.prototype.onStateChanged=function(e,i){this.emitter.emit(y.EVENT.RECORD_STATE_CHANGED,e)},t.prototype.whenReady=function(e,i){var n=this;if(i){this.whenReadyInternal(e,function(o){i(o)});return}return new Promise(function(o){return n.whenReadyInternal(e,function(){return o(e)})})},t.prototype.whenReadyInternal=function(e,i){if(this.isReady===!0){i(e);return}this.readyCallbacks.push({callback:i,context:e})},t.prototype.set=function(e){var i=this,n=e.path,o=e.data,s=e.callback;if(!n&&(o===null||typeof o!="object"))throw new Error("invalid arguments, scalar values cannot be set without path");if(!this.checkDestroyed("set")){if(this.recordReadOnlyMode){this.services.logger.error({topic:y.TOPIC.RECORD},y.EVENT.RECORD_READ_ONLY_MODE,"Attempting to set data when in readonly mode, ignoring");return}if(this.isReady===!1){this.pendingWrites.push({path:n,data:o,callback:s});return}var a=this.data,c=(0,Ee.setValue)(a,n||null,o);if(ke.deepEquals(a,c)){s&&this.services.timerRegistry.requestIdleCallback(function(){return s(null,i.name)});return}this.applyChange(c),this.services.connection.isConnected?this.sendUpdate(n,o,s):(s&&s(y.EVENT.CLIENT_OFFLINE,this.name),this.saveUpdate())}},t.prototype.setWithAck=function(e){var i=this;if(e.callback){this.set(e);return}return new Promise(function(n,o){e.callback=function(s){return s===null?n():o(s)},i.set(e)})},t.prototype.get=function(e){return(0,Ee.get)(this.data,e||null,this.options.recordDeepCopy)},t.prototype.subscribe=function(e,i){var n=this;if(e.path!==void 0&&(typeof e.path!="string"||e.path.length===0))throw new Error("invalid argument path");if(typeof e.callback!="function")throw new Error("invalid argument callback");this.checkDestroyed("subscribe")||(e.triggerNow?this.whenReadyInternal(null,function(){n.emitter.on(e.path||"",e.callback,i),e.callback(n.get(e.path))}):this.emitter.on(e.path||"",e.callback,i))},t.prototype.unsubscribe=function(e,i){if(e.path!==void 0&&(typeof e.path!="string"||e.path.length===0))throw new Error("invalid argument path");if(e.callback!==void 0&&typeof e.callback!="function")throw new Error("invalid argument callback");this.checkDestroyed("unsubscribe")||this.emitter.off(e.path||"",e.callback,i)},t.prototype.delete=function(e){var i=this;if(!this.services.connection.isConnected){if(e){this.services.timerRegistry.requestIdleCallback(function(){e("Deleting while offline is not supported")});return}return Promise.reject("Deleting while offline is not supported")}if(!this.checkDestroyed("delete"))if(this.stateMachine.transition(y.RECORD_ACTION.DELETE),e&&typeof e=="function")this.deleteResponse={callback:e},this.sendDelete();else return new Promise(function(n,o){i.deleteResponse={resolve:n,reject:o},i.sendDelete()})},t.prototype.setMergeStrategy=function(e){this.recordServices.mergeStrategy.setMergeStrategyByName(this.name,e)},t.prototype.saveRecordToOffline=function(e){e===void 0&&(e=function(){}),this.services.storage.set(this.name,this.version,this.data,e)},t.prototype.onSubscribing=function(){this.recordServices.readRegistry.register(this.name,this,this.handleReadResponse),this.responseTimeout=this.services.timeoutRegistry.add({message:{topic:y.TOPIC.RECORD,action:y.RECORD_ACTION.READ_RESPONSE,name:this.name}}),this.recordReadOnlyMode?this.recordServices.bulkSubscriptionService[y.RECORD_ACTION.SUBSCRIBEANDREAD].subscribe(this.name):this.recordServices.bulkSubscriptionService[y.RECORD_ACTION.SUBSCRIBECREATEANDREAD].subscribe(this.name)},t.prototype.onResubscribing=function(){this.services.timerRegistry.remove(this.readyTimer),this.recordServices.headRegistry.register(this.name,this,this.handleHeadResponse),this.responseTimeout=this.services.timeoutRegistry.add({message:{topic:y.TOPIC.RECORD,action:y.RECORD_ACTION.HEAD,name:this.name}}),this.recordServices.bulkSubscriptionService[y.RECORD_ACTION.SUBSCRIBEANDHEAD].subscribe(this.name)},t.prototype.onReady=function(){this.services.timeoutRegistry.clear(this.responseTimeout),this.applyPendingWrites(),this.isReady=!0,this.applyChange(this.data,!0,!1),this.readyCallbacks.forEach(function(e){var i=e.context,n=e.callback;n.call(i,i)}),this.readyCallbacks=[]},t.prototype.applyPendingWrites=function(){for(var e=this,i=[],n=this.data,o=n,s=0;s<this.pendingWrites.length;s++){var a=this.pendingWrites[s],c=a.callback,l=a.path,h=a.data;c&&i.push(c),o=(0,Ee.setValue)(o,l||null,h)}this.pendingWrites=[],this.applyChange(o);var p;if(i.length!==0&&(p=function(g){for(var N=0;N<i.length;N++)i[N](g,e.name)}),ke.deepEquals(n,o)){p&&p(null);return}this.services.connection.isConnected?this.sendUpdate(null,o,p):(p&&p(y.EVENT.CLIENT_OFFLINE),this.saveUpdate())},t.prototype.onUnsubscribed=function(){var e=this;if(this.services.connection.isConnected){var i={topic:y.TOPIC.RECORD,action:y.RECORD_ACTION.UNSUBSCRIBE,names:[this.name],correlationId:this.name};this.discardTimeout=this.services.timeoutRegistry.add({message:i}),this.services.connection.sendMessage(i)}this.emit(y.EVENT.RECORD_DISCARDED),this.saveRecordToOffline(function(){return e.destroy()})},t.prototype.onDeleted=function(){this.services.storage.delete(this.name,function(){}),this.recordServices.dirtyService.setDirty(this.name,!1),this.emit(y.EVENT.RECORD_DELETED),this.destroy()},t.prototype.handle=function(e){if(e.action===y.RECORD_ACTION.PATCH||e.action===y.RECORD_ACTION.UPDATE||e.action===y.RECORD_ACTION.ERASE){if(this.stateMachine.state==="MERGING")return;this.applyUpdate(e);return}if(e.action===y.RECORD_ACTION.DELETE_SUCCESS){this.services.timeoutRegistry.clear(this.deletedTimeout),this.stateMachine.transition(y.RECORD_ACTION.DELETE_SUCCESS),this.deleteResponse.callback?this.deleteResponse.callback(null):this.deleteResponse.resolve&&this.deleteResponse.resolve();return}if(e.action===y.RECORD_ACTION.DELETED){this.stateMachine.transition(y.RECORD_ACTION.DELETED);return}if(e.action===y.RECORD_ACTION.VERSION_EXISTS){this.recoverRecordFromMessage(e);return}if(e.action===y.RECORD_ACTION.MESSAGE_DENIED||e.action===y.RECORD_ACTION.MESSAGE_PERMISSION_ERROR||e.action===y.RECORD_ACTION.RECORD_UPDATE_ERROR){if(e.originalAction===y.RECORD_ACTION.SUBSCRIBECREATEANDREAD||e.originalAction===y.RECORD_ACTION.SUBSCRIBEANDHEAD||e.originalAction===y.RECORD_ACTION.SUBSCRIBEANDREAD){var i=Jt(Jt({},e),{originalAction:y.RECORD_ACTION.SUBSCRIBE}),n=Jt(Jt({},e),{originalAction:e.originalAction===y.RECORD_ACTION.SUBSCRIBECREATEANDREAD?y.RECORD_ACTION.READ_RESPONSE:y.RECORD_ACTION.HEAD_RESPONSE});this.services.timeoutRegistry.remove(i),this.services.timeoutRegistry.remove(n),this.services.logger.error(e)}if(e.isWriteAck){this.recordServices.writeAckService.recieve(e);return}this.emit(y.EVENT.RECORD_ERROR,y.RECORD_ACTION[e.action],y.RECORD_ACTION[e.originalAction]),e.originalAction===y.RECORD_ACTION.DELETE&&(this.deleteResponse.callback?this.deleteResponse.callback(y.RECORD_ACTION[y.RECORD_ACTION.MESSAGE_DENIED]):this.deleteResponse.reject&&this.deleteResponse.reject(y.RECORD_ACTION[y.RECORD_ACTION.MESSAGE_DENIED]));return}if(e.action===y.RECORD_ACTION.SUBSCRIPTION_HAS_PROVIDER||e.action===y.RECORD_ACTION.SUBSCRIPTION_HAS_NO_PROVIDER){this.hasProvider=e.action===y.RECORD_ACTION.SUBSCRIPTION_HAS_PROVIDER,this.emit(y.EVENT.RECORD_HAS_PROVIDER_CHANGED,this.hasProvider);return}if(e.action===y.RECORD_ACTION.CACHE_RETRIEVAL_TIMEOUT||e.action===y.RECORD_ACTION.STORAGE_RETRIEVAL_TIMEOUT){this.services.logger.error(e);return}},t.prototype.handleReadResponse=function(e){if(this.stateMachine.state==="MERGING"){this.recoverRecordFromMessage(e),this.recordServices.dirtyService.setDirty(this.name,!1);return}this.version=e.version,this.data=e.parsedData,this.stateMachine.state!=="READY"&&this.stateMachine.transition(y.RECORD_ACTION.READ_RESPONSE)},t.prototype.handleHeadResponse=function(e){var i=e.version;this.recordServices.dirtyService.isDirty(this.name)?i===-1&&this.version===this.options.initialRecordVersion?(this.stateMachine.transition("SUBSCRIBED"),this.sendCreateUpdate(this.data)):this.version===i+1?(this.stateMachine.transition("RESUBSCRIBED"),this.sendUpdate(null,this.data)):(this.stateMachine.transition("INVALID_VERSION"),i!==-1?(this.sendRead(),this.recordServices.readRegistry.register(this.name,this,this.handleReadResponse)):this.recoverRecordDeletedRemotely()):this.version===i?this.stateMachine.transition("RESUBSCRIBED"):(this.stateMachine.transition("INVALID_VERSION"),i<this.version?this.recoverRecordDeletedRemotely():(this.sendRead(),this.recordServices.readRegistry.register(this.name,this,this.handleReadResponse)))},t.prototype.sendRead=function(){this.services.connection.sendMessage({topic:y.TOPIC.RECORD,action:y.RECORD_ACTION.READ,name:this.name})},t.prototype.saveUpdate=function(){this.recordServices.dirtyService.isDirty(this.name)||(this.version++,this.recordServices.dirtyService.setDirty(this.name,!0)),this.saveRecordToOffline()},t.prototype.sendUpdate=function(e,i,n){if(e===void 0&&(e=null),this.recordReadOnlyMode){this.services.logger.error({topic:y.TOPIC.RECORD},y.EVENT.RECORD_READ_ONLY_MODE,"Attempting to send updated data, ignoring");return}this.recordServices.dirtyService.isDirty(this.name)?this.recordServices.dirtyService.setDirty(this.name,!1):this.version++;var o={topic:y.TOPIC.RECORD,version:this.version,name:this.name};e?i===void 0?Object.assign(o,{action:y.RECORD_ACTION.ERASE,path:e}):Object.assign(o,{action:y.RECORD_ACTION.PATCH,path:e,parsedData:i}):Object.assign(o,{action:y.RECORD_ACTION.UPDATE,parsedData:i}),n?this.recordServices.writeAckService.send(o,n):this.services.connection.sendMessage(o)},t.prototype.sendCreateUpdate=function(e){this.services.connection.sendMessage({name:this.name,topic:y.TOPIC.RECORD,action:y.RECORD_ACTION.CREATEANDUPDATE,version:this.options.initialRecordVersion,parsedData:e}),this.recordServices.dirtyService.setDirty(this.name,!1)},t.prototype.applyUpdate=function(e){var i=e.version,n=e.parsedData;if(this.version===null)this.version=i;else if(this.version+1!==i){this.stateMachine.transition("INVALID_VERSION"),e.action===y.RECORD_ACTION.PATCH?(this.sendRead(),this.recordServices.readRegistry.register(this.name,this,this.handleReadResponse)):this.recoverRecordFromMessage(e);return}this.version=i;var o;e.action===y.RECORD_ACTION.PATCH?o=(0,Ee.setValue)(this.data,e.path,n):e.action===y.RECORD_ACTION.ERASE?o=(0,Ee.setValue)(this.data,e.path,void 0):o=n,this.applyChange(o)},t.prototype.applyChange=function(e,i,n){if(i===void 0&&(i=!1),n===void 0&&(n=!0),!this.stateMachine.inEndState){var o=this.data;this.data=e,this.options.saveUpdatesOffline&&n&&this.saveRecordToOffline();for(var s=this.emitter.eventNames(),a=0;a<s.length;a++){var c=(0,Ee.get)(e,s[a],!1),l=(0,Ee.get)(o,s[a],!1);(!ke.deepEquals(c,l)||i&&c)&&this.emitter.emit(s[a],this.get(s[a]))}}},t.prototype.sendDelete=function(){var e=this;this.whenReadyInternal(null,function(){e.services.storage.delete(e.name,function(){if(e.services.connection.isConnected){var i={topic:y.TOPIC.RECORD,action:y.RECORD_ACTION.DELETE,name:e.name};e.deletedTimeout=e.services.timeoutRegistry.add({message:i,event:y.EVENT.RECORD_DELETE_TIMEOUT,duration:e.options.recordDeleteTimeout}),e.services.connection.sendMessage(i)}else e.stateMachine.transition(y.RECORD_ACTION.DELETE_SUCCESS)})})},t.prototype.recoverRecordFromMessage=function(e){this.recordServices.mergeStrategy.merge(e,this.version,this.get(),this.onRecordRecovered,this)},t.prototype.recoverRecordDeletedRemotely=function(){this.recordServices.mergeStrategy.merge({name:this.name,version:-1,parsedData:null},this.version,this.get(),this.onRecordRecovered,this)},t.prototype.onRecordRecovered=function(e,i,n){var o=this,s=i.version,a=i.parsedData;if(e){this.services.logger.error({topic:y.TOPIC.RECORD},y.EVENT.RECORD_VERSION_EXISTS),i.correlationId&&this.recordServices.writeAckService.recieve(Jt(Jt({},i),{reason:e}));return}if(n===null){s===-1?(this.services.storage.delete(this.name,function(){}),this.stateMachine.transition(y.RECORD_ACTION.DELETED)):this.stateMachine.transition(y.RECORD_ACTION.DELETE);return}this.version=s;var c=this.data;if(ke.deepEquals(c,a)){this.stateMachine.state==="MERGING"&&this.stateMachine.transition("MERGED");return}if(this.stateMachine.state!=="MERGING"){this.services.logger.warn({topic:y.TOPIC.RECORD,action:y.RECORD_ACTION.VERSION_EXISTS});return}var l=n;this.stateMachine.transition("MERGED");var h,p=this.pendingWrites.map(function(g){var N=g.callback;return N}).filter(function(g){return g!==void 0});if(p.length!==0&&(h=function(g){p.forEach(function(N){return N(g,o.name)})}),this.pendingWrites=[],ke.deepEquals(n,a)){this.applyChange(n),h&&h(null);return}if(this.recordReadOnlyMode){this.services.logger.error({topic:y.TOPIC.RECORD},y.EVENT.RECORD_READ_ONLY_MODE,"Attempting to set data after merge when in readonly mode, ignoring");return}this.applyChange(l),this.sendUpdate(null,this.data,h)},t.prototype.checkDestroyed=function(e){return this.stateMachine.inEndState?(this.services.logger.error({topic:y.TOPIC.RECORD},y.EVENT.RECORD_ALREADY_DESTROYED,{methodName:e}),!0):!1},t.prototype.destroy=function(){this.services.timerRegistry.remove(this.readyTimer),this.services.timeoutRegistry.clear(this.responseTimeout),this.services.timeoutRegistry.clear(this.deletedTimeout),this.services.timeoutRegistry.clear(this.discardTimeout),this.services.connection.removeOnReestablished(this.onConnectionReestablished),this.services.connection.removeOnLost(this.onConnectionLost),this.emitter.off(),this.isReady=!1,this.whenComplete(this.name)},t.prototype.onConnectionReestablished=function(){this.stateMachine.transition("RESUBSCRIBE")},t.prototype.onConnectionLost=function(){this.saveRecordToOffline(),this.recordServices.dirtyService.setDirty(this.name,!0)},t.prototype.getDebugId=function(){return this.options.debug?ke.getUid():null},t}(qs.Emitter);Qt.RecordCore=X;var Sl=[{name:y.RECORD_ACTION.SUBSCRIBECREATEANDREAD,from:"LOADING_OFFLINE",to:"SUBSCRIBING",handler:X.prototype.onSubscribing},{name:"LOADED",from:"LOADING_OFFLINE",to:"READY",handler:X.prototype.onReady},{name:y.RECORD_ACTION.READ_RESPONSE,from:"SUBSCRIBING",to:"READY",handler:X.prototype.onReady},{name:"SUBSCRIBED",from:"RESUBSCRIBING",to:"READY",handler:X.prototype.onReady},{name:"RESUBSCRIBE",from:"LOADING_OFFLINE",to:"RESUBSCRIBING",handler:X.prototype.onResubscribing},{name:"RESUBSCRIBE",from:"READY",to:"RESUBSCRIBING",handler:X.prototype.onResubscribing},{name:"RESUBSCRIBE",from:"RESUBSCRIBING",to:"RESUBSCRIBING",handler:X.prototype.onResubscribing},{name:"RESUBSCRIBE",from:"SUBSCRIBING",to:"SUBSCRIBING",handler:X.prototype.onSubscribing},{name:"RESUBSCRIBE",from:"UNSUBSCRIBING",to:"UNSUBSCRIBING"},{name:"RESUBSCRIBED",from:"RESUBSCRIBING",to:"READY",handler:X.prototype.onReady},{name:"INVALID_VERSION",from:"RESUBSCRIBING",to:"MERGING"},{name:"MERGED",from:"MERGING",to:"READY",handler:X.prototype.onReady},{name:y.RECORD_ACTION.DELETED,from:"MERGING",to:"DELETED",handler:X.prototype.onDeleted,isEndState:!0},{name:y.RECORD_ACTION.DELETE,from:"MERGING",to:"DELETING"},{name:y.RECORD_ACTION.DELETE,from:"READY",to:"DELETING"},{name:y.RECORD_ACTION.DELETED,from:"READY",to:"DELETED",handler:X.prototype.onDeleted,isEndState:!0},{name:y.RECORD_ACTION.DELETED,from:"UNSUBSCRIBE_FOR_REAL",to:"DELETED",handler:X.prototype.onDeleted,isEndState:!0},{name:y.RECORD_ACTION.DELETED,from:"UNSUBSCRIBING",to:"DELETED",handler:X.prototype.onDeleted,isEndState:!0},{name:y.RECORD_ACTION.DELETE_SUCCESS,from:"DELETING",to:"DELETED",handler:X.prototype.onDeleted,isEndState:!0},{name:y.RECORD_ACTION.UNSUBSCRIBE,from:"READY",to:"UNSUBSCRIBING"},{name:y.RECORD_ACTION.SUBSCRIBE,from:"UNSUBSCRIBING",to:"READY"},{name:"UNSUBSCRIBE_FOR_REAL",from:"UNSUBSCRIBING",to:"UNSUBSCRIBED",handler:X.prototype.onUnsubscribed,isEndState:!0},{name:"INVALID_VERSION",from:"READY",to:"MERGING"}]});var Ys=R(xe=>{"use strict";u();var _l=xe&&xe.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty(xe,"__esModule",{value:!0});xe.Record=void 0;var ii=Pt(),zt=k(),Ol=_t(),Nl=function(r){_l(t,r);function t(e){var i=r.call(this)||this;return i.record=e,i.debugId=i.record.getDebugId(),i.subscriptions=[],i.record.on(zt.EVENT.RECORD_READY,i.emit.bind(i,zt.EVENT.RECORD_READY,i),i),i.record.on(zt.EVENT.RECORD_DISCARDED,i.emit.bind(i,zt.EVENT.RECORD_DISCARDED),i),i.record.on(zt.EVENT.RECORD_DELETED,i.emit.bind(i,zt.EVENT.RECORD_DELETED),i),i.record.on(zt.EVENT.RECORD_ERROR,i.emit.bind(i,zt.EVENT.RECORD_ERROR),i),i.record.addReference(i),i}return Object.defineProperty(t.prototype,"name",{get:function(){return this.record.name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isReady",{get:function(){return this.record.isReady},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.record.version},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasProvider",{get:function(){return this.record.hasProvider},enumerable:!1,configurable:!0}),t.prototype.whenReady=function(e){if(e)this.record.whenReady(this,e);else return this.record.whenReady(this)},t.prototype.get=function(e){return this.record.get(e)},t.prototype.set=function(e,i,n){return this.record.set(ii.normalizeSetArguments(arguments))},t.prototype.setWithAck=function(e,i,n){return this.record.setWithAck(ii.normalizeSetArguments(arguments))},t.prototype.erase=function(e){if(!e)throw new Error("unable to erase record data without path, consider using `delete`");this.set(e,void 0)},t.prototype.eraseWithAck=function(e,i){if(!e)throw new Error("unable to erase record data without path, consider using `delete`");if(i)this.setWithAck(e,void 0,i);else return this.setWithAck(e,void 0)},t.prototype.subscribe=function(e,i,n){var o=ii.normalizeArguments(arguments);this.subscriptions.push(o),this.record.subscribe(o,this)},t.prototype.unsubscribe=function(e,i){var n=ii.normalizeArguments(arguments);this.subscriptions=this.subscriptions.filter(function(o){return!(!n.callback&&o.path===n.path||n.callback&&o.path===n.path&&o.callback===n.callback)}),this.record.unsubscribe(n,this)},t.prototype.discard=function(){for(var e=0;e<this.subscriptions.length;e++)this.record.unsubscribe(this.subscriptions[e],this);this.record.removeReference(this),this.record.removeContext(this)},t.prototype.delete=function(e){return this.record.delete(e)},t.prototype.setMergeStrategy=function(e){this.record.setMergeStrategy(e)},t}(Ol.Emitter);xe.Record=Nl});var $s=R(Ve=>{"use strict";u();var Tl=Ve&&Ve.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.AnonymousRecord=void 0;var je=Pt(),vl=_t(),bl=function(r){Tl(t,r);function t(e){var i=r.call(this)||this;return i.record=null,i.subscriptions=[],i.getRecordCore=e,i}return Object.defineProperty(t.prototype,"name",{get:function(){return this.record?this.record.name:""},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isReady",{get:function(){return this.record?this.record.isReady:!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.record?this.record.version:-1},enumerable:!1,configurable:!0}),t.prototype.whenReady=function(e){if(this.record)if(e)this.record.whenReady(this,e);else return this.record.whenReady(this)},t.prototype.setName=function(e,i){if(this.name!==e){this.discard(),this.record=this.getRecordCore(e),this.record.addReference(this);for(var n=0;n<this.subscriptions.length;n++)this.record.subscribe(this.subscriptions[n],this);if(this.emit("nameChanged",e),i)this.record.whenReady(this,i);else return this.record.whenReady(this)}},t.prototype.get=function(e){if(this.record)return this.record.get(e)},t.prototype.set=function(e,i,n){if(this.record)return this.record.set(je.normalizeSetArguments(arguments))},t.prototype.setWithAck=function(e,i,n){if(this.record)return this.record.setWithAck(je.normalizeSetArguments(arguments))},t.prototype.erase=function(e){if(this.record)return this.record.set(je.normalizeSetArguments(arguments))},t.prototype.eraseWithAck=function(e,i){if(this.record)return this.record.setWithAck(je.normalizeSetArguments(arguments))},t.prototype.subscribe=function(e,i,n){var o=je.normalizeArguments(arguments);this.subscriptions.push(o),this.record&&this.record.subscribe(o,this)},t.prototype.unsubscribe=function(e,i){var n=je.normalizeArguments(arguments);this.subscriptions=this.subscriptions.filter(function(o){return!(!n.callback&&o.path===n.path||n.callback&&o.path===n.path&&o.callback===n.callback)}),this.record&&this.record.unsubscribe(n,this)},t.prototype.discard=function(){if(this.record){for(var e=0;e<this.subscriptions.length;e++)this.record.unsubscribe(this.subscriptions[e],this);return this.record.removeReference(this)}},t.prototype.delete=function(e){if(this.record)return this.record.delete(e)},t.prototype.setMergeStrategy=function(e){this.record&&this.record.setMergeStrategy(e)},t}(vl.Emitter);Ve.AnonymousRecord=bl});var Js=R(Ut=>{"use strict";u();var gl=Ut&&Ut.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),Cl=Ut&&Ut.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o},Il=Ut&&Ut.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.List=void 0;var Ks=Pt(),ye=k(),ml=_t(),Al=function(r){gl(t,r);function t(e){var i=r.call(this)||this;return i.record=e,i.debugId=i.record.getDebugId(),i.wrappedFunctions=new Map,i.hasAddListener=!1,i.hasRemoveListener=!1,i.hasMoveListener=!1,i.subscriptions=[],i.originalApplyUpdate=i.record.applyUpdate.bind(i.record),i.record.applyUpdate=i.applyUpdate.bind(i),i.record.addReference(i),i.record.on("discard",function(){return i.emit("discard",i)},i),i.record.on("delete",function(){return i.emit("delete",i)},i),i.record.on("error",function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return i.emit.apply(i,Il(["error"],Cl(n),!1))},i),i}return Object.defineProperty(t.prototype,"name",{get:function(){return this.record.name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isReady",{get:function(){return this.record.isReady},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.record.version},enumerable:!1,configurable:!0}),t.prototype.whenReady=function(e){if(e)this.record.whenReady(this,e);else return this.record.whenReady(this)},t.prototype.discard=function(){this.destroy(),this.record.removeReference(this)},t.prototype.delete=function(e){return this.destroy(),this.record.delete(e)},t.prototype.getEntries=function(){var e=this.record.get();return e instanceof Array?e:[]},t.prototype.isEmpty=function(){return this.getEntries().length===0},t.prototype.setEntriesWithAck=function(e,i){var n=this;if(!i)return new Promise(function(o,s){n.setEntries(e,function(a){a?s(a):o()})});this.setEntries(e,i)},t.prototype.setEntries=function(e,i){var n="entries must be an array of record names",o;if(!(e instanceof Array))throw new Error(n);for(o=0;o<e.length;o++)if(typeof e[o]!="string")throw new Error(n);this.beforeChange(),this.record.set({data:e,callback:i}),this.afterChange()},t.prototype.removeEntry=function(e,i,n){var o=this.record.get(),s=this.hasIndex(i),a=[],c;for(c=0;c<o.length;c++)(o[c]!==e||s&&i!==c)&&a.push(o[c]);this.beforeChange(),this.record.set({data:a,callback:n}),this.afterChange()},t.prototype.addEntry=function(e,i,n){if(typeof e!="string")throw new Error("Entry must be a recordName");var o=this.hasIndex(i),s=this.getEntries();o?s.splice(i,0,e):s.push(e),this.beforeChange(),this.record.set({data:s,callback:n}),this.afterChange()},t.prototype.subscribe=function(e){var i=Ks.normalizeArguments(arguments);if(i.path)throw new Error("path is not supported for List.subscribe");var n=function(o,s){s(o.getEntries())}.bind(this,this,i.callback);this.wrappedFunctions.set(i.callback,n),i.callback=n,this.subscriptions.push(i),this.record.subscribe(i,this)},t.prototype.unsubscribe=function(e){var i=Ks.normalizeArguments(arguments);if(i.path)throw new Error("path is not supported for List.unsubscribe");var n=this.wrappedFunctions.get(i.callback);i.callback=n,this.wrappedFunctions.delete(i.callback),this.subscriptions=this.subscriptions.filter(function(o){return!!(i.callback&&i.callback!==o.callback)}),this.record.unsubscribe(i,this)},t.prototype.applyUpdate=function(e){e.parsedData instanceof Array||(e.parsedData=[]),this.beforeChange(),this.originalApplyUpdate(e),this.afterChange()},t.prototype.hasIndex=function(e){var i=!1,n=this.getEntries();if(e!==void 0){if(isNaN(e))throw new Error("Index must be a number");if(e!==n.length&&(e>=n.length||e<0))throw new Error("Index must be within current entries");i=!0}return i},t.prototype.beforeChange=function(){this.hasAddListener=this.hasListeners(ye.EVENT.ENTRY_ADDED_EVENT),this.hasRemoveListener=this.hasListeners(ye.EVENT.ENTRY_REMOVED_EVENT),this.hasMoveListener=this.hasListeners(ye.EVENT.ENTRY_MOVED_EVENT),this.hasAddListener||this.hasRemoveListener||this.hasMoveListener?this.beforeStructure=this.getStructure():this.beforeStructure=null},t.prototype.afterChange=function(){if(this.beforeStructure!==null){var e=this.getStructure(),i=this.beforeStructure,n,o;if(this.hasRemoveListener)for(n in i)for(o=0;o<i[n].length;o++)(e[n]===void 0||e[n][o]===void 0)&&this.emit(ye.EVENT.ENTRY_REMOVED_EVENT,n,i[n][o]);if(this.hasAddListener||this.hasMoveListener)for(n in e)if(i[n]===void 0)for(o=0;o<e[n].length;o++)this.emit(ye.EVENT.ENTRY_ADDED_EVENT,n,e[n][o]);else for(o=0;o<e[n].length;o++)i[n][o]!==e[n][o]&&(i[n][o]===void 0?this.emit(ye.EVENT.ENTRY_ADDED_EVENT,n,e[n][o]):this.emit(ye.EVENT.ENTRY_MOVED_EVENT,n,e[n][o]))}},t.prototype.getStructure=function(){var e={},i,n=this.getEntries();for(i=0;i<n.length;i++)e[n[i]]===void 0?e[n[i]]=[i]:e[n[i]].push(i);return e},t.prototype.destroy=function(){for(var e=0;e<this.subscriptions.length;e++)this.record.unsubscribe(this.subscriptions[e],this);this.wrappedFunctions.clear(),this.record.removeContext(this)},t}(ml.Emitter);Ut.List=Al});var zs=R(Rt=>{"use strict";u();var Dl=Rt&&Rt.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),en=Rt&&Rt.__assign||function(){return en=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},en.apply(this,arguments)},wl=Rt&&Rt.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o},Pl=Rt&&Rt.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.Dequeue=void 0;var Qs=Pt(),Re=k(),Ul=_t(),Ll=function(r){Dl(t,r);function t(e){var i=r.call(this)||this;return i.record=e,i.debugId=i.record.getDebugId(),i.wrappedFunctions=new Map,i.headPath="h",i.emptyHead={p:"",n:""},i.hasAddListener=!1,i.hasRemoveListener=!1,i.hasMoveListener=!1,i.subscriptions=[],i.lastEntries=[],i.lastVersion=0,i.originalApplyUpdate=i.record.applyUpdate.bind(i.record),i.record.applyUpdate=i.applyUpdate.bind(i),i.record.addReference(i),i.record.on("discard",function(){return i.emit("discard",i)},i),i.record.on("delete",function(){return i.emit("delete",i)},i),i.record.on("error",function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return i.emit.apply(i,Pl(["error"],wl(n),!1))},i),i}return Object.defineProperty(t.prototype,"name",{get:function(){return this.record.name},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isReady",{get:function(){return this.record.isReady},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.record.version},enumerable:!1,configurable:!0}),t.prototype.whenReady=function(e){if(e)this.record.whenReady(this,e);else return this.record.whenReady(this)},t.prototype.discard=function(){this.destroy(),this.record.removeReference(this)},t.prototype.delete=function(e){return this.destroy(),this.record.delete(e)},t.prototype.getEntries=function(){if(this.version===this.lastVersion)return this.lastEntries;for(var e=this.record.get(this.headPath)||this.emptyHead,i=e.n,n=[];i;){var o=this.record.get(i);n.push(o.d),i=o.n}return this.lastVersion=this.version,this.lastEntries=n,n},t.prototype.isEmpty=function(){var e=this.record.get(this.headPath)||this.emptyHead;return!e.n&&!e.p},t.prototype.setEntriesWithAck=function(e,i){var n=this;if(!i)return new Promise(function(o,s){n.setEntries(e,function(a){a?s(a):o()})});this.setEntries(e,i)},t.prototype.setEntries=function(e,i){var n,o,s="entries must be an array";if(!(e instanceof Array))throw new Error(s);if(e.length===0){this.record.set({data:(n={},n[this.headPath]=this.emptyHead,n),callback:i});return}for(var a={n:"0",p:"".concat(e.length-1)},c={},l=0;l<e.length;l++)c[l]={d:e[l],n:"".concat(l+1),p:"".concat(l-1)},l===0&&(c[l].p=""),l===e.length-1&&(c[l].n="");this.beforeChange(),this.record.set({data:en((o={},o[this.headPath]=a,o),c),callback:i}),this.afterChange()},t.prototype.getLast=function(){var e=this.record.get(this.headPath)||this.emptyHead;if(!e.p)return"";var i=this.record.get(e.p);return i.d},t.prototype.getFirst=function(){var e=this.record.get(this.headPath)||this.emptyHead;if(!e.n)return"";var i=this.record.get(e.n);return i.d},t.prototype.pop=function(){var e=this.getEntries();if(e.length<3){var i=e.pop()||"";return this.setEntries(e),i}var n=this.record.get(this.headPath)||this.emptyHead;if(!n.p)return"";var o=this.record.get(n.p);return this.beforeChange(),this.record.set({path:"".concat(this.headPath,".p"),data:o.p}),o.p&&this.record.set({path:"".concat(o.p,".n"),data:""}),this.record.set({path:n.p,data:void 0}),this.afterChange(),o.d},t.prototype.shift=function(){var e=this.getEntries();if(e.length<3){var i=e.shift()||"";return this.setEntries(e),i}var n=this.record.get(this.headPath)||this.emptyHead;if(!n.n)return"";var o=this.record.get(n.n);return this.beforeChange(),this.record.set({path:"".concat(this.headPath,".n"),data:o.n}),o.n&&this.record.set({path:"".concat(o.n,".p"),data:""}),this.record.set({path:n.n,data:void 0}),this.afterChange(),o.d},t.prototype.getNodeKey=function(){for(var e=Object.keys(this.record.get()).sort(function(o,s){return Number(o)-Number(s)}),i="".concat(e.length),n=1;n<e.length;n++)if(n!==Number(e[n])){i="".concat(n);break}return i},t.prototype.unshift=function(e){if(this.isEmpty()){this.setEntries([e]);return}var i=this.record.get(this.headPath)||this.emptyHead,n=this.getNodeKey();this.beforeChange(),this.record.set({path:n,data:{d:e,p:"",n:i.n}}),i.n&&this.record.set({path:"".concat(i.n,".p"),data:n}),this.record.set({path:"".concat(this.headPath,".n"),data:n}),this.afterChange()},t.prototype.push=function(e){if(this.isEmpty()){this.setEntries([e]);return}var i=this.record.get(this.headPath)||this.emptyHead,n=this.getNodeKey();this.beforeChange(),this.record.set({path:n,data:{d:e,p:i.p,n:""}}),i.p&&this.record.set({path:"".concat(i.p,".n"),data:n}),this.record.set({path:"".concat(this.headPath,".p"),data:n}),this.afterChange()},t.prototype.removeNode=function(e,i){var n=this.record.get(this.headPath)||this.emptyHead;this.beforeChange(),i.p&&this.record.set({path:"".concat(i.p,".n"),data:i.n}),i.n&&this.record.set({path:"".concat(i.n,".p"),data:i.p}),n.p===e&&this.record.set({path:"".concat(this.headPath,".p"),data:i.p}),n.n===e&&this.record.set({path:"".concat(this.headPath,".n"),data:i.n}),this.record.set({path:e,data:void 0}),this.afterChange()},t.prototype.removeEntry=function(e,i){for(var n=this.record.get(this.headPath)||this.emptyHead,o=n.n,s=0;o;){var a=this.record.get(o);if(a.d===e){if(!i){this.removeNode(o,a);break}if(i&&i===s){this.removeNode(o,a);break}}++s,o=a.n}if(!o)throw new Error("no entry removed")},t.prototype.insertEntry=function(e,i){var n=this.hasIndex(i);if(i===0){this.unshift(e);return}if(n){for(var o=this.record.get(this.headPath)||this.emptyHead,s=o.n,a=0;s;){var c=this.record.get(s);if(i===a){var l=this.getNodeKey();this.beforeChange(),this.record.set({path:l,data:{d:e,n:s,p:c.p}}),this.record.set({path:"".concat(s,".p"),data:l}),c.p&&this.record.set({path:"".concat(c.p,".n"),data:l}),this.afterChange();break}++a,s=c.n}if(!s)throw new Error("Index out of range")}},t.prototype.subscribe=function(e,i){var n=Qs.normalizeArguments(arguments);if(n.path)if(n.path==="first")n.path="".concat(this.headPath,".n");else if(n.path==="last")n.path="".concat(this.headPath,".p");else throw new Error('Position must be "first" or "last" element');var o=function(s,a){n.path?(n.path==="".concat(s.headPath,".p")&&a(s.getLast()),n.path==="".concat(s.headPath,".n")&&a(s.getFirst())):a(s.getEntries())}.bind(this,this,n.callback);this.wrappedFunctions.set(n.callback,o),n.callback=o,this.subscriptions.push(n),this.record.subscribe(n,this)},t.prototype.unsubscribe=function(e,i){var n=Qs.normalizeArguments(arguments);if(n.path)if(n.path==="first")n.path="".concat(this.headPath,".n");else if(n.path==="last")n.path="".concat(this.headPath,".p");else throw new Error('Position must be "first" or "last" element');var o=this.wrappedFunctions.get(n.callback);n.callback=o,this.wrappedFunctions.delete(n.callback),this.subscriptions=this.subscriptions.filter(function(s){return!(!n.callback&&s.path===n.path||n.callback&&s.path===n.path&&s.callback===n.callback)}),this.record.unsubscribe(n,this)},t.prototype.applyUpdate=function(e){this.beforeChange(),this.originalApplyUpdate(e),this.afterChange()},t.prototype.hasIndex=function(e){var i=!1,n=this.getEntries();if(e!==void 0){if(isNaN(e))throw new Error("Index must be a number");if(e!==n.length&&(e>=n.length||e<0))throw new Error("Index must be within current entries");i=!0}return i},t.prototype.beforeChange=function(){this.hasAddListener=this.hasListeners(Re.EVENT.ENTRY_ADDED_EVENT),this.hasRemoveListener=this.hasListeners(Re.EVENT.ENTRY_REMOVED_EVENT),this.hasMoveListener=this.hasListeners(Re.EVENT.ENTRY_MOVED_EVENT),this.hasAddListener||this.hasRemoveListener||this.hasMoveListener?this.beforeStructure=this.getStructure():this.beforeStructure=null},t.prototype.afterChange=function(){if(this.beforeStructure!==null){var e=this.getStructure(),i=this.beforeStructure,n,o;if(this.hasRemoveListener)for(n in i)for(o=0;o<i[n].length;o++)(e[n]===void 0||e[n][o]===void 0)&&this.emit(Re.EVENT.ENTRY_REMOVED_EVENT,n,i[n][o]);if(this.hasAddListener||this.hasMoveListener)for(n in e)if(i[n]===void 0)for(o=0;o<e[n].length;o++)this.emit(Re.EVENT.ENTRY_ADDED_EVENT,n,e[n][o]);else for(o=0;o<e[n].length;o++)i[n][o]!==e[n][o]&&(i[n][o]===void 0?this.emit(Re.EVENT.ENTRY_ADDED_EVENT,n,e[n][o]):this.emit(Re.EVENT.ENTRY_MOVED_EVENT,n,e[n][o]))}},t.prototype.getStructure=function(){var e={},i,n=this.getEntries();for(i=0;i<n.length;i++)e[n[i]]===void 0?e[n[i]]=[i]:e[n[i]].push(i);return e},t.prototype.destroy=function(){for(var e=0;e<this.subscriptions.length;e++)this.record.unsubscribe(this.subscriptions[e],this);this.wrappedFunctions.clear(),this.record.removeContext(this)},t}(Ul.Emitter);Rt.Dequeue=Ll});var Xs=R(oi=>{"use strict";u();Object.defineProperty(oi,"__esModule",{value:!0});oi.SingleNotifier=void 0;var ni=k(),Ml=function(){function r(t,e,i){this.services=t,this.action=e,this.requests=new Map,this.internalRequests=new Map,this.limboQueue=[],this.services.connection.onLost(this.onConnectionLost.bind(this)),this.services.connection.onExitLimbo(this.onExitLimbo.bind(this)),this.services.connection.onReestablished(this.onConnectionReestablished.bind(this))}return r.prototype.request=function(t,e){var i=this.requests.get(t);if(i){i.push(e);return}this.requests.set(t,[e]);var n={topic:ni.TOPIC.RECORD,action:this.action,name:t};this.services.connection.isConnected?(this.services.connection.sendMessage(n),this.services.timeoutRegistry.add({message:n})):this.services.connection.isInLimbo?this.limboQueue.push(n):(this.requests.delete(t),e(ni.EVENT.CLIENT_OFFLINE))},r.prototype.register=function(t,e,i){var n=this.internalRequests.get(t);n?n.push({callback:i,context:e}):this.internalRequests.set(t,[{callback:i,context:e}])},r.prototype.recieve=function(t,e,i){this.services.timeoutRegistry.remove(t);var n=t.name,o=this.requests.get(n)||[],s=this.internalRequests.get(n)||[];if(!(!o&&!s)){for(var a=0;a<s.length;a++)s[a].callback.call(s[a].context,t);this.internalRequests.delete(n);for(var a=0;a<o.length;a++)o[a](e,i);this.requests.delete(n)}},r.prototype.onConnectionLost=function(){this.requests.forEach(function(t){t.forEach(function(e){return e(ni.EVENT.CLIENT_OFFLINE)})}),this.requests.clear()},r.prototype.onExitLimbo=function(){for(var t=0;t<this.limboQueue.length;t++){var e=this.limboQueue[t],i=this.requests.get(e.name);i&&i.forEach(function(n){return n(ni.EVENT.CLIENT_OFFLINE)})}this.requests.clear(),this.limboQueue=[]},r.prototype.onConnectionReestablished=function(){for(var t=0;t<this.limboQueue.length;t++){var e=this.limboQueue[t];this.services.connection.sendMessage(e),this.services.timeoutRegistry.add({message:e})}},r}();oi.SingleNotifier=Ml});var Zs=R(Fe=>{"use strict";u();var si=Fe&&Fe.__assign||function(){return si=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},si.apply(this,arguments)};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.WriteAcknowledgementService=void 0;var cr=k(),Bl=function(){function r(t){this.services=t,this.responses=new Map,this.count=1,this.services.connection.onLost(this.onConnectionLost.bind(this))}return r.prototype.send=function(t,e){if(this.services.connection.isConnected===!1){this.services.timerRegistry.requestIdleCallback(e.bind(this,cr.EVENT.CLIENT_OFFLINE,t.name));return}var i=this.count.toString();this.responses.set(i,e),this.services.connection.sendMessage(si(si({},t),{correlationId:i,isWriteAck:!0})),this.count++},r.prototype.recieve=function(t){var e=t.correlationId,i=this.responses.get(e);!i||t.action!==cr.RECORD_ACTION.WRITE_ACKNOWLEDGEMENT&&!t.isError&&!t.isWriteAck||(t.action===cr.RECORD_ACTION.VERSION_EXISTS?i(t.reason||"Write failed due to conflict",t.name):t.isError?i(cr.RECORD_ACTION[t.action],t.name):i(null,t.name),this.responses.delete(e))},r.prototype.onConnectionLost=function(){this.responses.forEach(function(t){return t(cr.EVENT.CLIENT_OFFLINE)}),this.responses.clear()},r}();Fe.WriteAcknowledgementService=Bl});var ta=R(Xt=>{"use strict";u();var kl=Xt&&Xt.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o},xl=Xt&&Xt.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.DirtyService=void 0;var jl=function(){function r(t,e){this.storage=t,this.dirtyStorageName=e,this.dirtyRecords=new Map,this.loadedCallback=[],this.flushTimeout=null,this.loaded=!1,this.save=this.save.bind(this),this.load()}return r.prototype.isDirty=function(t){return this.dirtyRecords.has(t)},r.prototype.setDirty=function(t,e){var i=!0;e?this.dirtyRecords.set(t,!0):i=this.dirtyRecords.delete(t),!this.flushTimeout&&i&&(this.flushTimeout=setTimeout(this.save,1e3))},r.prototype.save=function(){this.storage.set(this.dirtyStorageName,1,xl([],kl(this.dirtyRecords),!1),function(){}),this.flushTimeout&&clearTimeout(this.flushTimeout),this.flushTimeout=null},r.prototype.whenLoaded=function(t,e){if(this.loaded){e.call(t);return}this.loadedCallback.push({callback:e,context:t})},r.prototype.getAll=function(){return this.dirtyRecords},r.prototype.load=function(){var t=this;this.loaded||this.storage.get(this.dirtyStorageName,function(e,i,n){t.dirtyRecords=n?new Map(n):new Map,t.loaded=!0,t.loadedCallback.forEach(function(o){var s=o.callback,a=o.context;return s.call(a)})})},r}();Xt.DirtyService=jl});var ra=R(Zt=>{"use strict";u();var Vl=Zt&&Zt.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Fl=Zt&&Zt.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.MergeStrategyService=void 0;var ea=k(),Hl=function(){function r(t,e){this.services=t,this.defaultStrategy=e,this.strategiesByRecord=new Map,this.strategiesByPattern=new Map}return r.prototype.setMergeStrategyByName=function(t,e){this.strategiesByRecord.set(t,e)},r.prototype.setMergeStrategyByPattern=function(t,e){this.strategiesByPattern.set(t,e)},r.prototype.merge=function(t,e,i,n,o){var s,a,c=t.name,l=this.strategiesByRecord.get(c);if(l){l(i,e,t.parsedData,t.version,function(A,ht){n.call(o,A,t,ht,e,i)});return}try{for(var h=Vl(this.strategiesByPattern),p=h.next();!p.done;p=h.next()){var g=Fl(p.value,2),N=g[0],B=g[1];if(N.test(c)){B(i,e,t.parsedData,t.version,function(A,ht){n.call(o,A,t,ht,e,i)});return}}}catch(A){s={error:A}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(s)throw s.error}}if(this.defaultStrategy){this.defaultStrategy(i,e,t.parsedData,t.version,function(A,ht){n.call(o,A,t,ht,e,i)});return}this.services.logger.error({topic:ea.TOPIC.RECORD},ea.EVENT.RECORD_VERSION_EXISTS,{remoteVersion:t.version,recordName:c})},r}();Zt.MergeStrategyService=Hl});var oa=R(Lt=>{"use strict";u();var ia=Lt&&Lt.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o},Gl=Lt&&Lt.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,n=t.length,o;i<n;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return r.concat(o||Array.prototype.slice.call(t))},ql=Lt&&Lt.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.RecordHandler=void 0;var rn=Pt(),b=k(),Wl=Ws(),Yl=Ys(),$l=$s(),Kl=Js(),Jl=zs(),Ql=Xi(),na=Xs(),zl=Zs(),Xl=ta(),Zl=ra(),th=ar(),eh=function(){function r(t,e,i,n){var o;n===void 0&&(n=new Ql.Listener(b.TOPIC.RECORD,t)),this.services=t,this.options=e,this.listener=n,this.recordCores=new Map,this.notifyCallbacks=new Map,this.recordServices=i||{bulkSubscriptionService:(o={},o[b.RECORD_ACTION.SUBSCRIBECREATEANDREAD]=this.getBulkSubscriptionService(b.RECORD_ACTION.SUBSCRIBECREATEANDREAD),o[b.RECORD_ACTION.SUBSCRIBEANDREAD]=this.getBulkSubscriptionService(b.RECORD_ACTION.SUBSCRIBEANDREAD),o[b.RECORD_ACTION.SUBSCRIBEANDHEAD]=this.getBulkSubscriptionService(b.RECORD_ACTION.SUBSCRIBEANDHEAD),o),writeAckService:new zl.WriteAcknowledgementService(t),readRegistry:new na.SingleNotifier(t,b.RECORD_ACTION.READ,e.recordReadTimeout),headRegistry:new na.SingleNotifier(t,b.RECORD_ACTION.HEAD,e.recordReadTimeout),dirtyService:new Xl.DirtyService(t.storage,e.dirtyStorageName),mergeStrategy:new Zl.MergeStrategyService(t,e.mergeStrategy)},this.dirtyService=this.recordServices.dirtyService,this.sendUpdatedData=this.sendUpdatedData.bind(this),this.onMergeCompleted=this.onMergeCompleted.bind(this),this.getRecordCore=this.getRecordCore.bind(this),this.removeRecord=this.removeRecord.bind(this),this.onBulkSubscriptionSent=this.onBulkSubscriptionSent.bind(this),this.services.connection.registerHandler(b.TOPIC.RECORD,this.handle.bind(this)),this.services.connection.onReestablished(this.syncDirtyRecords.bind(this)),this.services.connection.isConnected&&this.syncDirtyRecords()}return r.prototype.names=function(){return Gl([],ia(this.recordCores.keys()),!1)},r.prototype.setMergeStrategy=function(t,e){if(typeof e=="function")this.recordServices.mergeStrategy.setMergeStrategyByName(t,e);else throw new Error("Invalid merge strategy: Must be a Function")},r.prototype.setMergeStrategyRegExp=function(t,e){if(typeof e=="function")this.recordServices.mergeStrategy.setMergeStrategyByPattern(t,e);else throw new Error("Invalid merge strategy: Must be a Function")},r.prototype.getRecord=function(t){return new Yl.Record(this.getRecordCore(t))},r.prototype.getList=function(t){return new Kl.List(this.getRecordCore(t))},r.prototype.getDq=function(t){return new Jl.Dequeue(this.getRecordCore(t))},r.prototype.getAnonymousRecord=function(){return new $l.AnonymousRecord(this.getRecordCore)},r.prototype.listen=function(t,e){this.listener.listen(t,e)},r.prototype.unlisten=function(t){this.listener.unlisten(t)},r.prototype.snapshot=function(t,e){var i=this;if(typeof t!="string"||t.length===0)throw new Error("invalid argument: name");if(e!==void 0&&typeof e!="function")throw new Error("invalid argument: callback");var n=this.recordCores.get(t);if(n){if(e)n.whenReady(null,function(){e(null,n.get())});else return new Promise(function(o,s){n.whenReady(null,function(){o(n.get())})});return}if(e)this.recordServices.readRegistry.request(t,e);else return new Promise(function(o,s){i.recordServices.readRegistry.request(t,function(a,c){return a?s(a):o(c)})})},r.prototype.has=function(t,e){var i=this;if(typeof t!="string"||t.length===0)throw new Error("invalid argument: name");if(e!==void 0&&typeof e!="function")throw new Error("invalid argument: callback");var n;if(!e)return new Promise(function(o,s){n=function(a,c){return a?s(a):o(c!==-1)},i.head(t,n)});n=function(o,s){return o?e(o,null):e(null,s!==-1)},this.head(t,n)},r.prototype.head=function(t,e){var i=this;if(typeof t!="string"||t.length===0)throw new Error("invalid argument: name");if(e!==void 0&&typeof e!="function")throw new Error("invalid argument: callback");var n=this.recordCores.get(t);if(n){if(e)n.whenReady(null,function(){e(null,n.version)});else return new Promise(function(o,s){n.whenReady(null,function(){o(n.version)})});return}if(e)this.recordServices.headRegistry.request(t,e);else return new Promise(function(o,s){i.recordServices.headRegistry.request(t,function(a,c){return a?s(a):o(c)})})},r.prototype.setDataWithAck=function(t){for(var e=this,i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];var o=rn.normalizeSetArguments(arguments,1);if(!o.callback)return new Promise(function(s,a){o.callback=function(c){return c===null?s():a(c)},e.sendSetData(t,-1,o)});this.sendSetData(t,-1,o)},r.prototype.setData=function(t){var e=rn.normalizeSetArguments(arguments,1);this.sendSetData(t,-1,e)},r.prototype.delete=function(t,e){throw Error("Delete is not yet supported without use of a Record")},r.prototype.notify=function(t,e){var i=this;if(!this.services.connection.isConnected){if(e){e(b.EVENT.CLIENT_OFFLINE);return}return new Promise(function(o,s){return s(b.EVENT.CLIENT_OFFLINE)})}var n=rn.getUid();if(this.services.connection.sendMessage({topic:b.TOPIC.RECORD,action:b.RECORD_ACTION.NOTIFY,names:t,correlationId:n}),e)this.notifyCallbacks.set(n,e);else return new Promise(function(o,s){i.notifyCallbacks.set(n,function(a){return a?s(a):o()})})},r.prototype.sendSetData=function(t,e,i){var n=i.path,o=i.data,s=i.callback;if(!t||typeof t!="string"||t.length===0)throw new Error("invalid argument: recordName must be an non empty string");if(!n&&(o===null||typeof o!="object"))throw new Error("invalid argument: data must be an object when no path is provided");var a=this.recordCores.get(t);if(a){a.set({path:n,data:o,callback:s});return}var c;n?o===void 0?c=b.RECORD_ACTION.ERASE:c=b.RECORD_ACTION.CREATEANDPATCH:c=b.RECORD_ACTION.CREATEANDUPDATE;var l={topic:b.TOPIC.RECORD,action:c,name:t,path:n,version:e,parsedData:o};s?this.recordServices.writeAckService.send(l,s):this.services.connection.sendMessage(l)},r.prototype.saveToOfflineStorage=function(){this.recordCores.forEach(function(t){return t.saveRecordToOffline()})},r.prototype.clearOfflineStorage=function(t){var e=this;if(t)this.services.storage.reset(t);else return new Promise(function(i,n){e.services.storage.reset(function(o){return o?n(o):i()})})},r.prototype.handle=function(t){var e=this;if(t.action===b.RECORD_ACTION.NOTIFY&&t.isAck||t.isError&&t.action===b.RECORD_ACTION.RECORD_NOTIFY_ERROR){var i=this.notifyCallbacks.get(t.correlationId);i?(i(t.data||null),this.notifyCallbacks.delete(t.correlationId)):this.services.logger.error(t,b.RECORD_ACTION.NOTIFY);return}if(t.isAck){this.services.timeoutRegistry.remove(t);return}if(t.action===b.RECORD_ACTION.SUBSCRIPTION_FOR_PATTERN_FOUND||t.action===b.RECORD_ACTION.SUBSCRIPTION_FOR_PATTERN_REMOVED||t.action===b.RECORD_ACTION.LISTEN||t.action===b.RECORD_ACTION.UNLISTEN){this.listener.handle(t);return}if(t.isWriteAck&&t.action!==b.RECORD_ACTION.VERSION_EXISTS){this.recordServices.writeAckService.recieve(t);return}if(t.action===b.RECORD_ACTION.READ_RESPONSE||t.originalAction===b.RECORD_ACTION.READ){t.isError?this.recordServices.readRegistry.recieve(t,b.RECORD_ACTION[t.action]):this.recordServices.readRegistry.recieve(t,null,t.parsedData);return}if(t.action===b.RECORD_ACTION.HEAD_RESPONSE_BULK){Object.keys(t.versions).forEach(function(o){e.recordServices.headRegistry.recieve({topic:b.TOPIC.RECORD,action:b.RECORD_ACTION.HEAD_RESPONSE,originalAction:b.RECORD_ACTION.HEAD,name:o,version:t.versions[o]},null,t.versions[o])});return}if(t.action===b.RECORD_ACTION.HEAD_RESPONSE||t.originalAction===b.RECORD_ACTION.HEAD){t.isError?this.recordServices.headRegistry.recieve(t,b.RECORD_ACTION[t.action]):this.recordServices.headRegistry.recieve(t,null,t.version);return}var n=this.recordCores.get(t.name);if(n){n.handle(t);return}if(t.action!==b.RECORD_ACTION.VERSION_EXISTS&&!(t.action===b.RECORD_ACTION.SUBSCRIPTION_HAS_PROVIDER||t.action===b.RECORD_ACTION.SUBSCRIPTION_HAS_NO_PROVIDER)){if(t.isError){this.services.logger.error(t);return}this.services.logger.error(t,b.EVENT.UNSOLICITED_MESSAGE)}},r.prototype.removeRecord=function(t){this.recordCores.delete(t)},r.prototype.getRecordCore=function(t){var e=this.recordCores.get(t);return e||(e=new Wl.RecordCore(t,this.services,this.options,this.recordServices,this.removeRecord),this.recordCores.set(t,e)),e},r.prototype.syncDirtyRecords=function(){this.dirtyService.whenLoaded(this,this._syncDirtyRecords)},r.prototype._syncDirtyRecords=function(){var t,e,i=this.dirtyService.getAll();try{for(var n=ql(i),o=n.next();!o.done;o=n.next()){var s=ia(o.value,1),a=s[0],c=this.recordCores.get(a);c&&c.references.size>0||this.services.storage.get(a,this.sendUpdatedData)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},r.prototype.sendUpdatedData=function(t,e,i){var n=this;if(e===-1){this.services.logger.warn({topic:b.TOPIC.RECORD},b.RECORD_ACTION.DELETE,"Deleted record while offline, can't resolve");return}var o=function(s,a){s?n.recordServices.readRegistry.register(a,n,function(c){n.recordServices.mergeStrategy.merge(c,e,i,n.onMergeCompleted,n)}):n.dirtyService.setDirty(a,!1)};this.sendSetData(t,e,{data:i,callback:o})},r.prototype.onMergeCompleted=function(t,e,i){var n=e.name,o=e.version;this.sendSetData(n,o+1,{data:i})},r.prototype.getBulkSubscriptionService=function(t){return new th.BulkSubscriptionService(this.services,this.options.subscriptionInterval,b.TOPIC.RECORD,t,b.RECORD_ACTION.UNSUBSCRIBE,this.onBulkSubscriptionSent)},r.prototype.onBulkSubscriptionSent=function(t){t.names||this.services.timeoutRegistry.add({message:t})},r}();Lt.RecordHandler=eh});var sa=R(ci=>{"use strict";u();Object.defineProperty(ci,"__esModule",{value:!0});ci.PresenceHandler=void 0;var L=k(),ai=_t(),rh=ar(),Tt="OE";function ih(r){var t=null,e=null;if(r.length===1)if(Array.isArray(r[0]))t=r[0];else{if(typeof r[0]!="function")throw new Error('invalid argument: "callback"');e=r[0]}else if(r.length===2&&(t=r[0],e=r[1],!Array.isArray(t)||typeof e!="function"))throw new Error('invalid argument: "users" or "callback"');return{users:t,callback:e}}var nh=function(){function r(t,e){this.services=t,this.globalSubscriptionEmitter=new ai.Emitter,this.subscriptionEmitter=new ai.Emitter,this.queryEmitter=new ai.Emitter,this.queryAllEmitter=new ai.Emitter,this.counter=0,this.limboQueue=[],this.bulkSubscription=new rh.BulkSubscriptionService(this.services,e.subscriptionInterval,L.TOPIC.PRESENCE,L.PRESENCE_ACTION.SUBSCRIBE,L.PRESENCE_ACTION.UNSUBSCRIBE,this.onBulkSubscriptionSent.bind(this)),this.services.connection.registerHandler(L.TOPIC.PRESENCE,this.handle.bind(this)),this.services.connection.onExitLimbo(this.onExitLimbo.bind(this)),this.services.connection.onLost(this.onExitLimbo.bind(this)),this.services.connection.onReestablished(this.onConnectionReestablished.bind(this))}return r.prototype.subscribe=function(t,e){if(typeof t=="string"&&t.length>0&&typeof e=="function"){var i=t;this.subscriptionEmitter.hasListeners(i)||this.bulkSubscription.subscribe(i),this.subscriptionEmitter.on(i,e);return}if(typeof t=="function"&&typeof e=="undefined"){this.globalSubscriptionEmitter.hasListeners(Tt)||this.subscribeToAllChanges(),this.globalSubscriptionEmitter.on(Tt,t);return}throw new Error('invalid arguments: "user" or "callback"')},r.prototype.unsubscribe=function(t,e){if(t&&typeof t=="string"&&t.length>0){var i=t;if(e){if(typeof e!="function")throw new Error('invalid argument: "callback"');this.subscriptionEmitter.off(i,e)}else this.subscriptionEmitter.off(i);if(!this.subscriptionEmitter.hasListeners(i)){this.bulkSubscription.unsubscribe(i);return}}if(t&&typeof t=="function"){e=t,this.globalSubscriptionEmitter.off(Tt,e),this.globalSubscriptionEmitter.hasListeners(Tt)||this.unsubscribeToAllChanges();return}if(typeof t=="undefined"&&typeof e=="undefined"){this.subscriptionEmitter.off(),this.globalSubscriptionEmitter.off(),this.bulkSubscription.unsubscribeList(this.subscriptionEmitter.eventNames()),this.unsubscribeToAllChanges();return}throw new Error('invalid argument: "user" or "callback"')},r.prototype.getAll=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=ih(t),n=i.callback,o=i.users,s,a,c;if(o){var l=(this.counter++).toString();s={topic:L.TOPIC.PRESENCE,action:L.PRESENCE_ACTION.QUERY,correlationId:l,names:o},a=this.queryEmitter,c=l}else s={topic:L.TOPIC.PRESENCE,action:L.PRESENCE_ACTION.QUERY_ALL},a=this.queryAllEmitter,c=Tt;if(this.services.connection.isConnected?this.sendQuery(s):this.services.connection.isInLimbo?this.limboQueue.push(s):this.services.timerRegistry.requestIdleCallback(function(){a.emit(c,L.EVENT.CLIENT_OFFLINE)}),n){a.once(c,n);return}return new Promise(function(h,p){a.once(c,function(g,N){return g?p(g):h(N)})})},r.prototype.handle=function(t){if(t.isAck){this.services.timeoutRegistry.remove(t);return}if(t.action===L.PRESENCE_ACTION.QUERY_ALL_RESPONSE){this.queryAllEmitter.emit(Tt,null,t.names),this.services.timeoutRegistry.remove(t);return}if(t.action===L.PRESENCE_ACTION.QUERY_RESPONSE){this.queryEmitter.emit(t.correlationId,null,t.parsedData),this.services.timeoutRegistry.remove(t);return}if(t.action===L.PRESENCE_ACTION.PRESENCE_JOIN){this.subscriptionEmitter.emit(t.name,t.name,!0);return}if(t.action===L.PRESENCE_ACTION.PRESENCE_JOIN_ALL){this.globalSubscriptionEmitter.emit(Tt,t.name,!0);return}if(t.action===L.PRESENCE_ACTION.PRESENCE_LEAVE){this.subscriptionEmitter.emit(t.name,t.name,!1);return}if(t.action===L.PRESENCE_ACTION.PRESENCE_LEAVE_ALL){this.globalSubscriptionEmitter.emit(Tt,t.name,!1);return}if(t.isError){this.services.timeoutRegistry.remove(t),t.originalAction===L.PRESENCE_ACTION.QUERY?this.queryEmitter.emit(t.correlationId,L.PRESENCE_ACTION[t.action]):t.originalAction===L.PRESENCE_ACTION.QUERY_ALL?this.queryAllEmitter.emit(Tt,L.PRESENCE_ACTION[t.action]):this.services.logger.error(t);return}this.services.logger.error(t,L.EVENT.UNSOLICITED_MESSAGE)},r.prototype.sendQuery=function(t){this.services.connection.sendMessage(t),this.services.timeoutRegistry.add({message:t})},r.prototype.subscribeToAllChanges=function(){if(this.services.connection.isConnected){var t={topic:L.TOPIC.PRESENCE,action:L.PRESENCE_ACTION.SUBSCRIBE_ALL};this.services.timeoutRegistry.add({message:t}),this.services.connection.sendMessage(t)}},r.prototype.unsubscribeToAllChanges=function(){if(this.services.connection.isConnected){var t={topic:L.TOPIC.PRESENCE,action:L.PRESENCE_ACTION.UNSUBSCRIBE_ALL};this.services.timeoutRegistry.add({message:t}),this.services.connection.sendMessage(t)}},r.prototype.onConnectionReestablished=function(){var t=this.subscriptionEmitter.eventNames();t.length>0&&this.bulkSubscription.subscribeList(t);var e=this.globalSubscriptionEmitter.hasListeners(Tt);e&&this.subscribeToAllChanges();for(var i=0;i<this.limboQueue.length;i++)this.sendQuery(this.limboQueue[i]);this.limboQueue=[]},r.prototype.onExitLimbo=function(){var t=this;this.queryEmitter.eventNames().forEach(function(e){t.queryEmitter.emit(e,L.EVENT.CLIENT_OFFLINE)}),this.queryAllEmitter.emit(Tt,L.EVENT.CLIENT_OFFLINE),this.limboQueue=[],this.queryAllEmitter.off(),this.queryEmitter.off()},r.prototype.onBulkSubscriptionSent=function(t){this.services.timeoutRegistry.add({message:t})},r}();ci.PresenceHandler=nh});var aa=R(ee=>{"use strict";u();var oh=ee&&ee.__values||function(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],i=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},sh=ee&&ee.__read||function(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var i=e.call(r),n,o=[],s;try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(s)throw s.error}}return o};Object.defineProperty(ee,"__esModule",{value:!0});ee.IndexdbStorage=void 0;var te;(function(r){r[r.GET=0]="GET",r[r.SET=1]="SET",r[r.DELETE=2]="DELETE"})(te||(te={}));var ah=function(){function r(t){var e=this;if(this.options=t,this.isReady=!1,this.queuedRequests=new Map,this.flushTimeout=null,typeof indexedDB=="undefined"||indexedDB===null)throw new Error("IndexDB currently not supported when deepstream in node");this.flush=this.flush.bind(this);var i=t.indexdb,n=i.objectStoreNames,o=i.storageDatabaseName,s=i.defaultObjectStoreName,a=i.primaryKey;n.includes(s)||n.push(s);var c=t.indexdb.dbVersion;if(t.indexdb.autoVersion){var l=localStorage.getItem("deepstream-db/".concat(o));if(l){var h=JSON.parse(l),p=h.objectStoreNames.length!==n.length||h.objectStoreNames.some(function(N){return!n.includes(N)});p?c=h.dbVersion+1:c=h.dbVersion}else c=1}var g=indexedDB.open(o,c);g.onerror=function(N){console.error("Error opening index ".concat(o),N)},g.onsuccess=function(N){e.db=N.target.result,e.onReady()},g.onupgradeneeded=function(){var N=g.result;n.forEach(function(A){N.objectStoreNames.contains(A)||N.createObjectStore(A,{keyPath:a})});for(var B=0;B<N.objectStoreNames.length;B++)n.includes(N.objectStoreNames[B])===!1&&N.deleteObjectStore(N.objectStoreNames[B]);t.indexdb.autoVersion&&localStorage.setItem("deepstream-db/".concat(o),JSON.stringify({dbVersion:c,objectStoreNames:n}))}}return r.prototype.get=function(t,e){var i=this.options.ignorePrefixes.some(function(n){return t.startsWith(n)});if(i){e(t,-1,null);return}this.insertRequest({recordName:t,callback:e,operation:te.GET})},r.prototype.set=function(t,e,i,n){var o=this.options.ignorePrefixes.some(function(s){return t.startsWith(s)});if(o){n(null,t);return}this.insertRequest({recordName:t,version:e,callback:n,data:i,operation:te.SET})},r.prototype.delete=function(t,e){var i=this.options.ignorePrefixes.some(function(n){return t.startsWith(n)});if(i){e(null,t);return}this.insertRequest({recordName:t,callback:e,operation:te.DELETE})},r.prototype.reset=function(t){var e=this;this.db&&(this.db.close(),this.db=null);var i=indexedDB.deleteDatabase(this.options.indexdb.storageDatabaseName);i.onblocked=function(){return setTimeout(function(){return e.reset(t)},1e3)},i.onsuccess=function(){return t(null)},i.onerror=function(n){var o="Error deleting database ".concat(e.options.indexdb.storageDatabaseName);console.error(o,n),t(o)}},r.prototype.registerFlush=function(){this.isReady&&!this.flushTimeout&&(this.flushTimeout=setTimeout(this.flush,this.options.indexdb.flushTimeout))},r.prototype.flush=function(){var t,e,i=this,n=this.db.transaction(this.queuedRequests.keys(),"readwrite"),o=function(p,g){var N=n.objectStore(p);g.forEach(function(B){var A,ht=B.operation,rt=B.recordName,ze=B.version,S=B.data,_=B.callback;switch(ht){case te.GET:{var v=N.get(rt);v.onerror=function(z){throw new Error("Requesting record ".concat(rt," failed"))},v.onsuccess=function(){v.result?_(rt,v.result.version,v.result.data):_(rt,-1,null)};break}case te.DELETE:{var C=N.delete(rt);C.onsuccess=function(){return _(null)},C.onerror=function(z){return _(z.errorCode)};break}case te.SET:{var C=N.put((A={},A[i.options.indexdb.primaryKey]=rt,A.version=ze,A.data=S,A));C.onsuccess=function(){return _(null)},C.onerror=function(V){return _(V.errorCode)};break}}})};try{for(var s=oh(this.queuedRequests),a=s.next();!a.done;a=s.next()){var c=sh(a.value,2),l=c[0],h=c[1];o(l,h)}}catch(p){t={error:p}}finally{try{a&&!a.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}this.queuedRequests.clear(),this.flushTimeout=null},r.prototype.onReady=function(){this.isReady=!0,this.flush()},r.prototype.insertRequest=function(t){var e=t.recordName.indexOf("/"),i;e>-1?(i=t.recordName.substring(0,e),this.options.indexdb.objectStoreNames.indexOf(i)===-1?(console.error("Object store names need to be predefined, missing ".concat(i,". Using default objectStore instead.")),i=this.options.indexdb.defaultObjectStoreName):t.recordName=t.recordName.substring(e+1,t.recordName.length)):i=this.options.indexdb.defaultObjectStoreName;var n=this.queuedRequests.get(i);n===void 0?this.queuedRequests.set(i,[t]):n.push(t),this.registerFlush()},r}();ee.IndexdbStorage=ah});var ca=R(ui=>{"use strict";u();Object.defineProperty(ui,"__esModule",{value:!0});ui.LocalstorageStorage=void 0;var ch=function(){function r(t){if(this.options=t,this.isReady=!0,typeof localStorage=="undefined"||localStorage===null)try{var e=Ja("node-localstorage").LocalStorage;this.storage=new e(t.localstorage.nodeStoragePath,t.localstorage.nodeStorageSize*1024*1024)}catch(i){throw new Error("Attempting to use localStorage outside of browser without node-localstorage polyfill")}else this.storage=localStorage}return r.prototype.get=function(t,e){var i=this.options.ignorePrefixes.some(function(s){return t.startsWith(s)});if(i){e(t,-1,null);return}var n=this.storage.getItem(t);if(n){var o=JSON.parse(n);setTimeout(e.bind(this,t,o.version,o.data),0);return}setTimeout(e.bind(this,t,-1,null),0)},r.prototype.set=function(t,e,i,n){var o=this.options.ignorePrefixes.some(function(s){return t.startsWith(s)});if(o){n(null,t);return}this.storage.setItem(t,JSON.stringify({recordName:t,version:e,data:i})),setTimeout(n,0)},r.prototype.delete=function(t,e){var i=this.options.ignorePrefixes.some(function(n){return t.startsWith(n)});if(i){e(null,t);return}this.storage.removeItem(t),setTimeout(e,0)},r.prototype.reset=function(t){try{this.storage.clear(),t(null)}catch(e){t(e)}},r}();ui.LocalstorageStorage=ch});var ua=R(li=>{"use strict";u();Object.defineProperty(li,"__esModule",{value:!0});li.NoopStorage=void 0;var uh=function(){function r(){this.isReady=!0}return r.prototype.get=function(t,e){setTimeout(e.bind(this,t,-1,null),0)},r.prototype.set=function(t,e,i,n){setTimeout(n,0)},r.prototype.delete=function(t,e){setTimeout(e,0)},r.prototype.reset=function(t){t(null)},r}();li.NoopStorage=uh});var ha=R(St=>{"use strict";u();var lh=St&&St.__extends||function(){var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o])},r(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}(),hi=St&&St.__assign||function(){return hi=Object.assign||function(r){for(var t,e=1,i=arguments.length;e<i;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},hi.apply(this,arguments)};Object.defineProperty(St,"__esModule",{value:!0});St.DefaultOptions=St.C=St.DeepstreamClient=void 0;var la=no();Object.defineProperty(St,"DefaultOptions",{enumerable:!0,get:function(){return la.DefaultOptions}});var hh=k();St.C=hh;var fh=No(),dh=bo(),ph=go(),Eh=Co(),yh=ms(),Rh=ws(),Sh=Ls(),_h=Fs(),Oh=oa(),Nh=sa(),Th=_t(),vh=aa(),bh=ca(),gh=ua(),Ch=function(r){lh(t,r);function t(e,i){i===void 0&&(i={});var n=r.call(this)||this;n.options=hi(hi({},la.DefaultOptions),i);var o={};return o.logger=new fh.Logger(n),i.nativeTimerRegistry?o.timerRegistry=new Eh.NativeTimerRegistry:o.timerRegistry=new ph.IntervalTimerRegistry(n.options.intervalTimerResolution),o.timeoutRegistry=new dh.TimeoutRegistry(o,n.options),o.socketFactory=n.options.socketFactory||Rh.socketFactory,o.connection=new yh.Connection(o,n.options,e,n),n.options.offlineEnabled?(n.options.storageName==="indexdb"&&(o.storage=new vh.IndexdbStorage(n.options)),n.options.storageName==="localstorage"&&(o.storage=new bh.LocalstorageStorage(n.options)),n.options.storage&&(o.storage=n.options.storage)):o.storage=new gh.NoopStorage,n.services=o,n.services.connection.onLost(o.timeoutRegistry.onConnectionLost.bind(o.timeoutRegistry)),n.event=new Sh.EventHandler(n.services,n.options),n.rpc=new _h.RPCHandler(n.services,n.options),n.record=new Oh.RecordHandler(n.services,n.options),n.presence=new Nh.PresenceHandler(n.services,n.options),n}return t.prototype.login=function(e,i){var n=this;if(e&&typeof e=="object")if(i)this.services.connection.authenticate(e,i);else return new Promise(function(o,s){n.services.connection.authenticate(e,function(a,c){a?o(c):s(c)})});else if(typeof e=="function")this.services.connection.authenticate({},e);else return new Promise(function(o,s){n.services.connection.authenticate({},function(a,c){a?o(c):s(c)})})},t.prototype.getConnectionState=function(){return this.services.connection.getConnectionState()},t.prototype.close=function(){var e=this;Object.keys(this.services).forEach(function(i){e.services[i].close&&e.services[i].close()})},t.prototype.pause=function(){this.services.connection.pause()},t.prototype.resume=function(e){var i=this;if(e){this.services.connection.resume(e);return}return new Promise(function(n,o){i.services.connection.resume(function(s){s?o(s):n()})})},t.prototype.getUid=function(){var e=new Date().getTime().toString(36),i=(Math.random()*1e16).toString(36).replace(".","");return"".concat(e,"-").concat(i)},t}(Th.Emitter);St.DeepstreamClient=Ch});var fa=R(re=>{"use strict";u();Object.defineProperty(re,"__esModule",{value:!0});re.Options=re.C=re.DeepstreamClient=void 0;var nn=ha();Object.defineProperty(re,"DeepstreamClient",{enumerable:!0,get:function(){return nn.DeepstreamClient}});Object.defineProperty(re,"C",{enumerable:!0,get:function(){return nn.C}});Object.defineProperty(re,"Options",{enumerable:!0,get:function(){return nn.DefaultOptions}})});u();u();u();var eo="0.6.2";u();var Yh=tr("log","party-debug","background-color: #888; color: #fff; padding: 2px 5px; border-radius: 2px"),gr=tr("log","party-log","background-color: #88F; color: #00ffff; padding: 2px 5px; border-radius: 2px"),$h=tr("log","party-alert","background-color: #FF0; color: #000; padding: 2px 5px; border-radius: 2px"),at=tr("warn","party-warn","background-color: #FF0; color: #000; padding: 2px 5px; border-radius: 2px"),w=tr("error","party-error","background-color: #ff0000; color: #ffffff; padding: 2px 5px; border-radius: 2px");function tr(r,t,e){return typeof window!="undefined"?console[r].bind(window.console,`%c${t}`,e):console.log}var ro=typeof window!="undefined"?console.log.bind(window.console,"%cparty-log%c %c%s","background-color: #88F; color: #00ffff; padding: 2px 5px; border-radius: 2px","background: none;"):console.log;u();var Ta=Nr(fa(),1),va=Nr(k(),1);u();var sn=Nr(k(),1);function ur(r,t="unknown"){let e=on(r,"");if(!e){let i="";Se&&(i=`
"${t}${Se.path}" ${Se.message}`),at(`User provided data is not JSON serializable.${i}`)}return e}function fi(r,t){return typeof r!="object"?(at("User provided data is not an object."),!1):ur(r,t)}function di(r){return typeof r!="object"?!1:Object.keys(r).length===0}var Se;function on(r,t=""){if(Se=null,["string","number","boolean"].includes(typeof r)||r===null)return!0;if(Array.isArray(r)){for(let[e,i]of Object.entries(r))if(!on(i,`${t}[${e}]`))return!1;return!0}if(typeof r=="object"&&r.constructor===Object){for(let[e,i]of Object.entries(r))if(!on(i,`${t}.${e}`))return!1;return!0}return typeof r=="function"?(Se={path:t,message:"is a function. Functions are not allowed."},!1):typeof r=="symbol"?(Se={path:t,message:"is a symbol. Symbols are not allowed."},!1):typeof r=="object"||typeof r=="undefined"?!0:(Se={path:t,message:"is an unknown type. vanilla-party doesn't know what to do with it."},!1)}u();u();u();var Mt=".",lr=Symbol("target"),an=Symbol("unsubscribe");u();function hr(r){return r instanceof Date||r instanceof Set||r instanceof Map||r instanceof WeakSet||r instanceof WeakMap||ArrayBuffer.isView(r)}function da(r){return(typeof r=="object"?r===null:typeof r!="function")||r instanceof RegExp}u();u();var W=Array.isArray;u();function ie(r){return typeof r=="symbol"}var Ih={after(r,t){return W(r)?r.slice(t.length):t===""?r:r.slice(t.length+1)},concat(r,t){return W(r)?(r=[...r],t&&r.push(t),r):t&&t.toString!==void 0?(r!==""&&(r+=Mt),ie(t)?r+t.toString():r+t):r},initial(r){if(W(r))return r.slice(0,-1);if(r==="")return r;let t=r.lastIndexOf(Mt);return t===-1?"":r.slice(0,t)},last(r){var e;if(W(r))return(e=r.at(-1))!=null?e:"";if(r==="")return r;let t=r.lastIndexOf(Mt);return t===-1?r:r.slice(t+1)},walk(r,t){if(W(r))for(let e of r)t(e);else if(r!==""){let e=0,i=r.indexOf(Mt);if(i===-1)t(r);else for(;e<r.length;)i===-1&&(i=r.length),t(r.slice(e,i)),e=i+1,i=r.indexOf(Mt,e)}},get(r,t){return this.walk(t,e=>{r&&(r=r[e])}),r},isSubPath(r,t){if(W(r)){if(r.length<t.length)return!1;for(let e=0;e<t.length;e++)if(r[e]!==t[e])return!1;return!0}return r.length<t.length?!1:r===t?!0:r.startsWith(t)?r[t.length]===Mt:!1},isRootPath(r){return W(r)?r.length===0:r===""}},Z=Ih;u();function cn(r){return typeof r=="object"&&typeof r.next=="function"}u();function un(r,t,e,i,n){let o=r.next;if(t.name==="entries")r.next=function(){let s=o.call(this);return s.done===!1&&(s.value[0]=n(s.value[0],t,s.value[0],i),s.value[1]=n(s.value[1],t,s.value[0],i)),s};else if(t.name==="values"){let s=e[lr].keys();r.next=function(){let a=o.call(this);return a.done===!1&&(a.value=n(a.value,t,s.next().value,i)),a}}else r.next=function(){let s=o.call(this);return s.done===!1&&(s.value=n(s.value,t,s.value,i)),s};return r}u();function pi(r,t,e){return r.isUnsubscribed||t.ignoreSymbols&&ie(e)||t.ignoreUnderscores&&e.charAt(0)==="_"||"ignoreKeys"in t&&t.ignoreKeys.includes(e)}u();var fr=class{constructor(t){this._equals=t,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(t){let e=this._getDescriptorCache(),i=e.get(t);return i===void 0&&(i={},e.set(t,i)),i}_getOwnPropertyDescriptor(t,e){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(t,e);let i=this._getProperties(t),n=i[e];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(t,e),i[e]=n),n}getProxy(t,e,i,n){if(this.isUnsubscribed)return t;let o=t[n],s=o!=null?o:t;this._pathCache.set(s,e);let a=this._proxyCache.get(s);return a===void 0&&(a=o===void 0?new Proxy(t,i):t,this._proxyCache.set(s,a)),a}getPath(t){return this.isUnsubscribed?void 0:this._pathCache.get(t)}isDetached(t,e){return!Object.is(t,Z.get(e,this.getPath(t)))}defineProperty(t,e,i){return Reflect.defineProperty(t,e,i)?(this.isUnsubscribed||(this._getProperties(t)[e]=i),!0):!1}setProperty(t,e,i,n,o){if(!this._equals(o,i)||!(e in t)){let s=this._getOwnPropertyDescriptor(t,e);return s!==void 0&&"set"in s?Reflect.set(t,e,i,n):Reflect.set(t,e,i)}return!0}deleteProperty(t,e,i){if(Reflect.deleteProperty(t,e)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(t);n&&(delete n[e],this._pathCache.delete(i))}return!0}return!1}isSameDescriptor(t,e,i){let n=this._getOwnPropertyDescriptor(e,i);return t!==void 0&&n!==void 0&&Object.is(t.value,n.value)&&(t.writable||!1)===(n.writable||!1)&&(t.enumerable||!1)===(n.enumerable||!1)&&(t.configurable||!1)===(n.configurable||!1)&&t.get===n.get&&t.set===n.set}isGetInvariant(t,e){let i=this._getOwnPropertyDescriptor(t,e);return i!==void 0&&i.configurable!==!0&&i.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};u();u();function He(r){return toString.call(r)==="[object Object]"}u();u();u();function Ge(){return!0}u();function ne(r,t){return r.length!==t.length||r.some((e,i)=>t[i]!==e)}u();var Ei=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var mh=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),ln={push:Ge,pop:Ge,shift:Ge,unshift:Ge,copyWithin:ne,reverse:ne,sort:ne,splice:ne,flat:ne,fill:ne},pa=new Set([...Ei,...mh,...Object.keys(ln)]);u();u();function qe(r,t){if(r.size!==t.size)return!0;for(let e of r)if(!t.has(e))return!0;return!1}var hn=["keys","values","entries"],fn=new Set(["has","toString"]),dn={add:qe,clear:qe,delete:qe,forEach:qe},Ea=new Set([...fn,...Object.keys(dn),...hn]);u();u();function We(r,t){if(r.size!==t.size)return!0;let e;for(let[i,n]of r)if(e=t.get(i),e!==n||e===void 0&&!t.has(i))return!0;return!1}var Ah=new Set([...fn,"get"]),pn={set:We,clear:We,delete:We,forEach:We},ya=new Set([...Ah,...Object.keys(pn),...hn]);var Q=class{constructor(t,e,i,n){this._path=e,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=e===void 0?t:this._shallowClone(t)}static isHandledMethod(t){return Ei.has(t)}_shallowClone(t){let e=t;if(He(t))e=ue({},t);else if(W(t)||ArrayBuffer.isView(t))e=[...t];else if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set([...t].map(i=>this._shallowClone(i)));else if(t instanceof Map){e=new Map;for(let[i,n]of t.entries())e.set(i,this._shallowClone(n))}return this._clonedCache.add(e),e}preferredThisArg(t,e,i,n){return t?(W(n)?this._onIsChanged=ln[e]:n instanceof Set?this._onIsChanged=dn[e]:n instanceof Map&&(this._onIsChanged=pn[e]),n):i}update(t,e,i){let n=Z.after(t,this._path);if(e!=="length"){let o=this.clone;Z.walk(n,s=>{o!=null&&o[s]&&(this._clonedCache.has(o[s])||(o[s]=this._shallowClone(o[s])),o=o[s])}),this._hasOnValidate&&this._changes.push({path:n,property:e,previous:i}),o!=null&&o[e]&&(o[e]=i)}this._isChanged=!0}undo(t){let e;for(let i=this._changes.length-1;i!==-1;i--)e=this._changes[i],Z.get(t,e.path)[e.property]=e.previous}isChanged(t){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,t)}isPathApplicable(t){return Z.isRootPath(this._path)||Z.isSubPath(t,this._path)}};u();var Ye=class extends Q{static isHandledMethod(t){return pa.has(t)}};u();var dr=class extends Q{undo(t){t.setTime(this.clone.getTime())}isChanged(t,e){return!e(this.clone.valueOf(),t.valueOf())}};u();var $e=class extends Q{static isHandledMethod(t){return Ea.has(t)}undo(t){for(let e of this.clone)t.add(e);for(let e of t)this.clone.has(e)||t.delete(e)}};u();var Ke=class extends Q{static isHandledMethod(t){return ya.has(t)}undo(t){for(let[e,i]of this.clone.entries())t.set(e,i);for(let e of t.keys())this.clone.has(e)||t.delete(e)}};u();var pr=class extends Q{constructor(t,e,i,n){super(void 0,e,i,n),this._argument1=i[0],this._weakValue=t.has(this._argument1)}isChanged(t){return this._weakValue!==t.has(this._argument1)}undo(t){this._weakValue&&!t.has(this._argument1)?t.add(this._argument1):t.delete(this._argument1)}};u();var Er=class extends Q{constructor(t,e,i,n){super(void 0,e,i,n),this._weakKey=i[0],this._weakHas=t.has(this._weakKey),this._weakValue=t.get(this._weakKey)}isChanged(t){return this._weakValue!==t.get(this._weakKey)}undo(t){let e=t.has(this._weakKey);this._weakHas&&!e?t.set(this._weakKey,this._weakValue):!this._weakHas&&e?t.delete(this._weakKey):this._weakValue!==t.get(this._weakKey)&&t.set(this._weakKey,this._weakValue)}};var jt=class r{constructor(t){this._stack=[],this._hasOnValidate=t}static isHandledType(t){return He(t)||W(t)||hr(t)}static isHandledMethod(t,e){return He(t)?Q.isHandledMethod(e):W(t)?Ye.isHandledMethod(e):t instanceof Set?$e.isHandledMethod(e):t instanceof Map?Ke.isHandledMethod(e):hr(t)}get isCloning(){return this._stack.length>0}start(t,e,i){let n=Q;W(t)?n=Ye:t instanceof Date?n=dr:t instanceof Set?n=$e:t instanceof Map?n=Ke:t instanceof WeakSet?n=pr:t instanceof WeakMap&&(n=Er),this._stack.push(new n(t,e,i,this._hasOnValidate))}update(t,e,i){this._stack.at(-1).update(t,e,i)}preferredThisArg(t,e,i){let{name:n}=t,o=r.isHandledMethod(i,n);return this._stack.at(-1).preferredThisArg(o,n,e,i)}isChanged(t,e,i){return this._stack.at(-1).isChanged(t,e,i)}isPartOfClone(t){return this._stack.at(-1).isPathApplicable(t)}undo(t){this._previousClone!==void 0&&this._previousClone.undo(t)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var Dh={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},En=(r,t,e={})=>{e=ue(ue({},Dh),e);let i=Symbol("ProxyTarget"),{equals:n,isShallow:o,ignoreDetached:s,details:a}=e,c=new fr(n),l=typeof e.onValidate=="function",h=new jt(l),p=(S,_,v,C,z)=>!l||h.isCloning||e.onValidate(Z.concat(c.getPath(S),_),v,C,z)===!0,g=(S,_,v,C)=>{!pi(c,e,_)&&!(s&&c.isDetached(S,r))&&N(c.getPath(S),_,v,C)},N=(S,_,v,C,z)=>{h.isCloning&&h.isPartOfClone(S)?h.update(S,_,C):t(Z.concat(S,_),v,C,z)},B=S=>{var _;return S&&((_=S[i])!=null?_:S)},A=(S,_,v,C)=>{if(da(S)||v==="constructor"||o&&!jt.isHandledMethod(_,v)||pi(c,e,v)||c.isGetInvariant(_,v)||s&&c.isDetached(_,r))return S;C===void 0&&(C=c.getPath(_));let z=Z.concat(C,v),V=c.getPath(S);return V&&ht(z,V)?c.getProxy(S,V,rt,i):c.getProxy(S,z,rt,i)},ht=(S,_)=>{if(ie(S)||S.length<=_.length||W(_)&&_.length===0)return!1;let v=W(S)?S:S.split(Mt),C=W(_)?_:_.split(Mt);return v.length<=C.length?!1:!C.some((z,V)=>z!==v[V])},rt={get(S,_,v){if(ie(_)){if(_===i||_===lr)return S;if(_===an&&!c.isUnsubscribed&&c.getPath(S).length===0)return c.unsubscribe(),S}let C=hr(S)?Reflect.get(S,_):Reflect.get(S,_,v);return A(C,S,_)},set(S,_,v,C){var Ct;v=B(v);let z=(Ct=S[i])!=null?Ct:S,V=z[_];if(n(V,v)&&_ in S)return!0;let Xe=p(S,_,v,V);return Xe&&c.setProperty(z,_,v,C,V)?(g(S,_,S[_],V),!0):!Xe},defineProperty(S,_,v){if(!c.isSameDescriptor(v,S,_)){let C=S[_];p(S,_,v.value,C)&&c.defineProperty(S,_,v,C)&&g(S,_,v.value,C)}return!0},deleteProperty(S,_){if(!Reflect.has(S,_))return!0;let v=Reflect.get(S,_),C=p(S,_,void 0,v);return C&&c.deleteProperty(S,_,v)?(g(S,_,void 0,v),!0):!C},apply(S,_,v){var z;let C=(z=_[i])!=null?z:_;if(c.isUnsubscribed)return Reflect.apply(S,C,v);if((a===!1||a!==!0&&!a.includes(S.name))&&jt.isHandledType(C)){let V=Z.initial(c.getPath(S)),Xe=jt.isHandledMethod(C,S.name);h.start(C,V,v);let Ct=Reflect.apply(S,h.preferredThisArg(S,_,C),Xe?v.map(Or=>B(Or)):v),Ga=h.isChanged(C,n),In=h.stop();if(jt.isHandledType(Ct)&&Xe&&(_ instanceof Map&&S.name==="get"&&(V=Z.concat(V,v[0])),Ct=c.getProxy(Ct,V,rt)),Ga){let Or={name:S.name,args:v,result:Ct},mn=h.isCloning?Z.initial(V):V,An=h.isCloning?Z.last(V):"";p(Z.get(r,mn),An,C,In,Or)?N(mn,An,C,In,Or):h.undo(C)}return(_ instanceof Map||_ instanceof Set)&&cn(Ct)?un(Ct,S,_,V,A):Ct}return Reflect.apply(S,_,v)}},ze=c.getProxy(r,e.pathAsArray?[]:"",rt);return t=t.bind(ze),l&&(e.onValidate=e.onValidate.bind(ze)),ze};En.target=r=>{var t;return(t=r==null?void 0:r[lr])!=null?t:r};En.unsubscribe=r=>{var t;return(t=r==null?void 0:r[an])!=null?t:r};var yn=En;var Sa=Nr(k(),1);u();function yi(r,t,e=""){if(typeof r!="object"){w("_old is not an object");return}if(typeof t!="object"){w("_new is not an object");return}let i=Object.keys(r).reverse(),n=Object.keys(t);for(let o of i)Object.prototype.hasOwnProperty.call(t,o)||(Array.isArray(r)?r.splice(parseInt(o),1):delete r[o]);for(let o of n)Object.prototype.hasOwnProperty.call(r,o)||(r[o]=t[o]);for(let o of n)if(Object.prototype.hasOwnProperty.call(r,o)){let s=Ra(r[o]),a=Ra(t[o]);if(a==="unsupported"){w(`${e}.${o} is unsupported type: ${typeof t[o]}`);continue}if(s==="object"&&a==="object"){yi(r[o],t[o],`${e}.${o}`);continue}if(s==="array"&&a==="array"){yi(r[o],t[o],`${e}.${o}`);continue}r[o]!==t[o]&&(r[o]=t[o])}}function Ra(r){return r===null?"null":Array.isArray(r)?"array":typeof r=="object"?"object":typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r)||typeof r=="string"?"primitive":"unsupported"}var Rn=new WeakMap,Je,ot,q,_e,yr,Bt,oe,_a,Oa,Na,vt=class{constructor(t,e){x(this,oe);x(this,Je);x(this,ot);x(this,q);x(this,_e);x(this,yr);x(this,Bt);M(this,Je,t),M(this,ot,e),M(this,q,null),M(this,_e,{}),M(this,yr,yn(E(this,_e),ft(this,oe,Oa).bind(this),{onValidate:ft(this,oe,_a).bind(this)})),M(this,Bt,null),Rn.set(E(this,_e),this)}load(t,e=!1){return it(this,null,function*(){if(E(this,Bt))return at("Record.load() called twice!",E(this,ot)),E(this,Bt);if(E(this,Je).getConnectionState()!==Sa.CONNECTION_STATE.OPEN){w("Record.load() called before room is connected.",E(this,ot));return}return M(this,Bt,it(this,null,function*(){M(this,q,E(this,Je).record.getRecord(E(this,ot))),E(this,q).subscribe(ft(this,oe,Na).bind(this),!0),yield E(this,q).whenReady(),t&&(yield this.initData(t,e))})),E(this,Bt)})}get whenLoaded(){return E(this,Bt)===null?(w("Record.whenLoaded called before load().",E(this,ot)),Promise.reject(new Error("Record.whenLoaded called before load()."))):E(this,Bt)}initData(t,e=!1){return it(this,null,function*(){var i;if(!((i=E(this,q))!=null&&i.isReady)){w("Record.initData() called before record ready.",E(this,ot));return}!e&&!di(E(this,q).get())||fi(t,"init-data")&&(yield E(this,q).setWithAck(t))})}setData(t){var e;if(!((e=E(this,q))!=null&&e.isReady)){w(`Record.setData() called before record ready. ${E(this,ot)}
 Ignored: ${JSON.stringify(t)}`);return}fi(t,"set-data")&&E(this,q).set(t)}watchShared(t,e,i){var n;if(!((n=E(this,q))!=null&&n.isReady)){at(`watchShared() called on '${E(this,ot)}' before ready.`);return}E(this,q).subscribe(t,e,i)}get shared(){return E(this,yr)}get name(){return E(this,ot)}delete(){return it(this,null,function*(){var t;if(!((t=E(this,q))!=null&&t.isReady)){w(`delete() called on ${E(this,ot)} before ready.`);return}return new Promise(e=>{var i,n;(i=E(this,q))==null||i.once("delete",e),(n=E(this,q))==null||n.delete()})})}_set(t,e){return it(this,null,function*(){var i;yield(i=E(this,q))==null?void 0:i.setWithAck(t,e)})}_get(t){var e;return(e=E(this,q))==null?void 0:e.get(t)}static recordForShared(t){let e=yn.target(t);if(!Rn.has(e)){w("No record found for shared object.");return}return Rn.get(e)}};Je=new WeakMap,ot=new WeakMap,q=new WeakMap,_e=new WeakMap,yr=new WeakMap,Bt=new WeakMap,oe=new WeakSet,_a=function(t,e,i){return ur(e,`${E(this,ot)}/${t}`)},Oa=function(t,e,i){var n;if(!((n=E(this,q))!=null&&n.isReady)){at(`Shared object written to before ready. ${E(this,ot)}
 Ignored: ${t} = ${JSON.stringify(e)}`);return}this._set(t,e)},Na=function(t){fi(t,"server-data")||w("Incoming server data not valid."),yi(E(this,_e),t,"shared")};var tt,Rr,Sr,bt,gt,se,ae,Oe,kt,_r,ut,Ne,lt,ba,Sn,ga,Ca,_n,Ri=class{constructor(t,e,i){x(this,lt);x(this,tt);x(this,Rr);x(this,Sr);x(this,bt);x(this,gt);x(this,se);x(this,ae);x(this,Oe);x(this,kt);x(this,_r);x(this,ut);x(this,Ne);M(this,tt,new Ta.DeepstreamClient(t)),M(this,Rr,e),M(this,Sr,i),M(this,bt,`${e}-${i}`),M(this,gt,`${E(this,bt)}/${E(this,tt).getUid()}`),M(this,se,new Map),M(this,ae,[]),M(this,Oe,[]),M(this,kt,new vt(E(this,tt),E(this,gt))),M(this,ut,[]),M(this,Ne,void 0),M(this,_r,ft(this,lt,ba).call(this))}isConnected(){return E(this,tt).getConnectionState()===va.CONNECTION_STATE.OPEN}get whenConnected(){return E(this,_r)}disconnect(){this.isConnected()&&E(this,tt).close()}info(){return{appName:E(this,Rr),roomName:E(this,Sr),guestNames:E(this,ut),guestName:E(this,gt),isConnected:this.isConnected(),isHost:this.isHost()}}getRecord(t){return new vt(E(this,tt),`${E(this,bt)}/${t}`)}subscribe(t,e){E(this,tt).event.subscribe(`${E(this,bt)}/${t}`,e)}unsubscribe(t,e){E(this,tt).event.unsubscribe(`${E(this,bt)}/${t}`,e)}emit(t,e){(e===void 0||ur(e,"emit-data"))&&E(this,tt).event.emit(`${E(this,bt)}/${t}`,e)}get hostName(){return E(this,Ne)}get _guestNames(){return[...E(this,ut)]}get myGuestRecord(){return E(this,kt)}get guestShareds(){return new Proxy(E(this,Oe),{set(){return w("The guestShared array is read-only."),!0}})}isHost(){return E(this,Ne)===E(this,gt)}};tt=new WeakMap,Rr=new WeakMap,Sr=new WeakMap,bt=new WeakMap,gt=new WeakMap,se=new WeakMap,ae=new WeakMap,Oe=new WeakMap,kt=new WeakMap,_r=new WeakMap,ut=new WeakMap,Ne=new WeakMap,lt=new WeakSet,ba=function(){return it(this,null,function*(){E(this,tt).on("error",(e,i,n)=>{w("ds error",e,i,n),this.emit("party:ds-error",{error:e,event:i,topic:n})}),E(this,tt).presence.subscribe(ft(this,lt,Ca).bind(this)),yield E(this,tt).login({username:E(this,gt)}),E(this,kt).load(),yield ft(this,lt,ga).call(this),ft(this,lt,_n).call(this)})},Sn=function(){M(this,Ne,E(this,ut)[0])},ga=function(){return it(this,null,function*(){let t=yield E(this,tt).presence.getAll();M(this,ut,t.filter(e=>e.startsWith(`${E(this,bt)}/`)).concat(E(this,gt)).sort()),ft(this,lt,Sn).call(this)})},Ca=function(t,e){t.startsWith(`${E(this,bt)}/`)&&(e?(E(this,ut).push(t),E(this,ut).sort()):M(this,ut,E(this,ut).filter(i=>i!==t)),ft(this,lt,Sn).call(this),ft(this,lt,_n).call(this))},_n=function(){let t=()=>{E(this,Oe).length=0;let e=E(this,ae).filter(i=>!di(i));E(this,Oe).push(...e)};for(let e of E(this,ut))if(!E(this,se).has(e))if(e===E(this,gt))E(this,se).set(e,E(this,kt)),E(this,kt).whenLoaded.then(()=>{E(this,kt).watchShared(t.bind(this),!0)});else{let i=new vt(E(this,tt),e);E(this,se).set(e,i),i.load().then(()=>{i.watchShared(t.bind(this),!0)})}E(this,ae).length=0;for(let e of E(this,ut))if(e===E(this,gt))E(this,ae).push(E(this,kt).shared);else{let i=E(this,se).get(e);i&&E(this,ae).push(i.shared)}t()};ro("font-weight: bold",`Vanilla Party v${eo}`);var m=null,$y=(r,t,e="main",i)=>{if(m!==null){w("You are already connected. Call partyDisconnect() before calling partyConnect() again!");return}it(null,null,function*(){m=new Ri(r,t,e),yield m.whenConnected,window.addEventListener("beforeunload",()=>{m==null||m.disconnect()}),gr(`partyConnect() done! You are in the room "${m.info().roomName}"`),i==null||i()})},Ky=()=>{if(!m){w("partyDisconnect() called before partyConnect()");return}at(`You have been disconnected from room "${m.info().roomName}".`),m.disconnect(),m=null},Jy=(r,t,e)=>{if(!m){w("partyLoadShared() called before partyConnect()");return}let i=m.getRecord(r);return it(null,null,function*(){yield m==null?void 0:m.whenConnected;let o=(m==null?void 0:m.isHost())===!0;yield i.load(t,o),gr(`partyLoadShared "${r}" done!`),e==null||e(i.shared)}),i.shared},Qy=(r={},t)=>{if(!m){w("partyLoadMyShared() called before partyConnect()");return}let e=m.myGuestRecord;return it(null,null,function*(){yield m==null?void 0:m.whenConnected,yield e.whenLoaded,yield e.initData(r),gr("partyLoadMyShared done!"),t==null||t(e.shared)}),e.shared},zy=()=>{if(!m){w("partyLoadGuestShareds() called before partyConnect()");return}return m.guestShareds},Xy=()=>m?m.isHost():(w("partyIsHost() called before partyConnect()"),!1),Zy=(r,t)=>{var e;if(!vt.recordForShared(r)){at("partySetShared() doesn't recognize the provided shared object.",r);return}(e=vt.recordForShared(r))==null||e.setData(t)},tR=(r,t,e,i)=>{var n;if(!vt.recordForShared(r)){at("partyWatchShared() expected shared (argument 1) to be shared object.",r);return}(n=vt.recordForShared(r))==null||n.watchShared(t,e,i)},eR=(r,t)=>{if(!m){w("partyEmit() called before partyConnect()");return}m.emit(r,t)},rR=(r,t)=>{if(!m){w("partySubscribe() called before partyConnect()");return}m.subscribe(r,t)},iR=(r,t)=>{if(!m){w("partyUnsubscribe() called before partyConnect()");return}m.unsubscribe(r,t)},nR=()=>{if(!m){w("partyCountGuests() called before partyConnect()");return}return m.info().guestNames.length},Ia=()=>(m||w("partyGetRoom() called before partyConnect()"),m);u();u();function Qe(r,t,e=document){let i=new CustomEvent(`reef:${r}`,{bubbles:!0,cancelable:!0,detail:t});return e.dispatchEvent(i)}function On(r){return typeof r=="string"?document.querySelector(r):r}function Da(r){return Object.prototype.toString.call(r).slice(8,-1).toLowerCase()}function wa(r,t){let e="signal"+(r?`-${r}`:"");return{get:(i,n)=>n==="_isSignal"||(["object","array"].includes(Da(i[n]))&&!i[n]._isSignal&&(i[n]=new Proxy(i[n],wa(r))),i[n]),set:(i,n,o)=>(i[n]===o||(i[n]=o,Qe(e,{prop:n,value:o,action:"set"})),!0),deleteProperty:(i,n)=>(delete i[n],Qe(e,{prop:n,value:i[n],action:"delete"}),!0)}}function Pa(r={},t=""){return r=["array","object"].includes(Da(r))?r:{value:r},new Proxy(r,wa(t))}var ma=["input","option","textarea"],Si=["value","checked","selected"],Ua=["checked","selected"];function La(r){return["false","null","undefined","0","-0","NaN","0n","-0n"].includes(r)}function Ma(r,t,e,i){if(!t.startsWith("on")||!i||r[t])return;let n=i[e.split("(")[0]];n&&(r[t]=n)}function Ba(r,t){let e=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(r)||!e.includes("javascript:")&&!e.includes("data:text/html"))||!!(r.startsWith("on")||r.startsWith("@on")||r.startsWith("#on"))||void 0}function ka(r,t,e,i){Ma(r,t,e,i),Ba(t,e)||(Si.includes(t)&&(r[t]=t==="value"?e:" "),r.setAttribute(t,e))}function _i(r,t){Si.includes(t)&&(r[t]=""),r.removeAttribute(t)}function Nn(r,t){if(r.nodeType===1){for(let{name:e,value:i}of Array.from(r.attributes)){if(Ba(e,i))return _i(r,e),void Ma(r,e,i,t);if(!e.startsWith("@")&&!e.startsWith("#"))continue;let n=e.slice(1);_i(r,e),Ua.includes(n)&&La(i)||ka(r,n,i,t)}if(r.childNodes)for(let e of r.childNodes)Nn(e,t)}}function Aa(r){return r.childNodes&&r.childNodes.length?null:r.textContent}function Tn(r,t,e){let i=r.childNodes,n=t.childNodes;(function(o){let s=o.querySelectorAll("script");for(let a of s)a.remove()})(r)||(i.forEach(function(o,s){if(!n[s]){let h=o.cloneNode(!0);return Nn(h,e),void t.append(h)}if(a=o,c=n[s],typeof a.nodeType=="number"&&a.nodeType!==c.nodeType||typeof a.tagName=="string"&&a.tagName!==c.tagName||typeof a.id=="string"&&a.id&&a.id!==c.id||"getAttribute"in a&&"getAttribute"in c&&a.getAttribute("key")!==c.getAttribute("key")||typeof a.src=="string"&&a.src&&a.src!==c.src){let h=function(p,g){if(p.nodeType!==1)return;let N=p.getAttribute("id"),B=p.getAttribute("key");if(!N||!B)return;let A=N?`#${N}`:`[key="${B}"]`;return g.querySelector(`:scope > ${A}`)}(o,t);if(!h){let p=o.cloneNode(!0);return Nn(p,e),void n[s].before(p)}n[s].before(h)}var a,c;if(i[s]&&"hasAttribute"in i[s]&&i[s].hasAttribute("reef-ignore")||(function(h,p,g){if(h.nodeType!==1)return;let N=h.attributes,B=p.attributes;for(let{name:A,value:ht}of Array.from(N)){if(A.startsWith("#")||Si.includes(A)&&ma.includes(h.tagName.toLowerCase()))continue;let rt=A.startsWith("@")?A.slice(1):A;Ua.includes(rt)&&La(ht)?_i(p,rt):ka(p,rt,ht,g)}for(let{name:A,value:ht}of Array.from(B))N[A]||Si.includes(A)&&ma.includes(p.tagName.toLowerCase())||_i(p,A)}(o,n[s],e),o.nodeName.includes("-")))return;let l=Aa(o);if(l&&l!==Aa(n[s])&&(n[s].textContent=l),o.childNodes.length||!n[s].childNodes.length){if(!n[s].childNodes.length&&o.childNodes.length){let h=document.createDocumentFragment();return Tn(o,h,e),void n[s].appendChild(h)}o.childNodes.length&&Tn(o,n[s],e)}else n[s].innerHTML=""}),function(o,s){let a=o.length-s.length;if(!(a<1))for(;a>0;a--)o[o.length-1].remove()}(n,i))}function wh(r,t,e){let i=On(r),n=function(o){let s=new DOMParser().parseFromString(`<body><template>${o}</template></body>`,"text/html");return s.body?s.body.firstElementChild.content:document.createElement("body")}(t);Qe("before-render",null,i)&&(Tn(n,i,e),Qe("render",null,i))}var vn=class{constructor(t,e,i){var n;this.elem=t,this.template=e,this.signals=i.signals?i.signals.map(o=>`reef:signal-${o}`):["reef:signal"],this.events=i.events,this.handler=(n=this,function(o){n.render()}),this.debounce=null,this.start()}start(){for(let t of this.signals)document.addEventListener(t,this.handler);this.render(),Qe("start",null,On(this.elem))}stop(){for(let t of this.signals)document.removeEventListener(t,this.handler);Qe("stop",null,On(this.elem))}render(){let t=this;t.debounce&&window.cancelAnimationFrame(t.debounce),t.debounce=window.requestAnimationFrame(function(){wh(t.elem,t.template(),t.events)})}};function xa(r,t,e={}){return new vn(r,t,e)}var bn=`.vanillaparty_info {
  position: fixed;
  right: 0;
  top: 0;
  padding: 10px;

  background: rgba(255, 255, 0, 0.1);

  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
}

.vanillaparty_info .error {
  padding: 3px 6px;

  background: red;
  color: white;
}

.vanillaparty_info button {
  display: block;
  margin-top: 6px;
  padding: 3px 6px;

  background: white;
  color: black;
  border: 1px solid black;
  border-radius: 3px;

  cursor: pointer;

  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
}
.vanillaparty_info button:hover {
  background: #eee;
}
.vanillaparty_info button:active {
  background: #ddd;
}

.vanillaparty_info .checkbox {
  appearance: none;
  margin: 0;

  width: 1em;
  height: 1em;

  border: 1px solid black;
  border-radius: 3px;
  background: white;

  display: inline-grid;
  place-content: center;
}
.vanillaparty_info .checkbox::before {
  content: "";
  width: 0.65em;
  height: 0.65em;

  background: black;
  border-radius: 2px;

  transform: scale(0);
  transition: 120ms transform ease-in-out;
}
.vanillaparty_info .checkbox:checked::before {
  transform: scale(1);
}

.vanillaparty_info label {
  margin: 0;
  font-size: 14px;
}
`;var ce,Va,Cn,ja=!1,gn=!1;document.addEventListener("keyup",r=>{r.key==="F1"&&Fa()},!1);function Fa(r){let t=Ia();if(!t){w("partyToggleInfo() called before partyConnect()");return}gn=r!=null?r:!gn,gn?Ha(t):Uh()}function Ha(r){return it(this,null,function*(){if(yield r.whenConnected,ce)return;ce=document.createElement("div"),ce.className="vanillaparty_info",document.body.append(ce);let t=Pa(ue({},r.info()));function e(){let{appName:i,roomName:n,guestNames:o,isHost:s,isConnected:a}=t;return a?`
        <style>${bn}</style>
        <div>${i}</div>
        <div>${n}</div>
        <div>guests: ${o.length}</div>
        <div>${s?"hosting":""}</div>
        <button data-party="reload-others">reload others</button>
        <button data-party="disconnect-others">disconnect others</button>
        <a href="https://www.notion.so/justinbakse/The-Info-Panel-193b1bb21cec80aaafd8f341f044b3fc">?</a>`:`
        <style>${bn}</style>
        <div class="error">disconnected</div>`}Cn=xa(ce,e),ja||(ja=!0,document.addEventListener("click",i=>{let n=i.target.getAttribute("data-party");if(!n)return;let o=r.info().guestName;n==="reload-others"&&r.emit("party:reload-others",{sender:o}),n==="disconnect-others"&&r.emit("party:disconnect-others",{sender:o})}),r.subscribe("party:reload-others",i=>{r&&i.sender!==r.info().guestName&&(at('Received "reload-others" event. Reloading...'),window.location.reload())}),r.subscribe("party:disconnect-others",i=>{r&&i.sender!=r.info().guestName&&(at('Received "disconnect-others" event. Disconnecting...'),r.disconnect(),Ha(r))})),Va=window.setInterval(()=>{Object.assign(t,r.info())},100)})}function Uh(){ce&&(ce.remove(),ce=null),Cn&&Cn.stop(),clearInterval(Va)}export{vt as PartyRecord,Ri as PartyRoom,$y as partyConnect,nR as partyCountGuests,Ky as partyDisconnect,eR as partyEmit,Ia as partyGetRoom,Xy as partyIsHost,zy as partyLoadGuestShareds,Qy as partyLoadMyShared,Jy as partyLoadShared,Zy as partySetShared,rR as partySubscribe,Fa as partyToggleInfo,iR as partyUnsubscribe,tR as partyWatchShared};
//! experimental
//! /experimental
/*! Bundled license information:

ieee754/index.js:
  (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)

buffer/index.js:
  (*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <https://feross.org>
   * @license  MIT
   *)

reefjs/dist/reef.es.min.js:
  (*! reef v13.0.6 | (c) 2024 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/reef *)
*/
//# sourceMappingURL=vanilla-party.mjs.map