homebridge-config-ui-x 5.0.1-beta.1 → 5.0.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/auth/auth.controller.d.ts +6 -0
- package/dist/core/config/config.service.d.ts +9 -0
- package/dist/core/config/config.service.js +3 -0
- package/dist/core/config/config.service.js.map +1 -1
- package/dist/globalDefaults.js +3 -0
- package/dist/globalDefaults.js.map +1 -1
- package/dist/modules/platform-tools/terminal/terminal.gateway.d.ts +1 -0
- package/dist/modules/platform-tools/terminal/terminal.gateway.js +9 -0
- package/dist/modules/platform-tools/terminal/terminal.gateway.js.map +1 -1
- package/dist/modules/platform-tools/terminal/terminal.service.d.ts +9 -0
- package/dist/modules/platform-tools/terminal/terminal.service.js +156 -6
- package/dist/modules/platform-tools/terminal/terminal.service.js.map +1 -1
- package/package.json +2 -2
- package/public/{chunk-FPLWS5WP.js → chunk-2ZY66HU7.js} +1 -1
- package/public/{chunk-ETFLC24E.js → chunk-3U6QGJSS.js} +1 -1
- package/public/{chunk-PRMVT3SQ.js → chunk-46756LXW.js} +1 -1
- package/public/{chunk-WNQA5E2O.js → chunk-4KUE6YWH.js} +1 -1
- package/public/{chunk-NCZ7M3AB.js → chunk-4SOMPTAR.js} +1 -1
- package/public/{chunk-SR7XEHET.js → chunk-5D2W3NRI.js} +1 -1
- package/public/{chunk-CNNTXFBF.js → chunk-5DVKTLYT.js} +1 -1
- package/public/{chunk-PT72GTGE.js → chunk-5OQQNPUZ.js} +1 -1
- package/public/chunk-6JWROI2O.js +1 -0
- package/public/{chunk-VLNYF5AS.js → chunk-75U46IUB.js} +1 -1
- package/public/{chunk-3WACEBJM.js → chunk-7JLBC46N.js} +1 -1
- package/public/chunk-DOPUE6VY.js +1 -0
- package/public/{chunk-HIAE32S7.js → chunk-E6AXXGJG.js} +1 -1
- package/public/chunk-FKMJM5SF.js +5 -0
- package/public/{chunk-5VP77P7I.js → chunk-FMXCMVVR.js} +1 -1
- package/public/{chunk-IV4ZCEWF.js → chunk-FRRNHZV2.js} +1 -1
- package/public/{chunk-6HXGDQKN.js → chunk-FZYJ5GFN.js} +1 -1
- package/public/{chunk-YHQ4H2LV.js → chunk-GEW23QRK.js} +1 -1
- package/public/{chunk-5ELTAW44.js → chunk-GUBJ2A4H.js} +1 -1
- package/public/{chunk-PQR6HK2C.js → chunk-IX2TTA5F.js} +1 -1
- package/public/chunk-JSYOOM36.js +1 -0
- package/public/chunk-L77GHHTR.js +1 -0
- package/public/{chunk-FZM6AHK2.js → chunk-LIEJVB5Q.js} +1 -1
- package/public/{chunk-736V2KJB.js → chunk-LQOMUED6.js} +2 -2
- package/public/{chunk-RFGGDHFG.js → chunk-LR2447JF.js} +1 -1
- package/public/{chunk-UD6SW2QN.js → chunk-MIKINJTY.js} +1 -1
- package/public/{chunk-B55QOQVD.js → chunk-MKIYPB66.js} +1 -1
- package/public/{chunk-IHSOZF6N.js → chunk-MTXPJSYL.js} +1 -1
- package/public/{chunk-4NAUGWMH.js → chunk-NPZDIWIK.js} +1 -1
- package/public/chunk-NY74VDP2.js +1 -0
- package/public/{chunk-6FHUI6EC.js → chunk-QWKNRO32.js} +1 -1
- package/public/{chunk-CSB4ROBA.js → chunk-R4QILPTG.js} +1 -1
- package/public/{chunk-UVNR77PB.js → chunk-R6RSWBJN.js} +1 -1
- package/public/{chunk-4G62IPBL.js → chunk-RBDCCLWM.js} +1 -1
- package/public/{chunk-JN7YT2VS.js → chunk-REEIAZQJ.js} +1 -1
- package/public/{chunk-S2ZVRZCY.js → chunk-SGIVJQSI.js} +1 -1
- package/public/{chunk-XJ2MUFCV.js → chunk-SYVFKU6H.js} +1 -1
- package/public/{chunk-6HNZZKA3.js → chunk-SZ7NGZPH.js} +1 -1
- package/public/{chunk-LWKJJ5PU.js → chunk-U63AU3G7.js} +1 -1
- package/public/{chunk-TZFHB7AU.js → chunk-UUKXIRK2.js} +1 -1
- package/public/{chunk-52ICMLXG.js → chunk-WBRCM3FA.js} +1 -1
- package/public/{chunk-3K4AKQIG.js → chunk-X6PPS33O.js} +1 -1
- package/public/{chunk-7BGQ3WIH.js → chunk-YKNOB4TB.js} +1 -1
- package/public/{chunk-KM7BRFHX.js → chunk-YULH3R7B.js} +1 -1
- package/public/{chunk-TOLEK5UA.js → chunk-ZNBLT233.js} +1 -1
- package/public/index.html +1 -1
- package/public/main-PZ5X6BVU.js +1 -0
- package/public/chunk-2E7ZORGV.js +0 -5
- package/public/chunk-5QJD4F5J.js +0 -1
- package/public/chunk-A3GG65TX.js +0 -1
- package/public/chunk-CHYWVK3W.js +0 -1
- package/public/chunk-UJNY5BYT.js +0 -1
- package/public/chunk-ZCSPADUX.js +0 -1
- package/public/main-7VIDFQBH.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as r}from"./chunk-ZJ3JJYIN.js";import"./chunk-HBOWJDR5.js";import{ha as t,nb as e}from"./chunk-ULJPS3WS.js";var m=[{path:"",loadComponent:()=>import("./chunk-
|
|
1
|
+
import{g as r}from"./chunk-ZJ3JJYIN.js";import"./chunk-HBOWJDR5.js";import{ha as t,nb as e}from"./chunk-ULJPS3WS.js";var m=[{path:"",loadComponent:()=>import("./chunk-U63AU3G7.js").then(o=>o.PowerOptionsComponent)}],n=(()=>{class o{static \u0275fac=function(i){return new(i||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[r.forChild(m),r]})}return o})();var d=(()=>{class o{static \u0275fac=function(i){return new(i||o)};static \u0275mod=e({type:o});static \u0275inj=t({imports:[n]})}return o})();export{d as PowerOptionsModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-SYVFKU6H.js";import"./chunk-5DVKTLYT.js";import"./chunk-QWKNRO32.js";import"./chunk-YJWU65EW.js";import"./chunk-C3HWKB2Q.js";import"./chunk-WFYBML4S.js";import"./chunk-75U46IUB.js";import"./chunk-X6PPS33O.js";import{g as i}from"./chunk-ZJ3JJYIN.js";import"./chunk-JSYOOM36.js";import"./chunk-2ZY66HU7.js";import"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{ha as e,nb as t}from"./chunk-ULJPS3WS.js";var u=[{path:"",loadComponent:()=>import("./chunk-GUBJ2A4H.js").then(o=>o.AccessoriesComponent)}],c=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=t({type:o});static \u0275inj=e({imports:[i.forChild(u),i]})}return o})();var l=(()=>{class o{static \u0275fac=function(r){return new(r||o)};static \u0275mod=t({type:o});static \u0275inj=e({imports:[s,c]})}return o})();export{l as AccessoriesModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-75U46IUB.js";import"./chunk-X6PPS33O.js";import{d as E}from"./chunk-ZJ3JJYIN.js";import{b as R}from"./chunk-JSYOOM36.js";import{k as O,n as B}from"./chunk-2ZY66HU7.js";import{a as k,b as I}from"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{Dc as b,Ec as g,Hc as o,Ib as f,Ic as l,Jb as _,Ob as x,Pb as r,Qb as n,Rb as v,_b as $,ab as i,bc as S,dc as d,id as T,la as m,mb as w,qc as a,ra as C,rc as c,sa as y,sc as h}from"./chunk-ULJPS3WS.js";var U=(t,p)=>({"fas fa-fw fa-spinner fa-spin":t,"far fa-fw fa-check-circle":p}),F=t=>({"grey-text":t}),P=(t,p)=>({"far fa-fw fa-circle":t,"fas fa-fw fa-spinner fa-spin":p});function j(t,p){if(t&1&&(r(0,"div",7),a(1),n()),t&2){let e=d();i(),c(e.error)}}function M(t,p){if(t&1&&(r(0,"p",9),a(1),o(2,"translate"),n(),r(3,"div",10)(4,"div",11)(5,"span"),v(6,"i",12),a(7),o(8,"translate"),n()(),r(9,"div",11)(10,"span",12),v(11,"i",12),a(12),o(13,"translate"),n()()()),t&2){let e=d();i(),c(l(2,6,"restart.please_wait_while_server_restarts")),i(5),x("ngClass",g(12,U,!e.uiOnline,e.uiOnline)),i(),h(" ",l(8,8,"restart.ui_online")," "),i(3),x("ngClass",b(15,F,!e.uiOnline)),i(),x("ngClass",g(17,P,!e.uiOnline,e.uiOnline)),i(),h(" ",l(13,10,"restart.service_ready")," ")}}function V(t,p){if(t&1){let e=$();r(0,"p",15)(1,"button",16),S("click",function(){C(e);let u=d(2);return y(u.viewLogs())}),a(2),o(3,"translate"),n()()}t&2&&(i(2),c(l(3,1,"menu.tooltip_view_logs")))}function z(t,p){if(t&1&&(r(0,"div",8)(1,"p"),a(2),o(3,"translate"),n(),r(4,"p",13),a(5),o(6,"translate"),r(7,"span",14),a(8),n()(),f(9,V,4,3,"p",15),n()),t&2){let e=d();i(2),c(l(3,4,"restart.server_is_taking_long_time_to_restart")),i(3),h(" ",l(6,6,"restart.label_restart_command_executed"),": "),i(3),c(e.resp.command||"End Process"),i(),_(e.uiOnline?9:-1)}}var X=(()=>{class t{$api=m(B);$router=m(E);$settings=m(R);$toastr=m(O);$translate=m(k);$ws=m(D);checkTimeout;checkDelay;io;uiOnline=!1;error=!1;resp={};timeout=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("status"),this.io.connected.subscribe(()=>{this.io.socket.emit("monitor-server-status"),this.$settings.getAppSettings().catch(()=>{})}),this.$router.parseUrl(this.$router.url).queryParams.restarting?(this.uiOnline=!0,this.checkIfServerUp()):this.$api.put("/server/restart",{}).subscribe({next:s=>{this.resp=s,this.checkIfServerUp(),s.restartingUI||(this.uiOnline=!0)},error:s=>{console.error(s),this.error=this.$translate.instant("restart.toast_server_restart_error"),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}})}viewLogs(){this.$router.navigate(["/logs"])}ngOnDestroy(){this.io.end(),clearTimeout(this.checkDelay),clearTimeout(this.checkTimeout)}checkIfServerUp(){this.checkDelay=setTimeout(()=>{this.io.socket.on("homebridge-status",e=>{this.uiOnline=!0,(e.status==="up"||e.status==="pending")&&(this.$toastr.success(this.$translate.instant("restart.toast_server_restarted"),this.$translate.instant("toast.title_success")),this.$router.navigate(["/"]))})},7e3),this.checkTimeout=setTimeout(()=>{this.$toastr.warning(this.$translate.instant("restart.toast_server_restart_timeout"),this.$translate.instant("toast.title_warning"),{timeOut:1e4}),this.timeout=!0},4e4)}static \u0275fac=function(s){return new(s||t)};static \u0275cmp=w({type:t,selectors:[["ng-component"]],decls:14,vars:8,consts:[[1,"d-flex","justify-content-between"],[1,"primary-text","m-0"],[1,"my-4","align-items-center",2,"max-width","1000px","margin","auto"],[1,"w-100","text-center","primary-text","mb-5"],[1,"fas","fa-fw","fa-power-off",2,"font-size","75px"],[1,"text-center"],[1,"primary-text","mb-4"],[1,"alert","alert-error","my-4"],[1,"alert","alert-warning","my-4"],[1,"grey-text"],[1,"justify-content-center","my-4"],[1,"restart-progress-box","primary-text"],[3,"ngClass"],[1,"grey-text","mb-0"],[1,"font-monospace"],[1,"mt-2","mb-0"],[1,"btn","btn-primary","mb-0",3,"click"]],template:function(s,u){s&1&&(r(0,"div",0)(1,"h3",1),a(2),o(3,"translate"),n()(),r(4,"div",2)(5,"div",3),v(6,"i",4),n(),r(7,"div",5)(8,"h4",6),a(9),o(10,"translate"),n(),f(11,j,2,1,"div",7)(12,M,14,20),f(13,z,10,8,"div",8),n()()),s&2&&(i(2),c(l(3,4,"menu.restart.title")),i(7),c(l(10,6,"restart.title_restart")),i(2),_(u.error?11:12),i(2),_(u.timeout?13:-1))},dependencies:[T,I],styles:[".restart-progress-box[_ngcontent-%COMP%]{font-size:22px;font-weight:300;margin-top:15px}"]})}return t})();export{X as RestartComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-QIOCGI3G.js";import{g as W,m as j,n as oe}from"./chunk-C3HWKB2Q.js";import{A as P,b as re,c as V,d as x,e as N,f as O,g as A,j as w,m as Q,o as H,p as J,q as K,x as ae,z as G}from"./chunk-WFYBML4S.js";import{b as X}from"./chunk-3K4AKQIG.js";import{b as se}from"./chunk-ZJ3JJYIN.js";import{a as ve}from"./chunk-ZCSPADUX.js";import{k,n as B}from"./chunk-FPLWS5WP.js";import{a as $,b as U}from"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{$b as L,Dc as F,Hb as u,Hc as o,Ib as h,Ic as s,Jb as g,Jc as ne,Lb as ee,Mb as te,Nb as ie,Ob as f,Pb as r,Qb as n,Rb as c,Sb as S,Tb as D,Ub as q,_b as I,ab as e,bc as _,cc as z,dc as v,g as _e,id as R,la as p,mb as y,qc as m,ra as T,rc as d,sa as M,sc as C}from"./chunk-ULJPS3WS.js";function xe(i,E){i&1&&(r(0,"ngb-alert",13)(1,"p",20),m(2),o(3,"translate"),n()()),i&2&&(f("dismissible",!1),e(2),d(s(3,2,"login.invalid_password")))}var me=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);invalidCredentials=!1;formGroup=new A({password:new w("",[x.required])});disable2fa(){this.invalidCredentials=!1,this.$api.post("/users/otp/deactivate",this.formGroup.value).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.setup_2fa_disable_success"),this.$translate.instant("toast.title_success"))},error:()=>{this.formGroup.setValue({password:""}),this.invalidCredentials=!0}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:34,vars:27,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","password","autocomplete","current-password",1,"form-control","custom-input",3,"formControl","placeholder"],["type","error",1,"mt-3","mb-0",3,"dismissible"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"mb-0"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n()(),r(14,"ul",8)(15,"li",9)(16,"label",10),m(17),o(18,"translate"),n(),r(19,"div",11),c(20,"input",12),o(21,"translate"),n()()(),h(22,xe,4,4,"ngb-alert",13),n(),r(23,"div",14)(24,"div",15)(25,"button",16),o(26,"translate"),_("click",function(){return l.dismissModal()}),m(27),o(28,"translate"),n()(),c(29,"div",17),r(30,"div",18)(31,"button",19),_("click",function(){return l.disable2fa()}),m(32),o(33,"translate"),n()()()()),a&2&&(e(3),d(s(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",s(6,13,"form.button_close")),e(7),d(s(13,15,"users.setup_2fa_disable_current_password")),e(5),d(s(18,17,"users.label_password")),e(3),f("formControl",l.formGroup.controls.password)("placeholder",s(21,19,"users.label_password")),e(2),g(l.invalidCredentials&&!l.formGroup.controls.password.value?22:-1),e(3),u("aria-label",s(26,21,"form.button_close")),e(2),C(" ",s(28,23,"form.button_close")," "),e(4),f("disabled",l.formGroup.invalid),e(),C(" ",s(33,25,"form.button_disable")," "))},dependencies:[G,V,N,P,H,W,U],encapsulation:2})}return i})();var de=_e(ve(),1);var we=i=>({timeDiffError:i});function Ce(i,E){i&1&&(r(0,"li"),m(1),o(2,"translate"),n()),i&2&&(e(),d(s(2,1,"users.setup_2fa_scan_qr_code")))}function he(i,E){if(i&1&&(r(0,"ngb-alert",8)(1,"p",16),m(2),o(3,"translate"),n(),r(4,"p",17),m(5),o(6,"translate"),n()()),i&2){let t=v();f("dismissible",!1),e(2),d(s(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),d(ne(6,5,"users.setup_2fa_server_time_out",F(8,we,t.timeDiffError)))}}function ge(i,E){if(i&1&&(r(0,"ul",9)(1,"li",18)(2,"div",19),c(3,"app-qrcode",20),n()(),r(4,"li",21)(5,"label",22),m(6),o(7,"translate"),n(),r(8,"div",23),c(9,"input",24),n()()()),i&2){let t=v();e(3),f("data",t.otpString),e(3),d(s(7,3,"users.setup_2fa_enter_code")),e(3),f("formControl",t.formGroup.controls.code)}}function Ee(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function ye(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function Se(i,E){if(i&1){let t=I();r(0,"button",26),_("click",function(){T(t);let l=v();return M(l.enable2fa())}),m(1),o(2,"translate"),n()}if(i&2){let t=v();f("disabled",t.formGroup.invalid),e(),C(" ",s(2,2,"form.button_enable")," ")}}var pe=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);user;timeDiffError=null;otpString;formGroup=new A({code:new w("",[x.required,x.minLength(6),x.maxLength(6)])});ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:t=>{this.checkTimeDiff(t.timestamp),this.timeDiffError||(this.otpString=t.otpauth)},error:t=>{this.$activeModal.dismiss(),console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_enable_error"),this.$translate.instant("toast.title_error"))}})}enable2fa(){this.$api.post("/users/otp/activate",this.formGroup.value).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.setup_2fa_enabled_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close()},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(t){let a=(0,de.default)(t).diff(new Date,"millisecond");a<-5e3||a>5e3?this.timeDiffError=a:this.timeDiffError=null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:24,vars:15,consts:[[1,"modal-content","setup2fa"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"fw-bold","mb-1"],[1,"mb-0"],[1,"list-group-item","text-center"],[1,"text-center","w-100","d-flex","justify-content-center"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","placeholder","eg. 123456","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*",1,"form-control","custom-input",3,"formControl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n(),h(14,Ce,3,3,"li"),n(),h(15,he,7,10,"ngb-alert",8),h(16,ge,10,5,"ul",9),n(),r(17,"div",10)(18,"div",11),h(19,Ee,4,6,"button",12),n(),r(20,"div",13),h(21,ye,4,6,"button",12),n(),r(22,"div",14),h(23,Se,3,4,"button",15),n()()()),a&2&&(e(3),d(s(4,9,"users.setup_2fa")),e(2),u("aria-label",s(6,11,"form.button_close")),e(7),d(s(13,13,"users.setup_2fa_warning")),e(2),g(l.timeDiffError?-1:14),e(),g(l.timeDiffError?15:-1),e(),g(l.timeDiffError?-1:16),e(3),g(l.timeDiffError?-1:19),e(2),g(l.timeDiffError?21:-1),e(2),g(l.timeDiffError?-1:23))},dependencies:[W,le,G,V,N,ae,P,H,U],encapsulation:2})}return i})();var ce=i=>({"is-invalid":i}),ue=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w("",[x.compose([x.required,x.minLength(4)])]),passwordConfirm:new w("",[x.required]),admin:new w(!0)},this.matchPassword);onSubmit({value:t}){this.$api.post("/users",t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:a=>{this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:58,vars:50,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),r(33,"li",9)(34,"label",17),m(35),o(36,"translate"),n(),r(37,"div",11),c(38,"input",18),o(39,"translate"),n()(),r(40,"li",19)(41,"span",20),m(42),o(43,"translate"),n(),r(44,"div",21),c(45,"input",22),o(46,"translate"),c(47,"label",23),n()()()(),r(48,"div",24)(49,"div",20)(50,"button",25),_("click",function(){return l.dismissModal()}),m(51),o(52,"translate"),n()(),c(53,"div",26),r(54,"div",27)(55,"button",28),m(56),o(57,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,18,"users.title_add_user")),e(2),u("aria-label",s(7,20,"form.button_close")),e(8),d(s(15,22,"users.label_username")),e(3),u("aria-label",s(18,24,"users.label_username")),e(4),d(s(22,26,"users.label_full_name")),e(3),u("aria-label",s(25,28,"users.label_full_name")),e(4),d(s(29,30,"users.label_password")),e(3),f("ngClass",F(46,ce,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,32,"users.label_password")),e(4),d(s(36,34,"users.label_confirm_password")),e(3),f("ngClass",F(48,ce,l.form.controls.passwordConfirm.dirty&&l.form.controls.passwordConfirm.errors)),u("aria-label",s(39,36,"users.label_confirm_password")),e(4),d(s(43,38,"users.label_admin_user")),e(3),u("aria-label",s(46,40,"users.label_admin_user")),e(6),C(" ",s(52,42,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(57,44,"form.button_save")," "))},dependencies:[G,Q,V,N,O,P,J,K,R,U],encapsulation:2})}return i})();var fe=i=>({"is-invalid":i});function $e(i,E){if(i&1&&(r(0,"li",9)(1,"label",27),m(2),o(3,"translate"),n(),r(4,"div",11),c(5,"input",28),o(6,"translate"),n()()),i&2){let t=v();e(2),d(s(3,3,"users.label_confirm_password")),e(3),f("ngClass",F(7,fe,t.form.controls.passwordConfirm.dirty&&t.form.controls.passwordConfirm.errors)),u("aria-label",s(6,5,"users.label_confirm_password"))}}var be=(()=>{class i{$activeModal=p(j);$api=p(B);$auth=p(X);$toastr=p(k);$translate=p($);user;isCurrentUser=!1;form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w(""),passwordConfirm:new w(""),admin:new w(!0)},this.matchPassword);ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user)}onSubmit({value:t}){this.$api.patch(`/users/${this.user.id}`,t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&t.username!==this.$auth.user.username&&this.$auth.logout()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:52,vars:42,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-pen","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","off","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),h(33,$e,7,9,"li",9),r(34,"li",17)(35,"span",18),m(36),o(37,"translate"),n(),r(38,"div",19),c(39,"input",20),o(40,"translate"),c(41,"label",21),n()()()(),r(42,"div",22)(43,"div",18)(44,"button",23),_("click",function(){return l.dismissModal()}),m(45),o(46,"translate"),n()(),c(47,"div",24),r(48,"div",25)(49,"button",26),m(50),o(51,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,16,"users.title_edit_user")),e(2),u("aria-label",s(7,18,"form.button_close")),e(8),d(s(15,20,"users.label_username")),e(3),u("aria-label",s(18,22,"users.label_username")),e(4),d(s(22,24,"users.label_full_name")),e(3),u("aria-label",s(25,26,"users.label_full_name")),e(4),d(s(29,28,"users.label_new_password")),e(3),f("ngClass",F(40,fe,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,30,"users.label_new_password")),e(2),g(l.form.controls.password.value?33:-1),e(3),d(s(37,32,"users.label_admin_user")),e(3),u("aria-label",s(40,34,"users.label_admin_user")),e(6),C(" ",s(46,36,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(51,38,"form.button_save")," "))},dependencies:[G,Q,V,re,N,O,P,J,K,R,U],encapsulation:2})}return i})();function Ue(i,E){if(i&1){let t=I();S(0,"button",21),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.setup2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),d(s(2,1,"users.setup_2fa")))}function ke(i,E){if(i&1){let t=I();S(0,"button",17),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.disable2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),C(" ",s(2,1,"users.setup_2fa_disable")," "))}function Be(i,E){if(i&1){let t=I();S(0,"div",7)(1,"div",8)(2,"div",9)(3,"div",10)(4,"span",11),q(5,"h4",12)(6,"h5",13),D()(),S(7,"div",14),h(8,Ue,3,3,"button",15),h(9,ke,3,3,"button",16),S(10,"div")(11,"button",17),o(12,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.openEditUser(l))}),q(13,"i",18),D(),S(14,"button",19),o(15,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.deleteUser(l.id))}),q(16,"i",20),D()()()()()()}if(i&2){let t=E.$implicit,a=v();e(5),L("innerText",t.name),e(),L("innerText",t.username),e(2),g(a.username===t.username&&!t.otpActive?8:-1),e(),g(a.username===t.username&&t.otpActive?9:-1),e(2),u("aria-label",s(12,7,"form.button_edit")),e(3),L("disabled",a.username===t.username),u("aria-label",s(15,9,"form.button_delete"))}}var $t=(()=>{class i{$api=p(B);$auth=p(X);$modal=p(oe);$route=p(se);$toastr=p(k);$translate=p($);homebridgeUsers;username=this.$auth.user.username;ngOnInit(){this.$route.data.subscribe(t=>{this.homebridgeUsers=t.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(t=>{this.homebridgeUsers=t})}openAddNewUser(){this.$modal.open(ue,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(t){let a=this.$modal.open(be,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}deleteUser(t){this.$api.delete(`/users/${t}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(t){let a=this.$modal.open(pe,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}disable2fa(t){let a=this.$modal.open(me,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["app-users"]],decls:12,vars:6,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"primary-text","m-0"],[1,"col-3","text-end"],[1,"btn","btn-elegant","waves-effect","m-0",3,"click"],[1,"fas","fa-fw","fa-user-plus"],[1,"row"],[1,"col-md-6","mb-4"],[1,"card","card-body"],[1,"d-flex","flex-column"],[1,"d-flex","flex-row","mb-3"],[1,"me-auto","my-0"],[3,"innerText"],[1,"small","text-truncate","primary-text",3,"innerText"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-primary","m-0"],[1,"btn","btn-elegant","m-0"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-fw","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-fw","fa-trash"],[1,"btn","btn-primary","m-0",3,"click"]],template:function(a,l){a&1&&(S(0,"div",0)(1,"div",1)(2,"h3",2),m(3),o(4,"translate"),D()(),S(5,"div",3)(6,"button",4),o(7,"translate"),z("click",function(){return l.openAddNewUser()}),q(8,"i",5),D()()(),S(9,"div",6),te(10,Be,17,11,"div",7,ee),D()),a&2&&(e(3),d(s(4,2,"users.title_users")),e(3),u("aria-label",s(7,4,"users.button_add_user")),e(4),ie(l.homebridgeUsers))},dependencies:[U],encapsulation:2})}return i})();export{$t as UsersComponent};
|
|
1
|
+
import{a as le}from"./chunk-QIOCGI3G.js";import{g as W,m as j,n as oe}from"./chunk-C3HWKB2Q.js";import{A as P,b as re,c as V,d as x,e as N,f as O,g as A,j as w,m as Q,o as H,p as J,q as K,x as ae,z as G}from"./chunk-WFYBML4S.js";import{b as X}from"./chunk-X6PPS33O.js";import{b as se}from"./chunk-ZJ3JJYIN.js";import{a as ve}from"./chunk-JSYOOM36.js";import{k,n as B}from"./chunk-2ZY66HU7.js";import{a as $,b as U}from"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{$b as L,Dc as F,Hb as u,Hc as o,Ib as h,Ic as s,Jb as g,Jc as ne,Lb as ee,Mb as te,Nb as ie,Ob as f,Pb as r,Qb as n,Rb as c,Sb as S,Tb as D,Ub as q,_b as I,ab as e,bc as _,cc as z,dc as v,g as _e,id as R,la as p,mb as y,qc as m,ra as T,rc as d,sa as M,sc as C}from"./chunk-ULJPS3WS.js";function xe(i,E){i&1&&(r(0,"ngb-alert",13)(1,"p",20),m(2),o(3,"translate"),n()()),i&2&&(f("dismissible",!1),e(2),d(s(3,2,"login.invalid_password")))}var me=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);invalidCredentials=!1;formGroup=new A({password:new w("",[x.required])});disable2fa(){this.invalidCredentials=!1,this.$api.post("/users/otp/deactivate",this.formGroup.value).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.setup_2fa_disable_success"),this.$translate.instant("toast.title_success"))},error:()=>{this.formGroup.setValue({password:""}),this.invalidCredentials=!0}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:34,vars:27,consts:[[1,"modal-content",2,"min-height","300px"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","password","autocomplete","current-password",1,"form-control","custom-input",3,"formControl","placeholder"],["type","error",1,"mt-3","mb-0",3,"dismissible"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"mb-0"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n()(),r(14,"ul",8)(15,"li",9)(16,"label",10),m(17),o(18,"translate"),n(),r(19,"div",11),c(20,"input",12),o(21,"translate"),n()()(),h(22,xe,4,4,"ngb-alert",13),n(),r(23,"div",14)(24,"div",15)(25,"button",16),o(26,"translate"),_("click",function(){return l.dismissModal()}),m(27),o(28,"translate"),n()(),c(29,"div",17),r(30,"div",18)(31,"button",19),_("click",function(){return l.disable2fa()}),m(32),o(33,"translate"),n()()()()),a&2&&(e(3),d(s(4,11,"users.setup_2fa_disable")),e(2),u("aria-label",s(6,13,"form.button_close")),e(7),d(s(13,15,"users.setup_2fa_disable_current_password")),e(5),d(s(18,17,"users.label_password")),e(3),f("formControl",l.formGroup.controls.password)("placeholder",s(21,19,"users.label_password")),e(2),g(l.invalidCredentials&&!l.formGroup.controls.password.value?22:-1),e(3),u("aria-label",s(26,21,"form.button_close")),e(2),C(" ",s(28,23,"form.button_close")," "),e(4),f("disabled",l.formGroup.invalid),e(),C(" ",s(33,25,"form.button_disable")," "))},dependencies:[G,V,N,P,H,W,U],encapsulation:2})}return i})();var de=_e(ve(),1);var we=i=>({timeDiffError:i});function Ce(i,E){i&1&&(r(0,"li"),m(1),o(2,"translate"),n()),i&2&&(e(),d(s(2,1,"users.setup_2fa_scan_qr_code")))}function he(i,E){if(i&1&&(r(0,"ngb-alert",8)(1,"p",16),m(2),o(3,"translate"),n(),r(4,"p",17),m(5),o(6,"translate"),n()()),i&2){let t=v();f("dismissible",!1),e(2),d(s(3,3,"users.setup_2fa_cannot_setup_2fa")),e(3),d(ne(6,5,"users.setup_2fa_server_time_out",F(8,we,t.timeDiffError)))}}function ge(i,E){if(i&1&&(r(0,"ul",9)(1,"li",18)(2,"div",19),c(3,"app-qrcode",20),n()(),r(4,"li",21)(5,"label",22),m(6),o(7,"translate"),n(),r(8,"div",23),c(9,"input",24),n()()()),i&2){let t=v();e(3),f("data",t.otpString),e(3),d(s(7,3,"users.setup_2fa_enter_code")),e(3),f("formControl",t.formGroup.controls.code)}}function Ee(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function ye(i,E){if(i&1){let t=I();r(0,"button",25),o(1,"translate"),_("click",function(){T(t);let l=v();return M(l.dismissModal())}),m(2),o(3,"translate"),n()}i&2&&(u("aria-label",s(1,2,"form.button_close")),e(2),C(" ",s(3,4,"form.button_close")," "))}function Se(i,E){if(i&1){let t=I();r(0,"button",26),_("click",function(){T(t);let l=v();return M(l.enable2fa())}),m(1),o(2,"translate"),n()}if(i&2){let t=v();f("disabled",t.formGroup.invalid),e(),C(" ",s(2,2,"form.button_enable")," ")}}var pe=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);user;timeDiffError=null;otpString;formGroup=new A({code:new w("",[x.required,x.minLength(6),x.maxLength(6)])});ngOnInit(){this.$api.post("/users/otp/setup",{}).subscribe({next:t=>{this.checkTimeDiff(t.timestamp),this.timeDiffError||(this.otpString=t.otpauth)},error:t=>{this.$activeModal.dismiss(),console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_enable_error"),this.$translate.instant("toast.title_error"))}})}enable2fa(){this.$api.post("/users/otp/activate",this.formGroup.value).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.setup_2fa_enabled_success"),this.$translate.instant("toast.title_success")),this.$activeModal.close()},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("users.setup_2fa_activate_error"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}checkTimeDiff(t){let a=(0,de.default)(t).diff(new Date,"millisecond");a<-5e3||a>5e3?this.timeDiffError=a:this.timeDiffError=null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:24,vars:15,consts:[[1,"modal-content","setup2fa"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-key","primary-text",2,"font-size","75px"],[1,"mb-3"],["type","error",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"fw-bold","mb-1"],[1,"mb-0"],[1,"list-group-item","text-center"],[1,"text-center","w-100","d-flex","justify-content-center"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["type","text","placeholder","eg. 123456","autocomplete","one-time-code","autocapitalize","none","inputmode","numeric","pattern","[0-9]*",1,"form-control","custom-input",3,"formControl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"div",1)(2,"h5",2),m(3),o(4,"translate"),n(),r(5,"button",3),o(6,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(7,"div",4)(8,"div",5),c(9,"i",6),n(),r(10,"ul",7)(11,"li"),m(12),o(13,"translate"),n(),h(14,Ce,3,3,"li"),n(),h(15,he,7,10,"ngb-alert",8),h(16,ge,10,5,"ul",9),n(),r(17,"div",10)(18,"div",11),h(19,Ee,4,6,"button",12),n(),r(20,"div",13),h(21,ye,4,6,"button",12),n(),r(22,"div",14),h(23,Se,3,4,"button",15),n()()()),a&2&&(e(3),d(s(4,9,"users.setup_2fa")),e(2),u("aria-label",s(6,11,"form.button_close")),e(7),d(s(13,13,"users.setup_2fa_warning")),e(2),g(l.timeDiffError?-1:14),e(),g(l.timeDiffError?15:-1),e(),g(l.timeDiffError?-1:16),e(3),g(l.timeDiffError?-1:19),e(2),g(l.timeDiffError?21:-1),e(2),g(l.timeDiffError?-1:23))},dependencies:[W,le,G,V,N,ae,P,H,U],encapsulation:2})}return i})();var ce=i=>({"is-invalid":i}),ue=(()=>{class i{$activeModal=p(j);$api=p(B);$toastr=p(k);$translate=p($);form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w("",[x.compose([x.required,x.minLength(4)])]),passwordConfirm:new w("",[x.required]),admin:new w(!0)},this.matchPassword);onSubmit({value:t}){this.$api.post("/users",t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_added_new_user"),this.$translate.instant("toast.title_success"))},error:a=>{this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],decls:58,vars:50,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-plus","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","username","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),r(33,"li",9)(34,"label",17),m(35),o(36,"translate"),n(),r(37,"div",11),c(38,"input",18),o(39,"translate"),n()(),r(40,"li",19)(41,"span",20),m(42),o(43,"translate"),n(),r(44,"div",21),c(45,"input",22),o(46,"translate"),c(47,"label",23),n()()()(),r(48,"div",24)(49,"div",20)(50,"button",25),_("click",function(){return l.dismissModal()}),m(51),o(52,"translate"),n()(),c(53,"div",26),r(54,"div",27)(55,"button",28),m(56),o(57,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,18,"users.title_add_user")),e(2),u("aria-label",s(7,20,"form.button_close")),e(8),d(s(15,22,"users.label_username")),e(3),u("aria-label",s(18,24,"users.label_username")),e(4),d(s(22,26,"users.label_full_name")),e(3),u("aria-label",s(25,28,"users.label_full_name")),e(4),d(s(29,30,"users.label_password")),e(3),f("ngClass",F(46,ce,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,32,"users.label_password")),e(4),d(s(36,34,"users.label_confirm_password")),e(3),f("ngClass",F(48,ce,l.form.controls.passwordConfirm.dirty&&l.form.controls.passwordConfirm.errors)),u("aria-label",s(39,36,"users.label_confirm_password")),e(4),d(s(43,38,"users.label_admin_user")),e(3),u("aria-label",s(46,40,"users.label_admin_user")),e(6),C(" ",s(52,42,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(57,44,"form.button_save")," "))},dependencies:[G,Q,V,N,O,P,J,K,R,U],encapsulation:2})}return i})();var fe=i=>({"is-invalid":i});function $e(i,E){if(i&1&&(r(0,"li",9)(1,"label",27),m(2),o(3,"translate"),n(),r(4,"div",11),c(5,"input",28),o(6,"translate"),n()()),i&2){let t=v();e(2),d(s(3,3,"users.label_confirm_password")),e(3),f("ngClass",F(7,fe,t.form.controls.passwordConfirm.dirty&&t.form.controls.passwordConfirm.errors)),u("aria-label",s(6,5,"users.label_confirm_password"))}}var be=(()=>{class i{$activeModal=p(j);$api=p(B);$auth=p(X);$toastr=p(k);$translate=p($);user;isCurrentUser=!1;form=new A({username:new w("",[x.required]),name:new w("",[x.required]),password:new w(""),passwordConfirm:new w(""),admin:new w(!0)},this.matchPassword);ngOnInit(){this.isCurrentUser=this.$auth.user.username===this.user.username,this.form.patchValue(this.user)}onSubmit({value:t}){this.$api.patch(`/users/${this.user.id}`,t).subscribe({next:()=>{this.$activeModal.close(),this.$toastr.success(this.$translate.instant("users.toast_updated_user"),this.$translate.instant("toast.title_success")),this.isCurrentUser&&t.username!==this.$auth.user.username&&this.$auth.logout()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_add_user"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}matchPassword(t){let a=t.get("password").value,l=t.get("passwordConfirm").value;if(a!==l)t.get("passwordConfirm").setErrors({matchPassword:!0});else return null}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["ng-component"]],inputs:{user:"user"},decls:52,vars:42,consts:[[1,"modal-content"],["novalidate","",3,"ngSubmit","formGroup"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"text-center","mb-3"],[1,"fas","fa-fw","fa-user-pen","primary-text",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","form-username",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["formControlName","username","type","text","id","form-username","autocomplete","off","autocapitalize","none",1,"form-control","custom-input"],["for","form-name",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","name","type","text","id","form-name","autocomplete","name",1,"form-control","custom-input"],["for","form-pass",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","password","type","password","autocomplete","new-password","id","form-pass",1,"form-control","custom-input",3,"ngClass"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","formControlName","admin","id","isAdmin",1,"rendux-input"],["for","isAdmin",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","submit",1,"btn","btn-primary",3,"disabled"],["for","form-pass-confirm",1,"mb-2","mb-md-0","w-100","w-md-50"],["formControlName","passwordConfirm","type","password","autocomplete","new-password","id","form-pass-confirm",1,"form-control","custom-input",3,"ngClass"]],template:function(a,l){a&1&&(r(0,"div",0)(1,"form",1),_("ngSubmit",function(){return l.onSubmit(l.form)}),r(2,"div",2)(3,"h5",3),m(4),o(5,"translate"),n(),r(6,"button",4),o(7,"translate"),_("click",function(){return l.dismissModal()}),n()(),r(8,"div",5)(9,"div",6),c(10,"i",7),n(),r(11,"ul",8)(12,"li",9)(13,"label",10),m(14),o(15,"translate"),n(),r(16,"div",11),c(17,"input",12),o(18,"translate"),n()(),r(19,"li",9)(20,"label",13),m(21),o(22,"translate"),n(),r(23,"div",11),c(24,"input",14),o(25,"translate"),n()(),r(26,"li",9)(27,"label",15),m(28),o(29,"translate"),n(),r(30,"div",11),c(31,"input",16),o(32,"translate"),n()(),h(33,$e,7,9,"li",9),r(34,"li",17)(35,"span",18),m(36),o(37,"translate"),n(),r(38,"div",19),c(39,"input",20),o(40,"translate"),c(41,"label",21),n()()()(),r(42,"div",22)(43,"div",18)(44,"button",23),_("click",function(){return l.dismissModal()}),m(45),o(46,"translate"),n()(),c(47,"div",24),r(48,"div",25)(49,"button",26),m(50),o(51,"translate"),n()()()()()),a&2&&(e(),f("formGroup",l.form),e(3),d(s(5,16,"users.title_edit_user")),e(2),u("aria-label",s(7,18,"form.button_close")),e(8),d(s(15,20,"users.label_username")),e(3),u("aria-label",s(18,22,"users.label_username")),e(4),d(s(22,24,"users.label_full_name")),e(3),u("aria-label",s(25,26,"users.label_full_name")),e(4),d(s(29,28,"users.label_new_password")),e(3),f("ngClass",F(40,fe,l.form.controls.password.dirty&&l.form.controls.password.errors)),u("aria-label",s(32,30,"users.label_new_password")),e(2),g(l.form.controls.password.value?33:-1),e(3),d(s(37,32,"users.label_admin_user")),e(3),u("aria-label",s(40,34,"users.label_admin_user")),e(6),C(" ",s(46,36,"form.button_close")," "),e(4),f("disabled",!l.form.valid),e(),C(" ",s(51,38,"form.button_save")," "))},dependencies:[G,Q,V,re,N,O,P,J,K,R,U],encapsulation:2})}return i})();function Ue(i,E){if(i&1){let t=I();S(0,"button",21),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.setup2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),d(s(2,1,"users.setup_2fa")))}function ke(i,E){if(i&1){let t=I();S(0,"button",17),z("click",function(){T(t);let l=v().$implicit,b=v();return M(b.disable2fa(l))}),m(1),o(2,"translate"),D()}i&2&&(e(),C(" ",s(2,1,"users.setup_2fa_disable")," "))}function Be(i,E){if(i&1){let t=I();S(0,"div",7)(1,"div",8)(2,"div",9)(3,"div",10)(4,"span",11),q(5,"h4",12)(6,"h5",13),D()(),S(7,"div",14),h(8,Ue,3,3,"button",15),h(9,ke,3,3,"button",16),S(10,"div")(11,"button",17),o(12,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.openEditUser(l))}),q(13,"i",18),D(),S(14,"button",19),o(15,"translate"),z("click",function(){let l=T(t).$implicit,b=v();return M(b.deleteUser(l.id))}),q(16,"i",20),D()()()()()()}if(i&2){let t=E.$implicit,a=v();e(5),L("innerText",t.name),e(),L("innerText",t.username),e(2),g(a.username===t.username&&!t.otpActive?8:-1),e(),g(a.username===t.username&&t.otpActive?9:-1),e(2),u("aria-label",s(12,7,"form.button_edit")),e(3),L("disabled",a.username===t.username),u("aria-label",s(15,9,"form.button_delete"))}}var $t=(()=>{class i{$api=p(B);$auth=p(X);$modal=p(oe);$route=p(se);$toastr=p(k);$translate=p($);homebridgeUsers;username=this.$auth.user.username;ngOnInit(){this.$route.data.subscribe(t=>{this.homebridgeUsers=t.homebridgeUsers})}reloadUsers(){return this.$api.get("/users").subscribe(t=>{this.homebridgeUsers=t})}openAddNewUser(){this.$modal.open(ue,{size:"lg",backdrop:"static"}).result.finally(()=>{this.reloadUsers()})}openEditUser(t){let a=this.$modal.open(be,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}deleteUser(t){this.$api.delete(`/users/${t}`).subscribe({next:()=>{this.$toastr.success(this.$translate.instant("users.toast_user_deleted"),this.$translate.instant("toast.title_success")),this.reloadUsers()},error:a=>{console.error(a),this.$toastr.error(a.error.message||this.$translate.instant("users.toast_failed_to_delete_user"),this.$translate.instant("toast.title_error"))}})}setup2fa(t){let a=this.$modal.open(pe,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}disable2fa(t){let a=this.$modal.open(me,{size:"lg",backdrop:"static"});a.componentInstance.user=t,a.result.finally(()=>{this.reloadUsers()})}static \u0275fac=function(a){return new(a||i)};static \u0275cmp=y({type:i,selectors:[["app-users"]],decls:12,vars:6,consts:[[1,"row","mb-3"],[1,"col-9"],[1,"primary-text","m-0"],[1,"col-3","text-end"],[1,"btn","btn-elegant","waves-effect","m-0",3,"click"],[1,"fas","fa-fw","fa-user-plus"],[1,"row"],[1,"col-md-6","mb-4"],[1,"card","card-body"],[1,"d-flex","flex-column"],[1,"d-flex","flex-row","mb-3"],[1,"me-auto","my-0"],[3,"innerText"],[1,"small","text-truncate","primary-text",3,"innerText"],[1,"d-flex","flex-row","justify-content-between"],[1,"btn","btn-primary","m-0"],[1,"btn","btn-elegant","m-0"],[1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-fw","fa-user-pen"],[1,"btn","btn-danger","m-0","ms-2",3,"click","disabled"],[1,"fas","fa-fw","fa-trash"],[1,"btn","btn-primary","m-0",3,"click"]],template:function(a,l){a&1&&(S(0,"div",0)(1,"div",1)(2,"h3",2),m(3),o(4,"translate"),D()(),S(5,"div",3)(6,"button",4),o(7,"translate"),z("click",function(){return l.openAddNewUser()}),q(8,"i",5),D()()(),S(9,"div",6),te(10,Be,17,11,"div",7,ee),D()),a&2&&(e(3),d(s(4,2,"users.title_users")),e(3),u("aria-label",s(7,4,"users.button_add_user")),e(4),ie(l.homebridgeUsers))},dependencies:[U],encapsulation:2})}return i})();export{$t as UsersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-FZYJ5GFN.js";import"./chunk-X6PPS33O.js";import{g as r}from"./chunk-ZJ3JJYIN.js";import"./chunk-JSYOOM36.js";import"./chunk-2ZY66HU7.js";import"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{ha as o,nb as e}from"./chunk-ULJPS3WS.js";var c=[{path:"",loadComponent:()=>import("./chunk-L77GHHTR.js").then(t=>t.SettingsComponent),canActivate:[n]}],m=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=e({type:t});static \u0275inj=o({imports:[r.forChild(c),r]})}return t})();var l=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=e({type:t});static \u0275inj=o({imports:[m]})}return t})();export{l as SettingsModule};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as r}from"./chunk-ZJ3JJYIN.js";import"./chunk-HBOWJDR5.js";import{ha as e,nb as o}from"./chunk-ULJPS3WS.js";var m=[{path:"",loadComponent:()=>import("./chunk-DOPUE6VY.js").then(t=>t.TerminalComponent),canDeactivate:[t=>t.canDeactivate?t.canDeactivate():!0]}],n=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=o({type:t});static \u0275inj=e({imports:[r.forChild(m),r]})}return t})();var s=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=o({type:t});static \u0275inj=e({imports:[n]})}return t})();export{s as TerminalModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as J}from"./chunk-C3HWKB2Q.js";import{e as O,l as W,r as z,s as q,t as G,z as H}from"./chunk-WFYBML4S.js";import{d as Y}from"./chunk-ZJ3JJYIN.js";import{k as X,n as Z}from"./chunk-
|
|
1
|
+
import{m as J}from"./chunk-C3HWKB2Q.js";import{e as O,l as W,r as z,s as q,t as G,z as H}from"./chunk-WFYBML4S.js";import{d as Y}from"./chunk-ZJ3JJYIN.js";import{k as X,n as Z}from"./chunk-2ZY66HU7.js";import{a as K,b as Q}from"./chunk-R3563DDE.js";import{Ec as N,Fc as P,Hb as A,Hc as m,Ib as _,Ic as p,Jb as u,Lb as k,Mb as E,Nb as $,Ob as C,Pb as o,Qb as a,Rb as w,_b as B,a as T,ab as s,b as R,bc as b,dc as d,h as M,id as j,la as y,mb as D,qc as c,ra as f,rc as g,sa as v,sc as h,tc as V,w as S,xc as F,yc as U,zc as L}from"./chunk-ULJPS3WS.js";var te=(t,l)=>({"btn-danger":t,"btn-elegant":l}),ie=(t,l,e)=>({"fa-trash":t,"fa-undo":l,"fa-spinner fa-pulse":e});function ne(t,l){t&1&&(o(0,"div",12),w(1,"i",13),a(),o(2,"p",14),c(3),m(4,"translate"),a()),t&2&&(s(3),g(p(4,1,"reset.no_accessories")))}function se(t,l){if(t&1&&(o(0,"option",24),c(1),a()),t&2){let e=l.$implicit;C("value",e._id),s(),V("",e.name," (",e._username,")")}}function oe(t,l){if(t&1){let e=B();o(0,"li",20),c(1),m(2,"translate"),a(),o(3,"li",18)(4,"label",21),c(5),m(6,"translate"),a(),o(7,"div",22)(8,"select",23),L("ngModelChange",function(i){f(e);let r=d(2);return U(r.selectedBridge,i)||(r.selectedBridge=i),v(i)}),b("change",function(i){f(e);let r=d(2);return v(r.onBridgeChange(i.target.value))}),E(9,se,2,3,"option",24,k),a()()()}if(t&2){let e=d(2);s(),g(p(2,3,"form.label.changes_kept")),s(4),g(p(6,5,"reset.accessory_ind.bridge")),s(3),F("ngModel",e.selectedBridge),s(),$(e.pairings)}}function ae(t,l){if(t&1&&(o(0,"li",18)(1,"label",25),c(2),m(3,"translate"),a(),o(4,"div",26),c(5),a()()),t&2){let e=d(2);s(2),g(p(3,2,"reset.accessory_ind.bridge")),s(3),h(" ",e.getCurrentlySelectedBridge()," ")}}function re(t,l){if(t&1){let e=B();o(0,"li",19)(1,"span"),c(2),w(3,"br"),o(4,"small")(5,"span",27),c(6),a()()(),o(7,"button",28),m(8,"translate"),b("click",function(){let i=f(e).$implicit,r=d(2);return v(r.toggleList(i.UUID,i.$cacheFile))}),w(9,"i",29),a()()}if(t&2){let e=l.$implicit,n=d(2);s(2),h(" ",e.displayName),s(4),g(e.UUID),s(),C("disabled",n.clicked)("ngClass",N(8,te,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile))),A("aria-label",p(8,6,"form.button_delete")),s(2),C("ngClass",P(11,ie,!n.isInList(e.UUID,e.$cacheFile),n.isInList(e.UUID,e.$cacheFile)&&!n.clicked,n.isInList(e.UUID,e.$cacheFile)&&n.clicked))}}function le(t,l){if(t&1&&(o(0,"div",12),w(1,"i",15),a(),o(2,"ul",16)(3,"li"),c(4),m(5,"translate"),a(),o(6,"li"),c(7),m(8,"translate"),a(),o(9,"li"),c(10),m(11,"translate"),a()(),o(12,"ul",17),_(13,oe,11,7),_(14,ae,6,4,"li",18),E(15,re,10,15,"li",19,k),a()),t&2){let e=d();s(4),g(p(5,5,"reset.accessory_ind.list_1")),s(3),g(p(8,7,"reset.accessory_ind.list_2")),s(3),g(p(11,9,"reset.accessory_ind.list_3")),s(3),u(e.pairings.length>1?13:-1),s(),u(e.pairings.length===1?14:-1),s(),$(e.selectedBridgeAccessories)}}function ce(t,l){if(t&1){let e=B();o(0,"button",30),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}if(t&2){let e=d();C("disabled",e.clicked),s(),h(" ",p(2,2,"form.button_close")," ")}}function de(t,l){if(t&1){let e=B();o(0,"button",31),b("click",function(){f(e);let i=d();return v(i.dismissModal())}),c(1),m(2,"translate"),a()}t&2&&(s(),h(" ",p(2,1,"form.button_close")," "))}function me(t,l){if(t&1&&c(0),t&2){let e=d(3);h(" (",e.toDelete.length,") ")}}function pe(t,l){if(t&1&&(c(0),m(1,"translate"),_(2,me,1,1)),t&2){let e=d(2);h(" ",p(1,2,"form.button_remove")," "),s(2),u(e.toDelete.length>0?2:-1)}}function _e(t,l){t&1&&w(0,"i",33)}function ue(t,l){if(t&1){let e=B();o(0,"button",32),b("click",function(){f(e);let i=d();return v(i.removeAccessories())}),_(1,pe,3,4),_(2,_e,1,0,"i",33),a()}if(t&2){let e=d();C("disabled",!e.toDelete.length||e.clicked),s(),u(e.clicked?-1:1),s(),u(e.clicked?2:-1)}}var ke=(()=>{class t{$activeModal=y(J);$api=y(Z);$router=y(Y);$toastr=y(X);$translate=y(K);selectedBridge="";pairings=[];clicked=!1;selectedBridgeAccessories=[];accessoriesExist=!1;toDelete=[];ngOnInit(){this.loadCachedAccessories()}onBridgeChange(e){this.selectedBridge=e,this.selectedBridgeAccessories=this.pairings.find(n=>n._id===this.selectedBridge)?.accessories}getCurrentlySelectedBridge(){let e=this.pairings.find(n=>n._id===this.selectedBridge);return`${e.name} - ${e._username}`}toggleList(e,n){this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)?this.toDelete=this.toDelete.filter(i=>i.uuid!==e||i.cacheFile!==n):this.toDelete.push({cacheFile:n,uuid:e})}isInList(e,n){return this.toDelete.some(i=>i.uuid===e&&i.cacheFile===n)}removeAccessories(){return this.clicked=!0,this.$api.delete("/server/cached-accessories",{body:this.toDelete}).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"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}loadCachedAccessories(){return M(this,null,function*(){try{let[e,n]=yield Promise.all([S(this.$api.get("/server/cached-accessories")),S(this.$api.get("/server/pairings"))]),i=new Map(n.map(r=>[r._id,R(T({},r),{accessories:[]})]));e.sort((r,x)=>r.displayName.localeCompare(x.displayName)).forEach(r=>{let x=n.find(ee=>ee._main),I=r.$cacheFile?.split(".")?.[1]||x._id;(!this.selectedBridge||this.selectedBridge===I)&&(i.has(I)||i.set(I,{_id:I,_username:I.match(/.{1,2}/g).join(":"),name:this.$translate.instant("reset.accessory_ind.unknown"),accessories:[]}),i.get(I).accessories.push(r))}),this.pairings=Array.from(i.values()).filter(r=>r.accessories.length>0).sort((r,x)=>r._main&&!x._main?-1:!r._main&&x._main?1:r.name.localeCompare(x.name)),this.selectedBridge=this.selectedBridge||this.pairings[0]?._id,this.selectedBridge&&(this.accessoriesExist=!0,this.selectedBridgeAccessories=this.pairings[0].accessories)}catch(e){console.error(e),this.$toastr.error(this.$translate.instant("reset.error_message"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=D({type:t,selectors:[["ng-component"]],inputs:{selectedBridge:"selectedBridge"},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"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"list-group-item","text-center","grey-text","small"],["for","bridgeSelect",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],["id","bridgeSelect",1,"custom-select",3,"ngModelChange","change","ngModel"],[3,"value"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50","grey-text","font-monospace"],[1,"font-monospace","grey-text"],[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(n,i){n&1&&(o(0,"div",0)(1,"div",1)(2,"h5",2),c(3),m(4,"translate"),a(),o(5,"button",3),m(6,"translate"),b("click",function(){return i.dismissModal()}),a()(),o(7,"div",4),_(8,ne,5,3),_(9,le,17,11),a(),o(10,"div",5)(11,"div",6),_(12,ce,3,4,"button",7),a(),o(13,"div",8),_(14,de,3,3,"button",9),a(),o(15,"div",10),_(16,ue,3,3,"button",11),a()()()),n&2&&(s(3),g(p(4,8,"reset.accessory_ind.title")),s(2),C("disabled",i.clicked),A("aria-label",p(6,10,"form.button_close")),s(3),u(i.accessoriesExist?-1:8),s(),u(i.accessoriesExist?9:-1),s(3),u(i.accessoriesExist?12:-1),s(2),u(i.accessoriesExist?-1:14),s(2),u(i.accessoriesExist?16:-1))},dependencies:[j,H,q,G,z,O,W,Q],encapsulation:2})}return t})();export{ke as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-UXUU25EW.js";import{a as X}from"./chunk-6VMMFEEB.js";import{a as Z}from"./chunk-EI76KND2.js";import"./chunk-YJWU65EW.js";import{a as R}from"./chunk-CHYWVK3W.js";import{n as E}from"./chunk-C3HWKB2Q.js";import"./chunk-WFYBML4S.js";import{a as j}from"./chunk-VLNYF5AS.js";import{b as A}from"./chunk-3K4AKQIG.js";import{a as W,c as q,d as V,e as N,f as D}from"./chunk-ZJ3JJYIN.js";import{b as T}from"./chunk-ZCSPADUX.js";import{m as $}from"./chunk-FPLWS5WP.js";import{a as L,b as U}from"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{Cc as v,Dc as M,Hb as m,Hc as d,Ib as x,Ic as l,Jb as y,Ob as c,Pb as n,Qb as a,Rb as p,_b as S,ab as o,bc as _,dc as w,fb as F,g as Y,h as I,id as O,la as u,mb as P,qc as f,ra as h,rc as g,sa as b,w as z,zd as K}from"./chunk-ULJPS3WS.js";var Q=Y(Z(),1);function G(){var i;return typeof window<"u"&&(window?.matchMedia("(display-mode: standalone)").matches||((i=window.navigator)===null||i===void 0?void 0:i.standalone)||document.referrer.startsWith("android-app://")||window?.Windows||/trident.+(msapphost|webview)\//i.test(navigator.userAgent)||document.referrer.startsWith("app-info://platform/microsoft-store"))}var B=()=>["/"],te=i=>({"hamburger-icon-cross":i}),ne=i=>({expanded:i}),ie=()=>({exact:!0}),oe=()=>["/accessories"],re=()=>["/support"],ae=()=>["/power-options"],se=()=>["/plugins"],de=()=>["/logs"],le=()=>["/platform-tools/terminal"],pe=()=>["/config"],ce=()=>["/settings"];function me(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",19),d(2,"translate"),d(3,"translate"),_("click",function(){h(e);let t=w();return b(t.openUnderVoltageModal())})("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(4,"div",12),p(5,"i",20),a(),n(6,"div",14),f(7),d(8,"translate"),a()()()}i&2&&(o(),m("aria-label",l(2,2,"rpi.throttled.undervoltage_title")+" - "+l(3,4,"rpi.throttled.undervoltage_description")),o(6),g(l(8,6,"rpi.throttled.undervoltage_title")))}function ue(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",21),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,se))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.label_plugins")),o(5),g(l(7,6,"menu.label_plugins")))}function _e(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",22),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,de))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.linux.label_logs")),o(5),g(l(7,6,"menu.linux.label_logs")))}function fe(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",23),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,le))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.linux.label_terminal")),o(5),g(l(7,6,"menu.linux.label_terminal")))}function ge(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",24),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,pe))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.config_json_editor")),o(5),g(l(7,6,"menu.config_json_editor")))}function ve(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",25),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,ce))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.label_settings")),o(5),g(l(7,6,"menu.label_settings")))}function he(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",19),d(2,"translate"),_("click",function(){h(e);let t=w();return b(t.reloadPage())})("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",26),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),m("aria-label",l(2,2,"menu.reload")),o(5),g(l(7,4,"menu.reload")))}function be(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",19),d(2,"translate"),_("click",function(){h(e);let t=w();return b(t.logout())})("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",27),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),m("aria-label",l(2,2,"menu.tooltip_logout")),o(5),g(l(7,4,"menu.tooltip_logout")))}var J=(()=>{class i{$auth=u(A);$settings=u(T);$modal=u(E);$notification=u(X);$renderer=u(F);$router=u(V);$translate=u(L);isExpanded=!1;formAuth=this.$settings.formAuth;isAdmin=this.$auth.user.admin;enableTerminalAccess=this.$settings.env.enableTerminalAccess;rPiCurrentlyUnderVoltage=!1;rPiWasUnderVoltage=!1;isMobile=!1;freezeMenu=!1;isPwa=G();constructor(){this.isMobile=window.innerWidth<768;let e;window.addEventListener("resize",()=>{clearTimeout(e),e=setTimeout(()=>{this.updateListeners()},500)}),this.$router.events.subscribe(s=>{s instanceof W&&(this.closeSidebar(),this.freezeMenu=!0,setTimeout(()=>{this.freezeMenu=!1},750))})}ngOnInit(){this.$notification.raspberryPiThrottled.subscribe(r=>{r["Under Voltage"]&&(this.rPiCurrentlyUnderVoltage=!0),r["Under-voltage has occurred"]&&(this.rPiWasUnderVoltage=!0)}),this.$notification.formAuthEnabled.subscribe(r=>{this.formAuth=r});let e=document.querySelector(".sidebar"),s=document.querySelector(".m-header"),t=document.querySelector(".content");this.isMobile?document.addEventListener("touchstart",r=>{if(t.contains(r.target)&&this.isExpanded){r.preventDefault(),this.toggleSidebar();return}!e.contains(r.target)&&!s.contains(r.target)&&this.isExpanded&&(r.preventDefault(),this.closeSidebar())},{passive:!1}):(this.updateListeners(),s.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),s.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}),document.addEventListener("click",r=>{e.contains(r.target)&&r.clientX>60&&this.closeSidebar()},{passive:!1})),this.updateContentStyles()}toggleSidebar(){this.freezeMenu||(this.isExpanded=!this.isExpanded,this.updateContentStyles())}openUnderVoltageModal(){let e=this.$modal.open(H,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("rpi.throttled.undervoltage_title"),e.componentInstance.message=this.$translate.instant(this.rPiCurrentlyUnderVoltage?"rpi.throttled.currently_message":"rpi.throttled.previously_message"),e.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),e.componentInstance.faIconClass="fas fa-fw fa-bolt yellow-text",e.componentInstance.ctaButtonLink="https://pimylifeup.com/raspberry-pi-low-voltage-warning"}handleKeydown(e){if(e.key==="Enter"){let s=e.target;["menuitem","button"].includes(s.getAttribute("role"))&&s.click()}}reloadPage(){window.location.reload()}ngOnDestroy(){document.removeEventListener("touchstart",()=>{}),document.removeEventListener("click",()=>{})}logout(){this.$auth.logout()}openSidebar(){this.freezeMenu||(this.isExpanded=!0,this.updateContentStyles())}closeSidebar(){this.freezeMenu||(this.isExpanded=!1,this.updateContentStyles())}updateContentStyles(){let e=document.querySelector(".content");this.isExpanded?(this.$renderer.setStyle(e,"opacity","20%"),this.$renderer.setStyle(e,"pointer-events","none"),this.$renderer.setStyle(e,"overflow","hidden")):(this.$renderer.removeStyle(e,"opacity"),this.$renderer.removeStyle(e,"pointer-events"),this.$renderer.removeStyle(e,"overflow"))}updateListeners(){this.isMobile=window.innerWidth<768;let e=document.querySelector(".sidebar");e.removeAllListeners(),(this.isMobile||!this.isMobile&&this.$settings.menuMode!=="freeze")&&(e.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),e.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}))}static \u0275fac=function(s){return new(s||i)};static \u0275cmp=P({type:i,selectors:[["app-sidebar"]],inputs:{isExpanded:"isExpanded"},decls:61,vars:67,consts:[["tabindex","0","role","button",1,"m-header","text-end",3,"click","keydown"],[1,"me-2","d-block","d-lg-none",2,"font-size","0.9rem","color","#dddddd"],[3,"routerLink"],["ngSrc","../../../../assets/homebridge-logo.svg","alt","HB Logo","height","35","width","35",2,"height","35px","width","35px"],[1,"hb-logo-text-mobile"],[1,"hamburger-icon",3,"ngClass"],["role","navigation","id","sidebar",1,"sidebar",3,"ngClass"],["tabindex","0","role","button",1,"header",3,"click","keydown"],[1,"hb-logo-text"],[1,"link-wrapper"],[1,"link"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive","routerLinkActiveOptions"],[1,"icon"],[1,"fa","fa-fw","fa-house"],[1,"title"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive"],[1,"fa","fa-fw","fa-lightbulb"],[1,"fa","fa-fw","fa-question-circle-o"],[1,"fa","fa-fw","fa-power-off"],["role","menuitem","tabindex","0",1,"link-row",3,"click","keydown"],[1,"fas","fa-fw","fa-bolt","fa-beat","yellow-text",2,"--fa-beat-scale","1.5"],[1,"fa","fa-fw","fa-plug"],[1,"fa","fa-fw","fa-wave-square"],[1,"fa","fa-fw","fa-terminal"],[1,"fa","fa-fw","fa-code"],[1,"fa","fa-fw","fa-cog"],[1,"fa","fa-fw","fa-refresh"],[1,"fa","fa-fw","fa-right-from-bracket"]],template:function(s,t){s&1&&(n(0,"div",0),d(1,"translate"),_("click",function(){return t.toggleSidebar()})("keydown",function(C){return t.handleKeydown(C)}),p(2,"span",1),n(3,"a",2),d(4,"translate"),p(5,"img",3),n(6,"div",4),f(7,"Homebridge"),a()(),n(8,"div",5),p(9,"span")(10,"span")(11,"span")(12,"span"),a()(),n(13,"div",6)(14,"div",7),_("click",function(){return t.toggleSidebar()})("keydown",function(C){return t.handleKeydown(C)}),n(15,"a",2),d(16,"translate"),p(17,"img",3),n(18,"div",8),f(19,"Homebridge"),a()()(),n(20,"div",9)(21,"div",10)(22,"div",11),d(23,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(24,"div",12),p(25,"i",13),a(),n(26,"div",14),f(27),d(28,"translate"),a()()(),x(29,me,9,8,"div",10),x(30,ue,8,9,"div",10),n(31,"div",10)(32,"div",15),d(33,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(34,"div",12),p(35,"i",16),a(),n(36,"div",14),f(37),d(38,"translate"),a()()(),x(39,_e,8,9,"div",10),x(40,fe,8,9,"div",10),x(41,ge,8,9,"div",10),x(42,ve,8,9,"div",10),n(43,"div",10)(44,"div",15),d(45,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(46,"div",12),p(47,"i",17),a(),n(48,"div",14),f(49),d(50,"translate"),a()()(),n(51,"div",10)(52,"div",15),d(53,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(54,"div",12),p(55,"i",18),a(),n(56,"div",14),f(57),d(58,"translate"),a()()(),x(59,he,8,6,"div",10),x(60,be,8,6,"div",10),a()()),s&2&&(m("aria-expanded",t.isExpanded?"true":"false")("aria-controls","sidebar")("aria-label",l(1,34,"menu.sidebar.aria_menu")),o(3),c("routerLink",v(56,B)),m("aria-label",l(4,36,"menu.label_status")),o(5),c("ngClass",M(57,te,t.isExpanded)),o(5),c("ngClass",M(59,ne,t.isExpanded)),o(2),c("routerLink",v(61,B)),m("aria-label",l(16,38,"menu.label_status")),o(7),c("routerLink",v(62,B))("routerLinkActive","active")("routerLinkActiveOptions",v(63,ie)),m("aria-label",l(23,40,"menu.label_status")),o(5),g(l(28,42,"menu.label_status")),o(2),y(t.rPiWasUnderVoltage||t.rPiCurrentlyUnderVoltage?29:-1),o(),y(t.isAdmin?30:-1),o(2),c("routerLink",v(64,oe))("routerLinkActive","active"),m("aria-label",l(33,44,"menu.label_accessories")),o(5),g(l(38,46,"menu.label_accessories")),o(2),y(t.isAdmin?39:-1),o(),y(t.enableTerminalAccess&&t.isAdmin?40:-1),o(),y(t.isAdmin?41:-1),o(),y(t.isAdmin?42:-1),o(2),c("routerLink",v(65,re))("routerLinkActive","active"),m("aria-label",l(45,48,"support.title")),o(5),g(l(50,50,"support.title")),o(3),c("routerLink",v(66,ae))("routerLinkActive","active"),m("aria-label",l(53,52,"menu.restart.title")),o(5),g(l(58,54,"menu.restart.title")),o(2),y(t.isPwa?59:-1),o(),y(t.formAuth?60:-1))},dependencies:[N,K,O,D,U],styles:[".m-header[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100%;height:65px;z-index:510;display:flex;align-items:center;padding-left:3px;padding-right:3px}.m-header[_ngcontent-%COMP%]:hover{cursor:pointer}@media (min-width: 768px){.m-header[_ngcontent-%COMP%]{display:none}}.sidebar[_ngcontent-%COMP%]{position:fixed;left:0;top:0;height:100vh;transition:.3s;width:60px;z-index:500}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:15px 10px 15px 11px;font-size:.85rem}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]:hover{cursor:pointer}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{overflow-y:auto;max-height:calc(100vh - 80px)!important}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%]{display:flex;align-items:center;padding:15px 10px;cursor:pointer;transition:.2s;font-size:17px}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{flex:0 0 38px;display:flex;align-items:center;justify-content:center}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{flex:1;transition:.3s;max-width:0;overflow:hidden;white-space:nowrap}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%]{width:0}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:none}}.sidebar.expanded[_ngcontent-%COMP%]{width:210px}@media (max-width: 767px){.sidebar.expanded[_ngcontent-%COMP%]{width:210px}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:block}}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{max-width:150px;padding-left:10px}.hamburger-icon[_ngcontent-%COMP%]{margin:-7px 0 0 25px}@media (min-width: 768px){.hb-logo-text[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px}.sidebar.expanded[_ngcontent-%COMP%] .hb-logo-text[_ngcontent-%COMP%]{opacity:1;left:55px;transition:.3s}.sidebar[_ngcontent-%COMP%]:not(.expanded) .hb-logo-text[_ngcontent-%COMP%]{opacity:0;left:40px;transition:.3s}.hb-logo-text-mobile[_ngcontent-%COMP%], .hamburger-icon[_ngcontent-%COMP%]{display:none!important}}@media (max-width: 767px){.hb-logo-text[_ngcontent-%COMP%]{display:none!important}.hb-logo-text-mobile[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px;opacity:1;left:55px}.hamburger-icon[_ngcontent-%COMP%]{position:absolute;right:10px;top:28px;width:30px;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.5s ease-in-out;-moz-transition:.5s ease-in-out;-o-transition:.5s ease-in-out;transition:.5s ease-in-out;cursor:pointer}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;position:absolute;height:2px;width:100%;background-color:#fff;border-radius:9px;opacity:1;left:0;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.25s ease-in-out;-moz-transition:.25s ease-in-out;-o-transition:.25s ease-in-out;transition:.25s ease-in-out}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:0}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2), .hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){top:10px}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:20px}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:10px;width:0;left:50%}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2){-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:10px;width:0;left:50%}}"]})}return i})();var we=i=>({sidebarExpanded:i}),Xe=(()=>{class i{$auth=u(A);$modal=u(E);$router=u(V);$settings=u(T);$translate=u(L);$ws=u(j);io;sidebarExpanded=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("app"),this.io.socket.on("reconnect",()=>{this.$auth.checkToken()}),this.compareServerUiVersion()}compareServerUiVersion(){return I(this,null,function*(){if(this.$settings.settingsLoaded||(yield z(this.$settings.onSettingsLoaded)),this.$router.url!=="/restart"&&(0,Q.lt)(this.$settings.uiVersion,$.serverTarget)){console.log(`Server restart required. UI Version: ${$.serverTarget} - Server Version: ${this.$settings.uiVersion} `);let e=this.$modal.open(R,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("platform.version.service_restart_required"),e.componentInstance.message=this.$translate.instant("platform.version.restart_required",{serverVersion:this.$settings.uiVersion,uiVersion:$.serverTarget}),e.componentInstance.confirmButtonLabel=this.$translate.instant("menu.tooltip_restart"),e.componentInstance.faIconClass="fas fa-power-off orange-text",e.result.then(()=>this.$router.navigate(["/restart"])).catch(()=>{})}})}static \u0275fac=function(s){return new(s||i)};static \u0275cmp=P({type:i,selectors:[["app-layout"]],decls:3,vars:4,consts:[[3,"isExpanded"],[1,"content","px-3","p-md-4",3,"ngClass"]],template:function(s,t){s&1&&(p(0,"app-sidebar",0),n(1,"div",1),p(2,"router-outlet"),a()),s&2&&(c("isExpanded",t.sidebarExpanded),o(),c("ngClass",M(2,we,t.sidebarExpanded)))},dependencies:[J,O,q],styles:[".content[_ngcontent-%COMP%]{margin-left:60px;transition:.3s;height:100%}@media (max-width: 767px){.content[_ngcontent-%COMP%]{margin-left:0;padding-top:85px!important}}@media (min-width: 768px){.content[_ngcontent-%COMP%]{height:100%}}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return i})();export{Xe as LayoutComponent};
|
|
1
|
+
import{a as H}from"./chunk-UXUU25EW.js";import{a as X}from"./chunk-6VMMFEEB.js";import{a as Z}from"./chunk-EI76KND2.js";import"./chunk-YJWU65EW.js";import{a as R}from"./chunk-6JWROI2O.js";import{n as E}from"./chunk-C3HWKB2Q.js";import"./chunk-WFYBML4S.js";import{a as j}from"./chunk-75U46IUB.js";import{b as A}from"./chunk-X6PPS33O.js";import{a as W,c as q,d as V,e as N,f as D}from"./chunk-ZJ3JJYIN.js";import{b as T}from"./chunk-JSYOOM36.js";import{m as $}from"./chunk-2ZY66HU7.js";import{a as L,b as U}from"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{Cc as v,Dc as M,Hb as m,Hc as d,Ib as x,Ic as l,Jb as y,Ob as c,Pb as n,Qb as a,Rb as p,_b as S,ab as o,bc as _,dc as w,fb as F,g as Y,h as I,id as O,la as u,mb as P,qc as f,ra as h,rc as g,sa as b,w as z,zd as K}from"./chunk-ULJPS3WS.js";var Q=Y(Z(),1);function G(){var i;return typeof window<"u"&&(window?.matchMedia("(display-mode: standalone)").matches||((i=window.navigator)===null||i===void 0?void 0:i.standalone)||document.referrer.startsWith("android-app://")||window?.Windows||/trident.+(msapphost|webview)\//i.test(navigator.userAgent)||document.referrer.startsWith("app-info://platform/microsoft-store"))}var B=()=>["/"],te=i=>({"hamburger-icon-cross":i}),ne=i=>({expanded:i}),ie=()=>({exact:!0}),oe=()=>["/accessories"],re=()=>["/support"],ae=()=>["/power-options"],se=()=>["/plugins"],de=()=>["/logs"],le=()=>["/platform-tools/terminal"],pe=()=>["/config"],ce=()=>["/settings"];function me(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",19),d(2,"translate"),d(3,"translate"),_("click",function(){h(e);let t=w();return b(t.openUnderVoltageModal())})("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(4,"div",12),p(5,"i",20),a(),n(6,"div",14),f(7),d(8,"translate"),a()()()}i&2&&(o(),m("aria-label",l(2,2,"rpi.throttled.undervoltage_title")+" - "+l(3,4,"rpi.throttled.undervoltage_description")),o(6),g(l(8,6,"rpi.throttled.undervoltage_title")))}function ue(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",21),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,se))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.label_plugins")),o(5),g(l(7,6,"menu.label_plugins")))}function _e(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",22),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,de))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.linux.label_logs")),o(5),g(l(7,6,"menu.linux.label_logs")))}function fe(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",23),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,le))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.linux.label_terminal")),o(5),g(l(7,6,"menu.linux.label_terminal")))}function ge(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",24),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,pe))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.config_json_editor")),o(5),g(l(7,6,"menu.config_json_editor")))}function ve(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",15),d(2,"translate"),_("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",25),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),c("routerLink",v(8,ce))("routerLinkActive","active"),m("aria-label",l(2,4,"menu.label_settings")),o(5),g(l(7,6,"menu.label_settings")))}function he(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",19),d(2,"translate"),_("click",function(){h(e);let t=w();return b(t.reloadPage())})("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",26),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),m("aria-label",l(2,2,"menu.reload")),o(5),g(l(7,4,"menu.reload")))}function be(i,k){if(i&1){let e=S();n(0,"div",10)(1,"div",19),d(2,"translate"),_("click",function(){h(e);let t=w();return b(t.logout())})("keydown",function(t){h(e);let r=w();return b(r.handleKeydown(t))}),n(3,"div",12),p(4,"i",27),a(),n(5,"div",14),f(6),d(7,"translate"),a()()()}i&2&&(o(),m("aria-label",l(2,2,"menu.tooltip_logout")),o(5),g(l(7,4,"menu.tooltip_logout")))}var J=(()=>{class i{$auth=u(A);$settings=u(T);$modal=u(E);$notification=u(X);$renderer=u(F);$router=u(V);$translate=u(L);isExpanded=!1;formAuth=this.$settings.formAuth;isAdmin=this.$auth.user.admin;enableTerminalAccess=this.$settings.env.enableTerminalAccess;rPiCurrentlyUnderVoltage=!1;rPiWasUnderVoltage=!1;isMobile=!1;freezeMenu=!1;isPwa=G();constructor(){this.isMobile=window.innerWidth<768;let e;window.addEventListener("resize",()=>{clearTimeout(e),e=setTimeout(()=>{this.updateListeners()},500)}),this.$router.events.subscribe(s=>{s instanceof W&&(this.closeSidebar(),this.freezeMenu=!0,setTimeout(()=>{this.freezeMenu=!1},750))})}ngOnInit(){this.$notification.raspberryPiThrottled.subscribe(r=>{r["Under Voltage"]&&(this.rPiCurrentlyUnderVoltage=!0),r["Under-voltage has occurred"]&&(this.rPiWasUnderVoltage=!0)}),this.$notification.formAuthEnabled.subscribe(r=>{this.formAuth=r});let e=document.querySelector(".sidebar"),s=document.querySelector(".m-header"),t=document.querySelector(".content");this.isMobile?document.addEventListener("touchstart",r=>{if(t.contains(r.target)&&this.isExpanded){r.preventDefault(),this.toggleSidebar();return}!e.contains(r.target)&&!s.contains(r.target)&&this.isExpanded&&(r.preventDefault(),this.closeSidebar())},{passive:!1}):(this.updateListeners(),s.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),s.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}),document.addEventListener("click",r=>{e.contains(r.target)&&r.clientX>60&&this.closeSidebar()},{passive:!1})),this.updateContentStyles()}toggleSidebar(){this.freezeMenu||(this.isExpanded=!this.isExpanded,this.updateContentStyles())}openUnderVoltageModal(){let e=this.$modal.open(H,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("rpi.throttled.undervoltage_title"),e.componentInstance.message=this.$translate.instant(this.rPiCurrentlyUnderVoltage?"rpi.throttled.currently_message":"rpi.throttled.previously_message"),e.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),e.componentInstance.faIconClass="fas fa-fw fa-bolt yellow-text",e.componentInstance.ctaButtonLink="https://pimylifeup.com/raspberry-pi-low-voltage-warning"}handleKeydown(e){if(e.key==="Enter"){let s=e.target;["menuitem","button"].includes(s.getAttribute("role"))&&s.click()}}reloadPage(){window.location.reload()}ngOnDestroy(){document.removeEventListener("touchstart",()=>{}),document.removeEventListener("click",()=>{})}logout(){this.$auth.logout()}openSidebar(){this.freezeMenu||(this.isExpanded=!0,this.updateContentStyles())}closeSidebar(){this.freezeMenu||(this.isExpanded=!1,this.updateContentStyles())}updateContentStyles(){let e=document.querySelector(".content");this.isExpanded?(this.$renderer.setStyle(e,"opacity","20%"),this.$renderer.setStyle(e,"pointer-events","none"),this.$renderer.setStyle(e,"overflow","hidden")):(this.$renderer.removeStyle(e,"opacity"),this.$renderer.removeStyle(e,"pointer-events"),this.$renderer.removeStyle(e,"overflow"))}updateListeners(){this.isMobile=window.innerWidth<768;let e=document.querySelector(".sidebar");e.removeAllListeners(),(this.isMobile||!this.isMobile&&this.$settings.menuMode!=="freeze")&&(e.addEventListener("mouseenter",()=>this.openSidebar(),{passive:!1}),e.addEventListener("mouseleave",()=>this.closeSidebar(),{passive:!1}))}static \u0275fac=function(s){return new(s||i)};static \u0275cmp=P({type:i,selectors:[["app-sidebar"]],inputs:{isExpanded:"isExpanded"},decls:61,vars:67,consts:[["tabindex","0","role","button",1,"m-header","text-end",3,"click","keydown"],[1,"me-2","d-block","d-lg-none",2,"font-size","0.9rem","color","#dddddd"],[3,"routerLink"],["ngSrc","../../../../assets/homebridge-logo.svg","alt","HB Logo","height","35","width","35",2,"height","35px","width","35px"],[1,"hb-logo-text-mobile"],[1,"hamburger-icon",3,"ngClass"],["role","navigation","id","sidebar",1,"sidebar",3,"ngClass"],["tabindex","0","role","button",1,"header",3,"click","keydown"],[1,"hb-logo-text"],[1,"link-wrapper"],[1,"link"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive","routerLinkActiveOptions"],[1,"icon"],[1,"fa","fa-fw","fa-house"],[1,"title"],["role","menuitem","tabindex","0",1,"link-row",3,"keydown","routerLink","routerLinkActive"],[1,"fa","fa-fw","fa-lightbulb"],[1,"fa","fa-fw","fa-question-circle-o"],[1,"fa","fa-fw","fa-power-off"],["role","menuitem","tabindex","0",1,"link-row",3,"click","keydown"],[1,"fas","fa-fw","fa-bolt","fa-beat","yellow-text",2,"--fa-beat-scale","1.5"],[1,"fa","fa-fw","fa-plug"],[1,"fa","fa-fw","fa-wave-square"],[1,"fa","fa-fw","fa-terminal"],[1,"fa","fa-fw","fa-code"],[1,"fa","fa-fw","fa-cog"],[1,"fa","fa-fw","fa-refresh"],[1,"fa","fa-fw","fa-right-from-bracket"]],template:function(s,t){s&1&&(n(0,"div",0),d(1,"translate"),_("click",function(){return t.toggleSidebar()})("keydown",function(C){return t.handleKeydown(C)}),p(2,"span",1),n(3,"a",2),d(4,"translate"),p(5,"img",3),n(6,"div",4),f(7,"Homebridge"),a()(),n(8,"div",5),p(9,"span")(10,"span")(11,"span")(12,"span"),a()(),n(13,"div",6)(14,"div",7),_("click",function(){return t.toggleSidebar()})("keydown",function(C){return t.handleKeydown(C)}),n(15,"a",2),d(16,"translate"),p(17,"img",3),n(18,"div",8),f(19,"Homebridge"),a()()(),n(20,"div",9)(21,"div",10)(22,"div",11),d(23,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(24,"div",12),p(25,"i",13),a(),n(26,"div",14),f(27),d(28,"translate"),a()()(),x(29,me,9,8,"div",10),x(30,ue,8,9,"div",10),n(31,"div",10)(32,"div",15),d(33,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(34,"div",12),p(35,"i",16),a(),n(36,"div",14),f(37),d(38,"translate"),a()()(),x(39,_e,8,9,"div",10),x(40,fe,8,9,"div",10),x(41,ge,8,9,"div",10),x(42,ve,8,9,"div",10),n(43,"div",10)(44,"div",15),d(45,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(46,"div",12),p(47,"i",17),a(),n(48,"div",14),f(49),d(50,"translate"),a()()(),n(51,"div",10)(52,"div",15),d(53,"translate"),_("keydown",function(C){return t.handleKeydown(C)}),n(54,"div",12),p(55,"i",18),a(),n(56,"div",14),f(57),d(58,"translate"),a()()(),x(59,he,8,6,"div",10),x(60,be,8,6,"div",10),a()()),s&2&&(m("aria-expanded",t.isExpanded?"true":"false")("aria-controls","sidebar")("aria-label",l(1,34,"menu.sidebar.aria_menu")),o(3),c("routerLink",v(56,B)),m("aria-label",l(4,36,"menu.label_status")),o(5),c("ngClass",M(57,te,t.isExpanded)),o(5),c("ngClass",M(59,ne,t.isExpanded)),o(2),c("routerLink",v(61,B)),m("aria-label",l(16,38,"menu.label_status")),o(7),c("routerLink",v(62,B))("routerLinkActive","active")("routerLinkActiveOptions",v(63,ie)),m("aria-label",l(23,40,"menu.label_status")),o(5),g(l(28,42,"menu.label_status")),o(2),y(t.rPiWasUnderVoltage||t.rPiCurrentlyUnderVoltage?29:-1),o(),y(t.isAdmin?30:-1),o(2),c("routerLink",v(64,oe))("routerLinkActive","active"),m("aria-label",l(33,44,"menu.label_accessories")),o(5),g(l(38,46,"menu.label_accessories")),o(2),y(t.isAdmin?39:-1),o(),y(t.enableTerminalAccess&&t.isAdmin?40:-1),o(),y(t.isAdmin?41:-1),o(),y(t.isAdmin?42:-1),o(2),c("routerLink",v(65,re))("routerLinkActive","active"),m("aria-label",l(45,48,"support.title")),o(5),g(l(50,50,"support.title")),o(3),c("routerLink",v(66,ae))("routerLinkActive","active"),m("aria-label",l(53,52,"menu.restart.title")),o(5),g(l(58,54,"menu.restart.title")),o(2),y(t.isPwa?59:-1),o(),y(t.formAuth?60:-1))},dependencies:[N,K,O,D,U],styles:[".m-header[_ngcontent-%COMP%]{position:fixed;top:0;left:0;width:100%;height:65px;z-index:510;display:flex;align-items:center;padding-left:3px;padding-right:3px}.m-header[_ngcontent-%COMP%]:hover{cursor:pointer}@media (min-width: 768px){.m-header[_ngcontent-%COMP%]{display:none}}.sidebar[_ngcontent-%COMP%]{position:fixed;left:0;top:0;height:100vh;transition:.3s;width:60px;z-index:500}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;padding:15px 10px 15px 11px;font-size:.85rem}.sidebar[_ngcontent-%COMP%] .header[_ngcontent-%COMP%]:hover{cursor:pointer}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{overflow-y:auto;max-height:calc(100vh - 80px)!important}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%]{display:flex;align-items:center;padding:15px 10px;cursor:pointer;transition:.2s;font-size:17px}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{flex:0 0 38px;display:flex;align-items:center;justify-content:center}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{flex:1;transition:.3s;max-width:0;overflow:hidden;white-space:nowrap}@media (max-width: 767px){.sidebar[_ngcontent-%COMP%]{width:0}.sidebar[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:none}}.sidebar.expanded[_ngcontent-%COMP%]{width:210px}@media (max-width: 767px){.sidebar.expanded[_ngcontent-%COMP%]{width:210px}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%]{display:block}}.sidebar.expanded[_ngcontent-%COMP%] .link-wrapper[_ngcontent-%COMP%] .link[_ngcontent-%COMP%] .link-row[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{max-width:150px;padding-left:10px}.hamburger-icon[_ngcontent-%COMP%]{margin:-7px 0 0 25px}@media (min-width: 768px){.hb-logo-text[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px}.sidebar.expanded[_ngcontent-%COMP%] .hb-logo-text[_ngcontent-%COMP%]{opacity:1;left:55px;transition:.3s}.sidebar[_ngcontent-%COMP%]:not(.expanded) .hb-logo-text[_ngcontent-%COMP%]{opacity:0;left:40px;transition:.3s}.hb-logo-text-mobile[_ngcontent-%COMP%], .hamburger-icon[_ngcontent-%COMP%]{display:none!important}}@media (max-width: 767px){.hb-logo-text[_ngcontent-%COMP%]{display:none!important}.hb-logo-text-mobile[_ngcontent-%COMP%]{color:#fff;position:absolute;top:17px;font-size:22px;padding-left:3px;opacity:1;left:55px}.hamburger-icon[_ngcontent-%COMP%]{position:absolute;right:10px;top:28px;width:30px;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.5s ease-in-out;-moz-transition:.5s ease-in-out;-o-transition:.5s ease-in-out;transition:.5s ease-in-out;cursor:pointer}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;position:absolute;height:2px;width:100%;background-color:#fff;border-radius:9px;opacity:1;left:0;-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0);-webkit-transition:.25s ease-in-out;-moz-transition:.25s ease-in-out;-o-transition:.25s ease-in-out;transition:.25s ease-in-out}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:0}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2), .hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){top:10px}.hamburger-icon[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:20px}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(1){top:10px;width:0;left:50%}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(2){-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}.hamburger-icon-cross[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:nth-child(4){top:10px;width:0;left:50%}}"]})}return i})();var we=i=>({sidebarExpanded:i}),Xe=(()=>{class i{$auth=u(A);$modal=u(E);$router=u(V);$settings=u(T);$translate=u(L);$ws=u(j);io;sidebarExpanded=!1;ngOnInit(){this.io=this.$ws.connectToNamespace("app"),this.io.socket.on("reconnect",()=>{this.$auth.checkToken()}),this.compareServerUiVersion()}compareServerUiVersion(){return I(this,null,function*(){if(this.$settings.settingsLoaded||(yield z(this.$settings.onSettingsLoaded)),this.$router.url!=="/restart"&&(0,Q.lt)(this.$settings.uiVersion,$.serverTarget)){console.log(`Server restart required. UI Version: ${$.serverTarget} - Server Version: ${this.$settings.uiVersion} `);let e=this.$modal.open(R,{size:"lg",backdrop:"static"});e.componentInstance.title=this.$translate.instant("platform.version.service_restart_required"),e.componentInstance.message=this.$translate.instant("platform.version.restart_required",{serverVersion:this.$settings.uiVersion,uiVersion:$.serverTarget}),e.componentInstance.confirmButtonLabel=this.$translate.instant("menu.tooltip_restart"),e.componentInstance.faIconClass="fas fa-power-off orange-text",e.result.then(()=>this.$router.navigate(["/restart"])).catch(()=>{})}})}static \u0275fac=function(s){return new(s||i)};static \u0275cmp=P({type:i,selectors:[["app-layout"]],decls:3,vars:4,consts:[[3,"isExpanded"],[1,"content","px-3","p-md-4",3,"ngClass"]],template:function(s,t){s&1&&(p(0,"app-sidebar",0),n(1,"div",1),p(2,"router-outlet"),a()),s&2&&(c("isExpanded",t.sidebarExpanded),o(),c("ngClass",M(2,we,t.sidebarExpanded)))},dependencies:[J,O,q],styles:[".content[_ngcontent-%COMP%]{margin-left:60px;transition:.3s;height:100%}@media (max-width: 767px){.content[_ngcontent-%COMP%]{margin-left:0;padding-top:85px!important}}@media (min-width: 768px){.content[_ngcontent-%COMP%]{height:100%}}a[_ngcontent-%COMP%]:hover{text-decoration:none!important}"]})}return i})();export{Xe as LayoutComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as u,g as s}from"./chunk-ZJ3JJYIN.js";import{k as l,n as d}from"./chunk-
|
|
1
|
+
import{d as u,g as s}from"./chunk-ZJ3JJYIN.js";import{k as l,n as d}from"./chunk-2ZY66HU7.js";import{a as p}from"./chunk-R3563DDE.js";import"./chunk-HBOWJDR5.js";import{ga as c,h as f,ha as i,la as e,nb as n,w as m}from"./chunk-ULJPS3WS.js";var a=(()=>{class t{$api=e(d);$router=e(u);$toastr=e(l);$translate=e(p);resolve(){return f(this,null,function*(){try{let o=yield m(this.$api.get("/config-editor"));return JSON.stringify(o,null,4)}catch(o){console.error(o),this.$toastr.error(o.message,this.$translate.instant("toast.title_error")),this.$router.navigate(["/"])}})}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var y=[{path:"",loadComponent:()=>import("./chunk-LIEJVB5Q.js").then(t=>t.ConfigEditorComponent),resolve:{config:a}}],v=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=n({type:t});static \u0275inj=i({imports:[s.forChild(y),s]})}return t})();var T=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=n({type:t});static \u0275inj=i({providers:[a],imports:[v]})}return t})();export{T as ConfigEditorModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _i,b as r2}from"./chunk-JHPEPG44.js";import{a as qf}from"./chunk-HUAADM2I.js";import{a as Bf}from"./chunk-THGDS273.js";import{a as zf,b as lo}from"./chunk-3WACEBJM.js";import{a as Lf,b as Uf}from"./chunk-BG5MCCBU.js";import{a as Rf}from"./chunk-QIOCGI3G.js";import{a as Qa,b as is}from"./chunk-EI76KND2.js";import{a as es,b as ts}from"./chunk-YJWU65EW.js";import{a as Vf}from"./chunk-CHYWVK3W.js";import{a as Ka,b as Ga,c as Ja,d as Xa,e as Ya,f as Za,g as rr,m as Oe,n as ot,o as Df,p as Af,q as Nf,r as jf,s as Ff,t as or}from"./chunk-C3HWKB2Q.js";import{A as so,a as Sf,b as Yi,c as ir,e as $t,f as $f,h as Ef,i as Tf,j as Pf,k as Of,l as Zi,m as Mf,o as Qi,r as nr,s as On,t as Mn,y as kf,z as oi}from"./chunk-WFYBML4S.js";import{a as tn}from"./chunk-VLNYF5AS.js";import{d as yi}from"./chunk-ZJ3JJYIN.js";import{b as Re}from"./chunk-ZCSPADUX.js";import{k as Ce,m as en,n as ve}from"./chunk-FPLWS5WP.js";import{a as xe,b as Me}from"./chunk-R3563DDE.js";import{e as If}from"./chunk-HBOWJDR5.js";import{$a as mf,Ac as vf,Bc as xf,Ca as Wi,Cc as Pe,D as uf,Da as ff,Dc as ri,Ec as Tn,Fa as Qn,Fc as Wt,Gc as tr,Hb as G,Hc as w,Ib as E,Ic as S,Jb as T,Jc as He,Lb as at,M as Yn,Mb as st,Nb as lt,Ob as b,Pb as f,Qb as m,Qc as xt,Rb as $,Rc as z,Sb as Qe,Sc as Xi,Tb as rt,Ub as gi,Uc as Cf,Vb as yf,Wb as _f,Xa as he,Z as lu,_b as H,a as X,aa as ao,ab as d,b as $e,bc as q,cc as Ht,dc as y,e as g,fa as cf,fb as Ua,g as ze,ga as Ft,gb as Ti,h as K,ha as Zn,hc as uu,ib as Sn,ic as cu,id as Kt,ja as df,jc as du,jd as Pn,k as of,ka as pf,kc as Ki,kd as Ct,la as P,lc as Gi,mb as Y,mc as bf,n as jt,nb as er,nc as ni,o as su,ob as $n,oc as Ji,pb as hf,pc as Z,q as af,qc as x,ra as j,rc as R,rd as Wa,sa as F,sb as ue,sc as V,tc as En,ub as gf,uc as Ha,v as sf,vb as za,w as le,x as lf,xc as Ae,yc as Ne,za as La,zc as je,zd as wf}from"./chunk-ULJPS3WS.js";var po=g(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.regexpCode=be.getEsmExportName=be.getProperty=be.safeStringify=be.stringify=be.strConcat=be.addCodeArg=be.str=be._=be.nil=be._Code=be.Name=be.IDENTIFIER=be._CodeOrName=void 0;var uo=class{};be._CodeOrName=uo;be.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var kn=class extends uo{constructor(t){if(super(),!be.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};be.Name=kn;var Gt=class extends uo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((i,n)=>`${i}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((i,n)=>(n instanceof kn&&(i[n.str]=(i[n.str]||0)+1),i),{})}};be._Code=Gt;be.nil=new Gt("");function Hf(e,...t){let i=[e[0]],n=0;for(;n<t.length;)fu(i,t[n]),i.push(e[++n]);return new Gt(i)}be._=Hf;var pu=new Gt("+");function Wf(e,...t){let i=[co(e[0])],n=0;for(;n<t.length;)i.push(pu),fu(i,t[n]),i.push(pu,co(e[++n]));return a2(i),new Gt(i)}be.str=Wf;function fu(e,t){t instanceof Gt?e.push(...t._items):t instanceof kn?e.push(t):e.push(u2(t))}be.addCodeArg=fu;function a2(e){let t=1;for(;t<e.length-1;){if(e[t]===pu){let i=s2(e[t-1],e[t+1]);if(i!==void 0){e.splice(t-1,3,i);continue}e[t++]="+"}t++}}function s2(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof kn||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof kn))return`"${e}${t.slice(1)}`}function l2(e,t){return t.emptyStr()?e:e.emptyStr()?t:Wf`${e}${t}`}be.strConcat=l2;function u2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:co(Array.isArray(e)?e.join(","):e)}function c2(e){return new Gt(co(e))}be.stringify=c2;function co(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}be.safeStringify=co;function d2(e){return typeof e=="string"&&be.IDENTIFIER.test(e)?new Gt(`.${e}`):Hf`[${e}]`}be.getProperty=d2;function p2(e){if(typeof e=="string"&&be.IDENTIFIER.test(e))return new Gt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}be.getEsmExportName=p2;function f2(e){return new Gt(e.toString())}be.regexpCode=f2});var gu=g(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.ValueScope=Tt.ValueScopeName=Tt.Scope=Tt.varKinds=Tt.UsedValueState=void 0;var Et=po(),mu=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ns=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(ns||(Tt.UsedValueState=ns={}));Tt.varKinds={const:new Et.Name("const"),let:new Et.Name("let"),var:new Et.Name("var")};var rs=class{constructor({prefixes:t,parent:i}={}){this._names={},this._prefixes=t,this._parent=i}toName(t){return t instanceof Et.Name?t:this.name(t)}name(t){return new Et.Name(this._newName(t))}_newName(t){let i=this._names[t]||this._nameGroup(t);return`${t}${i.index++}`}_nameGroup(t){var i,n;if(!((n=(i=this._parent)===null||i===void 0?void 0:i._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Tt.Scope=rs;var os=class extends Et.Name{constructor(t,i){super(i),this.prefix=t}setValue(t,{property:i,itemIndex:n}){this.value=t,this.scopePath=(0,Et._)`.${new Et.Name(i)}[${n}]`}};Tt.ValueScopeName=os;var m2=(0,Et._)`\n`,hu=class extends rs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts=$e(X({},t),{_n:t.lines?m2:Et.nil})}get(){return this._scope}name(t){return new os(t,this._newName(t))}value(t,i){var n;if(i.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(t),{prefix:o}=r,a=(n=i.key)!==null&&n!==void 0?n:i.ref,s=this._values[o];if(s){let c=s.get(a);if(c)return c}else s=this._values[o]=new Map;s.set(a,r);let l=this._scope[o]||(this._scope[o]=[]),u=l.length;return l[u]=i.ref,r.setValue(i,{property:o,itemIndex:u}),r}getValue(t,i){let n=this._values[t];if(n)return n.get(i)}scopeRefs(t,i=this._values){return this._reduceValues(i,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Et._)`${t}${n.scopePath}`})}scopeCode(t=this._values,i,n){return this._reduceValues(t,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},i,n)}_reduceValues(t,i,n={},r){let o=Et.nil;for(let a in t){let s=t[a];if(!s)continue;let l=n[a]=n[a]||new Map;s.forEach(u=>{if(l.has(u))return;l.set(u,ns.Started);let c=i(u);if(c){let p=this.opts.es5?Tt.varKinds.var:Tt.varKinds.const;o=(0,Et._)`${o}${p} ${u} = ${c};${this.opts._n}`}else if(c=r?.(u))o=(0,Et._)`${o}${c}${this.opts._n}`;else throw new mu(u);l.set(u,ns.Completed)})}return o}};Tt.ValueScope=hu});var ee=g(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.or=ce.and=ce.not=ce.CodeGen=ce.operators=ce.varKinds=ce.ValueScopeName=ce.ValueScope=ce.Scope=ce.Name=ce.regexpCode=ce.stringify=ce.getProperty=ce.nil=ce.strConcat=ce.str=ce._=void 0;var ge=po(),ai=gu(),nn=po();Object.defineProperty(ce,"_",{enumerable:!0,get:function(){return nn._}});Object.defineProperty(ce,"str",{enumerable:!0,get:function(){return nn.str}});Object.defineProperty(ce,"strConcat",{enumerable:!0,get:function(){return nn.strConcat}});Object.defineProperty(ce,"nil",{enumerable:!0,get:function(){return nn.nil}});Object.defineProperty(ce,"getProperty",{enumerable:!0,get:function(){return nn.getProperty}});Object.defineProperty(ce,"stringify",{enumerable:!0,get:function(){return nn.stringify}});Object.defineProperty(ce,"regexpCode",{enumerable:!0,get:function(){return nn.regexpCode}});Object.defineProperty(ce,"Name",{enumerable:!0,get:function(){return nn.Name}});var cs=gu();Object.defineProperty(ce,"Scope",{enumerable:!0,get:function(){return cs.Scope}});Object.defineProperty(ce,"ValueScope",{enumerable:!0,get:function(){return cs.ValueScope}});Object.defineProperty(ce,"ValueScopeName",{enumerable:!0,get:function(){return cs.ValueScopeName}});Object.defineProperty(ce,"varKinds",{enumerable:!0,get:function(){return cs.varKinds}});ce.operators={GT:new ge._Code(">"),GTE:new ge._Code(">="),LT:new ge._Code("<"),LTE:new ge._Code("<="),EQ:new ge._Code("==="),NEQ:new ge._Code("!=="),NOT:new ge._Code("!"),OR:new ge._Code("||"),AND:new ge._Code("&&"),ADD:new ge._Code("+")};var Pi=class{optimizeNodes(){return this}optimizeNames(t,i){return this}},yu=class extends Pi{constructor(t,i,n){super(),this.varKind=t,this.name=i,this.rhs=n}render({es5:t,_n:i}){let n=t?ai.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+i}optimizeNames(t,i){if(t[this.name.str])return this.rhs&&(this.rhs=sr(this.rhs,t,i)),this}get names(){return this.rhs instanceof ge._CodeOrName?this.rhs.names:{}}},ss=class extends Pi{constructor(t,i,n){super(),this.lhs=t,this.rhs=i,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,i){if(!(this.lhs instanceof ge.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=sr(this.rhs,t,i),this}get names(){let t=this.lhs instanceof ge.Name?{}:X({},this.lhs.names);return us(t,this.rhs)}},_u=class extends ss{constructor(t,i,n,r){super(t,n,r),this.op=i}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},vu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xu=class extends Pi{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Cu=class extends Pi{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,i){return this.code=sr(this.code,t,i),this}get names(){return this.code instanceof ge._CodeOrName?this.code.names:{}}},fo=class extends Pi{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((i,n)=>i+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,i=t.length;for(;i--;){let n=t[i].optimizeNodes();Array.isArray(n)?t.splice(i,1,...n):n?t[i]=n:t.splice(i,1)}return t.length>0?this:void 0}optimizeNames(t,i){let{nodes:n}=this,r=n.length;for(;r--;){let o=n[r];o.optimizeNames(t,i)||(h2(t,o.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,i)=>Dn(t,i.names),{})}},Oi=class extends fo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},wu=class extends fo{},Iu=(()=>{class e extends Oi{}return e.kind="else",e})(),as=(()=>{class e extends Oi{constructor(i,n){super(n),this.condition=i}render(i){let n=`if(${this.condition})`+super.render(i);return this.else&&(n+="else "+this.else.render(i)),n}optimizeNodes(){super.optimizeNodes();let i=this.condition;if(i===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new Iu(r):r}if(n)return i===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(Yf(i),n instanceof e?[n]:n.nodes);if(!(i===!1||!this.nodes.length))return this}optimizeNames(i,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(i,n),!!(super.optimizeNames(i,n)||this.else))return this.condition=sr(this.condition,i,n),this}get names(){let i=super.names;return us(i,this.condition),this.else&&Dn(i,this.else.names),i}}return e.kind="if",e})(),ds=(()=>{class e extends Oi{}return e.kind="for",e})(),Su=class extends ds{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iteration=sr(this.iteration,t,i),this}get names(){return Dn(super.names,this.iteration.names)}},$u=class extends ds{constructor(t,i,n,r){super(),this.varKind=t,this.name=i,this.from=n,this.to=r}render(t){let i=t.es5?ai.varKinds.var:this.varKind,{name:n,from:r,to:o}=this;return`for(${i} ${n}=${r}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=us(super.names,this.from);return us(t,this.to)}},ls=class extends ds{constructor(t,i,n,r){super(),this.loop=t,this.varKind=i,this.name=n,this.iterable=r}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iterable=sr(this.iterable,t,i),this}get names(){return Dn(super.names,this.iterable.names)}},Kf=(()=>{class e extends Oi{constructor(i,n,r){super(),this.name=i,this.args=n,this.async=r}render(i){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(i)}}return e.kind="func",e})(),Gf=(()=>{class e extends fo{render(i){return"return "+super.render(i)}}return e.kind="return",e})(),Eu=class extends Oi{render(t){let i="try"+super.render(t);return this.catch&&(i+=this.catch.render(t)),this.finally&&(i+=this.finally.render(t)),i}optimizeNodes(){var t,i;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(i=this.finally)===null||i===void 0||i.optimizeNodes(),this}optimizeNames(t,i){var n,r;return super.optimizeNames(t,i),(n=this.catch)===null||n===void 0||n.optimizeNames(t,i),(r=this.finally)===null||r===void 0||r.optimizeNames(t,i),this}get names(){let t=super.names;return this.catch&&Dn(t,this.catch.names),this.finally&&Dn(t,this.finally.names),t}},Jf=(()=>{class e extends Oi{constructor(i){super(),this.error=i}render(i){return`catch(${this.error})`+super.render(i)}}return e.kind="catch",e})(),Xf=(()=>{class e extends Oi{render(i){return"finally"+super.render(i)}}return e.kind="finally",e})(),Tu=class{constructor(t,i={}){this._values={},this._blockStarts=[],this._constants={},this.opts=$e(X({},i),{_n:i.lines?`
|
|
1
|
+
import{a as _i,b as r2}from"./chunk-JHPEPG44.js";import{a as qf}from"./chunk-HUAADM2I.js";import{a as Bf}from"./chunk-THGDS273.js";import{a as zf,b as lo}from"./chunk-7JLBC46N.js";import{a as Lf,b as Uf}from"./chunk-BG5MCCBU.js";import{a as Rf}from"./chunk-QIOCGI3G.js";import{a as Qa,b as is}from"./chunk-EI76KND2.js";import{a as es,b as ts}from"./chunk-YJWU65EW.js";import{a as Vf}from"./chunk-6JWROI2O.js";import{a as Ka,b as Ga,c as Ja,d as Xa,e as Ya,f as Za,g as rr,m as Oe,n as ot,o as Df,p as Af,q as Nf,r as jf,s as Ff,t as or}from"./chunk-C3HWKB2Q.js";import{A as so,a as Sf,b as Yi,c as ir,e as $t,f as $f,h as Ef,i as Tf,j as Pf,k as Of,l as Zi,m as Mf,o as Qi,r as nr,s as On,t as Mn,y as kf,z as oi}from"./chunk-WFYBML4S.js";import{a as tn}from"./chunk-75U46IUB.js";import{d as yi}from"./chunk-ZJ3JJYIN.js";import{b as Re}from"./chunk-JSYOOM36.js";import{k as Ce,m as en,n as ve}from"./chunk-2ZY66HU7.js";import{a as xe,b as Me}from"./chunk-R3563DDE.js";import{e as If}from"./chunk-HBOWJDR5.js";import{$a as mf,Ac as vf,Bc as xf,Ca as Wi,Cc as Pe,D as uf,Da as ff,Dc as ri,Ec as Tn,Fa as Qn,Fc as Wt,Gc as tr,Hb as G,Hc as w,Ib as E,Ic as S,Jb as T,Jc as He,Lb as at,M as Yn,Mb as st,Nb as lt,Ob as b,Pb as f,Qb as m,Qc as xt,Rb as $,Rc as z,Sb as Qe,Sc as Xi,Tb as rt,Ub as gi,Uc as Cf,Vb as yf,Wb as _f,Xa as he,Z as lu,_b as H,a as X,aa as ao,ab as d,b as $e,bc as q,cc as Ht,dc as y,e as g,fa as cf,fb as Ua,g as ze,ga as Ft,gb as Ti,h as K,ha as Zn,hc as uu,ib as Sn,ic as cu,id as Kt,ja as df,jc as du,jd as Pn,k as of,ka as pf,kc as Ki,kd as Ct,la as P,lc as Gi,mb as Y,mc as bf,n as jt,nb as er,nc as ni,o as su,ob as $n,oc as Ji,pb as hf,pc as Z,q as af,qc as x,ra as j,rc as R,rd as Wa,sa as F,sb as ue,sc as V,tc as En,ub as gf,uc as Ha,v as sf,vb as za,w as le,x as lf,xc as Ae,yc as Ne,za as La,zc as je,zd as wf}from"./chunk-ULJPS3WS.js";var po=g(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.regexpCode=be.getEsmExportName=be.getProperty=be.safeStringify=be.stringify=be.strConcat=be.addCodeArg=be.str=be._=be.nil=be._Code=be.Name=be.IDENTIFIER=be._CodeOrName=void 0;var uo=class{};be._CodeOrName=uo;be.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var kn=class extends uo{constructor(t){if(super(),!be.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};be.Name=kn;var Gt=class extends uo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((i,n)=>`${i}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((i,n)=>(n instanceof kn&&(i[n.str]=(i[n.str]||0)+1),i),{})}};be._Code=Gt;be.nil=new Gt("");function Hf(e,...t){let i=[e[0]],n=0;for(;n<t.length;)fu(i,t[n]),i.push(e[++n]);return new Gt(i)}be._=Hf;var pu=new Gt("+");function Wf(e,...t){let i=[co(e[0])],n=0;for(;n<t.length;)i.push(pu),fu(i,t[n]),i.push(pu,co(e[++n]));return a2(i),new Gt(i)}be.str=Wf;function fu(e,t){t instanceof Gt?e.push(...t._items):t instanceof kn?e.push(t):e.push(u2(t))}be.addCodeArg=fu;function a2(e){let t=1;for(;t<e.length-1;){if(e[t]===pu){let i=s2(e[t-1],e[t+1]);if(i!==void 0){e.splice(t-1,3,i);continue}e[t++]="+"}t++}}function s2(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof kn||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof kn))return`"${e}${t.slice(1)}`}function l2(e,t){return t.emptyStr()?e:e.emptyStr()?t:Wf`${e}${t}`}be.strConcat=l2;function u2(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:co(Array.isArray(e)?e.join(","):e)}function c2(e){return new Gt(co(e))}be.stringify=c2;function co(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}be.safeStringify=co;function d2(e){return typeof e=="string"&&be.IDENTIFIER.test(e)?new Gt(`.${e}`):Hf`[${e}]`}be.getProperty=d2;function p2(e){if(typeof e=="string"&&be.IDENTIFIER.test(e))return new Gt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}be.getEsmExportName=p2;function f2(e){return new Gt(e.toString())}be.regexpCode=f2});var gu=g(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.ValueScope=Tt.ValueScopeName=Tt.Scope=Tt.varKinds=Tt.UsedValueState=void 0;var Et=po(),mu=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ns=function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e}(ns||(Tt.UsedValueState=ns={}));Tt.varKinds={const:new Et.Name("const"),let:new Et.Name("let"),var:new Et.Name("var")};var rs=class{constructor({prefixes:t,parent:i}={}){this._names={},this._prefixes=t,this._parent=i}toName(t){return t instanceof Et.Name?t:this.name(t)}name(t){return new Et.Name(this._newName(t))}_newName(t){let i=this._names[t]||this._nameGroup(t);return`${t}${i.index++}`}_nameGroup(t){var i,n;if(!((n=(i=this._parent)===null||i===void 0?void 0:i._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Tt.Scope=rs;var os=class extends Et.Name{constructor(t,i){super(i),this.prefix=t}setValue(t,{property:i,itemIndex:n}){this.value=t,this.scopePath=(0,Et._)`.${new Et.Name(i)}[${n}]`}};Tt.ValueScopeName=os;var m2=(0,Et._)`\n`,hu=class extends rs{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts=$e(X({},t),{_n:t.lines?m2:Et.nil})}get(){return this._scope}name(t){return new os(t,this._newName(t))}value(t,i){var n;if(i.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(t),{prefix:o}=r,a=(n=i.key)!==null&&n!==void 0?n:i.ref,s=this._values[o];if(s){let c=s.get(a);if(c)return c}else s=this._values[o]=new Map;s.set(a,r);let l=this._scope[o]||(this._scope[o]=[]),u=l.length;return l[u]=i.ref,r.setValue(i,{property:o,itemIndex:u}),r}getValue(t,i){let n=this._values[t];if(n)return n.get(i)}scopeRefs(t,i=this._values){return this._reduceValues(i,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Et._)`${t}${n.scopePath}`})}scopeCode(t=this._values,i,n){return this._reduceValues(t,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},i,n)}_reduceValues(t,i,n={},r){let o=Et.nil;for(let a in t){let s=t[a];if(!s)continue;let l=n[a]=n[a]||new Map;s.forEach(u=>{if(l.has(u))return;l.set(u,ns.Started);let c=i(u);if(c){let p=this.opts.es5?Tt.varKinds.var:Tt.varKinds.const;o=(0,Et._)`${o}${p} ${u} = ${c};${this.opts._n}`}else if(c=r?.(u))o=(0,Et._)`${o}${c}${this.opts._n}`;else throw new mu(u);l.set(u,ns.Completed)})}return o}};Tt.ValueScope=hu});var ee=g(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.or=ce.and=ce.not=ce.CodeGen=ce.operators=ce.varKinds=ce.ValueScopeName=ce.ValueScope=ce.Scope=ce.Name=ce.regexpCode=ce.stringify=ce.getProperty=ce.nil=ce.strConcat=ce.str=ce._=void 0;var ge=po(),ai=gu(),nn=po();Object.defineProperty(ce,"_",{enumerable:!0,get:function(){return nn._}});Object.defineProperty(ce,"str",{enumerable:!0,get:function(){return nn.str}});Object.defineProperty(ce,"strConcat",{enumerable:!0,get:function(){return nn.strConcat}});Object.defineProperty(ce,"nil",{enumerable:!0,get:function(){return nn.nil}});Object.defineProperty(ce,"getProperty",{enumerable:!0,get:function(){return nn.getProperty}});Object.defineProperty(ce,"stringify",{enumerable:!0,get:function(){return nn.stringify}});Object.defineProperty(ce,"regexpCode",{enumerable:!0,get:function(){return nn.regexpCode}});Object.defineProperty(ce,"Name",{enumerable:!0,get:function(){return nn.Name}});var cs=gu();Object.defineProperty(ce,"Scope",{enumerable:!0,get:function(){return cs.Scope}});Object.defineProperty(ce,"ValueScope",{enumerable:!0,get:function(){return cs.ValueScope}});Object.defineProperty(ce,"ValueScopeName",{enumerable:!0,get:function(){return cs.ValueScopeName}});Object.defineProperty(ce,"varKinds",{enumerable:!0,get:function(){return cs.varKinds}});ce.operators={GT:new ge._Code(">"),GTE:new ge._Code(">="),LT:new ge._Code("<"),LTE:new ge._Code("<="),EQ:new ge._Code("==="),NEQ:new ge._Code("!=="),NOT:new ge._Code("!"),OR:new ge._Code("||"),AND:new ge._Code("&&"),ADD:new ge._Code("+")};var Pi=class{optimizeNodes(){return this}optimizeNames(t,i){return this}},yu=class extends Pi{constructor(t,i,n){super(),this.varKind=t,this.name=i,this.rhs=n}render({es5:t,_n:i}){let n=t?ai.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+i}optimizeNames(t,i){if(t[this.name.str])return this.rhs&&(this.rhs=sr(this.rhs,t,i)),this}get names(){return this.rhs instanceof ge._CodeOrName?this.rhs.names:{}}},ss=class extends Pi{constructor(t,i,n){super(),this.lhs=t,this.rhs=i,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,i){if(!(this.lhs instanceof ge.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=sr(this.rhs,t,i),this}get names(){let t=this.lhs instanceof ge.Name?{}:X({},this.lhs.names);return us(t,this.rhs)}},_u=class extends ss{constructor(t,i,n,r){super(t,n,r),this.op=i}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},vu=class extends Pi{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xu=class extends Pi{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Cu=class extends Pi{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,i){return this.code=sr(this.code,t,i),this}get names(){return this.code instanceof ge._CodeOrName?this.code.names:{}}},fo=class extends Pi{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((i,n)=>i+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,i=t.length;for(;i--;){let n=t[i].optimizeNodes();Array.isArray(n)?t.splice(i,1,...n):n?t[i]=n:t.splice(i,1)}return t.length>0?this:void 0}optimizeNames(t,i){let{nodes:n}=this,r=n.length;for(;r--;){let o=n[r];o.optimizeNames(t,i)||(h2(t,o.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,i)=>Dn(t,i.names),{})}},Oi=class extends fo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},wu=class extends fo{},Iu=(()=>{class e extends Oi{}return e.kind="else",e})(),as=(()=>{class e extends Oi{constructor(i,n){super(n),this.condition=i}render(i){let n=`if(${this.condition})`+super.render(i);return this.else&&(n+="else "+this.else.render(i)),n}optimizeNodes(){super.optimizeNodes();let i=this.condition;if(i===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new Iu(r):r}if(n)return i===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(Yf(i),n instanceof e?[n]:n.nodes);if(!(i===!1||!this.nodes.length))return this}optimizeNames(i,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(i,n),!!(super.optimizeNames(i,n)||this.else))return this.condition=sr(this.condition,i,n),this}get names(){let i=super.names;return us(i,this.condition),this.else&&Dn(i,this.else.names),i}}return e.kind="if",e})(),ds=(()=>{class e extends Oi{}return e.kind="for",e})(),Su=class extends ds{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iteration=sr(this.iteration,t,i),this}get names(){return Dn(super.names,this.iteration.names)}},$u=class extends ds{constructor(t,i,n,r){super(),this.varKind=t,this.name=i,this.from=n,this.to=r}render(t){let i=t.es5?ai.varKinds.var:this.varKind,{name:n,from:r,to:o}=this;return`for(${i} ${n}=${r}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=us(super.names,this.from);return us(t,this.to)}},ls=class extends ds{constructor(t,i,n,r){super(),this.loop=t,this.varKind=i,this.name=n,this.iterable=r}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,i){if(super.optimizeNames(t,i))return this.iterable=sr(this.iterable,t,i),this}get names(){return Dn(super.names,this.iterable.names)}},Kf=(()=>{class e extends Oi{constructor(i,n,r){super(),this.name=i,this.args=n,this.async=r}render(i){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(i)}}return e.kind="func",e})(),Gf=(()=>{class e extends fo{render(i){return"return "+super.render(i)}}return e.kind="return",e})(),Eu=class extends Oi{render(t){let i="try"+super.render(t);return this.catch&&(i+=this.catch.render(t)),this.finally&&(i+=this.finally.render(t)),i}optimizeNodes(){var t,i;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(i=this.finally)===null||i===void 0||i.optimizeNodes(),this}optimizeNames(t,i){var n,r;return super.optimizeNames(t,i),(n=this.catch)===null||n===void 0||n.optimizeNames(t,i),(r=this.finally)===null||r===void 0||r.optimizeNames(t,i),this}get names(){let t=super.names;return this.catch&&Dn(t,this.catch.names),this.finally&&Dn(t,this.finally.names),t}},Jf=(()=>{class e extends Oi{constructor(i){super(),this.error=i}render(i){return`catch(${this.error})`+super.render(i)}}return e.kind="catch",e})(),Xf=(()=>{class e extends Oi{render(i){return"finally"+super.render(i)}}return e.kind="finally",e})(),Tu=class{constructor(t,i={}){this._values={},this._blockStarts=[],this._constants={},this.opts=$e(X({},i),{_n:i.lines?`
|
|
2
2
|
`:""}),this._extScope=t,this._scope=new ai.Scope({parent:t}),this._nodes=[new wu]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,i){let n=this._extScope.value(t,i);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,i){return this._extScope.getValue(t,i)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,i,n,r){let o=this._scope.toName(i);return n!==void 0&&r&&(this._constants[o.str]=n),this._leafNode(new yu(t,o,n)),o}const(t,i,n){return this._def(ai.varKinds.const,t,i,n)}let(t,i,n){return this._def(ai.varKinds.let,t,i,n)}var(t,i,n){return this._def(ai.varKinds.var,t,i,n)}assign(t,i,n){return this._leafNode(new ss(t,i,n))}add(t,i){return this._leafNode(new _u(t,ce.operators.ADD,i))}code(t){return typeof t=="function"?t():t!==ge.nil&&this._leafNode(new Cu(t)),this}object(...t){let i=["{"];for(let[n,r]of t)i.length>1&&i.push(","),i.push(n),(n!==r||this.opts.es5)&&(i.push(":"),(0,ge.addCodeArg)(i,r));return i.push("}"),new ge._Code(i)}if(t,i,n){if(this._blockNode(new as(t)),i&&n)this.code(i).else().code(n).endIf();else if(i)this.code(i).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new as(t))}else(){return this._elseNode(new Iu)}endIf(){return this._endBlockNode(as,Iu)}_for(t,i){return this._blockNode(t),i&&this.code(i).endFor(),this}for(t,i){return this._for(new Su(t),i)}forRange(t,i,n,r,o=this.opts.es5?ai.varKinds.var:ai.varKinds.let){let a=this._scope.toName(t);return this._for(new $u(o,a,i,n),()=>r(a))}forOf(t,i,n,r=ai.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=i instanceof ge.Name?i:this.var("_arr",i);return this.forRange("_i",0,(0,ge._)`${a}.length`,s=>{this.var(o,(0,ge._)`${a}[${s}]`),n(o)})}return this._for(new ls("of",r,o,i),()=>n(o))}forIn(t,i,n,r=this.opts.es5?ai.varKinds.var:ai.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,ge._)`Object.keys(${i})`,n);let o=this._scope.toName(t);return this._for(new ls("in",r,o,i),()=>n(o))}endFor(){return this._endBlockNode(ds)}label(t){return this._leafNode(new bu(t))}break(t){return this._leafNode(new vu(t))}return(t){let i=new Gf;if(this._blockNode(i),this.code(t),i.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Gf)}try(t,i,n){if(!i&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let r=new Eu;if(this._blockNode(r),this.code(t),i){let o=this.name("e");this._currNode=r.catch=new Jf(o),i(o)}return n&&(this._currNode=r.finally=new Xf,this.code(n)),this._endBlockNode(Jf,Xf)}throw(t){return this._leafNode(new xu(t))}block(t,i){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(i),this}endBlock(t){let i=this._blockStarts.pop();if(i===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-i;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=i,this}func(t,i=ge.nil,n,r){return this._blockNode(new Kf(t,i,n)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(Kf)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,i){let n=this._currNode;if(n instanceof t||i&&n instanceof i)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${i?`${t.kind}/${i.kind}`:t.kind}"`)}_elseNode(t){let i=this._currNode;if(!(i instanceof as))throw new Error('CodeGen: "else" without "if"');return this._currNode=i.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let i=this._nodes;i[i.length-1]=t}};ce.CodeGen=Tu;function Dn(e,t){for(let i in t)e[i]=(e[i]||0)+(t[i]||0);return e}function us(e,t){return t instanceof ge._CodeOrName?Dn(e,t.names):e}function sr(e,t,i){if(e instanceof ge.Name)return n(e);if(!r(e))return e;return new ge._Code(e._items.reduce((o,a)=>(a instanceof ge.Name&&(a=n(a)),a instanceof ge._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=i[o.str];return a===void 0||t[o.str]!==1?o:(delete t[o.str],a)}function r(o){return o instanceof ge._Code&&o._items.some(a=>a instanceof ge.Name&&t[a.str]===1&&i[a.str]!==void 0)}}function h2(e,t){for(let i in t)e[i]=(e[i]||0)-(t[i]||0)}function Yf(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,ge._)`!${Pu(e)}`}ce.not=Yf;var g2=Zf(ce.operators.AND);function y2(...e){return e.reduce(g2)}ce.and=y2;var _2=Zf(ce.operators.OR);function b2(...e){return e.reduce(_2)}ce.or=b2;function Zf(e){return(t,i)=>t===ge.nil?i:i===ge.nil?t:(0,ge._)`${Pu(t)} ${e} ${Pu(i)}`}function Pu(e){return e instanceof ge.Name?e:(0,ge._)`(${e})`}});var pe=g(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.checkStrictMode=de.getErrorPath=de.Type=de.useFunc=de.setEvaluated=de.evaluatedPropsToName=de.mergeEvaluated=de.eachItem=de.unescapeJsonPointer=de.escapeJsonPointer=de.escapeFragment=de.unescapeFragment=de.schemaRefOrVal=de.schemaHasRulesButRef=de.schemaHasRules=de.checkUnknownRules=de.alwaysValidSchema=de.toHash=void 0;var Ee=ee(),v2=po();function x2(e){let t={};for(let i of e)t[i]=!0;return t}de.toHash=x2;function C2(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(tm(e,t),!im(t,e.self.RULES.all))}de.alwaysValidSchema=C2;function tm(e,t=e.schema){let{opts:i,self:n}=e;if(!i.strictSchema||typeof t=="boolean")return;let r=n.RULES.keywords;for(let o in t)r[o]||om(e,`unknown keyword: "${o}"`)}de.checkUnknownRules=tm;function im(e,t){if(typeof e=="boolean")return!e;for(let i in e)if(t[i])return!0;return!1}de.schemaHasRules=im;function w2(e,t){if(typeof e=="boolean")return!e;for(let i in e)if(i!=="$ref"&&t.all[i])return!0;return!1}de.schemaHasRulesButRef=w2;function I2({topSchemaRef:e,schemaPath:t},i,n,r){if(!r){if(typeof i=="number"||typeof i=="boolean")return i;if(typeof i=="string")return(0,Ee._)`${i}`}return(0,Ee._)`${e}${t}${(0,Ee.getProperty)(n)}`}de.schemaRefOrVal=I2;function S2(e){return nm(decodeURIComponent(e))}de.unescapeFragment=S2;function $2(e){return encodeURIComponent(Mu(e))}de.escapeFragment=$2;function Mu(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}de.escapeJsonPointer=Mu;function nm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}de.unescapeJsonPointer=nm;function E2(e,t){if(Array.isArray(e))for(let i of e)t(i);else t(e)}de.eachItem=E2;function Qf({mergeNames:e,mergeToName:t,mergeValues:i,resultToName:n}){return(r,o,a,s)=>{let l=a===void 0?o:a instanceof Ee.Name?(o instanceof Ee.Name?e(r,o,a):t(r,o,a),a):o instanceof Ee.Name?(t(r,a,o),o):i(o,a);return s===Ee.Name&&!(l instanceof Ee.Name)?n(r,l):l}}de.mergeEvaluated={props:Qf({mergeNames:(e,t,i)=>e.if((0,Ee._)`${i} !== true && ${t} !== undefined`,()=>{e.if((0,Ee._)`${t} === true`,()=>e.assign(i,!0),()=>e.assign(i,(0,Ee._)`${i} || {}`).code((0,Ee._)`Object.assign(${i}, ${t})`))}),mergeToName:(e,t,i)=>e.if((0,Ee._)`${i} !== true`,()=>{t===!0?e.assign(i,!0):(e.assign(i,(0,Ee._)`${i} || {}`),ku(e,i,t))}),mergeValues:(e,t)=>e===!0?!0:X(X({},e),t),resultToName:rm}),items:Qf({mergeNames:(e,t,i)=>e.if((0,Ee._)`${i} !== true && ${t} !== undefined`,()=>e.assign(i,(0,Ee._)`${t} === true ? true : ${i} > ${t} ? ${i} : ${t}`)),mergeToName:(e,t,i)=>e.if((0,Ee._)`${i} !== true`,()=>e.assign(i,t===!0?!0:(0,Ee._)`${i} > ${t} ? ${i} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function rm(e,t){if(t===!0)return e.var("props",!0);let i=e.var("props",(0,Ee._)`{}`);return t!==void 0&&ku(e,i,t),i}de.evaluatedPropsToName=rm;function ku(e,t,i){Object.keys(i).forEach(n=>e.assign((0,Ee._)`${t}${(0,Ee.getProperty)(n)}`,!0))}de.setEvaluated=ku;var em={};function T2(e,t){return e.scopeValue("func",{ref:t,code:em[t.code]||(em[t.code]=new v2._Code(t.code))})}de.useFunc=T2;var Ou=function(e){return e[e.Num=0]="Num",e[e.Str=1]="Str",e}(Ou||(de.Type=Ou={}));function P2(e,t,i){if(e instanceof Ee.Name){let n=t===Ou.Num;return i?n?(0,Ee._)`"[" + ${e} + "]"`:(0,Ee._)`"['" + ${e} + "']"`:n?(0,Ee._)`"/" + ${e}`:(0,Ee._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return i?(0,Ee.getProperty)(e).toString():"/"+Mu(e)}de.getErrorPath=P2;function om(e,t,i=e.opts.strictSchema){if(i){if(t=`strict mode: ${t}`,i===!0)throw new Error(t);e.self.logger.warn(t)}}de.checkStrictMode=om});var Jt=g(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});var ft=ee(),O2={data:new ft.Name("data"),valCxt:new ft.Name("valCxt"),instancePath:new ft.Name("instancePath"),parentData:new ft.Name("parentData"),parentDataProperty:new ft.Name("parentDataProperty"),rootData:new ft.Name("rootData"),dynamicAnchors:new ft.Name("dynamicAnchors"),vErrors:new ft.Name("vErrors"),errors:new ft.Name("errors"),this:new ft.Name("this"),self:new ft.Name("self"),scope:new ft.Name("scope"),json:new ft.Name("json"),jsonPos:new ft.Name("jsonPos"),jsonLen:new ft.Name("jsonLen"),jsonPart:new ft.Name("jsonPart")};Du.default=O2});var mo=g(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.extendErrors=mt.resetErrorsCount=mt.reportExtraError=mt.reportError=mt.keyword$DataError=mt.keywordError=void 0;var _e=ee(),ps=pe(),wt=Jt();mt.keywordError={message:({keyword:e})=>(0,_e.str)`must pass "${e}" keyword validation`};mt.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,_e.str)`"${e}" keyword must be ${t} ($data)`:(0,_e.str)`"${e}" keyword is invalid ($data)`};function M2(e,t=mt.keywordError,i,n){let{it:r}=e,{gen:o,compositeRule:a,allErrors:s}=r,l=lm(e,t,i);n??(a||s)?am(o,l):sm(r,(0,_e._)`[${l}]`)}mt.reportError=M2;function k2(e,t=mt.keywordError,i){let{it:n}=e,{gen:r,compositeRule:o,allErrors:a}=n,s=lm(e,t,i);am(r,s),o||a||sm(n,wt.default.vErrors)}mt.reportExtraError=k2;function D2(e,t){e.assign(wt.default.errors,t),e.if((0,_e._)`${wt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,_e._)`${wt.default.vErrors}.length`,t),()=>e.assign(wt.default.vErrors,null)))}mt.resetErrorsCount=D2;function A2({gen:e,keyword:t,schemaValue:i,data:n,errsCount:r,it:o}){if(r===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",r,wt.default.errors,s=>{e.const(a,(0,_e._)`${wt.default.vErrors}[${s}]`),e.if((0,_e._)`${a}.instancePath === undefined`,()=>e.assign((0,_e._)`${a}.instancePath`,(0,_e.strConcat)(wt.default.instancePath,o.errorPath))),e.assign((0,_e._)`${a}.schemaPath`,(0,_e.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,_e._)`${a}.schema`,i),e.assign((0,_e._)`${a}.data`,n))})}mt.extendErrors=A2;function am(e,t){let i=e.const("err",t);e.if((0,_e._)`${wt.default.vErrors} === null`,()=>e.assign(wt.default.vErrors,(0,_e._)`[${i}]`),(0,_e._)`${wt.default.vErrors}.push(${i})`),e.code((0,_e._)`${wt.default.errors}++`)}function sm(e,t){let{gen:i,validateName:n,schemaEnv:r}=e;r.$async?i.throw((0,_e._)`new ${e.ValidationError}(${t})`):(i.assign((0,_e._)`${n}.errors`,t),i.return(!1))}var An={keyword:new _e.Name("keyword"),schemaPath:new _e.Name("schemaPath"),params:new _e.Name("params"),propertyName:new _e.Name("propertyName"),message:new _e.Name("message"),schema:new _e.Name("schema"),parentSchema:new _e.Name("parentSchema")};function lm(e,t,i){let{createErrors:n}=e.it;return n===!1?(0,_e._)`{}`:N2(e,t,i)}function N2(e,t,i={}){let{gen:n,it:r}=e,o=[j2(r,i),F2(e,i)];return q2(e,t,o),n.object(...o)}function j2({errorPath:e},{instancePath:t}){let i=t?(0,_e.str)`${e}${(0,ps.getErrorPath)(t,ps.Type.Str)}`:e;return[wt.default.instancePath,(0,_e.strConcat)(wt.default.instancePath,i)]}function F2({keyword:e,it:{errSchemaPath:t}},{schemaPath:i,parentSchema:n}){let r=n?t:(0,_e.str)`${t}/${e}`;return i&&(r=(0,_e.str)`${r}${(0,ps.getErrorPath)(i,ps.Type.Str)}`),[An.schemaPath,r]}function q2(e,{params:t,message:i},n){let{keyword:r,data:o,schemaValue:a,it:s}=e,{opts:l,propertyName:u,topSchemaRef:c,schemaPath:p}=s;n.push([An.keyword,r],[An.params,typeof t=="function"?t(e):t||(0,_e._)`{}`]),l.messages&&n.push([An.message,typeof i=="function"?i(e):i]),l.verbose&&n.push([An.schema,a],[An.parentSchema,(0,_e._)`${c}${p}`],[wt.default.data,o]),u&&n.push([An.propertyName,u])}});var cm=g(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.boolOrEmptySchema=lr.topBoolOrEmptySchema=void 0;var V2=mo(),B2=ee(),R2=Jt(),L2={message:"boolean schema is false"};function U2(e){let{gen:t,schema:i,validateName:n}=e;i===!1?um(e,!1):typeof i=="object"&&i.$async===!0?t.return(R2.default.data):(t.assign((0,B2._)`${n}.errors`,null),t.return(!0))}lr.topBoolOrEmptySchema=U2;function z2(e,t){let{gen:i,schema:n}=e;n===!1?(i.var(t,!1),um(e)):i.var(t,!0)}lr.boolOrEmptySchema=z2;function um(e,t){let{gen:i,data:n}=e,r={gen:i,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,V2.reportError)(r,L2,void 0,t)}});var Au=g(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.getRules=ur.isJSONType=void 0;var H2=["string","number","integer","boolean","null","object","array"],W2=new Set(H2);function K2(e){return typeof e=="string"&&W2.has(e)}ur.isJSONType=K2;function G2(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:$e(X({},e),{integer:!0,boolean:!0,null:!0}),rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ur.getRules=G2});var Nu=g(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.shouldUseRule=rn.shouldUseGroup=rn.schemaHasRulesForType=void 0;function J2({schema:e,self:t},i){let n=t.RULES.types[i];return n&&n!==!0&&dm(e,n)}rn.schemaHasRulesForType=J2;function dm(e,t){return t.rules.some(i=>pm(e,i))}rn.shouldUseGroup=dm;function pm(e,t){var i;return e[t.keyword]!==void 0||((i=t.definition.implements)===null||i===void 0?void 0:i.some(n=>e[n]!==void 0))}rn.shouldUseRule=pm});var ho=g(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.reportTypeError=ht.checkDataTypes=ht.checkDataType=ht.coerceAndCheckDataType=ht.getJSONTypes=ht.getSchemaTypes=ht.DataType=void 0;var X2=Au(),Y2=Nu(),Z2=mo(),ae=ee(),fm=pe(),cr=function(e){return e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong",e}(cr||(ht.DataType=cr={}));function Q2(e){let t=mm(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}ht.getSchemaTypes=Q2;function mm(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(X2.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ht.getJSONTypes=mm;function e$(e,t){let{gen:i,data:n,opts:r}=e,o=t$(t,r.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0,Y2.schemaHasRulesForType)(e,t[0]));if(a){let s=Fu(t,n,r.strictNumbers,cr.Wrong);i.if(s,()=>{o.length?i$(e,t,o):qu(e)})}return a}ht.coerceAndCheckDataType=e$;var hm=new Set(["string","number","integer","boolean","null"]);function t$(e,t){return t?e.filter(i=>hm.has(i)||t==="array"&&i==="array"):[]}function i$(e,t,i){let{gen:n,data:r,opts:o}=e,a=n.let("dataType",(0,ae._)`typeof ${r}`),s=n.let("coerced",(0,ae._)`undefined`);o.coerceTypes==="array"&&n.if((0,ae._)`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>n.assign(r,(0,ae._)`${r}[0]`).assign(a,(0,ae._)`typeof ${r}`).if(Fu(t,r,o.strictNumbers),()=>n.assign(s,r))),n.if((0,ae._)`${s} !== undefined`);for(let u of i)(hm.has(u)||u==="array"&&o.coerceTypes==="array")&&l(u);n.else(),qu(e),n.endIf(),n.if((0,ae._)`${s} !== undefined`,()=>{n.assign(r,s),n$(e,s)});function l(u){switch(u){case"string":n.elseIf((0,ae._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,ae._)`"" + ${r}`).elseIf((0,ae._)`${r} === null`).assign(s,(0,ae._)`""`);return;case"number":n.elseIf((0,ae._)`${a} == "boolean" || ${r} === null
|
|
3
3
|
|| (${a} == "string" && ${r} && ${r} == +${r})`).assign(s,(0,ae._)`+${r}`);return;case"integer":n.elseIf((0,ae._)`${a} === "boolean" || ${r} === null
|
|
4
4
|
|| (${a} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(s,(0,ae._)`+${r}`);return;case"boolean":n.elseIf((0,ae._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(s,!1).elseIf((0,ae._)`${r} === "true" || ${r} === 1`).assign(s,!0);return;case"null":n.elseIf((0,ae._)`${r} === "" || ${r} === 0 || ${r} === false`),n.assign(s,null);return;case"array":n.elseIf((0,ae._)`${a} === "string" || ${a} === "number"
|