@sync-in/server 1.9.0 → 1.9.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/package.json +1 -1
  3. package/server/app.constants.js +3 -3
  4. package/server/app.constants.js.map +1 -1
  5. package/server/app.functions.js +42 -0
  6. package/server/app.functions.js.map +1 -0
  7. package/static/{chunk-CCGGCHGN.js → chunk-2TB2INBF.js} +1 -1
  8. package/static/{chunk-KNZ3AQPR.js → chunk-3WLBVJ2S.js} +1 -1
  9. package/static/{chunk-24Q7OUU2.js → chunk-3YDYZLF7.js} +1 -1
  10. package/static/{chunk-XOTKK2NJ.js → chunk-4PZPHJ7L.js} +1 -1
  11. package/static/{chunk-7CFSJ4BO.js → chunk-5E3TYOL3.js} +1 -1
  12. package/static/{chunk-T74SMT7I.js → chunk-5S6KPQRA.js} +1 -1
  13. package/static/{chunk-PG54TWBO.js → chunk-6B3GGAV3.js} +1 -1
  14. package/static/{chunk-KHRF67SG.js → chunk-6NEBGCAZ.js} +1 -1
  15. package/static/{chunk-N3P6P6GW.js → chunk-BODMMLVB.js} +1 -1
  16. package/static/{chunk-Y2I36A4K.js → chunk-BU4ZICZR.js} +1 -1
  17. package/static/{chunk-RX3YQ67K.js → chunk-DQ3GEMPM.js} +1 -1
  18. package/static/{chunk-BYWSTP3P.js → chunk-FNOTGWRW.js} +1 -1
  19. package/static/{chunk-F7TXTNZC.js → chunk-GNZPP2VO.js} +1 -1
  20. package/static/{chunk-LJSVNPPQ.js → chunk-GRLHFXGB.js} +1 -1
  21. package/static/{chunk-EKEGRXCV.js → chunk-HCSWO7BO.js} +1 -1
  22. package/static/{chunk-FTSIPHMG.js → chunk-HMOB6XC5.js} +1 -1
  23. package/static/{chunk-5HNQLBSW.js → chunk-I2S3XPC5.js} +1 -1
  24. package/static/{chunk-S6EVLDHA.js → chunk-JWPXQOS3.js} +1 -1
  25. package/static/{chunk-MRF3CNLZ.js → chunk-JY2I3HGL.js} +1 -1
  26. package/static/{chunk-2FOWUJQF.js → chunk-K657XPXA.js} +1 -1
  27. package/static/{chunk-MRMSMTWD.js → chunk-MIA5YBOI.js} +1 -1
  28. package/static/{chunk-BQZWSZNN.js → chunk-NKGKBQBX.js} +1 -1
  29. package/static/{chunk-OJCAIKUK.js → chunk-PXRT4L57.js} +1 -1
  30. package/static/{chunk-3IISSX63.js → chunk-RDNTK4YH.js} +1 -1
  31. package/static/{chunk-MNNCSSHN.js → chunk-RK2ONYTL.js} +1 -1
  32. package/static/{chunk-QNFNXDSX.js → chunk-S2VBGI6Q.js} +1 -1
  33. package/static/{chunk-Y44XDRM5.js → chunk-TGLJFALR.js} +1 -1
  34. package/static/{chunk-LXQGVNU2.js → chunk-U4RW6XG5.js} +1 -1
  35. package/static/{chunk-4FJUCMEG.js → chunk-V6FA5QY4.js} +1 -1
  36. package/static/{chunk-XX7JXKA6.js → chunk-VK7XMFVE.js} +1 -1
  37. package/static/{chunk-RT3K6DZR.js → chunk-VQJYCYWI.js} +1 -1
  38. package/static/{chunk-MVZJSG5R.js → chunk-XQGPSNQB.js} +1 -1
  39. package/static/{chunk-2XPHUNYN.js → chunk-ZXXHFBGL.js} +1 -1
  40. package/static/index.html +1 -1
  41. package/static/{main-3PLRDZTO.js → main-56PZQ6TJ.js} +3 -3
