homebridge-config-ui-x 5.6.2-beta.4 → 5.6.2-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/package.json +1 -1
- package/public/{chunk-QW24XYP4.js → chunk-2U4A7JIA.js} +1 -1
- package/public/{chunk-IVSC57ZO.js → chunk-2YWIGYRQ.js} +1 -1
- package/public/{chunk-WK3G6ODO.js → chunk-4ZJF4BRP.js} +1 -1
- package/public/{chunk-Z7A7I4CB.js → chunk-54VEQSYX.js} +1 -1
- package/public/{chunk-WAFW4WKO.js → chunk-5H2H6GV5.js} +1 -1
- package/public/{chunk-NKYXSMFX.js → chunk-63H66SN7.js} +1 -1
- package/public/{chunk-Z4QSDA2A.js → chunk-6K47JJJN.js} +1 -1
- package/public/{chunk-KKNK6UV7.js → chunk-77SV5TMG.js} +1 -1
- package/public/{chunk-DY6UNDS6.js → chunk-7FYFNZTQ.js} +1 -1
- package/public/{chunk-GJNC52XA.js → chunk-7XGJYWYJ.js} +1 -1
- package/public/{chunk-CJ4SXXR6.js → chunk-B5KGSPBB.js} +1 -1
- package/public/{chunk-4UZT4CWL.js → chunk-BGUMMZ2C.js} +1 -1
- package/public/{chunk-BH22NGQA.js → chunk-CMFP5UNE.js} +1 -1
- package/public/{chunk-ISO2GRTR.js → chunk-CMYYLT6V.js} +1 -1
- package/public/{chunk-PHD5ZMC2.js → chunk-CO4NZMWO.js} +1 -1
- package/public/{chunk-5LPNXWFL.js → chunk-CUR56OIQ.js} +1 -1
- package/public/{chunk-XQWLMHVF.js → chunk-FKNEWYVP.js} +1 -1
- package/public/{chunk-D22SUY53.js → chunk-FZKZZ4RE.js} +1 -1
- package/public/{chunk-O2XW2OU3.js → chunk-FZSUY7NB.js} +1 -1
- package/public/{chunk-Q26KC4IB.js → chunk-G262EKYR.js} +1 -1
- package/public/{chunk-DZJPWLJP.js → chunk-HDDWXQCC.js} +1 -1
- package/public/{chunk-DNXIVWN6.js → chunk-HLBXNZT2.js} +1 -1
- package/public/{chunk-YALGVC7M.js → chunk-IPYUZTFM.js} +1 -1
- package/public/{chunk-YI5HDCRW.js → chunk-ITOBTSSK.js} +1 -1
- package/public/{chunk-BEUTGLPT.js → chunk-IVRRJDMF.js} +1 -1
- package/public/{chunk-UOXNLYDZ.js → chunk-LJEJT7XC.js} +1 -1
- package/public/{chunk-IE3V3626.js → chunk-MDBPS3HU.js} +1 -1
- package/public/{chunk-VWALJTBB.js → chunk-MLO5MHQZ.js} +1 -1
- package/public/{chunk-LAGMFNSS.js → chunk-MZXVAALT.js} +1 -1
- package/public/{chunk-VF2IGSWQ.js → chunk-N6F46ZR6.js} +1 -1
- package/public/{chunk-SUAYNYGQ.js → chunk-NE45RJPZ.js} +1 -1
- package/public/{chunk-NEPDVJTH.js → chunk-NG5KAPYX.js} +1 -1
- package/public/{chunk-KYJP2JUP.js → chunk-NYBBGETL.js} +1 -1
- package/public/{chunk-VFGREPGX.js → chunk-OJHYMECP.js} +1 -1
- package/public/{chunk-RIRCP4IY.js → chunk-PAVMGVYO.js} +1 -1
- package/public/chunk-PG65YVBK.js +1 -0
- package/public/{chunk-IRW2X6KD.js → chunk-Q2242BUJ.js} +1 -1
- package/public/{chunk-TBHJJ5AF.js → chunk-QBPL6XFG.js} +1 -1
- package/public/{chunk-RSC6KQC6.js → chunk-QISNGTEW.js} +1 -1
- package/public/{chunk-YCVAE2GW.js → chunk-QQCYNHHX.js} +2 -2
- package/public/{chunk-W57Z652M.js → chunk-S6QABMMB.js} +2 -2
- package/public/{chunk-SAAY45A7.js → chunk-V6OEXTM4.js} +1 -1
- package/public/{chunk-L5S7W2A7.js → chunk-V7G4OBHO.js} +1 -1
- package/public/{chunk-QVBEXZ7A.js → chunk-V7QYRB3O.js} +1 -1
- package/public/{chunk-22BONRNP.js → chunk-XCTMQV5H.js} +1 -1
- package/public/{chunk-ISO6GPND.js → chunk-XQAFGYWU.js} +1 -1
- package/public/{chunk-QJVZW2TP.js → chunk-XW456IS6.js} +1 -1
- package/public/{chunk-WB2AUNM5.js → chunk-Y54JZMAX.js} +1 -1
- package/public/{chunk-DELCRL3W.js → chunk-YG7LM534.js} +1 -1
- package/public/{chunk-UKRY5TMZ.js → chunk-YIXNA3NA.js} +1 -1
- package/public/{chunk-P7PS27MA.js → chunk-YPAGUJHG.js} +1 -1
- package/public/{chunk-WAPGX2D2.js → chunk-Z6YBMUNH.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-Q4FDCMVL.js → main-QERAHIA4.js} +1 -1
- package/public/chunk-VJC32FSY.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,7 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
|
|
|
15
15
|
- add search bar on settings page for filtering options
|
|
16
16
|
- added config option to advertise the ui over mdns
|
|
17
17
|
- implement html page titles on section pages (#2579)
|
|
18
|
+
- fix for custom uis showing schema form
|
|
18
19
|
|
|
19
20
|
### Other Changes
|
|
20
21
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-config-ui-x",
|
|
3
3
|
"displayName": "Homebridge UI",
|
|
4
|
-
"version": "5.6.2-beta.
|
|
4
|
+
"version": "5.6.2-beta.5",
|
|
5
5
|
"description": "A web based management, configuration and control platform for Homebridge.",
|
|
6
6
|
"author": "oznu <dev@oz.nu>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b}from"./chunk-
|
|
1
|
+
import{a as b}from"./chunk-54VEQSYX.js";import"./chunk-HDDWXQCC.js";import{d as k}from"./chunk-VHUDBTN7.js";import{b as w}from"./chunk-CMFP5UNE.js";import{k as C,l as $,n as T,q as S}from"./chunk-LJEJT7XC.js";import{Eb as E,Ga as x,Ib as h,La as n,Vb as a,Wa as _,Wb as s,gc as g,ja as o,lb as d,mb as f,mc as m,nc as c,oc as y,vb as r,wb as i,xb as l}from"./chunk-M33HG622.js";var I=t=>({command:t});function D(t,u){if(t&1&&(r(0,"div",7),a(1),i()),t&2){let e=h();n(),s(e.error)}}function R(t,u){t&1&&(r(0,"p",9),a(1),m(2,"translate"),i(),r(3,"div",10)(4,"div",11),l(5,"i",12),i()()),t&2&&(n(),s(c(2,1,"restart.please_wait_while_server_restarts")))}function B(t,u){if(t&1&&(r(0,"div",8)(1,"p"),a(2),m(3,"translate"),i(),l(4,"p",13),m(5,"translate"),i()),t&2){let e=h();n(2),s(c(3,2,"platform.docker.server_long_time")),n(2),E("innerHTML",y(5,4,"platform.docker.run_with_restart",g(7,I,e.command)),x)}}var U=(()=>{class t{$api=o(S);$router=o(k);$settings=o(w);$toastr=o(T);$translate=o(C);$ws=o(b);checkTimeout;checkDelay;io;resp={};timeout=!1;error=!1;command='<span class="font-monospace">--restart=always</span>';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/docker/restart-container",{}).subscribe({next:e=>{this.resp=e,this.checkIfServerUp()},error:e=>{this.error=this.$translate.instant("restart.toast_server_restart_error"),console.error(e),this.$toastr.error(this.$translate.instant("restart.toast_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.docker.container_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},1e4),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},6e4)}static \u0275fac=function(p){return new(p||t)};static \u0275cmp=_({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,"fab","fa-docker",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-spinner","fa-spin"],[1,"grey-text","mb-0",3,"innerHTML"]],template:function(p,v){p&1&&(r(0,"div",0)(1,"h3",1),a(2),m(3,"translate"),i()(),r(4,"div",2)(5,"div",3),l(6,"i",4),i(),r(7,"div",5)(8,"h4",6),a(9),m(10,"translate"),i(),d(11,D,2,1,"div",7)(12,R,6,3),d(13,B,6,9,"div",8),i()()),p&2&&(n(2),s(c(3,4,"menu.restart.title")),n(7),s(c(10,6,"platform.docker.title_restarting")),n(2),f(v.error?11:12),n(2),f(v.timeout?13:-1))},dependencies:[$],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{U as ContainerRestartComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-TUN7H57E.js";import{a as X}from"./chunk-O2XW2OU3.js";import{a as G}from"./chunk-E7V47C3O.js";import{a as Z}from"./chunk-4XDXTE6Q.js";import"./chunk-5JDHV5WO.js";import{a as R}from"./chunk-WK3G6ODO.js";import{n as E}from"./chunk-J2VLADZD.js";import"./chunk-QPTX7IVE.js";import{a as j}from"./chunk-Z7A7I4CB.js";import{b as A}from"./chunk-DZJPWLJP.js";import{a as q,c as N,d as V,e as W,f as D}from"./chunk-VHUDBTN7.js";import{b as T}from"./chunk-BH22NGQA.js";import{k as L,l as U,p as $}from"./chunk-UOXNLYDZ.js";import{Db as S,Gb as _,Ib as x,Kc as O,La as i,Pa as F,Vb as g,Wa as P,Wb as v,Xc as K,fc as h,g as Y,gc as M,h as I,ja as u,kb as m,lb as w,mb as y,mc as d,nc as s,oa as b,pa as C,rb as c,sb as n,tb as a,ub as p,w as z}from"./chunk-M33HG622.js";var Q=Y(Z(),1);var B=()=>["/"],te=o=>({"hamburger-icon-cross":o}),ne=o=>({expanded:o}),ie=()=>({exact:!0}),oe=()=>["/plugins"],re=()=>["/accessories"],ae=()=>["/logs"],de=()=>["/support"],se=()=>["/platform-tools/terminal"],le=()=>["/config"],pe=()=>["/settings"],ce=()=>["/power-options"];function me(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",20),d(2,"translate"),d(3,"translate"),_("click",function(){b(e);let t=x();return C(t.openUnderVoltageModal())})("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(4,"div",12),p(5,"i",21),a(),n(6,"div",14),g(7),d(8,"translate"),a()()()}o&2&&(i(),m("aria-label",s(2,2,"rpi.throttled.undervoltage_title")+" - "+s(3,4,"rpi.throttled.undervoltage_description")),i(6),v(s(8,6,"rpi.throttled.undervoltage_title")))}function ue(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",22),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,se))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.linux.label_terminal")),i(5),v(s(7,6,"menu.linux.label_terminal")))}function _e(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",23),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,le))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.config_json_editor")),i(5),v(s(7,6,"menu.config_json_editor")))}function ge(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",24),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,pe))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.label_settings")),i(5),v(s(7,6,"menu.label_settings")))}function fe(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",25),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,ce))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.restart.title")),i(5),v(s(7,6,"menu.restart.title")))}function ve(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",20),d(2,"translate"),_("click",function(){b(e);let t=x();return C(t.reloadPage())})("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",26),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),m("aria-label",s(2,2,"menu.reload")),i(5),v(s(7,4,"menu.reload")))}function he(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",20),d(2,"translate"),_("click",function(){b(e);let t=x();return C(t.logout())})("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",27),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),m("aria-label",s(2,2,"menu.tooltip_logout")),i(5),v(s(7,4,"menu.tooltip_logout")))}var J=(()=>{class o{$auth=u(A);$settings=u(T);$modal=u(E);$notification=u(G);$renderer=u(F);$router=u(V);$translate=u(L);isExpanded=!1;formAuth=this.$settings.formAuth;isAdmin=this.$auth.user.admin;enableTerminalAccess=this.$settings.env.enableTerminalAccess;rPiCurrentlyUnderVoltage=!1;rPiWasUnderVoltage=!1;isMobile=!1;freezeMenu=!1;isPwa=H();constructor(){this.isMobile=window.innerWidth<768;let e;window.addEventListener("resize",()=>{clearTimeout(e),e=setTimeout(()=>{this.updateListeners()},500)}),this.$router.events.subscribe(l=>{l instanceof q&&(this.closeSidebar(),this.freezeMenu=!0,setTimeout(()=>{this.freezeMenu=!1},750))})}ngOnInit(){this.$notification.raspberryPiThrottled.subscribe(r=>{r["Under Voltage"]&&(this.rPiCurrentlyUnderVoltage=!0),r["Under-voltage has occurred"]&&(this.rPiWasUnderVoltage=!0)}),this.$notification.formAuthEnabled.subscribe(r=>{this.formAuth=r});let e=document.querySelector(".sidebar"),l=document.querySelector(".m-header"),t=document.querySelector(".content");this.isMobile?document.addEventListener("touchstart",r=>{if(t.contains(r.target)&&this.isExpanded){r.preventDefault(),this.toggleSidebar();return}!e.contains(r.target)&&!l.contains(r.target)&&this.isExpanded&&(r.preventDefault(),this.closeSidebar())},{passive:!1}):(this.updateListeners(),l.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),l.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}),document.addEventListener("click",r=>{e.contains(r.target)&&r.clientX>60&&this.closeSidebar()},{passive:!1})),this.updateContentStyles()}toggleSidebar(){this.freezeMenu||(this.isExpanded=!this.isExpanded,this.updateContentStyles())}openUnderVoltageModal(){let e=this.$modal.open(X,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("rpi.throttled.undervoltage_title"),e.componentInstance.message=this.$translate.instant(this.rPiCurrentlyUnderVoltage?"rpi.throttled.currently_message":"rpi.throttled.previously_message"),e.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),e.componentInstance.faIconClass="fas fa-bolt yellow-text",e.componentInstance.ctaButtonLink="https://pimylifeup.com/raspberry-pi-low-voltage-warning"}handleKeydown(e){if(e.key==="Enter"){let l=e.target;["menuitem","button"].includes(l.getAttribute("role"))&&l.click()}}reloadPage(){window.location.reload()}ngOnDestroy(){document.removeEventListener("touchstart",()=>{}),document.removeEventListener("click",()=>{})}logout(){this.$auth.logout()}openSidebar(){this.freezeMenu||(this.isExpanded=!0,this.updateContentStyles())}closeSidebar(){this.freezeMenu||(this.isExpanded=!1,this.updateContentStyles())}updateContentStyles(){let e=document.querySelector(".content");this.isExpanded?(this.$renderer.setStyle(e,"opacity","20%"),this.$renderer.setStyle(e,"pointer-events","none"),this.$renderer.setStyle(e,"overflow","hidden")):(this.$renderer.removeStyle(e,"opacity"),this.$renderer.removeStyle(e,"pointer-events"),this.$renderer.removeStyle(e,"overflow"))}updateListeners(){this.isMobile=window.innerWidth<768;let e=document.querySelector(".sidebar");e.removeAllListeners(),(this.isMobile||!this.isMobile&&this.$settings.menuMode!=="freeze")&&(e.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),e.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}))}static \u0275fac=function(l){return new(l||o)};static \u0275cmp=P({type:o,selectors:[["app-sidebar"]],inputs:{isExpanded:"isExpanded"},decls:68,vars:75,consts:[["tabindex","0","role","button",1,"m-header","text-end",3,"click","keydown"],[1,"me-2","d-block","d-lg-none",2,"font-size","0.9rem","color","#dddddd"],[3,"routerLink"],["ngSrc","assets/homebridge-logo.svg","alt","HB Logo","height","35","width","35",2,"height","35px","width","35px"],[1,"hb-logo-text-mobile"],[1,"hamburger-icon",3,"ngClass"],["role","navigation","id","sidebar",1,"sidebar",3,"ngClass"],["tabindex","0","role","button",1,"header",3,"click","keydown"],[1,"hb-logo-text"],[1,"link-wrapper"],[1,"link"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive","routerLinkActiveOptions"],[1,"icon"],[1,"fa","fa-house"],[1,"title"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive"],[1,"fa","fa-plug"],[1,"fa","fa-lightbulb"],[1,"fa","fa-wave-square"],[1,"fa","fa-question-circle-o"],["role","menuitem","tabindex","0",1,"link-row",3,"click","keydown"],[1,"fas","fa-bolt","fa-beat","yellow-text",2,"--fa-beat-scale","1.5"],[1,"fa","fa-terminal"],[1,"fa","fa-code"],[1,"fa","fa-cog"],[1,"fa","fa-power-off"],[1,"fa","fa-refresh"],[1,"fa","fa-right-from-bracket"]],template:function(l,t){l&1&&(n(0,"div",0),d(1,"translate"),_("click",function(){return t.toggleSidebar()})("keydown",function(f){return t.handleKeydown(f)}),p(2,"span",1),n(3,"a",2),d(4,"translate"),p(5,"img",3),n(6,"div",4),g(7,"Homebridge"),a()(),n(8,"div",5),p(9,"span")(10,"span")(11,"span")(12,"span"),a()(),n(13,"div",6)(14,"div",7),_("click",function(){return t.toggleSidebar()})("keydown",function(f){return t.handleKeydown(f)}),n(15,"a",2),d(16,"translate"),p(17,"img",3),n(18,"div",8),g(19,"Homebridge"),a()()(),n(20,"div",9)(21,"div",10)(22,"div",11),d(23,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(24,"div",12),p(25,"i",13),a(),n(26,"div",14),g(27),d(28,"translate"),a()()(),w(29,me,9,8,"div",10),n(30,"div",10)(31,"div",15),d(32,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(33,"div",12),p(34,"i",16),a(),n(35,"div",14),g(36),d(37,"translate"),a()()(),n(38,"div",10)(39,"div",15),d(40,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(41,"div",12),p(42,"i",17),a(),n(43,"div",14),g(44),d(45,"translate"),a()()(),n(46,"div",10)(47,"div",15),d(48,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(49,"div",12),p(50,"i",18),a(),n(51,"div",14),g(52),d(53,"translate"),a()()(),w(54,ue,8,9,"div",10),w(55,_e,8,9,"div",10),w(56,ge,8,9,"div",10),n(57,"div",10)(58,"div",15),d(59,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(60,"div",12),p(61,"i",19),a(),n(62,"div",14),g(63),d(64,"translate"),a()()(),w(65,fe,8,9,"div",10),w(66,ve,8,6,"div",10),w(67,he,8,6,"div",10),a()()),l&2&&(m("aria-expanded",t.isExpanded?"true":"false")("aria-controls","sidebar")("aria-label",s(1,37,"menu.sidebar.aria_menu")),i(3),c("routerLink",h(63,B)),m("aria-label",s(4,39,"menu.label_status")),i(5),c("ngClass",M(64,te,t.isExpanded)),i(5),c("ngClass",M(66,ne,t.isExpanded)),i(2),c("routerLink",h(68,B)),m("aria-label",s(16,41,"menu.label_status")),i(7),c("routerLink",h(69,B))("routerLinkActive","active")("routerLinkActiveOptions",h(70,ie)),m("aria-label",s(23,43,"menu.label_status")),i(5),v(s(28,45,"menu.label_status")),i(2),y(t.rPiWasUnderVoltage||t.rPiCurrentlyUnderVoltage?29:-1),i(2),c("routerLink",h(71,oe))("routerLinkActive","active"),m("aria-label",s(32,47,"menu.label_plugins")),i(5),v(s(37,49,"menu.label_plugins")),i(3),c("routerLink",h(72,re))("routerLinkActive","active"),m("aria-label",s(40,51,"menu.label_accessories")),i(5),v(s(45,53,"menu.label_accessories")),i(3),c("routerLink",h(73,ae))("routerLinkActive","active"),m("aria-label",s(48,55,"menu.linux.label_logs")),i(5),v(s(53,57,"menu.linux.label_logs")),i(2),y(t.enableTerminalAccess&&t.isAdmin?54:-1),i(),y(t.isAdmin?55:-1),i(),y(t.isAdmin?56:-1),i(2),c("routerLink",h(74,de))("routerLinkActive","active"),m("aria-label",s(59,59,"support.title")),i(5),v(s(64,61,"support.title")),i(2),y(t.isAdmin?65:-1),i(),y(t.isPwa?66:-1),i(),y(t.formAuth?67:-1))},dependencies:[W,K,O,D,U],styles:[".m-header[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100%;height:65px;z-index:510;display:flex;align-items:center;padding-left:3px;padding-right:3px}.m-header[_ngcontent-%COMP%]:hover{cursor:pointer}@media (min-width: 768px){.m-header[_ngcontent-%COMP%]{display:none}}.sidebar[_ngcontent-%COMP%]{position:fixed;left:0;top:0;height:100vh;transition:.3s;width:60px;z-index:500}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:15px 10px 15px 11px;font-size:.85rem}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]:hover{cursor:pointer}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 80px)!important;scrollbar-width:thin}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{padding-bottom:60px}}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%]{display:flex;align-items:center;padding:15px 10px;cursor:pointer;transition:.2s;font-size:17px}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{flex:0 0 38px;display:flex;align-items:center;justify-content:center}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{flex:1;transition:.3s;max-width:0;overflow:hidden;white-space:nowrap}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%]{width:0}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:none}}.sidebar.expanded[_ngcontent-%COMP%]{width:210px}@media (max-width: 767px){.sidebar.expanded[_ngcontent-%COMP%]{width:210px}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:block}}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{max-width:150px;padding-left:10px}.hamburger-icon[_ngcontent-%COMP%]{margin:-7px 0 0 25px}@media (min-width: 768px){.hb-logo-text[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px}.sidebar.expanded[_ngcontent-%COMP%] .hb-logo-text[_ngcontent-%COMP%]{opacity:1;left:55px;transition:.3s}.sidebar[_ngcontent-%COMP%]:not(.expanded) .hb-logo-text[_ngcontent-%COMP%]{opacity:0;left:40px;transition:.3s}.hb-logo-text-mobile[_ngcontent-%COMP%], .hamburger-icon[_ngcontent-%COMP%]{display:none!important}}@media (max-width: 767px){.hb-logo-text[_ngcontent-%COMP%]{display:none!important}.hb-logo-text-mobile[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px;opacity:1;left:55px}.hamburger-icon[_ngcontent-%COMP%]{position:absolute;right:10px;top:28px;width:30px;transform:rotate(0);transition:.5s ease-in-out;cursor:pointer}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;position:absolute;height:2px;width:100%;background-color:#fff;border-radius:9px;opacity:1;left:0;transform:rotate(0);transition:.25s ease-in-out}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:0}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2), .hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){top:10px}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:20px}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:10px;width:0;left:50%}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2){transform:rotate(45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){transform:rotate(-45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:10px;width:0;left:50%}}"]})}return o})();var be=o=>({sidebarExpanded:o}),Re=(()=>{class o{$auth=u(A);$modal=u(E);$router=u(V);$settings=u(T);$translate=u(L);$ws=u(j);io;sidebarExpanded=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("app"),this.io.socket.on("reconnect",()=>{this.$auth.checkToken()}),this.compareServerUiVersion()}compareServerUiVersion(){return I(this,null,function*(){if(this.$settings.settingsLoaded||(yield z(this.$settings.onSettingsLoaded)),!this.$router.url.endsWith("/restart")&&(0,Q.lt)(this.$settings.uiVersion,$.serverTarget)){console.log(`Server restart required. UI Version: ${$.serverTarget} - Server Version: ${this.$settings.uiVersion} `);let e=this.$modal.open(R,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("platform.version.service_restart_required"),e.componentInstance.message=this.$translate.instant("platform.version.restart_required",{serverVersion:this.$settings.uiVersion,uiVersion:$.serverTarget}),e.componentInstance.confirmButtonLabel=this.$translate.instant("menu.tooltip_restart"),e.componentInstance.faIconClass="fas fa-power-off orange-text",e.result.then(()=>this.$router.navigate(["/restart"])).catch(()=>{})}})}static \u0275fac=function(l){return new(l||o)};static \u0275cmp=P({type:o,selectors:[["app-layout"]],decls:3,vars:4,consts:[[3,"isExpanded"],[1,"content","px-3","p-md-4",3,"ngClass"]],template:function(l,t){l&1&&(p(0,"app-sidebar",0),n(1,"div",1),p(2,"router-outlet"),a()),l&2&&(c("isExpanded",t.sidebarExpanded),i(),c("ngClass",M(2,be,t.sidebarExpanded)))},dependencies:[J,O,N],styles:[".content[_ngcontent-%COMP%]{margin-left:60px;transition:.3s;height:100%}@media (max-width: 767px){.content[_ngcontent-%COMP%]{margin-left:0;padding-top:85px!important}}@media (min-width: 768px){.content[_ngcontent-%COMP%]{height:100%}}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return o})();export{Re as LayoutComponent};
|
|
1
|
+
import{a as H}from"./chunk-TUN7H57E.js";import{a as X}from"./chunk-FZSUY7NB.js";import{a as G}from"./chunk-E7V47C3O.js";import{a as Z}from"./chunk-4XDXTE6Q.js";import"./chunk-5JDHV5WO.js";import{a as R}from"./chunk-4ZJF4BRP.js";import{n as E}from"./chunk-J2VLADZD.js";import"./chunk-QPTX7IVE.js";import{a as j}from"./chunk-54VEQSYX.js";import{b as A}from"./chunk-HDDWXQCC.js";import{a as q,c as N,d as V,e as W,f as D}from"./chunk-VHUDBTN7.js";import{b as T}from"./chunk-CMFP5UNE.js";import{k as L,l as U,p as $}from"./chunk-LJEJT7XC.js";import{Db as S,Gb as _,Ib as x,Kc as O,La as i,Pa as F,Vb as g,Wa as P,Wb as v,Xc as K,fc as h,g as Y,gc as M,h as I,ja as u,kb as m,lb as w,mb as y,mc as d,nc as s,oa as b,pa as C,rb as c,sb as n,tb as a,ub as p,w as z}from"./chunk-M33HG622.js";var Q=Y(Z(),1);var B=()=>["/"],te=o=>({"hamburger-icon-cross":o}),ne=o=>({expanded:o}),ie=()=>({exact:!0}),oe=()=>["/plugins"],re=()=>["/accessories"],ae=()=>["/logs"],de=()=>["/support"],se=()=>["/platform-tools/terminal"],le=()=>["/config"],pe=()=>["/settings"],ce=()=>["/power-options"];function me(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",20),d(2,"translate"),d(3,"translate"),_("click",function(){b(e);let t=x();return C(t.openUnderVoltageModal())})("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(4,"div",12),p(5,"i",21),a(),n(6,"div",14),g(7),d(8,"translate"),a()()()}o&2&&(i(),m("aria-label",s(2,2,"rpi.throttled.undervoltage_title")+" - "+s(3,4,"rpi.throttled.undervoltage_description")),i(6),v(s(8,6,"rpi.throttled.undervoltage_title")))}function ue(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",22),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,se))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.linux.label_terminal")),i(5),v(s(7,6,"menu.linux.label_terminal")))}function _e(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",23),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,le))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.config_json_editor")),i(5),v(s(7,6,"menu.config_json_editor")))}function ge(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",24),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,pe))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.label_settings")),i(5),v(s(7,6,"menu.label_settings")))}function fe(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",25),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),c("routerLink",h(8,ce))("routerLinkActive","active"),m("aria-label",s(2,4,"menu.restart.title")),i(5),v(s(7,6,"menu.restart.title")))}function ve(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",20),d(2,"translate"),_("click",function(){b(e);let t=x();return C(t.reloadPage())})("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",26),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),m("aria-label",s(2,2,"menu.reload")),i(5),v(s(7,4,"menu.reload")))}function he(o,k){if(o&1){let e=S();n(0,"div",10)(1,"div",20),d(2,"translate"),_("click",function(){b(e);let t=x();return C(t.logout())})("keydown",function(t){b(e);let r=x();return C(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",27),a(),n(5,"div",14),g(6),d(7,"translate"),a()()()}o&2&&(i(),m("aria-label",s(2,2,"menu.tooltip_logout")),i(5),v(s(7,4,"menu.tooltip_logout")))}var J=(()=>{class o{$auth=u(A);$settings=u(T);$modal=u(E);$notification=u(G);$renderer=u(F);$router=u(V);$translate=u(L);isExpanded=!1;formAuth=this.$settings.formAuth;isAdmin=this.$auth.user.admin;enableTerminalAccess=this.$settings.env.enableTerminalAccess;rPiCurrentlyUnderVoltage=!1;rPiWasUnderVoltage=!1;isMobile=!1;freezeMenu=!1;isPwa=H();constructor(){this.isMobile=window.innerWidth<768;let e;window.addEventListener("resize",()=>{clearTimeout(e),e=setTimeout(()=>{this.updateListeners()},500)}),this.$router.events.subscribe(l=>{l instanceof q&&(this.closeSidebar(),this.freezeMenu=!0,setTimeout(()=>{this.freezeMenu=!1},750))})}ngOnInit(){this.$notification.raspberryPiThrottled.subscribe(r=>{r["Under Voltage"]&&(this.rPiCurrentlyUnderVoltage=!0),r["Under-voltage has occurred"]&&(this.rPiWasUnderVoltage=!0)}),this.$notification.formAuthEnabled.subscribe(r=>{this.formAuth=r});let e=document.querySelector(".sidebar"),l=document.querySelector(".m-header"),t=document.querySelector(".content");this.isMobile?document.addEventListener("touchstart",r=>{if(t.contains(r.target)&&this.isExpanded){r.preventDefault(),this.toggleSidebar();return}!e.contains(r.target)&&!l.contains(r.target)&&this.isExpanded&&(r.preventDefault(),this.closeSidebar())},{passive:!1}):(this.updateListeners(),l.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),l.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}),document.addEventListener("click",r=>{e.contains(r.target)&&r.clientX>60&&this.closeSidebar()},{passive:!1})),this.updateContentStyles()}toggleSidebar(){this.freezeMenu||(this.isExpanded=!this.isExpanded,this.updateContentStyles())}openUnderVoltageModal(){let e=this.$modal.open(X,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("rpi.throttled.undervoltage_title"),e.componentInstance.message=this.$translate.instant(this.rPiCurrentlyUnderVoltage?"rpi.throttled.currently_message":"rpi.throttled.previously_message"),e.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),e.componentInstance.faIconClass="fas fa-bolt yellow-text",e.componentInstance.ctaButtonLink="https://pimylifeup.com/raspberry-pi-low-voltage-warning"}handleKeydown(e){if(e.key==="Enter"){let l=e.target;["menuitem","button"].includes(l.getAttribute("role"))&&l.click()}}reloadPage(){window.location.reload()}ngOnDestroy(){document.removeEventListener("touchstart",()=>{}),document.removeEventListener("click",()=>{})}logout(){this.$auth.logout()}openSidebar(){this.freezeMenu||(this.isExpanded=!0,this.updateContentStyles())}closeSidebar(){this.freezeMenu||(this.isExpanded=!1,this.updateContentStyles())}updateContentStyles(){let e=document.querySelector(".content");this.isExpanded?(this.$renderer.setStyle(e,"opacity","20%"),this.$renderer.setStyle(e,"pointer-events","none"),this.$renderer.setStyle(e,"overflow","hidden")):(this.$renderer.removeStyle(e,"opacity"),this.$renderer.removeStyle(e,"pointer-events"),this.$renderer.removeStyle(e,"overflow"))}updateListeners(){this.isMobile=window.innerWidth<768;let e=document.querySelector(".sidebar");e.removeAllListeners(),(this.isMobile||!this.isMobile&&this.$settings.menuMode!=="freeze")&&(e.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),e.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}))}static \u0275fac=function(l){return new(l||o)};static \u0275cmp=P({type:o,selectors:[["app-sidebar"]],inputs:{isExpanded:"isExpanded"},decls:68,vars:75,consts:[["tabindex","0","role","button",1,"m-header","text-end",3,"click","keydown"],[1,"me-2","d-block","d-lg-none",2,"font-size","0.9rem","color","#dddddd"],[3,"routerLink"],["ngSrc","assets/homebridge-logo.svg","alt","HB Logo","height","35","width","35",2,"height","35px","width","35px"],[1,"hb-logo-text-mobile"],[1,"hamburger-icon",3,"ngClass"],["role","navigation","id","sidebar",1,"sidebar",3,"ngClass"],["tabindex","0","role","button",1,"header",3,"click","keydown"],[1,"hb-logo-text"],[1,"link-wrapper"],[1,"link"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive","routerLinkActiveOptions"],[1,"icon"],[1,"fa","fa-house"],[1,"title"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive"],[1,"fa","fa-plug"],[1,"fa","fa-lightbulb"],[1,"fa","fa-wave-square"],[1,"fa","fa-question-circle-o"],["role","menuitem","tabindex","0",1,"link-row",3,"click","keydown"],[1,"fas","fa-bolt","fa-beat","yellow-text",2,"--fa-beat-scale","1.5"],[1,"fa","fa-terminal"],[1,"fa","fa-code"],[1,"fa","fa-cog"],[1,"fa","fa-power-off"],[1,"fa","fa-refresh"],[1,"fa","fa-right-from-bracket"]],template:function(l,t){l&1&&(n(0,"div",0),d(1,"translate"),_("click",function(){return t.toggleSidebar()})("keydown",function(f){return t.handleKeydown(f)}),p(2,"span",1),n(3,"a",2),d(4,"translate"),p(5,"img",3),n(6,"div",4),g(7,"Homebridge"),a()(),n(8,"div",5),p(9,"span")(10,"span")(11,"span")(12,"span"),a()(),n(13,"div",6)(14,"div",7),_("click",function(){return t.toggleSidebar()})("keydown",function(f){return t.handleKeydown(f)}),n(15,"a",2),d(16,"translate"),p(17,"img",3),n(18,"div",8),g(19,"Homebridge"),a()()(),n(20,"div",9)(21,"div",10)(22,"div",11),d(23,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(24,"div",12),p(25,"i",13),a(),n(26,"div",14),g(27),d(28,"translate"),a()()(),w(29,me,9,8,"div",10),n(30,"div",10)(31,"div",15),d(32,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(33,"div",12),p(34,"i",16),a(),n(35,"div",14),g(36),d(37,"translate"),a()()(),n(38,"div",10)(39,"div",15),d(40,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(41,"div",12),p(42,"i",17),a(),n(43,"div",14),g(44),d(45,"translate"),a()()(),n(46,"div",10)(47,"div",15),d(48,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(49,"div",12),p(50,"i",18),a(),n(51,"div",14),g(52),d(53,"translate"),a()()(),w(54,ue,8,9,"div",10),w(55,_e,8,9,"div",10),w(56,ge,8,9,"div",10),n(57,"div",10)(58,"div",15),d(59,"translate"),_("keydown",function(f){return t.handleKeydown(f)}),n(60,"div",12),p(61,"i",19),a(),n(62,"div",14),g(63),d(64,"translate"),a()()(),w(65,fe,8,9,"div",10),w(66,ve,8,6,"div",10),w(67,he,8,6,"div",10),a()()),l&2&&(m("aria-expanded",t.isExpanded?"true":"false")("aria-controls","sidebar")("aria-label",s(1,37,"menu.sidebar.aria_menu")),i(3),c("routerLink",h(63,B)),m("aria-label",s(4,39,"menu.label_status")),i(5),c("ngClass",M(64,te,t.isExpanded)),i(5),c("ngClass",M(66,ne,t.isExpanded)),i(2),c("routerLink",h(68,B)),m("aria-label",s(16,41,"menu.label_status")),i(7),c("routerLink",h(69,B))("routerLinkActive","active")("routerLinkActiveOptions",h(70,ie)),m("aria-label",s(23,43,"menu.label_status")),i(5),v(s(28,45,"menu.label_status")),i(2),y(t.rPiWasUnderVoltage||t.rPiCurrentlyUnderVoltage?29:-1),i(2),c("routerLink",h(71,oe))("routerLinkActive","active"),m("aria-label",s(32,47,"menu.label_plugins")),i(5),v(s(37,49,"menu.label_plugins")),i(3),c("routerLink",h(72,re))("routerLinkActive","active"),m("aria-label",s(40,51,"menu.label_accessories")),i(5),v(s(45,53,"menu.label_accessories")),i(3),c("routerLink",h(73,ae))("routerLinkActive","active"),m("aria-label",s(48,55,"menu.linux.label_logs")),i(5),v(s(53,57,"menu.linux.label_logs")),i(2),y(t.enableTerminalAccess&&t.isAdmin?54:-1),i(),y(t.isAdmin?55:-1),i(),y(t.isAdmin?56:-1),i(2),c("routerLink",h(74,de))("routerLinkActive","active"),m("aria-label",s(59,59,"support.title")),i(5),v(s(64,61,"support.title")),i(2),y(t.isAdmin?65:-1),i(),y(t.isPwa?66:-1),i(),y(t.formAuth?67:-1))},dependencies:[W,K,O,D,U],styles:[".m-header[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100%;height:65px;z-index:510;display:flex;align-items:center;padding-left:3px;padding-right:3px}.m-header[_ngcontent-%COMP%]:hover{cursor:pointer}@media (min-width: 768px){.m-header[_ngcontent-%COMP%]{display:none}}.sidebar[_ngcontent-%COMP%]{position:fixed;left:0;top:0;height:100vh;transition:.3s;width:60px;z-index:500}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:15px 10px 15px 11px;font-size:.85rem}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]:hover{cursor:pointer}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{overflow-x:hidden;overflow-y:auto;max-height:calc(100vh - 80px)!important;scrollbar-width:thin}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{padding-bottom:60px}}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%]{display:flex;align-items:center;padding:15px 10px;cursor:pointer;transition:.2s;font-size:17px}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{flex:0 0 38px;display:flex;align-items:center;justify-content:center}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{flex:1;transition:.3s;max-width:0;overflow:hidden;white-space:nowrap}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%]{width:0}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:none}}.sidebar.expanded[_ngcontent-%COMP%]{width:210px}@media (max-width: 767px){.sidebar.expanded[_ngcontent-%COMP%]{width:210px}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:block}}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{max-width:150px;padding-left:10px}.hamburger-icon[_ngcontent-%COMP%]{margin:-7px 0 0 25px}@media (min-width: 768px){.hb-logo-text[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px}.sidebar.expanded[_ngcontent-%COMP%] .hb-logo-text[_ngcontent-%COMP%]{opacity:1;left:55px;transition:.3s}.sidebar[_ngcontent-%COMP%]:not(.expanded) .hb-logo-text[_ngcontent-%COMP%]{opacity:0;left:40px;transition:.3s}.hb-logo-text-mobile[_ngcontent-%COMP%], .hamburger-icon[_ngcontent-%COMP%]{display:none!important}}@media (max-width: 767px){.hb-logo-text[_ngcontent-%COMP%]{display:none!important}.hb-logo-text-mobile[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px;opacity:1;left:55px}.hamburger-icon[_ngcontent-%COMP%]{position:absolute;right:10px;top:28px;width:30px;transform:rotate(0);transition:.5s ease-in-out;cursor:pointer}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;position:absolute;height:2px;width:100%;background-color:#fff;border-radius:9px;opacity:1;left:0;transform:rotate(0);transition:.25s ease-in-out}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:0}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2), .hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){top:10px}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:20px}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:10px;width:0;left:50%}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2){transform:rotate(45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){transform:rotate(-45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:10px;width:0;left:50%}}"]})}return o})();var be=o=>({sidebarExpanded:o}),Re=(()=>{class o{$auth=u(A);$modal=u(E);$router=u(V);$settings=u(T);$translate=u(L);$ws=u(j);io;sidebarExpanded=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("app"),this.io.socket.on("reconnect",()=>{this.$auth.checkToken()}),this.compareServerUiVersion()}compareServerUiVersion(){return I(this,null,function*(){if(this.$settings.settingsLoaded||(yield z(this.$settings.onSettingsLoaded)),!this.$router.url.endsWith("/restart")&&(0,Q.lt)(this.$settings.uiVersion,$.serverTarget)){console.log(`Server restart required. UI Version: ${$.serverTarget} - Server Version: ${this.$settings.uiVersion} `);let e=this.$modal.open(R,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("platform.version.service_restart_required"),e.componentInstance.message=this.$translate.instant("platform.version.restart_required",{serverVersion:this.$settings.uiVersion,uiVersion:$.serverTarget}),e.componentInstance.confirmButtonLabel=this.$translate.instant("menu.tooltip_restart"),e.componentInstance.faIconClass="fas fa-power-off orange-text",e.result.then(()=>this.$router.navigate(["/restart"])).catch(()=>{})}})}static \u0275fac=function(l){return new(l||o)};static \u0275cmp=P({type:o,selectors:[["app-layout"]],decls:3,vars:4,consts:[[3,"isExpanded"],[1,"content","px-3","p-md-4",3,"ngClass"]],template:function(l,t){l&1&&(p(0,"app-sidebar",0),n(1,"div",1),p(2,"router-outlet"),a()),l&2&&(c("isExpanded",t.sidebarExpanded),i(),c("ngClass",M(2,be,t.sidebarExpanded)))},dependencies:[J,O,N],styles:[".content[_ngcontent-%COMP%]{margin-left:60px;transition:.3s;height:100%}@media (max-width: 767px){.content[_ngcontent-%COMP%]{margin-left:0;padding-top:85px!important}}@media (min-width: 768px){.content[_ngcontent-%COMP%]{height:100%}}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return o})();export{Re as LayoutComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as I}from"./chunk-J2VLADZD.js";import{l as H}from"./chunk-
|
|
1
|
+
import{m as I}from"./chunk-J2VLADZD.js";import{l as H}from"./chunk-LJEJT7XC.js";import{Db as B,Eb as p,Ga as r,Hb as f,Ib as m,La as i,Ub as v,Vb as u,Wa as L,Wb as k,Xb as E,dc as g,ja as M,kb as x,lb as d,mb as c,mc as C,nc as b,oa as T,pa as y,vb as o,wb as a,xb as s}from"./chunk-M33HG622.js";function w(t,_){if(t&1&&s(0,"i",14),t&2){let e=m();v(g("fas ",e.faIconClass," mb-3"))}}function z(t,_){if(t&1&&s(0,"p",7),t&2){let e=m();p("innerHTML",e.message2,r)}}function h(t,_){if(t&1&&s(0,"p",7),t&2){let e=m();p("innerHTML",e.message3,r)}}function P(t,_){if(t&1){let e=B();o(0,"button",15),f("click",function(){T(e);let n=m();return y(n.closeModal())}),u(1),a()}if(t&2){let e=m();v(g("btn ",e.confirmButtonClass||"btn-primary")),i(),E(" ",e.confirmButtonLabel," ")}}var N=(()=>{class t{$activeModal=M(I);title;message;message2;message3;confirmButtonLabel;confirmButtonClass;faIconClass;dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(){this.$activeModal.close()}static \u0275fac=function(l){return new(l||t)};static \u0275cmp=L({type:t,selectors:[["ng-component"]],inputs:{title:"title",message:"message",message2:"message2",message3:"message3",confirmButtonLabel:"confirmButtonLabel",confirmButtonClass:"confirmButtonClass",faIconClass:"faIconClass"},decls:20,vars:15,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","text-center"],[2,"font-size","75px",3,"class"],[1,"mb-0","text-center",3,"innerHTML"],[1,"mt-2","mb-0","text-center",3,"innerHTML"],[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",3,"class"],[2,"font-size","75px"],["type","button","data-bs-dismiss","modal",3,"click"]],template:function(l,n){l&1&&(o(0,"div",0)(1,"div",1)(2,"h5",2),u(3),a(),o(4,"button",3),C(5,"translate"),f("click",function(){return n.dismissModal()}),a()(),o(6,"div",4),d(7,w,1,3,"i",5),s(8,"p",6),d(9,z,1,1,"p",7),d(10,h,1,1,"p",7),a(),o(11,"div",8)(12,"div",9)(13,"button",10),C(14,"translate"),f("click",function(){return n.dismissModal()}),u(15),C(16,"translate"),a()(),s(17,"div",11),o(18,"div",12),d(19,P,2,4,"button",13),a()()()),l&2&&(i(3),k(n.title),i(),x("aria-label",b(5,9,"form.button_close")),i(3),c(n.faIconClass?7:-1),i(),p("innerHTML",n.message,r),i(),c(n.message2?9:-1),i(),c(n.message3?10:-1),i(3),x("aria-label",b(14,11,"form.button_cancel")),i(2),E(" ",b(16,13,"form.button_cancel")," "),i(4),c(n.confirmButtonLabel?19:-1))},dependencies:[H],encapsulation:2})}return t})();export{N as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as pe}from"./chunk-DZJPWLJP.js";import{p as le}from"./chunk-UOXNLYDZ.js";import{ea as fe,f as We,ja as ue,k as he,n as X}from"./chunk-M33HG622.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-HDDWXQCC.js";import{p as le}from"./chunk-LJEJT7XC.js";import{ea as fe,f as We,ja as ue,k as he,n as X}from"./chunk-M33HG622.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 +1 @@
|
|
|
1
|
-
import{a as me}from"./chunk-4UZT4CWL.js";import{a as le}from"./chunk-4JL4TGFX.js";import{g as Q,m as k,n as ae}from"./chunk-J2VLADZD.js";import{B as A,C as G,b as q,c as F,d as g,e as V,f as z,g as N,j as S,m as R,p as O,q as L,r as J,z as re}from"./chunk-QPTX7IVE.js";import{b as H}from"./chunk-DZJPWLJP.js";import{b as oe}from"./chunk-VHUDBTN7.js";import{a as Ce,b as se}from"./chunk-BH22NGQA.js";import{k as T,l as E,n as B,q as M}from"./chunk-UOXNLYDZ.js";import{Ac as ne,Db as I,Gb as f,Ib as _,Kc as j,La as e,Vb as m,Wa as y,Wb as d,Xb as x,Yb as ee,g as xe,gc as D,h as W,hc as te,ja as c,kb as u,lb as w,mb as h,mc as a,nc as o,oa as $,ob as X,oc as ie,pa as U,pb as Y,qb as Z,rb as b,sb as i,tb as t,ub as p}from"./chunk-M33HG622.js";function we(r,C){r&1&&(i(0,"ngb-alert",13)(1,"p",20),m(2),a(3,"translate"),t()()),r&2&&(b("dismissible",!1),e(2),d(o(3,2,"login.invalid_password")))}var pe=(()=>{class r{$activeModal=c(k);$api=c(M);$toastr=c(B);$translate=c(T);invalidCredentials=!1;formGroup=new N({password:new S("",[g.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(s){return new(s||r)};static \u0275cmp=y({type:r,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-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(s,l){s&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),m(3),a(4,"translate"),t(),i(5,"button",3),a(6,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(7,"div",4)(8,"div",5),p(9,"i",6),t(),i(10,"ul",7)(11,"li"),m(12),a(13,"translate"),t()(),i(14,"ul",8)(15,"li",9)(16,"label",10),m(17),a(18,"translate"),t(),i(19,"div",11),p(20,"input",12),a(21,"translate"),t()()(),w(22,we,4,4,"ngb-alert",13),t(),i(23,"div",14)(24,"div",15)(25,"button",16),a(26,"translate"),f("click",function(){return l.dismissModal()}),m(27),a(28,"translate"),t()(),p(29,"div",17),i(30,"div",18)(31,"button",19),f("click",function(){return l.disable2fa()}),m(32),a(33,"translate"),t()()()()),s&2&&(e(3),d(o(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",o(6,13,"form.button_close")),e(7),d(o(13,15,"users.setup_2fa_disable_current_password")),e(5),d(o(18,17,"users.label_password")),e(3),b("formControl",l.formGroup.controls.password)("placeholder",o(21,19,"users.label_password")),e(2),h(l.invalidCredentials&&!l.formGroup.controls.password.value?22:-1),e(3),u("aria-label",o(26,21,"form.button_close")),e(2),x(" ",o(28,23,"form.button_close")," "),e(4),b("disabled",l.formGroup.invalid),e(),x(" ",o(33,25,"form.button_disable")," "))},dependencies:[A,F,V,G,O,Q,E],encapsulation:2})}return r})();var de=xe(Ce(),1);var he=r=>({timeDiffError:r});function ge(r,C){r&1&&(i(0,"li"),m(1),a(2,"translate"),t()),r&2&&(e(),d(o(2,1,"users.setup_2fa_scan_qr_code")))}function Se(r,C){if(r&1&&(i(0,"ngb-alert",8)(1,"p",16),m(2),a(3,"translate"),t(),i(4,"p",17),m(5),a(6,"translate"),t()()),r&2){let n=_();b("dismissible",!1),e(2),d(o(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),d(ie(6,5,"users.setup_2fa_server_time_out",D(8,he,n.timeDiffError)))}}function ye(r,C){r&1&&p(0,"i",27)}function Ee(r,C){r&1&&p(0,"i",28)}function $e(r,C){if(r&1){let n=I();i(0,"div",21),m(1),a(2,"translate"),p(3,"br"),m(4),i(5,"a",26),f("click",function(){$(n);let l=_(2);return U(l.copySecretToClipboard())}),w(6,ye,1,0,"i",27)(7,Ee,1,0,"i",28),t()()}if(r&2){let n=_(2);e(),x(" ",o(2,3,"users.setup_2fa_scan_qr_manual")),e(3),x(" ",n.otpSecret," "),e(2),h(n.secretCopied?6:7)}}function Ue(r,C){if(r&1&&(i(0,"ul",9)(1,"li",18)(2,"div",19),p(3,"app-qrcode",20),t(),w(4,$e,8,5,"div",21),t(),i(5,"li",22)(6,"label",23),m(7),a(8,"translate"),t(),i(9,"div",24),p(10,"input",25),t()()()),r&2){let n=_();e(3),b("data",n.otpString),e(),h(n.otpSecret?4:-1),e(3),d(o(8,4,"users.setup_2fa_enter_code")),e(3),b("formControl",n.formGroup.controls.code)}}function ke(r,C){if(r&1){let n=I();i(0,"button",29),a(1,"translate"),f("click",function(){$(n);let l=_();return U(l.dismissModal())}),m(2),a(3,"translate"),t()}r&2&&(u("aria-label",o(1,2,"form.button_close")),e(2),x(" ",o(3,4,"form.button_close")," "))}function Te(r,C){if(r&1){let n=I();i(0,"button",29),a(1,"translate"),f("click",function(){$(n);let l=_();return U(l.dismissModal())}),m(2),a(3,"translate"),t()}r&2&&(u("aria-label",o(1,2,"form.button_close")),e(2),x(" ",o(3,4,"form.button_close")," "))}function Be(r,C){if(r&1){let n=I();i(0,"button",30),f("click",function(){$(n);let l=_();return U(l.enable2fa())}),m(1),a(2,"translate"),t()}if(r&2){let n=_();b("disabled",n.formGroup.invalid),e(),x(" ",o(2,2,"form.button_enable")," ")}}var ce=(()=>{class r{$activeModal=c(k);$api=c(M);$toastr=c(B);$translate=c(T);copyTimeout=null;user;timeDiffError=null;otpString;otpSecret;secretCopied=!1;formGroup=new N({code:new S("",[g.required,g.minLength(6),g.maxLength(6)])});ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:n=>{this.checkTimeDiff(n.timestamp),this.timeDiffError||(this.otpString=n.otpauth,this.otpSecret=new URL(this.otpString).searchParams.get("secret")||"")},error:n=>{this.$activeModal.dismiss(),console.error(n),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:n=>{console.error(n),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}copySecretToClipboard(){return W(this,null,function*(){yield navigator.clipboard.writeText(this.otpSecret),this.secretCopied=!0,this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.secretCopied=!1},3e3)})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(n){let s=(0,de.default)(n).diff(new Date,"millisecond");s<-5e3||s>5e3?this.timeDiffError=s:this.timeDiffError=null}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,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-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","my-2"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"grey-text","small","mt-0","mb-1"],[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"],["href","javascript:void(0)",1,"ms-1","text-primary",3,"click"],[1,"fas","fa-check","green-text"],[1,"fas","fa-copy"],["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(s,l){s&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),m(3),a(4,"translate"),t(),i(5,"button",3),a(6,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(7,"div",4)(8,"div",5),p(9,"i",6),t(),i(10,"ul",7)(11,"li"),m(12),a(13,"translate"),t(),w(14,ge,3,3,"li"),t(),w(15,Se,7,10,"ngb-alert",8),w(16,Ue,11,6,"ul",9),t(),i(17,"div",10)(18,"div",11),w(19,ke,4,6,"button",12),t(),i(20,"div",13),w(21,Te,4,6,"button",12),t(),i(22,"div",14),w(23,Be,3,4,"button",15),t()()()),s&2&&(e(3),d(o(4,9,"users.setup_2fa")),e(2),u("aria-label",o(6,11,"form.button_close")),e(7),d(o(13,13,"users.setup_2fa_warning")),e(2),h(l.timeDiffError?-1:14),e(),h(l.timeDiffError?15:-1),e(),h(l.timeDiffError?-1:16),e(3),h(l.timeDiffError?-1:19),e(2),h(l.timeDiffError?21:-1),e(2),h(l.timeDiffError?-1:23))},dependencies:[Q,le,A,F,V,re,G,O,E],encapsulation:2})}return r})();var ue=r=>({"is-invalid":r}),fe=(()=>{class r{$activeModal=c(k);$api=c(M);$toastr=c(B);$translate=c(T);form=new N({username:new S("",[g.required]),name:new S("",[g.required]),password:new S("",[g.compose([g.required,g.minLength(4)])]),passwordConfirm:new S("",[g.required]),admin:new S(!0)},this.matchPassword);onSubmit({value:n}){this.$api.post("/users",n).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:s=>{this.$toastr.error(s.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(n){let s=n.get("password").value,l=n.get("passwordConfirm").value;if(s!==l)n.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,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-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"],["formControlName","admin","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(s,l){s&1&&(i(0,"div",0)(1,"form",1),f("ngSubmit",function(){return l.onSubmit(l.form)}),i(2,"div",2)(3,"h5",3),m(4),a(5,"translate"),t(),i(6,"button",4),a(7,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(8,"div",5)(9,"div",6),p(10,"i",7),t(),i(11,"ul",8)(12,"li",9)(13,"label",10),m(14),a(15,"translate"),t(),i(16,"div",11),p(17,"input",12),a(18,"translate"),t()(),i(19,"li",9)(20,"label",13),m(21),a(22,"translate"),t(),i(23,"div",11),p(24,"input",14),a(25,"translate"),t()(),i(26,"li",9)(27,"label",15),m(28),a(29,"translate"),t(),i(30,"div",11),p(31,"input",16),a(32,"translate"),t()(),i(33,"li",9)(34,"label",17),m(35),a(36,"translate"),t(),i(37,"div",11),p(38,"input",18),a(39,"translate"),t()(),i(40,"li",19)(41,"span",20),m(42),a(43,"translate"),t(),i(44,"div",21),p(45,"input",22),a(46,"translate"),p(47,"label",23),t()()()(),i(48,"div",24)(49,"div",20)(50,"button",25),f("click",function(){return l.dismissModal()}),m(51),a(52,"translate"),t()(),p(53,"div",26),i(54,"div",27)(55,"button",28),m(56),a(57,"translate"),t()()()()()),s&2&&(e(),b("formGroup",l.form),e(3),d(o(5,18,"users.title_add_user")),e(2),u("aria-label",o(7,20,"form.button_close")),e(8),d(o(15,22,"users.label_username")),e(3),u("aria-label",o(18,24,"users.label_username")),e(4),d(o(22,26,"users.label_full_name")),e(3),u("aria-label",o(25,28,"users.label_full_name")),e(4),d(o(29,30,"users.label_password")),e(3),b("ngClass",D(46,ue,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",o(32,32,"users.label_password")),e(4),d(o(36,34,"users.label_confirm_password")),e(3),b("ngClass",D(48,ue,l.form.controls.passwordConfirm.dirty&&l.form.controls.passwordConfirm.errors)),u("aria-label",o(39,36,"users.label_confirm_password")),e(4),d(o(43,38,"users.label_admin_user")),e(3),u("aria-label",o(46,40,"users.label_admin_user")),e(6),x(" ",o(52,42,"form.button_close")," "),e(4),b("disabled",!l.form.valid),e(),x(" ",o(57,44,"form.button_save")," "))},dependencies:[A,R,F,q,V,z,G,L,J,j,E],encapsulation:2})}return r})();var be=r=>({"is-invalid":r});function Me(r,C){if(r&1&&(i(0,"li",9)(1,"label",27),m(2),a(3,"translate"),t(),i(4,"div",11),p(5,"input",28),a(6,"translate"),t()()),r&2){let n=_();e(2),d(o(3,3,"users.label_confirm_password")),e(3),b("ngClass",D(7,be,n.form.controls.passwordConfirm.dirty&&n.form.controls.passwordConfirm.errors)),u("aria-label",o(6,5,"users.label_confirm_password"))}}var _e=(()=>{class r{$activeModal=c(k);$api=c(M);$auth=c(H);$cdr=c(ne);$toastr=c(B);$translate=c(T);initialFormValue={};user;isCurrentUser=!1;form=new N({username:new S("",[g.required]),name:new S("",[g.required]),password:new S(""),passwordConfirm:new S(""),admin:new S(!0)},this.matchPassword);ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user),this.initialFormValue=this.form.getRawValue(),this.form.valueChanges.subscribe(()=>this.$cdr.detectChanges())}onSubmit({value:n}){this.$api.patch(`/users/${this.user.id}`,n).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&n.username!==this.$auth.user.username&&this.$auth.logout()},error:s=>{console.error(s),this.$toastr.error(s.error?.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}isFormUnchanged(){return this.form.controls.password.value?!1:JSON.stringify(this.form.getRawValue())===JSON.stringify(this.initialFormValue)}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(n){let s=n.get("password").value,l=n.get("passwordConfirm").value;if(s!==l)n.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,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-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(s,l){s&1&&(i(0,"div",0)(1,"form",1),f("ngSubmit",function(){return l.onSubmit(l.form)}),i(2,"div",2)(3,"h5",3),m(4),a(5,"translate"),t(),i(6,"button",4),a(7,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(8,"div",5)(9,"div",6),p(10,"i",7),t(),i(11,"ul",8)(12,"li",9)(13,"label",10),m(14),a(15,"translate"),t(),i(16,"div",11),p(17,"input",12),a(18,"translate"),t()(),i(19,"li",9)(20,"label",13),m(21),a(22,"translate"),t(),i(23,"div",11),p(24,"input",14),a(25,"translate"),t()(),i(26,"li",9)(27,"label",15),m(28),a(29,"translate"),t(),i(30,"div",11),p(31,"input",16),a(32,"translate"),t()(),w(33,Me,7,9,"li",9),i(34,"li",17)(35,"span",18),m(36),a(37,"translate"),t(),i(38,"div",19),p(39,"input",20),a(40,"translate"),p(41,"label",21),t()()()(),i(42,"div",22)(43,"div",18)(44,"button",23),f("click",function(){return l.dismissModal()}),m(45),a(46,"translate"),t()(),p(47,"div",24),i(48,"div",25)(49,"button",26),m(50),a(51,"translate"),t()()()()()),s&2&&(e(),b("formGroup",l.form),e(3),d(o(5,16,"users.title_edit_user")),e(2),u("aria-label",o(7,18,"form.button_close")),e(8),d(o(15,20,"users.label_username")),e(3),u("aria-label",o(18,22,"users.label_username")),e(4),d(o(22,24,"users.label_full_name")),e(3),u("aria-label",o(25,26,"users.label_full_name")),e(4),d(o(29,28,"users.label_new_password")),e(3),b("ngClass",D(40,be,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",o(32,30,"users.label_new_password")),e(2),h(l.form.controls.password.value?33:-1),e(3),d(o(37,32,"users.label_admin_user")),e(3),u("aria-label",o(40,34,"users.label_admin_user")),e(6),x(" ",o(46,36,"form.button_close")," "),e(4),b("disabled",!l.form.valid||l.isFormUnchanged()),e(),x(" ",o(51,38,"form.button_save")," "))},dependencies:[A,R,F,q,V,z,G,L,J,j,E],encapsulation:2})}return r})();var ve=(()=>{class r{$activeModal=c(k);dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,selectors:[["ng-component"]],decls:46,vars:36,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","mb-3"],[1,"fa","fa-question-circle-o","primary-text",2,"font-size","75px"],[1,"ms-2"],[1,"mb-0"],[1,"mb-2","grey-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"]],template:function(s,l){s&1&&(i(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),m(4),a(5,"translate"),t(),i(6,"button",3),a(7,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(8,"div",4)(9,"div",5),p(10,"i",6),t(),i(11,"h5",7),m(12),a(13,"translate"),t(),i(14,"ul",8)(15,"li"),m(16),a(17,"translate"),t(),i(18,"ul",9)(19,"li"),m(20),a(21,"translate"),t(),i(22,"li"),m(23),a(24,"translate"),t(),i(25,"li"),m(26),a(27,"translate"),a(28,"translate"),t(),i(29,"li"),m(30),a(31,"translate"),t(),i(32,"li"),m(33),a(34,"translate"),t()(),i(35,"li"),m(36),a(37,"translate"),t()(),p(38,"app-support-banner"),t(),i(39,"div",10),p(40,"div",11),i(41,"div",12)(42,"button",13),f("click",function(){return l.dismissModal()}),m(43),a(44,"translate"),t()(),p(45,"div",14),t()()()),s&2&&(e(4),d(o(5,12,"support.title")),e(2),u("aria-label",o(7,14,"form.button_close")),e(6),d(o(13,16,"users.title_users")),e(4),d(o(17,18,"users.support.acc_1")),e(4),d(o(21,20,"menu.label_status")),e(3),d(o(24,22,"menu.label_plugins")),e(3),ee("",o(27,24,"menu.label_accessories")," (",o(28,26,"users.support.control"),")"),e(4),d(o(31,28,"menu.linux.label_logs")),e(3),d(o(34,30,"support.title")),e(3),d(o(37,32,"users.support.acc_2")),e(7),x(" ",o(44,34,"form.button_close")," "))},dependencies:[me,E],encapsulation:2})}return r})();var Ie=(r,C)=>({"fa-user-secret":r,"fa-user":C});function De(r,C){if(r&1){let n=I();i(0,"button",23),f("click",function(){$(n);let l=_(2).$implicit,v=_();return U(v.disable2fa(l))}),m(1),a(2,"translate"),t()}if(r&2){let n=_(2).$implicit,s=_();b("disabled",n.username!==s.username),e(),x(" ",o(2,2,"users.setup_2fa_disable")," ")}}function Fe(r,C){if(r&1){let n=I();i(0,"button",24),f("click",function(){$(n);let l=_(2).$implicit,v=_();return U(v.setup2fa(l))}),m(1),a(2,"translate"),t()}if(r&2){let n=_(2).$implicit,s=_();b("disabled",n.username!==s.username),e(),x(" ",o(2,2,"users.setup_2fa")," ")}}function Ve(r,C){if(r&1&&w(0,De,3,4,"button",21)(1,Fe,3,4,"button",22),r&2){let n=_().$implicit;h(n.otpActive?0:1)}}function Ne(r,C){r&1&&p(0,"div")}function Ae(r,C){if(r&1){let n=I();i(0,"div",9)(1,"div",10)(2,"div",11)(3,"div",12)(4,"span",13)(5,"h4"),m(6),t(),i(7,"h5",14),p(8,"i",15),m(9),t()()(),i(10,"div",16),w(11,Ve,2,1)(12,Ne,1,0,"div"),i(13,"div")(14,"button",17),a(15,"translate"),f("click",function(){let l=$(n).$implicit,v=_();return U(v.openEditUser(l))}),p(16,"i",18),t(),i(17,"button",19),a(18,"translate"),f("click",function(){let l=$(n).$implicit,v=_();return U(v.deleteUser(l.id))}),p(19,"i",20),t()()()()()()}if(r&2){let n=C.$implicit,s=_();e(6),d(n.name),e(2),b("ngClass",te(11,Ie,n.admin,!n.admin)),e(),x(" ",n.username," "),e(2),h(n.admin?11:12),e(3),u("aria-label",o(15,7,"form.button_edit")),e(3),b("disabled",s.username===n.username),u("aria-label",o(18,9,"form.button_delete"))}}var Ot=(()=>{class r{$api=c(M);$auth=c(H);$modal=c(ae);$route=c(oe);$settings=c(se);$toastr=c(B);$translate=c(T);homebridgeUsers=[];username=this.$auth.user.username;isAdmin=this.$auth.user.admin;ngOnInit(){let n=this.$translate.instant("users.title_users");this.$settings.setPageTitle(n),this.$route.data.subscribe(s=>{this.homebridgeUsers=s.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(n=>{this.homebridgeUsers=n})}openAddNewUser(){this.$modal.open(fe,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(n){let s=this.$modal.open(_e,{size:"lg",backdrop:"static"});s.componentInstance.user=n,s.result.finally(()=>{this.reloadUsers()})}deleteUser(n){this.$api.delete(`/users/${n}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:s=>{console.error(s),this.$toastr.error(s.error?.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(n){let s=this.$modal.open(ce,{size:"lg",backdrop:"static"});s.componentInstance.user=n,s.result.finally(()=>{this.reloadUsers()})}disable2fa(n){let s=this.$modal.open(pe,{size:"lg",backdrop:"static"});s.componentInstance.user=n,s.result.finally(()=>{this.reloadUsers()})}openSupport(){this.$modal.open(ve,{size:"lg",backdrop:"static"})}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,selectors:[["app-users"]],decls:15,vars:9,consts:[[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],[1,"btn","btn-elegant","waves-effect","m-0","me-2",3,"click"],[1,"fas","fa-user-plus"],["type","button",1,"btn","btn-elegant","my-0","me-0",3,"click"],[1,"fa","fa-question-circle-o"],[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"],[1,"small","text-truncate","grey-text"],[1,"fas",3,"ngClass"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-trash"],[1,"btn","btn-elegant","m-0",3,"disabled"],[1,"btn","btn-primary","m-0",3,"disabled"],[1,"btn","btn-elegant","m-0",3,"click","disabled"],[1,"btn","btn-primary","m-0",3,"click","disabled"]],template:function(s,l){s&1&&(i(0,"div",0)(1,"div",1)(2,"h3",2),m(3),a(4,"translate"),t()(),i(5,"div",3)(6,"button",4),a(7,"translate"),f("click",function(){return l.openAddNewUser()}),p(8,"i",5),t(),i(9,"button",6),a(10,"translate"),f("click",function(){return l.openSupport()}),p(11,"i",7),t()()(),i(12,"div",8),Y(13,Ae,20,14,"div",9,X),t()),s&2&&(e(3),d(o(4,3,"users.title_users")),e(3),u("aria-label",o(7,5,"users.button_add_user")),e(3),u("aria-label",o(10,7,"support.title")),e(4),Z(l.homebridgeUsers))},dependencies:[j,E],encapsulation:2})}return r})();export{Ot as UsersComponent};
|
|
1
|
+
import{a as me}from"./chunk-BGUMMZ2C.js";import{a as le}from"./chunk-4JL4TGFX.js";import{g as Q,m as k,n as ae}from"./chunk-J2VLADZD.js";import{B as A,C as G,b as q,c as F,d as g,e as V,f as z,g as N,j as S,m as R,p as O,q as L,r as J,z as re}from"./chunk-QPTX7IVE.js";import{b as H}from"./chunk-HDDWXQCC.js";import{b as oe}from"./chunk-VHUDBTN7.js";import{a as Ce,b as se}from"./chunk-CMFP5UNE.js";import{k as T,l as E,n as B,q as M}from"./chunk-LJEJT7XC.js";import{Ac as ne,Db as I,Gb as f,Ib as _,Kc as j,La as e,Vb as m,Wa as y,Wb as d,Xb as x,Yb as ee,g as xe,gc as D,h as W,hc as te,ja as c,kb as u,lb as w,mb as h,mc as a,nc as o,oa as $,ob as X,oc as ie,pa as U,pb as Y,qb as Z,rb as b,sb as i,tb as t,ub as p}from"./chunk-M33HG622.js";function we(r,C){r&1&&(i(0,"ngb-alert",13)(1,"p",20),m(2),a(3,"translate"),t()()),r&2&&(b("dismissible",!1),e(2),d(o(3,2,"login.invalid_password")))}var pe=(()=>{class r{$activeModal=c(k);$api=c(M);$toastr=c(B);$translate=c(T);invalidCredentials=!1;formGroup=new N({password:new S("",[g.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(s){return new(s||r)};static \u0275cmp=y({type:r,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-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(s,l){s&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),m(3),a(4,"translate"),t(),i(5,"button",3),a(6,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(7,"div",4)(8,"div",5),p(9,"i",6),t(),i(10,"ul",7)(11,"li"),m(12),a(13,"translate"),t()(),i(14,"ul",8)(15,"li",9)(16,"label",10),m(17),a(18,"translate"),t(),i(19,"div",11),p(20,"input",12),a(21,"translate"),t()()(),w(22,we,4,4,"ngb-alert",13),t(),i(23,"div",14)(24,"div",15)(25,"button",16),a(26,"translate"),f("click",function(){return l.dismissModal()}),m(27),a(28,"translate"),t()(),p(29,"div",17),i(30,"div",18)(31,"button",19),f("click",function(){return l.disable2fa()}),m(32),a(33,"translate"),t()()()()),s&2&&(e(3),d(o(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",o(6,13,"form.button_close")),e(7),d(o(13,15,"users.setup_2fa_disable_current_password")),e(5),d(o(18,17,"users.label_password")),e(3),b("formControl",l.formGroup.controls.password)("placeholder",o(21,19,"users.label_password")),e(2),h(l.invalidCredentials&&!l.formGroup.controls.password.value?22:-1),e(3),u("aria-label",o(26,21,"form.button_close")),e(2),x(" ",o(28,23,"form.button_close")," "),e(4),b("disabled",l.formGroup.invalid),e(),x(" ",o(33,25,"form.button_disable")," "))},dependencies:[A,F,V,G,O,Q,E],encapsulation:2})}return r})();var de=xe(Ce(),1);var he=r=>({timeDiffError:r});function ge(r,C){r&1&&(i(0,"li"),m(1),a(2,"translate"),t()),r&2&&(e(),d(o(2,1,"users.setup_2fa_scan_qr_code")))}function Se(r,C){if(r&1&&(i(0,"ngb-alert",8)(1,"p",16),m(2),a(3,"translate"),t(),i(4,"p",17),m(5),a(6,"translate"),t()()),r&2){let n=_();b("dismissible",!1),e(2),d(o(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),d(ie(6,5,"users.setup_2fa_server_time_out",D(8,he,n.timeDiffError)))}}function ye(r,C){r&1&&p(0,"i",27)}function Ee(r,C){r&1&&p(0,"i",28)}function $e(r,C){if(r&1){let n=I();i(0,"div",21),m(1),a(2,"translate"),p(3,"br"),m(4),i(5,"a",26),f("click",function(){$(n);let l=_(2);return U(l.copySecretToClipboard())}),w(6,ye,1,0,"i",27)(7,Ee,1,0,"i",28),t()()}if(r&2){let n=_(2);e(),x(" ",o(2,3,"users.setup_2fa_scan_qr_manual")),e(3),x(" ",n.otpSecret," "),e(2),h(n.secretCopied?6:7)}}function Ue(r,C){if(r&1&&(i(0,"ul",9)(1,"li",18)(2,"div",19),p(3,"app-qrcode",20),t(),w(4,$e,8,5,"div",21),t(),i(5,"li",22)(6,"label",23),m(7),a(8,"translate"),t(),i(9,"div",24),p(10,"input",25),t()()()),r&2){let n=_();e(3),b("data",n.otpString),e(),h(n.otpSecret?4:-1),e(3),d(o(8,4,"users.setup_2fa_enter_code")),e(3),b("formControl",n.formGroup.controls.code)}}function ke(r,C){if(r&1){let n=I();i(0,"button",29),a(1,"translate"),f("click",function(){$(n);let l=_();return U(l.dismissModal())}),m(2),a(3,"translate"),t()}r&2&&(u("aria-label",o(1,2,"form.button_close")),e(2),x(" ",o(3,4,"form.button_close")," "))}function Te(r,C){if(r&1){let n=I();i(0,"button",29),a(1,"translate"),f("click",function(){$(n);let l=_();return U(l.dismissModal())}),m(2),a(3,"translate"),t()}r&2&&(u("aria-label",o(1,2,"form.button_close")),e(2),x(" ",o(3,4,"form.button_close")," "))}function Be(r,C){if(r&1){let n=I();i(0,"button",30),f("click",function(){$(n);let l=_();return U(l.enable2fa())}),m(1),a(2,"translate"),t()}if(r&2){let n=_();b("disabled",n.formGroup.invalid),e(),x(" ",o(2,2,"form.button_enable")," ")}}var ce=(()=>{class r{$activeModal=c(k);$api=c(M);$toastr=c(B);$translate=c(T);copyTimeout=null;user;timeDiffError=null;otpString;otpSecret;secretCopied=!1;formGroup=new N({code:new S("",[g.required,g.minLength(6),g.maxLength(6)])});ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:n=>{this.checkTimeDiff(n.timestamp),this.timeDiffError||(this.otpString=n.otpauth,this.otpSecret=new URL(this.otpString).searchParams.get("secret")||"")},error:n=>{this.$activeModal.dismiss(),console.error(n),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:n=>{console.error(n),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}copySecretToClipboard(){return W(this,null,function*(){yield navigator.clipboard.writeText(this.otpSecret),this.secretCopied=!0,this.copyTimeout&&clearTimeout(this.copyTimeout),this.copyTimeout=setTimeout(()=>{this.secretCopied=!1},3e3)})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(n){let s=(0,de.default)(n).diff(new Date,"millisecond");s<-5e3||s>5e3?this.timeDiffError=s:this.timeDiffError=null}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,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-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","my-2"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"grey-text","small","mt-0","mb-1"],[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"],["href","javascript:void(0)",1,"ms-1","text-primary",3,"click"],[1,"fas","fa-check","green-text"],[1,"fas","fa-copy"],["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(s,l){s&1&&(i(0,"div",0)(1,"div",1)(2,"h5",2),m(3),a(4,"translate"),t(),i(5,"button",3),a(6,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(7,"div",4)(8,"div",5),p(9,"i",6),t(),i(10,"ul",7)(11,"li"),m(12),a(13,"translate"),t(),w(14,ge,3,3,"li"),t(),w(15,Se,7,10,"ngb-alert",8),w(16,Ue,11,6,"ul",9),t(),i(17,"div",10)(18,"div",11),w(19,ke,4,6,"button",12),t(),i(20,"div",13),w(21,Te,4,6,"button",12),t(),i(22,"div",14),w(23,Be,3,4,"button",15),t()()()),s&2&&(e(3),d(o(4,9,"users.setup_2fa")),e(2),u("aria-label",o(6,11,"form.button_close")),e(7),d(o(13,13,"users.setup_2fa_warning")),e(2),h(l.timeDiffError?-1:14),e(),h(l.timeDiffError?15:-1),e(),h(l.timeDiffError?-1:16),e(3),h(l.timeDiffError?-1:19),e(2),h(l.timeDiffError?21:-1),e(2),h(l.timeDiffError?-1:23))},dependencies:[Q,le,A,F,V,re,G,O,E],encapsulation:2})}return r})();var ue=r=>({"is-invalid":r}),fe=(()=>{class r{$activeModal=c(k);$api=c(M);$toastr=c(B);$translate=c(T);form=new N({username:new S("",[g.required]),name:new S("",[g.required]),password:new S("",[g.compose([g.required,g.minLength(4)])]),passwordConfirm:new S("",[g.required]),admin:new S(!0)},this.matchPassword);onSubmit({value:n}){this.$api.post("/users",n).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:s=>{this.$toastr.error(s.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(n){let s=n.get("password").value,l=n.get("passwordConfirm").value;if(s!==l)n.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,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-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"],["formControlName","admin","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(s,l){s&1&&(i(0,"div",0)(1,"form",1),f("ngSubmit",function(){return l.onSubmit(l.form)}),i(2,"div",2)(3,"h5",3),m(4),a(5,"translate"),t(),i(6,"button",4),a(7,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(8,"div",5)(9,"div",6),p(10,"i",7),t(),i(11,"ul",8)(12,"li",9)(13,"label",10),m(14),a(15,"translate"),t(),i(16,"div",11),p(17,"input",12),a(18,"translate"),t()(),i(19,"li",9)(20,"label",13),m(21),a(22,"translate"),t(),i(23,"div",11),p(24,"input",14),a(25,"translate"),t()(),i(26,"li",9)(27,"label",15),m(28),a(29,"translate"),t(),i(30,"div",11),p(31,"input",16),a(32,"translate"),t()(),i(33,"li",9)(34,"label",17),m(35),a(36,"translate"),t(),i(37,"div",11),p(38,"input",18),a(39,"translate"),t()(),i(40,"li",19)(41,"span",20),m(42),a(43,"translate"),t(),i(44,"div",21),p(45,"input",22),a(46,"translate"),p(47,"label",23),t()()()(),i(48,"div",24)(49,"div",20)(50,"button",25),f("click",function(){return l.dismissModal()}),m(51),a(52,"translate"),t()(),p(53,"div",26),i(54,"div",27)(55,"button",28),m(56),a(57,"translate"),t()()()()()),s&2&&(e(),b("formGroup",l.form),e(3),d(o(5,18,"users.title_add_user")),e(2),u("aria-label",o(7,20,"form.button_close")),e(8),d(o(15,22,"users.label_username")),e(3),u("aria-label",o(18,24,"users.label_username")),e(4),d(o(22,26,"users.label_full_name")),e(3),u("aria-label",o(25,28,"users.label_full_name")),e(4),d(o(29,30,"users.label_password")),e(3),b("ngClass",D(46,ue,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",o(32,32,"users.label_password")),e(4),d(o(36,34,"users.label_confirm_password")),e(3),b("ngClass",D(48,ue,l.form.controls.passwordConfirm.dirty&&l.form.controls.passwordConfirm.errors)),u("aria-label",o(39,36,"users.label_confirm_password")),e(4),d(o(43,38,"users.label_admin_user")),e(3),u("aria-label",o(46,40,"users.label_admin_user")),e(6),x(" ",o(52,42,"form.button_close")," "),e(4),b("disabled",!l.form.valid),e(),x(" ",o(57,44,"form.button_save")," "))},dependencies:[A,R,F,q,V,z,G,L,J,j,E],encapsulation:2})}return r})();var be=r=>({"is-invalid":r});function Me(r,C){if(r&1&&(i(0,"li",9)(1,"label",27),m(2),a(3,"translate"),t(),i(4,"div",11),p(5,"input",28),a(6,"translate"),t()()),r&2){let n=_();e(2),d(o(3,3,"users.label_confirm_password")),e(3),b("ngClass",D(7,be,n.form.controls.passwordConfirm.dirty&&n.form.controls.passwordConfirm.errors)),u("aria-label",o(6,5,"users.label_confirm_password"))}}var _e=(()=>{class r{$activeModal=c(k);$api=c(M);$auth=c(H);$cdr=c(ne);$toastr=c(B);$translate=c(T);initialFormValue={};user;isCurrentUser=!1;form=new N({username:new S("",[g.required]),name:new S("",[g.required]),password:new S(""),passwordConfirm:new S(""),admin:new S(!0)},this.matchPassword);ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user),this.initialFormValue=this.form.getRawValue(),this.form.valueChanges.subscribe(()=>this.$cdr.detectChanges())}onSubmit({value:n}){this.$api.patch(`/users/${this.user.id}`,n).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&n.username!==this.$auth.user.username&&this.$auth.logout()},error:s=>{console.error(s),this.$toastr.error(s.error?.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}isFormUnchanged(){return this.form.controls.password.value?!1:JSON.stringify(this.form.getRawValue())===JSON.stringify(this.initialFormValue)}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(n){let s=n.get("password").value,l=n.get("passwordConfirm").value;if(s!==l)n.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,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-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(s,l){s&1&&(i(0,"div",0)(1,"form",1),f("ngSubmit",function(){return l.onSubmit(l.form)}),i(2,"div",2)(3,"h5",3),m(4),a(5,"translate"),t(),i(6,"button",4),a(7,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(8,"div",5)(9,"div",6),p(10,"i",7),t(),i(11,"ul",8)(12,"li",9)(13,"label",10),m(14),a(15,"translate"),t(),i(16,"div",11),p(17,"input",12),a(18,"translate"),t()(),i(19,"li",9)(20,"label",13),m(21),a(22,"translate"),t(),i(23,"div",11),p(24,"input",14),a(25,"translate"),t()(),i(26,"li",9)(27,"label",15),m(28),a(29,"translate"),t(),i(30,"div",11),p(31,"input",16),a(32,"translate"),t()(),w(33,Me,7,9,"li",9),i(34,"li",17)(35,"span",18),m(36),a(37,"translate"),t(),i(38,"div",19),p(39,"input",20),a(40,"translate"),p(41,"label",21),t()()()(),i(42,"div",22)(43,"div",18)(44,"button",23),f("click",function(){return l.dismissModal()}),m(45),a(46,"translate"),t()(),p(47,"div",24),i(48,"div",25)(49,"button",26),m(50),a(51,"translate"),t()()()()()),s&2&&(e(),b("formGroup",l.form),e(3),d(o(5,16,"users.title_edit_user")),e(2),u("aria-label",o(7,18,"form.button_close")),e(8),d(o(15,20,"users.label_username")),e(3),u("aria-label",o(18,22,"users.label_username")),e(4),d(o(22,24,"users.label_full_name")),e(3),u("aria-label",o(25,26,"users.label_full_name")),e(4),d(o(29,28,"users.label_new_password")),e(3),b("ngClass",D(40,be,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",o(32,30,"users.label_new_password")),e(2),h(l.form.controls.password.value?33:-1),e(3),d(o(37,32,"users.label_admin_user")),e(3),u("aria-label",o(40,34,"users.label_admin_user")),e(6),x(" ",o(46,36,"form.button_close")," "),e(4),b("disabled",!l.form.valid||l.isFormUnchanged()),e(),x(" ",o(51,38,"form.button_save")," "))},dependencies:[A,R,F,q,V,z,G,L,J,j,E],encapsulation:2})}return r})();var ve=(()=>{class r{$activeModal=c(k);dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,selectors:[["ng-component"]],decls:46,vars:36,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","mb-3"],[1,"fa","fa-question-circle-o","primary-text",2,"font-size","75px"],[1,"ms-2"],[1,"mb-0"],[1,"mb-2","grey-text"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"]],template:function(s,l){s&1&&(i(0,"div",0)(1,"form")(2,"div",1)(3,"h5",2),m(4),a(5,"translate"),t(),i(6,"button",3),a(7,"translate"),f("click",function(){return l.dismissModal()}),t()(),i(8,"div",4)(9,"div",5),p(10,"i",6),t(),i(11,"h5",7),m(12),a(13,"translate"),t(),i(14,"ul",8)(15,"li"),m(16),a(17,"translate"),t(),i(18,"ul",9)(19,"li"),m(20),a(21,"translate"),t(),i(22,"li"),m(23),a(24,"translate"),t(),i(25,"li"),m(26),a(27,"translate"),a(28,"translate"),t(),i(29,"li"),m(30),a(31,"translate"),t(),i(32,"li"),m(33),a(34,"translate"),t()(),i(35,"li"),m(36),a(37,"translate"),t()(),p(38,"app-support-banner"),t(),i(39,"div",10),p(40,"div",11),i(41,"div",12)(42,"button",13),f("click",function(){return l.dismissModal()}),m(43),a(44,"translate"),t()(),p(45,"div",14),t()()()),s&2&&(e(4),d(o(5,12,"support.title")),e(2),u("aria-label",o(7,14,"form.button_close")),e(6),d(o(13,16,"users.title_users")),e(4),d(o(17,18,"users.support.acc_1")),e(4),d(o(21,20,"menu.label_status")),e(3),d(o(24,22,"menu.label_plugins")),e(3),ee("",o(27,24,"menu.label_accessories")," (",o(28,26,"users.support.control"),")"),e(4),d(o(31,28,"menu.linux.label_logs")),e(3),d(o(34,30,"support.title")),e(3),d(o(37,32,"users.support.acc_2")),e(7),x(" ",o(44,34,"form.button_close")," "))},dependencies:[me,E],encapsulation:2})}return r})();var Ie=(r,C)=>({"fa-user-secret":r,"fa-user":C});function De(r,C){if(r&1){let n=I();i(0,"button",23),f("click",function(){$(n);let l=_(2).$implicit,v=_();return U(v.disable2fa(l))}),m(1),a(2,"translate"),t()}if(r&2){let n=_(2).$implicit,s=_();b("disabled",n.username!==s.username),e(),x(" ",o(2,2,"users.setup_2fa_disable")," ")}}function Fe(r,C){if(r&1){let n=I();i(0,"button",24),f("click",function(){$(n);let l=_(2).$implicit,v=_();return U(v.setup2fa(l))}),m(1),a(2,"translate"),t()}if(r&2){let n=_(2).$implicit,s=_();b("disabled",n.username!==s.username),e(),x(" ",o(2,2,"users.setup_2fa")," ")}}function Ve(r,C){if(r&1&&w(0,De,3,4,"button",21)(1,Fe,3,4,"button",22),r&2){let n=_().$implicit;h(n.otpActive?0:1)}}function Ne(r,C){r&1&&p(0,"div")}function Ae(r,C){if(r&1){let n=I();i(0,"div",9)(1,"div",10)(2,"div",11)(3,"div",12)(4,"span",13)(5,"h4"),m(6),t(),i(7,"h5",14),p(8,"i",15),m(9),t()()(),i(10,"div",16),w(11,Ve,2,1)(12,Ne,1,0,"div"),i(13,"div")(14,"button",17),a(15,"translate"),f("click",function(){let l=$(n).$implicit,v=_();return U(v.openEditUser(l))}),p(16,"i",18),t(),i(17,"button",19),a(18,"translate"),f("click",function(){let l=$(n).$implicit,v=_();return U(v.deleteUser(l.id))}),p(19,"i",20),t()()()()()()}if(r&2){let n=C.$implicit,s=_();e(6),d(n.name),e(2),b("ngClass",te(11,Ie,n.admin,!n.admin)),e(),x(" ",n.username," "),e(2),h(n.admin?11:12),e(3),u("aria-label",o(15,7,"form.button_edit")),e(3),b("disabled",s.username===n.username),u("aria-label",o(18,9,"form.button_delete"))}}var Ot=(()=>{class r{$api=c(M);$auth=c(H);$modal=c(ae);$route=c(oe);$settings=c(se);$toastr=c(B);$translate=c(T);homebridgeUsers=[];username=this.$auth.user.username;isAdmin=this.$auth.user.admin;ngOnInit(){let n=this.$translate.instant("users.title_users");this.$settings.setPageTitle(n),this.$route.data.subscribe(s=>{this.homebridgeUsers=s.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(n=>{this.homebridgeUsers=n})}openAddNewUser(){this.$modal.open(fe,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(n){let s=this.$modal.open(_e,{size:"lg",backdrop:"static"});s.componentInstance.user=n,s.result.finally(()=>{this.reloadUsers()})}deleteUser(n){this.$api.delete(`/users/${n}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:s=>{console.error(s),this.$toastr.error(s.error?.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(n){let s=this.$modal.open(ce,{size:"lg",backdrop:"static"});s.componentInstance.user=n,s.result.finally(()=>{this.reloadUsers()})}disable2fa(n){let s=this.$modal.open(pe,{size:"lg",backdrop:"static"});s.componentInstance.user=n,s.result.finally(()=>{this.reloadUsers()})}openSupport(){this.$modal.open(ve,{size:"lg",backdrop:"static"})}static \u0275fac=function(s){return new(s||r)};static \u0275cmp=y({type:r,selectors:[["app-users"]],decls:15,vars:9,consts:[[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],[1,"btn","btn-elegant","waves-effect","m-0","me-2",3,"click"],[1,"fas","fa-user-plus"],["type","button",1,"btn","btn-elegant","my-0","me-0",3,"click"],[1,"fa","fa-question-circle-o"],[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"],[1,"small","text-truncate","grey-text"],[1,"fas",3,"ngClass"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-trash"],[1,"btn","btn-elegant","m-0",3,"disabled"],[1,"btn","btn-primary","m-0",3,"disabled"],[1,"btn","btn-elegant","m-0",3,"click","disabled"],[1,"btn","btn-primary","m-0",3,"click","disabled"]],template:function(s,l){s&1&&(i(0,"div",0)(1,"div",1)(2,"h3",2),m(3),a(4,"translate"),t()(),i(5,"div",3)(6,"button",4),a(7,"translate"),f("click",function(){return l.openAddNewUser()}),p(8,"i",5),t(),i(9,"button",6),a(10,"translate"),f("click",function(){return l.openSupport()}),p(11,"i",7),t()()(),i(12,"div",8),Y(13,Ae,20,14,"div",9,X),t()),s&2&&(e(3),d(o(4,3,"users.title_users")),e(3),u("aria-label",o(7,5,"users.button_add_user")),e(3),u("aria-label",o(10,7,"support.title")),e(4),Z(l.homebridgeUsers))},dependencies:[j,E],encapsulation:2})}return r})();export{Ot as UsersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u}from"./chunk-5XSDDD4U.js";import{k as c,n as p,q as m}from"./chunk-
|
|
1
|
+
import{a as u}from"./chunk-5XSDDD4U.js";import{k as c,n as p,q as m}from"./chunk-LJEJT7XC.js";import{ea as n,g as f,h as r,ja as a,w as s}from"./chunk-M33HG622.js";var l=f(u(),1);var $=(()=>{class e{$api=a(m);$toastr=a(p);$translate=a(c);downloadBackup(){return r(this,null,function*(){let t=yield s(this.$api.get("/backup/download",{observe:"response",responseType:"blob"})),i=t.headers.get("File-Name")||"homebridge-backup.tar.gz",o=t.body.size;if(o>globalThis.backup.maxBackupSize){let b=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(o/1048576).toFixed(1)}MB`});this.$toastr.warning(b,this.$translate.instant("toast.title_warning"))}(0,l.saveAs)(t.body,i)})}static \u0275fac=function(i){return new(i||e)};static \u0275prov=n({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{$ as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as u,g as n}from"./chunk-VHUDBTN7.js";import{k as f,n as l,q as d}from"./chunk-
|
|
1
|
+
import{d as u,g as n}from"./chunk-VHUDBTN7.js";import{k as f,n as l,q as d}from"./chunk-LJEJT7XC.js";import{Xa as s,ea as p,fa as i,h as m,ja as o,w as c}from"./chunk-M33HG622.js";var a=(()=>{class r{$api=o(d);$router=o(u);$toastr=o(l);$translate=o(f);resolve(){return m(this,null,function*(){try{return yield c(this.$api.get("/users"))}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}static \u0275fac=function(e){return new(e||r)};static \u0275prov=p({token:r,factory:r.\u0275fac})}return r})();var h=[{path:"",loadComponent:()=>import("./chunk-5H2H6GV5.js").then(r=>r.UsersComponent),resolve:{homebridgeUsers:a}}],g=(()=>{class r{static \u0275fac=function(e){return new(e||r)};static \u0275mod=s({type:r});static \u0275inj=i({imports:[n.forChild(h),n]})}return r})();var T=(()=>{class r{static \u0275fac=function(e){return new(e||r)};static \u0275mod=s({type:r});static \u0275inj=i({providers:[a],imports:[g]})}return r})();export{T as UsersModule};
|