blockmine 1.5.4 → 1.5.5
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.
|
@@ -67,7 +67,7 @@ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}
|
|
|
67
67
|
* LICENSE.md file in the root directory of this source tree.
|
|
68
68
|
*
|
|
69
69
|
* @license MIT
|
|
70
|
-
*/function n2e(e){return v.createElement(ghe,{flushSync:t1.flushSync,...e})}const qZ=e=>{let t;const n=new Set,o=(f,p)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const k=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(x=>x(t,k))}},a=()=>t,l={setState:o,getState:a,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f))},h=t=e(o,a,l);return l},o2e=e=>e?qZ(e):qZ,a2e=e=>e;function r2e(e,t=a2e){const n=le.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return le.useDebugValue(n),n}const HZ=e=>{const t=o2e(e),n=o=>r2e(t,o);return Object.assign(n,t),n},xJ=e=>e?HZ(e):HZ;var wJ=Symbol.for("immer-nothing"),VZ=Symbol.for("immer-draftable"),Jo=Symbol.for("immer-state");function Pa(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lh=Object.getPrototypeOf;function jh(e){return!!e&&!!e[Jo]}function Fd(e){var t;return e?bJ(e)||Array.isArray(e)||!!e[VZ]||!!((t=e.constructor)!=null&&t[VZ])||wD(e)||bD(e):!1}var i2e=Object.prototype.constructor.toString();function bJ(e){if(!e||typeof e!="object")return!1;const t=Lh(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===i2e}function PR(e,t){xD(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function xD(e){const t=e[Jo];return t?t.type_:Array.isArray(e)?1:wD(e)?2:bD(e)?3:0}function vq(e,t){return xD(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function MJ(e,t,n){const o=xD(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function s2e(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function wD(e){return e instanceof Map}function bD(e){return e instanceof Set}function Zs(e){return e.copy_||e.base_}function xq(e,t){if(wD(e))return new Map(e);if(bD(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=bJ(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[Jo];let a=Reflect.ownKeys(o);for(let i=0;i<a.length;i++){const s=a[i],l=o[s];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(o[s]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[s]})}return Object.create(Lh(e),o)}else{const o=Lh(e);if(o!==null&&n)return{...e};const a=Object.create(o);return Object.assign(a,e)}}function cV(e,t=!1){return MD(e)||jh(e)||!Fd(e)||(xD(e)>1&&(e.set=e.add=e.clear=e.delete=c2e),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>cV(o,!0))),e}function c2e(){Pa(2)}function MD(e){return Object.isFrozen(e)}var l2e={};function Ud(e){const t=l2e[e];return t||Pa(0,e),t}var xf;function _J(){return xf}function u2e(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function BZ(e,t){t&&(Ud("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function wq(e){bq(e),e.drafts_.forEach(d2e),e.drafts_=null}function bq(e){e===xf&&(xf=e.parent_)}function FZ(e){return xf=u2e(xf,e)}function d2e(e){const t=e[Jo];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function UZ(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Jo].modified_&&(wq(t),Pa(4)),Fd(e)&&(e=$R(t,e),t.parent_||zR(t,e)),t.patches_&&Ud("Patches").generateReplacementPatches_(n[Jo].base_,e,t.patches_,t.inversePatches_)):e=$R(t,n,[]),wq(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wJ?e:void 0}function $R(e,t,n){if(MD(t))return t;const o=t[Jo];if(!o)return PR(t,(a,i)=>GZ(e,o,t,a,i,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return zR(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const a=o.copy_;let i=a,s=!1;o.type_===3&&(i=new Set(a),a.clear(),s=!0),PR(i,(l,h)=>GZ(e,o,a,l,h,n,s)),zR(e,a,!1),n&&e.patches_&&Ud("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function GZ(e,t,n,o,a,i,s){if(jh(a)){const l=i&&t&&t.type_!==3&&!vq(t.assigned_,o)?i.concat(o):void 0,h=$R(e,a,l);if(MJ(n,o,h),jh(h))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Fd(a)&&!MD(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;$R(e,a),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&zR(e,a)}}function zR(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&cV(t,n)}function h2e(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:_J(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=o,i=lV;n&&(a=[o],i=wf);const{revoke:s,proxy:l}=Proxy.revocable(a,i);return o.draft_=l,o.revoke_=s,l}var lV={get(e,t){if(t===Jo)return e;const n=Zs(e);if(!vq(n,t))return f2e(e,n,t);const o=n[t];return e.finalized_||!Fd(o)?o:o===Yz(e.base_,t)?(Wz(e),e.copy_[t]=_q(o,e)):o},has(e,t){return t in Zs(e)},ownKeys(e){return Reflect.ownKeys(Zs(e))},set(e,t,n){const o=SJ(Zs(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const a=Yz(Zs(e),t),i=a==null?void 0:a[Jo];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(s2e(n,a)&&(n!==void 0||vq(e.base_,t)))return!0;Wz(e),Mq(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Yz(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Wz(e),Mq(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Zs(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){Pa(11)},getPrototypeOf(e){return Lh(e.base_)},setPrototypeOf(){Pa(12)}},wf={};PR(lV,(e,t)=>{wf[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});wf.deleteProperty=function(e,t){return wf.set.call(this,e,t,void 0)};wf.set=function(e,t,n){return lV.set.call(this,e[0],t,n,e[0])};function Yz(e,t){const n=e[Jo];return(n?Zs(n):e)[t]}function f2e(e,t,n){var a;const o=SJ(t,n);return o?"value"in o?o.value:(a=o.get)==null?void 0:a.call(e.draft_):void 0}function SJ(e,t){if(!(t in e))return;let n=Lh(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Lh(n)}}function Mq(e){e.modified_||(e.modified_=!0,e.parent_&&Mq(e.parent_))}function Wz(e){e.copy_||(e.copy_=xq(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var p2e=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(h=i,...f){return s.produce(h,p=>n.call(this,p,...f))}}typeof n!="function"&&Pa(6),o!==void 0&&typeof o!="function"&&Pa(7);let a;if(Fd(t)){const i=FZ(this),s=_q(t,void 0);let l=!0;try{a=n(s),l=!1}finally{l?wq(i):bq(i)}return BZ(i,o),UZ(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===wJ&&(a=void 0),this.autoFreeze_&&cV(a,!0),o){const i=[],s=[];Ud("Patches").generateReplacementPatches_(t,a,i,s),o(i,s)}return a}else Pa(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...l)=>this.produceWithPatches(s,h=>t(h,...l));let o,a;return[this.produce(t,n,(s,l)=>{o=s,a=l}),o,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Fd(e)||Pa(8),jh(e)&&(e=y2e(e));const t=FZ(this),n=_q(e,void 0);return n[Jo].isManual_=!0,bq(t),n}finishDraft(e,t){const n=e&&e[Jo];(!n||!n.isManual_)&&Pa(9);const{scope_:o}=n;return BZ(o,t),UZ(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const o=Ud("Patches").applyPatches_;return jh(e)?o(e,t):this.produce(e,a=>o(a,t))}};function _q(e,t){const n=wD(e)?Ud("MapSet").proxyMap_(e,t):bD(e)?Ud("MapSet").proxySet_(e,t):h2e(e,t);return(t?t.scope_:_J()).drafts_.push(n),n}function y2e(e){return jh(e)||Pa(10,e),CJ(e)}function CJ(e){if(!Fd(e)||MD(e))return e;const t=e[Jo];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xq(e,t.scope_.immer_.useStrictShallowCopy_)}else n=xq(e,!0);return PR(n,(o,a)=>{MJ(n,o,CJ(a))}),t&&(t.finalized_=!1),n}var ea=new p2e,m2e=ea.produce;ea.produceWithPatches.bind(ea);ea.setAutoFreeze.bind(ea);ea.setUseStrictShallowCopy.bind(ea);ea.applyPatches.bind(ea);ea.createDraft.bind(ea);ea.finishDraft.bind(ea);const g2e=e=>(t,n,o)=>(o.setState=(a,i,...s)=>{const l=typeof a=="function"?m2e(a):a;return t(l,i,...s)},e(o.setState,n,o)),NJ=g2e,_r=Object.create(null);_r.open="0";_r.close="1";_r.ping="2";_r.pong="3";_r.message="4";_r.upgrade="5";_r.noop="6";const ym=Object.create(null);Object.keys(_r).forEach(e=>{ym[_r[e]]=e});const Sq={type:"error",data:"parser error"},LJ=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",jJ=typeof ArrayBuffer=="function",AJ=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,uV=({type:e,data:t},n,o)=>LJ&&t instanceof Blob?n?o(t):XZ(t,o):jJ&&(t instanceof ArrayBuffer||AJ(t))?n?o(t):XZ(new Blob([t]),o):o(_r[e]+(t||"")),XZ=(e,t)=>{const n=new FileReader;return n.onload=function(){const o=n.result.split(",")[1];t("b"+(o||""))},n.readAsDataURL(e)};function ZZ(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Kz;function k2e(e,t){if(LJ&&e.data instanceof Blob)return e.data.arrayBuffer().then(ZZ).then(t);if(jJ&&(e.data instanceof ArrayBuffer||AJ(e.data)))return t(ZZ(e.data));uV(e,!1,n=>{Kz||(Kz=new TextEncoder),t(Kz.encode(n))})}const YZ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<YZ.length;e++)v0[YZ.charCodeAt(e)]=e;const v2e=e=>{let t=e.length*.75,n=e.length,o,a=0,i,s,l,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const f=new ArrayBuffer(t),p=new Uint8Array(f);for(o=0;o<n;o+=4)i=v0[e.charCodeAt(o)],s=v0[e.charCodeAt(o+1)],l=v0[e.charCodeAt(o+2)],h=v0[e.charCodeAt(o+3)],p[a++]=i<<2|s>>4,p[a++]=(s&15)<<4|l>>2,p[a++]=(l&3)<<6|h&63;return f},x2e=typeof ArrayBuffer=="function",dV=(e,t)=>{if(typeof e!="string")return{type:"message",data:EJ(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:w2e(e.substring(1),t)}:ym[n]?e.length>1?{type:ym[n],data:e.substring(1)}:{type:ym[n]}:Sq},w2e=(e,t)=>{if(x2e){const n=v2e(e);return EJ(n,t)}else return{base64:!0,data:e}},EJ=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},TJ="",b2e=(e,t)=>{const n=e.length,o=new Array(n);let a=0;e.forEach((i,s)=>{uV(i,!1,l=>{o[s]=l,++a===n&&t(o.join(TJ))})})},M2e=(e,t)=>{const n=e.split(TJ),o=[];for(let a=0;a<n.length;a++){const i=dV(n[a],t);if(o.push(i),i.type==="error")break}return o};function _2e(){return new TransformStream({transform(e,t){k2e(e,n=>{const o=n.length;let a;if(o<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,o);else if(o<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,o)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let Qz;function Dy(e){return e.reduce((t,n)=>t+n.length,0)}function Py(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let o=0;for(let a=0;a<t;a++)n[a]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),n}function S2e(e,t){Qz||(Qz=new TextDecoder);const n=[];let o=0,a=-1,i=!1;return new TransformStream({transform(s,l){for(n.push(s);;){if(o===0){if(Dy(n)<1)break;const h=Py(n,1);i=(h[0]&128)===128,a=h[0]&127,a<126?o=3:a===126?o=1:o=2}else if(o===1){if(Dy(n)<2)break;const h=Py(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),o=3}else if(o===2){if(Dy(n)<8)break;const h=Py(n,8),f=new DataView(h.buffer,h.byteOffset,h.length),p=f.getUint32(0);if(p>Math.pow(2,21)-1){l.enqueue(Sq);break}a=p*Math.pow(2,32)+f.getUint32(4),o=3}else{if(Dy(n)<a)break;const h=Py(n,a);l.enqueue(dV(i?h:Qz.decode(h),t)),o=0}if(a===0||a>e){l.enqueue(Sq);break}}}})}const IJ=4;function An(e){if(e)return C2e(e)}function C2e(e){for(var t in An.prototype)e[t]=An.prototype[t];return e}An.prototype.on=An.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};An.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};An.prototype.off=An.prototype.removeListener=An.prototype.removeAllListeners=An.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,a=0;a<n.length;a++)if(o=n[a],o===t||o.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};An.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],o=1;o<arguments.length;o++)t[o-1]=arguments[o];if(n){n=n.slice(0);for(var o=0,a=n.length;o<a;++o)n[o].apply(this,t)}return this};An.prototype.emitReserved=An.prototype.emit;An.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};An.prototype.hasListeners=function(e){return!!this.listeners(e).length};const _D=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),pa=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),N2e="arraybuffer";function RJ(e,...t){return t.reduce((n,o)=>(e.hasOwnProperty(o)&&(n[o]=e[o]),n),{})}const L2e=pa.setTimeout,j2e=pa.clearTimeout;function SD(e,t){t.useNativeTimers?(e.setTimeoutFn=L2e.bind(pa),e.clearTimeoutFn=j2e.bind(pa)):(e.setTimeoutFn=pa.setTimeout.bind(pa),e.clearTimeoutFn=pa.clearTimeout.bind(pa))}const A2e=1.33;function E2e(e){return typeof e=="string"?T2e(e):Math.ceil((e.byteLength||e.size)*A2e)}function T2e(e){let t=0,n=0;for(let o=0,a=e.length;o<a;o++)t=e.charCodeAt(o),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(o++,n+=4);return n}function DJ(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function I2e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function R2e(e){let t={},n=e.split("&");for(let o=0,a=n.length;o<a;o++){let i=n[o].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class D2e extends Error{constructor(t,n,o){super(t),this.description=n,this.context=o,this.type="TransportError"}}class hV extends An{constructor(t){super(),this.writable=!1,SD(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,o){return super.emitReserved("error",new D2e(t,n,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=dV(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=I2e(t);return n.length?"?"+n:""}}class P2e extends hV{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};M2e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,b2e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=DJ()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let PJ=!1;try{PJ=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const $2e=PJ;function z2e(){}class O2e extends P2e{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let o=location.port;o||(o=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||o!==t.port}}doWrite(t,n){const o=this.request({method:"POST",data:t});o.on("success",n),o.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,o)=>{this.onError("xhr poll error",n,o)}),this.pollXhr=t}}let hh=class mm extends An{constructor(t,n,o){super(),this.createRequest=t,SD(this,o),this._opts=o,this._method=o.method||"GET",this._uri=n,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var t;const n=RJ(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(n);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&o.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var a;o.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=mm.requestsCount++,mm.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=z2e,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete mm.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};hh.requestsCount=0;hh.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",WZ);else if(typeof addEventListener=="function"){const e="onpagehide"in pa?"pagehide":"unload";addEventListener(e,WZ,!1)}}function WZ(){for(let e in hh.requests)hh.requests.hasOwnProperty(e)&&hh.requests[e].abort()}const q2e=function(){const e=$J({xdomain:!1});return e&&e.responseType!==null}();class H2e extends O2e{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=q2e&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new hh($J,this.uri(),t)}}function $J(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||$2e))return new XMLHttpRequest}catch{}if(!t)try{return new pa[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const zJ=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class V2e extends hV{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,o=zJ?{}:RJ(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,o)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,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 n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;uV(o,this.supportsBinary,i=>{try{this.doWrite(o,i)}catch{}a&&_D(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=DJ()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Jz=pa.WebSocket||pa.MozWebSocket;class B2e extends V2e{createSocket(t,n,o){return zJ?new Jz(t,n,o):n?new Jz(t,n):new Jz(t)}doWrite(t,n){this.ws.send(n)}}class F2e extends hV{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=S2e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=t.readable.pipeThrough(n).getReader(),a=_2e();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const i=()=>{o.read().then(({done:l,value:h})=>{l||(this.onPacket(h),i())}).catch(l=>{})};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;this._writer.write(o).then(()=>{a&&_D(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const U2e={websocket:B2e,webtransport:F2e,polling:H2e},G2e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,X2e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Cq(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),o=e.indexOf("]");n!=-1&&o!=-1&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));let a=G2e.exec(e||""),i={},s=14;for(;s--;)i[X2e[s]]=a[s]||"";return n!=-1&&o!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Z2e(i,i.path),i.queryKey=Y2e(i,i.query),i}function Z2e(e,t){const n=/\/{2,9}/g,o=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&o.splice(0,1),t.slice(-1)=="/"&&o.splice(o.length-1,1),o}function Y2e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,a,i){a&&(n[a]=i)}),n}const Nq=typeof addEventListener=="function"&&typeof removeEventListener=="function",gm=[];Nq&&addEventListener("offline",()=>{gm.forEach(e=>e())},!1);class Qi extends An{constructor(t,n){if(super(),this.binaryType=N2e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const o=Cq(t);n.hostname=o.host,n.secure=o.protocol==="https"||o.protocol==="wss",n.port=o.port,o.query&&(n.query=o.query)}else n.host&&(n.hostname=Cq(n.host).host);SD(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(o=>{const a=o.prototype.name;this.transports.push(a),this._transportsByName[a]=o}),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:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=R2e(this.opts.query)),Nq&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},gm.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=IJ,n.transport=t,this.id&&(n.sid=this.id);const o=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Qi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}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",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Qi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&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&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let o=0;o<this.writeBuffer.length;o++){const a=this.writeBuffer[o].data;if(a&&(n+=E2e(a)),o>0&&n>this._maxPayload)return this.writeBuffer.slice(0,o);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,_D(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,o){return this._sendPacket("message",t,n,o),this}send(t,n,o){return this._sendPacket("message",t,n,o),this}_sendPacket(t,n,o,a){if(typeof n=="function"&&(a=n,n=void 0),typeof o=="function"&&(a=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const i={type:t,data:n,options:o};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},o=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():t()}):this.upgrading?o():t()),this}_onError(t){if(Qi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Nq&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=gm.indexOf(this._offlineEventListener);o!==-1&&gm.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Qi.protocol=IJ;class W2e extends Qi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),o=!1;Qi.priorWebsocketSuccess=!1;const a=()=>{o||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!o)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Qi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const k=new Error("probe error");k.transport=n.name,this.emitReserved("upgradeError",k)}}))};function i(){o||(o=!0,p(),n.close(),n=null)}const s=m=>{const k=new Error("probe error: "+m);k.transport=n.name,i(),this.emitReserved("upgradeError",k)};function l(){s("transport closed")}function h(){s("socket closed")}function f(m){n&&m.name!==n.name&&i()}const p=()=>{n.removeListener("open",a),n.removeListener("error",s),n.removeListener("close",l),this.off("close",h),this.off("upgrading",f)};n.once("open",a),n.once("error",s),n.once("close",l),this.once("close",h),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{o||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let o=0;o<t.length;o++)~this.transports.indexOf(t[o])&&n.push(t[o]);return n}}let K2e=class extends W2e{constructor(t,n={}){const o=typeof t=="object"?t:n;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(a=>U2e[a]).filter(a=>!!a)),super(t,o)}};function Q2e(e,t="",n){let o=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),o=Cq(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const i=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port+t,o.href=o.protocol+"://"+i+(n&&n.port===o.port?"":":"+o.port),o}const J2e=typeof ArrayBuffer=="function",e0e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,OJ=Object.prototype.toString,t0e=typeof Blob=="function"||typeof Blob<"u"&&OJ.call(Blob)==="[object BlobConstructor]",n0e=typeof File=="function"||typeof File<"u"&&OJ.call(File)==="[object FileConstructor]";function fV(e){return J2e&&(e instanceof ArrayBuffer||e0e(e))||t0e&&e instanceof Blob||n0e&&e instanceof File}function km(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,o=e.length;n<o;n++)if(km(e[n]))return!0;return!1}if(fV(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return km(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&km(e[n]))return!0;return!1}function o0e(e){const t=[],n=e.data,o=e;return o.data=Lq(n,t),o.attachments=t.length,{packet:o,buffers:t}}function Lq(e,t){if(!e)return e;if(fV(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=Lq(e[o],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=Lq(e[o],t));return n}return e}function a0e(e,t){return e.data=jq(e.data,t),delete e.attachments,e}function jq(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=jq(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=jq(e[n],t));return e}const r0e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],i0e=5;var _t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(_t||(_t={}));class s0e{constructor(t){this.replacer=t}encode(t){return(t.type===_t.EVENT||t.type===_t.ACK)&&km(t)?this.encodeAsBinary({type:t.type===_t.EVENT?_t.BINARY_EVENT:_t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===_t.BINARY_EVENT||t.type===_t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=o0e(t),o=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(o),a}}function KZ(e){return Object.prototype.toString.call(e)==="[object Object]"}class pV extends An{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const o=n.type===_t.BINARY_EVENT;o||n.type===_t.BINARY_ACK?(n.type=o?_t.EVENT:_t.ACK,this.reconstructor=new c0e(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(fV(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const o={type:Number(t.charAt(0))};if(_t[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===_t.BINARY_EVENT||o.type===_t.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(i,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");o.attachments=Number(s)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););o.nsp=t.substring(i,n)}else o.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const i=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}o.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(pV.isPayloadValid(o.type,i))o.data=i;else throw new Error("invalid payload")}return o}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case _t.CONNECT:return KZ(n);case _t.DISCONNECT:return n===void 0;case _t.CONNECT_ERROR:return typeof n=="string"||KZ(n);case _t.EVENT:case _t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&r0e.indexOf(n[0])===-1);case _t.ACK:case _t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class c0e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=a0e(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const l0e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:pV,Encoder:s0e,get PacketType(){return _t},protocol:i0e},Symbol.toStringTag,{value:"Module"}));function Ia(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const u0e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class qJ extends An{constructor(t,n,o){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=n,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ia(t,"open",this.onopen.bind(this)),Ia(t,"packet",this.onpacket.bind(this)),Ia(t,"error",this.onerror.bind(this)),Ia(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var o,a,i;if(u0e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:_t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,m=n.pop();this._registerAckCallback(p,m),s.id=p}const l=(a=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(h?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var o;const a=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},a),s=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((o,a)=>{const i=(s,l)=>s?a(s):o(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>o!==this._queue[0]?void 0:(a!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:_t.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,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(o=>String(o.id)===t)){const o=this.acks[t];delete this.acks[t],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case _t.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 _t.EVENT:case _t.BINARY_EVENT:this.onevent(t);break;case _t.ACK:case _t.BINARY_ACK:this.onack(t);break;case _t.DISCONNECT:this.ondisconnect();break;case _t.CONNECT_ERROR:this.destroy();const o=new Error(t.data.message);o.data=t.data.data,this.emitReserved("connect_error",o);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const o of n)o.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let o=!1;return function(...a){o||(o=!0,n.packet({type:_t.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,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:_t.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 n=this._anyListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,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 n=this._anyOutgoingListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const o of n)o.apply(this,t.data)}}}function Vh(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Vh.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};Vh.prototype.reset=function(){this.attempts=0};Vh.prototype.setMin=function(e){this.ms=e};Vh.prototype.setMax=function(e){this.max=e};Vh.prototype.setJitter=function(e){this.jitter=e};class Aq extends An{constructor(t,n){var o;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,SD(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((o=n.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new Vh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||l0e;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new K2e(this.uri,this.opts);const n=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const a=Ia(n,"open",function(){o.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},s=Ia(n,"error",i);if(this._timeout!==!1){const l=this._timeout,h=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ia(t,"ping",this.onping.bind(this)),Ia(t,"data",this.ondata.bind(this)),Ia(t,"error",this.onerror.bind(this)),Ia(t,"close",this.onclose.bind(this)),Ia(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){_D(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let o=this.nsps[t];return o?this._autoConnect&&!o.active&&o.connect():(o=new qJ(this,t,n),this.nsps[t]=o),o}_destroy(t){const n=Object.keys(this.nsps);for(const o of n)if(this.nsps[o].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let o=0;o<n.length;o++)this.engine.write(n[o],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")}disconnect(){return this._close()}onclose(t,n){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),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 n=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const a0={};function vm(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Q2e(e,t.path||"/socket.io"),o=n.source,a=n.id,i=n.path,s=a0[a]&&i in a0[a].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let h;return l?h=new Aq(o,t):(a0[a]||(a0[a]=new Aq(o,t)),h=a0[a]),n.query&&!t.query&&(t.query=n.queryKey),h.socket(n.path,t)}Object.assign(vm,{Manager:Aq,Socket:qJ,io:vm,connect:vm});const d0e=1,h0e=1e6;let eO=0;function f0e(){return eO=(eO+1)%Number.MAX_SAFE_INTEGER,eO.toString()}const tO=new Map,QZ=e=>{if(tO.has(e))return;const t=setTimeout(()=>{tO.delete(e),j0({type:"REMOVE_TOAST",toastId:e})},h0e);tO.set(e,t)},p0e=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,d0e)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?QZ(n):e.toasts.forEach(o=>{QZ(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},xm=[];let wm={toasts:[]};function j0(e){wm=p0e(wm,e),xm.forEach(t=>{t(wm)})}function Wo({...e}){const t=f0e(),n=a=>j0({type:"UPDATE_TOAST",toast:{...a,id:t}}),o=()=>j0({type:"DISMISS_TOAST",toastId:t});return j0({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||o()}}}),{id:t,dismiss:o,update:n}}function Zt(){const[e,t]=v.useState(wm);return v.useEffect(()=>(xm.push(t),()=>{const n=xm.indexOf(t);n>-1&&xm.splice(n,1)}),[e]),{...e,toast:Wo,dismiss:n=>j0({type:"DISMISS_TOAST",toastId:n})}}const Le=async(e,t={},n)=>{const o=Ee.getState().token,a={"Content-Type":"application/json",...t.headers};o&&(a.Authorization=`Bearer ${o}`);const i={...t,headers:a};i.body&&typeof i.body=="object"&&(i.body=JSON.stringify(i.body));try{const s=await fetch(e,i);if(s.status===204||s.headers.get("content-length")==="0")return n&&Wo({title:"Успех!",description:n}),!0;const l=await s.json();if(!s.ok){if(s.status===401){const{logout:h}=Ee.getState();return h(),null}throw new Error(l.error||"Произошла неизвестная ошибка на сервере")}return n&&Wo({title:"Успех!",description:n}),l}catch(s){if(s.message.includes("NetworkError")||s.message.includes("Failed to fetch"))Wo({variant:"destructive",title:"Ошибка сети",description:"Не удается подключиться к серверу"});else if(s.message.includes("Невалидный токен")){const{logout:l}=Ee.getState();return l(),null}else Wo({variant:"destructive",title:"Ошибка",description:s.message});throw s}},y0e=(e,t)=>({socket:null,bots:[],servers:[],botStatuses:{},botLogs:{},resourceUsage:{},appVersion:"",connectSocket:()=>{t().socket&&t().socket.disconnect();const n=t().token;if(!n){console.log("[Socket] Подключение отложено: нет токена.");return}const o=window.location.origin;console.log(`[Socket] Попытка подключения к: ${o}`);const a=vm(o,{auth:{token:n},autoConnect:!1,reconnection:!0,transports:["websocket"]});a.on("connect",()=>console.log("Socket.IO подключен:",a.id)),a.on("disconnect",i=>console.log("Socket.IO отключен:",i)),a.on("connect_error",i=>{console.error(`[Socket] Ошибка подключения: ${i.message}`)}),a.on("bot:status",({botId:i,status:s,message:l})=>{e(h=>{h.botStatuses[i]=s}),l&&t().appendLog(i,`[SYSTEM] ${l}`)}),a.on("bot:log",({botId:i,log:s})=>t().appendLog(i,s)),a.on("bots:usage",i=>{const s=i.reduce((l,h)=>({...l,[h.botId]:h}),{});e({resourceUsage:s})}),e({socket:a})},fetchInitialData:async()=>{try{const[n,o,a,i]=await Promise.all([Le("/api/bots"),Le("/api/servers"),Le("/api/bots/state"),Le("/api/version")]);e(s=>{s.bots=n||[],s.servers=o||[],s.botStatuses=a.statuses||{},s.botLogs=a.logs||{},s.appVersion=i.version||""})}catch(n){console.error("Не удалось загрузить начальные данные:",n.message),e(o=>{o.bots=[],o.servers=[]})}},appendLog:(n,o)=>{e(a=>{const i=a.botLogs[n]||[],s=typeof o=="object"&&o!==null?o:{id:Date.now()+Math.random(),content:o},l=[...i,s],h=Array.from(new Map(l.map(f=>[f.id,f])).values());return{botLogs:{...a.botLogs,[n]:h.slice(-500)}}})}}),m0e=(e,t)=>({createBot:async n=>{const o=await Le("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Новый бот успешно создан.");return o&&await t().fetchInitialData(),o},startBot:async n=>{await Le(`/api/bots/${n}/start`,{method:"POST"})},stopBot:async n=>{await Le(`/api/bots/${n}/stop`,{method:"POST"})},deleteBot:async n=>{await Le(`/api/bots/${n}`,{method:"DELETE"},"Бот успешно удален."),await t().fetchInitialData()},startAllBots:async()=>{await Le("/api/bots/start-all",{method:"POST"},"Команда на запуск всех ботов отправлена.")},stopAllBots:async()=>{await Le("/api/bots/stop-all",{method:"POST"},"Команда на остановку всех ботов отправлена.")}}),g0e=(e,t)=>({installedPlugins:{},pluginUpdates:{},pluginCatalog:[],isCatalogLoading:!0,optimisticallyIncrementDownloadCount:n=>{e(o=>{const a=o.pluginCatalog.find(i=>i.name===n);a&&(a.downloads=(a.downloads||0)+1)})},fetchPluginCatalog:async()=>{if(t().pluginCatalog.length>0){e({isCatalogLoading:!1});return}e({isCatalogLoading:!0});try{const n=await Le("/api/plugins/catalog");let o=new Map;try{const i=await fetch("http://185.65.200.184:3000/api/stats");if(i.ok){const s=await i.json();o=new Map(((s==null?void 0:s.plugins)||[]).map(l=>[l.pluginName,l.downloadCount]))}}catch(i){console.warn("Не удалось загрузить статистику скачиваний плагинов:",i.message)}const a=(n||[]).map(i=>({...i,downloads:o.get(i.name)||0}));e({pluginCatalog:a,isCatalogLoading:!1})}catch(n){console.error("Не удалось загрузить каталог плагинов:",n.message),e({pluginCatalog:[],isCatalogLoading:!1})}},fetchInstalledPlugins:async n=>{try{const a=(await Le(`/api/bots/${n}/plugins`)).map(i=>{let s;try{s=i.manifest?JSON.parse(i.manifest):{}}catch{console.error(`Ошибка парсинга манифеста для плагина ${i.name}`),s={}}const l=t().pluginCatalog.find(h=>h.name===i.name);return{...i,manifest:s,author:(l==null?void 0:l.author)||s.author||"Неизвестный автор",description:i.description||s.description||"Нет описания"}});e(i=>{i.installedPlugins[n]=a})}catch(o){console.error("Не удалось загрузить плагины для бота",n,o),e(a=>{a.installedPlugins[n]=[]})}},togglePlugin:async(n,o,a)=>{await Le(`/api/bots/${n}/plugins/${o}`,{method:"PUT",body:JSON.stringify({isEnabled:a})},"Статус плагина обновлен."),await t().fetchInstalledPlugins(n)},deletePlugin:async(n,o,a)=>{await Le(`/api/bots/${n}/plugins/${o}`,{method:"DELETE"},`Плагин "${a}" удален.`),await t().fetchInstalledPlugins(n)},installPluginFromRepo:async(n,o,a)=>{a&&t().optimisticallyIncrementDownloadCount(a);try{const i=await Le(`/api/bots/${n}/plugins/install/github`,{method:"POST",body:JSON.stringify({repoUrl:o})});return Wo({title:"Успех!",description:`Плагин "${i.name}" успешно установлен.`}),await t().fetchInstalledPlugins(n),i}catch(i){throw await t().fetchPluginCatalog(),i}},installPluginFromPath:async(n,o)=>{try{const a=await Le(`/api/bots/${n}/plugins/install/local`,{method:"POST",body:JSON.stringify({path:o})});return Wo({title:"Успех!",description:`Плагин "${a.name}" успешно установлен.`}),a}catch(a){throw a}finally{await t().fetchInstalledPlugins(n),await t().fetchPluginCatalog()}},checkForUpdates:async n=>{try{const o=await Le(`/api/plugins/check-updates/${n}`,{method:"POST"}),a=o.reduce((i,s)=>({...i,[s.sourceUri]:s}),{});e(i=>{i.pluginUpdates[n]=a}),Wo({title:"Проверка завершена",description:`Найдено обновлений: ${o.length}`})}catch(o){console.error("Ошибка проверки обновлений:",o)}},updatePlugin:async(n,o)=>{await Le(`/api/plugins/update/${n}`,{method:"POST"},"Плагин обновлен. Перезапустите бота."),await t().fetchInstalledPlugins(o),await t().checkForUpdates(o)}}),k0e=(e,t)=>({tasks:[],fetchTasks:async()=>{try{const n=await Le("/api/tasks");e({tasks:n||[]})}catch(n){console.error("Не удалось загрузить задачи:",n.message),e({tasks:[]})}},createTask:async n=>{const o=await Le("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Задача успешно создана.");return o&&e(a=>{a.tasks.unshift(o)}),o},updateTask:async(n,o)=>{const a=await Le(`/api/tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Задача успешно обновлена.");return a&&e(i=>{const s=i.tasks.findIndex(l=>l.id===n);s!==-1&&(i.tasks[s]={...i.tasks[s],...a})}),a},deleteTask:async n=>{await Le(`/api/tasks/${n}`,{method:"DELETE"},"Задача успешно удалена."),e(o=>{o.tasks=o.tasks.filter(a=>a.id!==n)})}}),v0e=(e,t)=>({token:localStorage.getItem("authToken")||null,user:null,isAuthenticated:!1,needsSetup:!1,authInitialized:!1,hasPermission:n=>{var a;if(!n)return!0;const o=((a=t().user)==null?void 0:a.permissions)||[];return o.includes("*")||o.includes(n)},initializeAuth:async()=>{try{if((await Le("/api/auth/status")).needsSetup){e({needsSetup:!0,isAuthenticated:!1,token:null,user:null});return}if(e({needsSetup:!1}),t().token){const a=await Le("/api/auth/me");e({user:a,isAuthenticated:!0})}else e({isAuthenticated:!1,user:null,token:null})}catch(n){console.error("Auth initialization failed:",n.message),(n.message.includes("Невалидный токен")||n.message.includes("Нет токена"))&&localStorage.removeItem("authToken"),e({isAuthenticated:!1,token:null,user:null})}finally{e({authInitialized:!0})}},login:async(n,o)=>{const a=await Le("/api/auth/login",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0}),t().connectSocket()},setupAdmin:async(n,o)=>{const a=await Le("/api/auth/setup",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0,needsSetup:!1}),t().connectSocket()},logout:()=>{const n=t().socket;n&&n.disconnect(),localStorage.removeItem("authToken"),e({token:null,user:null,isAuthenticated:!1,socket:null})}}),Ee=xJ(NJ((...e)=>({...y0e(...e),...m0e(...e),...g0e(...e),...k0e(...e),...v0e(...e)})));function Me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function JZ(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ni(...e){return t=>{let n=!1;const o=e.map(a=>{const i=JZ(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<o.length;a++){const i=o[a];typeof i=="function"?i():JZ(e[a],null)}}}}function st(...e){return v.useCallback(ni(...e),e)}function x0e(e,t){const n=v.createContext(t),o=i=>{const{children:s,...l}=i,h=v.useMemo(()=>l,Object.values(l));return u.jsx(n.Provider,{value:h,children:s})};o.displayName=e+"Provider";function a(i){const s=v.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,a]}function ro(e,t=[]){let n=[];function o(i,s){const l=v.createContext(s),h=n.length;n=[...n,s];const f=m=>{var _;const{scope:k,children:x,...M}=m,b=((_=k==null?void 0:k[e])==null?void 0:_[h])||l,C=v.useMemo(()=>M,Object.values(M));return u.jsx(b.Provider,{value:C,children:x})};f.displayName=i+"Provider";function p(m,k){var b;const x=((b=k==null?void 0:k[e])==null?void 0:b[h])||l,M=v.useContext(x);if(M)return M;if(s!==void 0)return s;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[f,p]}const a=()=>{const i=n.map(s=>v.createContext(s));return function(l){const h=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:h}}),[l,h])}};return a.scopeName=e,[o,w0e(a,...t)]}function w0e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=o.reduce((l,{useScope:h,scopeName:f})=>{const m=h(i)[`__scope${f}`];return{...l,...m}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function us(e){const t=M0e(e),n=v.forwardRef((o,a)=>{const{children:i,...s}=o,l=v.Children.toArray(i),h=l.find(_0e);if(h){const f=h.props.children,p=l.map(m=>m===h?v.Children.count(f)>1?v.Children.only(null):v.isValidElement(f)?f.props.children:null:m);return u.jsx(t,{...s,ref:a,children:v.isValidElement(f)?v.cloneElement(f,void 0,p):null})}return u.jsx(t,{...s,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var b0e=us("Slot");function M0e(e){const t=v.forwardRef((n,o)=>{const{children:a,...i}=n;if(v.isValidElement(a)){const s=C0e(a),l=S0e(i,a.props);return a.type!==v.Fragment&&(l.ref=o?ni(o,s):s),v.cloneElement(a,l)}return v.Children.count(a)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var HJ=Symbol("radix.slottable");function VJ(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=HJ,t}function _0e(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===HJ}function S0e(e,t){const n={...t};for(const o in t){const a=e[o],i=t[o];/^on[A-Z]/.test(o)?a&&i?n[o]=(...l)=>{const h=i(...l);return a(...l),h}:a&&(n[o]=a):o==="style"?n[o]={...a,...i}:o==="className"&&(n[o]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function C0e(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Wf(e){const t=e+"CollectionProvider",[n,o]=ro(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=b=>{const{scope:C,children:_}=b,N=le.useRef(null),A=le.useRef(new Map).current;return u.jsx(a,{scope:C,itemMap:A,collectionRef:N,children:_})};s.displayName=t;const l=e+"CollectionSlot",h=us(l),f=le.forwardRef((b,C)=>{const{scope:_,children:N}=b,A=i(l,_),T=st(C,A.collectionRef);return u.jsx(h,{ref:T,children:N})});f.displayName=l;const p=e+"CollectionItemSlot",m="data-radix-collection-item",k=us(p),x=le.forwardRef((b,C)=>{const{scope:_,children:N,...A}=b,T=le.useRef(null),I=st(C,T),j=i(p,_);return le.useEffect(()=>(j.itemMap.set(T,{ref:T,...A}),()=>void j.itemMap.delete(T))),u.jsx(k,{[m]:"",ref:I,children:N})});x.displayName=p;function M(b){const C=i(e+"CollectionConsumer",b);return le.useCallback(()=>{const N=C.collectionRef.current;if(!N)return[];const A=Array.from(N.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((j,$)=>A.indexOf(j.ref.current)-A.indexOf($.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:s,Slot:f,ItemSlot:x},M,o]}var N0e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=N0e.reduce((e,t)=>{const n=us(`Primitive.${t}`),o=v.forwardRef((a,i)=>{const{asChild:s,...l}=a,h=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(h,{...l,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function yV(e,t){e&&t1.flushSync(()=>e.dispatchEvent(t))}function wn(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function L0e(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e);v.useEffect(()=>{const o=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var j0e="DismissableLayer",Eq="dismissableLayer.update",A0e="dismissableLayer.pointerDownOutside",E0e="dismissableLayer.focusOutside",eY,BJ=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),n1=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...h}=e,f=v.useContext(BJ),[p,m]=v.useState(null),k=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=v.useState({}),M=st(t,$=>m($)),b=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),_=b.indexOf(C),N=p?b.indexOf(p):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,T=N>=_,I=I0e($=>{const z=$.target,F=[...f.branches].some(V=>V.contains(z));!T||F||(a==null||a($),s==null||s($),$.defaultPrevented||l==null||l())},k),j=R0e($=>{const z=$.target;[...f.branches].some(V=>V.contains(z))||(i==null||i($),s==null||s($),$.defaultPrevented||l==null||l())},k);return L0e($=>{N===f.layers.size-1&&(o==null||o($),!$.defaultPrevented&&l&&($.preventDefault(),l()))},k),v.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(eY=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),tY(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=eY)}},[p,k,n,f]),v.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),tY())},[p,f]),v.useEffect(()=>{const $=()=>x({});return document.addEventListener(Eq,$),()=>document.removeEventListener(Eq,$)},[]),u.jsx(Ae.div,{...h,ref:M,style:{pointerEvents:A?T?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,I.onPointerDownCapture)})});n1.displayName=j0e;var T0e="DismissableLayerBranch",FJ=v.forwardRef((e,t)=>{const n=v.useContext(BJ),o=v.useRef(null),a=st(t,o);return v.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(Ae.div,{...e,ref:a})});FJ.displayName=T0e;function I0e(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),o=v.useRef(!1),a=v.useRef(()=>{});return v.useEffect(()=>{const i=l=>{if(l.target&&!o.current){let h=function(){UJ(A0e,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=h,t.addEventListener("click",a.current,{once:!0})):h()}else t.removeEventListener("click",a.current);o.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function R0e(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),o=v.useRef(!1);return v.useEffect(()=>{const a=i=>{i.target&&!o.current&&UJ(E0e,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function tY(){const e=new CustomEvent(Eq);document.dispatchEvent(e)}function UJ(e,t,n,{discrete:o}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?yV(a,i):a.dispatchEvent(i)}var D0e=n1,P0e=FJ,qn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},$0e="Portal",o1=v.forwardRef((e,t)=>{var l;const{container:n,...o}=e,[a,i]=v.useState(!1);qn(()=>i(!0),[]);const s=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?t2e.createPortal(u.jsx(Ae.div,{...o,ref:t}),s):null});o1.displayName=$0e;function z0e(e,t){return v.useReducer((n,o)=>t[n][o]??n,e)}var Tn=e=>{const{present:t,children:n}=e,o=O0e(t),a=typeof n=="function"?n({present:o.isPresent}):v.Children.only(n),i=st(o.ref,q0e(a));return typeof n=="function"||o.isPresent?v.cloneElement(a,{ref:i}):null};Tn.displayName="Presence";function O0e(e){const[t,n]=v.useState(),o=v.useRef(null),a=v.useRef(e),i=v.useRef("none"),s=e?"mounted":"unmounted",[l,h]=z0e(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const f=$y(o.current);i.current=l==="mounted"?f:"none"},[l]),qn(()=>{const f=o.current,p=a.current;if(p!==e){const k=i.current,x=$y(f);e?h("MOUNT"):x==="none"||(f==null?void 0:f.display)==="none"?h("UNMOUNT"):h(p&&k!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),qn(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,m=x=>{const b=$y(o.current).includes(x.animationName);if(x.target===t&&b&&(h("ANIMATION_END"),!a.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},k=x=>{x.target===t&&(i.current=$y(o.current))};return t.addEventListener("animationstart",k),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(f),t.removeEventListener("animationstart",k),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function $y(e){return(e==null?void 0:e.animationName)||"none"}function q0e(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H0e=QH[" useInsertionEffect ".trim().toString()]||qn;function Eo({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[a,i,s]=V0e({defaultProp:t,onChange:n}),l=e!==void 0,h=l?e:a;{const p=v.useRef(e!==void 0);v.useEffect(()=>{const m=p.current;m!==l&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,o])}const f=v.useCallback(p=>{var m;if(l){const k=B0e(p)?p(e):p;k!==e&&((m=s.current)==null||m.call(s,k))}else i(p)},[l,e,i,s]);return[h,f]}function V0e({defaultProp:e,onChange:t}){const[n,o]=v.useState(e),a=v.useRef(n),i=v.useRef(t);return H0e(()=>{i.current=t},[t]),v.useEffect(()=>{var s;a.current!==n&&((s=i.current)==null||s.call(i,n),a.current=n)},[n,a]),[n,o,i]}function B0e(e){return typeof e=="function"}var GJ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),F0e="VisuallyHidden",CD=v.forwardRef((e,t)=>u.jsx(Ae.span,{...e,ref:t,style:{...GJ,...e.style}}));CD.displayName=F0e;var U0e=CD,mV="ToastProvider",[gV,G0e,X0e]=Wf("Toast"),[XJ,Hzt]=ro("Toast",[X0e]),[Z0e,ND]=XJ(mV),ZJ=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:s}=e,[l,h]=v.useState(null),[f,p]=v.useState(0),m=v.useRef(!1),k=v.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${mV}\`. Expected non-empty \`string\`.`),u.jsx(gV.Provider,{scope:t,children:u.jsx(Z0e,{scope:t,label:n,duration:o,swipeDirection:a,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:h,onToastAdd:v.useCallback(()=>p(x=>x+1),[]),onToastRemove:v.useCallback(()=>p(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:k,children:s})})};ZJ.displayName=mV;var YJ="ToastViewport",Y0e=["F8"],Tq="toast.viewportPause",Iq="toast.viewportResume",WJ=v.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=Y0e,label:a="Notifications ({hotkey})",...i}=e,s=ND(YJ,n),l=G0e(n),h=v.useRef(null),f=v.useRef(null),p=v.useRef(null),m=v.useRef(null),k=st(t,m,s.onViewportChange),x=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=s.toastCount>0;v.useEffect(()=>{const C=_=>{var A;o.length!==0&&o.every(T=>_[T]||_.code===T)&&((A=m.current)==null||A.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[o]),v.useEffect(()=>{const C=h.current,_=m.current;if(M&&C&&_){const N=()=>{if(!s.isClosePausedRef.current){const j=new CustomEvent(Tq);_.dispatchEvent(j),s.isClosePausedRef.current=!0}},A=()=>{if(s.isClosePausedRef.current){const j=new CustomEvent(Iq);_.dispatchEvent(j),s.isClosePausedRef.current=!1}},T=j=>{!C.contains(j.relatedTarget)&&A()},I=()=>{C.contains(document.activeElement)||A()};return C.addEventListener("focusin",N),C.addEventListener("focusout",T),C.addEventListener("pointermove",N),C.addEventListener("pointerleave",I),window.addEventListener("blur",N),window.addEventListener("focus",A),()=>{C.removeEventListener("focusin",N),C.removeEventListener("focusout",T),C.removeEventListener("pointermove",N),C.removeEventListener("pointerleave",I),window.removeEventListener("blur",N),window.removeEventListener("focus",A)}}},[M,s.isClosePausedRef]);const b=v.useCallback(({tabbingDirection:C})=>{const N=l().map(A=>{const T=A.ref.current,I=[T,...cfe(T)];return C==="forwards"?I:I.reverse()});return(C==="forwards"?N.reverse():N).flat()},[l]);return v.useEffect(()=>{const C=m.current;if(C){const _=N=>{var I,j,$;const A=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!A){const z=document.activeElement,F=N.shiftKey;if(N.target===C&&F){(I=f.current)==null||I.focus();return}const q=b({tabbingDirection:F?"backwards":"forwards"}),H=q.findIndex(E=>E===z);nO(q.slice(H+1))?N.preventDefault():F?(j=f.current)==null||j.focus():($=p.current)==null||$.focus()}};return C.addEventListener("keydown",_),()=>C.removeEventListener("keydown",_)}},[l,b]),u.jsxs(P0e,{ref:h,role:"region","aria-label":a.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:M?void 0:"none"},children:[M&&u.jsx(Rq,{ref:f,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"forwards"});nO(C)}}),u.jsx(gV.Slot,{scope:n,children:u.jsx(Ae.ol,{tabIndex:-1,...i,ref:k})}),M&&u.jsx(Rq,{ref:p,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"backwards"});nO(C)}})]})});WJ.displayName=YJ;var KJ="ToastFocusProxy",Rq=v.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...a}=e,i=ND(KJ,n);return u.jsx(CD,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var f;const l=s.relatedTarget;!((f=i.viewport)!=null&&f.contains(l))&&o()}})});Rq.displayName=KJ;var Kf="Toast",W0e="toast.swipeStart",K0e="toast.swipeMove",Q0e="toast.swipeCancel",J0e="toast.swipeEnd",QJ=v.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:a,onOpenChange:i,...s}=e,[l,h]=Eo({prop:o,defaultProp:a??!0,onChange:i,caller:Kf});return u.jsx(Tn,{present:n||l,children:u.jsx(nfe,{open:l,...s,ref:t,onClose:()=>h(!1),onPause:wn(e.onPause),onResume:wn(e.onResume),onSwipeStart:Me(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Me(e.onSwipeMove,f=>{const{x:p,y:m}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Me(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Me(e.onSwipeEnd,f=>{const{x:p,y:m}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),h(!1)})})})});QJ.displayName=Kf;var[efe,tfe]=XJ(Kf,{onClose(){}}),nfe=v.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:a,open:i,onClose:s,onEscapeKeyDown:l,onPause:h,onResume:f,onSwipeStart:p,onSwipeMove:m,onSwipeCancel:k,onSwipeEnd:x,...M}=e,b=ND(Kf,n),[C,_]=v.useState(null),N=st(t,E=>_(E)),A=v.useRef(null),T=v.useRef(null),I=a||b.duration,j=v.useRef(0),$=v.useRef(I),z=v.useRef(0),{onToastAdd:F,onToastRemove:V}=b,W=wn(()=>{var O;(C==null?void 0:C.contains(document.activeElement))&&((O=b.viewport)==null||O.focus()),s()}),q=v.useCallback(E=>{!E||E===1/0||(window.clearTimeout(z.current),j.current=new Date().getTime(),z.current=window.setTimeout(W,E))},[W]);v.useEffect(()=>{const E=b.viewport;if(E){const O=()=>{q($.current),f==null||f()},D=()=>{const G=new Date().getTime()-j.current;$.current=$.current-G,window.clearTimeout(z.current),h==null||h()};return E.addEventListener(Tq,D),E.addEventListener(Iq,O),()=>{E.removeEventListener(Tq,D),E.removeEventListener(Iq,O)}}},[b.viewport,I,h,f,q]),v.useEffect(()=>{i&&!b.isClosePausedRef.current&&q(I)},[i,I,b.isClosePausedRef,q]),v.useEffect(()=>(F(),()=>V()),[F,V]);const H=v.useMemo(()=>C?ree(C):null,[C]);return b.viewport?u.jsxs(u.Fragment,{children:[H&&u.jsx(ofe,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:H}),u.jsx(efe,{scope:n,onClose:W,children:t1.createPortal(u.jsx(gV.ItemSlot,{scope:n,children:u.jsx(D0e,{asChild:!0,onEscapeKeyDown:Me(l,()=>{b.isFocusedToastEscapeKeyDownRef.current||W(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:u.jsx(Ae.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection,...M,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Me(e.onKeyDown,E=>{E.key==="Escape"&&(l==null||l(E.nativeEvent),E.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,W()))}),onPointerDown:Me(e.onPointerDown,E=>{E.button===0&&(A.current={x:E.clientX,y:E.clientY})}),onPointerMove:Me(e.onPointerMove,E=>{if(!A.current)return;const O=E.clientX-A.current.x,D=E.clientY-A.current.y,G=!!T.current,X=["left","right"].includes(b.swipeDirection),Z=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,L=X?Z(0,O):0,Y=X?0:Z(0,D),U=E.pointerType==="touch"?10:2,R={x:L,y:Y},K={originalEvent:E,delta:R};G?(T.current=R,zy(K0e,m,K,{discrete:!1})):nY(R,b.swipeDirection,U)?(T.current=R,zy(W0e,p,K,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(O)>U||Math.abs(D)>U)&&(A.current=null)}),onPointerUp:Me(e.onPointerUp,E=>{const O=T.current,D=E.target;if(D.hasPointerCapture(E.pointerId)&&D.releasePointerCapture(E.pointerId),T.current=null,A.current=null,O){const G=E.currentTarget,X={originalEvent:E,delta:O};nY(O,b.swipeDirection,b.swipeThreshold)?zy(J0e,x,X,{discrete:!0}):zy(Q0e,k,X,{discrete:!0}),G.addEventListener("click",Z=>Z.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),ofe=e=>{const{__scopeToast:t,children:n,...o}=e,a=ND(Kf,t),[i,s]=v.useState(!1),[l,h]=v.useState(!1);return ife(()=>s(!0)),v.useEffect(()=>{const f=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(f)},[]),l?null:u.jsx(o1,{asChild:!0,children:u.jsx(CD,{...o,children:i&&u.jsxs(u.Fragment,{children:[a.label," ",n]})})})},afe="ToastTitle",JJ=v.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});JJ.displayName=afe;var rfe="ToastDescription",eee=v.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});eee.displayName=rfe;var tee="ToastAction",nee=v.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?u.jsx(aee,{altText:n,asChild:!0,children:u.jsx(kV,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${tee}\`. Expected non-empty \`string\`.`),null)});nee.displayName=tee;var oee="ToastClose",kV=v.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,a=tfe(oee,n);return u.jsx(aee,{asChild:!0,children:u.jsx(Ae.button,{type:"button",...o,ref:t,onClick:Me(e.onClick,a.onClose)})})});kV.displayName=oee;var aee=v.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...a}=e;return u.jsx(Ae.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...a,ref:t})});function ree(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),sfe(o)){const a=o.ariaHidden||o.hidden||o.style.display==="none",i=o.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const s=o.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...ree(o))}}),t}function zy(e,t,n,{discrete:o}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?yV(a,i):a.dispatchEvent(i)}var nY=(e,t,n=0)=>{const o=Math.abs(e.x),a=Math.abs(e.y),i=o>a;return t==="left"||t==="right"?i&&o>n:!i&&a>n};function ife(e=()=>{}){const t=wn(e);qn(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function sfe(e){return e.nodeType===e.ELEMENT_NODE}function cfe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function nO(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var lfe=ZJ,iee=WJ,see=QJ,cee=JJ,lee=eee,uee=nee,dee=kV;function hee(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=hee(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function fee(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=hee(e))&&(o&&(o+=" "),o+=t);return o}const oY=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,aY=fee,Bh=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return aY(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(f=>{const p=n==null?void 0:n[f],m=i==null?void 0:i[f];if(p===null)return null;const k=oY(p)||oY(m);return a[f][k]}),l=n&&Object.entries(n).reduce((f,p)=>{let[m,k]=p;return k===void 0||(f[m]=k),f},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,p)=>{let{class:m,className:k,...x}=p;return Object.entries(x).every(M=>{let[b,C]=M;return Array.isArray(C)?C.includes({...i,...l}[b]):{...i,...l}[b]===C})?[...f,m,k]:f},[]);return aY(e,s,h,n==null?void 0:n.class,n==null?void 0:n.className)};/**
|
|
70
|
+
*/function n2e(e){return v.createElement(ghe,{flushSync:t1.flushSync,...e})}const qZ=e=>{let t;const n=new Set,o=(f,p)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const k=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(x=>x(t,k))}},a=()=>t,l={setState:o,getState:a,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f))},h=t=e(o,a,l);return l},o2e=e=>e?qZ(e):qZ,a2e=e=>e;function r2e(e,t=a2e){const n=le.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return le.useDebugValue(n),n}const HZ=e=>{const t=o2e(e),n=o=>r2e(t,o);return Object.assign(n,t),n},xJ=e=>e?HZ(e):HZ;var wJ=Symbol.for("immer-nothing"),VZ=Symbol.for("immer-draftable"),Jo=Symbol.for("immer-state");function Pa(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lh=Object.getPrototypeOf;function jh(e){return!!e&&!!e[Jo]}function Fd(e){var t;return e?bJ(e)||Array.isArray(e)||!!e[VZ]||!!((t=e.constructor)!=null&&t[VZ])||wD(e)||bD(e):!1}var i2e=Object.prototype.constructor.toString();function bJ(e){if(!e||typeof e!="object")return!1;const t=Lh(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===i2e}function PR(e,t){xD(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function xD(e){const t=e[Jo];return t?t.type_:Array.isArray(e)?1:wD(e)?2:bD(e)?3:0}function vq(e,t){return xD(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function MJ(e,t,n){const o=xD(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function s2e(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function wD(e){return e instanceof Map}function bD(e){return e instanceof Set}function Zs(e){return e.copy_||e.base_}function xq(e,t){if(wD(e))return new Map(e);if(bD(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=bJ(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[Jo];let a=Reflect.ownKeys(o);for(let i=0;i<a.length;i++){const s=a[i],l=o[s];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(o[s]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[s]})}return Object.create(Lh(e),o)}else{const o=Lh(e);if(o!==null&&n)return{...e};const a=Object.create(o);return Object.assign(a,e)}}function cV(e,t=!1){return MD(e)||jh(e)||!Fd(e)||(xD(e)>1&&(e.set=e.add=e.clear=e.delete=c2e),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>cV(o,!0))),e}function c2e(){Pa(2)}function MD(e){return Object.isFrozen(e)}var l2e={};function Ud(e){const t=l2e[e];return t||Pa(0,e),t}var xf;function _J(){return xf}function u2e(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function BZ(e,t){t&&(Ud("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function wq(e){bq(e),e.drafts_.forEach(d2e),e.drafts_=null}function bq(e){e===xf&&(xf=e.parent_)}function FZ(e){return xf=u2e(xf,e)}function d2e(e){const t=e[Jo];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function UZ(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Jo].modified_&&(wq(t),Pa(4)),Fd(e)&&(e=$R(t,e),t.parent_||zR(t,e)),t.patches_&&Ud("Patches").generateReplacementPatches_(n[Jo].base_,e,t.patches_,t.inversePatches_)):e=$R(t,n,[]),wq(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wJ?e:void 0}function $R(e,t,n){if(MD(t))return t;const o=t[Jo];if(!o)return PR(t,(a,i)=>GZ(e,o,t,a,i,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return zR(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const a=o.copy_;let i=a,s=!1;o.type_===3&&(i=new Set(a),a.clear(),s=!0),PR(i,(l,h)=>GZ(e,o,a,l,h,n,s)),zR(e,a,!1),n&&e.patches_&&Ud("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function GZ(e,t,n,o,a,i,s){if(jh(a)){const l=i&&t&&t.type_!==3&&!vq(t.assigned_,o)?i.concat(o):void 0,h=$R(e,a,l);if(MJ(n,o,h),jh(h))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Fd(a)&&!MD(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;$R(e,a),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&zR(e,a)}}function zR(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&cV(t,n)}function h2e(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:_J(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=o,i=lV;n&&(a=[o],i=wf);const{revoke:s,proxy:l}=Proxy.revocable(a,i);return o.draft_=l,o.revoke_=s,l}var lV={get(e,t){if(t===Jo)return e;const n=Zs(e);if(!vq(n,t))return f2e(e,n,t);const o=n[t];return e.finalized_||!Fd(o)?o:o===Yz(e.base_,t)?(Wz(e),e.copy_[t]=_q(o,e)):o},has(e,t){return t in Zs(e)},ownKeys(e){return Reflect.ownKeys(Zs(e))},set(e,t,n){const o=SJ(Zs(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const a=Yz(Zs(e),t),i=a==null?void 0:a[Jo];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(s2e(n,a)&&(n!==void 0||vq(e.base_,t)))return!0;Wz(e),Mq(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Yz(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Wz(e),Mq(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Zs(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){Pa(11)},getPrototypeOf(e){return Lh(e.base_)},setPrototypeOf(){Pa(12)}},wf={};PR(lV,(e,t)=>{wf[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});wf.deleteProperty=function(e,t){return wf.set.call(this,e,t,void 0)};wf.set=function(e,t,n){return lV.set.call(this,e[0],t,n,e[0])};function Yz(e,t){const n=e[Jo];return(n?Zs(n):e)[t]}function f2e(e,t,n){var a;const o=SJ(t,n);return o?"value"in o?o.value:(a=o.get)==null?void 0:a.call(e.draft_):void 0}function SJ(e,t){if(!(t in e))return;let n=Lh(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Lh(n)}}function Mq(e){e.modified_||(e.modified_=!0,e.parent_&&Mq(e.parent_))}function Wz(e){e.copy_||(e.copy_=xq(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var p2e=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(h=i,...f){return s.produce(h,p=>n.call(this,p,...f))}}typeof n!="function"&&Pa(6),o!==void 0&&typeof o!="function"&&Pa(7);let a;if(Fd(t)){const i=FZ(this),s=_q(t,void 0);let l=!0;try{a=n(s),l=!1}finally{l?wq(i):bq(i)}return BZ(i,o),UZ(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===wJ&&(a=void 0),this.autoFreeze_&&cV(a,!0),o){const i=[],s=[];Ud("Patches").generateReplacementPatches_(t,a,i,s),o(i,s)}return a}else Pa(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...l)=>this.produceWithPatches(s,h=>t(h,...l));let o,a;return[this.produce(t,n,(s,l)=>{o=s,a=l}),o,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Fd(e)||Pa(8),jh(e)&&(e=y2e(e));const t=FZ(this),n=_q(e,void 0);return n[Jo].isManual_=!0,bq(t),n}finishDraft(e,t){const n=e&&e[Jo];(!n||!n.isManual_)&&Pa(9);const{scope_:o}=n;return BZ(o,t),UZ(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const o=Ud("Patches").applyPatches_;return jh(e)?o(e,t):this.produce(e,a=>o(a,t))}};function _q(e,t){const n=wD(e)?Ud("MapSet").proxyMap_(e,t):bD(e)?Ud("MapSet").proxySet_(e,t):h2e(e,t);return(t?t.scope_:_J()).drafts_.push(n),n}function y2e(e){return jh(e)||Pa(10,e),CJ(e)}function CJ(e){if(!Fd(e)||MD(e))return e;const t=e[Jo];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xq(e,t.scope_.immer_.useStrictShallowCopy_)}else n=xq(e,!0);return PR(n,(o,a)=>{MJ(n,o,CJ(a))}),t&&(t.finalized_=!1),n}var ea=new p2e,m2e=ea.produce;ea.produceWithPatches.bind(ea);ea.setAutoFreeze.bind(ea);ea.setUseStrictShallowCopy.bind(ea);ea.applyPatches.bind(ea);ea.createDraft.bind(ea);ea.finishDraft.bind(ea);const g2e=e=>(t,n,o)=>(o.setState=(a,i,...s)=>{const l=typeof a=="function"?m2e(a):a;return t(l,i,...s)},e(o.setState,n,o)),NJ=g2e,_r=Object.create(null);_r.open="0";_r.close="1";_r.ping="2";_r.pong="3";_r.message="4";_r.upgrade="5";_r.noop="6";const ym=Object.create(null);Object.keys(_r).forEach(e=>{ym[_r[e]]=e});const Sq={type:"error",data:"parser error"},LJ=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",jJ=typeof ArrayBuffer=="function",AJ=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,uV=({type:e,data:t},n,o)=>LJ&&t instanceof Blob?n?o(t):XZ(t,o):jJ&&(t instanceof ArrayBuffer||AJ(t))?n?o(t):XZ(new Blob([t]),o):o(_r[e]+(t||"")),XZ=(e,t)=>{const n=new FileReader;return n.onload=function(){const o=n.result.split(",")[1];t("b"+(o||""))},n.readAsDataURL(e)};function ZZ(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Kz;function k2e(e,t){if(LJ&&e.data instanceof Blob)return e.data.arrayBuffer().then(ZZ).then(t);if(jJ&&(e.data instanceof ArrayBuffer||AJ(e.data)))return t(ZZ(e.data));uV(e,!1,n=>{Kz||(Kz=new TextEncoder),t(Kz.encode(n))})}const YZ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v0=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<YZ.length;e++)v0[YZ.charCodeAt(e)]=e;const v2e=e=>{let t=e.length*.75,n=e.length,o,a=0,i,s,l,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const f=new ArrayBuffer(t),p=new Uint8Array(f);for(o=0;o<n;o+=4)i=v0[e.charCodeAt(o)],s=v0[e.charCodeAt(o+1)],l=v0[e.charCodeAt(o+2)],h=v0[e.charCodeAt(o+3)],p[a++]=i<<2|s>>4,p[a++]=(s&15)<<4|l>>2,p[a++]=(l&3)<<6|h&63;return f},x2e=typeof ArrayBuffer=="function",dV=(e,t)=>{if(typeof e!="string")return{type:"message",data:EJ(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:w2e(e.substring(1),t)}:ym[n]?e.length>1?{type:ym[n],data:e.substring(1)}:{type:ym[n]}:Sq},w2e=(e,t)=>{if(x2e){const n=v2e(e);return EJ(n,t)}else return{base64:!0,data:e}},EJ=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},TJ="",b2e=(e,t)=>{const n=e.length,o=new Array(n);let a=0;e.forEach((i,s)=>{uV(i,!1,l=>{o[s]=l,++a===n&&t(o.join(TJ))})})},M2e=(e,t)=>{const n=e.split(TJ),o=[];for(let a=0;a<n.length;a++){const i=dV(n[a],t);if(o.push(i),i.type==="error")break}return o};function _2e(){return new TransformStream({transform(e,t){k2e(e,n=>{const o=n.length;let a;if(o<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,o);else if(o<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,o)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(o))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(n)})}})}let Qz;function Dy(e){return e.reduce((t,n)=>t+n.length,0)}function Py(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let o=0;for(let a=0;a<t;a++)n[a]=e[0][o++],o===e[0].length&&(e.shift(),o=0);return e.length&&o<e[0].length&&(e[0]=e[0].slice(o)),n}function S2e(e,t){Qz||(Qz=new TextDecoder);const n=[];let o=0,a=-1,i=!1;return new TransformStream({transform(s,l){for(n.push(s);;){if(o===0){if(Dy(n)<1)break;const h=Py(n,1);i=(h[0]&128)===128,a=h[0]&127,a<126?o=3:a===126?o=1:o=2}else if(o===1){if(Dy(n)<2)break;const h=Py(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),o=3}else if(o===2){if(Dy(n)<8)break;const h=Py(n,8),f=new DataView(h.buffer,h.byteOffset,h.length),p=f.getUint32(0);if(p>Math.pow(2,21)-1){l.enqueue(Sq);break}a=p*Math.pow(2,32)+f.getUint32(4),o=3}else{if(Dy(n)<a)break;const h=Py(n,a);l.enqueue(dV(i?h:Qz.decode(h),t)),o=0}if(a===0||a>e){l.enqueue(Sq);break}}}})}const IJ=4;function An(e){if(e)return C2e(e)}function C2e(e){for(var t in An.prototype)e[t]=An.prototype[t];return e}An.prototype.on=An.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};An.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};An.prototype.off=An.prototype.removeListener=An.prototype.removeAllListeners=An.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var o,a=0;a<n.length;a++)if(o=n[a],o===t||o.fn===t){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+e],this};An.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],o=1;o<arguments.length;o++)t[o-1]=arguments[o];if(n){n=n.slice(0);for(var o=0,a=n.length;o<a;++o)n[o].apply(this,t)}return this};An.prototype.emitReserved=An.prototype.emit;An.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};An.prototype.hasListeners=function(e){return!!this.listeners(e).length};const _D=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),pa=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),N2e="arraybuffer";function RJ(e,...t){return t.reduce((n,o)=>(e.hasOwnProperty(o)&&(n[o]=e[o]),n),{})}const L2e=pa.setTimeout,j2e=pa.clearTimeout;function SD(e,t){t.useNativeTimers?(e.setTimeoutFn=L2e.bind(pa),e.clearTimeoutFn=j2e.bind(pa)):(e.setTimeoutFn=pa.setTimeout.bind(pa),e.clearTimeoutFn=pa.clearTimeout.bind(pa))}const A2e=1.33;function E2e(e){return typeof e=="string"?T2e(e):Math.ceil((e.byteLength||e.size)*A2e)}function T2e(e){let t=0,n=0;for(let o=0,a=e.length;o<a;o++)t=e.charCodeAt(o),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(o++,n+=4);return n}function DJ(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function I2e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function R2e(e){let t={},n=e.split("&");for(let o=0,a=n.length;o<a;o++){let i=n[o].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}class D2e extends Error{constructor(t,n,o){super(t),this.description=n,this.context=o,this.type="TransportError"}}class hV extends An{constructor(t){super(),this.writable=!1,SD(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,o){return super.emitReserved("error",new D2e(t,n,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=dV(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=I2e(t);return n.length?"?"+n:""}}class P2e extends hV{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};M2e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,b2e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=DJ()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let PJ=!1;try{PJ=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const $2e=PJ;function z2e(){}class O2e extends P2e{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let o=location.port;o||(o=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||o!==t.port}}doWrite(t,n){const o=this.request({method:"POST",data:t});o.on("success",n),o.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,o)=>{this.onError("xhr poll error",n,o)}),this.pollXhr=t}}let hh=class mm extends An{constructor(t,n,o){super(),this.createRequest=t,SD(this,o),this._opts=o,this._method=o.method||"GET",this._uri=n,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var t;const n=RJ(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(n);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&o.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var a;o.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=mm.requestsCount++,mm.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=z2e,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete mm.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};hh.requestsCount=0;hh.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",WZ);else if(typeof addEventListener=="function"){const e="onpagehide"in pa?"pagehide":"unload";addEventListener(e,WZ,!1)}}function WZ(){for(let e in hh.requests)hh.requests.hasOwnProperty(e)&&hh.requests[e].abort()}const q2e=function(){const e=$J({xdomain:!1});return e&&e.responseType!==null}();class H2e extends O2e{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=q2e&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new hh($J,this.uri(),t)}}function $J(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||$2e))return new XMLHttpRequest}catch{}if(!t)try{return new pa[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const zJ=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class V2e extends hV{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,o=zJ?{}:RJ(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,o)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,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 n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;uV(o,this.supportsBinary,i=>{try{this.doWrite(o,i)}catch{}a&&_D(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=DJ()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const Jz=pa.WebSocket||pa.MozWebSocket;class B2e extends V2e{createSocket(t,n,o){return zJ?new Jz(t,n,o):n?new Jz(t,n):new Jz(t)}doWrite(t,n){this.ws.send(n)}}class F2e extends hV{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=S2e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=t.readable.pipeThrough(n).getReader(),a=_2e();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const i=()=>{o.read().then(({done:l,value:h})=>{l||(this.onPacket(h),i())}).catch(l=>{})};i();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const o=t[n],a=n===t.length-1;this._writer.write(o).then(()=>{a&&_D(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const U2e={websocket:B2e,webtransport:F2e,polling:H2e},G2e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,X2e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Cq(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),o=e.indexOf("]");n!=-1&&o!=-1&&(e=e.substring(0,n)+e.substring(n,o).replace(/:/g,";")+e.substring(o,e.length));let a=G2e.exec(e||""),i={},s=14;for(;s--;)i[X2e[s]]=a[s]||"";return n!=-1&&o!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Z2e(i,i.path),i.queryKey=Y2e(i,i.query),i}function Z2e(e,t){const n=/\/{2,9}/g,o=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&o.splice(0,1),t.slice(-1)=="/"&&o.splice(o.length-1,1),o}function Y2e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,a,i){a&&(n[a]=i)}),n}const Nq=typeof addEventListener=="function"&&typeof removeEventListener=="function",gm=[];Nq&&addEventListener("offline",()=>{gm.forEach(e=>e())},!1);class Qi extends An{constructor(t,n){if(super(),this.binaryType=N2e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const o=Cq(t);n.hostname=o.host,n.secure=o.protocol==="https"||o.protocol==="wss",n.port=o.port,o.query&&(n.query=o.query)}else n.host&&(n.hostname=Cq(n.host).host);SD(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(o=>{const a=o.prototype.name;this.transports.push(a),this._transportsByName[a]=o}),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:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=R2e(this.opts.query)),Nq&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},gm.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=IJ,n.transport=t,this.id&&(n.sid=this.id);const o=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Qi.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}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",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Qi.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&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&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let o=0;o<this.writeBuffer.length;o++){const a=this.writeBuffer[o].data;if(a&&(n+=E2e(a)),o>0&&n>this._maxPayload)return this.writeBuffer.slice(0,o);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,_D(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,o){return this._sendPacket("message",t,n,o),this}send(t,n,o){return this._sendPacket("message",t,n,o),this}_sendPacket(t,n,o,a){if(typeof n=="function"&&(a=n,n=void 0),typeof o=="function"&&(a=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const i={type:t,data:n,options:o};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},o=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():t()}):this.upgrading?o():t()),this}_onError(t){if(Qi.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Nq&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=gm.indexOf(this._offlineEventListener);o!==-1&&gm.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Qi.protocol=IJ;class W2e extends Qi{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),o=!1;Qi.priorWebsocketSuccess=!1;const a=()=>{o||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!o)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Qi.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const k=new Error("probe error");k.transport=n.name,this.emitReserved("upgradeError",k)}}))};function i(){o||(o=!0,p(),n.close(),n=null)}const s=m=>{const k=new Error("probe error: "+m);k.transport=n.name,i(),this.emitReserved("upgradeError",k)};function l(){s("transport closed")}function h(){s("socket closed")}function f(m){n&&m.name!==n.name&&i()}const p=()=>{n.removeListener("open",a),n.removeListener("error",s),n.removeListener("close",l),this.off("close",h),this.off("upgrading",f)};n.once("open",a),n.once("error",s),n.once("close",l),this.once("close",h),this.once("upgrading",f),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{o||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let o=0;o<t.length;o++)~this.transports.indexOf(t[o])&&n.push(t[o]);return n}}let K2e=class extends W2e{constructor(t,n={}){const o=typeof t=="object"?t:n;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(a=>U2e[a]).filter(a=>!!a)),super(t,o)}};function Q2e(e,t="",n){let o=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),o=Cq(e)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const i=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port+t,o.href=o.protocol+"://"+i+(n&&n.port===o.port?"":":"+o.port),o}const J2e=typeof ArrayBuffer=="function",e0e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,OJ=Object.prototype.toString,t0e=typeof Blob=="function"||typeof Blob<"u"&&OJ.call(Blob)==="[object BlobConstructor]",n0e=typeof File=="function"||typeof File<"u"&&OJ.call(File)==="[object FileConstructor]";function fV(e){return J2e&&(e instanceof ArrayBuffer||e0e(e))||t0e&&e instanceof Blob||n0e&&e instanceof File}function km(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,o=e.length;n<o;n++)if(km(e[n]))return!0;return!1}if(fV(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return km(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&km(e[n]))return!0;return!1}function o0e(e){const t=[],n=e.data,o=e;return o.data=Lq(n,t),o.attachments=t.length,{packet:o,buffers:t}}function Lq(e,t){if(!e)return e;if(fV(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let o=0;o<e.length;o++)n[o]=Lq(e[o],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=Lq(e[o],t));return n}return e}function a0e(e,t){return e.data=jq(e.data,t),delete e.attachments,e}function jq(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=jq(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=jq(e[n],t));return e}const r0e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],i0e=5;var _t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(_t||(_t={}));class s0e{constructor(t){this.replacer=t}encode(t){return(t.type===_t.EVENT||t.type===_t.ACK)&&km(t)?this.encodeAsBinary({type:t.type===_t.EVENT?_t.BINARY_EVENT:_t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===_t.BINARY_EVENT||t.type===_t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=o0e(t),o=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(o),a}}function KZ(e){return Object.prototype.toString.call(e)==="[object Object]"}class pV extends An{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const o=n.type===_t.BINARY_EVENT;o||n.type===_t.BINARY_ACK?(n.type=o?_t.EVENT:_t.ACK,this.reconstructor=new c0e(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(fV(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const o={type:Number(t.charAt(0))};if(_t[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===_t.BINARY_EVENT||o.type===_t.BINARY_ACK){const i=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(i,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");o.attachments=Number(s)}if(t.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););o.nsp=t.substring(i,n)}else o.nsp="/";const a=t.charAt(n+1);if(a!==""&&Number(a)==a){const i=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}o.id=Number(t.substring(i,n+1))}if(t.charAt(++n)){const i=this.tryParse(t.substr(n));if(pV.isPayloadValid(o.type,i))o.data=i;else throw new Error("invalid payload")}return o}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case _t.CONNECT:return KZ(n);case _t.DISCONNECT:return n===void 0;case _t.CONNECT_ERROR:return typeof n=="string"||KZ(n);case _t.EVENT:case _t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&r0e.indexOf(n[0])===-1);case _t.ACK:case _t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class c0e{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=a0e(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const l0e=Object.freeze(Object.defineProperty({__proto__:null,Decoder:pV,Encoder:s0e,get PacketType(){return _t},protocol:i0e},Symbol.toStringTag,{value:"Module"}));function Ia(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const u0e=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class qJ extends An{constructor(t,n,o){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=n,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Ia(t,"open",this.onopen.bind(this)),Ia(t,"packet",this.onpacket.bind(this)),Ia(t,"error",this.onerror.bind(this)),Ia(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var o,a,i;if(u0e.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:_t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,m=n.pop();this._registerAckCallback(p,m),s.id=p}const l=(a=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(h?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var o;const a=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(a===void 0){this.acks[t]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},a),s=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((o,a)=>{const i=(s,l)=>s?a(s):o(l);i.withError=!0,n.push(i),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...i)=>o!==this._queue[0]?void 0:(a!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...i)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:_t.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,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(o=>String(o.id)===t)){const o=this.acks[t];delete this.acks[t],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case _t.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 _t.EVENT:case _t.BINARY_EVENT:this.onevent(t);break;case _t.ACK:case _t.BINARY_ACK:this.onack(t);break;case _t.DISCONNECT:this.ondisconnect();break;case _t.CONNECT_ERROR:this.destroy();const o=new Error(t.data.message);o.data=t.data.data,this.emitReserved("connect_error",o);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const o of n)o.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let o=!1;return function(...a){o||(o=!0,n.packet({type:_t.ACK,id:t,data:a}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,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:_t.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 n=this._anyListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,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 n=this._anyOutgoingListeners;for(let o=0;o<n.length;o++)if(t===n[o])return n.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const o of n)o.apply(this,t.data)}}}function Vh(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Vh.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};Vh.prototype.reset=function(){this.attempts=0};Vh.prototype.setMin=function(e){this.ms=e};Vh.prototype.setMax=function(e){this.max=e};Vh.prototype.setJitter=function(e){this.jitter=e};class Aq extends An{constructor(t,n){var o;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,SD(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((o=n.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new Vh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const a=n.parser||l0e;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new K2e(this.uri,this.opts);const n=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const a=Ia(n,"open",function(){o.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},s=Ia(n,"error",i);if(this._timeout!==!1){const l=this._timeout,h=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Ia(t,"ping",this.onping.bind(this)),Ia(t,"data",this.ondata.bind(this)),Ia(t,"error",this.onerror.bind(this)),Ia(t,"close",this.onclose.bind(this)),Ia(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){_D(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let o=this.nsps[t];return o?this._autoConnect&&!o.active&&o.connect():(o=new qJ(this,t,n),this.nsps[t]=o),o}_destroy(t){const n=Object.keys(this.nsps);for(const o of n)if(this.nsps[o].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let o=0;o<n.length;o++)this.engine.write(n[o],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")}disconnect(){return this._close()}onclose(t,n){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),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 n=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},n);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const a0={};function vm(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=Q2e(e,t.path||"/socket.io"),o=n.source,a=n.id,i=n.path,s=a0[a]&&i in a0[a].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let h;return l?h=new Aq(o,t):(a0[a]||(a0[a]=new Aq(o,t)),h=a0[a]),n.query&&!t.query&&(t.query=n.queryKey),h.socket(n.path,t)}Object.assign(vm,{Manager:Aq,Socket:qJ,io:vm,connect:vm});const d0e=1,h0e=1e6;let eO=0;function f0e(){return eO=(eO+1)%Number.MAX_SAFE_INTEGER,eO.toString()}const tO=new Map,QZ=e=>{if(tO.has(e))return;const t=setTimeout(()=>{tO.delete(e),j0({type:"REMOVE_TOAST",toastId:e})},h0e);tO.set(e,t)},p0e=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,d0e)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?QZ(n):e.toasts.forEach(o=>{QZ(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===n||n===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},xm=[];let wm={toasts:[]};function j0(e){wm=p0e(wm,e),xm.forEach(t=>{t(wm)})}function Wo({...e}){const t=f0e(),n=a=>j0({type:"UPDATE_TOAST",toast:{...a,id:t}}),o=()=>j0({type:"DISMISS_TOAST",toastId:t});return j0({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||o()}}}),{id:t,dismiss:o,update:n}}function Zt(){const[e,t]=v.useState(wm);return v.useEffect(()=>(xm.push(t),()=>{const n=xm.indexOf(t);n>-1&&xm.splice(n,1)}),[e]),{...e,toast:Wo,dismiss:n=>j0({type:"DISMISS_TOAST",toastId:n})}}const Le=async(e,t={},n)=>{const o=Ee.getState().token,a={"Content-Type":"application/json",...t.headers};o&&(a.Authorization=`Bearer ${o}`);const i={...t,headers:a};i.body&&typeof i.body=="object"&&(i.body=JSON.stringify(i.body));try{const s=await fetch(e,i);if(s.status===204||s.headers.get("content-length")==="0")return n&&Wo({title:"Успех!",description:n}),!0;const l=await s.json();if(!s.ok){if(s.status===401){const{logout:h}=Ee.getState();return h(),null}throw new Error(l.error||"Произошла неизвестная ошибка на сервере")}return n&&Wo({title:"Успех!",description:n}),l}catch(s){if(s.message.includes("NetworkError")||s.message.includes("Failed to fetch"))Wo({variant:"destructive",title:"Ошибка сети",description:"Не удается подключиться к серверу"});else if(s.message.includes("Невалидный токен")){const{logout:l}=Ee.getState();return l(),null}else Wo({variant:"destructive",title:"Ошибка",description:s.message});throw s}},y0e=(e,t)=>({socket:null,bots:[],servers:[],botStatuses:{},botLogs:{},resourceUsage:{},appVersion:"",connectSocket:()=>{const n=t().socket;if(n&&(n.connected||n.connecting)){console.log("[Socket] Подключение уже в процессе или установлено. Новое не создается.");return}n&&n.disconnect();const o=t().token;if(!o){console.log("[Socket] Подключение отложено: нет токена.");return}const a=window.location.origin;console.log(`[Socket] Попытка подключения к: ${a}`);const i=vm(a,{auth:{token:o},reconnection:!0,transports:["websocket"]});i.on("connect",()=>console.log("Socket.IO подключен:",i.id)),i.on("disconnect",s=>console.log("Socket.IO отключен:",s)),i.on("connect_error",s=>{console.warn(`[Socket] Ошибка подключения (попытка переподключения): ${s.message}`)}),i.on("bot:status",({botId:s,status:l,message:h})=>{e(f=>{f.botStatuses[s]=l}),h&&t().appendLog(s,`[SYSTEM] ${h}`)}),i.on("bot:log",({botId:s,log:l})=>t().appendLog(s,l)),i.on("bots:usage",s=>{const l=s.reduce((h,f)=>({...h,[f.botId]:f}),{});e({resourceUsage:l})}),e({socket:i})},fetchInitialData:async()=>{try{const[n,o,a,i]=await Promise.all([Le("/api/bots"),Le("/api/servers"),Le("/api/bots/state"),Le("/api/version")]);e(s=>{s.bots=n||[],s.servers=o||[],s.botStatuses=a.statuses||{},s.botLogs=a.logs||{},s.appVersion=i.version||""})}catch(n){console.error("Не удалось загрузить начальные данные:",n.message),e(o=>{o.bots=[],o.servers=[]})}},appendLog:(n,o)=>{e(a=>{const i=a.botLogs[n]||[],s=typeof o=="object"&&o!==null&&o.id?o:{id:Date.now()+Math.random(),content:typeof o=="object"&&o!==null?JSON.stringify(o):o},l=[...i,s],h=Array.from(new Map(l.map(f=>[f.id,f])).values());a.botLogs[n]=h.slice(-500)})}}),m0e=(e,t)=>({createBot:async n=>{const o=await Le("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Новый бот успешно создан.");return o&&await t().fetchInitialData(),o},startBot:async n=>{await Le(`/api/bots/${n}/start`,{method:"POST"})},stopBot:async n=>{await Le(`/api/bots/${n}/stop`,{method:"POST"})},deleteBot:async n=>{await Le(`/api/bots/${n}`,{method:"DELETE"},"Бот успешно удален."),await t().fetchInitialData()},startAllBots:async()=>{await Le("/api/bots/start-all",{method:"POST"},"Команда на запуск всех ботов отправлена.")},stopAllBots:async()=>{await Le("/api/bots/stop-all",{method:"POST"},"Команда на остановку всех ботов отправлена.")}}),g0e=(e,t)=>({installedPlugins:{},pluginUpdates:{},pluginCatalog:[],isCatalogLoading:!0,optimisticallyIncrementDownloadCount:n=>{e(o=>{const a=o.pluginCatalog.find(i=>i.name===n);a&&(a.downloads=(a.downloads||0)+1)})},fetchPluginCatalog:async()=>{if(t().pluginCatalog.length>0){e({isCatalogLoading:!1});return}e({isCatalogLoading:!0});try{const n=await Le("/api/plugins/catalog");let o=new Map;try{const i=await fetch("http://185.65.200.184:3000/api/stats");if(i.ok){const s=await i.json();o=new Map(((s==null?void 0:s.plugins)||[]).map(l=>[l.pluginName,l.downloadCount]))}}catch(i){console.warn("Не удалось загрузить статистику скачиваний плагинов:",i.message)}const a=(n||[]).map(i=>({...i,downloads:o.get(i.name)||0}));e({pluginCatalog:a,isCatalogLoading:!1})}catch(n){console.error("Не удалось загрузить каталог плагинов:",n.message),e({pluginCatalog:[],isCatalogLoading:!1})}},fetchInstalledPlugins:async n=>{try{const a=(await Le(`/api/bots/${n}/plugins`)).map(i=>{let s;try{s=i.manifest?JSON.parse(i.manifest):{}}catch{console.error(`Ошибка парсинга манифеста для плагина ${i.name}`),s={}}const l=t().pluginCatalog.find(h=>h.name===i.name);return{...i,manifest:s,author:(l==null?void 0:l.author)||s.author||"Неизвестный автор",description:i.description||s.description||"Нет описания"}});e(i=>{i.installedPlugins[n]=a})}catch(o){console.error("Не удалось загрузить плагины для бота",n,o),e(a=>{a.installedPlugins[n]=[]})}},togglePlugin:async(n,o,a)=>{await Le(`/api/bots/${n}/plugins/${o}`,{method:"PUT",body:JSON.stringify({isEnabled:a})},"Статус плагина обновлен."),await t().fetchInstalledPlugins(n)},deletePlugin:async(n,o,a)=>{await Le(`/api/bots/${n}/plugins/${o}`,{method:"DELETE"},`Плагин "${a}" удален.`),await t().fetchInstalledPlugins(n)},installPluginFromRepo:async(n,o,a)=>{a&&t().optimisticallyIncrementDownloadCount(a);try{const i=await Le(`/api/bots/${n}/plugins/install/github`,{method:"POST",body:JSON.stringify({repoUrl:o})});return Wo({title:"Успех!",description:`Плагин "${i.name}" успешно установлен.`}),await t().fetchInstalledPlugins(n),i}catch(i){throw await t().fetchPluginCatalog(),i}},installPluginFromPath:async(n,o)=>{try{const a=await Le(`/api/bots/${n}/plugins/install/local`,{method:"POST",body:JSON.stringify({path:o})});return Wo({title:"Успех!",description:`Плагин "${a.name}" успешно установлен.`}),a}catch(a){throw a}finally{await t().fetchInstalledPlugins(n),await t().fetchPluginCatalog()}},checkForUpdates:async n=>{try{const o=await Le(`/api/plugins/check-updates/${n}`,{method:"POST"}),a=o.reduce((i,s)=>({...i,[s.sourceUri]:s}),{});e(i=>{i.pluginUpdates[n]=a}),Wo({title:"Проверка завершена",description:`Найдено обновлений: ${o.length}`})}catch(o){console.error("Ошибка проверки обновлений:",o)}},updatePlugin:async(n,o)=>{await Le(`/api/plugins/update/${n}`,{method:"POST"},"Плагин обновлен. Перезапустите бота."),await t().fetchInstalledPlugins(o),await t().checkForUpdates(o)}}),k0e=(e,t)=>({tasks:[],fetchTasks:async()=>{try{const n=await Le("/api/tasks");e({tasks:n||[]})}catch(n){console.error("Не удалось загрузить задачи:",n.message),e({tasks:[]})}},createTask:async n=>{const o=await Le("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},"Задача успешно создана.");return o&&e(a=>{a.tasks.unshift(o)}),o},updateTask:async(n,o)=>{const a=await Le(`/api/tasks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)},"Задача успешно обновлена.");return a&&e(i=>{const s=i.tasks.findIndex(l=>l.id===n);s!==-1&&(i.tasks[s]={...i.tasks[s],...a})}),a},deleteTask:async n=>{await Le(`/api/tasks/${n}`,{method:"DELETE"},"Задача успешно удалена."),e(o=>{o.tasks=o.tasks.filter(a=>a.id!==n)})}}),v0e=(e,t)=>({token:localStorage.getItem("authToken")||null,user:null,isAuthenticated:!1,needsSetup:!1,authInitialized:!1,hasPermission:n=>{var a;if(!n)return!0;const o=((a=t().user)==null?void 0:a.permissions)||[];return o.includes("*")||o.includes(n)},initializeAuth:async()=>{try{if((await Le("/api/auth/status")).needsSetup){e({needsSetup:!0,isAuthenticated:!1,token:null,user:null});return}if(e({needsSetup:!1}),t().token){const a=await Le("/api/auth/me");e({user:a,isAuthenticated:!0})}else e({isAuthenticated:!1,user:null,token:null})}catch(n){console.error("Auth initialization failed:",n.message),(n.message.includes("Невалидный токен")||n.message.includes("Нет токена"))&&localStorage.removeItem("authToken"),e({isAuthenticated:!1,token:null,user:null})}finally{e({authInitialized:!0})}},login:async(n,o)=>{const a=await Le("/api/auth/login",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0}),t().connectSocket()},setupAdmin:async(n,o)=>{const a=await Le("/api/auth/setup",{method:"POST",body:JSON.stringify({username:n,password:o})});localStorage.setItem("authToken",a.token),e({token:a.token,user:a.user,isAuthenticated:!0,needsSetup:!1}),t().connectSocket()},logout:()=>{const n=t().socket;n&&n.disconnect(),localStorage.removeItem("authToken"),e({token:null,user:null,isAuthenticated:!1,socket:null})}}),Ee=xJ(NJ((...e)=>({...y0e(...e),...m0e(...e),...g0e(...e),...k0e(...e),...v0e(...e)})));function Me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function JZ(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ni(...e){return t=>{let n=!1;const o=e.map(a=>{const i=JZ(a,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a<o.length;a++){const i=o[a];typeof i=="function"?i():JZ(e[a],null)}}}}function st(...e){return v.useCallback(ni(...e),e)}function x0e(e,t){const n=v.createContext(t),o=i=>{const{children:s,...l}=i,h=v.useMemo(()=>l,Object.values(l));return u.jsx(n.Provider,{value:h,children:s})};o.displayName=e+"Provider";function a(i){const s=v.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,a]}function ro(e,t=[]){let n=[];function o(i,s){const l=v.createContext(s),h=n.length;n=[...n,s];const f=m=>{var _;const{scope:k,children:x,...M}=m,b=((_=k==null?void 0:k[e])==null?void 0:_[h])||l,C=v.useMemo(()=>M,Object.values(M));return u.jsx(b.Provider,{value:C,children:x})};f.displayName=i+"Provider";function p(m,k){var b;const x=((b=k==null?void 0:k[e])==null?void 0:b[h])||l,M=v.useContext(x);if(M)return M;if(s!==void 0)return s;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[f,p]}const a=()=>{const i=n.map(s=>v.createContext(s));return function(l){const h=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:h}}),[l,h])}};return a.scopeName=e,[o,w0e(a,...t)]}function w0e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(i){const s=o.reduce((l,{useScope:h,scopeName:f})=>{const m=h(i)[`__scope${f}`];return{...l,...m}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function us(e){const t=M0e(e),n=v.forwardRef((o,a)=>{const{children:i,...s}=o,l=v.Children.toArray(i),h=l.find(_0e);if(h){const f=h.props.children,p=l.map(m=>m===h?v.Children.count(f)>1?v.Children.only(null):v.isValidElement(f)?f.props.children:null:m);return u.jsx(t,{...s,ref:a,children:v.isValidElement(f)?v.cloneElement(f,void 0,p):null})}return u.jsx(t,{...s,ref:a,children:i})});return n.displayName=`${e}.Slot`,n}var b0e=us("Slot");function M0e(e){const t=v.forwardRef((n,o)=>{const{children:a,...i}=n;if(v.isValidElement(a)){const s=C0e(a),l=S0e(i,a.props);return a.type!==v.Fragment&&(l.ref=o?ni(o,s):s),v.cloneElement(a,l)}return v.Children.count(a)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var HJ=Symbol("radix.slottable");function VJ(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=HJ,t}function _0e(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===HJ}function S0e(e,t){const n={...t};for(const o in t){const a=e[o],i=t[o];/^on[A-Z]/.test(o)?a&&i?n[o]=(...l)=>{const h=i(...l);return a(...l),h}:a&&(n[o]=a):o==="style"?n[o]={...a,...i}:o==="className"&&(n[o]=[a,i].filter(Boolean).join(" "))}return{...e,...n}}function C0e(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Wf(e){const t=e+"CollectionProvider",[n,o]=ro(t),[a,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=b=>{const{scope:C,children:_}=b,N=le.useRef(null),A=le.useRef(new Map).current;return u.jsx(a,{scope:C,itemMap:A,collectionRef:N,children:_})};s.displayName=t;const l=e+"CollectionSlot",h=us(l),f=le.forwardRef((b,C)=>{const{scope:_,children:N}=b,A=i(l,_),T=st(C,A.collectionRef);return u.jsx(h,{ref:T,children:N})});f.displayName=l;const p=e+"CollectionItemSlot",m="data-radix-collection-item",k=us(p),x=le.forwardRef((b,C)=>{const{scope:_,children:N,...A}=b,T=le.useRef(null),I=st(C,T),j=i(p,_);return le.useEffect(()=>(j.itemMap.set(T,{ref:T,...A}),()=>void j.itemMap.delete(T))),u.jsx(k,{[m]:"",ref:I,children:N})});x.displayName=p;function M(b){const C=i(e+"CollectionConsumer",b);return le.useCallback(()=>{const N=C.collectionRef.current;if(!N)return[];const A=Array.from(N.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((j,$)=>A.indexOf(j.ref.current)-A.indexOf($.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:s,Slot:f,ItemSlot:x},M,o]}var N0e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=N0e.reduce((e,t)=>{const n=us(`Primitive.${t}`),o=v.forwardRef((a,i)=>{const{asChild:s,...l}=a,h=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(h,{...l,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function yV(e,t){e&&t1.flushSync(()=>e.dispatchEvent(t))}function wn(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function L0e(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e);v.useEffect(()=>{const o=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var j0e="DismissableLayer",Eq="dismissableLayer.update",A0e="dismissableLayer.pointerDownOutside",E0e="dismissableLayer.focusOutside",eY,BJ=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),n1=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:i,onInteractOutside:s,onDismiss:l,...h}=e,f=v.useContext(BJ),[p,m]=v.useState(null),k=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=v.useState({}),M=st(t,$=>m($)),b=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),_=b.indexOf(C),N=p?b.indexOf(p):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,T=N>=_,I=I0e($=>{const z=$.target,F=[...f.branches].some(V=>V.contains(z));!T||F||(a==null||a($),s==null||s($),$.defaultPrevented||l==null||l())},k),j=R0e($=>{const z=$.target;[...f.branches].some(V=>V.contains(z))||(i==null||i($),s==null||s($),$.defaultPrevented||l==null||l())},k);return L0e($=>{N===f.layers.size-1&&(o==null||o($),!$.defaultPrevented&&l&&($.preventDefault(),l()))},k),v.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(eY=k.body.style.pointerEvents,k.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),tY(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(k.body.style.pointerEvents=eY)}},[p,k,n,f]),v.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),tY())},[p,f]),v.useEffect(()=>{const $=()=>x({});return document.addEventListener(Eq,$),()=>document.removeEventListener(Eq,$)},[]),u.jsx(Ae.div,{...h,ref:M,style:{pointerEvents:A?T?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,I.onPointerDownCapture)})});n1.displayName=j0e;var T0e="DismissableLayerBranch",FJ=v.forwardRef((e,t)=>{const n=v.useContext(BJ),o=v.useRef(null),a=st(t,o);return v.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(Ae.div,{...e,ref:a})});FJ.displayName=T0e;function I0e(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),o=v.useRef(!1),a=v.useRef(()=>{});return v.useEffect(()=>{const i=l=>{if(l.target&&!o.current){let h=function(){UJ(A0e,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=h,t.addEventListener("click",a.current,{once:!0})):h()}else t.removeEventListener("click",a.current);o.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function R0e(e,t=globalThis==null?void 0:globalThis.document){const n=wn(e),o=v.useRef(!1);return v.useEffect(()=>{const a=i=>{i.target&&!o.current&&UJ(E0e,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function tY(){const e=new CustomEvent(Eq);document.dispatchEvent(e)}function UJ(e,t,n,{discrete:o}){const a=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?yV(a,i):a.dispatchEvent(i)}var D0e=n1,P0e=FJ,qn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},$0e="Portal",o1=v.forwardRef((e,t)=>{var l;const{container:n,...o}=e,[a,i]=v.useState(!1);qn(()=>i(!0),[]);const s=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?t2e.createPortal(u.jsx(Ae.div,{...o,ref:t}),s):null});o1.displayName=$0e;function z0e(e,t){return v.useReducer((n,o)=>t[n][o]??n,e)}var Tn=e=>{const{present:t,children:n}=e,o=O0e(t),a=typeof n=="function"?n({present:o.isPresent}):v.Children.only(n),i=st(o.ref,q0e(a));return typeof n=="function"||o.isPresent?v.cloneElement(a,{ref:i}):null};Tn.displayName="Presence";function O0e(e){const[t,n]=v.useState(),o=v.useRef(null),a=v.useRef(e),i=v.useRef("none"),s=e?"mounted":"unmounted",[l,h]=z0e(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const f=$y(o.current);i.current=l==="mounted"?f:"none"},[l]),qn(()=>{const f=o.current,p=a.current;if(p!==e){const k=i.current,x=$y(f);e?h("MOUNT"):x==="none"||(f==null?void 0:f.display)==="none"?h("UNMOUNT"):h(p&&k!==x?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),qn(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,m=x=>{const b=$y(o.current).includes(x.animationName);if(x.target===t&&b&&(h("ANIMATION_END"),!a.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},k=x=>{x.target===t&&(i.current=$y(o.current))};return t.addEventListener("animationstart",k),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(f),t.removeEventListener("animationstart",k),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function $y(e){return(e==null?void 0:e.animationName)||"none"}function q0e(e){var o,a;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H0e=QH[" useInsertionEffect ".trim().toString()]||qn;function Eo({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[a,i,s]=V0e({defaultProp:t,onChange:n}),l=e!==void 0,h=l?e:a;{const p=v.useRef(e!==void 0);v.useEffect(()=>{const m=p.current;m!==l&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,o])}const f=v.useCallback(p=>{var m;if(l){const k=B0e(p)?p(e):p;k!==e&&((m=s.current)==null||m.call(s,k))}else i(p)},[l,e,i,s]);return[h,f]}function V0e({defaultProp:e,onChange:t}){const[n,o]=v.useState(e),a=v.useRef(n),i=v.useRef(t);return H0e(()=>{i.current=t},[t]),v.useEffect(()=>{var s;a.current!==n&&((s=i.current)==null||s.call(i,n),a.current=n)},[n,a]),[n,o,i]}function B0e(e){return typeof e=="function"}var GJ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),F0e="VisuallyHidden",CD=v.forwardRef((e,t)=>u.jsx(Ae.span,{...e,ref:t,style:{...GJ,...e.style}}));CD.displayName=F0e;var U0e=CD,mV="ToastProvider",[gV,G0e,X0e]=Wf("Toast"),[XJ,Hzt]=ro("Toast",[X0e]),[Z0e,ND]=XJ(mV),ZJ=e=>{const{__scopeToast:t,label:n="Notification",duration:o=5e3,swipeDirection:a="right",swipeThreshold:i=50,children:s}=e,[l,h]=v.useState(null),[f,p]=v.useState(0),m=v.useRef(!1),k=v.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${mV}\`. Expected non-empty \`string\`.`),u.jsx(gV.Provider,{scope:t,children:u.jsx(Z0e,{scope:t,label:n,duration:o,swipeDirection:a,swipeThreshold:i,toastCount:f,viewport:l,onViewportChange:h,onToastAdd:v.useCallback(()=>p(x=>x+1),[]),onToastRemove:v.useCallback(()=>p(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:k,children:s})})};ZJ.displayName=mV;var YJ="ToastViewport",Y0e=["F8"],Tq="toast.viewportPause",Iq="toast.viewportResume",WJ=v.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:o=Y0e,label:a="Notifications ({hotkey})",...i}=e,s=ND(YJ,n),l=G0e(n),h=v.useRef(null),f=v.useRef(null),p=v.useRef(null),m=v.useRef(null),k=st(t,m,s.onViewportChange),x=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=s.toastCount>0;v.useEffect(()=>{const C=_=>{var A;o.length!==0&&o.every(T=>_[T]||_.code===T)&&((A=m.current)==null||A.focus())};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[o]),v.useEffect(()=>{const C=h.current,_=m.current;if(M&&C&&_){const N=()=>{if(!s.isClosePausedRef.current){const j=new CustomEvent(Tq);_.dispatchEvent(j),s.isClosePausedRef.current=!0}},A=()=>{if(s.isClosePausedRef.current){const j=new CustomEvent(Iq);_.dispatchEvent(j),s.isClosePausedRef.current=!1}},T=j=>{!C.contains(j.relatedTarget)&&A()},I=()=>{C.contains(document.activeElement)||A()};return C.addEventListener("focusin",N),C.addEventListener("focusout",T),C.addEventListener("pointermove",N),C.addEventListener("pointerleave",I),window.addEventListener("blur",N),window.addEventListener("focus",A),()=>{C.removeEventListener("focusin",N),C.removeEventListener("focusout",T),C.removeEventListener("pointermove",N),C.removeEventListener("pointerleave",I),window.removeEventListener("blur",N),window.removeEventListener("focus",A)}}},[M,s.isClosePausedRef]);const b=v.useCallback(({tabbingDirection:C})=>{const N=l().map(A=>{const T=A.ref.current,I=[T,...cfe(T)];return C==="forwards"?I:I.reverse()});return(C==="forwards"?N.reverse():N).flat()},[l]);return v.useEffect(()=>{const C=m.current;if(C){const _=N=>{var I,j,$;const A=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!A){const z=document.activeElement,F=N.shiftKey;if(N.target===C&&F){(I=f.current)==null||I.focus();return}const q=b({tabbingDirection:F?"backwards":"forwards"}),H=q.findIndex(E=>E===z);nO(q.slice(H+1))?N.preventDefault():F?(j=f.current)==null||j.focus():($=p.current)==null||$.focus()}};return C.addEventListener("keydown",_),()=>C.removeEventListener("keydown",_)}},[l,b]),u.jsxs(P0e,{ref:h,role:"region","aria-label":a.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:M?void 0:"none"},children:[M&&u.jsx(Rq,{ref:f,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"forwards"});nO(C)}}),u.jsx(gV.Slot,{scope:n,children:u.jsx(Ae.ol,{tabIndex:-1,...i,ref:k})}),M&&u.jsx(Rq,{ref:p,onFocusFromOutsideViewport:()=>{const C=b({tabbingDirection:"backwards"});nO(C)}})]})});WJ.displayName=YJ;var KJ="ToastFocusProxy",Rq=v.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:o,...a}=e,i=ND(KJ,n);return u.jsx(CD,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:s=>{var f;const l=s.relatedTarget;!((f=i.viewport)!=null&&f.contains(l))&&o()}})});Rq.displayName=KJ;var Kf="Toast",W0e="toast.swipeStart",K0e="toast.swipeMove",Q0e="toast.swipeCancel",J0e="toast.swipeEnd",QJ=v.forwardRef((e,t)=>{const{forceMount:n,open:o,defaultOpen:a,onOpenChange:i,...s}=e,[l,h]=Eo({prop:o,defaultProp:a??!0,onChange:i,caller:Kf});return u.jsx(Tn,{present:n||l,children:u.jsx(nfe,{open:l,...s,ref:t,onClose:()=>h(!1),onPause:wn(e.onPause),onResume:wn(e.onResume),onSwipeStart:Me(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Me(e.onSwipeMove,f=>{const{x:p,y:m}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Me(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Me(e.onSwipeEnd,f=>{const{x:p,y:m}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),h(!1)})})})});QJ.displayName=Kf;var[efe,tfe]=XJ(Kf,{onClose(){}}),nfe=v.forwardRef((e,t)=>{const{__scopeToast:n,type:o="foreground",duration:a,open:i,onClose:s,onEscapeKeyDown:l,onPause:h,onResume:f,onSwipeStart:p,onSwipeMove:m,onSwipeCancel:k,onSwipeEnd:x,...M}=e,b=ND(Kf,n),[C,_]=v.useState(null),N=st(t,E=>_(E)),A=v.useRef(null),T=v.useRef(null),I=a||b.duration,j=v.useRef(0),$=v.useRef(I),z=v.useRef(0),{onToastAdd:F,onToastRemove:V}=b,W=wn(()=>{var O;(C==null?void 0:C.contains(document.activeElement))&&((O=b.viewport)==null||O.focus()),s()}),q=v.useCallback(E=>{!E||E===1/0||(window.clearTimeout(z.current),j.current=new Date().getTime(),z.current=window.setTimeout(W,E))},[W]);v.useEffect(()=>{const E=b.viewport;if(E){const O=()=>{q($.current),f==null||f()},D=()=>{const G=new Date().getTime()-j.current;$.current=$.current-G,window.clearTimeout(z.current),h==null||h()};return E.addEventListener(Tq,D),E.addEventListener(Iq,O),()=>{E.removeEventListener(Tq,D),E.removeEventListener(Iq,O)}}},[b.viewport,I,h,f,q]),v.useEffect(()=>{i&&!b.isClosePausedRef.current&&q(I)},[i,I,b.isClosePausedRef,q]),v.useEffect(()=>(F(),()=>V()),[F,V]);const H=v.useMemo(()=>C?ree(C):null,[C]);return b.viewport?u.jsxs(u.Fragment,{children:[H&&u.jsx(ofe,{__scopeToast:n,role:"status","aria-live":o==="foreground"?"assertive":"polite","aria-atomic":!0,children:H}),u.jsx(efe,{scope:n,onClose:W,children:t1.createPortal(u.jsx(gV.ItemSlot,{scope:n,children:u.jsx(D0e,{asChild:!0,onEscapeKeyDown:Me(l,()=>{b.isFocusedToastEscapeKeyDownRef.current||W(),b.isFocusedToastEscapeKeyDownRef.current=!1}),children:u.jsx(Ae.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":b.swipeDirection,...M,ref:N,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Me(e.onKeyDown,E=>{E.key==="Escape"&&(l==null||l(E.nativeEvent),E.nativeEvent.defaultPrevented||(b.isFocusedToastEscapeKeyDownRef.current=!0,W()))}),onPointerDown:Me(e.onPointerDown,E=>{E.button===0&&(A.current={x:E.clientX,y:E.clientY})}),onPointerMove:Me(e.onPointerMove,E=>{if(!A.current)return;const O=E.clientX-A.current.x,D=E.clientY-A.current.y,G=!!T.current,X=["left","right"].includes(b.swipeDirection),Z=["left","up"].includes(b.swipeDirection)?Math.min:Math.max,L=X?Z(0,O):0,Y=X?0:Z(0,D),U=E.pointerType==="touch"?10:2,R={x:L,y:Y},K={originalEvent:E,delta:R};G?(T.current=R,zy(K0e,m,K,{discrete:!1})):nY(R,b.swipeDirection,U)?(T.current=R,zy(W0e,p,K,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(O)>U||Math.abs(D)>U)&&(A.current=null)}),onPointerUp:Me(e.onPointerUp,E=>{const O=T.current,D=E.target;if(D.hasPointerCapture(E.pointerId)&&D.releasePointerCapture(E.pointerId),T.current=null,A.current=null,O){const G=E.currentTarget,X={originalEvent:E,delta:O};nY(O,b.swipeDirection,b.swipeThreshold)?zy(J0e,x,X,{discrete:!0}):zy(Q0e,k,X,{discrete:!0}),G.addEventListener("click",Z=>Z.preventDefault(),{once:!0})}})})})}),b.viewport)})]}):null}),ofe=e=>{const{__scopeToast:t,children:n,...o}=e,a=ND(Kf,t),[i,s]=v.useState(!1),[l,h]=v.useState(!1);return ife(()=>s(!0)),v.useEffect(()=>{const f=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(f)},[]),l?null:u.jsx(o1,{asChild:!0,children:u.jsx(CD,{...o,children:i&&u.jsxs(u.Fragment,{children:[a.label," ",n]})})})},afe="ToastTitle",JJ=v.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});JJ.displayName=afe;var rfe="ToastDescription",eee=v.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e;return u.jsx(Ae.div,{...o,ref:t})});eee.displayName=rfe;var tee="ToastAction",nee=v.forwardRef((e,t)=>{const{altText:n,...o}=e;return n.trim()?u.jsx(aee,{altText:n,asChild:!0,children:u.jsx(kV,{...o,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${tee}\`. Expected non-empty \`string\`.`),null)});nee.displayName=tee;var oee="ToastClose",kV=v.forwardRef((e,t)=>{const{__scopeToast:n,...o}=e,a=tfe(oee,n);return u.jsx(aee,{asChild:!0,children:u.jsx(Ae.button,{type:"button",...o,ref:t,onClick:Me(e.onClick,a.onClose)})})});kV.displayName=oee;var aee=v.forwardRef((e,t)=>{const{__scopeToast:n,altText:o,...a}=e;return u.jsx(Ae.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...a,ref:t})});function ree(e){const t=[];return Array.from(e.childNodes).forEach(o=>{if(o.nodeType===o.TEXT_NODE&&o.textContent&&t.push(o.textContent),sfe(o)){const a=o.ariaHidden||o.hidden||o.style.display==="none",i=o.dataset.radixToastAnnounceExclude==="";if(!a)if(i){const s=o.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...ree(o))}}),t}function zy(e,t,n,{discrete:o}){const a=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),o?yV(a,i):a.dispatchEvent(i)}var nY=(e,t,n=0)=>{const o=Math.abs(e.x),a=Math.abs(e.y),i=o>a;return t==="left"||t==="right"?i&&o>n:!i&&a>n};function ife(e=()=>{}){const t=wn(e);qn(()=>{let n=0,o=0;return n=window.requestAnimationFrame(()=>o=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(o)}},[t])}function sfe(e){return e.nodeType===e.ELEMENT_NODE}function cfe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const a=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||a?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function nO(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var lfe=ZJ,iee=WJ,see=QJ,cee=JJ,lee=eee,uee=nee,dee=kV;function hee(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=hee(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function fee(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=hee(e))&&(o&&(o+=" "),o+=t);return o}const oY=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,aY=fee,Bh=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return aY(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:i}=t,s=Object.keys(a).map(f=>{const p=n==null?void 0:n[f],m=i==null?void 0:i[f];if(p===null)return null;const k=oY(p)||oY(m);return a[f][k]}),l=n&&Object.entries(n).reduce((f,p)=>{let[m,k]=p;return k===void 0||(f[m]=k),f},{}),h=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,p)=>{let{class:m,className:k,...x}=p;return Object.entries(x).every(M=>{let[b,C]=M;return Array.isArray(C)?C.includes({...i,...l}[b]):{...i,...l}[b]===C})?[...f,m,k]:f},[]);return aY(e,s,h,n==null?void 0:n.class,n==null?void 0:n.className)};/**
|
|
71
71
|
* @license lucide-react v0.514.0 - ISC
|
|
72
72
|
*
|
|
73
73
|
* This source code is licensed under the ISC license.
|
package/frontend/dist/index.html
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<meta name="msapplication-TileColor" content="#da532c">
|
|
43
43
|
<meta name="theme-color" content="#ffffff">
|
|
44
44
|
|
|
45
|
-
<script type="module" crossorigin src="/assets/index-
|
|
45
|
+
<script type="module" crossorigin src="/assets/index-BSQ59n1K.js"></script>
|
|
46
46
|
<link rel="stylesheet" crossorigin href="/assets/index-DC4RjP6E.css">
|
|
47
47
|
</head>
|
|
48
48
|
<body>
|