homebridge-config-ui-x 5.0.0 → 5.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/child-bridges/child-bridges.service.d.ts +1 -5
- package/dist/modules/child-bridges/child-bridges.service.js +2 -8
- package/dist/modules/child-bridges/child-bridges.service.js.map +1 -1
- package/package.json +3 -3
- package/public/{chunk-H2VHR6F4.js → chunk-22J4EY4Y.js} +1 -1
- package/public/{chunk-KDVPFRHN.js → chunk-23Y7BPAN.js} +1 -1
- package/public/{chunk-S42WFQ2L.js → chunk-2CKLKY5R.js} +1 -1
- package/public/{chunk-6LPAR6QB.js → chunk-2LZEASRE.js} +1 -1
- package/public/{chunk-HFVA7EOG.js → chunk-2ZIMN6HQ.js} +1 -1
- package/public/{chunk-4J2HTHMW.js → chunk-3ZPN5PPV.js} +1 -1
- package/public/{chunk-W4PQWIYG.js → chunk-4AJSXM5Z.js} +1 -1
- package/public/{chunk-EGPBTPS6.js → chunk-4M5IBLFU.js} +1 -1
- package/public/{chunk-WF776GWR.js → chunk-4QBSVR54.js} +1 -1
- package/public/{chunk-4NQG4OIB.js → chunk-6ZV74JJX.js} +1 -1
- package/public/{chunk-TSAWRS7P.js → chunk-77L2MCKQ.js} +1 -1
- package/public/{chunk-HU7QTSUZ.js → chunk-7HL2NUIE.js} +1 -1
- package/public/{chunk-56R3JRVX.js → chunk-7NKVE7MW.js} +1 -1
- package/public/{chunk-FWNSHSUQ.js → chunk-ACNBCUWA.js} +1 -1
- package/public/{chunk-MWGI7ZLY.js → chunk-B3ZMTQUC.js} +1 -1
- package/public/{chunk-2V6GVJIK.js → chunk-BWV3SD3Z.js} +1 -1
- package/public/{chunk-52HWZQJT.js → chunk-DCXDGRPU.js} +1 -1
- package/public/{chunk-ZR6LFO7Q.js → chunk-EKGJ3N4Y.js} +1 -1
- package/public/{chunk-G4DWZG7U.js → chunk-F754W3WB.js} +1 -1
- package/public/{chunk-GPZM245P.js → chunk-HOWJDZVR.js} +1 -1
- package/public/{chunk-2RH7XRJB.js → chunk-HVI3LFAL.js} +1 -1
- package/public/chunk-IJVDEEEM.js +1 -0
- package/public/{chunk-CR7NFTHI.js → chunk-J2WQQ5XA.js} +1 -1
- package/public/{chunk-UB4DU2JC.js → chunk-JO7II7GX.js} +1 -1
- package/public/{chunk-OYH4UIAH.js → chunk-LM66QCFN.js} +1 -1
- package/public/{chunk-NEZ6TZYE.js → chunk-LYUKIQWV.js} +1 -1
- package/public/{chunk-ESCMWFTR.js → chunk-ME25VZ4V.js} +1 -1
- package/public/{chunk-UJNEXGXC.js → chunk-MHB4GJLL.js} +1 -1
- package/public/{chunk-XIYHNDRN.js → chunk-PQPAXVOA.js} +1 -1
- package/public/{chunk-YYDFCQK6.js → chunk-PXYSYTXG.js} +1 -1
- package/public/{chunk-FO44GZVZ.js → chunk-REKXMGJU.js} +1 -1
- package/public/{chunk-QUD3RGWL.js → chunk-RSFLPDGU.js} +1 -1
- package/public/{chunk-H5PKL3FP.js → chunk-RZBLN3JA.js} +1 -1
- package/public/{chunk-65A2CLMB.js → chunk-TANPXHFU.js} +1 -1
- package/public/{chunk-W542IB6H.js → chunk-TGV7QZLC.js} +1 -1
- package/public/{chunk-CEVLFYVV.js → chunk-TXNH42IW.js} +1 -1
- package/public/{chunk-KOHQYRVP.js → chunk-VAZOOXJZ.js} +1 -1
- package/public/{chunk-U4GBERFR.js → chunk-WK5S4AAU.js} +1 -1
- package/public/{chunk-YZN5MPV3.js → chunk-XIPV6S2E.js} +1 -1
- package/public/{chunk-EP7NNPU2.js → chunk-XSYDRPRP.js} +1 -1
- package/public/{chunk-OLDRUBZS.js → chunk-XYW3RCJ2.js} +1 -1
- package/public/{chunk-7RQP64IZ.js → chunk-YKDYWWHU.js} +1 -1
- package/public/{chunk-CY3O5ACI.js → chunk-YUBK6BVK.js} +1 -1
- package/public/{chunk-XFFCMC6L.js → chunk-YZBWQAXL.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-I6NBG3JJ.js → main-HHD5K3CT.js} +1 -1
- package/public/chunk-DVQU3KHF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as pe}from"./chunk-S42WFQ2L.js";import{m as le}from"./chunk-DVQU3KHF.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-ULJPS3WS.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.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(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),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",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=function(){let r=qe({xdomain:!1});return r&&r.responseType!==null}(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,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=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),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},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(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"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){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 i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=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||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(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}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,setTimeout(()=>{s.socket.connected&&s.connected.next(void 0)}),s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]}else{let s=this.establishConnectionToNamespace(t);return s.connected=new X,s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]=s,s}}getExistingNamespace(t){return this.namespaceConnectionCache[t]}establishConnectionToNamespace(t){let s=I(`${le.api.socket}/${t}`,{query:{token:this.$auth.token}});return{socket:s,request:(n,o)=>new he(c=>{s.emit(n,o,a=>{typeof a=="object"&&a.error?c.error(a):c.next(a),c.complete()})})}}static \u0275fac=function(s){return new(s||r)};static \u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{cr as a};
|
|
1
|
+
import{b as pe}from"./chunk-2CKLKY5R.js";import{m as le}from"./chunk-IJVDEEEM.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-ULJPS3WS.js";var d=Object.create(null);d.open="0";d.close="1";d.ping="2";d.pong="3";d.message="4";d.upgrade="5";d.noop="6";var S=Object.create(null);Object.keys(d).forEach(r=>{S[d[r]]=r});var O={type:"error",data:"parser error"};var ye=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ge=typeof ArrayBuffer=="function",_e=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,B=({type:r,data:e},t,s)=>ye&&e instanceof Blob?t?s(e):de(e,s):ge&&(e instanceof ArrayBuffer||_e(e))?t?s(e):de(new Blob([e]),s):s(d[r]+(e||"")),de=(r,e)=>{let t=new FileReader;return t.onload=function(){let s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(r)};function me(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var $;function be(r,e){if(ye&&r.data instanceof Blob)return r.data.arrayBuffer().then(me).then(e);if(ge&&(r.data instanceof ArrayBuffer||_e(r.data)))return e(me(r.data));B(r,!1,t=>{$||($=new TextEncoder),e($.encode(t))})}var we="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<we.length;r++)N[we.charCodeAt(r)]=r;var ke=r=>{let e=r.length*.75,t=r.length,s,i=0,n,o,c,a;r[r.length-1]==="="&&(e--,r[r.length-2]==="="&&e--);let m=new ArrayBuffer(e),p=new Uint8Array(m);for(s=0;s<t;s+=4)n=N[r.charCodeAt(s)],o=N[r.charCodeAt(s+1)],c=N[r.charCodeAt(s+2)],a=N[r.charCodeAt(s+3)],p[i++]=n<<2|o>>4,p[i++]=(o&15)<<4|c>>2,p[i++]=(c&3)<<6|a&63;return m};var Ke=typeof ArrayBuffer=="function",L=(r,e)=>{if(typeof r!="string")return{type:"message",data:Ee(r,e)};let t=r.charAt(0);return t==="b"?{type:"message",data:Ye(r.substring(1),e)}:S[t]?r.length>1?{type:S[t],data:r.substring(1)}:{type:S[t]}:O},Ye=(r,e)=>{if(Ke){let t=ke(r);return Ee(t,e)}else return{base64:!0,data:r}},Ee=(r,e)=>{switch(e){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var ve="",xe=(r,e)=>{let t=r.length,s=new Array(t),i=0;r.forEach((n,o)=>{B(n,!1,c=>{s[o]=c,++i===t&&e(s.join(ve))})})},Te=(r,e)=>{let t=r.split(ve),s=[];for(let i=0;i<t.length;i++){let n=L(t[i],e);if(s.push(n),n.type==="error")break}return s};function Ae(){return new TransformStream({transform(r,e){be(r,t=>{let s=t.length,i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);let n=new DataView(i.buffer);n.setUint8(0,126),n.setUint16(1,s)}else{i=new Uint8Array(9);let n=new DataView(i.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(s))}r.data&&typeof r.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}var Q;function U(r){return r.reduce((e,t)=>e+t.length,0)}function V(r,e){if(r[0].length===e)return r.shift();let t=new Uint8Array(e),s=0;for(let i=0;i<e;i++)t[i]=r[0][s++],s===r[0].length&&(r.shift(),s=0);return r.length&&s<r[0].length&&(r[0]=r[0].slice(s)),t}function Re(r,e){Q||(Q=new TextDecoder);let t=[],s=0,i=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(U(t)<1)break;let a=V(t,1);n=(a[0]&128)===128,i=a[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(U(t)<2)break;let a=V(t,2);i=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),s=3}else if(s===2){if(U(t)<8)break;let a=V(t,8),m=new DataView(a.buffer,a.byteOffset,a.length),p=m.getUint32(0);if(p>Math.pow(2,21)-1){c.enqueue(O);break}i=p*Math.pow(2,32)+m.getUint32(4),s=3}else{if(U(t)<i)break;let a=V(t,i);c.enqueue(L(n?a:Q.decode(a),e)),s=0}if(i===0||i>r){c.enqueue(O);break}}}})}var j=4;function f(r){if(r)return Je(r)}function Je(r){for(var e in f.prototype)r[e]=f.prototype[e];return r}f.prototype.on=f.prototype.addEventListener=function(r,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(e),this};f.prototype.once=function(r,e){function t(){this.off(r,t),e.apply(this,arguments)}return t.fn=e,this.on(r,t),this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(r,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+r];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+r],this};f.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+r],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};f.prototype.emitReserved=f.prototype.emit;f.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};f.prototype.hasListeners=function(r){return!!this.listeners(r).length};var y=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),u=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ce="arraybuffer";function M(r,...e){return e.reduce((t,s)=>(r.hasOwnProperty(s)&&(t[s]=r[s]),t),{})}var ze=u.setTimeout,Xe=u.clearTimeout;function g(r,e){e.useNativeTimers?(r.setTimeoutFn=ze.bind(u),r.clearTimeoutFn=Xe.bind(u)):(r.setTimeoutFn=u.setTimeout.bind(u),r.clearTimeoutFn=u.clearTimeout.bind(u))}var $e=1.33;function Se(r){return typeof r=="string"?Qe(r):Math.ceil((r.byteLength||r.size)*$e)}function Qe(r){let e=0,t=0;for(let s=0,i=r.length;s<i;s++)e=r.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function H(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(r){let e="";for(let t in r)r.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(r[t]));return e}function Be(r){let e={},t=r.split("&");for(let s=0,i=t.length;s<i;s++){let n=t[s].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var W=class extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}},_=class extends f{constructor(e){super(),this.writable=!1,g(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new W(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=L(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=Oe(e);return t.length?"?"+t:""}};var P=class extends _{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Te(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,xe(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=H()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}};var Ne=!1;try{Ne=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Le=Ne;function je(){}var G=class extends P{constructor(e){if(super(e),typeof location<"u"){let t=location.protocol==="https:",s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,n)=>{this.onError("xhr post error",i,n)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}},K=(()=>{class r extends f{constructor(t,s,i){super(),this.createRequest=t,g(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let s=M(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.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(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=je,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),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",Pe);else if(typeof addEventListener=="function"){let r="onpagehide"in u?"pagehide":"unload";addEventListener(r,Pe,!1)}}function Pe(){for(let r in K.requests)K.requests.hasOwnProperty(r)&&K.requests[r].abort()}var Ge=function(){let r=qe({xdomain:!1});return r&&r.responseType!==null}(),w=class extends G{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Ge&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new K(qe,this.uri(),e)}};function qe(r){let e=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Le))return new XMLHttpRequest}catch{}if(!e)try{return new u[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var De=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",ee=class extends _{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=De?{}:M(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;B(s,this.supportsBinary,n=>{try{this.doWrite(s,n)}catch{}i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=H()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},Z=u.WebSocket||u.MozWebSocket,k=class extends ee{createSocket(e,t,s){return De?new Z(e,t,s):t?new Z(e,t):new Z(e)}doWrite(e,t){this.ws.send(t)}};var v=class extends _{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Re(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ae();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();let n=()=>{s.read().then(({done:c,value:a})=>{c||(this.onPacket(a),n())}).catch(c=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var te={websocket:k,webtransport:v,polling:w};var Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function x(r){if(r.length>8e3)throw"URI too long";let e=r,t=r.indexOf("["),s=r.indexOf("]");t!=-1&&s!=-1&&(r=r.substring(0,t)+r.substring(t,s).replace(/:/g,";")+r.substring(s,r.length));let i=Ze.exec(r||""),n={},o=14;for(;o--;)n[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(n.source=e,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=tt(n,n.path),n.queryKey=st(n,n.query),n}function tt(r,e){let t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(r,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,n){i&&(t[i]=n)}),t}var se=typeof addEventListener=="function"&&typeof removeEventListener=="function",Y=[];se&&addEventListener("offline",()=>{Y.forEach(r=>r())},!1);var J=(()=>{class r extends f{constructor(t,s){if(super(),this.binaryType=Ce,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){let i=x(t);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=x(s.host).host);g(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),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},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Be(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"})},Y.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let s=Object.assign({},this.opts.query);s.EIO=j,s.transport=t,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Se(n)),i>0&&s>this._maxPayload)return this.writeBuffer.slice(0,i);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,i){return this._sendPacket("message",t,s,i),this}send(t,s,i){return this._sendPacket("message",t,s,i),this}_sendPacket(t,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let o={type:t,data:s,options:i};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){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 i=Y.indexOf(this._offlineEventListener);i!==-1&&Y.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=j,r})(),z=class extends J{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;J.priorWebsocketSuccess=!1;let i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let C=new Error("probe error");C.transport=t.name,this.emitReserved("upgradeError",C)}}))};function n(){s||(s=!0,p(),t.close(),t=null)}let o=b=>{let C=new Error("probe error: "+b);C.transport=t.name,n(),this.emitReserved("upgradeError",C)};function c(){o("transport closed")}function a(){o("socket closed")}function m(b){t&&b.name!==t.name&&n()}let p=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",m)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}},T=class extends z{constructor(e,t={}){let s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>te[i]).filter(i=>!!i)),super(e,s)}};var ds=T.protocol;function Fe(r,e="",t){let s=r;t=t||typeof location<"u"&&location,r==null&&(r=t.protocol+"//"+t.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=t.protocol+r:r=t.host+r),/^(https?|wss?):\/\//.test(r)||(typeof t<"u"?r=t.protocol+"//"+r:r="https://"+r),s=x(r)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let n=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+n+":"+s.port+e,s.href=s.protocol+"://"+n+(t&&t.port===s.port?"":":"+s.port),s}var ae={};We(ae,{Decoder:()=>oe,Encoder:()=>ne,PacketType:()=>h,protocol:()=>He});var it=typeof ArrayBuffer=="function",nt=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,Ie=Object.prototype.toString,ot=typeof Blob=="function"||typeof Blob<"u"&&Ie.call(Blob)==="[object BlobConstructor]",ct=typeof File=="function"||typeof File<"u"&&Ie.call(File)==="[object FileConstructor]";function D(r){return it&&(r instanceof ArrayBuffer||nt(r))||ot&&r instanceof Blob||ct&&r instanceof File}function q(r,e){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let t=0,s=r.length;t<s;t++)if(q(r[t]))return!0;return!1}if(D(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return q(r.toJSON(),!0);for(let t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&q(r[t]))return!0;return!1}function Ue(r){let e=[],t=r.data,s=r;return s.data=re(t,e),s.attachments=e.length,{packet:s,buffers:e}}function re(r,e){if(!r)return r;if(D(r)){let t={_placeholder:!0,num:e.length};return e.push(r),t}else if(Array.isArray(r)){let t=new Array(r.length);for(let s=0;s<r.length;s++)t[s]=re(r[s],e);return t}else if(typeof r=="object"&&!(r instanceof Date)){let t={};for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=re(r[s],e));return t}return r}function Ve(r,e){return r.data=ie(r.data,e),delete r.attachments,r}function ie(r,e){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<e.length)return e[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]=ie(r[t],e);else if(typeof r=="object")for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=ie(r[t],e));return r}var at=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],He=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||{}),ne=class{constructor(e){this.replacer=e}encode(e){return(e.type===h.EVENT||e.type===h.ACK)&&q(e)?this.encodeAsBinary({type:e.type===h.EVENT?h.BINARY_EVENT:h.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===h.BINARY_EVENT||e.type===h.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=Ue(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}};function Me(r){return Object.prototype.toString.call(r)==="[object Object]"}var oe=class r extends f{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let s=t.type===h.BINARY_EVENT;s||t.type===h.BINARY_ACK?(t.type=s?h.EVENT:h.ACK,this.reconstructor=new ce(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(D(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,s={type:Number(e.charAt(0))};if(h[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===h.BINARY_EVENT||s.type===h.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(n,t)}else s.nsp="/";let i=e.charAt(t+1);if(i!==""&&Number(i)==i){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(r.isPayloadValid(s.type,n))s.data=n;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case h.CONNECT:return Me(t);case h.DISCONNECT:return t===void 0;case h.CONNECT_ERROR:return typeof t=="string"||Me(t);case h.EVENT:case h.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&at.indexOf(t[0])===-1);case h.ACK:case h.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ce=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=Ve(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function l(r,e,t){return r.on(e,t),function(){r.off(e,t)}}var ht=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),A=class extends f{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[l(e,"open",this.onopen.bind(this)),l(e,"packet",this.onpacket.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,n;if(ht.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let o={type:h.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let p=this.ids++,b=t.pop();this._registerAckCallback(p,b),o.id=p}let c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,a=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!c||(a?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;let i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(n),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{let n=(o,c)=>o?i(o):s(c);n.withError=!0,t.push(n),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...n)=>s!==this._queue[0]?void 0:(i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...n)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:h.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){let s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case h.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h.EVENT:case h.BINARY_EVENT:this.onevent(e);break;case h.ACK:case h.BINARY_ACK:this.onack(e);break;case h.DISCONNECT:this.ondisconnect();break;case h.CONNECT_ERROR:this.destroy();let s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,s=!1;return function(...i){s||(s=!0,t.packet({type:h.ACK,id:e,data:i}))}}onack(e){let t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let s of t)s.apply(this,e.data)}}};function E(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}E.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*r);r=(Math.floor(e*10)&1)==0?r-t:r+t}return Math.min(r,this.max)|0};E.prototype.reset=function(){this.attempts=0};E.prototype.setMin=function(r){this.ms=r};E.prototype.setMax=function(r){this.max=r};E.prototype.setJitter=function(r){this.jitter=r};var R=class extends f{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,g(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new E({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let i=t.parser||ae;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new T(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let i=l(t,"open",function(){s.onopen(),e&&e()}),n=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=l(t,"error",n);if(this._timeout!==!1){let c=this._timeout,a=this.setTimeoutFn(()=>{i(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(l(e,"ping",this.onping.bind(this)),l(e,"data",this.ondata.bind(this)),l(e,"error",this.onerror.bind(this)),l(e,"close",this.onclose.bind(this)),l(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){y(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new A(this,e,t),this.nsps[e]=s),s}_destroy(e){let t=Object.keys(this.nsps);for(let s of t)if(this.nsps[s].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var F={};function I(r,e){typeof r=="object"&&(e=r,r=void 0),e=e||{};let t=Fe(r,e.path||"/socket.io"),s=t.source,i=t.id,n=t.path,o=F[i]&&n in F[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?a=new R(s,e):(F[i]||(F[i]=new R(s,e)),a=F[i]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(I,{Manager:R,Socket:A,io:I,connect:I});var cr=(()=>{class r{$auth=ue(pe);namespaceConnectionCache={};connectToNamespace(t){if(this.namespaceConnectionCache[t]){let s=this.namespaceConnectionCache[t];return s.connected=new X,setTimeout(()=>{s.socket.connected&&s.connected.next(void 0)}),s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]}else{let s=this.establishConnectionToNamespace(t);return s.connected=new X,s.socket.on("connect",()=>{s.connected.next(void 0)}),s.end=()=>{s.socket.emit("end"),s.socket.removeAllListeners(),s.connected.complete()},this.namespaceConnectionCache[t]=s,s}}getExistingNamespace(t){return this.namespaceConnectionCache[t]}establishConnectionToNamespace(t){let s=I(`${le.api.socket}/${t}`,{query:{token:this.$auth.token}});return{socket:s,request:(n,o)=>new he(c=>{s.emit(n,o,a=>{typeof a=="object"&&a.error?c.error(a):c.next(a),c.complete()})})}}static \u0275fac=function(s){return new(s||r)};static \u0275prov=fe({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{cr as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ne}from"./chunk-CXP6VKNZ.js";import{a as oe,b as le}from"./chunk-WDFAWIMZ.js";import{a as X,b as Z}from"./chunk-HUAADM2I.js";import{a as ie}from"./chunk-THGDS273.js";import{m as Y,n as G,t as Q}from"./chunk-C3HWKB2Q.js";import{c as J,e as K,l as U,z as W}from"./chunk-WFYBML4S.js";import{b as ee}from"./chunk-GEIS2BWE.js";import{b as te}from"./chunk-W4PQWIYG.js";import{k as D,n as I}from"./chunk-DVQU3KHF.js";import{a as S,b as A}from"./chunk-R3563DDE.js";import"./chunk-Q4CZ7LVK.js";import{Hb as b,Hc as r,Ib as d,Ic as s,Jb as c,Jc as q,Lb as P,Mb as B,Nb as L,Ob as v,Pb as y,Qb as w,Rb as x,Sb as m,Tb as u,Ub as V,_b as _,ab as n,bc as E,cc as k,dc as a,fb as R,g as se,h as j,la as h,mb as M,pd as z,qc as C,ra as f,rc as $,sa as g,sc as T,w as H,xc as O,yc as N,zc as F}from"./chunk-ULJPS3WS.js";var ae=se(le(),1);function ce(o,p){o&1&&(m(0,"div",5),V(1,"i",12),u())}function me(o,p){if(o&1){let e=_();m(0,"li",17),C(1),r(2,"date"),m(3,"button",18),r(4,"translate"),k("click",function(){let t=f(e).$implicit,l=a(3);return g(l.restore(t.id))}),V(5,"i",19),u()()}if(o&2){let e=p.$implicit;n(),T(" ",q(2,2,e.timestamp,"medium")," "),n(2),b("aria-label",s(4,5,"config.restore.copy_to_editor"))}}function pe(o,p){if(o&1&&(m(0,"ul",15),B(1,me,6,7,"li",17,P),u()),o&2){let e=a(2);n(),L(e.backupList)}}function fe(o,p){o&1&&(m(0,"p",16),C(1),r(2,"translate"),u()),o&2&&(n(),$(s(2,1,"config.restore.no_backups")))}function ge(o,p){if(o&1&&(m(0,"div",13),V(1,"i",14),u(),m(2,"p",13),C(3),r(4,"translate"),u(),d(5,pe,3,0,"ul",15),d(6,fe,3,3,"p",16)),o&2){let e=a();n(3),$(s(4,3,"config.restore.title_restore_homebridge_backup")),n(2),c(e.backupList&&e.backupList.length?5:-1),n(),c(!e.backupList||!e.backupList.length?6:-1)}}function ue(o,p){if(o&1){let e=_();m(0,"button",20),r(1,"translate"),k("click",function(){f(e);let t=a();return g(t.dismissModal())}),C(2),r(3,"translate"),u()}o&2&&(b("aria-label",s(1,2,"form.button_close")),n(2),T(" ",s(3,4,"form.button_close")," "))}function he(o,p){if(o&1){let e=_();m(0,"button",20),r(1,"translate"),k("click",function(){f(e);let t=a();return g(t.dismissModal())}),C(2),r(3,"translate"),u()}o&2&&(b("aria-label",s(1,2,"form.button_close")),n(2),T(" ",s(3,4,"form.button_close")," "))}function _e(o,p){if(o&1){let e=_();m(0,"button",21),r(1,"translate"),k("click",function(){f(e);let t=a();return g(t.deleteAllBackups())}),C(2),r(3,"translate"),u()}o&2&&(b("aria-label",s(1,2,"form.button_remove")),n(2),T(" ",s(3,4,"form.button_remove")," "))}var re=(()=>{class o{$activeModal=h(Y);$api=h(I);$toastr=h(D);$translate=h(S);loading=!0;backupList=[];ngOnInit(){this.$api.get("/config-editor/backups").subscribe({next:e=>{this.loading=!1,this.backupList=e},error:e=>{this.loading=!1,console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}restore(e){return this.$activeModal.close(e)}deleteAllBackups(){return this.$api.delete("/config-editor/backups").subscribe({next:()=>{this.$activeModal.dismiss(),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success"))},error:e=>{console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(i){return new(i||o)};static \u0275cmp=M({type:o,selectors:[["ng-component"]],decls:17,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button",1,"btn","btn-danger","me-auto"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-history","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box"],[1,"text-center","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"btn","btn-primary","m-0","ms-3",3,"click"],[1,"fas","fa-fw","fa-arrow-right"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button",1,"btn","btn-danger","me-auto",3,"click"]],template:function(i,t){i&1&&(m(0,"div",0)(1,"div",1)(2,"h5",2),C(3),r(4,"translate"),u(),m(5,"button",3),r(6,"translate"),k("click",function(){return t.dismissModal()}),u()(),m(7,"div",4),d(8,ce,2,0,"div",5),d(9,ge,7,5),u(),m(10,"div",6)(11,"div",7),d(12,ue,4,6,"button",8),u(),m(13,"div",9),d(14,he,4,6,"button",8),u(),m(15,"div",10),d(16,_e,4,6,"button",11),u()()()),i&2&&(n(3),$(s(4,7,"form.button_restore")),n(2),b("aria-label",s(6,9,"form.button_close")),n(3),c(t.loading?8:-1),n(),c(t.loading?-1:9),n(3),c(!t.loading&&t.backupList.length?12:-1),n(2),c(t.loading||!t.loading&&!t.backupList.length?14:-1),n(2),c(!t.loading&&t.backupList.length?16:-1))},dependencies:[z,A],encapsulation:2})}return o})();function be(o,p){if(o&1){let e=_();y(0,"button",13),r(1,"translate"),r(2,"translate"),E("click",function(){f(e);let t=a();return g(t.onExportConfig())}),x(3,"i",14),w()}o&2&&(v("ngbTooltip",s(1,2,"form.button_download")),b("aria-label",s(2,4,"form.button_download")))}function Ce(o,p){if(o&1){let e=_();y(0,"button",15),r(1,"translate"),r(2,"translate"),E("click",function(){f(e);let t=a();return g(t.onCancelRestore())}),x(3,"i",16),w()}if(o&2){let e=a();v("disabled",e.saveInProgress)("ngbTooltip",s(1,3,"form.button_cancel")),b("aria-label",s(2,5,"form.button_cancel"))}}function ye(o,p){if(o&1){let e=_();y(0,"button",13),r(1,"translate"),r(2,"translate"),E("click",function(){f(e);let t=a();return g(t.onRestore())}),x(3,"i",17),w()}o&2&&(v("ngbTooltip",s(1,2,"form.button_restore")),b("aria-label",s(2,4,"form.button_restore")))}function we(o,p){o&1&&x(0,"i",8)}function ve(o,p){o&1&&x(0,"i",9)}function Ee(o,p){if(o&1){let e=_();y(0,"ngx-monaco-editor",18),E("onInit",function(t){f(e);let l=a();return g(l.onEditorInit(t))})("keydown.control.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())})("keydown.meta.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())}),w()}if(o&2){let e=a();v("options",e.editorOptions)("model",e.monacoEditorModel)}}function xe(o,p){if(o&1){let e=_();y(0,"ngx-monaco-diff-editor",19),E("onInit",function(t){f(e);let l=a();return g(l.onInitDiffEditor(t))})("keydown.control.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())})("keydown.meta.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())}),w()}if(o&2){let e=a();v("options",e.editorOptions)("originalModel",e.monacoEditorModel)("modifiedModel",e.monacoEditorModel)}}function ke(o,p){if(o&1){let e=_();y(0,"textarea",20),F("ngModelChange",function(t){f(e);let l=a();return N(l.homebridgeConfig,t)||(l.homebridgeConfig=t),g(t)}),C(1," "),w()}if(o&2){let e=a();O("ngModel",e.homebridgeConfig)}}var Ge=(()=>{class o{$api=h(I);$md=h(ie);$modal=h(G);$monacoEditor=h(ne);$route=h(ee);$renderer=h(R);$settings=h(te);$toastr=h(D);$translate=h(S);editorDecorations=[];lastHeight;visualViewPortEventCallback;homebridgeConfig;originalConfig;saveInProgress;isMobile=!1;monacoEditor;editorOptions;monacoEditorModel;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(i=>{this.homebridgeConfig=i.config}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>{this.setMonacoEditorModel()}})}onEditorInit(e){window.editor=e,this.monacoEditor=e,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(e){this.monacoEditor=e.modifiedEditor,e.getModel().original.setValue(this.originalConfig),e.getModel().modified.setValue(this.homebridgeConfig),window.editor=e}onSave(){return j(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let i=window.monaco.editor.getModelMarkers({owner:"json"});for(let t of i)if(t.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let e=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(e,null,4),typeof e.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(e.bridge.username)?e.accessories&&!Array.isArray(e.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&!Array.isArray(e.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&Array.isArray(e.platforms)&&!this.validateSection(e.platforms,"platform")||e.accessories&&Array.isArray(e.accessories)&&!this.validateSection(e.accessories,"accessory")||e.plugins&&Array.isArray(e.plugins)&&!this.validatePlugins(e.plugins,"plugins")||e.disabledPlugins&&Array.isArray(e.disabledPlugins)&&!this.validatePlugins(e.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(e),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}onRestore(){this.$modal.open(re,{size:"lg",backdrop:"static"}).result.then(e=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig),this.$api.get(`/config-editor/backups/${e}`).subscribe({next:i=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(i,null,4),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig,forceMoveMarkers:!0}]))},error:i=>{console.error(i),this.$toastr.error(i.error.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onExportConfig(){let e=`data:text/json;charset=utf-8,${encodeURIComponent(this.homebridgeConfig)}`,i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download","config.json"),document.body.appendChild(i),i.click(),i.remove()}onCancelRestore(){this.homebridgeConfig=this.originalConfig,this.originalConfig=""}ngOnDestroy(){let e=document.querySelector(".content");this.$renderer.removeStyle(e,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove()),this.monacoEditor&&this.monacoEditor.dispose()}validateSection(e,i){for(let t of e){if(typeof t!="object"||Array.isArray(t))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(!t[i])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(typeof t[i]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1}return!0}validatePlugins(e,i){for(let t of e)if(typeof t!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:i}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(e){this.monacoEditor&&(e=JSON.stringify(e,null,4).split(`
|
|
1
|
+
import{a as ne}from"./chunk-CXP6VKNZ.js";import{a as oe,b as le}from"./chunk-WDFAWIMZ.js";import{a as X,b as Z}from"./chunk-HUAADM2I.js";import{a as ie}from"./chunk-THGDS273.js";import{m as Y,n as G,t as Q}from"./chunk-C3HWKB2Q.js";import{c as J,e as K,l as U,z as W}from"./chunk-WFYBML4S.js";import{b as ee}from"./chunk-GEIS2BWE.js";import{b as te}from"./chunk-4AJSXM5Z.js";import{k as D,n as I}from"./chunk-IJVDEEEM.js";import{a as S,b as A}from"./chunk-R3563DDE.js";import"./chunk-Q4CZ7LVK.js";import{Hb as b,Hc as r,Ib as d,Ic as s,Jb as c,Jc as q,Lb as P,Mb as B,Nb as L,Ob as v,Pb as y,Qb as w,Rb as x,Sb as m,Tb as u,Ub as V,_b as _,ab as n,bc as E,cc as k,dc as a,fb as R,g as se,h as j,la as h,mb as M,pd as z,qc as C,ra as f,rc as $,sa as g,sc as T,w as H,xc as O,yc as N,zc as F}from"./chunk-ULJPS3WS.js";var ae=se(le(),1);function ce(o,p){o&1&&(m(0,"div",5),V(1,"i",12),u())}function me(o,p){if(o&1){let e=_();m(0,"li",17),C(1),r(2,"date"),m(3,"button",18),r(4,"translate"),k("click",function(){let t=f(e).$implicit,l=a(3);return g(l.restore(t.id))}),V(5,"i",19),u()()}if(o&2){let e=p.$implicit;n(),T(" ",q(2,2,e.timestamp,"medium")," "),n(2),b("aria-label",s(4,5,"config.restore.copy_to_editor"))}}function pe(o,p){if(o&1&&(m(0,"ul",15),B(1,me,6,7,"li",17,P),u()),o&2){let e=a(2);n(),L(e.backupList)}}function fe(o,p){o&1&&(m(0,"p",16),C(1),r(2,"translate"),u()),o&2&&(n(),$(s(2,1,"config.restore.no_backups")))}function ge(o,p){if(o&1&&(m(0,"div",13),V(1,"i",14),u(),m(2,"p",13),C(3),r(4,"translate"),u(),d(5,pe,3,0,"ul",15),d(6,fe,3,3,"p",16)),o&2){let e=a();n(3),$(s(4,3,"config.restore.title_restore_homebridge_backup")),n(2),c(e.backupList&&e.backupList.length?5:-1),n(),c(!e.backupList||!e.backupList.length?6:-1)}}function ue(o,p){if(o&1){let e=_();m(0,"button",20),r(1,"translate"),k("click",function(){f(e);let t=a();return g(t.dismissModal())}),C(2),r(3,"translate"),u()}o&2&&(b("aria-label",s(1,2,"form.button_close")),n(2),T(" ",s(3,4,"form.button_close")," "))}function he(o,p){if(o&1){let e=_();m(0,"button",20),r(1,"translate"),k("click",function(){f(e);let t=a();return g(t.dismissModal())}),C(2),r(3,"translate"),u()}o&2&&(b("aria-label",s(1,2,"form.button_close")),n(2),T(" ",s(3,4,"form.button_close")," "))}function _e(o,p){if(o&1){let e=_();m(0,"button",21),r(1,"translate"),k("click",function(){f(e);let t=a();return g(t.deleteAllBackups())}),C(2),r(3,"translate"),u()}o&2&&(b("aria-label",s(1,2,"form.button_remove")),n(2),T(" ",s(3,4,"form.button_remove")," "))}var re=(()=>{class o{$activeModal=h(Y);$api=h(I);$toastr=h(D);$translate=h(S);loading=!0;backupList=[];ngOnInit(){this.$api.get("/config-editor/backups").subscribe({next:e=>{this.loading=!1,this.backupList=e},error:e=>{this.loading=!1,console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}restore(e){return this.$activeModal.close(e)}deleteAllBackups(){return this.$api.delete("/config-editor/backups").subscribe({next:()=>{this.$activeModal.dismiss(),this.$toastr.success(this.$translate.instant("config.restore.toast_backups_deleted"),this.$translate.instant("toast.title_success"))},error:e=>{console.error(e),this.$toastr.error(e.error.message||e.message,this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(i){return new(i||o)};static \u0275cmp=M({type:o,selectors:[["ng-component"]],decls:17,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","primary-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button",1,"btn","btn-danger","me-auto"],[1,"fa","fa-fw","fa-cog","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-history","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box"],[1,"text-center","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"btn","btn-primary","m-0","ms-3",3,"click"],[1,"fas","fa-fw","fa-arrow-right"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button",1,"btn","btn-danger","me-auto",3,"click"]],template:function(i,t){i&1&&(m(0,"div",0)(1,"div",1)(2,"h5",2),C(3),r(4,"translate"),u(),m(5,"button",3),r(6,"translate"),k("click",function(){return t.dismissModal()}),u()(),m(7,"div",4),d(8,ce,2,0,"div",5),d(9,ge,7,5),u(),m(10,"div",6)(11,"div",7),d(12,ue,4,6,"button",8),u(),m(13,"div",9),d(14,he,4,6,"button",8),u(),m(15,"div",10),d(16,_e,4,6,"button",11),u()()()),i&2&&(n(3),$(s(4,7,"form.button_restore")),n(2),b("aria-label",s(6,9,"form.button_close")),n(3),c(t.loading?8:-1),n(),c(t.loading?-1:9),n(3),c(!t.loading&&t.backupList.length?12:-1),n(2),c(t.loading||!t.loading&&!t.backupList.length?14:-1),n(2),c(!t.loading&&t.backupList.length?16:-1))},dependencies:[z,A],encapsulation:2})}return o})();function be(o,p){if(o&1){let e=_();y(0,"button",13),r(1,"translate"),r(2,"translate"),E("click",function(){f(e);let t=a();return g(t.onExportConfig())}),x(3,"i",14),w()}o&2&&(v("ngbTooltip",s(1,2,"form.button_download")),b("aria-label",s(2,4,"form.button_download")))}function Ce(o,p){if(o&1){let e=_();y(0,"button",15),r(1,"translate"),r(2,"translate"),E("click",function(){f(e);let t=a();return g(t.onCancelRestore())}),x(3,"i",16),w()}if(o&2){let e=a();v("disabled",e.saveInProgress)("ngbTooltip",s(1,3,"form.button_cancel")),b("aria-label",s(2,5,"form.button_cancel"))}}function ye(o,p){if(o&1){let e=_();y(0,"button",13),r(1,"translate"),r(2,"translate"),E("click",function(){f(e);let t=a();return g(t.onRestore())}),x(3,"i",17),w()}o&2&&(v("ngbTooltip",s(1,2,"form.button_restore")),b("aria-label",s(2,4,"form.button_restore")))}function we(o,p){o&1&&x(0,"i",8)}function ve(o,p){o&1&&x(0,"i",9)}function Ee(o,p){if(o&1){let e=_();y(0,"ngx-monaco-editor",18),E("onInit",function(t){f(e);let l=a();return g(l.onEditorInit(t))})("keydown.control.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())})("keydown.meta.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())}),w()}if(o&2){let e=a();v("options",e.editorOptions)("model",e.monacoEditorModel)}}function xe(o,p){if(o&1){let e=_();y(0,"ngx-monaco-diff-editor",19),E("onInit",function(t){f(e);let l=a();return g(l.onInitDiffEditor(t))})("keydown.control.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())})("keydown.meta.s",function(t){f(e);let l=a();return t.preventDefault(),g(l.onSave())}),w()}if(o&2){let e=a();v("options",e.editorOptions)("originalModel",e.monacoEditorModel)("modifiedModel",e.monacoEditorModel)}}function ke(o,p){if(o&1){let e=_();y(0,"textarea",20),F("ngModelChange",function(t){f(e);let l=a();return N(l.homebridgeConfig,t)||(l.homebridgeConfig=t),g(t)}),C(1," "),w()}if(o&2){let e=a();O("ngModel",e.homebridgeConfig)}}var Ge=(()=>{class o{$api=h(I);$md=h(ie);$modal=h(G);$monacoEditor=h(ne);$route=h(ee);$renderer=h(R);$settings=h(te);$toastr=h(D);$translate=h(S);editorDecorations=[];lastHeight;visualViewPortEventCallback;homebridgeConfig;originalConfig;saveInProgress;isMobile=!1;monacoEditor;editorOptions;monacoEditorModel;constructor(){this.isMobile=this.$md.detect.mobile()}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light",automaticLayout:!0};let e=document.querySelector(".content");this.$renderer.setStyle(e,"height","100%"),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.visualViewPortEventCallback=()=>this.visualViewPortChanged(),this.lastHeight=window.innerHeight,window.visualViewport&&!this.isMobile&&(window.visualViewport.addEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.disableTouchMove()),this.$route.data.subscribe(i=>{this.homebridgeConfig=i.config}),this.monacoEditorModel={value:"{}",language:"json",uri:window.monaco?window.monaco.Uri.parse("a://homebridge/config.json"):void 0},window.monaco?this.setMonacoEditorModel():this.$monacoEditor.readyEvent.subscribe({next:()=>{this.setMonacoEditorModel()}})}onEditorInit(e){window.editor=e,this.monacoEditor=e,this.monacoEditor.getModel().setValue(this.homebridgeConfig)}onInitDiffEditor(e){this.monacoEditor=e.modifiedEditor,e.getModel().original.setValue(this.originalConfig),e.getModel().modified.setValue(this.homebridgeConfig),window.editor=e}onSave(){return j(this,null,function*(){if(!this.saveInProgress){this.monacoEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[])),this.saveInProgress=!0;try{if(!this.isMobile){yield this.monacoEditor.getAction("editor.action.formatDocument").run();let i=window.monaco.editor.getModelMarkers({owner:"json"});for(let t of i)if(t.message==="Duplicate object key"){this.saveInProgress=!1,this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"));return}this.homebridgeConfig=this.monacoEditor.getModel().getValue()}let e=this.parseConfigFromEditor();this.homebridgeConfig=JSON.stringify(e,null,4),typeof e.bridge!="object"?this.$toastr.error(this.$translate.instant("config.config_bridge_missing"),this.$translate.instant("toast.title_error")):/^(?:[0-9A-F]{2}:){5}[0-9A-F]{2}$/i.test(e.bridge.username)?e.accessories&&!Array.isArray(e.accessories)?this.$toastr.error(this.$translate.instant("config.config_accessory_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&!Array.isArray(e.platforms)?this.$toastr.error(this.$translate.instant("config.config_platform_must_be_array"),this.$translate.instant("toast.title_error")):e.platforms&&Array.isArray(e.platforms)&&!this.validateSection(e.platforms,"platform")||e.accessories&&Array.isArray(e.accessories)&&!this.validateSection(e.accessories,"accessory")||e.plugins&&Array.isArray(e.plugins)&&!this.validatePlugins(e.plugins,"plugins")||e.disabledPlugins&&Array.isArray(e.disabledPlugins)&&!this.validatePlugins(e.disabledPlugins,"disabledPlugins")||(yield this.saveConfig(e),this.originalConfig=""):this.$toastr.error(this.$translate.instant("config.config_username_error"),this.$translate.instant("toast.title_error"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error"))}this.saveInProgress=!1}})}onRestore(){this.$modal.open(re,{size:"lg",backdrop:"static"}).result.then(e=>{this.originalConfig||(this.originalConfig=this.homebridgeConfig),this.$api.get(`/config-editor/backups/${e}`).subscribe({next:i=>{this.$toastr.info(this.$translate.instant("config.restore.confirm"),this.$translate.instant("config.title_backup_loaded")),this.homebridgeConfig=JSON.stringify(i,null,4),this.monacoEditor&&window.editor.modifiedEditor&&(this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[]),this.monacoEditor.executeEdits("beautifier",[{identifier:"delete",range:new monaco.Range(1,1,this.monacoEditor.getModel().getLineCount()+10,1),text:"",forceMoveMarkers:!0}]),this.monacoEditor.executeEdits("beautifier",[{identifier:"insert",range:new monaco.Range(1,1,1,1),text:this.homebridgeConfig,forceMoveMarkers:!0}]))},error:i=>{console.error(i),this.$toastr.error(i.error.message||this.$translate.instant("backup.load_error"),this.$translate.instant("toast.title_error"))}})}).catch(()=>{})}onExportConfig(){let e=`data:text/json;charset=utf-8,${encodeURIComponent(this.homebridgeConfig)}`,i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("download","config.json"),document.body.appendChild(i),i.click(),i.remove()}onCancelRestore(){this.homebridgeConfig=this.originalConfig,this.originalConfig=""}ngOnDestroy(){let e=document.querySelector(".content");this.$renderer.removeStyle(e,"height"),window.visualViewport&&(window.visualViewport.removeEventListener("resize",this.visualViewPortEventCallback,!0),this.$md.enableTouchMove()),this.monacoEditor&&this.monacoEditor.dispose()}validateSection(e,i){for(let t of e){if(typeof t!="object"||Array.isArray(t))return this.$toastr.error(this.$translate.instant("config.error_blocks_objects",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(!t[i])return this.$toastr.error(this.$translate.instant("config.error_blocks_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1;if(typeof t[i]!="string")return this.$toastr.error(this.$translate.instant("config.error_string_type",{type:i}),this.$translate.instant("toast.title_error")),this.highlightOffendingArrayItem(t),!1}return!0}validatePlugins(e,i){for(let t of e)if(typeof t!="string")return this.$toastr.error(this.$translate.instant("config.error_string_array",{key:i}),this.$translate.instant("toast.title_error")),!1;return!0}highlightOffendingArrayItem(e){this.monacoEditor&&(e=JSON.stringify(e,null,4).split(`
|
|
2
2
|
`).map(i=>` ${i}`).join(`
|
|
3
3
|
`),setTimeout(()=>{let i=this.monacoEditor.getModel().findMatches(e);if(i.length){let t=i[0].range,l=new monaco.Range(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn);this.editorDecorations=this.monacoEditor.deltaDecorations(this.editorDecorations,[{range:l,options:{isWholeLine:!0,linesDecorationsClassName:"hb-monaco-editor-line-error"}}])}},200))}setMonacoEditorModel(){if(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.some(i=>i.uri==="http://homebridge/config.json"))return;let e=monaco.Uri.parse("a://homebridge/config.json");window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({allowComments:!1,validate:!0,schemas:[{uri:"http://homebridge/config.json",fileMatch:[e.toString()],schema:{type:"object",required:["bridge"],properties:{bridge:{type:"object",required:["name","username","port","pin"],properties:{name:{type:"string",description:`The Homebridge instance name.
|
|
4
4
|
This should be unique if you are running multiple instances of Homebridge.`,default:"Homebridge"},username:{type:"string",description:`Homebridge username must be 6 pairs of colon-separated hexadecimal characters (A-F 0-9).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as w}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-TXNH42IW.js";import"./chunk-2CKLKY5R.js";import{d as $}from"./chunk-GEIS2BWE.js";import{b as S}from"./chunk-4AJSXM5Z.js";import{k as E,n as y}from"./chunk-IJVDEEEM.js";import{a as g,b as _}from"./chunk-R3563DDE.js";import"./chunk-Q4CZ7LVK.js";import{Hc as m,Ib as c,Ic as l,Jb as d,Sb as r,Tb as i,Ub as f,ab as n,dc as v,la as o,mb as h,qc as a,rc as s}from"./chunk-ULJPS3WS.js";function T(t,u){if(t&1&&(r(0,"div",7),a(1),i()),t&2){let e=v();n(),s(e.error)}}function C(t,u){t&1&&(r(0,"p",9),a(1),m(2,"translate"),i(),r(3,"div",10)(4,"div",11),f(5,"i",12),i()()),t&2&&(n(),s(l(2,1,"restart.please_wait_while_server_restarts")))}function k(t,u){t&1&&(r(0,"div",8),a(1),m(2,"translate"),i()),t&2&&(n(),s(l(2,1,"platform.linux.long_time")))}var z=(()=>{class t{$api=o(y);$router=o($);$settings=o(S);$toastr=o(E);$translate=o(g);$ws=o(w);checkTimeout;checkDelay;io;resp={};timeout=!1;error=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$api.put("/platform-tools/linux/restart-host",{}).subscribe({next:e=>{this.resp=e,this.checkIfServerUp()},error:e=>{console.error(e),this.error=this.$translate.instant("platform.linux.server_restart_error"),this.$toastr.error(this.$translate.instant("platform.linux.server_restart_error"),this.$translate.instant("toast.title_error"))}})}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("platform.linux.server_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},3e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("platform.linux.server_taking_long_time"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},12e4)}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=h({type:t,selectors:[["ng-component"]],decls:14,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"alert","alert-warning","my-4"],[1,"grey-text"],[1,"justify-content-center","my-4"],[1,"restart-progress-box","primary-text"],[1,"fas","fa-fw","fa-spinner","fa-spin"]],template:function(p,x){p&1&&(r(0,"div",0)(1,"h3",1),a(2),m(3,"translate"),i()(),r(4,"div",2)(5,"div",3),f(6,"i",4),i(),r(7,"div",5)(8,"h4",6),a(9),m(10,"translate"),i(),c(11,T,2,1,"div",7)(12,C,6,3),c(13,k,3,3,"div",8),i()()),p&2&&(n(2),s(l(3,4,"menu.restart.title")),n(7),s(l(10,6,"platform.linux.restarting_server")),n(2),d(x.error?11:12),n(2),d(x.timeout?13:-1))},dependencies:[_],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{z as RestartLinuxComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A,c as $,d as C,e as R,f as O,g as T,j as w,m as q,p as z,q as D,w as H,x as G,z as Q}from"./chunk-WFYBML4S.js";import{b as K}from"./chunk-
|
|
1
|
+
import{A,c as $,d as C,e as R,f as O,g as T,j as w,m as q,p as z,q as D,w as H,x as G,z as Q}from"./chunk-WFYBML4S.js";import{b as K}from"./chunk-2CKLKY5R.js";import{d as U}from"./chunk-GEIS2BWE.js";import{b as J}from"./chunk-4AJSXM5Z.js";import{m as W}from"./chunk-IJVDEEEM.js";import{b as j}from"./chunk-R3563DDE.js";import"./chunk-Q4CZ7LVK.js";import{Dc as f,Hc as l,Ib as u,Ic as d,Jb as c,M as I,Ob as m,Pb as r,Qb as a,Rb as s,Sc as b,Uc as V,Xa as x,ab as i,bc as E,dc as M,h as y,id as P,kc as v,la as p,lc as F,ld as B,mb as k,qc as g,rc as h,sc as L,w as S,zd as N}from"./chunk-ULJPS3WS.js";var Y=["password"],Z=["username"],ee=["otp"],te=e=>({background:e}),ie=e=>({anim:e}),X=e=>({"is-invalid":e});function ne(e,_){if(e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",13),a(),s(3,"input",14,0),l(5,"translate"),a(),r(6,"div",8)(7,"span",12),s(8,"i",15),a(),s(9,"input",16,1),l(11,"translate"),a()),e&2){let n=M();i(3),m("placeholder",d(5,4,"users.label_username"))("ngClass",f(8,X,n.form.controls.username.dirty&&n.form.controls.username.errors)),i(6),m("placeholder",d(11,6,"users.label_password"))("ngClass",f(10,X,n.form.controls.password.dirty&&n.form.controls.password.errors))}}function oe(e,_){e&1&&(r(0,"div",8)(1,"span",12),s(2,"i",17),a(),s(3,"input",18,2),l(5,"translate"),a()),e&2&&(i(3),m("placeholder",d(5,1,"login.label_2fa_code")))}function ae(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_credentials")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}function re(e,_){e&1&&(r(0,"div",9)(1,"div",12),s(2,"i",19),a(),r(3,"div",20)(4,"div",21),g(5),l(6,"translate"),a(),s(7,"div",22),l(8,"translate"),a()()),e&2&&(i(5),h(d(6,2,"login.invalid_code")),i(2),m("innerHTML",d(8,4,"login.invalid_credentials_2"),x))}var _e=(()=>{class e{$auth=p(K);$cdr=p(V);$router=p(U);$settings=p(J);targetRoute;passwordInput=b("password");usernameInput=b("username");otpInput=b("otp");backgroundStyle;invalidCredentials=!1;invalid2faCode=!1;twoFactorCodeRequired=!1;inProgress=!1;form;ngOnInit(){this.form=new T({username:new w(""),password:new w("")}),this.form.valueChanges.pipe(I(500)).subscribe(n=>{let o=this.passwordInput()?.nativeElement.value;o&&o!==n.password&&this.form.controls.password.setValue(o)}),this.targetRoute=window.sessionStorage.getItem("target_route")||"",this.setBackground()}ngAfterViewChecked(){this.$cdr.detectChanges()}onSubmit(){return y(this,null,function*(){this.invalidCredentials=!1,this.invalid2faCode=!1,this.inProgress=!0,document.getElementById("submit-button")?.blur();let n=this.passwordInput()?.nativeElement.value;n&&n!==this.form.get("password").value&&this.form.controls.password.setValue(n);let o=this.usernameInput()?.nativeElement.value;if(o&&o!==this.form.get("username").value&&this.form.controls.username.setValue(o),this.twoFactorCodeRequired){let t=this.otpInput()?.nativeElement.value;t&&t!==this.form.get("otp").value&&this.form.controls.username.setValue(t)}try{yield this.$auth.login(this.form.getRawValue()),this.$router.navigateByUrl(this.targetRoute),window.sessionStorage.removeItem("target_route")}catch(t){t.status===412?(this.form.controls.otp?(this.form.controls.otp.setErrors(["Invalid Code"]),this.invalid2faCode=!0):this.form.addControl("otp",new w("",[C.required,C.minLength(6),C.maxLength(6)])),this.twoFactorCodeRequired=!0,setTimeout(()=>{document.getElementById("form-ota").focus()},100)):this.invalidCredentials=!0}this.inProgress=!1})}setBackground(){return y(this,null,function*(){if(this.$settings.settingsLoaded||(yield S(this.$settings.onSettingsLoaded)),this.$settings.env.customWallpaperHash){let n=`${W.api.base}/auth/wallpaper/${this.$settings.env.customWallpaperHash}`;this.backgroundStyle=`url('${n}') center/cover`}})}static \u0275fac=function(o){return new(o||e)};static \u0275cmp=k({type:e,selectors:[["ng-component"]],viewQuery:function(o,t){o&1&&(v(t.passwordInput,Y,5),v(t.usernameInput,Z,5),v(t.otpInput,ee,5)),o&2&&F(3)},decls:15,vars:18,consts:[["username",""],["password",""],["otp",""],[1,"login-container","gradient","d-flex","align-items-start","justify-content-center",3,"ngStyle","ngClass"],[1,"w-100","login-card","d-flex","py-4","flex-column"],["ngSrc","/assets/homebridge-color-round.svg","alt","Homebridge Logo","height","100","width","100","priority","true",1,"homebridge-logo","mx-auto","my-3"],["novalidate","",3,"ngSubmit","formGroup"],[1,"mb-4","text-center"],[1,"input-group","mb-4"],[1,"input-group","no-border","mb-4"],[1,"text-center"],["tabindex","3","id","submit-button","type","submit",1,"btn","btn-primary","mb-2",3,"disabled"],[1,"input-group-text","custom-input"],[1,"fas","fa-fw","fa-user","primary-text","fa-lg"],["formControlName","username","type","text","id","form-username","autofocus","","autocomplete","username","autocapitalize","none","tabindex","1","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-lock","primary-text","fa-lg"],["formControlName","password","type","password","id","form-pass","autocomplete","current-password","tabindex","2","required","",1,"form-control","custom-input",3,"placeholder","ngClass"],[1,"fas","fa-fw","fa-key","primary-text","fa-lg"],["formControlName","otp","type","text","id","form-ota","autofocus","","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*","tabindex","1",1,"form-control","custom-input",3,"placeholder"],[1,"fas","fa-fw","fa-exclamation-triangle","pink-text","fa-lg"],[1,"form-control","custom-input"],[1,"small","grey-text","fw-semibold"],[1,"small","grey-text",3,"innerHTML"]],template:function(o,t){o&1&&(r(0,"div",3)(1,"div",4),s(2,"img",5),r(3,"form",6),E("ngSubmit",function(){return t.onSubmit()}),r(4,"h4",7),g(5),l(6,"translate"),a(),u(7,ne,12,12),u(8,oe,6,3,"div",8),u(9,ae,9,6,"div",9),u(10,re,9,6,"div",9),r(11,"div",10)(12,"button",11),g(13),l(14,"translate"),a()()()()()),o&2&&(m("ngStyle",f(14,te,t.backgroundStyle))("ngClass",f(16,ie,!t.backgroundStyle)),i(3),m("formGroup",t.form),i(2),h(d(6,10,"setup.welcome_to_homebridge")),i(2),c(t.twoFactorCodeRequired?-1:7),i(),c(t.twoFactorCodeRequired?8:-1),i(),c(t.invalidCredentials?9:-1),i(),c(t.invalid2faCode?10:-1),i(2),m("disabled",t.form.invalid),i(),L(" ",d(14,12,"form.label_continue")," "))},dependencies:[B,Q,q,$,R,O,H,G,A,z,D,P,N,j],styles:["body{overflow:scroll!important} body.dark-mode .login-card{background-color:#2b2b2b;color:#fff}.login-container[_ngcontent-%COMP%]{z-index:-1;padding-top:2em;padding-bottom:2em;min-height:100%;background-size:300% 300%}.anim[_ngcontent-%COMP%]{-webkit-animation:_ngcontent-%COMP%_gradient 20s ease infinite;-moz-animation:gradient 20s ease infinite;-o-animation:gradient 20s ease infinite;animation:_ngcontent-%COMP%_gradient 20s ease infinite}@keyframes _ngcontent-%COMP%_gradient{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}.login-card[_ngcontent-%COMP%]{max-width:550px;border-radius:1rem;padding-right:25px;padding-left:25px;background-color:#ffffffe6}.login-card[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{background-color:inherit!important}@media screen and (max-width: 575px){.login-card[_ngcontent-%COMP%]{margin-left:1em;margin-right:1em}}.homebridge-logo[_ngcontent-%COMP%]{margin-bottom:10px}"]})}return e})();export{_e as LoginComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-QIOCGI3G.js";import{g as W,m as j,n as oe}from"./chunk-C3HWKB2Q.js";import{A as P,b as re,c as V,d as x,e as N,f as O,g as A,j as w,m as Q,o as H,p as J,q as K,x as ae,z as G}from"./chunk-WFYBML4S.js";import{b as X}from"./chunk-S42WFQ2L.js";import{b as se}from"./chunk-GEIS2BWE.js";import{a as ve}from"./chunk-W4PQWIYG.js";import{k,n as B}from"./chunk-DVQU3KHF.js";import{a as $,b as U}from"./chunk-R3563DDE.js";import"./chunk-Q4CZ7LVK.js";import{$b as L,Dc as F,Hb as u,Hc as o,Ib as h,Ic as s,Jb as g,Jc as ne,Lb as ee,Mb as te,Nb as ie,Ob as f,Pb as r,Qb as n,Rb as c,Sb as S,Tb as D,Ub as q,_b as I,ab as e,bc as _,cc as z,dc as v,g as _e,id as R,la as p,mb as y,qc as m,ra as T,rc as d,sa as M,sc as C}from"./chunk-ULJPS3WS.js";function xe(i,E){i&1&&(r(0,"ngb-alert",13)(1,"p",20),m(2),o(3,"translate"),n()()),i&2&&(f("dismissible",!1),e(2),d(s(3,2,"login.invalid_password")))}var me=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);invalidCredentials=!1;formGroup=new A({password:new w("",[x.required])});disable2fa(){this.invalidCredentials=!1,this.$api.post("/users/otp/deactivate",this.formGroup.value).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.setup_2fa_disable_success"),this.$translate.instant("toast.title_success"))},error:()=>{this.formGroup.setValue({password:""}),this.invalidCredentials=!0}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:34,vars:27,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","password","autocomplete","current-password",1,"form-control","custom-input",3,"formControl","placeholder"],["type","error",1,"mt-3","mb-0",3,"dismissible"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"mb-0"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n()(),r(14,"ul",8)(15,"li",9)(16,"label",10),m(17),o(18,"translate"),n(),r(19,"div",11),c(20,"input",12),o(21,"translate"),n()()(),h(22,xe,4,4,"ngb-alert",13),n(),r(23,"div",14)(24,"div",15)(25,"button",16),o(26,"translate"),_("click",function(){return l.dismissModal()}),m(27),o(28,"translate"),n()(),c(29,"div",17),r(30,"div",18)(31,"button",19),_("click",function(){return l.disable2fa()}),m(32),o(33,"translate"),n()()()()),a&2&&(e(3),d(s(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",s(6,13,"form.button_close")),e(7),d(s(13,15,"users.setup_2fa_disable_current_password")),e(5),d(s(18,17,"users.label_password")),e(3),f("formControl",l.formGroup.controls.password)("placeholder",s(21,19,"users.label_password")),e(2),g(l.invalidCredentials&&!l.formGroup.controls.password.value?22:-1),e(3),u("aria-label",s(26,21,"form.button_close")),e(2),C(" ",s(28,23,"form.button_close")," "),e(4),f("disabled",l.formGroup.invalid),e(),C(" ",s(33,25,"form.button_disable")," "))},dependencies:[G,V,N,P,H,W,U],encapsulation:2})}return i})();var de=_e(ve(),1);var we=i=>({timeDiffError:i});function Ce(i,E){i&1&&(r(0,"li"),m(1),o(2,"translate"),n()),i&2&&(e(),d(s(2,1,"users.setup_2fa_scan_qr_code")))}function he(i,E){if(i&1&&(r(0,"ngb-alert",8)(1,"p",16),m(2),o(3,"translate"),n(),r(4,"p",17),m(5),o(6,"translate"),n()()),i&2){let t=v();f("dismissible",!1),e(2),d(s(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),d(ne(6,5,"users.setup_2fa_server_time_out",F(8,we,t.timeDiffError)))}}function ge(i,E){if(i&1&&(r(0,"ul",9)(1,"li",18)(2,"div",19),c(3,"app-qrcode",20),n()(),r(4,"li",21)(5,"label",22),m(6),o(7,"translate"),n(),r(8,"div",23),c(9,"input",24),n()()()),i&2){let t=v();e(3),f("data",t.otpString),e(3),d(s(7,3,"users.setup_2fa_enter_code")),e(3),f("formControl",t.formGroup.controls.code)}}function Ee(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function ye(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function Se(i,E){if(i&1){let t=I();r(0,"button",26),_("click",function(){T(t);let l=v();return M(l.enable2fa())}),m(1),o(2,"translate"),n()}if(i&2){let t=v();f("disabled",t.formGroup.invalid),e(),C(" ",s(2,2,"form.button_enable")," ")}}var pe=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);user;timeDiffError=null;otpString;formGroup=new A({code:new w("",[x.required,x.minLength(6),x.maxLength(6)])});ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:t=>{this.checkTimeDiff(t.timestamp),this.timeDiffError||(this.otpString=t.otpauth)},error:t=>{this.$activeModal.dismiss(),console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_enable_error"),this.$translate.instant("toast.title_error"))}})}enable2fa(){this.$api.post("/users/otp/activate",this.formGroup.value).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.setup_2fa_enabled_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close()},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(t){let a=(0,de.default)(t).diff(new Date,"millisecond");a<-5e3||a>5e3?this.timeDiffError=a:this.timeDiffError=null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:24,vars:15,consts:[[1,"modal-content","setup2fa"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"fw-bold","mb-1"],[1,"mb-0"],[1,"list-group-item","text-center"],[1,"text-center","w-100","d-flex","justify-content-center"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","placeholder","eg. 123456","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*",1,"form-control","custom-input",3,"formControl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n(),h(14,Ce,3,3,"li"),n(),h(15,he,7,10,"ngb-alert",8),h(16,ge,10,5,"ul",9),n(),r(17,"div",10)(18,"div",11),h(19,Ee,4,6,"button",12),n(),r(20,"div",13),h(21,ye,4,6,"button",12),n(),r(22,"div",14),h(23,Se,3,4,"button",15),n()()()),a&2&&(e(3),d(s(4,9,"users.setup_2fa")),e(2),u("aria-label",s(6,11,"form.button_close")),e(7),d(s(13,13,"users.setup_2fa_warning")),e(2),g(l.timeDiffError?-1:14),e(),g(l.timeDiffError?15:-1),e(),g(l.timeDiffError?-1:16),e(3),g(l.timeDiffError?-1:19),e(2),g(l.timeDiffError?21:-1),e(2),g(l.timeDiffError?-1:23))},dependencies:[W,le,G,V,N,ae,P,H,U],encapsulation:2})}return i})();var ce=i=>({"is-invalid":i}),ue=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w("",[x.compose([x.required,x.minLength(4)])]),passwordConfirm:new w("",[x.required]),admin:new w(!0)},this.matchPassword);onSubmit({value:t}){this.$api.post("/users",t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:a=>{this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:58,vars:50,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),r(33,"li",9)(34,"label",17),m(35),o(36,"translate"),n(),r(37,"div",11),c(38,"input",18),o(39,"translate"),n()(),r(40,"li",19)(41,"span",20),m(42),o(43,"translate"),n(),r(44,"div",21),c(45,"input",22),o(46,"translate"),c(47,"label",23),n()()()(),r(48,"div",24)(49,"div",20)(50,"button",25),_("click",function(){return l.dismissModal()}),m(51),o(52,"translate"),n()(),c(53,"div",26),r(54,"div",27)(55,"button",28),m(56),o(57,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,18,"users.title_add_user")),e(2),u("aria-label",s(7,20,"form.button_close")),e(8),d(s(15,22,"users.label_username")),e(3),u("aria-label",s(18,24,"users.label_username")),e(4),d(s(22,26,"users.label_full_name")),e(3),u("aria-label",s(25,28,"users.label_full_name")),e(4),d(s(29,30,"users.label_password")),e(3),f("ngClass",F(46,ce,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,32,"users.label_password")),e(4),d(s(36,34,"users.label_confirm_password")),e(3),f("ngClass",F(48,ce,l.form.controls.passwordConfirm.dirty&&l.form.controls.passwordConfirm.errors)),u("aria-label",s(39,36,"users.label_confirm_password")),e(4),d(s(43,38,"users.label_admin_user")),e(3),u("aria-label",s(46,40,"users.label_admin_user")),e(6),C(" ",s(52,42,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(57,44,"form.button_save")," "))},dependencies:[G,Q,V,N,O,P,J,K,R,U],encapsulation:2})}return i})();var fe=i=>({"is-invalid":i});function $e(i,E){if(i&1&&(r(0,"li",9)(1,"label",27),m(2),o(3,"translate"),n(),r(4,"div",11),c(5,"input",28),o(6,"translate"),n()()),i&2){let t=v();e(2),d(s(3,3,"users.label_confirm_password")),e(3),f("ngClass",F(7,fe,t.form.controls.passwordConfirm.dirty&&t.form.controls.passwordConfirm.errors)),u("aria-label",s(6,5,"users.label_confirm_password"))}}var be=(()=>{class i{$activeModal=p(j);$api=p(B);$auth=p(X);$toastr=p(k);$translate=p($);user;isCurrentUser=!1;form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w(""),passwordConfirm:new w(""),admin:new w(!0)},this.matchPassword);ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user)}onSubmit({value:t}){this.$api.patch(`/users/${this.user.id}`,t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&t.username!==this.$auth.user.username&&this.$auth.logout()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:52,vars:42,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-pen","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","off","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),h(33,$e,7,9,"li",9),r(34,"li",17)(35,"span",18),m(36),o(37,"translate"),n(),r(38,"div",19),c(39,"input",20),o(40,"translate"),c(41,"label",21),n()()()(),r(42,"div",22)(43,"div",18)(44,"button",23),_("click",function(){return l.dismissModal()}),m(45),o(46,"translate"),n()(),c(47,"div",24),r(48,"div",25)(49,"button",26),m(50),o(51,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,16,"users.title_edit_user")),e(2),u("aria-label",s(7,18,"form.button_close")),e(8),d(s(15,20,"users.label_username")),e(3),u("aria-label",s(18,22,"users.label_username")),e(4),d(s(22,24,"users.label_full_name")),e(3),u("aria-label",s(25,26,"users.label_full_name")),e(4),d(s(29,28,"users.label_new_password")),e(3),f("ngClass",F(40,fe,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,30,"users.label_new_password")),e(2),g(l.form.controls.password.value?33:-1),e(3),d(s(37,32,"users.label_admin_user")),e(3),u("aria-label",s(40,34,"users.label_admin_user")),e(6),C(" ",s(46,36,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(51,38,"form.button_save")," "))},dependencies:[G,Q,V,re,N,O,P,J,K,R,U],encapsulation:2})}return i})();function Ue(i,E){if(i&1){let t=I();S(0,"button",21),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.setup2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),d(s(2,1,"users.setup_2fa")))}function ke(i,E){if(i&1){let t=I();S(0,"button",17),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.disable2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),C(" ",s(2,1,"users.setup_2fa_disable")," "))}function Be(i,E){if(i&1){let t=I();S(0,"div",7)(1,"div",8)(2,"div",9)(3,"div",10)(4,"span",11),q(5,"h4",12)(6,"h5",13),D()(),S(7,"div",14),h(8,Ue,3,3,"button",15),h(9,ke,3,3,"button",16),S(10,"div")(11,"button",17),o(12,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.openEditUser(l))}),q(13,"i",18),D(),S(14,"button",19),o(15,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.deleteUser(l.id))}),q(16,"i",20),D()()()()()()}if(i&2){let t=E.$implicit,a=v();e(5),L("innerText",t.name),e(),L("innerText",t.username),e(2),g(a.username===t.username&&!t.otpActive?8:-1),e(),g(a.username===t.username&&t.otpActive?9:-1),e(2),u("aria-label",s(12,7,"form.button_edit")),e(3),L("disabled",a.username===t.username),u("aria-label",s(15,9,"form.button_delete"))}}var $t=(()=>{class i{$api=p(B);$auth=p(X);$modal=p(oe);$route=p(se);$toastr=p(k);$translate=p($);homebridgeUsers;username=this.$auth.user.username;ngOnInit(){this.$route.data.subscribe(t=>{this.homebridgeUsers=t.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(t=>{this.homebridgeUsers=t})}openAddNewUser(){this.$modal.open(ue,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(t){let a=this.$modal.open(be,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}deleteUser(t){this.$api.delete(`/users/${t}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(t){let a=this.$modal.open(pe,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}disable2fa(t){let a=this.$modal.open(me,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["app-users"]],decls:12,vars:6,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"primary-text","m-0"],[1,"col-3","text-end"],[1,"btn","btn-elegant","waves-effect","m-0",3,"click"],[1,"fas","fa-fw","fa-user-plus"],[1,"row"],[1,"col-md-6","mb-4"],[1,"card","card-body"],[1,"d-flex","flex-column"],[1,"d-flex","flex-row","mb-3"],[1,"me-auto","my-0"],[3,"innerText"],[1,"small","text-truncate","primary-text",3,"innerText"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-primary","m-0"],[1,"btn","btn-elegant","m-0"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-fw","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-fw","fa-trash"],[1,"btn","btn-primary","m-0",3,"click"]],template:function(a,l){a&1&&(S(0,"div",0)(1,"div",1)(2,"h3",2),m(3),o(4,"translate"),D()(),S(5,"div",3)(6,"button",4),o(7,"translate"),z("click",function(){return l.openAddNewUser()}),q(8,"i",5),D()()(),S(9,"div",6),te(10,Be,17,11,"div",7,ee),D()),a&2&&(e(3),d(s(4,2,"users.title_users")),e(3),u("aria-label",s(7,4,"users.button_add_user")),e(4),ie(l.homebridgeUsers))},dependencies:[U],encapsulation:2})}return i})();export{$t as UsersComponent};
|
|
1
|
+
import{a as le}from"./chunk-QIOCGI3G.js";import{g as W,m as j,n as oe}from"./chunk-C3HWKB2Q.js";import{A as P,b as re,c as V,d as x,e as N,f as O,g as A,j as w,m as Q,o as H,p as J,q as K,x as ae,z as G}from"./chunk-WFYBML4S.js";import{b as X}from"./chunk-2CKLKY5R.js";import{b as se}from"./chunk-GEIS2BWE.js";import{a as ve}from"./chunk-4AJSXM5Z.js";import{k,n as B}from"./chunk-IJVDEEEM.js";import{a as $,b as U}from"./chunk-R3563DDE.js";import"./chunk-Q4CZ7LVK.js";import{$b as L,Dc as F,Hb as u,Hc as o,Ib as h,Ic as s,Jb as g,Jc as ne,Lb as ee,Mb as te,Nb as ie,Ob as f,Pb as r,Qb as n,Rb as c,Sb as S,Tb as D,Ub as q,_b as I,ab as e,bc as _,cc as z,dc as v,g as _e,id as R,la as p,mb as y,qc as m,ra as T,rc as d,sa as M,sc as C}from"./chunk-ULJPS3WS.js";function xe(i,E){i&1&&(r(0,"ngb-alert",13)(1,"p",20),m(2),o(3,"translate"),n()()),i&2&&(f("dismissible",!1),e(2),d(s(3,2,"login.invalid_password")))}var me=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);invalidCredentials=!1;formGroup=new A({password:new w("",[x.required])});disable2fa(){this.invalidCredentials=!1,this.$api.post("/users/otp/deactivate",this.formGroup.value).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.setup_2fa_disable_success"),this.$translate.instant("toast.title_success"))},error:()=>{this.formGroup.setValue({password:""}),this.invalidCredentials=!0}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:34,vars:27,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","password","autocomplete","current-password",1,"form-control","custom-input",3,"formControl","placeholder"],["type","error",1,"mt-3","mb-0",3,"dismissible"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"mb-0"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n()(),r(14,"ul",8)(15,"li",9)(16,"label",10),m(17),o(18,"translate"),n(),r(19,"div",11),c(20,"input",12),o(21,"translate"),n()()(),h(22,xe,4,4,"ngb-alert",13),n(),r(23,"div",14)(24,"div",15)(25,"button",16),o(26,"translate"),_("click",function(){return l.dismissModal()}),m(27),o(28,"translate"),n()(),c(29,"div",17),r(30,"div",18)(31,"button",19),_("click",function(){return l.disable2fa()}),m(32),o(33,"translate"),n()()()()),a&2&&(e(3),d(s(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",s(6,13,"form.button_close")),e(7),d(s(13,15,"users.setup_2fa_disable_current_password")),e(5),d(s(18,17,"users.label_password")),e(3),f("formControl",l.formGroup.controls.password)("placeholder",s(21,19,"users.label_password")),e(2),g(l.invalidCredentials&&!l.formGroup.controls.password.value?22:-1),e(3),u("aria-label",s(26,21,"form.button_close")),e(2),C(" ",s(28,23,"form.button_close")," "),e(4),f("disabled",l.formGroup.invalid),e(),C(" ",s(33,25,"form.button_disable")," "))},dependencies:[G,V,N,P,H,W,U],encapsulation:2})}return i})();var de=_e(ve(),1);var we=i=>({timeDiffError:i});function Ce(i,E){i&1&&(r(0,"li"),m(1),o(2,"translate"),n()),i&2&&(e(),d(s(2,1,"users.setup_2fa_scan_qr_code")))}function he(i,E){if(i&1&&(r(0,"ngb-alert",8)(1,"p",16),m(2),o(3,"translate"),n(),r(4,"p",17),m(5),o(6,"translate"),n()()),i&2){let t=v();f("dismissible",!1),e(2),d(s(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),d(ne(6,5,"users.setup_2fa_server_time_out",F(8,we,t.timeDiffError)))}}function ge(i,E){if(i&1&&(r(0,"ul",9)(1,"li",18)(2,"div",19),c(3,"app-qrcode",20),n()(),r(4,"li",21)(5,"label",22),m(6),o(7,"translate"),n(),r(8,"div",23),c(9,"input",24),n()()()),i&2){let t=v();e(3),f("data",t.otpString),e(3),d(s(7,3,"users.setup_2fa_enter_code")),e(3),f("formControl",t.formGroup.controls.code)}}function Ee(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function ye(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function Se(i,E){if(i&1){let t=I();r(0,"button",26),_("click",function(){T(t);let l=v();return M(l.enable2fa())}),m(1),o(2,"translate"),n()}if(i&2){let t=v();f("disabled",t.formGroup.invalid),e(),C(" ",s(2,2,"form.button_enable")," ")}}var pe=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);user;timeDiffError=null;otpString;formGroup=new A({code:new w("",[x.required,x.minLength(6),x.maxLength(6)])});ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:t=>{this.checkTimeDiff(t.timestamp),this.timeDiffError||(this.otpString=t.otpauth)},error:t=>{this.$activeModal.dismiss(),console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_enable_error"),this.$translate.instant("toast.title_error"))}})}enable2fa(){this.$api.post("/users/otp/activate",this.formGroup.value).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.setup_2fa_enabled_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close()},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(t){let a=(0,de.default)(t).diff(new Date,"millisecond");a<-5e3||a>5e3?this.timeDiffError=a:this.timeDiffError=null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:24,vars:15,consts:[[1,"modal-content","setup2fa"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"fw-bold","mb-1"],[1,"mb-0"],[1,"list-group-item","text-center"],[1,"text-center","w-100","d-flex","justify-content-center"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","placeholder","eg. 123456","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*",1,"form-control","custom-input",3,"formControl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n(),h(14,Ce,3,3,"li"),n(),h(15,he,7,10,"ngb-alert",8),h(16,ge,10,5,"ul",9),n(),r(17,"div",10)(18,"div",11),h(19,Ee,4,6,"button",12),n(),r(20,"div",13),h(21,ye,4,6,"button",12),n(),r(22,"div",14),h(23,Se,3,4,"button",15),n()()()),a&2&&(e(3),d(s(4,9,"users.setup_2fa")),e(2),u("aria-label",s(6,11,"form.button_close")),e(7),d(s(13,13,"users.setup_2fa_warning")),e(2),g(l.timeDiffError?-1:14),e(),g(l.timeDiffError?15:-1),e(),g(l.timeDiffError?-1:16),e(3),g(l.timeDiffError?-1:19),e(2),g(l.timeDiffError?21:-1),e(2),g(l.timeDiffError?-1:23))},dependencies:[W,le,G,V,N,ae,P,H,U],encapsulation:2})}return i})();var ce=i=>({"is-invalid":i}),ue=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w("",[x.compose([x.required,x.minLength(4)])]),passwordConfirm:new w("",[x.required]),admin:new w(!0)},this.matchPassword);onSubmit({value:t}){this.$api.post("/users",t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:a=>{this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:58,vars:50,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),r(33,"li",9)(34,"label",17),m(35),o(36,"translate"),n(),r(37,"div",11),c(38,"input",18),o(39,"translate"),n()(),r(40,"li",19)(41,"span",20),m(42),o(43,"translate"),n(),r(44,"div",21),c(45,"input",22),o(46,"translate"),c(47,"label",23),n()()()(),r(48,"div",24)(49,"div",20)(50,"button",25),_("click",function(){return l.dismissModal()}),m(51),o(52,"translate"),n()(),c(53,"div",26),r(54,"div",27)(55,"button",28),m(56),o(57,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,18,"users.title_add_user")),e(2),u("aria-label",s(7,20,"form.button_close")),e(8),d(s(15,22,"users.label_username")),e(3),u("aria-label",s(18,24,"users.label_username")),e(4),d(s(22,26,"users.label_full_name")),e(3),u("aria-label",s(25,28,"users.label_full_name")),e(4),d(s(29,30,"users.label_password")),e(3),f("ngClass",F(46,ce,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,32,"users.label_password")),e(4),d(s(36,34,"users.label_confirm_password")),e(3),f("ngClass",F(48,ce,l.form.controls.passwordConfirm.dirty&&l.form.controls.passwordConfirm.errors)),u("aria-label",s(39,36,"users.label_confirm_password")),e(4),d(s(43,38,"users.label_admin_user")),e(3),u("aria-label",s(46,40,"users.label_admin_user")),e(6),C(" ",s(52,42,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(57,44,"form.button_save")," "))},dependencies:[G,Q,V,N,O,P,J,K,R,U],encapsulation:2})}return i})();var fe=i=>({"is-invalid":i});function $e(i,E){if(i&1&&(r(0,"li",9)(1,"label",27),m(2),o(3,"translate"),n(),r(4,"div",11),c(5,"input",28),o(6,"translate"),n()()),i&2){let t=v();e(2),d(s(3,3,"users.label_confirm_password")),e(3),f("ngClass",F(7,fe,t.form.controls.passwordConfirm.dirty&&t.form.controls.passwordConfirm.errors)),u("aria-label",s(6,5,"users.label_confirm_password"))}}var be=(()=>{class i{$activeModal=p(j);$api=p(B);$auth=p(X);$toastr=p(k);$translate=p($);user;isCurrentUser=!1;form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w(""),passwordConfirm:new w(""),admin:new w(!0)},this.matchPassword);ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user)}onSubmit({value:t}){this.$api.patch(`/users/${this.user.id}`,t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&t.username!==this.$auth.user.username&&this.$auth.logout()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:52,vars:42,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-pen","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","off","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),h(33,$e,7,9,"li",9),r(34,"li",17)(35,"span",18),m(36),o(37,"translate"),n(),r(38,"div",19),c(39,"input",20),o(40,"translate"),c(41,"label",21),n()()()(),r(42,"div",22)(43,"div",18)(44,"button",23),_("click",function(){return l.dismissModal()}),m(45),o(46,"translate"),n()(),c(47,"div",24),r(48,"div",25)(49,"button",26),m(50),o(51,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,16,"users.title_edit_user")),e(2),u("aria-label",s(7,18,"form.button_close")),e(8),d(s(15,20,"users.label_username")),e(3),u("aria-label",s(18,22,"users.label_username")),e(4),d(s(22,24,"users.label_full_name")),e(3),u("aria-label",s(25,26,"users.label_full_name")),e(4),d(s(29,28,"users.label_new_password")),e(3),f("ngClass",F(40,fe,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,30,"users.label_new_password")),e(2),g(l.form.controls.password.value?33:-1),e(3),d(s(37,32,"users.label_admin_user")),e(3),u("aria-label",s(40,34,"users.label_admin_user")),e(6),C(" ",s(46,36,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(51,38,"form.button_save")," "))},dependencies:[G,Q,V,re,N,O,P,J,K,R,U],encapsulation:2})}return i})();function Ue(i,E){if(i&1){let t=I();S(0,"button",21),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.setup2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),d(s(2,1,"users.setup_2fa")))}function ke(i,E){if(i&1){let t=I();S(0,"button",17),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.disable2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),C(" ",s(2,1,"users.setup_2fa_disable")," "))}function Be(i,E){if(i&1){let t=I();S(0,"div",7)(1,"div",8)(2,"div",9)(3,"div",10)(4,"span",11),q(5,"h4",12)(6,"h5",13),D()(),S(7,"div",14),h(8,Ue,3,3,"button",15),h(9,ke,3,3,"button",16),S(10,"div")(11,"button",17),o(12,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.openEditUser(l))}),q(13,"i",18),D(),S(14,"button",19),o(15,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.deleteUser(l.id))}),q(16,"i",20),D()()()()()()}if(i&2){let t=E.$implicit,a=v();e(5),L("innerText",t.name),e(),L("innerText",t.username),e(2),g(a.username===t.username&&!t.otpActive?8:-1),e(),g(a.username===t.username&&t.otpActive?9:-1),e(2),u("aria-label",s(12,7,"form.button_edit")),e(3),L("disabled",a.username===t.username),u("aria-label",s(15,9,"form.button_delete"))}}var $t=(()=>{class i{$api=p(B);$auth=p(X);$modal=p(oe);$route=p(se);$toastr=p(k);$translate=p($);homebridgeUsers;username=this.$auth.user.username;ngOnInit(){this.$route.data.subscribe(t=>{this.homebridgeUsers=t.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(t=>{this.homebridgeUsers=t})}openAddNewUser(){this.$modal.open(ue,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(t){let a=this.$modal.open(be,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}deleteUser(t){this.$api.delete(`/users/${t}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(t){let a=this.$modal.open(pe,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}disable2fa(t){let a=this.$modal.open(me,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["app-users"]],decls:12,vars:6,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"primary-text","m-0"],[1,"col-3","text-end"],[1,"btn","btn-elegant","waves-effect","m-0",3,"click"],[1,"fas","fa-fw","fa-user-plus"],[1,"row"],[1,"col-md-6","mb-4"],[1,"card","card-body"],[1,"d-flex","flex-column"],[1,"d-flex","flex-row","mb-3"],[1,"me-auto","my-0"],[3,"innerText"],[1,"small","text-truncate","primary-text",3,"innerText"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-primary","m-0"],[1,"btn","btn-elegant","m-0"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-fw","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-fw","fa-trash"],[1,"btn","btn-primary","m-0",3,"click"]],template:function(a,l){a&1&&(S(0,"div",0)(1,"div",1)(2,"h3",2),m(3),o(4,"translate"),D()(),S(5,"div",3)(6,"button",4),o(7,"translate"),z("click",function(){return l.openAddNewUser()}),q(8,"i",5),D()()(),S(9,"div",6),te(10,Be,17,11,"div",7,ee),D()),a&2&&(e(3),d(s(4,2,"users.title_users")),e(3),u("aria-label",s(7,4,"users.button_add_user")),e(4),ie(l.homebridgeUsers))},dependencies:[U],encapsulation:2})}return i})();export{$t as UsersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as s}from"./chunk-
|
|
1
|
+
import{b as s}from"./chunk-2CKLKY5R.js";import{d as i}from"./chunk-GEIS2BWE.js";import{k as o}from"./chunk-IJVDEEEM.js";import{a}from"./chunk-R3563DDE.js";import{ga as e,la as r}from"./chunk-ULJPS3WS.js";var v=(()=>{class t{$auth=r(s);$router=r(i);$translate=r(a);$toastr=r(o);canActivate(){return this.$auth.user&&this.$auth.user.admin?!0:(this.$toastr.error(this.$translate.instant("toast.no_auth"),this.$translate.instant("toast.title_error")),this.$router.navigate(["/"]),!1)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=e({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();export{v as a};
|