homebridge-config-ui-x 4.77.0-beta.0 → 4.77.0-beta.2
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 +2 -0
- package/config.schema.json +17 -0
- package/dist/core/auth/auth.controller.d.ts +3 -0
- package/dist/core/config/config.service.d.ts +6 -0
- package/dist/core/config/config.service.js +4 -1
- package/dist/core/config/config.service.js.map +1 -1
- package/dist/modules/config-editor/config-editor.controller.d.ts +6 -1
- package/dist/modules/config-editor/config-editor.controller.js +20 -6
- package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
- package/dist/modules/config-editor/config-editor.service.d.ts +4 -1
- package/dist/modules/config-editor/config-editor.service.js +45 -27
- package/dist/modules/config-editor/config-editor.service.js.map +1 -1
- package/package.json +1 -1
- package/public/{chunk-4Q5CXE5I.js → chunk-2I2FMJI5.js} +1 -1
- package/public/{chunk-BF2T55DA.js → chunk-2P6TQXK5.js} +1 -1
- package/public/{chunk-OURXO5GT.js → chunk-3YMB7PLM.js} +1 -1
- package/public/{chunk-34FPHHDE.js → chunk-63HH4VDH.js} +1 -1
- package/public/{chunk-UZJJDUSS.js → chunk-65HVQJKS.js} +1 -1
- package/public/{chunk-XK4ZM637.js → chunk-6OLZUPEL.js} +1 -1
- package/public/{chunk-YIRAFBSQ.js → chunk-75IBFLA3.js} +1 -1
- package/public/{chunk-ZGEKC7IQ.js → chunk-AD3CVSF3.js} +1 -1
- package/public/{chunk-TOKP47O3.js → chunk-AQKG2GBX.js} +1 -1
- package/public/chunk-AWFMVHZM.js +1 -0
- package/public/chunk-AZ43ESWQ.js +1 -0
- package/public/{chunk-HITJ43P2.js → chunk-BW2OYIQQ.js} +1 -1
- package/public/{chunk-F366S4LF.js → chunk-BX3FYLVB.js} +1 -1
- package/public/chunk-CPUG2M2H.js +1 -0
- package/public/chunk-EIH5Y7XE.js +1 -0
- package/public/{chunk-H6M7G7XN.js → chunk-ELWVABN2.js} +1 -1
- package/public/{chunk-T6HERCVY.js → chunk-ENZISB64.js} +1 -1
- package/public/chunk-FM64LLBQ.js +1 -0
- package/public/{chunk-Y6RMDAGJ.js → chunk-G4AIF26G.js} +1 -1
- package/public/{chunk-3ELT4XKE.js → chunk-GU62TFEX.js} +1 -1
- package/public/{chunk-ZCCEWPTV.js → chunk-H6USGONO.js} +1 -1
- package/public/{chunk-6VFG4CQJ.js → chunk-HTUHQ4SG.js} +1 -1
- package/public/chunk-JCXIHP4I.js +1 -0
- package/public/{chunk-N5JHQPQR.js → chunk-JRX7HEQF.js} +1 -1
- package/public/{chunk-U7ORGKVU.js → chunk-JT5RXRUB.js} +1 -1
- package/public/{chunk-JMJ6ERPH.js → chunk-JWB2Z7MI.js} +1 -1
- package/public/{chunk-V5ITQWQ4.js → chunk-JXXNGV25.js} +1 -1
- package/public/{chunk-VW4I5LFS.js → chunk-KEJUCLLQ.js} +19 -19
- package/public/chunk-KJZAE2V2.js +8 -0
- package/public/chunk-KO47X5JW.js +6 -0
- package/public/{chunk-4MJFKI7F.js → chunk-L6TG3NQO.js} +1 -1
- package/public/{chunk-4F2L2K5R.js → chunk-M33BFKOK.js} +1 -1
- package/public/{chunk-UCI44OIA.js → chunk-NFJLJG67.js} +1 -1
- package/public/chunk-OI4FCF4W.js +1 -0
- package/public/{chunk-6D43Q5UP.js → chunk-OJOO3WHX.js} +1 -1
- package/public/{chunk-6JC4DGXV.js → chunk-PAPULWMP.js} +1 -1
- package/public/{chunk-5ZTTC2RE.js → chunk-PL5LIFS5.js} +1 -1
- package/public/{chunk-RBXDZ22D.js → chunk-Q5XXV7OZ.js} +1 -1
- package/public/{chunk-F3YMZ7SA.js → chunk-QDK7JEL3.js} +1 -1
- package/public/{chunk-K7ULIJ4V.js → chunk-RBCV2UNN.js} +1 -1
- package/public/{chunk-Q6D4VU67.js → chunk-RDGZT57P.js} +1 -1
- package/public/{chunk-FRA2KM7O.js → chunk-RTFEC5XJ.js} +1 -1
- package/public/chunk-S7ZABB45.js +1 -0
- package/public/chunk-SZKXSPBW.js +1 -0
- package/public/{chunk-ZN4Y5HET.js → chunk-VBIW5MAS.js} +1 -1
- package/public/{chunk-2FPCB5ZT.js → chunk-VCN57D2Q.js} +1 -1
- package/public/{chunk-NGXKARXZ.js → chunk-VK5TOJI7.js} +1 -1
- package/public/{chunk-IUNTY23D.js → chunk-VRKDNRJB.js} +1 -1
- package/public/chunk-W7RFS666.js +1 -0
- package/public/{chunk-RY4EMFRW.js → chunk-WA7CM2WB.js} +1 -1
- package/public/{chunk-3N6KDVVU.js → chunk-WRIO6X76.js} +1 -1
- package/public/chunk-XDHXR3B3.js +1 -0
- package/public/{chunk-QYJETDWO.js → chunk-XE5QPZAY.js} +1 -1
- package/public/chunk-YCC2JBUO.js +1 -0
- package/public/{chunk-CJ5B3IUH.js → chunk-YYZZ6YJZ.js} +1 -1
- package/public/{chunk-TZDNLXWZ.js → chunk-ZEHT5TXS.js} +1 -1
- package/public/{chunk-WLYZBJOT.js → chunk-ZR3Y3COV.js} +1 -1
- package/public/chunk-ZX5UK7SO.js +1 -0
- package/public/index.html +1 -1
- package/public/main-PWI2VFRJ.js +1 -0
- package/public/chunk-22FJLWH7.js +0 -6
- package/public/chunk-3EAVKNTJ.js +0 -1
- package/public/chunk-6JJOHKJ3.js +0 -1
- package/public/chunk-ACKJC2B3.js +0 -1
- package/public/chunk-DT4GMZTF.js +0 -8
- package/public/chunk-HJGIDYQI.js +0 -1
- package/public/chunk-I5W6LFYM.js +0 -1
- package/public/chunk-IOU7P4B3.js +0 -1
- package/public/chunk-JPZ7P7IS.js +0 -1
- package/public/chunk-NH7N2FZB.js +0 -1
- package/public/chunk-RRJQ2MBS.js +0 -1
- package/public/chunk-TM72Z6NP.js +0 -1
- package/public/chunk-W67F5NX7.js +0 -1
- package/public/chunk-XK6NPMWO.js +0 -1
- package/public/chunk-XZFEZBHL.js +0 -1
- package/public/main-I3QVP3WL.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Ve}from"./chunk-H6USGONO.js";import{w as Ne}from"./chunk-KEJUCLLQ.js";import{b as tt}from"./chunk-VK5TOJI7.js";import{a as Ze,b as et}from"./chunk-Y6TXYIFY.js";import{g as ae,m as R,n as K,o as oe}from"./chunk-2EMPNH2X.js";import{A as Z,b as J,c as ie,e as X,j as E,k as Ie,l as we,n as Ee,o as ne,r as Be,s as Te,t as $e,u as Fe,v as Re,x as Pe,z as Y}from"./chunk-EJ3RNOUF.js";import{d as O,e as Me}from"./chunk-ZOLUFCSO.js";import{a as De}from"./chunk-ELWVABN2.js";import{b as G}from"./chunk-75IBFLA3.js";import{c as ke,d as pe,f as te,g as de,k as M,m as Ae,n as A}from"./chunk-RTFEC5XJ.js";import{c as Se,d as ye}from"./chunk-FDPTBVVC.js";import{a as P,b as F}from"./chunk-GOW5VSYJ.js";import{$a as t,Ac as r,Bc as s,Cc as z,Gb as v,Hb as _,Ib as h,Kb as D,Lb as V,M as w,Mb as N,Nb as m,Ob as n,Pb as a,Qb as d,Ub as I,Xa as le,Xb as f,Ya as _e,Yb as b,ac as he,bc as ge,bd as U,cc as be,g as se,gd as Q,h as S,id as xe,jc as l,kc as u,la as C,lb as $,lc as g,qc as ve,ra as y,rc as fe,sa as k,sc as Ce,w as B,wc as L,xc as T,yc as q}from"./chunk-NR37MAXW.js";var Le=(i,c)=>({"green-text":i,"grey-text":c});function it(i,c){if(i&1){let e=I();n(0,"li",9)(1,"div",10),l(2),d(3,"br"),n(4,"small",11),d(5,"i",12),r(6,"translate"),l(7," \xB7 "),n(8,"span",13),l(9),a(),l(10),r(11,"titlecase"),a()(),n(12,"div",14)(13,"input",23),r(14,"translate"),f("click",function(){let p=y(e).$implicit,x=b();return k(x.toggleList(p._username))}),a(),d(15,"label",24),a()()}if(i&2){let e=c.$implicit,o=b();t(2),g(" ",e.name," "),t(3),m("ngbTooltip",s(6,10,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired"))("ngClass",T(16,Le,e._isPaired,!e._isPaired)),t(4),u(e._username),t(),g(" \xB7 ",s(11,12,e._category)," "),t(3),m("id","hidePluginUpdates_"+e._username)("checked",!o.isInList(e._username))("disabled",o.clicked),v("aria-label",s(14,14,"form.button_allow")+" "+e.name),t(2),m("for","hidePluginUpdates_"+e._username)}}function nt(i,c){i&1&&(l(0),r(1,"translate")),i&2&&g(" ",s(1,1,"form.button_save")," ")}function at(i,c){i&1&&d(0,"i",22)}var Oe=(()=>{class i{$activeModal=C(R);$api=C(A);$settings=C(G);$toastr=C(M);$translate=C(P);originalBlacklist=[];updatedBlacklist=[];existingBlacklist=[];clicked=!1;mainPairing={};pairings=[];constructor(){}get blacklistHasUpdated(){return this.updatedBlacklist.join(",")!==this.originalBlacklist.join(",")}ngOnInit(){return S(this,null,function*(){this.updatedBlacklist=this.existingBlacklist.map(e=>e.trim().toUpperCase()).sort((e,o)=>e.localeCompare(o)),this.originalBlacklist=[...this.updatedBlacklist];try{let e=yield B(this.$api.get("/server/pairings"));this.mainPairing=e.find(o=>o._main),this.pairings=e.filter(o=>!o._main).sort((o,p)=>o.name.localeCompare(p.name))}catch(e){console.error(e),this.$toastr.error(e.message,this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}toggleList(e){this.updatedBlacklist.includes(e)?this.updatedBlacklist=this.updatedBlacklist.filter(o=>o!==e):(this.updatedBlacklist.push(e),this.updatedBlacklist.sort((o,p)=>o.localeCompare(p)))}isInList(e){return this.updatedBlacklist.includes(e)}updateBlacklist(){return S(this,null,function*(){this.clicked=!0;try{yield B(this.$api.put("/config-editor/ui/accessory-control/instance-blacklist",{body:this.updatedBlacklist})),this.$settings.setEnvItem("accessoryControl.instanceBlacklist",this.updatedBlacklist),this.$activeModal.close()}catch(e){this.clicked=!1,console.error(e),this.$toastr.error(e.message,this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],inputs:{existingBlacklist:"existingBlacklist"},decls:45,vars:32,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-list-check","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mt-3","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"grey-text"],["container","body","openDelay","150","triggers","hover","placement","left",1,"fas","fa-fw","fa-link",3,"ngbTooltip","ngClass"],[1,"font-monospace"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","disabled","","checked","","id","controlMainBridge",1,"rendux-input"],["for","controlMainBridge",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],["type","checkbox",1,"rendux-input",3,"click","id","checked","disabled"],[1,"rendux-label","ms-3",3,"for"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),n(7,"div",4)(8,"div",5),d(9,"i",6),a(),n(10,"ul",7)(11,"li"),l(12),r(13,"translate"),a(),n(14,"li"),l(15),r(16,"translate"),a()(),n(17,"ul",8)(18,"li",9)(19,"div",10),l(20),d(21,"br"),n(22,"small",11),d(23,"i",12),r(24,"translate"),l(25," \xB7 "),n(26,"span",13),l(27),a(),l(28," \xB7 Homebridge "),a()(),n(29,"div",14),d(30,"input",15),r(31,"translate"),d(32,"label",16),a()(),V(33,it,16,19,"li",9,D),a()(),n(35,"div",17)(36,"div",10)(37,"button",18),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),l(38),r(39,"translate"),a()(),d(40,"div",19),n(41,"div",20)(42,"button",21),f("click",function(){return p.updateBlacklist()}),_(43,nt,2,3),_(44,at,1,0,"i",22),a()()()()),o&2&&(t(3),u(s(4,15,"settings.security.ui_control")),t(2),m("disabled",p.clicked),v("aria-label",s(6,17,"form.button_close")),t(7),u(s(13,19,"settings.security.ui_control_desc")),t(3),u(s(16,21,"settings.security.ui_control_desc_2")),t(5),g(" ",p.mainPairing.name),t(3),m("ngbTooltip",s(24,23,p.mainPairing._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired"))("ngClass",T(29,Le,p.mainPairing._isPaired,!p.mainPairing._isPaired)),t(4),u(p.mainPairing._username),t(3),v("aria-label",s(31,25,"plugins.manage.hide_updates")),t(3),N(p.pairings),t(4),m("disabled",p.clicked),t(),g(" ",s(39,27,"form.button_close")," "),t(4),m("disabled",!p.blacklistHasUpdated||p.clicked),t(),h(p.clicked?-1:43),t(),h(p.clicked?44:-1))},dependencies:[U,F,Y,Q,oe],encapsulation:2})}return i})();var ce=se(tt(),1);var ze=se(Ze(),1),Ue=se(et(),1);var ot=i=>({maxBackupSizeText:i});function rt(i,c){if(i&1&&d(0,"input",10),i&2){let e=b(2);m("value",e.selectedBackup.fileName)}}function st(i,c){if(i&1){let e=I();n(0,"input",12),f("change",function(p){y(e);let x=b(2);return k(x.handleRestoreFileInput(p.target.files))}),a()}}function lt(i,c){if(i&1&&(n(0,"div",4)(1,"div",7),d(2,"i",8),a(),n(3,"ul",9)(4,"li"),l(5),r(6,"translate"),a(),n(7,"li"),l(8),r(9,"translate"),a(),n(10,"li"),l(11),r(12,"translate"),a(),n(13,"li"),l(14),r(15,"translate"),a()(),_(16,rt,1,1,"input",10),_(17,st,1,0,"input",11),a()),i&2){let e=b();t(5),u(s(6,6,"backup.restore_help_one")),t(3),u(s(9,8,"backup.restore_help_two")),t(3),u(z(12,10,"backup.restore_max_size",L(15,ot,e.maxFileSizeText))),t(3),u(s(15,13,"backup.restore_warning")),t(2),h(e.selectedBackup?16:-1),t(),h(e.selectedBackup?-1:17)}}function pt(i,c){if(i&1){let e=I();n(0,"button",18),r(1,"translate"),f("click",function(){y(e);let p=b(2);return k(p.$activeModal.dismiss("Dismiss"))}),l(2),r(3,"translate"),a()}if(i&2){let e=b(2);m("disabled",e.clicked),v("aria-label",s(1,3,"form.button_close")),t(2),g(" ",s(3,5,"form.button_close")," ")}}function dt(i,c){if(i&1){let e=I();n(0,"button",18),r(1,"translate"),f("click",function(){y(e);let p=b(2);return k(p.reopenBackupModal())}),l(2),r(3,"translate"),a()}if(i&2){let e=b(2);m("disabled",e.clicked),v("aria-label",s(1,3,"form.button_back")),t(2),g(" ",s(3,5,"form.button_back")," ")}}function ct(i,c){i&1&&d(0,"i",19)}function mt(i,c){if(i&1&&(n(0,"span"),l(1),a()),i&2){let e=b(3);t(),g("",e.uploadPercent,"% - ")}}function ut(i,c){i&1&&(n(0,"span"),l(1," Extracting Archive"),a())}function _t(i,c){i&1&&(n(0,"span"),l(1),r(2,"translate"),a()),i&2&&(t(),g(" ",s(2,1,"backup.label_uploading")))}function ht(i,c){if(i&1&&(n(0,"span"),_(1,ct,1,0,"i",19),_(2,mt,2,1,"span"),_(3,ut,2,0,"span"),_(4,_t,3,3,"span"),a()),i&2){let e=b(2);t(),h(!e.uploadPercent||e.uploadPercent===100?1:-1),t(),h(e.uploadPercent&&e.uploadPercent!==100?2:-1),t(),h(e.uploadPercent===100?3:-1),t(),h(e.uploadPercent!==100?4:-1)}}function gt(i,c){i&1&&(l(0),r(1,"translate")),i&2&&g(" ",s(1,1,"form.button_restore")," ")}function bt(i,c){if(i&1){let e=I();n(0,"div",6)(1,"div",13),_(2,pt,4,7,"button",14),_(3,dt,4,7,"button",14),a(),d(4,"div",15),n(5,"div",16)(6,"button",17),f("click",function(){y(e);let p=b();return k(p.onRestoreBackupClick())}),_(7,ht,5,4,"span"),_(8,gt,2,3),a()()()}if(i&2){let e=b();t(2),h(e.setupWizardRestore?2:-1),t(),h(e.setupWizardRestore?-1:3),t(3),m("disabled",!e.selectedBackup&&!e.selectedFile||e.clicked),t(),h(e.clicked?7:-1),t(),h(e.clicked?-1:8)}}function vt(i,c){if(i&1){let e=I();n(0,"div",6),d(1,"div",13),n(2,"div",15)(3,"button",20),f("click",function(){y(e);let p=b();return k(p.postBackupRestart())}),l(4),r(5,"translate"),a()(),d(6,"div",16),a()}i&2&&(t(4),g(" ",s(5,1,"menu.hbrestart.title")," "))}var He=(()=>{class i{$activeModal=C(R);$api=C(A);$modal=C(K);$route=C(O);$toastr=C(M);$translate=C(P);$ws=C(De);setupWizardRestore=!1;selectedBackup=null;clicked=!1;maxFileSizeText=globalThis.backup.maxBackupSizeText;selectedFile;restoreInProgress=!1;restoreStarted=!1;restoreFailed=!1;restoreArchiveType="homebridge";uploadPercent=0;term=new ze.Terminal;termTarget;fitAddon=new Ue.FitAddon;io;constructor(){}ngOnInit(){return S(this,null,function*(){this.io=this.$ws.connectToNamespace("backup"),this.termTarget=document.getElementById("plugin-log-output"),this.term.open(this.termTarget),this.fitAddon.fit(),this.io.socket.on("stdout",e=>{this.term.write(e)}),this.setupWizardRestore&&(this.restoreStarted=!0,this.restoreInProgress=!0,this.startRestore())})}onRestoreBackupClick(){this.selectedBackup?this.restoreScheduledBackup():this.restoreArchiveType==="homebridge"?this.uploadHomebridgeArchive():this.restoreArchiveType==="hbfx"&&this.uploadHbfxArchive()}uploadHomebridgeArchive(){this.term.reset(),this.clicked=!0;let e=new FormData;e.append("restoreArchive",this.selectedFile,this.selectedFile.name),this.$api.post("/backup/restore",e).subscribe({next:()=>{this.restoreStarted=!0,this.restoreInProgress=!0,setTimeout(()=>{this.startRestore()},500),this.clicked=!1},error:o=>{console.error(o),this.$toastr.error(o.error?.message||this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error")),this.clicked=!1}})}restoreScheduledBackup(){return S(this,null,function*(){this.term.reset(),this.clicked=!0,this.$api.post(`/backup/scheduled-backups/${this.selectedBackup.id}/restore`,{}).subscribe({next:()=>{this.restoreStarted=!0,this.restoreInProgress=!0,setTimeout(()=>{this.startRestore()},500),this.clicked=!1},error:e=>{console.error(e),this.$toastr.error(e.error?.message||this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error")),this.clicked=!1}})})}startRestore(){return S(this,null,function*(){this.io.request("do-restore").subscribe({next:()=>{this.restoreInProgress=!1,this.$toastr.success(this.$translate.instant("backup.backup_restored"),this.$translate.instant("toast.title_success")),this.setupWizardRestore&&this.postBackupRestart()},error:e=>{this.restoreFailed=!0,console.error(e),this.$toastr.error(this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error"))}})})}uploadHbfxArchive(){this.term.reset(),this.clicked=!0;let e=new FormData;e.append("restoreArchive",this.selectedFile,this.selectedFile.name),this.$api.post("/backup/restore/hbfx",e,{reportProgress:!0,observe:"events"}).subscribe({next:o=>{o.type===Se.UploadProgress?this.uploadPercent=Math.round(100*o.loaded/o.total):o instanceof ye&&(this.restoreStarted=!0,this.restoreInProgress=!0,setTimeout(()=>{this.startHbfxRestore()},500),this.clicked=!1)},error:o=>{this.clicked=!1,console.error(o),this.$toastr.error(o.error?.message||this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error"))}})}startHbfxRestore(){return S(this,null,function*(){this.io.request("do-restore-hbfx").subscribe({next:()=>{this.restoreInProgress=!1,this.$toastr.success(this.$translate.instant("backup.backup_restored"),this.$translate.instant("toast.title_success"))},error:e=>{this.restoreFailed=!0,console.error(e),this.$toastr.error(this.$translate.instant("backup.restore_failed"),this.$translate.instant("toast.title_error"))}})})}handleRestoreFileInput(e){e.length?(this.selectedFile=e[0],this.selectedFile.name.endsWith(".hbfx")?this.restoreArchiveType="hbfx":this.restoreArchiveType="homebridge"):delete this.selectedFile}postBackupRestart(){this.$api.put("/backup/restart",{}).subscribe({next:()=>{this.$activeModal.close(!0),this.$route.navigate(["/"])},error:()=>{}})}reopenBackupModal(){this.$activeModal.dismiss(),this.$modal.open(re,{size:"lg",backdrop:"static"})}ngOnDestroy(){this.io.end()}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],inputs:{setupWizardRestore:"setupWizardRestore",selectedBackup:"selectedBackup"},decls:11,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],["id","plugin-log-output",1,"modal-body",3,"hidden"],[1,"modal-footer","justify-content-between"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-hard-drive","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","text","disabled","",1,"form-control","custom-input",3,"value"],["type","file","id","restoreFileUpload","accept","application/gzip, .gz, .hbfx",1,"form-control"],["type","file","id","restoreFileUpload","accept","application/gzip, .gz, .hbfx",1,"form-control",3,"change"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"fa","fa-fw","fa-circle-notch","fa-spin"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),_(7,lt,18,17,"div",4),d(8,"div",5),_(9,bt,9,5,"div",6),_(10,vt,7,3,"div",6),a()),o&2&&(t(3),u(s(4,7,"backup.title_backup")),t(2),m("disabled",p.restoreInProgress),v("aria-label",s(6,9,"form.button_close")),t(2),h(!p.restoreStarted&&!p.setupWizardRestore?7:-1),t(),m("hidden",!p.restoreStarted),t(),h(!p.restoreStarted||p.restoreFailed===!0?9:-1),t(),h(!p.restoreInProgress&&p.restoreStarted?10:-1))},dependencies:[F],encapsulation:2})}return i})();var ft=(i,c)=>({"fa-arrow-right":i,"fa-cog fa-spin":c}),Ct=i=>({backupTime:i,dayCount:7}),xt=(i,c)=>({"fa-trash":i,"fa-cog fa-spin":c}),St=(i,c)=>({backupSize:i,maxBackupSizeText:c});function yt(i,c){if(i&1&&(n(0,"li",23)(1,"label",28),l(2),r(3,"translate"),a(),n(4,"div",29),d(5,"input",30),r(6,"translate"),a()()),i&2){let e=b();t(2),u(s(3,3,"backup.settings_path")),t(3),m("formControl",e.pathFormControl),v("aria-label",s(6,5,"backup.settings_path"))}}function kt(i,c){if(i&1&&(l(0),r(1,"date"),r(2,"translate")),i&2){let e=b(2);g(" ",z(2,4,"backup.scheduled_backup_time",L(7,Ct,z(1,1,e.backupTime,"shortTime")))," ")}}function It(i,c){i&1&&(l(0),r(1,"translate")),i&2&&g(" ",s(1,1,"backup.scheduled_backup_disabled")," ")}function wt(i,c){if(i&1&&(n(0,"span",33),r(1,"translate"),d(2,"i",40),l(3),a()),i&2){let e=b().$implicit;m("ngbTooltip",z(1,2,"backup.backup_exceeds_max_size",T(5,St,e.size+"MB",e.maxBackupSizeText))),t(3),g(" ",e.size,"MB ")}}function Et(i,c){if(i&1&&(n(0,"span"),l(1),a()),i&2){let e=b().$implicit;t(),g(" ",e.size,"MB ")}}function Bt(i,c){if(i&1){let e=I();n(0,"li",9)(1,"span")(2,"span",32),l(3),r(4,"date"),a(),d(5,"br"),n(6,"small",10),l(7),r(8,"date"),_(9,wt,4,8,"span",33),_(10,Et,2,1,"span"),a()(),n(11,"span",34)(12,"button",35),r(13,"translate"),r(14,"translate"),f("click",function(){let p=y(e).$implicit,x=b(2);return k(x.restore(p))}),d(15,"i",36),a(),n(16,"button",37),r(17,"translate"),r(18,"translate"),f("click",function(){let p=y(e).$implicit,x=b(2);return k(x.download(p))}),d(19,"i",38),a(),n(20,"button",39),r(21,"translate"),r(22,"translate"),f("click",function(){let p=y(e).$implicit,x=b(2);return k(x.delete(p))}),d(23,"i",12),a()()()}if(i&2){let e=c.$implicit,o=b(2);t(2),m("ngbTooltip",e.fileName),t(),g(" ",z(4,15,e.timestamp,"mediumDate")," "),t(4),g(" ",z(8,18,e.timestamp,"shortTime")," \xB7 "),t(2),h(e.size>e.maxBackupSize?9:-1),t(),h(e.size<=e.maxBackupSize?10:-1),t(2),m("disabled",o.clicked||o.deleting||e.size>e.maxBackupSize)("ngbTooltip",s(13,21,"form.button_restore")),v("aria-label",s(14,23,"form.button_restore")),t(4),m("disabled",o.clicked||o.deleting)("ngbTooltip",s(17,25,"form.button_download")),v("aria-label",s(18,27,"form.button_download")),t(4),m("disabled",o.clicked||o.deleting)("ngbTooltip",s(21,29,"form.button_delete")),v("aria-label",s(22,31,"form.button_delete")),t(3),m("ngClass",T(33,xt,e.id!==o.deleting,e.id===o.deleting))}}function Tt(i,c){if(i&1&&(n(0,"ul",14)(1,"li",15)(2,"h6",16),l(3),r(4,"translate"),a(),n(5,"p",31),_(6,kt,3,9),_(7,It,2,3),a()(),V(8,Bt,24,36,"li",9,D),a()),i&2){let e=b();t(3),u(s(4,3,"backup.files_auto")),t(3),h(e.currentSettingEnabled&&e.backupTime?6:-1),t(),h(!e.currentSettingEnabled||!e.backupTime?7:-1),t(),N(e.scheduledBackups)}}var re=(()=>{class i{$activeModal=C(R);$api=C(A);$modal=C(K);$router=C(O);$settings=C(G);$toastr=C(M);$translate=C(P);restartToastIsShown=!1;clicked=!1;scheduledBackups=[];backupTime;deleting=null;currentSettingEnabled=!1;currentSettingPath="";enabledFormControl=new E(!1);pathFormControl=new E("");constructor(){}ngOnInit(){this.getScheduledBackups(),this.getNextBackup(),this.currentSettingEnabled=!this.$settings.env.scheduledBackupDisable,this.currentSettingPath=this.$settings.env.scheduledBackupPath,this.enabledFormControl.patchValue(this.currentSettingEnabled),this.pathFormControl.patchValue(this.currentSettingPath),this.enabledFormControl.valueChanges.pipe(w(750)).subscribe(e=>S(this,null,function*(){this.currentSettingEnabled=e,yield this.saveUiSettingChange("scheduledBackupDisable",!this.currentSettingEnabled)})),this.pathFormControl.valueChanges.pipe(w(1500)).subscribe(e=>S(this,null,function*(){this.currentSettingPath=e,yield this.saveUiSettingChange("scheduledBackupPath",this.currentSettingPath)}))}saveUiSettingChange(e,o){return S(this,null,function*(){try{yield B(this.$api.put("/config-editor/ui",{key:e,value:o})),this.showRestartToast()}catch(p){console.error(p),this.$toastr.error(p.message,this.$translate.instant("toast.title_error"))}})}getScheduledBackups(){this.$api.get("/backup/scheduled-backups").subscribe({next:e=>{this.scheduledBackups=e},error:e=>console.error(e)})}getNextBackup(){this.$api.get("/backup/scheduled-backups/next").subscribe({next:e=>{this.backupTime=e.next},error:e=>{console.error(e)}})}download(e){this.$api.get(`/backup/scheduled-backups/${e.id}`,{observe:"response",responseType:"blob"}).subscribe({next:o=>{let p=e.fileName||"homebridge-backup.tar.gz",x=o.body.size;if(x>globalThis.backup.maxBackupSize){let H=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(x/1048576).toFixed(1)}MB`});this.$toastr.warning(H,this.$translate.instant("toast.title_warning"))}(0,ce.saveAs)(o.body,p)},error:o=>{console.error(o),this.$toastr.error(this.$translate.instant("backup.backup_download_failed"),this.$translate.instant("toast.title_error"))}})}restore(e){this.$activeModal.close();let o=this.$modal.open(He,{size:"lg",backdrop:"static"});o.componentInstance.selectedBackup=e}delete(e){this.deleting=e.id,this.$api.delete(`/backup/scheduled-backups/${e.id}`).subscribe({next:()=>{this.getScheduledBackups(),this.deleting=null},error:o=>{this.deleting=null,console.error(o),this.$toastr.error(this.$translate.instant("backup.backup_delete_failed"),this.$translate.instant("toast.title_error"))}})}onDownloadBackupClick(){return S(this,null,function*(){this.clicked=!0,this.$api.get("/backup/download",{observe:"response",responseType:"blob"}).subscribe({next:e=>{let o=e.headers.get("File-Name")||"homebridge-backup.tar.gz";this.clicked=!1;let p=e.body.size;if(p>globalThis.backup.maxBackupSize){let x=this.$translate.instant("backup.backup_exceeds_max_size",{maxBackupSizeText:globalThis.backup.maxBackupSizeText,size:`${(p/1048576).toFixed(1)}MB`});this.$toastr.warning(x,this.$translate.instant("toast.title_warning"))}(0,ce.saveAs)(e.body,o)},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("backup.backup_download_failed"),this.$translate.instant("toast.title_error"))}})})}showRestartToast(){if(!this.restartToastIsShown){this.restartToastIsShown=!0;let e=this.$toastr.info(this.$translate.instant("settings.changes.saved"),this.$translate.instant("menu.hbrestart.title"),{timeOut:0,closeButton:!1,tapToDismiss:!0,disableTimeOut:!0,positionClass:"toast-bottom-right",enableHtml:!0});e&&e.onTap&&e.onTap.subscribe(()=>{this.$router.navigate(["/restart"])})}}Date=Date;static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],decls:70,vars:59,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-hard-drive","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"btn","btn-primary","m-0","ms-3",3,"click","disabled"],[1,"fas","fa-fw",3,"ngClass"],[1,"fas","fa-fw","fa-arrow-right"],[1,"list-group","list-group-box","mt-3","mb-0"],[1,"list-group-item"],[1,"mb-1","text-center"],[1,"mb-0","small","grey-text","text-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","disableScheduledBackups",1,"rendux-input",3,"formControl"],["for","disableScheduledBackups",1,"rendux-label"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"modal-footer","justify-content-between"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-end"],[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","/home/pi/homebridge-backups",1,"form-control","custom-input",3,"formControl"],[1,"small","grey-text","mb-0","text-center"],["container","modal","openDelay","150","triggers","hover",3,"ngbTooltip"],["container","modal","openDelay","150","triggers","hover",1,"red-text",3,"ngbTooltip"],[2,"display","flex","flex-wrap","nowrap"],["placement","bottom","container","modal","openDelay","150","triggers","hover",1,"btn","btn-primary","m-0","ms-3",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-history"],["placement","bottom","container","modal","openDelay","150","triggers","hover",1,"btn","btn-primary","m-0","ms-2",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-download"],["placement","bottom","container","modal","openDelay","150","triggers","hover",1,"btn","btn-danger","m-0","ms-2",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-exclamation-circle"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),n(7,"div",4)(8,"div",5),d(9,"i",6),a(),n(10,"ul",7)(11,"li"),l(12),r(13,"translate"),a(),n(14,"li"),l(15),r(16,"translate"),a(),n(17,"li"),l(18),r(19,"translate"),a()(),n(20,"ul",8)(21,"li",9)(22,"div")(23,"span"),l(24),r(25,"translate"),a(),d(26,"br"),n(27,"small",10),l(28),r(29,"translate"),a()(),n(30,"button",11),r(31,"translate"),f("click",function(){return p.onDownloadBackupClick()}),d(32,"i",12),a()(),n(33,"li",9)(34,"div")(35,"span"),l(36),r(37,"translate"),a(),d(38,"br"),n(39,"small",10),l(40),r(41,"translate"),a()(),n(42,"button",11),r(43,"translate"),f("click",function(){return p.restore(null)}),d(44,"i",13),a()()(),n(45,"ul",14)(46,"li",15)(47,"h6",16),l(48),r(49,"translate"),a(),n(50,"p",17),l(51),r(52,"translate"),a()(),n(53,"li",18)(54,"span",19),l(55),r(56,"translate"),a(),n(57,"div",20),d(58,"input",21),r(59,"translate"),d(60,"label",22),a()(),_(61,yt,7,7,"li",23),a(),_(62,Tt,10,5,"ul",14),a(),n(63,"div",24),d(64,"div",19),n(65,"div",25)(66,"button",26),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),l(67),r(68,"translate"),a()(),d(69,"div",27),a()()),o&2&&(t(3),u(s(4,24,"backup.title_backup")),t(2),m("disabled",p.clicked||p.deleting),v("aria-label",s(6,26,"form.button_close")),t(7),u(s(13,28,"backup.backup_help_one")),t(3),u(s(16,30,"backup.backup_help_two")),t(3),u(s(19,32,"backup.backup_warning")),t(6),u(s(25,34,"backup.backup_now")),t(4),u(s(29,36,"backup.backup_now_desc")),t(2),m("disabled",p.clicked),v("aria-label",s(31,38,"backup.backup_now")),t(2),m("ngClass",T(56,ft,!p.clicked,p.clicked)),t(4),u(s(37,40,"backup.restore_now")),t(4),u(s(41,42,"backup.restore_now_desc")),t(2),m("disabled",p.clicked),v("aria-label",s(43,44,"backup.restore_now")),t(6),u(s(49,46,"backup.settings_title")),t(3),u(s(52,48,"form.auto_save")),t(4),u(s(56,50,"backup.settings_enable")),t(3),m("formControl",p.enabledFormControl),v("aria-label",s(59,52,"backup.settings_enable")),t(3),h(p.currentSettingEnabled?61:-1),t(),h(p.scheduledBackups.length?62:-1),t(4),m("disabled",p.clicked||p.deleting),t(),g(" ",s(68,54,"form.button_close")," "))},dependencies:[oe,U,xe,F,Z,ie,J,X,ne],encapsulation:2})}return i})();function $t(i,c){i&1&&(n(0,"div",12),d(1,"i",13),a(),n(2,"p",14),l(3),r(4,"translate"),a()),i&2&&(t(3),u(s(4,1,"reset.no_accessories")))}function Ft(i,c){i&1&&(n(0,"div",12),d(1,"i",15),a(),n(2,"ul",16)(3,"li"),l(4),r(5,"translate"),a(),n(6,"li"),l(7),r(8,"translate"),a(),n(9,"li"),l(10),r(11,"translate"),a()(),n(12,"ngb-alert",17)(13,"p",18),l(14),r(15,"translate"),a()()),i&2&&(t(4),u(s(5,5,"reset.accessory_all.list_1")),t(3),u(s(8,7,"reset.accessory_all.list_2")),t(3),u(s(11,9,"reset.accessory_all.list_3")),t(2),m("dismissible",!1),t(2),u(s(15,11,"reset.action_is_irreversible")))}function Rt(i,c){if(i&1){let e=I();n(0,"button",19),r(1,"translate"),f("click",function(){y(e);let p=b();return k(p.$activeModal.dismiss("Dismiss"))}),l(2),r(3,"translate"),a()}if(i&2){let e=b();m("disabled",e.clicked),v("aria-label",s(1,3,"form.button_close")),t(2),g(" ",s(3,5,"form.button_close")," ")}}function Pt(i,c){if(i&1){let e=I();n(0,"button",20),r(1,"translate"),f("click",function(){y(e);let p=b();return k(p.$activeModal.dismiss("Dismiss"))}),l(2),r(3,"translate"),a()}i&2&&(v("aria-label",s(1,2,"form.button_close")),t(2),g(" ",s(3,4,"form.button_close")," "))}function Mt(i,c){i&1&&(l(0),r(1,"translate")),i&2&&g(" ",s(1,1,"form.button_remove")," ")}function At(i,c){i&1&&d(0,"i",22)}function Dt(i,c){if(i&1){let e=I();n(0,"button",21),f("click",function(){y(e);let p=b();return k(p.onResetCachedAccessoriesClick())}),_(1,Mt,2,3),_(2,At,1,0,"i",22),a()}if(i&2){let e=b();m("disabled",e.clicked),t(),h(e.clicked?-1:1),t(),h(e.clicked?2:-1)}}var Ke=(()=>{class i{$activeModal=C(R);$api=C(A);$router=C(O);$toastr=C(M);$translate=C(P);clicked=!1;cachedAccessories=[];constructor(){}ngOnInit(){this.loadCachedAccessories()}loadCachedAccessories(){return S(this,null,function*(){try{this.cachedAccessories=yield B(this.$api.get("/server/cached-accessories"))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("reset.error_message"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}onResetCachedAccessoriesClick(){return this.clicked=!0,this.$api.put("/server/reset-cached-accessories",{}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.delete_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.failed_to_reset"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","fa-fw","fa-network-wired","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"text-center","mb-0"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),n(7,"div",4),_(8,$t,5,3),_(9,Ft,16,13),a(),n(10,"div",5)(11,"div",6),_(12,Rt,4,7,"button",7),a(),n(13,"div",8),_(14,Pt,4,6,"button",9),a(),n(15,"div",10),_(16,Dt,3,3,"button",11),a()()()),o&2&&(t(3),u(s(4,8,"reset.accessory_all.title")),t(2),m("disabled",p.clicked),v("aria-label",s(6,10,"form.button_close")),t(3),h(p.cachedAccessories.length===0?8:-1),t(),h(p.cachedAccessories.length>0?9:-1),t(3),h(p.cachedAccessories.length>0?12:-1),t(2),h(p.cachedAccessories.length===0?14:-1),t(2),h(p.cachedAccessories.length>0?16:-1))},dependencies:[ae,F],encapsulation:2})}return i})();var Vt=(i,c)=>({"green-text":i,"grey-text":c}),Nt=(i,c)=>({"btn-danger":i,"btn-elegant":c}),Lt=(i,c,e)=>({"fa-broom":i,"fa-undo":c,"fa-spinner fa-pulse":e});function Ot(i,c){i&1&&(n(0,"div",12),d(1,"i",13),a(),n(2,"p",14),l(3),r(4,"translate"),a()),i&2&&(t(3),u(s(4,1,"reset.bridge_accessories.empty")))}function zt(i,c){if(i&1){let e=I();n(0,"li",18)(1,"span"),l(2),d(3,"br"),n(4,"small",19),d(5,"i",20),l(6),r(7,"translate"),n(8,"span",21),l(9),a()()(),n(10,"button",22),r(11,"translate"),f("click",function(){let p=y(e).$implicit,x=b(2);return k(x.toggleList(p._id))}),d(12,"i",23),a()()}if(i&2){let e=c.$implicit,o=b(2);t(2),g(" ",e.name," "),t(3),m("ngClass",T(12,Vt,e._isPaired,!e._isPaired)),t(),g(" ",s(7,8,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),u(e._username),t(),m("disabled",o.clicked)("ngClass",T(15,Nt,!o.toDelete.includes(e._id),o.toDelete.includes(e._id))),v("aria-label",s(11,10,"form.button_delete")),t(2),m("ngClass",q(18,Lt,!o.toDelete.includes(e._id),o.toDelete.includes(e._id)&&!o.clicked,o.toDelete.includes(e._id)&&o.clicked))}}function Ut(i,c){if(i&1&&(n(0,"div",12),d(1,"i",15),a(),n(2,"ul",16)(3,"li"),l(4),r(5,"translate"),a(),n(6,"li"),l(7),r(8,"translate"),a(),n(9,"li"),l(10),r(11,"translate"),a()(),n(12,"ul",17),V(13,zt,13,22,"li",18,D),a()),i&2){let e=b();t(4),u(s(5,3,"reset.bridge_accessories.list_1")),t(3),u(s(8,5,"reset.clear_cache_single.list_3")),t(3),u(s(11,7,"reset.bridge_accessories.list_2")),t(3),N(e.pairings)}}function Ht(i,c){if(i&1){let e=I();n(0,"button",24),f("click",function(){y(e);let p=b();return k(p.$activeModal.dismiss("Dismiss"))}),l(1),r(2,"translate"),a()}if(i&2){let e=b();m("disabled",e.clicked),t(),g(" ",s(2,2,"form.button_close")," ")}}function Wt(i,c){if(i&1){let e=I();n(0,"button",25),f("click",function(){y(e);let p=b();return k(p.$activeModal.dismiss("Dismiss"))}),l(1),r(2,"translate"),a()}i&2&&(t(),g(" ",s(2,1,"form.button_close")," "))}function Kt(i,c){if(i&1&&l(0),i&2){let e=b(3);g(" (",e.toDelete.length,") ")}}function Gt(i,c){if(i&1&&(l(0),r(1,"translate"),_(2,Kt,1,1)),i&2){let e=b(2);g(" ",s(1,2,"form.button_remove")," "),t(2),h(e.toDelete.length>0?2:-1)}}function jt(i,c){i&1&&d(0,"i",27)}function qt(i,c){if(i&1){let e=I();n(0,"button",26),f("click",function(){y(e);let p=b();return k(p.cleanBridges())}),_(1,Gt,3,4),_(2,jt,1,0,"i",27),a()}if(i&2){let e=b();m("disabled",!e.toDelete.length||e.clicked),t(),h(e.clicked?-1:1),t(),h(e.clicked?2:-1)}}var Ge=(()=>{class i{$activeModal=C(R);$api=C(A);$router=C(O);$toastr=C(M);$translate=C(P);clicked=!1;pairings=[];toDelete=[];constructor(){}ngOnInit(){this.loadPairings()}loadPairings(){return S(this,null,function*(){try{this.pairings=(yield B(this.$api.get("/server/pairings"))).filter(e=>e._category==="bridge"&&!e._main).sort((e,o)=>e.name.localeCompare(o.name))}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("settings.unpair_bridge.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}toggleList(e){this.toDelete.includes(e)?this.toDelete=this.toDelete.filter(o=>o!==e):this.toDelete.push(e)}cleanBridges(){return this.clicked=!0,this.$api.delete("/server/pairings/accessories",{body:this.toDelete.map(e=>({id:e}))}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.accessory_ind.done"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","fa-fw","fa-broom","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"fas","fa-fw","fa-link",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas","fa-fw",3,"ngClass"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),n(7,"div",4),_(8,Ot,5,3),_(9,Ut,15,9),a(),n(10,"div",5)(11,"div",6),_(12,Ht,3,4,"button",7),a(),n(13,"div",8),_(14,Wt,3,3,"button",9),a(),n(15,"div",10),_(16,qt,3,3,"button",11),a()()()),o&2&&(t(3),u(s(4,8,"reset.bridge_accessories.title")),t(2),m("disabled",p.clicked),v("aria-label",s(6,10,"form.button_close")),t(3),h(p.pairings.length===0?8:-1),t(),h(p.pairings.length>0?9:-1),t(3),h(p.pairings.length>0?12:-1),t(2),h(p.pairings.length===0?14:-1),t(2),h(p.pairings.length>0?16:-1))},dependencies:[U,F],encapsulation:2})}return i})();function Qt(i,c){i&1&&(l(0),r(1,"translate")),i&2&&g(" ",s(1,1,"form.button_reset")," ")}function Jt(i,c){i&1&&d(0,"i",16)}var je=(()=>{class i{$activeModal=C(R);$api=C(A);$route=C(O);$toastr=C(M);$translate=C(P);clicked;constructor(){}onResetHomebridgeAccessoryClick(){return this.clicked=!0,this.$api.put("/server/reset-homebridge-accessory",{}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.accessory_reset"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$route.navigate(["/restart"])},error:e=>{console.error(e),this.$toastr.error(this.$translate.instant("reset.failed_to_reset"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],decls:38,vars:33,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-bridge","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"text-center","mb-0"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),n(7,"div",4)(8,"div",5),d(9,"i",6),a(),n(10,"ul",7)(11,"li"),l(12),r(13,"translate"),a(),n(14,"li"),l(15),r(16,"translate"),a(),n(17,"li"),l(18),r(19,"translate"),a(),n(20,"li"),l(21),r(22,"translate"),a()(),n(23,"ngb-alert",8)(24,"p",9),l(25),r(26,"translate"),a()()(),n(27,"div",10)(28,"div",11)(29,"button",12),r(30,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),l(31),r(32,"translate"),a()(),d(33,"div",13),n(34,"div",14)(35,"button",15),f("click",function(){return p.onResetHomebridgeAccessoryClick()}),_(36,Qt,2,3),_(37,Jt,1,0,"i",16),a()()()()),o&2&&(t(3),u(s(4,15,"reset.bridge_all.title")),t(2),m("disabled",p.clicked),v("aria-label",s(6,17,"form.button_close")),t(7),u(s(13,19,"reset.bridge_all.list_1")),t(3),u(s(16,21,"reset.bridge_all.list_2")),t(3),u(s(19,23,"reset.bridge_all.list_3")),t(3),u(s(22,25,"reset.bridge_all.list_4")),t(2),m("dismissible",!1),t(2),u(s(26,27,"reset.action_is_irreversible")),t(4),m("disabled",p.clicked),v("aria-label",s(30,29,"form.button_close")),t(2),g(" ",s(32,31,"form.button_close")," "),t(4),m("disabled",p.clicked),t(),h(p.clicked?-1:36),t(),h(p.clicked?37:-1))},dependencies:[ae,F],encapsulation:2})}return i})();var me=(i,c)=>({"green-text":i,"grey-text":c}),ue=(i,c)=>({"btn-danger":i,"btn-elegant":c}),qe=(i,c,e)=>({"fa-refresh":i,"fa-undo":c,"fa-spinner fa-pulse":e}),Xt=(i,c,e)=>({"fa-trash":i,"fa-undo":c,"fa-spinner fa-pulse":e});function Yt(i,c){i&1&&(n(0,"div",12),d(1,"i",13),a(),n(2,"p",14),l(3),r(4,"translate"),a()),i&2&&(t(3),u(s(4,1,"reset.bridges.empty")))}function Zt(i,c){if(i&1){let e=I();n(0,"li",20)(1,"span"),l(2),d(3,"br"),n(4,"small",21),d(5,"i",22),l(6),r(7,"translate"),n(8,"span",23),l(9),a(),l(10),r(11,"titlecase"),a()(),n(12,"button",24),r(13,"translate"),f("click",function(){let p=y(e).$implicit,x=b(3);return k(x.toggleList(p._id,!1))}),d(14,"i",25),a()()}if(i&2){let e=c.$implicit,o=b(3);t(2),g(" ",e.name," "),t(3),m("ngClass",T(15,me,e._isPaired,!e._isPaired)),t(),g(" ",s(7,9,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),u(e._username),t(),g(" \xB7 ",e._main?"Homebridge":s(11,11,e._category)," "),t(2),m("disabled",o.clicked)("ngClass",T(18,ue,!o.isInList(e._id),o.isInList(e._id))),v("aria-label",s(13,13,"form.button_unpair")),t(2),m("ngClass",q(21,qe,!o.isInList(e._id),o.isInList(e._id)&&!o.clicked,o.isInList(e._id)&&o.clicked))}}function ei(i,c){if(i&1&&(n(0,"ul",16)(1,"li",17)(2,"h6",18),l(3),r(4,"translate"),a(),n(5,"p",19),l(6),r(7,"translate"),a()(),V(8,Zt,15,25,"li",20,D),a()),i&2){let e=b(2);t(3),u(s(4,2,"reset.bridge_ind.head_non_child")),t(3),u(s(7,4,"reset.bridge_ind.desc_non_child")),t(2),N(e.pairingsNonChild)}}function ti(i,c){if(i&1){let e=I();n(0,"li",20)(1,"span"),l(2),d(3,"br"),n(4,"small",21),d(5,"i",22),l(6),r(7,"translate"),n(8,"span",23),l(9),a()()(),n(10,"button",24),r(11,"translate"),f("click",function(){let p=y(e).$implicit,x=b(3);return k(x.toggleList(p._id,!0))}),d(12,"i",25),a()()}if(i&2){let e=c.$implicit,o=b(3);t(2),g(" ",e.name," "),t(3),m("ngClass",T(12,me,e._isPaired,!e._isPaired)),t(),g(" ",s(7,8,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),u(e._username),t(),m("disabled",o.clicked)("ngClass",T(15,ue,!o.isInList(e._id),o.isInList(e._id))),v("aria-label",s(11,10,"form.button_unpair")),t(2),m("ngClass",q(18,qe,!o.isInList(e._id),o.isInList(e._id)&&!o.clicked,o.isInList(e._id)&&o.clicked))}}function ii(i,c){if(i&1&&(n(0,"ul",16)(1,"li",17)(2,"h6",18),l(3),r(4,"translate"),a(),n(5,"p",19),l(6),r(7,"translate"),a()(),V(8,ti,13,22,"li",20,D),a()),i&2){let e=b(2);t(3),u(s(4,2,"reset.bridge_ind.head_child_active")),t(3),u(s(7,4,"reset.bridge_ind.desc_child_active")),t(2),N(e.pairingsChildActive)}}function ni(i,c){if(i&1){let e=I();n(0,"li",20)(1,"span"),l(2),d(3,"br"),n(4,"small",21),d(5,"i",22),l(6),r(7,"translate"),n(8,"span",23),l(9),a()()(),n(10,"button",24),r(11,"translate"),f("click",function(){let p=y(e).$implicit,x=b(3);return k(x.toggleList(p._id,!1))}),d(12,"i",25),a()()}if(i&2){let e=c.$implicit,o=b(3);t(2),g(" ",e.name," "),t(3),m("ngClass",T(12,me,e._isPaired,!e._isPaired)),t(),g(" ",s(7,8,e._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," \xB7 "),t(3),u(e._username),t(),m("disabled",o.clicked)("ngClass",T(15,ue,!o.isInList(e._id),o.isInList(e._id))),v("aria-label",s(11,10,"form.button_unpair")),t(2),m("ngClass",q(18,Xt,!o.isInList(e._id),o.isInList(e._id)&&!o.clicked,o.isInList(e._id)&&o.clicked))}}function ai(i,c){if(i&1&&(n(0,"ul",16)(1,"li",17)(2,"h6",18),l(3),r(4,"translate"),a(),n(5,"p",19),l(6),r(7,"translate"),a()(),V(8,ni,13,22,"li",20,D),a()),i&2){let e=b(2);t(3),u(s(4,2,"reset.bridge_ind.head_child_stale")),t(3),u(s(7,4,"reset.bridge_ind.desc_child_stale")),t(2),N(e.pairingsChildStale)}}function oi(i,c){if(i&1&&(n(0,"div",12),d(1,"i",15),a(),_(2,ei,10,6,"ul",16),_(3,ii,10,6,"ul",16),_(4,ai,10,6,"ul",16)),i&2){let e=b();t(2),h(e.pairingsNonChild.length>0?2:-1),t(),h(e.pairingsChildActive.length>0?3:-1),t(),h(e.pairingsChildStale.length>0?4:-1)}}function ri(i,c){if(i&1){let e=I();n(0,"button",26),f("click",function(){y(e);let p=b();return k(p.$activeModal.dismiss("Dismiss"))}),l(1),r(2,"translate"),a()}if(i&2){let e=b();m("disabled",e.clicked),t(),g(" ",s(2,2,"form.button_close")," ")}}function si(i,c){if(i&1){let e=I();n(0,"button",27),f("click",function(){y(e);let p=b();return k(p.$activeModal.dismiss("Dismiss"))}),l(1),r(2,"translate"),a()}i&2&&(t(),g(" ",s(2,1,"form.button_close")," "))}function li(i,c){if(i&1&&l(0),i&2){let e=b(3);g(" (",e.toDelete.length,") ")}}function pi(i,c){if(i&1&&(l(0),r(1,"translate"),_(2,li,1,1)),i&2){let e=b(2);g(" ",s(1,2,"form.button_reset")," "),t(2),h(e.toDelete.length>0?2:-1)}}function di(i,c){i&1&&d(0,"i",29)}function ci(i,c){if(i&1){let e=I();n(0,"button",28),f("click",function(){y(e);let p=b();return k(p.removeBridges())}),_(1,pi,3,4),_(2,di,1,0,"i",29),a()}if(i&2){let e=b();m("disabled",!e.toDelete.length||e.clicked),t(),h(e.clicked?-1:1),t(),h(e.clicked?2:-1)}}var Qe=(()=>{class i{$activeModal=C(R);$api=C(A);$router=C(O);$toastr=C(M);$translate=C(P);clicked=!1;pairingsNonChild=[];pairingsChildActive=[];pairingsChildStale=[];toDelete=[];constructor(){}ngOnInit(){this.loadPairings()}loadPairings(){return S(this,null,function*(){try{let e=(yield B(this.$api.get("/server/pairings"))).filter(o=>!o._main).sort((o,p)=>o.name.localeCompare(p.name));this.pairingsChildActive=e.filter(o=>o._category==="bridge"&&!o._couldBeStale),this.pairingsNonChild=e.filter(o=>o._category!=="bridge"),this.pairingsChildStale=e.filter(o=>o._category==="bridge"&&o._couldBeStale)}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("settings.unpair_bridge.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}toggleList(e,o=!1){this.toDelete.some(p=>p.id===e)?this.toDelete=this.toDelete.filter(p=>p.id!==e):this.toDelete.push({id:e,resetPairingInfo:o})}isInList(e){return this.toDelete.some(o=>o.id===e)}removeBridges(){return this.clicked=!0,this.$api.delete("/server/pairings",{body:this.toDelete}).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("reset.bridge_ind.done"),this.$translate.instant("toast.title_success")),this.$activeModal.close(),this.$router.navigate(["/restart"],{queryParams:{restarting:!0}})},error:e=>{this.clicked=!1,console.error(e),this.$toastr.error(this.$translate.instant("reset.bridge_ind.fail"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],decls:17,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"disabled"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-circle-check","primary-text",2,"font-size","75px"],[1,"text-center","mb-0"],[1,"fas","fa-fw","fa-bridge","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mt-3","mb-0"],[1,"list-group-item"],[1,"mb-1","text-center"],[1,"mb-0","small","grey-text","text-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"grey-text"],[1,"fas","fa-fw","fa-link",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas","fa-fw",3,"ngClass"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-fw","fa-spinner","fa-pulse"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),n(7,"div",4),_(8,Yt,5,3),_(9,oi,5,3),a(),n(10,"div",5)(11,"div",6),_(12,ri,3,4,"button",7),a(),n(13,"div",8),_(14,si,3,3,"button",9),a(),n(15,"div",10),_(16,ci,3,3,"button",11),a()()()),o&2&&(t(3),u(s(4,8,"reset.bridge_ind.title")),t(2),m("disabled",p.clicked),v("aria-label",s(6,10,"form.button_close")),t(3),h(p.pairingsChildActive.length===0&&p.pairingsChildStale.length===0&&p.pairingsNonChild.length===0?8:-1),t(),h(p.pairingsChildActive.length>0||p.pairingsChildStale.length>0||p.pairingsNonChild.length>0?9:-1),t(3),h(p.pairingsChildActive.length>0||p.pairingsChildStale.length>0||p.pairingsNonChild.length>0?12:-1),t(2),h(p.pairingsChildActive.length===0&&p.pairingsChildStale.length===0&&p.pairingsNonChild.length===0?14:-1),t(2),h(p.pairingsChildActive.length>0||p.pairingsChildStale.length>0||p.pairingsNonChild.length>0?16:-1))},dependencies:[U,Q,F],encapsulation:2})}return i})();function mi(i,c){if(i&1){let e=I();n(0,"li",9)(1,"div")(2,"span",16),l(3),a(),d(4,"br"),n(5,"span",17),l(6),a()(),n(7,"span")(8,"input",18),Ce("ngModelChange",function(p){let x=y(e).$implicit;return fe(x.selected,p)||(x.selected=p),k(p)}),f("ngModelChange",function(){y(e);let p=b();return k(p.onAdapterSelectionChange())}),a(),d(9,"label",19),a()()}if(i&2){let e=c.$implicit;t(3),u(e.ip4||e.ip6),t(3),u(e.iface),t(2),m("id","adapter"+e.iface),ve("ngModel",e.selected),t(),m("for","adapter"+e.iface)}}var Je=(()=>{class i{$activeModal=C(R);adaptersAvailable=[];adaptersOriginal=[];isUnchanged=!0;constructor(){}ngOnInit(){this.adaptersOriginal=this.adaptersAvailable.filter(e=>e.selected).map(e=>e.iface)}onAdapterSelectionChange(){this.isUnchanged=this.adaptersOriginal.length===this.adaptersAvailable.filter(e=>e.selected).length&&this.adaptersOriginal.every(e=>this.adaptersAvailable.some(o=>o.iface===e&&o.selected))}submit(){this.$activeModal.close(this.adaptersAvailable.filter(e=>e.selected).map(e=>e.iface))}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],inputs:{adaptersAvailable:"adaptersAvailable"},decls:28,vars:19,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,"fas","fa-fw","fa-ethernet","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[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-primary",3,"click","disabled"],[1,"font-monospace"],[1,"font-monospace","grey-text"],["type","checkbox",1,"rendux-input",3,"ngModelChange","id","ngModel"],[1,"rendux-label","ms-3",3,"for"]],template:function(o,p){o&1&&(n(0,"div",0)(1,"div",1)(2,"h5",2),l(3),r(4,"translate"),a(),n(5,"button",3),r(6,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),a()(),n(7,"div",4)(8,"div",5),d(9,"i",6),a(),n(10,"ul",7)(11,"li"),l(12),r(13,"translate"),a()(),n(14,"ul",8),V(15,mi,10,5,"li",9,D),a()(),n(17,"div",10)(18,"div",11)(19,"button",12),r(20,"translate"),f("click",function(){return p.$activeModal.dismiss("Dismiss")}),l(21),r(22,"translate"),a()(),d(23,"div",13),n(24,"div",14)(25,"button",15),f("click",function(){return p.submit()}),l(26),r(27,"translate"),a()()()()),o&2&&(t(3),u(s(4,7,"settings.network.title_network_interfaces")),t(2),v("aria-label",s(6,9,"form.button_close")),t(7),u(s(13,11,"settings.network.message_network_interface")),t(3),N(p.adaptersAvailable),t(4),v("aria-label",s(20,13,"form.button_close")),t(2),g(" ",s(22,15,"form.button_close")," "),t(4),m("disabled",p.isUnchanged),t(),g(" ",s(27,17,"form.button_save")," "))},dependencies:[Y,J,X,we,F],encapsulation:2})}return i})();var ui=["wallpaperInput"],_i=i=>({maxFileSizeText:i});function hi(i,c){if(i&1){let e=I();n(0,"div",10),d(1,"img",20),n(2,"button",21),r(3,"translate"),f("click",function(){y(e);let p=b();return k(p.clearWallpaper())}),d(4,"i",22),a()()}if(i&2){let e=b();t(),m("src",e.wallpaperUrl,_e),t(),v("aria-label",s(3,2,"form.button_delete"))}}function gi(i,c){i&1&&d(0,"div",11)}var Xe=(()=>{class i{$activeModal=C(R);$api=C(A);$modal=C(K);$settings=C(G);$toastr=C(M);$translate=C(P);clicked=!1;maxFileSizeText=globalThis.backup.maxBackupSizeText;selectedFile;wallpaperUrl=null;originalWallpaperUrl=null;wallpaperInput;constructor(){}ngOnInit(){this.$settings.env.customWallpaperHash&&(this.wallpaperUrl=`${Ae.api.base}/auth/wallpaper/${this.$settings.env.customWallpaperHash}`,this.originalWallpaperUrl=this.wallpaperUrl)}onFileChange(e){if(e.length){this.selectedFile=e[0];let o=new FileReader;o.onload=p=>{this.wallpaperUrl=p.target.result},o.readAsDataURL(this.selectedFile)}else delete this.selectedFile,this.wallpaperUrl=this.originalWallpaperUrl}saveWallpaper(){if(this.clicked=!0,this.selectedFile){let e=new FormData;e.append("wallpaper",this.selectedFile,this.selectedFile.name),this.$api.post("/server/wallpaper",e).subscribe({next:()=>{this.$settings.setItem("wallpaper",`ui-wallpaper.${this.selectedFile.name.split(".").pop()}`),this.$activeModal.close(),this.$toastr.success(this.$translate.instant("settings.display.wallpaper_success"),this.$translate.instant("toast.title_success"))},error:o=>{console.error(o),this.$toastr.error(o.error?.message,this.$translate.instant("toast.title_error")),this.clicked=!1}})}else this.$api.delete("/server/wallpaper").subscribe({next:()=>{this.$activeModal.close()},error:e=>{console.error(e),this.$toastr.error(e.error?.message,this.$translate.instant("toast.title_error")),this.clicked=!1}})}clearWallpaper(){this.selectedFile=null,this.wallpaperUrl=this.wallpaperUrl===this.originalWallpaperUrl?null:this.originalWallpaperUrl,this.wallpaperInput.nativeElement.value=""}cancel(){this.$activeModal.dismiss()}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],viewQuery:function(o,p){if(o&1&&he(ui,5),o&2){let x;ge(x=be())&&(p.wallpaperInput=x.first)}},decls:36,vars:28,consts:[["wallpaperInput",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-image","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"mb-3","text-center"],[1,"position-relative","d-inline-block"],[1,"gradient","anim","rounded",2,"height","200px","width","350px","margin","0 auto"],[1,"mb-0"],["type","file","id","wallpaper","accept","image/*",1,"form-control",3,"change"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],["alt","Current Wallpaper",1,"img-fluid","rounded","mx-auto","d-block",2,"height","200px",3,"src"],[1,"btn","btn-danger","position-absolute",2,"top","10px","right","10px",3,"click"],[1,"fas","fa-fw","fa-trash"]],template:function(o,p){if(o&1){let x=I();n(0,"div",1)(1,"div",2)(2,"h5",3),l(3),r(4,"translate"),a(),n(5,"button",4),r(6,"translate"),f("click",function(){return y(x),k(p.$activeModal.dismiss("Dismiss"))}),a()(),n(7,"div",5)(8,"div",6),d(9,"i",7),a(),n(10,"ul",8)(11,"li"),l(12),r(13,"translate"),a(),n(14,"li"),l(15),r(16,"translate"),a(),n(17,"li"),l(18),r(19,"translate"),a()(),n(20,"div",9),_(21,hi,5,4,"div",10)(22,gi,1,0,"div",11),a(),n(23,"div",12)(24,"input",13,0),f("change",function(Ye){return y(x),k(p.onFileChange(Ye.target.files))}),a()()(),n(26,"div",14)(27,"div",15)(28,"button",16),f("click",function(){return y(x),k(p.cancel())}),l(29),r(30,"translate"),a()(),d(31,"div",17),n(32,"div",18)(33,"button",19),f("click",function(){return y(x),k(p.saveWallpaper())}),l(34),r(35,"translate"),a()()()()}o&2&&(t(3),u(s(4,11,"settings.display.wallpaper")),t(2),m("disabled",p.clicked),v("aria-label",s(6,13,"form.button_close")),t(7),u(s(13,15,"settings.display.wallpaper_intro")),t(3),u(z(16,17,"settings.display.wallpaper_rule",L(26,_i,p.maxFileSizeText))),t(3),u(s(19,20,"settings.display.wallpaper_rule2")),t(3),h(p.wallpaperUrl?21:22),t(7),m("disabled",p.clicked),t(),g(" ",s(30,22,"form.button_close")," "),t(4),m("disabled",p.wallpaperUrl===p.originalWallpaperUrl||p.clicked),t(),g(" ",s(35,24,"form.button_save")," "))},dependencies:[Z,F],styles:[".anim[_ngcontent-%COMP%]{-webkit-animation:_ngcontent-%COMP%_gradient 20s ease infinite;-moz-animation:gradient 20s ease infinite;-o-animation:gradient 20s ease infinite;animation:_ngcontent-%COMP%_gradient 20s ease infinite}@keyframes _ngcontent-%COMP%_gradient{0%{background-position:0 50%}50%{background-position:100% 50%}to{background-position:0 50%}}"]})}return i})();var j=(i,c)=>({"fa-chevron-down":i,"fa-chevron-right":c}),ee=i=>({"is-invalid":i}),bi=i=>({link:i}),vi=(i,c)=>({"badge-danger":i,"badge-info":c});function fi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Ci(i,c){if(i&1){let e=I();n(0,"ul",5)(1,"li",12)(2,"span"),l(3),r(4,"translate"),a(),n(5,"div",13),d(6,"input",14),r(7,"translate"),_(8,fi,1,1,"i",15),a()(),n(9,"li",16)(10,"span",17),l(11),r(12,"translate"),a(),n(13,"button",18),r(14,"translate"),f("click",function(){y(e);let p=b();return k(p.openUiSettings())}),d(15,"i",19),a()(),n(16,"li",16)(17,"span",17),l(18),r(19,"translate"),a(),n(20,"button",18),r(21,"translate"),f("click",function(){y(e);let p=b();return k(p.openBackupModal())}),d(22,"i",19),a()(),n(23,"li",16)(24,"span",17),l(25),r(26,"translate"),a(),n(27,"a",20),r(28,"translate"),d(29,"i",19),a()()()}if(i&2){let e=b();t(3),u(s(4,11,"settings.name")),t(3),m("formControl",e.hbNameFormControl)("ngClass",L(27,ee,e.hbNameIsInvalid)),v("aria-label",s(7,13,"settings.name")),t(2),h(e.hbNameIsSaving?8:-1),t(3),u(s(12,15,"menu.label_settings_advanced")),t(2),v("aria-label",s(14,17,"menu.label_settings_advanced")),t(5),g(" ",s(19,19,"backup.title_backup")," "),t(2),v("aria-label",s(21,21,"backup.title_backup")),t(5),g(" ",s(26,23,"menu.tooltip_user_accounts")," "),t(2),v("aria-label",s(28,25,"menu.tooltip_user_accounts"))}}function xi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Si(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function yi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function ki(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Ii(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function wi(i,c){if(i&1){let e=I();n(0,"ul",6)(1,"li",12),l(2),r(3,"translate"),n(4,"div",21)(5,"select",22)(6,"option",23),l(7),r(8,"translate"),a(),n(9,"option",24),l(10,"Bulgarian (bg)"),a(),n(11,"option",25),l(12,"Catalan (ca)"),a(),n(13,"option",26),l(14,"Chinese - Simplified (zh-CN)"),a(),n(15,"option",27),l(16,"Chinese - Traditional (zh-TW)"),a(),n(17,"option",28),l(18,"Czech (cs)"),a(),n(19,"option",29),l(20,"Dutch (nl)"),a(),n(21,"option",30),l(22,"English (en)"),a(),n(23,"option",31),l(24,"Finnish (fi)"),a(),n(25,"option",32),l(26,"French (fr)"),a(),n(27,"option",33),l(28,"German (de)"),a(),n(29,"option",34),l(30,"Hebrew (he)"),a(),n(31,"option",35),l(32,"Hungarian (hu)"),a(),n(33,"option",36),l(34,"Indonesian (id)"),a(),n(35,"option",37),l(36,"Italian (it)"),a(),n(37,"option",38),l(38,"Japanese (ja)"),a(),n(39,"option",39),l(40,"Korean (ko)"),a(),n(41,"option",40),l(42,"Macedonian (mk)"),a(),n(43,"option",41),l(44,"Norwegian (no)"),a(),n(45,"option",42),l(46,"Polish (pl)"),a(),n(47,"option",43),l(48,"Portuguese (Brazil)"),a(),n(49,"option",44),l(50,"Portuguese (Portugal)"),a(),n(51,"option",45),l(52,"Russian (ru)"),a(),n(53,"option",46),l(54,"Slovenian (sl)"),a(),n(55,"option",47),l(56,"Spanish (es)"),a(),n(57,"option",48),l(58,"Swedish (sv)"),a(),n(59,"option",49),l(60,"Thai (th)"),a(),n(61,"option",50),l(62,"Turkish (tr)"),a(),n(63,"option",51),l(64,"Ukrainian (uk)"),a()(),_(65,xi,1,1,"i",15),a()(),n(66,"li",12),l(67),r(68,"translate"),n(69,"div",21)(70,"select",22)(71,"option",52),l(72),r(73,"translate"),a(),n(74,"option",53),l(75),r(76,"translate"),a(),n(77,"option",54),l(78),r(79,"translate"),a(),n(80,"option",55),l(81),r(82,"translate"),a(),n(83,"option",56),l(84),r(85,"translate"),a(),n(86,"option",57),l(87),r(88,"translate"),a(),n(89,"option",58),l(90),r(91,"translate"),a(),n(92,"option",59),l(93),r(94,"translate"),a(),n(95,"option",60),l(96),r(97,"translate"),a(),n(98,"option",61),l(99),r(100,"translate"),a(),n(101,"option",62),l(102),r(103,"translate"),a(),n(104,"option",63),l(105),r(106,"translate"),a(),n(107,"option",64),l(108),r(109,"translate"),a()(),_(110,Si,1,1,"i",15),a()(),n(111,"li",12),l(112),r(113,"translate"),n(114,"div",21)(115,"select",22)(116,"option",23),l(117),r(118,"translate"),a(),n(119,"option",65),l(120),r(121,"translate"),a(),n(122,"option",66),l(123),r(124,"translate"),a()(),_(125,yi,1,1,"i",15),a()(),n(126,"li",12),l(127),r(128,"translate"),n(129,"div",21)(130,"select",22)(131,"option",67),l(132),r(133,"translate"),a(),n(134,"option",68),l(135),r(136,"translate"),a()(),_(137,ki,1,1,"i",15),a()(),n(138,"li",12),l(139),r(140,"translate"),n(141,"div",21)(142,"select",22)(143,"option",69),l(144),r(145,"translate"),a(),n(146,"option",70),l(147),r(148,"translate"),a()(),_(149,Ii,1,1,"i",15),a()(),n(150,"li",16)(151,"span",17),l(152),r(153,"translate"),a(),n(154,"button",18),r(155,"translate"),f("click",function(){y(e);let p=b();return k(p.openWallpaperModal())}),d(156,"i",19),a()()()}if(i&2){let e=b();t(2),g(" ",s(3,38,"settings.display.lang")," "),t(3),m("formControl",e.uiLangFormControl),t(2),u(s(8,40,"form.select.auto")),t(58),h(e.uiLangIsSaving?65:-1),t(2),g(" ",s(68,42,"settings.display.theme")," "),t(3),m("formControl",e.uiThemeFormControl),t(2),u(s(73,44,"settings.display.orange")),t(3),u(s(76,46,"settings.display.red")),t(3),u(s(79,48,"settings.display.pink")),t(3),u(s(82,50,"settings.display.purple")),t(3),u(s(85,52,"settings.display.deep_purple")),t(3),u(s(88,54,"settings.display.indigo")),t(3),u(s(91,56,"settings.display.blue")),t(3),u(s(94,58,"settings.display.bluegrey")),t(3),u(s(97,60,"settings.display.cyan")),t(3),u(s(100,62,"settings.display.green")),t(3),u(s(103,64,"settings.display.teal")),t(3),u(s(106,66,"settings.display.grey")),t(3),u(s(109,68,"settings.display.brown")),t(2),h(e.uiThemeIsSaving?110:-1),t(2),g(" ",s(113,70,"settings.display.lighting_mode")," "),t(3),m("formControl",e.uiLightFormControl),t(2),u(s(118,72,"form.select.auto")),t(3),u(s(121,74,"settings.display.light")),t(3),u(s(124,76,"settings.display.dark")),t(2),h(e.uiLightIsSaving?125:-1),t(2),g(" ",s(128,78,"settings.display.menu_mode")," "),t(3),m("formControl",e.uiMenuFormControl),t(2),u(s(133,80,"settings.display.menu_default")),t(3),u(s(136,82,"settings.display.menu_freeze")),t(2),h(e.uiMenuIsSaving?137:-1),t(2),g(" ",s(140,84,"settings.display.temp_units")," "),t(3),m("formControl",e.uiTempFormControl),t(2),u(s(145,86,"settings.display.temp_units.c")),t(3),u(s(148,88,"settings.display.temp_units.f")),t(2),h(e.uiTempIsSaving?149:-1),t(3),u(s(153,90,"settings.display.wallpaper")),t(2),v("aria-label",s(155,92,"settings.display.wallpaper"))}}function Ei(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Bi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Ti(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function $i(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Fi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Ri(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Pi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Mi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Ai(i,c){if(i&1&&(n(0,"li",12)(1,"span"),l(2),r(3,"translate"),d(4,"br"),n(5,"small",72),l(6),r(7,"translate"),a()(),n(8,"div",21),d(9,"input",91),r(10,"translate"),_(11,Mi,1,1,"i",15),a()()),i&2){let e=b(5);t(2),g(" ",s(3,5,"settings.linux.temp")),t(4),u(s(7,7,"settings.linux.temp_desc")),t(3),m("formControl",e.uiTempFileFormControl),v("aria-label",s(10,9,"settings.linux.temp")),t(2),h(e.uiTempFileIsSaving?11:-1)}}function Di(i,c){if(i&1&&(n(0,"li",12)(1,"span"),l(2),r(3,"translate"),d(4,"br"),n(5,"small",72),l(6),r(7,"translate"),a()(),n(8,"div",21),d(9,"input",89),r(10,"translate"),_(11,Ri,1,1,"i",15),a()(),n(12,"li",12)(13,"span"),l(14),r(15,"translate"),d(16,"br"),n(17,"small",72),l(18),r(19,"translate"),a()(),n(20,"div",21),d(21,"input",90),r(22,"translate"),_(23,Pi,1,1,"i",15),a()(),_(24,Ai,12,11,"li",12)),i&2){let e=b(4);t(2),g(" ",s(3,11,"settings.linux.shutdown")),t(4),u(s(7,13,"settings.linux.shutdown_desc")),t(3),m("formControl",e.hbLinuxShutdownFormControl),v("aria-label",s(10,15,"settings.linux.shutdown")),t(2),h(e.hbLinuxShutdownIsSaving?11:-1),t(3),g(" ",s(15,17,"settings.linux.restart")),t(4),u(s(19,19,"settings.linux.restart_desc")),t(3),m("formControl",e.hbLinuxRestartFormControl),v("aria-label",s(22,21,"settings.linux.restart")),t(2),h(e.hbLinuxRestartIsSaving?23:-1),t(),h(e.$settings.env.runningOnRaspberryPi?24:-1)}}function Vi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Ni(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Li(i,c){if(i&1&&(n(0,"li",16)(1,"span"),l(2),r(3,"translate"),n(4,"code"),l(5,"-D"),a(),d(6,"br"),n(7,"small",72),l(8),r(9,"translate"),a()(),n(10,"div",74)(11,"div",75),d(12,"input",76),r(13,"translate"),d(14,"label",77),a(),_(15,Ei,1,1,"i",15),a()(),n(16,"li",16)(17,"span"),l(18),r(19,"translate"),n(20,"code"),l(21,"-I"),a(),d(22,"br"),n(23,"small",72),l(24),r(25,"translate"),a()(),n(26,"div",74)(27,"div",75),d(28,"input",78),r(29,"translate"),d(30,"label",79),a(),_(31,Bi,1,1,"i",15),a()(),n(32,"li",16)(33,"span"),l(34),r(35,"translate"),n(36,"code"),l(37,"-K"),a(),d(38,"br"),n(39,"small",72),l(40),r(41,"translate"),a()(),n(42,"div",74)(43,"div",75),d(44,"input",80),r(45,"translate"),d(46,"label",81),a(),_(47,Ti,1,1,"i",15),a()(),n(48,"li",16)(49,"span"),l(50),r(51,"translate"),d(52,"br"),n(53,"small",72),l(54),r(55,"translate"),a()(),n(56,"div",74)(57,"div",75),d(58,"input",82),r(59,"translate"),d(60,"label",83),a(),_(61,$i,1,1,"i",15),a()(),n(62,"li",12)(63,"span"),l(64),r(65,"translate"),d(66,"br"),n(67,"small",72),l(68),r(69,"translate"),a()(),n(70,"div",21),d(71,"input",84),r(72,"translate"),_(73,Fi,1,1,"i",15),a()(),_(74,Di,25,23),n(75,"li",12)(76,"span")(77,"span",85),l(78,"DEBUG"),a(),d(79,"br")(80,"small",86),r(81,"translate"),a(),n(82,"div",21),d(83,"input",87),_(84,Vi,1,1,"i",15),a()(),n(85,"li",12)(86,"span")(87,"span",85),l(88,"NODE_OPTIONS"),a(),d(89,"br"),n(90,"small",72),l(91),r(92,"translate"),a()(),n(93,"div",21),d(94,"input",88),_(95,Ni,1,1,"i",15),a()()),i&2){let e=b(3);t(2),g(" ",s(3,32,"settings.startup.debug")," "),t(6),g(" ",s(9,34,e.isHbV2?"settings.startup.debug_desc_v2":"settings.startup.debug_desc_v1")," "),t(4),m("formControl",e.hbDebugFormControl),v("aria-label",s(13,36,"settings.startup.debug")),t(3),h(e.hbDebugIsSaving?15:-1),t(3),g(" ",s(19,38,"settings.startup.insecure")," "),t(6),u(s(25,40,"settings.startup.insecure_desc")),t(4),m("formControl",e.hbInsecureFormControl),v("aria-label",s(29,42,"settings.startup.insecure")),t(3),h(e.hbInsecureIsSaving?31:-1),t(3),g(" ",s(35,44,"settings.startup.keep_accessories")," "),t(6),u(s(41,46,"settings.startup.keep_accessories_desc")),t(4),m("formControl",e.hbKeepFormControl),v("aria-label",s(45,48,"settings.startup.keep_accessories")),t(3),h(e.hbKeepIsSaving?47:-1),t(3),g(" ",s(51,50,"settings.startup.metrics")),t(4),u(s(55,52,"settings.startup.metrics_desc")),t(4),m("formControl",e.uiMetricsFormControl),v("aria-label",s(59,54,"settings.startup.metrics")),t(3),h(e.uiMetricsIsSaving?61:-1),t(3),g(" ",s(65,56,"settings.network.hb_package")),t(4),u(s(69,58,"settings.network.hb_package_desc")),t(3),m("formControl",e.hbPackageFormControl),v("aria-label",s(72,60,"settings.network.hb_package")),t(2),h(e.hbPackageIsSaving?73:-1),t(),h(e.$settings.env.platform==="linux"?74:-1),t(6),m("innerHTML",z(81,62,"settings.service.debug_tooltip",L(67,bi,e.linkDebug)),le),t(3),m("formControl",e.hbEnvDebugFormControl),t(),h(e.hbEnvDebugIsSaving?84:-1),t(7),u(s(92,65,"settings.service.node_tooltip")),t(3),m("formControl",e.hbEnvNodeFormControl),t(),h(e.hbEnvNodeIsSaving?95:-1)}}function Oi(i,c){i&1&&(n(0,"li",16)(1,"span"),l(2),r(3,"translate"),d(4,"br"),n(5,"small",72),l(6),r(7,"translate"),a()(),n(8,"a",92),r(9,"translate"),d(10,"i",19),a()()),i&2&&(t(2),g(" ",s(3,3,"menu.docker.startup_script")),t(4),u(s(7,5,"platform.docker.script_help")),t(2),v("aria-label",s(9,7,"menu.docker.startup_script")))}function zi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Ui(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Hi(i,c){if(i&1&&(n(0,"li",12)(1,"span"),l(2),r(3,"translate"),d(4,"br"),n(5,"small",72),l(6),r(7,"translate"),a()(),n(8,"div",21),d(9,"input",93),r(10,"translate"),_(11,Ui,1,1,"i",15),a()()),i&2){let e=b(3);t(2),g(" ",s(3,6,"settings.startup.log_truncate")),t(4),u(s(7,8,"settings.startup.log_truncate_desc")),t(3),m("formControl",e.hbLogTruncateFormControl)("ngClass",L(12,ee,e.hbLogTruncateIsInvalid)),v("aria-label",s(10,10,"settings.startup.log_truncate")),t(2),h(e.hbLogTruncateIsSaving?11:-1)}}function Wi(i,c){if(i&1&&(n(0,"ul",71),_(1,Li,96,69),_(2,Oi,11,9,"li",16),n(3,"li",12)(4,"span"),l(5),r(6,"translate"),d(7,"br"),n(8,"small",72),l(9),r(10,"translate"),a()(),n(11,"div",21),d(12,"input",73),r(13,"translate"),_(14,zi,1,1,"i",15),a()(),_(15,Hi,12,14,"li",12),a()),i&2){let e=b(2);t(),h(e.$settings.env.serviceMode?1:-1),t(),h(e.$settings.env.runningInDocker?2:-1),t(3),g(" ",s(6,9,"settings.startup.log_max")),t(4),u(s(10,11,"settings.startup.log_max_desc")),t(3),m("formControl",e.hbLogSizeFormControl)("ngClass",L(15,ee,e.hbLogSizeIsInvalid)),v("aria-label",s(13,13,"settings.startup.log_max")),t(2),h(e.hbLogSizeIsSaving?14:-1),t(),h(e.hbLogSizeFormControl.value>0?15:-1)}}function Ki(i,c){if(i&1){let e=I();n(0,"div",2),f("click",function(){y(e);let p=b();return k(p.toggleSection("startup"))}),n(1,"h5",3),d(2,"i",4),l(3),r(4,"translate"),a()(),_(5,Wi,16,17,"ul",71)}if(i&2){let e=b();v("aria-expanded",e.showFields.startup?"true":"false")("aria-controls","fieldsStartup"),t(2),m("ngClass",T(7,j,e.showFields.startup,!e.showFields.startup)),t(),g(" ",s(4,5,"settings.title_startup_options")," "),t(2),h(e.showFields.startup?5:-1)}}function Gi(i,c){i&1&&d(0,"i",106)}function ji(i,c){if(i&1&&(n(0,"span",95),_(1,Gi,1,0,"i",106),l(2),n(3,"span",107),l(4),r(5,"translate"),a()()),i&2){let e=c.$implicit;m("ngClass",T(6,vi,e.missing,!e.missing)),t(),h(e.missing?1:-1),t(),g(" ",e.iface,": "),t(2),u(e.missing?s(5,4,"settings.mdns_advertiser_not_connected"):e.ip4||e.ip6)}}function qi(i,c){i&1&&(n(0,"option",97),l(1),r(2,"translate"),a()),i&2&&(t(),g("Avahi (",s(2,1,"settings.mdns_advertiser_rec"),")"))}function Qi(i,c){i&1&&(n(0,"option",100),l(1),r(2,"translate"),a()),i&2&&(t(),g("systemd-resolved (",s(2,1,"settings.mdns_advertiser_exp"),")"))}function Ji(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Xi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Yi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function Zi(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function en(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function tn(i,c){if(i&1){let e=I();n(0,"ul",7)(1,"li",16)(2,"span",17),l(3),r(4,"translate"),d(5,"br"),n(6,"div",94),l(7),r(8,"translate"),a(),V(9,ji,6,9,"span",95,D),a(),n(11,"button",96),r(12,"translate"),f("click",function(){y(e);let p=b();return k(p.selectNetworkInterfaces())}),d(13,"i",19),a()(),n(14,"li",12)(15,"span"),l(16),r(17,"translate"),d(18,"br"),n(19,"small",72),l(20),r(21,"translate"),a()(),n(22,"div",21)(23,"select",22),r(24,"translate"),_(25,qi,3,3,"option",97),n(26,"option",98),l(27),r(28,"translate"),a(),n(29,"option",99),l(30,"Bonjour HAP"),a(),_(31,Qi,3,3,"option",100),a(),_(32,Ji,1,1,"i",15),a()(),n(33,"li",12)(34,"span"),l(35),r(36,"translate"),d(37,"br"),n(38,"small",72),l(39),r(40,"translate"),a()(),n(41,"div",21),d(42,"input",101),r(43,"translate"),_(44,Xi,1,1,"i",15),a()(),n(45,"li",12)(46,"span"),l(47),r(48,"translate"),d(49,"br"),n(50,"small",72),l(51),r(52,"translate"),a()(),n(53,"div",21),d(54,"input",102),r(55,"translate"),_(56,Yi,1,1,"i",15),a()(),n(57,"li",12)(58,"span"),l(59),r(60,"translate"),d(61,"br")(62,"small",103),r(63,"translate"),a(),n(64,"div",21),d(65,"input",104),r(66,"translate"),_(67,Zi,1,1,"i",15),a()(),n(68,"li",12)(69,"span"),l(70),r(71,"translate"),d(72,"br"),n(73,"small",72),l(74),r(75,"translate"),a()(),n(76,"div",21),d(77,"input",105),r(78,"translate"),_(79,en,1,1,"i",15),a()()()}if(i&2){let e=b();t(3),g(" ",s(4,34,"settings.network.title_network_interfaces")),t(4),u(s(8,36,"settings.network.message_network_interface")),t(2),N(e.adaptersSelected),t(2),m("disabled",!e.adaptersAvailable.length),v("aria-label",s(12,38,"settings.network.title_network_interfaces")),t(5),g(" ",s(17,40,"settings.mdns_advertiser")),t(4),u(s(21,42,"settings.mdns_advertiser_help")),t(3),m("formControl",e.hbMDnsFormControl),v("aria-label",s(24,44,"settings.mdns_advertiser")),t(2),h(e.showAvahiMdnsOption?25:-1),t(2),g(" Ciao ",e.showAvahiMdnsOption?"":"("+s(28,46,"settings.mdns_advertiser_rec")+")"," "),t(4),h(e.showResolvedMdnsOption?31:-1),t(),h(e.hbMDnsIsSaving?32:-1),t(3),g(" ",s(36,48,"settings.network.port_hb")),t(4),u(s(40,50,"settings.network.port_hb_desc")),t(3),m("formControl",e.hbPortFormControl)("ngClass",L(72,ee,e.hbPortIsInvalid)),v("aria-label",s(43,52,"settings.network.port")),t(2),h(e.hbPortIsSaving?44:-1),t(3),g(" ",s(48,54,"settings.network.port_ui")),t(4),u(s(52,56,"settings.network.port_ui_desc")),t(3),m("formControl",e.uiPortFormControl)("ngClass",L(74,ee,e.uiPortIsInvalid)),v("aria-label",s(55,58,"settings.network.port_ui")),t(2),h(e.uiPortIsSaving?56:-1),t(3),g(" ",s(60,60,"settings.network.host")),t(3),m("innerHtml",s(63,62,"settings.network.host_desc"),le),t(3),m("formControl",e.uiHostFormControl),v("aria-label",s(66,64,"settings.network.host")),t(2),h(e.uiHostIsSaving?67:-1),t(3),g(" ",s(71,66,"settings.network.proxy")),t(4),u(s(75,68,"settings.network.proxy_desc")),t(3),m("formControl",e.uiProxyHostFormControl),v("aria-label",s(78,70,"settings.network.proxy")),t(2),h(e.uiProxyHostIsSaving?79:-1)}}function nn(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function an(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function on(i,c){if(i&1&&(n(0,"li",12)(1,"span"),l(2),r(3,"translate"),d(4,"br"),n(5,"small",72),l(6),r(7,"translate"),a()(),n(8,"div",21),d(9,"input",113),r(10,"translate"),_(11,an,1,1,"i",15),a()()),i&2){let e=b(2);t(2),g(" ",s(3,6,"settings.startup.session")),t(4),u(s(7,8,"settings.startup.session_desc")),t(3),m("formControl",e.uiSessionTimeoutFormControl)("ngClass",L(12,ee,e.uiSessionTimeoutIsInvalid)),v("aria-label",s(10,10,"settings.startup.session")),t(2),h(e.uiSessionTimeoutIsSaving?11:-1)}}function rn(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function sn(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function ln(i,c){if(i&1&&(n(0,"li",12)(1,"span"),l(2),r(3,"translate"),a(),n(4,"div",21),d(5,"input",114),r(6,"translate"),_(7,rn,1,1,"i",15),a()(),n(8,"li",12)(9,"span"),l(10),r(11,"translate"),a(),n(12,"div",21),d(13,"input",115),r(14,"translate"),_(15,sn,1,1,"i",15),a()()),i&2){let e=b(2);t(2),u(s(3,8,"settings.security.key")),t(3),m("formControl",e.uiSslKeyFormControl),v("aria-label",s(6,10,"settings.security.key")),t(2),h(e.uiSslKeyIsSaving?7:-1),t(3),u(s(11,12,"settings.security.cert")),t(3),m("formControl",e.uiSslCertFormControl),v("aria-label",s(14,14,"settings.security.cert")),t(2),h(e.uiSslCertIsSaving?15:-1)}}function pn(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function dn(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function cn(i,c){if(i&1){let e=I();n(0,"li",12)(1,"span"),l(2),r(3,"translate"),a(),n(4,"div",21),d(5,"input",116),r(6,"translate"),_(7,pn,1,1,"i",15),a()(),n(8,"li",12)(9,"span"),l(10),r(11,"translate"),a(),n(12,"div",21)(13,"input",117),r(14,"translate"),f("focus",function(){y(e);let p=b(2);return k(p.showPfxPassphrase=!0)})("blur",function(){y(e);let p=b(2);return k(p.showPfxPassphrase=!1)}),a(),_(15,dn,1,1,"i",15),a()()}if(i&2){let e=b(2);t(2),u(s(3,9,"settings.security.pfx")),t(3),m("formControl",e.uiSslPfxFormControl),v("aria-label",s(6,11,"settings.security.pfx")),t(2),h(e.uiSslPfxIsSaving?7:-1),t(3),u(s(11,13,"settings.security.pass")),t(3),m("type",e.showPfxPassphrase?"text":"password")("formControl",e.uiSslPassphraseFormControl),v("aria-label",s(14,15,"settings.security.pass")),t(2),h(e.uiSslPassphraseIsSaving?15:-1)}}function mn(i,c){if(i&1){let e=I();n(0,"ul",8)(1,"li",16)(2,"span"),l(3),r(4,"translate"),d(5,"br"),n(6,"small",72),l(7),r(8,"translate"),a()(),n(9,"div",74)(10,"div",75),d(11,"input",108),r(12,"translate"),d(13,"label",109),a(),_(14,nn,1,1,"i",15),a()(),_(15,on,12,14,"li",12),n(16,"li",12)(17,"span"),l(18),r(19,"translate"),d(20,"br"),n(21,"small",72),l(22),r(23,"translate"),a()(),n(24,"div",21)(25,"select",22),r(26,"translate"),n(27,"option",110),l(28),r(29,"translate"),a(),n(30,"option",111),l(31),r(32,"translate"),a(),n(33,"option",112),l(34),r(35,"translate"),a()()()(),_(36,ln,16,16),_(37,cn,16,17),n(38,"li",16)(39,"span",17),l(40),r(41,"translate"),d(42,"br"),n(43,"small",72),l(44),r(45,"translate"),a()(),n(46,"button",18),r(47,"translate"),f("click",function(){y(e);let p=b();return k(p.accessoryUiControl())}),d(48,"i",19),a()()()}if(i&2){let e=b();t(3),g(" ",s(4,18,"settings.security.auth")),t(4),g(" ",s(8,20,"settings.security.auth_desc")," "),t(4),m("formControl",e.uiAuthFormControl),v("aria-label",s(12,22,"settings.security.auth")),t(3),h(e.uiAuthIsSaving?14:-1),t(),h(e.uiAuthFormControl.value?15:-1),t(3),g(" ",s(19,24,"settings.security.https")),t(4),u(s(23,26,"settings.security.https_desc")),t(3),m("formControl",e.uiSslTypeFormControl),v("aria-label",s(26,28,"settings.security.https")),t(3),u(s(29,30,"accessories.control.off")),t(3),u(s(32,32,"settings.security.https_keycert")),t(3),u(s(35,34,"settings.security.https_pfx")),t(2),h(e.uiSslTypeFormControl.value==="keycert"?36:-1),t(),h(e.uiSslTypeFormControl.value==="pfx"?37:-1),t(3),g(" ",s(41,36,"settings.security.ui_control")),t(4),u(s(45,38,"settings.security.ui_control_desc")),t(2),v("aria-label",s(47,40,"settings.security.ui_control"))}}function un(i,c){i&1&&(n(0,"p",9),l(1),r(2,"translate"),a()),i&2&&(t(),u(s(2,1,"settings.cache.desc")))}function _n(i,c){i&1&&d(0,"i",15),i&2&&m("@fadeInOut",void 0)}function hn(i,c){if(i&1){let e=I();n(0,"ul",118)(1,"li",16)(2,"span"),l(3),r(4,"translate"),d(5,"br"),n(6,"small",72),l(7),r(8,"translate"),a()(),n(9,"div",74)(10,"div",75),d(11,"input",119),r(12,"translate"),d(13,"label",120),a(),_(14,_n,1,1,"i",15),a()(),n(15,"li",16)(16,"span",17),l(17),r(18,"translate"),d(19,"br"),n(20,"small",72),l(21),r(22,"translate"),a()(),n(23,"button",18),r(24,"translate"),f("click",function(){y(e);let p=b(2);return k(p.removeSingleCachedAccessories())}),d(25,"i",19),a()(),n(26,"li",16)(27,"span",17),l(28),r(29,"translate"),d(30,"br"),n(31,"small",72),l(32),r(33,"translate"),a()(),n(34,"button",18),r(35,"translate"),f("click",function(){y(e);let p=b(2);return k(p.removeBridgeAccessories())}),d(36,"i",19),a()(),n(37,"li",16)(38,"span",17),l(39),r(40,"translate"),d(41,"br"),n(42,"small",72),l(43),r(44,"translate"),a()(),n(45,"button",18),r(46,"translate"),f("click",function(){y(e);let p=b(2);return k(p.removeAllCachedAccessories())}),d(47,"i",19),a()()()}if(i&2){let e=b(2);t(3),g(" ",s(4,14,"settings.accessory.debug")),t(4),u(s(8,16,"settings.accessory.debug_desc")),t(4),m("formControl",e.uiAccDebugFormControl),v("aria-label",s(12,18,"settings.accessory.debug")),t(3),h(e.uiAccDebugIsSaving?14:-1),t(3),g(" ",s(18,20,"reset.accessory_ind.title")),t(4),u(s(22,22,"reset.accessory_ind.desc")),t(2),v("aria-label",s(24,24,"reset.accessory_ind.title")),t(5),g(" ",s(29,26,"reset.bridge_accessories.title")),t(4),u(s(33,28,"reset.bridge_accessories.desc")),t(2),v("aria-label",s(35,30,"reset.accessory_all.title")),t(5),g(" ",s(40,32,"reset.accessory_all.title")),t(4),u(s(44,34,"reset.accessory_all.desc")),t(2),v("aria-label",s(46,36,"reset.accessory_all.title"))}}function gn(i,c){if(i&1){let e=I();n(0,"div",1)(1,"div",2),f("click",function(){y(e);let p=b();return k(p.toggleSection("cache"))}),n(2,"h5",3),d(3,"i",4),l(4),r(5,"translate"),a()(),_(6,un,3,3,"p",9),_(7,hn,48,38,"ul",118),a()}if(i&2){let e=b();t(),v("aria-expanded",e.showFields.cache?"true":"false")("aria-controls","fieldsCache"),t(2),m("ngClass",T(8,j,e.showFields.cache,!e.showFields.cache)),t(),g(" ",s(5,6,"settings.cache.title")," "),t(2),h(e.showFields.cache?6:-1),t(),h(e.showFields.cache?7:-1)}}function bn(i,c){i&1&&(n(0,"p",9),l(1),r(2,"translate"),a()),i&2&&(t(),u(s(2,1,"reset.bridges.desc")))}function vn(i,c){if(i&1){let e=I();n(0,"li",16)(1,"span",17),l(2),r(3,"translate"),d(4,"br"),n(5,"small",72),l(6),r(7,"translate"),a()(),n(8,"button",18),r(9,"translate"),f("click",function(){y(e);let p=b(2);return k(p.unpairAccessory())}),d(10,"i",19),a()()}i&2&&(t(2),g(" ",s(3,3,"reset.bridge_ind.title")),t(4),u(s(7,5,"reset.bridge_ind.desc")),t(2),v("aria-label",s(9,7,"reset.bridge_ind.title")))}function fn(i,c){if(i&1){let e=I();n(0,"ul",10),_(1,vn,11,9,"li",16),n(2,"li",16)(3,"span",17),l(4),r(5,"translate"),r(6,"titlecase"),d(7,"br"),n(8,"small",72),l(9),r(10,"translate"),a()(),n(11,"button",18),r(12,"translate"),f("click",function(){y(e);let p=b();return k(p.resetHomebridgeState())}),d(13,"i",19),a()()()}if(i&2){let e=b();t(),h(e.$settings.env.serviceMode?1:-1),t(3),g(" ",s(6,6,s(5,4,"reset.bridge_all.title"))),t(5),u(s(10,8,"reset.bridge_all.desc")),t(2),v("aria-label",s(12,10,"reset.bridge_all.title"))}}var Do=(()=>{class i{$api=C(A);$modal=C(K);$plugin=C(Ne);$router=C(O);$settings=C(G);$toastr=C(M);$translate=C(P);restartToastIsShown=!1;showFields={general:!0,display:!0,startup:!0,network:!0,security:!0,reset:!0,cache:!0};isHbV2=!1;showAvahiMdnsOption=!1;showResolvedMdnsOption=!1;adaptersAvailable=[];adaptersSelected=[];showPfxPassphrase=!1;hbNameIsInvalid=!1;hbNameIsSaving=!1;hbNameFormControl=new E("");uiLangIsSaving=!1;uiLangFormControl=new E("");uiThemeIsSaving=!1;uiThemeFormControl=new E("");uiLightIsSaving=!1;uiLightFormControl=new E("");uiMenuIsSaving=!1;uiMenuFormControl=new E("");uiTempIsSaving=!1;uiTempFormControl=new E("");hbDebugIsSaving=!1;hbDebugFormControl=new E(!1);hbInsecureIsSaving=!1;hbInsecureFormControl=new E(!1);hbKeepIsSaving=!1;hbKeepFormControl=new E(!1);hbEnvDebugIsSaving=!1;hbEnvDebugFormControl=new E("");hbEnvNodeIsSaving=!1;hbEnvNodeFormControl=new E("");hbLogSizeIsInvalid=!1;hbLogSizeIsSaving=!1;hbLogSizeFormControl=new E(-1);hbLogTruncateIsInvalid=!1;hbLogTruncateIsSaving=!1;hbLogTruncateFormControl=new E(0);hbMDnsIsSaving=!1;hbMDnsFormControl=new E("");hbPortIsInvalid=!1;hbPortIsSaving=!1;hbPortFormControl=new E(0);uiPortIsInvalid=!1;uiPortIsSaving=!1;uiPortFormControl=new E(0);uiAuthIsSaving=!1;uiAuthFormControl=new Ie(!0);uiSessionTimeoutIsInvalid=!1;uiSessionTimeoutIsSaving=!1;uiSessionTimeoutFormControl=new E(0);uiSslTypeFormControl=new E("off");uiSslKeyIsSaving=!1;uiSslKeyFormControl=new E("");uiSslCertIsSaving=!1;uiSslCertFormControl=new E("");uiSslPfxIsSaving=!1;uiSslPfxFormControl=new E("");uiSslPassphraseIsSaving=!1;uiSslPassphraseFormControl=new E("");uiHostIsSaving=!1;uiHostFormControl=new E("");uiProxyHostIsSaving=!1;uiProxyHostFormControl=new E("");hbPackageIsSaving=!1;hbPackageFormControl=new E("");uiMetricsIsSaving=!1;uiMetricsFormControl=new E(!0);uiAccDebugIsSaving=!1;uiAccDebugFormControl=new E(!1);uiTempFileIsSaving=!1;uiTempFileFormControl=new E("");hbLinuxShutdownIsSaving=!1;hbLinuxShutdownFormControl=new E("");hbLinuxRestartIsSaving=!1;hbLinuxRestartFormControl=new E("");linkDebug='<a href="https://github.com/homebridge/homebridge-config-ui-x/wiki/Debug-Common-Values" target="_blank"><i class="fa fa-fw fa-external-link-alt primary-text"></i></a>';constructor(){}ngOnInit(){return S(this,null,function*(){this.isHbV2=this.$settings.env.homebridgeVersion.startsWith("2"),yield this.initNetworkingOptions(),this.$settings.env.serviceMode&&(yield this.initServiceModeForm()),this.hbNameFormControl.patchValue(this.$settings.env.homebridgeInstanceName),this.hbNameFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.hbNameSave(e)),this.uiLangFormControl.patchValue(this.$settings.env.lang),this.uiLangFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiLangSave(e)),this.uiThemeFormControl.patchValue(this.$settings.theme),this.uiThemeFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiThemeSave(e)),this.uiLightFormControl.patchValue(this.$settings.lightingMode),this.uiLightFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiLightSave(e)),this.uiMenuFormControl.patchValue(this.$settings.menuMode),this.uiMenuFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiMenuSave(e)),this.uiTempFormControl.patchValue(this.$settings.env.temperatureUnits),this.uiTempFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiTempSave(e)),this.hbLogSizeFormControl.patchValue(this.$settings.env.log?.maxSize),this.hbLogSizeFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.hbLogSizeSave(e)),this.hbLogTruncateFormControl.patchValue(this.$settings.env.log?.truncateSize),this.hbLogTruncateFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.hbLogTruncateSave(e)),this.uiPortFormControl.patchValue(this.$settings.env.port),this.uiPortFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiPortSave(e)),this.uiAuthFormControl.patchValue(this.$settings.formAuth),this.uiAuthFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiAuthSave(e)),this.uiSessionTimeoutFormControl.patchValue(this.$settings.sessionTimeout),this.uiSessionTimeoutFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiSessionTimeoutSave(e)),this.uiSslKeyFormControl.patchValue(this.$settings.env.ssl?.key||""),this.uiSslKeyFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiSslKeySave(e)),this.uiSslCertFormControl.patchValue(this.$settings.env.ssl?.cert||""),this.uiSslCertFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiSslCertSave(e)),this.uiSslPfxFormControl.patchValue(this.$settings.env.ssl?.pfx||""),this.uiSslPfxFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiSslPfxSave(e)),this.uiSslPassphraseFormControl.patchValue(this.$settings.env.ssl?.passphrase||""),this.uiSslPassphraseFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiSslPassphraseSave(e)),this.uiSslTypeFormControl.patchValue(this.uiSslKeyFormControl.value||this.uiSslCertFormControl.value?"keycert":this.uiSslPfxFormControl.value||this.uiSslPassphraseFormControl.value?"pfx":"off"),this.uiSslTypeFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiSslTypeSave(e)),this.uiHostFormControl.patchValue(this.$settings.env.host||""),this.uiHostFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiHostSave(e)),this.uiProxyHostFormControl.patchValue(this.$settings.env.proxyHost||""),this.uiProxyHostFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiProxyHostSave(e)),this.hbPackageFormControl.patchValue(this.$settings.env.homebridgePackagePath||""),this.hbPackageFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.hbPackageSave(e)),this.uiMetricsFormControl.patchValue(!this.$settings.env.disableServerMetricsMonitoring),this.uiMetricsFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiMetricsSave(e)),this.uiAccDebugFormControl.patchValue(this.$settings.env.accessoryControl?.debug),this.uiAccDebugFormControl.valueChanges.pipe(w(750)).subscribe(e=>this.uiAccDebugSave(e)),this.uiTempFileFormControl.patchValue(this.$settings.env.temp),this.uiTempFileFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.uiTempFileSave(e)),this.hbLinuxShutdownFormControl.patchValue(this.$settings.env.linux?.shutdown),this.hbLinuxShutdownFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.hbLinuxShutdownSave(e)),this.hbLinuxRestartFormControl.patchValue(this.$settings.env.linux?.restart),this.hbLinuxRestartFormControl.valueChanges.pipe(w(1500)).subscribe(e=>this.hbLinuxRestartSave(e))})}initServiceModeForm(){return S(this,null,function*(){try{let e=yield B(this.$api.get("/platform-tools/hb-service/homebridge-startup-settings"));this.hbDebugFormControl.patchValue(e.HOMEBRIDGE_DEBUG),this.hbDebugFormControl.valueChanges.pipe(w(750)).subscribe(o=>this.hbDebugSave(o)),this.hbInsecureFormControl.patchValue(e.HOMEBRIDGE_INSECURE),this.hbInsecureFormControl.valueChanges.pipe(w(750)).subscribe(o=>this.hbInsecureSave(o)),this.hbKeepFormControl.patchValue(e.HOMEBRIDGE_KEEP_ORPHANS),this.hbKeepFormControl.valueChanges.pipe(w(750)).subscribe(o=>this.hbKeepSave(o)),this.hbEnvDebugFormControl.patchValue(e.ENV_DEBUG),this.hbEnvDebugFormControl.valueChanges.pipe(w(1500)).subscribe(o=>this.hbEnvDebugSave(o)),this.hbEnvNodeFormControl.patchValue(e.ENV_NODE_OPTIONS),this.hbEnvNodeFormControl.valueChanges.pipe(w(1500)).subscribe(o=>this.hbEnvNodeSave(o))}catch(e){console.error(e),this.$toastr.error(e.message,this.$translate.instant("toast.title_error"))}})}initNetworkingOptions(){return S(this,null,function*(){try{yield this.getNetworkSettings(),(this.$settings.env.runningInLinux||this.$settings.env.runningInDocker||this.$settings.env.runningInSynologyPackage||this.$settings.env.runningInPackageMode)&&(this.showAvahiMdnsOption=!0,this.showResolvedMdnsOption=!0)}catch(e){console.error(e),this.$toastr.error(e.message,this.$translate.instant("toast.title_error"))}})}getNetworkSettings(){return S(this,null,function*(){return Promise.all([B(this.$api.get("/server/network-interfaces/system")),B(this.$api.get("/server/network-interfaces/bridge")),B(this.$api.get("/server/mdns-advertiser")),B(this.$api.get("/server/port"))]).then(([e,o,p,x])=>{this.adaptersAvailable=e,this.buildBridgeNetworkAdapterList(o),this.hbMDnsFormControl.patchValue(p.advertiser),this.hbMDnsFormControl.valueChanges.pipe(w(750)).subscribe(H=>this.hbMDnsSave(H)),this.hbPortFormControl.patchValue(x.port),this.hbPortFormControl.valueChanges.pipe(w(1500)).subscribe(H=>this.hbPortSave(H))})})}saveUiSettingChange(e,o){return S(this,null,function*(){try{yield B(this.$api.put("/config-editor/ui",{key:e,value:o}))}catch(p){console.error(p),this.$toastr.error(p.message,this.$translate.instant("toast.title_error"))}})}hbNameSave(e){return S(this,null,function*(){if(!e||!/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u.test(e)){this.hbNameIsInvalid=!0;return}try{this.hbNameIsSaving=!0,yield B(this.$api.put("/server/name",{value:e})),this.$settings.setEnvItem("homebridgeInstanceName",e),this.hbNameIsInvalid=!1}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbNameIsSaving=!1},1e3)}})}uiLangSave(e){return S(this,null,function*(){try{this.uiLangIsSaving=!0,this.$settings.setLang(e),yield this.saveUiSettingChange("lang",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiLangIsSaving=!1},1e3)}})}uiThemeSave(e){return S(this,null,function*(){try{this.uiThemeIsSaving=!0,this.$settings.setTheme(e),yield this.saveUiSettingChange("theme",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiThemeIsSaving=!1},1e3)}})}uiLightSave(e){return S(this,null,function*(){try{this.uiLightIsSaving=!0,this.$settings.setLightingMode(e,"user"),yield this.saveUiSettingChange("lightingMode",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiLightIsSaving=!1},1e3)}})}uiMenuSave(e){return S(this,null,function*(){try{this.uiMenuIsSaving=!0,this.$settings.setMenuMode(e),yield this.saveUiSettingChange("menuMode",e),window.location.reload()}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiMenuIsSaving=!1},1e3)}})}uiTempSave(e){return S(this,null,function*(){try{this.uiTempIsSaving=!0,this.$settings.setEnvItem("temperatureUnits",e),yield this.saveUiSettingChange("tempUnits",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiTempIsSaving=!1},1e3)}})}hbDebugSave(e){return S(this,null,function*(){try{this.hbDebugIsSaving=!0,yield B(this.$api.put("/platform-tools/hb-service/homebridge-startup-settings",{HOMEBRIDGE_DEBUG:e,HOMEBRIDGE_KEEP_ORPHANS:this.hbKeepFormControl.value,HOMEBRIDGE_INSECURE:this.hbInsecureFormControl.value,ENV_DEBUG:this.hbEnvDebugFormControl.value,ENV_NODE_OPTIONS:this.hbEnvNodeFormControl.value}))}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbDebugIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}hbInsecureSave(e){return S(this,null,function*(){try{this.hbInsecureIsSaving=!0,yield B(this.$api.put("/platform-tools/hb-service/homebridge-startup-settings",{HOMEBRIDGE_DEBUG:this.hbDebugFormControl.value,HOMEBRIDGE_KEEP_ORPHANS:this.hbKeepFormControl.value,HOMEBRIDGE_INSECURE:e,ENV_DEBUG:this.hbEnvDebugFormControl.value,ENV_NODE_OPTIONS:this.hbEnvNodeFormControl.value}))}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbInsecureIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}hbKeepSave(e){return S(this,null,function*(){try{this.hbKeepIsSaving=!0,yield B(this.$api.put("/platform-tools/hb-service/homebridge-startup-settings",{HOMEBRIDGE_DEBUG:this.hbDebugFormControl.value,HOMEBRIDGE_KEEP_ORPHANS:e,HOMEBRIDGE_INSECURE:this.hbInsecureFormControl.value,ENV_DEBUG:this.hbEnvDebugFormControl.value,ENV_NODE_OPTIONS:this.hbEnvNodeFormControl.value}))}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbKeepIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}hbEnvDebugSave(e){return S(this,null,function*(){try{this.hbEnvDebugIsSaving=!0,yield B(this.$api.put("/platform-tools/hb-service/homebridge-startup-settings",{HOMEBRIDGE_DEBUG:this.hbDebugFormControl.value,HOMEBRIDGE_KEEP_ORPHANS:this.hbKeepFormControl.value,HOMEBRIDGE_INSECURE:this.hbInsecureFormControl.value,ENV_DEBUG:e,ENV_NODE_OPTIONS:this.hbEnvNodeFormControl.value}))}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbEnvDebugIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}hbEnvNodeSave(e){return S(this,null,function*(){try{this.hbEnvNodeIsSaving=!0,yield B(this.$api.put("/platform-tools/hb-service/homebridge-startup-settings",{HOMEBRIDGE_DEBUG:this.hbDebugFormControl.value,HOMEBRIDGE_KEEP_ORPHANS:this.hbKeepFormControl.value,HOMEBRIDGE_INSECURE:this.hbInsecureFormControl.value,ENV_DEBUG:this.hbEnvDebugFormControl.value,ENV_NODE_OPTIONS:e}))}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbEnvNodeIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}hbLogSizeSave(e){return S(this,null,function*(){if(e&&(typeof e!="number"||e<-1||Number.isInteger(e)===!1)){this.hbLogSizeIsInvalid=!0;return}try{this.hbLogSizeIsSaving=!0,this.$settings.setEnvItem("log.maxSize",e),(!e||e===-1)&&(yield this.saveUiSettingChange("log.truncateSize",null),this.hbLogTruncateIsInvalid=!1),yield this.saveUiSettingChange("log.maxSize",e),this.hbLogSizeIsInvalid=!1}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbLogSizeIsSaving=!1,this.showRestartToast()},1e3)}})}hbLogTruncateSave(e){return S(this,null,function*(){if(e&&(typeof e!="number"||e<0||Number.isInteger(e)===!1)){this.hbLogTruncateIsInvalid=!0;return}try{this.hbLogTruncateIsSaving=!0,this.$settings.setEnvItem("log.truncateSize",e),yield this.saveUiSettingChange("log.truncateSize",e),this.hbLogTruncateIsInvalid=!1}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbLogTruncateIsSaving=!1,this.showRestartToast()},1e3)}})}hbMDnsSave(e){return S(this,null,function*(){try{this.hbMDnsIsSaving=!0,yield B(this.$api.put("/server/mdns-advertiser",{advertiser:e}))}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbMDnsIsSaving=!1,this.showRestartToast()},1e3)}})}hbPortSave(e){return S(this,null,function*(){if(e===this.uiPortFormControl.value){this.hbPortIsInvalid=!0;return}try{this.hbPortIsSaving=!0,yield B(this.$api.put("/server/port",{port:e})),this.hbPortIsInvalid=!1}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbPortIsSaving=!1,this.showRestartToast()},1e3)}})}uiPortSave(e){return S(this,null,function*(){if(!e||typeof e!="number"||e<1025||e>65533||Number.isInteger(e)===!1||e===this.hbPortFormControl.value){this.uiPortIsInvalid=!0;return}try{this.uiPortIsSaving=!0,this.$settings.setEnvItem("port",e),yield this.saveUiSettingChange("port",e),this.uiPortIsInvalid=!1}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiPortIsSaving=!1,this.showRestartToast()},1e3)}})}uiAuthSave(e){return S(this,null,function*(){try{this.uiAuthIsSaving=!0,this.$settings.setItem("formAuth",e),yield this.saveUiSettingChange("auth",e?"form":"none")}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiAuthIsSaving=!1,this.showRestartToast()},1e3)}})}uiSessionTimeoutSave(e){return S(this,null,function*(){if(e&&(typeof e!="number"||e<600||e>864e5||Number.isInteger(e)===!1)){this.uiSessionTimeoutIsInvalid=!0;return}try{this.uiSessionTimeoutIsSaving=!0,this.$settings.setItem("sessionTimeout",e),yield this.saveUiSettingChange("sessionTimeout",e),this.uiSessionTimeoutIsInvalid=!1}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiSessionTimeoutIsSaving=!1,this.showRestartToast()},1e3)}})}uiSslKeySave(e){return S(this,null,function*(){try{this.uiSslKeyIsSaving=!0,this.$settings.setEnvItem("ssl.key",e),yield this.saveUiSettingChange("ssl.key",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiSslKeyIsSaving=!1,this.showRestartToast()},1e3)}})}uiSslCertSave(e){return S(this,null,function*(){try{this.uiSslCertIsSaving=!0,this.$settings.setEnvItem("ssl.cert",e),yield this.saveUiSettingChange("ssl.cert",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiSslCertIsSaving=!1,this.showRestartToast()},1e3)}})}uiSslPfxSave(e){return S(this,null,function*(){try{this.uiSslPfxIsSaving=!0,this.$settings.setEnvItem("ssl.pfx",e),yield this.saveUiSettingChange("ssl.pfx",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiSslPfxIsSaving=!1,this.showRestartToast()},1e3)}})}uiSslPassphraseSave(e){return S(this,null,function*(){try{this.uiSslPassphraseIsSaving=!0,this.$settings.setEnvItem("ssl.passphrase",e),yield this.saveUiSettingChange("ssl.passphrase",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiSslPassphraseIsSaving=!1,this.showRestartToast()},1e3)}})}uiSslTypeSave(e){return S(this,null,function*(){switch(e){case"keycert":this.uiSslPfxFormControl.patchValue("",{emitEvent:!1}),this.uiSslPassphraseFormControl.patchValue("",{emitEvent:!1}),this.$settings.setEnvItem("ssl.pfx",""),this.$settings.setEnvItem("ssl.passphrase","");break;case"pfx":this.uiSslKeyFormControl.patchValue("",{emitEvent:!1}),this.uiSslCertFormControl.patchValue("",{emitEvent:!1}),this.$settings.setEnvItem("ssl.key",""),this.$settings.setEnvItem("ssl.cert","");break;default:this.uiSslKeyFormControl.patchValue("",{emitEvent:!1}),this.uiSslCertFormControl.patchValue("",{emitEvent:!1}),this.uiSslPfxFormControl.patchValue("",{emitEvent:!1}),this.uiSslPassphraseFormControl.patchValue("",{emitEvent:!1}),this.$settings.setEnvItem("ssl.key",""),this.$settings.setEnvItem("ssl.cert",""),this.$settings.setEnvItem("ssl.pfx",""),this.$settings.setEnvItem("ssl.passphrase",""),yield this.saveUiSettingChange("ssl",""),this.showRestartToast()}})}uiHostSave(e){return S(this,null,function*(){try{this.uiHostIsSaving=!0,this.$settings.setEnvItem("host",e),yield this.saveUiSettingChange("host",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiHostIsSaving=!1,this.showRestartToast()},1e3)}})}uiProxyHostSave(e){return S(this,null,function*(){try{this.uiProxyHostIsSaving=!0,this.$settings.setEnvItem("proxyHost",e),yield this.saveUiSettingChange("proxyHost",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiProxyHostIsSaving=!1,this.showRestartToast()},1e3)}})}hbPackageSave(e){return S(this,null,function*(){try{this.hbPackageIsSaving=!0,this.$settings.setEnvItem("homebridgePackagePath",e),yield this.saveUiSettingChange("homebridgePackagePath",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbPackageIsSaving=!1,this.showRestartToast()},1e3)}})}uiMetricsSave(e){return S(this,null,function*(){try{this.uiMetricsIsSaving=!0,this.$settings.setEnvItem("disableServerMetricsMonitoring",!e),yield this.saveUiSettingChange("disableServerMetricsMonitoring",!e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiMetricsIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}uiAccDebugSave(e){return S(this,null,function*(){try{this.uiAccDebugIsSaving=!0,this.$settings.setEnvItem("accessoryControl.debug",e),yield this.saveUiSettingChange("accessoryControl.debug",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiAccDebugIsSaving=!1,this.showRestartToast()},1e3)}})}uiTempFileSave(e){return S(this,null,function*(){try{this.uiTempFileIsSaving=!0,this.$settings.setEnvItem("temp",e),yield this.saveUiSettingChange("temp",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.uiTempFileIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}hbLinuxShutdownSave(e){return S(this,null,function*(){try{this.hbLinuxShutdownIsSaving=!0,this.$settings.setEnvItem("linux.shutdown",e),yield this.saveUiSettingChange("linux.shutdown",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbLinuxShutdownIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}hbLinuxRestartSave(e){return S(this,null,function*(){try{this.hbLinuxRestartIsSaving=!0,this.$settings.setEnvItem("linux.restart",e),yield this.saveUiSettingChange("linux.restart",e)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{this.hbLinuxRestartIsSaving=!1,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>this.showRestartToast(),error:o=>{console.error(o),this.showRestartToast()}})},1e3)}})}openUiSettings(){this.$plugin.settings({name:"homebridge-config-ui-x",displayName:"Homebridge UI",settingsSchema:!0,links:{}})}openBackupModal(){this.$modal.open(re,{size:"lg",backdrop:"static"})}openWallpaperModal(){this.$modal.open(Xe,{size:"lg",backdrop:"static"})}resetHomebridgeState(){this.$modal.open(je,{size:"lg",backdrop:"static"})}unpairAccessory(){this.$modal.open(Qe,{size:"lg",backdrop:"static"})}removeAllCachedAccessories(){this.$modal.open(Ke,{size:"lg",backdrop:"static"})}accessoryUiControl(){return S(this,null,function*(){try{let e=this.$modal.open(Oe,{size:"lg",backdrop:"static"});e.componentInstance.existingBlacklist=this.$settings.env.accessoryControl?.instanceBlacklist||[],yield e.result,this.showRestartToast()}catch(e){e!=="Dismiss"&&(console.error(e),this.$toastr.error(e.message,this.$translate.instant("toast.title_error")))}})}removeSingleCachedAccessories(){this.$modal.open(Ve,{size:"lg",backdrop:"static"})}removeBridgeAccessories(){this.$modal.open(Ge,{size:"lg",backdrop:"static"})}selectNetworkInterfaces(){return S(this,null,function*(){let e=this.$modal.open(Je,{size:"lg",backdrop:"static"});e.componentInstance.adaptersAvailable=this.adaptersAvailable;try{let o=yield e.result;this.buildBridgeNetworkAdapterList(o),yield B(this.$api.put("/server/network-interfaces/bridge",{adapters:o})),this.showRestartToast()}catch(o){o!=="Dismiss"&&(console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error")))}})}buildBridgeNetworkAdapterList(e){if(!e.length){this.adaptersSelected=[];return}this.adaptersSelected=e.map(o=>{let p=this.adaptersAvailable.find(x=>x.iface===o);return p?{iface:p.iface,selected:!0,missing:!1,ip4:p.ip4,ip6:p.ip6}:{iface:o,selected:!0,missing:!0}})}toggleSection(e){this.showFields[e]=!this.showFields[e]}showRestartToast(){if(!this.restartToastIsShown){this.restartToastIsShown=!0;let e=this.$toastr.info(this.$translate.instant("settings.changes.saved"),this.$translate.instant("menu.hbrestart.title"),{timeOut:0,closeButton:!1,tapToDismiss:!0,disableTimeOut:!0,positionClass:"toast-bottom-right",enableHtml:!0});e&&e.onTap&&e.onTap.subscribe(()=>{this.$router.navigate(["/restart"])})}}static \u0275fac=function(o){return new(o||i)};static \u0275cmp=$({type:i,selectors:[["ng-component"]],decls:40,vars:56,consts:[[1,"primary-text","m-0"],[1,"my-4"],["role","button","tabindex","0",1,"mt-3","hover-pointer",3,"click"],[1,"primary-text"],[1,"fa","fa-fw",3,"ngClass"],["id","fieldsGeneral",1,"list-group","list-group-box","mt-2","mx-0"],["id","fieldsDisplay",1,"list-group","list-group-box","mt-2","mx-0"],["id","fieldsNetwork",1,"list-group","list-group-box","mt-2","mx-0"],["id","fieldsSecurity",1,"list-group","list-group-box","mt-2","mx-0"],[1,"small","grey-text","mb-2","mx-0"],["id","fieldsReset",1,"list-group","list-group-box","mt-2","mx-0"],[1,"pb-3"],[1,"list-group-item","d-block","d-md-flex","justify-content-between","align-items-center"],[1,"my-3","my-md-0","pl-0","pl-md-5","w-auto","d-flex","align-items-center"],["type","text",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl","ngClass"],[1,"fas","fa-fw","fa-floppy-disk","primary-text","fa-xl","me-0","me-md-2","ms-2","ms-md-0","order-2","order-md-1"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"pe-2"],[1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px",3,"click"],[1,"fas","fa-fw","fa-arrow-right"],["routerLink","/users",1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px"],[1,"my-3","my-md-0","ps-0","ps-md-5","w-auto","d-flex","align-items-center"],[1,"custom-select","resp-select","order-1","order-md-2",3,"formControl"],["value","auto"],["value","bg"],["value","ca"],["value","zh-CN"],["value","zh-TW"],["value","cs"],["value","nl"],["value","en"],["value","fi"],["value","fr"],["value","de"],["value","he"],["value","hu"],["value","id"],["value","it"],["value","ja"],["value","ko"],["value","mk"],["value","no"],["value","pl"],["value","pt-BR"],["value","pt"],["value","ru"],["value","sl"],["value","es"],["value","sv"],["value","th"],["value","tr"],["value","uk"],["value","orange"],["value","red"],["value","pink"],["value","purple"],["value","deep-purple"],["value","indigo"],["value","blue"],["value","blue-grey"],["value","cyan"],["value","green"],["value","teal"],["value","grey"],["value","brown"],["value","light"],["value","dark"],["value","default"],["value","freeze"],["value","c"],["value","f"],["id","fieldsStartup",1,"list-group","list-group-box","mb-4","mx-0"],[1,"grey-text","pe-2"],["type","number","min","-1","placeholder","1000000",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl","ngClass"],[1,"d-flex","align-items-center"],[1,"order-1","order-md-2"],["type","checkbox","id","homebridgeDebugMode",1,"rendux-input",3,"formControl"],["for","homebridgeDebugMode",1,"rendux-label","ms-3",2,"min-width","50px"],["type","checkbox","id","homebridgeInsecureMode",1,"rendux-input",3,"formControl"],["for","homebridgeInsecureMode",1,"rendux-label","ms-3",2,"min-width","50px"],["type","checkbox","id","homebridgeKeepOrphans",1,"rendux-input",3,"formControl"],["for","homebridgeKeepOrphans",1,"rendux-label","ms-3",2,"min-width","50px"],["type","checkbox","id","homebridgeMetrics",1,"rendux-input",3,"formControl"],["for","homebridgeMetrics",1,"rendux-label","ms-3",2,"min-width","50px"],["type","text","placeholder","/usr/local/lib/node_modules/homebridge",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],[1,"font-monospace"],[1,"grey-text","pe-2",3,"innerHTML"],["type","text","placeholder","HAP-NodeJS:Advertiser,HAP-NodeJS:Service",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["type","text","placeholder","--max-old-space-size=512 --max-http-header-size=8192",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["type","text","placeholder","shutdown",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["type","text","placeholder","reboot",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["type","text","placeholder","/sys/class/thermal/thermal_zone0/temp",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["routerLink","/platform-tools/docker/startup-script",1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px"],["type","number","min","0","placeholder","200000",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl","ngClass"],[1,"small","grey-text","pe-2"],[1,"badge","badge-primary","me-1",3,"ngClass"],[1,"btn","btn-primary","waves-effect","m-0","ms-3",2,"min-width","50px",3,"click","disabled"],["value","avahi"],["value","ciao"],["value","bonjour-hap"],["value","resolved"],["type","number","min","1025","max","65533",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl","ngClass"],["type","number","min","1025","max","65533","placeholder","8581",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl","ngClass"],[1,"grey-text","pe-2",3,"innerHtml"],["type","text","pattern","^[^{}/ :\\\\]+(?::\\d+)?$","placeholder","0.0.0.0",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["type","text","pattern","^[^{}/ :\\\\]+(?::\\d+)?$","placeholder","example.com:8443",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],[1,"fas","fa-fw","fa-exclamation-triangle"],[1,"fw-normal"],["type","checkbox","id","uiAuthForm",1,"rendux-input",3,"formControl"],["for","uiAuthForm",1,"rendux-label","ms-3",2,"min-width","50px"],["value","off"],["value","keycert"],["value","pfx"],["type","number","min","600","max","86400000","placeholder","28800",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl","ngClass"],["type","text","placeholder","/Users/.../certs/server.key",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["type","text","placeholder","/Users/.../certs/server.crt",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["type","text","placeholder","/Users/.../certs/server.pfx",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"formControl"],["placeholder","mypassphrase",1,"form-control","custom-input","resp-input","order-1","order-md-2",3,"focus","blur","type","formControl"],["id","fieldsCache",1,"list-group","list-group-box","mb-4","mx-0"],["type","checkbox","id","accessoryDebug",1,"rendux-input",3,"formControl"],["for","accessoryDebug",1,"rendux-label","ms-3",2,"min-width","50px"]],template:function(o,p){o&1&&(n(0,"h3",0),l(1),r(2,"translate"),a(),n(3,"div",1)(4,"div",2),f("click",function(){return p.toggleSection("general")}),n(5,"h5",3),d(6,"i",4),l(7),r(8,"translate"),a()(),_(9,Ci,30,29,"ul",5),a(),n(10,"div",1)(11,"div",2),f("click",function(){return p.toggleSection("display")}),n(12,"h5",3),d(13,"i",4),l(14),r(15,"translate"),a()(),_(16,wi,157,94,"ul",6),a(),_(17,Ki,6,10),n(18,"div",2),f("click",function(){return p.toggleSection("network")}),n(19,"h5",3),d(20,"i",4),l(21),r(22,"translate"),a()(),_(23,tn,80,76,"ul",7),n(24,"div",2),f("click",function(){return p.toggleSection("security")}),n(25,"h5",3),d(26,"i",4),l(27),r(28,"translate"),a()(),_(29,mn,49,42,"ul",8),_(30,gn,8,11,"div",1),n(31,"div",1)(32,"div",2),f("click",function(){return p.toggleSection("reset")}),n(33,"h5",3),d(34,"i",4),l(35),r(36,"translate"),a()(),_(37,bn,3,3,"p",9),_(38,fn,14,12,"ul",10),a(),d(39,"div",11)),o&2&&(t(),u(s(2,29,"menu.settings.title")),t(3),v("aria-expanded",p.showFields.general?"true":"false")("aria-controls","fieldsGeneral"),t(2),m("ngClass",T(41,j,p.showFields.general,!p.showFields.general)),t(),g(" ",s(8,31,"settings.general.title_general")," "),t(2),h(p.showFields.general?9:-1),t(2),v("aria-expanded",p.showFields.display?"true":"false")("aria-controls","fieldsDisplay"),t(2),m("ngClass",T(44,j,p.showFields.display,!p.showFields.display)),t(),g(" ",s(15,33,"settings.general.title_display")," "),t(2),h(p.showFields.display?16:-1),t(),h(p.$settings.env.serviceMode||p.$settings.env.runningInDocker?17:-1),t(),v("aria-expanded",p.showFields.network?"true":"false")("aria-controls","fieldsNetwork"),t(2),m("ngClass",T(47,j,p.showFields.network,!p.showFields.network)),t(),g(" ",s(22,35,"settings.network.title_network")," "),t(2),h(p.showFields.network?23:-1),t(),v("aria-expanded",p.showFields.security?"true":"false")("aria-controls","fieldsSecurity"),t(2),m("ngClass",T(50,j,p.showFields.security,!p.showFields.security)),t(),g(" ",s(28,37,"settings.network.title_security")," "),t(2),h(p.showFields.security?29:-1),t(),h(p.$settings.env.serviceMode?30:-1),t(2),v("aria-expanded",p.showFields.reset?"true":"false")("aria-controls","fieldsReset"),t(2),m("ngClass",T(53,j,p.showFields.reset,!p.showFields.reset)),t(),g(" ",s(36,39,"reset.bridges.title")," "),t(2),h(p.showFields.reset?37:-1),t(),h(p.showFields.reset?38:-1))},dependencies:[U,Me,Y,Te,$e,ie,Ee,J,Be,X,Pe,Re,Fe,Z,ne,Q,F],encapsulation:2,data:{animation:[ke("fadeInOut",[de(":enter",[te({opacity:0}),pe("750ms",te({opacity:1}))]),de(":leave",[pe("750ms",te({opacity:0}))])])]}})}return i})();export{Oe as a,re as b,Ke as c,je as d,Je as e,Xe as f,Do as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as a}from"./chunk-CPUG2M2H.js";import"./chunk-H6USGONO.js";import"./chunk-KEJUCLLQ.js";import"./chunk-CEC3XQIL.js";import"./chunk-FIDKTTX5.js";import"./chunk-L7P4OVCU.js";import"./chunk-DQBVZWYJ.js";import"./chunk-VK5TOJI7.js";import"./chunk-Y6TXYIFY.js";import"./chunk-ANCTYTNR.js";import"./chunk-YWKZ3P6I.js";import"./chunk-FMIYWTUO.js";import"./chunk-2EMPNH2X.js";import"./chunk-EJ3RNOUF.js";import"./chunk-ZOLUFCSO.js";import"./chunk-ELWVABN2.js";import"./chunk-JRX7HEQF.js";import"./chunk-75IBFLA3.js";import"./chunk-RTFEC5XJ.js";import"./chunk-FDPTBVVC.js";import"./chunk-GOW5VSYJ.js";import"./chunk-NR37MAXW.js";export{a as SettingsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as pe}from"./chunk-N5JHQPQR.js";import{m as le}from"./chunk-FRA2KM7O.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-NR37MAXW.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={};constructor(){}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{c as pe}from"./chunk-JRX7HEQF.js";import{m as le}from"./chunk-RTFEC5XJ.js";import{f as We,ga as fe,k as he,la as ue,n as X}from"./chunk-NR37MAXW.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={};constructor(){}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};
|