UNPKG

iobroker.zwave2

Version:
3 lines (2 loc) 7.47 kB
import{b as V}from"./chunk-RV4HM636.js";import{A as M,Aa as $,B as g,Ba as W,Da as _,Ea as Y,Fa as y,Ga as me,H as pe,J as H,Ja as B,Ka as ue,La as fe,Ma as ge,Na as ye,Oa as ve,Pa as he,Qa as ke,Ra as be,Sa as Se,Ta as Ce,a as K,b as a,c as w,d as ne,e as N,f as U,j as z,l as se,m as E,n as le,o as ce,oa as de,ua as O,va as T}from"./chunk-QC74SDCH.js";var j=K(A=>{"use strict";var we=N(),Te=U();Object.defineProperty(A,"__esModule",{value:!0});A.default=void 0;var _e=Te(w()),Be=we(H()),Ae=(0,Be.default)(_e.createElement("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"}),"Sync");A.default=Ae});var J=K(I=>{"use strict";var Ie=N(),xe=U();Object.defineProperty(I,"__esModule",{value:!0});I.default=void 0;var Ge=xe(w()),qe=Ie(H()),De=(0,qe.default)(Ge.createElement("path",{d:"M19 2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h4l3 3 3-3h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-6 16h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 11.9 13 12.5 13 14h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"LiveHelp");I.default=De});var re=a(ne()),ae=a(z()),h=a(se()),k=a(le()),c=a(ce());var L=a(pe()),b=a(E()),ie=a(j());var d=a(w());var Q=a(de()),X=a(J()),R=a(y()),Pe=g(o=>({tooltip:{verticalAlign:"middle"},icon:{color:o.palette.text.hint,cursor:"help"}})),F=o=>{let m=Pe();return(0,R.jsx)(Q.default,{title:o.tooltip,className:m.tooltip,children:(0,R.jsx)(X.default,{className:m.icon})})};var Z=a(z());var v=a(E()),ee=a(me());var te=a(w());var n=a(y()),Re=g(o=>({button:{margin:o.spacing(1,0)}})),oe=()=>{let{alive:o,connected:m}=Y(),{translate:l}=T(),u=Re(),{namespace:i}=O(),x=B(),[S]=_({id:`${i}.info.configUpdate`}),[s]=_({id:`${i}.info.configVersion`}),[G]=_({id:`${i}.info.configUpdating`}),[q,C]=(0,te.useState)(!1);async function D(){C(!0);let P=await x.updateConfig();C(!1),P||alert(l("Updating the configuration DB failed!"))}if(!o||!m)return(0,n.jsx)(n.Fragment,{});if(S){if(q||G)return(0,n.jsx)(v.default,{variant:"body2",children:l("Updating configuration DB - please wait...")})}else return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(v.default,{variant:"body2",children:[l("Configuration DB is up to date"),(0,n.jsx)("br",{}),l("Installed version"),": ",s]})});return(0,n.jsxs)("div",{children:[(0,n.jsxs)(v.default,{variant:"body2",children:[l("Update for configuration DB available"),": ",S]}),(0,n.jsxs)(v.default,{variant:"body2",children:[l("Installed version"),": ",s]}),(0,n.jsx)(Z.default,{className:u.button,variant:"contained",color:"primary",onClick:()=>D(),startIcon:(0,n.jsx)(ee.default,{}),children:l("Update configuration DB")}),(0,n.jsx)(v.default,{variant:"body2",children:l("config update disclaimer")})]})};var e=a(y()),Fe=g(o=>M({root:{display:"flex",flexGrow:1,flexFlow:"column nowrap",gap:o.spacing(8)},keyGrid:{display:"grid",gridTemplateColumns:"1fr auto",alignItems:"center",gap:o.spacing(2)},keyGridLabel:{marginTop:o.spacing(2),gridColumn:"1 / span 2"},keyGrid_TextField:{flexGrow:1},keyGrid_Button:{flexGrow:0}})),Le=[[2,"networkKey_S2_AccessControl","S2 Access Control"],[1,"networkKey_S2_Authenticated","S2 Authenticated"],[0,"networkKey_S2_Unauthenticated","S2 Unauthenticated"],[7,"networkKey_S0","S0 (Legacy)"]],Ke=(0,d.memo)(()=>{let{settings:o,originalSettings:m,setSettings:l}=$(),u=Fe(),{translate:i,language:x}=T(),S=B(),s=(r,t)=>{l(f=>({...f,[r]:t}))},G=r=>{if(!o[r]||o[r]!==m[r]||confirm(i("network key confirm"))){let t=new Uint8Array(16);window.crypto.getRandomValues(t);let f=[...t].map(p=>p.toString(16).padStart(2,"0")).join("");s(r,f)}},q=r=>{let t=o[r];!t||/[0-9a-fA-F]{32}/.test(t)||(alert(i("Invalid network key")),s(r,m[r]))},C=(r,t)=>{t.stopPropagation(),t.preventDefault();let p=(t.clipboardData||window.clipboardData).getData("Text");p&&(p=p.trim().replace(/0x/g,"").replace(/[^0-9a-fA-F]+/g,"").toLowerCase().slice(0,32)),s(r,p)},[D,P]=(0,d.useState)([]);return(0,d.useEffect)(()=>{S.listSerialPorts().then(r=>{r.length&&P(r)}).catch(r=>{console.error(`Cannot retrieve serial ports: ${r}`)})},[]),(0,e.jsxs)("div",{className:u.root,children:[(0,e.jsxs)(c.default,{container:!0,spacing:8,children:[(0,e.jsxs)(c.default,{container:!0,item:!0,xs:12,sm:!0,spacing:2,direction:"column",children:[(0,e.jsxs)(c.default,{item:!0,xs:!0,children:[(0,e.jsx)(V,{options:D,freeSolo:!0,forcePopupIcon:!0,noOptionsText:"",autoSelect:!0,clearOnBlur:!0,onChange:(r,t)=>s("serialport",t!=null?t:""),renderInput:r=>(0,e.jsx)(L.default,{...r,label:i("Select serial port"),margin:"normal"}),value:o.serialport}),(0,e.jsx)(b.default,{variant:"body2",children:i("hosted port tip")})]}),(0,e.jsxs)(c.default,{item:!0,xs:!0,children:[(0,e.jsx)(k.default,{label:i("Disable restarting the controller on startup"),control:(0,e.jsx)(h.default,{checked:o.disableSoftReset,onChange:(r,t)=>s("disableSoftReset",t)})}),(0,e.jsxs)(b.default,{variant:"body2",children:[i("You can try this if the adapter does not start after updating to 2.3 or higher."),"\xA0",(0,e.jsx)("a",{href:x==="de"?"https://github.com/AlCalzone/ioBroker.zwave2/blob/master/docs/de/bei-problemen.md#der-adapter-startet-nach-update-auf-version-23-oder-h\xF6her-nicht":"https://github.com/AlCalzone/ioBroker.zwave2/blob/master/docs/en/troubleshooting.md#the-adapter-does-not-start-after-updating-to-version-23-or-higher",target:"_blank",children:i("But read this first!")})]})]}),(0,e.jsxs)(c.default,{item:!0,xs:!0,children:[(0,e.jsx)(k.default,{label:i("Write a detailed logfile"),control:(0,e.jsx)(h.default,{checked:o.writeLogFile,onChange:(r,t)=>s("writeLogFile",t)})}),(0,e.jsx)(b.default,{variant:"body2",children:i("This should only be set for debugging purposes.")})]}),(0,e.jsx)(c.default,{item:!0,xs:!0,children:(0,e.jsx)(k.default,{label:i("Preserve state names"),control:(0,e.jsx)(h.default,{checked:o.preserveStateNames,onChange:(r,t)=>s("preserveStateNames",t)})})}),(0,e.jsx)(c.default,{item:!0,xs:!0,children:(0,e.jsx)(k.default,{label:(0,e.jsxs)(e.Fragment,{children:[i("Legacy switch compatibility")," ",(0,e.jsx)(F,{tooltip:i("switch compat tooltip")})]}),control:(0,e.jsx)(h.default,{checked:o.switchCompat,onChange:(r,t)=>s("switchCompat",t)})})})]}),(0,e.jsxs)(c.default,{item:!0,xs:12,sm:7,className:u.keyGrid,children:[(0,e.jsxs)(b.default,{variant:"body1",className:u.keyGridLabel,children:[i("Network keys for secure communication"),(0,e.jsx)(F,{tooltip:i("network key tooltip")})]}),Le.map(([r,t,f])=>(0,e.jsxs)(d.Fragment,{children:[(0,e.jsx)(L.default,{className:u.keyGrid_TextField,label:f,inputProps:{maxLength:32,style:{fontFamily:"monospace"},onPaste:C.bind(void 0,t)},fullWidth:!0,InputLabelProps:{shrink:!!o[t]},value:o[t],onChange:p=>s(t,p.target.value),onBlur:()=>q(t)}),(0,e.jsx)(ae.default,{className:u.keyGrid_Button,variant:"contained",color:"primary",startIcon:(0,e.jsx)(ie.default,{}),onClick:()=>G(t),style:{whiteSpace:"nowrap"},children:i("Generate key")})]},`security-class-${r}`))]})]}),(0,e.jsx)(oe,{})]})}),Ne=o=>{o.networkKey&&(o.networkKey_S0=o.networkKey,delete o.networkKey)},Ue={en:ue(),de:fe(),ru:ge(),pt:ye(),nl:ve(),fr:he(),it:ke(),es:be(),pl:Se(),"zh-cn":Ce()},ze=()=>(0,e.jsx)(W,{name:"zwave2",afterLoad:Ne,translations:Ue,children:(0,e.jsx)(Ke,{})});re.default.render((0,e.jsx)(ze,{}),document.getElementById("root")); //# sourceMappingURL=index.js.map