homebridge-config-ui-x 5.12.1-alpha.0 → 5.12.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -1
- package/package.json +8 -3
- package/public/{chunk-2C24YPBT.js → chunk-2OFBHOS4.js} +1 -1
- package/public/{chunk-4DP4S4T6.js → chunk-3LSRPBCH.js} +1 -1
- package/public/{chunk-RQHDC2H4.js → chunk-3V45R2IO.js} +1 -1
- package/public/{chunk-3D5CLRTZ.js → chunk-3V7HHVHU.js} +1 -1
- package/public/{chunk-YJHSSXBL.js → chunk-67NDBD3O.js} +1 -1
- package/public/{chunk-U7J32ZCT.js → chunk-6F7FL4N2.js} +1 -1
- package/public/{chunk-36DWHVJK.js → chunk-6NUTFCFF.js} +1 -1
- package/public/{chunk-HTAXQLUC.js → chunk-6ZIKRWSF.js} +1 -1
- package/public/{chunk-JYPTQF33.js → chunk-7X2JJHYE.js} +1 -1
- package/public/{chunk-NBNIZ4FB.js → chunk-ABYHZSIZ.js} +1 -1
- package/public/{chunk-LLHJXAVZ.js → chunk-B2LQOEWE.js} +1 -1
- package/public/{chunk-GE6FUSBI.js → chunk-DNCHN5MY.js} +1 -1
- package/public/{chunk-QDSMJS6K.js → chunk-DPMCM3OO.js} +1 -1
- package/public/{chunk-OVMPEMPZ.js → chunk-E6HNGTLD.js} +1 -1
- package/public/{chunk-ARFZQCZK.js → chunk-FVHWAEZA.js} +1 -1
- package/public/{chunk-XDVMRWJO.js → chunk-G67CSWKM.js} +1 -1
- package/public/{chunk-TCAIGKCZ.js → chunk-GFIXJZEO.js} +1 -1
- package/public/{chunk-JP4UERHI.js → chunk-GP4KDKBH.js} +2 -2
- package/public/{chunk-VD4V4NEZ.js → chunk-HGLLMJ7J.js} +1 -1
- package/public/{chunk-FRQW55RH.js → chunk-HGMPY62U.js} +1 -1
- package/public/{chunk-SKXHAHCO.js → chunk-HSDZKEAS.js} +1 -1
- package/public/{chunk-J7YCDUH4.js → chunk-JEQ5JQRP.js} +1 -1
- package/public/{chunk-3H4HIZHS.js → chunk-KILWF5J6.js} +1 -1
- package/public/{chunk-DEUOHDAT.js → chunk-KSNKFFQP.js} +1 -1
- package/public/{chunk-RJJ7UQ5A.js → chunk-L72SOSJN.js} +1 -1
- package/public/{chunk-RHMBWG6P.js → chunk-LPWHUUMS.js} +1 -1
- package/public/{chunk-WWIBIOK5.js → chunk-M2TL4QGG.js} +1 -1
- package/public/{chunk-H73LUU46.js → chunk-M62WKFKF.js} +1 -1
- package/public/{chunk-ETPA4W22.js → chunk-MEX6GNBR.js} +1 -1
- package/public/{chunk-657MY7IJ.js → chunk-NFQE76CE.js} +1 -1
- package/public/{chunk-RFZWSS3U.js → chunk-OBR76AWV.js} +1 -1
- package/public/{chunk-RCUGTYVU.js → chunk-PMANWQSB.js} +1 -1
- package/public/{chunk-YO6R75NE.js → chunk-POGEGLDZ.js} +1 -1
- package/public/{chunk-FYKCFXZ2.js → chunk-PXA52XD6.js} +1 -1
- package/public/{chunk-TP2KLH5Z.js → chunk-Q6DWCZZR.js} +1 -1
- package/public/{chunk-GLSCRXLU.js → chunk-QHMT6OOY.js} +1 -1
- package/public/chunk-QP2DYZ52.js +1 -0
- package/public/{chunk-PPDVWLPC.js → chunk-R75NMVH4.js} +1 -1
- package/public/{chunk-6XTPZD35.js → chunk-RJA5DWXC.js} +4 -4
- package/public/{chunk-CK4L2OZA.js → chunk-SC5ZNCG5.js} +1 -1
- package/public/chunk-TXQH2OVO.js +1 -0
- package/public/{chunk-7H56ZY4K.js → chunk-UKZECEPF.js} +1 -1
- package/public/{chunk-TFD6FNNU.js → chunk-V22CFYHU.js} +1 -1
- package/public/{chunk-GQUKWTAM.js → chunk-VZNH7H6M.js} +1 -1
- package/public/{chunk-ZM7HZFSJ.js → chunk-WISMAU6J.js} +1 -1
- package/public/{chunk-M5PVRCNI.js → chunk-WNO2VXXQ.js} +1 -1
- package/public/{chunk-VT7JPEPM.js → chunk-XOT3W4PF.js} +1 -1
- package/public/{chunk-JLMGZNW5.js → chunk-XZ4YGENI.js} +1 -1
- package/public/{chunk-XJ6E3F3B.js → chunk-YA7H2FDZ.js} +1 -1
- package/public/{chunk-4VZUA2FM.js → chunk-YAKM4NKJ.js} +1 -1
- package/public/{chunk-TDTMHOY3.js → chunk-YIUTOVQO.js} +1 -1
- package/public/{chunk-VVQDBX54.js → chunk-YQ3TDI7C.js} +1 -1
- package/public/{chunk-PBTOROO2.js → chunk-ZIERYCMT.js} +1 -1
- package/public/index.html +1 -1
- package/public/{main-Q72DV553.js → main-HEICJNRU.js} +1 -1
- package/public/chunk-WAVNYOYF.js +0 -1
- package/public/chunk-YEQ475QM.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as $v}from"./chunk-ETPA4W22.js";import{a as gp,c as Fv,d as Ov,e as Ys,f as Lv,g as QU,h as pp}from"./chunk-JYPTQF33.js";import{a as Bv}from"./chunk-JT7SPTVG.js";import{a as Uv}from"./chunk-N6D52WI6.js";import{a as qv}from"./chunk-J7YCDUH4.js";import{a as Jc,b as Zc,c as Qc}from"./chunk-VCZ6KBM7.js";import{a as da}from"./chunk-MGZVKFCX.js";import{a as Vv}from"./chunk-DDJU52K4.js";import{a as Yc,b as Lo}from"./chunk-KSI5RFA4.js";import{a as Vo,b as qo}from"./chunk-PCFKF3RR.js";import{a as Mv}from"./chunk-SKXHAHCO.js";import{a as qc,b as Lc,c as $c,d as Kc,e as Gc,f as Wc,g as Oo,m as It,n as vi,o as jv,p as Dv,q as Nv,r as Rv,s as Ev,t as xr}from"./chunk-YHD44ZXJ.js";import{B as Av,C as us,D as ca,a as vv,b as kr,c as ro,e as Qt,f as wv,h as kv,i as Hv,j as Sv,k as Cv,l as Wi,m as xv,n as Iv,o as Pv,p as Hr,s as Fo,t as Sr,u as up,v as Cr,w as Tv,x as zv}from"./chunk-LZU5VVW4.js";import{a as Pr}from"./chunk-VT7JPEPM.js";import{e as Is}from"./chunk-O7FV4MLW.js";import{b as Tt}from"./chunk-VD4V4NEZ.js";import{k as rt,l as Pt,n as ot,p as Ir,q as Xe}from"./chunk-WAVNYOYF.js";import{$a as Nc,$b as he,$c as fv,A as Ac,Ab as b,Bb as U,Ca as Ss,Cb as oa,Cc as di,Db as na,Dc as ae,Ea as cs,Eb as aa,Ec as wr,Fa as nv,Fb as uv,G as Xy,Gb as gv,Gc as ds,Ha as Cs,Hc as so,Ia as av,Ic as _v,J as ev,Ja as lv,Jc as hv,K as jc,Kb as ie,L as tv,Na as Me,Nb as Q,O as sp,Oa as cv,Ob as Ec,Pb as S,R as _r,Ra as dv,Rc as yi,Sa as m,T as iv,Tb as Bc,Ua as Ni,Ub as Mc,V as rp,Va as Gs,Vb as Uc,Wb as br,Xa as lp,Xb as yr,Yb as Fc,Zb as bi,Zc as Vc,_a as Bo,_b as Ri,a as pe,ab as ra,ac as D,b as Fe,ba as op,bc as re,bd as bv,c as Jy,ca as Dc,cb as xs,cc as oe,da as np,dc as vr,e as v,ea as ls,ec as Oc,fa as sv,fb as ve,fd as yv,g as xt,gb as fr,h as ge,hb as Ws,hc as at,ib as Rc,ic as lt,ja as ap,jc as ct,k as eo,ka as pt,kc as pv,la as hr,lb as cp,lc as Mo,m as to,mc as st,na as Ks,nc as li,oa as rv,oc as la,p as Re,pa as j,pc as ci,q as Tc,qb as dp,qc as Uo,r as ip,rb as me,rc as mv,sa as ov,sb as T,t as Zy,tb as z,tc as R,u as zc,ua as J,uc as O,va as Z,vb as Je,vc as mt,wb as Ze,xb as Qe,y as Qy,ya as sa,yb as N,z as Ae,za as io,zb as y}from"./chunk-UUXRTS4O.js";var Xv=v(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.formatNames=Ts.fastFormats=Ts.fullFormats=void 0;function Ps(e,i){return{validate:e,compare:i}}Ts.fullFormats={date:Ps(Yv,fp),time:Ps(_p(!0),bp),"date-time":Ps(Kv(!0),Zv),"iso-time":Ps(_p(),Jv),"iso-date-time":Ps(Kv(),Qv),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:rF,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:uF,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:oF,int32:{type:"number",validate:lF},int64:{type:"number",validate:cF},float:{type:"number",validate:Wv},double:{type:"number",validate:Wv},password:!0,binary:!0};Ts.fastFormats=Fe(pe({},Ts.fullFormats),{date:Ps(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,fp),time:Ps(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,bp),"date-time":Ps(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Zv),"iso-time":Ps(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Jv),"iso-date-time":Ps(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Qv),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i});Ts.formatNames=Object.keys(Ts.fullFormats);function XU(e){return e%4===0&&(e%100!==0||e%400===0)}var eF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,tF=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Yv(e){let i=eF.exec(e);if(!i)return!1;let t=+i[1],s=+i[2],r=+i[3];return s>=1&&s<=12&&r>=1&&r<=(s===2&&XU(t)?29:tF[s])}function fp(e,i){if(e&&i)return e>i?1:e<i?-1:0}var mp=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function _p(e){return function(t){let s=mp.exec(t);if(!s)return!1;let r=+s[1],o=+s[2],l=+s[3],c=s[4],u=s[5]==="-"?-1:1,p=+(s[6]||0),_=+(s[7]||0);if(p>23||_>59||e&&!c)return!1;if(r<=23&&o<=59&&l<60)return!0;let f=o-_*u,H=r-p*u-(f<0?1:0);return(H===23||H===-1)&&(f===59||f===-1)&&l<61}}function bp(e,i){if(!(e&&i))return;let t=new Date("2020-01-01T"+e).valueOf(),s=new Date("2020-01-01T"+i).valueOf();if(t&&s)return t-s}function Jv(e,i){if(!(e&&i))return;let t=mp.exec(e),s=mp.exec(i);if(t&&s)return e=t[1]+t[2]+t[3],i=s[1]+s[2]+s[3],e>i?1:e<i?-1:0}var hp=/t|\s/i;function Kv(e){let i=_p(e);return function(s){let r=s.split(hp);return r.length===2&&Yv(r[0])&&i(r[1])}}function Zv(e,i){if(!(e&&i))return;let t=new Date(e).valueOf(),s=new Date(i).valueOf();if(t&&s)return t-s}function Qv(e,i){if(!(e&&i))return;let[t,s]=e.split(hp),[r,o]=i.split(hp),l=fp(t,r);if(l!==void 0)return l||bp(s,o)}var iF=/\/|:/,sF=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function rF(e){return iF.test(e)&&sF.test(e)}var Gv=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function oF(e){return Gv.lastIndex=0,Gv.test(e)}var nF=-(2**31),aF=2**31-1;function lF(e){return Number.isInteger(e)&&e<=aF&&e>=nF}function cF(e){return Number.isInteger(e)}function Wv(){return!0}var dF=/[^\\]\\Z/;function uF(e){if(dF.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var pa=v(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.regexpCode=We.getEsmExportName=We.getProperty=We.safeStringify=We.stringify=We.strConcat=We.addCodeArg=We.str=We._=We.nil=We._Code=We.Name=We.IDENTIFIER=We._CodeOrName=void 0;var ua=class{};We._CodeOrName=ua;We.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var oo=class extends ua{constructor(i){if(super(),!We.IDENTIFIER.test(i))throw new Error("CodeGen: name must be a valid identifier");this.str=i}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};We.Name=oo;var Yi=class extends ua{constructor(i){super(),this._items=typeof i=="string"?[i]:i}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let i=this._items[0];return i===""||i==='""'}get str(){var i;return(i=this._str)!==null&&i!==void 0?i:this._str=this._items.reduce((t,s)=>`${t}${s}`,"")}get names(){var i;return(i=this._names)!==null&&i!==void 0?i:this._names=this._items.reduce((t,s)=>(s instanceof oo&&(t[s.str]=(t[s.str]||0)+1),t),{})}};We._Code=Yi;We.nil=new Yi("");function ew(e,...i){let t=[e[0]],s=0;for(;s<i.length;)vp(t,i[s]),t.push(e[++s]);return new Yi(t)}We._=ew;var yp=new Yi("+");function tw(e,...i){let t=[ga(e[0])],s=0;for(;s<i.length;)t.push(yp),vp(t,i[s]),t.push(yp,ga(e[++s]));return gF(t),new Yi(t)}We.str=tw;function vp(e,i){i instanceof Yi?e.push(...i._items):i instanceof oo?e.push(i):e.push(_F(i))}We.addCodeArg=vp;function gF(e){let i=1;for(;i<e.length-1;){if(e[i]===yp){let t=pF(e[i-1],e[i+1]);if(t!==void 0){e.splice(i-1,3,t);continue}e[i++]="+"}i++}}function pF(e,i){if(i==='""')return e;if(e==='""')return i;if(typeof e=="string")return i instanceof oo||e[e.length-1]!=='"'?void 0:typeof i!="string"?`${e.slice(0,-1)}${i}"`:i[0]==='"'?e.slice(0,-1)+i.slice(1):void 0;if(typeof i=="string"&&i[0]==='"'&&!(e instanceof oo))return`"${e}${i.slice(1)}`}function mF(e,i){return i.emptyStr()?e:e.emptyStr()?i:tw`${e}${i}`}We.strConcat=mF;function _F(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ga(Array.isArray(e)?e.join(","):e)}function hF(e){return new Yi(ga(e))}We.stringify=hF;function ga(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}We.safeStringify=ga;function fF(e){return typeof e=="string"&&We.IDENTIFIER.test(e)?new Yi(`.${e}`):ew`[${e}]`}We.getProperty=fF;function bF(e){if(typeof e=="string"&&We.IDENTIFIER.test(e))return new Yi(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}We.getEsmExportName=bF;function yF(e){return new Yi(e.toString())}We.regexpCode=yF});var Hp=v(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.ValueScope=ki.ValueScopeName=ki.Scope=ki.varKinds=ki.UsedValueState=void 0;var wi=pa(),wp=class extends Error{constructor(i){super(`CodeGen: "code" for ${i} not defined`),this.value=i.value}},Xc=(function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e})(Xc||(ki.UsedValueState=Xc={}));ki.varKinds={const:new wi.Name("const"),let:new wi.Name("let"),var:new wi.Name("var")};var ed=class{constructor({prefixes:i,parent:t}={}){this._names={},this._prefixes=i,this._parent=t}toName(i){return i instanceof wi.Name?i:this.name(i)}name(i){return new wi.Name(this._newName(i))}_newName(i){let t=this._names[i]||this._nameGroup(i);return`${i}${t.index++}`}_nameGroup(i){var t,s;if(!((s=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||s===void 0)&&s.has(i)||this._prefixes&&!this._prefixes.has(i))throw new Error(`CodeGen: prefix "${i}" is not allowed in this scope`);return this._names[i]={prefix:i,index:0}}};ki.Scope=ed;var td=class extends wi.Name{constructor(i,t){super(t),this.prefix=i}setValue(i,{property:t,itemIndex:s}){this.value=i,this.scopePath=(0,wi._)`.${new wi.Name(t)}[${s}]`}};ki.ValueScopeName=td;var vF=(0,wi._)`\n`,kp=class extends ed{constructor(i){super(i),this._values={},this._scope=i.scope,this.opts=Fe(pe({},i),{_n:i.lines?vF:wi.nil})}get(){return this._scope}name(i){return new td(i,this._newName(i))}value(i,t){var s;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(i),{prefix:o}=r,l=(s=t.key)!==null&&s!==void 0?s:t.ref,c=this._values[o];if(c){let _=c.get(l);if(_)return _}else c=this._values[o]=new Map;c.set(l,r);let u=this._scope[o]||(this._scope[o]=[]),p=u.length;return u[p]=t.ref,r.setValue(t,{property:o,itemIndex:p}),r}getValue(i,t){let s=this._values[i];if(s)return s.get(t)}scopeRefs(i,t=this._values){return this._reduceValues(t,s=>{if(s.scopePath===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return(0,wi._)`${i}${s.scopePath}`})}scopeCode(i=this._values,t,s){return this._reduceValues(i,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,s)}_reduceValues(i,t,s={},r){let o=wi.nil;for(let l in i){let c=i[l];if(!c)continue;let u=s[l]=s[l]||new Map;c.forEach(p=>{if(u.has(p))return;u.set(p,Xc.Started);let _=t(p);if(_){let f=this.opts.es5?ki.varKinds.var:ki.varKinds.const;o=(0,wi._)`${o}${f} ${p} = ${_};${this.opts._n}`}else if(_=r?.(p))o=(0,wi._)`${o}${_}${this.opts._n}`;else throw new wp(p);u.set(p,Xc.Completed)})}return o}};ki.ValueScope=kp});var we=v(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.or=Ue.and=Ue.not=Ue.CodeGen=Ue.operators=Ue.varKinds=Ue.ValueScopeName=Ue.ValueScope=Ue.Scope=Ue.Name=Ue.regexpCode=Ue.stringify=Ue.getProperty=Ue.nil=Ue.strConcat=Ue.str=Ue._=void 0;var Ke=pa(),gs=Hp(),Tr=pa();Object.defineProperty(Ue,"_",{enumerable:!0,get:function(){return Tr._}});Object.defineProperty(Ue,"str",{enumerable:!0,get:function(){return Tr.str}});Object.defineProperty(Ue,"strConcat",{enumerable:!0,get:function(){return Tr.strConcat}});Object.defineProperty(Ue,"nil",{enumerable:!0,get:function(){return Tr.nil}});Object.defineProperty(Ue,"getProperty",{enumerable:!0,get:function(){return Tr.getProperty}});Object.defineProperty(Ue,"stringify",{enumerable:!0,get:function(){return Tr.stringify}});Object.defineProperty(Ue,"regexpCode",{enumerable:!0,get:function(){return Tr.regexpCode}});Object.defineProperty(Ue,"Name",{enumerable:!0,get:function(){return Tr.Name}});var nd=Hp();Object.defineProperty(Ue,"Scope",{enumerable:!0,get:function(){return nd.Scope}});Object.defineProperty(Ue,"ValueScope",{enumerable:!0,get:function(){return nd.ValueScope}});Object.defineProperty(Ue,"ValueScopeName",{enumerable:!0,get:function(){return nd.ValueScopeName}});Object.defineProperty(Ue,"varKinds",{enumerable:!0,get:function(){return nd.varKinds}});Ue.operators={GT:new Ke._Code(">"),GTE:new Ke._Code(">="),LT:new Ke._Code("<"),LTE:new Ke._Code("<="),EQ:new Ke._Code("==="),NEQ:new Ke._Code("!=="),NOT:new Ke._Code("!"),OR:new Ke._Code("||"),AND:new Ke._Code("&&"),ADD:new Ke._Code("+")};var Js=class{optimizeNodes(){return this}optimizeNames(i,t){return this}},Sp=class extends Js{constructor(i,t,s){super(),this.varKind=i,this.name=t,this.rhs=s}render({es5:i,_n:t}){let s=i?gs.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${s} ${this.name}${r};`+t}optimizeNames(i,t){if(i[this.name.str])return this.rhs&&(this.rhs=Ko(this.rhs,i,t)),this}get names(){return this.rhs instanceof Ke._CodeOrName?this.rhs.names:{}}},sd=class extends Js{constructor(i,t,s){super(),this.lhs=i,this.rhs=t,this.sideEffects=s}render({_n:i}){return`${this.lhs} = ${this.rhs};`+i}optimizeNames(i,t){if(!(this.lhs instanceof Ke.Name&&!i[this.lhs.str]&&!this.sideEffects))return this.rhs=Ko(this.rhs,i,t),this}get names(){let i=this.lhs instanceof Ke.Name?{}:pe({},this.lhs.names);return od(i,this.rhs)}},Cp=class extends sd{constructor(i,t,s,r){super(i,s,r),this.op=t}render({_n:i}){return`${this.lhs} ${this.op}= ${this.rhs};`+i}},xp=class extends Js{constructor(i){super(),this.label=i,this.names={}}render({_n:i}){return`${this.label}:`+i}},Ip=class extends Js{constructor(i){super(),this.label=i,this.names={}}render({_n:i}){return`break${this.label?` ${this.label}`:""};`+i}},Pp=class extends Js{constructor(i){super(),this.error=i}render({_n:i}){return`throw ${this.error};`+i}get names(){return this.error.names}},Tp=class extends Js{constructor(i){super(),this.code=i}render({_n:i}){return`${this.code};`+i}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(i,t){return this.code=Ko(this.code,i,t),this}get names(){return this.code instanceof Ke._CodeOrName?this.code.names:{}}},ma=class extends Js{constructor(i=[]){super(),this.nodes=i}render(i){return this.nodes.reduce((t,s)=>t+s.render(i),"")}optimizeNodes(){let{nodes:i}=this,t=i.length;for(;t--;){let s=i[t].optimizeNodes();Array.isArray(s)?i.splice(t,1,...s):s?i[t]=s:i.splice(t,1)}return i.length>0?this:void 0}optimizeNames(i,t){let{nodes:s}=this,r=s.length;for(;r--;){let o=s[r];o.optimizeNames(i,t)||(wF(i,o.names),s.splice(r,1))}return s.length>0?this:void 0}get names(){return this.nodes.reduce((i,t)=>no(i,t.names),{})}},Zs=class extends ma{render(i){return"{"+i._n+super.render(i)+"}"+i._n}},zp=class extends ma{},Ap=(()=>{class e extends Zs{}return e.kind="else",e})(),id=(()=>{class e extends Zs{constructor(t,s){super(s),this.condition=t}render(t){let s=`if(${this.condition})`+super.render(t);return this.else&&(s+="else "+this.else.render(t)),s}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let s=this.else;if(s){let r=s.optimizeNodes();s=this.else=Array.isArray(r)?new Ap(r):r}if(s)return t===!1?s instanceof e?s:s.nodes:this.nodes.length?this:new e(nw(t),s instanceof e?[s]:s.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,s){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(t,s),!!(super.optimizeNames(t,s)||this.else))return this.condition=Ko(this.condition,t,s),this}get names(){let t=super.names;return od(t,this.condition),this.else&&no(t,this.else.names),t}}return e.kind="if",e})(),ad=(()=>{class e extends Zs{}return e.kind="for",e})(),jp=class extends ad{constructor(i){super(),this.iteration=i}render(i){return`for(${this.iteration})`+super.render(i)}optimizeNames(i,t){if(super.optimizeNames(i,t))return this.iteration=Ko(this.iteration,i,t),this}get names(){return no(super.names,this.iteration.names)}},Dp=class extends ad{constructor(i,t,s,r){super(),this.varKind=i,this.name=t,this.from=s,this.to=r}render(i){let t=i.es5?gs.varKinds.var:this.varKind,{name:s,from:r,to:o}=this;return`for(${t} ${s}=${r}; ${s}<${o}; ${s}++)`+super.render(i)}get names(){let i=od(super.names,this.from);return od(i,this.to)}},rd=class extends ad{constructor(i,t,s,r){super(),this.loop=i,this.varKind=t,this.name=s,this.iterable=r}render(i){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(i)}optimizeNames(i,t){if(super.optimizeNames(i,t))return this.iterable=Ko(this.iterable,i,t),this}get names(){return no(super.names,this.iterable.names)}},iw=(()=>{class e extends Zs{constructor(t,s,r){super(),this.name=t,this.args=s,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),sw=(()=>{class e extends ma{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),Np=class extends Zs{render(i){let t="try"+super.render(i);return this.catch&&(t+=this.catch.render(i)),this.finally&&(t+=this.finally.render(i)),t}optimizeNodes(){var i,t;return super.optimizeNodes(),(i=this.catch)===null||i===void 0||i.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(i,t){var s,r;return super.optimizeNames(i,t),(s=this.catch)===null||s===void 0||s.optimizeNames(i,t),(r=this.finally)===null||r===void 0||r.optimizeNames(i,t),this}get names(){let i=super.names;return this.catch&&no(i,this.catch.names),this.finally&&no(i,this.finally.names),i}},rw=(()=>{class e extends Zs{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),ow=(()=>{class e extends Zs{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),Rp=class{constructor(i,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=Fe(pe({},t),{_n:t.lines?`
|
|
1
|
+
import{a as $v}from"./chunk-MEX6GNBR.js";import{a as gp,c as Fv,d as Ov,e as Ys,f as Lv,g as QU,h as pp}from"./chunk-7X2JJHYE.js";import{a as Bv}from"./chunk-JT7SPTVG.js";import{a as Uv}from"./chunk-N6D52WI6.js";import{a as qv}from"./chunk-JEQ5JQRP.js";import{a as Jc,b as Zc,c as Qc}from"./chunk-VCZ6KBM7.js";import{a as da}from"./chunk-MGZVKFCX.js";import{a as Vv}from"./chunk-DDJU52K4.js";import{a as Yc,b as Lo}from"./chunk-KSI5RFA4.js";import{a as Vo,b as qo}from"./chunk-PCFKF3RR.js";import{a as Mv}from"./chunk-HSDZKEAS.js";import{a as qc,b as Lc,c as $c,d as Kc,e as Gc,f as Wc,g as Oo,m as It,n as vi,o as jv,p as Dv,q as Nv,r as Rv,s as Ev,t as xr}from"./chunk-YHD44ZXJ.js";import{B as Av,C as us,D as ca,a as vv,b as kr,c as ro,e as Qt,f as wv,h as kv,i as Hv,j as Sv,k as Cv,l as Wi,m as xv,n as Iv,o as Pv,p as Hr,s as Fo,t as Sr,u as up,v as Cr,w as Tv,x as zv}from"./chunk-LZU5VVW4.js";import{a as Pr}from"./chunk-XOT3W4PF.js";import{e as Is}from"./chunk-O7FV4MLW.js";import{b as Tt}from"./chunk-HGLLMJ7J.js";import{k as rt,l as Pt,n as ot,p as Ir,q as Xe}from"./chunk-TXQH2OVO.js";import{$a as Nc,$b as he,$c as fv,A as Ac,Ab as b,Bb as U,Ca as Ss,Cb as oa,Cc as di,Db as na,Dc as ae,Ea as cs,Eb as aa,Ec as wr,Fa as nv,Fb as uv,G as Xy,Gb as gv,Gc as ds,Ha as Cs,Hc as so,Ia as av,Ic as _v,J as ev,Ja as lv,Jc as hv,K as jc,Kb as ie,L as tv,Na as Me,Nb as Q,O as sp,Oa as cv,Ob as Ec,Pb as S,R as _r,Ra as dv,Rc as yi,Sa as m,T as iv,Tb as Bc,Ua as Ni,Ub as Mc,V as rp,Va as Gs,Vb as Uc,Wb as br,Xa as lp,Xb as yr,Yb as Fc,Zb as bi,Zc as Vc,_a as Bo,_b as Ri,a as pe,ab as ra,ac as D,b as Fe,ba as op,bc as re,bd as bv,c as Jy,ca as Dc,cb as xs,cc as oe,da as np,dc as vr,e as v,ea as ls,ec as Oc,fa as sv,fb as ve,fd as yv,g as xt,gb as fr,h as ge,hb as Ws,hc as at,ib as Rc,ic as lt,ja as ap,jc as ct,k as eo,ka as pt,kc as pv,la as hr,lb as cp,lc as Mo,m as to,mc as st,na as Ks,nc as li,oa as rv,oc as la,p as Re,pa as j,pc as ci,q as Tc,qb as dp,qc as Uo,r as ip,rb as me,rc as mv,sa as ov,sb as T,t as Zy,tb as z,tc as R,u as zc,ua as J,uc as O,va as Z,vb as Je,vc as mt,wb as Ze,xb as Qe,y as Qy,ya as sa,yb as N,z as Ae,za as io,zb as y}from"./chunk-UUXRTS4O.js";var Xv=v(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});Ts.formatNames=Ts.fastFormats=Ts.fullFormats=void 0;function Ps(e,i){return{validate:e,compare:i}}Ts.fullFormats={date:Ps(Yv,fp),time:Ps(_p(!0),bp),"date-time":Ps(Kv(!0),Zv),"iso-time":Ps(_p(),Jv),"iso-date-time":Ps(Kv(),Qv),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:rF,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:uF,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:oF,int32:{type:"number",validate:lF},int64:{type:"number",validate:cF},float:{type:"number",validate:Wv},double:{type:"number",validate:Wv},password:!0,binary:!0};Ts.fastFormats=Fe(pe({},Ts.fullFormats),{date:Ps(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,fp),time:Ps(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,bp),"date-time":Ps(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Zv),"iso-time":Ps(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Jv),"iso-date-time":Ps(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Qv),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i});Ts.formatNames=Object.keys(Ts.fullFormats);function XU(e){return e%4===0&&(e%100!==0||e%400===0)}var eF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,tF=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Yv(e){let i=eF.exec(e);if(!i)return!1;let t=+i[1],s=+i[2],r=+i[3];return s>=1&&s<=12&&r>=1&&r<=(s===2&&XU(t)?29:tF[s])}function fp(e,i){if(e&&i)return e>i?1:e<i?-1:0}var mp=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function _p(e){return function(t){let s=mp.exec(t);if(!s)return!1;let r=+s[1],o=+s[2],l=+s[3],c=s[4],u=s[5]==="-"?-1:1,p=+(s[6]||0),_=+(s[7]||0);if(p>23||_>59||e&&!c)return!1;if(r<=23&&o<=59&&l<60)return!0;let f=o-_*u,H=r-p*u-(f<0?1:0);return(H===23||H===-1)&&(f===59||f===-1)&&l<61}}function bp(e,i){if(!(e&&i))return;let t=new Date("2020-01-01T"+e).valueOf(),s=new Date("2020-01-01T"+i).valueOf();if(t&&s)return t-s}function Jv(e,i){if(!(e&&i))return;let t=mp.exec(e),s=mp.exec(i);if(t&&s)return e=t[1]+t[2]+t[3],i=s[1]+s[2]+s[3],e>i?1:e<i?-1:0}var hp=/t|\s/i;function Kv(e){let i=_p(e);return function(s){let r=s.split(hp);return r.length===2&&Yv(r[0])&&i(r[1])}}function Zv(e,i){if(!(e&&i))return;let t=new Date(e).valueOf(),s=new Date(i).valueOf();if(t&&s)return t-s}function Qv(e,i){if(!(e&&i))return;let[t,s]=e.split(hp),[r,o]=i.split(hp),l=fp(t,r);if(l!==void 0)return l||bp(s,o)}var iF=/\/|:/,sF=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function rF(e){return iF.test(e)&&sF.test(e)}var Gv=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function oF(e){return Gv.lastIndex=0,Gv.test(e)}var nF=-(2**31),aF=2**31-1;function lF(e){return Number.isInteger(e)&&e<=aF&&e>=nF}function cF(e){return Number.isInteger(e)}function Wv(){return!0}var dF=/[^\\]\\Z/;function uF(e){if(dF.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var pa=v(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.regexpCode=We.getEsmExportName=We.getProperty=We.safeStringify=We.stringify=We.strConcat=We.addCodeArg=We.str=We._=We.nil=We._Code=We.Name=We.IDENTIFIER=We._CodeOrName=void 0;var ua=class{};We._CodeOrName=ua;We.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var oo=class extends ua{constructor(i){if(super(),!We.IDENTIFIER.test(i))throw new Error("CodeGen: name must be a valid identifier");this.str=i}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};We.Name=oo;var Yi=class extends ua{constructor(i){super(),this._items=typeof i=="string"?[i]:i}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let i=this._items[0];return i===""||i==='""'}get str(){var i;return(i=this._str)!==null&&i!==void 0?i:this._str=this._items.reduce((t,s)=>`${t}${s}`,"")}get names(){var i;return(i=this._names)!==null&&i!==void 0?i:this._names=this._items.reduce((t,s)=>(s instanceof oo&&(t[s.str]=(t[s.str]||0)+1),t),{})}};We._Code=Yi;We.nil=new Yi("");function ew(e,...i){let t=[e[0]],s=0;for(;s<i.length;)vp(t,i[s]),t.push(e[++s]);return new Yi(t)}We._=ew;var yp=new Yi("+");function tw(e,...i){let t=[ga(e[0])],s=0;for(;s<i.length;)t.push(yp),vp(t,i[s]),t.push(yp,ga(e[++s]));return gF(t),new Yi(t)}We.str=tw;function vp(e,i){i instanceof Yi?e.push(...i._items):i instanceof oo?e.push(i):e.push(_F(i))}We.addCodeArg=vp;function gF(e){let i=1;for(;i<e.length-1;){if(e[i]===yp){let t=pF(e[i-1],e[i+1]);if(t!==void 0){e.splice(i-1,3,t);continue}e[i++]="+"}i++}}function pF(e,i){if(i==='""')return e;if(e==='""')return i;if(typeof e=="string")return i instanceof oo||e[e.length-1]!=='"'?void 0:typeof i!="string"?`${e.slice(0,-1)}${i}"`:i[0]==='"'?e.slice(0,-1)+i.slice(1):void 0;if(typeof i=="string"&&i[0]==='"'&&!(e instanceof oo))return`"${e}${i.slice(1)}`}function mF(e,i){return i.emptyStr()?e:e.emptyStr()?i:tw`${e}${i}`}We.strConcat=mF;function _F(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ga(Array.isArray(e)?e.join(","):e)}function hF(e){return new Yi(ga(e))}We.stringify=hF;function ga(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}We.safeStringify=ga;function fF(e){return typeof e=="string"&&We.IDENTIFIER.test(e)?new Yi(`.${e}`):ew`[${e}]`}We.getProperty=fF;function bF(e){if(typeof e=="string"&&We.IDENTIFIER.test(e))return new Yi(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}We.getEsmExportName=bF;function yF(e){return new Yi(e.toString())}We.regexpCode=yF});var Hp=v(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.ValueScope=ki.ValueScopeName=ki.Scope=ki.varKinds=ki.UsedValueState=void 0;var wi=pa(),wp=class extends Error{constructor(i){super(`CodeGen: "code" for ${i} not defined`),this.value=i.value}},Xc=(function(e){return e[e.Started=0]="Started",e[e.Completed=1]="Completed",e})(Xc||(ki.UsedValueState=Xc={}));ki.varKinds={const:new wi.Name("const"),let:new wi.Name("let"),var:new wi.Name("var")};var ed=class{constructor({prefixes:i,parent:t}={}){this._names={},this._prefixes=i,this._parent=t}toName(i){return i instanceof wi.Name?i:this.name(i)}name(i){return new wi.Name(this._newName(i))}_newName(i){let t=this._names[i]||this._nameGroup(i);return`${i}${t.index++}`}_nameGroup(i){var t,s;if(!((s=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||s===void 0)&&s.has(i)||this._prefixes&&!this._prefixes.has(i))throw new Error(`CodeGen: prefix "${i}" is not allowed in this scope`);return this._names[i]={prefix:i,index:0}}};ki.Scope=ed;var td=class extends wi.Name{constructor(i,t){super(t),this.prefix=i}setValue(i,{property:t,itemIndex:s}){this.value=i,this.scopePath=(0,wi._)`.${new wi.Name(t)}[${s}]`}};ki.ValueScopeName=td;var vF=(0,wi._)`\n`,kp=class extends ed{constructor(i){super(i),this._values={},this._scope=i.scope,this.opts=Fe(pe({},i),{_n:i.lines?vF:wi.nil})}get(){return this._scope}name(i){return new td(i,this._newName(i))}value(i,t){var s;if(t.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let r=this.toName(i),{prefix:o}=r,l=(s=t.key)!==null&&s!==void 0?s:t.ref,c=this._values[o];if(c){let _=c.get(l);if(_)return _}else c=this._values[o]=new Map;c.set(l,r);let u=this._scope[o]||(this._scope[o]=[]),p=u.length;return u[p]=t.ref,r.setValue(t,{property:o,itemIndex:p}),r}getValue(i,t){let s=this._values[i];if(s)return s.get(t)}scopeRefs(i,t=this._values){return this._reduceValues(t,s=>{if(s.scopePath===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return(0,wi._)`${i}${s.scopePath}`})}scopeCode(i=this._values,t,s){return this._reduceValues(i,r=>{if(r.value===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,s)}_reduceValues(i,t,s={},r){let o=wi.nil;for(let l in i){let c=i[l];if(!c)continue;let u=s[l]=s[l]||new Map;c.forEach(p=>{if(u.has(p))return;u.set(p,Xc.Started);let _=t(p);if(_){let f=this.opts.es5?ki.varKinds.var:ki.varKinds.const;o=(0,wi._)`${o}${f} ${p} = ${_};${this.opts._n}`}else if(_=r?.(p))o=(0,wi._)`${o}${_}${this.opts._n}`;else throw new wp(p);u.set(p,Xc.Completed)})}return o}};ki.ValueScope=kp});var we=v(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.or=Ue.and=Ue.not=Ue.CodeGen=Ue.operators=Ue.varKinds=Ue.ValueScopeName=Ue.ValueScope=Ue.Scope=Ue.Name=Ue.regexpCode=Ue.stringify=Ue.getProperty=Ue.nil=Ue.strConcat=Ue.str=Ue._=void 0;var Ke=pa(),gs=Hp(),Tr=pa();Object.defineProperty(Ue,"_",{enumerable:!0,get:function(){return Tr._}});Object.defineProperty(Ue,"str",{enumerable:!0,get:function(){return Tr.str}});Object.defineProperty(Ue,"strConcat",{enumerable:!0,get:function(){return Tr.strConcat}});Object.defineProperty(Ue,"nil",{enumerable:!0,get:function(){return Tr.nil}});Object.defineProperty(Ue,"getProperty",{enumerable:!0,get:function(){return Tr.getProperty}});Object.defineProperty(Ue,"stringify",{enumerable:!0,get:function(){return Tr.stringify}});Object.defineProperty(Ue,"regexpCode",{enumerable:!0,get:function(){return Tr.regexpCode}});Object.defineProperty(Ue,"Name",{enumerable:!0,get:function(){return Tr.Name}});var nd=Hp();Object.defineProperty(Ue,"Scope",{enumerable:!0,get:function(){return nd.Scope}});Object.defineProperty(Ue,"ValueScope",{enumerable:!0,get:function(){return nd.ValueScope}});Object.defineProperty(Ue,"ValueScopeName",{enumerable:!0,get:function(){return nd.ValueScopeName}});Object.defineProperty(Ue,"varKinds",{enumerable:!0,get:function(){return nd.varKinds}});Ue.operators={GT:new Ke._Code(">"),GTE:new Ke._Code(">="),LT:new Ke._Code("<"),LTE:new Ke._Code("<="),EQ:new Ke._Code("==="),NEQ:new Ke._Code("!=="),NOT:new Ke._Code("!"),OR:new Ke._Code("||"),AND:new Ke._Code("&&"),ADD:new Ke._Code("+")};var Js=class{optimizeNodes(){return this}optimizeNames(i,t){return this}},Sp=class extends Js{constructor(i,t,s){super(),this.varKind=i,this.name=t,this.rhs=s}render({es5:i,_n:t}){let s=i?gs.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${s} ${this.name}${r};`+t}optimizeNames(i,t){if(i[this.name.str])return this.rhs&&(this.rhs=Ko(this.rhs,i,t)),this}get names(){return this.rhs instanceof Ke._CodeOrName?this.rhs.names:{}}},sd=class extends Js{constructor(i,t,s){super(),this.lhs=i,this.rhs=t,this.sideEffects=s}render({_n:i}){return`${this.lhs} = ${this.rhs};`+i}optimizeNames(i,t){if(!(this.lhs instanceof Ke.Name&&!i[this.lhs.str]&&!this.sideEffects))return this.rhs=Ko(this.rhs,i,t),this}get names(){let i=this.lhs instanceof Ke.Name?{}:pe({},this.lhs.names);return od(i,this.rhs)}},Cp=class extends sd{constructor(i,t,s,r){super(i,s,r),this.op=t}render({_n:i}){return`${this.lhs} ${this.op}= ${this.rhs};`+i}},xp=class extends Js{constructor(i){super(),this.label=i,this.names={}}render({_n:i}){return`${this.label}:`+i}},Ip=class extends Js{constructor(i){super(),this.label=i,this.names={}}render({_n:i}){return`break${this.label?` ${this.label}`:""};`+i}},Pp=class extends Js{constructor(i){super(),this.error=i}render({_n:i}){return`throw ${this.error};`+i}get names(){return this.error.names}},Tp=class extends Js{constructor(i){super(),this.code=i}render({_n:i}){return`${this.code};`+i}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(i,t){return this.code=Ko(this.code,i,t),this}get names(){return this.code instanceof Ke._CodeOrName?this.code.names:{}}},ma=class extends Js{constructor(i=[]){super(),this.nodes=i}render(i){return this.nodes.reduce((t,s)=>t+s.render(i),"")}optimizeNodes(){let{nodes:i}=this,t=i.length;for(;t--;){let s=i[t].optimizeNodes();Array.isArray(s)?i.splice(t,1,...s):s?i[t]=s:i.splice(t,1)}return i.length>0?this:void 0}optimizeNames(i,t){let{nodes:s}=this,r=s.length;for(;r--;){let o=s[r];o.optimizeNames(i,t)||(wF(i,o.names),s.splice(r,1))}return s.length>0?this:void 0}get names(){return this.nodes.reduce((i,t)=>no(i,t.names),{})}},Zs=class extends ma{render(i){return"{"+i._n+super.render(i)+"}"+i._n}},zp=class extends ma{},Ap=(()=>{class e extends Zs{}return e.kind="else",e})(),id=(()=>{class e extends Zs{constructor(t,s){super(s),this.condition=t}render(t){let s=`if(${this.condition})`+super.render(t);return this.else&&(s+="else "+this.else.render(t)),s}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let s=this.else;if(s){let r=s.optimizeNodes();s=this.else=Array.isArray(r)?new Ap(r):r}if(s)return t===!1?s instanceof e?s:s.nodes:this.nodes.length?this:new e(nw(t),s instanceof e?[s]:s.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,s){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(t,s),!!(super.optimizeNames(t,s)||this.else))return this.condition=Ko(this.condition,t,s),this}get names(){let t=super.names;return od(t,this.condition),this.else&&no(t,this.else.names),t}}return e.kind="if",e})(),ad=(()=>{class e extends Zs{}return e.kind="for",e})(),jp=class extends ad{constructor(i){super(),this.iteration=i}render(i){return`for(${this.iteration})`+super.render(i)}optimizeNames(i,t){if(super.optimizeNames(i,t))return this.iteration=Ko(this.iteration,i,t),this}get names(){return no(super.names,this.iteration.names)}},Dp=class extends ad{constructor(i,t,s,r){super(),this.varKind=i,this.name=t,this.from=s,this.to=r}render(i){let t=i.es5?gs.varKinds.var:this.varKind,{name:s,from:r,to:o}=this;return`for(${t} ${s}=${r}; ${s}<${o}; ${s}++)`+super.render(i)}get names(){let i=od(super.names,this.from);return od(i,this.to)}},rd=class extends ad{constructor(i,t,s,r){super(),this.loop=i,this.varKind=t,this.name=s,this.iterable=r}render(i){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(i)}optimizeNames(i,t){if(super.optimizeNames(i,t))return this.iterable=Ko(this.iterable,i,t),this}get names(){return no(super.names,this.iterable.names)}},iw=(()=>{class e extends Zs{constructor(t,s,r){super(),this.name=t,this.args=s,this.async=r}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}}return e.kind="func",e})(),sw=(()=>{class e extends ma{render(t){return"return "+super.render(t)}}return e.kind="return",e})(),Np=class extends Zs{render(i){let t="try"+super.render(i);return this.catch&&(t+=this.catch.render(i)),this.finally&&(t+=this.finally.render(i)),t}optimizeNodes(){var i,t;return super.optimizeNodes(),(i=this.catch)===null||i===void 0||i.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(i,t){var s,r;return super.optimizeNames(i,t),(s=this.catch)===null||s===void 0||s.optimizeNames(i,t),(r=this.finally)===null||r===void 0||r.optimizeNames(i,t),this}get names(){let i=super.names;return this.catch&&no(i,this.catch.names),this.finally&&no(i,this.finally.names),i}},rw=(()=>{class e extends Zs{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}}return e.kind="catch",e})(),ow=(()=>{class e extends Zs{render(t){return"finally"+super.render(t)}}return e.kind="finally",e})(),Rp=class{constructor(i,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts=Fe(pe({},t),{_n:t.lines?`
|
|
2
2
|
`:""}),this._extScope=i,this._scope=new gs.Scope({parent:i}),this._nodes=[new zp]}toString(){return this._root.render(this.opts)}name(i){return this._scope.name(i)}scopeName(i){return this._extScope.name(i)}scopeValue(i,t){let s=this._extScope.value(i,t);return(this._values[s.prefix]||(this._values[s.prefix]=new Set)).add(s),s}getScopeValue(i,t){return this._extScope.getValue(i,t)}scopeRefs(i){return this._extScope.scopeRefs(i,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(i,t,s,r){let o=this._scope.toName(t);return s!==void 0&&r&&(this._constants[o.str]=s),this._leafNode(new Sp(i,o,s)),o}const(i,t,s){return this._def(gs.varKinds.const,i,t,s)}let(i,t,s){return this._def(gs.varKinds.let,i,t,s)}var(i,t,s){return this._def(gs.varKinds.var,i,t,s)}assign(i,t,s){return this._leafNode(new sd(i,t,s))}add(i,t){return this._leafNode(new Cp(i,Ue.operators.ADD,t))}code(i){return typeof i=="function"?i():i!==Ke.nil&&this._leafNode(new Tp(i)),this}object(...i){let t=["{"];for(let[s,r]of i)t.length>1&&t.push(","),t.push(s),(s!==r||this.opts.es5)&&(t.push(":"),(0,Ke.addCodeArg)(t,r));return t.push("}"),new Ke._Code(t)}if(i,t,s){if(this._blockNode(new id(i)),t&&s)this.code(t).else().code(s).endIf();else if(t)this.code(t).endIf();else if(s)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(i){return this._elseNode(new id(i))}else(){return this._elseNode(new Ap)}endIf(){return this._endBlockNode(id,Ap)}_for(i,t){return this._blockNode(i),t&&this.code(t).endFor(),this}for(i,t){return this._for(new jp(i),t)}forRange(i,t,s,r,o=this.opts.es5?gs.varKinds.var:gs.varKinds.let){let l=this._scope.toName(i);return this._for(new Dp(o,l,t,s),()=>r(l))}forOf(i,t,s,r=gs.varKinds.const){let o=this._scope.toName(i);if(this.opts.es5){let l=t instanceof Ke.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,Ke._)`${l}.length`,c=>{this.var(o,(0,Ke._)`${l}[${c}]`),s(o)})}return this._for(new rd("of",r,o,t),()=>s(o))}forIn(i,t,s,r=this.opts.es5?gs.varKinds.var:gs.varKinds.const){if(this.opts.ownProperties)return this.forOf(i,(0,Ke._)`Object.keys(${t})`,s);let o=this._scope.toName(i);return this._for(new rd("in",r,o,t),()=>s(o))}endFor(){return this._endBlockNode(ad)}label(i){return this._leafNode(new xp(i))}break(i){return this._leafNode(new Ip(i))}return(i){let t=new sw;if(this._blockNode(t),this.code(i),t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(sw)}try(i,t,s){if(!t&&!s)throw new Error('CodeGen: "try" without "catch" and "finally"');let r=new Np;if(this._blockNode(r),this.code(i),t){let o=this.name("e");this._currNode=r.catch=new rw(o),t(o)}return s&&(this._currNode=r.finally=new ow,this.code(s)),this._endBlockNode(rw,ow)}throw(i){return this._leafNode(new Pp(i))}block(i,t){return this._blockStarts.push(this._nodes.length),i&&this.code(i).endBlock(t),this}endBlock(i){let t=this._blockStarts.pop();if(t===void 0)throw new Error("CodeGen: not in self-balancing block");let s=this._nodes.length-t;if(s<0||i!==void 0&&s!==i)throw new Error(`CodeGen: wrong number of nodes: ${s} vs ${i} expected`);return this._nodes.length=t,this}func(i,t=Ke.nil,s,r){return this._blockNode(new iw(i,t,s)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(iw)}optimize(i=1){for(;i-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(i){return this._currNode.nodes.push(i),this}_blockNode(i){this._currNode.nodes.push(i),this._nodes.push(i)}_endBlockNode(i,t){let s=this._currNode;if(s instanceof i||t&&s instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${i.kind}/${t.kind}`:i.kind}"`)}_elseNode(i){let t=this._currNode;if(!(t instanceof id))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=i,this}get _root(){return this._nodes[0]}get _currNode(){let i=this._nodes;return i[i.length-1]}set _currNode(i){let t=this._nodes;t[t.length-1]=i}};Ue.CodeGen=Rp;function no(e,i){for(let t in i)e[t]=(e[t]||0)+(i[t]||0);return e}function od(e,i){return i instanceof Ke._CodeOrName?no(e,i.names):e}function Ko(e,i,t){if(e instanceof Ke.Name)return s(e);if(!r(e))return e;return new Ke._Code(e._items.reduce((o,l)=>(l instanceof Ke.Name&&(l=s(l)),l instanceof Ke._Code?o.push(...l._items):o.push(l),o),[]));function s(o){let l=t[o.str];return l===void 0||i[o.str]!==1?o:(delete i[o.str],l)}function r(o){return o instanceof Ke._Code&&o._items.some(l=>l instanceof Ke.Name&&i[l.str]===1&&t[l.str]!==void 0)}}function wF(e,i){for(let t in i)e[t]=(e[t]||0)-(i[t]||0)}function nw(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Ke._)`!${Ep(e)}`}Ue.not=nw;var kF=aw(Ue.operators.AND);function HF(...e){return e.reduce(kF)}Ue.and=HF;var SF=aw(Ue.operators.OR);function CF(...e){return e.reduce(SF)}Ue.or=CF;function aw(e){return(i,t)=>i===Ke.nil?t:t===Ke.nil?i:(0,Ke._)`${Ep(i)} ${e} ${Ep(t)}`}function Ep(e){return e instanceof Ke.Name?e:(0,Ke._)`(${e})`}});var qe=v(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.checkStrictMode=Oe.getErrorPath=Oe.Type=Oe.useFunc=Oe.setEvaluated=Oe.evaluatedPropsToName=Oe.mergeEvaluated=Oe.eachItem=Oe.unescapeJsonPointer=Oe.escapeJsonPointer=Oe.escapeFragment=Oe.unescapeFragment=Oe.schemaRefOrVal=Oe.schemaHasRulesButRef=Oe.schemaHasRules=Oe.checkUnknownRules=Oe.alwaysValidSchema=Oe.toHash=void 0;var _t=we(),xF=pa();function IF(e){let i={};for(let t of e)i[t]=!0;return i}Oe.toHash=IF;function PF(e,i){return typeof i=="boolean"?i:Object.keys(i).length===0?!0:(dw(e,i),!uw(i,e.self.RULES.all))}Oe.alwaysValidSchema=PF;function dw(e,i=e.schema){let{opts:t,self:s}=e;if(!t.strictSchema||typeof i=="boolean")return;let r=s.RULES.keywords;for(let o in i)r[o]||mw(e,`unknown keyword: "${o}"`)}Oe.checkUnknownRules=dw;function uw(e,i){if(typeof e=="boolean")return!e;for(let t in e)if(i[t])return!0;return!1}Oe.schemaHasRules=uw;function TF(e,i){if(typeof e=="boolean")return!e;for(let t in e)if(t!=="$ref"&&i.all[t])return!0;return!1}Oe.schemaHasRulesButRef=TF;function zF({topSchemaRef:e,schemaPath:i},t,s,r){if(!r){if(typeof t=="number"||typeof t=="boolean")return t;if(typeof t=="string")return(0,_t._)`${t}`}return(0,_t._)`${e}${i}${(0,_t.getProperty)(s)}`}Oe.schemaRefOrVal=zF;function AF(e){return gw(decodeURIComponent(e))}Oe.unescapeFragment=AF;function jF(e){return encodeURIComponent(Mp(e))}Oe.escapeFragment=jF;function Mp(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Oe.escapeJsonPointer=Mp;function gw(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Oe.unescapeJsonPointer=gw;function DF(e,i){if(Array.isArray(e))for(let t of e)i(t);else i(e)}Oe.eachItem=DF;function lw({mergeNames:e,mergeToName:i,mergeValues:t,resultToName:s}){return(r,o,l,c)=>{let u=l===void 0?o:l instanceof _t.Name?(o instanceof _t.Name?e(r,o,l):i(r,o,l),l):o instanceof _t.Name?(i(r,l,o),o):t(o,l);return c===_t.Name&&!(u instanceof _t.Name)?s(r,u):u}}Oe.mergeEvaluated={props:lw({mergeNames:(e,i,t)=>e.if((0,_t._)`${t} !== true && ${i} !== undefined`,()=>{e.if((0,_t._)`${i} === true`,()=>e.assign(t,!0),()=>e.assign(t,(0,_t._)`${t} || {}`).code((0,_t._)`Object.assign(${t}, ${i})`))}),mergeToName:(e,i,t)=>e.if((0,_t._)`${t} !== true`,()=>{i===!0?e.assign(t,!0):(e.assign(t,(0,_t._)`${t} || {}`),Up(e,t,i))}),mergeValues:(e,i)=>e===!0?!0:pe(pe({},e),i),resultToName:pw}),items:lw({mergeNames:(e,i,t)=>e.if((0,_t._)`${t} !== true && ${i} !== undefined`,()=>e.assign(t,(0,_t._)`${i} === true ? true : ${t} > ${i} ? ${t} : ${i}`)),mergeToName:(e,i,t)=>e.if((0,_t._)`${t} !== true`,()=>e.assign(t,i===!0?!0:(0,_t._)`${t} > ${i} ? ${t} : ${i}`)),mergeValues:(e,i)=>e===!0?!0:Math.max(e,i),resultToName:(e,i)=>e.var("items",i)})};function pw(e,i){if(i===!0)return e.var("props",!0);let t=e.var("props",(0,_t._)`{}`);return i!==void 0&&Up(e,t,i),t}Oe.evaluatedPropsToName=pw;function Up(e,i,t){Object.keys(t).forEach(s=>e.assign((0,_t._)`${i}${(0,_t.getProperty)(s)}`,!0))}Oe.setEvaluated=Up;var cw={};function NF(e,i){return e.scopeValue("func",{ref:i,code:cw[i.code]||(cw[i.code]=new xF._Code(i.code))})}Oe.useFunc=NF;var Bp=(function(e){return e[e.Num=0]="Num",e[e.Str=1]="Str",e})(Bp||(Oe.Type=Bp={}));function RF(e,i,t){if(e instanceof _t.Name){let s=i===Bp.Num;return t?s?(0,_t._)`"[" + ${e} + "]"`:(0,_t._)`"['" + ${e} + "']"`:s?(0,_t._)`"/" + ${e}`:(0,_t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return t?(0,_t.getProperty)(e).toString():"/"+Mp(e)}Oe.getErrorPath=RF;function mw(e,i,t=e.opts.strictSchema){if(t){if(i=`strict mode: ${i}`,t===!0)throw new Error(i);e.self.logger.warn(i)}}Oe.checkStrictMode=mw});var Ji=v(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var Xt=we(),EF={data:new Xt.Name("data"),valCxt:new Xt.Name("valCxt"),instancePath:new Xt.Name("instancePath"),parentData:new Xt.Name("parentData"),parentDataProperty:new Xt.Name("parentDataProperty"),rootData:new Xt.Name("rootData"),dynamicAnchors:new Xt.Name("dynamicAnchors"),vErrors:new Xt.Name("vErrors"),errors:new Xt.Name("errors"),this:new Xt.Name("this"),self:new Xt.Name("self"),scope:new Xt.Name("scope"),json:new Xt.Name("json"),jsonPos:new Xt.Name("jsonPos"),jsonLen:new Xt.Name("jsonLen"),jsonPart:new Xt.Name("jsonPart")};Fp.default=EF});var _a=v(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.extendErrors=ei.resetErrorsCount=ei.reportExtraError=ei.reportError=ei.keyword$DataError=ei.keywordError=void 0;var Ge=we(),ld=qe(),ui=Ji();ei.keywordError={message:({keyword:e})=>(0,Ge.str)`must pass "${e}" keyword validation`};ei.keyword$DataError={message:({keyword:e,schemaType:i})=>i?(0,Ge.str)`"${e}" keyword must be ${i} ($data)`:(0,Ge.str)`"${e}" keyword is invalid ($data)`};function BF(e,i=ei.keywordError,t,s){let{it:r}=e,{gen:o,compositeRule:l,allErrors:c}=r,u=fw(e,i,t);s??(l||c)?_w(o,u):hw(r,(0,Ge._)`[${u}]`)}ei.reportError=BF;function MF(e,i=ei.keywordError,t){let{it:s}=e,{gen:r,compositeRule:o,allErrors:l}=s,c=fw(e,i,t);_w(r,c),o||l||hw(s,ui.default.vErrors)}ei.reportExtraError=MF;function UF(e,i){e.assign(ui.default.errors,i),e.if((0,Ge._)`${ui.default.vErrors} !== null`,()=>e.if(i,()=>e.assign((0,Ge._)`${ui.default.vErrors}.length`,i),()=>e.assign(ui.default.vErrors,null)))}ei.resetErrorsCount=UF;function FF({gen:e,keyword:i,schemaValue:t,data:s,errsCount:r,it:o}){if(r===void 0)throw new Error("ajv implementation error");let l=e.name("err");e.forRange("i",r,ui.default.errors,c=>{e.const(l,(0,Ge._)`${ui.default.vErrors}[${c}]`),e.if((0,Ge._)`${l}.instancePath === undefined`,()=>e.assign((0,Ge._)`${l}.instancePath`,(0,Ge.strConcat)(ui.default.instancePath,o.errorPath))),e.assign((0,Ge._)`${l}.schemaPath`,(0,Ge.str)`${o.errSchemaPath}/${i}`),o.opts.verbose&&(e.assign((0,Ge._)`${l}.schema`,t),e.assign((0,Ge._)`${l}.data`,s))})}ei.extendErrors=FF;function _w(e,i){let t=e.const("err",i);e.if((0,Ge._)`${ui.default.vErrors} === null`,()=>e.assign(ui.default.vErrors,(0,Ge._)`[${t}]`),(0,Ge._)`${ui.default.vErrors}.push(${t})`),e.code((0,Ge._)`${ui.default.errors}++`)}function hw(e,i){let{gen:t,validateName:s,schemaEnv:r}=e;r.$async?t.throw((0,Ge._)`new ${e.ValidationError}(${i})`):(t.assign((0,Ge._)`${s}.errors`,i),t.return(!1))}var ao={keyword:new Ge.Name("keyword"),schemaPath:new Ge.Name("schemaPath"),params:new Ge.Name("params"),propertyName:new Ge.Name("propertyName"),message:new Ge.Name("message"),schema:new Ge.Name("schema"),parentSchema:new Ge.Name("parentSchema")};function fw(e,i,t){let{createErrors:s}=e.it;return s===!1?(0,Ge._)`{}`:OF(e,i,t)}function OF(e,i,t={}){let{gen:s,it:r}=e,o=[VF(r,t),qF(e,t)];return LF(e,i,o),s.object(...o)}function VF({errorPath:e},{instancePath:i}){let t=i?(0,Ge.str)`${e}${(0,ld.getErrorPath)(i,ld.Type.Str)}`:e;return[ui.default.instancePath,(0,Ge.strConcat)(ui.default.instancePath,t)]}function qF({keyword:e,it:{errSchemaPath:i}},{schemaPath:t,parentSchema:s}){let r=s?i:(0,Ge.str)`${i}/${e}`;return t&&(r=(0,Ge.str)`${r}${(0,ld.getErrorPath)(t,ld.Type.Str)}`),[ao.schemaPath,r]}function LF(e,{params:i,message:t},s){let{keyword:r,data:o,schemaValue:l,it:c}=e,{opts:u,propertyName:p,topSchemaRef:_,schemaPath:f}=c;s.push([ao.keyword,r],[ao.params,typeof i=="function"?i(e):i||(0,Ge._)`{}`]),u.messages&&s.push([ao.message,typeof t=="function"?t(e):t]),u.verbose&&s.push([ao.schema,l],[ao.parentSchema,(0,Ge._)`${_}${f}`],[ui.default.data,o]),p&&s.push([ao.propertyName,p])}});var yw=v(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.boolOrEmptySchema=Go.topBoolOrEmptySchema=void 0;var $F=_a(),KF=we(),GF=Ji(),WF={message:"boolean schema is false"};function YF(e){let{gen:i,schema:t,validateName:s}=e;t===!1?bw(e,!1):typeof t=="object"&&t.$async===!0?i.return(GF.default.data):(i.assign((0,KF._)`${s}.errors`,null),i.return(!0))}Go.topBoolOrEmptySchema=YF;function JF(e,i){let{gen:t,schema:s}=e;s===!1?(t.var(i,!1),bw(e)):t.var(i,!0)}Go.boolOrEmptySchema=JF;function bw(e,i){let{gen:t,data:s}=e,r={gen:t,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,$F.reportError)(r,WF,void 0,i)}});var Op=v(Wo=>{"use strict";Object.defineProperty(Wo,"__esModule",{value:!0});Wo.getRules=Wo.isJSONType=void 0;var ZF=["string","number","integer","boolean","null","object","array"],QF=new Set(ZF);function XF(e){return typeof e=="string"&&QF.has(e)}Wo.isJSONType=XF;function eO(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:Fe(pe({},e),{integer:!0,boolean:!0,null:!0}),rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Wo.getRules=eO});var Vp=v(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.shouldUseRule=zr.shouldUseGroup=zr.schemaHasRulesForType=void 0;function tO({schema:e,self:i},t){let s=i.RULES.types[t];return s&&s!==!0&&vw(e,s)}zr.schemaHasRulesForType=tO;function vw(e,i){return i.rules.some(t=>ww(e,t))}zr.shouldUseGroup=vw;function ww(e,i){var t;return e[i.keyword]!==void 0||((t=i.definition.implements)===null||t===void 0?void 0:t.some(s=>e[s]!==void 0))}zr.shouldUseRule=ww});var ha=v(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.reportTypeError=ti.checkDataTypes=ti.checkDataType=ti.coerceAndCheckDataType=ti.getJSONTypes=ti.getSchemaTypes=ti.DataType=void 0;var iO=Op(),sO=Vp(),rO=_a(),De=we(),kw=qe(),Yo=(function(e){return e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong",e})(Yo||(ti.DataType=Yo={}));function oO(e){let i=Hw(e.type);if(i.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!i.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&i.push("null")}return i}ti.getSchemaTypes=oO;function Hw(e){let i=Array.isArray(e)?e:e?[e]:[];if(i.every(iO.isJSONType))return i;throw new Error("type must be JSONType or JSONType[]: "+i.join(","))}ti.getJSONTypes=Hw;function nO(e,i){let{gen:t,data:s,opts:r}=e,o=aO(i,r.coerceTypes),l=i.length>0&&!(o.length===0&&i.length===1&&(0,sO.schemaHasRulesForType)(e,i[0]));if(l){let c=Lp(i,s,r.strictNumbers,Yo.Wrong);t.if(c,()=>{o.length?lO(e,i,o):$p(e)})}return l}ti.coerceAndCheckDataType=nO;var Sw=new Set(["string","number","integer","boolean","null"]);function aO(e,i){return i?e.filter(t=>Sw.has(t)||i==="array"&&t==="array"):[]}function lO(e,i,t){let{gen:s,data:r,opts:o}=e,l=s.let("dataType",(0,De._)`typeof ${r}`),c=s.let("coerced",(0,De._)`undefined`);o.coerceTypes==="array"&&s.if((0,De._)`${l} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,()=>s.assign(r,(0,De._)`${r}[0]`).assign(l,(0,De._)`typeof ${r}`).if(Lp(i,r,o.strictNumbers),()=>s.assign(c,r))),s.if((0,De._)`${c} !== undefined`);for(let p of t)(Sw.has(p)||p==="array"&&o.coerceTypes==="array")&&u(p);s.else(),$p(e),s.endIf(),s.if((0,De._)`${c} !== undefined`,()=>{s.assign(r,c),cO(e,c)});function u(p){switch(p){case"string":s.elseIf((0,De._)`${l} == "number" || ${l} == "boolean"`).assign(c,(0,De._)`"" + ${r}`).elseIf((0,De._)`${r} === null`).assign(c,(0,De._)`""`);return;case"number":s.elseIf((0,De._)`${l} == "boolean" || ${r} === null
|
|
3
3
|
|| (${l} == "string" && ${r} && ${r} == +${r})`).assign(c,(0,De._)`+${r}`);return;case"integer":s.elseIf((0,De._)`${l} === "boolean" || ${r} === null
|
|
4
4
|
|| (${l} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(c,(0,De._)`+${r}`);return;case"boolean":s.elseIf((0,De._)`${r} === "false" || ${r} === 0 || ${r} === null`).assign(c,!1).elseIf((0,De._)`${r} === "true" || ${r} === 1`).assign(c,!0);return;case"null":s.elseIf((0,De._)`${r} === "" || ${r} === 0 || ${r} === false`),s.assign(c,null);return;case"array":s.elseIf((0,De._)`${l} === "string" || ${l} === "number"
|
|
@@ -95,13 +95,13 @@ Should be: [ [ object1, pointer1 ], [ object 2, pointer2 ], etc... ]`),r}}static
|
|
|
95
95
|
`;t.source.postMessage({action:"inline-style",style:c},t.origin)})}getConfigBlocks(){return this.pluginConfig}updateConfigBlocks(t){for(let s of t)s[this.pluginType]=this.pluginAlias;this.pluginConfig=t}schemaFormUpdated(){if(!(!this.iframe||!this.iframe.contentWindow)){if(this.schemaFormRecentlyRefreshed){this.schemaFormRecentlyRefreshed=!1;return}this.schemaFormRecentlyUpdated=!0,this.iframe.contentWindow.postMessage({action:"stream",event:"configChanged",data:this.pluginConfig},Ir.api.origin)}}schemaFormRefresh(){if(this.schemaFormRecentlyUpdated){this.schemaFormRecentlyUpdated=!1;return}this.schemaFormRecentlyRefreshed=!0,this.showSchemaForm&&(this.showSchemaForm=!1,setTimeout(()=>{this.showSchemaForm=!0}))}formCreate(t,s,r,o,l){return ge(this,null,function*(){yield this.formEnd(),this.formId=t,this.formSchema=s,this.formData=r,this.formSubmitButtonLabel=o,this.formCancelButtonLabel=l})}formEnd(){return ge(this,null,function*(){this.formId&&(this.formId=void 0,this.formSchema=void 0,this.formData=void 0,this.formSubmitButtonLabel=void 0,this.formCancelButtonLabel=void 0,yield new Promise(t=>setTimeout(t)))})}formUpdated(t){this.iframe.contentWindow.postMessage({action:"stream",event:this.formId,data:{formEvent:"change",formData:t}},Ir.api.origin)}formActionEvent(t){this.iframe.contentWindow.postMessage({action:"stream",event:this.formId,data:{formEvent:t,formData:this.formData}},Ir.api.origin)}handleGetCachedAccessories(t){return ge(this,null,function*(){let s=yield Ae(this.$api.get("/server/cached-accessories"));return this.requestResponse(t,s.filter(r=>r.plugin===this.plugin.name))})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],viewQuery:function(s,r){s&1&&br(r.customPluginUiElementTarget,Qse,5),s&2&&yr()},inputs:{plugin:"plugin",schema:"schema",pluginConfig:"pluginConfig"},decls:24,vars:17,consts:[["custompluginui",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body","pb-0",2,"min-height","110px"],[1,"text-center","primary-text","my-5","w-100"],["width","100%","height","1px;","sandbox","allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms",2,"border","0"],[1,"card","card-body"],[1,"loading-overlay","text-center","primary-text","d-flex","align-items-center","justify-content-center"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end","d-flex","align-items-center","justify-content-end"],["container","modal","placement","top","triggers","hover",1,"fa","fa-xl","me-2",3,"ngClass","ngbTooltip","openDelay"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-circle-notch","fa-spin"],[1,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],[3,"dataChange","dataChanged","isValid","configSchema","data"],[1,"text-end","custom-form-action-buttons"],[1,"btn","btn-elegant"],[1,"btn","btn-primary",3,"disabled"],[1,"btn","btn-elegant",3,"click"],[1,"btn","btn-primary",3,"click","disabled"]],template:function(s,r){if(s&1){let o=ie();y(0,"div",1)(1,"div",2)(2,"h5",3),D(3),b(),y(4,"button",4),R(5,"translate"),Q("click",function(){return J(o),Z(r.dismissModal())}),b()(),y(6,"div",5),T(7,Xse,2,0,"div",6),U(8,"iframe",7,0),T(10,ere,2,2,"div",8),T(11,sre,5,4,"div",8),T(12,rre,2,0,"div",9),b(),y(13,"div",10)(14,"div",11)(15,"button",12),Q("click",function(){return J(o),Z(r.dismissModal())}),D(16),R(17,"translate"),b()(),U(18,"div",13),y(19,"div",14),T(20,ore,2,5,"i",15),y(21,"button",16),Q("click",function(){return J(o),Z(r.savePluginConfig(!0))}),T(22,nre,2,3),T(23,are,1,0,"i",17),b()()()()}s&2&&(m(3),re(r.plugin.displayName||r.plugin.name),m(),N("disabled",r.saveInProgress),me("aria-label",O(5,13,"form.button_close")),m(3),z(r.loading?7:-1),m(3),z(r.uiLoaded&&r.pluginConfig.length&&r.schema.singular&&r.showSchemaForm?10:-1),m(),z(r.formId?11:-1),m(),z(r.pluginSpinner?12:-1),m(3),N("disabled",r.saveInProgress),m(),oe(" ",O(17,15,"form.button_close")," "),m(4),z(r.saveButtonDisabled?-1:20),m(),N("disabled",r.saveInProgress||r.saveButtonDisabled),m(),z(r.saveInProgress?-1:22),m(),z(r.saveInProgress?23:-1))},dependencies:[ju,xr,yi,Pt],styles:[".manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}.loading-overlay[_ngcontent-%COMP%]{position:absolute;inset:16px;background-color:#ffffffb3} body.dark-mode .loading-overlay{background-color:#242424b3}.custom-form-action-buttons[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:last-child{margin-right:2px}"]})}return e})();var O2=(()=>{class e{$api=j(Xe);$modal=j(vi);plugins={};openSettings(t,s){return ge(this,null,function*(){let r=yield this.loadPluginConfig(t.name),o=this.$modal.open(this.plugins[t.name],{size:"lg",backdrop:"static"});return o.componentInstance.plugin=t,o.componentInstance.schema=s,o.componentInstance.pluginConfig=r,o.result.catch(()=>{})})}openCustomSettingsUi(t,s){return ge(this,null,function*(){let r=yield this.loadPluginConfig(t.name),o=this.$modal.open(F2,{size:"lg",backdrop:"static"});return o.componentInstance.plugin=t,o.componentInstance.schema=s,o.componentInstance.pluginConfig=r,o.result.catch(()=>{})})}loadPluginConfig(t){return ge(this,null,function*(){return Ae(this.$api.get(`/config-editor/plugin/${encodeURIComponent(t)}`))})}static \u0275fac=function(s){return new(s||e)};static \u0275prov=pt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();var G2=xt(da(),1);var V2=xt(da(),1);var lre=["pluginlogoutput"];function cre(e,i){if(e&1){let t=ie();y(0,"button",15),R(1,"translate"),R(2,"translate"),Q("click",function(){J(t);let r=S();return Z(r.restartChildBridges())}),U(3,"i",16),b()}if(e&2){let t=S();N("ngbTooltip",O(1,4,t.childBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart"))("openDelay",150)("disabled",t.midAction),me("aria-label",O(2,6,t.childBridges.length>1?"child_bridge.restart_plural":"child_bridge.restart"))}}var q2=(()=>{class e{$activeModal=j(It);$api=j(Xe);$log=j(qv);$modal=j(vi);$toastr=j(ot);$translate=j(rt);resizeEvent=new Re;pluginAlias;plugin;childBridges=[];termTarget=wr("pluginlogoutput");midAction=!1;onWindowResize(){this.resizeEvent.next(void 0)}ngOnInit(){this.getPluginLog()}restartChildBridges(){return ge(this,null,function*(){this.midAction=!0;try{for(let t of this.childBridges)yield Ae(this.$api.put(`/server/restart/${t.username}`,{}));this.$toastr.success(this.$translate.instant("plugins.manage.child_bridge_restart"),this.$translate.instant("toast.title_success")),this.midAction=!1}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("plugins.manage.child_bridge_restart_failed"),this.$translate.instant("toast.title_error")),this.midAction=!1}})}downloadLogFile(){this.midAction=!0;let t=this.$modal.open(Mv,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("logs.title_download_log_file"),t.componentInstance.message=this.$translate.instant("logs.download_warning"),t.componentInstance.confirmButtonLabel=this.$translate.instant("form.button_download"),t.componentInstance.faIconClass="fas fa-user-secret primary-text",t.result.then(()=>{this.$api.get("/platform-tools/hb-service/log/download?colour=yes",{observe:"response",responseType:"text"}).subscribe({next:s=>{if(!s.body)return;let r=s.body.split(`
|
|
96
96
|
`),o="",l=!1;r.forEach(c=>{if(c){if(l)if(c.match(/36m\[.*?\]/))l=!1;else{o+=`${c.replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"")}\r
|
|
97
97
|
`;return}c.includes(`36m[${this.pluginAlias}]`)&&(o+=`${c.replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"")}\r
|
|
98
|
-
`,l=!0)}}),(0,V2.saveAs)(new Blob([o],{type:"text/plain;charset=utf-8"}),`${this.plugin.name}.log.txt`),this.midAction=!1},error:s=>ge(this,null,function*(){let r;try{r=JSON.parse(yield s.error.text()).message}catch(o){console.error(o)}this.$toastr.error(r||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error")),this.midAction=!1})})}).catch(()=>{this.midAction=!1})}ngOnDestroy(){this.$log.destroyTerminal()}dismissModal(){this.$activeModal.dismiss("Dismiss")}getPluginLog(){this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe({next:t=>{this.pluginAlias=this.plugin.name==="homebridge-config-ui-x"?"Homebridge UI":t[0]?.name||this.plugin.name,this.$log.startTerminal(this.termTarget(),{},this.resizeEvent,this.pluginAlias)},error:t=>{console.error(t),this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),this.$activeModal.dismiss()}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],viewQuery:function(s,r){s&1&&br(r.termTarget,lre,5),s&2&&yr()},hostBindings:function(s,r){s&1&&Q("resize",function(l){return r.onWindowResize(l)},dv)},inputs:{plugin:"plugin",childBridges:"childBridges"},decls:22,vars:21,consts:[["pluginlogoutput",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body","d-flex","flex-row","flex-grow-1","w-100","p-0"],[1,"w-100","bg-black","plugin-log-output","terminal","align-self-end","w-100","h-100","mb-0","p-2"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["container","modal","placement","top","triggers","hover",1,"btn","btn-primary",3,"click","ngbTooltip","openDelay","disabled"],[1,"fas","fa-download"],["container","modal","placement","top","triggers","hover",1,"btn","btn-danger","ms-3",3,"ngbTooltip","openDelay","disabled"],["container","modal","placement","top","triggers","hover",1,"btn","btn-danger","ms-3",3,"click","ngbTooltip","openDelay","disabled"],[1,"fas","fa-power-off"]],template:function(s,r){if(s&1){let o=ie();y(0,"div",1)(1,"div",2)(2,"h5",3),D(3),b(),y(4,"button",4),R(5,"translate"),Q("click",function(){return J(o),Z(r.dismissModal())}),b()(),y(6,"div",5),U(7,"div",6,0),b(),y(9,"div",7)(10,"div",8)(11,"button",9),R(12,"translate"),Q("click",function(){return J(o),Z(r.dismissModal())}),D(13),R(14,"translate"),b()(),U(15,"div",10),y(16,"div",11)(17,"button",12),R(18,"translate"),R(19,"translate"),Q("click",function(){return J(o),Z(r.downloadLogFile())}),U(20,"i",13),b(),T(21,cre,4,8,"button",14),b()()()}s&2&&(m(3),re(r.plugin.displayName||r.plugin.name),m(),N("disabled",r.midAction),me("aria-label",O(5,11,"form.button_close")),m(7),N("disabled",r.midAction),me("aria-label",O(12,13,"form.button_close")),m(2),oe(" ",O(14,15,"form.button_close")," "),m(4),N("ngbTooltip",O(18,17,"logs.title_download_log_file"))("openDelay",150)("disabled",r.midAction),me("aria-label",O(19,19,"logs.title_download_log_file")),m(4),z(r.childBridges.length?21:-1))},dependencies:[xr,Pt],encapsulation:2})}return e})();var L2=xt(Yc(),1);var mf=()=>({app:"Homebridge v2"});function dre(e,i){e&1&&(y(0,"div",5),U(1,"i",12),b())}function ure(e,i){e&1&&(y(0,"p",9),D(1,"All your plugins are marked as compatible with Homebridge v2."),b())}function gre(e,i){e&1&&(y(0,"p",9),D(1,"To ignore this warning and continue with the update, click continue below."),b())}function pre(e,i){if(e&1&&(y(0,"p",9),D(1," Some of your plugins are not explicitly marked as compatible with Homebridge v2. This does "),y(2,"span",17),D(3,"not"),b(),D(4," necessarily mean that they won't work. We just can't guarantee that they will. "),b(),y(5,"p",9),D(6," For more information about this update, please see the "),y(7,"a",18),D(8,"wiki page"),b(),D(9,". "),b(),T(10,gre,2,0,"p",9)),e&2){let t=S(2);m(10),z(t.isUpdating?10:-1)}}function mre(e,i){e&1&&(y(0,"div",19),D(1," Node.js Version"),U(2,"br"),y(3,"span",20),D(4),R(5,"translate"),b()(),y(6,"div",21),U(7,"i",22),b()),e&2&&(m(4),re(mt(5,1,"status.readiness.node_yes",st(4,mf))))}function _re(e,i){e&1&&(y(0,"div",19),D(1," Node.js Version"),U(2,"br"),y(3,"span",20),D(4),R(5,"translate"),b(),U(6,"br"),y(7,"a",23),D(8),R(9,"translate"),U(10,"i",24),b()(),y(11,"div",21),U(12,"i",25),b()),e&2&&(m(4),re(mt(5,2,"status.readiness.node_no",st(7,mf))),m(4),oe(" ",O(9,5,"plugins.compat.node_link")," "))}function hre(e,i){e&1&&U(0,"i",26)}function fre(e,i){e&1&&U(0,"i",27)}function bre(e,i){if(e&1&&(y(0,"li",16)(1,"div",19),D(2),b(),y(3,"div",21),T(4,hre,1,0,"i",26),T(5,fre,1,0,"i",27),b()()),e&2){let t=i.$implicit;m(2),re(t.displayName),m(2),z(t.hb2Ready==="supported"?4:-1),m(),z(t.hb2Ready==="unknown"?5:-1)}}function yre(e,i){if(e&1&&(y(0,"div",13),U(1,"img",14),b(),T(2,ure,2,0,"p",9),T(3,pre,11,1),y(4,"ul",15)(5,"li",16),T(6,mre,8,5)(7,_re,13,8),b(),Ze(8,bre,6,3,"li",16,Je),b()),e&2){let t=S();m(2),z(t.allPluginsSupported?2:-1),m(),z(t.allPluginsSupported?-1:3),m(3),z(t.nodeReady?6:7),m(2),Qe(t.installedPlugins)}}function vre(e,i){if(e&1){let t=ie();y(0,"button",28),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.closeModal("Dismiss"))}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function wre(e,i){if(e&1){let t=ie();y(0,"button",28),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.closeModal("Dismiss"))}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function kre(e,i){if(e&1){let t=ie();y(0,"button",29),Q("click",function(){J(t);let r=S();return Z(r.closeModal("update"))}),D(1),R(2,"translate"),b()}if(e&2){let t=S();N("disabled",t.loading),m(),oe(" ",O(2,2,"form.button_continue")," ")}}var $2=(()=>{class e{$activeModal=j(It);$api=j(Xe);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);$ws=j(Pr);io;isUpdating=!1;skipIfCompatible=!0;loading=!0;installedPlugins=[];allPluginsSupported=!0;nodeReady=!1;ngOnInit(){return ge(this,null,function*(){this.io=this.$ws.getExistingNamespace("status"),this.io.socket.connected&&(yield this.checkHomebridgeUiVersion()),yield this.loadInstalledPlugins(),this.loading=!1})}checkHomebridgeUiVersion(){return ge(this,null,function*(){try{let{nodeVersion:t}=yield Ae(this.io.request("get-homebridge-server-info"));this.nodeReady=(0,L2.satisfies)(t,">=20")}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}loadInstalledPlugins(){return ge(this,null,function*(){this.installedPlugins=[],this.loading=!0;let t=this.$settings.env.homebridgeVersion.split(".")[0];try{let s=yield Ae(this.$api.get("/plugins"));this.installedPlugins=s.filter(r=>r.name!=="homebridge-config-ui-x").map(r=>{let o=r.engines?.homebridge?.split("||").map(c=>c.trim())||[],l=t==="2"?"hide":o.some(c=>c.startsWith("^2")||c.startsWith(">=2"))?"supported":"unknown";return l==="unknown"&&(this.allPluginsSupported=!1),Fe(pe({},r),{hb2Ready:l})}).sort((r,o)=>r.name.localeCompare(o.name)),this.skipIfCompatible&&this.installedPlugins.length===0&&this.$activeModal.close("update")}catch(s){console.error(s),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugins"),this.$translate.instant("toast.title_error"))}})}closeModal(t){this.$activeModal.close(t)}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{isUpdating:"isUpdating",skipIfCompatible:"skipIfCompatible"},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"],[1,"modal-body"],[1,"text-center","primary-text","my-5","w-100"],[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,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],["ngSrc","assets/hb-icon.png","alt","","height","100","width","100",1,"plugin-icon-card"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"fw-bold"],["href","https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0","target","_blank"],[1,"text-start","flex-grow-1"],[1,"grey-text"],[1,"ms-3"],[1,"fas","fa-check-circle","green-text","fa-xl"],["href","https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js","target","_blank","rel","noopener noreferrer",1,"small"],[1,"fa","fa-external-link-alt"],[1,"fas","fa-exclamation-circle","orange-text","fa-xl"],["aria-label","The developer has specifically marked this plugin as compatible with Homebridge v2.",1,"fas","fa-check-circle","green-text","fa-xl"],["aria-label","The developer has not specifically marked this plugin as compatible with Homebridge v2, but it may still work.",1,"fas","fa-question-circle","orange-text","fa-xl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),R(4,"translate"),b(),y(5,"button",3),R(6,"translate"),Q("click",function(){return r.closeModal("Dismiss")}),b()(),y(7,"div",4),T(8,dre,2,0,"div",5)(9,yre,10,3),b(),y(10,"div",6)(11,"div",7),T(12,vre,4,6,"button",8),b(),y(13,"div",9),T(14,wre,4,6,"button",8),b(),y(15,"div",10),T(16,kre,3,4,"button",11),b()()()),s&2&&(m(3),re(mt(4,6,"status.readiness.title",st(11,mf))),m(2),me("aria-label",O(6,9,"form.button_close")),m(3),z(r.loading?8:9),m(4),z(r.isUpdating?12:-1),m(2),z(r.isUpdating?-1:14),m(2),z(r.isUpdating?16:-1))},dependencies:[bv,Pt],encapsulation:2})}return e})();var Hre=(e,i,t,s,r)=>({iconStar:e,iconThumbsUp:i,iconCoffee:t,iconHeart:s,link:r}),W2=(e,i,t,s)=>({"fa-arrow-alt-circle-down":e,"fa-code-compare":i,"fa-arrow-alt-circle-up":t,"fa-trash":s}),Sre=()=>["homebridge","homebridge-config-ui-x"],Cre=e=>({pluginName:e});function xre(e,i){e&1&&(y(0,"p",13),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"plugins.settings.restart_required")))}function Ire(e,i){e&1&&(y(0,"p",13),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"restart.child_bridges")))}function Pre(e,i){if(e&1&&(U(0,"p",12),R(1,"translate"),T(2,xre,3,3,"p",13),T(3,Ire,3,3,"p",13)),e&2){let t=S(3);N("innerHTML",mt(1,3,t.supportMessageKey,mv(6,Hre,t.iconStar,t.iconThumbsUp,t.iconCoffee,t.iconHeart,t.donationLink)),Me),m(2),z(t.childBridges.length===0?2:-1),m(),z(t.childBridges.length>0?3:-1)}}function Tre(e,i){if(e&1&&(y(0,"div",9),U(1,"i",10),b(),y(2,"h5",11),D(3),b(),T(4,Pre,4,12)),e&2){let t=S(2);m(3),Oc("",t.pastTenseVerb,": ",t.pluginDisplayName," (",t.targetVersionPretty,")"),m(),z(t.isDisabled?-1:4)}}function zre(e,i){if(e&1&&(y(0,"div",6),T(1,Tre,5,4),b()),e&2){let t=S();m(),z(t.justUpdatedPlugin?1:-1)}}function Are(e,i){if(e&1&&(y(0,"div",7)(1,"div",9),U(2,"i",14),b(),y(3,"ul",15)(4,"li"),D(5),R(6,"translate"),b(),y(7,"li"),D(8),R(9,"translate"),b()(),y(10,"pre",16),D(11),b()()),e&2){let t=S();m(2),N("ngClass",Uo(9,W2,t.action==="Install",t.action==="Update"&&t.installedVersion,t.action==="Update"&&!t.installedVersion,t.action==="Uninstall")),m(3),re(O(6,5,"plugins.manage.online_updates")),m(3),re(O(9,7,"plugins.manage.manual_update_command")),m(3),vr(`hb-service stop
|
|
98
|
+
`,l=!0)}}),(0,V2.saveAs)(new Blob([o],{type:"text/plain;charset=utf-8"}),`${this.plugin.name}.log.txt`),this.midAction=!1},error:s=>ge(this,null,function*(){let r;try{r=JSON.parse(yield s.error.text()).message}catch(o){console.error(o)}this.$toastr.error(r||this.$translate.instant("logs.download.error"),this.$translate.instant("toast.title_error")),this.midAction=!1})})}).catch(()=>{this.midAction=!1})}ngOnDestroy(){this.$log.destroyTerminal()}dismissModal(){this.$activeModal.dismiss("Dismiss")}getPluginLog(){this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe({next:t=>{this.pluginAlias=this.plugin.name==="homebridge-config-ui-x"?"Homebridge UI":t[0]?.name||this.plugin.name,this.$log.startTerminal(this.termTarget(),{allowProposedApi:!0,allowTransparency:!1,fontSize:13,fontWeight:400,lineHeight:1.25},this.resizeEvent,this.pluginAlias)},error:t=>{console.error(t),this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),this.$activeModal.dismiss()}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],viewQuery:function(s,r){s&1&&br(r.termTarget,lre,5),s&2&&yr()},hostBindings:function(s,r){s&1&&Q("resize",function(l){return r.onWindowResize(l)},dv)},inputs:{plugin:"plugin",childBridges:"childBridges"},decls:22,vars:21,consts:[["pluginlogoutput",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"modal-body","d-flex","flex-row","flex-grow-1","w-100","p-0"],[1,"w-100","bg-black","plugin-log-output","terminal","align-self-end","w-100","h-100","mb-0","p-2"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["container","modal","placement","top","triggers","hover",1,"btn","btn-primary",3,"click","ngbTooltip","openDelay","disabled"],[1,"fas","fa-download"],["container","modal","placement","top","triggers","hover",1,"btn","btn-danger","ms-3",3,"ngbTooltip","openDelay","disabled"],["container","modal","placement","top","triggers","hover",1,"btn","btn-danger","ms-3",3,"click","ngbTooltip","openDelay","disabled"],[1,"fas","fa-power-off"]],template:function(s,r){if(s&1){let o=ie();y(0,"div",1)(1,"div",2)(2,"h5",3),D(3),b(),y(4,"button",4),R(5,"translate"),Q("click",function(){return J(o),Z(r.dismissModal())}),b()(),y(6,"div",5),U(7,"div",6,0),b(),y(9,"div",7)(10,"div",8)(11,"button",9),R(12,"translate"),Q("click",function(){return J(o),Z(r.dismissModal())}),D(13),R(14,"translate"),b()(),U(15,"div",10),y(16,"div",11)(17,"button",12),R(18,"translate"),R(19,"translate"),Q("click",function(){return J(o),Z(r.downloadLogFile())}),U(20,"i",13),b(),T(21,cre,4,8,"button",14),b()()()}s&2&&(m(3),re(r.plugin.displayName||r.plugin.name),m(),N("disabled",r.midAction),me("aria-label",O(5,11,"form.button_close")),m(7),N("disabled",r.midAction),me("aria-label",O(12,13,"form.button_close")),m(2),oe(" ",O(14,15,"form.button_close")," "),m(4),N("ngbTooltip",O(18,17,"logs.title_download_log_file"))("openDelay",150)("disabled",r.midAction),me("aria-label",O(19,19,"logs.title_download_log_file")),m(4),z(r.childBridges.length?21:-1))},dependencies:[xr,Pt],encapsulation:2})}return e})();var L2=xt(Yc(),1);var mf=()=>({app:"Homebridge v2"});function dre(e,i){e&1&&(y(0,"div",5),U(1,"i",12),b())}function ure(e,i){e&1&&(y(0,"p",9),D(1,"All your plugins are marked as compatible with Homebridge v2."),b())}function gre(e,i){e&1&&(y(0,"p",9),D(1,"To ignore this warning and continue with the update, click continue below."),b())}function pre(e,i){if(e&1&&(y(0,"p",9),D(1," Some of your plugins are not explicitly marked as compatible with Homebridge v2. This does "),y(2,"span",17),D(3,"not"),b(),D(4," necessarily mean that they won't work. We just can't guarantee that they will. "),b(),y(5,"p",9),D(6," For more information about this update, please see the "),y(7,"a",18),D(8,"wiki page"),b(),D(9,". "),b(),T(10,gre,2,0,"p",9)),e&2){let t=S(2);m(10),z(t.isUpdating?10:-1)}}function mre(e,i){e&1&&(y(0,"div",19),D(1," Node.js Version"),U(2,"br"),y(3,"span",20),D(4),R(5,"translate"),b()(),y(6,"div",21),U(7,"i",22),b()),e&2&&(m(4),re(mt(5,1,"status.readiness.node_yes",st(4,mf))))}function _re(e,i){e&1&&(y(0,"div",19),D(1," Node.js Version"),U(2,"br"),y(3,"span",20),D(4),R(5,"translate"),b(),U(6,"br"),y(7,"a",23),D(8),R(9,"translate"),U(10,"i",24),b()(),y(11,"div",21),U(12,"i",25),b()),e&2&&(m(4),re(mt(5,2,"status.readiness.node_no",st(7,mf))),m(4),oe(" ",O(9,5,"plugins.compat.node_link")," "))}function hre(e,i){e&1&&U(0,"i",26)}function fre(e,i){e&1&&U(0,"i",27)}function bre(e,i){if(e&1&&(y(0,"li",16)(1,"div",19),D(2),b(),y(3,"div",21),T(4,hre,1,0,"i",26),T(5,fre,1,0,"i",27),b()()),e&2){let t=i.$implicit;m(2),re(t.displayName),m(2),z(t.hb2Ready==="supported"?4:-1),m(),z(t.hb2Ready==="unknown"?5:-1)}}function yre(e,i){if(e&1&&(y(0,"div",13),U(1,"img",14),b(),T(2,ure,2,0,"p",9),T(3,pre,11,1),y(4,"ul",15)(5,"li",16),T(6,mre,8,5)(7,_re,13,8),b(),Ze(8,bre,6,3,"li",16,Je),b()),e&2){let t=S();m(2),z(t.allPluginsSupported?2:-1),m(),z(t.allPluginsSupported?-1:3),m(3),z(t.nodeReady?6:7),m(2),Qe(t.installedPlugins)}}function vre(e,i){if(e&1){let t=ie();y(0,"button",28),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.closeModal("Dismiss"))}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function wre(e,i){if(e&1){let t=ie();y(0,"button",28),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.closeModal("Dismiss"))}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function kre(e,i){if(e&1){let t=ie();y(0,"button",29),Q("click",function(){J(t);let r=S();return Z(r.closeModal("update"))}),D(1),R(2,"translate"),b()}if(e&2){let t=S();N("disabled",t.loading),m(),oe(" ",O(2,2,"form.button_continue")," ")}}var $2=(()=>{class e{$activeModal=j(It);$api=j(Xe);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);$ws=j(Pr);io;isUpdating=!1;skipIfCompatible=!0;loading=!0;installedPlugins=[];allPluginsSupported=!0;nodeReady=!1;ngOnInit(){return ge(this,null,function*(){this.io=this.$ws.getExistingNamespace("status"),this.io.socket.connected&&(yield this.checkHomebridgeUiVersion()),yield this.loadInstalledPlugins(),this.loading=!1})}checkHomebridgeUiVersion(){return ge(this,null,function*(){try{let{nodeVersion:t}=yield Ae(this.io.request("get-homebridge-server-info"));this.nodeReady=(0,L2.satisfies)(t,">=20")}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}loadInstalledPlugins(){return ge(this,null,function*(){this.installedPlugins=[],this.loading=!0;let t=this.$settings.env.homebridgeVersion.split(".")[0];try{let s=yield Ae(this.$api.get("/plugins"));this.installedPlugins=s.filter(r=>r.name!=="homebridge-config-ui-x").map(r=>{let o=r.engines?.homebridge?.split("||").map(c=>c.trim())||[],l=t==="2"?"hide":o.some(c=>c.startsWith("^2")||c.startsWith(">=2"))?"supported":"unknown";return l==="unknown"&&(this.allPluginsSupported=!1),Fe(pe({},r),{hb2Ready:l})}).sort((r,o)=>r.name.localeCompare(o.name)),this.skipIfCompatible&&this.installedPlugins.length===0&&this.$activeModal.close("update")}catch(s){console.error(s),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugins"),this.$translate.instant("toast.title_error"))}})}closeModal(t){this.$activeModal.close(t)}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{isUpdating:"isUpdating",skipIfCompatible:"skipIfCompatible"},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"],[1,"modal-body"],[1,"text-center","primary-text","my-5","w-100"],[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,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],["ngSrc","assets/hb-icon.png","alt","","height","100","width","100",1,"plugin-icon-card"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"fw-bold"],["href","https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0","target","_blank"],[1,"text-start","flex-grow-1"],[1,"grey-text"],[1,"ms-3"],[1,"fas","fa-check-circle","green-text","fa-xl"],["href","https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js","target","_blank","rel","noopener noreferrer",1,"small"],[1,"fa","fa-external-link-alt"],[1,"fas","fa-exclamation-circle","orange-text","fa-xl"],["aria-label","The developer has specifically marked this plugin as compatible with Homebridge v2.",1,"fas","fa-check-circle","green-text","fa-xl"],["aria-label","The developer has not specifically marked this plugin as compatible with Homebridge v2, but it may still work.",1,"fas","fa-question-circle","orange-text","fa-xl"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),R(4,"translate"),b(),y(5,"button",3),R(6,"translate"),Q("click",function(){return r.closeModal("Dismiss")}),b()(),y(7,"div",4),T(8,dre,2,0,"div",5)(9,yre,10,3),b(),y(10,"div",6)(11,"div",7),T(12,vre,4,6,"button",8),b(),y(13,"div",9),T(14,wre,4,6,"button",8),b(),y(15,"div",10),T(16,kre,3,4,"button",11),b()()()),s&2&&(m(3),re(mt(4,6,"status.readiness.title",st(11,mf))),m(2),me("aria-label",O(6,9,"form.button_close")),m(3),z(r.loading?8:9),m(4),z(r.isUpdating?12:-1),m(2),z(r.isUpdating?-1:14),m(2),z(r.isUpdating?16:-1))},dependencies:[bv,Pt],encapsulation:2})}return e})();var Hre=(e,i,t,s,r)=>({iconStar:e,iconThumbsUp:i,iconCoffee:t,iconHeart:s,link:r}),W2=(e,i,t,s)=>({"fa-arrow-alt-circle-down":e,"fa-code-compare":i,"fa-arrow-alt-circle-up":t,"fa-trash":s}),Sre=()=>["homebridge","homebridge-config-ui-x"],Cre=e=>({pluginName:e});function xre(e,i){e&1&&(y(0,"p",13),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"plugins.settings.restart_required")))}function Ire(e,i){e&1&&(y(0,"p",13),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"restart.child_bridges")))}function Pre(e,i){if(e&1&&(U(0,"p",12),R(1,"translate"),T(2,xre,3,3,"p",13),T(3,Ire,3,3,"p",13)),e&2){let t=S(3);N("innerHTML",mt(1,3,t.supportMessageKey,mv(6,Hre,t.iconStar,t.iconThumbsUp,t.iconCoffee,t.iconHeart,t.donationLink)),Me),m(2),z(t.childBridges.length===0?2:-1),m(),z(t.childBridges.length>0?3:-1)}}function Tre(e,i){if(e&1&&(y(0,"div",9),U(1,"i",10),b(),y(2,"h5",11),D(3),b(),T(4,Pre,4,12)),e&2){let t=S(2);m(3),Oc("",t.pastTenseVerb,": ",t.pluginDisplayName," (",t.targetVersionPretty,")"),m(),z(t.isDisabled?-1:4)}}function zre(e,i){if(e&1&&(y(0,"div",6),T(1,Tre,5,4),b()),e&2){let t=S();m(),z(t.justUpdatedPlugin?1:-1)}}function Are(e,i){if(e&1&&(y(0,"div",7)(1,"div",9),U(2,"i",14),b(),y(3,"ul",15)(4,"li"),D(5),R(6,"translate"),b(),y(7,"li"),D(8),R(9,"translate"),b()(),y(10,"pre",16),D(11),b()()),e&2){let t=S();m(2),N("ngClass",Uo(9,W2,t.action==="Install",t.action==="Update"&&t.installedVersion,t.action==="Update"&&!t.installedVersion,t.action==="Uninstall")),m(3),re(O(6,5,"plugins.manage.online_updates")),m(3),re(O(9,7,"plugins.manage.manual_update_command")),m(3),vr(`hb-service stop
|
|
99
99
|
npm install -g `,t.pluginName,"@",t.targetVersion,`
|
|
100
|
-
hb-service start`)}}function jre(e,i){if(e&1&&(y(0,"span"),D(1),b()),e&2){let t=S(3);m(),oe("v",t.installedVersion," \u2192 ")}}function Dre(e,i){if(e&1&&(y(0,"h5",18),T(1,jre,2,1,"span"),D(2),b()),e&2){let t=S(2);m(),z(t.installedVersion?1:-1),m(),oe(" ",t.targetVersionPretty," ")}}function Nre(e,i){e&1&&(y(0,"div",26),U(1,"i",27),b())}function Rre(e,i){if(e&1&&U(0,"markdown",28),e&2){let t=S(4);N("data",t.versionNotes)}}function Ere(e,i){e&1&&(y(0,"div",29),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"plugins.manage.notes_none")))}function Bre(e,i){if(e&1&&(y(0,"div",29),D(1),R(2,"translate"),U(3,"br"),D(4),R(5,"translate"),U(6,"br"),D(7),R(8,"translate"),U(9,"br"),b()),e&2){let t=S(6);m(),oe(" ",mt(2,3,"plugins.manage.notes_beta_1",li(10,Cre,t.pluginDisplayName))),m(3),oe(" ",O(5,6,"plugins.manage.notes_beta_2")),m(3),oe(" ",O(8,8,"plugins.manage.notes_beta_3"))}}function Mre(e,i){e&1&&(y(0,"div",29),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"plugins.manage.notes_latest")))}function Ure(e,i){if(e&1&&T(0,Bre,10,12,"div",29)(1,Mre,3,3,"div",29),e&2){let t=S(5);z(t.targetVersion.includes("beta")||t.targetVersion.includes("alpha")||t.targetVersion.includes("next")?0:1)}}function Fre(e,i){if(e&1&&T(0,Ere,3,3,"div",29)(1,Ure,2,1),e&2){let t=S(4);z(t.versionNotesShow?0:1)}}function Ore(e,i){if(e&1&&T(0,Rre,1,1,"markdown",28)(1,Fre,2,1),e&2){let t=S(3);z(t.versionNotes?0:1)}}function Vre(e,i){if(e&1&&(y(0,"div",25),T(1,Nre,2,0,"div",26)(2,Ore,2,1),b()),e&2){let t=S(2);m(),z(t.action==="Update"&&!t.versionNotesLoaded?1:2)}}function qre(e,i){e&1&&(y(0,"div",26),U(1,"i",27),b())}function Lre(e,i){if(e&1&&U(0,"markdown",28),e&2){let t=S(4);N("data",t.fullChangelog)}}function $re(e,i){e&1&&(U(0,"div",31),R(1,"translate")),e&2&&N("innerHTML",O(1,1,"plugins.manage.changelog_none"),Me)}function Kre(e,i){if(e&1&&T(0,Lre,1,1,"markdown",28)(1,$re,2,3,"div",31),e&2){let t=S(3);z(t.fullChangelog?0:1)}}function Gre(e,i){if(e&1&&(y(0,"div",30),T(1,qre,2,0,"div",26)(2,Kre,2,1),b()),e&2){let t=S(2);m(),z(t.action==="Update"&&!t.fullChangelogLoaded?1:2)}}function Wre(e,i){e&1&&(y(0,"span",34),U(1,"i",37),b())}function Yre(e,i){if(e&1){let t=ie();y(0,"a",38),Q("click",function(){J(t);let r=S(3);return Z(r.downloadBackupFile())}),U(1,"i",39),b()}}function Jre(e,i){if(e&1&&(y(0,"div",24)(1,"p",32)(2,"span",33),D(3),R(4,"translate"),b(),T(5,Wre,2,0,"span",34)(6,Yre,2,0,"a",35),b(),y(7,"p",36),D(8),R(9,"translate"),b()()),e&2){let t=S(2);m(3),re(O(4,3,"plugins.manage.backup")),m(2),z(t.downloadingBackup?5:6),m(3),re(O(9,5,"plugins.manage.hb_restart"))}}function Zre(e,i){if(e&1){let t=ie();y(0,"div",6)(1,"div",9),U(2,"i",17),b(),T(3,Dre,3,2,"h5",18),y(4,"ul",19,0),ct("activeIdChange",function(r){J(t);let o=S();return lt(o.releaseNotesTab,r)||(o.releaseNotesTab=r),Z(r)}),y(6,"li",20)(7,"button",21),D(8),R(9,"translate"),b(),cp(10,Vre,3,1,"ng-template",22),b(),y(11,"li",20)(12,"button",21),D(13),R(14,"translate"),b(),cp(15,Gre,3,1,"ng-template",22),b()(),U(16,"div",23),T(17,Jre,10,7,"div",24),b()}if(e&2){let t=Fc(5),s=S();m(2),N("ngClass",Uo(13,W2,s.action==="Install"&&!s.installedVersion,s.action==="Install"&&s.installedVersion,s.action==="Update",s.action==="Uninstall")),m(),z(s.latestVersion?3:-1),m(),at("activeId",s.releaseNotesTab),m(2),N("ngbNavItem",1),m(2),re(O(9,9,"plugins.manage.notes")),m(3),N("ngbNavItem",2),m(2),re(O(14,11,"plugins.manage.changelog")),m(3),N("ngbNavOutlet",t),m(),z(st(18,Sre).includes(s.pluginName)?17:-1)}}function Qre(e,i){if(e&1){let t=ie();y(0,"button",46),R(1,"translate"),Q("click",function(){J(t);let r=S(2);return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function Xre(e,i){if(e&1){let t=ie();y(0,"button",46),R(1,"translate"),Q("click",function(){J(t);let r=S(2);return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function eoe(e,i){if(e&1){let t=ie();y(0,"button",47),Q("click",function(){J(t);let r=S(2);return Z(r.update())}),D(1),R(2,"translate"),b()}e&2&&(m(),re(O(2,1,"form.button_continue")))}function toe(e,i){if(e&1){let t=ie();y(0,"button",47),Q("click",function(){J(t);let r=S(2);return Z(r.childBridges.length>0?r.onRestartChildBridgeClick():r.onRestartHomebridgeClick())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"menu.tooltip_restart")," "))}function ioe(e,i){if(e&1){let t=ie();y(0,"button",48),Q("click",function(){J(t);let r=S(2);return Z(r.downloadLogFile())}),D(1),R(2,"translate"),b()}e&2&&(m(),re(O(2,1,"form.button_download")))}function soe(e,i){if(e&1&&(y(0,"div",8)(1,"div",40),T(2,Qre,4,6,"button",41),b(),y(3,"div",42),T(4,Xre,4,6,"button",41),b(),y(5,"div",43),T(6,eoe,3,3,"button",44),T(7,toe,3,3,"button",44),T(8,ioe,3,3,"button",45),b()()),e&2){let t=S();m(2),z(!t.justUpdatedPlugin&&t.onlineUpdateOk||t.justUpdatedPlugin&&(!t.isDisabled||t.actionFailed)?2:-1),m(2),z(t.justUpdatedPlugin&&t.isDisabled&&!t.actionFailed||!t.onlineUpdateOk?4:-1),m(2),z(t.onlineUpdateOk&&t.releaseNotesShow?6:-1),m(),z(t.justUpdatedPlugin&&!t.isDisabled?7:-1),m(),z(t.actionFailed?8:-1)}}var jn=(()=>{class e{$activeModal=j(It);$api=j(Xe);$backup=j($v);$modal=j(vi);$router=j(Is);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);$ws=j(Pr);io;toastSuccess;term
|
|
100
|
+
hb-service start`)}}function jre(e,i){if(e&1&&(y(0,"span"),D(1),b()),e&2){let t=S(3);m(),oe("v",t.installedVersion," \u2192 ")}}function Dre(e,i){if(e&1&&(y(0,"h5",18),T(1,jre,2,1,"span"),D(2),b()),e&2){let t=S(2);m(),z(t.installedVersion?1:-1),m(),oe(" ",t.targetVersionPretty," ")}}function Nre(e,i){e&1&&(y(0,"div",26),U(1,"i",27),b())}function Rre(e,i){if(e&1&&U(0,"markdown",28),e&2){let t=S(4);N("data",t.versionNotes)}}function Ere(e,i){e&1&&(y(0,"div",29),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"plugins.manage.notes_none")))}function Bre(e,i){if(e&1&&(y(0,"div",29),D(1),R(2,"translate"),U(3,"br"),D(4),R(5,"translate"),U(6,"br"),D(7),R(8,"translate"),U(9,"br"),b()),e&2){let t=S(6);m(),oe(" ",mt(2,3,"plugins.manage.notes_beta_1",li(10,Cre,t.pluginDisplayName))),m(3),oe(" ",O(5,6,"plugins.manage.notes_beta_2")),m(3),oe(" ",O(8,8,"plugins.manage.notes_beta_3"))}}function Mre(e,i){e&1&&(y(0,"div",29),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"plugins.manage.notes_latest")))}function Ure(e,i){if(e&1&&T(0,Bre,10,12,"div",29)(1,Mre,3,3,"div",29),e&2){let t=S(5);z(t.targetVersion.includes("beta")||t.targetVersion.includes("alpha")||t.targetVersion.includes("next")?0:1)}}function Fre(e,i){if(e&1&&T(0,Ere,3,3,"div",29)(1,Ure,2,1),e&2){let t=S(4);z(t.versionNotesShow?0:1)}}function Ore(e,i){if(e&1&&T(0,Rre,1,1,"markdown",28)(1,Fre,2,1),e&2){let t=S(3);z(t.versionNotes?0:1)}}function Vre(e,i){if(e&1&&(y(0,"div",25),T(1,Nre,2,0,"div",26)(2,Ore,2,1),b()),e&2){let t=S(2);m(),z(t.action==="Update"&&!t.versionNotesLoaded?1:2)}}function qre(e,i){e&1&&(y(0,"div",26),U(1,"i",27),b())}function Lre(e,i){if(e&1&&U(0,"markdown",28),e&2){let t=S(4);N("data",t.fullChangelog)}}function $re(e,i){e&1&&(U(0,"div",31),R(1,"translate")),e&2&&N("innerHTML",O(1,1,"plugins.manage.changelog_none"),Me)}function Kre(e,i){if(e&1&&T(0,Lre,1,1,"markdown",28)(1,$re,2,3,"div",31),e&2){let t=S(3);z(t.fullChangelog?0:1)}}function Gre(e,i){if(e&1&&(y(0,"div",30),T(1,qre,2,0,"div",26)(2,Kre,2,1),b()),e&2){let t=S(2);m(),z(t.action==="Update"&&!t.fullChangelogLoaded?1:2)}}function Wre(e,i){e&1&&(y(0,"span",34),U(1,"i",37),b())}function Yre(e,i){if(e&1){let t=ie();y(0,"a",38),Q("click",function(){J(t);let r=S(3);return Z(r.downloadBackupFile())}),U(1,"i",39),b()}}function Jre(e,i){if(e&1&&(y(0,"div",24)(1,"p",32)(2,"span",33),D(3),R(4,"translate"),b(),T(5,Wre,2,0,"span",34)(6,Yre,2,0,"a",35),b(),y(7,"p",36),D(8),R(9,"translate"),b()()),e&2){let t=S(2);m(3),re(O(4,3,"plugins.manage.backup")),m(2),z(t.downloadingBackup?5:6),m(3),re(O(9,5,"plugins.manage.hb_restart"))}}function Zre(e,i){if(e&1){let t=ie();y(0,"div",6)(1,"div",9),U(2,"i",17),b(),T(3,Dre,3,2,"h5",18),y(4,"ul",19,0),ct("activeIdChange",function(r){J(t);let o=S();return lt(o.releaseNotesTab,r)||(o.releaseNotesTab=r),Z(r)}),y(6,"li",20)(7,"button",21),D(8),R(9,"translate"),b(),cp(10,Vre,3,1,"ng-template",22),b(),y(11,"li",20)(12,"button",21),D(13),R(14,"translate"),b(),cp(15,Gre,3,1,"ng-template",22),b()(),U(16,"div",23),T(17,Jre,10,7,"div",24),b()}if(e&2){let t=Fc(5),s=S();m(2),N("ngClass",Uo(13,W2,s.action==="Install"&&!s.installedVersion,s.action==="Install"&&s.installedVersion,s.action==="Update",s.action==="Uninstall")),m(),z(s.latestVersion?3:-1),m(),at("activeId",s.releaseNotesTab),m(2),N("ngbNavItem",1),m(2),re(O(9,9,"plugins.manage.notes")),m(3),N("ngbNavItem",2),m(2),re(O(14,11,"plugins.manage.changelog")),m(3),N("ngbNavOutlet",t),m(),z(st(18,Sre).includes(s.pluginName)?17:-1)}}function Qre(e,i){if(e&1){let t=ie();y(0,"button",46),R(1,"translate"),Q("click",function(){J(t);let r=S(2);return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function Xre(e,i){if(e&1){let t=ie();y(0,"button",46),R(1,"translate"),Q("click",function(){J(t);let r=S(2);return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}e&2&&(me("aria-label",O(1,2,"form.button_close")),m(2),oe(" ",O(3,4,"form.button_close")," "))}function eoe(e,i){if(e&1){let t=ie();y(0,"button",47),Q("click",function(){J(t);let r=S(2);return Z(r.update())}),D(1),R(2,"translate"),b()}e&2&&(m(),re(O(2,1,"form.button_continue")))}function toe(e,i){if(e&1){let t=ie();y(0,"button",47),Q("click",function(){J(t);let r=S(2);return Z(r.childBridges.length>0?r.onRestartChildBridgeClick():r.onRestartHomebridgeClick())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"menu.tooltip_restart")," "))}function ioe(e,i){if(e&1){let t=ie();y(0,"button",48),Q("click",function(){J(t);let r=S(2);return Z(r.downloadLogFile())}),D(1),R(2,"translate"),b()}e&2&&(m(),re(O(2,1,"form.button_download")))}function soe(e,i){if(e&1&&(y(0,"div",8)(1,"div",40),T(2,Qre,4,6,"button",41),b(),y(3,"div",42),T(4,Xre,4,6,"button",41),b(),y(5,"div",43),T(6,eoe,3,3,"button",44),T(7,toe,3,3,"button",44),T(8,ioe,3,3,"button",45),b()()),e&2){let t=S();m(2),z(!t.justUpdatedPlugin&&t.onlineUpdateOk||t.justUpdatedPlugin&&(!t.isDisabled||t.actionFailed)?2:-1),m(2),z(t.justUpdatedPlugin&&t.isDisabled&&!t.actionFailed||!t.onlineUpdateOk?4:-1),m(2),z(t.onlineUpdateOk&&t.releaseNotesShow?6:-1),m(),z(t.justUpdatedPlugin&&!t.isDisabled?7:-1),m(),z(t.actionFailed?8:-1)}}var jn=(()=>{class e{$activeModal=j(It);$api=j(Xe);$backup=j($v);$modal=j(vi);$router=j(Is);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);$ws=j(Pr);io;toastSuccess;term;termTarget;fitAddon=new Jc;webLinksAddon=new Zc;errorLog="";pluginName;pluginDisplayName;targetVersion;latestVersion;installedVersion;isDisabled;action;onRefreshPluginList;verifiedPlugin;verifiedPlusPlugin;funding;targetVersionPretty="";actionComplete=!1;actionFailed=!1;justUpdatedPlugin=!1;updateToBeta=!1;childBridges=[];presentTenseVerb;pastTenseVerb;onlineUpdateOk;iconStar='<i class="fas fa-star orange-text"></i>';iconThumbsUp='<i class="fas fa-thumbs-up orange-text"></i>';iconCoffee='<i class="fas fa-coffee pink-text"></i>';iconHeart='<i class="fas fa-heart pink-text"></i>';supportMessageKey;donationLink;versionNotes;versionNotesLoaded=!1;versionNotesShow=!1;fullChangelog;fullChangelogLoaded=!1;releaseNotesShow=!1;releaseNotesTab=1;downloadingBackup=!1;constructor(){this.term=new Qc({theme:{background:"#00000000"},allowProposedApi:!0,allowTransparency:!1,fontSize:13,fontWeight:400,lineHeight:1.25}),this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}ngOnInit(){switch(this.targetVersionPretty=this.targetVersion==="latest"?`v${this.latestVersion}`:/^\d/.test(this.targetVersion)?`v${this.targetVersion}`:this.targetVersion,this.io=this.$ws.connectToNamespace("plugins"),this.termTarget=document.getElementById("plugin-log-output"),this.term.open(this.termTarget),this.fitAddon.fit(),this.io.socket.on("stdout",t=>{this.term.write(t);let s=t.toString().replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"").trimEnd();s&&(this.errorLog+=`${s}\r
|
|
101
101
|
`)}),this.toastSuccess=this.$translate.instant("toast.title_success"),this.onlineUpdateOk=!(["homebridge","homebridge-config-ui-x"].includes(this.pluginName)&&this.$settings.env.platform==="win32"),this.action){case"Install":this.install(),this.presentTenseVerb=this.$translate.instant("plugins.manage.install"),this.pastTenseVerb=this.$translate.instant("plugins.manage.installed");break;case"Uninstall":this.uninstall(),this.presentTenseVerb=this.$translate.instant("plugins.manage.uninstall"),this.pastTenseVerb=this.$translate.instant("plugins.manage.uninstalled");break;case"Update":switch(this.targetVersion){case"latest":this.updateToBeta=!1;break;case"alpha":case"beta":case"test":this.updateToBeta=!0;break}this.presentTenseVerb=this.$translate.instant("plugins.manage.update"),this.pastTenseVerb=this.$translate.instant("plugins.manage.updated"),this.getVersionNotes();break}this.determineSupportMessage()}determineSupportMessage(){if(this.supportMessageKey="plugins.manage.support_github",this.donationLink="",!["homebridge","homebridge-config-ui-x"].includes(this.pluginName)&&(this.verifiedPlugin||this.verifiedPlusPlugin)&&this.funding&&Math.random()<.5){let t=null;if(typeof this.funding=="string")t=this.funding;else if(Array.isArray(this.funding)){let s=this.funding.map(r=>typeof r=="string"?r:r?.url).filter(Boolean);t=s.length>0?s[Math.floor(Math.random()*s.length)]:null}else this.funding?.url&&(t=this.funding.url);if(t){let s=/ko-?fi/i.test(t);this.supportMessageKey=s?"plugins.manage.support_kofi":"plugins.manage.support_donate",this.donationLink=`<a href="${t}" target="_blank" rel="noopener noreferrer"><i class="fas fa-external-link-alt primary-text"></i></a>`}}}update(){if(this.releaseNotesShow=!1,this.versionNotes="",this.fullChangelog="",!!this.onlineUpdateOk){if(this.pluginName==="homebridge")return this.upgradeHomebridge();this.io.request("update",{name:this.pluginName,version:this.targetVersion,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>ge(this,null,function*(){if(this.pluginName==="homebridge-config-ui-x"){this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{window.location.href="/restart"},error:t=>{console.error(t),window.location.href="/restart"}});return}try{yield this.getChildBridges()}catch(t){console.error(t)}this.actionComplete=!0,this.justUpdatedPlugin=!0,this.$router.navigate(["/plugins"])}),error:t=>{this.actionFailed=!0,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}}onRestartHomebridgeClick(){this.$router.navigate(["/restart"]),this.$activeModal.close()}onRestartChildBridgeClick(){return ge(this,null,function*(){try{for(let s of this.childBridges)yield Ae(this.$api.put(`/server/restart/${s.username}`,{}));let t=this.$modal.open(q2,{size:"xl",backdrop:"static"});t.componentInstance.plugin={name:this.pluginName,displayName:this.pluginDisplayName},t.componentInstance.childBridges=this.childBridges}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("plugins.manage.child_bridge_restart_failed"),this.$translate.instant("toast.title_error"))}finally{this.$activeModal.close()}})}downloadLogFile(){let t=new Blob([this.errorLog],{type:"text/plain;charset=utf-8"});(0,G2.saveAs)(t,`${this.pluginName}-error.log`)}downloadBackupFile(){return ge(this,null,function*(){this.downloadingBackup=!0;try{yield this.$backup.downloadBackup()}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}finally{this.downloadingBackup=!1}})}ngOnDestroy(){this.io.end()}dismissModal(){this.$activeModal.dismiss("Dismiss")}install(){if(this.onlineUpdateOk){if(this.pluginName==="homebridge")return this.upgradeHomebridge();this.io.request("install",{name:this.pluginName,version:this.targetVersion,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>ge(this,null,function*(){this.$toastr.success(`${this.pastTenseVerb} ${this.pluginName}`,this.toastSuccess),this.onRefreshPluginList&&this.onRefreshPluginList();try{let s=(yield Ae(this.$api.get("/plugins"))).find(r=>r.name===this.pluginName);this.$activeModal.close({action:"just-installed",plugin:s})}catch(t){console.error("Failed to fetch updated plugin data:",t),this.$activeModal.close({action:"just-installed",pluginName:this.pluginName})}}),error:t=>{this.actionFailed=!0,console.error(t),this.$router.navigate(["/plugins"]),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}}uninstall(){this.io.request("uninstall",{name:this.pluginName,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.$activeModal.close(),this.$router.navigate(["/plugins"]),this.$modal.open(Ys,{size:"lg",backdrop:"static"})},error:t=>{this.actionFailed=!0,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}upgradeHomebridge(){return ge(this,null,function*(){let t="update";if(Number(this.installedVersion.split(".")[0])<2&&["2","alpha","beta"].includes(this.targetVersion.split(".")[0])){let s=this.$modal.open($2,{size:"lg",backdrop:"static"});s.componentInstance.isUpdating=!0,t=yield s.result}t==="update"?this.io.request("homebridge-update",{version:this.targetVersion,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.$activeModal.close(),this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$router.navigate(["/restart"])},error:s=>{console.error(s),this.$router.navigate(["/restart"])}})},error:s=>{this.actionFailed=!0,console.error(s),this.$toastr.error(s.message,this.$translate.instant("toast.title_error")),this.$activeModal.close()}}):this.$activeModal.close()})}getVersionNotes(){return ge(this,null,function*(){this.releaseNotesShow=!0;try{let t=yield Ae(this.$api.get(`/plugins/release/${encodeURIComponent(this.pluginName)}`));this.fullChangelog=t.changelog,t.latestVersion&&(this.latestVersion=t.latestVersion),this.targetVersion==="latest"||this.targetVersion===this.latestVersion?(this.versionNotesShow=!0,t.notes&&(this.versionNotes=t.notes)):(this.versionNotesShow=!1,this.versionNotesLoaded=!0)}catch(t){console.error("Error loading release notes:",t)}this.fullChangelogLoaded=!0,this.versionNotesLoaded=!0})}getChildBridges(){return ge(this,null,function*(){(yield Ae(this.$api.get("/status/homebridge/child-bridges"))).forEach(s=>{this.pluginName===s.plugin&&this.childBridges.push(s)})})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{pluginName:"pluginName",pluginDisplayName:"pluginDisplayName",targetVersion:"targetVersion",latestVersion:"latestVersion",installedVersion:"installedVersion",isDisabled:"isDisabled",action:"action",onRefreshPluginList:"onRefreshPluginList",verifiedPlugin:"verifiedPlugin",verifiedPlusPlugin:"verifiedPlusPlugin",funding:"funding"},decls:11,vars:9,consts:[["nav","ngbNav"],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],["id","plugin-log-output",1,"modal-body",3,"hidden"],[1,"modal-body","plugin-modal-body"],[1,"modal-body"],[1,"modal-footer","justify-content-between"],[1,"mb-3","text-center"],[1,"far","fa-check-circle","primary-text",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"mb-3","text-center","grey-text",3,"innerHTML"],[1,"text-center","mb-0"],[1,"fas","primary-text",2,"font-size","75px",3,"ngClass"],[1,"mb-3"],[1,"p-2","mb-0"],[1,"far","primary-text",2,"font-size","75px",3,"ngClass"],[1,"mb-4","text-center"],["ngbNav","",1,"nav-tabs","px-0",3,"activeIdChange","activeId"],[1,"w-50","m-0",3,"ngbNavItem"],["ngbNavLink","",1,"w-100","release-tab"],["ngbNavContent",""],[1,"mt-2",3,"ngbNavOutlet"],[1,"mt-4","mb-0"],[1,"alert","release-notes","p-3","pb-1","my-0"],[1,"w-100","text-center","primary-text","mt-3","mb-4"],[1,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],[1,"plugin-md",3,"data"],[1,"w-100","text-center","grey-text","mt-3","mb-4"],[1,"alert","release-notes","p-3","pb-1","my-0",2,"border-top-left-radius","0","border-top-right-radius","0"],[1,"w-100","text-center","grey-text","mt-3","mb-4",3,"innerHTML"],[1,"w-100","text-center","mb-1","small"],[1,"grey-text"],[1,"mx-1"],["href","javascript:void(0)"],[1,"w-100","text-center","mb-0","small","grey-text"],[1,"fa","fa-circle-notch","fa-spin"],["href","javascript:void(0)",3,"click"],[1,"fa","fa-download","mx-1"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-center"],[1,"text-end"],["type","button",1,"btn","btn-primary"],[1,"btn","btn-primary"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button",1,"btn","btn-primary",3,"click"],[1,"btn","btn-primary",3,"click"]],template:function(s,r){s&1&&(y(0,"div",1)(1,"div",2)(2,"h5",3),D(3),b(),y(4,"button",4),R(5,"translate"),Q("click",function(){return r.dismissModal()}),b()(),U(6,"div",5),T(7,zre,2,1,"div",6),T(8,Are,12,14,"div",7),T(9,Zre,18,19,"div",6),T(10,soe,9,5,"div",8),b()),s&2&&(m(3),re(r.pluginDisplayName),m(),me("aria-label",O(5,7,"form.button_close")),m(2),N("hidden",!r.onlineUpdateOk||r.actionComplete||r.releaseNotesShow),m(),z(r.actionComplete?7:-1),m(),z(r.onlineUpdateOk?-1:8),m(),z(r.releaseNotesShow&&!r.actionComplete&&r.onlineUpdateOk?9:-1),m(),z(!r.onlineUpdateOk||r.actionComplete||r.releaseNotesShow||r.actionFailed?10:-1))},dependencies:[qo,Vo,Lo,yi,Ev,Nv,Dv,jv,Rv,Pt],styles:[".plugin-modal-body[_ngcontent-%COMP%] .release-notes[_ngcontent-%COMP%]{box-shadow:none;max-height:39vh;overflow:auto;border:0;border-top-left-radius:0;border-top-right-radius:0}.plugin-modal-body[_ngcontent-%COMP%] .release-tab[_ngcontent-%COMP%]{font-size:1rem;color:#d3d3d3}.plugin-modal-body[_ngcontent-%COMP%] .tab-content[_ngcontent-%COMP%]{border-radius:0 0 20px 20px} .nav-tabs{--bs-nav-tabs-border-width: 0} .plugin-md{text-align:left;font-size:.85rem;word-wrap:break-word} .plugin-md img{max-width:100%} .plugin-md h1{font-size:1.3rem;font-weight:300} .plugin-md h2{font-size:1.2rem;font-weight:300} .plugin-md h3{font-size:1.1rem;font-weight:300} .plugin-md h4{font-size:1rem;font-weight:300} .plugin-md h5{font-size:.9rem;font-weight:300} .plugin-md pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px}"]})}return e})();var Y2=xt(Yc(),1);var roe=()=>["homebridge","homebridge-config-ui-x"];function ooe(e,i){e&1&&(y(0,"div",5),U(1,"i",12),b())}function noe(e,i){if(e&1&&(U(0,"i",20),y(1,"h6",21),D(2),R(3,"translate"),b(),y(4,"p",21),D(5),R(6,"translate"),y(7,"span",22),D(8),b()()),e&2){let t=S(2);m(2),re(O(3,3,"plugins.manage.select_version")),m(3),oe(" ",O(6,5,"plugins.status_installed"),": "),m(3),oe("v",t.plugin.installedVersion)}}function aoe(e,i){e&1&&(U(0,"i",23),y(1,"h6",21),D(2),R(3,"translate"),b()),e&2&&(m(2),re(O(3,1,"plugins.manage.select_version")))}function loe(e,i){e&1&&U(0,"i",26)}function coe(e,i){e&1&&U(0,"i",27)}function doe(e,i){if(e&1){let t=ie();y(0,"li",14)(1,"span",8),D(2),U(3,"br"),y(4,"small",24),D(5),b()(),y(6,"button",25),Q("click",function(){let r=J(t).$implicit,o=S(2);return Z(o.doInstall(r.version))}),T(7,loe,1,0,"i",26)(8,coe,1,0,"i",27),b()()}if(e&2){let t=i.$implicit,s=S(2);m(2),oe(" ",t.tag," "),m(3),oe("v",t.version),m(2),z(s.plugin.installedVersion===t.version?7:8)}}function uoe(e,i){e&1&&D(0," \u2713 ")}function goe(e,i){if(e&1&&(y(0,"option",17),D(1),T(2,uoe,1,0),b()),e&2){let t=i.$implicit,s=S(2);N("value",t.version)("selected",s.versionSelect==t.version),m(),oe(" v",t.version," "),m(),z(t.version==s.plugin.installedVersion?2:-1)}}function poe(e,i){e&1&&U(0,"i",26)}function moe(e,i){e&1&&U(0,"i",27)}function _oe(e,i){if(e&1){let t=ie();y(0,"button",25),Q("click",function(){J(t);let r=S(2);return Z(r.doInstall(r.versionSelect))}),T(1,poe,1,0,"i",26)(2,moe,1,0,"i",27),b()}if(e&2){let t=S(2);m(),z(t.plugin.installedVersion===t.versionSelect?1:2)}}function hoe(e,i){if(e&1&&(y(0,"ul",19)(1,"li",28)(2,"div",8),D(3),R(4,"translate"),U(5,"br"),y(6,"span",29),D(7),R(8,"translate"),b()(),y(9,"div",30),U(10,"input",31),R(11,"translate"),U(12,"label",32),b()()()),e&2){let t=S(2);m(3),oe(" ",O(4,4,"plugins.manage.hide_updates")),m(4),re(O(8,6,"plugins.manage.hide_updates_desc")),m(3),N("formControl",t.hideUpdatesFormControl),me("aria-label",O(11,8,"plugins.manage.hide_updates"))}}function foe(e,i){if(e&1){let t=ie();y(0,"div",6),T(1,noe,9,7)(2,aoe,4,3),y(3,"ul",13),Ze(4,doe,9,3,"li",14,Je),y(6,"li",14)(7,"div",15),D(8),R(9,"translate"),U(10,"br"),y(11,"select",16),ct("ngModelChange",function(r){J(t);let o=S();return lt(o.versionSelect,r)||(o.versionSelect=r),Z(r)}),Ze(12,goe,3,4,"option",17,Je),b()(),T(14,_oe,3,1,"button",18),b()(),T(15,hoe,13,10,"ul",19),b()}if(e&2){let t=S();m(),z(t.plugin.installedVersion?1:2),m(3),Qe(t.versionsWithTags),m(4),oe(" ",O(9,5,"plugins.manage.all_versions")," "),m(3),at("ngModel",t.versionSelect),m(),Qe(t.versions),m(2),z(t.versionSelect?14:-1),m(),z(t.plugin.installedVersion&&!st(7,roe).includes(t.plugin.name)?15:-1)}}var J2=(()=>{class e{$activeModal=j(It);$api=j(Xe);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);plugin;onRefreshPluginList;isUpdateHidden=!1;hideUpdatesFormControl=new Sv(!1);loading=!0;versions=[];versionsWithTags=[];versionSelect;ngOnInit(){this.versionSelect=this.plugin.installedVersion||this.plugin.latestVersion,this.lookupVersions(),this.isUpdateHidden=this.$settings.env.plugins.hideUpdatesFor&&this.$settings.env.plugins.hideUpdatesFor.includes(this.plugin.name),this.hideUpdatesFormControl.patchValue(this.isUpdateHidden),this.hideUpdatesFormControl.valueChanges.pipe(_r(500)).subscribe(t=>this.toggleHideUpdates(t))}doInstall(t){this.$activeModal.close({name:this.plugin.name,version:t,engines:this.versions.find(s=>s.version===t).engines,action:this.plugin.installedVersion?"alternate":"install"})}toggleHideUpdates(t){return ge(this,null,function*(){let s=this.$settings.env.plugins?.hideUpdatesFor||[];t?s.includes(this.plugin.name)||(s=[...s,this.plugin.name].sort((r,o)=>r.localeCompare(o))):s=s.filter(r=>r!==this.plugin.name);try{yield Ae(this.$api.put("/config-editor/ui/plugins/hide-updates-for",{body:s})),this.$settings.setEnvItem("plugins.hideUpdatesFor",s),this.onRefreshPluginList&&this.onRefreshPluginList()}catch(r){this.hideUpdatesFormControl.patchValue(this.isUpdateHidden,{emitEvent:!1}),console.error(r),this.$toastr.error(r.message,this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}lookupVersions(){this.$api.get(`/plugins/lookup/${encodeURIComponent(this.plugin.name)}/versions`).subscribe({next:t=>{for(let[s,r]of Object.entries(t.versions))this.versions.push({version:s,engines:r.engines||null}),Object.keys(t.tags).filter(o=>t.tags[o]===s).forEach(o=>{this.versionsWithTags.push({version:s,tag:o})});this.plugin.installedVersion&&!this.versions.find(s=>s.version===this.plugin.installedVersion)&&this.versions.push({version:this.plugin.installedVersion,engines:this.plugin.engines||null}),this.versions.sort((s,r)=>(0,Y2.rcompare)(s.version,r.version)),this.versionsWithTags.sort((s,r)=>{let o=["latest","next","beta","alpha"],l=o.includes(s.tag)?o.indexOf(s.tag):999,c=o.includes(r.tag)?o.indexOf(r.tag):999;return l-c}),!this.versions.find(s=>s.version===this.versionSelect)&&t.tags.latest&&(this.versionSelect=t.tags.latest),this.loading=!1},error:t=>{console.error(t),this.$toastr.error(t.error?.message||t.message,this.$translate.instant("toast.title_error")),this.$activeModal.dismiss()}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",onRefreshPluginList:"onRefreshPluginList"},decls:17,vars:11,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","d-flex","flex-row","flex-grow-1","w-100"],[1,"text-center","primary-text","my-5","w-100"],[1,"w-100","text-center"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"],[1,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"text-start",2,"min-width","50%"],[1,"custom-select","w-100","font-monospace",2,"font-size","0.875rem",3,"ngModelChange","ngModel"],[3,"value","selected"],[1,"btn","btn-primary","m-0","ms-3","py-1"],[1,"list-group","list-group-box","mt-3","mb-0"],[1,"fas","fa-code-compare","primary-text","mb-3",2,"font-size","75px"],[1,"mb-3"],[1,"font-monospace"],[1,"far","fa-arrow-alt-circle-down","primary-text","mb-3",2,"font-size","75px"],[1,"grey-text","font-monospace"],[1,"btn","btn-primary","m-0","ms-3","py-1",3,"click"],[1,"fas","fa-rotate-right"],[1,"fas","fa-arrow-alt-circle-down"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"grey-text","small"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","hidePluginUpdates",1,"rendux-input",3,"formControl"],["for","hidePluginUpdates",1,"rendux-label","ms-3"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),b(),y(4,"button",3),R(5,"translate"),Q("click",function(){return r.dismissModal()}),b()(),y(6,"div",4),T(7,ooe,2,0,"div",5)(8,foe,16,8,"div",6),b(),y(9,"div",7),U(10,"div",8),y(11,"div",9)(12,"button",10),R(13,"translate"),Q("click",function(){return r.dismissModal()}),D(14),R(15,"translate"),b()(),U(16,"div",11),b()()),s&2&&(m(3),re(r.plugin.displayName||r.plugin.name),m(),me("aria-label",O(5,5,"form.button_close")),m(3),z(r.loading?7:8),m(5),me("aria-label",O(13,7,"form.button_close")),m(2),oe(" ",O(15,9,"form.button_close")," "))},dependencies:[us,Sr,Cr,kr,Fo,Qt,Wi,ca,Hr,Pt],encapsulation:2})}return e})();var Z2=xt(QU(),1);var Du=(()=>{class e{transform(t){return t.replace(/\$\{\{HOSTNAME\}\}/g,location.hostname)}static \u0275fac=function(s){return new(s||e)};static \u0275pipe=Rc({name:"interpolateMd",type:e,pure:!0})}return e})();var Q2=(e,i,t)=>({"fa-circle-check green-text":e,"fa-circle-exclamation red-text":i,"fa-circle-exclamation orange-text":t});function boe(e,i){e&1&&(y(0,"div",5),U(1,"i",14),b())}function yoe(e,i){e&1&&(y(0,"div",6),D(1),R(2,"translate"),R(3,"translate"),b()),e&2&&(m(),vr(" ",O(2,2,"plugins.settings.message_manual_config_required")," ",O(3,4,"plugins.settings.message_consult_documentation")," "))}function voe(e,i){if(e&1&&(U(0,"markdown",7),R(1,"interpolateMd")),e&2){let t=S();N("data",O(1,1,t.schema.headerDisplay))}}function woe(e,i){if(e&1){let t=ie();y(0,"button",28),R(1,"translate"),Q("click",function(){J(t);let r=S(2).$index,o=S(2);return Z(o.removeBlock(r))}),U(2,"i",29),b()}e&2&&N("ngbTooltip",O(1,2,"form.button_delete"))("openDelay",150)}function koe(e,i){if(e&1){let t=ie();T(0,woe,3,4,"button",25),y(1,"button",26),R(2,"translate"),Q("click",function(){J(t);let r=S().$index,o=S(2);return Z(o.editBlock(r))}),U(3,"i",27),b()}if(e&2){let t=S().$index,s=S(2);z(s.show==="configBlock."+t?0:-1),m(),N("ngbTooltip",O(2,3,"form.button_edit"))("openDelay",150)}}function Hoe(e,i){if(e&1&&(U(0,"i",21),R(1,"translate")),e&2){let t=S().$index,s=S(2);N("ngClass",ci(5,Q2,s.formBlocksValid[t],s.strictValidation&&!s.formBlocksValid[t],!s.strictValidation&&!s.formBlocksValid[t]))("ngbTooltip",O(1,3,s.formBlocksValid[t]?"form.label_valid":s.strictValidation?"form.label_invalid_strict":"form.label_invalid"))("openDelay",150)}}function Soe(e,i){if(e&1){let t=ie();y(0,"div",16)(1,"div",18)(2,"div",19)(3,"h5",20),D(4),b(),y(5,"div"),T(6,koe,4,5),T(7,Hoe,2,9,"i",21),b()()(),y(8,"div",22)(9,"div",23)(10,"ngx-monaco-editor",24),ct("ngModelChange",function(r){J(t);let o=S(2);return lt(o.currentBlock,r)||(o.currentBlock=r),Z(r)}),Q("onInit",function(r){J(t);let o=S(2);return Z(o.onEditorInit(r))}),b()()()()}if(e&2){let t=i.$implicit,s=i.$index,r=S(2);N("ngbAccordionItem","configBlock."+s)("collapsed",r.show!=="configBlock."+s)("id","configBlock."+s),m(4),re(t.name||r.pluginAlias),m(2),z(!(r.schema!=null&&r.schema.singular)||r.pluginConfig.length>1?6:-1),m(),z(r.schema!=null&&r.schema.singular?-1:7),m(3),N("options",r.editorOptions),at("ngModel",r.currentBlock)}}function Coe(e,i){if(e&1&&(y(0,"div",17),U(1,"markdown",7),R(2,"interpolateMd"),b()),e&2){let t=S(2);m(),N("data",O(2,1,t.schema.footerDisplay))}}function xoe(e,i){if(e&1&&(y(0,"div",15),Ze(1,Soe,11,8,"div",16,Je),b(),T(3,Coe,3,3,"div",17)),e&2){let t=S();N("closeOthers",!0),m(),Qe(t.pluginConfig),m(2),z(t.schema!=null&&t.schema.footerDisplay?3:-1)}}function Ioe(e,i){if(e&1&&(U(0,"i",30),R(1,"translate")),e&2){let t=S(2);N("ngClass",ci(5,Q2,t.formIsValid,t.strictValidation&&!t.formIsValid,!t.strictValidation&&!t.formIsValid))("ngbTooltip",O(1,3,t.formIsValid?"form.label_valid":t.strictValidation?"form.label_invalid_strict":"form.label_invalid"))("openDelay",150)}}function Poe(e,i){if(e&1){let t=ie();y(0,"button",34),Q("click",function(){J(t);let r=S(2);return Z(r.addBlock())}),U(1,"i",35),b()}}function Toe(e,i){e&1&&(D(0),R(1,"translate")),e&2&&oe(" ",O(1,1,"form.button_save")," ")}function zoe(e,i){e&1&&U(0,"i",33)}function Aoe(e,i){if(e&1){let t=ie();T(0,Ioe,2,9,"i",30),T(1,Poe,2,0,"button",31),y(2,"button",32),Q("click",function(){J(t);let r=S();return Z(r.save())}),T(3,Toe,2,3),T(4,zoe,1,0,"i",33),b()}if(e&2){let t=S();z(t.schema!=null&&t.schema.singular?0:-1),m(),z(t.schema!=null&&t.schema.singular?-1:1),m(),N("disabled",t.saveInProgress||!t.formIsValid&&t.strictValidation),m(),z(t.saveInProgress?-1:3),m(),z(t.saveInProgress?4:-1)}}function joe(e,i){if(e&1){let t=ie();y(0,"button",36),Q("click",function(){J(t);let r=S();return Z(r.openFullConfigEditor())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"plugins.settings.label_open_config_editor")," "))}var _f=(()=>{class e{$activeModal=j(It);$api=j(Xe);$cb=j($o);$cdr=j(ds);$md=j(Uv);$plugin=j(qr);$router=j(Is);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);isDebugModeEnabled=this.$settings.isFeatureEnabled("childBridgeDebugMode");plugin;schema;pluginAlias;pluginType;loading=!0;canConfigure=!1;show="";pluginConfig;currentBlock;currentBlockIndex=null;saveInProgress=!1;isFirstSave=!1;monacoEditor;formBlocksValid={};formIsValid=!0;strictValidation=!1;editorOptions;get arrayKey(){return this.pluginType==="accessory"?"accessories":"platforms"}ngOnInit(){this.editorOptions={language:"json",theme:this.$settings.actualLightingMode==="dark"?"vs-dark":"vs-light"},this.strictValidation=this.schema?.strictValidation||!1,this.$md.detect.mobile()?(this.loading=!1,this.canConfigure=!1):this.loadPluginAlias()}onEditorInit(t){return ge(this,null,function*(){window.editor=t,this.monacoEditor=t,this.setupSchemaValidation(),this.monacoEditor.onDidChangeModelContent(()=>setTimeout(()=>this.onValidationChange(),300)),window.monaco.editor.onDidChangeMarkers(r=>{let o=this.monacoEditor.getModel()?.uri;o&&r.some(l=>l.toString()===o.toString())&&this.onValidationChange()}),yield this.monacoEditor.getModel().setValue(this.currentBlock),yield this.monacoEditor.getAction("editor.action.formatDocument").run()})}ngOnDestroy(){try{if(window.editor&&window.editor.dispose&&(window.editor.dispose(),window.editor=void 0),window.monaco){let s=`http://plugin/${this.schema?.pluginAlias||this.pluginAlias}/config.json`,o=(window.monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas||[]).filter(l=>l.uri!==s);window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!1,schemas:o})}this.monacoEditor&&this.monacoEditor.dispose()}catch{}}setupSchemaValidation(){let t=this.schema?.schema;t||(t=this.createBasicSchema());let r=`http://plugin/${this.schema?.pluginAlias||this.pluginAlias}/config.json`,o=pp(this.$translate,{isDebugModeEnabled:this.isDebugModeEnabled}),c=[...t.required||[]];this.pluginType==="platform"?(c.includes("platform")||c.push("platform"),t.properties?.platform?t.properties.platform.const=this.pluginAlias:t.properties=Fe(pe({},t.properties),{platform:{type:"string",title:"Platform Name",description:"This is used by Homebridge to identify which plugin this platform belongs to.",const:this.pluginAlias}})):(c.includes("accessory")||c.push("accessory"),c.includes("name")||c.push("name"),t.properties?.accessory?t.properties.accessory.const=this.pluginAlias:t.properties=Fe(pe({},t.properties),{accessory:{type:"string",title:this.$translate.instant("child_bridge.config.accessory"),description:"This is used by Homebridge to identify which plugin this accessory belongs to.",const:this.pluginAlias}})),window.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,allowComments:!1,schemas:[{uri:r,fileMatch:["*"],schema:Fe(pe({},t),{required:c,properties:Fe(pe({},t.properties),{_bridge:o})})}]})}createBasicSchema(){let t=pp(this.$translate,{isDebugModeEnabled:this.isDebugModeEnabled});return this.pluginType==="platform"?{type:"object",required:["platform"],title:this.$translate.instant("plugins.button_settings"),properties:{platform:{type:"string",title:"Platform Name",description:"This is used by Homebridge to identify which plugin this platform belongs to.",not:{enum:["config"]}},name:{type:"string",title:this.$translate.instant("accessories.name"),description:"The name of the platform."},_bridge:t}}:{type:"object",required:["accessory","name"],title:this.$translate.instant("plugins.button_settings"),properties:{accessory:{type:"string",title:this.$translate.instant("child_bridge.config.accessory"),description:"This is used by Homebridge to identify which plugin this accessory belongs to."},name:{type:"string",title:this.$translate.instant("accessories.name"),description:"The name of the accessory."},_bridge:t}}}isJsonValid(){if(!this.monacoEditor)return!0;let t=this.monacoEditor.getModel();if(!t)return!0;let s=window.monaco.editor.getModelMarkers({resource:t.uri}),r=window.monaco;return!s.filter(l=>l.severity===r.MarkerSeverity.Error||l.severity===r.MarkerSeverity.Warning).length}updateOverallValidation(){this.formIsValid=Object.values(this.formBlocksValid).every(t=>t)}onValidationChange(){this.currentBlockIndex!==null&&this.monacoEditor&&(this.formBlocksValid[this.currentBlockIndex]=this.isJsonValid(),this.updateOverallValidation(),this.$cdr.detectChanges())}addBlock(){if(!this.saveCurrentBlock()){this.$toastr.error(this.$translate.instant("plugins.config.please_fix"),this.$translate.instant("toast.title_error"));return}this.pluginConfig.push({[this.pluginType]:this.pluginAlias,name:this.pluginAlias}),this.editBlock(this.pluginConfig.length-1)}editBlock(t){if(this.currentBlockIndex!==null){if(!this.saveCurrentBlock())return;this.formBlocksValid[this.currentBlockIndex]=this.isJsonValid()}this.show=`configBlock.${t}`,this.currentBlockIndex=t,this.currentBlock=JSON.stringify(this.pluginConfig[this.currentBlockIndex],null,4),t in this.formBlocksValid||(this.formBlocksValid[t]=!0),this.updateOverallValidation(),setTimeout(()=>this.onValidationChange(),150)}removeBlock(t){let s=this.pluginConfig[t],r=this.pluginConfig.findIndex(o=>o===s);r>-1&&this.pluginConfig.splice(r,1),this.currentBlockIndex=null,this.currentBlock=void 0,this.show=""}save(){return ge(this,null,function*(){if(this.saveInProgress=!0,!this.saveCurrentBlock()){this.saveInProgress=!1;return}try{let t=yield Ae(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,this.pluginConfig));if(this.$activeModal.close(),this.isFirstSave&&this.$settings.env.recommendChildBridges&&t[0]?.platform){this.$activeModal.close(),this.$plugin.bridgeSettings(this.plugin,!0);return}this.$activeModal.close(),yield this.$cb.openCorrectRestartModalForPlugin(this.plugin.name)}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error")),this.saveInProgress=!1}})}openFullConfigEditor(){this.$router.navigate(["/config"]),this.$activeModal.close()}closeModal(){this.$activeModal.close()}loadPluginAlias(){this.$api.get(`/plugins/alias/${encodeURIComponent(this.plugin.name)}`).subscribe({next:t=>{t.pluginAlias&&t.pluginType?(this.pluginAlias=t.pluginAlias,this.pluginType=t.pluginType,this.loadHomebridgeConfig()):this.loading=!1},error:()=>{this.loading=!1}})}loadHomebridgeConfig(){this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe(t=>{this.pluginConfig=t,this.canConfigure=!0,this.loading=!1,this.initializeValidationState(),this.pluginConfig.length?this.editBlock(0):(this.isFirstSave=!0,this.addBlock())})}saveCurrentBlock(){if(this.currentBlockIndex!==null&&this.monacoEditor){let t=this.monacoEditor.getModel().getValue().trim(),s;t.charAt(0)==='"'&&t.charAt(t.length-1)==="]"&&(t=`{${t}}`);try{s=Z2.default.parse(t)}catch(o){return console.error(o),this.$toastr.error(this.$translate.instant("config.config_invalid_json"),this.$translate.instant("toast.title_error")),!1}if(Array.isArray(s)||typeof s!="object")return this.$toastr.error(this.$translate.instant("plugins.config.must_be_object"),this.$translate.instant("toast.title_error")),!1;if(!s[this.pluginType]&&Array.isArray(s[this.arrayKey])&&s[this.arrayKey].length&&Object.keys(s).length===1&&(s=s[this.arrayKey][0]),this.pluginType==="accessory"&&(!s.name||typeof s.name!="string"))return this.$toastr.error(this.$translate.instant("plugins.config.name_property"),this.$translate.instant("toast.title_error")),s.name="",this.monacoEditor.getModel().setValue(JSON.stringify(s,null,4)),!1;let r=this.pluginConfig[this.currentBlockIndex];Object.keys(r).forEach(o=>delete r[o]),Object.assign(r,s),r[this.pluginType]=this.pluginAlias}return!0}initializeValidationState(){this.formBlocksValid={};for(let t=0;t<this.pluginConfig.length;t+=1)this.formBlocksValid[t]=!0;this.updateOverallValidation()}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",schema:"schema"},decls:20,vars:16,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","pb-0"],[1,"text-center","primary-text","my-5","w-100"],[1,"alert","alert-warning","mb-0"],[1,"plugin-md",3,"data"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end","d-flex","align-items-center","justify-content-end"],[1,"btn","btn-primary"],[1,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],["ngbAccordion","",3,"closeOthers"],[1,"card",3,"ngbAccordionItem","collapsed","id"],[1,"mt-3"],["ngbAccordionHeader","",1,"card-header"],[1,"d-flex","align-items-center","justify-content-between"],[1,"m-0","py-2","ps-1"],["container","modal","placement","left","triggers","hover",1,"fa","fa-xl",3,"ngClass","ngbTooltip","openDelay"],["ngbAccordionCollapse",""],["ngbAccordionBody","",1,"card-body","p-0",2,"height","400px"],[1,"flex-grow-1","h-100","w-100","mb-0","pb-0",3,"ngModelChange","onInit","options","ngModel"],["container","modal","triggers","hover",1,"btn","btn-danger","m-0","ms-2",3,"ngbTooltip","openDelay"],["ngbAccordionToggle","","container","modal","triggers","hover",1,"btn","btn-primary","m-0","ms-2","me-2",3,"click","ngbTooltip","openDelay"],[1,"fa","fa-edit"],["container","modal","triggers","hover",1,"btn","btn-danger","m-0","ms-2",3,"click","ngbTooltip","openDelay"],[1,"fa","fa-trash"],["container","modal","placement","top","triggers","hover",1,"fa","fa-xl","me-2",3,"ngClass","ngbTooltip","openDelay"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","me-2"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-circle-notch","fa-spin"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","me-2",3,"click"],[1,"fa","fa-plus"],[1,"btn","btn-primary",3,"click"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),b(),y(4,"button",3),R(5,"translate"),Q("click",function(){return r.closeModal()}),b()(),y(6,"div",4),T(7,boe,2,0,"div",5),T(8,yoe,4,6,"div",6),T(9,voe,2,3,"markdown",7),T(10,xoe,4,2),b(),y(11,"div",8)(12,"div",9)(13,"button",10),Q("click",function(){return r.closeModal()}),D(14),R(15,"translate"),b()(),U(16,"div",11),y(17,"div",12),T(18,Aoe,5,5),T(19,joe,3,3,"button",13),b()()()),s&2&&(m(3),vr("",r.plugin.displayName||r.plugin.name," - ",r.pluginType),m(),N("disabled",r.saveInProgress),me("aria-label",O(5,12,"form.button_close")),m(3),z(r.loading?7:-1),m(),z(!r.loading&&!r.canConfigure?8:-1),m(),z(r.schema!=null&&r.schema.headerDisplay?9:-1),m(),z(!r.loading&&r.canConfigure?10:-1),m(3),N("disabled",r.saveInProgress),m(),oe(" ",O(15,14,"form.button_close")," "),m(4),z(r.canConfigure?18:-1),m(),z(r.canConfigure?-1:19))},dependencies:[yi,Wc,Gc,Kc,xr,Lc,qc,Bv,us,Qt,Wi,$c,qo,Vo,Lo,Pt,Du],styles:[".no-padding-card-body .card-body{padding:0!important} body.dark-mode .no-padding-card-body .card-body{background-color:#1e1e1e}.manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}"]})}return e})();var hf=e=>({link:e}),X2=e=>({"is-invalid":e}),Doe=e=>({"font-monospace":e}),Noe=(e,i)=>({"green-text":e,"grey-text":i});function Roe(e,i){if(e&1){let t=ie();y(0,"button",14),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.closeModal())}),b()}if(e&2){let t=S();N("disabled",t.saveInProgress),me("aria-label",O(1,2,"form.button_close"))}}function Eoe(e,i){e&1&&(y(0,"div",6),U(1,"i",15),b())}function Boe(e,i){e&1&&(y(0,"li"),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"child_bridge.bridges_paired_2")))}function Moe(e,i){if(e&1&&(y(0,"li"),D(1),R(2,"translate"),b(),T(3,Boe,3,3,"li")),e&2){let t=S(2);m(),re(O(2,2,"child_bridge.bridges_paired")),m(2),z(t.configBlocks.length===1&&!t.deviceInfo.get(t.configBlocks[0]._bridge==null?null:t.configBlocks[0]._bridge.username)&&t.originalBridges.length===0?3:-1)}}function Uoe(e,i){if(e&1&&(y(0,"option",30),D(1),b()),e&2){let t=i.$implicit,s=i.$index;N("value",s),m(),re(t.name||t.platform||t.accessory)}}function Foe(e,i){if(e&1){let t=ie();y(0,"ul",22)(1,"li",26),D(2),R(3,"translate"),b(),y(4,"li",24)(5,"label",27),D(6),R(7,"translate"),b(),y(8,"div",28)(9,"select",29),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.selectedBlock,r)||(o.selectedBlock=r),Z(r)}),Q("change",function(){J(t);let r=S(3);return Z(r.onBlockChange(r.selectedBlock))}),Ze(10,Uoe,2,2,"option",30,Je),b()()()()}if(e&2){let t=S(3);m(2),re(O(3,3,"form.label.changes_kept")),m(4),oe(" ",O(7,5,"accessories.plugin")," "),m(3),at("ngModel",t.selectedBlock),m(),Qe(t.configBlocks)}}function Ooe(e,i){if(e&1&&D(0),e&2){let t=S().$implicit;vr(" ",t.name," \xB7 ",t.username," ")}}function Voe(e,i){if(e&1&&D(0),e&2){let t=S().$implicit;oe(" ",t.username," ")}}function qoe(e,i){if(e&1&&(y(0,"option",30),T(1,Ooe,1,2)(2,Voe,1,1),b()),e&2){let t=i.$implicit;N("value",t.username),m(),z(t.name?1:2)}}function Loe(e,i){if(e&1){let t=ie();y(0,"li",24)(1,"label",31),D(2),R(3,"translate"),b(),y(4,"div",28)(5,"select",32,0),Q("change",function(){J(t);let r=Fc(6),o=S(3);return Z(o.onLinkBridgeChange(r.value))}),y(7,"option",30),D(8),R(9,"translate"),b(),Ze(10,qoe,3,2,"option",30,Je),b()()()}if(e&2){let t=S(3);m(2),re(O(3,2,"child_bridge.config.or_link")),m(6),re(O(9,4,"child_bridge.config.select_existing")),m(2),Qe(t.bridgesAvailableForLink)}}function $oe(e,i){e&1&&(y(0,"li",24)(1,"label",33),D(2,"Child Bridge"),b(),y(3,"div",34),D(4),R(5,"translate"),b()()),e&2&&(m(4),oe(" ",O(5,1,"child_bridge.config.prevent")," "))}function Koe(e,i){if(e&1){let t=ie();y(0,"li",25)(1,"span",8),D(2),R(3,"translate"),b(),y(4,"div",35)(5,"input",36),Q("change",function(){J(t);let r=S(3);return Z(r.toggleExternalBridge(r.configBlocks[r.selectedBlock],r.enabledBlocks[r.selectedBlock],r.selectedBlock))}),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.enabledBlocks[o.selectedBlock],r)||(o.enabledBlocks[o.selectedBlock]=r),Z(r)}),b(),U(6,"label",37),b()()}if(e&2){let t=S(3);m(2),oe(" ",O(3,4,t.currentlySelectedLink?"child_bridge.config.or_link":"child_bridge.config.use")," "),m(3),N("id","toggleExternalBridgeInput_"+t.selectedBlock),at("ngModel",t.enabledBlocks[t.selectedBlock]),m(),N("for","toggleExternalBridgeInput_"+t.selectedBlock)}}function Goe(e,i){if(e&1&&(y(0,"li",24)(1,"label",33),D(2),R(3,"translate"),b(),y(4,"div",38),D(5),b()()),e&2){let t=S(3);m(2),re(O(3,2,"child_bridge.config.name")),m(3),oe(" ",t.currentlySelectedLink.name," ")}}function Woe(e,i){if(e&1&&(y(0,"li",24)(1,"label",33),D(2),R(3,"translate"),b(),y(4,"div",38),D(5),b()()),e&2){let t=S(3);m(2),re(O(3,2,"users.label_username")),m(3),oe(" ",(t.currentlySelectedLink==null?null:t.currentlySelectedLink.username)||(t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username)," ")}}function Yoe(e,i){if(e&1&&(y(0,"li",24)(1,"label",33),D(2),R(3,"translate"),b(),y(4,"div",38),D(5),b()()),e&2){let t=S(3);m(2),re(O(3,2,"child_bridge.config.port")),m(3),oe(" ",t.currentlySelectedLink.port," ")}}function Joe(e,i){if(e&1){let t=ie();y(0,"li",25)(1,"span",8),D(2),R(3,"translate"),y(4,"code"),D(5,"-D"),b()(),y(6,"div",35)(7,"input",51),R(8,"translate"),ct("ngModelChange",function(r){J(t);let o=S(5);return lt(o.configBlocks[o.selectedBlock]._bridge.debugModeEnabled,r)||(o.configBlocks[o.selectedBlock]._bridge.debugModeEnabled=r),Z(r)}),b(),U(9,"label",37),b()()}if(e&2){let t=S(5);m(2),oe("",O(3,5,"child_bridge.config.debug")," "),m(5),N("id","homebridgeDebugMode_"+t.selectedBlock),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.debugModeEnabled),me("aria-label",O(8,7,"settings.startup.debug")),m(2),N("for","homebridgeDebugMode_"+t.selectedBlock)}}function Zoe(e,i){if(e&1){let t=ie();y(0,"li",24)(1,"label",33),D(2),R(3,"translate"),y(4,"span",42),D(5),R(6,"translate"),b(),U(7,"br")(8,"small",43),R(9,"translate"),b(),y(10,"div",44)(11,"input",45),Q("input",function(r){J(t);let o=S(4);return Z(o.onScheduledRestartCronChange(r.target.value,o.configBlocks[o.selectedBlock]._bridge==null?null:o.configBlocks[o.selectedBlock]._bridge.username))}),b()()(),T(12,Joe,10,9,"li",25),y(13,"li",24)(14,"label",33)(15,"span",46),D(16,"DEBUG"),b(),U(17,"br")(18,"small",47),R(19,"translate"),b(),y(20,"div",28)(21,"input",48),ct("ngModelChange",function(r){J(t);let o=S(4);return lt(o.configBlocks[o.selectedBlock]._bridge.env.DEBUG,r)||(o.configBlocks[o.selectedBlock]._bridge.env.DEBUG=r),Z(r)}),b()()(),y(22,"li",24)(23,"label",33)(24,"span",46),D(25,"NODE_OPTIONS"),b(),U(26,"br"),y(27,"small",49),D(28),R(29,"translate"),b()(),y(30,"div",28)(31,"input",50),ct("ngModelChange",function(r){J(t);let o=S(4);return lt(o.configBlocks[o.selectedBlock]._bridge.env.NODE_OPTIONS,r)||(o.configBlocks[o.selectedBlock]._bridge.env.NODE_OPTIONS=r),Z(r)}),b()()()}if(e&2){let t=S(4);m(2),oe(" ",O(3,13,"settings.startup.scheduled_restart")," "),m(3),re(O(6,15,"common.labels.beta")),m(3),N("innerHtml",mt(9,17,"settings.startup.scheduled_restart_desc",li(25,hf,t.linkCron)),Me),m(3),bi("letter-spacing","0.15em")("text-align","center"),N("value",t.getScheduledRestartCron(t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username)),m(),z(t.canShowBridgeDebug?12:-1),m(6),N("innerHTML",mt(19,20,"settings.service.debug_tooltip",li(27,hf,t.linkDebug)),Me),m(3),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.env.DEBUG),m(7),re(O(29,23,"settings.service.node_tooltip")),m(3),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.env.NODE_OPTIONS)}}function Qoe(e,i){if(e&1){let t=ie();y(0,"li",24)(1,"label",33),D(2),R(3,"translate"),b(),y(4,"div",28)(5,"input",39),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.configBlocks[o.selectedBlock]._bridge.name,r)||(o.configBlocks[o.selectedBlock]._bridge.name=r),Z(r)}),b()()(),y(6,"li",24)(7,"label",33),D(8),R(9,"translate"),b(),y(10,"div",28)(11,"input",40),R(12,"translate"),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.configBlocks[o.selectedBlock]._bridge.manufacturer,r)||(o.configBlocks[o.selectedBlock]._bridge.manufacturer=r),Z(r)}),b()()(),y(13,"li",24)(14,"label",33),D(15),R(16,"translate"),b(),y(17,"div",28)(18,"input",40),R(19,"translate"),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.configBlocks[o.selectedBlock]._bridge.model,r)||(o.configBlocks[o.selectedBlock]._bridge.model=r),Z(r)}),b()()(),y(20,"li",24)(21,"label",33),D(22),R(23,"translate"),b(),y(24,"div",28)(25,"input",41),R(26,"translate"),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.configBlocks[o.selectedBlock]._bridge.firmwareRevision,r)||(o.configBlocks[o.selectedBlock]._bridge.firmwareRevision=r),Z(r)}),b()()(),T(27,Zoe,32,29)}if(e&2){let t=S(3);m(2),re(O(3,14,"child_bridge.config.name")),m(3),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.name),N("ngClass",li(28,X2,t.getHapNameValidationError(t.selectedBlock))),m(3),re(O(9,16,"child_bridge.config.manufacturer")),m(3),N("placeholder",O(12,18,"form.optional")),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.manufacturer),m(4),re(O(16,20,"child_bridge.config.model")),m(3),N("placeholder",O(19,22,"form.optional")),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.model),m(4),re(O(23,24,"child_bridge.config.firmware")),m(3),N("ngClass",li(30,Doe,t.configBlocks[t.selectedBlock]._bridge.firmwareRevision))("placeholder",O(26,26,"form.optional")),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.firmwareRevision),m(2),z(t.justInstalled?-1:27)}}function Xoe(e,i){e&1&&(y(0,"li",53)(1,"div",55)(2,"div",56)(3,"div")(4,"div",57),U(5,"i",58),b(),y(6,"div",59),D(7),R(8,"translate"),b()()()()()),e&2&&(m(7),re(O(8,1,"child_bridge.return_to_pair")))}function ene(e,i){e&1&&(y(0,"span"),D(1),R(2,"translate"),b()),e&2&&(m(),oe(" \xB7 ",O(2,1,"status.code_scan")," "))}function tne(e,i){if(e&1){let t=ie();y(0,"li",25)(1,"span",8),D(2),R(3,"translate"),b(),y(4,"div",35)(5,"input",64),R(6,"translate"),Q("change",function(){J(t);let r=S(5);return Z(r.toggleHideUnpairing(r.configBlocks[r.selectedBlock]._bridge==null?null:r.configBlocks[r.selectedBlock]._bridge.username))}),b(),U(7,"label",37),b()()}if(e&2){let t=S(5);m(2),re(O(3,5,"child_bridge.config.hide_pairing_alert")),m(3),N("id","toggleHideHapUnpairing_"+t.selectedBlock)("checked",t.isUnpairingHidden(t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username)),me("aria-label",O(6,7,"child_bridge.config.hide_pairing_alert")),m(2),N("for","toggleHideHapUnpairing_"+t.selectedBlock)}}function ine(e,i){if(e&1&&(y(0,"li",53)(1,"div",55),U(2,"app-qrcode",60),y(3,"p",61),D(4),b(),y(5,"p",62),U(6,"i",63),D(7),R(8,"translate"),T(9,ene,3,3,"span"),b()()(),T(10,tne,8,9,"li",25)),e&2){let t,s,r,o,l,c,u=S(4);m(2),N("data",(t=u.deviceInfo.get(u.configBlocks[u.selectedBlock]._bridge==null?null:u.configBlocks[u.selectedBlock]._bridge.username))==null?null:t._setupCode),m(2),oe(" ",(s=u.deviceInfo.get(u.configBlocks[u.selectedBlock]._bridge==null?null:u.configBlocks[u.selectedBlock]._bridge.username))==null?null:s.pincode," "),m(2),N("ngClass",la(8,Noe,(r=u.deviceInfo.get(u.configBlocks[u.selectedBlock]._bridge==null?null:u.configBlocks[u.selectedBlock]._bridge.username))==null?null:r._isPaired,!((r=u.deviceInfo.get(u.configBlocks[u.selectedBlock]._bridge==null?null:u.configBlocks[u.selectedBlock]._bridge.username))!=null&&r._isPaired))),m(),oe(" ",O(8,6,(o=u.deviceInfo.get(u.configBlocks[u.selectedBlock]._bridge==null?null:u.configBlocks[u.selectedBlock]._bridge.username))!=null&&o._isPaired?"status.widget.qr_paired":"status.widget.qr_unpaired")," "),m(2),z((l=u.deviceInfo.get(u.configBlocks[u.selectedBlock]._bridge==null?null:u.configBlocks[u.selectedBlock]._bridge.username))!=null&&l._isPaired?-1:9),m(),z((c=u.deviceInfo.get(u.configBlocks[u.selectedBlock]._bridge==null?null:u.configBlocks[u.selectedBlock]._bridge.username))!=null&&c._isPaired?-1:10)}}function sne(e,i){if(e&1){let t=ie();y(0,"ul",23)(1,"li",25)(2,"span",8),U(3,"i",52),D(4," HAP "),b()(),T(5,Xoe,9,3,"li",53),T(6,ine,11,11),y(7,"li",24)(8,"label",33),D(9),R(10,"translate"),b(),y(11,"div",28)(12,"input",54),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.configBlocks[o.selectedBlock]._bridge.port,r)||(o.configBlocks[o.selectedBlock]._bridge.port=r),Z(r)}),b()()()()}if(e&2){let t=S(3);m(5),z(t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username&&t.deviceInfo.get(t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username)===!1?5:-1),m(),z(t.deviceInfo.get(t.configBlocks[t.selectedBlock]._bridge==null?null:t.configBlocks[t.selectedBlock]._bridge.username)?6:-1),m(3),re(O(10,5,"child_bridge.config.port")),m(3),at("ngModel",t.configBlocks[t.selectedBlock]._bridge.port),N("ngClass",li(7,X2,t.getHapPortValidationError(t.selectedBlock)))}}function rne(e,i){if(e&1&&(T(0,Foe,12,7,"ul",22),y(1,"ul",23),T(2,Loe,12,6,"li",24),T(3,$oe,6,3,"li",24),T(4,Koe,7,6,"li",25),T(5,Goe,6,4,"li",24),T(6,Woe,6,4,"li",24),T(7,Yoe,6,4,"li",24),T(8,Qoe,28,32),b(),T(9,sne,13,9,"ul",23)),e&2){let t=S(2);z(t.configBlocks.length>1?0:-1),m(2),z(!(t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username)&&t.bridgesAvailableForLink.length&&!t.currentBridgeHasLinks?2:-1),m(),z(t.currentBridgeHasLinks?3:-1),m(),z(t.currentBridgeHasLinks?-1:4),m(),z(t.currentlySelectedLink?5:-1),m(),z((t.currentlySelectedLink||t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username)&&(t.currentlySelectedLink||!t.currentBridgeHasLinks)?6:-1),m(),z(t.currentlySelectedLink?7:-1),m(),z(!t.currentlySelectedLink&&(t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username)?8:-1),m(),z(!t.currentlySelectedLink&&(t.configBlocks[t.selectedBlock]._bridge!=null&&t.configBlocks[t.selectedBlock]._bridge.username)?9:-1)}}function one(e,i){e&1&&(D(0),R(1,"translate")),e&2&&oe(" ",O(1,1,"child_bridge.confirm_delete_2")," ")}function nne(e,i){if(e&1&&(y(0,"li"),U(1,"i",66),D(2),y(3,"span",49),D(4," \xB7 "),b(),y(5,"span",67),D(6),b()()),e&2){let t,s=i.$implicit,r=S(3);m(2),oe(" ",s.bridgeName||((t=r.deviceInfo.get(s.id))==null?null:t.displayName)," "),m(4),re(s.id)}}function ane(e,i){if(e&1&&(y(0,"ngb-alert",19)(1,"p"),D(2),R(3,"translate"),T(4,one,2,3),b(),y(5,"div",10)(6,"ul",65),Ze(7,nne,7,2,"li",null,Je),b()()()),e&2){let t=S(2);N("dismissible",!1),m(2),oe(" ",O(3,3,"child_bridge.confirm_delete_1")," "),m(2),z(t.deletingPairedBridge?4:-1),m(3),Qe(t.deleteBridges)}}function lne(e,i){e&1&&(y(0,"ngb-alert",20),D(1),R(2,"translate"),b()),e&2&&(N("dismissible",!1),m(),re(O(2,2,"child_bridge.must_configure_plugin")))}function cne(e,i){if(e&1){let t=ie();y(0,"ngb-alert",21)(1,"div",17),D(2),R(3,"translate"),R(4,"translate"),b(),y(5,"button",68),Q("click",function(){J(t);let r=S(2);return Z(r.openFullConfigEditor())}),D(6),R(7,"translate"),b()()}e&2&&(N("dismissible",!1),m(2),vr(" ",O(3,4,"plugins.settings.message_manual_config_required")," ",O(4,6,"plugins.settings.message_consult_documentation")," "),m(4),oe(" ",O(7,8,"plugins.settings.label_open_config_editor")," "))}function dne(e,i){if(e&1){let t=ie();y(0,"div",10)(1,"img",16),Q("error",function(){J(t);let r=S();return Z(r.handleIconError())}),b()(),y(2,"ul",17),U(3,"li",18),R(4,"translate"),T(5,Moe,4,4),b(),T(6,rne,10,9),T(7,ane,9,5,"ngb-alert",19),T(8,lne,3,4,"ngb-alert",20),T(9,cne,8,10,"ngb-alert",21)}if(e&2){let t=S();m(),N("src",t.plugin.icon,cv),m(2),N("innerHTML",mt(4,7,"child_bridge.about",li(10,hf,t.linkChildBridges)),Me),m(2),z(t.configBlocks.length?5:-1),m(),z(t.canConfigure&&t.configBlocks.length?6:-1),m(),z(t.deleteBridges.length?7:-1),m(),z(!t.configBlocks.length&&t.canConfigure?8:-1),m(),z(t.canConfigure?-1:9)}}function une(e,i){if(e&1){let t=ie();y(0,"button",69),Q("click",function(){J(t);let r=S();return Z(r.closeModal())}),D(1),R(2,"translate"),b()}if(e&2){let t=S();N("disabled",t.saveInProgress),m(),oe(" ",O(2,2,"form.button_close")," ")}}function gne(e,i){e&1&&U(0,"i",71)}function pne(e,i){if(e&1){let t=ie();y(0,"button",70),Q("click",function(){J(t);let r=S();return Z(r.save())}),D(1),R(2,"translate"),T(3,gne,1,0,"i",71),b()}if(e&2){let t=S();N("disabled",t.saveInProgress||t.hasValidationErrors),m(),oe(" ",O(2,3,"form.button_save")," "),m(2),z(t.saveInProgress?3:-1)}}function mne(e,i){if(e&1){let t=ie();y(0,"button",72),Q("click",function(){J(t);let r=S();return Z(r.closeModal())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"form.button_close")," "))}function _ne(e,i){e&1&&(D(0),R(1,"translate")),e&2&&oe(" ",O(1,1,"form.button_save")," ")}function hne(e,i){e&1&&U(0,"i",71)}function fne(e,i){if(e&1){let t=ie();y(0,"button",70),Q("click",function(){J(t);let r=S(2);return Z(r.save())}),T(1,_ne,2,3),T(2,hne,1,0,"i",71),b()}if(e&2){let t=S(2);N("disabled",t.saveInProgress||t.loading||t.hasValidationErrors),m(),z(t.saveInProgress?-1:1),m(),z(t.saveInProgress?2:-1)}}function bne(e,i){if(e&1){let t=ie();y(0,"button",74),Q("click",function(){J(t);let r=S(2);return Z(r.openPluginConfig())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"plugins.button_settings")," "))}function yne(e,i){if(e&1&&(T(0,fne,3,3,"button",11),T(1,bne,3,3,"button",73)),e&2){let t=S();z(t.configBlocks.length?0:-1),m(),z(t.configBlocks.length?-1:1)}}var ej=(()=>{class e{$activeModal=j(It);$api=j(Xe);$modal=j(vi);$plugin=j(qr);$router=j(Is);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);bridgeConfigs=new Map;originalScheduledRestartCrons=new Map;originalHideAlerts=new Map;plugin;schema;justInstalled=!1;loading=!0;canConfigure=!0;configBlocks=[];selectedBlock="0";isPlatform;enabledBlocks={};bridgeCache=new Map;originalBridges=[];deviceInfo=new Map;saveInProgress=!1;canShowBridgeDebug=!1;deleteBridges=[];deletingPairedBridge=!1;accessoryBridgeLinks=[];bridgesAvailableForLink=[];currentlySelectedLink=null;currentBridgeHasLinks=!1;defaultIcon="assets/hb-icon.png";linkChildBridges='<a href="https://github.com/homebridge/homebridge/wiki/Child-Bridges" target="_blank"><i class="fas fa-external-link-alt primary-text"></i></a>';linkDebug='<a href="https://github.com/homebridge/homebridge-config-ui-x/wiki/Debug-Common-Values" target="_blank"><i class="fa fa-external-link-alt primary-text"></i></a>';linkCron='<a href="https://crontab.guru/" target="_blank" rel="noopener noreferrer"><i class="fa fa-external-link-alt primary-text"></i></a>';ngOnInit(){return ge(this,null,function*(){yield Promise.all([this.getPluginType(),this.loadPluginConfig(),this.loadBridgeConfigs()]),this.canShowBridgeDebug=this.$settings.isFeatureEnabled("childBridgeDebugMode"),this.loading=!1})}handleIconError(){this.plugin.icon=this.defaultIcon}onBlockChange(t){if(this.selectedBlock=t,this.currentlySelectedLink=this.accessoryBridgeLinks.find(s=>s.index===t)||null,this.currentBridgeHasLinks=this.accessoryBridgeLinks.some(s=>s.usesIndex===t),this.bridgesAvailableForLink=[],this.configBlocks[Number(t)].accessory)for(let[s,r]of Array.from(this.bridgeCache.entries()))this.enabledBlocks[s]&&!this.deleteBridges.some(o=>o.id===r.username)&&s<Number(t)&&this.bridgesAvailableForLink.push({index:s.toString(),usesIndex:t,name:r.name,port:r.port,username:r.username})}onLinkBridgeChange(t){if(t){let s=this.configBlocks.findIndex(o=>o._bridge?.username===t);this.accessoryBridgeLinks.push({index:this.selectedBlock,usesIndex:s.toString(),name:this.bridgeCache.get(s)?.name,port:this.bridgeCache.get(s)?.port,username:t}),this.currentlySelectedLink=this.accessoryBridgeLinks.find(o=>o.index===this.selectedBlock)||null,this.enabledBlocks[Number(this.selectedBlock)]=!0;let r=this.configBlocks[Number(this.selectedBlock)];r._bridge={username:t}}}getPluginType(){return ge(this,null,function*(){try{let t=yield Ae(this.$api.get(`/plugins/alias/${encodeURIComponent(this.plugin.name)}`));this.isPlatform=t.pluginType==="platform"}catch(t){this.$toastr.error(this.$translate.instant("plugins.config.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close(),console.error(t)}})}loadPluginConfig(){return ge(this,null,function*(){try{this.configBlocks=yield Ae(this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`));for(let[s,r]of this.configBlocks.entries())if(r._bridge&&(this.enabledBlocks[s]=!0),r._bridge&&r._bridge.username){let o=Array.from(this.bridgeCache.entries()).find(([,u])=>u.username===r._bridge.username),l=o?o[0]:-1,c=o?o[1]:void 0;if(c)r._bridge.env={},this.accessoryBridgeLinks.push({index:s.toString(),usesIndex:l.toString(),name:c.name,port:c.port,username:r._bridge.username});else{if(r._bridge.env=r._bridge.env||{},this.bridgeCache.set(s,r._bridge),yield this.getDeviceInfo(r._bridge.username),!r._bridge.name){let u=this.deviceInfo.get(r._bridge.username);u&&(r._bridge.name=u.displayName)}this.originalBridges.push(JSON.parse(JSON.stringify(r._bridge)))}}if(this.justInstalled&&this.bridgeCache.size===0&&this.configBlocks.forEach((s,r)=>{this.enabledBlocks[r]=!0,this.toggleExternalBridge(s,!0,r.toString())}),this.accessoryBridgeLinks.find(s=>s.username===this.bridgeCache.get(Number(this.selectedBlock))?.username)&&(this.currentBridgeHasLinks=!0),this.currentlySelectedLink=this.accessoryBridgeLinks.find(s=>s.index===this.selectedBlock)||null,this.configBlocks[Number(this.selectedBlock)]?.accessory)for(let[s,r]of Array.from(this.bridgeCache.entries()))this.enabledBlocks[s]&&!this.deleteBridges.some(o=>o.id===r.username)&&s<Number(this.selectedBlock)&&this.bridgesAvailableForLink.push({index:s.toString(),usesIndex:this.selectedBlock,name:r.name,port:r.port,username:r.username})}catch(t){this.canConfigure=!1,console.error(t)}})}toggleExternalBridge(t,s,r){return ge(this,null,function*(){if(s){let o=this.bridgeCache.get(Number(r));t._bridge={username:o?o.username:this.generateUsername(),port:yield this.getUnusedPort(),name:o?.name||this.sanitizeBridgeName(this.plugin.displayName||this.plugin.name),model:o?.model,manufacturer:o?.manufacturer,firmwareRevision:o?.firmwareRevision,debugModeEnabled:o?.debugModeEnabled,env:o?.env||{}},this.deleteBridges.some(l=>l.id===t._bridge.username)&&(this.deleteBridges=this.deleteBridges.filter(l=>l.id!==t._bridge.username)),this.bridgeCache.set(Number(r),t._bridge),yield this.getDeviceInfo(t._bridge.username)}else{if(this.enabledBlocks[Number(r)]=!1,this.accessoryBridgeLinks.some(o=>o.index===r))this.accessoryBridgeLinks=this.accessoryBridgeLinks.filter(o=>o.index!==r),this.currentlySelectedLink=null;else{let o=this.originalBridges.find(l=>l.username===t._bridge.username);if(o&&!this.deleteBridges.some(l=>l.id===t._bridge.username)){let l=this.deviceInfo.get(t._bridge.username);this.deleteBridges.push({id:t._bridge.username,bridgeName:t._bridge.name||o.displayName,paired:l?l._isPaired:!1})}}delete t._bridge}this.deletingPairedBridge=this.deleteBridges.some(o=>o.paired)})}getUnusedPort(){return ge(this,null,function*(){try{return(yield Ae(this.$api.get("/server/port/new"))).port}catch{return Math.floor(Math.random()*30001+3e4)}})}getDeviceInfo(t){return ge(this,null,function*(){try{this.deviceInfo.set(t,yield Ae(this.$api.get(`/server/pairings/${t.replace(/:/g,"")}`)))}catch(s){console.error(s),this.deviceInfo.set(t,!1)}})}sanitizeBridgeName(t){if(!t)return t;let s=t.replace(/[^\p{L}\p{N} ']/gu,"");return s=s.replace(/^[ ']+|[ ']+$/g,""),s=s.replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu,""),s}getHapNameValidationError(t){let s=this.configBlocks[Number(t)];if(!s._bridge?.name)return!1;let r=s._bridge.name;return!/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u.test(r)}get hasValidationErrors(){for(let[t,s]of this.configBlocks.entries())if(this.enabledBlocks[t]&&s._bridge?.username&&(this.getHapNameValidationError(t.toString())||this.getHapPortValidationError(t.toString())))return!0;return!1}getHapPortValidationError(t){let r=this.configBlocks[Number(t)]._bridge?.port;if(!r&&r!==0)return!1;if(typeof r!="number"||!Number.isInteger(r)||r<1025||r>65533)return!0;for(let[o,l]of this.configBlocks.entries())if(o.toString()!==t&&this.enabledBlocks[o]&&l._bridge?.port===r)return!0;return!1}save(){return ge(this,null,function*(){this.saveInProgress=!0;try{for(let[u,p]of this.configBlocks.entries())if(p._bridge?.username){if(this.getHapNameValidationError(u.toString())){this.$toastr.error(this.$translate.instant("plugins.bridge.name_error"),this.$translate.instant("toast.title_error")),this.saveInProgress=!1;return}if(this.getHapPortValidationError(u.toString())){this.$toastr.error(this.$translate.instant("plugins.bridge.port_error",{type:"HAP"}),this.$translate.instant("toast.title_error")),this.saveInProgress=!1;return}}yield Ae(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,this.configBlocks));for(let u of this.deleteBridges)try{yield Ae(this.$api.delete(`/server/pairings/${u.id.replace(/:/g,"")}`))}catch(p){console.error(p),this.$toastr.error(this.$translate.instant("settings.reset_bridge.error"),this.$translate.instant("toast.title_error"))}let t=this.hasScheduledRestartCronChanged(),s=this.hasHideAlertsChanged(),r=this.hasBridgeConfigChanged(),o=this.deleteBridges.length>0,l=!t&&!s&&!r&&!o,c=s&&!t&&!r&&!o;for(let[u,p]of this.bridgeConfigs.entries()){if(this.deleteBridges.some(x=>x.id===u))continue;let _=this.originalHideAlerts.get(u),f=!!p.hideHapAlert,H=_?!!_.hideHapAlert:!1;try{f!==H&&(yield this.saveHideAlert(u,f))}catch(x){console.error(x)}}for(let[u,p]of this.bridgeConfigs.entries()){if(this.deleteBridges.some(P=>P.id===u))continue;let _=p.scheduledRestartCron||null,f=this.originalScheduledRestartCrons.get(u)||null,H=_===""?null:_;if(H!==(f===""?null:f))try{yield this.saveScheduledRestartCron(u,H)}catch(P){console.error(P)}}if(t)try{yield Ae(this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}))}catch(u){console.error(u)}l?this.$activeModal.close():c?this.$activeModal.close("refresh"):(this.$activeModal.close(),this.$modal.open(Ys,{size:"lg",backdrop:"static"}))}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error"))}finally{this.saveInProgress=!1}})}openPluginConfig(){this.$activeModal.close(),this.$plugin.settings({name:this.plugin.name,settingsSchema:!0,links:{}})}generateUsername(){let t="0123456789ABCDEF",s="0E:";for(let r=0;r<5;r+=1)s+=t.charAt(Math.round(Math.random()*15)),s+=t.charAt(Math.round(Math.random()*15)),r!==4&&(s+=":");return s}openFullConfigEditor(){this.$router.navigate(["/config"]),this.$activeModal.close()}dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(){this.$activeModal.close("Dismiss")}loadBridgeConfigs(){return ge(this,null,function*(){let t=this.$settings.env.bridges||[];this.bridgeConfigs.clear(),this.originalScheduledRestartCrons.clear(),this.originalHideAlerts.clear();for(let s of t){let r=s.username.toUpperCase();this.bridgeConfigs.set(r,s),this.originalScheduledRestartCrons.set(r,s.scheduledRestartCron||null),this.originalHideAlerts.set(r,{hideHapAlert:s.hideHapAlert})}})}isUnpairingHidden(t){let s=this.bridgeConfigs.get(t.toUpperCase());return s?!!s.hideHapAlert:!1}toggleHideUnpairing(t){let s=t.toUpperCase(),o=!this.isUnpairingHidden(t),l=this.bridgeConfigs.get(s);l||(l={username:s},this.bridgeConfigs.set(s,l)),o?l.hideHapAlert=!0:delete l.hideHapAlert}getScheduledRestartCron(t){return t&&this.bridgeConfigs.get(t.toUpperCase())?.scheduledRestartCron||""}onScheduledRestartCronChange(t,s){if(!s)return;let r=s.toUpperCase(),o=this.bridgeConfigs.get(r);o||(o={username:r},this.bridgeConfigs.set(r,o));let l=t?.trim();l?o.scheduledRestartCron=l:delete o.scheduledRestartCron}hasScheduledRestartCronChanged(){for(let[t,s]of this.bridgeConfigs.entries()){let r=s.scheduledRestartCron||null,o=this.originalScheduledRestartCrons.get(t)||null;if((r===""?null:r)!==(o===""?null:o))return!0}return!1}hasBridgeConfigChanged(){if(this.configBlocks.length!==this.originalBridges.length)return!0;for(let[,t]of this.configBlocks.entries()){if(!t._bridge)continue;let s=this.originalBridges.find(l=>l.username===t._bridge.username);if(!s||t._bridge.name!==s.name||t._bridge.port!==s.port||t._bridge.model!==s.model||t._bridge.manufacturer!==s.manufacturer||t._bridge.firmwareRevision!==s.firmwareRevision||t._bridge.debugModeEnabled!==s.debugModeEnabled)return!0;let r=t._bridge.env||{},o=s.env||{};if(r.DEBUG!==o.DEBUG||r.NODE_OPTIONS!==o.NODE_OPTIONS)return!0}return!1}hasHideAlertsChanged(){for(let[t,s]of this.bridgeConfigs.entries()){let r=this.originalHideAlerts.get(t),o=!!s.hideHapAlert,l=r?!!r.hideHapAlert:!1;if(o!==l)return!0}return!1}updateLocalBridgeConfig(t,s){let r=t.toUpperCase(),o=this.$settings.env.bridges||[],l=o.findIndex(c=>c.username.toUpperCase()===r);l!==-1?Object.assign(o[l],s):o.push(pe({username:r},s)),this.$settings.env.bridges=o}saveHideAlert(t,s){return ge(this,null,function*(){let r=t.toUpperCase(),o=`/config-editor/ui/bridges/${encodeURIComponent(r)}/hide-hap-alert`;try{yield Ae(this.$api.put(o,{value:s})),this.updateLocalBridgeConfig(r,{hideHapAlert:s})}catch(l){throw console.error("Failed to update hide alert:",l),l}})}saveScheduledRestartCron(t,s){return ge(this,null,function*(){let r=t.toUpperCase();try{if(yield Ae(this.$api.put(`/config-editor/ui/bridges/${encodeURIComponent(r)}/scheduled-restart-cron`,{value:s||null})),s)this.updateLocalBridgeConfig(r,{scheduledRestartCron:s});else{let o=this.$settings.env.bridges||[],l=o.findIndex(c=>c.username.toUpperCase()===r);l!==-1&&(delete o[l].scheduledRestartCron,this.$settings.env.bridges=o)}}catch(o){throw console.error("Failed to update scheduled restart cron:",o),o}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",schema:"schema",justInstalled:"justInstalled"},decls:16,vars:8,consts:[["bridgeLinkSelect",""],[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"disabled"],[1,"modal-body"],[1,"text-center","primary-text","my-5","w-100"],[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",1,"btn","btn-primary",3,"disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click","disabled"],[1,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],["alt","Plugin Icon",1,"mb-3","plugin-icon-card",3,"error","src"],[1,"mb-3"],[3,"innerHTML"],["type","error",1,"mt-3","mb-0",3,"dismissible"],["type","info",3,"dismissible"],["type","info",1,"mb-0",3,"dismissible"],[1,"list-group","list-group-box","mb-0"],[1,"list-group","list-group-box","mt-3","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","flex-row","pb-2"],[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"],["for","bridgeLink",1,"mb-2","mb-md-0","w-100","w-md-50"],["id","bridgeLink",1,"custom-select",3,"change"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50","grey-text"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox",1,"rendux-input",3,"change","ngModelChange","id","ngModel"],[1,"rendux-label",3,"for"],[1,"text-start","text-md-end","w-100","w-md-50","grey-text","font-monospace"],["type","text",1,"form-control","custom-input",3,"ngModelChange","ngModel","ngClass"],["type","text",1,"form-control","custom-input",3,"ngModelChange","placeholder","ngModel"],["type","text",1,"form-control","custom-input",3,"ngModelChange","ngClass","placeholder","ngModel"],[1,"badge","badge-primary","ms-1"],[1,"grey-text",3,"innerHtml"],[1,"text-start","text-md-end","w-100","w-md-50","d-flex","flex-column","align-items-end"],["type","text","placeholder","mm hh dd MM ww","maxlength","30",1,"form-control","custom-input","font-monospace",3,"input","value"],[1,"font-monospace"],[1,"grey-text",3,"innerHTML"],["type","text","placeholder","HAP-NodeJS:Advertiser,HAP-NodeJS:Service",1,"form-control","custom-input","font-monospace",3,"ngModelChange","ngModel"],[1,"grey-text"],["type","text","placeholder","--max-old-space-size=512 --max-http-header-size=8192",1,"form-control","custom-input","font-monospace",3,"ngModelChange","ngModel"],["type","checkbox",1,"rendux-input",3,"ngModelChange","id","ngModel"],[1,"fas","fa-xl","fa-hap","me-2","my-2"],[1,"list-group-item","text-center"],["type","number","min","1025","max","65533",1,"form-control","custom-input","font-monospace",3,"ngModelChange","ngModel","ngClass"],[1,"w-100","d-flex","flex-column","text-center"],[1,"mx-auto","d-flex","align-items-center","justify-content-center","qr-code-placeholder","primary-text","p-3"],[1,"text-center","grey-text"],[1,"fas","fa-qrcode","fa-2x","mb-2","primary-text"],[1,"text-center","small","grey-text"],[1,"mx-auto",2,"width","175px","height","175px",3,"data"],[1,"mx-auto","mt-3","mb-1","font-monospace"],[1,"grey-text","mx-auto","small","mb-1",2,"max-width","400px"],[1,"fas","fa-link",3,"ngClass"],["type","checkbox",1,"rendux-input",3,"change","id","checked"],[1,"d-inline-block","text-start","mb-0"],[1,"fas","fa-lg","fa-hap","me-1"],[1,"grey-text","font-monospace"],[1,"btn","btn-primary","mb-0",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-circle-notch","fa-spin"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click"]],template:function(s,r){s&1&&(y(0,"div",1)(1,"div",2)(2,"h5",3),D(3),b(),T(4,Roe,2,4,"button",4),b(),y(5,"div",5),T(6,Eoe,2,0,"div",6),T(7,dne,10,12),b(),y(8,"div",7)(9,"div",8),T(10,une,3,4,"button",9),b(),y(11,"div",10),T(12,pne,4,5,"button",11),T(13,mne,3,3,"button",12),b(),y(14,"div",13),T(15,yne,2,2),b()()()),s&2&&(m(3),re(r.plugin.displayName||r.plugin.name),m(),z(r.justInstalled?-1:4),m(2),z(r.loading?6:-1),m(),z(r.loading?-1:7),m(3),z(r.canConfigure&&!r.justInstalled?10:-1),m(2),z(r.justInstalled?12:-1),m(),z(r.canConfigure?-1:13),m(2),z(r.canConfigure&&!r.justInstalled?15:-1))},dependencies:[us,Sr,Cr,ro,Iv,kr,Fo,Qt,zv,Tv,Wi,Oo,Vv,yi,Pt],styles:[".manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}.qr-code-placeholder[_ngcontent-%COMP%]{width:175px;height:175px;border:2px solid currentColor;border-radius:8px;background-color:#f8f9fa;padding:20px} body.dark-mode .qr-code-placeholder, [class*=config-ui-x-dark-mode] .qr-code-placeholder{background-color:#1a1a1a}"]})}return e})();var ff=xt(Yc(),1);var Nu=()=>["homebridge","homebridge-config-ui-x"],tj=(e,i,t)=>({pluginName:e,minVersion:i,installedVersion:t}),vne=(e,i,t)=>({minVersion:e,installedVersion:i,latestVersion:t,packageName:"Homebridge"}),wne=()=>({packageName:"Homebridge"}),kne=(e,i,t)=>({minVersion:e,installedVersion:i,latestVersion:t,packageName:"Homebridge UI"}),Hne=()=>({packageName:"Homebridge UI"});function Sne(e,i){if(e&1&&(y(0,"li",14)(1,"div",17),U(2,"i",18),b(),y(3,"div",19),D(4),R(5,"translate"),b()()),e&2){let t=S(2);m(4),oe(" ",mt(5,1,"plugins.compat.node_too_low",ci(4,tj,t.plugin.displayName,t.nodeMinVersion,t.nodeInstalledVersion))," ")}}function Cne(e,i){if(e&1&&(y(0,"li",14)(1,"div",17),U(2,"i",18),b(),y(3,"div",19),D(4),R(5,"translate"),b()()),e&2){let t=S(2);m(4),oe(" ",mt(5,1,"plugins.compat.hb_too_low",ci(4,tj,t.plugin.displayName,t.hbMinVersion,t.hbInstalledVersion))," ")}}function xne(e,i){if(e&1&&(y(0,"div",11),U(1,"i",12),b(),y(2,"ul",13),T(3,Sne,6,8,"li",14),T(4,Cne,6,8,"li",14),b(),y(5,"ngb-alert",15)(6,"p",16),D(7),R(8,"translate"),b()()),e&2){let t=S();m(),he(pv("",t.action==="install"?"far fa-arrow-alt-circle-down":t.action==="update"?"far fa-arrow-alt-circle-up":"fas fa-code-compare"," primary-text")),m(2),z(t.isValidNode?-1:3),m(),z(t.isValidHb?-1:4),m(),N("dismissible",!1),m(2),re(O(8,7,"common.phrases.are_you_sure"))}}function Ine(e,i){if(e&1&&(y(0,"div",11),U(1,"i",20),b(),y(2,"ul",13)(3,"li",14)(4,"div",17),U(5,"i",18),b(),y(6,"div",19),D(7),R(8,"translate"),b()()(),y(9,"ngb-alert",15)(10,"p",21),D(11),R(12,"translate"),b(),y(13,"p",16)(14,"a",22),D(15),R(16,"translate"),U(17,"i",23),b()()()),e&2){let t=S();m(7),oe(" ",mt(8,4,"plugins.compat.hb_node_too_low",ci(12,vne,t.nodeMinVersion,t.nodeInstalledVersion,t.plugin.latestVersion))," "),m(2),N("dismissible",!1),m(2),re(mt(12,7,"plugins.compat.node_first",st(16,wne))),m(4),oe(" ",O(16,10,"plugins.compat.node_link")," ")}}function Pne(e,i){if(e&1&&(y(0,"div",11),U(1,"i",20),b(),y(2,"ul",13)(3,"li",14)(4,"div",17),U(5,"i",18),b(),y(6,"div",19),D(7),R(8,"translate"),b()()(),y(9,"ngb-alert",15)(10,"p",21),D(11),R(12,"translate"),b(),y(13,"p",16)(14,"a",22),D(15),R(16,"translate"),U(17,"i",23),b()()()),e&2){let t=S();m(7),oe(" ",mt(8,4,"plugins.compat.hb_node_too_low",ci(12,kne,t.nodeMinVersion,t.nodeInstalledVersion,t.plugin.latestVersion))," "),m(2),N("dismissible",!1),m(2),re(mt(12,7,"plugins.compat.node_first",st(16,Hne))),m(4),oe(" ",O(16,10,"plugins.compat.node_link")," ")}}function Tne(e,i){if(e&1){let t=ie();y(0,"button",24),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"form.button_close")," "))}function zne(e,i){if(e&1){let t=ie();y(0,"button",24),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"form.button_close")," "))}function Ane(e,i){if(e&1){let t=ie();y(0,"button",25),Q("click",function(){J(t);let r=S();return Z(r.closeModal())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"form.button_continue")," "))}var ij=(()=>{class e{$activeModal=j(It);$settings=j(Tt);plugin;isValidNode;isValidHb;action;nodeMinVersion;nodeInstalledVersion;hbMinVersion;hbInstalledVersion;ngOnInit(){this.nodeMinVersion=(0,ff.minVersion)(this.plugin.updateEngines?.node),this.nodeInstalledVersion=this.$settings.env.nodeVersion,this.hbMinVersion=(0,ff.minVersion)(this.plugin.updateEngines?.homebridge),this.hbInstalledVersion=this.$settings.env.homebridgeVersion}dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(){this.$activeModal.close(!0)}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",isValidNode:"isValidNode",isValidHb:"isValidHb",action:"action"},decls:18,vars:16,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,"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-danger"],[1,"text-center","mb-3"],[2,"font-size","75px"],[1,"list-group","list-group-box","mb-3","text-start"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],["type","warning",1,"mb-0",3,"dismissible"],[1,"text-center","mb-0"],[1,"me-3"],[1,"fas","fa-exclamation-circle","orange-text","fa-xl"],[1,"text-start","flex-grow-1"],[1,"fab","fa-node-js","primary-text",2,"font-size","75px"],[1,"text-center","mb-1"],["href","https://homebridge.io/w/JTKEF","target","_blank","rel","noopener noreferrer"],[1,"fa","fa-external-link-alt"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),R(4,"translate"),b(),y(5,"button",3),R(6,"translate"),Q("click",function(){return r.dismissModal()}),b()(),y(7,"div",4),T(8,xne,9,9),T(9,Ine,18,17),T(10,Pne,18,17),b(),y(11,"div",5)(12,"div",6),T(13,Tne,3,3,"button",7),b(),y(14,"div",8),T(15,zne,3,3,"button",7),b(),y(16,"div",9),T(17,Ane,3,3,"button",10),b()()()),s&2&&(m(3),re(O(4,8,"plugins.compat.title")),m(2),me("aria-label",O(6,10,"form.button_close")),m(3),z(st(12,Nu).includes(r.plugin.name)?-1:8),m(),z(r.plugin.name==="homebridge"?9:-1),m(),z(r.plugin.name==="homebridge-config-ui-x"?10:-1),m(3),z(st(13,Nu).includes(r.plugin.name)?-1:13),m(2),z(st(14,Nu).includes(r.plugin.name)?15:-1),m(2),z(st(15,Nu).includes(r.plugin.name)?-1:17))},dependencies:[Oo,Pt],encapsulation:2})}return e})();var sj=xt(da(),1);var rj=(()=>{class e{$api=j(Xe);$toastr=j(ot);$translate=j(rt);downloadDumpFile(){this.$api.get("/plugins/custom-plugins/homebridge-deconz/dump-file",{observe:"response",responseType:"blob"}).subscribe({next:t=>{(0,sj.saveAs)(t.body,"homebridge-deconz.json.gz")},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("plugins.settings.deconz.dump_no_exist"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["app-homebridge-deconz"]],decls:3,vars:0,consts:[["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-download"]],template:function(s,r){s&1&&(oa(0,"button",0),Ec("click",function(){return r.downloadDumpFile()}),aa(1,"i",1),D(2,` Download Dump File
|
|
102
102
|
`),na())},encapsulation:2})}return e})();var oj=xt(da(),1);var nj=(()=>{class e{$api=j(Xe);$translate=j(rt);$toastr=j(ot);downloadDumpFile(){this.$api.get("/plugins/custom-plugins/homebridge-hue/dump-file",{observe:"response",responseType:"blob"}).subscribe({next:t=>{(0,oj.saveAs)(t.body,"homebridge-hue.json.gz")},error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("plugins.settings.hue.dump_no_exist"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["app-homebridge-hue"]],decls:3,vars:0,consts:[["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant","m-0",3,"click"],[1,"fas","fa-download"]],template:function(s,r){s&1&&(oa(0,"button",0),Ec("click",function(){return r.downloadDumpFile()}),aa(1,"i",1),D(2,` Download Dump File
|
|
103
103
|
`),na())},encapsulation:2})}return e})();var aj=(e,i,t)=>({"fa-circle-check green-text":e,"fa-circle-exclamation red-text":i,"fa-circle-exclamation orange-text":t});function jne(e,i){if(e&1&&(U(0,"markdown",5),R(1,"interpolateMd")),e&2){let t=S();N("data",O(1,1,t.schema.headerDisplay))}}function Dne(e,i){if(e&1){let t=ie();y(0,"button",31),R(1,"translate"),Q("click",function(){J(t);let r=S().$implicit,o=S(2);return Z(o.removeBlock(r.__uuid__))}),U(2,"i",32),b()}e&2&&N("ngbTooltip",O(1,2,"form.button_delete"))("openDelay",150)}function Nne(e,i){if(e&1){let t=ie();y(0,"div",19)(1,"div",20)(2,"div",21)(3,"h5",22),D(4),b(),y(5,"div",23),T(6,Dne,3,4,"button",24),y(7,"button",25),R(8,"translate"),U(9,"i",26),b(),U(10,"i",27),R(11,"translate"),b()()(),y(12,"div",28)(13,"div",29)(14,"app-schema-form",30),ct("dataChange",function(r){let o=J(t).$implicit;return lt(o.config,r)||(o.config=r),Z(r)}),Q("isValid",function(r){let o=J(t).$index,l=S(2);return Z(l.onIsValid(r,o))}),b()()()()}if(e&2){let t=i.$implicit,s=i.$index,r=S(2);N("ngbAccordionItem",t.__uuid__)("collapsed",r.show!==t.__uuid__)("id",t.__uuid__),m(4),re(t.name),m(2),z(r.plugin.name!=="homebridge-config-ui-x"&&r.show===t.__uuid__?6:-1),m(),N("ngbTooltip",O(8,12,"form.button_edit"))("openDelay",150),m(3),N("ngClass",ci(16,aj,r.formBlocksValid[s],r.strictValidation&&!r.formBlocksValid[s],!r.strictValidation&&!r.formBlocksValid[s]))("ngbTooltip",O(11,14,r.formBlocksValid[s]?"form.label_valid":r.strictValidation?"form.label_invalid_strict":"form.label_invalid"))("openDelay",150),m(4),N("configSchema",r.schema),at("data",t.config)}}function Rne(e,i){if(e&1){let t=ie();y(0,"div",18),Q("show",function(r){J(t);let o=S();return Z(o.blockShown(r))})("hide",function(r){J(t);let o=S();return Z(o.blockHidden(r))}),Ze(1,Nne,15,20,"div",19,Je),b()}if(e&2){let t=S();N("closeOthers",!0),m(),Qe(t.pluginConfig)}}function Ene(e,i){e&1&&U(0,"app-homebridge-deconz")}function Bne(e,i){e&1&&U(0,"app-homebridge-hue")}function Mne(e,i){if(e&1){let t=ie();y(0,"div",7)(1,"app-schema-form",30),ct("dataChange",function(r){J(t);let o=S();return lt(o.pluginConfig[0].config,r)||(o.pluginConfig[0].config=r),Z(r)}),Q("isValid",function(r){J(t);let o=S();return Z(o.onIsValid(r,0))}),b(),T(2,Ene,1,0,"app-homebridge-deconz"),T(3,Bne,1,0,"app-homebridge-hue"),b()}if(e&2){let t=S();m(),N("configSchema",t.schema),at("data",t.pluginConfig[0].config),m(),z(t.plugin.name==="homebridge-deconz"?2:-1),m(),z(t.plugin.name==="homebridge-hue"?3:-1)}}function Une(e,i){if(e&1&&(y(0,"div",8),U(1,"markdown",5),R(2,"interpolateMd"),b()),e&2){let t=S();m(),N("data",O(2,1,t.schema.footerDisplay))}}function Fne(e,i){if(e&1&&(U(0,"i",14),R(1,"translate")),e&2){let t=S();N("ngClass",ci(5,aj,t.formIsValid,t.strictValidation&&!t.formIsValid,!t.strictValidation&&!t.formIsValid))("ngbTooltip",O(1,3,t.formIsValid?"form.label_valid":t.strictValidation?"form.label_invalid_strict":"form.label_invalid"))("openDelay",150)}}function One(e,i){if(e&1){let t=ie();y(0,"button",33),Q("click",function(){J(t);let r=S();return Z(r.addBlock())}),U(1,"i",34),b()}}function Vne(e,i){e&1&&(y(0,"span"),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"form.button_save")))}function qne(e,i){e&1&&U(0,"i",17)}var lj=(()=>{class e{$activeModal=j(It);$api=j(Xe);$cb=j($o);$plugin=j(qr);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);plugin;schema;pluginAlias;pluginType;pluginConfig=[];form={};show="";saveInProgress;isFirstSave=!1;formBlocksValid={};formIsValid=!0;strictValidation=!1;ngOnInit(){this.pluginAlias=this.schema.pluginAlias,this.pluginType=this.schema.pluginType,this.strictValidation=this.schema.strictValidation,this.loadPluginConfig()}save(){return ge(this,null,function*(){this.saveInProgress=!0;let t=this.pluginConfig.map(s=>s.config);try{let s=yield Ae(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,t));if(this.saveInProgress=!1,this.plugin.name==="homebridge-config-ui-x")this.$settings.getAppSettings().catch(()=>{});else if(this.isFirstSave&&this.$settings.env.recommendChildBridges&&s[0]?.platform){this.$activeModal.close(),this.$plugin.bridgeSettings(this.plugin,!0);return}this.$activeModal.close(),yield this.$cb.openCorrectRestartModalForPlugin(this.plugin.name)}catch(s){console.error(s),this.$toastr.error(this.$translate.instant("config.failed_to_save_config"),this.$translate.instant("toast.title_error")),this.saveInProgress=!1}})}blockShown(t){this.show=t;for(let s of this.pluginConfig)s.name=s.config.name||s.name}blockHidden(t){this.show===t&&(this.show="")}addBlock(){let t=xn();this.pluginConfig.push({__uuid__:t,name:this.schema.pluginAlias,config:{[this.pluginType]:this.schema.pluginAlias}}),this.formBlocksValid[this.pluginConfig.length-1]=!1,this.blockShown(t)}removeBlock(t){let s=this.pluginConfig.findIndex(r=>r.__uuid__===t);this.pluginConfig.splice(s,1),delete this.formBlocksValid[s],Object.keys(this.formBlocksValid).length||(this.formIsValid=!0)}onIsValid(t,s){this.formBlocksValid[s]=t,this.formIsValid=Object.values(this.formBlocksValid).every(r=>r)}dismissModal(){this.$activeModal.dismiss("Dismiss")}closeModal(){this.$activeModal.close()}loadPluginConfig(){this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe({next:t=>{for(let s of t){let r={__uuid__:xn(),name:s.name||this.schema.pluginAlias,config:s};this.pluginConfig.push(r)}this.pluginConfig.length?this.show=this.pluginConfig[0].__uuid__:(this.isFirstSave=!0,this.addBlock()),this.plugin.name==="homebridge-hue"&&this.pluginConfig.length&&this.homebridgeHueFix(this.pluginConfig[0].config)},error:t=>{console.error(t),this.$toastr.error(t.error?.message||this.$translate.instant("plugins.config.load_error"),this.$translate.instant("toast.title_error"))}})}homebridgeHueFix(t){if(this.schema.schema.properties.users={type:"object",properties:{}},!(!t.users||typeof t.users!="object"))for(let s of Object.keys(t.users))this.schema.schema.properties.users.properties[s]={type:"string"}}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",schema:"schema"},decls:23,vars:18,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","pb-0"],[1,"plugin-md",3,"data"],["ngbAccordion","",3,"closeOthers"],[1,"card","card-body"],[1,"mt-3"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end","d-flex","align-items-center","justify-content-end"],["container","modal","placement","top","triggers","hover",1,"fa","fa-xl","me-2",3,"ngClass","ngbTooltip","openDelay"],["type","button","data-dismiss","modal",1,"btn","btn-elegant","me-2"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-circle-notch","fa-spin"],["ngbAccordion","",3,"show","hide","closeOthers"],[1,"card",3,"ngbAccordionItem","collapsed","id"],["ngbAccordionHeader","",1,"card-header"],[1,"d-flex","align-items-center","justify-content-between"],[1,"m-0"],[1,"d-flex","align-items-center"],["container","modal","placement","left","triggers","hover",1,"btn","btn-danger","ms-2",3,"ngbTooltip","openDelay"],["ngbAccordionToggle","","container","modal","placement","left","triggers","hover",1,"btn","btn-primary","ms-2","me-2",3,"ngbTooltip","openDelay"],[1,"fa","fa-edit"],["container","modal","placement","left","triggers","hover",1,"fa","fa-xl",3,"ngClass","ngbTooltip","openDelay"],["ngbAccordionCollapse",""],["ngbAccordionBody","",1,"card-body"],[3,"dataChange","isValid","configSchema","data"],["container","modal","placement","left","triggers","hover",1,"btn","btn-danger","ms-2",3,"click","ngbTooltip","openDelay"],[1,"fa","fa-trash"],["type","button","data-dismiss","modal",1,"btn","btn-elegant","me-2",3,"click"],[1,"fa","fa-plus"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),b(),y(4,"button",3),R(5,"translate"),Q("click",function(){return r.dismissModal()}),b()(),y(6,"div",4),T(7,jne,2,3,"markdown",5),T(8,Rne,3,1,"div",6),T(9,Mne,4,4,"div",7),T(10,Une,3,3,"div",8),b(),y(11,"div",9)(12,"div",10)(13,"button",11),Q("click",function(){return r.closeModal()}),D(14),R(15,"translate"),b()(),U(16,"div",12),y(17,"div",13),T(18,Fne,2,9,"i",14),T(19,One,2,0,"button",15),y(20,"button",16),Q("click",function(){return r.save()}),T(21,Vne,3,3,"span"),T(22,qne,1,0,"i",17),b()()()()),s&2&&(m(3),re(r.plugin.displayName||r.plugin.name),m(),N("disabled",r.saveInProgress),me("aria-label",O(5,14,"form.button_close")),m(3),z(r.schema.headerDisplay?7:-1),m(),z(r.pluginConfig.length&&!r.schema.singular?8:-1),m(),z(r.pluginConfig.length&&r.schema.singular?9:-1),m(),z(r.schema.footerDisplay?10:-1),m(3),N("disabled",r.saveInProgress),m(),oe(" ",O(15,16,"form.button_close")," "),m(4),z(r.schema.singular?18:-1),m(),z(r.schema.singular?-1:19),m(),N("disabled",r.saveInProgress||!r.formIsValid&&r.strictValidation),m(),z(r.saveInProgress?-1:21),m(),z(r.saveInProgress?22:-1))},dependencies:[qo,Vo,Lo,Wc,Gc,Kc,xr,Lc,qc,yi,ju,rj,nj,$c,Pt,Du],styles:[".manage-plugin-config-external-icons[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;line-height:1;color:#000;opacity:.5;background-color:transparent;border:0}"]})}return e})();var Lne=(e,i)=>({"green-text":e,"grey-text":i}),$ne=(e,i)=>({"btn-danger":e,"btn-elegant":i}),Kne=(e,i,t)=>({"fa-broom":e,"fa-undo":i,"fa-circle-notch fa-spin":t});function Gne(e,i){e&1&&(y(0,"div",12),U(1,"i",13),b(),y(2,"p",14),D(3),R(4,"translate"),b()),e&2&&(m(3),re(O(4,1,"reset.bridge_accessories.empty")))}function Wne(e,i){if(e&1){let t=ie();y(0,"li",18)(1,"span",19),U(2,"i",20),b(),y(3,"span",21),D(4),U(5,"br"),y(6,"small",22),U(7,"i",23),D(8," \xB7 "),y(9,"span",24),D(10),b()()(),y(11,"button",25),R(12,"translate"),Q("click",function(){let r=J(t).$implicit,o=S(2);return Z(o.toggleList(r._id))}),U(13,"i",26),b()()}if(e&2){let t=i.$implicit,s=S(2);m(4),oe(" ",t.name," "),m(3),N("ngClass",la(9,Lne,t._isPaired,!t._isPaired)),m(3),re(t._username),m(),N("disabled",s.clicked)("ngClass",la(12,$ne,!s.toDelete.includes(t._id),s.toDelete.includes(t._id))),me("aria-label",O(12,7,"form.button_delete")),m(2),N("ngClass",ci(15,Kne,!s.toDelete.includes(t._id),s.toDelete.includes(t._id)&&!s.clicked,s.toDelete.includes(t._id)&&s.clicked))}}function Yne(e,i){if(e&1&&(y(0,"div",12),U(1,"i",15),b(),y(2,"ul",16)(3,"li"),D(4),R(5,"translate"),b(),y(6,"li"),D(7),R(8,"translate"),b()(),y(9,"ul",17),Ze(10,Wne,14,19,"li",18,Je),b()),e&2){let t=S();m(4),re(O(5,2,"reset.bridge_accessories.list_1")),m(3),re(O(8,4,"reset.clear_cache_single.list_3")),m(3),Qe(t.pairings)}}function Jne(e,i){if(e&1){let t=ie();y(0,"button",27),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(1),R(2,"translate"),b()}if(e&2){let t=S();N("disabled",t.clicked),m(),oe(" ",O(2,2,"form.button_close")," ")}}function Zne(e,i){if(e&1){let t=ie();y(0,"button",28),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(1),R(2,"translate"),b()}e&2&&(m(),oe(" ",O(2,1,"form.button_close")," "))}function Qne(e,i){if(e&1&&D(0),e&2){let t=S(3);oe(" (",t.toDelete.length,") ")}}function Xne(e,i){if(e&1&&(D(0),R(1,"translate"),T(2,Qne,1,1)),e&2){let t=S(2);oe(" ",O(1,2,"form.button_reset")," "),m(2),z(t.toDelete.length>0?2:-1)}}function eae(e,i){e&1&&U(0,"i",30)}function tae(e,i){if(e&1){let t=ie();y(0,"button",29),Q("click",function(){J(t);let r=S();return Z(r.cleanBridges())}),T(1,Xne,3,4),T(2,eae,1,0,"i",30),b()}if(e&2){let t=S();N("disabled",!t.toDelete.length||t.clicked),m(),z(t.clicked?-1:1),m(),z(t.clicked?2:-1)}}var cj=(()=>{class e{$activeModal=j(It);$api=j(Xe);$router=j(Is);$toastr=j(ot);$translate=j(rt);childBridges=[];clicked=!1;pairings=[];toDelete=[];ngOnInit(){this.loadPairings()}toggleList(t){this.toDelete.includes(t)?this.toDelete=this.toDelete.filter(s=>s!==t):this.toDelete.push(t)}cleanBridges(){return this.clicked=!0,this.$api.delete("/server/pairings/accessories",{body:this.toDelete.map(t=>({id:t}))}).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:t=>{this.clicked=!1,console.error(t),this.$toastr.error(this.$translate.instant("reset.accessory_ind.fail"),this.$translate.instant("toast.title_error"))}})}dismissModal(){this.$activeModal.dismiss("Dismiss")}loadPairings(){return ge(this,null,function*(){try{this.pairings=(yield Ae(this.$api.get("/server/pairings"))).filter(t=>t._category==="bridge"&&!t._main&&this.childBridges.find(s=>s.username===t._username)).sort((t,s)=>t.name.localeCompare(s.name))}catch(t){console.error(t),this.$toastr.error(this.$translate.instant("settings.unpair_bridge.load_error"),this.$translate.instant("toast.title_error")),this.$activeModal.close()}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{childBridges:"childBridges"},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-circle-check","primary-text",2,"font-size","75px"],[1,"mb-0","text-center"],[1,"fas","fa-broom","primary-text",2,"font-size","75px"],[1,"mb-3"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[1,"me-3"],[1,"fas","fa-lg","fa-hap"],[1,"flex-grow-1"],[1,"grey-text"],[1,"fas","fa-link",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-danger","m-0","ms-3",3,"click","disabled","ngClass"],[1,"fas",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-circle-notch","fa-spin"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),R(4,"translate"),b(),y(5,"button",3),R(6,"translate"),Q("click",function(){return r.dismissModal()}),b()(),y(7,"div",4),T(8,Gne,5,3),T(9,Yne,12,6),b(),y(10,"div",5)(11,"div",6),T(12,Jne,3,4,"button",7),b(),y(13,"div",8),T(14,Zne,3,3,"button",9),b(),y(15,"div",10),T(16,tae,3,3,"button",11),b()()()),s&2&&(m(3),re(O(4,8,"child_bridge.reset_accessories")),m(2),N("disabled",r.clicked),me("aria-label",O(6,10,"form.button_close")),m(3),z(r.pairings.length===0?8:-1),m(),z(r.pairings.length>0?9:-1),m(3),z(r.pairings.length>0?12:-1),m(2),z(r.pairings.length===0?14:-1),m(2),z(r.pairings.length>0?16:-1))},dependencies:[yi,Pt],encapsulation:2})}return e})();var uj=xt(da(),1);var iae=e=>({prefix:e}),sae=e=>({link:e}),dj=(e,i,t,s)=>({"fa-circle-o":e,"fa-circle-notch fa-spin":i,"fa-check-circle green-text":t,"fa-times-circle red-text":s}),rae=(e,i,t)=>({"fa-circle-o":e,"fa-circle-notch fa-spin":i,"fa-times-circle red-text":t});function oae(e,i){e&1&&(y(0,"li"),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"plugins.manage.scoped.process")))}function nae(e,i){e&1&&(U(0,"li",8),R(1,"translate"),y(2,"li"),D(3),R(4,"translate"),b()),e&2&&(N("innerHTML",O(1,2,"plugins.manage.scoped.windows"),Me),m(3),re(O(4,4,"plugins.manage.manual_update_command")))}function aae(e,i){if(e&1&&(y(0,"pre",9),D(1),b()),e&2){let t=S();m(),Oc(`hb-service stop
|
|
104
104
|
npm install -g `,t.plugin.newHbScope.to,"@",t.plugin.newHbScope.switch,`
|
|
105
105
|
npm uninstall -g `,t.plugin.newHbScope.from,`
|
|
106
|
-
hb-service start`)}}function lae(e,i){if(e&1&&(y(0,"div",10)(1,"ul",18)(2,"li"),U(3,"i",19),D(4),R(5,"translate"),y(6,"span",20),D(7),b()(),y(8,"li"),U(9,"i",19),D(10),R(11,"translate"),y(12,"span",20),D(13),b()(),y(14,"li"),U(15,"i",19),D(16),R(17,"translate"),b()()()),e&2){let t=S();m(3),N("ngClass",Uo(14,dj,!t.installing&&!t.installed&&!t.failure,t.installing,t.installed&&!t.failure,!t.installed&&t.failure)),m(),oe(" ",O(5,8,"plugins.manage.install")," "),m(3),re(t.plugin.newHbScope.to),m(2),N("ngClass",Uo(19,dj,!t.uninstalling&&!t.uninstalled&&!t.failure,t.uninstalling,t.uninstalled&&!t.failure,!t.uninstalled&&t.failure)),m(),oe(" ",O(11,10,"plugins.manage.uninstall")," "),m(3),re(t.plugin.newHbScope.from),m(2),N("ngClass",ci(24,rae,!t.restarting&&!t.failure,t.restarting,t.failure)),m(),oe(" ",O(17,12,"menu.hbrestart.title")," ")}}function cae(e,i){if(e&1){let t=ie();y(0,"div",11)(1,"p"),D(2),R(3,"translate"),b(),y(4,"p",20),D(5),b(),y(6,"button",21),Q("click",function(){J(t);let r=S();return Z(r.downloadLogFile())}),D(7),R(8,"translate"),b()()}if(e&2){let t=S();m(2),re(O(3,3,"plugins.manage.scoped.error")),m(3),re(t.failure),m(2),re(O(8,5,"form.button_download"))}}function dae(e,i){if(e&1){let t=ie();y(0,"button",22),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}if(e&2){let t=S();N("disabled",t.installing||t.uninstalling||t.restarting),me("aria-label",O(1,3,"form.button_close")),m(2),oe(" ",O(3,5,"form.button_close")," ")}}function uae(e,i){if(e&1){let t=ie();y(0,"button",22),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}if(e&2){let t=S();N("disabled",t.installing||t.uninstalling||t.restarting),me("aria-label",O(1,3,"form.button_close")),m(2),oe(" ",O(3,5,"form.button_close")," ")}}function gae(e,i){e&1&&(y(0,"span"),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"form.button_continue")))}function pae(e,i){e&1&&U(0,"i",24)}function mae(e,i){if(e&1){let t=ie();y(0,"button",23),Q("click",function(){J(t);let r=S();return Z(r.doSwitch())}),T(1,gae,3,3,"span"),T(2,pae,1,0,"i",24),b()}if(e&2){let t=S();N("disabled",t.installing||t.uninstalling||t.restarting||!t.onlineUpdateOk||t.failure),m(),z(!t.installing&&!t.uninstalling&&!t.restarting?1:-1),m(),z((t.installing||t.uninstalling||t.restarting)&&!t.failure?2:-1)}}var gj=(()=>{class e{$activeModal=j(It);$api=j(Xe);$router=j(Is);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);$ws=j(Pr);io;term;termTarget;fitAddon=new Jc;webLinksAddon=new Zc;errorLog="";plugin;installing=!1;installed=!1;uninstalling=!1;uninstalled=!1;restarting=!1;failure="";onlineUpdateOk;moreInfo='<a href="https://github.com/homebridge/plugins/wiki/Scoped-Plugins" target="_blank"><i class="fa fa-external-link-alt primary-text"></i></a>';prefix='<span class="font-monospace">@homebridge-plugins/</span>';constructor(){this.term=new Qc({theme:{background:"#00000000",foreground:this.$settings.actualLightingMode==="light"?"#333333":"#eeeeee",cursor:"#d2d2d2",selectionBackground:"#d2d2d2"},
|
|
106
|
+
hb-service start`)}}function lae(e,i){if(e&1&&(y(0,"div",10)(1,"ul",18)(2,"li"),U(3,"i",19),D(4),R(5,"translate"),y(6,"span",20),D(7),b()(),y(8,"li"),U(9,"i",19),D(10),R(11,"translate"),y(12,"span",20),D(13),b()(),y(14,"li"),U(15,"i",19),D(16),R(17,"translate"),b()()()),e&2){let t=S();m(3),N("ngClass",Uo(14,dj,!t.installing&&!t.installed&&!t.failure,t.installing,t.installed&&!t.failure,!t.installed&&t.failure)),m(),oe(" ",O(5,8,"plugins.manage.install")," "),m(3),re(t.plugin.newHbScope.to),m(2),N("ngClass",Uo(19,dj,!t.uninstalling&&!t.uninstalled&&!t.failure,t.uninstalling,t.uninstalled&&!t.failure,!t.uninstalled&&t.failure)),m(),oe(" ",O(11,10,"plugins.manage.uninstall")," "),m(3),re(t.plugin.newHbScope.from),m(2),N("ngClass",ci(24,rae,!t.restarting&&!t.failure,t.restarting,t.failure)),m(),oe(" ",O(17,12,"menu.hbrestart.title")," ")}}function cae(e,i){if(e&1){let t=ie();y(0,"div",11)(1,"p"),D(2),R(3,"translate"),b(),y(4,"p",20),D(5),b(),y(6,"button",21),Q("click",function(){J(t);let r=S();return Z(r.downloadLogFile())}),D(7),R(8,"translate"),b()()}if(e&2){let t=S();m(2),re(O(3,3,"plugins.manage.scoped.error")),m(3),re(t.failure),m(2),re(O(8,5,"form.button_download"))}}function dae(e,i){if(e&1){let t=ie();y(0,"button",22),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}if(e&2){let t=S();N("disabled",t.installing||t.uninstalling||t.restarting),me("aria-label",O(1,3,"form.button_close")),m(2),oe(" ",O(3,5,"form.button_close")," ")}}function uae(e,i){if(e&1){let t=ie();y(0,"button",22),R(1,"translate"),Q("click",function(){J(t);let r=S();return Z(r.dismissModal())}),D(2),R(3,"translate"),b()}if(e&2){let t=S();N("disabled",t.installing||t.uninstalling||t.restarting),me("aria-label",O(1,3,"form.button_close")),m(2),oe(" ",O(3,5,"form.button_close")," ")}}function gae(e,i){e&1&&(y(0,"span"),D(1),R(2,"translate"),b()),e&2&&(m(),re(O(2,1,"form.button_continue")))}function pae(e,i){e&1&&U(0,"i",24)}function mae(e,i){if(e&1){let t=ie();y(0,"button",23),Q("click",function(){J(t);let r=S();return Z(r.doSwitch())}),T(1,gae,3,3,"span"),T(2,pae,1,0,"i",24),b()}if(e&2){let t=S();N("disabled",t.installing||t.uninstalling||t.restarting||!t.onlineUpdateOk||t.failure),m(),z(!t.installing&&!t.uninstalling&&!t.restarting?1:-1),m(),z((t.installing||t.uninstalling||t.restarting)&&!t.failure?2:-1)}}var gj=(()=>{class e{$activeModal=j(It);$api=j(Xe);$router=j(Is);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);$ws=j(Pr);io;term;termTarget;fitAddon=new Jc;webLinksAddon=new Zc;errorLog="";plugin;installing=!1;installed=!1;uninstalling=!1;uninstalled=!1;restarting=!1;failure="";onlineUpdateOk;moreInfo='<a href="https://github.com/homebridge/plugins/wiki/Scoped-Plugins" target="_blank"><i class="fa fa-external-link-alt primary-text"></i></a>';prefix='<span class="font-monospace">@homebridge-plugins/</span>';constructor(){this.term=new Qc({theme:{background:"#00000000",foreground:this.$settings.actualLightingMode==="light"?"#333333":"#eeeeee",cursor:"#d2d2d2",selectionBackground:"#d2d2d2"},allowProposedApi:!0,allowTransparency:this.$settings.actualLightingMode==="light",fontSize:13,fontWeight:400,lineHeight:1.25}),this.term.loadAddon(this.fitAddon),this.term.loadAddon(this.webLinksAddon)}ngOnInit(){this.onlineUpdateOk=this.$settings.env.platform!=="win32",this.io=this.$ws.connectToNamespace("plugins"),this.termTarget=document.getElementById("plugin-output"),this.term.open(this.termTarget),this.fitAddon.fit(),this.io.socket.on("stdout",t=>{this.term.write(t);let s=t.toString().replace(/\x1B\[(\d{1,3}(;\d{1,2})?)?[mGK]/g,"").trimEnd();s&&(this.errorLog+=`${s}\r
|
|
107
107
|
`)})}doSwitch(){this.installing=!0,this.io.request("install",{name:this.plugin.newHbScope.to,version:this.plugin.newHbScope.switch,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.installing=!1,this.installed=!0,this.uninstalling=!0,this.io.request("uninstall",{name:this.plugin.newHbScope.from,termCols:this.term.cols,termRows:this.term.rows}).subscribe({next:()=>{this.uninstalling=!1,this.uninstalled=!0,this.restarting=!0,this.$api.put("/platform-tools/hb-service/set-full-service-restart-flag",{}).subscribe({next:()=>{this.$activeModal.close(),this.$router.navigate(["/restart"])},error:t=>{this.restarting=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})},error:t=>{this.uninstalling=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})},error:t=>{this.installing=!1,this.failure=t.message,console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}downloadLogFile(){let t=new Blob([this.errorLog],{type:"text/plain;charset=utf-8"});(0,uj.saveAs)(t,`${this.plugin.name}-error.log`)}ngOnDestroy(){this.io.end(),this.term.dispose()}dismissModal(){this.$activeModal.dismiss("Dismiss")}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin"},decls:31,vars:31,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,"mb-3","text-center"],[1,"fas","fa-arrow-right-arrow-left","primary-text",2,"font-size","75px"],[1,"mb-0"],[3,"innerHTML"],[1,"mt-3","mb-0"],[1,"text-center"],[1,"alert","alert-error","mb-0"],["id","plugin-output",1,"mb-0",3,"hidden"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"disabled"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"disabled"],[1,"d-inline-block","text-start","mt-3","mb-3",2,"list-style-type","none"],[1,"fa",3,"ngClass"],[1,"font-monospace"],[1,"btn","btn-primary","mb-0",3,"click"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click","disabled"],[1,"fas","fa-circle-notch","fa-spin"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),R(4,"translate"),b(),y(5,"button",3),R(6,"translate"),Q("click",function(){return r.dismissModal()}),b()(),y(7,"div",4)(8,"div",5),U(9,"i",6),b(),y(10,"ul",7),U(11,"li",8),R(12,"translate"),y(13,"li"),D(14),R(15,"translate"),b(),U(16,"li",8),R(17,"translate"),T(18,oae,3,3,"li"),T(19,nae,5,6),b(),T(20,aae,2,3,"pre",9),T(21,lae,18,28,"div",10),T(22,cae,9,7,"div",11),U(23,"div",12),b(),y(24,"div",13)(25,"div",14),T(26,dae,4,7,"button",15),b(),y(27,"div",10),T(28,uae,4,7,"button",15),b(),y(29,"div",16),T(30,mae,3,3,"button",17),b()()()),s&2&&(m(3),re(O(4,15,"plugins.manage.scoped.switch")),m(2),N("disabled",r.installing||r.uninstalling||r.restarting),me("aria-label",O(6,17,"form.button_close")),m(6),N("innerHTML",mt(12,19,"plugins.manage.scoped.info_1",li(27,iae,r.prefix)),Me),m(3),re(O(15,22,"plugins.manage.scoped_message")),m(2),N("innerHTML",mt(17,24,"plugins.manage.scoped.info_2",li(29,sae,r.moreInfo)),Me),m(2),z(r.onlineUpdateOk?18:-1),m(),z(r.onlineUpdateOk?-1:19),m(),z(r.onlineUpdateOk?-1:20),m(),z(r.onlineUpdateOk?21:-1),m(),z(r.failure?22:-1),m(),N("hidden",!r.onlineUpdateOk||r.failure),m(3),z(r.onlineUpdateOk?26:-1),m(2),z(r.onlineUpdateOk?-1:28),m(2),z(r.onlineUpdateOk?30:-1))},dependencies:[yi,Pt],styles:["#plugin-output[_ngcontent-%COMP%]{height:150px;overflow-y:auto;overflow-x:hidden}"]})}return e})();var _ae=e=>({pluginName:e}),hae=e=>({count:e});function fae(e,i){e&1&&(y(0,"div",5),U(1,"i",13),b())}function bae(e,i){e&1&&(D(0),R(1,"translate")),e&2&&oe(" ",O(1,1,"plugins.uninstall_remove_child_bridge")," ")}function yae(e,i){if(e&1&&(D(0),R(1,"translate")),e&2){let t=S(4);oe(" ",mt(1,1,"plugins.uninstall_remove_child_bridges",li(4,hae,t.childBridges.length))," ")}}function vae(e,i){if(e&1){let t=ie();y(0,"label",24)(1,"input",25),ct("ngModelChange",function(r){J(t);let o=S(3);return lt(o.removeChildBridges,r)||(o.removeChildBridges=r),Z(r)}),b(),T(2,bae,2,3),T(3,yae,2,6),U(4,"span",23),b()}if(e&2){let t=S(3);m(),at("ngModel",t.removeChildBridges),m(),z(t.childBridges.length===1?2:-1),m(),z(t.childBridges.length>1?3:-1)}}function wae(e,i){if(e&1){let t=ie();y(0,"p",16)(1,"label",21)(2,"input",22),ct("ngModelChange",function(r){J(t);let o=S(2);return lt(o.removeConfig,r)||(o.removeConfig=r),Z(r)}),b(),D(3),R(4,"translate"),U(5,"span",23),b(),T(6,vae,5,3,"label",24),b()}if(e&2){let t=S(2);m(2),at("ngModel",t.removeConfig),m(),oe(" ",O(4,3,"plugins.uninstall_remove_plugin_config")," "),m(3),z(t.hasChildBridges?6:-1)}}function kae(e,i){e&1&&(y(0,"ul",17)(1,"li"),D(2),R(3,"translate"),b(),y(4,"li"),D(5),R(6,"translate"),b()()),e&2&&(m(2),re(O(3,2,"plugins.uninstall_warn_1")),m(3),re(O(6,4,"plugins.uninstall_warn_2")))}function Hae(e,i){e&1&&(y(0,"ngb-alert",18),D(1),R(2,"translate"),b()),e&2&&(N("dismissible",!1),m(),oe(" ",O(2,2,"plugins.uninstall_remove_config_required")," "))}function Sae(e,i){if(e&1&&(y(0,"div",14),U(1,"i",15),b(),y(2,"div",9),T(3,wae,7,5,"p",16),b(),T(4,kae,7,6,"ul",17),T(5,Hae,3,4,"ngb-alert",18),y(6,"ngb-alert",19)(7,"p",20),D(8),R(9,"translate"),b()()),e&2){let t=S();m(3),z(t.isConfigured?3:-1),m(),z(t.hasChildBridges&&t.removeChildBridges?4:-1),m(),z(t.isConfigured&&(!t.pluginAlias||!t.pluginType)?5:-1),m(),N("dismissible",!1),m(2),re(mt(9,5,"plugins.uninstall_remove_confirmation",li(8,_ae,t.plugin.displayName)))}}function Cae(e,i){e&1&&(D(0),R(1,"translate")),e&2&&oe(" ",O(1,1,"plugins.manage.uninstall")," ")}function xae(e,i){e&1&&U(0,"i",12)}var pj=(()=>{class e{$activeModal=j(It);$api=j(Xe);$modal=j(vi);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);plugin;childBridges;action;loading=!0;uninstalling=!1;removeConfig=!0;removeChildBridges=!0;hasChildBridges=!1;isConfigured=!1;pluginType;pluginAlias;ngOnInit(){return ge(this,null,function*(){try{this.childBridges.length&&(this.hasChildBridges=!0);let t=yield this.getAlias();this.pluginType=t.pluginType,this.pluginAlias=t.pluginAlias,(yield Ae(this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`))).length&&(this.isConfigured=!0)}finally{this.loading=!1}})}doUninstall(){return ge(this,null,function*(){if(this.uninstalling=!0,this.removeConfig&&this.isConfigured)try{yield this.removePluginConfig()}catch(s){console.error(s),this.$toastr.error(this.$translate.instant("plugins.config.remove_error"),this.$translate.instant("toast.title_error"))}if(this.hasChildBridges&&this.removeChildBridges)try{yield Promise.all(this.childBridges.map(s=>this.removeChildBridge(s.username.replace(/:/g,""))))}catch(s){console.error(s)}this.$activeModal.dismiss();let t=this.$modal.open(jn,{size:"lg",backdrop:"static"});t.componentInstance.action="Uninstall",t.componentInstance.pluginName=this.plugin.name,t.componentInstance.pluginDisplayName=this.plugin.displayName})}dismissModal(){this.$activeModal.dismiss("Dismiss")}getAlias(){return ge(this,null,function*(){return Ae(this.$api.get(`/plugins/alias/${encodeURIComponent(this.plugin.name)}`))})}removePluginConfig(){return ge(this,null,function*(){yield Ae(this.$api.post(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`,[])),yield Ae(this.$api.put(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}/enable`,{})),this.$toastr.success(this.$translate.instant("plugins.settings.plugin_config_saved"),this.$translate.instant("toast.title_success"))})}removeChildBridge(t){return ge(this,null,function*(){try{yield Ae(this.$api.delete(`/server/pairings/${t}`))}catch(s){console.error(s),this.$toastr.error(this.$translate.instant("plugins.uninstall_bridge_error"),this.$translate.instant("toast.title_error"))}})}static \u0275fac=function(s){return new(s||e)};static \u0275cmp=ve({type:e,selectors:[["ng-component"]],inputs:{plugin:"plugin",childBridges:"childBridges",action:"action"},decls:20,vars:17,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","disabled"],[1,"modal-body"],[1,"text-center","primary-text","my-5","w-100"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click","disabled"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click","disabled"],[1,"fas","fa-circle-notch","fa-spin"],[1,"fa","fa-circle-notch","fa-spin",2,"font-size","75px"],[1,"text-center","mb-3"],[1,"fas","fa-trash","primary-text",2,"font-size","75px"],[1,"d-inline-block","text-start","mb-1"],[1,"mb-3","text-start"],["type","info",1,"mb-3",3,"dismissible"],["type","warning",1,"mb-0",3,"dismissible"],[1,"mb-0"],["for","remove-plugin-config",1,"hb-uix-switch","d-block"],["id","remove-plugin-config","type","checkbox",3,"ngModelChange","ngModel"],[1,"hb-uix-slider","hb-uix-round"],["for","remove-plugin-child-bridges",1,"hb-uix-switch","d-block"],["id","remove-plugin-child-bridges","type","checkbox",3,"ngModelChange","ngModel"]],template:function(s,r){s&1&&(y(0,"div",0)(1,"div",1)(2,"h5",2),D(3),b(),y(4,"button",3),R(5,"translate"),Q("click",function(){return r.dismissModal()}),b()(),y(6,"div",4),T(7,fae,2,0,"div",5),T(8,Sae,10,10),b(),y(9,"div",6)(10,"div",7)(11,"button",8),R(12,"translate"),Q("click",function(){return r.dismissModal()}),D(13),R(14,"translate"),b()(),U(15,"div",9),y(16,"div",10)(17,"button",11),Q("click",function(){return r.doUninstall()}),T(18,Cae,2,3),T(19,xae,1,0,"i",12),b()()()()),s&2&&(m(3),re(r.plugin.displayName||r.plugin.name),m(),N("disabled",r.uninstalling),me("aria-label",O(5,11,"form.button_close")),m(3),z(r.loading?7:-1),m(),z(r.loading?-1:8),m(3),N("disabled",r.uninstalling),me("aria-label",O(12,13,"form.button_close")),m(2),oe(" ",O(14,15,"form.button_close")," "),m(4),N("disabled",r.loading||r.uninstalling),m(),z(r.uninstalling?-1:18),m(),z(r.uninstalling?19:-1))},dependencies:[us,kr,Qt,Wi,Oo,Pt],encapsulation:2})}return e})();var qr=(()=>{class e{$api=j(Xe);$modal=j(vi);$customPluginsService=j(O2);$settings=j(Tt);$toastr=j(ot);$translate=j(rt);pluginListRefreshSubject=new Re;onPluginListRefresh=this.pluginListRefreshSubject.asObservable();installPlugin(t,s){return ge(this,null,function*(){let r=this.$modal.open(jn,{size:"lg",backdrop:"static"});r.componentInstance.action="Install",r.componentInstance.pluginName=t.name,r.componentInstance.pluginDisplayName=t.displayName,r.componentInstance.targetVersion=s,r.componentInstance.onRefreshPluginList=()=>this.pluginListRefreshSubject.next();try{let o=yield r.result;o?.action==="just-installed"&&o?.plugin&&(o.plugin.isConfigured?this.$modal.open(Ys,{size:"lg",backdrop:"static"}):yield this.settings(o.plugin))}catch{}})}uninstallPlugin(t,s){let r=this.$modal.open(pj,{size:"lg",backdrop:"static"});r.componentInstance.action="Uninstall",r.componentInstance.plugin=t,r.componentInstance.childBridges=s}checkAndUpdatePlugin(t,s){return ge(this,null,function*(){(yield this.checkHbAndNodeVersion(t,"update"))&&(yield this.updatePlugin(t,s))})}updatePlugin(t,s){return ge(this,null,function*(){let r=this.$modal.open(jn,{size:"lg",backdrop:"static"});r.componentInstance.action="Update",r.componentInstance.pluginName=t.name,r.componentInstance.pluginDisplayName=t.displayName,r.componentInstance.targetVersion=s,r.componentInstance.latestVersion=t.latestVersion,r.componentInstance.installedVersion=t.installedVersion,r.componentInstance.isDisabled=t.disabled,r.componentInstance.verifiedPlugin=t.verifiedPlugin,r.componentInstance.verifiedPlusPlugin=t.verifiedPlusPlugin,r.componentInstance.funding=t.funding,r.componentInstance.onRefreshPluginList=()=>this.pluginListRefreshSubject.next();try{let o=yield r.result;o?.action==="just-installed"&&o?.plugin&&(o.plugin.isConfigured?this.$modal.open(Ys,{size:"lg",backdrop:"static"}):yield this.settings(o.plugin))}catch{}})}upgradeHomebridge(t,s){return ge(this,null,function*(){if(!(yield this.checkHbAndNodeVersion(t,"update")))return;let r=this.$modal.open(jn,{size:"lg",backdrop:"static"});r.componentInstance.action="Update",r.componentInstance.pluginName=t.name,r.componentInstance.pluginDisplayName=t.displayName,r.componentInstance.targetVersion=s,r.componentInstance.latestVersion=t.latestVersion,r.componentInstance.installedVersion=t.installedVersion})}installAlternateVersion(t){return ge(this,null,function*(){let s=this.$modal.open(J2,{size:"lg",backdrop:"static"});s.componentInstance.plugin=t,s.componentInstance.onRefreshPluginList=()=>this.pluginListRefreshSubject.next();try{let{action:r,version:o,engines:l}=yield s.result;return(yield this.checkHbAndNodeVersion(Fe(pe({},t),{updateEngines:l}),r))?t.name==="homebridge"?yield this.upgradeHomebridge(t,o):t.installedVersion?yield this.updatePlugin(t,o):this.installPlugin(t,o):void 0}catch{}})}bridgeSettings(t,s=!1){return ge(this,null,function*(){let r;if(t.settingsSchema)try{r=yield this.loadConfigSchema(t.name)}catch(l){console.error(l),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugin_schema"),this.$translate.instant("toast.title_error"));return}let o=this.$modal.open(ej,{size:"lg",backdrop:"static"});o.componentInstance.schema=r,o.componentInstance.plugin=t,o.componentInstance.justInstalled=s;try{(yield o.result)==="refresh"&&this.pluginListRefreshSubject.next()}catch{}})}settings(t){return ge(this,null,function*(){let s;if(t.settingsSchema)try{s=yield this.loadConfigSchema(t.name)}catch(o){console.error(o),this.$toastr.error(this.$translate.instant("plugins.toast_failed_to_load_plugin_schema"),this.$translate.instant("toast.title_error"));return}if(s&&s.customUi)return this.$customPluginsService.openCustomSettingsUi(t,s);if(this.$customPluginsService.plugins[t.name])return this.$customPluginsService.openSettings(t,s);let r=this.$modal.open(t.settingsSchema?lj:_f,{size:"lg",backdrop:"static"});return r.componentInstance.schema=s,r.componentInstance.plugin=t,r.result.catch(()=>{})})}jsonEditor(t){return ge(this,null,function*(){let s;if(t.settingsSchema)try{s=yield this.loadConfigSchema(t.name)}catch(o){console.error(o)}let r=this.$modal.open(_f,{size:"lg",backdrop:"static"});return r.componentInstance.schema=s,r.componentInstance.plugin=t,r.result.catch(o=>console.error(o))})}checkHbAndNodeVersion(t,s){return ge(this,null,function*(){let r=!0,o=!0;try{t.updateEngines?.node&&(0,Dn.lt)(this.$settings.env.nodeVersion,(0,Dn.minVersion)(t.updateEngines.node))&&(r=!1),t.updateEngines?.homebridge&&(0,Dn.lt)(this.$settings.env.homebridgeVersion,(0,Dn.minVersion)(t.updateEngines.homebridge))&&(o=!1)}catch(l){return console.error(l),this.$toastr.error(l.message,this.$translate.instant("toast.title_error")),!1}if(!r||!o)try{let l=this.$modal.open(ij,{size:"lg",backdrop:"static"});return l.componentInstance.plugin=t,l.componentInstance.isValidNode=r,l.componentInstance.isValidHb=o,l.componentInstance.action=s,yield l.result}catch{return!1}return!0})}loadConfigSchema(t){return ge(this,null,function*(){return Ae(this.$api.get(`/plugins/config-schema/${encodeURIComponent(t)}`))})}resetChildBridges(t){return ge(this,null,function*(){let s=this.$modal.open(cj,{size:"lg",backdrop:"static"});s.componentInstance.childBridges=t})}switchToScoped(t){return ge(this,null,function*(){let s=this.$modal.open(gj,{size:"lg",backdrop:"static"});s.componentInstance.plugin=t})}static \u0275fac=function(s){return new(s||e)};static \u0275prov=pt({token:e,factory:e.\u0275fac,providedIn:"root"})}return e})();export{Z1 as a,uf as b,Ft as c,e_e as d,Nt as e,o2 as f,l2 as g,c2 as h,cf as i,d2 as j,g2 as k,p2 as l,m2 as m,_2 as n,h2 as o,f2 as p,b2 as q,y2 as r,v2 as s,w2 as t,k2 as u,H2 as v,S2 as w,C2 as x,x2 as y,I2 as z,P2 as A,T2 as B,z2 as C,A2 as D,j2 as E,D2 as F,N2 as G,R2 as H,E2 as I,B2 as J,M2 as K,U2 as L,O2 as M,q2 as N,$2 as O,qr as P};
|