@simplito/privmx-webendpoint
Version:
PrivMX Web Endpoint library
2 lines • 106 kB
JavaScript
/*! For license information please see privmx-endpoint-web.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["privmx-webendpoint"]=t():e.PrivmxWebEndpoint=t()}(this,(()=>(()=>{var e={526(e,t){"use strict";t.byteLength=function(e){var t=o(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,s=o(e),a=s[0],c=s[1],u=new n(function(e,t,r){return 3*(t+r)/4-r}(0,a,c)),h=0,l=c>0?a-4:a;for(r=0;r<l;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=255&t;return 2===c&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[h++]=255&t),1===c&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t),u},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s=[],a=16383,o=0,u=i-n;o<u;o+=a)s.push(c(e,o,o+a>u?u:o+a));return 1===n?(t=e[i-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[i-2]<<8)+e[i-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function o(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,i){for(var n,s,a=[],o=t;o<i;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),a.push(r[(s=n)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},287(e,t,r){"use strict";const i=r(526),n=r(632),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const a=2147483647;function o(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|f(e,t);let i=o(r);const n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return c.from(i,t,r);const n=function(e){if(c.isBuffer(e)){const t=0|y(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?o(0):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return h(e),o(e<0?0:0|y(e))}function p(e){const t=e.length<0?0:0|y(e.length),r=o(t);for(let i=0;i<t;i+=1)r[i]=255&e[i];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(i,c.prototype),i}function y(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(e).length;default:if(n)return i?-1:G(e).length;t=(""+t).toLowerCase(),n=!0}}function b(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return I(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function v(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function g(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Y(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:m(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,i,n){let s,a=1,o=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;a=2,o/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(n){let i=-1;for(s=r;s<o;s++)if(u(e,s)===u(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===c)return i*a}else-1!==i&&(s-=s-i),i=-1}else for(r+c>o&&(r=o-c),s=r;s>=0;s--){let r=!0;for(let i=0;i<c;i++)if(u(e,s+i)!==u(t,i)){r=!1;break}if(r)return s}return-1}function A(e,t,r,i){r=Number(r)||0;const n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;const s=t.length;let a;for(i>s/2&&(i=s/2),a=0;a<i;++a){const i=parseInt(t.substr(2*a,2),16);if(Y(i))return a;e[r+a]=i}return a}function E(e,t,r,i){return $(G(t,e.length-r),e,r,i)}function w(e,t,r,i){return $(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function S(e,t,r,i){return $(z(t),e,r,i)}function _(e,t,r,i){return $(function(e,t){let r,i,n;const s=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),i=r>>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function I(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);const i=[];let n=t;for(;n<r;){const t=e[n];let s=null,a=t>239?4:t>223?3:t>191?2:1;if(n+a<=r){let r,i,o,c;switch(a){case 1:t<128&&(s=t);break;case 2:r=e[n+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(s=c));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(c=(15&t)<<12|(63&r)<<6|63&i,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:r=e[n+1],i=e[n+2],o=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&o)&&(c=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&o,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=a}return function(e){const t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=C));return r}(i)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return h(e),e<=0?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)}(e,t,r)},c.allocUnsafe=function(e){return l(e)},c.allocUnsafeSlow=function(e){return l(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(q(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),q(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},c.isEncoding=function(e){switch(String(e).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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const i=c.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(q(t,Uint8Array))n+t.length>i.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,n)}n+=t.length}return i},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)v(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):b.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.IS;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,r,i,n){if(q(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(n>>>=0)-(i>>>=0),a=(r>>>=0)-(t>>>=0);const o=Math.min(s,a),u=this.slice(i,n),h=e.slice(t,r);for(let e=0;e<o;++e)if(u[e]!==h[e]){s=u[e],a=h[e];break}return s<a?-1:a<s?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},c.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return A(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function R(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function P(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function D(e,t,r){const i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=t;i<r;++i)n+=X[e[i]];return n}function M(e,t,r){const i=e.slice(t,r);let n="";for(let e=0;e<i.length-1;e+=2)n+=String.fromCharCode(i[e]+256*i[e+1]);return n}function F(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function B(e,t,r,i,n,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function O(e,t,r,i,n){j(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function k(e,t,r,i,n){j(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function L(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,i,s){return t=+t,r>>>=0,s||L(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function K(e,t,r,i,s){return t=+t,r>>>=0,s||L(e,0,r,8),n.write(e,t,r,i,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,c.prototype),i},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||F(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return i},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||F(e,t,this.length);let i=this[e+--t],n=1;for(;t>0&&(n*=256);)i+=this[e+--t]*n;return i},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||F(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||F(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||F(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=J((function(e){Q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(i)+(BigInt(n)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(e){Q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||F(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||F(e,t,this.length);let i=t,n=1,s=this[e+--i];for(;i>0&&(n*=256);)s+=this[e+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||F(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||F(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=J((function(e){Q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=J((function(e){Q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||F(e,4,this.length),n.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||F(e,4,this.length),n.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||F(e,8,this.length),n.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||F(e,8,this.length),n.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||B(this,e,t,r,Math.pow(2,8*r)-1,0);let n=1,s=0;for(this[t]=255&e;++s<r&&(n*=256);)this[t+s]=e/n&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||B(this,e,t,r,Math.pow(2,8*r)-1,0);let n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=J((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);B(this,e,t,r,i-1,-i)}let n=0,s=1,a=0;for(this[t]=255&e;++n<r&&(s*=256);)e<0&&0===a&&0!==this[t+n-1]&&(a=1),this[t+n]=(e/s|0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);B(this,e,t,r,i-1,-i)}let n=r-1,s=1,a=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/s|0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||B(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=J((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,i){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);const n=i-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),n},c.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const s=c.isBuffer(e)?e:c.from(e,i),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=s[n%a]}return this};const x={};function U(e,t,r){x[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",r=e.length;const i="-"===e[0]?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function j(e,t,r,i,n,s){if(e>r||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new x.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){Q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||V(t,e.length-(r+1))}(i,n,s)}function Q(e,t){if("number"!=typeof e)throw new x.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,r){if(Math.floor(e)!==e)throw Q(e,r),new x.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new x.ERR_BUFFER_OUT_OF_BOUNDS;throw new x.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=W(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=W(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(e,t){let r;t=t||1/0;const i=e.length;let n=null;const s=[];for(let a=0;a<i;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function z(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function $(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const X=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t}();function J(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},632(e,t){t.read=function(e,t,r,i,n){var s,a,o=8*n-i-1,c=(1<<o)-1,u=c>>1,h=-7,l=r?n-1:0,p=r?-1:1,d=e[t+l];for(l+=p,s=d&(1<<-h)-1,d>>=-h,h+=o;h>0;s=256*s+e[t+l],l+=p,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=i;h>0;a=256*a+e[t+l],l+=p,h-=8);if(0===s)s=1-u;else{if(s===c)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,i),s-=u}return(d?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var a,o,c,u=8*s-n-1,h=(1<<u)-1,l=h>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,y=i?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=h):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+l>=1?p/c:p*Math.pow(2,1-l))*c>=2&&(a++,c/=2),a+l>=h?(o=0,a=h):a+l>=1?(o=(t*c-1)*Math.pow(2,n),a+=l):(o=t*Math.pow(2,l-1)*Math.pow(2,n),a=0));n>=8;e[r+d]=255&o,d+=y,o/=256,n-=8);for(a=a<<n|o,u+=n;u>0;e[r+d]=255&a,d+=y,a/=256,u-=8);e[r+d-y]|=128*f}},54(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FinalizationHelper=void 0;const i=r(457);class n{wasmLib;static instance;static wasmLib;static init(e){n.wasmLib=e}static getInstance(){if(!n.wasmLib)throw new Error("Initialize first with the WASM Library object");return this.instance||(this.instance=new n(n.wasmLib)),this.instance}finalizationRegistry;finalizationQueue=[];scheduler=null;constructor(e){this.wasmLib=e,this.finalizationRegistry=new FinalizationRegistry((e=>{i.ApiStatic.getInstance(),this.finalizationQueue.push(e.onFree),this.scheduleCleanup()}))}scheduleCleanup(){this.scheduler||(this.scheduler=setTimeout((async()=>{for(const e of this.finalizationQueue)await e();this.finalizationQueue=[],clearTimeout(this.scheduler),this.scheduler=null}),1e3))}register(e,t){this.finalizationRegistry.register(e,t,e)}}t.FinalizationHelper=n},853(e,t){"use strict";var r,i,n,s,a,o,c,u,h,l,p,d,y,f;Object.defineProperty(t,"__esModule",{value:!0}),t.DataChannelCryptorDecryptStatus=t.StreamEventSelectorType=t.StreamEventType=t.EventsEventSelectorType=t.KvdbEventSelectorType=t.KvdbEventType=t.InboxEventSelectorType=t.InboxEventType=t.ThreadEventSelectorType=t.ThreadEventType=t.StoreEventSelectorType=t.StoreEventType=t.ConnectionEventSelectorType=t.ConnectionEventType=void 0,function(e){e[e.USER_ADD=0]="USER_ADD",e[e.USER_REMOVE=1]="USER_REMOVE",e[e.USER_STATUS=2]="USER_STATUS"}(r||(t.ConnectionEventType=r={})),function(e){e[e.CONTEXT_ID=0]="CONTEXT_ID"}(i||(t.ConnectionEventSelectorType=i={})),function(e){e[e.STORE_CREATE=0]="STORE_CREATE",e[e.STORE_UPDATE=1]="STORE_UPDATE",e[e.STORE_DELETE=2]="STORE_DELETE",e[e.STORE_STATS=3]="STORE_STATS",e[e.FILE_CREATE=4]="FILE_CREATE",e[e.FILE_UPDATE=5]="FILE_UPDATE",e[e.FILE_DELETE=6]="FILE_DELETE",e[e.COLLECTION_CHANGE=7]="COLLECTION_CHANGE"}(n||(t.StoreEventType=n={})),function(e){e[e.CONTEXT_ID=0]="CONTEXT_ID",e[e.STORE_ID=1]="STORE_ID",e[e.FILE_ID=2]="FILE_ID"}(s||(t.StoreEventSelectorType=s={})),function(e){e[e.THREAD_CREATE=0]="THREAD_CREATE",e[e.THREAD_UPDATE=1]="THREAD_UPDATE",e[e.THREAD_DELETE=2]="THREAD_DELETE",e[e.THREAD_STATS=3]="THREAD_STATS",e[e.MESSAGE_CREATE=4]="MESSAGE_CREATE",e[e.MESSAGE_UPDATE=5]="MESSAGE_UPDATE",e[e.MESSAGE_DELETE=6]="MESSAGE_DELETE",e[e.COLLECTION_CHANGE=7]="COLLECTION_CHANGE"}(a||(t.ThreadEventType=a={})),function(e){e[e.CONTEXT_ID=0]="CONTEXT_ID",e[e.THREAD_ID=1]="THREAD_ID",e[e.MESSAGE_ID=2]="MESSAGE_ID"}(o||(t.ThreadEventSelectorType=o={})),function(e){e[e.INBOX_CREATE=0]="INBOX_CREATE",e[e.INBOX_UPDATE=1]="INBOX_UPDATE",e[e.INBOX_DELETE=2]="INBOX_DELETE",e[e.ENTRY_CREATE=3]="ENTRY_CREATE",e[e.ENTRY_DELETE=4]="ENTRY_DELETE",e[e.COLLECTION_CHANGE=5]="COLLECTION_CHANGE"}(c||(t.InboxEventType=c={})),function(e){e[e.CONTEXT_ID=0]="CONTEXT_ID",e[e.INBOX_ID=1]="INBOX_ID",e[e.ENTRY_ID=2]="ENTRY_ID"}(u||(t.InboxEventSelectorType=u={})),function(e){e[e.KVDB_CREATE=0]="KVDB_CREATE",e[e.KVDB_UPDATE=1]="KVDB_UPDATE",e[e.KVDB_DELETE=2]="KVDB_DELETE",e[e.KVDB_STATS=3]="KVDB_STATS",e[e.ENTRY_CREATE=4]="ENTRY_CREATE",e[e.ENTRY_UPDATE=5]="ENTRY_UPDATE",e[e.ENTRY_DELETE=6]="ENTRY_DELETE",e[e.COLLECTION_CHANGE=7]="COLLECTION_CHANGE"}(h||(t.KvdbEventType=h={})),function(e){e[e.CONTEXT_ID=0]="CONTEXT_ID",e[e.KVDB_ID=1]="KVDB_ID",e[e.ENTRY_ID=2]="ENTRY_ID"}(l||(t.KvdbEventSelectorType=l={})),function(e){e[e.CONTEXT_ID=0]="CONTEXT_ID"}(p||(t.EventsEventSelectorType=p={})),function(e){e[e.STREAMROOM_CREATE=0]="STREAMROOM_CREATE",e[e.STREAMROOM_UPDATE=1]="STREAMROOM_UPDATE",e[e.STREAMROOM_DELETE=2]="STREAMROOM_DELETE",e[e.STREAM_JOIN=4]="STREAM_JOIN",e[e.STREAM_LEAVE=5]="STREAM_LEAVE",e[e.STREAM_PUBLISH=6]="STREAM_PUBLISH",e[e.STREAM_UNPUBLISH=7]="STREAM_UNPUBLISH"}(d||(t.StreamEventType=d={})),function(e){e[e.CONTEXT_ID=0]="CONTEXT_ID",e[e.STREAMROOM_ID=1]="STREAMROOM_ID",e[e.STREAM_ID=2]="STREAM_ID"}(y||(t.StreamEventSelectorType=y={})),function(e){e[e.OK=0]="OK",e[e.FRAME_TOO_SHORT=4097]="FRAME_TOO_SHORT",e[e.UNSUPPORTED_VERSION=4098]="UNSUPPORTED_VERSION",e[e.INVALID_IV_LENGTH=4099]="INVALID_IV_LENGTH",e[e.FRAME_TRUNCATED=4100]="FRAME_TRUNCATED",e[e.INVALID_KEY_ID=4101]="INVALID_KEY_ID",e[e.KEY_NOT_FOUND=4102]="KEY_NOT_FOUND",e[e.INVALID_KEY_LENGTH=4103]="INVALID_KEY_LENGTH",e[e.DECRYPT_AUTH_FAILED=4104]="DECRYPT_AUTH_FAILED",e[e.INVALID_DATA_SEQUENCE=4105]="INVALID_DATA_SEQUENCE"}(f||(t.DataChannelCryptorDecryptStatus=f={}))},667(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Api=void 0;const i=r(785),n=r(708);t.Api=class{lib;promises;taskIdGenerator;constructor(e){this.lib=e,this.taskIdGenerator=new i.IdGenerator,this.promises=new Map,this.setResultsCallback()}async runAsync(e){return new Promise(((t,r)=>{const i=this.generateId();this.promises.set(i,{resolve:t,reject:r}),e(i)}))}resolveResult(e){1==e.status?this.promises.get(e.taskId).resolve(e.result):this.promises.get(e.taskId).reject(this.toNativeError(e.error)),this.promises.delete(e.taskId)}generateId(){return this.taskIdGenerator.generateId()}setResultsCallback(){this.lib.setResultsCallback((e=>this.resolveResult(e)))}toNativeError(e){return this.isRawCppError(e)?new n.NativeError(e):e instanceof Error?e:new Error("string"==typeof e?e:JSON.stringify(e))}isRawCppError(e){return"object"==typeof e&&null!==e&&"code"in e&&"name"in e&&"scope"in e}}},457(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiStatic=void 0,t.ApiStatic=class{static instance;static init(e){this.instance=e}static getInstance(){if(!this.instance)throw new Error("API Static not initialized");return this.instance}}},361(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseNative=void 0,t.BaseNative=class{_api;constructor(e){this._api=e}get api(){if(!this._api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this._api}deleteApiRef(){this._api=null}async runAsync(e){if(!this.api)throw new Error("This API instance is no longer valid because the connection associated with it has been closed.");return this.api.runAsync(e)}}},140(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionNative=void 0;const i=r(361);class n extends i.BaseNative{lastConnectionId=-1;userVerifierPtr=-1;static verifierBindingId=-1;static getVerifierBindingId(){return++this.verifierBindingId}async newApi(e){throw new Error("Use the newConnection() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async newConnection(){return this.runAsync((e=>this.api.lib.Connection_newConnection(e)))}async deleteConnection(e){await this.runAsync((t=>this.api.lib.Connection_deleteConnection(t,e))),this.deleteApiRef()}async connect(e,t){await this.runAsync((r=>this.api.lib.Connection_connect(r,e,t))),await this.getConnectionId(e,[])}async connectPublic(e,t){return this.runAsync((r=>this.api.lib.Connection_connectPublic(r,e,t)))}async getConnectionId(e,t){return this.lastConnectionId<0&&(this.lastConnectionId=await this.runAsync((r=>this.api.lib.Connection_getConnectionId(r,e,t)))),this.lastConnectionId}async listContexts(e,t){return this.runAsync((r=>this.api.lib.Connection_listContexts(r,e,t)))}async listContextUsers(e,t){return this.runAsync((r=>this.api.lib.Connection_listContextUsers(r,e,t)))}async subscribeFor(e,t){return this.runAsync((r=>this.api.lib.Connection_subscribeFor(r,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((r=>this.api.lib.Connection_unsubscribeFrom(r,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((r=>this.api.lib.Connection_buildSubscriptionQuery(r,e,t)))}async disconnect(e,t){await this.runAsync((r=>this.api.lib.Connection_disconnect(r,e,t)))}async setUserVerifier(e,t){this.userVerifierPtr>-1&&(await this.deleteUserVerifierInterface(this.userVerifierPtr),this.userVerifierPtr=-1);const[r,i]=t,s=n.getVerifierBindingId();window.userVerifierBinder||(window.userVerifierBinder={}),window.userVerifierBinder[s]={userVierifier_verify:async e=>{if(i&&"function"==typeof i.verify)return i.verify(e);throw new Error("Call on UserVerifierInterface with missing implementation")}},this.userVerifierPtr=await this.runAsync((e=>this.api.lib.Connection_newUserVerifierInterface(e,r,s)))}async newUserVerifierInterface(e){return this.runAsync((t=>this.api.lib.Connection_newUserVerifierInterface(t,e)))}async deleteUserVerifierInterface(e){await this.runAsync((t=>this.api.lib.Connection_deleteUserVerifierInterface(t,e)))}}t.ConnectionNative=n},711(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoApiNative=void 0;const i=r(504),n=r(361);class s extends n.BaseNative{async newApi(){return this.runAsync((e=>this.api.lib.CryptoApi_newCryptoApi(e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.CryptoApi_deleteCryptoApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_create(r,e,t)))}async signData(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_signData(r,e,t)))}async verifySignature(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_verifySignature(r,e,t)))}async generatePrivateKey(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_generatePrivateKey(r,e,t)))}async derivePrivateKey(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_derivePrivateKey(r,e,t)))}async derivePrivateKey2(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_derivePrivateKey2(r,e,t)))}async derivePublicKey(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_derivePublicKey(r,e,t)))}async generateKeySymmetric(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_generateKeySymmetric(r,e,t)))}async encryptDataSymmetric(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_encryptDataSymmetric(r,e,t)))}async decryptDataSymmetric(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_decryptDataSymmetric(r,e,t)))}async convertPEMKeytoWIFKey(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_convertPEMKeytoWIFKey(r,e,t)))}async generateBip39(e,t){const r=await this.runAsync((r=>this.api.lib.CryptoApi_generateBip39(r,e,t)));return this.convertBIP(r)}async fromMnemonic(e,t){const r=await this.runAsync((r=>this.api.lib.CryptoApi_fromMnemonic(r,e,t)));return this.convertBIP(r)}async fromEntropy(e,t){const r=await this.runAsync((r=>this.api.lib.CryptoApi_fromEntropy(r,e,t)));return this.convertBIP(r)}async entropyToMnemonic(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_entropyToMnemonic(r,e,t)))}async mnemonicToEntropy(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_mnemonicToEntropy(r,e,t)))}async mnemonicToSeed(e,t){return this.runAsync((r=>this.api.lib.CryptoApi_mnemonicToSeed(r,e,t)))}convertBIP(e){return{mnemonic:e.mnemonic,entropy:e.entropy,extKey:i.ExtKey.fromPtr(e.extKey)}}}t.CryptoApiNative=s},688(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventApiNative=void 0;const i=r(361);class n extends i.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.EventApi_newEventApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.EventApi_deleteEventApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((r=>this.api.lib.EventApi_create(r,e,t)))}async emitEvent(e,t){return this.runAsync((r=>this.api.lib.EventApi_emitEvent(r,e,t)))}async subscribeFor(e,t){return this.runAsync((r=>this.api.lib.EventApi_subscribeFor(r,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((r=>this.api.lib.EventApi_unsubscribeFrom(r,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((r=>this.api.lib.EventApi_buildSubscriptionQuery(r,e,t)))}}t.EventApiNative=n},467(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueueNative=void 0;const i=r(361);class n extends i.BaseNative{async newApi(e){throw new Error("Use the newEventQueue() - specialized version of method instead.")}async deleteApi(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async newEventQueue(){return this.runAsync((e=>this.api.lib.EventQueue_newEventQueue(e)))}async deleteEventQueue(e){await this.runAsync((t=>this.api.lib.EventQueue_deleteEventQueue(t,e))),this.deleteApiRef()}async waitEvent(e,t){return this.runAsync((r=>this.api.lib.EventQueue_waitEvent(r,e,t)))}async emitBreakEvent(e,t){return this.runAsync((r=>this.api.lib.EventQueue_emitBreakEvent(r,e,t)))}}t.EventQueueNative=n},614(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtKeyNative=void 0;const i=r(457),n=r(361);class s extends n.BaseNative{async newApi(){throw new Error("Use the specialized version of method instead.")}async deleteApi(e){return this.runAsync((t=>this.api.lib.ExtKey_deleteExtKey(t,e)))}async deleteExtKey(e){return this.runAsync((t=>this.api.lib.ExtKey_deleteExtKey(t,e)))}static async fromSeed(e){const t=i.ApiStatic.getInstance();return t.runAsync((r=>t.lib.ExtKey_fromSeed(r,e)))}static async fromBase58(e){const t=i.ApiStatic.getInstance();return t.runAsync((r=>t.lib.ExtKey_fromBase58(r,e)))}static async generateRandom(e){const t=i.ApiStatic.getInstance();return t.runAsync((r=>t.lib.ExtKey_generateRandom(r,e)))}async derive(e,t){return this.runAsync((r=>this.api.lib.ExtKey_derive(r,e,t)))}async deriveHardened(e,t){return this.runAsync((r=>this.api.lib.ExtKey_deriveHardened(r,e,t)))}getPrivatePartAsBase58(e,t){return this.runAsync((r=>this.api.lib.ExtKey_getPrivatePartAsBase58(r,e,t)))}getPublicPartAsBase58(e,t){return this.runAsync((r=>this.api.lib.ExtKey_getPublicPartAsBase58(r,e,t)))}getPrivateKey(e,t){return this.runAsync((r=>this.api.lib.ExtKey_getPrivateKey(r,e,t)))}getPublicKey(e,t){return this.runAsync((r=>this.api.lib.ExtKey_getPublicKey(r,e,t)))}getPrivateEncKey(e,t){return this.runAsync((r=>this.api.lib.ExtKey_getPrivateEncKey(r,e,t)))}getPublicKeyAsBase58Address(e,t){return this.runAsync((r=>this.api.lib.ExtKey_getPublicKeyAsBase58Address(r,e,t)))}getChainCode(e,t){return this.runAsync((r=>this.api.lib.ExtKey_getChainCode(r,e,t)))}verifyCompactSignatureWithHash(e,t){return this.runAsync((r=>this.api.lib.ExtKey_verifyCompactSignatureWithHash(r,e,t)))}isPrivate(e,t){return this.runAsync((r=>this.api.lib.ExtKey_isPrivate(r,e,t)))}}t.ExtKeyNative=s},785(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IdGenerator=void 0,t.IdGenerator=class{_id=0;generateId(){return this._id++,this._id}}},252(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InboxApiNative=void 0;const i=r(361);class n extends i.BaseNative{async newApi(e,t,r){return this.runAsync((i=>this.api.lib.InboxApi_newInboxApi(i,e,t,r)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.InboxApi_deleteInboxApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((r=>this.api.lib.InboxApi_create(r,e,t)))}async createInbox(e,t){return this.runAsync((r=>this.api.lib.InboxApi_createInbox(r,e,t)))}async updateInbox(e,t){return this.runAsync((r=>this.api.lib.InboxApi_updateInbox(r,e,t)))}async getInbox(e,t){return this.runAsync((r=>this.api.lib.InboxApi_getInbox(r,e,t)))}async listInboxes(e,t){return this.runAsync((r=>this.api.lib.InboxApi_listInboxes(r,e,t)))}async getInboxPublicView(e,t){return this.runAsync((r=>this.api.lib.InboxApi_getInboxPublicView(r,e,t)))}async deleteInbox(e,t){return this.runAsync((r=>this.api.lib.InboxApi_deleteInbox(r,e,t)))}async prepareEntry(e,t){return this.runAsync((r=>this.api.lib.InboxApi_prepareEntry(r,e,t)))}async sendEntry(e,t){return this.runAsync((r=>this.api.lib.InboxApi_sendEntry(r,e,t)))}async readEntry(e,t){return this.runAsync((r=>this.api.lib.InboxApi_readEntry(r,e,t)))}async deleteEntry(e,t){return this.runAsync((r=>this.api.lib.InboxApi_deleteEntry(r,e,t)))}async listEntries(e,t){return this.runAsync((r=>this.api.lib.InboxApi_listEntries(r,e,t)))}async createFileHandle(e,t){return this.runAsync((r=>this.api.lib.InboxApi_createFileHandle(r,e,t)))}async writeToFile(e,t){return this.runAsync((r=>this.api.lib.InboxApi_writeToFile(r,e,t)))}async openFile(e,t){return this.runAsync((r=>this.api.lib.InboxApi_openFile(r,e,t)))}async readFromFile(e,t){return this.runAsync((r=>this.api.lib.InboxApi_readFromFile(r,e,t)))}async seekInFile(e,t){return this.runAsync((r=>this.api.lib.InboxApi_seekInFile(r,e,t)))}async closeFile(e,t){return this.runAsync((r=>this.api.lib.InboxApi_closeFile(r,e,t)))}async subscribeFor(e,t){return this.runAsync((r=>this.api.lib.InboxApi_subscribeFor(r,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((r=>this.api.lib.InboxApi_unsubscribeFrom(r,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((r=>this.api.lib.InboxApi_buildSubscriptionQuery(r,e,t)))}}t.InboxApiNative=n},453(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KvdbApiNative=void 0;const i=r(361);class n extends i.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.KvdbApi_newKvdbApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.KvdbApi_deleteKvdbApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_create(r,e,t)))}async createKvdb(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_createKvdb(r,e,t)))}async updateKvdb(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_updateKvdb(r,e,t)))}async deleteKvdb(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_deleteKvdb(r,e,t)))}async getKvdb(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_getKvdb(r,e,t)))}async listKvdbs(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_listKvdbs(r,e,t)))}async hasEntry(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_hasEntry(r,e,t)))}async getEntry(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_getEntry(r,e,t)))}async listEntriesKeys(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_listEntriesKeys(r,e,t)))}async listEntries(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_listEntries(r,e,t)))}async setEntry(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_setEntry(r,e,t)))}async deleteEntry(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_deleteEntry(r,e,t)))}async deleteEntries(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_deleteEntries(r,e,t)))}async subscribeFor(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_subscribeFor(r,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_unsubscribeFrom(r,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_buildSubscriptionQuery(r,e,t)))}async buildSubscriptionQueryForSelectedEntry(e,t){return this.runAsync((r=>this.api.lib.KvdbApi_buildSubscriptionQueryForSelectedEntry(r,e,t)))}}t.KvdbApiNative=n},708(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NativeError=void 0;class r extends Error{code;scope;fullMessage;constructor(e){super(e.description||e.full),Object.setPrototypeOf(this,r.prototype),this.name=e.name||"NativeError",this.code=e.code,this.scope=e.scope,this.fullMessage=e.full,this.stack&&e.full&&(this.stack+=`\n Caused by Native C++ Exception: ${e.full}`)}}t.NativeError=r},243(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StoreApiNative=void 0;const i=r(361);class n extends i.BaseNative{async newApi(e){return this.runAsync((t=>this.api.lib.StoreApi_newStoreApi(t,e)))}async deleteApi(e){await this.runAsync((t=>this.api.lib.StoreApi_deleteStoreApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((r=>this.api.lib.StoreApi_create(r,e,t)))}async createStore(e,t){return this.runAsync((r=>this.api.lib.StoreApi_createStore(r,e,t)))}async updateStore(e,t){return this.runAsync((r=>this.api.lib.StoreApi_updateStore(r,e,t)))}async deleteStore(e,t){return this.runAsync((r=>this.api.lib.StoreApi_deleteStore(r,e,t)))}async getStore(e,t){return this.runAsync((r=>this.api.lib.StoreApi_getStore(r,e,t)))}async listStores(e,t){return this.runAsync((r=>this.api.lib.StoreApi_listStores(r,e,t)))}async createFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_createFile(r,e,t)))}async updateFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_updateFile(r,e,t)))}async updateFileMeta(e,t){return this.runAsync((r=>this.api.lib.StoreApi_updateFileMeta(r,e,t)))}async writeToFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_writeToFile(r,e,t)))}async deleteFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_deleteFile(r,e,t)))}async getFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_getFile(r,e,t)))}async listFiles(e,t){return this.runAsync((r=>this.api.lib.StoreApi_listFiles(r,e,t)))}async openFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_openFile(r,e,t)))}async readFromFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_readFromFile(r,e,t)))}async seekInFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_seekInFile(r,e,t)))}async closeFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_closeFile(r,e,t)))}async syncFile(e,t){return this.runAsync((r=>this.api.lib.StoreApi_syncFile(r,e,t)))}async subscribeFor(e,t){return this.runAsync((r=>this.api.lib.StoreApi_subscribeFor(r,e,t)))}async unsubscribeFrom(e,t){return this.runAsync((r=>this.api.lib.StoreApi_unsubscribeFrom(r,e,t)))}async buildSubscriptionQuery(e,t){return this.runAsync((r=>this.api.lib.StoreApi_buildSubscriptionQuery(r,e,t)))}}t.StoreApiNative=n},620(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StreamApiNative=void 0;const i=r(332),n=r(361);class s extends n.BaseNative{webRtcClient;static bindingId=-1;static getBindingId(){return++this.bindingId}webRtcInterfacePtr=-1;selfPtr=-1;webRtcInterfaceImpl;constructor(e,t){super(e),this.webRtcClient=t,t.bindApiInterface({trickle:(e,t)=>this.trickle(this.selfPtr,[e,t]),acceptOffer:(e,t)=>this.acceptOfferOnReconfigure(this.selfPtr,[e,t])})}async newApi(e,t){const r=s.getBindingId();return this.bindWebRtcInterfaceAsHandler(r),this.selfPtr=await this.runAsync((i=>this.api.lib.StreamApi_newStreamApi(i,e,t,r))),this.selfPtr}async deleteApi(e){await this.runAsync((t=>this.api.lib.StreamApi_deleteStreamApi(t,e))),this.deleteApiRef()}async create(e,t){return this.runAsync((r=>this.api.lib.StreamApi_create(r,e,t)))}async createStreamRoom(e,t){return this.runAsync((r=>this.api.lib.StreamApi_createStreamRoom(r,e,t)))}async updateStreamRoom(e,t){return this.runAsync((r=>this.api.lib.StreamApi_updateStreamRoom(r,e,t)))}async deleteStreamRoom(e,t){return this.runAsync((r=>this.api.lib.StreamApi_deleteStreamRoom(r,e,t)))}async getStreamRoom(e,t){return this.runAsync((r=>this.api.lib.Strea