@sync-in/server 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -2
- package/package.json +10 -9
- package/server/app.bootstrap.js +4 -2
- package/server/app.bootstrap.js.map +1 -1
- package/server/applications/files/files.controller.js +12 -4
- package/server/applications/files/files.controller.js.map +1 -1
- package/server/applications/files/files.controller.spec.js +18 -4
- package/server/applications/files/files.controller.spec.js.map +1 -1
- package/server/applications/files/services/files-manager.service.js.map +1 -1
- package/server/applications/files/services/files-methods.service.js +1 -6
- package/server/applications/files/services/files-methods.service.js.map +1 -1
- package/server/applications/files/utils/doc-textify/adapters/pdf.js +5 -16
- package/server/applications/files/utils/doc-textify/adapters/pdf.js.map +1 -1
- package/server/applications/users/services/users-manager.service.js +1 -2
- package/server/applications/users/services/users-manager.service.js.map +1 -1
- package/server/applications/users/users.gateway.js +6 -0
- package/server/applications/users/users.gateway.js.map +1 -1
- package/server/common/image.js +62 -58
- package/server/common/image.js.map +1 -1
- package/static/3rdpartylicenses.txt +0 -26
- package/static/chunk-2VMSXRCB.js +12 -0
- package/static/{chunk-X5XGK6T7.js → chunk-3OHSRRKH.js} +1 -1
- package/static/{chunk-H6NE33VX.js → chunk-3R4WKOHQ.js} +1 -1
- package/static/{chunk-WLMNXRBS.js → chunk-3R74L4UU.js} +1 -1
- package/static/{chunk-ZPF2DSQV.js → chunk-5UKZLU5H.js} +1 -1
- package/static/{chunk-KFJIQIGR.js → chunk-BQV4FRM6.js} +1 -1
- package/static/{chunk-MFLIJH6T.js → chunk-CETH7UYS.js} +1 -1
- package/static/{chunk-C36MW4ME.js → chunk-DIT6W7VM.js} +9 -9
- package/static/{chunk-YW57T2PF.js → chunk-IQSKQXC3.js} +1 -1
- package/static/{chunk-QZU2S5CV.js → chunk-ITUFI2BJ.js} +1 -1
- package/static/{chunk-PGZZP5W3.js → chunk-LCTZJ537.js} +1 -1
- package/static/{chunk-LVM4QB22.js → chunk-LK2UCQJ6.js} +1 -1
- package/static/{chunk-ZTCRGJ6Y.js → chunk-LP5TBXEN.js} +1 -1
- package/static/{chunk-BIKLW4YS.js → chunk-LVSNIS5P.js} +1 -1
- package/static/{chunk-VM4YX6Q7.js → chunk-MTVSJTIW.js} +1 -1
- package/static/{chunk-V3AT2BKP.js → chunk-O6FYXVHI.js} +1 -1
- package/static/{chunk-SHIVUDP3.js → chunk-PNR6M34W.js} +1 -1
- package/static/{chunk-M3XVNQZQ.js → chunk-QMRBZHE4.js} +1 -1
- package/static/{chunk-NO2LTNW3.js → chunk-QSJRY3TF.js} +1 -1
- package/static/{chunk-373XVRXW.js → chunk-QUUIRSYT.js} +1 -1
- package/static/{chunk-UEQCWMXD.js → chunk-RFH46UW3.js} +1 -1
- package/static/{chunk-AY2SZ3G6.js → chunk-RSXHRKM5.js} +1 -1
- package/static/{chunk-UJPPR4MX.js → chunk-RV3VZJPZ.js} +1 -1
- package/static/{chunk-JSWCNGXJ.js → chunk-S7HNXVRB.js} +1 -1
- package/static/{chunk-VKK5BSLX.js → chunk-SJR5R3Y4.js} +1 -1
- package/static/{chunk-UG5DMXYO.js → chunk-V3LHHZYN.js} +1 -1
- package/static/{chunk-HAS5ZOTR.js → chunk-VJTXJ43D.js} +1 -1
- package/static/{chunk-HNQRZALS.js → chunk-VQQKMY2C.js} +1 -1
- package/static/{chunk-MSUHTBB2.js → chunk-WSSU2HXE.js} +1 -1
- package/static/{chunk-GUGNR5TF.js → chunk-XDZGW64M.js} +2 -2
- package/static/{chunk-TPYBFZS5.js → chunk-XTRDKGKG.js} +1 -1
- package/static/{chunk-YEKR5OPO.js → chunk-YLWTEC3X.js} +1 -1
- package/static/index.html +1 -1
- package/static/{main-VOL6OMJ5.js → main-4H5BJY3J.js} +2 -2
- package/static/chunk-WJW7CT6G.js +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ga as yi,H as hi,Ha as Ei,Ib as Ti,Jb as lt,Ma as Si,Sa as bi,Sb as L,Ta as wi,W as li,X as ie,_ as ut,aa as pi,ba as fi,ca as Mt,da as di,ea as mi,fa as se,ga as W,ha as gi,hb as Ai,ia as _i,ja as z,kb as Z,lb as vi,mb as Ht,yb as tt}from"./chunk-GUGNR5TF.js";import{$a as Ct,$d as si,Ab as ct,Cd as ii,Db as A,Dd as Ut,Fb as D,G as Oe,Ib as Le,Jb as Ue,Kb as Ot,L as xe,Lb as xt,Lf as ai,Mb as te,Na as m,Nb as Me,Ob as H,Oc as Ye,Pa as Pe,Qb as T,Rc as Ft,Sb as Ve,Ub as He,Va as Be,Vb as We,W as Ne,Wa as Q,Wb as $e,Yc as It,_b as Nt,_c as Pt,ab as kt,ad as ht,ae as ri,bb as J,bg as ci,c as Re,ca as at,cd as Bt,da as At,dd as Ke,dg as Vt,ea as vt,ec as qe,ga as Fe,gc as Ge,hd as je,ia as p,ib as De,id as Qe,jb as Rt,kb as R,lb as O,ld as Je,md as Xe,na as M,nf as ni,oa as V,qb as k,rb as f,rd as ze,sb as g,sc as ee,sd as Ze,tb as X,tf as oi,ud as ti,v as S,vd as ei,wa as Ie,wd as Dt,xd as Lt,za as Tt}from"./chunk-C36MW4ME.js";import{n as ui}from"./chunk-DM4NXKEP.js";import{a as U,b as ve,d as Te,f as Ce,j as ke}from"./chunk-N3U6637P.js";var Ci={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var pt={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(s){return s.BASE="/api/auth",s.LOGIN="login",s.LOGOUT="logout",s.REFRESH="refresh",s.TOKEN="token",s.TOKEN_REFRESH="token/refresh",s.WS="socket.io",s.TWO_FA_BASE="2fa",s.TWO_FA_ENABLE="enable",s.TWO_FA_DISABLE="disable",s.TWO_FA_LOGIN_VERIFY="login/verify",s.TWO_FA_ADMIN_RESET_USER="reset/user",s})(l||{}),er=`${l.BASE}/${l.LOGIN}`,ir=`${l.BASE}/${l.LOGOUT}`,ki=`${l.BASE}/${l.REFRESH}`,sr=`${l.BASE}/${l.TOKEN}`,rr=`${l.BASE}/${l.TOKEN_REFRESH}`,Ri=`/${l.WS}`,re=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,Oi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,Ni=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var Se={};Ce(Se,{Fetch:()=>yt,Manager:()=>Y,NodeWebSocket:()=>P,NodeXHR:()=>I,Socket:()=>q,WebSocket:()=>P,WebTransport:()=>$,XHR:()=>I,connect:()=>K,default:()=>K,io:()=>K,protocol:()=>ye});var C=Object.create(null);C.open="0";C.close="1";C.ping="2";C.pong="3";C.message="4";C.upgrade="5";C.noop="6";var ft=Object.create(null);Object.keys(C).forEach(s=>{ft[C[s]]=s});var dt={type:"error",data:"parser error"};var Pi=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Bi=typeof ArrayBuffer=="function",Di=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,mt=({type:s,data:t},i,e)=>Pi&&t instanceof Blob?i?e(t):Fi(t,e):Bi&&(t instanceof ArrayBuffer||Di(t))?i?e(t):Fi(new Blob([t]),e):e(C[s]+(t||"")),Fi=(s,t)=>{let i=new FileReader;return i.onload=function(){let e=i.result.split(",")[1];t("b"+(e||""))},i.readAsDataURL(s)};function Ii(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}var ne;function Li(s,t){if(Pi&&s.data instanceof Blob)return s.data.arrayBuffer().then(Ii).then(t);if(Bi&&(s.data instanceof ArrayBuffer||Di(s.data)))return t(Ii(s.data));mt(s,!1,i=>{ne||(ne=new TextEncoder),t(ne.encode(i))})}var Ui="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<Ui.length;s++)gt[Ui.charCodeAt(s)]=s;var Mi=s=>{let t=s.length*.75,i=s.length,e,r=0,n,o,a,c;s[s.length-1]==="="&&(t--,s[s.length-2]==="="&&t--);let E=new ArrayBuffer(t),w=new Uint8Array(E);for(e=0;e<i;e+=4)n=gt[s.charCodeAt(e)],o=gt[s.charCodeAt(e+1)],a=gt[s.charCodeAt(e+2)],c=gt[s.charCodeAt(e+3)],w[r++]=n<<2|o>>4,w[r++]=(o&15)<<4|a>>2,w[r++]=(a&3)<<6|c&63;return E};var _s=typeof ArrayBuffer=="function",_t=(s,t)=>{if(typeof s!="string")return{type:"message",data:Vi(s,t)};let i=s.charAt(0);return i==="b"?{type:"message",data:ys(s.substring(1),t)}:ft[i]?s.length>1?{type:ft[i],data:s.substring(1)}:{type:ft[i]}:dt},ys=(s,t)=>{if(_s){let i=Mi(s);return Vi(i,t)}else return{base64:!0,data:s}},Vi=(s,t)=>{switch(t){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}};var Hi="",Wi=(s,t)=>{let i=s.length,e=new Array(i),r=0;s.forEach((n,o)=>{mt(n,!1,a=>{e[o]=a,++r===i&&t(e.join(Hi))})})},$i=(s,t)=>{let i=s.split(Hi),e=[];for(let r=0;r<i.length;r++){let n=_t(i[r],t);if(e.push(n),n.type==="error")break}return e};function qi(){return new TransformStream({transform(s,t){Li(s,i=>{let e=i.length,r;if(e<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,e);else if(e<65536){r=new Uint8Array(3);let n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,e)}else{r=new Uint8Array(9);let n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(e))}s.data&&typeof s.data!="string"&&(r[0]|=128),t.enqueue(r),t.enqueue(i)})}})}var oe;function Wt(s){return s.reduce((t,i)=>t+i.length,0)}function $t(s,t){if(s[0].length===t)return s.shift();let i=new Uint8Array(t),e=0;for(let r=0;r<t;r++)i[r]=s[0][e++],e===s[0].length&&(s.shift(),e=0);return s.length&&e<s[0].length&&(s[0]=s[0].slice(e)),i}function Gi(s,t){oe||(oe=new TextDecoder);let i=[],e=0,r=-1,n=!1;return new TransformStream({transform(o,a){for(i.push(o);;){if(e===0){if(Wt(i)<1)break;let c=$t(i,1);n=(c[0]&128)===128,r=c[0]&127,r<126?e=3:r===126?e=1:e=2}else if(e===1){if(Wt(i)<2)break;let c=$t(i,2);r=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),e=3}else if(e===2){if(Wt(i)<8)break;let c=$t(i,8),E=new DataView(c.buffer,c.byteOffset,c.length),w=E.getUint32(0);if(w>Math.pow(2,21)-1){a.enqueue(dt);break}r=w*Math.pow(2,32)+E.getUint32(4),e=3}else{if(Wt(i)<r)break;let c=$t(i,r);a.enqueue(_t(n?c:oe.decode(c),t)),e=0}if(r===0||r>s){a.enqueue(dt);break}}}})}var ae=4;function u(s){if(s)return Es(s)}function Es(s){for(var t in u.prototype)s[t]=u.prototype[t];return s}u.prototype.on=u.prototype.addEventListener=function(s,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(t),this};u.prototype.once=function(s,t){function i(){this.off(s,i),t.apply(this,arguments)}return i.fn=t,this.on(s,i),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(s,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+s];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var e,r=0;r<i.length;r++)if(e=i[r],e===t||e.fn===t){i.splice(r,1);break}return i.length===0&&delete this._callbacks["$"+s],this};u.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),i=this._callbacks["$"+s],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(i){i=i.slice(0);for(var e=0,r=i.length;e<r;++e)i[e].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};u.prototype.hasListeners=function(s){return!!this.listeners(s).length};var x=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,i)=>i(t,0),_=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Yi="arraybuffer";function qt(s,...t){return t.reduce((i,e)=>(s.hasOwnProperty(e)&&(i[e]=s[e]),i),{})}var Ss=_.setTimeout,bs=_.clearTimeout;function N(s,t){t.useNativeTimers?(s.setTimeoutFn=Ss.bind(_),s.clearTimeoutFn=bs.bind(_)):(s.setTimeoutFn=_.setTimeout.bind(_),s.clearTimeoutFn=_.clearTimeout.bind(_))}var ws=1.33;function Ki(s){return typeof s=="string"?As(s):Math.ceil((s.byteLength||s.size)*ws)}function As(s){let t=0,i=0;for(let e=0,r=s.length;e<r;e++)t=s.charCodeAt(e),t<128?i+=1:t<2048?i+=2:t<55296||t>=57344?i+=3:(e++,i+=4);return i}function Gt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function ji(s){let t="";for(let i in s)s.hasOwnProperty(i)&&(t.length&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(s[i]));return t}function Qi(s){let t={},i=s.split("&");for(let e=0,r=i.length;e<r;e++){let n=i[e].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Yt=class extends Error{constructor(t,i,e){super(t),this.description=i,this.context=e,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,N(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,i,e){return super.emitReserved("error",new Yt(t,i,e)),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){let i=_t(t,this.socket.binaryType);this.onPacket(i)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,i={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){let 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){let i=ji(t);return i.length?"?"+i:""}};var et=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let i=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||i()})),this.writable||(e++,this.once("drain",function(){--e||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let i=e=>{if(this.readyState==="opening"&&e.type==="open"&&this.onOpen(),e.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};$i(t,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Wi(t,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=Gt()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(t,i)}};var Ji=!1;try{Ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Xi=Ji;function vs(){}var ce=class extends et{constructor(t){if(super(t),typeof location<"u"){let i=location.protocol==="https:",e=location.port;e||(e=i?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||e!==t.port}}doWrite(t,i){let e=this.request({method:"POST",data:t});e.on("success",i),e.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(i,e)=>{this.onError("xhr poll error",i,e)}),this.pollXhr=t}},Kt=(()=>{class s extends u{constructor(i,e,r){super(),this.createRequest=i,N(this,r),this._opts=r,this._method=r.method||"GET",this._uri=e,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var i;let e=qt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(e);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(i=this._opts.cookieJar)===null||i===void 0||i.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var n;r.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=s.requestsCount++,s.requests[this._index]=this)}_onError(i){this.emitReserved("error",i,this._xhr),this._cleanup(!0)}_cleanup(i){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=vs,i)try{this._xhr.abort()}catch{}typeof document<"u"&&delete s.requests[this._index],this._xhr=null}}_onLoad(){let i=this._xhr.responseText;i!==null&&(this.emitReserved("data",i),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return s.requestsCount=0,s.requests={},s})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",zi);else if(typeof addEventListener=="function"){let s="onpagehide"in _?"pagehide":"unload";addEventListener(s,zi,!1)}}function zi(){for(let s in Kt.requests)Kt.requests.hasOwnProperty(s)&&Kt.requests[s].abort()}var Ts=(function(){let s=Zi({xdomain:!1});return s&&s.responseType!==null})(),I=class extends ce{constructor(t){super(t);let i=t&&t.forceBase64;this.supportsBinary=Ts&&!i}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Kt(Zi,this.uri(),t)}};function Zi(s){let t=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Xi))return new XMLHttpRequest}catch{}if(!t)try{return new _[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var ts=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ue=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),i=this.opts.protocols,e=ts?{}:qt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(e.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,i,e)}catch(r){return this.emitReserved("error",r)}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 i=0;i<t.length;i++){let e=t[i],r=i===t.length-1;mt(e,this.supportsBinary,n=>{try{this.doWrite(e,n)}catch{}r&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=Gt()),this.supportsBinary||(i.b64=1),this.createUri(t,i)}},he=_.WebSocket||_.MozWebSocket,P=class extends ue{createSocket(t,i,e){return ts?new he(t,i,e):i?new he(t,i):new he(t)}doWrite(t,i){this.ws.send(i)}};var $=class extends F{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=>{let i=Gi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),e=t.readable.pipeThrough(i).getReader(),r=qi();r.readable.pipeTo(t.writable),this._writer=r.writable.getWriter();let n=()=>{e.read().then(({done:a,value:c})=>{a||(this.onPacket(c),n())}).catch(a=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let i=0;i<t.length;i++){let e=t[i],r=i===t.length-1;this._writer.write(e).then(()=>{r&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var le={websocket:P,webtransport:$,polling:I};var Cs=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ks=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function it(s){if(s.length>8e3)throw"URI too long";let t=s,i=s.indexOf("["),e=s.indexOf("]");i!=-1&&e!=-1&&(s=s.substring(0,i)+s.substring(i,e).replace(/:/g,";")+s.substring(e,s.length));let r=Cs.exec(s||""),n={},o=14;for(;o--;)n[ks[o]]=r[o]||"";return i!=-1&&e!=-1&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Rs(n,n.path),n.queryKey=Os(n,n.query),n}function Rs(s,t){let i=/\/{2,9}/g,e=t.replace(i,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&e.splice(0,1),t.slice(-1)=="/"&&e.splice(e.length-1,1),e}function Os(s,t){let i={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,r,n){r&&(i[r]=n)}),i}var pe=typeof addEventListener=="function"&&typeof removeEventListener=="function",jt=[];pe&&addEventListener("offline",()=>{jt.forEach(s=>s())},!1);var Qt=(()=>{class s extends u{constructor(i,e){if(super(),this.binaryType=Yi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,i&&typeof i=="object"&&(e=i,i=null),i){let r=it(i);e.hostname=r.host,e.secure=r.protocol==="https"||r.protocol==="wss",e.port=r.port,r.query&&(e.query=r.query)}else e.host&&(e.hostname=it(e.host).host);N(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(r=>{let n=r.prototype.name;this.transports.push(n),this._transportsByName[n]=r}),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},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Qi(this.opts.query)),pe&&(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"})},jt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(i){let e=Object.assign({},this.opts.query);e.EIO=ae,e.transport=i,this.id&&(e.sid=this.id);let r=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[i]);return new this._transportsByName[i](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let i=this.opts.rememberUpgrade&&s.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let e=this.createTransport(i);e.open(),this.setTransport(e)}setTransport(i){this.transport&&this.transport.removeAllListeners(),this.transport=i,i.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",s.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",i),this.emitReserved("heartbeat"),i.type){case"open":this.onHandshake(JSON.parse(i.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let e=new Error("server error");e.code=i.data,this._onError(e);break;case"message":this.emitReserved("data",i.data),this.emitReserved("message",i.data);break}}onHandshake(i){this.emitReserved("handshake",i),this.id=i.sid,this.transport.query.sid=i.sid,this._pingInterval=i.pingInterval,this._pingTimeout=i.pingTimeout,this._maxPayload=i.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let i=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+i,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},i),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){let i=this._getWritablePackets();this.transport.send(i),this._prevBufferLen=i.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let r=0;r<this.writeBuffer.length;r++){let n=this.writeBuffer[r].data;if(n&&(e+=Ki(n)),r>0&&e>this._maxPayload)return this.writeBuffer.slice(0,r);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let i=Date.now()>this._pingTimeoutTime;return i&&(this._pingTimeoutTime=0,x(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),i}write(i,e,r){return this._sendPacket("message",i,e,r),this}send(i,e,r){return this._sendPacket("message",i,e,r),this}_sendPacket(i,e,r,n){if(typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let o={type:i,data:e,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let i=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),i()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():i()}):this.upgrading?r():i()),this}_onError(i){if(s.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",i),this._onClose("transport error",i)}_onClose(i,e){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(),pe&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let r=jt.indexOf(this._offlineEventListener);r!==-1&&jt.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",i,e),this.writeBuffer=[],this._prevBufferLen=0}}}return s.protocol=ae,s})(),Jt=class extends Qt{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 i=this.createTransport(t),e=!1;Qt.priorWebsocketSuccess=!1;let r=()=>{e||(i.send([{type:"ping",data:"probe"}]),i.once("packet",B=>{if(!e)if(B.type==="pong"&&B.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;Qt.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{e||this.readyState!=="closed"&&(w(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{let ot=new Error("probe error");ot.transport=i.name,this.emitReserved("upgradeError",ot)}}))};function n(){e||(e=!0,w(),i.close(),i=null)}let o=B=>{let ot=new Error("probe error: "+B);ot.transport=i.name,n(),this.emitReserved("upgradeError",ot)};function a(){o("transport closed")}function c(){o("socket closed")}function E(B){i&&B.name!==i.name&&n()}let w=()=>{i.removeListener("open",r),i.removeListener("error",o),i.removeListener("close",a),this.off("close",c),this.off("upgrading",E)};i.once("open",r),i.once("error",o),i.once("close",a),this.once("close",c),this.once("upgrading",E),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{e||i.open()},200):i.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let i=[];for(let e=0;e<t.length;e++)~this.transports.indexOf(t[e])&&i.push(t[e]);return i}},st=class extends Jt{constructor(t,i={}){let e=typeof t=="object"?t:i;(!e.transports||e.transports&&typeof e.transports[0]=="string")&&(e.transports=(e.transports||["polling","websocket","webtransport"]).map(r=>le[r]).filter(r=>!!r)),super(t,e)}};var yt=class extends et{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(i=>this.onData(i))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,i){this._fetch(t).then(e=>{if(!e.ok)return this.onError("fetch write error",e.status,e);i()}).catch(e=>{this.onError("fetch write error",e)})}_fetch(t){var i;let e=t!==void 0,r=new Headers(this.opts.extraHeaders);return e&&r.set("content-type","text/plain;charset=UTF-8"),(i=this.socket._cookieJar)===null||i===void 0||i.appendCookies(r),fetch(this.uri(),{method:e?"POST":"GET",body:e?t:null,headers:r,credentials:this.opts.withCredentials?"include":"omit"}).then(n=>{var o;return(o=this.socket._cookieJar)===null||o===void 0||o.parseCookies(n.headers.getSetCookie()),n})}};var ln=st.protocol;function es(s,t="",i){let e=s;i=i||typeof location<"u"&&location,s==null&&(s=i.protocol+"//"+i.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=i.protocol+s:s=i.host+s),/^(https?|wss?):\/\//.test(s)||(typeof i<"u"?s=i.protocol+"//"+s:s="https://"+s),e=it(s)),e.port||(/^(http|ws)$/.test(e.protocol)?e.port="80":/^(http|ws)s$/.test(e.protocol)&&(e.port="443")),e.path=e.path||"/";let n=e.host.indexOf(":")!==-1?"["+e.host+"]":e.host;return e.id=e.protocol+"://"+n+":"+e.port+t,e.href=e.protocol+"://"+n+(i&&i.port===e.port?"":":"+e.port),e}var Ee={};Ce(Ee,{Decoder:()=>ge,Encoder:()=>me,PacketType:()=>h,protocol:()=>ye});var xs=typeof ArrayBuffer=="function",Ns=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,is=Object.prototype.toString,Fs=typeof Blob=="function"||typeof Blob<"u"&&is.call(Blob)==="[object BlobConstructor]",Is=typeof File=="function"||typeof File<"u"&&is.call(File)==="[object FileConstructor]";function St(s){return xs&&(s instanceof ArrayBuffer||Ns(s))||Fs&&s instanceof Blob||Is&&s instanceof File}function Et(s,t){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let i=0,e=s.length;i<e;i++)if(Et(s[i]))return!0;return!1}if(St(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return Et(s.toJSON(),!0);for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i)&&Et(s[i]))return!0;return!1}function ss(s){let t=[],i=s.data,e=s;return e.data=fe(i,t),e.attachments=t.length,{packet:e,buffers:t}}function fe(s,t){if(!s)return s;if(St(s)){let i={_placeholder:!0,num:t.length};return t.push(s),i}else if(Array.isArray(s)){let i=new Array(s.length);for(let e=0;e<s.length;e++)i[e]=fe(s[e],t);return i}else if(typeof s=="object"&&!(s instanceof Date)){let i={};for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(i[e]=fe(s[e],t));return i}return s}function rs(s,t){return s.data=de(s.data,t),delete s.attachments,s}function de(s,t){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<t.length)return t[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let i=0;i<s.length;i++)s[i]=de(s[i],t);else if(typeof s=="object")for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&(s[i]=de(s[i],t));return s}var Ps=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ye=5,h=(function(s){return 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",s})(h||{}),me=class{constructor(t){this.replacer=t}encode(t){return(t.type===h.EVENT||t.type===h.ACK)&&Et(t)?this.encodeAsBinary({type:t.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let i=""+t.type;return(t.type===h.BINARY_EVENT||t.type===h.BINARY_ACK)&&(i+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(i+=t.nsp+","),t.id!=null&&(i+=t.id),t.data!=null&&(i+=JSON.stringify(t.data,this.replacer)),i}encodeAsBinary(t){let i=ss(t),e=this.encodeAsString(i.packet),r=i.buffers;return r.unshift(e),r}};function ns(s){return Object.prototype.toString.call(s)==="[object Object]"}var ge=class s extends u{constructor(t){super(),this.reviver=t}add(t){let i;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(t);let e=i.type===h.BINARY_EVENT;e||i.type===h.BINARY_ACK?(i.type=e?h.EVENT:h.ACK,this.reconstructor=new _e(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(St(t)||t.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(t),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let i=0,e={type:Number(t.charAt(0))};if(h[e.type]===void 0)throw new Error("unknown packet type "+e.type);if(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK){let n=i+1;for(;t.charAt(++i)!=="-"&&i!=t.length;);let o=t.substring(n,i);if(o!=Number(o)||t.charAt(i)!=="-")throw new Error("Illegal attachments");e.attachments=Number(o)}if(t.charAt(i+1)==="/"){let n=i+1;for(;++i&&!(t.charAt(i)===","||i===t.length););e.nsp=t.substring(n,i)}else e.nsp="/";let r=t.charAt(i+1);if(r!==""&&Number(r)==r){let n=i+1;for(;++i;){let o=t.charAt(i);if(o==null||Number(o)!=o){--i;break}if(i===t.length)break}e.id=Number(t.substring(n,i+1))}if(t.charAt(++i)){let n=this.tryParse(t.substr(i));if(s.isPayloadValid(e.type,n))e.data=n;else throw new Error("invalid payload")}return e}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,i){switch(t){case h.CONNECT:return ns(i);case h.DISCONNECT:return i===void 0;case h.CONNECT_ERROR:return typeof i=="string"||ns(i);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&Ps.indexOf(i[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},_e=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let i=rs(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function b(s,t,i){return s.on(t,i),function(){s.off(t,i)}}var Bs=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),q=class extends u{constructor(t,i,e){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=i,e&&e.auth&&(this.auth=e.auth),this._opts=Object.assign({},e),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[b(t,"open",this.onopen.bind(this)),b(t,"packet",this.onpacket.bind(this)),b(t,"error",this.onerror.bind(this)),b(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,...i){var e,r,n;if(Bs.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(i.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;let o={type:h.EVENT,data:i};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){let w=this.ids++,B=i.pop();this._registerAckCallback(w,B),o.id=w}let a=(r=(e=this.io.engine)===null||e===void 0?void 0:e.transport)===null||r===void 0?void 0:r.writable,c=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,i){var e;let r=(e=this.flags.timeout)!==null&&e!==void 0?e:this._opts.ackTimeout;if(r===void 0){this.acks[t]=i;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);i.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(n),i.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...i){return new Promise((e,r)=>{let n=(o,a)=>o?r(o):e(a);n.withError=!0,i.push(n),this.emit(t,...i)})}_addToQueue(t){let i;typeof t[t.length-1]=="function"&&(i=t.pop());let e={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...n)=>e!==this._queue[0]?void 0:(r!==null?e.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(r)):(this._queue.shift(),i&&i(null,...n)),e.pending=!1,this._drainQueue())),this._queue.push(e),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let i=this._queue[0];i.pending&&!t||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.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:h.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,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){let e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case h.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 h.EVENT:case h.BINARY_EVENT:this.onevent(t);break;case h.ACK:case h.BINARY_ACK:this.onack(t);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e);break}}onevent(t){let i=t.data||[];t.id!=null&&i.push(this.ack(t.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let i=this._anyListeners.slice();for(let e of i)e.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){let i=this,e=!1;return function(...r){e||(e=!0,i.packet({type:h.ACK,id:t,data:r}))}}onack(t){let i=this.acks[t.id];typeof i=="function"&&(delete this.acks[t.id],i.withError&&t.data.unshift(null),i.apply(this,t.data))}onconnect(t,i){this.id=t,this.recovered=i&&this._pid===i,this._pid=i,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:h.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){let i=this._anyListeners;for(let e=0;e<i.length;e++)if(t===i[e])return i.splice(e,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){let i=this._anyOutgoingListeners;for(let e=0;e<i.length;e++)if(t===i[e])return i.splice(e,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let i=this._anyOutgoingListeners.slice();for(let e of i)e.apply(this,t.data)}}};function G(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}G.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),i=Math.floor(t*this.jitter*s);s=(Math.floor(t*10)&1)==0?s-i:s+i}return Math.min(s,this.max)|0};G.prototype.reset=function(){this.attempts=0};G.prototype.setMin=function(s){this.ms=s};G.prototype.setMax=function(s){this.max=s};G.prototype.setJitter=function(s){this.jitter=s};var Y=class extends u{constructor(t,i){var e;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(i=t,t=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,N(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((e=i.randomizationFactor)!==null&&e!==void 0?e:.5),this.backoff=new G({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=t;let r=i.parser||Ee;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=i.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 i;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(i=this.backoff)===null||i===void 0||i.setMin(t),this)}randomizationFactor(t){var i;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(i=this.backoff)===null||i===void 0||i.setJitter(t),this)}reconnectionDelayMax(t){var i;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(i=this.backoff)===null||i===void 0||i.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 st(this.uri,this.opts);let i=this.engine,e=this;this._readyState="opening",this.skipReconnect=!1;let r=b(i,"open",function(){e.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=b(i,"error",n);if(this._timeout!==!1){let a=this._timeout,c=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),i.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(b(t,"ping",this.onping.bind(this)),b(t,"data",this.ondata.bind(this)),b(t,"error",this.onerror.bind(this)),b(t,"close",this.onclose.bind(this)),b(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(i){this.onclose("parse error",i)}}ondecoded(t){x(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,i){let e=this.nsps[t];return e?this._autoConnect&&!e.active&&e.connect():(e=new q(this,t,i),this.nsps[t]=e),e}_destroy(t){let i=Object.keys(this.nsps);for(let e of i)if(this.nsps[e].active)return;this._close()}_packet(t){let i=this.encoder.encode(t);for(let e=0;e<i.length;e++)this.engine.write(i[e],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,i){var e;this.cleanup(),(e=this.engine)===null||e===void 0||e.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let i=this.backoff.duration();this._reconnecting=!0;let e=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},i);this.opts.autoUnref&&e.unref(),this.subs.push(()=>{this.clearTimeoutFn(e)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var bt={};function K(s,t){typeof s=="object"&&(t=s,s=void 0),t=t||{};let i=es(s,t.path||"/socket.io"),e=i.source,r=i.id,n=i.path,o=bt[r]&&n in bt[r].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,c;return a?c=new Y(e,t):(bt[r]||(bt[r]=new Y(e,t)),c=bt[r]),i.query&&!t.query&&(t.query=i.queryKey),c.socket(i.path,t)}Object.assign(K,{Manager:Y,Socket:q,io:K,connect:K});var rt=class s{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,i){this.config=t,this.appRef=i,t===void 0&&(t=this.emptyConfig);let e=t.url,r=t.options,n=K?K:Se;this.ioSocket=n(e,r)}get auth(){return this.ioSocket.auth}set auth(t){this.ioSocket.auth=t}get io(){return this.ioSocket.io}get open(){return this.connect}get close(){return this.disconnect}of(t){if(!t||t==="/")return this;let i=this.namespaces[t];if(i)return i;let a=this.config,{url:e}=a,r=Te(a,["url"]),n=U({url:!e.endsWith("/")&&!t.startsWith("/")?`${e}/${t}`:`${e}${t}`},r),o=new s(n,this.appRef);return this.namespaces[t]=o,o}on(t,i){return this.ioSocket.on(t,i),this}once(t,i){return this.ioSocket.once(t,i),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...i){return this.ioSocket.emit(t,...i),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...i){return this.ioSocket.emitWithAck(t,...i)}removeListener(t,i){return this.ioSocket.removeListener(t,i),this}removeAllListeners(t){return this.ioSocket.removeAllListeners(t),this}fromEvent(t){return this.subscribersCounter[t]||(this.subscribersCounter[t]=0),this.subscribersCounter[t]++,this.eventObservables$[t]||(this.eventObservables$[t]=new Re(i=>{let e=r=>{i.next(r),this.appRef.tick()};return this.ioSocket.on(t,e),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,e),delete this.eventObservables$[t])}}).pipe(Ne())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(i=>this.once(t,i))}listeners(t){return this.ioSocket.listeners(t)}hasListeners(t){return this.ioSocket.hasListeners(t)}listenersAny(){return this.ioSocket.listenersAny()}listenersAnyOutgoing(){return this.ioSocket.listenersAnyOutgoing()}off(t,i){return this.ioSocket.off(t,i),this}offAny(t){return this.ioSocket.offAny(t),this}offAnyOutgoing(t){return this.ioSocket.offAnyOutgoing(t),this}onAny(t){return this.ioSocket.onAny(t),this}onAnyOutgoing(t){return this.ioSocket.onAnyOutgoing(t),this}prependAny(t){return this.ioSocket.prependAny(t),this}prependAnyOutgoing(t){return this.ioSocket.prependAnyOutgoing(t),this}timeout(t){return this.ioSocket.timeout(t),this}get volatile(){let t=this.ioSocket.volatile;return this}get active(){return this.ioSocket.active}get connected(){return this.ioSocket.connected}get disconnected(){return this.ioSocket.disconnected}get recovered(){return this.ioSocket.recovered}get id(){return this.ioSocket.id}compress(t){return this.ioSocket.compress(t),this}};function Ds(s,t){return new rt(s,t)}var os=new Fe("__SOCKET_IO_CONFIG__"),eo=(()=>{class s{static forRoot(i){return{ngModule:s,providers:[{provide:os,useValue:i},{provide:rt,useFactory:Ds,deps:[os,De]}]}}static \u0275fac=function(e){return new(e||s)};static \u0275mod=kt({type:s});static \u0275inj=vt({})}return s})();var be={BASE:`${li}/notifications`,UNREAD:"unread"},Xt=be.BASE;var d=(function(s){return s.ADD="add",s.UPDATE="update",s.DELETE="delete",s.DELETE_PERMANENTLY="deletePermanently",s})(d||{});var v=(function(s){return s.COMMENTS="comments",s.SPACES="spaces",s.SPACE_ROOTS="spaces_roots",s.SHARES="shares",s.LINKS="links",s.SYNC="sync",s.AUTH_LOCKED="auth_locked",s.AUTH_2FA="auth_2fa",s})(v||{}),co={COMMENTS:"commented",SPACES:{[d.ADD]:"You now have access to the space",[d.DELETE]:"You no longer have access to the space",[d.DELETE_PERMANENTLY]:"This space has been permanently deleted"},SPACE_ROOTS:{[d.ADD]:"anchored",[d.DELETE]:"unanchored"},SHARES:{[d.ADD]:"shared with you",[d.DELETE]:"no longer share with you"},SHARES_WITHOUT_OWNER:{[d.ADD]:"You now have access to the share",[d.DELETE]:"You no longer have access to the share",[d.DELETE_PERMANENTLY]:"You are no longer a member of the parent share, your child share has been deleted"},LINKS:{[d.ADD]:"shared with you",[d.UPDATE]:"You now have access to the space"},SYNC:{[d.DELETE]:"You are no longer synchronizing"},AUTH_2FA:{[d.ADD]:"Two-factor authentication (2FA) on your account has been enabled",[d.DELETE]:"Two-factor authentication (2FA) on your account has been disabled"},AUTH_LOCKED:{[d.DELETE]:"Your account has been locked after several unsuccessful authentication attempts"}};var as=ni;var cs={[v.COMMENTS]:as,[v.SPACES]:lt.SPACES,[v.SPACE_ROOTS]:lt.SPACES,[v.SHARES]:lt.SHARES,[v.LINKS]:lt.LINKS,[v.SYNC]:Ai.SYNC};var zt=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=Z(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Information",avatarUrl:null},this.appIcon=cs[this.content.app],this.setMainElement()}setMainElement(){if(this.content.app===v.COMMENTS||this.content.app===v.SHARES||this.content.app===v.SYNC)return;let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}};var hs=(()=>{let t=class t{constructor(){this.http=p(Ft),this.store=p(Ht),this.layout=p(tt)}getNotifications(e=!1){return this.http.get(`${Xt}${e?`/${be.UNREAD}`:""}`).pipe(S(r=>r.map(n=>new zt(n))))}wasReadNotification(e){return this.http.patch(`${Xt}/${e}`,null)}deleteNotification(e){return this.http.delete(`${Xt}${e?`/${e}`:""}`)}checkUnreadNotifications(e=!1){this.getNotifications().subscribe(r=>{let n;if(e&&r.length){let o=r[0];n=this.layout.sendNotification("warning",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=r.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("warning","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(xe(1)).subscribe(()=>this.layout.showRSideBarTab(Si.NOTIFICATIONS,!0)),this.store.notifications.set(r)})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275prov=At({token:t,factory:t.\u0275fac,providedIn:"root"});let s=t;return s})();var y=(function(s){return s.ACCESS="access",s.ACCESS_2FA="access_2fa",s.REFRESH="refresh",s.WS="ws",s.CSRF="csrf",s.CSRF_2FA="csrf_2fa",s})(y||{});var Do="sync-in-csrf";var we=6;var us="sync-in-two-fa-code",ls="sync-in-two-fa-password",Lo={[y.ACCESS]:"/",[y.REFRESH]:ki,[y.WS]:Ri,[y.CSRF]:"/",[y.ACCESS_2FA]:xi,[y.CSRF_2FA]:"/"},Uo=[y.REFRESH,y.ACCESS,y.WS,y.CSRF],Mo=[y.ACCESS_2FA,y.CSRF_2FA];var Us=["Password"];function Ms(s,t){s&1&&(f(0,"label",1),T(1,"Password"),g())}function Vs(s,t){if(s&1){let i=ct();f(0,"div",5),A("click",function(){M(i);let r=D();return V(r.randomPassword())}),f(1,"span"),X(2,"fa-icon",6),g()()}if(s&2){let i=D();m(2),k("icon",i.icons.faDice)}}var ps=(()=>{let t=class t{constructor(){this.passwordChange=new Pe,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Lt),this.toggleVisiblePassword=wi,this.icons={faEye:ri,faEyeSlash:ai,faDice:ci}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(yi(this.passwordMinLength+2))}};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=Ct({type:t,selectors:[["app-input-password"]],viewQuery:function(r,n){if(r&1&&Ue(Us,7),r&2){let o;Ot(o=xt())&&(n.passwordElement=o.first)}},inputs:{password:"password",passwordMinLength:"passwordMinLength",placeholder:"placeholder",showGenerator:"showGenerator",showLabel:"showLabel",disabled:"disabled",isRequired:"isRequired",focus:"focus",centered:"centered"},outputs:{passwordChange:"passwordChange"},decls:9,vars:16,consts:[["Password",""],["for","password","l10nTranslate",""],["id","password",1,"input-group","input-group-sm",2,"min-width","150px"],["autocomplete","off","type","password",1,"form-control","form-control-sm","pe-0",3,"ngModelChange","keyup","ngModel","disabled","placeholder","required"],[1,"input-group-text","cursor-pointer"],[1,"input-group-text","cursor-pointer",3,"click"],[3,"icon"]],template:function(r,n){if(r&1){let o=ct();R(0,Ms,2,0,"label",1),f(1,"div",2)(2,"input",3,0),qe(4,"translate"),$e("ngModelChange",function(c){return M(o),We(n.password,c)||(n.password=c),V(c)}),A("keyup",function(){return M(o),V(n.passwordChange.emit(n.password))}),g(),R(5,Vs,3,1,"div",4),f(6,"div",5),A("click",function(){M(o);let c=te(3);return V(n.toggleVisiblePassword(c))}),f(7,"span"),X(8,"fa-icon",6),g()()()}if(r&2){let o=te(3);O(n.showLabel?0:-1),m(2),Me("padding-left",n.centered?"2rem":""),H("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),He("ngModel",n.password),k("disabled",n.disabled)("placeholder",Ge(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),O(n.showGenerator?5:-1),m(3),k("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[ei,Pt,Bt,ze,je,Dt,Vt,Ut,ii],encapsulation:2});let s=t;return s})();var fs=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Tt)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=J({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let s=t;return s})();function Hs(s,t){s&1&&(f(0,"span",3),T(1,"Two-Factor Authentication"),g())}function Ws(s,t){s&1&&(f(0,"span",3),T(1,"Password Authentication"),g())}function $s(s,t){if(s&1&&T(0),s&2){let i=D();Ve(" ",i.hasError," ")}}function qs(s,t){s&1&&T(0," Enter your password ")}function Gs(s,t){s&1&&T(0," Valid with your TOTP code ")}function Ys(s,t){if(s&1){let i=ct();f(0,"div",9)(1,"app-input-password",13),A("passwordChange",function(r){M(i);let n=D();return V(n.updatePassword(r))}),g()()}if(s&2){let i=D();m(),k("password",i.twoFaForm.value.password)("focus",!0)("centered",!0)}}function Ks(s,t){s&1&&(f(0,"div",14),T(1,"Valid with your TOTP code"),g())}function js(s,t){if(s&1&&(R(0,Ks,2,0,"div",14),f(1,"div",15),X(2,"input",16),g()),s&2){let i=D();O(i.withPassword?0:-1),m(2),k("autoFocus",!i.withPassword)("autoSelect",!i.withPassword)("maxlength",i.twoFaCodelength)}}var ds=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:si,faLock:oi},this.twoFaCodelength=we,this.locale=p(Lt),this.fb=p(ti),this.layout=p(tt)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[ht.required,ht.pattern(new RegExp(`^\\d{${we}}$`))]:null),password:this.fb.control("",this.withPassword?[ht.required,ht.minLength(8)]:null)})}onClose(e=!1){this.isValid(e),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let e=new Ye(U(U({},this.withTwoFaEnabled?{[us]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[ls]:this.twoFaForm.value.password}:{}));this.onClose(e)}updatePassword(e){this.twoFaForm.patchValue({password:e})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=Ct({type:t,selectors:[["app-user-auth-2fa-verify-dialog"]],inputs:{withPassword:"withPassword",withTwoFaEnabled:"withTwoFaEnabled"},decls:20,vars:9,consts:[[1,"modal-header","align-items-center","justify-content-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"modal-body","modal-auth-verify-2fa"],[1,"card","shadow-sm"],[1,"card-body"],["l10nTranslate","",1,"d-flex","justify-content-center","align-items-center","mb-3"],[3,"ngSubmit","formGroup"],[1,"mb-4"],[1,"d-grid","gap-2"],["type","submit","l10nTranslate","",1,"btn","btn-primary",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["id","password","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",3,"passwordChange","password","focus","centered"],["l10nTranslate","",1,"text-align-center","mb-3"],[1,"mb-3"],["appAutofocus","","type","text","formControlName","totpCode","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022","inputmode","numeric","autocomplete","one-time-code","name","totp",1,"form-control","text-center","fs-4",3,"autoFocus","autoSelect","maxlength"]],template:function(r,n){r&1&&(f(0,"div",0)(1,"h4",1),X(2,"fa-icon",2),R(3,Hs,2,0,"span",3)(4,Ws,2,0,"span",3),g()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),R(9,$s,1,1)(10,qs,1,0)(11,Gs,1,0),g(),f(12,"form",8),A("ngSubmit",function(){return n.onSubmit()}),R(13,Ys,2,3,"div",9),R(14,js,3,4),f(15,"div",10)(16,"button",11),T(17,"Confirm"),g(),f(18,"button",12),A("click",function(){return n.onClose()}),T(19,"Cancel"),g()()()()()()),r&2&&(m(2),k("icon",n.icons.faLock),m(),O(n.withTwoFaEnabled?3:4),m(5),H("text-danger",n.hasError),m(),O(n.hasError?9:n.withPassword?10:11),m(3),k("formGroup",n.twoFaForm),m(),O(n.withPassword?13:-1),m(),O(n.withTwoFaEnabled?14:-1),m(2),k("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Vt,Ut,fs,Dt,Qe,Pt,Bt,Ke,Ze,Je,Xe,ps],encapsulation:2});let s=t;return s})();var Zt=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(i=>new L(i))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=Z(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=ui(this.currentAccess).fromNow(!0),this.newly=bi(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(i=>new L(i)))}};var wt=class{constructor(t){this.setOnlineStatus(Ei("status",t)),this.avatarUrl=Z(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=hi[t]}};var Ja=(()=>{let t=class t{constructor(){this.http=p(Ft),this.layout=p(tt),this.store=p(Ht),this.webSocket=p(rt),this.notifications=p(hs),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(Ci.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(pt.EVENTS.ONLINE_USER).pipe(S(e=>new wt(e))).subscribe(e=>this.newOnlineUser(e)),this.webSocket.fromEvent(pt.EVENTS.ONLINE_USERS).pipe(S(e=>e.map(r=>new wt(r)))).subscribe(e=>this.setOnlineUsers(e)),this.webSocket.fromEvent(pt.EVENTS.ONLINE_STATUS).subscribe(e=>this.receiveOnlineStatus(e))}get user(){return this.store.user.getValue()}initUser(e,r=!1){this.refreshAvatar(),this.layout.setLanguage(e.language).catch(console.error),this.store.userImpersonate.set(r||e.impersonated),this.store.user.next(e),this.checkQuota(this.store.user.getValue()),r&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(e){this.store.onlineUsers.set(e)}newOnlineUser(e){this.store.onlineUsers().find(r=>r.id===e.id)?this.receiveOnlineStatus({userId:e.id,status:e.onlineStatus}):this.store.onlineUsers.update(r=>[e,...r])}userHavePermission(e){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(e)!==-1:!1}browseGroup(e){return this.http.get(`${gi}${e?`/${e}`:""}`).pipe(S(r=>new Zt(r)))}createPersonalGroup(e){return this.http.post(W,e).pipe(S(r=>new L(r)))}updatePersonalGroup(e,r){return this.http.put(`${W}/${e}`,r).pipe(S(n=>new L(n)))}leavePersonalGroup(e){return this.http.delete(`${_i}/${e}`)}addUsersToGroup(e,r){return this.http.patch(`${W}/${e}/${ut.USERS}`,r)}deletePersonalGroup(e){return this.http.delete(`${W}/${e}`)}updateUserFromPersonalGroup(e,r,n){return this.http.patch(`${W}/${e}/${ut.USERS}/${r}`,n)}removeUserFromGroup(e,r){return this.http.delete(`${W}/${e}/${ut.USERS}/${r}`)}listGuests(){return this.http.get(z).pipe(S(e=>e.map(r=>new j(r))))}getGuest(e){return this.http.get(`${z}/${e}`).pipe(S(r=>new j(r)))}createGuest(e){return this.http.post(z,e).pipe(S(r=>new j(r)))}updateGuest(e,r){return this.http.put(`${z}/${e}`,r).pipe(S(n=>n?new j(n):null))}deleteGuest(e){return this.http.delete(`${z}/${e}`)}genAvatar(){this.http.patch(se,null).subscribe({next:()=>this.refreshAvatar(),error:e=>this.layout.sendNotification("error","Configuration","Avatar",e)})}uploadAvatar(e){let r=new FormData;r.append("file",e),this.http.put(se,r).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(e,r){return this.http.put(fi,e,{headers:r})}changeLanguage(e){return this.http.put(pi,e)}changeNotification(e){return this.http.put(di,e)}changeStorageIndexing(e){return this.http.put(mi,e)}changeOnlineStatus(e,r=!0){this.webSocket.emit(pt.EVENTS.ONLINE_STATUS,{status:e,store:r})}receiveOnlineStatus(e){this.user.id===e.userId?this.user.onlineStatus=e.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(r=>r.map(n=>n.id===e.userId?ve(U({},n),{onlineStatus:e.status}):n))}searchMembers(e,r=[]){return this.http.request("search",ut.BASE,{body:e}).pipe(S(n=>n.map(o=>new L(o,r))),Oe(()=>[]))}setMenusVisibility(e){for(let r of e)if(!(r.id&&(r.hide=!this.userHavePermission(r.id),r.hide))&&(r.checks?.length&&(r.hide=!r.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),r.submenus?.length&&this.setMenusVisibility(r.submenus),r.title===Ti.FILES)){for(let n of r.submenus)if(!n.hide){r.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(vi())}checkAppStoreAvailability(){this.http.get(`${ie.BASE}/${ie.APP_STORE}`).subscribe({next:e=>this.store.appStoreManifest.set(e),error:e=>console.error(e)})}listAppPasswords(e){return this.http.get(Mt,{headers:e})}generateAppPassword(e,r){return this.http.post(Mt,e,{headers:r})}deleteAppPassword(e){return this.http.delete(`${Mt}/${e}`)}init2Fa(){return this.http.get(re)}enable2Fa(e){return this.http.post(re,e)}disable2Fa(e){return this.http.post(Oi,e)}adminResetUser2Fa(e,r){return this.http.post(`${Ni}/${e}`,null,{headers:r})}auth2FaVerifyDialog(e=!1){return ke(this,null,function*(){let r=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(e||r)return new Promise(n=>{let o=this.layout.openDialog(ds,"xs",{initialState:{withPassword:e,withTwoFaEnabled:r}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(e){if(!(e.isGuest||e.isLink)&&e.storageQuota){let r=Math.round(100/e.storageQuota*(e.storageQuota-e.storageUsage));r<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):r<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:r}),null,{disableTimeOut:!0,closeButton:!0}):r<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:r}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(r){return new(r||t)},t.\u0275prov=At({token:t,factory:t.\u0275fac,providedIn:"root"});let s=t;return s})();var Qs={provide:It,useExisting:at(()=>Js),multi:!0},Js=(()=>{let t=class t{constructor(){this.btnCheckboxTrue=!0,this.btnCheckboxFalse=!1,this.state=!1,this.isDisabled=!1,this.onChange=Function.prototype,this.onTouched=Function.prototype}onClick(){this.isDisabled||(this.toggle(!this.state),this.onChange(this.value))}ngOnInit(){this.toggle(this.trueValue===this.value)}get trueValue(){return typeof this.btnCheckboxTrue<"u"?this.btnCheckboxTrue:!0}get falseValue(){return typeof this.btnCheckboxFalse<"u"?this.btnCheckboxFalse:!1}toggle(e){this.state=e,this.value=this.state?this.trueValue:this.falseValue}writeValue(e){this.state=this.trueValue===e,this.value=e?this.trueValue:this.falseValue}setDisabledState(e){this.isDisabled=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=J({type:t,selectors:[["","btnCheckbox",""]],hostVars:3,hostBindings:function(r,n){r&1&&A("click",function(){return n.onClick()}),r&2&&(Rt("aria-pressed",n.state),H("active",n.state))},inputs:{btnCheckboxTrue:"btnCheckboxTrue",btnCheckboxFalse:"btnCheckboxFalse"},features:[Nt([Qs])]});let s=t;return s})(),Xs={provide:It,useExisting:at(()=>ms),multi:!0},ms=(()=>{let t=class t{get value(){return this.group?this.group.value:this._value}set value(e){if(this.group){this.group.value=e;return}this._value=e,this._onChange(e)}get disabled(){return this._disabled}set disabled(e){this.setDisabledState(e)}get controlOrGroupDisabled(){return this.disabled||this.group&&this.group.disabled?!0:void 0}get hasDisabledClass(){return this.controlOrGroupDisabled&&!this.isActive}get isActive(){return this.btnRadio===this.value}get tabindex(){if(!this.controlOrGroupDisabled)return this.isActive||this.group==null?0:-1}get hasFocus(){return this._hasFocus}constructor(e,r,n,o){this.el=e,this.cdr=r,this.renderer=n,this.group=o,this.onChange=Function.prototype,this.onTouched=Function.prototype,this.uncheckable=!1,this.role="radio",this._disabled=!1,this._hasFocus=!1}toggleIfAllowed(){this.canToggle()&&(this.uncheckable&&this.btnRadio===this.value?this.value=void 0:this.value=this.btnRadio)}onSpacePressed(e){this.toggleIfAllowed(),e.preventDefault()}focus(){this.el.nativeElement.focus()}onFocus(){this._hasFocus=!0}onBlur(){this._hasFocus=!1,this.onTouched()}canToggle(){return!this.controlOrGroupDisabled&&(this.uncheckable||this.btnRadio!==this.value)}ngOnChanges(e){"uncheckable"in e&&(this.uncheckable=this.uncheckable!==!1&&typeof this.uncheckable<"u")}_onChange(e){if(this.group){this.group.value=e;return}this.onTouched(),this.onChange(e)}writeValue(e){this.value=e,this.cdr.markForCheck()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){if(this._disabled=e,e){this.renderer.setAttribute(this.el.nativeElement,"disabled","disabled");return}this.renderer.removeAttribute(this.el.nativeElement,"disabled")}};t.\u0275fac=function(r){return new(r||t)(Q(Tt),Q(ee),Q(Be),Q(at(()=>gs),8))},t.\u0275dir=J({type:t,selectors:[["","btnRadio",""]],hostVars:8,hostBindings:function(r,n){r&1&&A("click",function(){return n.toggleIfAllowed()})("keydown.space",function(a){return n.onSpacePressed(a)})("focus",function(){return n.onFocus()})("blur",function(){return n.onBlur()}),r&2&&(Rt("aria-disabled",n.controlOrGroupDisabled)("aria-checked",n.isActive)("role",n.role)("tabindex",n.tabindex),H("disabled",n.hasDisabledClass)("active",n.isActive))},inputs:{btnRadio:"btnRadio",uncheckable:"uncheckable",value:"value",disabled:"disabled"},features:[Nt([Xs]),Ie]});let s=t;return s})(),zs={provide:It,useExisting:at(()=>gs),multi:!0},gs=(()=>{let t=class t{constructor(e){this.cdr=e,this.onChange=Function.prototype,this.onTouched=Function.prototype,this.role="radiogroup",this._disabled=!1}get value(){return this._value}set value(e){this._value=e,this.onChange(e)}get disabled(){return this._disabled}get tabindex(){return this._disabled?null:0}writeValue(e){this._value=e,this.cdr.markForCheck()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.radioButtons&&(this._disabled=e,this.radioButtons.forEach(r=>{r.setDisabledState(e)}),this.cdr.markForCheck())}onFocus(){if(this._disabled)return;let e=this.getActiveOrFocusedRadio();if(e){e.focus();return}if(this.radioButtons){let r=this.radioButtons.find(n=>!n.disabled);r&&r.focus()}}onBlur(){this.onTouched&&this.onTouched()}selectNext(e){this.selectInDirection("next"),e.preventDefault()}selectPrevious(e){this.selectInDirection("previous"),e.preventDefault()}selectInDirection(e){if(this._disabled)return;function r(o,a){let E=(o+(e==="next"?1:-1))%a.length;return E<0&&(E=a.length-1),E}let n=this.getActiveOrFocusedRadio();if(n&&this.radioButtons){let o=this.radioButtons.toArray(),a=o.indexOf(n);for(let c=r(a,o);c!==a;c=r(c,o))if(o[c].canToggle()){o[c].toggleIfAllowed(),o[c].focus();break}}}getActiveOrFocusedRadio(){if(this.radioButtons)return this.radioButtons.find(e=>e.isActive)||this.radioButtons.find(e=>e.hasFocus)}};t.\u0275fac=function(r){return new(r||t)(Q(ee))},t.\u0275dir=J({type:t,selectors:[["","btnRadioGroup",""]],contentQueries:function(r,n,o){if(r&1&&Le(o,ms,4),r&2){let a;Ot(a=xt())&&(n.radioButtons=a)}},hostVars:2,hostBindings:function(r,n){r&1&&A("focus",function(){return n.onFocus()})("blur",function(){return n.onBlur()})("keydown.ArrowRight",function(a){return n.selectNext(a)})("keydown.ArrowDown",function(a){return n.selectNext(a)})("keydown.ArrowLeft",function(a){return n.selectPrevious(a)})("keydown.ArrowUp",function(a){return n.selectPrevious(a)}),r&2&&Rt("role",n.role)("tabindex",n.tabindex)},features:[Nt([zs])]});let s=t;return s})(),hc=(()=>{let t=class t{static forRoot(){return{ngModule:t,providers:[]}}};t.\u0275fac=function(r){return new(r||t)},t.\u0275mod=kt({type:t}),t.\u0275inj=vt({});let s=t;return s})();export{er as a,ir as b,ki as c,xi as d,Do as e,we as f,us as g,ls as h,eo as i,v as j,hs as k,ps as l,fs as m,Zt as n,j as o,Ja as p,Js as q,hc as r};
|
|
1
|
+
import{Ga as yi,H as hi,Ha as Ei,Ib as Ti,Jb as lt,Ma as Si,Sa as bi,Sb as L,Ta as wi,W as li,X as ie,_ as ut,aa as pi,ba as fi,ca as Mt,da as di,ea as mi,fa as se,ga as W,ha as gi,hb as Ai,ia as _i,ja as z,kb as Z,lb as vi,mb as Ht,yb as tt}from"./chunk-XDZGW64M.js";import{$a as Ct,$c as Pt,Ab as ct,Db as A,Dd as ii,Ed as Ut,Fb as D,G as Oe,Ib as Le,Jb as Ue,Kb as Ot,L as xe,Lb as xt,Mb as te,Mf as ai,Na as m,Nb as Me,Ob as H,Pa as Pe,Pc as Ye,Qb as T,Sb as Ve,Sc as Ft,Ub as He,Va as Be,Vb as We,W as Ne,Wa as Q,Wb as $e,Zc as It,_b as Nt,ab as kt,ae as si,bb as J,bd as ht,be as ri,c as Re,ca as at,cg as ci,da as At,dd as Bt,ea as vt,ec as qe,ed as Ke,eg as Vt,ga as Fe,gc as Ge,ia as p,ib as De,id as je,jb as Rt,jd as Qe,kb as R,lb as O,md as Je,na as M,nd as Xe,oa as V,of as ni,qb as k,rb as f,sb as g,sd as ze,tb as X,tc as ee,td as Ze,uf as oi,v as S,vd as ti,wa as Ie,wd as ei,xd as Dt,yd as Lt,za as Tt}from"./chunk-DIT6W7VM.js";import{n as ui}from"./chunk-DM4NXKEP.js";import{a as U,b as ve,d as Te,f as Ce,j as ke}from"./chunk-N3U6637P.js";var Ci={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var pt={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(s){return s.BASE="/api/auth",s.LOGIN="login",s.LOGOUT="logout",s.REFRESH="refresh",s.TOKEN="token",s.TOKEN_REFRESH="token/refresh",s.WS="socket.io",s.TWO_FA_BASE="2fa",s.TWO_FA_ENABLE="enable",s.TWO_FA_DISABLE="disable",s.TWO_FA_LOGIN_VERIFY="login/verify",s.TWO_FA_ADMIN_RESET_USER="reset/user",s})(l||{}),er=`${l.BASE}/${l.LOGIN}`,ir=`${l.BASE}/${l.LOGOUT}`,ki=`${l.BASE}/${l.REFRESH}`,sr=`${l.BASE}/${l.TOKEN}`,rr=`${l.BASE}/${l.TOKEN_REFRESH}`,Ri=`/${l.WS}`,re=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,Oi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,Ni=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var Se={};Ce(Se,{Fetch:()=>yt,Manager:()=>Y,NodeWebSocket:()=>P,NodeXHR:()=>I,Socket:()=>q,WebSocket:()=>P,WebTransport:()=>$,XHR:()=>I,connect:()=>K,default:()=>K,io:()=>K,protocol:()=>ye});var C=Object.create(null);C.open="0";C.close="1";C.ping="2";C.pong="3";C.message="4";C.upgrade="5";C.noop="6";var ft=Object.create(null);Object.keys(C).forEach(s=>{ft[C[s]]=s});var dt={type:"error",data:"parser error"};var Pi=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Bi=typeof ArrayBuffer=="function",Di=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,mt=({type:s,data:t},i,e)=>Pi&&t instanceof Blob?i?e(t):Fi(t,e):Bi&&(t instanceof ArrayBuffer||Di(t))?i?e(t):Fi(new Blob([t]),e):e(C[s]+(t||"")),Fi=(s,t)=>{let i=new FileReader;return i.onload=function(){let e=i.result.split(",")[1];t("b"+(e||""))},i.readAsDataURL(s)};function Ii(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}var ne;function Li(s,t){if(Pi&&s.data instanceof Blob)return s.data.arrayBuffer().then(Ii).then(t);if(Bi&&(s.data instanceof ArrayBuffer||Di(s.data)))return t(Ii(s.data));mt(s,!1,i=>{ne||(ne=new TextEncoder),t(ne.encode(i))})}var Ui="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<Ui.length;s++)gt[Ui.charCodeAt(s)]=s;var Mi=s=>{let t=s.length*.75,i=s.length,e,r=0,n,o,a,c;s[s.length-1]==="="&&(t--,s[s.length-2]==="="&&t--);let E=new ArrayBuffer(t),w=new Uint8Array(E);for(e=0;e<i;e+=4)n=gt[s.charCodeAt(e)],o=gt[s.charCodeAt(e+1)],a=gt[s.charCodeAt(e+2)],c=gt[s.charCodeAt(e+3)],w[r++]=n<<2|o>>4,w[r++]=(o&15)<<4|a>>2,w[r++]=(a&3)<<6|c&63;return E};var _s=typeof ArrayBuffer=="function",_t=(s,t)=>{if(typeof s!="string")return{type:"message",data:Vi(s,t)};let i=s.charAt(0);return i==="b"?{type:"message",data:ys(s.substring(1),t)}:ft[i]?s.length>1?{type:ft[i],data:s.substring(1)}:{type:ft[i]}:dt},ys=(s,t)=>{if(_s){let i=Mi(s);return Vi(i,t)}else return{base64:!0,data:s}},Vi=(s,t)=>{switch(t){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}};var Hi="",Wi=(s,t)=>{let i=s.length,e=new Array(i),r=0;s.forEach((n,o)=>{mt(n,!1,a=>{e[o]=a,++r===i&&t(e.join(Hi))})})},$i=(s,t)=>{let i=s.split(Hi),e=[];for(let r=0;r<i.length;r++){let n=_t(i[r],t);if(e.push(n),n.type==="error")break}return e};function qi(){return new TransformStream({transform(s,t){Li(s,i=>{let e=i.length,r;if(e<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,e);else if(e<65536){r=new Uint8Array(3);let n=new DataView(r.buffer);n.setUint8(0,126),n.setUint16(1,e)}else{r=new Uint8Array(9);let n=new DataView(r.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(e))}s.data&&typeof s.data!="string"&&(r[0]|=128),t.enqueue(r),t.enqueue(i)})}})}var oe;function Wt(s){return s.reduce((t,i)=>t+i.length,0)}function $t(s,t){if(s[0].length===t)return s.shift();let i=new Uint8Array(t),e=0;for(let r=0;r<t;r++)i[r]=s[0][e++],e===s[0].length&&(s.shift(),e=0);return s.length&&e<s[0].length&&(s[0]=s[0].slice(e)),i}function Gi(s,t){oe||(oe=new TextDecoder);let i=[],e=0,r=-1,n=!1;return new TransformStream({transform(o,a){for(i.push(o);;){if(e===0){if(Wt(i)<1)break;let c=$t(i,1);n=(c[0]&128)===128,r=c[0]&127,r<126?e=3:r===126?e=1:e=2}else if(e===1){if(Wt(i)<2)break;let c=$t(i,2);r=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),e=3}else if(e===2){if(Wt(i)<8)break;let c=$t(i,8),E=new DataView(c.buffer,c.byteOffset,c.length),w=E.getUint32(0);if(w>Math.pow(2,21)-1){a.enqueue(dt);break}r=w*Math.pow(2,32)+E.getUint32(4),e=3}else{if(Wt(i)<r)break;let c=$t(i,r);a.enqueue(_t(n?c:oe.decode(c),t)),e=0}if(r===0||r>s){a.enqueue(dt);break}}}})}var ae=4;function u(s){if(s)return Es(s)}function Es(s){for(var t in u.prototype)s[t]=u.prototype[t];return s}u.prototype.on=u.prototype.addEventListener=function(s,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(t),this};u.prototype.once=function(s,t){function i(){this.off(s,i),t.apply(this,arguments)}return i.fn=t,this.on(s,i),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(s,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+s];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var e,r=0;r<i.length;r++)if(e=i[r],e===t||e.fn===t){i.splice(r,1);break}return i.length===0&&delete this._callbacks["$"+s],this};u.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),i=this._callbacks["$"+s],e=1;e<arguments.length;e++)t[e-1]=arguments[e];if(i){i=i.slice(0);for(var e=0,r=i.length;e<r;++e)i[e].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};u.prototype.hasListeners=function(s){return!!this.listeners(s).length};var x=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,i)=>i(t,0),_=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Yi="arraybuffer";function qt(s,...t){return t.reduce((i,e)=>(s.hasOwnProperty(e)&&(i[e]=s[e]),i),{})}var Ss=_.setTimeout,bs=_.clearTimeout;function N(s,t){t.useNativeTimers?(s.setTimeoutFn=Ss.bind(_),s.clearTimeoutFn=bs.bind(_)):(s.setTimeoutFn=_.setTimeout.bind(_),s.clearTimeoutFn=_.clearTimeout.bind(_))}var ws=1.33;function Ki(s){return typeof s=="string"?As(s):Math.ceil((s.byteLength||s.size)*ws)}function As(s){let t=0,i=0;for(let e=0,r=s.length;e<r;e++)t=s.charCodeAt(e),t<128?i+=1:t<2048?i+=2:t<55296||t>=57344?i+=3:(e++,i+=4);return i}function Gt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function ji(s){let t="";for(let i in s)s.hasOwnProperty(i)&&(t.length&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(s[i]));return t}function Qi(s){let t={},i=s.split("&");for(let e=0,r=i.length;e<r;e++){let n=i[e].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Yt=class extends Error{constructor(t,i,e){super(t),this.description=i,this.context=e,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,N(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,i,e){return super.emitReserved("error",new Yt(t,i,e)),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){let i=_t(t,this.socket.binaryType);this.onPacket(i)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,i={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){let 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){let i=ji(t);return i.length?"?"+i:""}};var et=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let i=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||i()})),this.writable||(e++,this.once("drain",function(){--e||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let i=e=>{if(this.readyState==="opening"&&e.type==="open"&&this.onOpen(),e.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};$i(t,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Wi(t,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=Gt()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(t,i)}};var Ji=!1;try{Ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Xi=Ji;function vs(){}var ce=class extends et{constructor(t){if(super(t),typeof location<"u"){let i=location.protocol==="https:",e=location.port;e||(e=i?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||e!==t.port}}doWrite(t,i){let e=this.request({method:"POST",data:t});e.on("success",i),e.on("error",(r,n)=>{this.onError("xhr post error",r,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(i,e)=>{this.onError("xhr poll error",i,e)}),this.pollXhr=t}},Kt=(()=>{class s extends u{constructor(i,e,r){super(),this.createRequest=i,N(this,r),this._opts=r,this._method=r.method||"GET",this._uri=e,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var i;let e=qt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(e);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(i=this._opts.cookieJar)===null||i===void 0||i.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var n;r.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=s.requestsCount++,s.requests[this._index]=this)}_onError(i){this.emitReserved("error",i,this._xhr),this._cleanup(!0)}_cleanup(i){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=vs,i)try{this._xhr.abort()}catch{}typeof document<"u"&&delete s.requests[this._index],this._xhr=null}}_onLoad(){let i=this._xhr.responseText;i!==null&&(this.emitReserved("data",i),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return s.requestsCount=0,s.requests={},s})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",zi);else if(typeof addEventListener=="function"){let s="onpagehide"in _?"pagehide":"unload";addEventListener(s,zi,!1)}}function zi(){for(let s in Kt.requests)Kt.requests.hasOwnProperty(s)&&Kt.requests[s].abort()}var Ts=(function(){let s=Zi({xdomain:!1});return s&&s.responseType!==null})(),I=class extends ce{constructor(t){super(t);let i=t&&t.forceBase64;this.supportsBinary=Ts&&!i}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Kt(Zi,this.uri(),t)}};function Zi(s){let t=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Xi))return new XMLHttpRequest}catch{}if(!t)try{return new _[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var ts=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ue=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),i=this.opts.protocols,e=ts?{}:qt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(e.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,i,e)}catch(r){return this.emitReserved("error",r)}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 i=0;i<t.length;i++){let e=t[i],r=i===t.length-1;mt(e,this.supportsBinary,n=>{try{this.doWrite(e,n)}catch{}r&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=Gt()),this.supportsBinary||(i.b64=1),this.createUri(t,i)}},he=_.WebSocket||_.MozWebSocket,P=class extends ue{createSocket(t,i,e){return ts?new he(t,i,e):i?new he(t,i):new he(t)}doWrite(t,i){this.ws.send(i)}};var $=class extends F{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=>{let i=Gi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),e=t.readable.pipeThrough(i).getReader(),r=qi();r.readable.pipeTo(t.writable),this._writer=r.writable.getWriter();let n=()=>{e.read().then(({done:a,value:c})=>{a||(this.onPacket(c),n())}).catch(a=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let i=0;i<t.length;i++){let e=t[i],r=i===t.length-1;this._writer.write(e).then(()=>{r&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var le={websocket:P,webtransport:$,polling:I};var Cs=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ks=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function it(s){if(s.length>8e3)throw"URI too long";let t=s,i=s.indexOf("["),e=s.indexOf("]");i!=-1&&e!=-1&&(s=s.substring(0,i)+s.substring(i,e).replace(/:/g,";")+s.substring(e,s.length));let r=Cs.exec(s||""),n={},o=14;for(;o--;)n[ks[o]]=r[o]||"";return i!=-1&&e!=-1&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Rs(n,n.path),n.queryKey=Os(n,n.query),n}function Rs(s,t){let i=/\/{2,9}/g,e=t.replace(i,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&e.splice(0,1),t.slice(-1)=="/"&&e.splice(e.length-1,1),e}function Os(s,t){let i={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,r,n){r&&(i[r]=n)}),i}var pe=typeof addEventListener=="function"&&typeof removeEventListener=="function",jt=[];pe&&addEventListener("offline",()=>{jt.forEach(s=>s())},!1);var Qt=(()=>{class s extends u{constructor(i,e){if(super(),this.binaryType=Yi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,i&&typeof i=="object"&&(e=i,i=null),i){let r=it(i);e.hostname=r.host,e.secure=r.protocol==="https"||r.protocol==="wss",e.port=r.port,r.query&&(e.query=r.query)}else e.host&&(e.hostname=it(e.host).host);N(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(r=>{let n=r.prototype.name;this.transports.push(n),this._transportsByName[n]=r}),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},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Qi(this.opts.query)),pe&&(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"})},jt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(i){let e=Object.assign({},this.opts.query);e.EIO=ae,e.transport=i,this.id&&(e.sid=this.id);let r=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[i]);return new this._transportsByName[i](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let i=this.opts.rememberUpgrade&&s.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let e=this.createTransport(i);e.open(),this.setTransport(e)}setTransport(i){this.transport&&this.transport.removeAllListeners(),this.transport=i,i.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",s.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",i),this.emitReserved("heartbeat"),i.type){case"open":this.onHandshake(JSON.parse(i.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let e=new Error("server error");e.code=i.data,this._onError(e);break;case"message":this.emitReserved("data",i.data),this.emitReserved("message",i.data);break}}onHandshake(i){this.emitReserved("handshake",i),this.id=i.sid,this.transport.query.sid=i.sid,this._pingInterval=i.pingInterval,this._pingTimeout=i.pingTimeout,this._maxPayload=i.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let i=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+i,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},i),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){let i=this._getWritablePackets();this.transport.send(i),this._prevBufferLen=i.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let r=0;r<this.writeBuffer.length;r++){let n=this.writeBuffer[r].data;if(n&&(e+=Ki(n)),r>0&&e>this._maxPayload)return this.writeBuffer.slice(0,r);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let i=Date.now()>this._pingTimeoutTime;return i&&(this._pingTimeoutTime=0,x(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),i}write(i,e,r){return this._sendPacket("message",i,e,r),this}send(i,e,r){return this._sendPacket("message",i,e,r),this}_sendPacket(i,e,r,n){if(typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let o={type:i,data:e,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let i=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),i()},r=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():i()}):this.upgrading?r():i()),this}_onError(i){if(s.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",i),this._onClose("transport error",i)}_onClose(i,e){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(),pe&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let r=jt.indexOf(this._offlineEventListener);r!==-1&&jt.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",i,e),this.writeBuffer=[],this._prevBufferLen=0}}}return s.protocol=ae,s})(),Jt=class extends Qt{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 i=this.createTransport(t),e=!1;Qt.priorWebsocketSuccess=!1;let r=()=>{e||(i.send([{type:"ping",data:"probe"}]),i.once("packet",B=>{if(!e)if(B.type==="pong"&&B.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;Qt.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{e||this.readyState!=="closed"&&(w(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{let ot=new Error("probe error");ot.transport=i.name,this.emitReserved("upgradeError",ot)}}))};function n(){e||(e=!0,w(),i.close(),i=null)}let o=B=>{let ot=new Error("probe error: "+B);ot.transport=i.name,n(),this.emitReserved("upgradeError",ot)};function a(){o("transport closed")}function c(){o("socket closed")}function E(B){i&&B.name!==i.name&&n()}let w=()=>{i.removeListener("open",r),i.removeListener("error",o),i.removeListener("close",a),this.off("close",c),this.off("upgrading",E)};i.once("open",r),i.once("error",o),i.once("close",a),this.once("close",c),this.once("upgrading",E),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{e||i.open()},200):i.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let i=[];for(let e=0;e<t.length;e++)~this.transports.indexOf(t[e])&&i.push(t[e]);return i}},st=class extends Jt{constructor(t,i={}){let e=typeof t=="object"?t:i;(!e.transports||e.transports&&typeof e.transports[0]=="string")&&(e.transports=(e.transports||["polling","websocket","webtransport"]).map(r=>le[r]).filter(r=>!!r)),super(t,e)}};var yt=class extends et{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(i=>this.onData(i))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,i){this._fetch(t).then(e=>{if(!e.ok)return this.onError("fetch write error",e.status,e);i()}).catch(e=>{this.onError("fetch write error",e)})}_fetch(t){var i;let e=t!==void 0,r=new Headers(this.opts.extraHeaders);return e&&r.set("content-type","text/plain;charset=UTF-8"),(i=this.socket._cookieJar)===null||i===void 0||i.appendCookies(r),fetch(this.uri(),{method:e?"POST":"GET",body:e?t:null,headers:r,credentials:this.opts.withCredentials?"include":"omit"}).then(n=>{var o;return(o=this.socket._cookieJar)===null||o===void 0||o.parseCookies(n.headers.getSetCookie()),n})}};var ln=st.protocol;function es(s,t="",i){let e=s;i=i||typeof location<"u"&&location,s==null&&(s=i.protocol+"//"+i.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=i.protocol+s:s=i.host+s),/^(https?|wss?):\/\//.test(s)||(typeof i<"u"?s=i.protocol+"//"+s:s="https://"+s),e=it(s)),e.port||(/^(http|ws)$/.test(e.protocol)?e.port="80":/^(http|ws)s$/.test(e.protocol)&&(e.port="443")),e.path=e.path||"/";let n=e.host.indexOf(":")!==-1?"["+e.host+"]":e.host;return e.id=e.protocol+"://"+n+":"+e.port+t,e.href=e.protocol+"://"+n+(i&&i.port===e.port?"":":"+e.port),e}var Ee={};Ce(Ee,{Decoder:()=>ge,Encoder:()=>me,PacketType:()=>h,protocol:()=>ye});var xs=typeof ArrayBuffer=="function",Ns=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,is=Object.prototype.toString,Fs=typeof Blob=="function"||typeof Blob<"u"&&is.call(Blob)==="[object BlobConstructor]",Is=typeof File=="function"||typeof File<"u"&&is.call(File)==="[object FileConstructor]";function St(s){return xs&&(s instanceof ArrayBuffer||Ns(s))||Fs&&s instanceof Blob||Is&&s instanceof File}function Et(s,t){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let i=0,e=s.length;i<e;i++)if(Et(s[i]))return!0;return!1}if(St(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return Et(s.toJSON(),!0);for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i)&&Et(s[i]))return!0;return!1}function ss(s){let t=[],i=s.data,e=s;return e.data=fe(i,t),e.attachments=t.length,{packet:e,buffers:t}}function fe(s,t){if(!s)return s;if(St(s)){let i={_placeholder:!0,num:t.length};return t.push(s),i}else if(Array.isArray(s)){let i=new Array(s.length);for(let e=0;e<s.length;e++)i[e]=fe(s[e],t);return i}else if(typeof s=="object"&&!(s instanceof Date)){let i={};for(let e in s)Object.prototype.hasOwnProperty.call(s,e)&&(i[e]=fe(s[e],t));return i}return s}function rs(s,t){return s.data=de(s.data,t),delete s.attachments,s}function de(s,t){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<t.length)return t[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let i=0;i<s.length;i++)s[i]=de(s[i],t);else if(typeof s=="object")for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&(s[i]=de(s[i],t));return s}var Ps=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ye=5,h=(function(s){return 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",s})(h||{}),me=class{constructor(t){this.replacer=t}encode(t){return(t.type===h.EVENT||t.type===h.ACK)&&Et(t)?this.encodeAsBinary({type:t.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let i=""+t.type;return(t.type===h.BINARY_EVENT||t.type===h.BINARY_ACK)&&(i+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(i+=t.nsp+","),t.id!=null&&(i+=t.id),t.data!=null&&(i+=JSON.stringify(t.data,this.replacer)),i}encodeAsBinary(t){let i=ss(t),e=this.encodeAsString(i.packet),r=i.buffers;return r.unshift(e),r}};function ns(s){return Object.prototype.toString.call(s)==="[object Object]"}var ge=class s extends u{constructor(t){super(),this.reviver=t}add(t){let i;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(t);let e=i.type===h.BINARY_EVENT;e||i.type===h.BINARY_ACK?(i.type=e?h.EVENT:h.ACK,this.reconstructor=new _e(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(St(t)||t.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(t),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let i=0,e={type:Number(t.charAt(0))};if(h[e.type]===void 0)throw new Error("unknown packet type "+e.type);if(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK){let n=i+1;for(;t.charAt(++i)!=="-"&&i!=t.length;);let o=t.substring(n,i);if(o!=Number(o)||t.charAt(i)!=="-")throw new Error("Illegal attachments");e.attachments=Number(o)}if(t.charAt(i+1)==="/"){let n=i+1;for(;++i&&!(t.charAt(i)===","||i===t.length););e.nsp=t.substring(n,i)}else e.nsp="/";let r=t.charAt(i+1);if(r!==""&&Number(r)==r){let n=i+1;for(;++i;){let o=t.charAt(i);if(o==null||Number(o)!=o){--i;break}if(i===t.length)break}e.id=Number(t.substring(n,i+1))}if(t.charAt(++i)){let n=this.tryParse(t.substr(i));if(s.isPayloadValid(e.type,n))e.data=n;else throw new Error("invalid payload")}return e}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,i){switch(t){case h.CONNECT:return ns(i);case h.DISCONNECT:return i===void 0;case h.CONNECT_ERROR:return typeof i=="string"||ns(i);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&Ps.indexOf(i[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},_e=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let i=rs(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function b(s,t,i){return s.on(t,i),function(){s.off(t,i)}}var Bs=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),q=class extends u{constructor(t,i,e){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=i,e&&e.auth&&(this.auth=e.auth),this._opts=Object.assign({},e),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[b(t,"open",this.onopen.bind(this)),b(t,"packet",this.onpacket.bind(this)),b(t,"error",this.onerror.bind(this)),b(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,...i){var e,r,n;if(Bs.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(i.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;let o={type:h.EVENT,data:i};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){let w=this.ids++,B=i.pop();this._registerAckCallback(w,B),o.id=w}let a=(r=(e=this.io.engine)===null||e===void 0?void 0:e.transport)===null||r===void 0?void 0:r.writable,c=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!a||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,i){var e;let r=(e=this.flags.timeout)!==null&&e!==void 0?e:this._opts.ackTimeout;if(r===void 0){this.acks[t]=i;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);i.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(n),i.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...i){return new Promise((e,r)=>{let n=(o,a)=>o?r(o):e(a);n.withError=!0,i.push(n),this.emit(t,...i)})}_addToQueue(t){let i;typeof t[t.length-1]=="function"&&(i=t.pop());let e={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...n)=>e!==this._queue[0]?void 0:(r!==null?e.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(r)):(this._queue.shift(),i&&i(null,...n)),e.pending=!1,this._drainQueue())),this._queue.push(e),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let i=this._queue[0];i.pending&&!t||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.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:h.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,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(e=>String(e.id)===t)){let e=this.acks[t];delete this.acks[t],e.withError&&e.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case h.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 h.EVENT:case h.BINARY_EVENT:this.onevent(t);break;case h.ACK:case h.BINARY_ACK:this.onack(t);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let e=new Error(t.data.message);e.data=t.data.data,this.emitReserved("connect_error",e);break}}onevent(t){let i=t.data||[];t.id!=null&&i.push(this.ack(t.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let i=this._anyListeners.slice();for(let e of i)e.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){let i=this,e=!1;return function(...r){e||(e=!0,i.packet({type:h.ACK,id:t,data:r}))}}onack(t){let i=this.acks[t.id];typeof i=="function"&&(delete this.acks[t.id],i.withError&&t.data.unshift(null),i.apply(this,t.data))}onconnect(t,i){this.id=t,this.recovered=i&&this._pid===i,this._pid=i,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:h.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){let i=this._anyListeners;for(let e=0;e<i.length;e++)if(t===i[e])return i.splice(e,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){let i=this._anyOutgoingListeners;for(let e=0;e<i.length;e++)if(t===i[e])return i.splice(e,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let i=this._anyOutgoingListeners.slice();for(let e of i)e.apply(this,t.data)}}};function G(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}G.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),i=Math.floor(t*this.jitter*s);s=(Math.floor(t*10)&1)==0?s-i:s+i}return Math.min(s,this.max)|0};G.prototype.reset=function(){this.attempts=0};G.prototype.setMin=function(s){this.ms=s};G.prototype.setMax=function(s){this.max=s};G.prototype.setJitter=function(s){this.jitter=s};var Y=class extends u{constructor(t,i){var e;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(i=t,t=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,N(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((e=i.randomizationFactor)!==null&&e!==void 0?e:.5),this.backoff=new G({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=t;let r=i.parser||Ee;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=i.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 i;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(i=this.backoff)===null||i===void 0||i.setMin(t),this)}randomizationFactor(t){var i;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(i=this.backoff)===null||i===void 0||i.setJitter(t),this)}reconnectionDelayMax(t){var i;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(i=this.backoff)===null||i===void 0||i.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 st(this.uri,this.opts);let i=this.engine,e=this;this._readyState="opening",this.skipReconnect=!1;let r=b(i,"open",function(){e.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=b(i,"error",n);if(this._timeout!==!1){let a=this._timeout,c=this.setTimeoutFn(()=>{r(),n(new Error("timeout")),i.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(b(t,"ping",this.onping.bind(this)),b(t,"data",this.ondata.bind(this)),b(t,"error",this.onerror.bind(this)),b(t,"close",this.onclose.bind(this)),b(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(i){this.onclose("parse error",i)}}ondecoded(t){x(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,i){let e=this.nsps[t];return e?this._autoConnect&&!e.active&&e.connect():(e=new q(this,t,i),this.nsps[t]=e),e}_destroy(t){let i=Object.keys(this.nsps);for(let e of i)if(this.nsps[e].active)return;this._close()}_packet(t){let i=this.encoder.encode(t);for(let e=0;e<i.length;e++)this.engine.write(i[e],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,i){var e;this.cleanup(),(e=this.engine)===null||e===void 0||e.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let i=this.backoff.duration();this._reconnecting=!0;let e=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},i);this.opts.autoUnref&&e.unref(),this.subs.push(()=>{this.clearTimeoutFn(e)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var bt={};function K(s,t){typeof s=="object"&&(t=s,s=void 0),t=t||{};let i=es(s,t.path||"/socket.io"),e=i.source,r=i.id,n=i.path,o=bt[r]&&n in bt[r].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,c;return a?c=new Y(e,t):(bt[r]||(bt[r]=new Y(e,t)),c=bt[r]),i.query&&!t.query&&(t.query=i.queryKey),c.socket(i.path,t)}Object.assign(K,{Manager:Y,Socket:q,io:K,connect:K});var rt=class s{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,i){this.config=t,this.appRef=i,t===void 0&&(t=this.emptyConfig);let e=t.url,r=t.options,n=K?K:Se;this.ioSocket=n(e,r)}get auth(){return this.ioSocket.auth}set auth(t){this.ioSocket.auth=t}get io(){return this.ioSocket.io}get open(){return this.connect}get close(){return this.disconnect}of(t){if(!t||t==="/")return this;let i=this.namespaces[t];if(i)return i;let a=this.config,{url:e}=a,r=Te(a,["url"]),n=U({url:!e.endsWith("/")&&!t.startsWith("/")?`${e}/${t}`:`${e}${t}`},r),o=new s(n,this.appRef);return this.namespaces[t]=o,o}on(t,i){return this.ioSocket.on(t,i),this}once(t,i){return this.ioSocket.once(t,i),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...i){return this.ioSocket.emit(t,...i),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...i){return this.ioSocket.emitWithAck(t,...i)}removeListener(t,i){return this.ioSocket.removeListener(t,i),this}removeAllListeners(t){return this.ioSocket.removeAllListeners(t),this}fromEvent(t){return this.subscribersCounter[t]||(this.subscribersCounter[t]=0),this.subscribersCounter[t]++,this.eventObservables$[t]||(this.eventObservables$[t]=new Re(i=>{let e=r=>{i.next(r),this.appRef.tick()};return this.ioSocket.on(t,e),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,e),delete this.eventObservables$[t])}}).pipe(Ne())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(i=>this.once(t,i))}listeners(t){return this.ioSocket.listeners(t)}hasListeners(t){return this.ioSocket.hasListeners(t)}listenersAny(){return this.ioSocket.listenersAny()}listenersAnyOutgoing(){return this.ioSocket.listenersAnyOutgoing()}off(t,i){return this.ioSocket.off(t,i),this}offAny(t){return this.ioSocket.offAny(t),this}offAnyOutgoing(t){return this.ioSocket.offAnyOutgoing(t),this}onAny(t){return this.ioSocket.onAny(t),this}onAnyOutgoing(t){return this.ioSocket.onAnyOutgoing(t),this}prependAny(t){return this.ioSocket.prependAny(t),this}prependAnyOutgoing(t){return this.ioSocket.prependAnyOutgoing(t),this}timeout(t){return this.ioSocket.timeout(t),this}get volatile(){let t=this.ioSocket.volatile;return this}get active(){return this.ioSocket.active}get connected(){return this.ioSocket.connected}get disconnected(){return this.ioSocket.disconnected}get recovered(){return this.ioSocket.recovered}get id(){return this.ioSocket.id}compress(t){return this.ioSocket.compress(t),this}};function Ds(s,t){return new rt(s,t)}var os=new Fe("__SOCKET_IO_CONFIG__"),eo=(()=>{class s{static forRoot(i){return{ngModule:s,providers:[{provide:os,useValue:i},{provide:rt,useFactory:Ds,deps:[os,De]}]}}static \u0275fac=function(e){return new(e||s)};static \u0275mod=kt({type:s});static \u0275inj=vt({})}return s})();var be={BASE:`${li}/notifications`,UNREAD:"unread"},Xt=be.BASE;var d=(function(s){return s.ADD="add",s.UPDATE="update",s.DELETE="delete",s.DELETE_PERMANENTLY="deletePermanently",s})(d||{});var v=(function(s){return s.COMMENTS="comments",s.SPACES="spaces",s.SPACE_ROOTS="spaces_roots",s.SHARES="shares",s.LINKS="links",s.SYNC="sync",s.AUTH_LOCKED="auth_locked",s.AUTH_2FA="auth_2fa",s})(v||{}),co={COMMENTS:"commented",SPACES:{[d.ADD]:"You now have access to the space",[d.DELETE]:"You no longer have access to the space",[d.DELETE_PERMANENTLY]:"This space has been permanently deleted"},SPACE_ROOTS:{[d.ADD]:"anchored",[d.DELETE]:"unanchored"},SHARES:{[d.ADD]:"shared with you",[d.DELETE]:"no longer share with you"},SHARES_WITHOUT_OWNER:{[d.ADD]:"You now have access to the share",[d.DELETE]:"You no longer have access to the share",[d.DELETE_PERMANENTLY]:"You are no longer a member of the parent share, your child share has been deleted"},LINKS:{[d.ADD]:"shared with you",[d.UPDATE]:"You now have access to the space"},SYNC:{[d.DELETE]:"You are no longer synchronizing"},AUTH_2FA:{[d.ADD]:"Two-factor authentication (2FA) on your account has been enabled",[d.DELETE]:"Two-factor authentication (2FA) on your account has been disabled"},AUTH_LOCKED:{[d.DELETE]:"Your account has been locked after several unsuccessful authentication attempts"}};var as=ni;var cs={[v.COMMENTS]:as,[v.SPACES]:lt.SPACES,[v.SPACE_ROOTS]:lt.SPACES,[v.SHARES]:lt.SHARES,[v.LINKS]:lt.LINKS,[v.SYNC]:Ai.SYNC};var zt=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=Z(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Information",avatarUrl:null},this.appIcon=cs[this.content.app],this.setMainElement()}setMainElement(){if(this.content.app===v.COMMENTS||this.content.app===v.SHARES||this.content.app===v.SYNC)return;let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}};var hs=(()=>{let t=class t{constructor(){this.http=p(Ft),this.store=p(Ht),this.layout=p(tt)}getNotifications(e=!1){return this.http.get(`${Xt}${e?`/${be.UNREAD}`:""}`).pipe(S(r=>r.map(n=>new zt(n))))}wasReadNotification(e){return this.http.patch(`${Xt}/${e}`,null)}deleteNotification(e){return this.http.delete(`${Xt}${e?`/${e}`:""}`)}checkUnreadNotifications(e=!1){this.getNotifications().subscribe(r=>{let n;if(e&&r.length){let o=r[0];n=this.layout.sendNotification("warning",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=r.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("warning","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(xe(1)).subscribe(()=>this.layout.showRSideBarTab(Si.NOTIFICATIONS,!0)),this.store.notifications.set(r)})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275prov=At({token:t,factory:t.\u0275fac,providedIn:"root"});let s=t;return s})();var y=(function(s){return s.ACCESS="access",s.ACCESS_2FA="access_2fa",s.REFRESH="refresh",s.WS="ws",s.CSRF="csrf",s.CSRF_2FA="csrf_2fa",s})(y||{});var Do="sync-in-csrf";var we=6;var us="sync-in-two-fa-code",ls="sync-in-two-fa-password",Lo={[y.ACCESS]:"/",[y.REFRESH]:ki,[y.WS]:Ri,[y.CSRF]:"/",[y.ACCESS_2FA]:xi,[y.CSRF_2FA]:"/"},Uo=[y.REFRESH,y.ACCESS,y.WS,y.CSRF],Mo=[y.ACCESS_2FA,y.CSRF_2FA];var Us=["Password"];function Ms(s,t){s&1&&(f(0,"label",1),T(1,"Password"),g())}function Vs(s,t){if(s&1){let i=ct();f(0,"div",5),A("click",function(){M(i);let r=D();return V(r.randomPassword())}),f(1,"span"),X(2,"fa-icon",6),g()()}if(s&2){let i=D();m(2),k("icon",i.icons.faDice)}}var ps=(()=>{let t=class t{constructor(){this.passwordChange=new Pe,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Lt),this.toggleVisiblePassword=wi,this.icons={faEye:ri,faEyeSlash:ai,faDice:ci}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(yi(this.passwordMinLength+2))}};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=Ct({type:t,selectors:[["app-input-password"]],viewQuery:function(r,n){if(r&1&&Ue(Us,7),r&2){let o;Ot(o=xt())&&(n.passwordElement=o.first)}},inputs:{password:"password",passwordMinLength:"passwordMinLength",placeholder:"placeholder",showGenerator:"showGenerator",showLabel:"showLabel",disabled:"disabled",isRequired:"isRequired",focus:"focus",centered:"centered"},outputs:{passwordChange:"passwordChange"},decls:9,vars:16,consts:[["Password",""],["for","password","l10nTranslate",""],["id","password",1,"input-group","input-group-sm",2,"min-width","150px"],["autocomplete","off","type","password",1,"form-control","form-control-sm","pe-0",3,"ngModelChange","keyup","ngModel","disabled","placeholder","required"],[1,"input-group-text","cursor-pointer"],[1,"input-group-text","cursor-pointer",3,"click"],[3,"icon"]],template:function(r,n){if(r&1){let o=ct();R(0,Ms,2,0,"label",1),f(1,"div",2)(2,"input",3,0),qe(4,"translate"),$e("ngModelChange",function(c){return M(o),We(n.password,c)||(n.password=c),V(c)}),A("keyup",function(){return M(o),V(n.passwordChange.emit(n.password))}),g(),R(5,Vs,3,1,"div",4),f(6,"div",5),A("click",function(){M(o);let c=te(3);return V(n.toggleVisiblePassword(c))}),f(7,"span"),X(8,"fa-icon",6),g()()()}if(r&2){let o=te(3);O(n.showLabel?0:-1),m(2),Me("padding-left",n.centered?"2rem":""),H("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),He("ngModel",n.password),k("disabled",n.disabled)("placeholder",Ge(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),O(n.showGenerator?5:-1),m(3),k("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[ei,Pt,Bt,ze,je,Dt,Vt,Ut,ii],encapsulation:2});let s=t;return s})();var fs=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Tt)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=J({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let s=t;return s})();function Hs(s,t){s&1&&(f(0,"span",3),T(1,"Two-Factor Authentication"),g())}function Ws(s,t){s&1&&(f(0,"span",3),T(1,"Password Authentication"),g())}function $s(s,t){if(s&1&&T(0),s&2){let i=D();Ve(" ",i.hasError," ")}}function qs(s,t){s&1&&T(0," Enter your password ")}function Gs(s,t){s&1&&T(0," Valid with your TOTP code ")}function Ys(s,t){if(s&1){let i=ct();f(0,"div",9)(1,"app-input-password",13),A("passwordChange",function(r){M(i);let n=D();return V(n.updatePassword(r))}),g()()}if(s&2){let i=D();m(),k("password",i.twoFaForm.value.password)("focus",!0)("centered",!0)}}function Ks(s,t){s&1&&(f(0,"div",14),T(1,"Valid with your TOTP code"),g())}function js(s,t){if(s&1&&(R(0,Ks,2,0,"div",14),f(1,"div",15),X(2,"input",16),g()),s&2){let i=D();O(i.withPassword?0:-1),m(2),k("autoFocus",!i.withPassword)("autoSelect",!i.withPassword)("maxlength",i.twoFaCodelength)}}var ds=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:si,faLock:oi},this.twoFaCodelength=we,this.locale=p(Lt),this.fb=p(ti),this.layout=p(tt)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[ht.required,ht.pattern(new RegExp(`^\\d{${we}}$`))]:null),password:this.fb.control("",this.withPassword?[ht.required,ht.minLength(8)]:null)})}onClose(e=!1){this.isValid(e),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let e=new Ye(U(U({},this.withTwoFaEnabled?{[us]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[ls]:this.twoFaForm.value.password}:{}));this.onClose(e)}updatePassword(e){this.twoFaForm.patchValue({password:e})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=Ct({type:t,selectors:[["app-user-auth-2fa-verify-dialog"]],inputs:{withPassword:"withPassword",withTwoFaEnabled:"withTwoFaEnabled"},decls:20,vars:9,consts:[[1,"modal-header","align-items-center","justify-content-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"modal-body","modal-auth-verify-2fa"],[1,"card","shadow-sm"],[1,"card-body"],["l10nTranslate","",1,"d-flex","justify-content-center","align-items-center","mb-3"],[3,"ngSubmit","formGroup"],[1,"mb-4"],[1,"d-grid","gap-2"],["type","submit","l10nTranslate","",1,"btn","btn-primary",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["id","password","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",3,"passwordChange","password","focus","centered"],["l10nTranslate","",1,"text-align-center","mb-3"],[1,"mb-3"],["appAutofocus","","type","text","formControlName","totpCode","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022","inputmode","numeric","autocomplete","one-time-code","name","totp",1,"form-control","text-center","fs-4",3,"autoFocus","autoSelect","maxlength"]],template:function(r,n){r&1&&(f(0,"div",0)(1,"h4",1),X(2,"fa-icon",2),R(3,Hs,2,0,"span",3)(4,Ws,2,0,"span",3),g()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),R(9,$s,1,1)(10,qs,1,0)(11,Gs,1,0),g(),f(12,"form",8),A("ngSubmit",function(){return n.onSubmit()}),R(13,Ys,2,3,"div",9),R(14,js,3,4),f(15,"div",10)(16,"button",11),T(17,"Confirm"),g(),f(18,"button",12),A("click",function(){return n.onClose()}),T(19,"Cancel"),g()()()()()()),r&2&&(m(2),k("icon",n.icons.faLock),m(),O(n.withTwoFaEnabled?3:4),m(5),H("text-danger",n.hasError),m(),O(n.hasError?9:n.withPassword?10:11),m(3),k("formGroup",n.twoFaForm),m(),O(n.withPassword?13:-1),m(),O(n.withTwoFaEnabled?14:-1),m(2),k("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Vt,Ut,fs,Dt,Qe,Pt,Bt,Ke,Ze,Je,Xe,ps],encapsulation:2});let s=t;return s})();var Zt=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(i=>new L(i))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=Z(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=ui(this.currentAccess).fromNow(!0),this.newly=bi(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(i=>new L(i)))}};var wt=class{constructor(t){this.setOnlineStatus(Ei("status",t)),this.avatarUrl=Z(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=hi[t]}};var Ja=(()=>{let t=class t{constructor(){this.http=p(Ft),this.layout=p(tt),this.store=p(Ht),this.webSocket=p(rt),this.notifications=p(hs),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(Ci.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(pt.EVENTS.ONLINE_USER).pipe(S(e=>new wt(e))).subscribe(e=>this.newOnlineUser(e)),this.webSocket.fromEvent(pt.EVENTS.ONLINE_USERS).pipe(S(e=>e.map(r=>new wt(r)))).subscribe(e=>this.setOnlineUsers(e)),this.webSocket.fromEvent(pt.EVENTS.ONLINE_STATUS).subscribe(e=>this.receiveOnlineStatus(e))}get user(){return this.store.user.getValue()}initUser(e,r=!1){this.refreshAvatar(),this.layout.setLanguage(e.language).catch(console.error),this.store.userImpersonate.set(r||e.impersonated),this.store.user.next(e),this.checkQuota(this.store.user.getValue()),r&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(e){this.store.onlineUsers.set(e)}newOnlineUser(e){this.store.onlineUsers().find(r=>r.id===e.id)?this.receiveOnlineStatus({userId:e.id,status:e.onlineStatus}):this.store.onlineUsers.update(r=>[e,...r])}userHavePermission(e){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(e)!==-1:!1}browseGroup(e){return this.http.get(`${gi}${e?`/${e}`:""}`).pipe(S(r=>new Zt(r)))}createPersonalGroup(e){return this.http.post(W,e).pipe(S(r=>new L(r)))}updatePersonalGroup(e,r){return this.http.put(`${W}/${e}`,r).pipe(S(n=>new L(n)))}leavePersonalGroup(e){return this.http.delete(`${_i}/${e}`)}addUsersToGroup(e,r){return this.http.patch(`${W}/${e}/${ut.USERS}`,r)}deletePersonalGroup(e){return this.http.delete(`${W}/${e}`)}updateUserFromPersonalGroup(e,r,n){return this.http.patch(`${W}/${e}/${ut.USERS}/${r}`,n)}removeUserFromGroup(e,r){return this.http.delete(`${W}/${e}/${ut.USERS}/${r}`)}listGuests(){return this.http.get(z).pipe(S(e=>e.map(r=>new j(r))))}getGuest(e){return this.http.get(`${z}/${e}`).pipe(S(r=>new j(r)))}createGuest(e){return this.http.post(z,e).pipe(S(r=>new j(r)))}updateGuest(e,r){return this.http.put(`${z}/${e}`,r).pipe(S(n=>n?new j(n):null))}deleteGuest(e){return this.http.delete(`${z}/${e}`)}genAvatar(){this.http.patch(se,null).subscribe({next:()=>this.refreshAvatar(),error:e=>this.layout.sendNotification("error","Configuration","Avatar",e)})}uploadAvatar(e){let r=new FormData;r.append("file",e),this.http.put(se,r).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(e,r){return this.http.put(fi,e,{headers:r})}changeLanguage(e){return this.http.put(pi,e)}changeNotification(e){return this.http.put(di,e)}changeStorageIndexing(e){return this.http.put(mi,e)}changeOnlineStatus(e,r=!0){this.webSocket.emit(pt.EVENTS.ONLINE_STATUS,{status:e,store:r})}receiveOnlineStatus(e){this.user.id===e.userId?this.user.onlineStatus=e.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(r=>r.map(n=>n.id===e.userId?ve(U({},n),{onlineStatus:e.status}):n))}searchMembers(e,r=[]){return this.http.request("search",ut.BASE,{body:e}).pipe(S(n=>n.map(o=>new L(o,r))),Oe(()=>[]))}setMenusVisibility(e){for(let r of e)if(!(r.id&&(r.hide=!this.userHavePermission(r.id),r.hide))&&(r.checks?.length&&(r.hide=!r.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),r.submenus?.length&&this.setMenusVisibility(r.submenus),r.title===Ti.FILES)){for(let n of r.submenus)if(!n.hide){r.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(vi())}checkAppStoreAvailability(){this.http.get(`${ie.BASE}/${ie.APP_STORE}`).subscribe({next:e=>this.store.appStoreManifest.set(e),error:e=>console.error(e)})}listAppPasswords(e){return this.http.get(Mt,{headers:e})}generateAppPassword(e,r){return this.http.post(Mt,e,{headers:r})}deleteAppPassword(e){return this.http.delete(`${Mt}/${e}`)}init2Fa(){return this.http.get(re)}enable2Fa(e){return this.http.post(re,e)}disable2Fa(e){return this.http.post(Oi,e)}adminResetUser2Fa(e,r){return this.http.post(`${Ni}/${e}`,null,{headers:r})}auth2FaVerifyDialog(e=!1){return ke(this,null,function*(){let r=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(e||r)return new Promise(n=>{let o=this.layout.openDialog(ds,"xs",{initialState:{withPassword:e,withTwoFaEnabled:r}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(e){if(!(e.isGuest||e.isLink)&&e.storageQuota){let r=Math.round(100/e.storageQuota*(e.storageQuota-e.storageUsage));r<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):r<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:r}),null,{disableTimeOut:!0,closeButton:!0}):r<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:r}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(r){return new(r||t)},t.\u0275prov=At({token:t,factory:t.\u0275fac,providedIn:"root"});let s=t;return s})();var Qs={provide:It,useExisting:at(()=>Js),multi:!0},Js=(()=>{let t=class t{constructor(){this.btnCheckboxTrue=!0,this.btnCheckboxFalse=!1,this.state=!1,this.isDisabled=!1,this.onChange=Function.prototype,this.onTouched=Function.prototype}onClick(){this.isDisabled||(this.toggle(!this.state),this.onChange(this.value))}ngOnInit(){this.toggle(this.trueValue===this.value)}get trueValue(){return typeof this.btnCheckboxTrue<"u"?this.btnCheckboxTrue:!0}get falseValue(){return typeof this.btnCheckboxFalse<"u"?this.btnCheckboxFalse:!1}toggle(e){this.state=e,this.value=this.state?this.trueValue:this.falseValue}writeValue(e){this.state=this.trueValue===e,this.value=e?this.trueValue:this.falseValue}setDisabledState(e){this.isDisabled=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=J({type:t,selectors:[["","btnCheckbox",""]],hostVars:3,hostBindings:function(r,n){r&1&&A("click",function(){return n.onClick()}),r&2&&(Rt("aria-pressed",n.state),H("active",n.state))},inputs:{btnCheckboxTrue:"btnCheckboxTrue",btnCheckboxFalse:"btnCheckboxFalse"},features:[Nt([Qs])]});let s=t;return s})(),Xs={provide:It,useExisting:at(()=>ms),multi:!0},ms=(()=>{let t=class t{get value(){return this.group?this.group.value:this._value}set value(e){if(this.group){this.group.value=e;return}this._value=e,this._onChange(e)}get disabled(){return this._disabled}set disabled(e){this.setDisabledState(e)}get controlOrGroupDisabled(){return this.disabled||this.group&&this.group.disabled?!0:void 0}get hasDisabledClass(){return this.controlOrGroupDisabled&&!this.isActive}get isActive(){return this.btnRadio===this.value}get tabindex(){if(!this.controlOrGroupDisabled)return this.isActive||this.group==null?0:-1}get hasFocus(){return this._hasFocus}constructor(e,r,n,o){this.el=e,this.cdr=r,this.renderer=n,this.group=o,this.onChange=Function.prototype,this.onTouched=Function.prototype,this.uncheckable=!1,this.role="radio",this._disabled=!1,this._hasFocus=!1}toggleIfAllowed(){this.canToggle()&&(this.uncheckable&&this.btnRadio===this.value?this.value=void 0:this.value=this.btnRadio)}onSpacePressed(e){this.toggleIfAllowed(),e.preventDefault()}focus(){this.el.nativeElement.focus()}onFocus(){this._hasFocus=!0}onBlur(){this._hasFocus=!1,this.onTouched()}canToggle(){return!this.controlOrGroupDisabled&&(this.uncheckable||this.btnRadio!==this.value)}ngOnChanges(e){"uncheckable"in e&&(this.uncheckable=this.uncheckable!==!1&&typeof this.uncheckable<"u")}_onChange(e){if(this.group){this.group.value=e;return}this.onTouched(),this.onChange(e)}writeValue(e){this.value=e,this.cdr.markForCheck()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){if(this._disabled=e,e){this.renderer.setAttribute(this.el.nativeElement,"disabled","disabled");return}this.renderer.removeAttribute(this.el.nativeElement,"disabled")}};t.\u0275fac=function(r){return new(r||t)(Q(Tt),Q(ee),Q(Be),Q(at(()=>gs),8))},t.\u0275dir=J({type:t,selectors:[["","btnRadio",""]],hostVars:8,hostBindings:function(r,n){r&1&&A("click",function(){return n.toggleIfAllowed()})("keydown.space",function(a){return n.onSpacePressed(a)})("focus",function(){return n.onFocus()})("blur",function(){return n.onBlur()}),r&2&&(Rt("aria-disabled",n.controlOrGroupDisabled)("aria-checked",n.isActive)("role",n.role)("tabindex",n.tabindex),H("disabled",n.hasDisabledClass)("active",n.isActive))},inputs:{btnRadio:"btnRadio",uncheckable:"uncheckable",value:"value",disabled:"disabled"},features:[Nt([Xs]),Ie]});let s=t;return s})(),zs={provide:It,useExisting:at(()=>gs),multi:!0},gs=(()=>{let t=class t{constructor(e){this.cdr=e,this.onChange=Function.prototype,this.onTouched=Function.prototype,this.role="radiogroup",this._disabled=!1}get value(){return this._value}set value(e){this._value=e,this.onChange(e)}get disabled(){return this._disabled}get tabindex(){return this._disabled?null:0}writeValue(e){this._value=e,this.cdr.markForCheck()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.radioButtons&&(this._disabled=e,this.radioButtons.forEach(r=>{r.setDisabledState(e)}),this.cdr.markForCheck())}onFocus(){if(this._disabled)return;let e=this.getActiveOrFocusedRadio();if(e){e.focus();return}if(this.radioButtons){let r=this.radioButtons.find(n=>!n.disabled);r&&r.focus()}}onBlur(){this.onTouched&&this.onTouched()}selectNext(e){this.selectInDirection("next"),e.preventDefault()}selectPrevious(e){this.selectInDirection("previous"),e.preventDefault()}selectInDirection(e){if(this._disabled)return;function r(o,a){let E=(o+(e==="next"?1:-1))%a.length;return E<0&&(E=a.length-1),E}let n=this.getActiveOrFocusedRadio();if(n&&this.radioButtons){let o=this.radioButtons.toArray(),a=o.indexOf(n);for(let c=r(a,o);c!==a;c=r(c,o))if(o[c].canToggle()){o[c].toggleIfAllowed(),o[c].focus();break}}}getActiveOrFocusedRadio(){if(this.radioButtons)return this.radioButtons.find(e=>e.isActive)||this.radioButtons.find(e=>e.hasFocus)}};t.\u0275fac=function(r){return new(r||t)(Q(ee))},t.\u0275dir=J({type:t,selectors:[["","btnRadioGroup",""]],contentQueries:function(r,n,o){if(r&1&&Le(o,ms,4),r&2){let a;Ot(a=xt())&&(n.radioButtons=a)}},hostVars:2,hostBindings:function(r,n){r&1&&A("focus",function(){return n.onFocus()})("blur",function(){return n.onBlur()})("keydown.ArrowRight",function(a){return n.selectNext(a)})("keydown.ArrowDown",function(a){return n.selectNext(a)})("keydown.ArrowLeft",function(a){return n.selectPrevious(a)})("keydown.ArrowUp",function(a){return n.selectPrevious(a)}),r&2&&Rt("role",n.role)("tabindex",n.tabindex)},features:[Nt([zs])]});let s=t;return s})(),hc=(()=>{let t=class t{static forRoot(){return{ngModule:t,providers:[]}}};t.\u0275fac=function(r){return new(r||t)},t.\u0275mod=kt({type:t}),t.\u0275inj=vt({});let s=t;return s})();export{er as a,ir as b,ki as c,xi as d,Do as e,we as f,us as g,ls as h,eo as i,v as j,hs as k,ps as l,fs as m,Zt as n,j as o,Ja as p,Js as q,hc as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cb as c,ia as a
|
|
1
|
+
import{Ad as f,cb as c,ia as a}from"./chunk-DIT6W7VM.js";var d=(()=>{let t=class t{constructor(){this.translate=a(f)}transform(e,i=[]){let n="";if(!e)return n;for(let[o,s]of Object.entries(e).filter(([l,p])=>i.indexOf(l)===-1))s&&(n+=`${s} ${this.translate.translate(s===1?o.slice(0,-1):o)}, `);return n.slice(0,-2)}};t.\u0275fac=function(i){return new(i||t)},t.\u0275pipe=c({name:"joinCounts",type:t,pure:!0});let r=t;return r})();export{d as a};
|