@@ -1 +1 @@
1
- import{$a as at,B as Kt,Ba as di,Cb as z,I as ni,Ma as mi,Mb as wi,Na as _i,Nb as ct,Pb as bi,Qb as Ai,Ua as gi,W as ai,X as Qt,_ as ot,aa as ci,ab as yi,ba as hi,ca as xt,da as ui,ea as li,fa as jt,ga as q,ha as pi,ia as fi,ja as X,qb as Ei,tb as M,ub as Si,vb as Pt}from"./chunk-5HNQLBSW.js";import{Aa as Ce,Bb as st,Bd as je,Cd as Je,Dd as Rt,Eb as B,Ed as Ot,Ef as ii,G as we,Gb as D,Jd as Xe,Kb as Ne,Kd as kt,L as be,Lb as Pe,Mb as Fe,Oa as m,Pb as Yt,Qa as Re,Qb as Le,Rb as At,Tb as A,Vb as Ie,Vc as We,W as Ae,Wf as ri,Xb as Ue,Yb as Be,Yc as Tt,Zb as De,ab as bt,bb as Oe,c as Se,cb as ke,ea as wt,fa as Te,fd as vt,ha as ve,hd as nt,he as ze,ie as Ze,ja as p,jb as xe,jd as Ct,kc as Me,kd as $e,lb as k,mb as x,mc as Ve,mg as si,oa as W,od as qe,og as Nt,pa as $,pd as Ge,rb as C,sb as f,sd as He,tb as _,td as Ye,ub as J,v as S,wf as ti,yd as Ke,yf as ei,zd as Qe}from"./chunk-IOIBQGHN.js";import{n as oi}from"./chunk-DM4NXKEP.js";import{a as O,b as _e,d as ge,e as ye,i as Ee}from"./chunk-KAVP6UXH.js";var V=(function(r){return r.USER="user",r.GUEST="guest",r.LINK="link",r.GROUP="group",r.PGROUP="personal group",r})(V||{});function Ti(r,t=[]){let e=O({},Object.fromEntries(Object.entries(Ai).filter(([i,s])=>t.indexOf(i)===-1)));if(!r)return e;for(let i of r.split(":"))i in e&&(e[i]=!0);return e}function jr(r,t,e=[]){let i={};if(!r)return i;for(let s of r.split(":"))e.indexOf(s)===-1&&(i[s]=t.indexOf(s)>-1);return i}function Jr(r,t=[]){let e={};if(!r)return e;for(let i of r.split(":"))t.indexOf(i)===-1&&(e[i]=bi[i]);return e}function Xr(r){return Object.entries(r).filter(([t,e])=>e).map(([t,e])=>t).join(":")}var T=class{constructor(t,e=[]){this.newly=0,this.linkSettings=null,Object.assign(this,t),this.mid=`${t.type[0]}${t.id}`,this.hPerms=Ti(t.permissions,e),t.login&&(this.avatarUrl=M(t.login)),this.isLink=!!this.linkId,this.isGuest=this.type===V.GUEST,this.isUser=this.isGuest||this.type===V.USER&&!this.isLink,this.isGroup=this.type===V.GROUP||this.type===V.PGROUP,this.isPersonalGroup=this.type===V.PGROUP,this.setGroupRole(),this.modifiedAt?this.newly=at(this.modifiedAt):this.createdAt&&(this.newly=at(this.createdAt))}setGroupRole(t){typeof t<"u"&&(this.groupRole=t),this.isGroupManager=this.groupRole===Kt.MANAGER}};function os(r,t,e){return new T({id:r.id,login:r.login,name:r.fullName,description:r.email,type:V.USER,spaceRole:t||di.IS_MEMBER,groupRole:e||Kt.MEMBER,permissions:""})}var vi={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var ht={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r.TWO_FA_BASE="2fa",r.TWO_FA_ENABLE="enable",r.TWO_FA_DISABLE="disable",r.TWO_FA_LOGIN_VERIFY="login/verify",r.TWO_FA_ADMIN_RESET_USER="reset/user",r})(l||{}),us=`${l.BASE}/${l.LOGIN}`,ls=`${l.BASE}/${l.LOGOUT}`,Ci=`${l.BASE}/${l.REFRESH}`,ps=`${l.BASE}/${l.TOKEN}`,fs=`${l.BASE}/${l.TOKEN_REFRESH}`,Ri=`/${l.WS}`,Jt=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,Oi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,ki=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var pe={};ye(pe,{Fetch:()=>mt,Manager:()=>K,NodeWebSocket:()=>I,NodeXHR:()=>L,Socket:()=>H,WebSocket:()=>I,WebTransport:()=>G,XHR:()=>L,connect:()=>Q,default:()=>Q,io:()=>Q,protocol:()=>ue});var v=Object.create(null);v.open="0";v.close="1";v.ping="2";v.pong="3";v.message="4";v.upgrade="5";v.noop="6";var ut=Object.create(null);Object.keys(v).forEach(r=>{ut[v[r]]=r});var lt={type:"error",data:"parser error"};var Fi=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Li=typeof ArrayBuffer=="function",Ii=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,pt=({type:r,data:t},e,i)=>Fi&&t instanceof Blob?e?i(t):Ni(t,i):Li&&(t instanceof ArrayBuffer||Ii(t))?e?i(t):Ni(new Blob([t]),i):i(v[r]+(t||"")),Ni=(r,t)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];t("b"+(i||""))},e.readAsDataURL(r)};function Pi(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var Xt;function Ui(r,t){if(Fi&&r.data instanceof Blob)return r.data.arrayBuffer().then(Pi).then(t);if(Li&&(r.data instanceof ArrayBuffer||Ii(r.data)))return t(Pi(r.data));pt(r,!1,e=>{Xt||(Xt=new TextEncoder),t(Xt.encode(e))})}var Bi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ft=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Bi.length;r++)ft[Bi.charCodeAt(r)]=r;var Di=r=>{let t=r.length*.75,e=r.length,i,s=0,n,o,a,c;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);let R=new ArrayBuffer(t),b=new Uint8Array(R);for(i=0;i<e;i+=4)n=ft[r.charCodeAt(i)],o=ft[r.charCodeAt(i+1)],a=ft[r.charCodeAt(i+2)],c=ft[r.charCodeAt(i+3)],b[s++]=n<<2|o>>4,b[s++]=(o&15)<<4|a>>2,b[s++]=(a&3)<<6|c&63;return R};var dr=typeof ArrayBuffer=="function",dt=(r,t)=>{if(typeof r!="string")return{type:"message",data:Mi(r,t)};let e=r.charAt(0);return e==="b"?{type:"message",data:mr(r.substring(1),t)}:ut[e]?r.length>1?{type:ut[e],data:r.substring(1)}:{type:ut[e]}:lt},mr=(r,t)=>{if(dr){let e=Di(r);return Mi(e,t)}else return{base64:!0,data:r}},Mi=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var Vi="",Wi=(r,t)=>{let e=r.length,i=new Array(e),s=0;r.forEach((n,o)=>{pt(n,!1,a=>{i[o]=a,++s===e&&t(i.join(Vi))})})},$i=(r,t)=>{let e=r.split(Vi),i=[];for(let s=0;s<e.length;s++){let n=dt(e[s],t);if(i.push(n),n.type==="error")break}return i};function qi(){return new TransformStream({transform(r,t){Ui(r,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(e)})}})}var zt;function Lt(r){return r.reduce((t,e)=>t+e.length,0)}function It(r,t){if(r[0].length===t)return r.shift();let e=new Uint8Array(t),i=0;for(let s=0;s<t;s++)e[s]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),e}function Gi(r,t){zt||(zt=new TextDecoder);let e=[],i=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(e.push(o);;){if(i===0){if(Lt(e)<1)break;let c=It(e,1);n=(c[0]&128)===128,s=c[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(Lt(e)<2)break;let c=It(e,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),i=3}else if(i===2){if(Lt(e)<8)break;let c=It(e,8),R=new DataView(c.buffer,c.byteOffset,c.length),b=R.getUint32(0);if(b>Math.pow(2,21)-1){a.enqueue(lt);break}s=b*Math.pow(2,32)+R.getUint32(4),i=3}else{if(Lt(e)<s)break;let c=It(e,s);a.enqueue(dt(n?c:zt.decode(c),t)),i=0}if(s===0||s>r){a.enqueue(lt);break}}}})}var Zt=4;function u(r){if(r)return _r(r)}function _r(r){for(var t in u.prototype)r[t]=u.prototype[t];return r}u.prototype.on=u.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};u.prototype.once=function(r,t){function e(){this.off(r,e),t.apply(this,arguments)}return e.fn=t,this.on(r,e),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+r];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===t||i.fn===t){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+r],this};u.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};u.prototype.hasListeners=function(r){return!!this.listeners(r).length};var N=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0),g=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hi="arraybuffer";function Ut(r,...t){return t.reduce((e,i)=>(r.hasOwnProperty(i)&&(e[i]=r[i]),e),{})}var gr=g.setTimeout,yr=g.clearTimeout;function P(r,t){t.useNativeTimers?(r.setTimeoutFn=gr.bind(g),r.clearTimeoutFn=yr.bind(g)):(r.setTimeoutFn=g.setTimeout.bind(g),r.clearTimeoutFn=g.clearTimeout.bind(g))}var Er=1.33;function Yi(r){return typeof r=="string"?Sr(r):Math.ceil((r.byteLength||r.size)*Er)}function Sr(r){let t=0,e=0;for(let i=0,s=r.length;i<s;i++)t=r.charCodeAt(i),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(i++,e+=4);return e}function Bt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ki(r){let t="";for(let e in r)r.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(r[e]));return t}function Qi(r){let t={},e=r.split("&");for(let i=0,s=e.length;i<s;i++){let n=e[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Dt=class extends Error{constructor(t,e,i){super(t),this.description=e,this.context=i,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,P(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,i){return super.emitReserved("error",new Dt(t,e,i)),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 e=dt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_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 e=Ki(t);return e.length?"?"+e:""}};var Z=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};$i(t,this.socket.binaryType).forEach(e),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,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Bt()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(t,e)}};var ji=!1;try{ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Ji=ji;function wr(){}var te=class extends Z{constructor(t){if(super(t),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,e){let i=this.request({method:"POST",data:t});i.on("success",e),i.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=t}},Mt=(()=>{class r extends u{constructor(e,i,s){super(),this.createRequest=e,P(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=Ut(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=wr,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xi);else if(typeof addEventListener=="function"){let r="onpagehide"in g?"pagehide":"unload";addEventListener(r,Xi,!1)}}function Xi(){for(let r in Mt.requests)Mt.requests.hasOwnProperty(r)&&Mt.requests[r].abort()}var br=(function(){let r=zi({xdomain:!1});return r&&r.responseType!==null})(),L=class extends te{constructor(t){super(t);let e=t&&t.forceBase64;this.supportsBinary=br&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mt(zi,this.uri(),t)}};function zi(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ji))return new XMLHttpRequest}catch{}if(!t)try{return new g[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Zi=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ie=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,i=Zi?{}:Ut(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,i)}catch(s){return this.emitReserved("error",s)}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 e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;pt(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}s&&N(()=>{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",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Bt()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}},ee=g.WebSocket||g.MozWebSocket,I=class extends ie{createSocket(t,e,i){return Zi?new ee(t,e,i):e?new ee(t,e):new ee(t)}doWrite(t,e){this.ws.send(e)}};var G=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 e=Gi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(e).getReader(),s=qi();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();let n=()=>{i.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 e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;this._writer.write(i).then(()=>{s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var re={websocket:I,webtransport:G,polling:L};var Ar=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tt(r){if(r.length>8e3)throw"URI too long";let t=r,e=r.indexOf("["),i=r.indexOf("]");e!=-1&&i!=-1&&(r=r.substring(0,e)+r.substring(e,i).replace(/:/g,";")+r.substring(i,r.length));let s=Ar.exec(r||""),n={},o=14;for(;o--;)n[Tr[o]]=s[o]||"";return e!=-1&&i!=-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=vr(n,n.path),n.queryKey=Cr(n,n.query),n}function vr(r,t){let e=/\/{2,9}/g,i=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Cr(r,t){let e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,n){s&&(e[s]=n)}),e}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Vt=[];se&&addEventListener("offline",()=>{Vt.forEach(r=>r())},!1);var Wt=(()=>{class r extends u{constructor(e,i){if(super(),this.binaryType=Hi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=tt(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=tt(i.host).host);P(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let n=s.prototype.name;this.transports.push(n),this._transportsByName[n]=s}),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},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Qi(this.opts.query)),se&&(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"})},Vt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=Zt,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(i+=Yi(n)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,n){if(typeof i=="function"&&(n=i,i=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let o={type:e,data:i,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){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(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=Vt.indexOf(this._offlineEventListener);s!==-1&&Vt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=Zt,r})(),$t=class extends Wt{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 e=this.createTransport(t),i=!1;Wt.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",U=>{if(!i)if(U.type==="pong"&&U.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Wt.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(b(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let rt=new Error("probe error");rt.transport=e.name,this.emitReserved("upgradeError",rt)}}))};function n(){i||(i=!0,b(),e.close(),e=null)}let o=U=>{let rt=new Error("probe error: "+U);rt.transport=e.name,n(),this.emitReserved("upgradeError",rt)};function a(){o("transport closed")}function c(){o("socket closed")}function R(U){e&&U.name!==e.name&&n()}let b=()=>{e.removeListener("open",s),e.removeListener("error",o),e.removeListener("close",a),this.off("close",c),this.off("upgrading",R)};e.once("open",s),e.once("error",o),e.once("close",a),this.once("close",c),this.once("upgrading",R),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&e.push(t[i]);return e}},et=class extends $t{constructor(t,e={}){let i=typeof t=="object"?t:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>re[s]).filter(s=>!!s)),super(t,i)}};var mt=class extends Z{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(e=>this.onData(e))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,e){this._fetch(t).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);e()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(t){var e;let i=t!==void 0,s=new Headers(this.opts.extraHeaders);return i&&s.set("content-type","text/plain;charset=UTF-8"),(e=this.socket._cookieJar)===null||e===void 0||e.appendCookies(s),fetch(this.uri(),{method:i?"POST":"GET",body:i?t:null,headers:s,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 Sn=et.protocol;function tr(r,t="",e){let i=r;e=e||typeof location<"u"&&location,r==null&&(r=e.protocol+"//"+e.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=e.protocol+r:r=e.host+r),/^(https?|wss?):\/\//.test(r)||(typeof e<"u"?r=e.protocol+"//"+r:r="https://"+r),i=tt(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(e&&e.port===i.port?"":":"+i.port),i}var le={};ye(le,{Decoder:()=>ce,Encoder:()=>ae,PacketType:()=>h,protocol:()=>ue});var Rr=typeof ArrayBuffer=="function",Or=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,er=Object.prototype.toString,kr=typeof Blob=="function"||typeof Blob<"u"&&er.call(Blob)==="[object BlobConstructor]",xr=typeof File=="function"||typeof File<"u"&&er.call(File)==="[object FileConstructor]";function gt(r){return Rr&&(r instanceof ArrayBuffer||Or(r))||kr&&r instanceof Blob||xr&&r instanceof File}function _t(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let e=0,i=r.length;e<i;e++)if(_t(r[e]))return!0;return!1}if(gt(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return _t(r.toJSON(),!0);for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&_t(r[e]))return!0;return!1}function ir(r){let t=[],e=r.data,i=r;return i.data=ne(e,t),i.attachments=t.length,{packet:i,buffers:t}}function ne(r,t){if(!r)return r;if(gt(r)){let e={_placeholder:!0,num:t.length};return t.push(r),e}else if(Array.isArray(r)){let e=new Array(r.length);for(let i=0;i<r.length;i++)e[i]=ne(r[i],t);return e}else if(typeof r=="object"&&!(r instanceof Date)){let e={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=ne(r[i],t));return e}return r}function rr(r,t){return r.data=oe(r.data,t),delete r.attachments,r}function oe(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=oe(r[e],t);else if(typeof r=="object")for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=oe(r[e],t));return r}var Nr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ue=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ae=class{constructor(t){this.replacer=t}encode(t){return(t.type===h.EVENT||t.type===h.ACK)&&_t(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 e=""+t.type;return(t.type===h.BINARY_EVENT||t.type===h.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e=ir(t),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}};function sr(r){return Object.prototype.toString.call(r)==="[object Object]"}var ce=class r extends u{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);let i=e.type===h.BINARY_EVENT;i||e.type===h.BINARY_ACK?(e.type=i?h.EVENT:h.ACK,this.reconstructor=new he(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(gt(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0,i={type:Number(t.charAt(0))};if(h[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===h.BINARY_EVENT||i.type===h.BINARY_ACK){let n=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);let o=t.substring(n,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(t.charAt(e+1)==="/"){let n=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););i.nsp=t.substring(n,e)}else i.nsp="/";let s=t.charAt(e+1);if(s!==""&&Number(s)==s){let n=e+1;for(;++e;){let o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}i.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){let n=this.tryParse(t.substr(e));if(r.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case h.CONNECT:return sr(e);case h.DISCONNECT:return e===void 0;case h.CONNECT_ERROR:return typeof e=="string"||sr(e);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Nr.indexOf(e[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},he=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 e=rr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function w(r,t,e){return r.on(t,e),function(){r.off(t,e)}}var Pr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),H=class extends u{constructor(t,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[w(t,"open",this.onopen.bind(this)),w(t,"packet",this.onpacket.bind(this)),w(t,"error",this.onerror.bind(this)),w(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,...e){var i,s,n;if(Pr.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:h.EVENT,data:e};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let b=this.ids++,U=e.pop();this._registerAckCallback(b,U),o.id=b}let a=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.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,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[t]=e;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);e.call(this,new Error("operation has timed out"))},s),o=(...a)=>{this.io.clearTimeoutFn(n),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((i,s)=>{let n=(o,a)=>o?s(o):i(a);n.withError=!0,e.push(n),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...n)=>i!==this._queue[0]?void 0:(s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){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,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.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 i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.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 e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:h.ACK,id:t,data:s}))}}onack(t){let e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type: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 e=this._anyListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,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 e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,t.data)}}};function Y(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Y.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-e:r+e}return Math.min(r,this.max)|0};Y.prototype.reset=function(){this.attempts=0};Y.prototype.setMin=function(r){this.ms=r};Y.prototype.setMax=function(r){this.max=r};Y.prototype.setJitter=function(r){this.jitter=r};var K=class extends u{constructor(t,e){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,P(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Y({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;let s=e.parser||le;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.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 e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.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 et(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=w(e,"open",function(){i.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=w(e,"error",n);if(this._timeout!==!1){let a=this._timeout,c=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),e.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),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(w(t,"ping",this.onping.bind(this)),w(t,"data",this.ondata.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this)),w(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new H(this,t,e),this.nsps[t]=i),i}_destroy(t){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let i=0;i<e.length;i++)this.engine.write(e[i],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,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var yt={};function Q(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let e=tr(r,t.path||"/socket.io"),i=e.source,s=e.id,n=e.path,o=yt[s]&&n in yt[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,c;return a?c=new K(i,t):(yt[s]||(yt[s]=new K(i,t)),c=yt[s]),e.query&&!t.query&&(t.query=e.queryKey),c.socket(e.path,t)}Object.assign(Q,{Manager:K,Socket:H,io:Q,connect:Q});var it=class r{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,e){this.config=t,this.appRef=e,t===void 0&&(t=this.emptyConfig);let i=t.url,s=t.options,n=Q?Q:pe;this.ioSocket=n(i,s)}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 e=this.namespaces[t];if(e)return e;let a=this.config,{url:i}=a,s=ge(a,["url"]),n=O({url:!i.endsWith("/")&&!t.startsWith("/")?`${i}/${t}`:`${i}${t}`},s),o=new r(n,this.appRef);return this.namespaces[t]=o,o}on(t,e){return this.ioSocket.on(t,e),this}once(t,e){return this.ioSocket.once(t,e),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...e){return this.ioSocket.emit(t,...e),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...e){return this.ioSocket.emitWithAck(t,...e)}removeListener(t,e){return this.ioSocket.removeListener(t,e),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 Se(e=>{let i=s=>{e.next(s),this.appRef.tick()};return this.ioSocket.on(t,i),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,i),delete this.eventObservables$[t])}}).pipe(Ae())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(e=>this.once(t,e))}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,e){return this.ioSocket.off(t,e),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 Fr(r,t){return new it(r,t)}var nr=new ve("__SOCKET_IO_CONFIG__"),uo=(()=>{class r{static forRoot(e){return{ngModule:r,providers:[{provide:nr,useValue:e},{provide:it,useFactory:Fr,deps:[nr,xe]}]}}static \u0275fac=function(i){return new(i||r)};static \u0275mod=Oe({type:r});static \u0275inj=Te({})}return r})();var fe={BASE:`${ai}/notifications`,UNREAD:"unread"},qt=fe.BASE;var d=(function(r){return r.ADD="add",r.UPDATE="update",r.DELETE="delete",r.DELETE_PERMANENTLY="deletePermanently",r})(d||{});var y=(function(r){return r.COMMENTS="comments",r.SPACES="spaces",r.SPACE_ROOTS="spaces_roots",r.SHARES="shares",r.LINKS="links",r.SYNC="sync",r.AUTH_LOCKED="auth_locked",r.AUTH_2FA="auth_2fa",r.UNLOCK_REQUEST="unlock_request",r.UPDATE_AVAILABLE="server_update_available",r})(y||{}),yo={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"},UNLOCK_REQUEST:"sends you a request to unlock the file",UPDATE_AVAILABLE:"A new update is available"};var or=ei;var ar={[y.COMMENTS]:or,[y.SPACES]:ct.SPACES,[y.SPACE_ROOTS]:ct.SPACES,[y.SHARES]:ct.SHARES,[y.LINKS]:ct.LINKS,[y.SYNC]:Ei.SYNC,[y.UNLOCK_REQUEST]:ti};var Gt=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=M(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Info",avatarUrl:null},this.appIcon=ar[this.content.app],this.setMainElement()}setMainElement(){if(!(this.content.app===y.COMMENTS||this.content.app===y.SHARES||this.content.app===y.UPDATE_AVAILABLE||this.content.app===y.SYNC)&&this.content?.url){let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}}};var cr=(()=>{let t=class t{constructor(){this.http=p(Tt),this.store=p(Pt),this.layout=p(z)}getNotifications(i=!1){return this.http.get(`${qt}${i?`/${fe.UNREAD}`:""}`).pipe(S(s=>s.map(n=>new Gt(n))))}wasReadNotification(i){return this.http.patch(`${qt}/${i}`,null)}deleteNotification(i){return this.http.delete(`${qt}${i?`/${i}`:""}`)}checkUnreadNotifications(i=!1){this.getNotifications().subscribe(s=>{let n;if(i&&s.length){let o=s[0];n=this.layout.sendNotification("info",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=s.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("info","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(be(1)).subscribe(()=>this.layout.showRSideBarTab(gi.NOTIFICATIONS,!0)),this.store.notifications.set(s)})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();var E=(function(r){return r.ACCESS="access",r.ACCESS_2FA="access_2fa",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r.CSRF_2FA="csrf_2fa",r})(E||{});var Yo="sync-in-csrf";var de=6;var hr="sync-in-two-fa-code",ur="sync-in-two-fa-password",Ko={[E.ACCESS]:"/",[E.REFRESH]:Ci,[E.WS]:Ri,[E.CSRF]:"/",[E.ACCESS_2FA]:ki,[E.CSRF_2FA]:"/"},Qo=[E.REFRESH,E.ACCESS,E.WS,E.CSRF],jo=[E.ACCESS_2FA,E.CSRF_2FA];var Ir=["Password"];function Ur(r,t){r&1&&(f(0,"label",1),A(1,"Password"),_())}function Br(r,t){if(r&1){let e=st();f(0,"div",5),B("click",function(){W(e);let s=D();return $(s.randomPassword())}),f(1,"span"),J(2,"fa-icon",6),_()()}if(r&2){let e=D();m(2),C("icon",e.icons.faDice)}}var lr=(()=>{let t=class t{constructor(){this.passwordChange=new Re,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Ot),this.toggleVisiblePassword=yi,this.icons={faEye:Ze,faEyeSlash:ri,faDice:si}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(mi(this.passwordMinLength+2))}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({type:t,selectors:[["app-input-password"]],viewQuery:function(s,n){if(s&1&&Ne(Ir,7),s&2){let o;Pe(o=Fe())&&(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(s,n){if(s&1){let o=st();k(0,Ur,2,0,"label",1),f(1,"div",2)(2,"input",3,0),Me(4,"translate"),De("ngModelChange",function(c){return W(o),Be(n.password,c)||(n.password=c),$(c)}),B("keyup",function(){return W(o),$(n.passwordChange.emit(n.password))}),_(),k(5,Br,3,1,"div",4),f(6,"div",5),B("click",function(){W(o);let c=Yt(3);return $(n.toggleVisiblePassword(c))}),f(7,"span"),J(8,"fa-icon",6),_()()()}if(s&2){let o=Yt(3);x(n.showLabel?0:-1),m(2),Le("padding-left",n.centered?"2rem":""),At("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),Ue("ngModel",n.password),C("disabled",n.disabled)("placeholder",Ve(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),x(n.showGenerator?5:-1),m(3),C("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[Je,vt,Ct,Ke,qe,Rt,Nt,kt,Xe],encapsulation:2});let r=t;return r})();var pr=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Ce)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(s){return new(s||t)},t.\u0275dir=ke({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let r=t;return r})();function Dr(r,t){r&1&&(f(0,"span",3),A(1,"Two-Factor Authentication"),_())}function Mr(r,t){r&1&&(f(0,"span",3),A(1,"Password Authentication"),_())}function Vr(r,t){if(r&1&&A(0),r&2){let e=D();Ie(" ",e.hasError," ")}}function Wr(r,t){r&1&&A(0," Enter your password ")}function $r(r,t){r&1&&A(0," Valid with your TOTP code ")}function qr(r,t){if(r&1){let e=st();f(0,"div",9)(1,"app-input-password",13),B("passwordChange",function(s){W(e);let n=D();return $(n.updatePassword(s))}),_()()}if(r&2){let e=D();m(),C("password",e.twoFaForm.value.password)("focus",!0)("centered",!0)}}function Gr(r,t){r&1&&(f(0,"div",14),A(1,"Valid with your TOTP code"),_())}function Hr(r,t){if(r&1&&(k(0,Gr,2,0,"div",14),f(1,"div",15),J(2,"input",16),_()),r&2){let e=D();x(e.withPassword?0:-1),m(2),C("autoFocus",!e.withPassword)("autoSelect",!e.withPassword)("maxlength",e.twoFaCodelength)}}var fr=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:ze,faLock:ii},this.twoFaCodelength=de,this.locale=p(Ot),this.fb=p(je),this.layout=p(z)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[nt.required,nt.pattern(new RegExp(`^\\d{${de}}$`))]:null),password:this.fb.control("",this.withPassword?[nt.required,nt.minLength(8)]:null)})}onClose(i=!1){this.isValid(i),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let i=new We(O(O({},this.withTwoFaEnabled?{[hr]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[ur]:this.twoFaForm.value.password}:{}));this.onClose(i)}updatePassword(i){this.twoFaForm.patchValue({password:i})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({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(s,n){s&1&&(f(0,"div",0)(1,"h4",1),J(2,"fa-icon",2),k(3,Dr,2,0,"span",3)(4,Mr,2,0,"span",3),_()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),k(9,Vr,1,1)(10,Wr,1,0)(11,$r,1,0),_(),f(12,"form",8),B("ngSubmit",function(){return n.onSubmit()}),k(13,qr,2,3,"div",9),k(14,Hr,3,4),f(15,"div",10)(16,"button",11),A(17,"Confirm"),_(),f(18,"button",12),B("click",function(){return n.onClose()}),A(19,"Cancel"),_()()()()()()),s&2&&(m(2),C("icon",n.icons.faLock),m(),x(n.withTwoFaEnabled?3:4),m(5),At("text-danger",n.hasError),m(),x(n.hasError?9:n.withPassword?10:11),m(3),C("formGroup",n.twoFaForm),m(),x(n.withPassword?13:-1),m(),x(n.withTwoFaEnabled?14:-1),m(2),C("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Nt,kt,pr,Rt,Ge,vt,Ct,$e,Qe,He,Ye,lr],encapsulation:2});let r=t;return r})();var Ht=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(e=>new T(e))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=M(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=oi(this.currentAccess).fromNow(!0),this.newly=at(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(e=>new T(e)))}};var St=class{constructor(t){this.setOnlineStatus(_i("status",t)),this.avatarUrl=M(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=ni[t]}};var oc=(()=>{let t=class t{constructor(){this.http=p(Tt),this.layout=p(z),this.store=p(Pt),this.webSocket=p(it),this.notifications=p(cr),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(vi.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USER).pipe(S(i=>new St(i))).subscribe(i=>this.newOnlineUser(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USERS).pipe(S(i=>i.map(s=>new St(s)))).subscribe(i=>this.setOnlineUsers(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_STATUS).subscribe(i=>this.receiveOnlineStatus(i))}get user(){return this.store.user.getValue()}initUser(i,s=!1){this.refreshAvatar(),this.layout.setLanguage(i.language).catch(console.error),this.store.userImpersonate.set(s||i.impersonated),this.store.user.next(i),this.checkQuota(this.store.user.getValue()),s&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(i){this.store.onlineUsers.set(i)}newOnlineUser(i){this.store.onlineUsers().find(s=>s.id===i.id)?this.receiveOnlineStatus({userId:i.id,status:i.onlineStatus}):this.store.onlineUsers.update(s=>[i,...s])}userHavePermission(i){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(i)!==-1:!1}browseGroup(i){return this.http.get(`${pi}${i?`/${i}`:""}`).pipe(S(s=>new Ht(s)))}createPersonalGroup(i){return this.http.post(q,i).pipe(S(s=>new T(s)))}updatePersonalGroup(i,s){return this.http.put(`${q}/${i}`,s).pipe(S(n=>new T(n)))}leavePersonalGroup(i){return this.http.delete(`${fi}/${i}`)}addUsersToGroup(i,s){return this.http.patch(`${q}/${i}/${ot.USERS}`,s)}deletePersonalGroup(i){return this.http.delete(`${q}/${i}`)}updateUserFromPersonalGroup(i,s,n){return this.http.patch(`${q}/${i}/${ot.USERS}/${s}`,n)}removeUserFromGroup(i,s){return this.http.delete(`${q}/${i}/${ot.USERS}/${s}`)}listGuests(){return this.http.get(X).pipe(S(i=>i.map(s=>new j(s))))}getGuest(i){return this.http.get(`${X}/${i}`).pipe(S(s=>new j(s)))}createGuest(i){return this.http.post(X,i).pipe(S(s=>new j(s)))}updateGuest(i,s){return this.http.put(`${X}/${i}`,s).pipe(S(n=>n?new j(n):null))}deleteGuest(i){return this.http.delete(`${X}/${i}`)}genAvatar(){this.http.patch(jt,null).subscribe({next:()=>this.refreshAvatar(),error:i=>this.layout.sendNotification("error","Configuration","Avatar",i)})}uploadAvatar(i){let s=new FormData;s.append("file",i),this.http.put(jt,s).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(i,s){return this.http.put(hi,i,{headers:s})}changeLanguage(i){return this.http.put(ci,i)}changeNotification(i){return this.http.put(ui,i)}changeStorageIndexing(i){return this.http.put(li,i)}changeOnlineStatus(i,s=!0){this.webSocket.emit(ht.EVENTS.ONLINE_STATUS,{status:i,store:s})}receiveOnlineStatus(i){this.user.id===i.userId?this.user.onlineStatus=i.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(s=>s.map(n=>n.id===i.userId?_e(O({},n),{onlineStatus:i.status}):n))}searchMembers(i,s=[]){return this.http.request("search",ot.BASE,{body:i}).pipe(S(n=>n.map(o=>new T(o,s))),we(()=>[]))}setMenusVisibility(i){for(let s of i)if(!(s.id&&(s.hide=!this.userHavePermission(s.id),s.hide))&&(s.checks?.length&&(s.hide=!s.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),s.submenus?.length&&this.setMenusVisibility(s.submenus),s.title===wi.FILES)){for(let n of s.submenus)if(!n.hide){s.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(Si())}checkAppStoreAvailability(){this.http.get(`${Qt.BASE}/${Qt.APP_STORE}`).subscribe({next:i=>this.store.appStoreManifest.set(i),error:i=>console.error(i)})}listAppPasswords(i){return this.http.get(xt,{headers:i})}generateAppPassword(i,s){return this.http.post(xt,i,{headers:s})}deleteAppPassword(i){return this.http.delete(`${xt}/${i}`)}init2Fa(){return this.http.get(Jt)}enable2Fa(i){return this.http.post(Jt,i)}disable2Fa(i){return this.http.post(Oi,i)}adminResetUser2Fa(i,s){return this.http.post(`${xi}/${i}`,null,{headers:s})}auth2FaVerifyDialog(i=!1){return Ee(this,null,function*(){let s=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(i||s)return new Promise(n=>{let o=this.layout.openDialog(fr,"xs",{initialState:{withPassword:i,withTwoFaEnabled:s}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(i){if(!(i.isGuest||i.isLink)&&i.storageQuota){let s=Math.round(100/i.storageQuota*(i.storageQuota-i.storageUsage));s<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):s<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0}):s<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();export{us as a,ls as b,Ci as c,ki as d,Yo as e,de as f,hr as g,ur as h,uo as i,y as j,cr as k,lr as l,pr as m,V as n,Ti as o,jr as p,Jr as q,Xr as r,T as s,os as t,Ht as u,j as v,oc as w};
1
+ import{$a as at,B as Kt,Ba as di,Cb as z,I as ni,Ma as mi,Mb as wi,Na as _i,Nb as ct,Pb as bi,Qb as Ai,Ua as gi,W as ai,X as Qt,_ as ot,aa as ci,ab as yi,ba as hi,ca as xt,da as ui,ea as li,fa as jt,ga as q,ha as pi,ia as fi,ja as X,qb as Ei,tb as M,ub as Si,vb as Pt}from"./chunk-I2S3XPC5.js";import{Aa as Ce,Bb as st,Bd as je,Cd as Je,Dd as Rt,Eb as B,Ed as Ot,Ef as ii,G as we,Gb as D,Jd as Xe,Kb as Ne,Kd as kt,L as be,Lb as Pe,Mb as Fe,Oa as m,Pb as Yt,Qa as Re,Qb as Le,Rb as At,Tb as A,Vb as Ie,Vc as We,W as Ae,Wf as ri,Xb as Ue,Yb as Be,Yc as Tt,Zb as De,ab as bt,bb as Oe,c as Se,cb as ke,ea as wt,fa as Te,fd as vt,ha as ve,hd as nt,he as ze,ie as Ze,ja as p,jb as xe,jd as Ct,kc as Me,kd as $e,lb as k,mb as x,mc as Ve,mg as si,oa as W,od as qe,og as Nt,pa as $,pd as Ge,rb as C,sb as f,sd as He,tb as _,td as Ye,ub as J,v as S,wf as ti,yd as Ke,yf as ei,zd as Qe}from"./chunk-IOIBQGHN.js";import{n as oi}from"./chunk-DM4NXKEP.js";import{a as O,b as _e,d as ge,e as ye,i as Ee}from"./chunk-KAVP6UXH.js";var V=(function(r){return r.USER="user",r.GUEST="guest",r.LINK="link",r.GROUP="group",r.PGROUP="personal group",r})(V||{});function Ti(r,t=[]){let e=O({},Object.fromEntries(Object.entries(Ai).filter(([i,s])=>t.indexOf(i)===-1)));if(!r)return e;for(let i of r.split(":"))i in e&&(e[i]=!0);return e}function jr(r,t,e=[]){let i={};if(!r)return i;for(let s of r.split(":"))e.indexOf(s)===-1&&(i[s]=t.indexOf(s)>-1);return i}function Jr(r,t=[]){let e={};if(!r)return e;for(let i of r.split(":"))t.indexOf(i)===-1&&(e[i]=bi[i]);return e}function Xr(r){return Object.entries(r).filter(([t,e])=>e).map(([t,e])=>t).join(":")}var T=class{constructor(t,e=[]){this.newly=0,this.linkSettings=null,Object.assign(this,t),this.mid=`${t.type[0]}${t.id}`,this.hPerms=Ti(t.permissions,e),t.login&&(this.avatarUrl=M(t.login)),this.isLink=!!this.linkId,this.isGuest=this.type===V.GUEST,this.isUser=this.isGuest||this.type===V.USER&&!this.isLink,this.isGroup=this.type===V.GROUP||this.type===V.PGROUP,this.isPersonalGroup=this.type===V.PGROUP,this.setGroupRole(),this.modifiedAt?this.newly=at(this.modifiedAt):this.createdAt&&(this.newly=at(this.createdAt))}setGroupRole(t){typeof t<"u"&&(this.groupRole=t),this.isGroupManager=this.groupRole===Kt.MANAGER}};function os(r,t,e){return new T({id:r.id,login:r.login,name:r.fullName,description:r.email,type:V.USER,spaceRole:t||di.IS_MEMBER,groupRole:e||Kt.MEMBER,permissions:""})}var vi={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var ht={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r.TWO_FA_BASE="2fa",r.TWO_FA_ENABLE="enable",r.TWO_FA_DISABLE="disable",r.TWO_FA_LOGIN_VERIFY="login/verify",r.TWO_FA_ADMIN_RESET_USER="reset/user",r})(l||{}),us=`${l.BASE}/${l.LOGIN}`,ls=`${l.BASE}/${l.LOGOUT}`,Ci=`${l.BASE}/${l.REFRESH}`,ps=`${l.BASE}/${l.TOKEN}`,fs=`${l.BASE}/${l.TOKEN_REFRESH}`,Ri=`/${l.WS}`,Jt=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,Oi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,ki=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var pe={};ye(pe,{Fetch:()=>mt,Manager:()=>K,NodeWebSocket:()=>I,NodeXHR:()=>L,Socket:()=>H,WebSocket:()=>I,WebTransport:()=>G,XHR:()=>L,connect:()=>Q,default:()=>Q,io:()=>Q,protocol:()=>ue});var v=Object.create(null);v.open="0";v.close="1";v.ping="2";v.pong="3";v.message="4";v.upgrade="5";v.noop="6";var ut=Object.create(null);Object.keys(v).forEach(r=>{ut[v[r]]=r});var lt={type:"error",data:"parser error"};var Fi=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Li=typeof ArrayBuffer=="function",Ii=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,pt=({type:r,data:t},e,i)=>Fi&&t instanceof Blob?e?i(t):Ni(t,i):Li&&(t instanceof ArrayBuffer||Ii(t))?e?i(t):Ni(new Blob([t]),i):i(v[r]+(t||"")),Ni=(r,t)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];t("b"+(i||""))},e.readAsDataURL(r)};function Pi(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var Xt;function Ui(r,t){if(Fi&&r.data instanceof Blob)return r.data.arrayBuffer().then(Pi).then(t);if(Li&&(r.data instanceof ArrayBuffer||Ii(r.data)))return t(Pi(r.data));pt(r,!1,e=>{Xt||(Xt=new TextEncoder),t(Xt.encode(e))})}var Bi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ft=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Bi.length;r++)ft[Bi.charCodeAt(r)]=r;var Di=r=>{let t=r.length*.75,e=r.length,i,s=0,n,o,a,c;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);let R=new ArrayBuffer(t),b=new Uint8Array(R);for(i=0;i<e;i+=4)n=ft[r.charCodeAt(i)],o=ft[r.charCodeAt(i+1)],a=ft[r.charCodeAt(i+2)],c=ft[r.charCodeAt(i+3)],b[s++]=n<<2|o>>4,b[s++]=(o&15)<<4|a>>2,b[s++]=(a&3)<<6|c&63;return R};var dr=typeof ArrayBuffer=="function",dt=(r,t)=>{if(typeof r!="string")return{type:"message",data:Mi(r,t)};let e=r.charAt(0);return e==="b"?{type:"message",data:mr(r.substring(1),t)}:ut[e]?r.length>1?{type:ut[e],data:r.substring(1)}:{type:ut[e]}:lt},mr=(r,t)=>{if(dr){let e=Di(r);return Mi(e,t)}else return{base64:!0,data:r}},Mi=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var Vi="",Wi=(r,t)=>{let e=r.length,i=new Array(e),s=0;r.forEach((n,o)=>{pt(n,!1,a=>{i[o]=a,++s===e&&t(i.join(Vi))})})},$i=(r,t)=>{let e=r.split(Vi),i=[];for(let s=0;s<e.length;s++){let n=dt(e[s],t);if(i.push(n),n.type==="error")break}return i};function qi(){return new TransformStream({transform(r,t){Ui(r,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(e)})}})}var zt;function Lt(r){return r.reduce((t,e)=>t+e.length,0)}function It(r,t){if(r[0].length===t)return r.shift();let e=new Uint8Array(t),i=0;for(let s=0;s<t;s++)e[s]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),e}function Gi(r,t){zt||(zt=new TextDecoder);let e=[],i=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(e.push(o);;){if(i===0){if(Lt(e)<1)break;let c=It(e,1);n=(c[0]&128)===128,s=c[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(Lt(e)<2)break;let c=It(e,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),i=3}else if(i===2){if(Lt(e)<8)break;let c=It(e,8),R=new DataView(c.buffer,c.byteOffset,c.length),b=R.getUint32(0);if(b>Math.pow(2,21)-1){a.enqueue(lt);break}s=b*Math.pow(2,32)+R.getUint32(4),i=3}else{if(Lt(e)<s)break;let c=It(e,s);a.enqueue(dt(n?c:zt.decode(c),t)),i=0}if(s===0||s>r){a.enqueue(lt);break}}}})}var Zt=4;function u(r){if(r)return _r(r)}function _r(r){for(var t in u.prototype)r[t]=u.prototype[t];return r}u.prototype.on=u.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};u.prototype.once=function(r,t){function e(){this.off(r,e),t.apply(this,arguments)}return e.fn=t,this.on(r,e),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+r];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===t||i.fn===t){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+r],this};u.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};u.prototype.hasListeners=function(r){return!!this.listeners(r).length};var N=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0),g=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Hi="arraybuffer";function Ut(r,...t){return t.reduce((e,i)=>(r.hasOwnProperty(i)&&(e[i]=r[i]),e),{})}var gr=g.setTimeout,yr=g.clearTimeout;function P(r,t){t.useNativeTimers?(r.setTimeoutFn=gr.bind(g),r.clearTimeoutFn=yr.bind(g)):(r.setTimeoutFn=g.setTimeout.bind(g),r.clearTimeoutFn=g.clearTimeout.bind(g))}var Er=1.33;function Yi(r){return typeof r=="string"?Sr(r):Math.ceil((r.byteLength||r.size)*Er)}function Sr(r){let t=0,e=0;for(let i=0,s=r.length;i<s;i++)t=r.charCodeAt(i),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(i++,e+=4);return e}function Bt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ki(r){let t="";for(let e in r)r.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(r[e]));return t}function Qi(r){let t={},e=r.split("&");for(let i=0,s=e.length;i<s;i++){let n=e[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Dt=class extends Error{constructor(t,e,i){super(t),this.description=e,this.context=i,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,P(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,i){return super.emitReserved("error",new Dt(t,e,i)),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 e=dt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_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 e=Ki(t);return e.length?"?"+e:""}};var Z=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};$i(t,this.socket.binaryType).forEach(e),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,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Bt()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(t,e)}};var ji=!1;try{ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Ji=ji;function wr(){}var te=class extends Z{constructor(t){if(super(t),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,e){let i=this.request({method:"POST",data:t});i.on("success",e),i.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=t}},Mt=(()=>{class r extends u{constructor(e,i,s){super(),this.createRequest=e,P(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=Ut(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=wr,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Xi);else if(typeof addEventListener=="function"){let r="onpagehide"in g?"pagehide":"unload";addEventListener(r,Xi,!1)}}function Xi(){for(let r in Mt.requests)Mt.requests.hasOwnProperty(r)&&Mt.requests[r].abort()}var br=(function(){let r=zi({xdomain:!1});return r&&r.responseType!==null})(),L=class extends te{constructor(t){super(t);let e=t&&t.forceBase64;this.supportsBinary=br&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mt(zi,this.uri(),t)}};function zi(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ji))return new XMLHttpRequest}catch{}if(!t)try{return new g[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var Zi=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ie=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,i=Zi?{}:Ut(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,i)}catch(s){return this.emitReserved("error",s)}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 e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;pt(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}s&&N(()=>{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",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Bt()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}},ee=g.WebSocket||g.MozWebSocket,I=class extends ie{createSocket(t,e,i){return Zi?new ee(t,e,i):e?new ee(t,e):new ee(t)}doWrite(t,e){this.ws.send(e)}};var G=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 e=Gi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(e).getReader(),s=qi();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();let n=()=>{i.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 e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;this._writer.write(i).then(()=>{s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var re={websocket:I,webtransport:G,polling:L};var Ar=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Tr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tt(r){if(r.length>8e3)throw"URI too long";let t=r,e=r.indexOf("["),i=r.indexOf("]");e!=-1&&i!=-1&&(r=r.substring(0,e)+r.substring(e,i).replace(/:/g,";")+r.substring(i,r.length));let s=Ar.exec(r||""),n={},o=14;for(;o--;)n[Tr[o]]=s[o]||"";return e!=-1&&i!=-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=vr(n,n.path),n.queryKey=Cr(n,n.query),n}function vr(r,t){let e=/\/{2,9}/g,i=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Cr(r,t){let e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,n){s&&(e[s]=n)}),e}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Vt=[];se&&addEventListener("offline",()=>{Vt.forEach(r=>r())},!1);var Wt=(()=>{class r extends u{constructor(e,i){if(super(),this.binaryType=Hi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=tt(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=tt(i.host).host);P(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let n=s.prototype.name;this.transports.push(n),this._transportsByName[n]=s}),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},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Qi(this.opts.query)),se&&(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"})},Vt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=Zt,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(i+=Yi(n)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,n){if(typeof i=="function"&&(n=i,i=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let o={type:e,data:i,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){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(),se&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=Vt.indexOf(this._offlineEventListener);s!==-1&&Vt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=Zt,r})(),$t=class extends Wt{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 e=this.createTransport(t),i=!1;Wt.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",U=>{if(!i)if(U.type==="pong"&&U.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Wt.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(b(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let rt=new Error("probe error");rt.transport=e.name,this.emitReserved("upgradeError",rt)}}))};function n(){i||(i=!0,b(),e.close(),e=null)}let o=U=>{let rt=new Error("probe error: "+U);rt.transport=e.name,n(),this.emitReserved("upgradeError",rt)};function a(){o("transport closed")}function c(){o("socket closed")}function R(U){e&&U.name!==e.name&&n()}let b=()=>{e.removeListener("open",s),e.removeListener("error",o),e.removeListener("close",a),this.off("close",c),this.off("upgrading",R)};e.once("open",s),e.once("error",o),e.once("close",a),this.once("close",c),this.once("upgrading",R),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&e.push(t[i]);return e}},et=class extends $t{constructor(t,e={}){let i=typeof t=="object"?t:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>re[s]).filter(s=>!!s)),super(t,i)}};var mt=class extends Z{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(e=>this.onData(e))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,e){this._fetch(t).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);e()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(t){var e;let i=t!==void 0,s=new Headers(this.opts.extraHeaders);return i&&s.set("content-type","text/plain;charset=UTF-8"),(e=this.socket._cookieJar)===null||e===void 0||e.appendCookies(s),fetch(this.uri(),{method:i?"POST":"GET",body:i?t:null,headers:s,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 Sn=et.protocol;function tr(r,t="",e){let i=r;e=e||typeof location<"u"&&location,r==null&&(r=e.protocol+"//"+e.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=e.protocol+r:r=e.host+r),/^(https?|wss?):\/\//.test(r)||(typeof e<"u"?r=e.protocol+"//"+r:r="https://"+r),i=tt(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(e&&e.port===i.port?"":":"+i.port),i}var le={};ye(le,{Decoder:()=>ce,Encoder:()=>ae,PacketType:()=>h,protocol:()=>ue});var Rr=typeof ArrayBuffer=="function",Or=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,er=Object.prototype.toString,kr=typeof Blob=="function"||typeof Blob<"u"&&er.call(Blob)==="[object BlobConstructor]",xr=typeof File=="function"||typeof File<"u"&&er.call(File)==="[object FileConstructor]";function gt(r){return Rr&&(r instanceof ArrayBuffer||Or(r))||kr&&r instanceof Blob||xr&&r instanceof File}function _t(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let e=0,i=r.length;e<i;e++)if(_t(r[e]))return!0;return!1}if(gt(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return _t(r.toJSON(),!0);for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&_t(r[e]))return!0;return!1}function ir(r){let t=[],e=r.data,i=r;return i.data=ne(e,t),i.attachments=t.length,{packet:i,buffers:t}}function ne(r,t){if(!r)return r;if(gt(r)){let e={_placeholder:!0,num:t.length};return t.push(r),e}else if(Array.isArray(r)){let e=new Array(r.length);for(let i=0;i<r.length;i++)e[i]=ne(r[i],t);return e}else if(typeof r=="object"&&!(r instanceof Date)){let e={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=ne(r[i],t));return e}return r}function rr(r,t){return r.data=oe(r.data,t),delete r.attachments,r}function oe(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=oe(r[e],t);else if(typeof r=="object")for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=oe(r[e],t));return r}var Nr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ue=5,h=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(h||{}),ae=class{constructor(t){this.replacer=t}encode(t){return(t.type===h.EVENT||t.type===h.ACK)&&_t(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 e=""+t.type;return(t.type===h.BINARY_EVENT||t.type===h.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e=ir(t),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}};function sr(r){return Object.prototype.toString.call(r)==="[object Object]"}var ce=class r extends u{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);let i=e.type===h.BINARY_EVENT;i||e.type===h.BINARY_ACK?(e.type=i?h.EVENT:h.ACK,this.reconstructor=new he(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(gt(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0,i={type:Number(t.charAt(0))};if(h[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===h.BINARY_EVENT||i.type===h.BINARY_ACK){let n=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);let o=t.substring(n,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(t.charAt(e+1)==="/"){let n=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););i.nsp=t.substring(n,e)}else i.nsp="/";let s=t.charAt(e+1);if(s!==""&&Number(s)==s){let n=e+1;for(;++e;){let o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}i.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){let n=this.tryParse(t.substr(e));if(r.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case h.CONNECT:return sr(e);case h.DISCONNECT:return e===void 0;case h.CONNECT_ERROR:return typeof e=="string"||sr(e);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Nr.indexOf(e[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},he=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 e=rr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function w(r,t,e){return r.on(t,e),function(){r.off(t,e)}}var Pr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),H=class extends u{constructor(t,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[w(t,"open",this.onopen.bind(this)),w(t,"packet",this.onpacket.bind(this)),w(t,"error",this.onerror.bind(this)),w(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,...e){var i,s,n;if(Pr.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:h.EVENT,data:e};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let b=this.ids++,U=e.pop();this._registerAckCallback(b,U),o.id=b}let a=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.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,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[t]=e;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);e.call(this,new Error("operation has timed out"))},s),o=(...a)=>{this.io.clearTimeoutFn(n),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((i,s)=>{let n=(o,a)=>o?s(o):i(a);n.withError=!0,e.push(n),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...n)=>i!==this._queue[0]?void 0:(s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){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,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.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 i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.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 e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:h.ACK,id:t,data:s}))}}onack(t){let e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type: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 e=this._anyListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,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 e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,t.data)}}};function Y(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Y.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-e:r+e}return Math.min(r,this.max)|0};Y.prototype.reset=function(){this.attempts=0};Y.prototype.setMin=function(r){this.ms=r};Y.prototype.setMax=function(r){this.max=r};Y.prototype.setJitter=function(r){this.jitter=r};var K=class extends u{constructor(t,e){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,P(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Y({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;let s=e.parser||le;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.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 e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.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 et(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=w(e,"open",function(){i.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=w(e,"error",n);if(this._timeout!==!1){let a=this._timeout,c=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),e.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),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(w(t,"ping",this.onping.bind(this)),w(t,"data",this.ondata.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this)),w(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new H(this,t,e),this.nsps[t]=i),i}_destroy(t){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let i=0;i<e.length;i++)this.engine.write(e[i],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,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var yt={};function Q(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let e=tr(r,t.path||"/socket.io"),i=e.source,s=e.id,n=e.path,o=yt[s]&&n in yt[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,c;return a?c=new K(i,t):(yt[s]||(yt[s]=new K(i,t)),c=yt[s]),e.query&&!t.query&&(t.query=e.queryKey),c.socket(e.path,t)}Object.assign(Q,{Manager:K,Socket:H,io:Q,connect:Q});var it=class r{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,e){this.config=t,this.appRef=e,t===void 0&&(t=this.emptyConfig);let i=t.url,s=t.options,n=Q?Q:pe;this.ioSocket=n(i,s)}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 e=this.namespaces[t];if(e)return e;let a=this.config,{url:i}=a,s=ge(a,["url"]),n=O({url:!i.endsWith("/")&&!t.startsWith("/")?`${i}/${t}`:`${i}${t}`},s),o=new r(n,this.appRef);return this.namespaces[t]=o,o}on(t,e){return this.ioSocket.on(t,e),this}once(t,e){return this.ioSocket.once(t,e),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...e){return this.ioSocket.emit(t,...e),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...e){return this.ioSocket.emitWithAck(t,...e)}removeListener(t,e){return this.ioSocket.removeListener(t,e),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 Se(e=>{let i=s=>{e.next(s),this.appRef.tick()};return this.ioSocket.on(t,i),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,i),delete this.eventObservables$[t])}}).pipe(Ae())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(e=>this.once(t,e))}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,e){return this.ioSocket.off(t,e),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 Fr(r,t){return new it(r,t)}var nr=new ve("__SOCKET_IO_CONFIG__"),uo=(()=>{class r{static forRoot(e){return{ngModule:r,providers:[{provide:nr,useValue:e},{provide:it,useFactory:Fr,deps:[nr,xe]}]}}static \u0275fac=function(i){return new(i||r)};static \u0275mod=Oe({type:r});static \u0275inj=Te({})}return r})();var fe={BASE:`${ai}/notifications`,UNREAD:"unread"},qt=fe.BASE;var d=(function(r){return r.ADD="add",r.UPDATE="update",r.DELETE="delete",r.DELETE_PERMANENTLY="deletePermanently",r})(d||{});var y=(function(r){return r.COMMENTS="comments",r.SPACES="spaces",r.SPACE_ROOTS="spaces_roots",r.SHARES="shares",r.LINKS="links",r.SYNC="sync",r.AUTH_LOCKED="auth_locked",r.AUTH_2FA="auth_2fa",r.UNLOCK_REQUEST="unlock_request",r.UPDATE_AVAILABLE="server_update_available",r})(y||{}),yo={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"},UNLOCK_REQUEST:"sends you a request to unlock the file",UPDATE_AVAILABLE:"A new update is available"};var or=ei;var ar={[y.COMMENTS]:or,[y.SPACES]:ct.SPACES,[y.SPACE_ROOTS]:ct.SPACES,[y.SHARES]:ct.SHARES,[y.LINKS]:ct.LINKS,[y.SYNC]:Ei.SYNC,[y.UNLOCK_REQUEST]:ti};var Gt=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=M(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Info",avatarUrl:null},this.appIcon=ar[this.content.app],this.setMainElement()}setMainElement(){if(!(this.content.app===y.COMMENTS||this.content.app===y.SHARES||this.content.app===y.UPDATE_AVAILABLE||this.content.app===y.SYNC)&&this.content?.url){let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}}};var cr=(()=>{let t=class t{constructor(){this.http=p(Tt),this.store=p(Pt),this.layout=p(z)}getNotifications(i=!1){return this.http.get(`${qt}${i?`/${fe.UNREAD}`:""}`).pipe(S(s=>s.map(n=>new Gt(n))))}wasReadNotification(i){return this.http.patch(`${qt}/${i}`,null)}deleteNotification(i){return this.http.delete(`${qt}${i?`/${i}`:""}`)}checkUnreadNotifications(i=!1){this.getNotifications().subscribe(s=>{let n;if(i&&s.length){let o=s[0];n=this.layout.sendNotification("info",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=s.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("info","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(be(1)).subscribe(()=>this.layout.showRSideBarTab(gi.NOTIFICATIONS,!0)),this.store.notifications.set(s)})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();var E=(function(r){return r.ACCESS="access",r.ACCESS_2FA="access_2fa",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r.CSRF_2FA="csrf_2fa",r})(E||{});var Yo="sync-in-csrf";var de=6;var hr="sync-in-two-fa-code",ur="sync-in-two-fa-password",Ko={[E.ACCESS]:"/",[E.REFRESH]:Ci,[E.WS]:Ri,[E.CSRF]:"/",[E.ACCESS_2FA]:ki,[E.CSRF_2FA]:"/"},Qo=[E.REFRESH,E.ACCESS,E.WS,E.CSRF],jo=[E.ACCESS_2FA,E.CSRF_2FA];var Ir=["Password"];function Ur(r,t){r&1&&(f(0,"label",1),A(1,"Password"),_())}function Br(r,t){if(r&1){let e=st();f(0,"div",5),B("click",function(){W(e);let s=D();return $(s.randomPassword())}),f(1,"span"),J(2,"fa-icon",6),_()()}if(r&2){let e=D();m(2),C("icon",e.icons.faDice)}}var lr=(()=>{let t=class t{constructor(){this.passwordChange=new Re,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Ot),this.toggleVisiblePassword=yi,this.icons={faEye:Ze,faEyeSlash:ri,faDice:si}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(mi(this.passwordMinLength+2))}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({type:t,selectors:[["app-input-password"]],viewQuery:function(s,n){if(s&1&&Ne(Ir,7),s&2){let o;Pe(o=Fe())&&(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(s,n){if(s&1){let o=st();k(0,Ur,2,0,"label",1),f(1,"div",2)(2,"input",3,0),Me(4,"translate"),De("ngModelChange",function(c){return W(o),Be(n.password,c)||(n.password=c),$(c)}),B("keyup",function(){return W(o),$(n.passwordChange.emit(n.password))}),_(),k(5,Br,3,1,"div",4),f(6,"div",5),B("click",function(){W(o);let c=Yt(3);return $(n.toggleVisiblePassword(c))}),f(7,"span"),J(8,"fa-icon",6),_()()()}if(s&2){let o=Yt(3);x(n.showLabel?0:-1),m(2),Le("padding-left",n.centered?"2rem":""),At("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),Ue("ngModel",n.password),C("disabled",n.disabled)("placeholder",Ve(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),x(n.showGenerator?5:-1),m(3),C("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[Je,vt,Ct,Ke,qe,Rt,Nt,kt,Xe],encapsulation:2});let r=t;return r})();var pr=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Ce)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(s){return new(s||t)},t.\u0275dir=ke({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let r=t;return r})();function Dr(r,t){r&1&&(f(0,"span",3),A(1,"Two-Factor Authentication"),_())}function Mr(r,t){r&1&&(f(0,"span",3),A(1,"Password Authentication"),_())}function Vr(r,t){if(r&1&&A(0),r&2){let e=D();Ie(" ",e.hasError," ")}}function Wr(r,t){r&1&&A(0," Enter your password ")}function $r(r,t){r&1&&A(0," Valid with your TOTP code ")}function qr(r,t){if(r&1){let e=st();f(0,"div",9)(1,"app-input-password",13),B("passwordChange",function(s){W(e);let n=D();return $(n.updatePassword(s))}),_()()}if(r&2){let e=D();m(),C("password",e.twoFaForm.value.password)("focus",!0)("centered",!0)}}function Gr(r,t){r&1&&(f(0,"div",14),A(1,"Valid with your TOTP code"),_())}function Hr(r,t){if(r&1&&(k(0,Gr,2,0,"div",14),f(1,"div",15),J(2,"input",16),_()),r&2){let e=D();x(e.withPassword?0:-1),m(2),C("autoFocus",!e.withPassword)("autoSelect",!e.withPassword)("maxlength",e.twoFaCodelength)}}var fr=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:ze,faLock:ii},this.twoFaCodelength=de,this.locale=p(Ot),this.fb=p(je),this.layout=p(z)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[nt.required,nt.pattern(new RegExp(`^\\d{${de}}$`))]:null),password:this.fb.control("",this.withPassword?[nt.required,nt.minLength(8)]:null)})}onClose(i=!1){this.isValid(i),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let i=new We(O(O({},this.withTwoFaEnabled?{[hr]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[ur]:this.twoFaForm.value.password}:{}));this.onClose(i)}updatePassword(i){this.twoFaForm.patchValue({password:i})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=bt({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(s,n){s&1&&(f(0,"div",0)(1,"h4",1),J(2,"fa-icon",2),k(3,Dr,2,0,"span",3)(4,Mr,2,0,"span",3),_()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),k(9,Vr,1,1)(10,Wr,1,0)(11,$r,1,0),_(),f(12,"form",8),B("ngSubmit",function(){return n.onSubmit()}),k(13,qr,2,3,"div",9),k(14,Hr,3,4),f(15,"div",10)(16,"button",11),A(17,"Confirm"),_(),f(18,"button",12),B("click",function(){return n.onClose()}),A(19,"Cancel"),_()()()()()()),s&2&&(m(2),C("icon",n.icons.faLock),m(),x(n.withTwoFaEnabled?3:4),m(5),At("text-danger",n.hasError),m(),x(n.hasError?9:n.withPassword?10:11),m(3),C("formGroup",n.twoFaForm),m(),x(n.withPassword?13:-1),m(),x(n.withTwoFaEnabled?14:-1),m(2),C("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Nt,kt,pr,Rt,Ge,vt,Ct,$e,Qe,He,Ye,lr],encapsulation:2});let r=t;return r})();var Ht=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(e=>new T(e))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=M(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=oi(this.currentAccess).fromNow(!0),this.newly=at(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(e=>new T(e)))}};var St=class{constructor(t){this.setOnlineStatus(_i("status",t)),this.avatarUrl=M(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=ni[t]}};var oc=(()=>{let t=class t{constructor(){this.http=p(Tt),this.layout=p(z),this.store=p(Pt),this.webSocket=p(it),this.notifications=p(cr),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(vi.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USER).pipe(S(i=>new St(i))).subscribe(i=>this.newOnlineUser(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USERS).pipe(S(i=>i.map(s=>new St(s)))).subscribe(i=>this.setOnlineUsers(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_STATUS).subscribe(i=>this.receiveOnlineStatus(i))}get user(){return this.store.user.getValue()}initUser(i,s=!1){this.refreshAvatar(),this.layout.setLanguage(i.language).catch(console.error),this.store.userImpersonate.set(s||i.impersonated),this.store.user.next(i),this.checkQuota(this.store.user.getValue()),s&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(i){this.store.onlineUsers.set(i)}newOnlineUser(i){this.store.onlineUsers().find(s=>s.id===i.id)?this.receiveOnlineStatus({userId:i.id,status:i.onlineStatus}):this.store.onlineUsers.update(s=>[i,...s])}userHavePermission(i){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(i)!==-1:!1}browseGroup(i){return this.http.get(`${pi}${i?`/${i}`:""}`).pipe(S(s=>new Ht(s)))}createPersonalGroup(i){return this.http.post(q,i).pipe(S(s=>new T(s)))}updatePersonalGroup(i,s){return this.http.put(`${q}/${i}`,s).pipe(S(n=>new T(n)))}leavePersonalGroup(i){return this.http.delete(`${fi}/${i}`)}addUsersToGroup(i,s){return this.http.patch(`${q}/${i}/${ot.USERS}`,s)}deletePersonalGroup(i){return this.http.delete(`${q}/${i}`)}updateUserFromPersonalGroup(i,s,n){return this.http.patch(`${q}/${i}/${ot.USERS}/${s}`,n)}removeUserFromGroup(i,s){return this.http.delete(`${q}/${i}/${ot.USERS}/${s}`)}listGuests(){return this.http.get(X).pipe(S(i=>i.map(s=>new j(s))))}getGuest(i){return this.http.get(`${X}/${i}`).pipe(S(s=>new j(s)))}createGuest(i){return this.http.post(X,i).pipe(S(s=>new j(s)))}updateGuest(i,s){return this.http.put(`${X}/${i}`,s).pipe(S(n=>n?new j(n):null))}deleteGuest(i){return this.http.delete(`${X}/${i}`)}genAvatar(){this.http.patch(jt,null).subscribe({next:()=>this.refreshAvatar(),error:i=>this.layout.sendNotification("error","Configuration","Avatar",i)})}uploadAvatar(i){let s=new FormData;s.append("file",i),this.http.put(jt,s).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(i,s){return this.http.put(hi,i,{headers:s})}changeLanguage(i){return this.http.put(ci,i)}changeNotification(i){return this.http.put(ui,i)}changeStorageIndexing(i){return this.http.put(li,i)}changeOnlineStatus(i,s=!0){this.webSocket.emit(ht.EVENTS.ONLINE_STATUS,{status:i,store:s})}receiveOnlineStatus(i){this.user.id===i.userId?this.user.onlineStatus=i.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(s=>s.map(n=>n.id===i.userId?_e(O({},n),{onlineStatus:i.status}):n))}searchMembers(i,s=[]){return this.http.request("search",ot.BASE,{body:i}).pipe(S(n=>n.map(o=>new T(o,s))),we(()=>[]))}setMenusVisibility(i){for(let s of i)if(!(s.id&&(s.hide=!this.userHavePermission(s.id),s.hide))&&(s.checks?.length&&(s.hide=!s.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),s.submenus?.length&&this.setMenusVisibility(s.submenus),s.title===wi.FILES)){for(let n of s.submenus)if(!n.hide){s.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(Si())}checkAppStoreAvailability(){this.http.get(`${Qt.BASE}/${Qt.APP_STORE}`).subscribe({next:i=>this.store.appStoreManifest.set(i),error:i=>console.error(i)})}listAppPasswords(i){return this.http.get(xt,{headers:i})}generateAppPassword(i,s){return this.http.post(xt,i,{headers:s})}deleteAppPassword(i){return this.http.delete(`${xt}/${i}`)}init2Fa(){return this.http.get(Jt)}enable2Fa(i){return this.http.post(Jt,i)}disable2Fa(i){return this.http.post(Oi,i)}adminResetUser2Fa(i,s){return this.http.post(`${xi}/${i}`,null,{headers:s})}auth2FaVerifyDialog(i=!1){return Ee(this,null,function*(){let s=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(i||s)return new Promise(n=>{let o=this.layout.openDialog(fr,"xs",{initialState:{withPassword:i,withTwoFaEnabled:s}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(i){if(!(i.isGuest||i.isLink)&&i.storageQuota){let s=Math.round(100/i.storageQuota*(i.storageQuota-i.storageUsage));s<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):s<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0}):s<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();export{us as a,ls as b,Ci as c,ki as d,Yo as e,de as f,hr as g,ur as h,uo as i,y as j,cr as k,lr as l,pr as m,V as n,Ti as o,jr as p,Jr as q,Xr as r,T as s,os as t,Ht as u,j as v,oc as w};
@@ -1 +1 @@
1
- import{b as nt}from"./chunk-LJSVNPPQ.js";import{a as it}from"./chunk-NMF2ZFBE.js";import{a as Z,f as tt,h as et}from"./chunk-2XPHUNYN.js";import{a as K,b as Q}from"./chunk-XCLK7NJL.js";import{Cb as q,vb as z}from"./chunk-5HNQLBSW.js";import{Bb as f,Cd as B,Eb as m,Ed as G,Gb as p,Jd as U,Kd as $,Ld as j,Oa as e,Qa as v,Sb as I,Tb as l,Ub as A,Vb as w,Xb as E,Yb as C,Zb as b,ab as L,cc as x,fd as k,ja as S,jd as H,kc as F,lb as g,mb as P,mc as R,nb as Y,oa as u,od as M,og as J,pa as y,pb as D,qb as N,rb as r,sb as i,tb as n,ub as T,ud as O,vd as V,vf as X,wd as W}from"./chunk-IOIBQGHN.js";function ot(a,h){if(a&1&&(i(0,"option",13),l(1,"Select a file"),n(),i(2,"option",13),l(3,"Select a folder"),n()),a&2){let c=p();r("value",c.SYNC_PATH_FILTER_TYPE.FILE),e(2),r("value",c.SYNC_PATH_FILTER_TYPE.FOLDER)}}function st(a,h){if(a&1){let c=f();i(0,"button",24),m("click",function(){u(c);let s=p();return y(s.onSelect())}),l(1,"Browse"),n()}}function rt(a,h){if(a&1){let c=f();i(0,"button",24),m("click",function(){u(c);let s=p();return y(s.onSelect(s.ELECTRON_DIALOG.DIRECTORY))}),l(1,"Browse"),n()}}function at(a,h){if(a&1){let c=f();i(0,"div",18)(1,"input",25),b("ngModelChange",function(s){let t=u(c).$index,d=p();return C(d.syncPath.settings.filters[t],s)||(d.syncPath.settings.filters[t]=s),y(s)}),n(),i(2,"button",26),m("click",function(){let s=u(c).$index,t=p();return y(t.onRemoveFilter(s))}),T(3,"fa-icon",2),n()()}if(a&2){let c=h.$index,o=p();e(),E("ngModel",o.syncPath.settings.filters[c]),e(2),r("icon",o.icons.faTimes)}}function lt(a,h){if(a&1){let c=f();i(0,"button",27),m("click",function(){u(c);let s=p();return y(s.onFlush())}),l(1,"Reset"),n()}}var vt=(()=>{let h=class h{constructor(){this.mustRefresh=new v,this.locale=S(G),this.layout=S(q),this.store=S(z),this.ELECTRON_DIALOG=it,this.SYNC_PATH_FILTER_TYPE=Z,this.currentFilterType=this.store.isElectronApp()?this.SYNC_PATH_FILTER_TYPE.FILE:this.SYNC_PATH_FILTER_TYPE.START,this.filterTypePlaceholder={[this.SYNC_PATH_FILTER_TYPE.FILE]:"click on the browse button",[this.SYNC_PATH_FILTER_TYPE.FOLDER]:"click on the browse button",[this.SYNC_PATH_FILTER_TYPE.START]:"with a name or pattern",[this.SYNC_PATH_FILTER_TYPE.IN]:"with a name or pattern",[this.SYNC_PATH_FILTER_TYPE.END]:"with the extension ('.mp3', '.avi', '.mov' ...)",[this.SYNC_PATH_FILTER_TYPE.EXPERT]:"[-+]?[0-9]*\\.?[0-9]*"},this.icons={faTimes:X,faRotate:j},this.confirmDeletion=!1,this.syncService=S(et)}ngOnInit(){this.syncPath=new tt(JSON.parse(JSON.stringify(this.syncPathSelected)))}onSubmit(){if(this.confirmDeletion){this.onRemove();return}this.store.isElectronApp()?this.syncService.updatePath(this.syncPath.export(!0)).then(()=>{this.syncService.refreshPaths().catch(console.error),this.layout.closeDialog()}):this.syncService.updateSyncPath(this.syncClientSelected.id,this.syncPath.id,this.syncPath.export()).subscribe({next:()=>{this.mustRefresh.emit(),this.layout.closeDialog()},error:o=>this.layout.sendNotification("error","Unable to update",this.syncPath.settings.name,o)})}onRemove(){this.store.isElectronApp()?this.syncService.removePath(this.syncPath.id).then(()=>{this.syncService.refreshPaths().catch(console.error),this.layout.closeDialog(),this.layout.sendNotification("success","Sync deleted",this.syncPath.settings.name)}).catch(o=>this.layout.sendNotification("error","Unable to delete",this.syncPath.settings.name,o)):this.syncService.deleteSyncPath(this.syncClientSelected.id,this.syncPath.id).subscribe({next:()=>{this.mustRefresh.emit(),this.layout.closeDialog(),this.layout.sendNotification("success","Sync deleted",this.syncPath.settings.name)},error:o=>this.layout.sendNotification("error","Unable to delete",this.syncPath.settings.name,o)})}onFlush(){this.syncService.flushPath(this.syncPath.id).then(()=>{this.layout.sendNotification("success","Sync was reset",this.syncPath.settings.name),this.layout.closeDialog()}).catch(o=>this.layout.sendNotification("error","Unable to reset",this.syncPath.settings.name,o))}onRemoveFilter(o){this.syncPath.settings.filters.splice(o,1)}onSelect(o=this.ELECTRON_DIALOG.FILE){this.syncService.showOpenDialog({properties:[o],defaultPath:this.syncPath.settings.localPath}).then(s=>{s.canceled||s.filePaths[0].startsWith(this.syncPath.settings.localPath)&&(this.currentFilter=s.filePaths[0].replace(this.syncPath.settings.localPath,"").substring(1))})}addFilter(){this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.FILE||this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.FOLDER||this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.EXPERT?this.syncPath.settings.filters.unshift(this.currentFilter):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.START?this.syncPath.settings.filters.unshift(`^${this.currentFilter}.*`):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.IN?this.syncPath.settings.filters.unshift(`.*${this.currentFilter}.*`):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.END&&this.syncPath.settings.filters.unshift(`.*${this.currentFilter}$`),this.currentFilter=null}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}};h.\u0275fac=function(s){return new(s||h)},h.\u0275cmp=L({type:h,selectors:[["app-sync-path-settings-dialog"]],inputs:{syncPathSelected:"syncPathSelected",syncClientSelected:"syncClientSelected"},outputs:{mustRefresh:"mustRefresh"},decls:43,vars:35,consts:[[1,"modal-header"],[1,"modal-title"],[3,"icon"],[1,"ms-2"],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body"],["type","pills",3,"justified"],[2,"margin-top","8px","margin-bottom","6px"],["customClass","tab-dialog",3,"heading"],["direction","start","size","large",3,"showPaths","syncPath"],[1,"d-flex","align-items-center","mb-2"],[1,"d-flex","flex-row","col-12","px-0"],[1,"form-select","form-select-sm","me-1",3,"ngModelChange","ngModel"],["l10nTranslate","",3,"value"],["type","text",1,"form-control","form-select-sm","me-1",3,"ngModelChange","ngModel","disabled","placeholder"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary","me-1",3,"click","disabled"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary"],[1,"my-1"],[1,"d-flex","mb-1"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger","me-2",3,"click","disabled"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","submit","l10nTranslate","",3,"click","disabled"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary",3,"click"],["type","text",1,"form-control","form-control-sm","me-1",3,"ngModelChange","ngModel"],["data-dismiss","modal","type","button",1,"btn","btn-xs","btn-danger",3,"click"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning",3,"click"]],template:function(s,t){s&1&&(i(0,"div",0)(1,"h4",1),T(2,"fa-icon",2),i(3,"span",3),l(4),n()(),i(5,"button",4),m("click",function(){return t.layout.closeDialog()}),n()(),i(6,"div",5)(7,"tabset",6),T(8,"hr",7),i(9,"tab",8),F(10,"translate"),T(11,"app-sync-path-settings",9),n(),i(12,"tab",8),F(13,"translate"),i(14,"div",10)(15,"div",11)(16,"select",12),b("ngModelChange",function(_){return C(t.currentFilterType,_)||(t.currentFilterType=_),_}),g(17,ot,4,2),i(18,"option",13),l(19,"The files starting"),n(),i(20,"option",13),l(21,"The files containing"),n(),i(22,"option",13),l(23,"The files ending"),n(),i(24,"option",13),l(25,"Expert (Regexp)"),n()(),i(26,"input",14),F(27,"translate"),b("ngModelChange",function(_){return C(t.currentFilter,_)||(t.currentFilter=_),_}),n(),i(28,"button",15),m("click",function(){return t.addFilter()}),l(29,"Add"),n(),g(30,st,2,0,"button",16),g(31,rt,2,0,"button",16),n()(),T(32,"hr",17),D(33,at,4,2,"div",18,Y),n()()(),i(35,"div",19)(36,"button",20),m("click",function(){return t.confirmDeletion=!0}),l(37," Remove "),n(),g(38,lt,2,0,"button",21),i(39,"button",22),m("click",function(){return t.onCancel()}),l(40,"Cancel"),n(),i(41,"button",23),m("click",function(){return t.onSubmit()}),l(42),n()()),s&2&&(e(2),r("icon",t.icons.faRotate),e(2),A(t.syncPath.settings.name),e(3),r("justified",!0),e(2),r("heading",R(10,26,"Settings",t.locale.language)),e(2),r("showPaths",!0)("syncPath",t.syncPath),e(),r("heading",R(13,29,"Filters",t.locale.language)),e(4),E("ngModel",t.currentFilterType),e(),P(t.store.isElectronApp()?17:-1),e(),r("value",t.SYNC_PATH_FILTER_TYPE.START),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.IN),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.END),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.EXPERT),e(2),E("ngModel",t.currentFilter),r("disabled",t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FILE||t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FOLDER)("placeholder",R(27,32,t.filterTypePlaceholder[t.currentFilterType],t.locale.language)),e(2),r("disabled",!t.currentFilter),e(2),P(t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FILE?30:-1),e(),P(t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FOLDER?31:-1),e(2),N(t.syncPath.settings.filters),e(3),r("disabled",t.confirmDeletion),e(2),P(t.store.isElectronApp()?38:-1),e(3),I(x("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary")),r("disabled",!t.syncPath.settings.name),e(),w(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[K,Q,nt,B,V,W,k,O,H,M,J,$,U],encapsulation:2});let a=h;return a})();export{vt as a};
1
+ import{b as nt}from"./chunk-GRLHFXGB.js";import{a as it}from"./chunk-NMF2ZFBE.js";import{a as Z,f as tt,h as et}from"./chunk-ZXXHFBGL.js";import{a as K,b as Q}from"./chunk-XCLK7NJL.js";import{Cb as q,vb as z}from"./chunk-I2S3XPC5.js";import{Bb as f,Cd as B,Eb as m,Ed as G,Gb as p,Jd as U,Kd as $,Ld as j,Oa as e,Qa as v,Sb as I,Tb as l,Ub as A,Vb as w,Xb as E,Yb as C,Zb as b,ab as L,cc as x,fd as k,ja as S,jd as H,kc as F,lb as g,mb as P,mc as R,nb as Y,oa as u,od as M,og as J,pa as y,pb as D,qb as N,rb as r,sb as i,tb as n,ub as T,ud as O,vd as V,vf as X,wd as W}from"./chunk-IOIBQGHN.js";function ot(a,h){if(a&1&&(i(0,"option",13),l(1,"Select a file"),n(),i(2,"option",13),l(3,"Select a folder"),n()),a&2){let c=p();r("value",c.SYNC_PATH_FILTER_TYPE.FILE),e(2),r("value",c.SYNC_PATH_FILTER_TYPE.FOLDER)}}function st(a,h){if(a&1){let c=f();i(0,"button",24),m("click",function(){u(c);let s=p();return y(s.onSelect())}),l(1,"Browse"),n()}}function rt(a,h){if(a&1){let c=f();i(0,"button",24),m("click",function(){u(c);let s=p();return y(s.onSelect(s.ELECTRON_DIALOG.DIRECTORY))}),l(1,"Browse"),n()}}function at(a,h){if(a&1){let c=f();i(0,"div",18)(1,"input",25),b("ngModelChange",function(s){let t=u(c).$index,d=p();return C(d.syncPath.settings.filters[t],s)||(d.syncPath.settings.filters[t]=s),y(s)}),n(),i(2,"button",26),m("click",function(){let s=u(c).$index,t=p();return y(t.onRemoveFilter(s))}),T(3,"fa-icon",2),n()()}if(a&2){let c=h.$index,o=p();e(),E("ngModel",o.syncPath.settings.filters[c]),e(2),r("icon",o.icons.faTimes)}}function lt(a,h){if(a&1){let c=f();i(0,"button",27),m("click",function(){u(c);let s=p();return y(s.onFlush())}),l(1,"Reset"),n()}}var vt=(()=>{let h=class h{constructor(){this.mustRefresh=new v,this.locale=S(G),this.layout=S(q),this.store=S(z),this.ELECTRON_DIALOG=it,this.SYNC_PATH_FILTER_TYPE=Z,this.currentFilterType=this.store.isElectronApp()?this.SYNC_PATH_FILTER_TYPE.FILE:this.SYNC_PATH_FILTER_TYPE.START,this.filterTypePlaceholder={[this.SYNC_PATH_FILTER_TYPE.FILE]:"click on the browse button",[this.SYNC_PATH_FILTER_TYPE.FOLDER]:"click on the browse button",[this.SYNC_PATH_FILTER_TYPE.START]:"with a name or pattern",[this.SYNC_PATH_FILTER_TYPE.IN]:"with a name or pattern",[this.SYNC_PATH_FILTER_TYPE.END]:"with the extension ('.mp3', '.avi', '.mov' ...)",[this.SYNC_PATH_FILTER_TYPE.EXPERT]:"[-+]?[0-9]*\\.?[0-9]*"},this.icons={faTimes:X,faRotate:j},this.confirmDeletion=!1,this.syncService=S(et)}ngOnInit(){this.syncPath=new tt(JSON.parse(JSON.stringify(this.syncPathSelected)))}onSubmit(){if(this.confirmDeletion){this.onRemove();return}this.store.isElectronApp()?this.syncService.updatePath(this.syncPath.export(!0)).then(()=>{this.syncService.refreshPaths().catch(console.error),this.layout.closeDialog()}):this.syncService.updateSyncPath(this.syncClientSelected.id,this.syncPath.id,this.syncPath.export()).subscribe({next:()=>{this.mustRefresh.emit(),this.layout.closeDialog()},error:o=>this.layout.sendNotification("error","Unable to update",this.syncPath.settings.name,o)})}onRemove(){this.store.isElectronApp()?this.syncService.removePath(this.syncPath.id).then(()=>{this.syncService.refreshPaths().catch(console.error),this.layout.closeDialog(),this.layout.sendNotification("success","Sync deleted",this.syncPath.settings.name)}).catch(o=>this.layout.sendNotification("error","Unable to delete",this.syncPath.settings.name,o)):this.syncService.deleteSyncPath(this.syncClientSelected.id,this.syncPath.id).subscribe({next:()=>{this.mustRefresh.emit(),this.layout.closeDialog(),this.layout.sendNotification("success","Sync deleted",this.syncPath.settings.name)},error:o=>this.layout.sendNotification("error","Unable to delete",this.syncPath.settings.name,o)})}onFlush(){this.syncService.flushPath(this.syncPath.id).then(()=>{this.layout.sendNotification("success","Sync was reset",this.syncPath.settings.name),this.layout.closeDialog()}).catch(o=>this.layout.sendNotification("error","Unable to reset",this.syncPath.settings.name,o))}onRemoveFilter(o){this.syncPath.settings.filters.splice(o,1)}onSelect(o=this.ELECTRON_DIALOG.FILE){this.syncService.showOpenDialog({properties:[o],defaultPath:this.syncPath.settings.localPath}).then(s=>{s.canceled||s.filePaths[0].startsWith(this.syncPath.settings.localPath)&&(this.currentFilter=s.filePaths[0].replace(this.syncPath.settings.localPath,"").substring(1))})}addFilter(){this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.FILE||this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.FOLDER||this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.EXPERT?this.syncPath.settings.filters.unshift(this.currentFilter):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.START?this.syncPath.settings.filters.unshift(`^${this.currentFilter}.*`):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.IN?this.syncPath.settings.filters.unshift(`.*${this.currentFilter}.*`):this.currentFilterType===this.SYNC_PATH_FILTER_TYPE.END&&this.syncPath.settings.filters.unshift(`.*${this.currentFilter}$`),this.currentFilter=null}onCancel(){this.confirmDeletion?this.confirmDeletion=!1:this.layout.closeDialog()}};h.\u0275fac=function(s){return new(s||h)},h.\u0275cmp=L({type:h,selectors:[["app-sync-path-settings-dialog"]],inputs:{syncPathSelected:"syncPathSelected",syncClientSelected:"syncClientSelected"},outputs:{mustRefresh:"mustRefresh"},decls:43,vars:35,consts:[[1,"modal-header"],[1,"modal-title"],[3,"icon"],[1,"ms-2"],["aria-label","Close","type","button",1,"btn-close","btn-close-white",3,"click"],[1,"modal-body"],["type","pills",3,"justified"],[2,"margin-top","8px","margin-bottom","6px"],["customClass","tab-dialog",3,"heading"],["direction","start","size","large",3,"showPaths","syncPath"],[1,"d-flex","align-items-center","mb-2"],[1,"d-flex","flex-row","col-12","px-0"],[1,"form-select","form-select-sm","me-1",3,"ngModelChange","ngModel"],["l10nTranslate","",3,"value"],["type","text",1,"form-control","form-select-sm","me-1",3,"ngModelChange","ngModel","disabled","placeholder"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary","me-1",3,"click","disabled"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary"],[1,"my-1"],[1,"d-flex","mb-1"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-danger","me-2",3,"click","disabled"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","submit","l10nTranslate","",3,"click","disabled"],["l10nTranslate","","type","button",1,"btn","btn-xs","btn-secondary",3,"click"],["type","text",1,"form-control","form-control-sm","me-1",3,"ngModelChange","ngModel"],["data-dismiss","modal","type","button",1,"btn","btn-xs","btn-danger",3,"click"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-warning",3,"click"]],template:function(s,t){s&1&&(i(0,"div",0)(1,"h4",1),T(2,"fa-icon",2),i(3,"span",3),l(4),n()(),i(5,"button",4),m("click",function(){return t.layout.closeDialog()}),n()(),i(6,"div",5)(7,"tabset",6),T(8,"hr",7),i(9,"tab",8),F(10,"translate"),T(11,"app-sync-path-settings",9),n(),i(12,"tab",8),F(13,"translate"),i(14,"div",10)(15,"div",11)(16,"select",12),b("ngModelChange",function(_){return C(t.currentFilterType,_)||(t.currentFilterType=_),_}),g(17,ot,4,2),i(18,"option",13),l(19,"The files starting"),n(),i(20,"option",13),l(21,"The files containing"),n(),i(22,"option",13),l(23,"The files ending"),n(),i(24,"option",13),l(25,"Expert (Regexp)"),n()(),i(26,"input",14),F(27,"translate"),b("ngModelChange",function(_){return C(t.currentFilter,_)||(t.currentFilter=_),_}),n(),i(28,"button",15),m("click",function(){return t.addFilter()}),l(29,"Add"),n(),g(30,st,2,0,"button",16),g(31,rt,2,0,"button",16),n()(),T(32,"hr",17),D(33,at,4,2,"div",18,Y),n()()(),i(35,"div",19)(36,"button",20),m("click",function(){return t.confirmDeletion=!0}),l(37," Remove "),n(),g(38,lt,2,0,"button",21),i(39,"button",22),m("click",function(){return t.onCancel()}),l(40,"Cancel"),n(),i(41,"button",23),m("click",function(){return t.onSubmit()}),l(42),n()()),s&2&&(e(2),r("icon",t.icons.faRotate),e(2),A(t.syncPath.settings.name),e(3),r("justified",!0),e(2),r("heading",R(10,26,"Settings",t.locale.language)),e(2),r("showPaths",!0)("syncPath",t.syncPath),e(),r("heading",R(13,29,"Filters",t.locale.language)),e(4),E("ngModel",t.currentFilterType),e(),P(t.store.isElectronApp()?17:-1),e(),r("value",t.SYNC_PATH_FILTER_TYPE.START),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.IN),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.END),e(2),r("value",t.SYNC_PATH_FILTER_TYPE.EXPERT),e(2),E("ngModel",t.currentFilter),r("disabled",t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FILE||t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FOLDER)("placeholder",R(27,32,t.filterTypePlaceholder[t.currentFilterType],t.locale.language)),e(2),r("disabled",!t.currentFilter),e(2),P(t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FILE?30:-1),e(),P(t.currentFilterType===t.SYNC_PATH_FILTER_TYPE.FOLDER?31:-1),e(2),N(t.syncPath.settings.filters),e(3),r("disabled",t.confirmDeletion),e(2),P(t.store.isElectronApp()?38:-1),e(3),I(x("btn btn-sm ",t.confirmDeletion?"btn-danger":"btn-primary")),r("disabled",!t.syncPath.settings.name),e(),w(" ",t.confirmDeletion?"Confirm deletion":"Confirm"," "))},dependencies:[K,Q,nt,B,V,W,k,O,H,M,J,$,U],encapsulation:2});let a=h;return a})();export{vt as a};
@@ -1 +1 @@
1
- import{a as ie,b as ne,c as ae}from"./chunk-YMAN4LIU.js";import{Ab as te,qb as I,s as q,xb as D,yb as $,zb as ee}from"./chunk-5HNQLBSW.js";import{Ae as T,Cd as B,Ed as j,Gb as _,Jd as k,Jf as Z,Kd as G,Ld as x,Oa as t,Rb as P,Sb as s,Tb as r,Ub as M,Vb as R,Wd as J,Xb as g,Yb as y,Ye as X,Zb as h,Zf as N,ab as u,cc as d,fd as H,ja as O,jd as w,kc as L,lb as C,mb as f,mc as Y,od as F,og as v,qd as z,qe as K,rb as a,sb as i,se as Q,tb as l,ub as m,ud as b,vd as W,wd as U,xd as V}from"./chunk-IOIBQGHN.js";function se(o,p){if(o&1&&m(0,"fa-icon",1),o&2){let n=_(2);a("icon",n.icons.faLongArrowAltDown)("fixedWidth",n.syncPath.settings.mode!==n.SYNC_PATH_MODE.BOTH)}}function ce(o,p){if(o&1&&m(0,"fa-icon",3),o&2){let n=_(2);s(n.SYNC_TRANSFER_SIDE_CLASS[n.SYNC_TRANSFER_SIDE.LOCAL]),a("icon",n.SYNC_TRANSFER_SIDE_ICON[n.SYNC_TRANSFER_SIDE.LOCAL])}}function re(o,p){if(o&1&&C(0,se,1,2,"fa-icon",1)(1,ce,1,3,"fa-icon",2),o&2){let n=_();f(n.small?0:1)}}function de(o,p){if(o&1&&m(0,"fa-icon",1),o&2){let n=_(2);a("icon",n.icons.faLongArrowAltUp)("fixedWidth",n.syncPath.settings.mode!==n.SYNC_PATH_MODE.BOTH)}}function pe(o,p){if(o&1&&m(0,"fa-icon",3),o&2){let n=_(2);s(n.SYNC_TRANSFER_SIDE_CLASS[n.SYNC_TRANSFER_SIDE.REMOTE]),P("ms-1",n.syncPath.settings.mode===n.SYNC_PATH_MODE.BOTH),a("icon",n.SYNC_TRANSFER_SIDE_ICON[n.SYNC_TRANSFER_SIDE.REMOTE])}}function me(o,p){if(o&1&&C(0,de,1,2,"fa-icon",1)(1,pe,1,5,"fa-icon",4),o&2){let n=_();f(n.small?0:1)}}var oe=(()=>{let p=class p{constructor(){this.small=!1,this.SYNC_PATH_MODE=D,this.SYNC_TRANSFER_SIDE_ICON=ae,this.icons={faLongArrowAltDown:N,faLongArrowAltUp:T},this.SYNC_TRANSFER_SIDE=ie,this.SYNC_TRANSFER_SIDE_CLASS=ne}};p.\u0275fac=function(S){return new(S||p)},p.\u0275cmp=u({type:p,selectors:[["app-sync-path-direction-icon"]],inputs:{syncPath:"syncPath",small:"small"},decls:3,vars:2,consts:[[1,"d-flex","justify-content-center"],[3,"icon","fixedWidth"],[3,"icon","class"],[3,"icon"],[3,"icon","ms-1","class"]],template:function(S,e){S&1&&(i(0,"span",0),C(1,re,2,1),C(2,me,2,1),l()),S&2&&(t(),f(e.syncPath.settings.mode===e.SYNC_PATH_MODE.DOWNLOAD||e.syncPath.settings.mode===e.SYNC_PATH_MODE.BOTH?1:-1),t(),f(e.syncPath.settings.mode===e.SYNC_PATH_MODE.UPLOAD||e.syncPath.settings.mode===e.SYNC_PATH_MODE.BOTH?2:-1))},dependencies:[v],encapsulation:2});let o=p;return o})();function _e(o,p){if(o&1&&(i(0,"div")(1,"div"),m(2,"fa-icon",0),i(3,"span",1),r(4,"Client"),l()(),i(5,"div",10)(6,"span",11),r(7),l()()(),i(8,"div")(9,"div"),m(10,"fa-icon",0),i(11,"span",1),r(12,"Server"),l()(),i(13,"div",10)(14,"span",11)(15,"div",12),m(16,"fa-icon",13),r(17),l()()()()),o&2){let n=_();s(d("d-flex justify-content-",n.direction," align-items-center mb-2")),t(),s(d("col-",n.colSize[n.size][0])),t(),a("icon",n.icons.CLIENT),t(5),M(n.syncPath.settings.localPath),t(),s(d("d-flex justify-content-",n.direction," align-items-center mb-2")),t(),s(d("col-",n.colSize[n.size][0])),t(),a("icon",n.icons.SERVER),t(6),a("icon",n.syncPath.icon),t(),R(" ",n.syncPath.showedPath," ")}}function Se(o,p){if(o&1&&(i(0,"span",4),m(1,"fa-icon",14),L(2,"translate"),l()),o&2){let n=_();t(),a("icon",n.icons.faExclamationCircle)("tooltip",Y(2,2,"You must have permission to modify the server folder to choose a different sync mode",n.locale.language))}}var Le=(()=>{let p=class p{constructor(){this.direction="center",this.showPaths=!1,this.size="small",this.locale=O(j),this.icons={CLIENT:I.CLIENT,SERVER:I.SERVER,faExclamationCircle:X,faLongArrowAltDown:N,faLongArrowAltUp:T,faGauge:J,faClock:Q,faRotate:x,faEdit:K,faBug:Z},this.colSize={small:[2,5],large:[3,6]},this.SYNC_PATH_CONFLICT_MODE=ee,this.SYNC_PATH_MODE=D,this.SYNC_PATH_DIFF_MODE=$,this.SYNC_PATH_SCHEDULER_UNIT=te}};p.\u0275fac=function(S){return new(S||p)},p.\u0275cmp=u({type:p,selectors:[["app-sync-path-settings"]],inputs:{syncPath:"syncPath",direction:"direction",showPaths:"showPaths",size:"size"},decls:74,vars:98,consts:[[3,"icon"],["l10nTranslate","",1,"ms-2"],["type","text",3,"ngModelChange","ngModel"],[3,"syncPath","small"],[1,"ms-2","fs-lg","cursor-pointer"],[1,"form-select","form-select-sm",3,"ngModelChange","ngModel"],["l10nTranslate","",3,"disabled","ngValue"],["l10nTranslate","",3,"ngValue"],[1,"form-select","form-select-sm",3,"ngModelChange","ngModel","disabled"],["min","1","type","number",1,"form-control","form-select-sm","pe-1","me-2",2,"width","70px",3,"ngModelChange","ngModel","disabled"],[1,"col-8"],[1,"form-control-sm","form-control-plaintext"],[1,"d-flex","align-items-center"],[1,"me-1",3,"icon"],[1,"text-warning",3,"icon","tooltip"]],template:function(S,e){S&1&&(i(0,"div"),C(1,_e,18,17),i(2,"div")(3,"div"),m(4,"fa-icon",0),i(5,"span",1),r(6,"Name"),l()(),i(7,"div")(8,"input",2),h("ngModelChange",function(c){return y(e.syncPath.settings.name,c)||(e.syncPath.settings.name=c),c}),l()()(),i(9,"div")(10,"div"),m(11,"app-sync-path-direction-icon",3),i(12,"span",1),r(13,"Direction"),l(),C(14,Se,3,5,"span",4),l(),i(15,"div")(16,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.mode,c)||(e.syncPath.settings.mode=c),c}),i(17,"option",6),r(18,"upload only"),l(),i(19,"option",7),r(20,"download only"),l(),i(21,"option",6),r(22,"both"),l()()()(),i(23,"div")(24,"div"),m(25,"fa-icon",0),i(26,"span",1),r(27,"Conflict"),l()(),i(28,"div")(29,"select",8),h("ngModelChange",function(c){return y(e.syncPath.settings.conflictMode,c)||(e.syncPath.settings.conflictMode=c),c}),i(30,"option",7),r(31,"the client\u2019s files take precedence"),l(),i(32,"option",7),r(33,"the server\u2019s files take precedence"),l(),i(34,"option",7),r(35,"the most recent files will be kept"),l()()()(),i(36,"div")(37,"div"),m(38,"fa-icon",0),i(39,"span",1),r(40,"Mode"),l()(),i(41,"div")(42,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.diffMode,c)||(e.syncPath.settings.diffMode=c),c}),i(43,"option",7),r(44),l(),i(45,"option",7),r(46),l()()()(),i(47,"div")(48,"div"),m(49,"fa-icon",0),i(50,"span",1),r(51,"Scheduler"),l()(),i(52,"div")(53,"input",9),h("ngModelChange",function(c){return y(e.syncPath.settings.scheduler.value,c)||(e.syncPath.settings.scheduler.value=c),c}),l(),i(54,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.scheduler.unit,c)||(e.syncPath.settings.scheduler.unit=c),c}),i(55,"option",7),r(56,"disabled"),l(),i(57,"option",7),r(58,"scheduler_unit_minute"),l(),i(59,"option",7),r(60,"scheduler_unit_hour"),l(),i(61,"option",7),r(62,"scheduler_unit_day"),l()()()(),i(63,"div")(64,"div"),m(65,"fa-icon",0),i(66,"span",1),r(67,"Status"),l()(),i(68,"div")(69,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.enabled,c)||(e.syncPath.settings.enabled=c),c}),i(70,"option",7),r(71,"enabled"),l(),i(72,"option",7),r(73,"disabled"),l()()()()()),S&2&&(s(d("d-flex flex-column justify-content-",e.direction)),t(),f(e.showPaths?1:-1),t(),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faEdit),t(3),s(d("col-",e.colSize[e.size][1])),t(),s(d("form-control form-select-sm ",e.syncPath.settings.name?"":"is-invalid")),g("ngModel",e.syncPath.settings.name),t(),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("d-flex align-items-center col-",e.colSize[e.size][0])),t(),a("syncPath",e.syncPath)("small",!0),t(3),f(e.syncPath.isWriteable?-1:14),t(),s(d("col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.mode),t(),a("disabled",!e.syncPath.isWriteable)("ngValue",e.SYNC_PATH_MODE.UPLOAD),t(2),a("ngValue",e.SYNC_PATH_MODE.DOWNLOAD),t(2),a("disabled",!e.syncPath.isWriteable)("ngValue",e.SYNC_PATH_MODE.BOTH),t(2),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faBug),t(3),s(d("col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.conflictMode),a("disabled",e.syncPath.settings.mode!=="both"),t(),a("ngValue",e.SYNC_PATH_CONFLICT_MODE.LOCAL),t(2),a("ngValue",e.SYNC_PATH_CONFLICT_MODE.REMOTE),t(2),a("ngValue",e.SYNC_PATH_CONFLICT_MODE.RECENT),t(2),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faGauge),t(3),s(d("col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.diffMode),t(),a("ngValue",e.SYNC_PATH_DIFF_MODE.FAST),t(),M(e.SYNC_PATH_DIFF_MODE.FAST),t(),a("ngValue",e.SYNC_PATH_DIFF_MODE.SECURE),t(),M(e.SYNC_PATH_DIFF_MODE.SECURE),t(),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faClock),t(3),s(d("d-flex flex-row col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.scheduler.value),a("disabled",e.syncPath.settings.scheduler.unit===e.SYNC_PATH_SCHEDULER_UNIT.DISABLED),t(),g("ngModel",e.syncPath.settings.scheduler.unit),t(),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.DISABLED),t(2),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.MINUTE),t(2),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.HOUR),t(2),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.DAY),t(2),s(d("d-flex justify-content-",e.direction," align-items-center")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faRotate),t(3),s(d("col-",e.colSize[e.size][1])),t(),P("text-danger",!e.syncPath.settings.enabled),g("ngModel",e.syncPath.settings.enabled),t(),a("ngValue",!0),t(2),a("ngValue",!1))},dependencies:[G,v,B,W,U,H,z,b,w,V,F,q,oe,k],encapsulation:2});let o=p;return o})();export{oe as a,Le as b};
1
+ import{a as ie,b as ne,c as ae}from"./chunk-YMAN4LIU.js";import{Ab as te,qb as I,s as q,xb as D,yb as $,zb as ee}from"./chunk-I2S3XPC5.js";import{Ae as T,Cd as B,Ed as j,Gb as _,Jd as k,Jf as Z,Kd as G,Ld as x,Oa as t,Rb as P,Sb as s,Tb as r,Ub as M,Vb as R,Wd as J,Xb as g,Yb as y,Ye as X,Zb as h,Zf as N,ab as u,cc as d,fd as H,ja as O,jd as w,kc as L,lb as C,mb as f,mc as Y,od as F,og as v,qd as z,qe as K,rb as a,sb as i,se as Q,tb as l,ub as m,ud as b,vd as W,wd as U,xd as V}from"./chunk-IOIBQGHN.js";function se(o,p){if(o&1&&m(0,"fa-icon",1),o&2){let n=_(2);a("icon",n.icons.faLongArrowAltDown)("fixedWidth",n.syncPath.settings.mode!==n.SYNC_PATH_MODE.BOTH)}}function ce(o,p){if(o&1&&m(0,"fa-icon",3),o&2){let n=_(2);s(n.SYNC_TRANSFER_SIDE_CLASS[n.SYNC_TRANSFER_SIDE.LOCAL]),a("icon",n.SYNC_TRANSFER_SIDE_ICON[n.SYNC_TRANSFER_SIDE.LOCAL])}}function re(o,p){if(o&1&&C(0,se,1,2,"fa-icon",1)(1,ce,1,3,"fa-icon",2),o&2){let n=_();f(n.small?0:1)}}function de(o,p){if(o&1&&m(0,"fa-icon",1),o&2){let n=_(2);a("icon",n.icons.faLongArrowAltUp)("fixedWidth",n.syncPath.settings.mode!==n.SYNC_PATH_MODE.BOTH)}}function pe(o,p){if(o&1&&m(0,"fa-icon",3),o&2){let n=_(2);s(n.SYNC_TRANSFER_SIDE_CLASS[n.SYNC_TRANSFER_SIDE.REMOTE]),P("ms-1",n.syncPath.settings.mode===n.SYNC_PATH_MODE.BOTH),a("icon",n.SYNC_TRANSFER_SIDE_ICON[n.SYNC_TRANSFER_SIDE.REMOTE])}}function me(o,p){if(o&1&&C(0,de,1,2,"fa-icon",1)(1,pe,1,5,"fa-icon",4),o&2){let n=_();f(n.small?0:1)}}var oe=(()=>{let p=class p{constructor(){this.small=!1,this.SYNC_PATH_MODE=D,this.SYNC_TRANSFER_SIDE_ICON=ae,this.icons={faLongArrowAltDown:N,faLongArrowAltUp:T},this.SYNC_TRANSFER_SIDE=ie,this.SYNC_TRANSFER_SIDE_CLASS=ne}};p.\u0275fac=function(S){return new(S||p)},p.\u0275cmp=u({type:p,selectors:[["app-sync-path-direction-icon"]],inputs:{syncPath:"syncPath",small:"small"},decls:3,vars:2,consts:[[1,"d-flex","justify-content-center"],[3,"icon","fixedWidth"],[3,"icon","class"],[3,"icon"],[3,"icon","ms-1","class"]],template:function(S,e){S&1&&(i(0,"span",0),C(1,re,2,1),C(2,me,2,1),l()),S&2&&(t(),f(e.syncPath.settings.mode===e.SYNC_PATH_MODE.DOWNLOAD||e.syncPath.settings.mode===e.SYNC_PATH_MODE.BOTH?1:-1),t(),f(e.syncPath.settings.mode===e.SYNC_PATH_MODE.UPLOAD||e.syncPath.settings.mode===e.SYNC_PATH_MODE.BOTH?2:-1))},dependencies:[v],encapsulation:2});let o=p;return o})();function _e(o,p){if(o&1&&(i(0,"div")(1,"div"),m(2,"fa-icon",0),i(3,"span",1),r(4,"Client"),l()(),i(5,"div",10)(6,"span",11),r(7),l()()(),i(8,"div")(9,"div"),m(10,"fa-icon",0),i(11,"span",1),r(12,"Server"),l()(),i(13,"div",10)(14,"span",11)(15,"div",12),m(16,"fa-icon",13),r(17),l()()()()),o&2){let n=_();s(d("d-flex justify-content-",n.direction," align-items-center mb-2")),t(),s(d("col-",n.colSize[n.size][0])),t(),a("icon",n.icons.CLIENT),t(5),M(n.syncPath.settings.localPath),t(),s(d("d-flex justify-content-",n.direction," align-items-center mb-2")),t(),s(d("col-",n.colSize[n.size][0])),t(),a("icon",n.icons.SERVER),t(6),a("icon",n.syncPath.icon),t(),R(" ",n.syncPath.showedPath," ")}}function Se(o,p){if(o&1&&(i(0,"span",4),m(1,"fa-icon",14),L(2,"translate"),l()),o&2){let n=_();t(),a("icon",n.icons.faExclamationCircle)("tooltip",Y(2,2,"You must have permission to modify the server folder to choose a different sync mode",n.locale.language))}}var Le=(()=>{let p=class p{constructor(){this.direction="center",this.showPaths=!1,this.size="small",this.locale=O(j),this.icons={CLIENT:I.CLIENT,SERVER:I.SERVER,faExclamationCircle:X,faLongArrowAltDown:N,faLongArrowAltUp:T,faGauge:J,faClock:Q,faRotate:x,faEdit:K,faBug:Z},this.colSize={small:[2,5],large:[3,6]},this.SYNC_PATH_CONFLICT_MODE=ee,this.SYNC_PATH_MODE=D,this.SYNC_PATH_DIFF_MODE=$,this.SYNC_PATH_SCHEDULER_UNIT=te}};p.\u0275fac=function(S){return new(S||p)},p.\u0275cmp=u({type:p,selectors:[["app-sync-path-settings"]],inputs:{syncPath:"syncPath",direction:"direction",showPaths:"showPaths",size:"size"},decls:74,vars:98,consts:[[3,"icon"],["l10nTranslate","",1,"ms-2"],["type","text",3,"ngModelChange","ngModel"],[3,"syncPath","small"],[1,"ms-2","fs-lg","cursor-pointer"],[1,"form-select","form-select-sm",3,"ngModelChange","ngModel"],["l10nTranslate","",3,"disabled","ngValue"],["l10nTranslate","",3,"ngValue"],[1,"form-select","form-select-sm",3,"ngModelChange","ngModel","disabled"],["min","1","type","number",1,"form-control","form-select-sm","pe-1","me-2",2,"width","70px",3,"ngModelChange","ngModel","disabled"],[1,"col-8"],[1,"form-control-sm","form-control-plaintext"],[1,"d-flex","align-items-center"],[1,"me-1",3,"icon"],[1,"text-warning",3,"icon","tooltip"]],template:function(S,e){S&1&&(i(0,"div"),C(1,_e,18,17),i(2,"div")(3,"div"),m(4,"fa-icon",0),i(5,"span",1),r(6,"Name"),l()(),i(7,"div")(8,"input",2),h("ngModelChange",function(c){return y(e.syncPath.settings.name,c)||(e.syncPath.settings.name=c),c}),l()()(),i(9,"div")(10,"div"),m(11,"app-sync-path-direction-icon",3),i(12,"span",1),r(13,"Direction"),l(),C(14,Se,3,5,"span",4),l(),i(15,"div")(16,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.mode,c)||(e.syncPath.settings.mode=c),c}),i(17,"option",6),r(18,"upload only"),l(),i(19,"option",7),r(20,"download only"),l(),i(21,"option",6),r(22,"both"),l()()()(),i(23,"div")(24,"div"),m(25,"fa-icon",0),i(26,"span",1),r(27,"Conflict"),l()(),i(28,"div")(29,"select",8),h("ngModelChange",function(c){return y(e.syncPath.settings.conflictMode,c)||(e.syncPath.settings.conflictMode=c),c}),i(30,"option",7),r(31,"the client\u2019s files take precedence"),l(),i(32,"option",7),r(33,"the server\u2019s files take precedence"),l(),i(34,"option",7),r(35,"the most recent files will be kept"),l()()()(),i(36,"div")(37,"div"),m(38,"fa-icon",0),i(39,"span",1),r(40,"Mode"),l()(),i(41,"div")(42,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.diffMode,c)||(e.syncPath.settings.diffMode=c),c}),i(43,"option",7),r(44),l(),i(45,"option",7),r(46),l()()()(),i(47,"div")(48,"div"),m(49,"fa-icon",0),i(50,"span",1),r(51,"Scheduler"),l()(),i(52,"div")(53,"input",9),h("ngModelChange",function(c){return y(e.syncPath.settings.scheduler.value,c)||(e.syncPath.settings.scheduler.value=c),c}),l(),i(54,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.scheduler.unit,c)||(e.syncPath.settings.scheduler.unit=c),c}),i(55,"option",7),r(56,"disabled"),l(),i(57,"option",7),r(58,"scheduler_unit_minute"),l(),i(59,"option",7),r(60,"scheduler_unit_hour"),l(),i(61,"option",7),r(62,"scheduler_unit_day"),l()()()(),i(63,"div")(64,"div"),m(65,"fa-icon",0),i(66,"span",1),r(67,"Status"),l()(),i(68,"div")(69,"select",5),h("ngModelChange",function(c){return y(e.syncPath.settings.enabled,c)||(e.syncPath.settings.enabled=c),c}),i(70,"option",7),r(71,"enabled"),l(),i(72,"option",7),r(73,"disabled"),l()()()()()),S&2&&(s(d("d-flex flex-column justify-content-",e.direction)),t(),f(e.showPaths?1:-1),t(),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faEdit),t(3),s(d("col-",e.colSize[e.size][1])),t(),s(d("form-control form-select-sm ",e.syncPath.settings.name?"":"is-invalid")),g("ngModel",e.syncPath.settings.name),t(),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("d-flex align-items-center col-",e.colSize[e.size][0])),t(),a("syncPath",e.syncPath)("small",!0),t(3),f(e.syncPath.isWriteable?-1:14),t(),s(d("col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.mode),t(),a("disabled",!e.syncPath.isWriteable)("ngValue",e.SYNC_PATH_MODE.UPLOAD),t(2),a("ngValue",e.SYNC_PATH_MODE.DOWNLOAD),t(2),a("disabled",!e.syncPath.isWriteable)("ngValue",e.SYNC_PATH_MODE.BOTH),t(2),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faBug),t(3),s(d("col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.conflictMode),a("disabled",e.syncPath.settings.mode!=="both"),t(),a("ngValue",e.SYNC_PATH_CONFLICT_MODE.LOCAL),t(2),a("ngValue",e.SYNC_PATH_CONFLICT_MODE.REMOTE),t(2),a("ngValue",e.SYNC_PATH_CONFLICT_MODE.RECENT),t(2),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faGauge),t(3),s(d("col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.diffMode),t(),a("ngValue",e.SYNC_PATH_DIFF_MODE.FAST),t(),M(e.SYNC_PATH_DIFF_MODE.FAST),t(),a("ngValue",e.SYNC_PATH_DIFF_MODE.SECURE),t(),M(e.SYNC_PATH_DIFF_MODE.SECURE),t(),s(d("d-flex justify-content-",e.direction," align-items-center mb-2")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faClock),t(3),s(d("d-flex flex-row col-",e.colSize[e.size][1])),t(),g("ngModel",e.syncPath.settings.scheduler.value),a("disabled",e.syncPath.settings.scheduler.unit===e.SYNC_PATH_SCHEDULER_UNIT.DISABLED),t(),g("ngModel",e.syncPath.settings.scheduler.unit),t(),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.DISABLED),t(2),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.MINUTE),t(2),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.HOUR),t(2),a("ngValue",e.SYNC_PATH_SCHEDULER_UNIT.DAY),t(2),s(d("d-flex justify-content-",e.direction," align-items-center")),t(),s(d("col-",e.colSize[e.size][0])),t(),a("icon",e.icons.faRotate),t(3),s(d("col-",e.colSize[e.size][1])),t(),P("text-danger",!e.syncPath.settings.enabled),g("ngModel",e.syncPath.settings.enabled),t(),a("ngValue",!0),t(2),a("ngValue",!1))},dependencies:[G,v,B,W,U,H,z,b,w,V,F,q,oe,k],encapsulation:2});let o=p;return o})();export{oe as a,Le as b};
@@ -1,4 +1,4 @@
1
- import{b as ye}from"./chunk-PG54TWBO.js";import{m as ve,n as xe,s as N,w as Oe}from"./chunk-BYWSTP3P.js";import{Cb as Ce,J as _e}from"./chunk-5HNQLBSW.js";import{Aa as q,Ab as D,Bb as y,Cd as ce,Dd as le,Eb as h,Gb as p,Gd as pe,Ha as T,J as I,Kd as de,Mc as ie,N as W,Oa as s,Od as ue,Pb as F,Qa as O,Rb as b,Sb as Z,Tb as m,Ub as k,Xb as V,Yb as G,Zb as A,ab as M,af as he,cb as B,cc as J,cd as ne,da as U,db as Q,dd as oe,ec as Y,fb as w,fd as re,gc as ee,hc as te,ja as C,jd as se,kc as H,lb as f,mb as g,mc as j,mf as fe,nb as $,oa as v,oc as z,od as ae,og as P,pa as x,pb as K,qb as X,rb as u,sb as c,tb as a,ub as _,ze as me,zf as ge}from"./chunk-IOIBQGHN.js";var ke=(function(i){return i[i.USER=0]="USER",i[i.PERSONAL=1]="PERSONAL",i})(ke||{}),Se=(function(i){return i[i.VISIBLE=0]="VISIBLE",i[i.PRIVATE=1]="PRIVATE",i[i.ISOLATED=2]="ISOLATED",i})(Se||{});var Xe=(()=>{let n=class n{constructor(){this.translate=C(pe)}transform(e,t=[]){let o="";if(!e)return o;for(let[l,d]of Object.entries(e).filter(([E,qe])=>t.indexOf(E)===-1))d&&(o+=`${d} ${this.translate.translate(d===1?l.slice(0,-1):l)}, `);return o.slice(0,-2)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275pipe=Q({name:"joinCounts",type:n,pure:!0});let i=n;return i})();function Me(i,n){if(i&1&&(c(0,"span"),m(1),a()),i&2){let r=p();s(),k(r.group.name)}}function we(i,n){i&1&&(c(0,"span",3),m(1,"New personal group"),a())}function Pe(i,n){if(i&1&&_(0,"fa-icon",4),i&2){let r=p();u("icon",r.icons.faSpinner)}}function Ee(i,n){i&1&&(c(0,"span",3),m(1,"Edit personal group"),a())}function Te(i,n){i&1&&(c(0,"span",3),m(1,"Edit group"),a())}function De(i,n){if(i&1&&(c(0,"h4",5),f(1,Ee,2,0,"span",3)(2,Te,2,0,"span",3),a()),i&2){let r=p();s(),g(r.isPersonalGroup?1:2)}}var mt=(()=>{let n=class n{constructor(){this.groupChange=new O,this.layout=C(Ce),this.icons={GROUPS:_e.GROUPS,faSpinner:fe,faCog:he,faUsers:me,faPen:ge},this.isPersonalGroup=!0,this.submitted=!1,this.loading=!1,this.userService=C(Oe),this.user=this.userService.user}ngOnInit(){this.originalGroup?.id?(this.isPersonalGroup=this.originalGroup.isPersonalGroup,this.group=new N({id:this.originalGroup.id,name:this.originalGroup.name,description:this.originalGroup.description,createdAt:this.originalGroup.createdAt,modifiedAt:this.originalGroup.modifiedAt,type:this.originalGroup.type})):this.group=new N({id:0,name:"",description:"",createdAt:null,modifiedAt:null,type:xe.PGROUP})}onCancel(){this.layout.closeDialog()}onSubmit(){if(this.loading=!0,this.submitted=!0,this.group.id===0)this.userService.createPersonalGroup(this.makeDto(!0)).subscribe({next:e=>{this.loading=!1,this.groupChange.emit(["add",e]),this.layout.sendNotification("success","Group created",e.name),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updatePersonalGroup(this.originalGroup.id,this.makeDto()).subscribe({next:t=>{this.loading=!1,this.groupChange.emit(["update",t]),this.layout.sendNotification("success","Group updated",t.name),this.layout.closeDialog()},error:t=>this.onError(t)})}}makeDto(e=!1){return{name:e?this.group.name:this.group.name!==this.originalGroup.name?this.group.name:void 0,description:e?this.group.description:this.group.description!==this.originalGroup.description?this.group.description:void 0}}onError(e){this.layout.sendNotification("error","Group error",this.group.name,e),this.submitted=!1,this.loading=!1}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-user-group-dialog"]],inputs:{originalGroup:"originalGroup"},outputs:{groupChange:"groupChange"},decls:23,vars:15,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","disabled","autoSelect","ngModel"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","ngModel","disabled"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(c(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),f(3,Me,2,1,"span")(4,we,2,0,"span",3),f(5,Pe,1,1,"fa-icon",4),a(),f(6,De,3,1,"h4",5),c(7,"button",6),h("click",function(){return o.layout.closeDialog()}),a()(),c(8,"div",7)(9,"div",8)(10,"div",9)(11,"label",10),m(12,"Name"),a(),c(13,"input",11),A("ngModelChange",function(d){return G(o.group.name,d)||(o.group.name=d),d}),a()(),c(14,"div",12)(15,"label",13),m(16,"Description"),a(),c(17,"input",14),A("ngModelChange",function(d){return G(o.group.description,d)||(o.group.description=d),d}),a()()()(),c(18,"div",15)(19,"button",16),h("click",function(){return o.onCancel()}),m(20,"Cancel"),a(),c(21,"button",17),h("click",function(){return o.onSubmit()}),m(22," Confirm "),a()()),t&2&&(s(2),u("icon",o.icons.GROUPS),s(),g(o.group.id?3:4),s(2),g(o.loading?5:-1),s(),g(o.group.id?6:-1),s(),Z(J("btn-close btn-close-white ",o.group.id?"ms-2":"ms-auto"," ms-2")),s(6),b("is-invalid",!o.group.name),u("disabled",!o.isPersonalGroup)("autoSelect",!1),V("ngModel",o.group.name),s(4),V("ngModel",o.group.description),u("disabled",!o.isPersonalGroup),s(4),u("disabled",!o.group.name||o.submitted))},dependencies:[le,re,se,ce,ae,P,de,ve],encapsulation:2});let i=n;return i})();var be=(()=>{let n=class n{onClick(e){e.stopPropagation()}ngOnInit(){setTimeout(()=>{typeof document<"u"&&document.addEventListener("click",this.offClickHandler)},0)}ngOnDestroy(){typeof document<"u"&&document.removeEventListener("click",this.offClickHandler)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275dir=B({type:n,selectors:[["","offClick",""]],hostBindings:function(t,o){t&1&&h("click",function(d){return o.onClick(d)})},inputs:{offClickHandler:[0,"offClick","offClickHandler"]}});let i=n;return i})();var S=class{constructor(n){typeof n=="string"&&(this.id=this.name=n,this.description=""),typeof n=="object"&&(this.id=n.id||n.name,this.name=n.name,this.description=n.description||"")}};var Fe=i=>({active:i}),Ve=(i,n)=>({o:i,i:n});function Ge(i,n){if(i&1){let r=y();c(0,"input",6),h("keydown",function(t){v(r);let o=p();return x(o.inputEvent(t))})("keyup",function(t){v(r);let o=p();return x(o.inputEvent(t,!0))}),a()}if(i&2){let r=p();u("disabled",r.disabled)}}function Ae(i,n){i&1&&D(0)}function He(i,n){if(i&1&&(c(0,"span",12),w(1,Ae,1,0,"ng-container",13),a()),i&2){let r=p(2),e=F(6);b("ui-select-allow-clear",r.allowClear&&r.active),s(),u("ngTemplateOutlet",r.customTemplateSelect||e)("ngTemplateOutletContext",ee(4,Fe,r.active))}}function je(i,n){if(i&1&&(c(0,"span",9),m(1),a()),i&2){let r=p(2);s(),k(r.placeholder)}}function ze(i,n){if(i&1){let r=y();c(0,"button",14),h("click",function(t){v(r);let o=p(2);return x(o.removeClick(o.active,t))}),a()}}function Ne(i,n){if(i&1){let r=y();c(0,"div",4)(1,"span",7),h("click",function(t){v(r);let o=p();return x(o.matchClick(t))}),f(2,He,2,6,"span",8)(3,je,2,1,"span",9),f(4,ze,1,0,"button",10),_(5,"i",11),a()()}if(i&2){let r=p();s(2),g(r.active?2:3),s(2),g(r.allowClear&&r.active?4:-1)}}function Le(i,n){i&1&&D(0)}function Re(i,n){if(i&1){let r=y();c(0,"li",15)(1,"div",16),h("click",function(t){let o=v(r).$implicit,l=p(2);return x(l.selectMatch(o,t))})("mouseenter",function(){let t=v(r).$implicit,o=p(2);return x(o.selectActive(t))}),w(2,Le,1,0,"ng-container",13),a()()}if(i&2){let r=n.$implicit,e=p(2),t=F(8);s(),b("active",e.isActive(r)),s(),u("ngTemplateOutlet",e.customTemplateOptions||t)("ngTemplateOutletContext",te(4,Ve,r,e.inputValue))}}function Ie(i,n){if(i&1&&(c(0,"ul",5),K(1,Re,3,7,"li",15,$),a()),i&2){let r=p();s(),X(r.options)}}function We(i,n){if(i&1&&(c(0,"div",17)(1,"span",18),_(2,"fa-icon",19),a(),c(3,"span"),m(4),a(),c(5,"div",20),m(6),a()()),i&2){let r=n.active,e=p();s(2),u("icon",e.itemIcon)("fixedWidth",!1),s(2),k(r.name),s(2),k(r.description)}}function Ue(i,n){if(i&1&&(c(0,"a",21)(1,"div",17)(2,"span",18),_(3,"fa-icon",19),a(),_(4,"span",22),H(5,"highlight"),_(6,"span",23),H(7,"highlight"),a()()),i&2){let r=n.i,e=n.o,t=p();s(3),u("icon",t.itemIcon)("fixedWidth",!1),s(),u("innerHtml",t.sanitize(j(5,4,e.name,r)),T),s(2),u("innerHtml",t.sanitize(j(7,7,e.description,r)),T)}}var Tt=(()=>{let n=class n{constructor(){this.element=C(q),this.itemIcon=ue,this.allowClear=!0,this.placeholder="",this.idField="id",this.nameField="name",this.descriptionField="description",this.data=new O,this.selected=new O,this.removed=new O,this.typed=new O,this.opened=new O,this.options=[],this.itemObjects=[],this.inputMode=!1,this.inputValue="",this.onChange=Function.prototype,this.onTouched=Function.prototype,this.sanitizer=C(ne),this._items=[],this._optionsOpened=!1,this._disabled=!1,this._active=null,this.clickedOutside=this.clickedOutside.bind(this)}set items(e){if(!e.length){this._items=this.itemObjects=[],this.itemObjects=[];return}this._items=e.filter(t=>{if(typeof t=="string"||typeof t=="object"&&t&&t[this.nameField]&&t[this.idField])return t}),this.itemObjects=this._items.map(t=>typeof t=="string"?new S(t):new S({id:t[this.idField],name:t[this.nameField],description:t[this.descriptionField]}))}get optionsOpened(){return this._optionsOpened}set optionsOpened(e){this._optionsOpened=e,this.opened.emit(e)}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._disabled===!0&&this.hideOptions()}get active(){return this._active}set active(e){e?this._active=typeof e=="string"?e:new S({id:e[this.idField],name:e[this.nameField],description:e[this.descriptionField]}):this._active=null}sanitize(e){return this.sanitizer.bypassSecurityTrustHtml(e)}inputEvent(e,t=!1){if(e.keyCode===9)return;if(t&&(e.keyCode===37||e.keyCode===39||e.keyCode===38||e.keyCode===40||e.keyCode===13)){e.preventDefault();return}if(!t&&e.keyCode===8){let l=this.element.nativeElement.querySelector("div.ui-select-container > input");(!l.value||l.value.length<=0)&&(this.active&&this.remove(this.active),e.preventDefault())}if(!t&&e.keyCode===27){this.hideOptions(),e.preventDefault();return}if(!t&&e.keyCode===46&&(this.active&&this.remove(this.active),e.preventDefault()),!t&&e.keyCode===37&&this._items.length>0){this.behavior.first(),e.preventDefault();return}if(!t&&e.keyCode===39&&this._items.length>0){this.behavior.last(),e.preventDefault();return}if(!t&&e.keyCode===38){this.behavior.prev(),e.preventDefault();return}if(!t&&e.keyCode===40){this.behavior.next(),e.preventDefault();return}if(!t&&e.keyCode===13){(!this.active||this.active.id!==this.activeOption.id)&&(this.selectActiveMatch(),this.behavior.next()),e.preventDefault();return}let o=e.target||e.srcElement;o?(this.inputValue=o.value,this.doEvent("typed",this.inputValue||" ")):this.open()}ngOnInit(){this.subscription=this.typed.asObservable().pipe(I(200),W()).subscribe(e=>this.doSearch(e)),this.behavior=new R(this),this.doEvent("typed"," ")}ngOnDestroy(){this.subscription.unsubscribe()}remove(e){this._disabled!==!0&&(this.active=null,this.data.next(this.active),this.doEvent("removed",e),this.inputValue="",this.doEvent("typed"," "))}doEvent(e,t){this[e]&&t&&this[e].next(t),this.onTouched(),(e==="selected"||e==="removed")&&this.onChange(this.active)}clickedOutside(){this.inputMode=!1,this.optionsOpened=!1}writeValue(e){this.active=e,this.data.emit(this.active)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}matchClick(e){this._disabled!==!0&&(this.inputMode=!this.inputMode,this.inputMode===!0&&(this.focusToInput(),this.open()))}mainClick(e){if(this.inputMode===!0||this._disabled===!0)return;if(e.keyCode===46){e.preventDefault(),this.inputEvent(e);return}if(e.keyCode===8){e.preventDefault(),this.inputEvent(e,!0);return}if(e.keyCode===9||e.keyCode===13||e.keyCode===27||e.keyCode>=37&&e.keyCode<=40){e.preventDefault();return}this.inputMode=!0;let t=String.fromCharCode(96<=e.keyCode&&e.keyCode<=105?e.keyCode-48:e.keyCode).toLowerCase();this.focusToInput(t),this.open();let o=e.target||e.srcElement;o.value=t,this.inputEvent(e)}selectActive(e){this.activeOption=e}isActive(e){return this.activeOption.id===e.id}removeClick(e,t){t.stopPropagation(),this.remove(e)}focusToInput(e=""){setTimeout(()=>{let t=this.element.nativeElement.querySelector("div.ui-select-container > input");t&&(t.focus(),t.value=e)},0)}selectMatch(e,t=void 0){t&&(t.stopPropagation(),t.preventDefault()),!(this.options.length<=0)&&(this.active=e,this.data.next(this.active),this.doEvent("selected",e),this.hideOptions(),this.focusToInput(e.name),this.element.nativeElement.querySelector(".ui-select-container").focus())}doSearch(e){this.searchFunction(e).subscribe({next:t=>{this.items=t},error:t=>{console.error(t),this.items=[]},complete:()=>this.behavior.filter()})}open(){this.options=this.itemObjects,this.options.length>0&&this.behavior.first(),this.optionsOpened=!0}hideOptions(){this.inputMode=!1,this.optionsOpened=!1}selectActiveMatch(){this.selectMatch(this.activeOption)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-select"]],inputs:{searchFunction:"searchFunction",customTemplateOptions:"customTemplateOptions",customTemplateSelect:"customTemplateSelect",itemIcon:"itemIcon",allowClear:"allowClear",placeholder:"placeholder",idField:"idField",nameField:"nameField",descriptionField:"descriptionField",disabled:"disabled",active:"active"},outputs:{data:"data",selected:"selected",removed:"removed",typed:"typed",opened:"opened"},features:[Y([{provide:oe,useExisting:U(()=>n),multi:!0}])],decls:9,vars:5,consts:[["DefaultSelect",""],["DefaultOptions",""],[1,"ui-select-container","dropdown","open",3,"keyup","offClick"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"disabled"],[1,"ui-select-match","form-control","form-control-sm"],["role","menu",1,"ui-select-choices","dropdown-menu"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"keydown","keyup","disabled"],["tabindex","-1",1,"ui-select-toggle","no-select",2,"outline","0",3,"click"],[1,"ui-select-match-text","w-100",3,"ui-select-allow-clear"],[1,"ui-select-placeholder"],["aria-label","close","type","button",1,"btn-close"],[1,"dropdown-toggle"],[1,"ui-select-match-text","w-100"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["aria-label","close","type","button",1,"btn-close",3,"click"],["role","menuitem"],[1,"ui-select-choices-row",3,"click","mouseenter"],[1,"d-flex","align-items-center"],[1,"ui-icon","circle-primary-icon","me-2"],[3,"icon","fixedWidth"],[1,"d-flex","ms-auto","me-4","fs-xxxs","text-muted"],["href","javascript:void(0)",1,"dropdown-item","cursor-pointer",2,"padding","3px 5px"],[3,"innerHtml"],[1,"d-flex","ms-auto","fs-xxxs","text-muted",3,"innerHtml"]],template:function(t,o){if(t&1){let l=y();c(0,"div",2),h("keyup",function(E){return v(l),x(o.mainClick(E))}),_(1,"div"),f(2,Ge,1,1,"input",3)(3,Ne,6,2,"div",4),f(4,Ie,3,0,"ul",5),a(),w(5,We,7,4,"ng-template",null,0,z)(7,Ue,8,10,"ng-template",null,1,z)}t&2&&(u("offClick",o.clickedOutside),s(),b("ui-disabled",o.disabled),s(),g(o.inputMode?2:3),s(2),g(o.optionsOpened&&o.options&&o.options.length>0?4:-1))},dependencies:[be,P,ie,ye],styles:[`.ui-select-container[_ngcontent-%COMP%]{background-color:transparent;border-radius:4px}.ui-select-container.open[_ngcontent-%COMP%] > .dropdown-menu[_ngcontent-%COMP%]{display:block}.ui-select-container.open[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{outline:none}.ui-select-container[_ngcontent-%COMP%] .ui-icon[_ngcontent-%COMP%]{min-width:26px;min-height:26px;font-size:.85rem}.ui-select-container[_ngcontent-%COMP%] .ui-disabled[_ngcontent-%COMP%]{background-color:#d4dbe8;border-radius:4px;position:absolute;width:100%;height:100%;z-index:5;opacity:.6;top:0;left:0;cursor:not-allowed}.ui-select-container[_ngcontent-%COMP%] .ui-select-search[_ngcontent-%COMP%]{line-height:26px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%]{padding-left:.3rem}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{text-align:start!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .caret[_ngcontent-%COMP%]{position:absolute;top:45%;right:15px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .close[_ngcontent-%COMP%]{font-size:1.6em;line-height:.75}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%]{display:flex;align-items:center}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%] > .caret[_ngcontent-%COMP%]{position:absolute;height:10px;top:50%;right:10px;margin-top:-2px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-placeholder[_ngcontent-%COMP%]{float:left;line-height:26px;color:#8c8c8c;width:100%}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]{cursor:pointer}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]:after{display:inline-block!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%]{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{display:block;padding:3px 5px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .active[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{text-decoration:none;outline:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .dropdown-item[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{pointer-events:none}
1
+ import{b as ye}from"./chunk-6B3GGAV3.js";import{m as ve,n as xe,s as N,w as Oe}from"./chunk-FNOTGWRW.js";import{Cb as Ce,J as _e}from"./chunk-I2S3XPC5.js";import{Aa as q,Ab as D,Bb as y,Cd as ce,Dd as le,Eb as h,Gb as p,Gd as pe,Ha as T,J as I,Kd as de,Mc as ie,N as W,Oa as s,Od as ue,Pb as F,Qa as O,Rb as b,Sb as Z,Tb as m,Ub as k,Xb as V,Yb as G,Zb as A,ab as M,af as he,cb as B,cc as J,cd as ne,da as U,db as Q,dd as oe,ec as Y,fb as w,fd as re,gc as ee,hc as te,ja as C,jd as se,kc as H,lb as f,mb as g,mc as j,mf as fe,nb as $,oa as v,oc as z,od as ae,og as P,pa as x,pb as K,qb as X,rb as u,sb as c,tb as a,ub as _,ze as me,zf as ge}from"./chunk-IOIBQGHN.js";var ke=(function(i){return i[i.USER=0]="USER",i[i.PERSONAL=1]="PERSONAL",i})(ke||{}),Se=(function(i){return i[i.VISIBLE=0]="VISIBLE",i[i.PRIVATE=1]="PRIVATE",i[i.ISOLATED=2]="ISOLATED",i})(Se||{});var Xe=(()=>{let n=class n{constructor(){this.translate=C(pe)}transform(e,t=[]){let o="";if(!e)return o;for(let[l,d]of Object.entries(e).filter(([E,qe])=>t.indexOf(E)===-1))d&&(o+=`${d} ${this.translate.translate(d===1?l.slice(0,-1):l)}, `);return o.slice(0,-2)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275pipe=Q({name:"joinCounts",type:n,pure:!0});let i=n;return i})();function Me(i,n){if(i&1&&(c(0,"span"),m(1),a()),i&2){let r=p();s(),k(r.group.name)}}function we(i,n){i&1&&(c(0,"span",3),m(1,"New personal group"),a())}function Pe(i,n){if(i&1&&_(0,"fa-icon",4),i&2){let r=p();u("icon",r.icons.faSpinner)}}function Ee(i,n){i&1&&(c(0,"span",3),m(1,"Edit personal group"),a())}function Te(i,n){i&1&&(c(0,"span",3),m(1,"Edit group"),a())}function De(i,n){if(i&1&&(c(0,"h4",5),f(1,Ee,2,0,"span",3)(2,Te,2,0,"span",3),a()),i&2){let r=p();s(),g(r.isPersonalGroup?1:2)}}var mt=(()=>{let n=class n{constructor(){this.groupChange=new O,this.layout=C(Ce),this.icons={GROUPS:_e.GROUPS,faSpinner:fe,faCog:he,faUsers:me,faPen:ge},this.isPersonalGroup=!0,this.submitted=!1,this.loading=!1,this.userService=C(Oe),this.user=this.userService.user}ngOnInit(){this.originalGroup?.id?(this.isPersonalGroup=this.originalGroup.isPersonalGroup,this.group=new N({id:this.originalGroup.id,name:this.originalGroup.name,description:this.originalGroup.description,createdAt:this.originalGroup.createdAt,modifiedAt:this.originalGroup.modifiedAt,type:this.originalGroup.type})):this.group=new N({id:0,name:"",description:"",createdAt:null,modifiedAt:null,type:xe.PGROUP})}onCancel(){this.layout.closeDialog()}onSubmit(){if(this.loading=!0,this.submitted=!0,this.group.id===0)this.userService.createPersonalGroup(this.makeDto(!0)).subscribe({next:e=>{this.loading=!1,this.groupChange.emit(["add",e]),this.layout.sendNotification("success","Group created",e.name),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updatePersonalGroup(this.originalGroup.id,this.makeDto()).subscribe({next:t=>{this.loading=!1,this.groupChange.emit(["update",t]),this.layout.sendNotification("success","Group updated",t.name),this.layout.closeDialog()},error:t=>this.onError(t)})}}makeDto(e=!1){return{name:e?this.group.name:this.group.name!==this.originalGroup.name?this.group.name:void 0,description:e?this.group.description:this.group.description!==this.originalGroup.description?this.group.description:void 0}}onError(e){this.layout.sendNotification("error","Group error",this.group.name,e),this.submitted=!1,this.loading=!1}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-user-group-dialog"]],inputs:{originalGroup:"originalGroup"},outputs:{groupChange:"groupChange"},decls:23,vars:15,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","disabled","autoSelect","ngModel"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","ngModel","disabled"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(c(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),f(3,Me,2,1,"span")(4,we,2,0,"span",3),f(5,Pe,1,1,"fa-icon",4),a(),f(6,De,3,1,"h4",5),c(7,"button",6),h("click",function(){return o.layout.closeDialog()}),a()(),c(8,"div",7)(9,"div",8)(10,"div",9)(11,"label",10),m(12,"Name"),a(),c(13,"input",11),A("ngModelChange",function(d){return G(o.group.name,d)||(o.group.name=d),d}),a()(),c(14,"div",12)(15,"label",13),m(16,"Description"),a(),c(17,"input",14),A("ngModelChange",function(d){return G(o.group.description,d)||(o.group.description=d),d}),a()()()(),c(18,"div",15)(19,"button",16),h("click",function(){return o.onCancel()}),m(20,"Cancel"),a(),c(21,"button",17),h("click",function(){return o.onSubmit()}),m(22," Confirm "),a()()),t&2&&(s(2),u("icon",o.icons.GROUPS),s(),g(o.group.id?3:4),s(2),g(o.loading?5:-1),s(),g(o.group.id?6:-1),s(),Z(J("btn-close btn-close-white ",o.group.id?"ms-2":"ms-auto"," ms-2")),s(6),b("is-invalid",!o.group.name),u("disabled",!o.isPersonalGroup)("autoSelect",!1),V("ngModel",o.group.name),s(4),V("ngModel",o.group.description),u("disabled",!o.isPersonalGroup),s(4),u("disabled",!o.group.name||o.submitted))},dependencies:[le,re,se,ce,ae,P,de,ve],encapsulation:2});let i=n;return i})();var be=(()=>{let n=class n{onClick(e){e.stopPropagation()}ngOnInit(){setTimeout(()=>{typeof document<"u"&&document.addEventListener("click",this.offClickHandler)},0)}ngOnDestroy(){typeof document<"u"&&document.removeEventListener("click",this.offClickHandler)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275dir=B({type:n,selectors:[["","offClick",""]],hostBindings:function(t,o){t&1&&h("click",function(d){return o.onClick(d)})},inputs:{offClickHandler:[0,"offClick","offClickHandler"]}});let i=n;return i})();var S=class{constructor(n){typeof n=="string"&&(this.id=this.name=n,this.description=""),typeof n=="object"&&(this.id=n.id||n.name,this.name=n.name,this.description=n.description||"")}};var Fe=i=>({active:i}),Ve=(i,n)=>({o:i,i:n});function Ge(i,n){if(i&1){let r=y();c(0,"input",6),h("keydown",function(t){v(r);let o=p();return x(o.inputEvent(t))})("keyup",function(t){v(r);let o=p();return x(o.inputEvent(t,!0))}),a()}if(i&2){let r=p();u("disabled",r.disabled)}}function Ae(i,n){i&1&&D(0)}function He(i,n){if(i&1&&(c(0,"span",12),w(1,Ae,1,0,"ng-container",13),a()),i&2){let r=p(2),e=F(6);b("ui-select-allow-clear",r.allowClear&&r.active),s(),u("ngTemplateOutlet",r.customTemplateSelect||e)("ngTemplateOutletContext",ee(4,Fe,r.active))}}function je(i,n){if(i&1&&(c(0,"span",9),m(1),a()),i&2){let r=p(2);s(),k(r.placeholder)}}function ze(i,n){if(i&1){let r=y();c(0,"button",14),h("click",function(t){v(r);let o=p(2);return x(o.removeClick(o.active,t))}),a()}}function Ne(i,n){if(i&1){let r=y();c(0,"div",4)(1,"span",7),h("click",function(t){v(r);let o=p();return x(o.matchClick(t))}),f(2,He,2,6,"span",8)(3,je,2,1,"span",9),f(4,ze,1,0,"button",10),_(5,"i",11),a()()}if(i&2){let r=p();s(2),g(r.active?2:3),s(2),g(r.allowClear&&r.active?4:-1)}}function Le(i,n){i&1&&D(0)}function Re(i,n){if(i&1){let r=y();c(0,"li",15)(1,"div",16),h("click",function(t){let o=v(r).$implicit,l=p(2);return x(l.selectMatch(o,t))})("mouseenter",function(){let t=v(r).$implicit,o=p(2);return x(o.selectActive(t))}),w(2,Le,1,0,"ng-container",13),a()()}if(i&2){let r=n.$implicit,e=p(2),t=F(8);s(),b("active",e.isActive(r)),s(),u("ngTemplateOutlet",e.customTemplateOptions||t)("ngTemplateOutletContext",te(4,Ve,r,e.inputValue))}}function Ie(i,n){if(i&1&&(c(0,"ul",5),K(1,Re,3,7,"li",15,$),a()),i&2){let r=p();s(),X(r.options)}}function We(i,n){if(i&1&&(c(0,"div",17)(1,"span",18),_(2,"fa-icon",19),a(),c(3,"span"),m(4),a(),c(5,"div",20),m(6),a()()),i&2){let r=n.active,e=p();s(2),u("icon",e.itemIcon)("fixedWidth",!1),s(2),k(r.name),s(2),k(r.description)}}function Ue(i,n){if(i&1&&(c(0,"a",21)(1,"div",17)(2,"span",18),_(3,"fa-icon",19),a(),_(4,"span",22),H(5,"highlight"),_(6,"span",23),H(7,"highlight"),a()()),i&2){let r=n.i,e=n.o,t=p();s(3),u("icon",t.itemIcon)("fixedWidth",!1),s(),u("innerHtml",t.sanitize(j(5,4,e.name,r)),T),s(2),u("innerHtml",t.sanitize(j(7,7,e.description,r)),T)}}var Tt=(()=>{let n=class n{constructor(){this.element=C(q),this.itemIcon=ue,this.allowClear=!0,this.placeholder="",this.idField="id",this.nameField="name",this.descriptionField="description",this.data=new O,this.selected=new O,this.removed=new O,this.typed=new O,this.opened=new O,this.options=[],this.itemObjects=[],this.inputMode=!1,this.inputValue="",this.onChange=Function.prototype,this.onTouched=Function.prototype,this.sanitizer=C(ne),this._items=[],this._optionsOpened=!1,this._disabled=!1,this._active=null,this.clickedOutside=this.clickedOutside.bind(this)}set items(e){if(!e.length){this._items=this.itemObjects=[],this.itemObjects=[];return}this._items=e.filter(t=>{if(typeof t=="string"||typeof t=="object"&&t&&t[this.nameField]&&t[this.idField])return t}),this.itemObjects=this._items.map(t=>typeof t=="string"?new S(t):new S({id:t[this.idField],name:t[this.nameField],description:t[this.descriptionField]}))}get optionsOpened(){return this._optionsOpened}set optionsOpened(e){this._optionsOpened=e,this.opened.emit(e)}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._disabled===!0&&this.hideOptions()}get active(){return this._active}set active(e){e?this._active=typeof e=="string"?e:new S({id:e[this.idField],name:e[this.nameField],description:e[this.descriptionField]}):this._active=null}sanitize(e){return this.sanitizer.bypassSecurityTrustHtml(e)}inputEvent(e,t=!1){if(e.keyCode===9)return;if(t&&(e.keyCode===37||e.keyCode===39||e.keyCode===38||e.keyCode===40||e.keyCode===13)){e.preventDefault();return}if(!t&&e.keyCode===8){let l=this.element.nativeElement.querySelector("div.ui-select-container > input");(!l.value||l.value.length<=0)&&(this.active&&this.remove(this.active),e.preventDefault())}if(!t&&e.keyCode===27){this.hideOptions(),e.preventDefault();return}if(!t&&e.keyCode===46&&(this.active&&this.remove(this.active),e.preventDefault()),!t&&e.keyCode===37&&this._items.length>0){this.behavior.first(),e.preventDefault();return}if(!t&&e.keyCode===39&&this._items.length>0){this.behavior.last(),e.preventDefault();return}if(!t&&e.keyCode===38){this.behavior.prev(),e.preventDefault();return}if(!t&&e.keyCode===40){this.behavior.next(),e.preventDefault();return}if(!t&&e.keyCode===13){(!this.active||this.active.id!==this.activeOption.id)&&(this.selectActiveMatch(),this.behavior.next()),e.preventDefault();return}let o=e.target||e.srcElement;o?(this.inputValue=o.value,this.doEvent("typed",this.inputValue||" ")):this.open()}ngOnInit(){this.subscription=this.typed.asObservable().pipe(I(200),W()).subscribe(e=>this.doSearch(e)),this.behavior=new R(this),this.doEvent("typed"," ")}ngOnDestroy(){this.subscription.unsubscribe()}remove(e){this._disabled!==!0&&(this.active=null,this.data.next(this.active),this.doEvent("removed",e),this.inputValue="",this.doEvent("typed"," "))}doEvent(e,t){this[e]&&t&&this[e].next(t),this.onTouched(),(e==="selected"||e==="removed")&&this.onChange(this.active)}clickedOutside(){this.inputMode=!1,this.optionsOpened=!1}writeValue(e){this.active=e,this.data.emit(this.active)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}matchClick(e){this._disabled!==!0&&(this.inputMode=!this.inputMode,this.inputMode===!0&&(this.focusToInput(),this.open()))}mainClick(e){if(this.inputMode===!0||this._disabled===!0)return;if(e.keyCode===46){e.preventDefault(),this.inputEvent(e);return}if(e.keyCode===8){e.preventDefault(),this.inputEvent(e,!0);return}if(e.keyCode===9||e.keyCode===13||e.keyCode===27||e.keyCode>=37&&e.keyCode<=40){e.preventDefault();return}this.inputMode=!0;let t=String.fromCharCode(96<=e.keyCode&&e.keyCode<=105?e.keyCode-48:e.keyCode).toLowerCase();this.focusToInput(t),this.open();let o=e.target||e.srcElement;o.value=t,this.inputEvent(e)}selectActive(e){this.activeOption=e}isActive(e){return this.activeOption.id===e.id}removeClick(e,t){t.stopPropagation(),this.remove(e)}focusToInput(e=""){setTimeout(()=>{let t=this.element.nativeElement.querySelector("div.ui-select-container > input");t&&(t.focus(),t.value=e)},0)}selectMatch(e,t=void 0){t&&(t.stopPropagation(),t.preventDefault()),!(this.options.length<=0)&&(this.active=e,this.data.next(this.active),this.doEvent("selected",e),this.hideOptions(),this.focusToInput(e.name),this.element.nativeElement.querySelector(".ui-select-container").focus())}doSearch(e){this.searchFunction(e).subscribe({next:t=>{this.items=t},error:t=>{console.error(t),this.items=[]},complete:()=>this.behavior.filter()})}open(){this.options=this.itemObjects,this.options.length>0&&this.behavior.first(),this.optionsOpened=!0}hideOptions(){this.inputMode=!1,this.optionsOpened=!1}selectActiveMatch(){this.selectMatch(this.activeOption)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-select"]],inputs:{searchFunction:"searchFunction",customTemplateOptions:"customTemplateOptions",customTemplateSelect:"customTemplateSelect",itemIcon:"itemIcon",allowClear:"allowClear",placeholder:"placeholder",idField:"idField",nameField:"nameField",descriptionField:"descriptionField",disabled:"disabled",active:"active"},outputs:{data:"data",selected:"selected",removed:"removed",typed:"typed",opened:"opened"},features:[Y([{provide:oe,useExisting:U(()=>n),multi:!0}])],decls:9,vars:5,consts:[["DefaultSelect",""],["DefaultOptions",""],[1,"ui-select-container","dropdown","open",3,"keyup","offClick"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"disabled"],[1,"ui-select-match","form-control","form-control-sm"],["role","menu",1,"ui-select-choices","dropdown-menu"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"keydown","keyup","disabled"],["tabindex","-1",1,"ui-select-toggle","no-select",2,"outline","0",3,"click"],[1,"ui-select-match-text","w-100",3,"ui-select-allow-clear"],[1,"ui-select-placeholder"],["aria-label","close","type","button",1,"btn-close"],[1,"dropdown-toggle"],[1,"ui-select-match-text","w-100"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["aria-label","close","type","button",1,"btn-close",3,"click"],["role","menuitem"],[1,"ui-select-choices-row",3,"click","mouseenter"],[1,"d-flex","align-items-center"],[1,"ui-icon","circle-primary-icon","me-2"],[3,"icon","fixedWidth"],[1,"d-flex","ms-auto","me-4","fs-xxxs","text-muted"],["href","javascript:void(0)",1,"dropdown-item","cursor-pointer",2,"padding","3px 5px"],[3,"innerHtml"],[1,"d-flex","ms-auto","fs-xxxs","text-muted",3,"innerHtml"]],template:function(t,o){if(t&1){let l=y();c(0,"div",2),h("keyup",function(E){return v(l),x(o.mainClick(E))}),_(1,"div"),f(2,Ge,1,1,"input",3)(3,Ne,6,2,"div",4),f(4,Ie,3,0,"ul",5),a(),w(5,We,7,4,"ng-template",null,0,z)(7,Ue,8,10,"ng-template",null,1,z)}t&2&&(u("offClick",o.clickedOutside),s(),b("ui-disabled",o.disabled),s(),g(o.inputMode?2:3),s(2),g(o.optionsOpened&&o.options&&o.options.length>0?4:-1))},dependencies:[be,P,ie,ye],styles:[`.ui-select-container[_ngcontent-%COMP%]{background-color:transparent;border-radius:4px}.ui-select-container.open[_ngcontent-%COMP%] > .dropdown-menu[_ngcontent-%COMP%]{display:block}.ui-select-container.open[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{outline:none}.ui-select-container[_ngcontent-%COMP%] .ui-icon[_ngcontent-%COMP%]{min-width:26px;min-height:26px;font-size:.85rem}.ui-select-container[_ngcontent-%COMP%] .ui-disabled[_ngcontent-%COMP%]{background-color:#d4dbe8;border-radius:4px;position:absolute;width:100%;height:100%;z-index:5;opacity:.6;top:0;left:0;cursor:not-allowed}.ui-select-container[_ngcontent-%COMP%] .ui-select-search[_ngcontent-%COMP%]{line-height:26px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%]{padding-left:.3rem}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{text-align:start!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .caret[_ngcontent-%COMP%]{position:absolute;top:45%;right:15px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .close[_ngcontent-%COMP%]{font-size:1.6em;line-height:.75}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%]{display:flex;align-items:center}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%] > .caret[_ngcontent-%COMP%]{position:absolute;height:10px;top:50%;right:10px;margin-top:-2px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-placeholder[_ngcontent-%COMP%]{float:left;line-height:26px;color:#8c8c8c;width:100%}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]{cursor:pointer}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]:after{display:inline-block!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%]{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{display:block;padding:3px 5px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .active[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{text-decoration:none;outline:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .dropdown-item[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{pointer-events:none}
2
2
 
3
3
 
4
4