mosquito-transport-js 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TODO +3 -0
- package/dist/browser/index.min.js +30 -0
- package/dist/browser/index.min.js.map +1 -0
- package/dist/cjs/index.min.js/index.js +42 -0
- package/dist/cjs/index.min.js/index.js.map +1 -0
- package/dist/esm/index.min.js/index.js +42 -0
- package/dist/esm/index.min.js/index.js.map +1 -0
- package/package.json +15 -18
- package/rollup.config.js +93 -0
- package/src/helpers/EngineApi.js +27 -27
- package/src/helpers/peripherals.js +9 -5
- package/src/helpers/utils.js +11 -5
- package/src/helpers/values.js +5 -4
- package/src/index.d.ts +24 -3
- package/src/index.js +49 -31
- package/src/products/auth/accessor.js +5 -25
- package/src/products/auth/index.js +5 -5
- package/src/products/database/index.js +5 -5
- package/src/products/database/validator.js +9 -2
- package/src/products/storage/index.js +2 -1
- package/.babelrc +0 -5
package/TODO
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
*
|
|
5
|
+
* The MIT License (MIT)
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2024 BrainbehindX Inc.
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in
|
|
17
|
+
* all copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
* THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
(function(global){var exports={}; !function(t){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o=!1;function s(){o=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)r[e]=t[e],n[t.charCodeAt(e)]=e;n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}function a(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16)+(t[a+1]<<8)+t[a+2],s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}function c(t){var e;o||s();for(var n=t.length,i=n%3,c="",h=[],u=16383,l=0,f=n-i;l<f;l+=u)h.push(a(t,l,l+u>f?f:l+u));return 1===i?(e=t[n-1],c+=r[e>>2],c+=r[e<<4&63],c+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],c+=r[e>>10],c+=r[e>>4&63],c+=r[e<<2&63],c+="="),h.push(c),h.join("")}function h(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,h=c>>1,u=-7,l=r?i-1:0,f=r?-1:1,p=t[e+l];for(l+=f,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+t[e+l],l+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+t[e+l],l+=f,u-=8);if(0===o)o=1-h;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=h}return(p?-1:1)*s*Math.pow(2,o-n)}function u(t,e,r,n,i,o){var s,a,c,h=8*o-i-1,u=(1<<h)-1,l=u>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?f/c:f*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=u?(a=0,s=u):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[r+p]=255&s,p+=d,s/=256,h-=8);t[r+p-d]|=128*y}var l={}.toString,f=Array.isArray||function(t){return"[object Array]"==l.call(t)};function p(){return y.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function d(t,e){if(p()<e)throw new RangeError("Invalid typed array length");return y.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=y.prototype:(null===t&&(t=new y(e)),t.length=e),t}function y(t,e,r){if(!(y.TYPED_ARRAY_SUPPORT||this instanceof y))return new y(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return b(this,t)}return g(this,t,e,r)}function g(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);y.TYPED_ARRAY_SUPPORT?(t=e).__proto__=y.prototype:t=_(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!y.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|E(e,r);t=d(t,n);var i=t.write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(A(e)){var r=0|w(e.length);return 0===(t=d(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?d(t,0):_(t,e);if("Buffer"===e.type&&f(e.data))return _(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function m(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function b(t,e){if(m(e),t=d(t,e<0?0:0|w(e)),!y.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function _(t,e){var r=e.length<0?0:0|w(e.length);t=d(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function w(t){if(t>=p())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+p().toString(16)+" bytes");return 0|t}function A(t){return!(null==t||!t._isBuffer)}function E(t,e){if(A(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return X(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return X(t).length;e=(""+e).toLowerCase(),n=!0}}function T(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return L(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function k(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function O(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=y.from(e,n)),A(e))return 0===e.length?-1:S(t,e,r,n,i);if("number"==typeof e)return e&=255,y.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):S(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function S(t,e,r,n,i){var o,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var u=-1;for(o=r;o<a;o++)if(h(t,o)===h(e,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===c)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var l=!0,f=0;f<c;f++)if(h(t,o+f)!==h(e,f)){l=!1;break}if(l)return o}return-1}function x(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function R(t,e,r,n){return Q(X(e,t.length-r),t,r,n)}function C(t,e,r,n){return Q(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function $(t,e,r,n){return C(t,e,r,n)}function P(t,e,r,n){return Q(G(e),t,r,n)}function j(t,e,r,n){return Q(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function U(t,e,r){return 0===e&&r===t.length?c(t):c(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,c,h=t[i],u=null,l=h>239?4:h>223?3:h>191?2:1;if(i+l<=r)switch(l){case 1:h<128&&(u=h);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&h)<<6|63&o)>127&&(u=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&h)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,l=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=l}return function(t){var e=t.length;if(e<=N)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=N));return r}(n)}y.TYPED_ARRAY_SUPPORT=void 0===e.TYPED_ARRAY_SUPPORT||e.TYPED_ARRAY_SUPPORT,p(),y.poolSize=8192,y._augment=function(t){return t.__proto__=y.prototype,t},y.from=function(t,e,r){return g(null,t,e,r)},y.TYPED_ARRAY_SUPPORT&&(y.prototype.__proto__=Uint8Array.prototype,y.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&y[Symbol.species]),y.alloc=function(t,e,r){return function(t,e,r,n){return m(e),e<=0?d(t,e):void 0!==r?"string"==typeof n?d(t,e).fill(r,n):d(t,e).fill(r):d(t,e)}(null,t,e,r)},y.allocUnsafe=function(t){return b(null,t)},y.allocUnsafeSlow=function(t){return b(null,t)},y.isBuffer=function(t){return null!=t&&(!!t._isBuffer||Z(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&Z(t.slice(0,0))}(t))},y.compare=function(t,e){if(!A(t)||!A(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},y.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}},y.concat=function(t,e){if(!f(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return y.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=y.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var o=t[r];if(!A(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},y.byteLength=E,y.prototype._isBuffer=!0,y.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)k(this,e,e+1);return this},y.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)k(this,e,e+3),k(this,e+1,e+2);return this},y.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)k(this,e,e+7),k(this,e+1,e+6),k(this,e+2,e+5),k(this,e+3,e+4);return this},y.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?B(this,0,t):T.apply(this,arguments)},y.prototype.equals=function(t){if(!A(t))throw new TypeError("Argument must be a Buffer");return this===t||0===y.compare(this,t)},y.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},y.prototype.compare=function(t,e,r,n,i){if(!A(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),h=t.slice(e,r),u=0;u<a;++u)if(c[u]!==h[u]){o=c[u],s=h[u];break}return o<s?-1:s<o?1:0},y.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},y.prototype.indexOf=function(t,e,r){return O(this,t,e,r,!0)},y.prototype.lastIndexOf=function(t,e,r){return O(this,t,e,r,!1)},y.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return R(this,t,e,r);case"ascii":return C(this,t,e,r);case"latin1":case"binary":return $(this,t,e,r);case"base64":return P(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var N=4096;function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function D(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function L(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=V(t[o]);return i}function I(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function K(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function F(t,e,r,n,i,o){if(!A(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function z(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function W(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function Y(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function q(t,e,r,n,i){return i||Y(t,0,r,4),u(t,e,r,n,23,4),r+4}function H(t,e,r,n,i){return i||Y(t,0,r,8),u(t,e,r,n,52,8),r+8}y.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),y.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=y.prototype;else{var i=e-t;r=new y(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},y.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||K(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},y.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||K(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},y.prototype.readUInt8=function(t,e){return e||K(t,1,this.length),this[t]},y.prototype.readUInt16LE=function(t,e){return e||K(t,2,this.length),this[t]|this[t+1]<<8},y.prototype.readUInt16BE=function(t,e){return e||K(t,2,this.length),this[t]<<8|this[t+1]},y.prototype.readUInt32LE=function(t,e){return e||K(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},y.prototype.readUInt32BE=function(t,e){return e||K(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},y.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||K(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},y.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||K(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},y.prototype.readInt8=function(t,e){return e||K(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},y.prototype.readInt16LE=function(t,e){e||K(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},y.prototype.readInt16BE=function(t,e){e||K(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},y.prototype.readInt32LE=function(t,e){return e||K(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},y.prototype.readInt32BE=function(t,e){return e||K(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},y.prototype.readFloatLE=function(t,e){return e||K(t,4,this.length),h(this,t,!0,23,4)},y.prototype.readFloatBE=function(t,e){return e||K(t,4,this.length),h(this,t,!1,23,4)},y.prototype.readDoubleLE=function(t,e){return e||K(t,8,this.length),h(this,t,!0,52,8)},y.prototype.readDoubleBE=function(t,e){return e||K(t,8,this.length),h(this,t,!1,52,8)},y.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},y.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||F(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},y.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,1,255,0),y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},y.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):z(this,t,e,!0),e+2},y.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,65535,0),y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):z(this,t,e,!1),e+2},y.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):W(this,t,e,!0),e+4},y.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,4294967295,0),y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):W(this,t,e,!1),e+4},y.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},y.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);F(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s|0)-a&255;return e+r},y.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,1,127,-128),y.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},y.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):z(this,t,e,!0),e+2},y.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,2,32767,-32768),y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):z(this,t,e,!1),e+2},y.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,2147483647,-2147483648),y.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):W(this,t,e,!0),e+4},y.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),y.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):W(this,t,e,!1),e+4},y.prototype.writeFloatLE=function(t,e,r){return q(this,t,e,!0,r)},y.prototype.writeFloatBE=function(t,e,r){return q(this,t,e,!1,r)},y.prototype.writeDoubleLE=function(t,e,r){return H(this,t,e,!0,r)},y.prototype.writeDoubleBE=function(t,e,r){return H(this,t,e,!1,r)},y.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!y.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},y.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!y.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=A(t)?t:X(new y(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var J=/[^+\/0-9A-Za-z-_]/g;function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function X(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return function(t){var e,r,a,c,h,u;o||s();var l=t.length;if(l%4>0)throw new Error("Invalid string. Length must be a multiple of 4");h="="===t[l-2]?2:"="===t[l-1]?1:0,u=new i(3*l/4-h),a=h>0?l-4:l;var f=0;for(e=0,r=0;e<a;e+=4,r+=3)c=n[t.charCodeAt(e)]<<18|n[t.charCodeAt(e+1)]<<12|n[t.charCodeAt(e+2)]<<6|n[t.charCodeAt(e+3)],u[f++]=c>>16&255,u[f++]=c>>8&255,u[f++]=255&c;return 2===h?(c=n[t.charCodeAt(e)]<<2|n[t.charCodeAt(e+1)]>>4,u[f++]=255&c):1===h&&(c=n[t.charCodeAt(e)]<<10|n[t.charCodeAt(e+1)]<<4|n[t.charCodeAt(e+2)]>>2,u[f++]=c>>8&255,u[f++]=255&c),u}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(J,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Q(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Z(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}class tt{constructor(){this.listenerMap={},this.lastTriggerValueMap={},this.triggeredKeys={}}listenTo(t,e,r=!1){if("function"!=typeof e)throw`expected a function in listenTo() second argument "${e}"`;if("boolean"!=typeof r)throw`expected a boolean in listenTo() third argument but got "${r}"`;this.listenerMap[t]||(this.listenerMap[t]={ite:0,triggers:{}});const n=""+ ++this.listenerMap[t].ite;let i;return this.listenerMap[t].triggers[n]=e,r&&setTimeout((()=>{i||e?.(...this.lastTriggerValueMap[t]||[])}),0),()=>{i||(delete this.listenerMap[t].triggers[n],Object.keys(this.listenerMap[t].triggers).length||delete this.listenerMap[t]),i=!0}}hasDispatched(t){return!!this.triggeredKeys[t]}deleteDispatch(t){this.lastTriggerValueMap[t]&&delete this.lastTriggerValueMap[t],this.triggeredKeys[t]&&delete this.triggeredKeys[t]}dispatch(){const t=[...arguments||[]],e=t[0],r=t.filter(((t,e)=>e));if(!e)throw`expected a string in dispatch() first argument but got "${e}"`;Object.keys(this.listenerMap[e]?.triggers||{}).forEach((t=>{this.listenerMap[e]?.triggers[t]?.(...r)})),this.lastTriggerValueMap[e]=r,this.triggeredKeys[e]=!0}}const et=new tt,rt=new tt,nt=new tt,it=new tt,ot=new tt;var st="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function at(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ct(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),r}var ht={exports:{}};function ut(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var lt,ft={exports:{}},pt=ct(Object.freeze({__proto__:null,default:{}}));function dt(){return lt||(lt=1,ft.exports=(t=t||function(t,e){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==st&&st.crypto&&(r=st.crypto),!r)try{r=pt}catch(t){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),o={},s=o.lib={},a=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},c=s.WordArray=a.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[n+o>>>2]|=s<<24-(n+o)%4*8}else for(var a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(n());return new c.init(e,t)}}),h=o.enc={},u=h.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new c.init(r,e/2)}},l=h.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var o=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new c.init(r,e)}},f=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},p=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,i=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),h=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,u=t.min(4*h,o);if(h){for(var l=0;l<h;l+=s)this._doProcessBlock(i,l);r=i.splice(0,h),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});s.Hasher=p.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new d.HMAC.init(t,r).finalize(e)}}});var d=o.algo={};return o}(Math),t)),ft.exports;var t}var yt,gt={exports:{}};function vt(){return yt||(yt=1,gt.exports=(t=dt(),function(){var e=t,r=e.lib.WordArray;function n(t,e,n){for(var i=[],o=0,s=0;s<e;s++)if(s%4){var a=n[t.charCodeAt(s-1)]<<s%4*2|n[t.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=a<<24-o%4*8,o++}return r.create(i,o)}e.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],o=0;o<r;o+=3)for(var s=(e[o>>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<r;a++)i.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t){var e=t.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var s=r.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return n(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64)),gt.exports;var t}var mt,bt={exports:{}};function _t(){return mt||(mt=1,bt.exports=(t=dt(),function(e){var r=t,n=r.lib,i=n.WordArray,o=n.Hasher,s=r.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=t[e+0],c=t[e+1],p=t[e+2],d=t[e+3],y=t[e+4],g=t[e+5],v=t[e+6],m=t[e+7],b=t[e+8],_=t[e+9],w=t[e+10],A=t[e+11],E=t[e+12],T=t[e+13],k=t[e+14],O=t[e+15],S=o[0],x=o[1],R=o[2],C=o[3];S=h(S,x,R,C,s,7,a[0]),C=h(C,S,x,R,c,12,a[1]),R=h(R,C,S,x,p,17,a[2]),x=h(x,R,C,S,d,22,a[3]),S=h(S,x,R,C,y,7,a[4]),C=h(C,S,x,R,g,12,a[5]),R=h(R,C,S,x,v,17,a[6]),x=h(x,R,C,S,m,22,a[7]),S=h(S,x,R,C,b,7,a[8]),C=h(C,S,x,R,_,12,a[9]),R=h(R,C,S,x,w,17,a[10]),x=h(x,R,C,S,A,22,a[11]),S=h(S,x,R,C,E,7,a[12]),C=h(C,S,x,R,T,12,a[13]),R=h(R,C,S,x,k,17,a[14]),S=u(S,x=h(x,R,C,S,O,22,a[15]),R,C,c,5,a[16]),C=u(C,S,x,R,v,9,a[17]),R=u(R,C,S,x,A,14,a[18]),x=u(x,R,C,S,s,20,a[19]),S=u(S,x,R,C,g,5,a[20]),C=u(C,S,x,R,w,9,a[21]),R=u(R,C,S,x,O,14,a[22]),x=u(x,R,C,S,y,20,a[23]),S=u(S,x,R,C,_,5,a[24]),C=u(C,S,x,R,k,9,a[25]),R=u(R,C,S,x,d,14,a[26]),x=u(x,R,C,S,b,20,a[27]),S=u(S,x,R,C,T,5,a[28]),C=u(C,S,x,R,p,9,a[29]),R=u(R,C,S,x,m,14,a[30]),S=l(S,x=u(x,R,C,S,E,20,a[31]),R,C,g,4,a[32]),C=l(C,S,x,R,b,11,a[33]),R=l(R,C,S,x,A,16,a[34]),x=l(x,R,C,S,k,23,a[35]),S=l(S,x,R,C,c,4,a[36]),C=l(C,S,x,R,y,11,a[37]),R=l(R,C,S,x,m,16,a[38]),x=l(x,R,C,S,w,23,a[39]),S=l(S,x,R,C,T,4,a[40]),C=l(C,S,x,R,s,11,a[41]),R=l(R,C,S,x,d,16,a[42]),x=l(x,R,C,S,v,23,a[43]),S=l(S,x,R,C,_,4,a[44]),C=l(C,S,x,R,E,11,a[45]),R=l(R,C,S,x,O,16,a[46]),S=f(S,x=l(x,R,C,S,p,23,a[47]),R,C,s,6,a[48]),C=f(C,S,x,R,m,10,a[49]),R=f(R,C,S,x,k,15,a[50]),x=f(x,R,C,S,g,21,a[51]),S=f(S,x,R,C,E,6,a[52]),C=f(C,S,x,R,d,10,a[53]),R=f(R,C,S,x,w,15,a[54]),x=f(x,R,C,S,c,21,a[55]),S=f(S,x,R,C,b,6,a[56]),C=f(C,S,x,R,O,10,a[57]),R=f(R,C,S,x,v,15,a[58]),x=f(x,R,C,S,T,21,a[59]),S=f(S,x,R,C,y,6,a[60]),C=f(C,S,x,R,A,10,a[61]),R=f(R,C,S,x,p,15,a[62]),x=f(x,R,C,S,_,21,a[63]),o[0]=o[0]+S|0,o[1]=o[1]+x|0,o[2]=o[2]+R|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),s=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,h=0;h<4;h++){var u=c[h];c[h]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function h(t,e,r,n,i,o,s){var a=t+(e&r|~e&n)+i+s;return(a<<o|a>>>32-o)+e}function u(t,e,r,n,i,o,s){var a=t+(e&n|r&~n)+i+s;return(a<<o|a>>>32-o)+e}function l(t,e,r,n,i,o,s){var a=t+(e^r^n)+i+s;return(a<<o|a>>>32-o)+e}function f(t,e,r,n,i,o,s){var a=t+(r^(e|~n))+i+s;return(a<<o|a>>>32-o)+e}r.MD5=o._createHelper(c),r.HmacMD5=o._createHmacHelper(c)}(Math),t.MD5)),bt.exports;var t}var wt,At={exports:{}},Et={exports:{}};function Tt(){return wt||(wt=1,Et.exports=(a=dt(),e=(t=a).lib,r=e.WordArray,n=e.Hasher,i=t.algo,o=[],s=i.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],c=r[4],h=0;h<80;h++){if(h<16)o[h]=0|t[e+h];else{var u=o[h-3]^o[h-8]^o[h-14]^o[h-16];o[h]=u<<1|u>>>31}var l=(n<<5|n>>>27)+c+o[h];l+=h<20?1518500249+(i&s|~i&a):h<40?1859775393+(i^s^a):h<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,c=a,a=s,s=i<<30|i>>>2,i=n,n=l}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),t.SHA1=n._createHelper(s),t.HmacSHA1=n._createHmacHelper(s),a.SHA1)),Et.exports;var t,e,r,n,i,o,s,a}var kt,Ot,St={exports:{}};function xt(){return Ot||(Ot=1,At.exports=function(t){return function(){var e=t,r=e.lib,n=r.Base,i=r.WordArray,o=e.algo,s=o.MD5,a=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r,n=this.cfg,o=n.hasher.create(),s=i.create(),a=s.words,c=n.keySize,h=n.iterations;a.length<c;){r&&o.update(r),r=o.update(t).finalize(e),o.reset();for(var u=1;u<h;u++)r=o.finalize(r),o.reset();s.concat(r)}return s.sigBytes=4*c,s}});e.EvpKDF=function(t,e,r){return a.create(r).compute(t,e)}}(),t.EvpKDF}(dt(),Tt(),(kt||(kt=1,St.exports=(t=dt(),r=(e=t).lib.Base,n=e.enc.Utf8,void(e.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=n.parse(e));var r=t.blockSize,i=4*r;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),s=this._iKey=e.clone(),a=o.words,c=s.words,h=0;h<r;h++)a[h]^=1549556828,c[h]^=909522486;o.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))),St.exports))),At.exports;var t,e,r,n}var Rt,Ct,$t={exports:{}};ht.exports=function(t){return function(){var e=t,r=e.lib.BlockCipher,n=e.algo,i=[],o=[],s=[],a=[],c=[],h=[],u=[],l=[],f=[],p=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var r=0,n=0;for(e=0;e<256;e++){var d=n^n<<1^n<<2^n<<3^n<<4;d=d>>>8^255&d^99,i[r]=d,o[d]=r;var y=t[r],g=t[y],v=t[g],m=257*t[d]^16843008*d;s[r]=m<<24|m>>>8,a[r]=m<<16|m>>>16,c[r]=m<<8|m>>>24,h[r]=m,m=16843009*v^65537*g^257*y^16843008*r,u[d]=m<<24|m>>>8,l[d]=m<<16|m>>>16,f[d]=m<<8|m>>>24,p[d]=m,r?(r=y^t[t[t[v^y]]],n^=t[t[n]]):r=n=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],y=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s<n;s++)s<r?o[s]=e[s]:(h=o[s-1],s%r?r>6&&s%r==4&&(h=i[h>>>24]<<24|i[h>>>16&255]<<16|i[h>>>8&255]<<8|i[255&h]):(h=i[(h=h<<8|h>>>24)>>>24]<<24|i[h>>>16&255]<<16|i[h>>>8&255]<<8|i[255&h],h^=d[s/r|0]<<24),o[s]=o[s-r]^h);for(var a=this._invKeySchedule=[],c=0;c<n;c++){if(s=n-c,c%4)var h=o[s];else h=o[s-4];a[c]=c<4||s<=4?h:u[i[h>>>24]]^l[i[h>>>16&255]]^f[i[h>>>8&255]]^p[i[255&h]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,a,c,h,i)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,u,l,f,p,o),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,o,s,a){for(var c=this._nRounds,h=t[e]^r[0],u=t[e+1]^r[1],l=t[e+2]^r[2],f=t[e+3]^r[3],p=4,d=1;d<c;d++){var y=n[h>>>24]^i[u>>>16&255]^o[l>>>8&255]^s[255&f]^r[p++],g=n[u>>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^r[p++],v=n[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&u]^r[p++],m=n[f>>>24]^i[h>>>16&255]^o[u>>>8&255]^s[255&l]^r[p++];h=y,u=g,l=v,f=m}y=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^r[p++],g=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^r[p++],v=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^r[p++],m=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^r[p++],t[e]=y,t[e+1]=g,t[e+2]=v,t[e+3]=m},keySize:8});e.AES=r._createHelper(y)}(),t.AES}(dt(),vt(),_t(),xt(),Rt||(Rt=1,$t.exports=(Ct=dt(),xt(),void(Ct.lib.Cipher||function(t){var e=Ct,r=e.lib,n=r.Base,i=r.WordArray,o=r.BufferedBlockAlgorithm,s=e.enc;s.Utf8;var a=s.Base64,c=e.algo.EvpKDF,h=r.Cipher=o.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?m:g}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()});r.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=e.mode={},l=r.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),f=u.CBC=function(){var e=l.extend();function r(e,r,n){var i,o=this._iv;o?(i=o,this._iv=t):i=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=i[s]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize;r.call(this,t,e,i),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,o=t.slice(e,e+i);n.decryptBlock(t,e),r.call(this,t,e,i),this._prevBlock=o}}),e}(),p=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,o=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(o);var c=i.create(s,n);t.concat(c)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};r.BlockCipher=h.extend({cfg:h.cfg.extend({mode:f,padding:p}),reset:function(){var t;h.reset.call(this);var e=this.cfg,r=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(n,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var d=r.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),y=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?i.create([1398893684,1701076831]).concat(r).concat(e):e).toString(a)},parse:function(t){var e,r=a.parse(t),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),d.create({ciphertext:r,salt:e})}},g=r.SerializableCipher=n.extend({cfg:n.extend({format:y}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),o=i.finalize(e),s=i.cfg;return d.create({ciphertext:o,key:r,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(e.kdf={}).OpenSSL={execute:function(t,e,r,n,o){if(n||(n=i.random(8)),o)s=c.create({keySize:e+r,hasher:o}).compute(t,n);else var s=c.create({keySize:e+r}).compute(t,n);var a=i.create(s.words.slice(e),4*r);return s.sigBytes=4*e,d.create({key:s,iv:a,salt:n})}},m=r.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:v}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=g.encrypt.call(this,t,e,i.key,n);return o.mixIn(i),o},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt,n.hasher);return n.iv=i.iv,g.decrypt.call(this,t,e,i.key,n)}})}()))));var Pt=at(ht.exports),jt={exports:{}};!function(t,e){t.exports=function(t){return t.enc.Utf8}(dt())}(jt);var Ut=at(jt.exports),Bt={exports:{}};!function(t){!function(t){var e=function(t){var e,r=new Float64Array(16);if(t)for(e=0;e<t.length;e++)r[e]=t[e];return r},r=function(){throw new Error("no PRNG")},n=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var o=e(),s=e([1]),a=e([56129,1]),c=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),l=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),f=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function p(t,e,r,n){t[e]=r>>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=255&r,t[e+4]=n>>24&255,t[e+5]=n>>16&255,t[e+6]=n>>8&255,t[e+7]=255&n}function d(t,e,r,n,i){var o,s=0;for(o=0;o<i;o++)s|=t[e+o]^r[n+o];return(1&s-1>>>8)-1}function y(t,e,r,n){return d(t,e,r,n,16)}function g(t,e,r,n){return d(t,e,r,n,32)}function v(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,h=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,u=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,v=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,_=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=o,A=s,E=a,T=c,k=h,O=u,S=l,x=f,R=p,C=d,$=y,P=g,j=v,U=m,B=b,N=_,M=0;M<20;M+=2)w^=(i=(j^=(i=(R^=(i=(k^=(i=w+j|0)<<7|i>>>25)+w|0)<<9|i>>>23)+k|0)<<13|i>>>19)+R|0)<<18|i>>>14,O^=(i=(A^=(i=(U^=(i=(C^=(i=O+A|0)<<7|i>>>25)+O|0)<<9|i>>>23)+C|0)<<13|i>>>19)+U|0)<<18|i>>>14,$^=(i=(S^=(i=(E^=(i=(B^=(i=$+S|0)<<7|i>>>25)+$|0)<<9|i>>>23)+B|0)<<13|i>>>19)+E|0)<<18|i>>>14,N^=(i=(P^=(i=(x^=(i=(T^=(i=N+P|0)<<7|i>>>25)+N|0)<<9|i>>>23)+T|0)<<13|i>>>19)+x|0)<<18|i>>>14,w^=(i=(T^=(i=(E^=(i=(A^=(i=w+T|0)<<7|i>>>25)+w|0)<<9|i>>>23)+A|0)<<13|i>>>19)+E|0)<<18|i>>>14,O^=(i=(k^=(i=(x^=(i=(S^=(i=O+k|0)<<7|i>>>25)+O|0)<<9|i>>>23)+S|0)<<13|i>>>19)+x|0)<<18|i>>>14,$^=(i=(C^=(i=(R^=(i=(P^=(i=$+C|0)<<7|i>>>25)+$|0)<<9|i>>>23)+P|0)<<13|i>>>19)+R|0)<<18|i>>>14,N^=(i=(B^=(i=(U^=(i=(j^=(i=N+B|0)<<7|i>>>25)+N|0)<<9|i>>>23)+j|0)<<13|i>>>19)+U|0)<<18|i>>>14;w=w+o|0,A=A+s|0,E=E+a|0,T=T+c|0,k=k+h|0,O=O+u|0,S=S+l|0,x=x+f|0,R=R+p|0,C=C+d|0,$=$+y|0,P=P+g|0,j=j+v|0,U=U+m|0,B=B+b|0,N=N+_|0,t[0]=w>>>0&255,t[1]=w>>>8&255,t[2]=w>>>16&255,t[3]=w>>>24&255,t[4]=A>>>0&255,t[5]=A>>>8&255,t[6]=A>>>16&255,t[7]=A>>>24&255,t[8]=E>>>0&255,t[9]=E>>>8&255,t[10]=E>>>16&255,t[11]=E>>>24&255,t[12]=T>>>0&255,t[13]=T>>>8&255,t[14]=T>>>16&255,t[15]=T>>>24&255,t[16]=k>>>0&255,t[17]=k>>>8&255,t[18]=k>>>16&255,t[19]=k>>>24&255,t[20]=O>>>0&255,t[21]=O>>>8&255,t[22]=O>>>16&255,t[23]=O>>>24&255,t[24]=S>>>0&255,t[25]=S>>>8&255,t[26]=S>>>16&255,t[27]=S>>>24&255,t[28]=x>>>0&255,t[29]=x>>>8&255,t[30]=x>>>16&255,t[31]=x>>>24&255,t[32]=R>>>0&255,t[33]=R>>>8&255,t[34]=R>>>16&255,t[35]=R>>>24&255,t[36]=C>>>0&255,t[37]=C>>>8&255,t[38]=C>>>16&255,t[39]=C>>>24&255,t[40]=$>>>0&255,t[41]=$>>>8&255,t[42]=$>>>16&255,t[43]=$>>>24&255,t[44]=P>>>0&255,t[45]=P>>>8&255,t[46]=P>>>16&255,t[47]=P>>>24&255,t[48]=j>>>0&255,t[49]=j>>>8&255,t[50]=j>>>16&255,t[51]=j>>>24&255,t[52]=U>>>0&255,t[53]=U>>>8&255,t[54]=U>>>16&255,t[55]=U>>>24&255,t[56]=B>>>0&255,t[57]=B>>>8&255,t[58]=B>>>16&255,t[59]=B>>>24&255,t[60]=N>>>0&255,t[61]=N>>>8&255,t[62]=N>>>16&255,t[63]=N>>>24&255}(t,e,r,n)}function m(t,e,r,n){!function(t,e,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,h=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,u=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,g=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,v=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,m=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,_=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,w=0;w<20;w+=2)o^=(i=(v^=(i=(p^=(i=(h^=(i=o+v|0)<<7|i>>>25)+o|0)<<9|i>>>23)+h|0)<<13|i>>>19)+p|0)<<18|i>>>14,u^=(i=(s^=(i=(m^=(i=(d^=(i=u+s|0)<<7|i>>>25)+u|0)<<9|i>>>23)+d|0)<<13|i>>>19)+m|0)<<18|i>>>14,y^=(i=(l^=(i=(a^=(i=(b^=(i=y+l|0)<<7|i>>>25)+y|0)<<9|i>>>23)+b|0)<<13|i>>>19)+a|0)<<18|i>>>14,_^=(i=(g^=(i=(f^=(i=(c^=(i=_+g|0)<<7|i>>>25)+_|0)<<9|i>>>23)+c|0)<<13|i>>>19)+f|0)<<18|i>>>14,o^=(i=(c^=(i=(a^=(i=(s^=(i=o+c|0)<<7|i>>>25)+o|0)<<9|i>>>23)+s|0)<<13|i>>>19)+a|0)<<18|i>>>14,u^=(i=(h^=(i=(f^=(i=(l^=(i=u+h|0)<<7|i>>>25)+u|0)<<9|i>>>23)+l|0)<<13|i>>>19)+f|0)<<18|i>>>14,y^=(i=(d^=(i=(p^=(i=(g^=(i=y+d|0)<<7|i>>>25)+y|0)<<9|i>>>23)+g|0)<<13|i>>>19)+p|0)<<18|i>>>14,_^=(i=(b^=(i=(m^=(i=(v^=(i=_+b|0)<<7|i>>>25)+_|0)<<9|i>>>23)+v|0)<<13|i>>>19)+m|0)<<18|i>>>14;t[0]=o>>>0&255,t[1]=o>>>8&255,t[2]=o>>>16&255,t[3]=o>>>24&255,t[4]=u>>>0&255,t[5]=u>>>8&255,t[6]=u>>>16&255,t[7]=u>>>24&255,t[8]=y>>>0&255,t[9]=y>>>8&255,t[10]=y>>>16&255,t[11]=y>>>24&255,t[12]=_>>>0&255,t[13]=_>>>8&255,t[14]=_>>>16&255,t[15]=_>>>24&255,t[16]=l>>>0&255,t[17]=l>>>8&255,t[18]=l>>>16&255,t[19]=l>>>24&255,t[20]=f>>>0&255,t[21]=f>>>8&255,t[22]=f>>>16&255,t[23]=f>>>24&255,t[24]=p>>>0&255,t[25]=p>>>8&255,t[26]=p>>>16&255,t[27]=p>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255}(t,e,r,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(t,e,r,n,i,o,s){var a,c,h=new Uint8Array(16),u=new Uint8Array(64);for(c=0;c<16;c++)h[c]=0;for(c=0;c<8;c++)h[c]=o[c];for(;i>=64;){for(v(u,h,s,b),c=0;c<64;c++)t[e+c]=r[n+c]^u[c];for(a=1,c=8;c<16;c++)a=a+(255&h[c])|0,h[c]=255&a,a>>>=8;i-=64,e+=64,n+=64}if(i>0)for(v(u,h,s,b),c=0;c<i;c++)t[e+c]=r[n+c]^u[c];return 0}function w(t,e,r,n,i){var o,s,a=new Uint8Array(16),c=new Uint8Array(64);for(s=0;s<16;s++)a[s]=0;for(s=0;s<8;s++)a[s]=n[s];for(;r>=64;){for(v(c,a,i,b),s=0;s<64;s++)t[e+s]=c[s];for(o=1,s=8;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,e+=64}if(r>0)for(v(c,a,i,b),s=0;s<r;s++)t[e+s]=c[s];return 0}function A(t,e,r,n,i){var o=new Uint8Array(32);m(o,n,i,b);for(var s=new Uint8Array(8),a=0;a<8;a++)s[a]=n[a+16];return w(t,e,r,s,o)}function E(t,e,r,n,i,o,s){var a=new Uint8Array(32);m(a,o,s,b);for(var c=new Uint8Array(8),h=0;h<8;h++)c[h]=o[h+16];return _(t,e,r,n,i,c,a)}var T=function(t){var e,r,n,i,o,s,a,c;this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0,e=255&t[0]|(255&t[1])<<8,this.r[0]=8191&e,r=255&t[2]|(255&t[3])<<8,this.r[1]=8191&(e>>>13|r<<3),n=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&t[8]|(255&t[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|a<<5),c=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function k(t,e,r,n,i,o){var s=new T(o);return s.update(r,n,i),s.finish(t,e),0}function O(t,e,r,n,i,o){var s=new Uint8Array(16);return k(s,0,r,n,i,o),y(t,e,s,0)}function S(t,e,r,n,i){var o;if(r<32)return-1;for(E(t,0,e,0,r,n,i),k(t,16,t,32,r-32,t),o=0;o<16;o++)t[o]=0;return 0}function x(t,e,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(A(s,0,32,n,i),0!==O(e,16,e,32,r-32,s))return-1;for(E(t,0,e,0,r,n,i),o=0;o<32;o++)t[o]=0;return 0}function R(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function C(t){var e,r,n=1;for(e=0;e<16;e++)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-65536*n;t[0]+=n-1+37*(n-1)}function $(t,e,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(t[o]^e[o]),t[o]^=n,e[o]^=n}function P(t,r){var n,i,o,s=e(),a=e();for(n=0;n<16;n++)a[n]=r[n];for(C(a),C(a),C(a),i=0;i<2;i++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,$(a,s,1-o)}for(n=0;n<16;n++)t[2*n]=255&a[n],t[2*n+1]=a[n]>>8}function j(t,e){var r=new Uint8Array(32),n=new Uint8Array(32);return P(r,t),P(n,e),g(r,0,n,0)}function U(t){var e=new Uint8Array(32);return P(e,t),1&e[0]}function B(t,e){var r;for(r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function N(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]+r[n]}function M(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]-r[n]}function D(t,e,r){var n,i,o=0,s=0,a=0,c=0,h=0,u=0,l=0,f=0,p=0,d=0,y=0,g=0,v=0,m=0,b=0,_=0,w=0,A=0,E=0,T=0,k=0,O=0,S=0,x=0,R=0,C=0,$=0,P=0,j=0,U=0,B=0,N=r[0],M=r[1],D=r[2],L=r[3],I=r[4],K=r[5],F=r[6],z=r[7],W=r[8],Y=r[9],q=r[10],H=r[11],J=r[12],V=r[13],X=r[14],G=r[15];o+=(n=e[0])*N,s+=n*M,a+=n*D,c+=n*L,h+=n*I,u+=n*K,l+=n*F,f+=n*z,p+=n*W,d+=n*Y,y+=n*q,g+=n*H,v+=n*J,m+=n*V,b+=n*X,_+=n*G,s+=(n=e[1])*N,a+=n*M,c+=n*D,h+=n*L,u+=n*I,l+=n*K,f+=n*F,p+=n*z,d+=n*W,y+=n*Y,g+=n*q,v+=n*H,m+=n*J,b+=n*V,_+=n*X,w+=n*G,a+=(n=e[2])*N,c+=n*M,h+=n*D,u+=n*L,l+=n*I,f+=n*K,p+=n*F,d+=n*z,y+=n*W,g+=n*Y,v+=n*q,m+=n*H,b+=n*J,_+=n*V,w+=n*X,A+=n*G,c+=(n=e[3])*N,h+=n*M,u+=n*D,l+=n*L,f+=n*I,p+=n*K,d+=n*F,y+=n*z,g+=n*W,v+=n*Y,m+=n*q,b+=n*H,_+=n*J,w+=n*V,A+=n*X,E+=n*G,h+=(n=e[4])*N,u+=n*M,l+=n*D,f+=n*L,p+=n*I,d+=n*K,y+=n*F,g+=n*z,v+=n*W,m+=n*Y,b+=n*q,_+=n*H,w+=n*J,A+=n*V,E+=n*X,T+=n*G,u+=(n=e[5])*N,l+=n*M,f+=n*D,p+=n*L,d+=n*I,y+=n*K,g+=n*F,v+=n*z,m+=n*W,b+=n*Y,_+=n*q,w+=n*H,A+=n*J,E+=n*V,T+=n*X,k+=n*G,l+=(n=e[6])*N,f+=n*M,p+=n*D,d+=n*L,y+=n*I,g+=n*K,v+=n*F,m+=n*z,b+=n*W,_+=n*Y,w+=n*q,A+=n*H,E+=n*J,T+=n*V,k+=n*X,O+=n*G,f+=(n=e[7])*N,p+=n*M,d+=n*D,y+=n*L,g+=n*I,v+=n*K,m+=n*F,b+=n*z,_+=n*W,w+=n*Y,A+=n*q,E+=n*H,T+=n*J,k+=n*V,O+=n*X,S+=n*G,p+=(n=e[8])*N,d+=n*M,y+=n*D,g+=n*L,v+=n*I,m+=n*K,b+=n*F,_+=n*z,w+=n*W,A+=n*Y,E+=n*q,T+=n*H,k+=n*J,O+=n*V,S+=n*X,x+=n*G,d+=(n=e[9])*N,y+=n*M,g+=n*D,v+=n*L,m+=n*I,b+=n*K,_+=n*F,w+=n*z,A+=n*W,E+=n*Y,T+=n*q,k+=n*H,O+=n*J,S+=n*V,x+=n*X,R+=n*G,y+=(n=e[10])*N,g+=n*M,v+=n*D,m+=n*L,b+=n*I,_+=n*K,w+=n*F,A+=n*z,E+=n*W,T+=n*Y,k+=n*q,O+=n*H,S+=n*J,x+=n*V,R+=n*X,C+=n*G,g+=(n=e[11])*N,v+=n*M,m+=n*D,b+=n*L,_+=n*I,w+=n*K,A+=n*F,E+=n*z,T+=n*W,k+=n*Y,O+=n*q,S+=n*H,x+=n*J,R+=n*V,C+=n*X,$+=n*G,v+=(n=e[12])*N,m+=n*M,b+=n*D,_+=n*L,w+=n*I,A+=n*K,E+=n*F,T+=n*z,k+=n*W,O+=n*Y,S+=n*q,x+=n*H,R+=n*J,C+=n*V,$+=n*X,P+=n*G,m+=(n=e[13])*N,b+=n*M,_+=n*D,w+=n*L,A+=n*I,E+=n*K,T+=n*F,k+=n*z,O+=n*W,S+=n*Y,x+=n*q,R+=n*H,C+=n*J,$+=n*V,P+=n*X,j+=n*G,b+=(n=e[14])*N,_+=n*M,w+=n*D,A+=n*L,E+=n*I,T+=n*K,k+=n*F,O+=n*z,S+=n*W,x+=n*Y,R+=n*q,C+=n*H,$+=n*J,P+=n*V,j+=n*X,U+=n*G,_+=(n=e[15])*N,s+=38*(A+=n*D),a+=38*(E+=n*L),c+=38*(T+=n*I),h+=38*(k+=n*K),u+=38*(O+=n*F),l+=38*(S+=n*z),f+=38*(x+=n*W),p+=38*(R+=n*Y),d+=38*(C+=n*q),y+=38*($+=n*H),g+=38*(P+=n*J),v+=38*(j+=n*V),m+=38*(U+=n*X),b+=38*(B+=n*G),o=(n=(o+=38*(w+=n*M))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),_=(n=_+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),t[0]=o,t[1]=s,t[2]=a,t[3]=c,t[4]=h,t[5]=u,t[6]=l,t[7]=f,t[8]=p,t[9]=d,t[10]=y,t[11]=g,t[12]=v,t[13]=m,t[14]=b,t[15]=_}function L(t,e){D(t,e,e)}function I(t,r){var n,i=e();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)L(i,i),2!==n&&4!==n&&D(i,i,r);for(n=0;n<16;n++)t[n]=i[n]}function K(t,r){var n,i=e();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)L(i,i),1!==n&&D(i,i,r);for(n=0;n<16;n++)t[n]=i[n]}function F(t,r,n){var i,o,s=new Uint8Array(32),c=new Float64Array(80),h=e(),u=e(),l=e(),f=e(),p=e(),d=e();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,B(c,n),o=0;o<16;o++)u[o]=c[o],f[o]=h[o]=l[o]=0;for(h[0]=f[0]=1,o=254;o>=0;--o)$(h,u,i=s[o>>>3]>>>(7&o)&1),$(l,f,i),N(p,h,l),M(h,h,l),N(l,u,f),M(u,u,f),L(f,p),L(d,h),D(h,l,h),D(l,u,p),N(p,h,l),M(h,h,l),L(u,h),M(l,f,d),D(h,l,a),N(h,h,f),D(l,l,h),D(h,f,d),D(f,u,c),L(u,p),$(h,u,i),$(l,f,i);for(o=0;o<16;o++)c[o+16]=h[o],c[o+32]=l[o],c[o+48]=u[o],c[o+64]=f[o];var y=c.subarray(32),g=c.subarray(16);return I(y,y),D(g,g,y),P(t,g),0}function z(t,e){return F(t,e,i)}function W(t,e){return r(e,32),z(t,e)}function Y(t,e,r){var i=new Uint8Array(32);return F(i,r,e),m(t,n,i,b)}T.prototype.blocks=function(t,e,r){for(var n,i,o,s,a,c,h,u,l,f,p,d,y,g,v,m,b,_,w,A=this.fin?0:2048,E=this.h[0],T=this.h[1],k=this.h[2],O=this.h[3],S=this.h[4],x=this.h[5],R=this.h[6],C=this.h[7],$=this.h[8],P=this.h[9],j=this.r[0],U=this.r[1],B=this.r[2],N=this.r[3],M=this.r[4],D=this.r[5],L=this.r[6],I=this.r[7],K=this.r[8],F=this.r[9];r>=16;)f=l=0,f+=(E+=8191&(n=255&t[e+0]|(255&t[e+1])<<8))*j,f+=(T+=8191&(n>>>13|(i=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*F),f+=(k+=8191&(i>>>10|(o=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*K),f+=(O+=8191&(o>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*I),l=(f+=(S+=8191&(s>>>4|(a=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*L))>>>13,f&=8191,f+=(x+=a>>>1&8191)*(5*D),f+=(R+=8191&(a>>>14|(c=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*M),f+=(C+=8191&(c>>>11|(h=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*N),f+=($+=8191&(h>>>8|(u=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*B),p=l+=(f+=(P+=u>>>5|A)*(5*U))>>>13,p+=E*U,p+=T*j,p+=k*(5*F),p+=O*(5*K),l=(p+=S*(5*I))>>>13,p&=8191,p+=x*(5*L),p+=R*(5*D),p+=C*(5*M),p+=$*(5*N),l+=(p+=P*(5*B))>>>13,p&=8191,d=l,d+=E*B,d+=T*U,d+=k*j,d+=O*(5*F),l=(d+=S*(5*K))>>>13,d&=8191,d+=x*(5*I),d+=R*(5*L),d+=C*(5*D),d+=$*(5*M),y=l+=(d+=P*(5*N))>>>13,y+=E*N,y+=T*B,y+=k*U,y+=O*j,l=(y+=S*(5*F))>>>13,y&=8191,y+=x*(5*K),y+=R*(5*I),y+=C*(5*L),y+=$*(5*D),g=l+=(y+=P*(5*M))>>>13,g+=E*M,g+=T*N,g+=k*B,g+=O*U,l=(g+=S*j)>>>13,g&=8191,g+=x*(5*F),g+=R*(5*K),g+=C*(5*I),g+=$*(5*L),v=l+=(g+=P*(5*D))>>>13,v+=E*D,v+=T*M,v+=k*N,v+=O*B,l=(v+=S*U)>>>13,v&=8191,v+=x*j,v+=R*(5*F),v+=C*(5*K),v+=$*(5*I),m=l+=(v+=P*(5*L))>>>13,m+=E*L,m+=T*D,m+=k*M,m+=O*N,l=(m+=S*B)>>>13,m&=8191,m+=x*U,m+=R*j,m+=C*(5*F),m+=$*(5*K),b=l+=(m+=P*(5*I))>>>13,b+=E*I,b+=T*L,b+=k*D,b+=O*M,l=(b+=S*N)>>>13,b&=8191,b+=x*B,b+=R*U,b+=C*j,b+=$*(5*F),_=l+=(b+=P*(5*K))>>>13,_+=E*K,_+=T*I,_+=k*L,_+=O*D,l=(_+=S*M)>>>13,_&=8191,_+=x*N,_+=R*B,_+=C*U,_+=$*j,w=l+=(_+=P*(5*F))>>>13,w+=E*F,w+=T*K,w+=k*I,w+=O*L,l=(w+=S*D)>>>13,w&=8191,w+=x*M,w+=R*N,w+=C*B,w+=$*U,E=f=8191&(l=(l=((l+=(w+=P*j)>>>13)<<2)+l|0)+(f&=8191)|0),T=p+=l>>>=13,k=d&=8191,O=y&=8191,S=g&=8191,x=v&=8191,R=m&=8191,C=b&=8191,$=_&=8191,P=w&=8191,e+=16,r-=16;this.h[0]=E,this.h[1]=T,this.h[2]=k,this.h[3]=O,this.h[4]=S,this.h[5]=x,this.h[6]=R,this.h[7]=C,this.h[8]=$,this.h[9]=P},T.prototype.finish=function(t,e){var r,n,i,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|s[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},T.prototype.update=function(t,e,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n<i;n++)this.buffer[this.leftover+n]=t[e+n];if(r-=i,e+=i,this.leftover+=i,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(r>=16&&(i=r-r%16,this.blocks(t,e,i),e+=i,r-=i),r){for(n=0;n<r;n++)this.buffer[this.leftover+n]=t[e+n];this.leftover+=r}};var q=S,H=x;var J=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function V(t,e,r,n){for(var i,o,s,a,c,h,u,l,f,p,d,y,g,v,m,b,_,w,A,E,T,k,O,S,x,R,C=new Int32Array(16),$=new Int32Array(16),P=t[0],j=t[1],U=t[2],B=t[3],N=t[4],M=t[5],D=t[6],L=t[7],I=e[0],K=e[1],F=e[2],z=e[3],W=e[4],Y=e[5],q=e[6],H=e[7],V=0;n>=128;){for(A=0;A<16;A++)E=8*A+V,C[A]=r[E+0]<<24|r[E+1]<<16|r[E+2]<<8|r[E+3],$[A]=r[E+4]<<24|r[E+5]<<16|r[E+6]<<8|r[E+7];for(A=0;A<80;A++)if(i=P,o=j,s=U,a=B,c=N,h=M,u=D,L,f=I,p=K,d=F,y=z,g=W,v=Y,m=q,H,O=65535&(k=H),S=k>>>16,x=65535&(T=L),R=T>>>16,O+=65535&(k=(W>>>14|N<<18)^(W>>>18|N<<14)^(N>>>9|W<<23)),S+=k>>>16,x+=65535&(T=(N>>>14|W<<18)^(N>>>18|W<<14)^(W>>>9|N<<23)),R+=T>>>16,O+=65535&(k=W&Y^~W&q),S+=k>>>16,x+=65535&(T=N&M^~N&D),R+=T>>>16,T=J[2*A],O+=65535&(k=J[2*A+1]),S+=k>>>16,x+=65535&T,R+=T>>>16,T=C[A%16],S+=(k=$[A%16])>>>16,x+=65535&T,R+=T>>>16,x+=(S+=(O+=65535&k)>>>16)>>>16,O=65535&(k=w=65535&O|S<<16),S=k>>>16,x=65535&(T=_=65535&x|(R+=x>>>16)<<16),R=T>>>16,O+=65535&(k=(I>>>28|P<<4)^(P>>>2|I<<30)^(P>>>7|I<<25)),S+=k>>>16,x+=65535&(T=(P>>>28|I<<4)^(I>>>2|P<<30)^(I>>>7|P<<25)),R+=T>>>16,S+=(k=I&K^I&F^K&F)>>>16,x+=65535&(T=P&j^P&U^j&U),R+=T>>>16,l=65535&(x+=(S+=(O+=65535&k)>>>16)>>>16)|(R+=x>>>16)<<16,b=65535&O|S<<16,O=65535&(k=y),S=k>>>16,x=65535&(T=a),R=T>>>16,S+=(k=w)>>>16,x+=65535&(T=_),R+=T>>>16,j=i,U=o,B=s,N=a=65535&(x+=(S+=(O+=65535&k)>>>16)>>>16)|(R+=x>>>16)<<16,M=c,D=h,L=u,P=l,K=f,F=p,z=d,W=y=65535&O|S<<16,Y=g,q=v,H=m,I=b,A%16==15)for(E=0;E<16;E++)T=C[E],O=65535&(k=$[E]),S=k>>>16,x=65535&T,R=T>>>16,T=C[(E+9)%16],O+=65535&(k=$[(E+9)%16]),S+=k>>>16,x+=65535&T,R+=T>>>16,_=C[(E+1)%16],O+=65535&(k=((w=$[(E+1)%16])>>>1|_<<31)^(w>>>8|_<<24)^(w>>>7|_<<25)),S+=k>>>16,x+=65535&(T=(_>>>1|w<<31)^(_>>>8|w<<24)^_>>>7),R+=T>>>16,_=C[(E+14)%16],S+=(k=((w=$[(E+14)%16])>>>19|_<<13)^(_>>>29|w<<3)^(w>>>6|_<<26))>>>16,x+=65535&(T=(_>>>19|w<<13)^(w>>>29|_<<3)^_>>>6),R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,C[E]=65535&x|R<<16,$[E]=65535&O|S<<16;O=65535&(k=I),S=k>>>16,x=65535&(T=P),R=T>>>16,T=t[0],S+=(k=e[0])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[0]=P=65535&x|R<<16,e[0]=I=65535&O|S<<16,O=65535&(k=K),S=k>>>16,x=65535&(T=j),R=T>>>16,T=t[1],S+=(k=e[1])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[1]=j=65535&x|R<<16,e[1]=K=65535&O|S<<16,O=65535&(k=F),S=k>>>16,x=65535&(T=U),R=T>>>16,T=t[2],S+=(k=e[2])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[2]=U=65535&x|R<<16,e[2]=F=65535&O|S<<16,O=65535&(k=z),S=k>>>16,x=65535&(T=B),R=T>>>16,T=t[3],S+=(k=e[3])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[3]=B=65535&x|R<<16,e[3]=z=65535&O|S<<16,O=65535&(k=W),S=k>>>16,x=65535&(T=N),R=T>>>16,T=t[4],S+=(k=e[4])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[4]=N=65535&x|R<<16,e[4]=W=65535&O|S<<16,O=65535&(k=Y),S=k>>>16,x=65535&(T=M),R=T>>>16,T=t[5],S+=(k=e[5])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[5]=M=65535&x|R<<16,e[5]=Y=65535&O|S<<16,O=65535&(k=q),S=k>>>16,x=65535&(T=D),R=T>>>16,T=t[6],S+=(k=e[6])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[6]=D=65535&x|R<<16,e[6]=q=65535&O|S<<16,O=65535&(k=H),S=k>>>16,x=65535&(T=L),R=T>>>16,T=t[7],S+=(k=e[7])>>>16,x+=65535&T,R+=T>>>16,R+=(x+=(S+=(O+=65535&k)>>>16)>>>16)>>>16,t[7]=L=65535&x|R<<16,e[7]=H=65535&O|S<<16,V+=128,n-=128}return n}function X(t,e,r){var n,i=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,V(i,o,e,r),r%=128,n=0;n<r;n++)s[n]=e[a-r+n];for(s[r]=128,s[(r=256-128*(r<112?1:0))-9]=0,p(s,r-8,a/536870912|0,a<<3),V(i,o,s,r),n=0;n<8;n++)p(t,8*n,i[n],o[n]);return 0}function G(t,r){var n=e(),i=e(),o=e(),s=e(),a=e(),c=e(),u=e(),l=e(),f=e();M(n,t[1],t[0]),M(f,r[1],r[0]),D(n,n,f),N(i,t[0],t[1]),N(f,r[0],r[1]),D(i,i,f),D(o,t[3],r[3]),D(o,o,h),D(s,t[2],r[2]),N(s,s,s),M(a,i,n),M(c,s,o),N(u,s,o),N(l,i,n),D(t[0],a,c),D(t[1],l,u),D(t[2],u,c),D(t[3],a,l)}function Q(t,e,r){var n;for(n=0;n<4;n++)$(t[n],e[n],r)}function Z(t,r){var n=e(),i=e(),o=e();I(o,r[2]),D(n,r[0],o),D(i,r[1],o),P(t,i),t[31]^=U(n)<<7}function tt(t,e,r){var n,i;for(R(t[0],o),R(t[1],s),R(t[2],s),R(t[3],o),i=255;i>=0;--i)Q(t,e,n=r[i/8|0]>>(7&i)&1),G(e,t),G(t,t),Q(t,e,n)}function et(t,r){var n=[e(),e(),e(),e()];R(n[0],u),R(n[1],l),R(n[2],s),D(n[3],u,l),tt(t,n,r)}function rt(t,n,i){var o,s=new Uint8Array(64),a=[e(),e(),e(),e()];for(i||r(n,32),X(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,et(a,s),Z(t,a),o=0;o<32;o++)n[o+32]=t[o];return 0}var nt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function it(t,e){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i<o;++i)e[i]+=r-16*e[n]*nt[i-(n-32)],r=Math.floor((e[i]+128)/256),e[i]-=256*r;e[i]+=r,e[n]=0}for(r=0,i=0;i<32;i++)e[i]+=r-(e[31]>>4)*nt[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*nt[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function ot(t){var e,r=new Float64Array(64);for(e=0;e<64;e++)r[e]=t[e];for(e=0;e<64;e++)t[e]=0;it(t,r)}function st(t,r,n,i){var o,s,a=new Uint8Array(64),c=new Uint8Array(64),h=new Uint8Array(64),u=new Float64Array(64),l=[e(),e(),e(),e()];X(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(o=0;o<n;o++)t[64+o]=r[o];for(o=0;o<32;o++)t[32+o]=a[32+o];for(X(h,t.subarray(32),n+32),ot(h),et(l,h),Z(t,l),o=32;o<64;o++)t[o]=i[o];for(X(c,t,n+64),ot(c),o=0;o<64;o++)u[o]=0;for(o=0;o<32;o++)u[o]=h[o];for(o=0;o<32;o++)for(s=0;s<32;s++)u[o+s]+=c[o]*a[s];return it(t.subarray(32),u),f}function at(t,r,n,i){var a,h=new Uint8Array(32),u=new Uint8Array(64),l=[e(),e(),e(),e()],p=[e(),e(),e(),e()];if(n<64)return-1;if(function(t,r){var n=e(),i=e(),a=e(),h=e(),u=e(),l=e(),p=e();return R(t[2],s),B(t[1],r),L(a,t[1]),D(h,a,c),M(a,a,t[2]),N(h,t[2],h),L(u,h),L(l,u),D(p,l,u),D(n,p,a),D(n,n,h),K(n,n),D(n,n,a),D(n,n,h),D(n,n,h),D(t[0],n,h),L(i,t[0]),D(i,i,h),j(i,a)&&D(t[0],t[0],f),L(i,t[0]),D(i,i,h),j(i,a)?-1:(U(t[0])===r[31]>>7&&M(t[0],o,t[0]),D(t[3],t[0],t[1]),0)}(p,i))return-1;for(a=0;a<n;a++)t[a]=r[a];for(a=0;a<32;a++)t[a+32]=i[a];if(X(u,t,n),ot(u),tt(l,p,u),et(p,r.subarray(32)),G(l,p),Z(h,l),n-=64,g(r,0,h,0)){for(a=0;a<n;a++)t[a]=0;return-1}for(a=0;a<n;a++)t[a]=r[a+64];return n}var ct=16,ht=64,lt=32,ft=64;function dt(t,e){if(32!==t.length)throw new Error("bad key size");if(24!==e.length)throw new Error("bad nonce size")}function yt(){for(var t=0;t<arguments.length;t++)if(!(arguments[t]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function gt(t){for(var e=0;e<t.length;e++)t[e]=0}t.lowlevel={crypto_core_hsalsa20:m,crypto_stream_xor:E,crypto_stream:A,crypto_stream_salsa20_xor:_,crypto_stream_salsa20:w,crypto_onetimeauth:k,crypto_onetimeauth_verify:O,crypto_verify_16:y,crypto_verify_32:g,crypto_secretbox:S,crypto_secretbox_open:x,crypto_scalarmult:F,crypto_scalarmult_base:z,crypto_box_beforenm:Y,crypto_box_afternm:q,crypto_box:function(t,e,r,n,i,o){var s=new Uint8Array(32);return Y(s,i,o),q(t,e,r,n,s)},crypto_box_open:function(t,e,r,n,i,o){var s=new Uint8Array(32);return Y(s,i,o),H(t,e,r,n,s)},crypto_box_keypair:W,crypto_hash:X,crypto_sign:st,crypto_sign_keypair:rt,crypto_sign_open:at,crypto_secretbox_KEYBYTES:32,crypto_secretbox_NONCEBYTES:24,crypto_secretbox_ZEROBYTES:32,crypto_secretbox_BOXZEROBYTES:ct,crypto_scalarmult_BYTES:32,crypto_scalarmult_SCALARBYTES:32,crypto_box_PUBLICKEYBYTES:32,crypto_box_SECRETKEYBYTES:32,crypto_box_BEFORENMBYTES:32,crypto_box_NONCEBYTES:24,crypto_box_ZEROBYTES:32,crypto_box_BOXZEROBYTES:16,crypto_sign_BYTES:ht,crypto_sign_PUBLICKEYBYTES:lt,crypto_sign_SECRETKEYBYTES:ft,crypto_sign_SEEDBYTES:32,crypto_hash_BYTES:64,gf:e,D:c,L:nt,pack25519:P,unpack25519:B,M:D,A:N,S:L,Z:M,pow2523:K,add:G,set25519:R,modL:it,scalarmult:tt,scalarbase:et},t.randomBytes=function(t){var e=new Uint8Array(t);return r(e,t),e},t.secretbox=function(t,e,r){yt(t,e,r),dt(r,e);for(var n=new Uint8Array(32+t.length),i=new Uint8Array(n.length),o=0;o<t.length;o++)n[o+32]=t[o];return S(i,n,n.length,e,r),i.subarray(ct)},t.secretbox.open=function(t,e,r){yt(t,e,r),dt(r,e);for(var n=new Uint8Array(ct+t.length),i=new Uint8Array(n.length),o=0;o<t.length;o++)n[o+ct]=t[o];return n.length<32||0!==x(i,n,n.length,e,r)?null:i.subarray(32)},t.secretbox.keyLength=32,t.secretbox.nonceLength=24,t.secretbox.overheadLength=ct,t.scalarMult=function(t,e){if(yt(t,e),32!==t.length)throw new Error("bad n size");if(32!==e.length)throw new Error("bad p size");var r=new Uint8Array(32);return F(r,t,e),r},t.scalarMult.base=function(t){if(yt(t),32!==t.length)throw new Error("bad n size");var e=new Uint8Array(32);return z(e,t),e},t.scalarMult.scalarLength=32,t.scalarMult.groupElementLength=32,t.box=function(e,r,n,i){var o=t.box.before(n,i);return t.secretbox(e,r,o)},t.box.before=function(t,e){yt(t,e),function(t,e){if(32!==t.length)throw new Error("bad public key size");if(32!==e.length)throw new Error("bad secret key size")}(t,e);var r=new Uint8Array(32);return Y(r,t,e),r},t.box.after=t.secretbox,t.box.open=function(e,r,n,i){var o=t.box.before(n,i);return t.secretbox.open(e,r,o)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var t=new Uint8Array(32),e=new Uint8Array(32);return W(t,e),{publicKey:t,secretKey:e}},t.box.keyPair.fromSecretKey=function(t){if(yt(t),32!==t.length)throw new Error("bad secret key size");var e=new Uint8Array(32);return z(e,t),{publicKey:e,secretKey:new Uint8Array(t)}},t.box.publicKeyLength=32,t.box.secretKeyLength=32,t.box.sharedKeyLength=32,t.box.nonceLength=24,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(t,e){if(yt(t,e),e.length!==ft)throw new Error("bad secret key size");var r=new Uint8Array(ht+t.length);return st(r,t,t.length,e),r},t.sign.open=function(t,e){if(yt(t,e),e.length!==lt)throw new Error("bad public key size");var r=new Uint8Array(t.length),n=at(r,t,t.length,e);if(n<0)return null;for(var i=new Uint8Array(n),o=0;o<i.length;o++)i[o]=r[o];return i},t.sign.detached=function(e,r){for(var n=t.sign(e,r),i=new Uint8Array(ht),o=0;o<i.length;o++)i[o]=n[o];return i},t.sign.detached.verify=function(t,e,r){if(yt(t,e,r),e.length!==ht)throw new Error("bad signature size");if(r.length!==lt)throw new Error("bad public key size");var n,i=new Uint8Array(ht+t.length),o=new Uint8Array(ht+t.length);for(n=0;n<ht;n++)i[n]=e[n];for(n=0;n<t.length;n++)i[n+ht]=t[n];return at(o,i,i.length,r)>=0},t.sign.keyPair=function(){var t=new Uint8Array(lt),e=new Uint8Array(ft);return rt(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(yt(t),t.length!==ft)throw new Error("bad secret key size");for(var e=new Uint8Array(lt),r=0;r<e.length;r++)e[r]=t[32+r];return{publicKey:e,secretKey:new Uint8Array(t)}},t.sign.keyPair.fromSeed=function(t){if(yt(t),32!==t.length)throw new Error("bad seed size");for(var e=new Uint8Array(lt),r=new Uint8Array(ft),n=0;n<32;n++)r[n]=t[n];return rt(e,r,!0),{publicKey:e,secretKey:r}},t.sign.publicKeyLength=lt,t.sign.secretKeyLength=ft,t.sign.seedLength=32,t.sign.signatureLength=ht,t.hash=function(t){yt(t);var e=new Uint8Array(64);return X(e,t,t.length),e},t.hash.hashLength=64,t.verify=function(t,e){return yt(t,e),0!==t.length&&0!==e.length&&(t.length===e.length&&0===d(t,0,e,0,t.length))},t.setPRNG=function(t){r=t},function(){var e="undefined"!=typeof self?self.crypto||self.msCrypto:null;if(e&&e.getRandomValues){t.setPRNG((function(t,r){var n,i=new Uint8Array(r);for(n=0;n<r;n+=65536)e.getRandomValues(i.subarray(n,n+Math.min(r-n,65536)));for(n=0;n<r;n++)t[n]=i[n];gt(i)}))}else void 0!==ut&&(e=pt)&&e.randomBytes&&t.setPRNG((function(t,r){var n,i=e.randomBytes(r);for(n=0;n<r;n++)t[n]=i[n];gt(i)}))}()}(t.exports?t.exports:self.nacl=self.nacl||{})}(Bt);var Nt=at(Bt.exports);const{encrypt:Mt,decrypt:Dt}=Pt,{box:Lt,randomBytes:It}=Nt,Kt=t=>t?.simpleError?t:{simpleError:{error:"unexpected_error",message:`${t}`}},Ft=t=>t&&"object"==typeof t&&!Array.isArray(t)&&!(t instanceof Date),zt=t=>"number"==typeof t&&!`${t}`.includes("."),Wt=(t,e="",r=[],n=".")=>{let i=[];const o=Array.isArray(e);return Object.entries(t).forEach((([t,s])=>{Ft(s)&&!r.includes(t)?i=[...i,...Wt(s,o?[...e,t]:`${e}${t}${n}`,r,n)]:i.push(o?[[...e,t],s]:[`${e}${t}`,s])})),i},Yt=t=>{const e=[],r=[];if(Array.isArray(t))t.forEach((t=>{Ft(t)?Wt(t).map((([t,n])=>{e.push(t),r.push(n)})):e.push(Array.isArray(t)?JSON.stringify(t):`${t}`)}));else{if(!Ft(t))return`${t}`;Wt(t).map((([t,n])=>{e.push(t),r.push(n)}))}return[...e.sort(),...r.map((t=>`${Array.isArray(t)?JSON.stringify(t):t}`)).sort()].join(",")},qt=t=>t&&"object"==typeof t?Array.isArray(t)?[...t]:{...t}:t,Ht=(t,e)=>it.listenTo(e,(e=>{"boolean"==typeof e&&t?.(e)}),!0),Jt=t=>new Promise((async e=>{try{e(await t())}catch(t){e()}}));const Vt=(t,e,r)=>{const n=Lt.keyPair(),i=It(Lt.nonceLength);return[`${y.from(n.publicKey).toString("base64")}.${y.from(i).toString("base64")}.${y.from(Lt(y.from(JSON.stringify([t,e]),"utf8"),i,y.from(r,"base64"),n.secretKey)).toString("base64")}`,[n.secretKey,n.publicKey]]},Xt=(t,e,r)=>{const[n,i]=t.split("."),o=Lt.open(y.from(i,"base64"),y.from(n,"base64"),y.from(e,"base64"),r);if(!o)throw"Decrypting e2e message failed";return JSON.parse(y.from(o).toString("utf8"))[0]},Gt=t=>y.from(t,"utf8").toString("base64"),Qt=Gt("MOSQUITO_TRANSPORT_FREEZER"),Zt=Gt("MOSQUITO_TRANSPORT_CACHE_PASSWORD"),te="DEFAULT_DB",ee="mongodb://127.0.0.1:27017",re={LOCAL_STORAGE:"local-storage"},ne={STICKY:"sticky",STICKY_NO_AWAIT:"sticky-no-await",STICKY_RELOAD:"sticky-reload",DEFAULT:"default",CACHE_NO_AWAIT:"cache-no-await",NO_CACHE_NO_AWAIT:"no-cache-no-await"},ie={DEFAULT:"default",NO_CACHE:"no-cache",NO_AWAIT:"no-await",NO_AWAIT_NO_CACHE:"no-await-no-cache",AWAIT_NO_CACHE:"await-no-cache",CACHE_NO_AWAIT:"cache-no-await"},oe={$SET:"$set",$PUSH:"$push",$PULL:"$pull",$UNSET:"$unset",$INC:"$inc",$MAX:"$max",$MIN:"$min",$MUL:"$mul",$RENAME:"$rename"},se=Object.values(oe),ae={$IN:"$in",$ALL:"$all",$NIN:"$nin",$GT:"$gt",$GTE:"$gte",$LT:"$lt",$LTE:"$lte",$TEXT:"$text",$NEAR:"$near",$TYPE:"$type",$SIZE:"$size"},ce=Object.values(ae),he=()=>/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,ue={PendingIte:0,AnyProcessIte:0,IS_CONNECTED:{},IS_TOKEN_READY:{},InitializedProject:{},ReleaseCacheData:void 0,AuthJWTToken:{},cacheStorageReducer:void 0,TokenRefreshTimer:{},LastTokenRefreshRef:{},StorageProcessID:0,InitiatedForcedToken:{},PendingFetchCollective:{pendingProcess:{},pendingResolution:{}},PendingDbReadCollective:{pendingProcess:{},pendingResolution:{}}},le={DatabaseStore:{},DatabaseRecords:{},DatabaseCountResult:{},AuthStore:{},PendingWrites:{},FetchedStore:{}},fe={...le},pe=()=>{try{window}catch(t){return}const{cachePassword:t=Zt,cacheProtocol:e=re.LOCAL_STORAGE}=ue.ReleaseCacheData;clearTimeout(ue.cacheStorageReducer),ue.cacheStorageReducer=setTimeout((()=>{const r=((t,e,r)=>Mt(t,`${e||""}${r||""}`).toString())(JSON.stringify({...le}),t,t);e===re.LOCAL_STORAGE&&window.localStorage.setItem(Qt,r)}),500)},de=async t=>{try{window}catch(t){return}const{cachePassword:e=Zt,cacheProtocol:r=re.LOCAL_STORAGE}=t;let n;r===re.LOCAL_STORAGE&&(n=window.localStorage.getItem(Qt));const i=JSON.parse(((t,e,r)=>Dt(t,`${e||""}${r||""}`).toString(Ut))(n||"",e,e)||"{}");Object.entries(i).forEach((([t,e])=>{le[t]=e})),Object.entries(le.AuthStore).forEach((([t,e])=>{ue.AuthJWTToken[t]=e?.token})),ue.IsStoreReady=!0,nt.dispatch("_","ready")},ye=()=>new Promise((t=>{if(ue.IsStoreReady)return void t();const e=nt.listenTo("_",(r=>{"ready"===r&&(t(),e())}),!0)})),ge=t=>new Promise((e=>{if(ue.IS_CONNECTED[t])return void e();const r=it.listenTo(t,(t=>{t&&(e(),r())}),!0)})),ve=t=>new Promise((e=>{if("boolean"==typeof ue.IS_CONNECTED[t])return void e(ue.IS_CONNECTED[t]);const r=it.listenTo(t,(t=>{"boolean"==typeof t&&(e(t),r())}),!0)})),me=({body:t,accessKey:e,authToken:r,method:n,uglify:i,serverE2E_PublicKey:o})=>{i||(t=JSON.stringify({...t}));const[s,a]=i?Vt(t,r,o):[void 0,[]];return[{body:i?s:t,cache:"no-cache",headers:{"Content-type":i?"text/plain":"application/json",Authorization:e,...r&&!i?{"Mosquito-Token":r}:{}},method:n||"POST"},a]},be=(t,e)=>({simpleError:{error:t,message:e}}),_e=Object.create(null);_e.open="0",_e.close="1",_e.ping="2",_e.pong="3",_e.message="4",_e.upgrade="5",_e.noop="6";const we=Object.create(null);Object.keys(_e).forEach((t=>{we[_e[t]]=t}));const Ae={type:"error",data:"parser error"},Ee="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Te="function"==typeof ArrayBuffer,ke=({type:t,data:e},r,n)=>{return Ee&&e instanceof Blob?r?n(e):Oe(e,n):Te&&(e instanceof ArrayBuffer||(i=e,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer))?r?n(e):Oe(new Blob([e]),n):n(_e[t]+(e||""));var i},Oe=(t,e)=>{const r=new FileReader;return r.onload=function(){const t=r.result.split(",")[1];e("b"+(t||""))},r.readAsDataURL(t)},Se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xe="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let t=0;t<64;t++)xe[Se.charCodeAt(t)]=t;const Re="function"==typeof ArrayBuffer,Ce=(t,e)=>{if("string"!=typeof t)return{type:"message",data:Pe(t,e)};const r=t.charAt(0);if("b"===r)return{type:"message",data:$e(t.substring(1),e)};return we[r]?t.length>1?{type:we[r],data:t.substring(1)}:{type:we[r]}:Ae},$e=(t,e)=>{if(Re){const r=(t=>{let e,r,n,i,o,s=.75*t.length,a=t.length,c=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);const h=new ArrayBuffer(s),u=new Uint8Array(h);for(e=0;e<a;e+=4)r=xe[t.charCodeAt(e)],n=xe[t.charCodeAt(e+1)],i=xe[t.charCodeAt(e+2)],o=xe[t.charCodeAt(e+3)],u[c++]=r<<2|n>>4,u[c++]=(15&n)<<4|i>>2,u[c++]=(3&i)<<6|63&o;return h})(t);return Pe(r,e)}return{base64:!0,data:t}},Pe=(t,e)=>"blob"===e&&t instanceof ArrayBuffer?new Blob([t]):t,je=String.fromCharCode(30);function Ue(t){if(t)return function(t){for(var e in Ue.prototype)t[e]=Ue.prototype[e];return t}(t)}Ue.prototype.on=Ue.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Ue.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},Ue.prototype.off=Ue.prototype.removeListener=Ue.prototype.removeAllListeners=Ue.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i=0;i<n.length;i++)if((r=n[i])===e||r.fn===e){n.splice(i,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},Ue.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,e)}return this},Ue.prototype.emitReserved=Ue.prototype.emit,Ue.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Ue.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Be="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function Ne(t,...e){return e.reduce(((e,r)=>(t.hasOwnProperty(r)&&(e[r]=t[r]),e)),{})}const Me=Be.setTimeout,De=Be.clearTimeout;function Le(t,e){e.useNativeTimers?(t.setTimeoutFn=Me.bind(Be),t.clearTimeoutFn=De.bind(Be)):(t.setTimeoutFn=Be.setTimeout.bind(Be),t.clearTimeoutFn=Be.clearTimeout.bind(Be))}class Ie extends Error{constructor(t,e,r){super(t),this.description=e,this.context=r,this.type="TransportError"}}class Ke extends Ue{constructor(t){super(),this.writable=!1,Le(this,t),this.opts=t,this.query=t.query,this.socket=t.socket}onError(t,e,r){return super.emitReserved("error",new Ie(t,e,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(t){"open"===this.readyState&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const e=Ce(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}}const Fe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),ze=64,We={};let Ye,qe=0,He=0;function Je(t){let e="";do{e=Fe[t%ze]+e,t=Math.floor(t/ze)}while(t>0);return e}function Ve(){const t=Je(+new Date);return t!==Ye?(qe=0,Ye=t):t+"."+Je(qe++)}for(;He<ze;He++)We[Fe[He]]=He;function Xe(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}let Ge=!1;try{Ge="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){}const Qe=Ge;function Ze(t){const e=t.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!e||Qe))return new XMLHttpRequest}catch(t){}if(!e)try{return new(Be[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}function tr(){}const er=null!=new Ze({xdomain:!1}).responseType;class rr extends Ue{constructor(t,e){super(),Le(this,e),this.opts=e,this.method=e.method||"GET",this.uri=t,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.create()}create(){const t=Ne(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd,t.xscheme=!!this.opts.xs;const e=this.xhr=new Ze(t);try{e.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(let t in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(t)&&e.setRequestHeader(t,this.opts.extraHeaders[t])}}catch(t){}if("POST"===this.method)try{e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{e.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in e&&(e.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(e.timeout=this.opts.requestTimeout),e.onreadystatechange=()=>{4===e.readyState&&(200===e.status||1223===e.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof e.status?e.status:0)}),0))},e.send(this.data)}catch(t){return void this.setTimeoutFn((()=>{this.onError(t)}),0)}"undefined"!=typeof document&&(this.index=rr.requestsCount++,rr.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=tr,t)try{this.xhr.abort()}catch(t){}"undefined"!=typeof document&&delete rr.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;null!==t&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(rr.requestsCount=0,rr.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",nr);else if("function"==typeof addEventListener){addEventListener("onpagehide"in Be?"pagehide":"unload",nr,!1)}function nr(){for(let t in rr.requests)rr.requests.hasOwnProperty(t)&&rr.requests[t].abort()}const ir="function"==typeof Promise&&"function"==typeof Promise.resolve?t=>Promise.resolve().then(t):(t,e)=>e(t,0),or=Be.WebSocket||Be.MozWebSocket,sr="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const ar={websocket:class extends Ke{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),e=this.opts.protocols,r=sr?{}:Ne(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=sr?new or(t,e,r):e?new or(t,e):new or(t)}catch(t){return this.emitReserved("error",t)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){const r=t[e],n=e===t.length-1;ke(r,this.supportsBinary,(t=>{try{this.ws.send(t)}catch(t){}n&&ir((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let t=this.query||{};const e=this.opts.secure?"wss":"ws";let r="";this.opts.port&&("wss"===e&&443!==Number(this.opts.port)||"ws"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port),this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ve()),this.supportsBinary||(t.b64=1);const n=Xe(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}check(){return!!or}},polling:class extends Ke{constructor(t){if(super(t),this.polling=!1,"undefined"!=typeof location){const e="https:"===location.protocol;let r=location.port;r||(r=e?"443":"80"),this.xd="undefined"!=typeof location&&t.hostname!==location.hostname||r!==t.port,this.xs=t.secure!==e}const e=t&&t.forceBase64;this.supportsBinary=er&&!e}get name(){return"polling"}doOpen(){this.poll()}pause(t){this.readyState="pausing";const e=()=>{this.readyState="paused",t()};if(this.polling||!this.writable){let t=0;this.polling&&(t++,this.once("pollComplete",(function(){--t||e()}))),this.writable||(t++,this.once("drain",(function(){--t||e()})))}else e()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){((t,e)=>{const r=t.split(je),n=[];for(let t=0;t<r.length;t++){const i=Ce(r[t],e);if(n.push(i),"error"===i.type)break}return n})(t,this.socket.binaryType).forEach((t=>{if("opening"===this.readyState&&"open"===t.type&&this.onOpen(),"close"===t.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};"open"===this.readyState?t():this.once("open",t)}write(t){this.writable=!1,((t,e)=>{const r=t.length,n=new Array(r);let i=0;t.forEach(((t,o)=>{ke(t,!1,(t=>{n[o]=t,++i===r&&e(n.join(je))}))}))})(t,(t=>{this.doWrite(t,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){let t=this.query||{};const e=this.opts.secure?"https":"http";let r="";!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ve()),this.supportsBinary||t.sid||(t.b64=1),this.opts.port&&("https"===e&&443!==Number(this.opts.port)||"http"===e&&80!==Number(this.opts.port))&&(r=":"+this.opts.port);const n=Xe(t);return e+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(n.length?"?"+n:"")}request(t={}){return Object.assign(t,{xd:this.xd,xs:this.xs},this.opts),new rr(this.uri(),t)}doWrite(t,e){const r=this.request({method:"POST",data:t});r.on("success",e),r.on("error",((t,e)=>{this.onError("xhr post error",t,e)}))}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",((t,e)=>{this.onError("xhr poll error",t,e)})),this.pollXhr=t}}},cr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,hr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ur(t){const e=t,r=t.indexOf("["),n=t.indexOf("]");-1!=r&&-1!=n&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));let i=cr.exec(t||""),o={},s=14;for(;s--;)o[hr[s]]=i[s]||"";return-1!=r&&-1!=n&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(t,e){const r=/\/{2,9}/g,n=e.replace(r,"/").split("/");"/"!=e.slice(0,1)&&0!==e.length||n.splice(0,1);"/"==e.slice(-1)&&n.splice(n.length-1,1);return n}(0,o.path),o.queryKey=function(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(t,e,n){e&&(r[e]=n)})),r}(0,o.query),o}let lr=class t extends Ue{constructor(t,e={}){super(),this.writeBuffer=[],t&&"object"==typeof t&&(e=t,t=null),t?(t=ur(t),e.hostname=t.host,e.secure="https"===t.protocol||"wss"===t.protocol,e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=ur(e.host).host),Le(this,e),this.secure=null!=e.secure?e.secure:"undefined"!=typeof location&&"https:"===location.protocol,e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=e.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=e.transports||["polling","websocket"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(t){let e={},r=t.split("&");for(let t=0,n=r.length;t<n;t++){let n=r[t].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const e=Object.assign({},this.opts.query);e.EIO=4,e.transport=t,this.id&&(e.sid=this.id);const r=Object.assign({},this.opts.transportOptions[t],this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new ar[t](r)}open(){let e;if(this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(t){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(t=>this.onClose("transport close",t)))}probe(e){let r=this.createTransport(e),n=!1;t.priorWebsocketSuccess=!1;const i=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;t.priorWebsocketSuccess="websocket"===r.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(u(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())}))}else{const t=new Error("probe error");t.transport=r.name,this.emitReserved("upgradeError",t)}})))};function o(){n||(n=!0,u(),r.close(),r=null)}const s=t=>{const e=new Error("probe error: "+t);e.transport=r.name,o(),this.emitReserved("upgradeError",e)};function a(){s("transport closed")}function c(){s("socket closed")}function h(t){r&&t.name!==r.name&&o()}const u=()=>{r.removeListener("open",i),r.removeListener("error",s),r.removeListener("close",a),this.off("close",c),this.off("upgrading",h)};r.once("open",i),r.once("error",s),r.once("close",a),this.once("close",c),this.once("upgrading",h),r.open()}onOpen(){if(this.readyState="open",t.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let t=0;const e=this.upgrades.length;for(;t<e;t++)this.probe(this.upgrades[t])}}onPacket(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data)}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.maxPayload=t.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){const n=this.writeBuffer[r].data;if(n&&(t+="string"==typeof(e=n)?function(t){let e=0,r=0;for(let n=0,i=t.length;n<i;n++)e=t.charCodeAt(n),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}var e;return this.writeBuffer}write(t,e,r){return this.sendPacket("message",t,e,r),this}send(t,e,r){return this.sendPacket("message",t,e,r),this}sendPacket(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const i={type:t,data:e,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),t()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():t()})):this.upgrading?r():t()),this}onError(e){t.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(t,e){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,e),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const e=[];let r=0;const n=t.length;for(;r<n;r++)~this.transports.indexOf(t[r])&&e.push(t[r]);return e}};lr.protocol=4;const fr="function"==typeof ArrayBuffer,pr=t=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,dr=Object.prototype.toString,yr="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===dr.call(Blob),gr="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===dr.call(File);function vr(t){return fr&&(t instanceof ArrayBuffer||pr(t))||yr&&t instanceof Blob||gr&&t instanceof File}function mr(t,e){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let e=0,r=t.length;e<r;e++)if(mr(t[e]))return!0;return!1}if(vr(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return mr(t.toJSON(),!0);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&mr(t[e]))return!0;return!1}function br(t){const e=[],r=t.data,n=t;return n.data=_r(r,e),n.attachments=e.length,{packet:n,buffers:e}}function _r(t,e){if(!t)return t;if(vr(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}if(Array.isArray(t)){const r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=_r(t[n],e);return r}if("object"==typeof t&&!(t instanceof Date)){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=_r(t[n],e));return r}return t}function wr(t,e){return t.data=Ar(t.data,e),delete t.attachments,t}function Ar(t,e){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=Ar(t[r],e);else if("object"==typeof t)for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=Ar(t[r],e));return t}const Er=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Tr;!function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"}(Tr||(Tr={}));function kr(t){return"[object Object]"===Object.prototype.toString.call(t)}class Or extends Ue{constructor(t){super(),this.reviver=t}add(t){let e;if("string"==typeof t){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);const r=e.type===Tr.BINARY_EVENT;r||e.type===Tr.BINARY_ACK?(e.type=r?Tr.EVENT:Tr.ACK,this.reconstructor=new Sr(e),0===e.attachments&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else{if(!vr(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e))}}decodeString(t){let e=0;const r={type:Number(t.charAt(0))};if(void 0===Tr[r.type])throw new Error("unknown packet type "+r.type);if(r.type===Tr.BINARY_EVENT||r.type===Tr.BINARY_ACK){const n=e+1;for(;"-"!==t.charAt(++e)&&e!=t.length;);const i=t.substring(n,e);if(i!=Number(i)||"-"!==t.charAt(e))throw new Error("Illegal attachments");r.attachments=Number(i)}if("/"===t.charAt(e+1)){const n=e+1;for(;++e;){if(","===t.charAt(e))break;if(e===t.length)break}r.nsp=t.substring(n,e)}else r.nsp="/";const n=t.charAt(e+1);if(""!==n&&Number(n)==n){const n=e+1;for(;++e;){const r=t.charAt(e);if(null==r||Number(r)!=r){--e;break}if(e===t.length)break}r.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){const n=this.tryParse(t.substr(e));if(!Or.isPayloadValid(r.type,n))throw new Error("invalid payload");r.data=n}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch(t){return!1}}static isPayloadValid(t,e){switch(t){case Tr.CONNECT:return kr(e);case Tr.DISCONNECT:return void 0===e;case Tr.CONNECT_ERROR:return"string"==typeof e||kr(e);case Tr.EVENT:case Tr.BINARY_EVENT:return Array.isArray(e)&&("number"==typeof e[0]||"string"==typeof e[0]&&-1===Er.indexOf(e[0]));case Tr.ACK:case Tr.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Sr{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const t=wr(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var xr=Object.freeze({__proto__:null,Decoder:Or,Encoder:class{constructor(t){this.replacer=t}encode(t){return t.type!==Tr.EVENT&&t.type!==Tr.ACK||!mr(t)?[this.encodeAsString(t)]:this.encodeAsBinary({type:t.type===Tr.EVENT?Tr.BINARY_EVENT:Tr.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id})}encodeAsString(t){let e=""+t.type;return t.type!==Tr.BINARY_EVENT&&t.type!==Tr.BINARY_ACK||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){const e=br(t),r=this.encodeAsString(e.packet),n=e.buffers;return n.unshift(r),n}},get PacketType(){return Tr},protocol:5});function Rr(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const Cr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $r extends Ue{constructor(t,e,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Rr(t,"open",this.onopen.bind(this)),Rr(t,"packet",this.onpacket.bind(this)),Rr(t,"error",this.onerror.bind(this)),Rr(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){if(Cr.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const r={type:Tr.EVENT,data:e,options:{}};if(r.options.compress=!1!==this.flags.compress,"function"==typeof e[e.length-1]){const t=this.ids++,n=e.pop();this._registerAckCallback(t,n),r.id=t}const n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(t,e){var r;const n=null!==(r=this.flags.timeout)&&void 0!==r?r:this._opts.ackTimeout;if(void 0===n)return void(this.acks[t]=e);const i=this.io.setTimeoutFn((()=>{delete this.acks[t];for(let e=0;e<this.sendBuffer.length;e++)this.sendBuffer[e].id===t&&this.sendBuffer.splice(e,1);e.call(this,new Error("operation has timed out"))}),n);this.acks[t]=(...t)=>{this.io.clearTimeoutFn(i),e.apply(this,[null,...t])}}emitWithAck(t,...e){const r=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((n,i)=>{e.push(((t,e)=>r?t?i(t):n(e):n(t))),this.emit(t,...e)}))}_addToQueue(t){let e;"function"==typeof t[t.length-1]&&(e=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push(((t,...n)=>{if(r!==this._queue[0])return;return null!==t?r.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(t)):(this._queue.shift(),e&&e(null,...n)),r.pending=!1,this._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||0===this._queue.length)return;const e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){"function"==typeof this.auth?this.auth((t=>{this._sendConnectPacket(t)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Tr.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Tr.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Tr.EVENT:case Tr.BINARY_EVENT:this.onevent(t);break;case Tr.ACK:case Tr.BINARY_ACK:this.onack(t);break;case Tr.DISCONNECT:this.ondisconnect();break;case Tr.CONNECT_ERROR:this.destroy();const e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e)}}onevent(t){const e=t.data||[];null!=t.id&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const r of e)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&"string"==typeof t[t.length-1]&&(this._lastOffset=t[t.length-1])}ack(t){const e=this;let r=!1;return function(...n){r||(r=!0,e.packet({type:Tr.ACK,id:t,data:n}))}}onack(t){const e=this.acks[t.id];"function"==typeof e&&(e.apply(this,t.data),delete this.acks[t.id])}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((t=>this.emitEvent(t))),this.receiveBuffer=[],this.sendBuffer.forEach((t=>{this.notifyOutgoingListeners(t),this.packet(t)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((t=>t())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Tr.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const e=this._anyListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const e=this._anyOutgoingListeners;for(let r=0;r<e.length;r++)if(t===e[r])return e.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const r of e)r.apply(this,t.data)}}}function Pr(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Pr.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=1&Math.floor(10*e)?t+r:t-r}return 0|Math.min(t,this.max)},Pr.prototype.reset=function(){this.attempts=0},Pr.prototype.setMin=function(t){this.ms=t},Pr.prototype.setMax=function(t){this.max=t},Pr.prototype.setJitter=function(t){this.jitter=t};class jr extends Ue{constructor(t,e){var r;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.opts=e,Le(this,e),this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=e.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new Pr({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this._readyState="closed",this.uri=t;const n=e.parser||xr;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==e.autoConnect,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return void 0===t?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return void 0===t?this._reconnectionDelay:(this._reconnectionDelay=t,null===(e=this.backoff)||void 0===e||e.setMin(t),this)}randomizationFactor(t){var e;return void 0===t?this._randomizationFactor:(this._randomizationFactor=t,null===(e=this.backoff)||void 0===e||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return void 0===t?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,null===(e=this.backoff)||void 0===e||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new lr(this.uri,this.opts);const e=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=Rr(e,"open",(function(){r.onopen(),t&&t()})),i=Rr(e,"error",(e=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",e),t?t(e):r.maybeReconnectOnOpen()}));if(!1!==this._timeout){const t=this._timeout;0===t&&n();const r=this.setTimeoutFn((()=>{n(),e.close(),e.emit("error",new Error("timeout"))}),t);this.opts.autoUnref&&r.unref(),this.subs.push((function(){clearTimeout(r)}))}return this.subs.push(n),this.subs.push(i),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Rr(t,"ping",this.onping.bind(this)),Rr(t,"data",this.ondata.bind(this)),Rr(t,"error",this.onerror.bind(this)),Rr(t,"close",this.onclose.bind(this)),Rr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(t){this.onclose("parse error",t)}}ondecoded(t){ir((()=>{this.emitReserved("packet",t)}),this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new $r(this,t,e),this.nsps[t]=r),r}_destroy(t){const e=Object.keys(this.nsps);for(const t of e){if(this.nsps[t].active)return}this._close()}_packet(t){const e=this.encoder.encode(t);for(let r=0;r<e.length;r++)this.engine.write(e[r],t.options)}cleanup(){this.subs.forEach((t=>t())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,e){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),t.skipReconnect||t.open((e=>{e?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",e)):t.onreconnect()})))}),e);this.opts.autoUnref&&r.unref(),this.subs.push((function(){clearTimeout(r)}))}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Ur={};function Br(t,e){"object"==typeof t&&(e=t,t=void 0);const r=function(t,e="",r){let n=t;r=r||"undefined"!=typeof location&&location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(t=void 0!==r?r.protocol+"//"+t:"https://"+t),n=ur(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+e,n.href=n.protocol+"://"+i+(r&&r.port===n.port?"":":"+n.port),n}(t,(e=e||{}).path||"/socket.io"),n=r.source,i=r.id,o=r.path,s=Ur[i]&&o in Ur[i].nsps;let a;return e.forceNew||e["force new connection"]||!1===e.multiplex||s?a=new jr(n,e):(Ur[i]||(Ur[i]=new jr(n,e)),a=Ur[i]),r.query&&!e.query&&(e.query=r.queryKey),a.socket(r.path,e)}Object.assign(Br,{Manager:jr,Socket:$r,io:Br,connect:Br});const Nr={_readDocument:(t,e)=>`${t}/${e?Gt(Nr._readDocument(t)):"_readDocument"}`,_writeDocument:(t,e)=>`${t}/${e?Gt(Nr._writeDocument(t)):"_writeDocument"}`,_deleteCollection:(t,e)=>`${t}/${e?Gt(Nr._deleteCollection(t)):"_deleteCollection"}`,_queryCollection:(t,e)=>`${t}/${e?Gt(Nr._queryCollection(t)):"_queryCollection"}`,_writeMapDocument:(t,e)=>`${t}/${e?Gt(Nr._writeMapDocument(t)):"_writeMapDocument"}`,_customSignin:(t,e)=>`${t}/${e?Gt(Nr._customSignin(t)):"_customSignin"}`,_customSignup:(t,e)=>`${t}/${e?Gt(Nr._customSignup(t)):"_customSignup"}`,_googleSignin:(t,e)=>`${t}/${e?Gt(Nr._googleSignin(t)):"_googleSignin"}`,_appleSignin:(t,e)=>`${t}/${e?Gt(Nr._appleSignin(t)):"_appleSignin"}`,_facebookSignin:(t,e)=>`${t}/${e?Gt(Nr._facebookSignin(t)):"_facebookSignin"}`,_twitterSignin:(t,e)=>`${t}/${e?Gt(Nr._twitterSignin(t)):"_twitterSignin"}`,_githubSignin:(t,e)=>`${t}/${e?Gt(Nr._githubSignin(t)):"_githubSignin"}`,_signOut:(t,e)=>`${t}/${e?Gt(Nr._signOut(t)):"_signOut"}`,_invalidateToken:(t,e)=>`${t}/${e?Gt(Nr._invalidateToken(t)):"_invalidateToken"}`,_refreshAuthToken:(t,e)=>`${t}/${e?Gt(Nr._refreshAuthToken(t)):"_refreshAuthToken"}`,_downloadFile:(t,e)=>`${t}/${e?Gt(Nr._downloadFile(t)):"_downloadFile"}`,_uploadFile:(t,e)=>`${t}/${e?Gt(Nr._uploadFile(t)):"_uploadFile"}`,_deleteFile:(t,e)=>`${t}/${e?Gt(Nr._deleteFile(t)):"_deleteFile"}`,_deleteFolder:(t,e)=>`${t}/${e?Gt(Nr._deleteFolder(t)):"_deleteFolder"}`,staticStorage:(t,e)=>`${t}/${e?Gt(Nr.staticStorage(t)):"storage"}`,_documentCount:(t,e)=>`${t}/${e?Gt(Nr._documentCount(t)):"_documentCount"}`,_areYouOk:(t,e)=>`${t}/${e?Gt(Nr._areYouOk(t)):"_areYouOk"}`,_listenCollection:t=>`${t?Gt(Nr._listenCollection()):"_listenCollection"}`,_listenDocument:t=>`${t?Gt(Nr._listenDocument()):"_listenDocument"}`,_startDisconnectWriteTask:t=>`${t?Gt(Nr._startDisconnectWriteTask()):"_startDisconnectWriteTask"}`,_cancelDisconnectWriteTask:t=>`${t?Gt(Nr._cancelDisconnectWriteTask()):"_cancelDisconnectWriteTask"}`,_listenUserVerification:t=>`${t?Gt(Nr._listenUserVerification()):"_listenUserVerification"}`};var Mr={...Nr};const Dr=2147483647,Lr=(t,e)=>{let r;if(e>=Dr){const n=setTimeout((()=>{r=Lr(t,e-Dr)}),Dr);r=()=>{clearTimeout(n)}}else{const n=setTimeout(t,e);r=()=>{clearTimeout(n)}}return()=>{r()}};var Ir=at(Lr);const Kr=(t,e)=>et.listenTo(e,((e,r)=>{void 0!==e&&t?.(e||null,r)}),!0),Fr=async(t,{token:e,refreshToken:r})=>{const{projectUrl:n}=t;le.AuthStore[n]={token:e,refreshToken:r},ue.AuthJWTToken[n]=e,pe(),Wr(n),qr(t)},zr=t=>{return JSON.parse((e=t.split(".")[1],y.from(e,"base64").toString("utf8")));var e},Wr=async(t,e)=>{await ye(),et.dispatch(t,le.AuthStore[t]?.token||null,e)},Yr=t=>new Promise((e=>{const r=rt.listenTo(t,(t=>{"ready"===t&&(r(),e())}),!0)})),qr=async(t,e)=>{const{projectUrl:r,maxRetries:n}=t;await ye();const{token:i}=le.AuthStore[r]||{},o=i?zr(i):void 0;if(ue.TokenRefreshTimer[r]?.(),i){const i=Date.now()>=1e3*o.exp-6e4,s=()=>Hr(t,++ue.LastTokenRefreshRef[r],n,n,e);if(i||e)return rt.dispatch(r),s();rt.dispatch(r,"ready"),ue.TokenRefreshTimer[r]=Ir((()=>{rt.dispatch(r),s()}),1e3*o.exp-6e4-Date.now())}else if(e)return rt.dispatch(r,"ready"),be("no_token_yet","No token is available to initiate a refresh").simpleError},Hr=(t,e,r=7,n=7,i)=>new Promise((async(o,s)=>{const{projectUrl:a,serverE2E_PublicKey:c,accessKey:h,uglify:u}=t,l=be("process_lost","The token refresh process has been lost and replace with another one");try{const{token:r,refreshToken:n}=le.AuthStore[a],[f,[p]]=me({body:{token:r,r_token:n},accessKey:h,uglify:u,serverE2E_PublicKey:c}),d=await(await fetch(Mr._refreshAuthToken(a,u),f)).json();if(e!==ue.LastTokenRefreshRef[a])return void s(l.simpleError);if(d.simpleError)throw d;const y=u?Xt(d.e2e,c,p):d;le.AuthStore[a]?(le.AuthStore[a].token=y.result.token,ue.AuthJWTToken[a]=y.result.token,o(y.result.token),Wr(a,!ue.InitiatedForcedToken[a]&&i),i&&(ue.InitiatedForcedToken[a]=!0),pe(),qr(t),Jr(t,r)):s(l.simpleError)}catch(i){if(i.simpleError)console.error(`refreshToken error: ${i.simpleError?.message}`),nn({...t}),s(i.simpleError);else if(r<=0)s(e===ue.LastTokenRefreshRef[a]?l.simpleError:be("retry_limit_reached","The retry limit has been reach and execution prematurely stopped").simpleError),console.error("refreshToken retry exceeded, waiting for 2min before starting another retry");else{const i=Ht((c=>{e!==ue.LastTokenRefreshRef[a]?(s(l.simpleError),i()):c&&(i(),Hr(t,e,r-1,n).then(o,s))}),a)}}})),Jr=async(t,e)=>{try{const{projectUrl:r,accessKey:n,uglify:i,serverE2E_PublicKey:o}=t;await ge(r);const[s]=me({body:{token:e},accessKey:n,uglify:i,serverE2E_PublicKey:o}),a=await(await fetch(Mr._invalidateToken(r,i),s)).json();if(a.simpleError)throw a}catch(t){throw Kt(t).simpleError}},{_listenUserVerification:Vr,_signOut:Xr,_customSignin:Gr,_customSignup:Qr,_googleSignin:Zr}=Mr;class tn{constructor(t){this.builder={...t}}customSignin=(t,e)=>en(this.builder,t,e);customSignup=(t,e,r,n)=>rn(this.builder,t,e,r,n);googleSignin=t=>on(this.builder,t);appleSignin(){}facebookSignin(){}twitterSignin(){}githubSignin(){}listenVerifiedStatus(t,e){const{projectUrl:r,serverE2E_PublicKey:n,uglify:i,baseUrl:o,wsPrefix:s}=this.builder;let a,c,h=ue.AuthJWTToken[r]||null,u=0;const l=async()=>{const h=++u;if(await Yr(r),!ue.AuthJWTToken[r])return void e?.(be("user_login_required","You must be signed-in to use this method").simpleError);if(h!==u)return;const l=ue.AuthJWTToken[r],[f,[p]]=i?Vt({mtoken:l},void 0,n):[null,[]];a=Br(`${s}://${o}`,{auth:i?{e2e:f,_m_internal:!0}:{mtoken:l,_m_internal:!0},transports:["websocket","polling","flashsocket"]}),a.emit(Vr(i)),a.on("onVerificationChanged",(([r,o])=>{const s=r?Kt(r).simpleError:void 0;s?e?.(s):t?.(i?Xt(o,n,p):o)})),a.on("connect",(()=>{c&&a.emit(Vr(i))})),a.on("disconnect",(()=>{c=!0}))};l();const f=Kr((t=>{(t||null)!==h&&(a?.close?.(),c=void 0,l()),h=t}),r);return()=>{a?.close?.(),f?.()}}listenAuthToken=t=>Kr(t,this.builder.projectUrl);getAuthToken=()=>new Promise((t=>{const e=Kr((r=>{e(),t(r||null)}),this.builder.projectUrl)}));listenAuth=t=>{let e;return Kr(((r,n)=>{const{refreshToken:i}=le.AuthStore[this.builder.projectUrl]||{};((!!r||null)!==e||n)&&t(r?{...zr(r),tokenManager:{refreshToken:i,accessToken:r}}:null),e=!!r||null}),this.builder.projectUrl)};getAuth=()=>new Promise((t=>{const e=this.listenAuth((r=>{e(),t(r)}))}));signOut=()=>nn(this.builder);forceRefreshToken=()=>qr(this.builder,!0)}const en=(t,e,r)=>new Promise((async(n,i)=>{const{projectUrl:o,serverE2E_PublicKey:s,accessKey:a,uglify:c}=t;try{await ye();const[i,[h]]=me({body:{_:`${Gt(e)}.${Gt(r)}`},accessKey:a,serverE2E_PublicKey:s,uglify:c}),u=await(await fetch(Gr(o,c),i)).json();if(u.simpleError)throw u;const l=c?Xt(u.e2e,s,h):u;n({user:zr(l.result.token),token:l.result.token,refreshToken:l.result.refreshToken}),await Fr(t,l.result)}catch(t){i(Kt(t).simpleError)}})),rn=(t,e,r,n,i)=>new Promise((async(o,s)=>{const{projectUrl:a,serverE2E_PublicKey:c,accessKey:h,uglify:u}=t;try{await ye();const[s,[l]]=me({body:{_:`${Gt(e)}.${Gt(r)}.${Gt(n||"").trim()}`,metadata:i},accessKey:h,serverE2E_PublicKey:c,uglify:u}),f=await(await fetch(Qr(a,u),s)).json();if(f.simpleError)throw f;const p=u?Xt(f.e2e,c,l):f;o({user:zr(p.result.token),token:p.result.token,refreshToken:p.result.refreshToken}),await Fr(t,p.result)}catch(t){s(Kt(t).simpleError)}})),nn=async t=>{await ye();const{projectUrl:e,serverE2E_PublicKey:r,accessKey:n,uglify:i}=t,{token:o,refreshToken:s}=le.AuthStore[e];if(rt.dispatch(e),le.AuthStore[e]&&delete le.AuthStore[e],o&&delete ue.AuthJWTToken[e],Object.keys(fe).forEach((t=>{le[t]=fe[t]})),Wr(e),pe(),qr(t),o){rt.dispatch(e,"ready");try{await ge(e);const[t]=me({body:{token:o,r_token:s},accessKey:n,uglify:i,serverE2E_PublicKey:r}),a=await(await fetch(Xr(e,i),t)).json();if(a.simpleError)throw a}catch(t){throw Kt(t).simpleError}}},on=(t,e)=>new Promise((async(r,n)=>{const{projectUrl:i,serverE2E_PublicKey:o,accessKey:s,uglify:a}=t;try{await ye();const[n,[c]]=me({body:{token:e},accessKey:s,uglify:a,serverE2E_PublicKey:o}),h=await(await fetch(Zr(i,a),n)).json();if(h.simpleError)throw h;const u=a?Xt(h.e2e,o,c):h;r({user:zr(u.result.token),token:u.result.token,refreshToken:u.result.refreshToken,isNewUser:u.result.isNewUser}),await Fr(t,u.result)}catch(t){n(Kt(t).simpleError)}}));var sn=Array.isArray,an="object"==typeof st&&st&&st.Object===Object&&st,cn=an,hn="object"==typeof self&&self&&self.Object===Object&&self,un=cn||hn||Function("return this")(),ln=un.Symbol,fn=ln,pn=Object.prototype,dn=pn.hasOwnProperty,yn=pn.toString,gn=fn?fn.toStringTag:void 0;var vn=function(t){var e=dn.call(t,gn),r=t[gn];try{t[gn]=void 0;var n=!0}catch(t){}var i=yn.call(t);return n&&(e?t[gn]=r:delete t[gn]),i},mn=Object.prototype.toString;var bn=function(t){return mn.call(t)},_n=vn,wn=bn,An=ln?ln.toStringTag:void 0;var En=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":An&&An in Object(t)?_n(t):wn(t)};var Tn=function(t){return null!=t&&"object"==typeof t},kn=En,On=Tn;var Sn=function(t){return"symbol"==typeof t||On(t)&&"[object Symbol]"==kn(t)},xn=sn,Rn=Sn,Cn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$n=/^\w*$/;var Pn=function(t,e){if(xn(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Rn(t))||($n.test(t)||!Cn.test(t)||null!=e&&t in Object(e))};var jn=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Un=En,Bn=jn;var Nn,Mn=function(t){if(!Bn(t))return!1;var e=Un(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Dn=un["__core-js_shared__"],Ln=(Nn=/[^.]+$/.exec(Dn&&Dn.keys&&Dn.keys.IE_PROTO||""))?"Symbol(src)_1."+Nn:"";var In=function(t){return!!Ln&&Ln in t},Kn=Function.prototype.toString;var Fn=function(t){if(null!=t){try{return Kn.call(t)}catch(t){}try{return t+""}catch(t){}}return""},zn=Mn,Wn=In,Yn=jn,qn=Fn,Hn=/^\[object .+?Constructor\]$/,Jn=Function.prototype,Vn=Object.prototype,Xn=Jn.toString,Gn=Vn.hasOwnProperty,Qn=RegExp("^"+Xn.call(Gn).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Zn=function(t){return!(!Yn(t)||Wn(t))&&(zn(t)?Qn:Hn).test(qn(t))};var ti=Zn,ei=function(t,e){return null==t?void 0:t[e]};var ri=function(t,e){var r=ei(t,e);return ti(r)?r:void 0},ni=ri(Object,"create"),ii=ni;var oi=function(){this.__data__=ii?ii(null):{},this.size=0};var si=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ai=ni,ci=Object.prototype.hasOwnProperty;var hi=function(t){var e=this.__data__;if(ai){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return ci.call(e,t)?e[t]:void 0},ui=ni,li=Object.prototype.hasOwnProperty;var fi=ni;var pi=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=fi&&void 0===e?"__lodash_hash_undefined__":e,this},di=oi,yi=si,gi=hi,vi=function(t){var e=this.__data__;return ui?void 0!==e[t]:li.call(e,t)},mi=pi;function bi(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}bi.prototype.clear=di,bi.prototype.delete=yi,bi.prototype.get=gi,bi.prototype.has=vi,bi.prototype.set=mi;var _i=bi;var wi=function(){this.__data__=[],this.size=0};var Ai=function(t,e){return t===e||t!=t&&e!=e},Ei=Ai;var Ti=function(t,e){for(var r=t.length;r--;)if(Ei(t[r][0],e))return r;return-1},ki=Ti,Oi=Array.prototype.splice;var Si=Ti;var xi=Ti;var Ri=Ti;var Ci=function(t,e){var r=this.__data__,n=Ri(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},$i=wi,Pi=function(t){var e=this.__data__,r=ki(e,t);return!(r<0)&&(r==e.length-1?e.pop():Oi.call(e,r,1),--this.size,!0)},ji=function(t){var e=this.__data__,r=Si(e,t);return r<0?void 0:e[r][1]},Ui=function(t){return xi(this.__data__,t)>-1},Bi=Ci;function Ni(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Ni.prototype.clear=$i,Ni.prototype.delete=Pi,Ni.prototype.get=ji,Ni.prototype.has=Ui,Ni.prototype.set=Bi;var Mi=Ni,Di=ri(un,"Map"),Li=_i,Ii=Mi,Ki=Di;var Fi=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},zi=Fi;var Wi=function(t,e){var r=t.__data__;return zi(e)?r["string"==typeof e?"string":"hash"]:r.map},Yi=Wi;var qi=Wi;var Hi=Wi;var Ji=Wi;var Vi=function(t,e){var r=Ji(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},Xi=function(){this.size=0,this.__data__={hash:new Li,map:new(Ki||Ii),string:new Li}},Gi=function(t){var e=Yi(this,t).delete(t);return this.size-=e?1:0,e},Qi=function(t){return qi(this,t).get(t)},Zi=function(t){return Hi(this,t).has(t)},to=Vi;function eo(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}eo.prototype.clear=Xi,eo.prototype.delete=Gi,eo.prototype.get=Qi,eo.prototype.has=Zi,eo.prototype.set=to;var ro=eo,no=ro;function io(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=t.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(io.Cache||no),r}io.Cache=no;var oo=io;var so=function(t){var e=oo(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e},ao=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,co=/\\(\\)?/g,ho=so((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ao,(function(t,r,n,i){e.push(n?i.replace(co,"$1"):r||t)})),e}));var uo=function(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i},lo=uo,fo=sn,po=Sn,yo=ln?ln.prototype:void 0,go=yo?yo.toString:void 0;var vo=function t(e){if("string"==typeof e)return e;if(fo(e))return lo(e,t)+"";if(po(e))return go?go.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r},mo=vo;var bo=function(t){return null==t?"":mo(t)},_o=sn,wo=Pn,Ao=ho,Eo=bo;var To=function(t,e){return _o(t)?t:wo(t,e)?[t]:Ao(Eo(t))},ko=Sn;var Oo=function(t){if("string"==typeof t||ko(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},So=To,xo=Oo;var Ro=function(t,e){for(var r=0,n=(e=So(e,t)).length;null!=t&&r<n;)t=t[xo(e[r++])];return r&&r==n?t:void 0},Co=Ro;var $o=at((function(t,e,r){var n=null==t?void 0:Co(t,e);return void 0===n?r:n})),Po=Mi;var jo=Mi,Uo=Di,Bo=ro;var No=function(t,e){var r=this.__data__;if(r instanceof jo){var n=r.__data__;if(!Uo||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Bo(n)}return r.set(t,e),this.size=r.size,this},Mo=Mi,Do=function(){this.__data__=new Po,this.size=0},Lo=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Io=function(t){return this.__data__.get(t)},Ko=function(t){return this.__data__.has(t)},Fo=No;function zo(t){var e=this.__data__=new Mo(t);this.size=e.size}zo.prototype.clear=Do,zo.prototype.delete=Lo,zo.prototype.get=Io,zo.prototype.has=Ko,zo.prototype.set=Fo;var Wo=zo;var Yo=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var qo=function(t){return this.__data__.has(t)},Ho=ro,Jo=Yo,Vo=qo;function Xo(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Ho;++e<r;)this.add(t[e])}Xo.prototype.add=Xo.prototype.push=Jo,Xo.prototype.has=Vo;var Go=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var Qo=function(t,e){return t.has(e)},Zo=Xo,ts=Go,es=Qo;var rs=function(t,e,r,n,i,o){var s=1&r,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var h=o.get(t),u=o.get(e);if(h&&u)return h==e&&u==t;var l=-1,f=!0,p=2&r?new Zo:void 0;for(o.set(t,e),o.set(e,t);++l<a;){var d=t[l],y=e[l];if(n)var g=s?n(y,d,l,e,t,o):n(d,y,l,t,e,o);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!ts(e,(function(t,e){if(!es(p,e)&&(d===t||i(d,t,r,n,o)))return p.push(e)}))){f=!1;break}}else if(d!==y&&!i(d,y,r,n,o)){f=!1;break}}return o.delete(t),o.delete(e),f};var ns=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var is=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},os=un.Uint8Array,ss=Ai,as=rs,cs=ns,hs=is,us=ln?ln.prototype:void 0,ls=us?us.valueOf:void 0;var fs=function(t,e,r,n,i,o,s){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new os(t),new os(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ss(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=cs;case"[object Set]":var c=1&n;if(a||(a=hs),t.size!=e.size&&!c)return!1;var h=s.get(t);if(h)return h==e;n|=2,s.set(t,e);var u=as(a(t),a(e),n,i,o,s);return s.delete(t),u;case"[object Symbol]":if(ls)return ls.call(t)==ls.call(e)}return!1};var ps=function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t},ds=ps,ys=sn;var gs=function(t,e,r){var n=e(t);return ys(t)?n:ds(n,r(t))};var vs=function(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var s=t[r];e(s,r,t)&&(o[i++]=s)}return o};var ms=vs,bs=function(){return[]},_s=Object.prototype.propertyIsEnumerable,ws=Object.getOwnPropertySymbols,As=ws?function(t){return null==t?[]:(t=Object(t),ms(ws(t),(function(e){return _s.call(t,e)})))}:bs;var Es=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n},Ts=En,ks=Tn;var Os=function(t){return ks(t)&&"[object Arguments]"==Ts(t)},Ss=Os,xs=Tn,Rs=Object.prototype,Cs=Rs.hasOwnProperty,$s=Rs.propertyIsEnumerable,Ps=Ss(function(){return arguments}())?Ss:function(t){return xs(t)&&Cs.call(t,"callee")&&!$s.call(t,"callee")},js=Ps,Us={exports:{}};var Bs=function(){return!1};!function(t,e){var r=un,n=Bs,i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}(Us,Us.exports);var Ns=Us.exports,Ms=/^(?:0|[1-9]\d*)$/;var Ds=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Ms.test(t))&&t>-1&&t%1==0&&t<e};var Ls=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Is=En,Ks=Ls,Fs=Tn,zs={};zs["[object Float32Array]"]=zs["[object Float64Array]"]=zs["[object Int8Array]"]=zs["[object Int16Array]"]=zs["[object Int32Array]"]=zs["[object Uint8Array]"]=zs["[object Uint8ClampedArray]"]=zs["[object Uint16Array]"]=zs["[object Uint32Array]"]=!0,zs["[object Arguments]"]=zs["[object Array]"]=zs["[object ArrayBuffer]"]=zs["[object Boolean]"]=zs["[object DataView]"]=zs["[object Date]"]=zs["[object Error]"]=zs["[object Function]"]=zs["[object Map]"]=zs["[object Number]"]=zs["[object Object]"]=zs["[object RegExp]"]=zs["[object Set]"]=zs["[object String]"]=zs["[object WeakMap]"]=!1;var Ws=function(t){return Fs(t)&&Ks(t.length)&&!!zs[Is(t)]};var Ys=function(t){return function(e){return t(e)}},qs={exports:{}};!function(t,e){var r=an,n=e&&!e.nodeType&&e,i=n&&t&&!t.nodeType&&t,o=i&&i.exports===n&&r.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=s}(qs,qs.exports);var Hs=qs.exports,Js=Ws,Vs=Ys,Xs=Hs&&Hs.isTypedArray,Gs=Xs?Vs(Xs):Js,Qs=Es,Zs=js,ta=sn,ea=Ns,ra=Ds,na=Gs,ia=Object.prototype.hasOwnProperty;var oa=function(t,e){var r=ta(t),n=!r&&Zs(t),i=!r&&!n&&ea(t),o=!r&&!n&&!i&&na(t),s=r||n||i||o,a=s?Qs(t.length,String):[],c=a.length;for(var h in t)!e&&!ia.call(t,h)||s&&("length"==h||i&&("offset"==h||"parent"==h)||o&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||ra(h,c))||a.push(h);return a},sa=Object.prototype;var aa=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||sa)};var ca=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),ha=aa,ua=ca,la=Object.prototype.hasOwnProperty;var fa=Mn,pa=Ls;var da=function(t){return null!=t&&pa(t.length)&&!fa(t)},ya=oa,ga=function(t){if(!ha(t))return ua(t);var e=[];for(var r in Object(t))la.call(t,r)&&"constructor"!=r&&e.push(r);return e},va=da;var ma=gs,ba=As,_a=function(t){return va(t)?ya(t):ga(t)};var wa=function(t){return ma(t,_a,ba)},Aa=Object.prototype.hasOwnProperty;var Ea=function(t,e,r,n,i,o){var s=1&r,a=wa(t),c=a.length;if(c!=wa(e).length&&!s)return!1;for(var h=c;h--;){var u=a[h];if(!(s?u in e:Aa.call(e,u)))return!1}var l=o.get(t),f=o.get(e);if(l&&f)return l==e&&f==t;var p=!0;o.set(t,e),o.set(e,t);for(var d=s;++h<c;){var y=t[u=a[h]],g=e[u];if(n)var v=s?n(g,y,u,e,t,o):n(y,g,u,t,e,o);if(!(void 0===v?y===g||i(y,g,r,n,o):v)){p=!1;break}d||(d="constructor"==u)}if(p&&!d){var m=t.constructor,b=e.constructor;m==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof b&&b instanceof b||(p=!1)}return o.delete(t),o.delete(e),p},Ta=ri(un,"DataView"),ka=Di,Oa=ri(un,"Promise"),Sa=ri(un,"Set"),xa=ri(un,"WeakMap"),Ra=En,Ca=Fn,$a="[object Map]",Pa="[object Promise]",ja="[object Set]",Ua="[object WeakMap]",Ba="[object DataView]",Na=Ca(Ta),Ma=Ca(ka),Da=Ca(Oa),La=Ca(Sa),Ia=Ca(xa),Ka=Ra;(Ta&&Ka(new Ta(new ArrayBuffer(1)))!=Ba||ka&&Ka(new ka)!=$a||Oa&&Ka(Oa.resolve())!=Pa||Sa&&Ka(new Sa)!=ja||xa&&Ka(new xa)!=Ua)&&(Ka=function(t){var e=Ra(t),r="[object Object]"==e?t.constructor:void 0,n=r?Ca(r):"";if(n)switch(n){case Na:return Ba;case Ma:return $a;case Da:return Pa;case La:return ja;case Ia:return Ua}return e});var Fa=Wo,za=rs,Wa=fs,Ya=Ea,qa=Ka,Ha=sn,Ja=Ns,Va=Gs,Xa="[object Arguments]",Ga="[object Array]",Qa="[object Object]",Za=Object.prototype.hasOwnProperty;var tc=function(t,e,r,n,i,o){var s=Ha(t),a=Ha(e),c=s?Ga:qa(t),h=a?Ga:qa(e),u=(c=c==Xa?Qa:c)==Qa,l=(h=h==Xa?Qa:h)==Qa,f=c==h;if(f&&Ja(t)){if(!Ja(e))return!1;s=!0,u=!1}if(f&&!u)return o||(o=new Fa),s||Va(t)?za(t,e,r,n,i,o):Wa(t,e,c,r,n,i,o);if(!(1&r)){var p=u&&Za.call(t,"__wrapped__"),d=l&&Za.call(e,"__wrapped__");if(p||d){var y=p?t.value():t,g=d?e.value():e;return o||(o=new Fa),i(y,g,r,n,o)}}return!!f&&(o||(o=new Fa),Ya(t,e,r,n,i,o))},ec=Tn;var rc=function t(e,r,n,i,o){return e===r||(null==e||null==r||!ec(e)&&!ec(r)?e!=e&&r!=r:tc(e,r,n,i,t,o))},nc=rc;var ic=function(t,e){return nc(t,e)},oc=at(ic);const sc=["desc","asc","ascending","descending"],ac=(t,e=[])=>{const r=["excludeFields","returnOnly","extraction","episode","retrieval","disableAuth","disableMinimizer"].filter((t=>!e.includes(t)));if(t){if(!Ft(t))throw"Invalid value assigned to 'config', expected a raw object";Object.entries(t).forEach((([t,e])=>{if(!r.includes(t))throw`unexpected property '${t}' found in config`;if("excludeFields"===t||"returnOnly"===t){if("string"!=typeof e&&!Array.isArray(e))throw`invalid value supplied to ${t}, expected either a string or array of string`;Array.isArray(e)&&e.forEach((e=>{if("string"!=typeof e)throw`invalid value supplied to ${t}, expected a string in array but got ${e}`}))}else if("extraction"===t)(Array.isArray(e)?e:[e]).forEach(((t,e)=>{const{limit:r,sort:n,direction:i,collection:o,find:s,findOne:a}=t;if("number"==typeof r&&(!zt(r)||r<=0))throw`invalid value supplied to limit of extraction[${e}], expected a positive whole number but got ${r}`;if(n&&"string"!=typeof n)throw`invalid value supplied to sort in extraction[${e}], expected a string value but got ${n}`;if(o&&"string"!=typeof o)throw`invalid value supplied to collection in extraction[${e}], expected a string value but got ${o}`;if(i&&1!==i&&-1!==i&&!sc.includes(i))throw`invalid value supplied to direction in extraction[${e}], expected any of ${[1,-1,...sc]} but got ${i}`}));else if("episode"===t){if(0!==e&&1!==e)throw`invalid value supplied to ${t}, expected either 0 or 1 but got ${e}`}else if("retrieval"===t){const r=Object.values(ne);if(!r.includes(e))throw`invalid value supplied to ${t}, expected any of ${r} but got ${e}`}else{if("disableAuth"!==t&&"disableMinimizer"!==t)throw`unexpected property '${t}' found in config`;if("boolean"!=typeof e)throw`invalid value supplied to ${t}, expected a boolean value but got ${e}`}}))}},cc=(t={})=>kc({},t),hc=t=>{if("string"!=typeof t||t.includes(".")||!t.trim())throw`invalid collection path "${t}", expected non-empty string and mustn't contain "."`},uc=(t,e)=>{const r=[[],[]];return Object.entries(e).forEach((([e,n])=>{if("$and"===e){if(!Array.isArray(n))throw"$and must be an array";n.forEach((e=>r[0].push(kc(t,e))))}else if("$or"===e){if(!Array.isArray(n))throw"$and must be an array";n.forEach((e=>r[1].push(kc(t,e))))}else r[0].push(kc(t,{[`${e}`]:n}))})),!(r[0].filter((t=>!t)).length||r[1].length&&!r[1].filter((t=>t)).length)},lc=["double","string","object","array","decimal","int","bool","date","null","number"],{$IN:fc,$NIN:pc,$GT:dc,$GTE:yc,$LT:gc,$LTE:vc,$EQ:mc,$EXISTS:bc,$REGEX:_c,$NE:wc,$SIZE:Ac,$TEXT:Ec,$TYPE:Tc}=ae,kc=(t={},e={})=>{if(!Ft(t))throw"data must be a raw object";if(!Ft(e))throw`expected a raw object but got ${e}`;const r={...t},n=[];return Wt(e,[]).forEach((([t,e])=>{let i=t.map(((t,e)=>t.startsWith("$")?{$:t,i:e}:null)).filter((t=>t));if(i.length){const{$:o,i:s}=i[0],a=s?$o(r,t.filter(((t,e)=>e<s)).join(".")):null;if(!ce.includes(o))throw`"${o}" operation is currently not supported`;if(o!==Ec&&(s!==t.length-1||!s))throw`"${o} must be at the last position as an operator"`;if(o===fc){if(!Array.isArray(e))throw`The value assigned to "${o}" operator must be an array`;void 0!==a?n.push(!!(Array.isArray(a)?a:[a]).filter((t=>!!e.filter((e=>Oc(e,t))).length)).length):n.push(!1)}else if(o===pc){if(!Array.isArray(e))throw`The value assigned to "${o}" operator must be an array`;void 0!==a?n.push(!(Array.isArray(a)?a:[a]).filter((t=>!!e.filter((e=>Oc(e,t))).length)).length):n.push(!0)}else if(o===dc)void 0!==a?n.push(!!(Array.isArray(a)?a:[a]).filter((t=>t>e)).length):n.push(!1);else if(o===yc)void 0!==a?n.push(!!(Array.isArray(a)?a:[a]).filter((t=>t>=e)).length):n.push(!1);else if(o===gc)void 0!==a?n.push(!!(Array.isArray(a)?a:[a]).filter((t=>t<e)).length):n.push(!1);else if(o===vc)void 0!==a?n.push(!!(Array.isArray(a)?a:[a]).filter((t=>t<=e)).length):n.push(!1);else if(o===Ec){if("$search"===i.slice(-1)[0].$){const{$caseSensitive:t,$localFields:i=[],$search:o}=r.$text;if("string"!=typeof e||"string"!=typeof o)throw"$search must have a string value";const s=i.map((t=>$o(r,t||""))).map((t=>`${"string"==typeof t?t:Array.isArray(t)?t.map((t=>"string"==typeof t?t:"")).join(" ").trim():""}`.trim())).join(" ").trim();n.push(t?s.includes(e.trim()):s.toLowerCase().includes(e.toLowerCase().trim()))}}else if(o===mc);else if(o===bc);else if(o===_c);else if(o===wc);else if(o===Ac){if(!zt(e)||v<0)throw"$size must be a positive whole number";n.push(Array.isArray(a)&&a.length===e)}else if(o===Tc){if(!lc.includes(e))throw`invalid value supplied to ${o}, mosquioto-transport only recognise "${lc}" data types`;const t=t=>{if("number"==typeof t){if(isNaN(t))return("decimal"===e||"double"===e)&&(t=>"number"==typeof t&&`${t}`.includes("."))(t)||"int"===e||"number"===e}else{if("boolean"==typeof t)return"bool"===e;if("string"==typeof t)return"string"===e;if(null===t)return"null"===e;if(t instanceof RegExp)return"regex"===e;if(t instanceof Date)return"date"===e;if(Ft(t))return"object"===e}return!1};n.push(Array.isArray(a)&&"array"===e||!!(Array.isArray(a)?a:[a]).filter((e=>t(e))).length)}}else{const i=$o(r,t.join("."));void 0!==i?n.push(!!(Array.isArray(i)?i:[i]).filter((t=>!!Oc(e,t))).length):n.push(!1)}})),!n.filter((t=>!t)).length},Oc=(t,e)=>t instanceof RegExp?"string"==typeof e&&t.test(e):oc(t,e);var Sc=ri,xc=function(){try{var t=Sc(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var Rc=function(t,e,r){"__proto__"==e&&xc?xc(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r},Cc=Rc,$c=Ai,Pc=Object.prototype.hasOwnProperty;var jc=function(t,e,r){var n=t[e];Pc.call(t,e)&&$c(n,r)&&(void 0!==r||e in t)||Cc(t,e,r)},Uc=jc,Bc=To,Nc=Ds,Mc=jn,Dc=Oo;var Lc=function(t,e,r,n){if(!Mc(t))return t;for(var i=-1,o=(e=Bc(e,t)).length,s=o-1,a=t;null!=a&&++i<o;){var c=Dc(e[i]),h=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(i!=s){var u=a[c];void 0===(h=n?n(u,c,a):void 0)&&(h=Mc(u)?u:Nc(e[i+1])?[]:{})}Uc(a,c,h),a=a[c]}return t},Ic=Lc;var Kc=function(t,e,r){return null==t?t:Ic(t,e,r)},Fc=at(Kc);var zc=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0};var Wc=function(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o},Yc=Ro,qc=Wc;var Hc=To,Jc=zc,Vc=function(t,e){return e.length<2?t:Yc(t,qc(e,0,-1))},Xc=Oo;var Gc=function(t,e){return e=Hc(e,t),null==(t=Vc(t,e))||delete t[Xc(Jc(e))]};var Qc=at((function(t,e){return null==t||Gc(t,e)}));const Zc=async(t,e,r,n)=>{await ye();const{projectUrl:i,dbUrl:o=ee,dbName:s=te,path:a}=t,{extraction:c,excludeFields:h,returnOnly:u}=r?.config,l=`${Yt(c||{})},${(h||[]).join(",")},${(u||[]).join(",")}`,f=$o(le.DatabaseStore,[i,o,s,a,"data",l],[]);(Array.isArray(n)?n:[n]).forEach((t=>{const e=f.findIndex((e=>e._id===t._id));-1===e?f.push(t):f[e]=t})),Fc(le.DatabaseStore,[i,o,s,a,"data",l],[...f]),Fc(le.DatabaseStore,[i,o,s,a,"record",e],{query:r,result:n,registeredOn:Date.now()}),pe()},th=async(t,e)=>{await ye();const{projectUrl:r,dbUrl:n=ee,dbName:i=te,path:o,command:s}=t,{config:a,find:c,findOne:h,sort:u,direction:l,limit:f,random:p}=s,{extraction:d,excludeFields:y,returnOnly:g}=a||{},v=`${Yt(d||{})},${(y||[]).join(",")},${(g||[]).join(",")}`,m=$o(le.DatabaseStore,[r,n,i,o,"data",v],[]),b=$o(le.DatabaseStore,[r,n,i,o,"record",e]);if(!b)return null;let _=m.filter((t=>uc(t,h||c||{})));return p?_=(t=>{const e=[...t];let r,n=e.length;for(;0!=n;)r=Math.floor(Math.random()*n),n--,[e[n],e[r]]=[e[r],e[n]];return e})(_):u&&(_=function(t=[],e){return t.slice(0).sort((function(t,r){const n=getLodash(t,e),i=getLodash(r,e);return n>i?1:n<i?-1:0}))}(_,u),-1!==l&&"desc"!==l&&"descending"!==l||(_=_.reverse())),h?_=_[0]:f&&_.filter(((t,e)=>e<f)),[_,b.result]},eh=(t,e)=>{const{command:r,path:n,countDoc:i}=t,{find:o,findOne:s,sort:a,direction:c,limit:h}=r||{},{extraction:u,retrieval:l=ne.DEFAULT,delivery:f=ie.DEFAULT,excludeFields:p=[],returnOnly:d=[]}=e||{};return`collection:${n}->excludes:${(Array.isArray(p)?p:[p]).filter((t=>void 0!==t)).join(",")}->includes:${(Array.isArray(d)?d:[d]).filter((t=>void 0!==t)).join(",")}->${i?"countDoc:yes->":""}sort:${a||""}->direction:${c||""}->limit:${h||""}->${s?"findOne":"find"}:${Yt(s||o||{})}:extraction:${Yt(u||{})}:retrieval:${l}:delivery:${f}`},rh=t=>{const e={};return Wt(t,[]).forEach((([t,r])=>{if(t[0].startsWith("$"))throw`unexpected field "${t[0]}"`;"$timestamp"===t.slice(-1)[0]&&"now"===r&&(t.pop(),r=Date.now()),Fc(e,t.join("."),r)})),e},nh=(t,e)=>{const r={...t},n={};return Wt(e,[]).forEach((([i,o])=>{const[s,a]=[i[0],i.filter(((t,e)=>e))];if(!se.includes(s)||!a.length)throw"MongoInvalidArgumentError: Update document requires atomic operators";a.length>1&&Ft(e[s][a[0]])&&!n[a[0]]&&(n[a[0]]=!0,r[a[0]]={});const c=$o(t,a.join("."));if(s===oe.$UNSET)Qc(r,a.join("."));else{if([oe.$MAX,oe.$MIN,oe.$INC,oe.$MUL].filter((t=>t===s)).length&&isNaN(o))throw`expected a number for "${s}" operation but got ${o}`;if("$timestamp"===a.slice(-1)[0]&&"now"===o){const t=[oe.$SET,oe.$UNSET];if(!t.includes(s))throw`invalid operator for updating timestamp, expected any of ${t}`;a.pop(),o=Date.now()}if(s===oe.$RENAME){if(void 0===c)return;if("string"!=typeof o)throw`${s} operator expected a string value at ${a.join(".")}`;Qc(r,a.join(".")),a[a.length-1]=o}Fc(r,a.join("."),s===oe.$SET?o:s===oe.$INC?isNaN(c)?o:c+o:s===oe.$MAX?isNaN(c)||o>c?o:c:s===oe.$MIN?isNaN(c)||o<c?o:c:s===oe.$MUL?isNaN(c)?0:o*c:s===oe.$PULL?Array.isArray(c)?c.filter((t=>!oc(t,o))):[o]:s===oe.$PUSH?Array.isArray(c)?[...c,o]:[o]:s===oe.$RENAME?c:null)}})),r};class ih{constructor(t){this.builder={...t}}find=t=>({get:e=>vh({...this.builder,command:{find:t}},e),listen:(e,r,n)=>dh(e,r,{...this.builder,command:{find:t}},n),count:e=>gh({...this.builder,command:{find:t}},e),limit:e=>({get:r=>vh({...this.builder,command:{find:t,limit:e}},r),random:r=>vh({...this.builder,command:{find:t,limit:e,random:!0}},r),listen:(r,n,i)=>dh(r,n,{...this.builder,command:{find:t,limit:e}},i),sort:(r,n)=>({get:i=>vh({...this.builder,command:{find:t,limit:e,sort:r,direction:n}},i),listen:(i,o,s)=>dh(i,o,{...this.builder,command:{find:t,limit:e,sort:r,direction:n}},s)})}),sort:(e,r)=>({get:n=>vh({...this.builder,command:{find:t,sort:e,direction:r}},n),listen:(n,i,o)=>dh(n,i,{...this.builder,command:{find:t,sort:e,direction:r}},o),limit:n=>({get:i=>vh({...this.builder,command:{find:t,sort:e,direction:r,limit:n}},i),listen:(i,o,s)=>dh(i,o,{...this.builder,command:{find:t,sort:e,direction:r,limit:n}},s)})})});sort=(t,e)=>this.find().sort(t,e);limit=t=>this.find().limit(t);count=t=>gh({...this.builder},t);get=t=>vh({...this.builder},t);listen=(t,e,r)=>dh(t,e,{...this.builder},r);findOne=(t={})=>({listen:(e,r,n)=>dh(e,r,{...this.builder,command:{findOne:t}},n),get:e=>vh({...this.builder,command:{findOne:t}},e)});onDisconnect=()=>({setOne:t=>yh({...this.builder},t,"setOne"),setMany:t=>yh({...this.builder},t,"setMany"),updateOne:(t,e)=>yh({...this.builder,command:{find:t}},e,"updateOne"),updateMany:(t,e)=>yh({...this.builder,command:{find:t}},e,"updateMany"),mergeOne:(t,e)=>yh({...this.builder,command:{find:t}},e,"mergeOne"),mergeMany:(t,e)=>yh({...this.builder,command:{find:t}},e,"mergeMany"),deleteOne:t=>yh({...this.builder,command:{find:t}},null,"deleteOne"),deleteMany:t=>yh({...this.builder,command:{find:t}},null,"deleteMany"),replaceOne:(t,e)=>yh({...this.builder,command:{find:t}},e,"replaceOne"),putOne:(t,e)=>yh({...this.builder,command:{find:t}},e,"putOne")});setOne=(t,e)=>mh(this.builder,t,"setOne",e);setMany=(t,e)=>mh(this.builder,t,"setMany",e);updateOne=(t,e,r)=>mh({...this.builder,find:t},e,"updateOne",r);updateMany=(t,e,r)=>mh({...this.builder,find:t},e,"updateMany",r);mergeOne=(t,e,r)=>mh({...this.builder,find:t},e,"mergeOne",r);mergeMany=(t,e,r)=>mh({...this.builder,find:t},e,"mergeMany",r);replaceOne=(t,e,r)=>mh({...this.builder,find:t},e,"replaceOne",r);putOne=(t,e,r)=>mh({...this.builder,find:t},e,"putOne",r);deleteOne=(t,e)=>mh({...this.builder,find:t},null,"deleteOne",e);deleteMany=(t,e)=>mh({...this.builder,find:t},null,"deleteMany",e)}const{_listenCollection:oh,_listenDocument:sh,_startDisconnectWriteTask:ah,_cancelDisconnectWriteTask:ch,_documentCount:hh,_readDocument:uh,_queryCollection:lh,_writeDocument:fh,_writeMapDocument:ph}=Mr,dh=(t,e,r,n)=>{const{projectUrl:i,wsPrefix:o,serverE2E_PublicKey:s,baseUrl:a,dbUrl:c,dbName:h,accessKey:u,path:l,disableCache:f,command:p,uglify:d}=r,{find:y,findOne:g,sort:v,direction:m,limit:b}=p,{disableAuth:_}=n||{},w=eh(r,n),A=!f,E=""+ ++ue.AnyProcessIte;ac(n,["retrieval","disableAuth"]),cc(g||y),hc(l);let T,k,O,S,x,R,C=ue.AuthJWTToken[i]||null,$=0;A&&(O=((t,{accessId:e,builder:r,config:n,processId:i})=>{let o="";const{episode:s=0}=n||{},a=ot.listenTo(e,(async n=>{const a=await th(r,e);a&&!oc(o,a[s])&&n===i&&t(a[s]),o=a[s]}));return()=>{o=void 0,a()}})(t,{accessId:w,builder:r,config:n,processId:E}),R=Ht((async t=>{R(),await ye(),t||k||T||ot.dispatch(w,E)}),i));const P=async()=>{const f=++$;if(_||await Yr(i),T||f!==$)return;const p=_?void 0:ue.AuthJWTToken[i],E={commands:{config:n,path:l,find:g||y,sort:v,direction:m,limit:b},dbName:h,dbUrl:c},[O,[R]]=d?Vt({accessKey:u,_body:E},p,s):["",[]];S=Br(`${o}://${a}`,{auth:d?{e2e:O,_m_internal:!0}:{accessKey:u,_body:E,...p?{mtoken:p}:{},_m_internal:!0},transports:["websocket","polling","flashsocket"]}),S.emit((g?sh:oh)(d)),S.on("mSnapshot",(async([i,o])=>{k=!0,i?e?.(Kt(i).simpleError):(d&&(o=Xt(o,s,R)),t?.(o),A&&Zc(r,w,{sort:v,direction:m,limit:b,find:y,findOne:g,config:n},o))})),S.on("connect",(()=>{x&&S.emit((g?sh:oh)(d))})),S.on("disconnect",(()=>{x=!0}))};P();const j=Kr((t=>{(t||null)!==C&&(S?.close?.(),x=void 0,P()),C=t}),i);return()=>{T||(T=!0,R?.(),O?.(),j?.(),S&&S.close())}},yh=(t,e,r)=>{const{projectUrl:n,wsPrefix:i,baseUrl:o,serverE2E_PublicKey:s,dbUrl:a,dbName:c,accessKey:h,path:u,command:l,uglify:f}=t,{find:p}=l||{};hc(u);let d,y,g,v=ue.AuthJWTToken[n]||null,m=0;const b=async()=>{const t=++m;if(await Yr(n),d||t!==m)return;const l=ue.AuthJWTToken[n],v={commands:{path:u,find:p,value:e,scope:r},dbName:c,dbUrl:a};y=Br(`${i}://${o}`,{auth:f?{e2e:Vt(v,l,s)[0],_m_internal:!0}:{...l?{mtoken:l}:{},accessKey:h,_body:v,_m_internal:!0},transports:["websocket","polling","flashsocket"]}),y.emit(ah(f)),y.on("connect",(()=>{g&&y.emit(ah(f))})),y.on("disconnect",(()=>{g=!0}))};b();const _=Kr((async t=>{(t||null)!==v&&(y&&(await Jt((()=>y.timeout(1e4).emitWithAck(ch(f)))),y.close()),g=void 0,b()),v=t}),n);return()=>{d||(_(),y&&(async()=>{await Jt((()=>y.timeout(1e4).emitWithAck(ch(f)))),y.close()})(),d=!0)}},gh=async(t,e)=>{const{projectUrl:r,serverE2E_PublicKey:n,dbUrl:i,dbName:o,accessKey:s,maxRetries:a=7,uglify:c,path:h,disableCache:u,command:l={}}=t,{find:f}=l,{disableAuth:p}=e||{},d=eh({...t,countDoc:!0},e);await ye(),ac(e,["excludeFields","returnOnly","extraction","episode","retrieval","disableMinimizer"]),cc(f||{}),hc(h);let y=0;const g=()=>new Promise((async(t,e)=>{++y;const l=(r,n)=>{isNaN(r)?e(n):t(r)};try{!p&&await ve(r)&&await Yr(r);const[t,[e]]=me({body:{commands:{path:h,find:f},dbName:o,dbUrl:i},accessKey:s,...p?{}:{authToken:ue.AuthJWTToken[r]},serverE2E_PublicKey:n,uglify:c}),a=await(await fetch(hh(r,c),t)).json();if(a.simpleError)throw a;const y=c?Xt(a.e2e,n,e):a;u||Fc(le.DatabaseCountResult,[r,i||ee,o||te,d],y.result),l(y.result)}catch(t){const e=Fc(le.DatabaseCountResult,[r,i||ee,o||te,d]);if(t?.simpleError)l(void 0,t.simpleError);else if(u||isNaN(e))if(y>a)l(void 0,{error:"retry_limit_exceeded",message:`retry exceed limit(${a})`});else{const t=Ht((e=>{e&&(t(),g().then((t=>{l(t)}),(t=>{l(void 0,t)})))}),r)}else l(e)}}));return await g()},vh=async(t,e)=>{const{projectUrl:r,serverE2E_PublicKey:n,dbUrl:i,dbName:o,accessKey:s,maxRetries:a=7,path:c,disableCache:h,uglify:u,command:l}=t,{find:f,findOne:p,sort:d,direction:y,limit:g,random:v}=l,{retrieval:m=ne.DEFAULT,episode:b=0,disableAuth:_,disableMinimizer:w}=e||{},A=!w,E=eh(t,e),T=`${E}${r}${i}${o}${m}`,k=()=>th(t,E),O=(m!==ne.DEFAULT||!h)&&m!==ne.NO_CACHE_NO_AWAIT;if(await ye(),O&&(ac(e),hc(c),cc(p||f),"number"==typeof g&&(!zt(g)||g<=0)))throw`limit() has an invalid argument for "${c}", expected a positive whole number but got ${g}`;let S,x=0;const R=()=>new Promise((async(h,w)=>{const C=1===++x,$=(t,e)=>{const r=C&&t?t.liveResult||null===t.liveResult?t.liveResult||void 0:t.episode[b]:t;t?h(C?r:t):w(e),!S&&C&&(S=!0,A&&((ue.PendingDbReadCollective.pendingResolution[T]||[]).forEach((n=>{n(t?{result:qt(r)}:void 0,e)})),ue.PendingDbReadCollective.pendingResolution[T]&&delete ue.PendingDbReadCollective.pendingResolution[T],ue.PendingDbReadCollective.pendingProcess[T]&&delete ue.PendingDbReadCollective.pendingProcess[T]))};try{if(C){if(A){if(ue.PendingDbReadCollective.pendingProcess[T])return ue.PendingDbReadCollective.pendingResolution[T]||(ue.PendingDbReadCollective.pendingResolution[T]=[]),void ue.PendingDbReadCollective.pendingResolution[T].push(((t,e)=>{t?h(t.result):w(e)}));ue.PendingDbReadCollective.pendingProcess[T]=!0}if(m.startsWith("sticky")&&await k()&&($({episode:await k()}),m!==ne.STICKY_RELOAD))return}!_&&await ve(r)&&await Yr(r);const[a,[b]]=me({body:{commands:{config:e,path:c,find:p||f,sort:d,direction:y,limit:g,random:v},dbName:o,dbUrl:i},accessKey:s,authToken:_?void 0:ue.AuthJWTToken[r],serverE2E_PublicKey:n,uglify:u}),S=await(await fetch((p?uh:lh)(r,u),a)).json();if(S.simpleError)throw S;const x=u?Xt(S.e2e,n,b):S;O&&Zc(t,E,{...l,config:e},x.result),$({liveResult:x.result||null})}catch(t){if(t?.simpleError)$(void 0,t?.simpleError);else if(m===ne.CACHE_NO_AWAIT&&!await k()||m===ne.STICKY_NO_AWAIT||m===ne.NO_CACHE_NO_AWAIT)$(void 0,Kt(t).simpleError);else if(O&&(m===ne.DEFAULT||m===ne.CACHE_NO_AWAIT)&&await k())$({episode:await k()});else if(x>a)$(void 0,{error:"retry_limit_exceeded",message:`retry exceed limit(${a})`});else{const t=Ht((e=>{e&&(t(),R().then((t=>{$(t)}),(t=>{$(void 0,t)})))}),r)}}}));return await R()},mh=async(t,e,r,n)=>{const{projectUrl:i,serverE2E_PublicKey:o,dbUrl:s,dbName:a,accessKey:c,maxRetries:h=7,path:u,find:l,disableCache:f,uglify:p}=t,{disableAuth:d,delivery:y=ie.DEFAULT,stepping:g}=n||{},v=`${Date.now()+ ++ue.PendingIte}`,m="batchWrite"===r,b=(y!==ie.DEFAULT||!f)&&y!==ie.NO_CACHE&&y!==ie.NO_AWAIT_NO_CACHE&&y!==ie.AWAIT_NO_CACHE;await ye(),b&&(hc(u),((t,e,r)=>{const n=Ft(t);if("setOne"!==r&&"setMany"!==r){if("deleteOne"!==r&&"deleteMany"!==r&&!n)throw`expected raw object in ${r}() operation but got ${t}`;cc(e),Wt(t,[]).forEach((([t])=>{if(t.filter((t=>"_foreign_doc"===t)).length)throw'"_foreign_doc" is a reserved word, don\'t use it as a field in a document'}))}else{if("setOne"===r&&!n)throw`expected raw object in ${r}() operation but got ${t}`;if("setMany"===r&&!Array.isArray(t))throw`expected an array of document in ${r}() operation but got ${t}`;const e={};(Array.isArray(t)?t:[t]).forEach((t=>{if(!Ft(t))throw`expected raw object in ${r}() operation but got ${t}`;if(e[t._id])throw`duplicate document _id:${t._id} found in ${r}() operation`;if(!t._id)throw`No _id found in ${r}() operation`;e[t._id]=!0}))}})(e,t.find,r),await(async(t,e,r)=>{await ye();const{projectUrl:n,dbUrl:i=ee,dbName:o=te,path:s}=t,{value:a,find:c,type:h}=r,u="updateOne"===h||"updateMany"===h||"mergeOne"===h||"mergeMany"===h,l=$o(le.DatabaseStore,[n,i,o,s,"data"],{});let f=[],p={};Object.entries(l).forEach((([t,e])=>{let r,n=[];if("setOne"===h||"setMany"===h?("setOne"===h?[a]:a).forEach((t=>{-1===e.findIndex((e=>e._id===t._id))?n.push({doc:rh(t),dex:"push",docId:a._id}):p[t._id]||console.error(`document with _id=${t._id} already exist locally with ${h}() operation, will try committing it online`),p[t._id]=!0})):e.forEach(((t,e)=>{if(r)return;let i;if(uc(t,c||{}))if("deleteMany"===h)i=null;else if("deleteOne"===h)i=null,r=!0;else if(u){if((nh({},{...a})?._id||c?._id)&&h.endsWith("Many"))throw`avoid providing "_id" for ${h}() operation, use ${h.substring(0,h.length-4)}One instead as _id only reference a single document`;i=nh({...t},{...a}),h.endsWith("One")&&(r=!0)}else i=rh({...a}),r=!0;void 0!==i&&n.push({doc:i,dex:e,docId:t._id,b4Doc:{...t}})})),!n.length){let t;if("putOne"===h){const e=rh(a),r=e?._id||c?._id;r?n.push({doc:{...e,_id:r},dex:"push",docId:r}):t=!0}else if("mergeOne"===h||"mergeMany"===h){const e=nh({},a),r=e?._id||c?._id;if(r&&"mergeMany"===h)throw'avoid providing "_id" for mergeMany() operation, use mergeOne instead as _id only reference a single document';r?n.push({doc:{...e,_id:r},dex:"push",docId:r}):t=!0}t&&console.error(`no data found locally and _id was not provided for ${h}() operation, skipping local and proceeding to online commit`)}f.push([t,n])})),f.forEach((([t,e])=>{e.forEach((({doc:e,dex:r,docId:n})=>{"push"===r?l[t].push({...e}):l[t]=null===e?l[t].filter((t=>t._id!==n)):l[t].map((t=>t._id===n?{...e}:t))}))})),Fc(le.PendingWrites,[n,`${i}${o}${s}`,e],{find:c,value:a,type:h,editions:f,addedOn:Date.now()}),pe()})(t,v,{value:e,type:r,find:l}));let _,w=0;const A=()=>new Promise((async(n,f)=>{const E=1===++w,T=(e,r,i)=>{const{removeCache:o,revertCache:s}=i||{};E||(e&&(e={a:e,c:i}),r&&(r={b:r,c:i})),e?n(e):f(r),!_&&E&&(_=!0,o&&b&&(async(t,e,r)=>{await ye();const{projectUrl:n,dbUrl:i=ee,dbName:o=te,path:s}=t,a=$o(le.PendingWrites,[n,`${i}${o}${s}`,e]),c=$o(le.DatabaseStore,[n,i,o,s,"data"]);a&&(r&&c&&a.editions.forEach((([t,e])=>{e.forEach((({doc:e,dex:r,docId:n,b4Doc:i})=>{c[t]="push"===r?c[t].filter((t=>t._id!==n)):null===e?[...c[t],i]:c[t].map((t=>t._id===n?{...i}:t))}))})),Qc(le.PendingWrites,[n,`${i}${o}${s}`,e]),pe())})(t,v,s))};try{!d&&await ve(i)&&await Yr(i);const[t,[n]]=me({body:{commands:{value:e,...m?{stepping:g}:{path:u,scope:r,find:l}},dbName:a,dbUrl:s},accessKey:c,serverE2E_PublicKey:o,authToken:d?void 0:ue.AuthJWTToken[i],uglify:p}),h=await(await fetch((m?ph:fh)(i,p),t)).json();if(h.simpleError)throw h;const f=p?Xt(h.e2e,o,n):h;T({status:"sent",committed:f.committed},void 0,{removeCache:!0})}catch(t){if(t?.simpleError)console.error(`${r} error (${u}), ${t.simpleError?.message}`),T(void 0,t?.simpleError,{removeCache:!0,revertCache:!0});else if(y===ie.NO_AWAIT||y===ie.CACHE_NO_AWAIT||y===ie.NO_AWAIT_NO_CACHE||y===ie.NO_CACHE)T(void 0,Kt(t).simpleError,await ve(i)?{removeCache:!0}:null);else if(w>h)T(void 0,{error:"retry_limit_exceeded",message:`retry exceed limit(${h})`});else if(y===ie.AWAIT_NO_CACHE){const t=Ht((e=>{e&&(t(),A().then((t=>{T(t.a,void 0,t.c)}),(t=>{T(void 0,t.b,t.c)})))}),i)}else b?T({status:"pending"}):T(void 0,Kt(t).simpleError)}}));return await A()};class bh{constructor(t){this.builder={...t}}uploadFile=(t,e,r,n,i)=>{let o,s=!1,a=!1;return(async()=>{let c,h;if(y.isBuffer(t))h=t;else if(t instanceof Blob)try{h=await t.arrayBuffer()}catch(t){return void r?.({error:"invalid_blob",message:`uploadFile() first argument has an invalid blob ${t}`})}else{if("string"!=typeof t||!t?.trim())return void r?.({error:"file_path_invalid",message:"uploadFile() first argument must either be a blob, buffer or base64 string"});c=t.replace(/^data:\w+\/\w+;base64,/,"")}if(s)return;e=e?.trim();const u=wh(e);if(u)return void r?.({error:"destination_invalid",message:u});const{projectUrl:l,accessKey:f}=this.builder;o=new XMLHttpRequest;const{awaitServer:p}=i||{};p&&await ge(l),await Yr(l),o.open("POST",Mr._uploadFile(l),!0),o.upload.addEventListener("progress",(t=>{n?.({sentBtyes:t.loaded,totalBytes:t.total})})),o.addEventListener("load",(()=>{if(!a&&!s){a=!0;try{const t=JSON.parse(o.responseText);if("success"!==t.status||!t.downloadUrl)throw t.simpleError||{error:"unexpected_error",message:"An unexpected error occurred"};r?.(void 0,t.downloadUrl)}catch(t){r?.(t)}}})),o.addEventListener("error",(()=>{a||s||(a=!0,r?.({error:"unexpected_error",message:"An unexpected error occurred"}))})),o.addEventListener("abort",(()=>{a||s||(a=!0,r?.({error:"upload_aborted",message:"The upload process was aborted"}))})),o.setRequestHeader("Authorization",`Bearer ${Gt(f)}`),o.setRequestHeader("Accept","application/json"),o.setRequestHeader("Content-Type",h?"buffer/upload":"text/plain"),ue.AuthJWTToken[l]&&o.setRequestHeader("Mosquito-Token",ue.AuthJWTToken[l]),o.setRequestHeader("Mosquito-Destination",e),c&&o.setRequestHeader("Mosquito-Encoding","base64"),o.send(c||h)})(),()=>{s||(s=!0,o&&o.abort(),setTimeout((()=>{r?.({error:"upload_aborted",message:"The upload process was aborted"})}),1))}};deleteFile=t=>_h(this.builder,t);deleteFolder=t=>_h(this.builder,t,!0)}const _h=async(t,e,r)=>{const{projectUrl:n,accessKey:i}=t;try{const t=await(await fetch(Mr[r?"_deleteFolder":"_deleteFile"](n),me({path:e},ue.AuthJWTToken[n]))).json();if(t.simpleError)throw t;if("success"!==t.status)throw"operation not successful"}catch(t){if(t?.simpleError)throw t.simpleError;throw be("unexpected_error",`${t}`).simpleError}},wh=(t="")=>{if(!(t=t.trim())||"string"!=typeof t)return"destination is required";if(t.startsWith("/")||t.endsWith("/"))return'destination must neither start with "/" nor end with "/"';let e,r="";return t.split("").forEach((t=>{"/"===t&&"/"===r&&(e='invalid destination path, "/" cannot be side by side'),r=t})),e},Ah=t=>{const{ok:e,type:r,status:n,statusText:i,redirected:o,url:s,headers:a,base64:c,builderCred:h}=t,{uglified:u,encKey:l,serverKey:f}=h,p={arrayBuffer:async()=>y.from(c,"base64"),json:async()=>JSON.parse(await p.text()),text:async()=>{const t=y.from(c,"base64").toString("utf8");if(u){return`${Xt(t,f,l)}`}return t},clone:()=>({...p}),type:r,status:n,statusText:i,redirected:o,url:s,ok:e,headers:new Headers({...a})};return p},Eh=(t="",e)=>{let r;return Object.entries(e||{}).forEach((([e,n])=>{e.toLowerCase()===t.toLowerCase()&&(r=n)})),r},Th=t=>{const e={};return t.forEach(((t,r)=>{e[r]=t})),e};var kh=function t(e){if(void 0===e)return e;if(e&&y.isBuffer(e))return JSON.stringify(":base64:"+e.toString("base64"));if(e&&e.toJSON&&(e=e.toJSON()),e&&"object"==typeof e){var r="",n=Array.isArray(e);r=n?"[":"{";var i=!0;for(var o in e){var s="function"==typeof e[o]||!n&&void 0===e[o];Object.hasOwnProperty.call(e,o)&&!s&&(i||(r+=","),i=!1,n?null==e[o]?r+="null":r+=t(e[o]):void 0!==e[o]&&(r+=t(o)+":"+t(e[o])))}return r+=n?"]":"}"}return"string"==typeof e?JSON.stringify(/^:/.test(e)?":"+e:e):void 0===e?"null":JSON.stringify(e)},Oh=function(t){return JSON.parse(t,(function(t,e){return"string"==typeof e?/^:base64:/.test(e)?y.from(e.substring(8),"base64"):/^:/.test(e)?e.substring(1):e:e}))};const{_listenCollection:Sh,_listenDocument:xh,_startDisconnectWriteTask:Rh,_cancelDisconnectWriteTask:Ch,_listenUserVerification:$h}=Mr;const Ph=t=>{const e=[...Object.values(re)];Object.entries(t).forEach((([t,r])=>{if("cachePassword"===t){if("string"!=typeof r||r.trim().length<=0)throw"Invalid value supplied to cachePassword, value must be a string and greater than 0 characters"}else{if("cacheProtocol"!==t)throw`Unexpected property named ${t}`;if(!e.includes(`${r}`))throw`unknown value supplied to ${t}, expected any of ${e}`}}))},jh={dbName:t=>{if("string"!=typeof t||!t.trim())throw"Invalid value supplied to dbName, value must be string and greater than one"},dbUrl:t=>{if("string"!=typeof t||!t.trim())throw"Invalid value supplied to dbUrl, value must be string and greater than one"},heapMemory:t=>{if("number"!=typeof t||t<=0)throw"Invalid value supplied to heapMemory, value must be number and greater than zero"},projectUrl:t=>{if("string"!=typeof t||!he().test(t.trim()))throw"Invalid value supplied to projectUrl, value must be a string and greater than one"},disableCache:t=>{if("boolean"!=typeof t)throw"Invalid value supplied to disableCache, value must be a boolean"},accessKey:t=>{if("string"!=typeof t||!t.trim())throw"Invalid value supplied to accessKey, value must be a string and greater than one"},maxRetries:t=>{if("number"!=typeof t||t<=0||!zt(t))throw"Invalid value supplied to maxRetries, value must be whole number and greater than zero"},enableE2E_Encryption:t=>{if("boolean"!=typeof t)throw"Invalid value supplied to enableE2E_Encryption, value must be a boolean"},serverE2E_PublicKey:t=>{if("string"!=typeof t||!t.trim())throw"Invalid value supplied to serverETE_PublicKey, value must be string and greater than one"}},Uh=(t,e)=>{if("object"!=typeof t)throw`${e.constructor.name} config is not an object`;const r=Object.keys(t);for(let e=0;e<r.length;e++){const n=r[e];if(!jh[n])throw`Unexpected property named ${n}`;jh[n](t[n])}if(t.enableE2E_Encryption&&!t.serverE2E_PublicKey)throw'"serverE2E_PublicKey" is missing, enabling end-to-end encryption requires a public encryption key from the server';if(!t.projectUrl)throw`projectUrl is a required property in ${e.constructor.name}() constructor`;if(!t.accessKey)throw`accessKey is a required property in ${e.constructor.name}() constructor`};t.DOCUMENT_EXTRACTION=t=>({$dynamicValue:t}),t.FIND_GEO_JSON=(t,e,r)=>({$near:{$geometry:{type:"Point",coordinates:t.reverse()},$minDistance:r||0,$maxDistance:e}}),t.GEO_JSON=(t,e)=>({type:"Point",coordinates:[e,t]}),t.MosquitoTransport=class{constructor(t){Uh(t,this),this.config={...t,uglify:t.enableE2E_Encryption,apiUrl:t.projectUrl,projectUrl:t.projectUrl.split("/").slice(0,-1).join("/")};const{projectUrl:e}=this.config;if(this.config.secureUrl=e.startsWith("https"),this.config.baseUrl=e.split("://")[1],this.config.wsPrefix=this.config.secureUrl?"wss":"ws",!ue.ReleaseCacheData)throw`releaseCache must be called before creating any ${this.constructor.name} instance`;if(!ue.InitializedProject[e]){ue.InitializedProject[e]=!0,ue.LastTokenRefreshRef[e]=0,Wr(e),qr({...this.config},!0);const t=Br(`${this.config.wsPrefix}://${e.split("://")[1]}`,{transports:["websocket","polling","flashsocket"],auth:{_m_internal:!0,_from_base:!0}});t.on("_signal_signout",(()=>{this.auth().signOut()})),t.on("connect",(()=>{it.dispatch(e,!0)})),t.on("disconnect",(()=>{it.dispatch(e,!1)})),Ht((t=>{ue.IS_CONNECTED[e]=t}),e),rt.listenTo(e,(t=>{ue.IS_TOKEN_READY[e]=t}))}}static releaseCache(t){if(ue.ReleaseCacheData)throw`calling ${this.name}() multiple times is prohibited`;Ph({...t}),ue.ReleaseCacheData={...t},de({...t})}getDatabase=(t,e)=>({collection:r=>new ih({...this.config,path:r,...t?{dbName:t}:{},...e?{dbUrl:e}:{}})});collection=t=>(hc(t),new ih({...this.config,path:t}));batchWrite=(t,e)=>((t,e,r)=>mh({...t},e,"batchWrite",r))({...this.config},t,e);auth=()=>new tn({...this.config});storage=()=>new bh({...this.config});fetchHttp=(t,e,r)=>(async(t="",e={},r)=>{const{projectUrl:n,apiUrl:i,serverE2E_PublicKey:o,method:s,maxRetries:a=7,disableCache:c,accessKey:h,uglify:u}=r,{retrieval:l=ne.DEFAULT,enableMinimizer:f,rawApproach:p}=s||{},d=he().test(t),g=s?.disableAuth||d,v=(l!==ne.DEFAULT||!c)&&l!==ne.NO_CACHE_NO_AWAIT,m=Yt({...e,jij:{disableAuth:!!g,url:t,projectUrl:n,retrieval:l}});if("mtoken"in(e?.headers||{}))throw'"mtoken" in header is a reserved prop';if("uglified"in(e?.headers||{}))throw'"uglified" in header is a reserved prop';if(t.startsWith(n)&&!p)throw`fetchHttp first argument can not starts with projectUrl:"${n}", please set {rawApproach: true} if you're trying to access this url as it is`;if(!d&&e.body&&"string"!=typeof e.body)throw'"body" must be a string value';let b,_=0;const w=()=>new Promise((async(r,s)=>{const c=++_,p=(t,e)=>{t?r(t):s(e),b||1!==c||(b=!0,f&&((ue.PendingFetchCollective.pendingResolution[m]||[]).forEach((r=>{r(qt(t),e)})),ue.PendingFetchCollective.pendingResolution[m]&&delete ue.PendingFetchCollective.pendingResolution[m],ue.PendingFetchCollective.pendingProcess[m]&&delete ue.PendingFetchCollective.pendingProcess[m]))};await ye();const A=le.FetchedStore[m],E=()=>{p({...Ah(A),fromCache:!0})};try{if(1===c){if(f){if(ue.PendingFetchCollective.pendingProcess[m])return ue.PendingFetchCollective.pendingResolution[m]||(ue.PendingFetchCollective.pendingResolution[m]=[]),void ue.PendingFetchCollective.pendingResolution[m].push(((t,e)=>{t?r(t.result):s(e)}));ue.PendingFetchCollective.pendingProcess[m]=!0}if(l.startsWith("sticky")&&A&&(E(),l!==ne.STICKY_RELOAD))return}!g&&await ve(n)&&await Yr(n);const a=ue.AuthJWTToken[n],b=!d&&e?.body&&"string"==typeof e?.body&&u,_=Eh("content-type",e?.headers),[w,[T]]=b&&d?Vt(e.body,a,o):[null,[]],k=await fetch(d?t:`${i}/${t}`,{...d?{}:{method:"POST"},...e,...b?{body:w}:{},cache:"no-cache",headers:{...d?{}:{"Content-type":"application/json"},...e?.headers,...b?{uglified:b,"Content-type":"text/plain",..._?{"init-content-type":_}:{}}:{},...g||!a||b||d?{}:{mtoken:a},...d?{}:{authorization:`Bearer ${h}`}}}),{ok:O,type:S,status:x,statusText:R,redirected:C,url:$,headers:P}=k,j=P.get("simple_error");if(!d&&j)throw{simpleError:JSON.parse(j)};const U=y.from(await k.arrayBuffer()).toString("base64"),B={builderCred:{uglified:b,encKey:T,serverKey:o},base64:U,type:S,status:x,statusText:R,redirected:C,url:$,ok:O,headers:Th(P)};v&&(le.FetchedStore[m]={...B},pe()),p(Ah(B))}catch(t){if(t?.simpleError)p(void 0,t.simpleError);else if(l===ne.CACHE_NO_AWAIT&&!A||l===ne.STICKY_NO_AWAIT||l===ne.NO_CACHE_NO_AWAIT)p(void 0,Kt(t).simpleError);else if(v&&(l===ne.DEFAULT||l===ne.CACHE_NO_AWAIT)&&A)E();else if(_>=a)p(void 0,Kt(t).simpleError);else{const t=Ht((async e=>{e&&(t(),w().then((t=>{1===c?p(t):r(t)}),(t=>{1===c?p(void 0,t):s(t)})))}),n)}}}));return await w()})(t,e,{...this.config,method:r});listenReachableServer=t=>Ht(t,this.config.projectUrl);getSocket=t=>{const{disableAuth:e,authHandshake:r}=t||{},{projectUrl:n,uglify:i,accessKey:o,serverE2E_PublicKey:s,wsPrefix:a}=this.config,c=[Sh,xh,Rh,Ch,$h];let h,u,l,f,p,d=()=>new Promise((t=>{h=t})),y=d(),g=[],v=0;const m=t=>function(){const[e,...r]=[...arguments];let n;n=i?Oh(Xt(e,s,p)):e,t?.(...n||[],..."function"==typeof r[0]?[function(){const t=[...arguments];let e;e=i?Vt(kh(t),void 0,s)[0]:t,r[0](e)}]:[])},b=({timeout:t,promise:e,emittion:r})=>new Promise((async(n,o)=>{const[a,...h]=r;if("string"!=typeof a)throw`expected ${e?"emitWithAck":"emit"} first argument to be a string type`;if(c.includes(a))throw`${a} is a restricted socket path, avoid using any of ${c}`;let u,f=Date.now();const p=isNaN(t)?void 0:setTimeout((()=>{u=!0,o(new Error("emittion timeout"))}),t);if(await y,!u){clearTimeout(p);try{const r=isNaN(t)?l:l.timeout(t-(Date.now()-f)),o=h.slice(-1)[0],c="function"==typeof o?h.slice(0,-1):h,[u,[p]]=i?Vt(kh(c),void 0,s):[void 0,[]];if("function"==typeof o&&e)throw"emitWithAck cannot have function in it parameter";const d=await r[e?"emitWithAck":"emit"](a,...i?[u]:[c],..."function"==typeof o?[function(){const t=[...arguments][0];let e;e=i?Oh(Xt(t,s,p)):t,o(...e||[])}]:[]);n(e&&d?i?Oh(Xt(d,s,p))[0]:d[0]:void 0)}catch(t){o(t)}}})),_=async()=>{if(u)return;const t=e?void 0:ue.AuthJWTToken[n],[c,[f]]=i?Vt({accessKey:o,a_extras:r},t,s):[null,[]];l=Br(`${a}://${n.split("://")[1]}`,{transports:["websocket","polling","flashsocket"],auth:i?{ugly:!0,e2e:c}:{...t?{mtoken:t}:{},a_extras:r,accessKey:o}}),p=f,h(),g.forEach((([t,e,r,n])=>{l[e](r,n)}))};if(e)_();else{let t;f=((t,e)=>rt.listenTo(e,t,!0))((e=>{t!==(e||!1)&&("ready"===e?_():(l?.close?.(),l=void 0,y=d()),t=e||!1)}),n)}return{timeout:t=>({emitWithAck:function(){return b({timeout:t,promise:!0,emittion:[...arguments]})}}),emit:function(){b({emittion:[...arguments]})},emitWithAck:function(){return b({emittion:[...arguments],promise:!0})},on:async(t,e)=>{if(c.includes(t))throw`${t} is a restricted socket path, avoid using any of ${c}`;const r=++v,n=m(e);return g.push([r,"on",t,n]),l&&l.on(t,n),()=>{l&&l.off(t,n),g=g.filter((([t])=>t!==r))}},once:async(t,e)=>{if(c.includes(t))throw`${t} is a restricted socket path, avoid using any of ${c}`;const r=++v,n=m(e);return g.push([r,"once",t,n]),l&&l.once(t,n),()=>{l&&l.off(t,n),g=g.filter((([t])=>t!==r))}},destroy:()=>{u=!0,f?.(),l&&l.close(),g=[]}}};wipeDatabaseCache=()=>{}},t.TIMESTAMP={$timestamp:"now"}}(exports); global.MosquitoTransport=Object.assign(global.MosquitoTransport || {}, exports);})(typeof globalThis!=='undefined'?globalThis:typeof window!=='undefined'?window:typeof global!=='undefined'?global:this);
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.min.js.map
|