|
import{s as at,l as H,i as S,n as D,d as w,y as ne,z as se,a as N,f as u,g as U,e as X,c as j,ah as ls,k as be,o as we,Z as I,u as G,F as Pn,j as ye,q as Rt,U as le,V as ot,S as cs,R as fs,N as In,B as Dn,_ as ke,r as ce,v as fe,w as ue,x as he,t as lt,b as ct,h as ft,T as Ft,O as us,J as hs,a1 as Ht,m as ds,a0 as ps}from"../chunks/scheduler.DB3Sqaa-.js";import{n as zt,l as ms,S as He,i as ze,g as V,a as v,c as F,t as k,b as z,d as de,m as W,e as K}from"../chunks/index.CidI1d1E.js";import{g as Mn}from"../chunks/globals.D0QH3NT1.js";import{w as gs}from"../chunks/index.DyGhRlyv.js";import{g as qn,d as gt,W as Wt,C as Kt,k as _t,u as _s,e as ys,q as bs,U as ws}from"../chunks/index.DPWiq6NR.js";import{g as yt}from"../chunks/entry.JtQ7vg2d.js";import{p as ks}from"../chunks/stores.m3IJIQGn.js";import{e as Fe,u as vs,o as Es}from"../chunks/each.cN4tVpvB.js";import{g as Te,a as Re}from"../chunks/spread.CgU5AtxT.js";import{c as ie,u as Ts,a as Un,t as Bs}from"../chunks/Toaster.svelte_svelte_type_style_lang.C-7zrEBl.js";import{a as Yt}from"../chunks/index.BS8UhGmM.js";import{g as As}from"../chunks/index.MWcCAAbc.js";import{i as Jt,a as Ss,g as Cs}from"../chunks/index.CRzJ484K.js";import{m as Os}from"../chunks/index.DYGdzELC.js";const Rs=!1,Ns="ignore",zo=Object.freeze(Object.defineProperty({__proto__:null,ssr:Rs,trailingSlash:Ns},Symbol.toStringTag,{value:"Module"})),ge=Object.create(null);ge.open="0";ge.close="1";ge.ping="2";ge.pong="3";ge.message="4";ge.upgrade="5";ge.noop="6";const nt=Object.create(null);Object.keys(ge).forEach(s=>{nt[ge[s]]=s});const kt={type:"error",data:"parser error"},Vn=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Fn=typeof ArrayBuffer=="function",Hn=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,Nt=({type:s,data:e},t,n)=>Vn&&e instanceof Blob?t?n(e):Xt(e,n):Fn&&(e instanceof ArrayBuffer||Hn(e))?t?n(e):Xt(new Blob([e]),n):n(ge[s]+(e||"")),Xt=(s,e)=>{const t=new FileReader;return t.onload=function(){const n=t.result.split(",")[1];e("b"+(n||""))},t.readAsDataURL(s)};function jt(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}let bt;function Ls(s,e){if(Vn&&s.data instanceof Blob)return s.data.arrayBuffer().then(jt).then(e);if(Fn&&(s.data instanceof ArrayBuffer||Hn(s.data)))return e(jt(s.data));Nt(s,!1,t=>{bt||(bt=new TextEncoder),e(bt.encode(t))})}const Qt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ve=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<Qt.length;s++)Ve[Qt.charCodeAt(s)]=s;const Ps=s=>{let e=s.length*.75,t=s.length,n,i=0,o,c,r,a;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);const l=new ArrayBuffer(e),f=new Uint8Array(l);for(n=0;n<t;n+=4)o=Ve[s.charCodeAt(n)],c=Ve[s.charCodeAt(n+1)],r=Ve[s.charCodeAt(n+2)],a=Ve[s.charCodeAt(n+3)],f[i++]=o<<2|c>>4,f[i++]=(c&15)<<4|r>>2,f[i++]=(r&3)<<6|a&63;return l},Is=typeof ArrayBuffer=="function",Lt=(s,e)=>{if(typeof s!="string")return{type:"message",data:zn(s,e)};const t=s.charAt(0);return t==="b"?{type:"message",data:Ds(s.substring(1),e)}:nt[t]?s.length>1?{type:nt[t],data:s.substring(1)}:{type:nt[t]}:kt},Ds=(s,e)=>{if(Is){const t=Ps(s);return zn(t,e)}else return{base64:!0,data:s}},zn=(s,e)=>{switch(e){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}},Wn="",Ms=(s,e)=>{const t=s.length,n=new Array(t);let i=0;s.forEach((o,c)=>{Nt(o,!1,r=>{n[c]=r,++i===t&&e(n.join(Wn))})})},qs=(s,e)=>{const t=s.split(Wn),n=[];for(let i=0;i<t.length;i++){const o=Lt(t[i],e);if(n.push(o),o.type==="error")break}return n};function Us(){return new TransformStream({transform(s,e){Ls(s,t=>{const n=t.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}s.data&&typeof s.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let wt;function Ze(s){return s.reduce((e,t)=>e+t.length,0)}function xe(s,e){if(s[0].length===e)return s.shift();const t=new Uint8Array(e);let n=0;for(let i=0;i<e;i++)t[i]=s[0][n++],n===s[0].length&&(s.shift(),n=0);return s.length&&n<s[0].length&&(s[0]=s[0].slice(n)),t}function Vs(s,e){wt||(wt=new TextDecoder);const t=[];let n=0,i=-1,o=!1;return new TransformStream({transform(c,r){for(t.push(c);;){if(n===0){if(Ze(t)<1)break;const a=xe(t,1);o=(a[0]&128)===128,i=a[0]&127,i<126?n=3:i===126?n=1:n=2}else if(n===1){if(Ze(t)<2)break;const a=xe(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),n=3}else if(n===2){if(Ze(t)<8)break;const a=xe(t,8),l=new DataView(a.buffer,a.byteOffset,a.length),f=l.getUint32(0);if(f>Math.pow(2,21)-1){r.enqueue(kt);break}i=f*Math.pow(2,32)+l.getUint32(4),n=3}else{if(Ze(t)<i)break;const a=xe(t,i);r.enqueue(Lt(o?a:wt.decode(a),e)),n=0}if(i===0||i>s){r.enqueue(kt);break}}}})}const Kn=4;function L(s){if(s)return Fs(s)}function Fs(s){for(var e in L.prototype)s[e]=L.prototype[e];return s}L.prototype.on=L.prototype.addEventListener=function(s,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(e),this};L.prototype.once=function(s,e){function t(){this.off(s,t),e.apply(this,arguments)}return t.fn=e,this.on(s,t),this};L.prototype.off=L.prototype.removeListener=L.prototype.removeAllListeners=L.prototype.removeEventListener=function(s,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+s];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var n,i=0;i<t.length;i++)if(n=t[i],n===e||n.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+s],this};L.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+s],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t){t=t.slice(0);for(var n=0,i=t.length;n<i;++n)t[n].apply(this,e)}return this};L.prototype.emitReserved=L.prototype.emit;L.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};L.prototype.hasListeners=function(s){return!!this.listeners(s).length};const te=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Yn(s,...e){return e.reduce((t,n)=>(s.hasOwnProperty(n)&&(t[n]=s[n]),t),{})}const Hs=te.setTimeout,zs=te.clearTimeout;function ut(s,e){e.useNativeTimers?(s.setTimeoutFn=Hs.bind(te),s.clearTimeoutFn=zs.bind(te)):(s.setTimeoutFn=te.setTimeout.bind(te),s.clearTimeoutFn=te.clearTimeout.bind(te))}const Ws=1.33;function Ks(s){return typeof s=="string"?Ys(s):Math.ceil((s.byteLength||s.size)*Ws)}function Ys(s){let e=0,t=0;for(let n=0,i=s.length;n<i;n++)e=s.charCodeAt(n),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(n++,t+=4);return t}function Js(s){let e="";for(let t in s)s.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(s[t]));return e}function Xs(s){let e={},t=s.split("&");for(let n=0,i=t.length;n<i;n++){let o=t[n].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class js extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Pt extends L{constructor(e){super(),this.writable=!1,ut(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new js(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Lt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Js(e);return t.length?"?"+t:""}}const Jn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),vt=64,Qs={};let Gt=0,$e=0,Zt;function xt(s){let e="";do e=Jn[s%vt]+e,s=Math.floor(s/vt);while(s>0);return e}function Xn(){const s=xt(+new Date);return s!==Zt?(Gt=0,Zt=s):s+"."+xt(Gt++)}for(;$e<vt;$e++)Qs[Jn[$e]]=$e;let jn=!1;try{jn=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Gs=jn;function Qn(s){const e=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Gs))return new XMLHttpRequest}catch{}if(!e)try{return new te[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Zs(){}const xs=function(){return new Qn({xdomain:!1}).responseType!=null}();class $s extends Pt{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const n=location.protocol==="https:";let i=location.port;i||(i=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}const t=e&&e.forceBase64;this.supportsBinary=xs&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let n=0;this.polling&&(n++,this.once("pollComplete",function(){--n||t()})),this.writable||(n++,this.once("drain",function(){--n||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};qs(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Ms(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Xn()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new me(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,n)=>{this.onError("xhr poll error",t,n)}),this.pollXhr=e}}class me extends L{constructor(e,t){super(),ut(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=Yn(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new Qn(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&n.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var i;n.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(n)),n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=me.requestsCount++,me.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Zs,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete me.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}me.requestsCount=0;me.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",$t);else if(typeof addEventListener=="function"){const s="onpagehide"in te?"pagehide":"unload";addEventListener(s,$t,!1)}}function $t(){for(let s in me.requests)me.requests.hasOwnProperty(s)&&me.requests[s].abort()}const It=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),et=te.WebSocket||te.MozWebSocket,en=!0,ei="arraybuffer",tn=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ti extends Pt{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=tn?{}:Yn(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=en&&!tn?t?new et(e,t):new et(e):new et(e,t,n)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;Nt(n,this.supportsBinary,o=>{const c={};try{en&&this.ws.send(o)}catch{}i&&It(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Xn()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!et}}class ni extends Pt{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=Vs(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),i=Us();i.readable.pipeTo(e.writable),this.writer=i.writable.getWriter();const o=()=>{n.read().then(({done:r,value:a})=>{r||(this.onPacket(a),o())}).catch(r=>{})};o();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this.writer.write(c).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;this.writer.write(n).then(()=>{i&&It(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const si={websocket:ti,webtransport:ni,polling:$s},ii=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,oi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Et(s){if(s.length>2e3)throw"URI too long";const e=s,t=s.indexOf("["),n=s.indexOf("]");t!=-1&&n!=-1&&(s=s.substring(0,t)+s.substring(t,n).replace(/:/g,";")+s.substring(n,s.length));let i=ii.exec(s||""),o={},c=14;for(;c--;)o[oi[c]]=i[c]||"";return t!=-1&&n!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=ri(o,o.path),o.queryKey=ai(o,o.query),o}function ri(s,e){const t=/\/{2,9}/g,n=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function ai(s,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,i,o){i&&(t[i]=o)}),t}let Gn=class Oe extends L{constructor(e,t={}){super(),this.binaryType=ei,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Et(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Et(t.host).host),ut(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Xs(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(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"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Kn,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new si[e](n)}open(){let e;if(this.opts.rememberUpgrade&&Oe.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),n=!1;Oe.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",d=>{if(!n)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Oe.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=t.name,this.emitReserved("upgradeError",m)}}))};function o(){n||(n=!0,f(),t.close(),t=null)}const c=d=>{const m=new Error("probe error: "+d);m.transport=t.name,o(),this.emitReserved("upgradeError",m)};function r(){c("transport closed")}function a(){c("socket closed")}function l(d){t&&d.name!==t.name&&o()}const f=()=>{t.removeListener("open",i),t.removeListener("error",c),t.removeListener("close",r),this.off("close",a),this.off("upgrading",l)};t.once("open",i),t.once("error",c),t.once("close",r),this.once("close",a),this.once("upgrading",l),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onOpen(){if(this.readyState="open",Oe.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let n=0;n<this.writeBuffer.length;n++){const i=this.writeBuffer[n].data;if(i&&(t+=Ks(i)),n>0&&t>this.maxPayload)return this.writeBuffer.slice(0,n);t+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,i){if(typeof t=="function"&&(i=t,t=void 0),typeof n=="function"&&(i=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}onError(e){Oe.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const i=e.length;for(;n<i;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}};Gn.protocol=Kn;function li(s,e="",t){let n=s;t=t||typeof location<"u"&&location,s==null&&(s=t.protocol+"//"+t.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=t.protocol+s:s=t.host+s),/^(https?|wss?):\/\//.test(s)||(typeof t<"u"?s=t.protocol+"//"+s:s="https://"+s),n=Et(s)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const o=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+e,n.href=n.protocol+"://"+o+(t&&t.port===n.port?"":":"+n.port),n}const ci=typeof ArrayBuffer=="function",fi=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,Zn=Object.prototype.toString,ui=typeof Blob=="function"||typeof Blob<"u"&&Zn.call(Blob)==="[object BlobConstructor]",hi=typeof File=="function"||typeof File<"u"&&Zn.call(File)==="[object FileConstructor]";function Dt(s){return ci&&(s instanceof ArrayBuffer||fi(s))||ui&&s instanceof Blob||hi&&s instanceof File}function st(s,e){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let t=0,n=s.length;t<n;t++)if(st(s[t]))return!0;return!1}if(Dt(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return st(s.toJSON(),!0);for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&st(s[t]))return!0;return!1}function di(s){const e=[],t=s.data,n=s;return n.data=Tt(t,e),n.attachments=e.length,{packet:n,buffers:e}}function Tt(s,e){if(!s)return s;if(Dt(s)){const t={_placeholder:!0,num:e.length};return e.push(s),t}else if(Array.isArray(s)){const t=new Array(s.length);for(let n=0;n<s.length;n++)t[n]=Tt(s[n],e);return t}else if(typeof s=="object"&&!(s instanceof Date)){const t={};for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=Tt(s[n],e));return t}return s}function pi(s,e){return s.data=Bt(s.data,e),delete s.attachments,s}function Bt(s,e){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<e.length)return e[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let t=0;t<s.length;t++)s[t]=Bt(s[t],e);else if(typeof s=="object")for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=Bt(s[t],e));return s}const mi=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],gi=5;var A;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(A||(A={}));class _i{constructor(e){this.replacer=e}encode(e){return(e.type===A.EVENT||e.type===A.ACK)&&st(e)?this.encodeAsBinary({type:e.type===A.EVENT?A.BINARY_EVENT:A.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===A.BINARY_EVENT||e.type===A.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=di(e),n=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(n),i}}function nn(s){return Object.prototype.toString.call(s)==="[object Object]"}class Mt extends L{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===A.BINARY_EVENT;n||t.type===A.BINARY_ACK?(t.type=n?A.EVENT:A.ACK,this.reconstructor=new yi(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Dt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(A[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===A.BINARY_EVENT||n.type===A.BINARY_ACK){const o=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const c=e.substring(o,t);if(c!=Number(c)||e.charAt(t)!=="-")throw new Error("Illegal attachments");n.attachments=Number(c)}if(e.charAt(t+1)==="/"){const o=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););n.nsp=e.substring(o,t)}else n.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const o=t+1;for(;++t;){const c=e.charAt(t);if(c==null||Number(c)!=c){--t;break}if(t===e.length)break}n.id=Number(e.substring(o,t+1))}if(e.charAt(++t)){const o=this.tryParse(e.substr(t));if(Mt.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case A.CONNECT:return nn(t);case A.DISCONNECT:return t===void 0;case A.CONNECT_ERROR:return typeof t=="string"||nn(t);case A.EVENT:case A.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&mi.indexOf(t[0])===-1);case A.ACK:case A.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class yi{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=pi(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const bi=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Mt,Encoder:_i,get PacketType(){return A},protocol:gi},Symbol.toStringTag,{value:"Module"}));function ae(s,e,t){return s.on(e,t),function(){s.off(e,t)}}const wi=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class xn extends L{constructor(e,t,n){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=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ae(e,"open",this.onopen.bind(this)),ae(e,"packet",this.onpacket.bind(this)),ae(e,"error",this.onerror.bind(this)),ae(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(wi.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:A.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const c=this.ids++,r=t.pop();this._registerAckCallback(c,r),n.id=c}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const i=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let r=0;r<this.sendBuffer.length;r++)this.sendBuffer[r].id===e&&this.sendBuffer.splice(r,1);t.call(this,new Error("operation has timed out"))},i),c=(...r)=>{this.io.clearTimeoutFn(o),t.apply(this,r)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...t){return new Promise((n,i)=>{const o=(c,r)=>c?i(c):n(r);o.withError=!0,t.push(o),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>n!==this._queue[0]?void 0:(i!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:A.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(n=>String(n.id)===e)){const n=this.acks[e];delete this.acks[e],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case A.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 A.EVENT:case A.BINARY_EVENT:this.onevent(e);break;case A.ACK:case A.BINARY_ACK:this.onack(e);break;case A.DISCONNECT:this.ondisconnect();break;case A.CONNECT_ERROR:this.destroy();const n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:A.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:A.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Ne(s){s=s||{},this.ms=s.min||100,this.max=s.max||1e4,this.factor=s.factor||2,this.jitter=s.jitter>0&&s.jitter<=1?s.jitter:0,this.attempts=0}Ne.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*s);s=Math.floor(e*10)&1?s+t:s-t}return Math.min(s,this.max)|0};Ne.prototype.reset=function(){this.attempts=0};Ne.prototype.setMin=function(s){this.ms=s};Ne.prototype.setMax=function(s){this.max=s};Ne.prototype.setJitter=function(s){this.jitter=s};class At extends L{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ut(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((n=t.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new Ne({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||bi;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Gn(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=ae(t,"open",function(){n.onopen(),e&&e()}),o=r=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",r),e?e(r):this.maybeReconnectOnOpen()},c=ae(t,"error",o);if(this._timeout!==!1){const r=this._timeout,a=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),t.close()},r);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ae(e,"ping",this.onping.bind(this)),ae(e,"data",this.ondata.bind(this)),ae(e,"error",this.onerror.bind(this)),ae(e,"close",this.onclose.bind(this)),ae(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){It(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new xn(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ue={};function it(s,e){typeof s=="object"&&(e=s,s=void 0),e=e||{};const t=li(s,e.path||"/socket.io"),n=t.source,i=t.id,o=t.path,c=Ue[i]&&o in Ue[i].nsps,r=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let a;return r?a=new At(n,e):(Ue[i]||(Ue[i]=new At(n,e)),a=Ue[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(it,{Manager:At,Socket:xn,io:it,connect:it});function sn(s){return Object.prototype.toString.call(s)==="[object Date]"}function St(s,e,t,n){if(typeof t=="number"||sn(t)){const i=n-t,o=(t-e)/(s.dt||1/60),c=s.opts.stiffness*i,r=s.opts.damping*o,a=(c-r)*s.inv_mass,l=(o+a)*s.dt;return Math.abs(l)<s.opts.precision&&Math.abs(i)<s.opts.precision?n:(s.settled=!1,sn(t)?new Date(t.getTime()+l):t+l)}else{if(Array.isArray(t))return t.map((i,o)=>St(s,e[o],t[o],n[o]));if(typeof t=="object"){const i={};for(const o in t)i[o]=St(s,e[o],t[o],n[o]);return i}else throw new Error(`Cannot spring ${typeof t} values`)}}function ki(s,e={}){const t=gs(s),{stiffness:n=.15,damping:i=.8,precision:o=.01}=e;let c,r,a,l=s,f=s,d=1,m=0,h=!1;function y(B,C={}){f=B;const O=a={};return s==null||C.hard||R.stiffness>=1&&R.damping>=1?(h=!0,c=zt(),l=B,t.set(s=f),Promise.resolve()):(C.soft&&(m=1/((C.soft===!0?.5:+C.soft)*60),d=0),r||(c=zt(),h=!1,r=ms(E=>{if(h)return h=!1,r=null,!1;d=Math.min(d+m,1);const p={inv_mass:d,opts:R,settled:!0,dt:(E-c)*60/1e3},_=St(p,l,s,f);return c=E,l=s,t.set(s=_),p.settled&&(r=null),!p.settled})),new Promise(E=>{r.promise.then(()=>{O===a&&E()})}))}const R={set:y,update:(B,C)=>y(B(f,s),C),subscribe:t.subscribe,stiffness:n,damping:i,precision:o};return R}function vi(s){return{c:D,l:D,m:D,d:D}}function Ei(s){let e,t,n;return{c(){e=ne("svg"),t=ne("path"),n=ne("path"),this.h()},l(i){e=se(i,"svg",{viewBox:!0,fill:!0,height:!0,width:!0,xmlns:!0});var o=N(e);t=se(o,"path",{d:!0}),N(t).forEach(w),n=se(o,"path",{d:!0}),N(n).forEach(w),o.forEach(w),this.h()},h(){u(t,"d","M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"),u(n,"d","M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"),u(e,"viewBox","0 0 64 64"),u(e,"fill","currentColor"),u(e,"height","20"),u(e,"width","20"),u(e,"xmlns","http://www.w3.org/2000/svg")},m(i,o){S(i,e,o),U(e,t),U(e,n)},d(i){i&&w(e)}}}function Ti(s){let e,t;return{c(){e=ne("svg"),t=ne("path"),this.h()},l(n){e=se(n,"svg",{xmlns:!0,viewBox:!0,fill:!0,height:!0,width:!0});var i=N(e);t=se(i,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),N(t).forEach(w),i.forEach(w),this.h()},h(){u(t,"fill-rule","evenodd"),u(t,"d","M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z"),u(t,"clip-rule","evenodd"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"viewBox","0 0 20 20"),u(e,"fill","currentColor"),u(e,"height","20"),u(e,"width","20")},m(n,i){S(n,e,i),U(e,t)},d(n){n&&w(e)}}}function Bi(s){let e,t;return{c(){e=ne("svg"),t=ne("path"),this.h()},l(n){e=se(n,"svg",{xmlns:!0,viewBox:!0,fill:!0,height:!0,width:!0});var i=N(e);t=se(i,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),N(t).forEach(w),i.forEach(w),this.h()},h(){u(t,"fill-rule","evenodd"),u(t,"d","M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z"),u(t,"clip-rule","evenodd"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"viewBox","0 0 20 20"),u(e,"fill","currentColor"),u(e,"height","20"),u(e,"width","20")},m(n,i){S(n,e,i),U(e,t)},d(n){n&&w(e)}}}function Ai(s){let e,t;return{c(){e=ne("svg"),t=ne("path"),this.h()},l(n){e=se(n,"svg",{xmlns:!0,viewBox:!0,fill:!0,height:!0,width:!0});var i=N(e);t=se(i,"path",{"fill-rule":!0,d:!0,"clip-rule":!0}),N(t).forEach(w),i.forEach(w),this.h()},h(){u(t,"fill-rule","evenodd"),u(t,"d","M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"),u(t,"clip-rule","evenodd"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"viewBox","0 0 20 20"),u(e,"fill","currentColor"),u(e,"height","20"),u(e,"width","20")},m(n,i){S(n,e,i),U(e,t)},d(n){n&&w(e)}}}function Si(s){let e;function t(o,c){return o[0]==="success"?Ai:o[0]==="error"?Bi:o[0]==="info"?Ti:o[0]==="warning"?Ei:vi}let n=t(s),i=n(s);return{c(){i.c(),e=H()},l(o){i.l(o),e=H()},m(o,c){i.m(o,c),S(o,e,c)},p(o,[c]){n!==(n=t(o))&&(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:D,o:D,d(o){o&&w(e),i.d(o)}}}function Ci(s,e,t){let{type:n="success"}=e;return s.$$set=i=>{"type"in i&&t(0,n=i.type)},[n]}class ht extends He{constructor(e){super(),ze(this,e,Ci,Si,at,{type:0})}}function Oi(s,e,t){const n=s.slice();return n[2]=e[t],n[4]=t,n}function Ri(s,e){let t;return{key:s,first:null,c(){t=X("div"),this.h()},l(n){t=j(n,"DIV",{class:!0}),N(t).forEach(w),this.h()},h(){u(t,"class","sonner-loading-bar"),this.first=t},m(n,i){S(n,t,i)},p:D,d(n){n&&w(t)}}}function Ni(s){let e,t,n=[],i=new Map,o=Fe(s[1]);const c=r=>r[4];for(let r=0;r<o.length;r+=1){let a=Oi(s,o,r),l=c(a);i.set(l,n[r]=Ri(l))}return{c(){e=X("div"),t=X("div");for(let r=0;r<n.length;r+=1)n[r].c();this.h()},l(r){e=j(r,"DIV",{class:!0,"data-visible":!0});var a=N(e);t=j(a,"DIV",{class:!0});var l=N(t);for(let f=0;f<n.length;f+=1)n[f].l(l);l.forEach(w),a.forEach(w),this.h()},h(){u(t,"class","sonner-spinner"),u(e,"class","sonner-loading-wrapper"),u(e,"data-visible",s[0])},m(r,a){S(r,e,a),U(e,t);for(let l=0;l<n.length;l+=1)n[l]&&n[l].m(t,null)},p(r,[a]){a&1&&u(e,"data-visible",r[0])},i:D,o:D,d(r){r&&w(e);for(let a=0;a<n.length;a+=1)n[a].d()}}}function Li(s,e,t){let{visible:n}=e;const i=Array(12).fill(0);return s.$$set=o=>{"visible"in o&&t(0,n=o.visible)},[n,i]}class Pi extends He{constructor(e){super(),ze(this,e,Li,Ni,at,{visible:0})}}const Ii=s=>({}),on=s=>({}),Di=s=>({}),rn=s=>({}),Mi=s=>({}),an=s=>({}),qi=s=>({}),ln=s=>({}),Ui=s=>({}),cn=s=>({});function fn(s){let e,t,n,i,o,c,r;return{c(){e=X("button"),t=ne("svg"),n=ne("line"),i=ne("line"),this.h()},l(a){e=j(a,"BUTTON",{"aria-label":!0,"data-disabled":!0,"data-close-button":!0,class:!0});var l=N(e);t=se(l,"svg",{xmlns:!0,width:!0,height:!0,viewBox:!0,fill:!0,stroke:!0,"stroke-width":!0,"stroke-linecap":!0,"stroke-linejoin":!0});var f=N(t);n=se(f,"line",{x1:!0,y1:!0,x2:!0,y2:!0}),N(n).forEach(w),i=se(f,"line",{x1:!0,y1:!0,x2:!0,y2:!0}),N(i).forEach(w),f.forEach(w),l.forEach(w),this.h()},h(){var a,l,f;u(n,"x1","18"),u(n,"y1","6"),u(n,"x2","6"),u(n,"y2","18"),u(i,"x1","6"),u(i,"y1","6"),u(i,"x2","18"),u(i,"y2","18"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"width","12"),u(t,"height","12"),u(t,"viewBox","0 0 24 24"),u(t,"fill","none"),u(t,"stroke","currentColor"),u(t,"stroke-width","1.5"),u(t,"stroke-linecap","round"),u(t,"stroke-linejoin","round"),u(e,"aria-label","Close toast"),u(e,"data-disabled",s[22]),u(e,"data-close-button",""),u(e,"class",o=ie((a=s[1])==null?void 0:a.closeButton,(f=(l=s[2])==null?void 0:l.classes)==null?void 0:f.closeButton))},m(a,l){S(a,e,l),U(e,t),U(t,n),U(t,i),c||(r=G(e,"click",function(){cs(s[22]?void 0:s[49])&&(s[22]?void 0:s[49]).apply(this,arguments)}),c=!0)},p(a,l){var f,d,m;s=a,l[0]&4194304&&u(e,"data-disabled",s[22]),l[0]&6&&o!==(o=ie((f=s[1])==null?void 0:f.closeButton,(m=(d=s[2])==null?void 0:d.classes)==null?void 0:m.closeButton))&&u(e,"class",o)},d(a){a&&w(e),c=!1,r()}}}function Vi(s){let e,t,n,i,o,c,r,a=(s[11]!=="default"||s[2].icon||s[2].promise)&&un(s),l=s[2].title&&dn(s),f=s[2].description&&pn(s),d=s[2].cancel&&mn(s),m=s[2].action&&gn(s);return{c(){a&&a.c(),e=be(),t=X("div"),l&&l.c(),n=be(),f&&f.c(),i=be(),d&&d.c(),o=be(),m&&m.c(),c=H(),this.h()},l(h){a&&a.l(h),e=we(h),t=j(h,"DIV",{"data-content":!0});var y=N(t);l&&l.l(y),n=we(y),f&&f.l(y),y.forEach(w),i=we(h),d&&d.l(h),o=we(h),m&&m.l(h),c=H(),this.h()},h(){u(t,"data-content","")},m(h,y){a&&a.m(h,y),S(h,e,y),S(h,t,y),l&&l.m(t,null),U(t,n),f&&f.m(t,null),S(h,i,y),d&&d.m(h,y),S(h,o,y),m&&m.m(h,y),S(h,c,y),r=!0},p(h,y){h[11]!=="default"||h[2].icon||h[2].promise?a?(a.p(h,y),y[0]&2052&&k(a,1)):(a=un(h),a.c(),k(a,1),a.m(e.parentNode,e)):a&&(V(),v(a,1,1,()=>{a=null}),F()),h[2].title?l?(l.p(h,y),y[0]&4&&k(l,1)):(l=dn(h),l.c(),k(l,1),l.m(t,n)):l&&(V(),v(l,1,1,()=>{l=null}),F()),h[2].description?f?(f.p(h,y),y[0]&4&&k(f,1)):(f=pn(h),f.c(),k(f,1),f.m(t,null)):f&&(V(),v(f,1,1,()=>{f=null}),F()),h[2].cancel?d?d.p(h,y):(d=mn(h),d.c(),d.m(o.parentNode,o)):d&&(d.d(1),d=null),h[2].action?m?m.p(h,y):(m=gn(h),m.c(),m.m(c.parentNode,c)):m&&(m.d(1),m=null)},i(h){r||(k(a),k(l),k(f),r=!0)},o(h){v(a),v(l),v(f),r=!1},d(h){h&&(w(e),w(t),w(i),w(o),w(c)),a&&a.d(h),l&&l.d(),f&&f.d(),d&&d.d(h),m&&m.d(h)}}}function Fi(s){let e,t,n;const i=[s[2].componentProps];var o=s[2].component;function c(r,a){let l={};for(let f=0;f<i.length;f+=1)l=le(l,i[f]);return a!==void 0&&a[0]&4&&(l=le(l,Te(i,[Re(r[2].componentProps)]))),{props:l}}return o&&(e=ke(o,c(s)),e.$on("closeToast",s[30])),{c(){e&&z(e.$$.fragment),t=H()},l(r){e&&de(e.$$.fragment,r),t=H()},m(r,a){e&&W(e,r,a),S(r,t,a),n=!0},p(r,a){if(a[0]&4&&o!==(o=r[2].component)){if(e){V();const l=e;v(l.$$.fragment,1,0,()=>{K(l,1)}),F()}o?(e=ke(o,c(r,a)),e.$on("closeToast",r[30]),z(e.$$.fragment),k(e.$$.fragment,1),W(e,t.parentNode,t)):e=null}else if(o){const l=a[0]&4?Te(i,[Re(r[2].componentProps)]):{};e.$set(l)}},i(r){n||(e&&k(e.$$.fragment,r),n=!0)},o(r){e&&v(e.$$.fragment,r),n=!1},d(r){r&&w(t),e&&K(e,r)}}}function un(s){let e,t,n,i,o,c=(s[2].promise||s[11]==="loading")&&!s[2].icon&&hn(s);const r=[Yi,Ki,Wi,zi,Hi],a=[];function l(f,d){return f[2].icon?0:f[11]==="success"?1:f[11]==="error"?2:f[11]==="warning"?3:f[11]==="info"?4:-1}return~(n=l(s))&&(i=a[n]=r[n](s)),{c(){e=X("div"),c&&c.c(),t=be(),i&&i.c(),this.h()},l(f){e=j(f,"DIV",{"data-icon":!0});var d=N(e);c&&c.l(d),t=we(d),i&&i.l(d),d.forEach(w),this.h()},h(){u(e,"data-icon","")},m(f,d){S(f,e,d),c&&c.m(e,null),U(e,t),~n&&a[n].m(e,null),o=!0},p(f,d){(f[2].promise||f[11]==="loading")&&!f[2].icon?c?(c.p(f,d),d[0]&2052&&k(c,1)):(c=hn(f),c.c(),k(c,1),c.m(e,t)):c&&(V(),v(c,1,1,()=>{c=null}),F());let m=n;n=l(f),n===m?~n&&a[n].p(f,d):(i&&(V(),v(a[m],1,1,()=>{a[m]=null}),F()),~n?(i=a[n],i?i.p(f,d):(i=a[n]=r[n](f),i.c()),k(i,1),i.m(e,null)):i=null)},i(f){o||(k(c),k(i),o=!0)},o(f){v(c),v(i),o=!1},d(f){f&&w(e),c&&c.d(),~n&&a[n].d()}}}function hn(s){let e;const t=s[48]["loading-icon"],n=ce(t,s,s[47],cn);return{c(){n&&n.c()},l(i){n&&n.l(i)},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o[1]&65536)&&fe(n,t,i,i[47],e?he(t,i[47],o,Ui):ue(i[47]),cn)},i(i){e||(k(n,i),e=!0)},o(i){v(n,i),e=!1},d(i){n&&n.d(i)}}}function Hi(s){let e;const t=s[48]["info-icon"],n=ce(t,s,s[47],on);return{c(){n&&n.c()},l(i){n&&n.l(i)},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o[1]&65536)&&fe(n,t,i,i[47],e?he(t,i[47],o,Ii):ue(i[47]),on)},i(i){e||(k(n,i),e=!0)},o(i){v(n,i),e=!1},d(i){n&&n.d(i)}}}function zi(s){let e;const t=s[48]["warning-icon"],n=ce(t,s,s[47],rn);return{c(){n&&n.c()},l(i){n&&n.l(i)},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o[1]&65536)&&fe(n,t,i,i[47],e?he(t,i[47],o,Di):ue(i[47]),rn)},i(i){e||(k(n,i),e=!0)},o(i){v(n,i),e=!1},d(i){n&&n.d(i)}}}function Wi(s){let e;const t=s[48]["error-icon"],n=ce(t,s,s[47],an);return{c(){n&&n.c()},l(i){n&&n.l(i)},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o[1]&65536)&&fe(n,t,i,i[47],e?he(t,i[47],o,Mi):ue(i[47]),an)},i(i){e||(k(n,i),e=!0)},o(i){v(n,i),e=!1},d(i){n&&n.d(i)}}}function Ki(s){let e;const t=s[48]["success-icon"],n=ce(t,s,s[47],ln);return{c(){n&&n.c()},l(i){n&&n.l(i)},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o[1]&65536)&&fe(n,t,i,i[47],e?he(t,i[47],o,qi):ue(i[47]),ln)},i(i){e||(k(n,i),e=!0)},o(i){v(n,i),e=!1},d(i){n&&n.d(i)}}}function Yi(s){let e,t,n;var i=s[2].icon;function o(c,r){return{}}return i&&(e=ke(i,o())),{c(){e&&z(e.$$.fragment),t=H()},l(c){e&&de(e.$$.fragment,c),t=H()},m(c,r){e&&W(e,c,r),S(c,t,r),n=!0},p(c,r){if(r[0]&4&&i!==(i=c[2].icon)){if(e){V();const a=e;v(a.$$.fragment,1,0,()=>{K(a,1)}),F()}i?(e=ke(i,o()),z(e.$$.fragment),k(e.$$.fragment,1),W(e,t.parentNode,t)):e=null}},i(c){n||(e&&k(e.$$.fragment,c),n=!0)},o(c){e&&v(e.$$.fragment,c),n=!1},d(c){c&&w(t),e&&K(e,c)}}}function dn(s){let e,t,n,i,o;const c=[Xi,Ji],r=[];function a(l,f){return typeof l[2].title!="string"?0:1}return t=a(s),n=r[t]=c[t](s),{c(){e=X("div"),n.c(),this.h()},l(l){e=j(l,"DIV",{"data-title":!0,class:!0});var f=N(e);n.l(f),f.forEach(w),this.h()},h(){var l,f,d;u(e,"data-title",""),u(e,"class",i=ie((l=s[1])==null?void 0:l.title,(d=(f=s[2])==null?void 0:f.classes)==null?void 0:d.title))},m(l,f){S(l,e,f),r[t].m(e,null),o=!0},p(l,f){var m,h,y;let d=t;t=a(l),t===d?r[t].p(l,f):(V(),v(r[d],1,1,()=>{r[d]=null}),F(),n=r[t],n?n.p(l,f):(n=r[t]=c[t](l),n.c()),k(n,1),n.m(e,null)),(!o||f[0]&6&&i!==(i=ie((m=l[1])==null?void 0:m.title,(y=(h=l[2])==null?void 0:h.classes)==null?void 0:y.title)))&&u(e,"class",i)},i(l){o||(k(n),o=!0)},o(l){v(n),o=!1},d(l){l&&w(e),r[t].d()}}}function Ji(s){let e=s[2].title+"",t;return{c(){t=lt(e)},l(n){t=ct(n,e)},m(n,i){S(n,t,i)},p(n,i){i[0]&4&&e!==(e=n[2].title+"")&&ft(t,e)},i:D,o:D,d(n){n&&w(t)}}}function Xi(s){let e,t,n;const i=[s[2].componentProps];var o=s[2].title;function c(r,a){let l={};for(let f=0;f<i.length;f+=1)l=le(l,i[f]);return a!==void 0&&a[0]&4&&(l=le(l,Te(i,[Re(r[2].componentProps)]))),{props:l}}return o&&(e=ke(o,c(s))),{c(){e&&z(e.$$.fragment),t=H()},l(r){e&&de(e.$$.fragment,r),t=H()},m(r,a){e&&W(e,r,a),S(r,t,a),n=!0},p(r,a){if(a[0]&4&&o!==(o=r[2].title)){if(e){V();const l=e;v(l.$$.fragment,1,0,()=>{K(l,1)}),F()}o?(e=ke(o,c(r,a)),z(e.$$.fragment),k(e.$$.fragment,1),W(e,t.parentNode,t)):e=null}else if(o){const l=a[0]&4?Te(i,[Re(r[2].componentProps)]):{};e.$set(l)}},i(r){n||(e&&k(e.$$.fragment,r),n=!0)},o(r){e&&v(e.$$.fragment,r),n=!1},d(r){r&&w(t),e&&K(e,r)}}}function pn(s){let e,t,n,i,o;const c=[Qi,ji],r=[];function a(l,f){return typeof l[2].description!="string"?0:1}return t=a(s),n=r[t]=c[t](s),{c(){e=X("div"),n.c(),this.h()},l(l){e=j(l,"DIV",{"data-description":!0,class:!0});var f=N(e);n.l(f),f.forEach(w),this.h()},h(){var l,f;u(e,"data-description",""),u(e,"class",i=ie(s[9],s[23],(l=s[1])==null?void 0:l.description,(f=s[2].classes)==null?void 0:f.description))},m(l,f){S(l,e,f),r[t].m(e,null),o=!0},p(l,f){var m,h;let d=t;t=a(l),t===d?r[t].p(l,f):(V(),v(r[d],1,1,()=>{r[d]=null}),F(),n=r[t],n?n.p(l,f):(n=r[t]=c[t](l),n.c()),k(n,1),n.m(e,null)),(!o||f[0]&8389126&&i!==(i=ie(l[9],l[23],(m=l[1])==null?void 0:m.description,(h=l[2].classes)==null?void 0:h.description)))&&u(e,"class",i)},i(l){o||(k(n),o=!0)},o(l){v(n),o=!1},d(l){l&&w(e),r[t].d()}}}function ji(s){let e=s[2].description+"",t;return{c(){t=lt(e)},l(n){t=ct(n,e)},m(n,i){S(n,t,i)},p(n,i){i[0]&4&&e!==(e=n[2].description+"")&&ft(t,e)},i:D,o:D,d(n){n&&w(t)}}}function Qi(s){let e,t,n;const i=[s[2].componentProps];var o=s[2].description;function c(r,a){let l={};for(let f=0;f<i.length;f+=1)l=le(l,i[f]);return a!==void 0&&a[0]&4&&(l=le(l,Te(i,[Re(r[2].componentProps)]))),{props:l}}return o&&(e=ke(o,c(s))),{c(){e&&z(e.$$.fragment),t=H()},l(r){e&&de(e.$$.fragment,r),t=H()},m(r,a){e&&W(e,r,a),S(r,t,a),n=!0},p(r,a){if(a[0]&4&&o!==(o=r[2].description)){if(e){V();const l=e;v(l.$$.fragment,1,0,()=>{K(l,1)}),F()}o?(e=ke(o,c(r,a)),z(e.$$.fragment),k(e.$$.fragment,1),W(e,t.parentNode,t)):e=null}else if(o){const l=a[0]&4?Te(i,[Re(r[2].componentProps)]):{};e.$set(l)}},i(r){n||(e&&k(e.$$.fragment,r),n=!0)},o(r){e&&v(e.$$.fragment,r),n=!1},d(r){r&&w(t),e&&K(e,r)}}}function mn(s){let e,t=s[2].cancel.label+"",n,i,o,c;return{c(){e=X("button"),n=lt(t),this.h()},l(r){e=j(r,"BUTTON",{"data-button":!0,"data-cancel":!0,style:!0,class:!0});var a=N(e);n=ct(a,t),a.forEach(w),this.h()},h(){var r,a,l;u(e,"data-button",""),u(e,"data-cancel",""),u(e,"style",s[7]),u(e,"class",i=ie((r=s[1])==null?void 0:r.cancelButton,(l=(a=s[2])==null?void 0:a.classes)==null?void 0:l.cancelButton))},m(r,a){S(r,e,a),U(e,n),o||(c=G(e,"click",s[50]),o=!0)},p(r,a){var l,f,d;a[0]&4&&t!==(t=r[2].cancel.label+"")&&ft(n,t),a[0]&128&&u(e,"style",r[7]),a[0]&6&&i!==(i=ie((l=r[1])==null?void 0:l.cancelButton,(d=(f=r[2])==null?void 0:f.classes)==null?void 0:d.cancelButton))&&u(e,"class",i)},d(r){r&&w(e),o=!1,c()}}}function gn(s){let e,t=s[2].action.label+"",n,i,o,c;return{c(){e=X("button"),n=lt(t),this.h()},l(r){e=j(r,"BUTTON",{"data-button":!0,style:!0,class:!0});var a=N(e);n=ct(a,t),a.forEach(w),this.h()},h(){var r,a,l;u(e,"data-button",""),u(e,"style",s[8]),u(e,"class",i=ie((r=s[1])==null?void 0:r.actionButton,(l=(a=s[2])==null?void 0:a.classes)==null?void 0:l.actionButton))},m(r,a){S(r,e,a),U(e,n),o||(c=G(e,"click",s[51]),o=!0)},p(r,a){var l,f,d;a[0]&4&&t!==(t=r[2].action.label+"")&&ft(n,t),a[0]&256&&u(e,"style",r[8]),a[0]&6&&i!==(i=ie((l=r[1])==null?void 0:l.actionButton,(d=(f=r[2])==null?void 0:f.classes)==null?void 0:d.actionButton))&&u(e,"class",i)},d(r){r&&w(e),o=!1,c()}}}function Gi(s){let e,t,n,i,o,c,r,a,l,f,d,m,h,y,R,B=s[6]&&!s[2].component&&fn(s);const C=[Fi,Vi],O=[];function E(p,_){return p[2].component?0:1}return n=E(s),i=O[n]=C[n](s),{c(){e=X("li"),B&&B.c(),t=be(),i.c(),this.h()},l(p){e=j(p,"LI",{"aria-live":!0,"aria-atomic":!0,role:!0,tabindex:!0,class:!0,"data-sonner-toast":!0,"data-styled":!0,"data-mounted":!0,"data-promise":!0,"data-removed":!0,"data-visible":!0,"data-y-position":!0,"data-x-position":!0,"data-index":!0,"data-front":!0,"data-swiping":!0,"data-type":!0,"data-invert":!0,"data-swipe-out":!0,"data-expanded":!0,style:!0});var _=N(e);B&&B.l(_),t=we(_),i.l(_),_.forEach(w),this.h()},h(){var p,_,oe,Y,Z,re,pe;u(e,"aria-live",o=s[2].important?"assertive":"polite"),u(e,"aria-atomic","true"),u(e,"role","status"),u(e,"tabindex",0),u(e,"class",c=ie(s[34].class,s[24],(p=s[1])==null?void 0:p.toast,(oe=(_=s[2])==null?void 0:_.classes)==null?void 0:oe.toast,(Y=s[1])==null?void 0:Y[s[11]],(re=(Z=s[2])==null?void 0:Z.classes)==null?void 0:re[s[11]])),u(e,"data-sonner-toast",""),u(e,"data-styled",r=!(s[2].component||(pe=s[2])!=null&&pe.unstyled||s[10])),u(e,"data-mounted",s[12]),u(e,"data-promise",a=!!s[2].promise),u(e,"data-removed",s[13]),u(e,"data-visible",s[25]),u(e,"data-y-position",l=s[21][0]),u(e,"data-x-position",f=s[21][1]),u(e,"data-index",s[3]),u(e,"data-front",s[26]),u(e,"data-swiping",s[14]),u(e,"data-type",s[11]),u(e,"data-invert",s[0]),u(e,"data-swipe-out",s[15]),u(e,"data-expanded",d=!!(s[4]||s[5]&&s[12])),u(e,"style",m=`${s[34].style} ${s[2].style}`),I(e,"--index",s[3]),I(e,"--toasts-before",s[3]),I(e,"--z-index",s[27].length-s[3]),I(e,"--offset",`${s[13]?s[16]:s[19]}px`),I(e,"--initial-height",`${s[17]}px`)},m(p,_){S(p,e,_),B&&B.m(e,null),U(e,t),O[n].m(e,null),s[52](e),h=!0,y||(R=[G(e,"pointerdown",s[31]),G(e,"pointerup",s[32]),G(e,"pointermove",s[33])],y=!0)},p(p,_){var Z,re,pe,x,T,J,P;p[6]&&!p[2].component?B?B.p(p,_):(B=fn(p),B.c(),B.m(e,t)):B&&(B.d(1),B=null);let oe=n;n=E(p),n===oe?O[n].p(p,_):(V(),v(O[oe],1,1,()=>{O[oe]=null}),F(),i=O[n],i?i.p(p,_):(i=O[n]=C[n](p),i.c()),k(i,1),i.m(e,null)),(!h||_[0]&4&&o!==(o=p[2].important?"assertive":"polite"))&&u(e,"aria-live",o),(!h||_[0]&16779270|_[1]&8&&c!==(c=ie(p[34].class,p[24],(Z=p[1])==null?void 0:Z.toast,(pe=(re=p[2])==null?void 0:re.classes)==null?void 0:pe.toast,(x=p[1])==null?void 0:x[p[11]],(J=(T=p[2])==null?void 0:T.classes)==null?void 0:J[p[11]])))&&u(e,"class",c),(!h||_[0]&1028&&r!==(r=!(p[2].component||(P=p[2])!=null&&P.unstyled||p[10])))&&u(e,"data-styled",r),(!h||_[0]&4096)&&u(e,"data-mounted",p[12]),(!h||_[0]&4&&a!==(a=!!p[2].promise))&&u(e,"data-promise",a),(!h||_[0]&8192)&&u(e,"data-removed",p[13]),(!h||_[0]&33554432)&&u(e,"data-visible",p[25]),(!h||_[0]&2097152&&l!==(l=p[21][0]))&&u(e,"data-y-position",l),(!h||_[0]&2097152&&f!==(f=p[21][1]))&&u(e,"data-x-position",f),(!h||_[0]&8)&&u(e,"data-index",p[3]),(!h||_[0]&67108864)&&u(e,"data-front",p[26]),(!h||_[0]&16384)&&u(e,"data-swiping",p[14]),(!h||_[0]&2048)&&u(e,"data-type",p[11]),(!h||_[0]&1)&&u(e,"data-invert",p[0]),(!h||_[0]&32768)&&u(e,"data-swipe-out",p[15]),(!h||_[0]&4144&&d!==(d=!!(p[4]||p[5]&&p[12])))&&u(e,"data-expanded",d),(!h||_[0]&4|_[1]&8&&m!==(m=`${p[34].style} ${p[2].style}`))&&u(e,"style",m);const Y=_[0]&4|_[1]&8;(_[0]&12|_[1]&8||Y)&&I(e,"--index",p[3]),(_[0]&12|_[1]&8||Y)&&I(e,"--toasts-before",p[3]),(_[0]&134217740|_[1]&8||Y)&&I(e,"--z-index",p[27].length-p[3]),(_[0]&598020|_[1]&8||Y)&&I(e,"--offset",`${p[13]?p[16]:p[19]}px`),(_[0]&131076|_[1]&8||Y)&&I(e,"--initial-height",`${p[17]}px`)},i(p){h||(k(i),h=!0)},o(p){v(i),h=!1},d(p){p&&w(e),B&&B.d(),O[n].d(),s[52](null),y=!1,Pn(R)}}}const _n=4e3,Zi=14,xi=20,$i=200,eo=.05;function to(s,e,t){let n,i,o,c,r,a,l,f,d,m,h,y,R,B=D,C=()=>(B(),B=fs(Ge,g=>t(45,R=g)),Ge),O,E;s.$$.on_destroy.push(()=>B());let{$$slots:p={},$$scope:_}=e;const oe={toast:"",title:"",description:"",loader:"",closeButton:"",cancelButton:"",actionButton:"",action:"",warning:"",error:"",success:"",default:"",info:"",loading:""},{toasts:Y,heights:Z,removeHeight:re,setHeight:pe,remove:x}=Un;ye(s,Y,g=>t(27,E=g)),ye(s,Z,g=>t(46,O=g));let{toast:T}=e,{index:J}=e,{expanded:P}=e,{invert:$}=e,{position:_e}=e,{visibleToasts:Le}=e,{expandByDefault:Pe}=e,{closeButton:We}=e,{interacting:Ie}=e,{cancelButtonStyle:Ke=""}=e,{actionButtonStyle:Ye=""}=e,{duration:Be=4e3}=e,{descriptionClass:Je=""}=e,{classes:Ae={}}=e,{unstyled:b=!1}=e,M=!1,ee=!1,ve=!1,De=!1,Xe=0,dt=0,Q,Me=0,pt=0,qt=0,Se=null;async function $n(){if(!M)return;await In();let g;P||Pe?g=1:g=1-J*eo,Q.style.setProperty("height","auto");const q=Q.offsetHeight,qe=Q.getBoundingClientRect().height,mt=Math.round((qe/g+Number.EPSILON)*100)/100;Q.style.removeProperty("height");let Ce;Math.abs(mt-q)<1?Ce=mt:Ce=q,t(17,dt=Ce),pe({toastId:T.id,height:Ce})}function Ee(){t(13,ee=!0),t(16,Xe=Me),re(T.id),setTimeout(()=>{x(T.id)},$i)}let je,Qe=T.duration||Be||_n;function es(){if(qt<pt){const g=new Date().getTime()-pt;Qe=Qe-g}qt=new Date().getTime()}function Ut(){pt=new Date().getTime(),t(39,je=setTimeout(()=>{var g;(g=T.onAutoClose)==null||g.call(T,T),Ee()},Qe))}let Ge;Rt(()=>{t(12,M=!0);const g=Q.getBoundingClientRect().height;return t(17,dt=g),pe({toastId:T.id,height:g}),()=>re(T.id)});function ts(g){if(h)return;t(16,Xe=Me);const q=g.target;q.setPointerCapture(g.pointerId),q.tagName!=="BUTTON"&&(t(14,ve=!0),Se={x:g.clientX,y:g.clientY})}function ns(){var q;if(De)return;Se=null;const g=Number((Q==null?void 0:Q.style.getPropertyValue("--swipe-amount").replace("px",""))||0);if(Math.abs(g)>=xi){t(16,Xe=Me),(q=T.onDismiss)==null||q.call(T,T),Ee(),t(15,De=!0);return}Q.style.setProperty("--swipe-amount","0px"),t(14,ve=!1)}function ss(g){if(!Se)return;const q=g.clientY-Se.y,qe=g.clientX-Se.x,Ce=(d[0]==="top"?Math.min:Math.max)(0,q),Vt=g.pointerType==="touch"?10:2;Math.abs(Ce)>Vt?Q.style.setProperty("--swipe-amount",`${q}px`):Math.abs(qe)>Vt&&(Se=null)}const is=()=>{var g;Ee(),(g=T.onDismiss)==null||g.call(T,T)},os=()=>{var g;Ee(),(g=T.cancel)!=null&&g.onClick&&T.cancel.onClick()},rs=g=>{var q;(q=T.action)==null||q.onClick(g),!g.defaultPrevented&&Ee()};function as(g){Dn[g?"unshift":"push"](()=>{Q=g,t(18,Q)})}return s.$$set=g=>{t(34,e=le(le({},e),ot(g))),"toast"in g&&t(2,T=g.toast),"index"in g&&t(3,J=g.index),"expanded"in g&&t(4,P=g.expanded),"invert"in g&&t(0,$=g.invert),"position"in g&&t(35,_e=g.position),"visibleToasts"in g&&t(36,Le=g.visibleToasts),"expandByDefault"in g&&t(5,Pe=g.expandByDefault),"closeButton"in g&&t(6,We=g.closeButton),"interacting"in g&&t(37,Ie=g.interacting),"cancelButtonStyle"in g&&t(7,Ke=g.cancelButtonStyle),"actionButtonStyle"in g&&t(8,Ye=g.actionButtonStyle),"duration"in g&&t(38,Be=g.duration),"descriptionClass"in g&&t(9,Je=g.descriptionClass),"classes"in g&&t(1,Ae=g.classes),"unstyled"in g&&t(10,b=g.unstyled),"$$scope"in g&&t(47,_=g.$$scope)},s.$$.update=()=>{s.$$.dirty[0]&2&&t(1,Ae={...oe,...Ae}),s.$$.dirty[0]&8&&t(26,n=J===0),s.$$.dirty[0]&8|s.$$.dirty[1]&32&&t(25,i=J+1<=Le),s.$$.dirty[0]&4&&t(42,o=T.title),s.$$.dirty[0]&4&&t(41,c=T.description),s.$$.dirty[0]&4&&t(11,r=T.type),s.$$.dirty[0]&4&&t(24,a=T.class||""),s.$$.dirty[0]&4&&t(23,l=T.descriptionClass||""),s.$$.dirty[0]&4|s.$$.dirty[1]&32768&&t(44,f=O.findIndex(g=>g.toastId===T.id)||0),s.$$.dirty[1]&16&&t(21,d=_e.split("-")),s.$$.dirty[1]&40960&&t(43,m=O.reduce((g,q,qe)=>qe>=f?g:g+q.height,0)),s.$$.dirty[0]&5&&t(0,$=T.invert||$),s.$$.dirty[0]&2048&&t(22,h=r==="loading"),s.$$.dirty[1]&12288&&t(19,Me=Math.round(f*Zi+m)),s.$$.dirty[1]&3072&&$n(),s.$$.dirty[0]&4|s.$$.dirty[1]&384&&T.updated&&(clearTimeout(je),Qe=T.duration||Be||_n,Ut()),s.$$.dirty[0]&2052&&t(40,y=T.promise&&r==="loading"||T.duration===Number.POSITIVE_INFINITY),s.$$.dirty[0]&16|s.$$.dirty[1]&832&&C(t(20,Ge=Ts(()=>(y||(P||Ie?es():Ut()),()=>clearTimeout(je))))),s.$$.dirty[1]&16384,s.$$.dirty[0]&4&&T.delete&&Ee()},e=ot(e),[$,Ae,T,J,P,Pe,We,Ke,Ye,Je,b,r,M,ee,ve,De,Xe,dt,Q,Me,Ge,d,h,l,a,i,n,E,Y,Z,Ee,ts,ns,ss,e,_e,Le,Ie,Be,je,y,c,o,m,f,R,O,_,p,is,os,rs,as]}class no extends He{constructor(e){super(),ze(this,e,to,Gi,ls,{toast:2,index:3,expanded:4,invert:0,position:35,visibleToasts:36,expandByDefault:5,closeButton:6,interacting:37,cancelButtonStyle:7,actionButtonStyle:8,duration:38,descriptionClass:9,classes:1,unstyled:10},null,[-1,-1,-1])}}const{Boolean:so}=Mn;function yn(s,e,t){const n=s.slice();return n[10]=e[t],n[40]=t,n}function bn(s,e,t){const n=s.slice();return n[41]=e[t],n[40]=t,n}const io=s=>({}),wn=s=>({slot:"loading-icon"}),oo=s=>({}),kn=s=>({slot:"success-icon"}),ro=s=>({}),vn=s=>({slot:"error-icon"}),ao=s=>({}),En=s=>({slot:"warning-icon"}),lo=s=>({}),Tn=s=>({slot:"info-icon"});function Bn(s){let e,t,n,i=Fe(s[17]),o=[];for(let r=0;r<i.length;r+=1)o[r]=Sn(yn(s,i,r));const c=r=>v(o[r],1,1,()=>{o[r]=null});return{c(){e=X("section");for(let r=0;r<o.length;r+=1)o[r].c();this.h()},l(r){e=j(r,"SECTION",{"aria-label":!0,tabindex:!0});var a=N(e);for(let l=0;l<o.length;l+=1)o[l].l(a);a.forEach(w),this.h()},h(){u(e,"aria-label",t=`${s[1]} ${s[16]}`),u(e,"tabindex",-1)},m(r,a){S(r,e,a);for(let l=0;l<o.length;l+=1)o[l]&&o[l].m(e,null);n=!0},p(r,a){if(a[0]&31915005|a[1]&16){i=Fe(r[17]);let l;for(l=0;l<i.length;l+=1){const f=yn(r,i,l);o[l]?(o[l].p(f,a),k(o[l],1)):(o[l]=Sn(f),o[l].c(),k(o[l],1),o[l].m(e,null))}for(V(),l=i.length;l<o.length;l+=1)c(l);F()}(!n||a[0]&65538&&t!==(t=`${r[1]} ${r[16]}`))&&u(e,"aria-label",t)},i(r){if(!n){for(let a=0;a<i.length;a+=1)k(o[a]);n=!0}},o(r){o=o.filter(so);for(let a=0;a<o.length;a+=1)v(o[a]);n=!1},d(r){r&&w(e),hs(o,r)}}}function co(s){let e,t;return e=new Pi({props:{visible:s[41].type==="loading"}}),{c(){z(e.$$.fragment)},l(n){de(e.$$.fragment,n)},m(n,i){W(e,n,i),t=!0},p(n,i){const o={};i[0]&133120&&(o.visible=n[41].type==="loading"),e.$set(o)},i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){v(e.$$.fragment,n),t=!1},d(n){K(e,n)}}}function fo(s){let e;const t=s[27]["loading-icon"],n=ce(t,s,s[35],wn),i=n||co(s);return{c(){i&&i.c()},l(o){i&&i.l(o)},m(o,c){i&&i.m(o,c),e=!0},p(o,c){n?n.p&&(!e||c[1]&16)&&fe(n,t,o,o[35],e?he(t,o[35],c,io):ue(o[35]),wn):i&&i.p&&(!e||c[0]&133120)&&i.p(o,e?c:[-1,-1])},i(o){e||(k(i,o),e=!0)},o(o){v(i,o),e=!1},d(o){i&&i.d(o)}}}function uo(s){let e,t;return e=new ht({props:{type:"success"}}),{c(){z(e.$$.fragment)},l(n){de(e.$$.fragment,n)},m(n,i){W(e,n,i),t=!0},p:D,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){v(e.$$.fragment,n),t=!1},d(n){K(e,n)}}}function ho(s){let e;const t=s[27]["success-icon"],n=ce(t,s,s[35],kn),i=n||uo();return{c(){i&&i.c()},l(o){i&&i.l(o)},m(o,c){i&&i.m(o,c),e=!0},p(o,c){n&&n.p&&(!e||c[1]&16)&&fe(n,t,o,o[35],e?he(t,o[35],c,oo):ue(o[35]),kn)},i(o){e||(k(i,o),e=!0)},o(o){v(i,o),e=!1},d(o){i&&i.d(o)}}}function po(s){let e,t;return e=new ht({props:{type:"error"}}),{c(){z(e.$$.fragment)},l(n){de(e.$$.fragment,n)},m(n,i){W(e,n,i),t=!0},p:D,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){v(e.$$.fragment,n),t=!1},d(n){K(e,n)}}}function mo(s){let e;const t=s[27]["error-icon"],n=ce(t,s,s[35],vn),i=n||po();return{c(){i&&i.c()},l(o){i&&i.l(o)},m(o,c){i&&i.m(o,c),e=!0},p(o,c){n&&n.p&&(!e||c[1]&16)&&fe(n,t,o,o[35],e?he(t,o[35],c,ro):ue(o[35]),vn)},i(o){e||(k(i,o),e=!0)},o(o){v(i,o),e=!1},d(o){i&&i.d(o)}}}function go(s){let e,t;return e=new ht({props:{type:"warning"}}),{c(){z(e.$$.fragment)},l(n){de(e.$$.fragment,n)},m(n,i){W(e,n,i),t=!0},p:D,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){v(e.$$.fragment,n),t=!1},d(n){K(e,n)}}}function _o(s){let e;const t=s[27]["warning-icon"],n=ce(t,s,s[35],En),i=n||go();return{c(){i&&i.c()},l(o){i&&i.l(o)},m(o,c){i&&i.m(o,c),e=!0},p(o,c){n&&n.p&&(!e||c[1]&16)&&fe(n,t,o,o[35],e?he(t,o[35],c,ao):ue(o[35]),En)},i(o){e||(k(i,o),e=!0)},o(o){v(i,o),e=!1},d(o){i&&i.d(o)}}}function yo(s){let e,t;return e=new ht({props:{type:"info"}}),{c(){z(e.$$.fragment)},l(n){de(e.$$.fragment,n)},m(n,i){W(e,n,i),t=!0},p:D,i(n){t||(k(e.$$.fragment,n),t=!0)},o(n){v(e.$$.fragment,n),t=!1},d(n){K(e,n)}}}function bo(s){let e;const t=s[27]["info-icon"],n=ce(t,s,s[35],Tn),i=n||yo();return{c(){i&&i.c()},l(o){i&&i.l(o)},m(o,c){i&&i.m(o,c),e=!0},p(o,c){n&&n.p&&(!e||c[1]&16)&&fe(n,t,o,o[35],e?he(t,o[35],c,lo):ue(o[35]),Tn)},i(o){e||(k(i,o),e=!0)},o(o){v(i,o),e=!1},d(o){i&&i.d(o)}}}function An(s,e){var o,c,r,a,l;let t,n,i;return n=new no({props:{index:e[40],toast:e[41],invert:e[0],visibleToasts:e[5],closeButton:e[6],interacting:e[13],position:e[10],expandByDefault:e[3],expanded:e[12],actionButtonStyle:((o=e[7])==null?void 0:o.actionButtonStyle)||"",cancelButtonStyle:((c=e[7])==null?void 0:c.cancelButtonStyle)||"",class:((r=e[7])==null?void 0:r.class)||"",descriptionClass:((a=e[7])==null?void 0:a.descriptionClass)||"",classes:e[7].classes||{},duration:((l=e[7])==null?void 0:l.duration)??e[4],unstyled:e[7].unstyled||!1,$$slots:{"info-icon":[bo],"warning-icon":[_o],"error-icon":[mo],"success-icon":[ho],"loading-icon":[fo]},$$scope:{ctx:e}}}),{key:s,first:null,c(){t=H(),z(n.$$.fragment),this.h()},l(f){t=H(),de(n.$$.fragment,f),this.h()},h(){this.first=t},m(f,d){S(f,t,d),W(n,f,d),i=!0},p(f,d){var h,y,R,B,C;e=f;const m={};d[0]&133120&&(m.index=e[40]),d[0]&133120&&(m.toast=e[41]),d[0]&1&&(m.invert=e[0]),d[0]&32&&(m.visibleToasts=e[5]),d[0]&64&&(m.closeButton=e[6]),d[0]&8192&&(m.interacting=e[13]),d[0]&131072&&(m.position=e[10]),d[0]&8&&(m.expandByDefault=e[3]),d[0]&4096&&(m.expanded=e[12]),d[0]&128&&(m.actionButtonStyle=((h=e[7])==null?void 0:h.actionButtonStyle)||""),d[0]&128&&(m.cancelButtonStyle=((y=e[7])==null?void 0:y.cancelButtonStyle)||""),d[0]&128&&(m.class=((R=e[7])==null?void 0:R.class)||""),d[0]&128&&(m.descriptionClass=((B=e[7])==null?void 0:B.descriptionClass)||""),d[0]&128&&(m.classes=e[7].classes||{}),d[0]&144&&(m.duration=((C=e[7])==null?void 0:C.duration)??e[4]),d[0]&128&&(m.unstyled=e[7].unstyled||!1),d[0]&133120|d[1]&16&&(m.$$scope={dirty:d,ctx:e}),n.$set(m)},i(f){i||(k(n.$$.fragment,f),i=!0)},o(f){v(n.$$.fragment,f),i=!1},d(f){f&&w(t),K(n,f)}}}function Sn(s){let e,t=[],n=new Map,i,o,c,r,a,l,f,d,m,h;function y(...E){return s[28](s[40],s[10],...E)}let R=Fe(s[11].filter(y));const B=E=>E[41].id;for(let E=0;E<R.length;E+=1){let p=bn(s,R,E),_=B(p);n.set(_,t[E]=An(_,p))}let C=[{tabindex:o=-1},{class:c=s[23].class},{"data-sonner-toaster":""},{"data-theme":s[14]},{"data-rich-colors":s[2]},{dir:r=s[9]==="auto"?Ot():s[9]},{"data-y-position":a=s[10].split("-")[0]},{"data-x-position":l=s[10].split("-")[1]},{style:f=s[23].style},s[24]],O={};for(let E=0;E<C.length;E+=1)O=le(O,C[E]);return{c(){e=X("ol");for(let E=0;E<t.length;E+=1)t[E].c();i=be(),this.h()},l(E){e=j(E,"OL",{tabindex:!0,class:!0,"data-sonner-toaster":!0,"data-theme":!0,"data-rich-colors":!0,dir:!0,"data-y-position":!0,"data-x-position":!0,style:!0});var p=N(e);for(let _=0;_<t.length;_+=1)t[_].l(p);i=we(p),p.forEach(w),this.h()},h(){var E;Ht(e,O),I(e,"--front-toast-height",`${(E=s[18][0])==null?void 0:E.height}px`),I(e,"--offset",typeof s[8]=="number"?`${s[8]}px`:s[8]||Cn),I(e,"--width",`${On}px`),I(e,"--gap",`${Rn}px`)},m(E,p){S(E,e,p);for(let _=0;_<t.length;_+=1)t[_]&&t[_].m(e,null);U(e,i),s[29](e),d=!0,m||(h=[G(e,"blur",s[21]),G(e,"focus",s[22]),G(e,"mouseenter",s[30]),G(e,"mousemove",s[31]),G(e,"mouseleave",s[32]),G(e,"pointerdown",s[33]),G(e,"pointerup",s[34])],m=!0)},p(E,p){var _;s=E,p[0]&145657|p[1]&16&&(R=Fe(s[11].filter(y)),V(),t=vs(t,p,B,1,s,R,n,e,Es,An,i,bn),F()),Ht(e,O=Te(C,[{tabindex:o},(!d||p[0]&8388608&&c!==(c=s[23].class))&&{class:c},{"data-sonner-toaster":""},(!d||p[0]&16384)&&{"data-theme":s[14]},(!d||p[0]&4)&&{"data-rich-colors":s[2]},(!d||p[0]&512&&r!==(r=s[9]==="auto"?Ot():s[9]))&&{dir:r},(!d||p[0]&131072&&a!==(a=s[10].split("-")[0]))&&{"data-y-position":a},(!d||p[0]&131072&&l!==(l=s[10].split("-")[1]))&&{"data-x-position":l},(!d||p[0]&8388608&&f!==(f=s[23].style))&&{style:f},p[0]&16777216&&s[24]])),I(e,"--front-toast-height",`${(_=s[18][0])==null?void 0:_.height}px`),I(e,"--offset",typeof s[8]=="number"?`${s[8]}px`:s[8]||Cn),I(e,"--width",`${On}px`),I(e,"--gap",`${Rn}px`)},i(E){if(!d){for(let p=0;p<R.length;p+=1)k(t[p]);d=!0}},o(E){for(let p=0;p<t.length;p+=1)v(t[p]);d=!1},d(E){E&&w(e);for(let p=0;p<t.length;p+=1)t[p].d();s[29](null),m=!1,Pn(h)}}}function wo(s){let e,t,n=s[11].length>0&&Bn(s);return{c(){n&&n.c(),e=H()},l(i){n&&n.l(i),e=H()},m(i,o){n&&n.m(i,o),S(i,e,o),t=!0},p(i,o){i[11].length>0?n?(n.p(i,o),o[0]&2048&&k(n,1)):(n=Bn(i),n.c(),k(n,1),n.m(e.parentNode,e)):n&&(V(),v(n,1,1,()=>{n=null}),F())},i(i){t||(k(n),t=!0)},o(i){v(n),t=!1},d(i){i&&w(e),n&&n.d(i)}}}const ko=3,Cn="32px",On=356,Rn=14,Ct="dark",rt="light";function vo(s){return s!=="system"?s:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Ct:rt}function Ot(){if(typeof window>"u"||typeof document>"u")return"ltr";const s=document.documentElement.getAttribute("dir");return s==="auto"||!s?window.getComputedStyle(document.documentElement).direction:s}function Eo(s,e,t){let n,i;const o=["invert","theme","position","hotkey","containerAriaLabel","richColors","expand","duration","visibleToasts","closeButton","toastOptions","offset","dir"];let c=Ft(e,o),r,a,{$$slots:l={},$$scope:f}=e,{invert:d=!1}=e,{theme:m="light"}=e,{position:h="bottom-right"}=e,{hotkey:y=["altKey","KeyT"]}=e,{containerAriaLabel:R="Notifications"}=e,{richColors:B=!1}=e,{expand:C=!1}=e,{duration:O=4e3}=e,{visibleToasts:E=ko}=e,{closeButton:p=!1}=e,{toastOptions:_={}}=e,{offset:oe=null}=e,{dir:Y=Ot()}=e;const{toasts:Z,heights:re,reset:pe}=Un;ye(s,Z,b=>t(11,r=b)),ye(s,re,b=>t(18,a=b));let x=!1,T=!1,J=vo(m),P,$=null,_e=!1;us(()=>{P&&$&&($.focus({preventScroll:!0}),$=null,_e=!1)}),Rt(()=>{pe();const b=M=>{y.every(ve=>M[ve]||M.code===ve)&&(t(12,x=!0),P==null||P.focus()),M.code==="Escape"&&(document.activeElement===P||P!=null&&P.contains(document.activeElement))&&t(12,x=!1)};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}});function Le(b){_e&&!b.currentTarget.contains(b.relatedTarget)&&(_e=!1,$&&($.focus({preventScroll:!0}),$=null))}function Pe(b){_e||(_e=!0,$=b.relatedTarget)}const We=(b,M,ee)=>!ee.position&&b===0||ee.position===M;function Ie(b){Dn[b?"unshift":"push"](()=>{P=b,t(15,P)})}const Ke=()=>t(12,x=!0),Ye=()=>t(12,x=!0),Be=()=>{T||t(12,x=!1)},Je=()=>t(13,T=!0),Ae=()=>t(13,T=!1);return s.$$set=b=>{t(23,e=le(le({},e),ot(b))),t(24,c=Ft(e,o)),"invert"in b&&t(0,d=b.invert),"theme"in b&&t(25,m=b.theme),"position"in b&&t(10,h=b.position),"hotkey"in b&&t(26,y=b.hotkey),"containerAriaLabel"in b&&t(1,R=b.containerAriaLabel),"richColors"in b&&t(2,B=b.richColors),"expand"in b&&t(3,C=b.expand),"duration"in b&&t(4,O=b.duration),"visibleToasts"in b&&t(5,E=b.visibleToasts),"closeButton"in b&&t(6,p=b.closeButton),"toastOptions"in b&&t(7,_=b.toastOptions),"offset"in b&&t(8,oe=b.offset),"dir"in b&&t(9,Y=b.dir),"$$scope"in b&&t(35,f=b.$$scope)},s.$$.update=()=>{if(s.$$.dirty[0]&3072&&t(17,n=Array.from(new Set([h,...r.filter(b=>b.position).map(b=>b.position)].filter(Boolean)))),s.$$.dirty[0]&67108864&&t(16,i=y.join("+").replace(/Key/g,"").replace(/Digit/g,"")),s.$$.dirty[0]&2048&&r.length<=1&&t(12,x=!1),s.$$.dirty[0]&2048){const b=r.filter(M=>M.dismiss&&!M.delete);if(b.length>0){const M=r.map(ee=>b.find(De=>De.id===ee.id)?{...ee,delete:!0}:ee);Z.set(M)}}if(s.$$.dirty[0]&33554432&&(m!=="system"&&t(14,J=m),typeof window<"u")){m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?t(14,J=Ct):t(14,J=rt));const b=window.matchMedia("(prefers-color-scheme: dark)"),M=({matches:ee})=>{t(14,J=ee?Ct:rt)};"addEventListener"in b?b.addEventListener("change",M):b.addListener(M)}},e=ot(e),[d,R,B,C,O,E,p,_,oe,Y,h,r,x,T,J,P,i,n,a,Z,re,Le,Pe,e,c,m,y,l,We,Ie,Ke,Ye,Be,Je,Ae,f]}class To extends He{constructor(e){super(),ze(this,e,Eo,wo,at,{invert:0,theme:25,position:10,hotkey:26,containerAriaLabel:1,richColors:2,expand:3,duration:4,visibleToasts:5,closeButton:6,toastOptions:7,offset:8,dir:9},null,[-1,-1])}}const{document:tt}=Mn;function Nn(s){let e;const t=s[4].default,n=ce(t,s,s[3],null);return{c(){n&&n.c()},l(i){n&&n.l(i)},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&8)&&fe(n,t,i,i[3],e?he(t,i[3],o,null):ue(i[3]),null)},i(i){e||(k(n,i),e=!0)},o(i){v(n,i),e=!1},d(i){n&&n.d(i)}}}function Bo(s){let e,t,n,i,o,c;tt.title=e=s[1];let r=s[0]&&Nn(s);return o=new To({props:{theme:s[2].includes("dark")||s[2]==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",richColors:!0,position:"top-center"}}),{c(){t=X("link"),n=be(),r&&r.c(),i=be(),z(o.$$.fragment),this.h()},l(a){const l=ds("svelte-1eeu451",tt.head);t=j(l,"LINK",{crossorigin:!0,rel:!0,href:!0}),l.forEach(w),n=we(a),r&&r.l(a),i=we(a),de(o.$$.fragment,a),this.h()},h(){u(t,"crossorigin","anonymous"),u(t,"rel","icon"),u(t,"href",qn+"/static/favicon.png")},m(a,l){U(tt.head,t),S(a,n,l),r&&r.m(a,l),S(a,i,l),W(o,a,l),c=!0},p(a,[l]){(!c||l&2)&&e!==(e=a[1])&&(tt.title=e),a[0]?r?(r.p(a,l),l&1&&k(r,1)):(r=Nn(a),r.c(),k(r,1),r.m(i.parentNode,i)):r&&(V(),v(r,1,1,()=>{r=null}),F());const f={};l&4&&(f.theme=a[2].includes("dark")||a[2]==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),o.$set(f)},i(a){c||(k(r),k(o.$$.fragment,a),c=!0)},o(a){v(r),v(o.$$.fragment,a),c=!1},d(a){a&&(w(n),w(i)),w(t),r&&r.d(a),K(o,a)}}}const Ln=768;function Ao(s,e,t){let n,i,o,c,r;ye(s,ks,h=>t(5,n=h)),ye(s,gt,h=>t(6,i=h)),ye(s,Jt,h=>t(7,o=h)),ye(s,Wt,h=>t(1,c=h)),ye(s,Kt,h=>t(2,r=h));let{$$slots:a={},$$scope:l}=e,f=ki(0,{stiffness:.05});ps("i18n",Jt);let d=!1;const m=()=>{const h=it(`${qn}`||void 0,{reconnection:!0,reconnectionDelay:1e3,reconnectionDelayMax:5e3,randomizationFactor:.5,path:"/ws/socket.io",auth:{token:localStorage.token}});ys.set(h),h.on("connect_error",y=>{console.log("connect_error",y)}),h.on("connect",()=>{console.log("connected",h.id)}),h.on("reconnect_attempt",y=>{console.log("reconnect_attempt",y)}),h.on("reconnect_failed",()=>{console.log("reconnect_failed")}),h.on("disconnect",(y,R)=>{console.log(`Socket ${h.id} disconnected due to ${y}`),R&&console.log("Additional details:",R)}),h.on("user-count",y=>{console.log("user-count",y),bs.set(y.count)}),h.on("usage",y=>{console.log("usage",y),ws.set(y.models)})};return Rt(async()=>{var R,B;Kt.set(localStorage.theme),_t.set(window.innerWidth<Ln);const h=()=>{window.innerWidth<Ln?_t.set(!0):_t.set(!1)};window.addEventListener("resize",h);let y=null;try{y=await Yt(),console.log("Backend config:",y)}catch(C){console.error("Error loading backend config:",C)}if(Ss(),!localStorage.locale){const C=await Cs(),O=navigator.languages?navigator.languages:[navigator.language||navigator.userLanguage],E=y.default_locale?y.default_locale:Os(C,O,"en-US");o.changeLanguage(E)}if(y){if(await gt.set(y),await Wt.set(y.name),i)if(m(),localStorage.token){const C=await As(localStorage.token).catch(O=>(Bs.error(O),null));C?(await _s.set(C),await gt.set(await Yt())):(localStorage.removeItem("token"),await yt("/auth"))}else n.url.pathname!=="/auth"&&await yt("/auth")}else await yt("/error");if(await In(),document.documentElement.classList.contains("her")&&document.getElementById("progress-bar")){f.subscribe(E=>{const p=document.getElementById("progress-bar");p&&(p.style.width=`${E}%`)}),await f.set(100),(R=document.getElementById("splash-screen"))==null||R.remove();const C=new Audio("/audio/greeting.mp3"),O=()=>{C.play(),document.removeEventListener("click",O)};document.addEventListener("click",O),t(0,d=!0)}else(B=document.getElementById("splash-screen"))==null||B.remove(),t(0,d=!0);return()=>{window.removeEventListener("resize",h)}}),s.$$set=h=>{"$$scope"in h&&t(3,l=h.$$scope)},[d,c,r,l,a]}class Wo extends He{constructor(e){super(),ze(this,e,Ao,Bo,at,{})}}export{Wo as component,zo as universal}; |