(()=>{var Rr=Object.create,Y=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var br=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var Sr=e=>Y(e,"__esModule",{value:!0});var _r=(e,r)=>()=>(e&&(r=e(e=0)),r),D=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var kr=(e,r,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Pr(r))!Tr.call(e,i)&&i!=="default"&&Y(e,i,{get:()=>r[i],enumerable:!(t=Cr(r,i))||t.enumerable});return e},Dr=e=>kr(Sr(Y(e!=null?Rr(br(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var rr=D(N=>{y();"use strict";N.byteLength=Mr;N.toByteArray=$r;N.fromByteArray=jr;var m=[],E=[],Nr=typeof Uint8Array!="undefined"?Uint8Array:Array,j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var R=0,Or=j.length;R<Or;++R)m[R]=j[R],E[j.charCodeAt(R)]=R;E["-".charCodeAt(0)]=62;E["_".charCodeAt(0)]=63;function v(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var i=t===r?0:4-t%4;return[t,i]}function Mr(e){var r=v(e),t=r[0],i=r[1];return(t+i)*3/4-i}function Lr(e,r,t){return(r+t)*3/4-t}function $r(e){var r,t=v(e),i=t[0],n=t[1],o=new Nr(Lr(e,i,n)),u=0,h=n>0?i-4:i,f;for(f=0;f<h;f+=4)r=E[e.charCodeAt(f)]<<18|E[e.charCodeAt(f+1)]<<12|E[e.charCodeAt(f+2)]<<6|E[e.charCodeAt(f+3)],o[u++]=r>>16&255,o[u++]=r>>8&255,o[u++]=r&255;return n===2&&(r=E[e.charCodeAt(f)]<<2|E[e.charCodeAt(f+1)]>>4,o[u++]=r&255),n===1&&(r=E[e.charCodeAt(f)]<<10|E[e.charCodeAt(f+1)]<<4|E[e.charCodeAt(f+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function Gr(e){return m[e>>18&63]+m[e>>12&63]+m[e>>6&63]+m[e&63]}function Yr(e,r,t){for(var i,n=[],o=r;o<t;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(Gr(i));return n.join("")}function jr(e){for(var r,t=e.length,i=t%3,n=[],o=16383,u=0,h=t-i;u<h;u+=o)n.push(Yr(e,u,u+o>h?h:u+o));return i===1?(r=e[t-1],n.push(m[r>>2]+m[r<<4&63]+"==")):i===2&&(r=(e[t-2]<<8)+e[t-1],n.push(m[r>>10]+m[r>>4&63]+m[r<<2&63]+"=")),n.join("")}});var tr=D(H=>{y();H.read=function(e,r,t,i,n){var o,u,h=n*8-i-1,f=(1<<h)-1,l=f>>1,c=-7,a=t?n-1:0,U=t?-1:1,g=e[r+a];for(a+=U,o=g&(1<<-c)-1,g>>=-c,c+=h;c>0;o=o*256+e[r+a],a+=U,c-=8);for(u=o&(1<<-c)-1,o>>=-c,c+=i;c>0;u=u*256+e[r+a],a+=U,c-=8);if(o===0)o=1-l;else{if(o===f)return u?NaN:(g?-1:1)*Infinity;u=u+Math.pow(2,i),o=o-l}return(g?-1:1)*u*Math.pow(2,o-i)};H.write=function(e,r,t,i,n,o){var u,h,f,l=o*8-n-1,c=(1<<l)-1,a=c>>1,U=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:o-1,G=i?1:-1,Ur=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===Infinity?(h=isNaN(r)?1:0,u=c):(u=Math.floor(Math.log(r)/Math.LN2),r*(f=Math.pow(2,-u))<1&&(u--,f*=2),u+a>=1?r+=U/f:r+=U*Math.pow(2,1-a),r*f>=2&&(u++,f/=2),u+a>=c?(h=0,u=c):u+a>=1?(h=(r*f-1)*Math.pow(2,n),u=u+a):(h=r*Math.pow(2,a-1)*Math.pow(2,n),u=0));n>=8;e[t+g]=h&255,g+=G,h/=256,n-=8);for(u=u<<n|h,l+=n;l>0;e[t+g]=u&255,g+=G,u/=256,l-=8);e[t+g-G]|=Ur*128}});var xr=D(T=>{y();"use strict";var V=rr(),C=tr(),er=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;T.Buffer=s;T.SlowBuffer=Qr;T.INSPECT_MAX_BYTES=50;var O=2147483647;T.kMaxLength=O;s.TYPED_ARRAY_SUPPORT=Hr();!s.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Hr(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch(e){return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.byteOffset}});function A(e){if(e>O)throw new RangeError('The value "'+e+'" is invalid for option "size"');let r=new Uint8Array(e);return Object.setPrototypeOf(r,s.prototype),r}function s(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return W(e)}return ir(e,r,t)}s.poolSize=8192;function ir(e,r,t){if(typeof e=="string")return Wr(e,r);if(ArrayBuffer.isView(e))return zr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(B(e,ArrayBuffer)||e&&B(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(B(e,SharedArrayBuffer)||e&&B(e.buffer,SharedArrayBuffer)))return K(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return s.from(i,r,t);let n=Kr(e);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,r,t){return ir(e,r,t)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function nr(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Vr(e,r,t){return nr(e),e<=0?A(e):r!==void 0?typeof t=="string"?A(e).fill(r,t):A(e).fill(r):A(e)}s.alloc=function(e,r,t){return Vr(e,r,t)};function W(e){return nr(e),A(e<0?0:Q(e)|0)}s.allocUnsafe=function(e){return W(e)};s.allocUnsafeSlow=function(e){return W(e)};function Wr(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=or(e,r)|0,i=A(t),n=i.write(e,r);return n!==t&&(i=i.slice(0,n)),i}function z(e){let r=e.length<0?0:Q(e.length)|0,t=A(r);for(let i=0;i<r;i+=1)t[i]=e[i]&255;return t}function zr(e){if(B(e,Uint8Array)){let r=new Uint8Array(e);return K(r.buffer,r.byteOffset,r.byteLength)}return z(e)}function K(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let i;return r===void 0&&t===void 0?i=new Uint8Array(e):t===void 0?i=new Uint8Array(e,r):i=new Uint8Array(e,r,t),Object.setPrototypeOf(i,s.prototype),i}function Kr(e){if(s.isBuffer(e)){let r=Q(e.length)|0,t=A(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||J(e.length)?A(0):z(e);if(e.type==="Buffer"&&Array.isArray(e.data))return z(e.data)}function Q(e){if(e>=O)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+O.toString(16)+" bytes");return e|0}function Qr(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype};s.compare=function(r,t){if(B(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),B(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(r)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let i=r.length,n=t.length;for(let o=0,u=Math.min(i,n);o<u;++o)if(r[o]!==t[o]){i=r[o],n=t[o];break}return i<n?-1:n<i?1:0};s.isEncoding=function(r){switch(String(r).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}};s.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<r.length;++i)t+=r[i].length;let n=s.allocUnsafe(t),o=0;for(i=0;i<r.length;++i){let u=r[i];if(B(u,Uint8Array))o+u.length>n.length?(s.isBuffer(u)||(u=s.from(u)),u.copy(n,o)):Uint8Array.prototype.set.call(n,u,o);else if(s.isBuffer(u))u.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return n};function or(e,r){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||B(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let t=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return wr(e).length;default:if(n)return i?-1:Z(e).length;r=(""+r).toLowerCase(),n=!0}}s.byteLength=or;function Xr(e,r,t){let i=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return ot(this,r,t);case"utf8":case"utf-8":return hr(this,r,t);case"ascii":return it(this,r,t);case"latin1":case"binary":return nt(this,r,t);case"base64":return tt(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,r,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}s.prototype._isBuffer=!0;function I(e,r,t){let i=e[r];e[r]=e[t],e[t]=i}s.prototype.swap16=function(){let r=this.length;if(r%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)I(this,t,t+1);return this};s.prototype.swap32=function(){let r=this.length;if(r%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)I(this,t,t+3),I(this,t+1,t+2);return this};s.prototype.swap64=function(){let r=this.length;if(r%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)I(this,t,t+7),I(this,t+1,t+6),I(this,t+2,t+5),I(this,t+3,t+4);return this};s.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?hr(this,0,r):Xr.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(r){if(!s.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0};s.prototype.inspect=function(){let r="",t=T.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"};er&&(s.prototype[er]=s.prototype.inspect);s.prototype.compare=function(r,t,i,n,o){if(B(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),i===void 0&&(i=r?r.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>r.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===r)return 0;let u=o-n,h=i-t,f=Math.min(u,h),l=this.slice(n,o),c=r.slice(t,i);for(let a=0;a<f;++a)if(l[a]!==c[a]){u=l[a],h=c[a];break}return u<h?-1:h<u?1:0};function ur(e,r,t,i,n){if(e.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,J(t)&&(t=n?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(n)return-1;t=e.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof r=="string"&&(r=s.from(r,i)),s.isBuffer(r))return r.length===0?-1:sr(e,r,t,i,n);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):sr(e,[r],t,i,n);throw new TypeError("val must be string, number or Buffer")}function sr(e,r,t,i,n){let o=1,u=e.length,h=r.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,u/=2,h/=2,t/=2}function f(c,a){return o===1?c[a]:c.readUInt16BE(a*o)}let l;if(n){let c=-1;for(l=t;l<u;l++)if(f(e,l)===f(r,c===-1?0:l-c)){if(c===-1&&(c=l),l-c+1===h)return c*o}else c!==-1&&(l-=l-c),c=-1}else for(t+h>u&&(t=u-h),l=t;l>=0;l--){let c=!0;for(let a=0;a<h;a++)if(f(e,l+a)!==f(r,a)){c=!1;break}if(c)return l}return-1}s.prototype.includes=function(r,t,i){return this.indexOf(r,t,i)!==-1};s.prototype.indexOf=function(r,t,i){return ur(this,r,t,i,!0)};s.prototype.lastIndexOf=function(r,t,i){return ur(this,r,t,i,!1)};function Zr(e,r,t,i){t=Number(t)||0;let n=e.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;let o=r.length;i>o/2&&(i=o/2);let u;for(u=0;u<i;++u){let h=parseInt(r.substr(u*2,2),16);if(J(h))return u;e[t+u]=h}return u}function Jr(e,r,t,i){return M(Z(r,e.length-t),e,t,i)}function qr(e,r,t,i){return M(at(r),e,t,i)}function vr(e,r,t,i){return M(wr(r),e,t,i)}function rt(e,r,t,i){return M(ct(r,e.length-t),e,t,i)}s.prototype.write=function(r,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),r.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let u=!1;for(;;)switch(n){case"hex":return Zr(this,r,t,i);case"utf8":case"utf-8":return Jr(this,r,t,i);case"ascii":case"latin1":case"binary":return qr(this,r,t,i);case"base64":return vr(this,r,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rt(this,r,t,i);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function tt(e,r,t){return r===0&&t===e.length?V.fromByteArray(e):V.fromByteArray(e.slice(r,t))}function hr(e,r,t){t=Math.min(e.length,t);let i=[],n=r;for(;n<t;){let o=e[n],u=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h<=t){let f,l,c,a;switch(h){case 1:o<128&&(u=o);break;case 2:f=e[n+1],(f&192)==128&&(a=(o&31)<<6|f&63,a>127&&(u=a));break;case 3:f=e[n+1],l=e[n+2],(f&192)==128&&(l&192)==128&&(a=(o&15)<<12|(f&63)<<6|l&63,a>2047&&(a<55296||a>57343)&&(u=a));break;case 4:f=e[n+1],l=e[n+2],c=e[n+3],(f&192)==128&&(l&192)==128&&(c&192)==128&&(a=(o&15)<<18|(f&63)<<12|(l&63)<<6|c&63,a>65535&&a<1114112&&(u=a))}}u===null?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|u&1023),i.push(u),n+=h}return et(i)}var fr=4096;function et(e){let r=e.length;if(r<=fr)return String.fromCharCode.apply(String,e);let t="",i=0;for(;i<r;)t+=String.fromCharCode.apply(String,e.slice(i,i+=fr));return t}function it(e,r,t){let i="";t=Math.min(e.length,t);for(let n=r;n<t;++n)i+=String.fromCharCode(e[n]&127);return i}function nt(e,r,t){let i="";t=Math.min(e.length,t);for(let n=r;n<t;++n)i+=String.fromCharCode(e[n]);return i}function ot(e,r,t){let i=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>i)&&(t=i);let n="";for(let o=r;o<t;++o)n+=lt[e[o]];return n}function ut(e,r,t){let i=e.slice(r,t),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}s.prototype.slice=function(r,t){let i=this.length;r=~~r,t=t===void 0?i:~~t,r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<r&&(t=r);let n=this.subarray(r,t);return Object.setPrototypeOf(n,s.prototype),n};function p(e,r,t){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||p(r,t,this.length);let n=this[r],o=1,u=0;for(;++u<t&&(o*=256);)n+=this[r+u]*o;return n};s.prototype.readUintBE=s.prototype.readUIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||p(r,t,this.length);let n=this[r+--t],o=1;for(;t>0&&(o*=256);)n+=this[r+--t]*o;return n};s.prototype.readUint8=s.prototype.readUInt8=function(r,t){return r=r>>>0,t||p(r,1,this.length),this[r]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||p(r,2,this.length),this[r]|this[r+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||p(r,2,this.length),this[r]<<8|this[r+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||p(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||p(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};s.prototype.readBigUInt64LE=F(function(r){r=r>>>0,b(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&S(r,this.length-8);let n=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});s.prototype.readBigUInt64BE=F(function(r){r=r>>>0,b(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&S(r,this.length-8);let n=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});s.prototype.readIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||p(r,t,this.length);let n=this[r],o=1,u=0;for(;++u<t&&(o*=256);)n+=this[r+u]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};s.prototype.readIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||p(r,t,this.length);let n=t,o=1,u=this[r+--n];for(;n>0&&(o*=256);)u+=this[r+--n]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};s.prototype.readInt8=function(r,t){return r=r>>>0,t||p(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};s.prototype.readInt16LE=function(r,t){r=r>>>0,t||p(r,2,this.length);let i=this[r]|this[r+1]<<8;return i&32768?i|4294901760:i};s.prototype.readInt16BE=function(r,t){r=r>>>0,t||p(r,2,this.length);let i=this[r+1]|this[r]<<8;return i&32768?i|4294901760:i};s.prototype.readInt32LE=function(r,t){return r=r>>>0,t||p(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};s.prototype.readInt32BE=function(r,t){return r=r>>>0,t||p(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};s.prototype.readBigInt64LE=F(function(r){r=r>>>0,b(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&S(r,this.length-8);let n=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)});s.prototype.readBigInt64BE=F(function(r){r=r>>>0,b(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&S(r,this.length-8);let n=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(n)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+i)});s.prototype.readFloatLE=function(r,t){return r=r>>>0,t||p(r,4,this.length),C.read(this,r,!0,23,4)};s.prototype.readFloatBE=function(r,t){return r=r>>>0,t||p(r,4,this.length),C.read(this,r,!1,23,4)};s.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||p(r,8,this.length),C.read(this,r,!0,52,8)};s.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||p(r,8,this.length),C.read(this,r,!1,52,8)};function d(e,r,t,i,n,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>n||r<o)throw new RangeError('"value" argument is out of bounds');if(t+i>e.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;d(this,r,t,i,h,0)}let o=1,u=0;for(this[t]=r&255;++u<i&&(o*=256);)this[t+u]=r/o&255;return t+i};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;d(this,r,t,i,h,0)}let o=i-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+i};s.prototype.writeUint8=s.prototype.writeUInt8=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,1,255,0),this[t]=r&255,t+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function ar(e,r,t,i,n){Er(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,t}function cr(e,r,t,i,n){Er(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t+7]=o,o=o>>8,e[t+6]=o,o=o>>8,e[t+5]=o,o=o>>8,e[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=u,u=u>>8,e[t+2]=u,u=u>>8,e[t+1]=u,u=u>>8,e[t]=u,t+8}s.prototype.writeBigUInt64LE=F(function(r,t=0){return ar(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeBigUInt64BE=F(function(r,t=0){return cr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});s.prototype.writeIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let f=Math.pow(2,8*i-1);d(this,r,t,i,f-1,-f)}let o=0,u=1,h=0;for(this[t]=r&255;++o<i&&(u*=256);)r<0&&h===0&&this[t+o-1]!==0&&(h=1),this[t+o]=(r/u>>0)-h&255;return t+i};s.prototype.writeIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let f=Math.pow(2,8*i-1);d(this,r,t,i,f-1,-f)}let o=i-1,u=1,h=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&h===0&&this[t+o+1]!==0&&(h=1),this[t+o]=(r/u>>0)-h&255;return t+i};s.prototype.writeInt8=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};s.prototype.writeInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};s.prototype.writeInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};s.prototype.writeInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};s.prototype.writeInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||d(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};s.prototype.writeBigInt64LE=F(function(r,t=0){return ar(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});s.prototype.writeBigInt64BE=F(function(r,t=0){return cr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lr(e,r,t,i,n,o){if(t+i>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function pr(e,r,t,i,n){return r=+r,t=t>>>0,n||lr(e,r,t,4,34028234663852886e22,-34028234663852886e22),C.write(e,r,t,i,23,4),t+4}s.prototype.writeFloatLE=function(r,t,i){return pr(this,r,t,!0,i)};s.prototype.writeFloatBE=function(r,t,i){return pr(this,r,t,!1,i)};function yr(e,r,t,i,n){return r=+r,t=t>>>0,n||lr(e,r,t,8,17976931348623157e292,-17976931348623157e292),C.write(e,r,t,i,52,8),t+8}s.prototype.writeDoubleLE=function(r,t,i){return yr(this,r,t,!0,i)};s.prototype.writeDoubleBE=function(r,t,i){return yr(this,r,t,!1,i)};s.prototype.copy=function(r,t,i,n){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=r.length&&(t=r.length),t||(t=0),n>0&&n<i&&(n=i),n===i||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),r.length-t<n-i&&(n=r.length-t+i);let o=n-i;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(r,this.subarray(i,n),t),o};s.prototype.fill=function(r,t,i,n){if(typeof r=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(r.length===1){let u=r.charCodeAt(0);(n==="utf8"&&u<128||n==="latin1")&&(r=u)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o<i;++o)this[o]=r;else{let u=s.isBuffer(r)?r:s.from(r,n),h=u.length;if(h===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=u[o%h]}return this};var P={};function X(e,r,t){P[e]=class extends t{constructor(){super();Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}X("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);X("ERR_INVALID_ARG_TYPE",function(e,r){return`The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError);X("ERR_OUT_OF_RANGE",function(e,r,t){let i=`The value of "${e}" is out of range.`,n=t;return Number.isInteger(t)&&Math.abs(t)>2**32?n=dr(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=dr(n)),n+="n"),i+=` It must be ${r}. Received ${n}`,i},RangeError);function dr(e){let r="",t=e.length,i=e[0]==="-"?1:0;for(;t>=i+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function st(e,r,t){b(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&S(r,e.length-(t+1))}function Er(e,r,t,i,n,o){if(e>t||e<r){let u=typeof r=="bigint"?"n":"",h;throw o>3?r===0||r===BigInt(0)?h=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:h=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:h=`>= ${r}${u} and <= ${t}${u}`,new P.ERR_OUT_OF_RANGE("value",h,e)}st(i,n,o)}function b(e,r){if(typeof e!="number")throw new P.ERR_INVALID_ARG_TYPE(r,"number",e)}function S(e,r,t){throw Math.floor(e)!==e?(b(e,t),new P.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new P.ERR_BUFFER_OUT_OF_BOUNDS:new P.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}var ht=/[^+/0-9A-Za-z-_]/g;function ft(e){if(e=e.split("=")[0],e=e.trim().replace(ht,""),e.length<2)return"";for(;e.length%4!=0;)e=e+"=";return e}function Z(e,r){r=r||Infinity;let t,i=e.length,n=null,o=[];for(let u=0;u<i;++u){if(t=e.charCodeAt(u),t>55295&&t<57344){if(!n){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===i){(r-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(r-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function at(e){let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function ct(e,r){let t,i,n,o=[];for(let u=0;u<e.length&&!((r-=2)<0);++u)t=e.charCodeAt(u),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function wr(e){return V.toByteArray(ft(e))}function M(e,r,t,i){let n;for(n=0;n<i&&!(n+t>=r.length||n>=e.length);++n)r[n+t]=e[n];return n}function B(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function J(e){return e!==e}var lt=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)r[i+n]=e[t]+e[n]}return r}();function F(e){return typeof BigInt=="undefined"?pt:e}function pt(){throw new Error("BigInt not supported")}});var y=_r(()=>{globalThis.global=globalThis;globalThis.Buffer=xr().Buffer;globalThis.process={browser:!0,env:{},nextTick(e,...r){queueMicrotask(()=>e(...r))}}});var mr=D(L=>{y();"use strict";Object.defineProperty(L,"__esModule",{value:!0});function gr(){let e,r,t=new Promise((i,n)=>{e=o=>{i(o),t.isPending=!1},r=o=>{n(o),t.isPending=!1}}).catch(i=>Promise.reject(i));return t.resolve=e,t.reject=r,"finally"in t||(t.finally=i=>{t.then(i),t.catch(i)}),t.isPending=!0,t}L.future=gr;L.default=gr});y();y();var yt=Dr(mr()),q=class{constructor(r,t){this.size=r;this.ArrayTypeConstructor=t;this.writePointer=0;this.readPointer=0;this.buffer=new this.ArrayTypeConstructor(r)}readAvailableCount(){return this.writePointer-this.readPointer}getWritePointer(){return this.writePointer}getReadPointer(){return this.readPointer}write(r,t){this.writeAt(r,this.writePointer,t)}read(r){let t=this.peek(this.readPointer,r);return this.readPointer+=t.length,t}peek(r,t){let i=r||this.readPointer,n=this.writePointer-this.readPointer,o=t?Math.min(t,n):n,u=i%this.buffer.length,h=u+o,f;return h>this.buffer.length?(f=new this.ArrayTypeConstructor(o),f.set(this.buffer.slice(u,this.buffer.length)),f.set(this.buffer.slice(0,h-this.buffer.length),this.buffer.length-u)):f=this.buffer.slice(u,h),f}writeAt(r,t,i){let n=i||r.length,o=r;n>this.buffer.length&&(o=r.slice(r.length-this.buffer.length,r.length));let u=t%this.buffer.length;if(u+n>this.buffer.length){let l=this.buffer.length-u;this.buffer.set(o.slice(0,l),u),this.buffer.set(o.slice(l,n),0)}else this.buffer.set(o.slice(0,n),u);let f=t+n;f>this.writePointer&&(this.writePointer=f),this.updateReadPointerToMinReadPosition()}isFull(){return this.readAvailableCount()>=this.size}updateReadPointerToMinReadPosition(){let r=this.writePointer-this.buffer.length;this.readPointer<r&&(this.readPointer=r)}};y();var dt=40,$=24e3,_=$*dt/1e3,Et=2048,Ut=Et*1e3/$;y();var Br;(function(n){n.ENCODE="ENCODE",n.DECODE="DECODE",n.DESTROY_ENCODER="DESTROY_ENCODER",n.DESTROY_DECODER="DESTROY_ENCODER"})(Br||(Br={}));var w;(function(h){h.ENCODE="ENCODE",h.PAUSE="PAUSE",h.RESUME="RESUME",h.ON_PAUSED="ON_PAUSED",h.ON_RECORDING="ON_RECORDING",h.CHECK_STATUS="CHECK_STATUS",h.TIMEOUT="TIMEOUT"})(w||(w={}));var k;(function(t){t.STREAM_PLAYING="STREAM_PLAYING",t.WRITE_SAMPLES="WRITE_SAMPLES"})(k||(k={}));var Ar;(function(t){t.ENCODE="ENCODE_OUTPUT",t.DECODE="DECODE_OUTPUT"})(Ar||(Ar={}));var x;(function(i){i[i.RECORDING=0]="RECORDING",i[i.PAUSE_REQUESTED=1]="PAUSE_REQUESTED",i[i.PAUSED=2]="PAUSED"})(x||(x={}));var Fr=class extends AudioWorkletProcessor{constructor(...r){super(...r);this.status=2;this.inputSamplesCount=0;this.lastProcess=0;this.port.onmessage=t=>{t.data.topic===w.PAUSE&&(this.status=1),t.data.topic===w.RESUME&&(this.status=0,this.notify(w.ON_RECORDING)),t.data.topic===w.CHECK_STATUS&&(this.status===0||this.status===1)&&this.isTimeout()&&(this.status=2,this.notify(w.TIMEOUT),this.notify(w.ON_PAUSED))}}isTimeout(){return Date.now()-this.lastProcess>1e3}process(r,t,i){if(this.lastProcess=Date.now(),this.status===2)return!0;let n=r?.[0]?.[0]??new Float32Array;if(this.status===1){let o=Math.floor(n.length/_)*_+_-this.inputSamplesCount%_;o<=n.length&&(n=n.slice(0,o),this.status=2,this.notify(w.ON_PAUSED))}return this.inputSamplesCount+=n.length,this.sendDataToEncode(n),!0}notify(r){this.port.postMessage({topic:r})}sendDataToEncode(r){this.port.postMessage({topic:w.ENCODE,samples:r},[r.buffer])}},Ir=class extends AudioWorkletProcessor{constructor(r){super(r);this.playing=!1;this.bufferLength=r?.processorOptions.channelBufferSize??2,this.sampleRate=r?.processorOptions.sampleRate??$,this.buffer=new q(Math.floor(this.bufferLength*this.sampleRate),Float32Array),this.readStartSamplesCount=(r?.processorOptions.readStartLength??.2)*this.sampleRate,this.port.onmessage=t=>{t.data.topic===k.WRITE_SAMPLES&&this.buffer.write(t.data.samples)}}process(r,t,i){let n=t[0][0];n.fill(0);let o=this.playing,u=o?n.length-1:this.readStartSamplesCount;return this.buffer.readAvailableCount()>u?(n.set(this.buffer.read(n.length)),o||this.changePlayingStatus(!0)):o&&this.changePlayingStatus(!1),!0}changePlayingStatus(r){this.playing=r,this.port.postMessage({topic:k.STREAM_PLAYING,playing:r})}};registerProcessor("inputProcessor",Fr);registerProcessor("outputProcessor",Ir);})();
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
