iobroker.admin 7.7.15 → 7.7.16

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/adminWww/assets/{AdapterUpdateDialog-CJRQB5ud.js → AdapterUpdateDialog-DgGBsRTF.js} +1 -1
  3. package/adminWww/assets/{Adapters-B5LWXJ3G.js → Adapters-DQx7Bvua.js} +1 -1
  4. package/adminWww/assets/{Config-D3mtokJQ.js → Config-DVKaSpJQ.js} +1 -1
  5. package/adminWww/assets/CustomTab-Bd0jotF3.js +1 -0
  6. package/adminWww/assets/EasyMode-Do6TrxNe.js +1 -0
  7. package/adminWww/assets/{Enums-BImz5cPM.js → Enums-Cs1YfE0u.js} +1 -1
  8. package/adminWww/assets/{Fields-V2W2HJlv.js → Fields-BN3I4xea.js} +1 -1
  9. package/adminWww/assets/{Files-Ci2XDKh8.js → Files-D3ZGey4U.js} +1 -1
  10. package/adminWww/assets/{Hosts-AXD2lYOf.js → Hosts-CiLGol9z.js} +2 -2
  11. package/adminWww/assets/Instances-BPN48MUb.js +2 -0
  12. package/adminWww/assets/Intro-pve0DohO.js +2 -0
  13. package/adminWww/assets/Logs-DGuH9I7c.js +1 -0
  14. package/adminWww/assets/{Objects-CeqK8jeG.js → Objects-CEr0R7D7.js} +1 -1
  15. package/adminWww/assets/{blueGrey-BFcAYvAO.js → ThemeProvider-DPY2Djdh.js} +5 -5
  16. package/adminWww/assets/Users-D3mq-yuy.js +1 -0
  17. package/adminWww/assets/amber-D7aVlNg3.js +1 -0
  18. package/adminWww/assets/{bootstrap-xC60EdKn.js → bootstrap-C5UDqwR8.js} +6 -6
  19. package/adminWww/assets/{index-B_eoqXoQ.js → index-BUuGt50W.js} +1 -1
  20. package/adminWww/assets/{index-B5NvG6mn.js → index-CUHhJ9XN.js} +2 -2
  21. package/adminWww/assets/index-CWQMA6JI.js +55 -0
  22. package/adminWww/assets/pl-B5EqeZG3.js +1 -0
  23. package/adminWww/assets/{sdk-DTP6UH26.js → sdk-CXXcV9KR.js} +1 -1
  24. package/adminWww/index.html +1 -1
  25. package/adminWww/mf-manifest.json +1 -1
  26. package/adminWww/remoteEntry.js +2 -2
  27. package/io-package.json +2 -2
  28. package/package.json +1 -1
  29. package/adminWww/assets/CustomTab-CBVvppVS.js +0 -1
  30. package/adminWww/assets/EasyMode-CR0Vw-OT.js +0 -1
  31. package/adminWww/assets/Instances-j88MVgOp.js +0 -2
  32. package/adminWww/assets/Intro-DH7_8X9J.js +0 -2
  33. package/adminWww/assets/Logs-BJEYaBGh.js +0 -1
  34. package/adminWww/assets/Users-BJgk5zRR.js +0 -1
  35. package/adminWww/assets/index-d-Zo1uu9.js +0 -55
  36. package/adminWww/assets/pl-OOhGZ0tn.js +0 -1
package/README.md CHANGED
@@ -157,7 +157,7 @@ The icons may not be reused in other projects without the proper flaticon licens
157
157
  <!--
158
158
  ### **WORK IN PROGRESS**
159
159
  -->
160
- ### 7.7.15 (2025-10-23)
160
+ ### 7.7.16 (2025-10-24)
161
161
  - (@GermanBluefox) Improvement of categories: drag&drop, visibility
162
162
  - (@copilot) Added missing filterFunc property to jsonConfig objectId schema to match documentation and implementation
163
163
  - (@copilot, @SimonFischer04) Added extended reverse proxy example section with screenshots, limitations (admin root requirement), and adapter compatibility notes
@@ -1,2 +1,2 @@
1
- import{j as t}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as y}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{s as f,k as C}from"./bootstrap-xC60EdKn.js";import{h as T}from"./zh-cn-Dy5SHo8v.js";import{i as s,a as u}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as k}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{S as D}from"./State-DhReNijC.js";const a={closeButton:l=>({position:"absolute",right:8,top:8,color:l.palette.grey[500]}),languageButton:{position:"absolute",right:60,top:8},languageButtonActive:l=>({color:l.palette.primary.main}),typography:{paddingRight:30},version:l=>({background:"#4dabf5",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),wrapperButton:{"@media screen and (max-width: 465px)":{"& *":{fontSize:10}},"@media screen and (max-width: 380px)":{"& *":{fontSize:9}}},messageText:{},messageIcon:{width:32,height:32,marginRight:8},messageColor_warn:{color:"#cb7642"},messageColor_error:{color:"#f5614d"},messageColor_info:{color:"#5abd29"},messageTitle_warn:l=>({background:"#cb7642",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),messageTitle_error:l=>({background:"#f5614d",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),messageTitle_info:l=>({background:"#5abd29",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),messageDialogText:{fontSize:18},messageDialogTitle:{},versionTime:{fontSize:"smaller",opacity:.5,marginLeft:4},dialogPaper:{maxWidth:880},repoStableVersionText:l=>({color:l.palette.mode==="dark"?"#8dff7a":"#2b9800",fontWeight:"bold",marginLeft:"4px"}),repoLatestVersionText:l=>({color:l.palette.mode==="dark"?"#a3fcff":"#005498",fontWeight:"bold",marginLeft:"4px"})};function I(l,e,p,r){let c=null;return l&&l.forEach(i=>{var m,_;let d=!((m=i.condition)!=null&&m.rules);if((_=i.condition)!=null&&_.rules){const j=(Array.isArray(i.condition.rules)?i.condition.rules:[i.condition.rules]).map(o=>{let n,h,g;if(o.includes("oldVersion"))n=e,o=o.substring(10);else if(o.includes("newVersion"))n=p,o=o.substring(10);else{if(o==="installed")return!!e;if(o==="!"||o==="not-installed")return!e;if(r){const w=o.match(/([a-z][-a-z_0-9]+)([!=<>]+)([.\d]+)/);if(w){const x=Object.keys(r).find(b=>{var v;return((v=r[b])==null?void 0:v.name)===w[1]});if(x){n=r[x].version,h=w[2],g=w[3];try{return h==="=="?f.eq(n,g):h===">"?f.gt(n,g):h==="<"?f.lt(n,g):h===">="?f.gte(n,g):h==="<="?f.lte(n,g):h==="!="?f.neq(n,g):(console.warn(`Unknown rule ${n}${o}`),!1)}catch{return console.warn(`Cannot compare ${n}${o}`),!1}}}else if(o.match(/^[!=<>]+/)){if(o.startsWith("!")){const x=o.substring(1);if(!Object.keys(r).find(b=>{var v;return((v=r[b])==null?void 0:v.name)===x}))return!0}}else if(Object.keys(r).find(x=>{var b;return((b=r[x])==null?void 0:b.name)===o}))return!0;return!1}}o[1]>="0"&&o[1]<="9"?(h=o[0],g=o.substring(1)):(h=o.substring(0,2),g=o.substring(2));try{if(h==="==")return f.eq(n,g);if(h===">")return f.gt(n,g);if(h==="<")return f.lt(n,g);if(h===">=")return f.gte(n,g);if(h==="<=")return f.lte(n,g);if(h==="!=")return f.neq(n,g);console.warn(`Unknown rule ${n}${o}`)}catch{console.warn(`Cannot compare ${n}${o}`)}return!1});i.condition.operand==="or"?d=j.find(o=>o):d=j.findIndex(o=>!o)===-1}d&&(c||=[],c.push({title:i.title,text:i.text,link:i.link,linkText:i.linkText,buttons:i.buttons,level:i.level}))}),c}class W extends y.Component{t;mobile;messages;lang;constructor(e){var r,c;super(e),this.t=e.t,this.mobile=window.innerWidth<C,this.state={showMessageDialog:!1};const p=!1;this.messages=I(((r=this.props.adapterObject)==null?void 0:r.messages)||p,this.props.installedVersion,(c=this.props.adapterObject)==null?void 0:c.version,this.props.instances),this.lang=k.I18n.getLanguage(),T.locale(this.lang)}getDependencies(){return(this.props.dependencies||[]).map(e=>t.jsx(D,{state:e.rightVersion,children:`${e.name}${e.version?` (${e.version})`:""}: ${e.installed?e.installedVersion:"-"}`},e.name))}getNews(){var c;const e=[];let p,r;return this.props.isStable!==void 0&&(this.props.isStable?(p=this.props.adapterObject.version,r=this.props.adapterObject.latestVersion):(p=this.props.adapterObject.stable,r=this.props.adapterObject.version)),(c=this.props.news)==null||c.forEach(i=>{var m,_,j;const d=(i.news?i.news.split(`
1
+ import{j as t}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as y}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{s as f,k as C}from"./bootstrap-C5UDqwR8.js";import{h as T}from"./zh-cn-Dy5SHo8v.js";import{i as s,a as u}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as k}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{S as D}from"./State-DhReNijC.js";const a={closeButton:l=>({position:"absolute",right:8,top:8,color:l.palette.grey[500]}),languageButton:{position:"absolute",right:60,top:8},languageButtonActive:l=>({color:l.palette.primary.main}),typography:{paddingRight:30},version:l=>({background:"#4dabf5",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),wrapperButton:{"@media screen and (max-width: 465px)":{"& *":{fontSize:10}},"@media screen and (max-width: 380px)":{"& *":{fontSize:9}}},messageText:{},messageIcon:{width:32,height:32,marginRight:8},messageColor_warn:{color:"#cb7642"},messageColor_error:{color:"#f5614d"},messageColor_info:{color:"#5abd29"},messageTitle_warn:l=>({background:"#cb7642",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),messageTitle_error:l=>({background:"#f5614d",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),messageTitle_info:l=>({background:"#5abd29",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:l.palette.mode==="dark"?"black":"white"}),messageDialogText:{fontSize:18},messageDialogTitle:{},versionTime:{fontSize:"smaller",opacity:.5,marginLeft:4},dialogPaper:{maxWidth:880},repoStableVersionText:l=>({color:l.palette.mode==="dark"?"#8dff7a":"#2b9800",fontWeight:"bold",marginLeft:"4px"}),repoLatestVersionText:l=>({color:l.palette.mode==="dark"?"#a3fcff":"#005498",fontWeight:"bold",marginLeft:"4px"})};function I(l,e,p,r){let c=null;return l&&l.forEach(i=>{var m,_;let d=!((m=i.condition)!=null&&m.rules);if((_=i.condition)!=null&&_.rules){const j=(Array.isArray(i.condition.rules)?i.condition.rules:[i.condition.rules]).map(o=>{let n,h,g;if(o.includes("oldVersion"))n=e,o=o.substring(10);else if(o.includes("newVersion"))n=p,o=o.substring(10);else{if(o==="installed")return!!e;if(o==="!"||o==="not-installed")return!e;if(r){const w=o.match(/([a-z][-a-z_0-9]+)([!=<>]+)([.\d]+)/);if(w){const x=Object.keys(r).find(b=>{var v;return((v=r[b])==null?void 0:v.name)===w[1]});if(x){n=r[x].version,h=w[2],g=w[3];try{return h==="=="?f.eq(n,g):h===">"?f.gt(n,g):h==="<"?f.lt(n,g):h===">="?f.gte(n,g):h==="<="?f.lte(n,g):h==="!="?f.neq(n,g):(console.warn(`Unknown rule ${n}${o}`),!1)}catch{return console.warn(`Cannot compare ${n}${o}`),!1}}}else if(o.match(/^[!=<>]+/)){if(o.startsWith("!")){const x=o.substring(1);if(!Object.keys(r).find(b=>{var v;return((v=r[b])==null?void 0:v.name)===x}))return!0}}else if(Object.keys(r).find(x=>{var b;return((b=r[x])==null?void 0:b.name)===o}))return!0;return!1}}o[1]>="0"&&o[1]<="9"?(h=o[0],g=o.substring(1)):(h=o.substring(0,2),g=o.substring(2));try{if(h==="==")return f.eq(n,g);if(h===">")return f.gt(n,g);if(h==="<")return f.lt(n,g);if(h===">=")return f.gte(n,g);if(h==="<=")return f.lte(n,g);if(h==="!=")return f.neq(n,g);console.warn(`Unknown rule ${n}${o}`)}catch{console.warn(`Cannot compare ${n}${o}`)}return!1});i.condition.operand==="or"?d=j.find(o=>o):d=j.findIndex(o=>!o)===-1}d&&(c||=[],c.push({title:i.title,text:i.text,link:i.link,linkText:i.linkText,buttons:i.buttons,level:i.level}))}),c}class W extends y.Component{t;mobile;messages;lang;constructor(e){var r,c;super(e),this.t=e.t,this.mobile=window.innerWidth<C,this.state={showMessageDialog:!1};const p=!1;this.messages=I(((r=this.props.adapterObject)==null?void 0:r.messages)||p,this.props.installedVersion,(c=this.props.adapterObject)==null?void 0:c.version,this.props.instances),this.lang=k.I18n.getLanguage(),T.locale(this.lang)}getDependencies(){return(this.props.dependencies||[]).map(e=>t.jsx(D,{state:e.rightVersion,children:`${e.name}${e.version?` (${e.version})`:""}: ${e.installed?e.installedVersion:"-"}`},e.name))}getNews(){var c;const e=[];let p,r;return this.props.isStable!==void 0&&(this.props.isStable?(p=this.props.adapterObject.version,r=this.props.adapterObject.latestVersion):(p=this.props.adapterObject.stable,r=this.props.adapterObject.version)),(c=this.props.news)==null||c.forEach(i=>{var m,_,j;const d=(i.news?i.news.split(`
2
2
  `):[]).map(o=>o.trim().replace(/^\*\s*/,"").replace(/<!--[^>]*->/,"").replace(/<! -[^>]*->/,"").replace(/<!--|--!?>/g,"").trim()).filter(o=>!!o);(m=this.props.adapterObject)!=null&&m.version&&i.version&&f.gt(i.version,(_=this.props.adapterObject)==null?void 0:_.version)||e.push(t.jsxs(s.Grid2,{children:[t.jsxs(s.Typography,{sx:a.version,children:[i.version,r&&r===i.version?t.jsx(s.Box,{component:"span",sx:a.repoLatestVersionText,children:"(latest)"}):null,p&&p===i.version?t.jsx(s.Box,{component:"span",sx:a.repoStableVersionText,children:`(${k.I18n.t("stable")})`}):null,((j=this.props.adapterObject)==null?void 0:j.version)===i.version?t.jsxs("span",{style:a.versionTime,children:["(",T(this.props.adapterObject.versionDate).fromNow(),")"]}):null]}),d.map((o,n)=>t.jsx(s.Typography,{component:"div",variant:"body2",children:`• ${o}`},`${i.version}-${n}`))]},i.version))}),e}getText(e,p){return e&&typeof e=="object"?p?e.en:e[this.lang]||e.en:typeof e=="object"?"":e}renderOneMessage(e,p){return t.jsxs(s.Grid2,{children:[t.jsx(s.Typography,{sx:a[`messageTitle_${e.level||"warn"}`],children:this.getText(e.title,this.props.noTranslation)||""}),t.jsx(s.Typography,{component:"div",variant:"body2",style:a.messageText,children:this.getText(e.text,this.props.noTranslation)||""}),e.link?t.jsx(s.Button,{onClick:()=>{window.open(e.link,"_blank").focus()},startIcon:t.jsx(u.Public,{}),variant:"contained",color:"grey",children:this.getText(e.linkText,this.props.noTranslation)||this.props.t("More info")}):null]},p)}renderMessages(){return this.messages?t.jsx(s.Grid2,{container:!0,spacing:2,direction:"column",wrap:"nowrap",sx:{marginBottom:1},children:this.messages.map((e,p)=>this.renderOneMessage(e,p))}):null}renderMessageDialog(){var r;if(!this.state.showMessageDialog)return null;const e=this.messages.find(c=>c.buttons),p=(r=this.props.adapterObject)==null?void 0:r.version;return t.jsxs(s.Dialog,{onClose:()=>this.setState({showMessageDialog:!1}),open:!0,children:[t.jsx(s.DialogTitle,{style:a.messageDialogTitle,children:this.getText(e.title,this.props.noTranslation)||this.props.t("Please confirm")}),t.jsxs(s.DialogContent,{style:a.messageDialogText,children:[e.level==="warn"?t.jsx(u.Warning,{style:{...a.messageIcon,...a.messageColor_warn}}):null,e.level==="error"?t.jsx(u.Error,{style:{...a.messageIcon,...a.messageColor_error}}):null,e.level==="info"?t.jsx(u.Info,{style:{...a.messageIcon,...a.messageColor_info}}):null,this.getText(e.text,this.props.noTranslation)]}),t.jsxs(s.DialogActions,{children:[e.link?t.jsx(s.Button,{onClick:()=>{window.open(e.link,"_blank").focus()},startIcon:t.jsx(u.Public,{}),variant:"contained",color:"secondary",children:this.getText(e.linkText,this.props.noTranslation)||this.props.t("More info")}):null,e.link?t.jsx("div",{style:{flexGrow:1}}):null,e.buttons.map((c,i)=>c==="ok"?t.jsx(s.Button,{variant:"contained",onClick:()=>this.setState({showMessageDialog:!1},()=>this.props.onUpdate(p)),color:"primary",startIcon:t.jsx(u.Check,{}),children:this.t("Update")},i):c==="agree"?t.jsx(s.Button,{sx:a[`messageTitle_${e.level||"warn"}`],variant:"contained",onClick:()=>this.setState({showMessageDialog:!1},()=>this.props.onUpdate(p)),color:"primary",startIcon:t.jsx(u.Check,{}),children:this.t("Agree")},i):c==="cancel"?t.jsx(s.Button,{variant:"contained",onClick:()=>this.setState({showMessageDialog:!1}),startIcon:t.jsx(u.Close,{}),color:"grey",children:this.t("Cancel")},i):null)]})]})}render(){var c,i;const e=(c=this.props.adapterObject)==null?void 0:c.version,p=(i=this.props.news)==null?void 0:i.every(d=>d.downloaded),r=this.getNews();return t.jsxs(s.Dialog,{onClose:this.props.onClose,open:!0,sx:{"& .MuiDialog-paper":a.dialogPaper},children:[this.renderMessageDialog(),t.jsx(s.DialogTitle,{children:t.jsxs(s.Typography,{component:"h2",variant:"h6",sx:{"&.MuiTypography-root":a.typography},children:[t.jsx("div",{style:{width:"calc(100% - 60px)"},children:this.t('Update "%s" to v%s',this.props.adapter,e)}),t.jsx(s.IconButton,{size:"large",sx:a.closeButton,onClick:this.props.onClose,children:t.jsx(u.Close,{})}),this.lang!=="en"&&this.props.toggleTranslation&&!p?t.jsx(s.IconButton,{size:"large",style:k.Utils.getStyle(this.props.theme,a.languageButton,this.props.noTranslation&&a.languageButtonActive),onClick:this.props.toggleTranslation,title:k.I18n.t("Disable/Enable translation"),children:t.jsx(u.Language,{})}):null]})}),t.jsxs(s.DialogContent,{dividers:!0,children:[this.renderMessages(),t.jsxs(s.Grid2,{container:!0,direction:"column",spacing:2,wrap:"nowrap",children:[this.props.dependencies&&this.props.dependencies.length>0&&this.props.dependencies.find(d=>!d.rightVersion)&&t.jsxs(s.Grid2,{children:[t.jsx(s.Typography,{variant:"h6",gutterBottom:!0,children:this.t("Dependencies")}),this.getDependencies()]}),r.length?t.jsxs(s.Grid2,{children:[t.jsx(s.Typography,{variant:"h6",gutterBottom:!0,children:this.t("Change log")}),t.jsx(s.Grid2,{container:!0,spacing:2,direction:"column",wrap:"nowrap",children:r})]}):this.t("No change log available")]})]}),t.jsxs(s.DialogActions,{sx:a.wrapperButton,children:[!!this.props.rightDependencies&&this.props.onIgnore&&e&&t.jsx(s.Button,{id:"adapter-update-dialog-ignore",variant:"outlined",onClick:()=>this.props.onIgnore(e),color:"primary",children:this.t("Ignore version %s",e)}),t.jsx(s.Button,{variant:"contained",id:"adapter-update-dialog-ok",autoFocus:!0,disabled:!this.props.rightDependencies||!e||!this.props.adapterObject,onClick:()=>{var d;(d=this.messages)!=null&&d.find(m=>m.buttons)?this.setState({showMessageDialog:!0}):this.props.onUpdate(e)},color:"primary",startIcon:t.jsx(u.Check,{}),children:this.mobile?null:this.props.textUpdate?this.props.textUpdate:this.t("Update")}),this.props.textInstruction?t.jsx(s.Button,{id:"adapter-update-dialog-instructions",variant:"contained",autoFocus:!0,disabled:!this.props.rightDependencies||!e||!this.props.adapterObject,onClick:()=>{var d;(d=this.messages)!=null&&d.find(m=>m.buttons)?this.setState({showMessageDialog:!0}):this.props.onInstruction()},color:"primary",startIcon:t.jsx(u.Book,{}),children:this.mobile?null:this.props.textInstruction}):null,t.jsx(s.Button,{id:"adapter-update-dialog-cancel",variant:"contained",onClick:()=>this.props.onClose(),color:"grey",startIcon:t.jsx(u.Close,{}),children:this.mobile?null:this.t("Close")})]})]})}}export{W as A,I as c};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as L,a as J}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{s as V,C as ut,G as gt,H as mt,L as xt,I as N,A as ft,a as yt,b as z,c as at,S as tt}from"./bootstrap-xC60EdKn.js";import{i as o,a as g}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{s as lt}from"./index-Dy_ekAsY.js";import{M as wt,s as bt,C as et}from"./sentry-C8mPNiGL.js";import{i as x}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{c as K,A as jt}from"./AdapterUpdateDialog-CJRQB5ud.js";import{t as pt,b as Ct,w as vt}from"./createTheme-O_VGsRib.js";import{C as Tt}from"./CustomModal-DCjdghJB.js";import{a as dt}from"./blueGrey-BFcAYvAO.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./ace-DgO9yth5.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./ext-language_tools-DJmHbGA8.js";import"./preload-helper-BDBacUwf.js";import"./sdk-DTP6UH26.js";import"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./en-US-B8gg5zk_.js";import"./iconBase-CB0tx1VT.js";import"./zh-cn-Dy5SHo8v.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./State-DhReNijC.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";const A={smallAvatar:{width:24,height:24},listItem:p=>({mb:"2px",background:p.palette.background,"@media screen and (max-width: 400px)":{pl:"2px"}}),toVersion:p=>({color:p.palette.mode==="dark"?"#00dc00":"#008100",fontWeight:"bold",ml:"4px"}),updateDone:{background:"#5ef05e80",opacity:.7},minWidthCss:{"@media screen and (max-width: 400px)":{minWidth:32}},wrapperButton:{},typography:{paddingRight:30},versions:{minWidth:110,display:"inline-block"},closeButton:p=>({position:"absolute",right:8,top:8,color:p.palette.grey[500]}),languageButton:{position:"absolute",right:60,top:8},languageButtonActive:p=>({color:p.palette.primary.main}),versionHeader:p=>({background:"#4dabf5",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:p.palette.mode==="dark"?"black":"white"}),repoStableVersionText:p=>({color:p.palette.mode==="dark"?"#8dff7a":"#2b9800",fontWeight:"bold",marginLeft:"4px"}),repoLatestVersionText:p=>({color:p.palette.mode==="dark"?"#a3fcff":"#005498",fontWeight:"bold",marginLeft:"4px"})};class X extends L.Component{updateAvailable;initialVersions;currentRef;current;constructor(t){super(t),this.updateAvailable=this.detectUpdates(),this.initialVersions={},this.updateAvailable.forEach(s=>this.initialVersions[s]=this.props.installed[s].version),this.state={showNews:null},this.currentRef=J.createRef(),this.current=t.current,this.props.onUpdateSelected([...this.updateAvailable],this.updateAvailable)}static isUpdateAvailable(t){const{oldVersion:s,newVersion:i,name:n}=t;try{return V.gt(i,s)}catch{return console.warn(`Cannot compare "${i}" and "${s}" of adapter ${n}`),!1}}detectUpdates(){const t=[];return Object.keys(this.props.repository).forEach(s=>{const i=this.props.installed[s];s==="js-controller"||s==="admin"||i&&this.props.repository[s].version&&i.ignoreVersion!==this.props.repository[s].version&&X.isUpdateAvailable({oldVersion:i.version,newVersion:this.props.repository[s].version,name:s})&&(K(this.props.repository[s].messages,i.version,this.props.repository[s].version)?console.log(`Adapter ${s} is filtered out from update all functionality, because it has messages which need to be read before update`):this.props.rightDependenciesFunc(s)?t.push(s):console.log(`Adapter ${s} is filtered out from update all functionality, because its dependencies are not met`))}),t.sort(),t}getNews(t){const s=this.props.repository[t],i=this.props.installed[t],n=[];return i&&(s!=null&&s.news)&&Object.keys(s.news).forEach(r=>{try{V.gt(r,i.version)&&n.push({version:r,news:this.props.noTranslation?s.news[r].en:s.news[r][this.props.lang]||s.news[r].en})}catch{console.warn(`Cannot compare "${r}" and "${i.version}"`)}}),n}renderOneAdapter(t){const s=this.props.selected.includes(t);if((this.props.finished||this.props.inProcess)&&!s||!this.props.installed[t])return null;const i=`.${this.props.installed[t].localIcon}`;return e.jsxs(o.ListItem,{dense:!0,sx:{"&.MuiListItem-root":x.Utils.getStyle(this.props.theme,A.listItem,this.props.updated.includes(t)&&A.updateDone)},ref:this.props.current===t?this.currentRef:null,secondaryAction:!this.props.finished&&!this.props.inProcess?e.jsx(o.Checkbox,{edge:"end",checked:s,tabIndex:-1,disableRipple:!0,disabled:this.props.inProcess,onClick:()=>{const n=[...this.props.selected],r=n.indexOf(t);r!==-1?n.splice(r,1):(n.push(t),n.sort()),this.props.onUpdateSelected(n)}}):this.props.current===t&&!this.props.stopped&&!this.props.finished&&e.jsx(o.CircularProgress,{}),children:[e.jsx(o.ListItemIcon,{sx:A.minWidthCss,children:e.jsx(o.Avatar,{variant:"square",alt:t,src:i,style:A.smallAvatar})}),e.jsx(o.ListItemText,{primary:t,title:this.getNews(t).map(n=>`${n.version}: ${n.news}`).join(`
1
+ import{j as e}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as L,a as J}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{s as V,C as ut,G as gt,H as mt,L as xt,I as N,A as ft,a as yt,b as z,c as at,S as tt}from"./bootstrap-C5UDqwR8.js";import{i as o,a as g}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{s as lt}from"./index-Dy_ekAsY.js";import{M as wt,s as bt,C as et}from"./sentry-C8mPNiGL.js";import{i as x}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{c as K,A as jt}from"./AdapterUpdateDialog-DgGBsRTF.js";import{t as pt,b as Ct,w as vt}from"./createTheme-O_VGsRib.js";import{C as Tt}from"./CustomModal-DCjdghJB.js";import{a as dt}from"./amber-D7aVlNg3.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./ace-DgO9yth5.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./ext-language_tools-DJmHbGA8.js";import"./preload-helper-BDBacUwf.js";import"./sdk-CXXcV9KR.js";import"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./ThemeProvider-DPY2Djdh.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";import"./en-US-B8gg5zk_.js";import"./iconBase-CB0tx1VT.js";import"./zh-cn-Dy5SHo8v.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./State-DhReNijC.js";const A={smallAvatar:{width:24,height:24},listItem:p=>({mb:"2px",background:p.palette.background,"@media screen and (max-width: 400px)":{pl:"2px"}}),toVersion:p=>({color:p.palette.mode==="dark"?"#00dc00":"#008100",fontWeight:"bold",ml:"4px"}),updateDone:{background:"#5ef05e80",opacity:.7},minWidthCss:{"@media screen and (max-width: 400px)":{minWidth:32}},wrapperButton:{},typography:{paddingRight:30},versions:{minWidth:110,display:"inline-block"},closeButton:p=>({position:"absolute",right:8,top:8,color:p.palette.grey[500]}),languageButton:{position:"absolute",right:60,top:8},languageButtonActive:p=>({color:p.palette.primary.main}),versionHeader:p=>({background:"#4dabf5",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:p.palette.mode==="dark"?"black":"white"}),repoStableVersionText:p=>({color:p.palette.mode==="dark"?"#8dff7a":"#2b9800",fontWeight:"bold",marginLeft:"4px"}),repoLatestVersionText:p=>({color:p.palette.mode==="dark"?"#a3fcff":"#005498",fontWeight:"bold",marginLeft:"4px"})};class X extends L.Component{updateAvailable;initialVersions;currentRef;current;constructor(t){super(t),this.updateAvailable=this.detectUpdates(),this.initialVersions={},this.updateAvailable.forEach(s=>this.initialVersions[s]=this.props.installed[s].version),this.state={showNews:null},this.currentRef=J.createRef(),this.current=t.current,this.props.onUpdateSelected([...this.updateAvailable],this.updateAvailable)}static isUpdateAvailable(t){const{oldVersion:s,newVersion:i,name:n}=t;try{return V.gt(i,s)}catch{return console.warn(`Cannot compare "${i}" and "${s}" of adapter ${n}`),!1}}detectUpdates(){const t=[];return Object.keys(this.props.repository).forEach(s=>{const i=this.props.installed[s];s==="js-controller"||s==="admin"||i&&this.props.repository[s].version&&i.ignoreVersion!==this.props.repository[s].version&&X.isUpdateAvailable({oldVersion:i.version,newVersion:this.props.repository[s].version,name:s})&&(K(this.props.repository[s].messages,i.version,this.props.repository[s].version)?console.log(`Adapter ${s} is filtered out from update all functionality, because it has messages which need to be read before update`):this.props.rightDependenciesFunc(s)?t.push(s):console.log(`Adapter ${s} is filtered out from update all functionality, because its dependencies are not met`))}),t.sort(),t}getNews(t){const s=this.props.repository[t],i=this.props.installed[t],n=[];return i&&(s!=null&&s.news)&&Object.keys(s.news).forEach(r=>{try{V.gt(r,i.version)&&n.push({version:r,news:this.props.noTranslation?s.news[r].en:s.news[r][this.props.lang]||s.news[r].en})}catch{console.warn(`Cannot compare "${r}" and "${i.version}"`)}}),n}renderOneAdapter(t){const s=this.props.selected.includes(t);if((this.props.finished||this.props.inProcess)&&!s||!this.props.installed[t])return null;const i=`.${this.props.installed[t].localIcon}`;return e.jsxs(o.ListItem,{dense:!0,sx:{"&.MuiListItem-root":x.Utils.getStyle(this.props.theme,A.listItem,this.props.updated.includes(t)&&A.updateDone)},ref:this.props.current===t?this.currentRef:null,secondaryAction:!this.props.finished&&!this.props.inProcess?e.jsx(o.Checkbox,{edge:"end",checked:s,tabIndex:-1,disableRipple:!0,disabled:this.props.inProcess,onClick:()=>{const n=[...this.props.selected],r=n.indexOf(t);r!==-1?n.splice(r,1):(n.push(t),n.sort()),this.props.onUpdateSelected(n)}}):this.props.current===t&&!this.props.stopped&&!this.props.finished&&e.jsx(o.CircularProgress,{}),children:[e.jsx(o.ListItemIcon,{sx:A.minWidthCss,children:e.jsx(o.Avatar,{variant:"square",alt:t,src:i,style:A.smallAvatar})}),e.jsx(o.ListItemText,{primary:t,title:this.getNews(t).map(n=>`${n.version}: ${n.news}`).join(`
2
2
  `),secondary:e.jsxs("span",{children:[e.jsxs("div",{style:A.versions,children:[this.initialVersions[t]," →",e.jsx(o.Box,{component:"span",sx:A.toVersion,children:this.props.repository[t].version})]}),e.jsx(o.IconButton,{title:x.I18n.t("Show change log"),onClick:()=>this.setState({showNews:{adapter:t,version:this.props.repository[t].version,fromVersion:this.initialVersions[t]}}),size:"small",children:e.jsx(g.Info,{})})]})})]},t)}getReactNews(t,s){var d,l,u,m;const i=this.props.repository[t],n=this.props.installed[t];s=s||n.version;const r=[];let a,c;const h=this.props.repository._repoInfo;return h!=null&&h.stable?(a=(d=this.props.repository[t])==null?void 0:d.version,c=(l=this.props.repository[t])==null?void 0:l.latestVersion):(a=(u=this.props.repository[t])==null?void 0:u.stable,c=(m=this.props.repository[t])==null?void 0:m.version),n&&(i!=null&&i.news)&&Object.keys(i.news).forEach(f=>{try{if(V.gt(f,s)&&i.news[f]){const b=(this.props.noTranslation?i.news[f].en||"":i.news[f][this.props.lang]||i.news[f].en||"").split(`
3
3
  `).map(I=>I.trim().replace(/^\*\s?/,"").replace(/<!--[^>]*->/g,"").replace(/<! -[^>]*->/g,"").trim()).filter(I=>!!I);r.push(e.jsxs(o.Grid2,{children:[e.jsxs(o.Typography,{sx:A.versionHeader,children:[f,c===f?e.jsx(o.Box,{component:"span",sx:A.repoLatestVersionText,children:"(latest)"}):null,a===f?e.jsx(o.Box,{component:"span",sx:A.repoStableVersionText,children:`(${x.I18n.t("stable")})`}):null]}),b.map((I,T)=>e.jsx(o.Typography,{component:"div",variant:"body2",children:`• ${I}`},`${f}-${T}`))]},f))}}catch{console.warn(`Cannot compare "${f}" and "${s}"`)}}),r}renderShowNews(){if(this.state.showNews){const t=this.getReactNews(this.state.showNews.adapter,this.state.showNews.fromVersion),s=x.Utils.getStyle(this.props.theme,A.closeButton),i=x.Utils.getStyle(this.props.theme,A.languageButtonActive);return e.jsxs(o.Dialog,{onClose:()=>this.setState({showNews:null}),open:!0,children:[e.jsx(o.DialogTitle,{children:e.jsxs(o.Typography,{component:"h2",variant:"h6",sx:{"&.MuiTypography-root":A.typography},children:[e.jsx("div",{style:{width:"calc(100% - 60px)"},children:x.I18n.t('Update "%s" to v%s',this.state.showNews.adapter,this.state.showNews.version)}),e.jsx(o.IconButton,{size:"large",style:s,onClick:()=>this.setState({showNews:null}),children:e.jsx(g.Close,{})}),x.I18n.getLanguage()!=="en"&&this.props.toggleTranslation?e.jsx(o.IconButton,{size:"large",style:{...A.languageButton,...this.props.noTranslation?i:void 0},onClick:this.props.toggleTranslation,title:x.I18n.t("Disable/Enable translation"),children:e.jsx(g.Language,{})}):null]})}),e.jsx(o.DialogContent,{dividers:!0,children:e.jsx(o.Grid2,{container:!0,direction:"column",spacing:2,wrap:"nowrap",children:t.length?e.jsxs(o.Grid2,{children:[e.jsx(o.Typography,{variant:"h6",gutterBottom:!0,children:x.I18n.t("Change log")}),e.jsx(o.Grid2,{container:!0,spacing:2,direction:"column",wrap:"nowrap",children:t})]}):x.I18n.t("No change log available")})}),e.jsx(o.DialogActions,{style:A.wrapperButton,children:e.jsx(o.Button,{variant:"contained",onClick:()=>this.setState({showNews:null}),color:"grey",startIcon:e.jsx(g.Close,{}),children:x.I18n.t("Close")})})]})}return null}render(){return this.current!==this.props.current&&(this.current=this.props.current,setTimeout(()=>{var t;return(t=this.currentRef.current)==null?void 0:t.scrollIntoView()},200)),e.jsxs(o.List,{style:A.root,children:[this.updateAvailable.map(t=>this.renderOneAdapter(t)),this.renderShowNews()]})}}const W={dialogRoot:{height:"calc(100% - 64px)"},wrapperHead:{justifyContent:"space-between",display:"flex"},checkbox:{marginRight:10},appBar:p=>({flexWrap:"wrap",position:"sticky",bottom:-10,pl:1,background:p.name==="blue"?"#5d6467":p.name==="dark"?"#5b5b5b":"#FFF"}),container:{overflow:"hidden",height:"calc(100% - 48px)","@media screen and (max-width: 602px)":{height:"auto"}},content:{"@media screen and (max-width: 500px)":{p:1}},languageButton:{position:"absolute",right:73,top:11},languageButtonActive:p=>({color:p.palette.primary.main})};class At extends L.Component{updateAvailable=[];onAdapterFinished;processList;constructor(t){super(t),this.state={selected:[],inProcess:!1,finished:!1,current:"",updated:[],stopped:!1,debug:(window._localStorage||window.localStorage).getItem("AdaptersUpdaterDialog.debug")==="true",stopOnError:(window._localStorage||window.localStorage).getItem("AdaptersUpdaterDialog.stopOnError")!=="false",closeOnFinished:(window._localStorage||window.localStorage).getItem("AdaptersUpdaterDialog.closeOnFinished")==="true",currentVersion:""},this.updateAvailable=[]}updateAdapter(t,s,i){this.onAdapterFinished=i,this.setState({current:t,currentVersion:s})}onStartUpdate(){this.setState({inProcess:!0},()=>{this.props.onSetCommandRunning(!0),this.processList=[...this.state.selected].map(t=>{var s;return{adapter:t,version:(s=this.props.repository[t])==null?void 0:s.version}}),this.updateAdapters(()=>{this.setState({inProcess:!1,finished:!0},()=>{this.props.onSetCommandRunning(!1),this.state.closeOnFinished&&this.props.onClose(!!this.state.updated.length)})})})}updateAdapters(t){if(!this.processList||!this.processList.length||this.state.stopped)t&&t();else{const{adapter:s,version:i}=this.processList.shift();this.updateAdapter(s,i,()=>{const n=[...this.state.updated];n.push(s),this.setState({updated:n},()=>setTimeout(()=>this.updateAdapters(t),200))})}}render(){const t=this.props.noTranslation?x.Utils.getStyle(this.props.theme,W.languageButtonActive):void 0;return e.jsxs(o.Dialog,{open:!0,maxWidth:"lg",fullWidth:!!this.state.current,onClose:()=>this.props.onClose(!!this.state.updated.length),"aria-labelledby":"update-dialog-title","aria-describedby":"update-dialog-description",sx:{"& .MuiPaper-root":W.dialogRoot},scroll:"paper",children:[e.jsx(o.DialogTitle,{id:"update-dialog-title",children:e.jsxs("div",{style:W.wrapperHead,children:[this.props.t("Update %s adapter(s)",this.state.selected.length),!this.state.finished&&!this.state.inProcess&&e.jsx(o.Tooltip,{title:this.props.t("Select/Unselect all"),slotProps:{popper:{sx:{pointerEvents:"none"}}},children:e.jsx(o.Checkbox,{checked:this.state.selected.length===this.updateAvailable.length,style:W.checkbox,tabIndex:-1,indeterminate:this.state.selected.length!==this.updateAvailable.length&&this.state.selected.length!==0,disableRipple:!0,onClick:()=>{let s=[];this.state.selected.length!==this.updateAvailable.length&&(s=[...this.updateAvailable]),this.setState({selected:s})}})}),x.I18n.getLanguage()!=="en"&&this.props.toggleTranslation?e.jsx(o.IconButton,{size:"large",style:{...W.languageButton,...t},onClick:()=>this.props.toggleTranslation(),title:x.I18n.t("Disable/Enable translation"),children:e.jsx(g.Language,{})}):null]})}),e.jsxs(o.DialogContent,{sx:{"&.MuiDialogContent-root":W.content},style:{height:"100%"},children:[e.jsxs(o.Grid2,{container:!0,direction:"row",sx:W.container,children:[e.jsx(o.Grid2,{style:{height:"100%",overflow:"hidden",width:this.state.current?250:"100%"},children:e.jsx("div",{style:{height:"100%",overflow:"auto"},children:e.jsx(X,{finished:this.state.finished,inProcess:this.state.inProcess,selected:this.state.selected,current:this.state.current,stopped:this.state.stopped,updated:this.state.updated,lang:this.props.lang,installed:this.props.installed,repository:this.props.repository,noTranslation:this.props.noTranslation,toggleTranslation:this.props.toggleTranslation,onUpdateSelected:(s,i)=>{i&&(this.updateAvailable=i),this.setState({selected:s})},theme:this.props.theme,rightDependenciesFunc:this.props.rightDependenciesFunc})})}),!!this.state.current&&e.jsx(o.Grid2,{style:{height:"100%",overflow:"hidden",width:"calc(100% - 260px)",minWidth:240},children:e.jsx(ut,{noSpacing:!0,ready:!0,host:this.props.currentHost,socket:this.props.socket,t:this.props.t,cmd:`upgrade ${this.state.current}@${this.state.currentVersion}${this.state.debug?" --debug":""}`,onFinished:()=>this.onAdapterFinished(),errorFunc:()=>{this.state.stopOnError?(this.setState({stopped:!0,finished:!0}),this.onAdapterFinished=null,this.props.onSetCommandRunning(!1)):this.onAdapterFinished()}},this.state.current)})]}),e.jsxs(o.Toolbar,{variant:"dense",disableGutters:!0,sx:W.appBar,children:[e.jsx(o.FormControlLabel,{control:e.jsx(o.Checkbox,{disabled:this.state.finished,checked:this.state.stopOnError,onChange:()=>{(window._localStorage||window.localStorage).setItem("AdaptersUpdaterDialog.stopOnError",this.state.stopOnError?"false":"true"),this.setState({stopOnError:!this.state.stopOnError})}}),label:this.props.t("Stop on error")}),e.jsx(o.FormControlLabel,{control:e.jsx(o.Checkbox,{disabled:this.state.finished,checked:this.state.closeOnFinished,onChange:()=>{(window._localStorage||window.localStorage).setItem("AdaptersUpdaterDialog.closeOnFinished",this.state.closeOnFinished?"false":"true"),this.setState({closeOnFinished:!this.state.closeOnFinished})}}),label:this.props.t("Close on finished")}),e.jsx(o.FormControlLabel,{control:e.jsx(o.Checkbox,{disabled:this.state.finished||this.state.inProcess,checked:this.state.debug,onChange:()=>{(window._localStorage||window.localStorage).setItem("AdaptersUpdaterDialog.debug",this.state.debug?"false":"true"),this.setState({debug:!this.state.debug})}}),label:this.props.t("Debug info")})]})]}),e.jsxs(o.DialogActions,{children:[e.jsx(o.Button,{id:"adapters-update-dialog-update",variant:"contained",disabled:this.state.stopped||this.state.inProcess||this.state.finished||!this.state.selected.length,onClick:()=>this.onStartUpdate(),color:"primary",autoFocus:!0,startIcon:e.jsx(g.Check,{}),children:this.props.t("Update")}),e.jsx(o.Button,{id:"adapters-update-dialog-cancel",variant:"contained",disabled:!this.state.inProcess,color:"grey",startIcon:e.jsx(g.Cancel,{}),onClick:()=>{this.setState({stopped:!0,finished:!0}),this.props.onSetCommandRunning(!1)},children:this.props.t("Cancel")}),e.jsx(o.Button,{id:"adapters-update-dialog-close",variant:"contained",onClick:()=>this.props.onClose(!!this.state.updated.length),disabled:this.state.inProcess&&!this.state.stopped,color:this.state.stopped?"error":"grey",startIcon:e.jsx(g.Close,{}),children:this.props.t("Close")})]})]})}}class st extends gt{host;prefix;constructor(t,s){super(t,`${s}.adapter`,"adapter"),this.prefix=`${s}.adapter.`,this.host=s}getObject(t){return this.objects&&this.objects[this.prefix+t]||null}getHost(){return this.host}}const St="data:image/svg+xml,%3csvg%20viewBox='0%200%202500%202500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M0%200h2500v2500H0z'%20fill='%23c00'/%3e%3cpath%20d='M1241.5%20268.5h-973v1962.9h972.9V763.5h495v1467.9h495V268.5z'%20fill='%23fff'/%3e%3c/svg%3e";function Z(p){return{id:`github-install-dialog-tab-${p}`,"aria-controls":`github-install-dialog-panel-${p}`}}const C={root:p=>({backgroundColor:p.palette.background.paper,width:"100%",height:"100%"}),paper:{maxWidth:1e3},tabPaper:{padding:16},title:p=>({mt:"10px",p:1,ml:1,fontSize:18,color:p.palette.primary.main}),warningText:{color:"#f53939"},noteText:{marginTop:16},errorTextNoGit:{fontSize:13,color:"#ff1616"},listIcon:{width:24,height:24},listIconWithMargin:{width:24,height:24,marginRight:8},tabSelected:p=>({color:p.palette.mode==="dark"?p.palette.secondary.contrastText:"#222 !important"})};function It(p){const t=[];for(let s=0;s<p.length;s++)typeof p[s]=="object"?p[s].forEach(i=>t.push(i)):t.push(p[s]);return t}const it=10;class kt extends J.Component{constructor(t){super(t);let s=[];const i=(window._localstorage||window.localStorage).getItem("App.npmHistory");if(i)try{s=JSON.parse(i)}catch{}this.state={autoCompleteValue:(window._localstorage||window.localStorage).getItem("App.autocomplete")||null,debug:(window._localstorage||window.localStorage).getItem("App.gitDebug")==="true",url:(window._localstorage||window.localStorage).getItem("App.userUrl")||"",currentTab:(window._localstorage||window.localStorage).getItem("App.gitTab")||"npm",customHistory:s}}renderNpm(){return this.state.currentTab==="npm"?e.jsxs(o.Paper,{style:C.tabPaper,id:"github-install-dialog-panel-npm",children:[e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(o.FormControlLabel,{control:e.jsx(o.Checkbox,{checked:this.state.debug,onChange:t=>{(window._localstorage||window.localStorage).setItem("App.gitDebug",t.target.checked?"true":"false"),this.setState({debug:t.target.checked})}}),label:this.props.t("Debug outputs")})}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end"},children:[e.jsx(g.Sms,{style:{marginRight:10}}),e.jsx(o.Autocomplete,{fullWidth:!0,value:this.state.autoCompleteValue,onChange:(t,s)=>{(window._localstorage||window.localStorage).setItem("App.autocomplete",s),this.setState({autoCompleteValue:s})},options:this.getList(),getOptionLabel:t=>(t==null?void 0:t.name)??"",renderInput:t=>{var i;const s={...t};return s.InputProps=s.InputProps||{},s.InputProps.startAdornment=e.jsx(o.InputAdornment,{position:"start",children:e.jsx(x.Icon,{src:((i=this.state.autoCompleteValue)==null?void 0:i.icon)||"",style:C.listIcon})}),e.jsx(o.TextField,{variant:"standard",...t,label:x.I18n.t("Select adapter")})},renderOption:(t,s)=>e.jsxs(o.Box,{component:"li",sx:{"& > img":{mr:2,flexShrink:0}},...t,children:[e.jsx(x.Icon,{src:(s==null?void 0:s.icon)||"",style:C.listIconWithMargin}),(s==null?void 0:s.name)??""]})})]}),e.jsx("div",{style:{fontSize:24,fontWeight:"bold",marginTop:40},children:this.props.t("Warning!")}),e.jsx("div",{style:C.warningText,children:this.props.t("npm_warning","NPM","NPM")}),e.jsx("div",{style:C.noteText,children:this.props.t("github_note")})]}):null}renderGitHub(){return this.state.currentTab==="GitHub"?e.jsxs(o.Paper,{style:C.tabPaper,id:"github-install-dialog-panel-github",children:[e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(o.FormControlLabel,{control:e.jsx(o.Checkbox,{checked:this.state.debug,onChange:t=>{(window._localstorage||window.localStorage).setItem("App.gitDebug",t.target.checked?"true":"false"),this.setState({debug:t.target.checked})}}),label:this.props.t("Debug outputs")})}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-end"},children:[e.jsx(g.Sms,{style:{marginRight:10}}),e.jsx(o.Autocomplete,{fullWidth:!0,value:this.state.autoCompleteValue,getOptionDisabled:t=>!!(t!=null&&t.nogit),renderOption:(t,s)=>e.jsxs(o.Box,{component:"li",sx:{"& > img":{mr:2,flexShrink:0}},...t,children:[e.jsx(x.Icon,{src:(s==null?void 0:s.icon)||"",style:C.listIconWithMargin}),(s==null?void 0:s.name)??"",(s==null?void 0:s.nogit)&&e.jsx("div",{style:C.errorTextNoGit,children:x.I18n.t("This adapter cannot be installed from git as must be built before installation.")})]}),onChange:(t,s)=>{(window._localstorage||window.localStorage).setItem("App.autocomplete",s),this.setState({autoCompleteValue:s})},options:this.getList(),getOptionLabel:t=>(t==null?void 0:t.name)??"",renderInput:t=>{var i;const s={...t};return s.InputProps=s.InputProps||{},s.InputProps.startAdornment=e.jsx(o.InputAdornment,{position:"start",children:e.jsx(x.Icon,{src:((i=this.state.autoCompleteValue)==null?void 0:i.icon)||"",style:C.listIconWithMargin})}),e.jsx(o.TextField,{variant:"standard",...t,label:x.I18n.t("Select adapter")})}})]}),e.jsx("div",{style:{fontSize:24,fontWeight:"bold",marginTop:40},children:this.props.t("Warning!")}),e.jsx("div",{style:C.warningText,children:this.props.t("github_warning","GitHub","GitHub")}),e.jsx("div",{style:C.noteText,children:this.props.t("github_note")})]}):null}renderCustom(){return this.state.currentTab==="URL"?e.jsxs(o.Paper,{style:C.tabPaper,id:"github-install-dialog-panel-custom",children:[e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(o.FormControlLabel,{control:e.jsx(o.Checkbox,{checked:this.state.debug,onChange:t=>{(window._localstorage||window.localStorage).setItem("App.gitDebug",t.target.checked?"true":"false"),this.setState({debug:t.target.checked})}}),label:this.props.t("Debug outputs")})}),e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx(o.Autocomplete,{fullWidth:!0,value:this.state.url||"",onInputChange:(t,s)=>{(window._localstorage||window.localStorage).setItem("App.userUrl",s||""),this.setState({url:s})},onChange:(t,s)=>{(window._localstorage||window.localStorage).setItem("App.userUrl",s||""),this.setState({url:s})},renderOption:(t,s)=>e.jsxs(o.Box,{component:"li",...t,style:{display:"flex",alignItems:"left"},children:[s,e.jsx("div",{style:{flexGrow:1}}),e.jsx(o.IconButton,{size:"small",onClick:i=>{i.stopPropagation();const n=this.state.customHistory.filter(r=>r!==s);(window._localstorage||window.localStorage).setItem("App.npmHistory",JSON.stringify(n)),this.setState({customHistory:n})},children:e.jsx(g.Delete,{})})]}),freeSolo:!0,options:this.state.customHistory,renderInput:t=>e.jsx(o.TextField,{variant:"standard",...t,onKeyUp:s=>{if(s.key==="Enter"&&this.state.url){const i=this.state.customHistory.filter(n=>n!==this.state.url);i.unshift(this.state.url),i.length>it&&i.pop(),(window._localstorage||window.localStorage).setItem("App.npmHistory",JSON.stringify(i)),this.state.url.includes(".")?this.props.installFromUrl(this.state.url,this.state.debug,!0):this.props.installFromUrl(`iobroker.${this.state.url}`,this.state.debug,!0),this.setState({autoCompleteValue:null,url:""}),this.props.onClose()}},helperText:this.props.t("URL or file path"),label:this.props.t("URL")})})}),e.jsx("div",{style:{fontSize:24,fontWeight:"bold",marginTop:40},children:this.props.t("Warning!")}),e.jsx("div",{style:C.warningText,children:this.props.t("github_warning","URL","URL")}),e.jsx("div",{style:C.noteText,children:this.props.t("github_note")})]}):null}getList(){const t=this.props.categories.map(i=>i.adapters),s=It(t);return s.sort(),s.map((i,n)=>{if(n&&s[n-1]===i)return null;const r=this.props.repository[i];if(!(r!=null&&r.controller)){const a=(r.extIcon||r.meta||r.readme||"").toString().split("/");let c=r==null?void 0:r.name;c||(c=r.titleLang,c&&typeof c=="object"?c=c[x.I18n.getLanguage()]||c.en:c=r.title||i);const h={value:`${i}/${a[3]}`,name:`${c} [${a[3]}]`,icon:r.extIcon||r.icon,nogit:!!r.nogit,title:i};return this.props.installed[c]&&c!=="admin"&&(h.icon=`/adapter/${i}/${r.icon.split("/admin/").pop()}`),h}return null}).filter(i=>i).sort((i,n)=>i.name<n.name?-1:i.name>n.name?1:0)}render(){var s;const t=()=>this.setState({autoCompleteValue:null,url:""});return e.jsxs(o.Dialog,{onClose:()=>this.props.onClose(),open:!0,sx:{"& .MuiDialog-paper":C.paper},children:[e.jsx(o.DialogContent,{dividers:!0,children:e.jsxs(o.Box,{component:"div",sx:C.root,children:[e.jsx(o.AppBar,{position:"static",color:"default",children:e.jsxs(o.Tabs,{value:this.state.currentTab,onChange:(i,n)=>{(window._localstorage||window.localStorage).setItem("App.gitTab",n),this.setState({currentTab:n})},variant:"fullWidth",indicatorColor:"secondary",children:[e.jsx(o.Tab,{label:this.props.t("From npm"),wrapped:!0,sx:{"&.Mui-selected":C.tabSelected},icon:e.jsx("img",{src:St,alt:"npm",width:24,height:24}),...Z("npm"),value:"npm"}),e.jsx(o.Tab,{label:this.props.t("From github"),wrapped:!0,sx:{"&.Mui-selected":C.tabSelected},icon:e.jsx(lt,{style:{width:24,height:24},width:24,height:24}),...Z("github"),value:"GitHub"}),e.jsx(o.Tab,{label:this.props.t("Custom"),wrapped:!0,sx:{"&.Mui-selected":C.tabSelected},icon:e.jsx(g.Language,{width:24,height:24}),...Z("custom"),value:"URL"})]})}),e.jsx(o.Box,{component:"div",sx:C.title,children:this.props.t("Install or update the adapter from %s",this.state.currentTab||"npm")}),this.renderNpm(),this.renderGitHub(),this.renderCustom()]})}),e.jsxs(o.DialogActions,{children:[e.jsx(o.Button,{id:"github-install-dialog-ok",variant:"contained",disabled:(this.state.currentTab==="GitHub"||this.state.currentTab==="npm")&&!((s=this.state.autoCompleteValue)!=null&&s.value)||this.state.currentTab==="URL"&&!this.state.url,autoFocus:!0,onClick:async()=>{var i,n;if(this.state.currentTab==="GitHub"){const r=(((i=this.state.autoCompleteValue)==null?void 0:i.value)||"").split("/"),a=`${r[1]}/ioBroker.${r[0]}`;this.props.installFromUrl(a,this.state.debug,!0)}else if(this.state.currentTab==="URL"){const r=this.state.customHistory.filter(a=>a!==this.state.url);r.unshift(this.state.url),r.length>it&&r.pop(),(window._localstorage||window.localStorage).setItem("App.npmHistory",JSON.stringify(r)),this.state.url.includes(".")?this.props.installFromUrl(this.state.url,this.state.debug,!0):this.props.installFromUrl(`iobroker.${this.state.url}`,this.state.debug,!0)}else if(this.state.currentTab==="npm"){const r=(((n=this.state.autoCompleteValue)==null?void 0:n.value)||"").split("/")[0],a=r.includes(".")?r.split(".")[1]:r;try{await this.props.installFromUrl(`iobroker.${a}@latest`,this.state.debug,!0),this.props.upload(a)}catch(c){console.error(`Installation from url failed: ${c.message}`)}}this.props.onClose(),t()},color:"primary",startIcon:e.jsx(g.Check,{}),children:this.props.t("Install")}),e.jsx(o.Button,{id:"github-install-dialog-close",variant:"contained",onClick:()=>{this.props.onClose(),t()},color:"grey",startIcon:e.jsx(g.Close,{}),children:this.props.t("Close")})]})]})}}const B={formControl:{marginTop:24,width:100},closeButton:p=>({position:"absolute",right:8,top:8,color:p.palette.grey[500]}),languageButton:{position:"absolute",right:60,top:8},languageButtonActive:p=>({color:p.palette.primary.main}),paper:{},typography:{pr:"30px"},messageText:{},messageColor_warn:{color:"#cb7642"},messageColor_error:{color:"#f5614d"},messageColor_info:{color:"#5abd29"},messageTitle_warn:p=>({background:"#cb7642",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:p.palette.mode==="dark"?"black":"white"}),messageTitle_error:p=>({background:"#f5614d",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:p.palette.mode==="dark"?"black":"white"}),messageTitle_info:p=>({background:"#5abd29",borderRadius:"3px",pl:"10px",fontWeight:"bold",color:p.palette.mode==="dark"?"black":"white"}),deps:p=>({m:"10px",fontSize:16,color:p.palette.mode==="dark"?"#e70000":"#840101"})};class Dt extends L.Component{t;messages=null;lang;constructor(t){super(t),this.state={instanceNumbers:[]},this.t=t.t,this.lang=x.I18n.getLanguage(),this.messages=K(t.adapterObject.messages,null,t.adapterObject.version,t.instances)}componentDidMount(){this.props.instancesWorker.getObjects().then(t=>{const s=Object.keys(t).filter(i=>{var n,r;return((r=(n=t[i])==null?void 0:n.common)==null?void 0:r.name)===this.props.adapter}).map(i=>i.substring(i.lastIndexOf(".")+1));this.setState({instanceNumbers:s})})}getAvailableInstances(){const t=[];t.push(e.jsx(o.MenuItem,{value:"auto",children:this.t("auto")},"auto"));for(let s=0;s<=100&&(this.state.instanceNumbers.includes(s.toString())||t.push(e.jsx(o.MenuItem,{value:s.toString(),children:s},s)),!(t.length>11));s++);return t}checkDependencies(t=this.props.dependencies){if(!t)return"";const s=[];for(const i of t)i.installedVersion?i.rightVersion||s.push(`${this.props.t("Invalid version of %s. Required %s. Current ",i.name,i.version)}${i.installedVersion}`):s.push(this.props.t("No version of %s",i.name,i.name));return s.length?s.map(i=>e.jsx("div",{children:i},i)):""}getText(t,s){return t&&typeof t=="object"?s?t.en:t[this.lang]||t.en:typeof t=="object"?"":t}renderOneMessage(t,s){return e.jsxs(o.Grid2,{children:[e.jsx(o.Typography,{sx:B[`messageTitle_${t.level||"warn"}`],children:this.getText(t.title,this.props.noTranslation)||""}),e.jsx(o.Typography,{component:"div",variant:"body2",style:B.messageText,children:this.getText(t.text,this.props.noTranslation)||""}),t.link?e.jsx(o.Button,{onClick:()=>{window.open(t.link,"_blank").focus()},startIcon:e.jsx(g.Public,{}),variant:"contained",color:"grey",children:this.getText(t.linkText,this.props.noTranslation)||this.props.t("More info")}):null]},s)}renderMessages(){return this.messages?e.jsx(o.Grid2,{container:!0,spacing:2,direction:"column",wrap:"nowrap",sx:{marginBottom:1},children:this.messages.map((t,s)=>this.renderOneMessage(t,s))}):null}render(){const t=this.checkDependencies();return e.jsxs(o.Dialog,{onClose:()=>{},open:!0,sx:{"& .MuiDialog-paper":B.paper},children:[e.jsx(o.DialogTitle,{children:e.jsxs(o.Typography,{component:"h2",variant:"h6",sx:{"&.MuiTypography-root":B.typography},children:[this.t("You are going to add new instance:")," ",this.props.adapter,e.jsx(o.IconButton,{size:"large",sx:B.closeButton,onClick:()=>this.props.onClose(!1),children:e.jsx(g.Close,{})}),this.messages&&this.lang!=="en"&&this.props.toggleTranslation?e.jsx(o.IconButton,{size:"large",style:x.Utils.getStyle(this.props.theme,B.languageButton,this.props.noTranslation&&B.languageButtonActive),onClick:this.props.toggleTranslation,title:x.I18n.t("Disable/Enable translation"),children:e.jsx(g.Language,{})}):null]})}),e.jsxs(o.DialogContent,{dividers:!0,children:[this.renderMessages(),!t&&this.props.expertMode?e.jsxs(o.Grid2,{container:!0,direction:"column",children:[e.jsx(mt,{tooltip:this.t("Select host to add the instance"),expertMode:!0,socket:this.props.socket,hostsWorker:this.props.hostsWorker,currentHost:this.props.currentHost,setCurrentHost:(s,i)=>this.props.onHostChange(i.replace(/^system\.host\./,""))}),e.jsxs(o.FormControl,{variant:"standard",style:B.formControl,children:[e.jsx(o.InputLabel,{id:"instance-label",children:this.t("Instance")}),e.jsx(o.Select,{variant:"standard",labelId:"instance-label",value:this.props.currentInstance,onChange:this.props.onInstanceChange,children:this.getAvailableInstances()})]})]}):null,e.jsx(o.Box,{component:"div",sx:B.deps,children:t})]}),e.jsxs(o.DialogActions,{children:[e.jsx(o.Button,{id:"instance-add-dialog-ok",variant:"contained",autoFocus:!0,disabled:!!t,onClick:()=>this.props.onClose(!0),color:"primary",startIcon:e.jsx(g.Add,{}),children:this.t("Add")}),e.jsx(o.Button,{id:"instance-add-dialog-cancel",variant:"contained",onClick:()=>this.props.onClose(!1),color:"grey",startIcon:e.jsx(g.Close,{}),children:this.t("Close")})]})]})}}function q(p){var s;if(!p)return"";if((s=p.licenseInformation)!=null&&s.link)return p.licenseInformation.link;let t=p.licenseUrl;if(!t||!t.includes("/LICENSE")||!t.includes("raw.githubusercontent.com")){if(t=p.extIcon,!t){if(t=p.readme,!t)return console.error(`No extIcon for ${p.name||JSON.stringify(p)}`),"";t=t.replace("github.com","raw.githubusercontent.com").replace("/blob/","/"),t.includes("/main")?t=`${t.split("/main")[0]}/main/LICENSE`:t.includes("/master")&&(t=`${t.split("/master")[0]}/master/LICENSE`)}if(t.includes("/main"))t=`${t.split("/main")[0]}/main/LICENSE`;else if(t.includes("/master"))t=`${t.split("/master")[0]}/master/LICENSE`;else return""}return t}class P extends L.Component{constructor(t){super(t),this.state={showDialog:!1,showLicenseDialog:null,addInstanceHostName:"",addInstanceId:"auto",addInstanceDialog:""}}renderLicenseDialog(t){return this.state.showLicenseDialog?e.jsx(xt,{licenseType:this.state.showLicenseDialog.licenseType,url:this.state.showLicenseDialog.url,onClose:s=>{const i=s?this.state.showLicenseDialog:null;this.setState({showLicenseDialog:null,showDialog:!1},()=>{i&&(i.upload?P.upload(i.adapterName,t):this.addInstance({adapterName:i.adapterName,context:t}).catch(n=>window.alert(`Cannot add instance: ${n}`)))})}}):null}async addInstance(t){if(!t.customUrl){const i=t.context.repository[t.adapterName],n=K(i.messages,null,i.version,t.context.compactInstances);if(!t.instance&&(t.context.expertMode||n)){this.setState({addInstanceDialog:t.adapterName,showDialog:!0,addInstanceHostName:t.context.currentHost.replace(/^system\.host\./,""),addInstanceId:t.instance||"auto"});return}if(t.instance){const r=await t.context.instancesWorker.getObjects();if(r&&r[`system.adapter.${t.adapterName}.${t.instance}`]){window.alert(t.context.t("Instance %s already exists",`${t.adapterName}.${t.instance}`));return}}}const s=(this.state.addInstanceHostName||t.context.currentHost).replace(/^system\.host\./,"");try{await new Promise((i,n)=>{t.context.executeCommand(`${t.customUrl?"url":"add"} ${t.adapterName} ${t.instance?`${t.instance} `:""}--host ${s} ${t.debug||t.context.expertMode?"--debug":""}`,s,r=>r?n(new Error(`The process returned an exit code of ${r}`)):i())})}catch(i){window.alert(`${x.I18n.t("Cannot install")}: ${i}`)}}static getDependencies(t,s){var r,a;const i=s.repository[t],n=[];if(i){i.dependencies&&!Array.isArray(i.dependencies)&&(i.dependencies=[i.dependencies]),i.globalDependencies&&!Array.isArray(i.globalDependencies)&&(i.globalDependencies=[i.globalDependencies]);const c=i.node;if((r=i.dependencies)!=null&&r.length)for(const d of i.dependencies){const l={name:"",version:null,installed:!1,installedVersion:null,rightVersion:!1},u=typeof d!="string",m=Object.keys(d);if(l.name=u?m?m[0]:null:d,l.version=u?d[l.name]:null,l.name){const f=s.installed[l.name];l.installed=!!f,l.installedVersion=f?f.version:null;try{l.rightVersion=f?u?V.satisfies(f.version,l.version,{includePrerelease:!0}):!0:!1}catch{l.rightVersion=!0}}n.push(l)}if((a=i.globalDependencies)!=null&&a.length)for(const d of i.globalDependencies){const l={name:"",version:null,installed:!1,installedVersion:null,rightVersion:!1},u=typeof d!="string",m=Object.keys(d);if(l.name=u?m?m[0]:null:d,l.version=u?d[l.name]:null,l.name){const f=s.installedGlobal[l.name];l.installed=!!f,l.installedVersion=f?f.version:null;try{l.rightVersion=f?u?V.satisfies(f.version,l.version,{includePrerelease:!0}):!0:!1}catch{l.rightVersion=!0}}n.push(l)}const h=i.ifInstalledDependencies;if(h&&typeof h=="object"&&!Array.isArray(h)){const d=Object.keys(h);for(const l of d){const u={name:l,version:h[l],installed:!1,installedVersion:null,rightVersion:!1};if(u.name){const m=s.installedGlobal[u.name];u.installed=!!m,u.installedVersion=m?m.version:null;try{u.rightVersion=m?V.satisfies(m.version,u.version,{includePrerelease:!0}):!0}catch{u.rightVersion=!0}}n.push(u)}}if(c){const d={name:"node",version:c,installed:!0,installedVersion:s.nodeJsVersion,rightVersion:!1};try{d.rightVersion=V.satisfies(s.nodeJsVersion,c)}catch{d.rightVersion=!0}n.push(d)}}return n}renderAddInstanceDialog(t){return this.state.addInstanceDialog?e.jsx(Dt,{adapter:this.state.addInstanceDialog,socket:t.socket,hostsWorker:t.hostsWorker,instancesWorker:t.instancesWorker,dependencies:P.getDependencies(this.state.addInstanceDialog,t),currentHost:`system.host.${this.state.addInstanceHostName}`,currentInstance:this.state.addInstanceId,t:t.t,onClose:s=>{const i=s?this.state.addInstanceDialog:"",n=s?this.state.addInstanceId:"";this.setState({addInstanceDialog:"",addInstanceId:"auto",showDialog:!1},()=>{if(i)try{this.addInstance({adapterName:i,instance:n,context:t})}catch(r){window.alert(`Cannot add instance: ${r}`)}})},onHostChange:s=>this.setState({addInstanceHostName:s.replace(/^system\.host\./,"")}),onInstanceChange:s=>this.setState({addInstanceId:s.target.value.toString()}),adapterObject:t.repository[this.state.addInstanceDialog],instances:t.compactInstances,toggleTranslation:t.toggleTranslation,noTranslation:this.props.noTranslation,expertMode:t.expertMode,theme:t.theme}):null}static upload(t,s){s.executeCommand(`upload ${t}${s.expertMode?" --debug":""}`)}onAddInstance(t,s){var a;const i=s.repository[t],n=q(i),r=((a=i.licenseInformation)==null?void 0:a.license)||i.license;r==="MIT"?this.addInstance({adapterName:t,context:s}).catch(c=>window.alert(`Cannot add instance: ${c}`)):this.setState({showLicenseDialog:{url:n,adapterName:t,licenseType:r},showDialog:!0})}renderDialogs(t){return this.state.showDialog?e.jsxs(e.Fragment,{children:[this.renderAddInstanceDialog(t),this.renderLicenseDialog(t)]}):null}}const F={name:{flexWrap:"nowrap",width:300,marginTop:0},nameDiv:{display:"flex",alignItems:"center"},categoryName:{fontWeight:"bold",cursor:"pointer"},green:{color:pt[500]},blue:{color:Ct[700]},category:{backgroundColor:"background.default"},marginRight5:{marginRight:5}};function Vt(p){const{installedCount:t,name:s,categoryName:i}=p;return e.jsxs(o.TableRow,{hover:!1,sx:F.category,children:[e.jsx(o.TableCell,{children:e.jsx(o.Grid2,{container:!0,spacing:1,alignItems:"center",style:F.name,children:e.jsx(o.Grid2,{component:"div",children:e.jsx(o.IconButton,{size:"small",onClick:p.onToggle,children:p.expanded?e.jsx(g.ExpandMore,{}):e.jsx(g.ChevronRight,{})})})})}),e.jsx(o.TableCell,{onClick:p.onToggle,children:e.jsxs("div",{style:{...F.nameDiv,...F.categoryName},children:[e.jsx(wt,{iconName:i,style:F.marginRight5}),s]})}),e.jsxs(o.TableCell,{colSpan:p.descHidden?5:6,children:[e.jsx(o.Typography,{component:"span",variant:"body2",style:F.green,children:t}),` ${p.t("of")} `,e.jsx(o.Typography,{component:"span",variant:"body2",style:F.blue,children:p.count}),` ${p.t("Adapters from this Group installed")}`]})]})}const S={rating:{marginBottom:20},listRating:{marginRight:8},listTime:{opacity:.5,fontStyle:"italic"},list:{},listOwn:p=>({backgroundColor:p.name==="colored"||p.name==="light"?"#16516e2e":p.palette.secondary.dark}),listTitle:p=>({backgroundColor:p.palette.primary.dark,pt:"4px",pb:"4px",mb:"4px",color:"#ffffff",textAlign:"center"}),languageFilter:{width:300},ratingTextControl:{width:"calc(100% - 138px)",marginRight:8},ratingLanguageControl:{width:130},noComments:{width:"100%",textAlign:"center",marginTop:16},commentCount:{marginTop:2,marginLeft:8,opacity:.8,fontSize:10,float:"right"},infoText:{textAlign:"left",fontSize:"14px"},infoTextContainer:{display:"flex",paddingBottom:"10px",alignItems:"center",gap:"10px"}},ot=[{id:"en",title:"English"},{id:"de",title:"Deutsch"},{id:"ru",title:"русский"},{id:"pt",title:"Portugues"},{id:"nl",title:"Nederlands"},{id:"fr",title:"français"},{id:"it",title:"Italiano"},{id:"es",title:"Espanol"},{id:"pl",title:"Polski"},{id:"uk",title:"Українська"},{id:"zh-cn",title:"简体中文"}];class Rt extends L.Component{constructor(t){super(t),this.state={ratingNumber:0,ratingComment:"",votings:null,ratingLang:this.props.lang,filterLang:(window._localStorage||window.localStorage).getItem("app.commentLang")||this.props.lang,commentsByLanguage:{}}}componentDidMount(){fetch(`https://rating.iobroker.net/adapter/${this.props.adapter}?uuid=${this.props.uuid}`).then(t=>t.json()).then(t=>{t=t||{},t.rating=t.rating||{};const s=Object.keys(t.rating);s.sort((n,r)=>t.rating[n].ts>t.rating[r].ts?-1:t.rating[n].ts<t.rating[r].ts?1:0);const i={};if(t.comments&&(t.comments.sort((n,r)=>n.ts>r.ts?-1:n.ts<r.ts?1:0),t.comments.forEach(n=>{i[n.lang]=i[n.lang]||0,i[n.lang]++})),s.length){const n=t.rating[s[0]];this.setState({votings:t,ratingNumber:n?n.r:0,commentsByLanguage:i})}else this.setState({votings:t,commentsByLanguage:i})})}setAdapterRating(t,s,i,n,r){return fetch("https://rating.iobroker.net/vote",{method:"POST",headers:{"Content-Type":"application/json"},redirect:"follow",body:JSON.stringify({uuid:this.props.uuid,adapter:t,version:s,rating:i,comment:n,lang:r})}).then(a=>a.json()).then(a=>(window.alert(`${this.props.t("Vote:")} ${t}@${s}=${i}`),delete a.adapter,a)).catch(a=>(window.alert(`Cannot vote: ${a}`),null))}renderInfoText(){return e.jsxs("div",{style:S.infoTextContainer,children:[e.jsx(g.Info,{}),e.jsx(o.Typography,{style:S.infoText,children:this.props.t("use GitHub for issues")})]})}renderComments(){var t;if((t=this.state.votings)!=null&&t.comments&&this.state.votings.comments.length){const s=this.state.votings.comments.find(i=>!(this.state.filterLang&&this.state.filterLang!=="_"&&i.lang!==this.state.filterLang));return e.jsxs("div",{style:{width:"100%",textAlign:"left"},children:[e.jsx(o.Box,{component:"h3",sx:S.listTitle,children:this.props.t("Comments")}),e.jsxs(o.FormControl,{variant:"standard",style:S.languageFilter,children:[e.jsx(o.InputLabel,{children:this.props.t("Show comments in language")}),e.jsxs(o.Select,{variant:"standard",value:this.state.filterLang,onChange:i=>{(window._localStorage||window.localStorage).setItem("app.commentLang",i.target.value),this.setState({filterLang:i.target.value})},children:[e.jsxs(o.MenuItem,{value:"_",children:[this.props.t("All")," ",e.jsx("span",{style:S.commentCount,children:this.state.votings.comments.length})]}),ot.map(i=>e.jsxs(o.MenuItem,{value:i.id,children:[i.title," ",this.state.commentsByLanguage[i.id]?e.jsx("span",{style:S.commentCount,children:this.state.commentsByLanguage[i.id]}):null]},i.id))]})]}),e.jsxs(o.List,{style:S.list,dense:!0,disablePadding:!0,children:[s&&this.state.votings.comments.map((i,n)=>this.state.filterLang&&this.state.filterLang!=="_"&&i.lang!==this.state.filterLang?null:i?e.jsxs(o.ListItem,{title:i.uuid?this.props.t("Your comment"):"",sx:{"&.MuiListItem-root":i.uuid?S.listOwn:void 0},dense:!0,children:[e.jsx(o.ListItemAvatar,{style:S.listRating,children:e.jsx(o.Rating,{readOnly:!0,defaultValue:i.rating,size:"small"})}),e.jsx(o.ListItemText,{primary:i.comment,secondary:`${new Date(i.ts).toLocaleString()} / v${i.version}`,sx:{"& .MuiListItemText-secondary":S.listTime}})]},n):null),!s&&e.jsx("div",{style:S.noComments,children:this.props.t("No comments in selected language")})]})]})}return null}render(){var i,n,r;let t,s;if(this.state.votings){const a=this.state.votings.rating;s=Object.keys(a),s.sort((c,h)=>a[c].ts>a[h].ts?-1:a[c].ts<a[h].ts?1:0),s.length&&(t=a[s[0]])}return e.jsxs(o.Dialog,{open:!0,onClose:()=>this.props.onClose(),children:[e.jsx(o.DialogTitle,{children:`${this.props.t("Review")} ${this.props.adapter}${this.props.version?`@${this.props.version}`:""}`}),e.jsxs(o.DialogContent,{style:{textAlign:"center"},title:((i=this.props.currentRating)==null?void 0:i.title)||"",children:[this.renderInfoText(),e.jsx(o.Rating,{style:S.rating,name:this.props.adapter,value:this.props.version?this.state.ratingNumber:(r=(n=this.props.currentRating)==null?void 0:n.rating)==null?void 0:r.r,size:"large",readOnly:!this.props.version,onChange:(a,c)=>this.setState({ratingNumber:c})}),this.props.version?e.jsxs("div",{style:{width:"100%",textAlign:"left"},children:[e.jsx(o.TextField,{variant:"standard",style:S.ratingTextControl,value:this.state.ratingComment,label:this.props.t("Comment to version"),helperText:this.props.t("Max length %s characters",200),onChange:a=>this.setState({ratingComment:a.target.value}),slotProps:{input:{endAdornment:this.state.ratingComment?e.jsx(o.InputAdornment,{position:"end",children:e.jsx(o.IconButton,{tabIndex:-1,size:"small",onClick:()=>this.setState({ratingComment:""}),children:e.jsx(g.Close,{})})}):null},htmlInput:{maxLength:200}}}),e.jsxs(o.FormControl,{variant:"standard",style:S.ratingLanguageControl,children:[e.jsx(o.InputLabel,{children:this.props.t("Language")}),e.jsx(o.Select,{variant:"standard",value:this.state.ratingLang,onChange:a=>this.setState({ratingLang:a.target.value}),children:ot.map(a=>e.jsx(o.MenuItem,{value:a.id,children:a.title},a.id))})]})]}):null,this.props.version?e.jsx("div",{style:{paddingTop:20,paddingBottom:16},children:this.props.t("Rate how good this version of the adapter works on your system. You can vote for every new version.")}):null,s&&t?e.jsx("div",{children:this.props.t("You voted for %s on %s",s[0],new Date(t.ts).toLocaleDateString())}):null,this.renderComments()]}),e.jsxs(o.DialogActions,{children:[this.props.version&&e.jsx(o.Button,{variant:"contained",autoFocus:!0,color:"primary",disabled:!this.state.ratingNumber||this.state.votings===null,onClick:()=>{this.state.ratingNumber!==(t==null?void 0:t.r)||this.state.ratingComment?this.setAdapterRating(this.props.adapter,this.props.version,this.state.ratingNumber,this.state.ratingComment,this.state.ratingLang).then(a=>this.props.onClose(a)):this.props.onClose()},startIcon:e.jsx(g.HowToVote,{}),children:this.props.t("Rate")}),e.jsx(o.Button,{autoFocus:!this.props.version,variant:"contained",onClick:()=>this.props.onClose(),color:"grey",startIcon:e.jsx(g.Close,{}),children:this.props.t("Close")})]})]})}}const nt={closeButton:p=>({position:"absolute",right:8,top:8,color:p.palette.grey[500]}),typography:{paddingRight:30}};class Lt extends L.Component{t;constructor(t){super(t),this.state={deleteCustom:!1,deleteCustomSupported:!1},this.t=t.t}componentDidMount(){this.props.socket.checkFeatureSupported("DEL_INSTANCE_CUSTOM").then(t=>{if(t)return this.props.socket.getObject(`system.adapter.${this.props.adapter}`).then(s=>{s!=null&&s.common?s.common.supportCustoms&&this.setState({deleteCustomSupported:s.common.supportCustoms}):this.setState({deleteCustomSupported:!0})})})}render(){return e.jsxs(o.Dialog,{onClose:this.props.onClose,open:!0,children:[e.jsx(o.DialogTitle,{children:e.jsxs(o.Typography,{component:"h2",variant:"h6",sx:{"&.MuiTypography-root":nt.typography},children:[this.t("Please confirm"),e.jsx(o.IconButton,{size:"large",sx:nt.closeButton,onClick:this.props.onClose,children:e.jsx(g.Close,{})})]})}),e.jsxs(o.DialogContent,{dividers:!0,children:[e.jsx(o.Typography,{gutterBottom:!0,children:this.t("Are you sure you want to delete adapter %s?",this.props.adapter)}),this.state.deleteCustomSupported&&e.jsx(o.FormControlLabel,{control:e.jsx(o.Checkbox,{checked:this.state.deleteCustom,onChange:t=>this.setState({deleteCustom:t.target.checked})}),label:this.t("Delete all custom object settings of this adapter too")})]}),e.jsxs(o.DialogActions,{children:[e.jsx(o.Button,{id:"adapter-delete-dialog-ok",variant:"contained",autoFocus:!0,onClick:()=>{this.props.onClick(this.state.deleteCustom),this.props.onClose()},color:"primary",startIcon:e.jsx(g.Check,{}),children:this.t("Ok")}),e.jsx(o.Button,{id:"adapter-delete-dialog-cancel",variant:"contained",autoFocus:!0,onClick:()=>this.props.onClose(),color:"grey",startIcon:e.jsx(g.Close,{}),children:this.t("Close")})]})]})}}const ct={none:e.jsx(g.HorizontalRule,{}),patch:e.jsx(g.KeyboardDoubleArrowUp,{style:{color:"green"}}),minor:e.jsx(g.North,{style:{color:"orange"}}),major:e.jsx(g.VerticalAlignTop,{style:{color:"red"}})};class Ut extends J.Component{constructor(t){super(t),this.state={currentSavedPolicy:"none",policy:"none",repositories:[],supported:!0}}async componentDidMount(){await this.getConfiguredRepositories(),await this.getCurrentAutoUpgradeSetting()}async getConfiguredRepositories(){var i;const t=await this.props.socket.getObject("system.config");if(!((i=t==null?void 0:t.common)!=null&&i.adapterAutoUpgrade))return;const s=Object.entries(t.common.adapterAutoUpgrade.repositories).filter(([,n])=>n).map(([n])=>n);this.setState({repositories:s})}getAdapterId(){return`${this.props.hostId}.adapter.${this.props.adapter}`}async getCurrentAutoUpgradeSetting(){const t=await this.props.socket.getObject(this.getAdapterId());if(!t){console.error("no adapter object existing"),this.setState({supported:!1});return}this.setState({policy:t.common.automaticUpgrade||"none",currentSavedPolicy:t.common.automaticUpgrade||"none"})}async save(){const t=await this.props.socket.getObject(this.getAdapterId());if(!t){console.error("no adapter object existing"),this.setState({supported:!1});return}t.common.automaticUpgrade=this.state.policy,await this.props.socket.setObject(this.getAdapterId(),t),this.setState({currentSavedPolicy:this.state.policy},()=>this.props.onClose())}render(){return e.jsxs(o.Dialog,{open:!0,maxWidth:"md",fullWidth:!0,children:[e.jsx(o.DialogTitle,{children:x.I18n.t("Auto upgrade policy for %s",this.props.adapter)}),e.jsxs(o.DialogContent,{style:{padding:"0 20px",overflow:"hidden"},children:[e.jsx(N,{value:!this.state.supported,children:e.jsx(o.Typography,{children:x.I18n.t("This feature is supported up from js-controller Kiera (Version 6)!")})}),e.jsxs(N,{value:this.state.supported,children:[e.jsx(o.Typography,{children:x.I18n.t("Allow only the following upgrades to be performed automatically:")}),e.jsx(o.Select,{variant:"standard",style:{marginTop:20,minWidth:150,marginBottom:8},value:this.state.policy,onChange:t=>this.setState({policy:t.target.value}),children:ft.map(t=>e.jsx(o.MenuItem,{value:t,children:e.jsxs("div",{style:{display:"flex",gap:8},children:[ct[t],yt[t]]})},t))}),e.jsx(N,{value:this.state.repositories.includes("beta")&&this.state.policy!=="none",children:e.jsx(z,{type:"warning",children:x.I18n.t("repo_update_hint")})}),e.jsx(N,{value:this.state.policy==="major",children:e.jsx(z,{type:"warning",children:x.I18n.t("The current selected configuration will allow to automatically pull in incompatible changes of this adapter!")})})]})]}),e.jsxs(o.DialogActions,{children:[e.jsx(o.Button,{disabled:this.state.currentSavedPolicy===this.state.policy,color:"primary",variant:"contained",startIcon:e.jsx(g.Save,{}),onClick:()=>this.save(),children:x.I18n.t("Save")}),e.jsx(o.Button,{variant:"contained",onClick:()=>this.props.onClose(),color:"grey",startIcon:e.jsx(g.Close,{}),children:x.I18n.t("Close")})]})]})}}const ht={hidden:{display:"none"},buttonUpdate:{border:"1px solid",padding:"0px 7px",borderRadius:5,display:"flex",alignItems:"center",cursor:"pointer",transition:"background 0.5s","&:hover":{background:"#00800026"}},buttonUpdateIcon:{height:20,width:20,marginRight:10},classPoll:{color:"orange"},classPush:{color:"green"},classAssumption:{color:"red",transform:"rotate(90deg)"},marginLeft5:{marginLeft:5},ratingSet:{cursor:"pointer"},sentry:{width:21,height:21,objectFit:"fill",marginTop:3,filter:"invert(0%) sepia(90%) saturate(1267%) hue-rotate(-260deg) brightness(99%) contrast(97%)"},tooltip:{pointerEvents:"none"},wrongDependencies:{color:vt[700]},updateAvailable:{color:pt[700]},currentVersion:p=>({cursor:"pointer",mb:"6px",mr:"8px",mt:"4px","&:hover":{background:p.palette.primary.dark}}),header:p=>({fontWeight:"bold",background:p.palette.secondary.main,p:"10px"}),modalDialog:{height:"calc(100% - 64px)",overflowY:"hidden"},currentVersionText:p=>({color:p.palette.mode==="dark"?"#a3ffa3":"#009800",fontWeight:"bold",marginLeft:"4px"}),repoStableVersionText:p=>({color:p.palette.mode==="dark"?"#8dff7a":"#2b9800",fontWeight:"bold",marginLeft:"4px"}),repoLatestVersionText:p=>({color:p.palette.mode==="dark"?"#a3fcff":"#005498",fontWeight:"bold",marginLeft:"4px"}),rating:{},containerVersion:{},containerSpecificVersion:{},versionWarn:{color:dt[500]},cardContentFlexBetween:{},cardContentFlex:{}};class H extends P{installedVersion="";constructor(t){super(t),Object.assign(this.state,{autoUpgradeDialogOpen:!1,showUpdateDialog:!1,adapterDeletionDialog:!1,adapterInstallSpecificVersion:"",showInstallVersion:!1,showSetRating:null})}static renderImage(t){const{style:s,alt:i,...n}=t,r=s.backgroundImage.substring(5,s.backgroundImage.length-2);return e.jsx("img",{...n,alt:i,src:r,onError:a=>{a.target&&(a.target.onerror=null,a.target.src="img/no-image.svg")}})}renderAddInstanceButton(){const t=this.props.context.repository[this.props.adapterName]?this.props.context.repository[this.props.adapterName].allowAdapterInstall:!0;return e.jsx(N,{value:t,children:e.jsx(o.Tooltip,{title:this.props.context.t("Add instance"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.IconButton,{size:"small",disabled:this.props.commandRunning,style:this.props.cached.rightOs?void 0:this.styles.hidden,onClick:this.props.cached.rightOs?()=>this.onAddInstance(this.props.adapterName,this.props.context):void 0,children:e.jsx(g.Add,{})})})})}renderAutoUpgradeButton(){var i;const t=this.props.context.hostAdapterWorker.getObject(this.props.adapterName);if(!t)return e.jsx("div",{style:{width:34,height:34,display:"inline-block"}});const s=(i=t.common)==null?void 0:i.automaticUpgrade;return e.jsx(o.Tooltip,{title:this.props.context.t("Automatic Upgrade Policy")+(s?`: ${s}`:""),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.IconButton,{size:"small",onClick:()=>this.setState({autoUpgradeDialogOpen:!0,showDialog:!0}),children:!s||s==="none"?e.jsx(g.KeyboardArrowUp,{}):ct[s]})})}renderReadmeButton(){const t=this.props.context.repository[this.props.adapterName]?this.props.context.repository[this.props.adapterName].allowAdapterReadme:!0;return e.jsx(N,{value:t,children:e.jsx(o.Tooltip,{title:this.props.context.t("Readme"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.IconButton,{size:"small",onClick:()=>this.openInfoDialog(),children:e.jsx(g.Help,{})})})})}renderRating(){var i,n,r;const t=this.props.context.repository[this.props.adapterName]?this.props.context.repository[this.props.adapterName].allowAdapterRating:!0;return this.props.context.isTileView&&(this.props.context.sortPopularFirst||this.props.context.sortRecentlyUpdated)||!this.props.context.repository[this.props.adapterName].stat||t===!1?null:e.jsx("div",{onClick:()=>this.setState({showSetRating:{version:this.installedVersion,rating:this.props.context.repository[this.props.adapterName].rating},showDialog:!0}),style:{...this.styles.rating,...this.styles.ratingSet},title:(i=this.props.context.repository[this.props.adapterName].rating)==null?void 0:i.title,children:e.jsx(o.Rating,{name:this.props.adapterName,precision:.5,size:"small",readOnly:!0,value:((r=(n=this.props.context.repository[this.props.adapterName].rating)==null?void 0:n.rating)==null?void 0:r.r)||0})})}renderConnectionType(){var s;const t=(s=this.props.context.repository[this.props.adapterName])==null?void 0:s.connectionType;return t==="cloud"?e.jsx(o.Tooltip,{title:this.props.context.t("Adapter requires the specific cloud access for these devices/service"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(g.Cloud,{})}):t==="local"?e.jsx(o.Tooltip,{title:this.props.context.t("Adapter does not use the cloud for these devices/service"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(g.CloudOff,{})}):null}renderDataSource(){var s;const t=(s=this.props.context.repository[this.props.adapterName])==null?void 0:s.dataSource;return t?e.jsx("div",{style:this.styles.marginLeft5,title:t,children:t==="poll"?e.jsx(o.Tooltip,{title:this.props.context.t("The device or service will be periodically asked"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(g.ArrowUpward,{style:this.styles.classPoll})}):t==="push"?e.jsx(o.Tooltip,{title:this.props.context.t("The device or service delivers the new state actively"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(g.ArrowDownward,{style:this.styles.classPush})}):t==="assumption"?e.jsx(o.Tooltip,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t("Adapter cannot request the exactly device status and the status will be guessed on the last sent command"),children:e.jsx(g.Remove,{style:this.styles.classAssumption})}):e.jsx("div",{style:{width:24,height:24}})}):null}renderLicenseInfo(t=!1){var r,a,c,h;const s=this.props.context.repository[this.props.adapterName],i=q(s),n=(r=s.licenseInformation)!=null&&r.type?e.jsx(o.Link,{href:i,target:"_blank",rel:"noopener",sx:(d=>({color:d.palette.mode==="dark"?"white":"black","&:hover":{color:d.palette.mode==="dark"?"white":"black"}})),children:((a=s.licenseInformation)==null?void 0:a.type)==="paid"?e.jsx(o.Tooltip,{title:this.props.context.t("The adapter requires a paid license."),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(g.MonetizationOn,{})}):((c=s.licenseInformation)==null?void 0:c.type)==="commercial"?e.jsx(o.Tooltip,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t("The adapter requires a paid license for commercial use."),children:e.jsx(g.MonetizationOn,{opacity:.5})}):((h=s.licenseInformation)==null?void 0:h.type)==="limited"?e.jsx(o.Tooltip,{slotProps:{popper:{sx:this.styles.tooltip}},title:this.props.context.t("The adapter has a limited functionality without a paid license."),children:e.jsx(g.MonetizationOn,{opacity:.5})}):null}):null;return!n&&t?e.jsx("div",{style:{width:24,height:24}}):n}renderSentryInfo(){var s,i;return((i=(s=this.props.context.repository[this.props.adapterName])==null?void 0:s.plugins)==null?void 0:i.sentry)?e.jsx("div",{style:this.styles.marginLeft5,children:e.jsx(o.Tooltip,{title:"sentry",slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.CardMedia,{style:this.styles.sentry,component:"img",image:bt})})}):null}getDependencies(){const t=P.getDependencies(this.props.adapterName,this.props.context);if(!t)return null;const s=[];for(const i of t)i.installedVersion?i.rightVersion||s.push(`${this.props.context.t("Invalid version of %s. Required %s. Current ",i.name,i.version)}${i.installedVersion}`):s.push(this.props.context.t("No version of %s",i.name,i.name));return s.length?(s.unshift(this.props.context.t("Wrong dependencies")),s.map((i,n)=>e.jsx("div",{style:n?void 0:{fontWeight:"bold",fontSize:"larger"},children:i},i))):null}renderVersion(){const t=this.props.context.repository[this.props.adapterName]?this.props.context.repository[this.props.adapterName].allowAdapterUpdate:!0,s=this.props.context.repository[this.props.adapterName],i=s==null?void 0:s.version;return i?!this.props.commandRunning&&this.props.cached.updateAvailable&&t!==!1?e.jsx(o.Tooltip,{title:this.props.context.t("Update"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsxs("div",{onClick:()=>this.setState({showUpdateDialog:!0,showDialog:!0}),style:{...this.styles.buttonUpdate,...this.props.cached.rightDependencies?this.styles.updateAvailable:void 0},children:[e.jsx(o.IconButton,{style:this.styles.buttonUpdateIcon,size:"small",children:e.jsx(g.Refresh,{})}),i]})}):e.jsx(o.Tooltip,{title:this.getDependencies(),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx("span",{style:this.props.cached.rightDependencies?void 0:this.styles.wrongDependencies,children:i})}):e.jsx("span",{style:this.styles.wrongDependencies,children:this.props.context.t("not maintained")})}static extractGitHubCommitHash(t){if(!t)return null;const s=t.indexOf("#");if(s===-1)return null;const i=t.substring(s+1);return i.length>=7?i.substring(0,7):i}renderInstalledVersion(t){var h,d;const s=this.props.context.installed[this.props.adapterName],i=(d=(h=this.props.context.adapters[`system.adapter.${this.props.adapterName}`])==null?void 0:h.common)==null?void 0:d.installedFrom,{adapterName:n}=this.props,r=i&&!i.startsWith(`iobroker.${n}@`),a=r?H.extractGitHubCommitHash(i):null,c=r&&a?`${this.installedVersion}+${a}`:this.installedVersion;if(t){const l=s==null?void 0:s.enabled,u=s==null?void 0:s.count;return e.jsxs(o.Grid2,{container:!0,wrap:"nowrap",alignItems:"center",spacing:1,children:[this.installedVersion?e.jsx(o.Grid2,{children:c+(u?` (${u}${u!==l?"~":""})`:"")}):null,r&&e.jsx(o.Grid2,{container:!0,children:e.jsx(o.Tooltip,{title:`${this.props.context.t("Non-NPM-Version")}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(g.GitHub,{fontSize:"small",style:this.styles.versionWarn})})})]})}return this.installedVersion?e.jsxs(o.Typography,{component:"span",style:this.styles.cardContentFlexBetween,children:[e.jsxs("div",{children:[this.props.context.t("Installed version"),":"]}),e.jsxs("div",{style:this.styles.cardContentFlex,children:[r&&e.jsx(o.Tooltip,{title:`${this.props.context.t("Non-NPM-Version")}: ${i}`,slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(g.GitHub,{fontSize:"small",style:this.styles.versionWarn})}),c]})]}):null}renderUploadButton(){return this.props.context.expertMode&&this.installedVersion?e.jsx(o.Tooltip,{title:this.props.context.t("Upload"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.IconButton,{size:"small",disabled:this.props.commandRunning,onClick:()=>this.onUpload(),children:e.jsx(g.Publish,{})})}):null}renderDeleteButton(){const t=this.props.context.repository[this.props.adapterName]?this.props.context.repository[this.props.adapterName].allowAdapterDelete:!0;return e.jsx(N,{value:!!this.installedVersion&&t,children:e.jsx(o.Tooltip,{title:this.props.context.t("Delete adapter"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.IconButton,{size:"small",disabled:this.props.commandRunning,onClick:()=>this.setState({adapterDeletionDialog:!0,showDialog:!0}),children:e.jsx(g.DeleteForever,{})})})})}renderInstallSpecificVersionButton(){const t=this.props.context.repository[this.props.adapterName]?this.props.context.repository[this.props.adapterName].allowAdapterUpdate:!0;return this.props.context.expertMode&&t!==!1&&this.installedVersion&&e.jsx(o.Tooltip,{title:this.props.context.t("Install a specific version"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.IconButton,{disabled:this.props.commandRunning,size:"small",onClick:()=>this.setState({showInstallVersion:!0,showDialog:!0}),children:e.jsx(g.AddToPhotos,{})})})}renderRebuildButton(){return!this.props.context.expertMode||!this.installedVersion?null:e.jsx(o.Tooltip,{title:this.props.context.t("Rebuild"),children:e.jsx(o.IconButton,{size:"small",disabled:this.props.commandRunning,onClick:()=>this.rebuild(),children:e.jsx(g.Build,{})})})}renderAutoUpdateDialog(){return this.state.autoUpgradeDialogOpen?e.jsx(Ut,{onClose:()=>this.setState({autoUpgradeDialogOpen:!1,showDialog:!1}),adapter:this.props.adapterName,hostId:this.props.context.adminHost,socket:this.props.context.socket}):null}renderUpdateAdapterDialog(){var t;return this.state.showUpdateDialog?(this.installedVersion=(t=this.props.context.installed[this.props.adapterName])==null?void 0:t.version,e.jsx(jt,{adapter:this.props.adapterName,adapterObject:this.props.context.repository[this.props.adapterName],t:this.props.context.t,dependencies:P.getDependencies(this.props.adapterName,this.props.context),rightDependencies:this.props.context.rightDependenciesFunc(this.props.adapterName),news:this.getNews(),toggleTranslation:this.props.context.toggleTranslation,noTranslation:this.props.noTranslation,installedVersion:this.installedVersion,onUpdate:s=>this.setState({showUpdateDialog:!1,showDialog:!1},()=>this.update(s)),isStable:this.props.context.repository._repoInfo.stable,onIgnore:s=>this.setState({showUpdateDialog:!1,showDialog:!1},()=>this.props.context.socket.getObject(`system.adapter.${this.props.adapterName}`).then(i=>{i!=null&&i.common?(i.common.ignoreVersion=s,this.props.context.socket.setObject(i._id,i).catch(n=>window.alert(`Cannot write object: ${n}`))):window.alert(`Adapter "${this.props.adapterName}" does not exist!`)}).then(()=>this.props.context.removeUpdateAvailable(this.props.adapterName))),onClose:()=>this.setState({showUpdateDialog:!1,showDialog:!1}),instances:this.props.context.compactInstances,theme:this.props.context.theme})):null}static formatNews(t){return(t||"").toString().split(`
4
4
  `).map(i=>i.trim().replace(/^\*+/,"").replace(/^-/,"").replace(/\*+$/,"").replace(/\r/g,"").trim()).filter(i=>i).map((i,n)=>e.jsxs("div",{style:{},children:[e.jsx("span",{children:"- "}),i]},n))}renderAdapterInstallVersion(){var n,r,a,c;if(!this.state.showInstallVersion)return null;let t,s;const i=this.props.context.repository._repoInfo;return i!=null&&i.stable?(t=(n=this.props.context.repository[this.props.adapterName])==null?void 0:n.version,s=(r=this.props.context.repository[this.props.adapterName])==null?void 0:r.latestVersion):(t=(a=this.props.context.repository[this.props.adapterName])==null?void 0:a.stable,s=(c=this.props.context.repository[this.props.adapterName])==null?void 0:c.version),e.jsx(Tt,{title:this.props.context.t("Please select specific version of %s",this.props.adapterName),applyButton:!1,onClose:()=>this.setState({showInstallVersion:!1,adapterInstallSpecificVersion:"",showDialog:!1}),theme:this.props.context.theme,toggleTranslation:this.props.context.toggleTranslation,noTranslation:this.props.noTranslation,children:e.jsxs("div",{style:{height:"100%",overflowY:"hidden"},children:[e.jsxs("div",{style:this.styles.containerSpecificVersion,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(o.TextField,{variant:"standard",style:{flexGrow:1},label:this.props.context.t("Enter version manually"),value:this.state.adapterInstallSpecificVersion,onChange:h=>this.setState({adapterInstallSpecificVersion:h.target.value}),slotProps:{input:{endAdornment:this.state.adapterInstallSpecificVersion?e.jsx(o.InputAdornment,{position:"end",children:e.jsx(o.IconButton,{tabIndex:-1,size:"small",onClick:()=>this.setState({adapterInstallSpecificVersion:""}),children:e.jsx(g.Close,{})})}):null}}}),e.jsx(o.Button,{color:"primary",variant:"contained",size:"small",disabled:!this.state.adapterInstallSpecificVersion,onClick:()=>{this.state.adapterInstallSpecificVersion&&(this.update(this.state.adapterInstallSpecificVersion),this.setState({showInstallVersion:!1,adapterInstallSpecificVersion:"",showDialog:!1}))},children:this.props.context.t("Install")})]}),e.jsx(o.Tooltip,{title:this.props.context.t("npmjs.com"),slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.IconButton,{size:"small",onClick:()=>{window.open(`https://www.npmjs.com/package/iobroker.${this.props.adapterName}?activeTab=versions`,this.props.adapterName).focus()},children:e.jsx(g.Link,{})})})]}),e.jsx(o.Box,{component:"div",sx:this.styles.header,children:this.props.context.t("Or select from the list")}),e.jsx("div",{style:{...this.styles.containerVersion,height:"calc(100% - 122px)",overflowY:"auto"},children:this.getNews(!0).map(({version:h,news:d})=>e.jsx(o.Card,{variant:"outlined",sx:this.styles.currentVersion,onClick:()=>{this.update(h),this.setState({showInstallVersion:!1,showDialog:!1})},children:e.jsxs(o.CardContent,{children:[e.jsxs(o.Typography,{sx:x.Utils.getStyle(this.props.context.theme,this.installedVersion===h&&this.styles.currentVersionText,{fontSize:16,fontWeight:"bold"}),color:"text.secondary",gutterBottom:!0,children:[h,this.installedVersion===h?e.jsx(o.Box,{component:"span",sx:this.styles.currentVersionText,children:`(${this.props.context.t("current")})`}):null,s===h?e.jsx(o.Box,{component:"span",sx:this.styles.repoLatestVersionText,children:"(latest)"}):null,t===h?e.jsx(o.Box,{component:"span",sx:this.styles.repoStableVersionText,children:`(${this.props.context.t("stable")})`}):null]}),e.jsx(o.Typography,{variant:"body2",style:{opacity:.7},children:H.formatNews(d)})]})},h))})]})})}renderSetRatingDialog(){return this.state.showSetRating?e.jsx(Rt,{t:this.props.context.t,lang:this.props.context.lang,version:this.state.showSetRating.version,adapter:this.props.adapterName,currentRating:this.state.showSetRating.rating,onClose:t=>{t&&this.props.context.updateRating(this.props.adapterName,t),this.setState({showSetRating:null,showDialog:!1})},uuid:this.props.context.uuid}):null}renderAdapterDeletionDialog(){return this.state.adapterDeletionDialog?e.jsx(Lt,{adapter:this.props.adapterName,socket:this.props.context.socket,t:this.props.context.t,onClick:t=>this.delete(t),onClose:()=>this.setState({adapterDeletionDialog:!1,showDialog:!1})}):null}openInfoDialog(){var i;const s=(i=this.props.context.repository[this.props.adapterName].docs)!=null&&i[this.props.context.lang]?this.props.context.lang:"en";window.open(at.getDocsLinkForAdapter({lang:s,adapterName:this.props.adapterName}),"help")}getNews(t=!1){const s=this.props.context.repository[this.props.adapterName],i=this.props.context.installed[this.props.adapterName],n=[];return i&&(s!=null&&s.news)&&Object.keys(s.news).forEach(r=>{try{if(V.gt(r,i.version)||t){let a;typeof s.news[r]=="object"?a=this.props.noTranslation?s.news[r].en:s.news[r][this.props.context.lang]||s.news[r].en:a=s.news[r],n.push({version:r,news:a})}}catch{console.warn(`[ADAPTERS] Cannot compare "${r}" and "${i.version}" (${this.props.adapterName})`)}}),n}onUpload(){var n;const t=this.props.context.repository[this.props.adapterName],s=q(t),i=((n=t.licenseInformation)==null?void 0:n.license)||t.license;i!=="MIT"?this.setState({showLicenseDialog:{url:s,upload:!0,adapterName:this.props.adapterName,licenseType:i},showDialog:!0}):P.upload(this.props.adapterName,this.props.context)}delete(t){this.props.context.executeCommand(`del ${this.props.adapterName}${t?" --custom":""}${this.props.context.expertMode?" --debug":""}`)}async update(t){if(this.props.adapterName==="admin"&&this.props.context.adminHost===this.props.context.currentHost&&await this.props.context.socket.checkFeatureSupported("ADAPTER_WEBSERVER_UPGRADE")){this.props.context.setAdminUpgradeTo(t);return}this.props.context.executeCommand(`upgrade ${this.props.adapterName}@${t}${this.props.context.expertMode?" --debug":""}`)}rebuild(){this.props.context.executeCommand(`rebuild ${this.props.adapterName}${this.props.context.expertMode?" --debug":""}`)}renderDialogs(){return this.state.showDialog?e.jsxs(e.Fragment,{children:[this.renderAddInstanceDialog(this.props.context),this.renderLicenseDialog(this.props.context),this.renderUpdateAdapterDialog(),this.renderAdapterInstallVersion(),this.renderSetRatingDialog(),this.renderAdapterDeletionDialog(),this.renderAutoUpdateDialog()]}):null}}const Nt="0 2px 2px 0 rgba(0, 0, 0, .14),0 3px 1px -2px rgba(0, 0, 0, .12),0 1px 5px 0 rgba(0, 0, 0, .2)",Ot="0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)",Bt={...ht,type:{color:"tile"},root:p=>({position:"relative",m:"10px",width:300,minHeight:200,background:p.palette.background.default,boxShadow:Nt,display:"flex",flexDirection:"column",transition:"box-shadow 0.5s","&:hover":{boxShadow:Ot}}),imageBlock:p=>({background:p.palette.mode==="dark"?"#848484":"#c0c0c0",minHeight:60,display:"flex",padding:"0 10px 0 10px",position:"relative",justifyContent:"space-between",color:"#000"}),img:{width:45,height:45,margin:"auto 0",position:"relative","&:after":{content:'""',position:"absolute",zIndex:2,top:0,left:0,width:"100%",height:"100%",background:'url("img/no-image.svg") 100% 100% no-repeat',backgroundSize:"cover",backgroundColor:"#fff"}},installed:{background:"#77c7ff8c"},update:{background:"#10ff006b"},fab:{position:"absolute",bottom:-20,width:40,height:40,right:20},greenText:p=>({color:p.palette.success.dark}),collapse:{height:"100%",backgroundColor:"silver",position:"absolute",width:"100%",zIndex:3,marginTop:"auto",bottom:0,justifyContent:"space-between",display:"flex",flexDirection:"column"},close:{width:20,height:20,opacity:.9,cursor:"pointer",position:"relative",marginLeft:"auto",mb:"10px",transition:"all 0.6s ease","&:hover":{transform:"rotate(90deg)"},"&:before":{position:"absolute",left:9,content:'""',height:20,width:3,backgroundColor:"rgba(0, 0, 0, 0.54)",transform:"rotate(45deg)"},"&:after":{position:"absolute",left:9,content:'""',height:20,width:3,backgroundColor:"rgba(0, 0, 0, 0.54)",transform:"rotate(-45deg)"}},footerBlock:p=>({background:p.palette.background.default,p:"10px",display:"flex",justifyContent:"space-between"}),versionDate:{alignSelf:"center"},adapter:p=>({width:"100%",fontWeight:"bold",fontSize:16,verticalAlign:"middle",pl:1,pt:2,color:(p.palette.mode==="dark","#333")}),adapterWithAgo:{width:"calc(100% - 145px)"},description:p=>({color:p.palette.mode==="dark"?"#222":"inherit"}),cardContent:{overflow:"auto"},cardContentDiv:{position:"sticky",right:0,top:0,background:"silver"},cardContentFlex:{display:"flex"},cardContentFlexBetween:{display:"flex",justifyContent:"space-between"},cardContent2:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},cardMargin10:{marginTop:10},availableVersion:{display:"flex",justifyContent:"space-between"},curdContentFlexCenter:{display:"flex",alignItems:"center"},versionWarn:{color:dt[500],marginRight:5},rating:{marginTop:20}};class $t extends H{styles=Bt;constructor(t){super(t),Object.assign(this.state,{openCollapse:!1})}renderInfoCard(){return e.jsxs("div",{style:this.styles.collapse,children:[e.jsxs(o.CardContent,{style:this.styles.cardContent,children:[e.jsx("div",{style:this.styles.cardContentDiv,children:e.jsx(o.Box,{component:"div",sx:this.styles.close,onClick:()=>this.setState({openCollapse:!this.state.openCollapse})})}),e.jsx(o.Typography,{gutterBottom:!0,component:"span",variant:"body2",sx:this.styles.description,children:this.props.cached.desc})]}),e.jsxs(o.Box,{component:"div",sx:this.styles.footerBlock,children:[this.renderAddInstanceButton(),e.jsxs("div",{style:this.styles.cardContentFlex,children:[this.renderAutoUpgradeButton(),this.renderReadmeButton(),this.renderUploadButton(),this.renderDeleteButton(),this.renderInstallSpecificVersionButton()]})]})]})}renderCardMedia(){const t=this.props.context.repository[this.props.adapterName],s=t==null?void 0:t.version;return e.jsxs(o.Box,{component:"div",sx:x.Utils.getStyle(this.props.context.theme,this.styles.imageBlock,this.installedVersion&&this.styles.installed,this.installedVersion&&s&&this.installedVersion!==s&&this.props.cached.updateAvailable&&this.styles.update),children:[e.jsx(o.CardMedia,{sx:this.styles.img,component:i=>H.renderImage(i),src:this.props.cached.image||"img/no-image.svg",image:this.props.cached.image||"img/no-image.svg"}),e.jsx(o.Box,{component:"div",sx:x.Utils.getStyle(this.props.context.theme,this.styles.adapter,(t.stat||this.props.context.sortRecentlyUpdated)&&this.styles.adapterWithAgo),children:this.props.adapterName}),this.props.context.sortPopularFirst?e.jsx("div",{style:this.styles.versionDate,children:t.stat}):null,this.props.context.sortRecentlyUpdated?e.jsx("div",{style:this.styles.versionDate,children:this.props.cached.daysAgoText}):null,!this.props.context.sortPopularFirst&&!this.props.context.sortRecentlyUpdated?this.renderRating():null,this.state.openCollapse?null:e.jsx(o.Tooltip,{title:this.props.context.t("Info"),slotProps:{popper:{sx:{pointerEvents:"none"}}},children:e.jsx(o.Fab,{onClick:()=>this.setState({openCollapse:!this.state.openCollapse}),style:this.styles.fab,color:"primary","aria-label":"add",children:e.jsx(g.MoreVert,{})})})]})}renderCardContent(){const t=this.props.context.repository[this.props.adapterName]?this.props.context.repository[this.props.adapterName].allowAdapterUpdate:!0,s=this.props.context.installed[this.props.adapterName];return e.jsxs(o.CardContent,{style:this.styles.cardContent2,children:[e.jsx(o.Typography,{gutterBottom:!0,variant:"h5",component:"h5",children:this.props.cached.title}),e.jsxs("div",{style:this.styles.cardContentFlex,children:[this.renderConnectionType(),this.renderDataSource(),e.jsx("div",{children:this.renderLicenseInfo()}),this.renderSentryInfo()]}),e.jsxs("div",{style:this.styles.cardMargin10,children:[s!=null&&s.count?e.jsxs(o.Typography,{component:"span",style:this.styles.cardContentFlexBetween,children:[e.jsxs("div",{children:[this.props.context.t("Installed instances"),":"]}),e.jsx("div",{children:s.count})]}):null,e.jsx(N,{value:t,children:e.jsxs(o.Typography,{component:"span",style:this.styles.availableVersion,children:[e.jsx("div",{children:this.props.context.t("Available version:")}),e.jsx(o.Box,{component:"div",sx:x.Utils.getStyle(this.props.context.theme,this.props.cached.updateAvailable&&this.styles.greenText,this.styles.curdContentFlexCenter),children:this.renderVersion()})]})}),this.renderInstalledVersion()]})]})}render(){var t;return this.installedVersion=(t=this.props.context.installed[this.props.adapterName])==null?void 0:t.version,e.jsxs(o.Card,{sx:this.styles.root,children:[this.state.openCollapse?this.renderInfoCard():null,this.renderCardMedia(),this.renderCardContent(),this.renderDialogs()]})}}const _t={...ht,type:{color:"line"},smallAvatar:{width:32,height:32,marginLeft:4},paddingNone:{padding:"0 !important"},name:{flexWrap:"nowrap",width:300,marginTop:0},flex:{display:"flex"},nameCell:{paddingTop:"0 !important",paddingBottom:"0 !important"}};class Wt extends H{styles=_t;render(){var i,n;const t=this.props.context.repository[this.props.adapterName],s=t?t.allowAdapterRating:!0;return this.installedVersion=(i=this.props.context.installed[this.props.adapterName])==null?void 0:i.version,e.jsxs(o.TableRow,{hover:!0,children:[e.jsx(o.TableCell,{}),e.jsx(o.TableCell,{children:e.jsxs(o.Grid2,{container:!0,spacing:1,alignItems:"center",style:this.styles.name,children:[e.jsx(o.Tooltip,{title:this.props.adapterName,slotProps:{popper:{sx:this.styles.tooltip}},children:e.jsx(o.Grid2,{style:this.styles.paddingNone,children:e.jsx(o.Avatar,{variant:"square",alt:this.props.cached.title,src:this.props.cached.image,style:this.styles.smallAvatar})})}),s!==!1?e.jsxs(o.Grid2,{style:this.styles.nameCell,children:[e.jsx("div",{children:this.props.cached.title}),this.renderRating()]}):e.jsx(o.Grid2,{children:this.props.cached.title})]})}),!this.props.context.descHidden&&e.jsx(o.TableCell,{title:this.props.cached.desc,style:{width:20,wordWrap:"break-word"},children:this.props.cached.desc}),e.jsx(o.TableCell,{children:e.jsxs("div",{style:this.styles.flex,children:[this.renderConnectionType()||e.jsx("div",{style:{width:24,height:24}}),this.renderDataSource()||e.jsx("div",{style:{marginLeft:5,width:24,height:24}}),this.renderSentryInfo()||e.jsx("div",{style:{marginLeft:5,width:24,height:24}}),this.renderLicenseInfo(!0)]})}),e.jsx(o.TableCell,{children:this.renderInstalledVersion(!0)}),e.jsx(o.TableCell,{children:e.jsx(o.Grid2,{container:!0,alignItems:"center",children:this.renderVersion()})}),e.jsx(o.TableCell,{style:{fontSize:"smaller"},children:((n=t==null?void 0:t.licenseInformation)==null?void 0:n.license)||(t==null?void 0:t.license)}),e.jsxs(o.TableCell,{children:[this.renderAddInstanceButton(),this.renderAutoUpgradeButton(),this.renderReadmeButton(),this.renderUploadButton(),this.renderDeleteButton(),this.renderInstallSpecificVersionButton(),this.renderRebuildButton()]}),this.renderDialogs()]})}}const Y=246,$={emptyBlock:50,name:300,connectionType:120,installed:120,available:120,update:40,license:80,install:Y},G=Object.keys($).reduce((p,t)=>p+$[t],0),k={container:{height:"100%",width:"100%"},containerNotFullHeight:{height:"calc(100% - 50px)"},containerFullHeight:{height:"100%"},table:{width:"100%",tableLayout:"fixed",minWidth:960,"& td":{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",pt:"2px",pb:"2px",pr:"4px",pl:"4px"},"& th":{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",pt:"2px",pb:"2px",pr:"4px",pl:"4px"}},name:{flexWrap:"nowrap",width:$.name},emptyBlock:{flexWrap:"nowrap",width:$.emptyBlock},description:{width:`calc(100% - ${G+2}px)`},connectionType:{width:$.connectionType},installed:{width:$.installed},available:{width:$.available,paddingRight:6},license:{width:$.license},install:{width:$.install},viewModeDiv:{display:"flex",flexFlow:"wrap",overflow:"auto",justifyContent:"center"}};class Pt extends L.Component{lastRenderCounter=-1;constructor(t){super(t),this.state={descWidth:t.descWidth,repoName:t.repoName,systemConfig:!!t.systemConfig,tableViewMode:t.tableViewMode,oneListView:t.oneListView,categoriesExpanded:JSON.stringify(t.categoriesExpanded),cachedAdapters:t.cachedAdapters?Object.keys(t.cachedAdapters).length:0,update:t.update,sortByName:t.sortByName,sortPopularFirst:t.sortPopularFirst,sortRecentlyUpdated:t.sortRecentlyUpdated,renderCounter:0,listOfVisibleAdapter:JSON.stringify(t.listOfVisibleAdapter),expertMode:t.context.expertMode,commandRunning:t.commandRunning,noTranslation:t.noTranslation}}getRow(t,s){const i=this.props.cachedAdapters[t];return i?e.jsx(Wt,{context:s,adapterName:t,cached:i,commandRunning:this.state.commandRunning,noTranslation:this.state.noTranslation},`adapter-${t}`):null}getRows(t){var n;if(!this.props.listOfVisibleAdapter)return e.jsx(o.TableRow,{children:e.jsx(o.TableCell,{colSpan:8,children:e.jsx(o.LinearProgress,{})})});let s=0,i=[];if(this.props.oneListView){for(let r=0;r<this.props.listOfVisibleAdapter.length;r++){const a=this.props.listOfVisibleAdapter[r];i.length>50&&!((n=this.props.context.installed[a])!=null&&n.version)||i.push(this.getRow(a,t))}if(s=i.length,s&&this.props.listOfVisibleAdapter.length>i.length){const r=this.props.listOfVisibleAdapter.length-i.length,a=r===1?this.props.context.t("Filter adapters to see others. There is %s more",1):this.props.context.t("Filter adapters to see others. There are %s more",r);i.push(e.jsx(o.TableRow,{children:e.jsx(o.TableCell,{colSpan:8,style:{fontSize:20,padding:20,textAlign:"center"},children:a})},"more"))}}else i=this.props.categories.map(r=>{if(!r.adapters.find(d=>this.props.listOfVisibleAdapter.includes(d)))return null;const c=r.name,h=this.props.categoriesExpanded[c];return s++,e.jsxs(L.Fragment,{children:[e.jsx(Vt,{categoryName:c,count:r.count,expanded:h,installedCount:r.installed,name:r.translation,descHidden:t.descHidden,onToggle:()=>this.props.toggleCategory(c),t:this.props.context.t},`category-${c}1`),h&&r.adapters.map(d=>{const l=this.getRow(d,t);return l&&s++,l})]},`category-${c} ${r.adapters.length}`)});return s?i:this.props.update?null:e.jsx("tr",{children:e.jsxs("td",{colSpan:8,style:{textAlign:"center"},children:[this.props.searchFilter||this.props.installedListFilter?e.jsx(o.Button,{variant:"outlined",title:this.props.context.t("Click to clear all filters"),onClick:()=>this.props.clearAllFilters(),children:this.props.context.t("all items are filtered out")}):null,this.props.updateListFilter&&(this.props.searchFilter||this.props.installedListFilter)?e.jsx("br",{}):null,this.props.updateListFilter?e.jsx(o.Button,{style:{marginTop:16},variant:"outlined",onClick:()=>this.props.clearAllFilters(!0),startIcon:e.jsx(g.Update,{}),children:this.props.context.t("Remove filter for updatable adapters")}):null]})})}getTiles(t){var i;if(!this.props.listOfVisibleAdapter)return e.jsx(o.LinearProgress,{});if(!this.props.listOfVisibleAdapter.length)return this.props.update?null:e.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:16},children:[this.props.searchFilter||this.props.installedListFilter?e.jsx(o.Tooltip,{title:this.props.context.t("Click to clear all filters"),slotProps:{popper:{sx:{pointerEvents:"none"}}},children:e.jsx(o.Button,{variant:"outlined",onClick:()=>this.props.clearAllFilters(),children:this.props.context.t("all items are filtered out")})}):null,this.props.updateListFilter?e.jsx(o.Button,{variant:"outlined",onClick:()=>this.props.clearAllFilters(!0),startIcon:e.jsx(g.Update,{}),children:this.props.context.t("Remove filter for updatable adapters")}):null]});const s=[];for(let n=0;n<this.props.listOfVisibleAdapter.length;n++){const r=this.props.listOfVisibleAdapter[n],a=this.props.cachedAdapters[r];s.length>50&&!((i=this.props.context.installed[r])!=null&&i.version)||s.push(e.jsx($t,{context:t,adapterName:r,cached:a,commandRunning:this.state.commandRunning,noTranslation:this.state.noTranslation},`adapter-${r}`))}return this.props.listOfVisibleAdapter.length>s.length&&(s.push(e.jsx("div",{style:{flexBasis:"100%",height:0}},"newLine")),s.push(e.jsx("div",{style:{fontSize:20,margin:20},children:this.props.context.t("Filter adapters to see others. There is %s more",this.props.listOfVisibleAdapter.length-s.length)},"more"))),s}renderTileView(t,s,i){return e.jsxs(e.Fragment,{children:[t?null:e.jsx(o.Box,{sx:{marginX:2,marginTop:1,width:"calc(100% - 32px)"},children:e.jsx(z,{type:"warning",children:this.props.context.t('Active repo is "%s"',s)})}),e.jsx("div",{style:k.viewModeDiv,children:this.getTiles(i)})]})}renderTableView(t,s,i){return e.jsxs(x.TabContent,{children:[t?null:e.jsx(o.Box,{sx:{marginX:2,marginTop:1,width:"calc(100% - 32px)"},children:e.jsx(z,{type:"warning",children:this.props.context.t('Active repo is "%s"',s)})}),e.jsx(o.TableContainer,{style:{...k.container,...t?k.containerFullHeight:k.containerNotFullHeight},children:e.jsxs(o.Table,{stickyHeader:!0,size:"small",sx:k.table,children:[e.jsx(o.TableHead,{children:e.jsxs(o.TableRow,{children:[e.jsx(o.TableCell,{style:k.emptyBlock}),e.jsx(o.TableCell,{style:k.name,children:e.jsx(o.Typography,{children:this.props.context.t("Name")})}),!i.descHidden&&e.jsx(o.TableCell,{style:{...k.description,width:this.props.descWidth},children:e.jsx(o.Typography,{children:this.props.context.t("Description")})}),e.jsx(o.TableCell,{style:k.connectionType}),e.jsx(o.TableCell,{style:k.installed,children:e.jsx(o.Typography,{children:this.props.context.t("Installed")})}),e.jsx(o.TableCell,{style:k.available,children:e.jsx(o.Typography,{children:this.props.context.t("Available")})}),e.jsx(o.TableCell,{style:k.license,children:e.jsx(o.Typography,{children:this.props.context.t("License")})}),e.jsx(o.TableCell,{style:{...k.install,width:this.state.expertMode?Y:Y-68},children:e.jsx(o.Typography,{children:this.props.context.t("Install")})})]})}),e.jsx(o.TableBody,{children:this.getRows(i)})]})})]})}static getDerivedStateFromProps(t,s){let i=!1;t.descWidth!==s.descWidth&&(console.log("Render because of descWidth"),i=!0),t.repoName!==s.repoName&&(console.log("Render because of repoName"),i=!0),!!t.systemConfig!==s.systemConfig&&(console.log("Render because of systemConfig"),i=!0),t.tableViewMode!==s.tableViewMode&&(console.log("Render because of tableViewMode"),i=!0),t.oneListView!==s.oneListView&&(console.log("Render because of oneListView"),i=!0);const n=JSON.stringify(t.categoriesExpanded);n!==s.categoriesExpanded&&(console.log("Render because of categoriesExpanded"),i=!0);const r=t.cachedAdapters?Object.keys(t.cachedAdapters).length:0;r!==s.cachedAdapters&&(console.log(`Render because of cachedAdapters ${r} <> ${s.cachedAdapters}`),i=!0),t.update!==s.update&&(console.log("Render because of update"),i=!0),t.sortByName!==s.sortByName&&(console.log("Render because of sortByName"),i=!0),t.sortPopularFirst!==s.sortPopularFirst&&(console.log("Render because of sortPopularFirst"),i=!0),t.sortRecentlyUpdated!==s.sortRecentlyUpdated&&(console.log("Render because of sortRecentlyUpdated"),i=!0),t.context.expertMode!==s.expertMode&&(console.log("Render because of expertMode"),i=!0);const a=JSON.stringify(t.listOfVisibleAdapter);return a!==s.listOfVisibleAdapter&&(console.log("Render because of listOfVisibleAdapter"),i=!0),t.commandRunning!==s.commandRunning&&(console.log("Render because of commandRunning"),i=!0),t.noTranslation!==s.noTranslation&&(console.log("Render because of commandRunning"),i=!0),i?{descWidth:t.descWidth,repoName:t.repoName,systemConfig:!!t.systemConfig,tableViewMode:t.tableViewMode,oneListView:t.oneListView,categoriesExpanded:n,cachedAdapters:r,update:t.update,sortByName:t.sortByName,sortPopularFirst:t.sortPopularFirst,sortRecentlyUpdated:t.sortRecentlyUpdated,listOfVisibleAdapter:a,renderCounter:s.renderCounter+1,expertMode:t.context.expertMode,commandRunning:t.commandRunning,noTranslation:t.noTranslation}:null}shouldComponentUpdate(t,s){return this.lastRenderCounter!==s.renderCounter?(this.lastRenderCounter=s.renderCounter,!0):!1}render(){var t,s;return(s=(t=this.props.systemConfig)==null?void 0:t.common)!=null&&s.activeRepo?this.props.tableViewMode?this.renderTableView(this.props.stableRepo,this.props.repoName,this.props.context):this.renderTileView(this.props.stableRepo,this.props.repoName,this.props.context):e.jsx(o.LinearProgress,{})}}class Mt extends L.Component{updating;interval;startTimeout;textareaRef;link;oldVersion;constructor(t){super(t),this.state={response:null,error:null,starting:!0,upAgain:!1},this.updating=!1,this.textareaRef=J.createRef(),this.link=`${window.location.protocol}//${window.location.host}/`}setUpdating(t){this.updating!==t&&(this.updating=t,this.props.onUpdating(t))}async getWebserverParams(){const t=await this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`);return{useHttps:t.native.secure,port:t.native.port,certPrivateName:t.native.certPrivate,certPublicName:t.native.certPublic}}async componentDidMount(){const{certPrivateName:t,certPublicName:s,port:i,useHttps:n}=await this.getWebserverParams();this.oldVersion=this.props.currentAdminVersion,await this.props.socket.upgradeAdapterWithWebserver(this.props.host,{version:this.props.version,adapterName:"admin",port:i,useHttps:n,certPublicName:s,certPrivateName:t}),this.setUpdating(!0),this.interval=setInterval(()=>this.checkStatus(),1e3),this.startTimeout=setTimeout(()=>{this.startTimeout=null,this.setState({starting:!1})},1e4)}componentWillUnmount(){this.interval&&(clearInterval(this.interval),this.interval=null),this.startTimeout&&(clearTimeout(this.startTimeout),this.startTimeout=null)}async checkVersion(){try{const s=await(await fetch("./version")).text();return s&&s.length<20&&s!==this.oldVersion?(this.interval&&(clearInterval(this.interval),this.interval=null),this.setState({response:{running:!1,success:!0,stderr:[],stdout:[x.I18n.t("Version updated to %s",s)]},upAgain:!0,error:null},()=>this.setUpdating(!1)),!0):s===this.oldVersion}catch{return!1}}async checkStatus(){console.log(`Request update status from: ${this.link}`);try{const s=await(await fetch(this.link)).text();if(console.log(`Received status: ${s}`),s.startsWith("{")&&s.endsWith("}"))try{const i=JSON.parse(s);i!=null&&i.stderr&&(i.stderr=i.stderr.filter(n=>n.trim())),i&&!i.running&&i.success&&i.stdout?(i.stdout.push(""),i.stdout.push("---------------------------------------------------"),i.stdout.push(x.I18n.t("%s was successfully updated to %s","admin",this.props.version))):i!=null&&i.stdout&&(i.stdout.unshift(""),i.stdout.unshift("---------------------------------------------------"),i.stdout.unshift(x.I18n.t("updating %s to %s...","admin",this.props.version))),this.setState({response:i,error:null},()=>{i&&!i.running?(this.interval&&(clearInterval(this.interval),this.interval=null),this.waitForAdapterStart()):i!=null&&i.running&&this.setUpdating(!0),this.textareaRef.current&&setTimeout(()=>this.textareaRef.current.scrollTop=this.textareaRef.current.scrollHeight,100)})}catch(i){console.error(`Cannot parse response: ${i}`),this.setState({error:s},()=>this.setUpdating(!1))}else await this.checkVersion()||console.error(`Response is not JSON: ${s}`)}catch(t){this.state.starting||this.setState({error:t.toString()},()=>this.setUpdating(!1))}}waitForAdapterStart(){this.interval=setInterval(async()=>{try{await fetch(this.link),clearInterval(this.interval),this.interval=null,this.setState({upAgain:!0})}catch{}},1e3)}render(){var t,s,i,n,r;return e.jsxs(o.Dialog,{onClose:(a,c)=>{c!=="escapeKeyDown"&&c!=="backdropClick"&&this.props.onClose()},open:!0,maxWidth:"lg",fullWidth:!0,children:[e.jsx(o.DialogTitle,{children:x.I18n.t("Updating %s...","admin")}),e.jsxs(o.DialogContent,{style:{height:400,padding:"0 20px",overflow:"hidden"},children:[(!this.state.response||this.state.response.running)&&!this.state.error?e.jsx(o.LinearProgress,{}):null,this.state.response||this.state.error?e.jsx("textarea",{ref:this.textareaRef,style:{width:"100%",height:"100%",resize:"none",background:this.props.themeType==="dark"?"#000":"#fff",color:this.props.themeType==="dark"?"#EEE":"#111",boxSizing:"border-box",fontFamily:"Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace",border:(t=this.state.response)!=null&&t.success?"2px solid green":this.state.error||this.state.response&&!this.state.response.running&&!this.state.response.success?"2px solid red":void 0},value:this.state.error?this.state.error:this.state.response.stderr&&this.state.response.stderr.length?this.state.response.stderr.join(`
@@ -1 +1 @@
1
- import{j as s}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as k}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{i,a as p}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as y}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{i as C}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import{g as $}from"./_commonjsHelpers-CE1G-McA.js";import{a as I,b as D}from"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import{c as b}from"./bootstrap-xC60EdKn.js";import{o as L,g as E,w as m,t as g}from"./createTheme-O_VGsRib.js";const{loadShare:T}=D,{initPromise:F}=I,M=F.then(c=>T("@iobroker/dm-gui-components",{customShareInfo:{shareConfig:{singleton:!0,strictVersion:!1,requiredVersion:"*"}}})),W=await M.then(c=>c());var O=W;const P=$(O),A=["silly","debug","info","warn","error"],n={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},scroll:{height:"100%",overflowY:"auto"},instanceIcon:{width:42,height:42,marginRight:16,verticalAlign:"middle"},button:{width:36,height:36},version:{fontSize:12,opacity:.8,marginLeft:20,marginRight:10},versionAliveConnected:c=>({color:c.palette.mode==="dark"?"#23a623":"#60ff60"}),versionAliveNotConnected:{color:"#a67223"},buttonControl:{padding:"5px",transition:"opacity 0.2s",height:34},enabled:{color:g[400],"&:hover":{backgroundColor:g[200]}},disabled:{color:m[400],"&:hover":{backgroundColor:m[200]}},hide:{visibility:"hidden"},formControl:{width:"100%",marginBottom:5},logLevel:{fontSize:12,marginLeft:10},green:{color:g[700]},red:{color:m[700]},grey:{color:E[700]},blue:{color:"#0055a9"},orange:{color:L[400]},orangeDevice:{color:L[300]},tooltip:{pointerEvents:"none"}};class G extends k.Component{refIframe;registered;constructor(e){super(e),this.state={checkedExist:!1,showStopAdminDialog:!1,running:!1,canStart:!1,alive:!1,connected:!1,connectedToHost:!1,logOnTheFlyValue:!1,logLevel:"info",logLevelValue:"info",tempLogLevel:"info",showLogLevelDialog:!1,showMore:null},this.refIframe=null,this.registered=!1}componentDidUpdate(){var e;!this.registered&&((e=this.refIframe)!=null&&e.contentWindow)&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe))}componentDidMount(){var e;if(this.props.tab)this.props.socket.fileExists(`${this.props.adapter}.admin`,"tab.html").then(t=>{if(t)this.setState({checkedExist:"tab.html"});else return this.props.socket.fileExists(`${this.props.adapter}.admin`,"tab_m.html").then(o=>o?this.setState({checkedExist:"tab_m.html"}):window.alert("Cannot find tab(_m).html"))});else{const t=`system.adapter.${this.props.adapter}.${this.props.instance}`;this.props.socket.subscribeObject(t,this.onObjectChange),this.props.socket.getObject(t).then(async o=>{var f,u,_,v,x,w,S;const a=await this.props.socket.getState(`${t}.logLevel`);await this.props.socket.subscribeState(`${t}.logLevel`,this.onStateChange);const r=await this.props.socket.getState(`${t}.alive`);await this.props.socket.subscribeState(`${t}.alive`,this.onStateChange);const l=await this.props.socket.getState(`${t}.connected`);await this.props.socket.subscribeState(`${t}.connected`,this.onStateChange);let d;try{d=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.connection`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.connection`,this.onStateChange)}catch{d=null}let h;try{h=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.extension`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.extension`,this.onStateChange)}catch{h=null}this.setState({checkedExist:!0,running:((f=o==null?void 0:o.common)==null?void 0:f.onlyWWW)||((u=o==null?void 0:o.common)==null?void 0:u.enabled),canStart:!((_=o==null?void 0:o.common)!=null&&_.onlyWWW),alive:!!(r!=null&&r.val),extension:h?!!(h!=null&&h.val):null,connectedToHost:!!(l!=null&&l.val),connected:d?!!d.val:null,logLevel:((v=o==null?void 0:o.common)==null?void 0:v.loglevel)||"info",logLevelValue:((x=o==null?void 0:o.common)==null?void 0:x.loglevel)||"info",tempLogLevel:(a==null?void 0:a.val)||((w=o==null?void 0:o.common)==null?void 0:w.loglevel)||"info",common:(o==null?void 0:o.common)||{},native:(o==null?void 0:o.native)||{},adapterDocLangs:(S=o==null?void 0:o.common)!=null&&S.docs?Object.keys(o.common.docs):["en"]})}).catch(o=>{console.error(o),this.setState({checkedExist:!0,running:!1})})}!this.registered&&((e=this.refIframe)!=null&&e.contentWindow)&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe)),(window.addEventListener||window.attachEvent)(window.addEventListener?"message":"onmessage",this.closeConfig,!1)}onObjectChange=(e,t)=>{var o,a,r,l;e===`system.adapter.${this.props.adapter}.${this.props.instance}`&&this.setState({running:((o=t==null?void 0:t.common)==null?void 0:o.onlyWWW)||((a=t==null?void 0:t.common)==null?void 0:a.enabled),canStart:!((r=t==null?void 0:t.common)!=null&&r.onlyWWW),logLevel:((l=t==null?void 0:t.common)==null?void 0:l.loglevel)||"info"})};getInstanceStatus(){var o,a,r,l;const e=((o=this.state.common)==null?void 0:o.mode)||"";let t=e==="daemon"?"green":"blue";if((a=this.state.common)!=null&&a.enabled&&(!this.state.common.webExtension||!((r=this.state.native)!=null&&r.webInstance)||e==="daemon")){if(this.state.common.webExtension&&((l=this.state.native)!=null&&l.webInstance)&&this.state.extension!==null)return this.state.extension?"green":"red";(!this.state.connectedToHost||!this.state.alive)&&(t=e==="daemon"?"red":"orangeDevice"),this.state.connected!==null&&!this.state.connected&&t!=="red"&&(t="orange")}else t=e==="daemon"?"grey":"blue";return t}onStateChange=(e,t)=>{const o=`system.adapter.${this.props.adapter}.${this.props.instance}`;e===`${o}.alive`?this.setState({alive:!!(t!=null&&t.val)}):e===`${o}.connected`?this.setState({connectedToHost:!!(t!=null&&t.val)}):e===`${this.props.adapter}.${this.props.instance}.info.connection`?this.setState({connected:t?!!t.val:null}):e===`${this.props.adapter}.${this.props.instance}.info.extension`?this.setState({extension:t?!!t.val:null}):e===`${o}.logLevel`&&this.setState({tempLogLevel:t?t.val:null})};componentWillUnmount(){this.props.socket.unsubscribeObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,this.onObjectChange),(window.removeEventListener||window.detachEvent)(window.removeEventListener?"message":"onmessage",this.closeConfig,!1),this.registered&&this.refIframe&&this.props.onUnregisterIframeRef(this.refIframe),this.refIframe=null}closeConfig=e=>{if(e.origin===window.location.origin){if(e.data==="close"||e.message==="close")this.props.easyMode?this.props.handleNavigation("easy"):this.props.handleNavigation("tab-instances");else if(e.data==="change"||e.message==="change")this.props.configStored(!1);else if(e.data==="nochange"||e.message==="nochange")this.props.configStored(!0);else if(typeof e.data=="string"&&e.data.startsWith("goto:")||typeof e.message=="string"&&e.message.startsWith("goto:")){const[,t]=(e.data||e.message).split(":"),[o,a,r]=t.split("/");this.props.handleNavigation(o,a,r)}}};renderHelpButton(){return this.props.jsonConfig?s.jsx(i.Tooltip,{title:this.props.t("Show help for this adapter"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx(i.Fab,{sx:{"&.MuiFab-root":n.button},onClick:()=>{var t;const e=(t=this.state.adapterDocLangs)!=null&&t.includes(this.props.lang)?this.props.lang:"en";window.open(b.getDocsLinkForAdapter({lang:e,adapterName:this.props.adapter}),"help")},children:s.jsx(p.Help,{})})}):null}getConfigurator(){if(this.props.jsonConfig)return s.jsx(C.JsonConfig,{expertMode:this.props.expertMode,theme:this.props.theme,width:this.props.width,adapterName:this.props.adapter,instance:this.props.instance,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,configStored:this.props.configStored,t:this.props.t,DeviceManager:P});const e=`adapter/${this.props.adapter}/${this.props.tab?this.state.checkedExist:this.props.materialize?"index_m.html":"index.html"}?${this.props.instance||0}&newReact=true&${this.props.instance||0}&react=${this.props.themeName}`;return this.state.checkedExist?s.jsx("iframe",{ref:t=>this&&(this.refIframe=t),title:"config",style:this.props.style,src:e}):null}returnStopAdminDialog(){return this.state.showStopAdminDialog?s.jsx(y.DialogConfirm,{title:this.props.t("Please confirm"),text:this.props.t("stop_admin",this.props.instance),ok:this.props.t("Stop admin"),onClose:e=>{e&&this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!1}}).catch(t=>window.alert(t)),this.setState({showStopAdminDialog:!1})}}):null}renderLogLevelDialog(){return this.state.showLogLevelDialog?s.jsxs(i.Dialog,{open:!0,onClose:()=>this.setState({showLogLevelDialog:!1}),children:[s.jsx(i.DialogTitle,{children:this.props.t("Edit log level rule for %s",`${this.props.adapter}.${this.props.instance}`)}),s.jsxs(i.DialogContent,{children:[s.jsxs(i.FormControl,{style:{...n.formControl,marginTop:10},variant:"outlined",children:[s.jsx(i.InputLabel,{children:this.props.t("log level")}),s.jsx(i.Select,{variant:"standard",value:this.state.logLevelValue,fullWidth:!0,onChange:e=>this.setState({logLevelValue:e.target.value}),children:A.map(e=>s.jsx(i.MenuItem,{value:e,children:this.props.t(e)},e))})]}),s.jsxs(i.FormControl,{style:n.formControl,variant:"outlined",children:[s.jsx(i.FormControlLabel,{control:s.jsx(i.Checkbox,{checked:this.state.logOnTheFlyValue,onChange:e=>this.setState({logOnTheFlyValue:e.target.checked})}),label:this.props.t("Without restart")}),s.jsx(i.FormHelperText,{children:this.state.logOnTheFlyValue?this.props.t("Will be reset to the saved log level after restart of adapter"):this.props.t("Log level will be saved permanently")})]})]}),s.jsxs(i.DialogActions,{children:[s.jsx(i.Button,{color:"primary",variant:"contained",onClick:()=>{this.state.logOnTheFlyValue?this.props.socket.setState(`system.adapter.${this.props.adapter}.${this.props.instance}.logLevel`,this.state.logLevelValue):this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{loglevel:this.state.logLevelValue}}).catch(e=>window.alert(`Cannot set log level: ${e}`)),this.setState({showLogLevelDialog:!1})},children:this.props.t("Ok")}),s.jsx(i.Button,{color:"grey",variant:"contained",onClick:()=>this.setState({showLogLevelDialog:!1}),children:this.props.t("Cancel")})]})]}):null}render(){const e=[this.props.version?s.jsxs("span",{style:{...n.version,...n[this.getInstanceStatus()]},children:["v",this.props.version]},"version"):null,s.jsx(i.Tooltip,{title:this.props.t("Start/stop"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{children:s.jsx(i.IconButton,{size:"small",onClick:t=>{t.stopPropagation(),t.preventDefault(),this.state.running&&`${this.props.adapter}.${this.props.instance}`===this.props.adminInstance?this.setState({showStopAdminDialog:!0,showMore:null}):(this.setState({showMore:null}),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!this.state.running}}).catch(o=>window.alert(`Cannot set log level: ${o}`)))},onFocus:t=>t.stopPropagation(),sx:{...n.buttonControl,...this.state.canStart?this.state.running?n.enabled:n.disabled:n.hide},children:this.state.running?s.jsx(p.Pause,{}):s.jsx(p.PlayArrow,{})})})},"start"),s.jsx(i.Tooltip,{title:this.props.t("Restart"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{children:s.jsx(i.IconButton,{size:"small",onClick:t=>{this.setState({showMore:null}),t.stopPropagation(),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{}).catch(o=>window.alert(`Cannot set log level: ${o}`))},onFocus:t=>t.stopPropagation(),style:{...n.buttonControl,...this.state.canStart?void 0:n.hide},disabled:!this.state.running,children:s.jsx(p.Refresh,{})})})},"restart"),this.state.tempLogLevel!==this.state.logLevel?s.jsx(i.Tooltip,{title:this.props.t("temporary log level"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{style:n.logLevel,children:this.state.tempLogLevel})},"log"):null,s.jsx(i.Tooltip,{title:this.props.t("log level"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{style:n.logLevel,children:this.state.tempLogLevel!==this.state.logLevel?`/ ${this.state.logLevel}`:this.state.logLevel})},"logLevel"),s.jsx(i.Tooltip,{title:this.props.t("Edit log level rule for %s",`${this.props.adapter}.${this.props.instance}`),children:s.jsx(i.IconButton,{size:"small",onClick:t=>{t.stopPropagation(),this.setState({showLogLevelDialog:!0,showMore:null})},onFocus:t=>t.stopPropagation(),style:{...n.buttonControl,...this.state.canStart?void 0:n.hide,width:34,height:34},children:s.jsx(p.Edit,{style:{width:20,height:20}})})},"editLog")];return s.jsxs(i.Paper,{style:n.root,children:[s.jsx(i.AppBar,{color:"default",position:"static",children:s.jsxs(i.Toolbar,{variant:"dense",style:{marginLeft:8,paddingRight:6},children:[s.jsxs(i.Typography,{variant:"h6",color:"inherit",style:{display:"flex",alignItems:"center"},children:[s.jsx(i.IconButton,{size:"small",onClick:()=>{this.props.easyMode?this.props.handleNavigation("easy"):this.props.handleNavigation("tab-instances")},onFocus:t=>t.stopPropagation(),style:{marginRight:10},children:s.jsx(p.ArrowBack,{})}),this.props.jsonConfig?s.jsx(y.Icon,{src:this.props.icon,style:n.instanceIcon}):null,s.jsx(i.Box,{component:"span",sx:t=>({[t.breakpoints.down("md")]:{display:"none"},marginRight:"8px"}),children:`${this.props.t("Instance settings")}:`}),`${this.props.adapter}.${this.props.instance}`,s.jsx(i.Box,{component:"div",sx:t=>({[t.breakpoints.down("sm")]:{display:"none"}}),children:e}),s.jsxs(i.Box,{component:"span",sx:t=>({[t.breakpoints.up("sm")]:{display:"none"}}),children:[s.jsx(i.IconButton,{style:{marginLeft:8},onClick:t=>this.setState({showMore:t.currentTarget}),children:s.jsx(p.MoreVert,{})}),this.state.showMore?s.jsx(i.Menu,{open:!0,anchorEl:this.state.showMore,onClose:()=>this.setState({showMore:null}),children:e}):null]})]}),s.jsx("div",{style:{flexGrow:1}}),this.renderHelpButton()]})}),this.getConfigurator(),this.returnStopAdminDialog(),this.renderLogLevelDialog()]})}}export{G as C};
1
+ import{j as s}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as k}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{i,a as p}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as y}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{i as C}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import{g as $}from"./_commonjsHelpers-CE1G-McA.js";import{a as I,b as D}from"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import{c as b}from"./bootstrap-C5UDqwR8.js";import{o as L,g as E,w as m,t as g}from"./createTheme-O_VGsRib.js";const{loadShare:T}=D,{initPromise:F}=I,M=F.then(c=>T("@iobroker/dm-gui-components",{customShareInfo:{shareConfig:{singleton:!0,strictVersion:!1,requiredVersion:"*"}}})),W=await M.then(c=>c());var O=W;const P=$(O),A=["silly","debug","info","warn","error"],n={root:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},scroll:{height:"100%",overflowY:"auto"},instanceIcon:{width:42,height:42,marginRight:16,verticalAlign:"middle"},button:{width:36,height:36},version:{fontSize:12,opacity:.8,marginLeft:20,marginRight:10},versionAliveConnected:c=>({color:c.palette.mode==="dark"?"#23a623":"#60ff60"}),versionAliveNotConnected:{color:"#a67223"},buttonControl:{padding:"5px",transition:"opacity 0.2s",height:34},enabled:{color:g[400],"&:hover":{backgroundColor:g[200]}},disabled:{color:m[400],"&:hover":{backgroundColor:m[200]}},hide:{visibility:"hidden"},formControl:{width:"100%",marginBottom:5},logLevel:{fontSize:12,marginLeft:10},green:{color:g[700]},red:{color:m[700]},grey:{color:E[700]},blue:{color:"#0055a9"},orange:{color:L[400]},orangeDevice:{color:L[300]},tooltip:{pointerEvents:"none"}};class G extends k.Component{refIframe;registered;constructor(e){super(e),this.state={checkedExist:!1,showStopAdminDialog:!1,running:!1,canStart:!1,alive:!1,connected:!1,connectedToHost:!1,logOnTheFlyValue:!1,logLevel:"info",logLevelValue:"info",tempLogLevel:"info",showLogLevelDialog:!1,showMore:null},this.refIframe=null,this.registered=!1}componentDidUpdate(){var e;!this.registered&&((e=this.refIframe)!=null&&e.contentWindow)&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe))}componentDidMount(){var e;if(this.props.tab)this.props.socket.fileExists(`${this.props.adapter}.admin`,"tab.html").then(t=>{if(t)this.setState({checkedExist:"tab.html"});else return this.props.socket.fileExists(`${this.props.adapter}.admin`,"tab_m.html").then(o=>o?this.setState({checkedExist:"tab_m.html"}):window.alert("Cannot find tab(_m).html"))});else{const t=`system.adapter.${this.props.adapter}.${this.props.instance}`;this.props.socket.subscribeObject(t,this.onObjectChange),this.props.socket.getObject(t).then(async o=>{var f,u,_,v,x,w,S;const a=await this.props.socket.getState(`${t}.logLevel`);await this.props.socket.subscribeState(`${t}.logLevel`,this.onStateChange);const r=await this.props.socket.getState(`${t}.alive`);await this.props.socket.subscribeState(`${t}.alive`,this.onStateChange);const l=await this.props.socket.getState(`${t}.connected`);await this.props.socket.subscribeState(`${t}.connected`,this.onStateChange);let d;try{d=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.connection`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.connection`,this.onStateChange)}catch{d=null}let h;try{h=await this.props.socket.getState(`${this.props.adapter}.${this.props.instance}.info.extension`),this.props.socket.subscribeState(`${this.props.adapter}.${this.props.instance}.info.extension`,this.onStateChange)}catch{h=null}this.setState({checkedExist:!0,running:((f=o==null?void 0:o.common)==null?void 0:f.onlyWWW)||((u=o==null?void 0:o.common)==null?void 0:u.enabled),canStart:!((_=o==null?void 0:o.common)!=null&&_.onlyWWW),alive:!!(r!=null&&r.val),extension:h?!!(h!=null&&h.val):null,connectedToHost:!!(l!=null&&l.val),connected:d?!!d.val:null,logLevel:((v=o==null?void 0:o.common)==null?void 0:v.loglevel)||"info",logLevelValue:((x=o==null?void 0:o.common)==null?void 0:x.loglevel)||"info",tempLogLevel:(a==null?void 0:a.val)||((w=o==null?void 0:o.common)==null?void 0:w.loglevel)||"info",common:(o==null?void 0:o.common)||{},native:(o==null?void 0:o.native)||{},adapterDocLangs:(S=o==null?void 0:o.common)!=null&&S.docs?Object.keys(o.common.docs):["en"]})}).catch(o=>{console.error(o),this.setState({checkedExist:!0,running:!1})})}!this.registered&&((e=this.refIframe)!=null&&e.contentWindow)&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe)),(window.addEventListener||window.attachEvent)(window.addEventListener?"message":"onmessage",this.closeConfig,!1)}onObjectChange=(e,t)=>{var o,a,r,l;e===`system.adapter.${this.props.adapter}.${this.props.instance}`&&this.setState({running:((o=t==null?void 0:t.common)==null?void 0:o.onlyWWW)||((a=t==null?void 0:t.common)==null?void 0:a.enabled),canStart:!((r=t==null?void 0:t.common)!=null&&r.onlyWWW),logLevel:((l=t==null?void 0:t.common)==null?void 0:l.loglevel)||"info"})};getInstanceStatus(){var o,a,r,l;const e=((o=this.state.common)==null?void 0:o.mode)||"";let t=e==="daemon"?"green":"blue";if((a=this.state.common)!=null&&a.enabled&&(!this.state.common.webExtension||!((r=this.state.native)!=null&&r.webInstance)||e==="daemon")){if(this.state.common.webExtension&&((l=this.state.native)!=null&&l.webInstance)&&this.state.extension!==null)return this.state.extension?"green":"red";(!this.state.connectedToHost||!this.state.alive)&&(t=e==="daemon"?"red":"orangeDevice"),this.state.connected!==null&&!this.state.connected&&t!=="red"&&(t="orange")}else t=e==="daemon"?"grey":"blue";return t}onStateChange=(e,t)=>{const o=`system.adapter.${this.props.adapter}.${this.props.instance}`;e===`${o}.alive`?this.setState({alive:!!(t!=null&&t.val)}):e===`${o}.connected`?this.setState({connectedToHost:!!(t!=null&&t.val)}):e===`${this.props.adapter}.${this.props.instance}.info.connection`?this.setState({connected:t?!!t.val:null}):e===`${this.props.adapter}.${this.props.instance}.info.extension`?this.setState({extension:t?!!t.val:null}):e===`${o}.logLevel`&&this.setState({tempLogLevel:t?t.val:null})};componentWillUnmount(){this.props.socket.unsubscribeObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,this.onObjectChange),(window.removeEventListener||window.detachEvent)(window.removeEventListener?"message":"onmessage",this.closeConfig,!1),this.registered&&this.refIframe&&this.props.onUnregisterIframeRef(this.refIframe),this.refIframe=null}closeConfig=e=>{if(e.origin===window.location.origin){if(e.data==="close"||e.message==="close")this.props.easyMode?this.props.handleNavigation("easy"):this.props.handleNavigation("tab-instances");else if(e.data==="change"||e.message==="change")this.props.configStored(!1);else if(e.data==="nochange"||e.message==="nochange")this.props.configStored(!0);else if(typeof e.data=="string"&&e.data.startsWith("goto:")||typeof e.message=="string"&&e.message.startsWith("goto:")){const[,t]=(e.data||e.message).split(":"),[o,a,r]=t.split("/");this.props.handleNavigation(o,a,r)}}};renderHelpButton(){return this.props.jsonConfig?s.jsx(i.Tooltip,{title:this.props.t("Show help for this adapter"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx(i.Fab,{sx:{"&.MuiFab-root":n.button},onClick:()=>{var t;const e=(t=this.state.adapterDocLangs)!=null&&t.includes(this.props.lang)?this.props.lang:"en";window.open(b.getDocsLinkForAdapter({lang:e,adapterName:this.props.adapter}),"help")},children:s.jsx(p.Help,{})})}):null}getConfigurator(){if(this.props.jsonConfig)return s.jsx(C.JsonConfig,{expertMode:this.props.expertMode,theme:this.props.theme,width:this.props.width,adapterName:this.props.adapter,instance:this.props.instance,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,dateFormat:this.props.dateFormat,isFloatComma:this.props.isFloatComma,configStored:this.props.configStored,t:this.props.t,DeviceManager:P});const e=`adapter/${this.props.adapter}/${this.props.tab?this.state.checkedExist:this.props.materialize?"index_m.html":"index.html"}?${this.props.instance||0}&newReact=true&${this.props.instance||0}&react=${this.props.themeName}`;return this.state.checkedExist?s.jsx("iframe",{ref:t=>this&&(this.refIframe=t),title:"config",style:this.props.style,src:e}):null}returnStopAdminDialog(){return this.state.showStopAdminDialog?s.jsx(y.DialogConfirm,{title:this.props.t("Please confirm"),text:this.props.t("stop_admin",this.props.instance),ok:this.props.t("Stop admin"),onClose:e=>{e&&this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!1}}).catch(t=>window.alert(t)),this.setState({showStopAdminDialog:!1})}}):null}renderLogLevelDialog(){return this.state.showLogLevelDialog?s.jsxs(i.Dialog,{open:!0,onClose:()=>this.setState({showLogLevelDialog:!1}),children:[s.jsx(i.DialogTitle,{children:this.props.t("Edit log level rule for %s",`${this.props.adapter}.${this.props.instance}`)}),s.jsxs(i.DialogContent,{children:[s.jsxs(i.FormControl,{style:{...n.formControl,marginTop:10},variant:"outlined",children:[s.jsx(i.InputLabel,{children:this.props.t("log level")}),s.jsx(i.Select,{variant:"standard",value:this.state.logLevelValue,fullWidth:!0,onChange:e=>this.setState({logLevelValue:e.target.value}),children:A.map(e=>s.jsx(i.MenuItem,{value:e,children:this.props.t(e)},e))})]}),s.jsxs(i.FormControl,{style:n.formControl,variant:"outlined",children:[s.jsx(i.FormControlLabel,{control:s.jsx(i.Checkbox,{checked:this.state.logOnTheFlyValue,onChange:e=>this.setState({logOnTheFlyValue:e.target.checked})}),label:this.props.t("Without restart")}),s.jsx(i.FormHelperText,{children:this.state.logOnTheFlyValue?this.props.t("Will be reset to the saved log level after restart of adapter"):this.props.t("Log level will be saved permanently")})]})]}),s.jsxs(i.DialogActions,{children:[s.jsx(i.Button,{color:"primary",variant:"contained",onClick:()=>{this.state.logOnTheFlyValue?this.props.socket.setState(`system.adapter.${this.props.adapter}.${this.props.instance}.logLevel`,this.state.logLevelValue):this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{loglevel:this.state.logLevelValue}}).catch(e=>window.alert(`Cannot set log level: ${e}`)),this.setState({showLogLevelDialog:!1})},children:this.props.t("Ok")}),s.jsx(i.Button,{color:"grey",variant:"contained",onClick:()=>this.setState({showLogLevelDialog:!1}),children:this.props.t("Cancel")})]})]}):null}render(){const e=[this.props.version?s.jsxs("span",{style:{...n.version,...n[this.getInstanceStatus()]},children:["v",this.props.version]},"version"):null,s.jsx(i.Tooltip,{title:this.props.t("Start/stop"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{children:s.jsx(i.IconButton,{size:"small",onClick:t=>{t.stopPropagation(),t.preventDefault(),this.state.running&&`${this.props.adapter}.${this.props.instance}`===this.props.adminInstance?this.setState({showStopAdminDialog:!0,showMore:null}):(this.setState({showMore:null}),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{common:{enabled:!this.state.running}}).catch(o=>window.alert(`Cannot set log level: ${o}`)))},onFocus:t=>t.stopPropagation(),sx:{...n.buttonControl,...this.state.canStart?this.state.running?n.enabled:n.disabled:n.hide},children:this.state.running?s.jsx(p.Pause,{}):s.jsx(p.PlayArrow,{})})})},"start"),s.jsx(i.Tooltip,{title:this.props.t("Restart"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{children:s.jsx(i.IconButton,{size:"small",onClick:t=>{this.setState({showMore:null}),t.stopPropagation(),this.props.socket.extendObject(`system.adapter.${this.props.adapter}.${this.props.instance}`,{}).catch(o=>window.alert(`Cannot set log level: ${o}`))},onFocus:t=>t.stopPropagation(),style:{...n.buttonControl,...this.state.canStart?void 0:n.hide},disabled:!this.state.running,children:s.jsx(p.Refresh,{})})})},"restart"),this.state.tempLogLevel!==this.state.logLevel?s.jsx(i.Tooltip,{title:this.props.t("temporary log level"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{style:n.logLevel,children:this.state.tempLogLevel})},"log"):null,s.jsx(i.Tooltip,{title:this.props.t("log level"),slotProps:{popper:{sx:n.tooltip}},children:s.jsx("span",{style:n.logLevel,children:this.state.tempLogLevel!==this.state.logLevel?`/ ${this.state.logLevel}`:this.state.logLevel})},"logLevel"),s.jsx(i.Tooltip,{title:this.props.t("Edit log level rule for %s",`${this.props.adapter}.${this.props.instance}`),children:s.jsx(i.IconButton,{size:"small",onClick:t=>{t.stopPropagation(),this.setState({showLogLevelDialog:!0,showMore:null})},onFocus:t=>t.stopPropagation(),style:{...n.buttonControl,...this.state.canStart?void 0:n.hide,width:34,height:34},children:s.jsx(p.Edit,{style:{width:20,height:20}})})},"editLog")];return s.jsxs(i.Paper,{style:n.root,children:[s.jsx(i.AppBar,{color:"default",position:"static",children:s.jsxs(i.Toolbar,{variant:"dense",style:{marginLeft:8,paddingRight:6},children:[s.jsxs(i.Typography,{variant:"h6",color:"inherit",style:{display:"flex",alignItems:"center"},children:[s.jsx(i.IconButton,{size:"small",onClick:()=>{this.props.easyMode?this.props.handleNavigation("easy"):this.props.handleNavigation("tab-instances")},onFocus:t=>t.stopPropagation(),style:{marginRight:10},children:s.jsx(p.ArrowBack,{})}),this.props.jsonConfig?s.jsx(y.Icon,{src:this.props.icon,style:n.instanceIcon}):null,s.jsx(i.Box,{component:"span",sx:t=>({[t.breakpoints.down("md")]:{display:"none"},marginRight:"8px"}),children:`${this.props.t("Instance settings")}:`}),`${this.props.adapter}.${this.props.instance}`,s.jsx(i.Box,{component:"div",sx:t=>({[t.breakpoints.down("sm")]:{display:"none"}}),children:e}),s.jsxs(i.Box,{component:"span",sx:t=>({[t.breakpoints.up("sm")]:{display:"none"}}),children:[s.jsx(i.IconButton,{style:{marginLeft:8},onClick:t=>this.setState({showMore:t.currentTarget}),children:s.jsx(p.MoreVert,{})}),this.state.showMore?s.jsx(i.Menu,{open:!0,anchorEl:this.state.showMore,onClose:()=>this.setState({showMore:null}),children:e}):null]})]}),s.jsx("div",{style:{flexGrow:1}}),this.renderHelpButton()]})}),this.getConfigurator(),this.returnStopAdminDialog(),this.renderLogLevelDialog()]})}}export{G as C};
@@ -0,0 +1 @@
1
+ import{j as i}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as c}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{i as l}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{l as g}from"./index-8HslT92O.js";import{i as d}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{i as f}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import{c as _}from"./bootstrap-C5UDqwR8.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./ace-DgO9yth5.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./createTheme-O_VGsRib.js";import"./ext-language_tools-DJmHbGA8.js";import"./preload-helper-BDBacUwf.js";import"./sdk-CXXcV9KR.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./ThemeProvider-DPY2Djdh.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";import"./en-US-B8gg5zk_.js";const u={root:{display:"block",position:"relative",left:0,top:0,width:"100%",height:"100%",color:"black",borderRadius:4,boxShadow:"0px 2px 1px -1px rgb(0 0 0 / 20%), 0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 1px 3px 0px rgb(0 0 0 / 12%)",border:"0px solid #888"}};class J extends c.Component{refIframe=null;registered=!1;loadingTimer=null;constructor(t){super(t),this.state={href:"",adapterName:"",instanceNumber:null,schema:null,jsonData:{},loadingKey:0,loading:!0}}async componentDidMount(){var h;!this.registered&&((h=this.refIframe)!=null&&h.contentWindow)&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe)),(window.addEventListener||window.attachEvent)(window.addEventListener?"message":"onmessage",this.onMessage,!1);const t={};for(const o of this.props.hosts)t[o._id]=o;const e=await _.getHref(this.props.instancesWorker,this.props.tab,this.props.hostname,t,this.props.adminInstance,this.props.theme.palette.mode);let s=null;const r=(e==null?void 0:e.href.split("?")[0])||"";let n={};if(r.endsWith(".json")||r.endsWith(".json5"))try{let o;const m=await this.props.socket.readFile(`${e.adapterName}.admin`,r,!0);m.file!==void 0&&(o=atob(m.file.toString()),o.startsWith("{")||(o=decodeURIComponent(o)));try{s=g.parse(o)}catch(a){console.error(`Cannot parse jsonConfig of ${e.adapterName}: ${a}`),window.alert(`Cannot parse jsonConfig of ${e.adapterName}: ${a}`)}if(s&&await f.JsonConfigComponent.loadI18n(this.props.socket,s.i18n,e.adapterName),s!=null&&s.command){const a=await this.props.socket.getState(`system.adapter.${e.adapterName}.${e.instanceNumber||0}.alive`);if(a!=null&&a.val){const p=await this.props.socket.sendTo(`${e.adapterName}.${e.instanceNumber||0}`,s==null?void 0:s.command,null);p!=null&&p.data&&(n=p.data)}}}catch(o){console.error(`Cannot load ${e.adapterName}.admin/${e.href}: ${o}`),window.alert(`Cannot load ${e.adapterName}.admin/${e.href}: ${o}`)}this.setState({href:e.href,adapterName:e.adapterName,instanceNumber:e.instanceNumber,schema:s,jsonData:n})}componentWillUnmount(){this.loadingTimer&&(clearInterval(this.loadingTimer),this.loadingTimer=null),this.registered&&(this.props.onUnregisterIframeRef(this.refIframe),this.registered=!1),(window.removeEventListener||window.detachEvent)(window.removeEventListener?"message":"onmessage",this.onMessage,!1)}componentDidUpdate(){var t;!this.registered&&((t=this.refIframe)!=null&&t.contentWindow)&&(this.registered=!0,this.props.onRegisterIframeRef(this.refIframe))}onMessage=t=>{if(this.props.supportsLoadingMessage&&t.data==="iobLoaded"||t.message==="iobLoaded"){this.setState({loading:!1}),this.loadingTimer&&(clearInterval(this.loadingTimer),this.loadingTimer=null);return}if(t.origin===window.location.origin){if(t.data==="close"||t.message==="close")d.Router.doNavigate("tab-instances");else if(t.data==="change"||t.message==="change")console.warn('Application sends "change" message, but it is not processed yet');else if(t.data==="nochange"||t.message==="nochange")console.warn('Application sends "nochange" message, but it is not processed yet');else if(typeof t.data=="string"&&t.data.startsWith("goto:")||typeof t.message=="string"&&t.message.startsWith("goto:")){const[,e]=(t.data||t.message).split(":"),[s,r,n]=e.split("/");d.Router.doNavigate(s,r,n)}}};render(){return this.state.href?this.state.href.includes(".json")?this.state.schema?i.jsx(f.JsonConfigComponent,{socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.theme.palette.mode,adapterName:this.state.adapterName,instance:this.state.instanceNumber||0,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,data:this.state.jsonData,onError:()=>{},theme:this.props.theme,withoutSaveButtons:!0,expertMode:this.props.expertMode}):i.jsx(l.LinearProgress,{}):this.state.href.startsWith("http://")&&window.location.protocol==="https:"&&window.location.hostname!=="localhost"?i.jsxs("div",{style:{padding:10,display:"flex",justifyContent:"center",alignItems:"center",height:"100%",flexDirection:"column",fontSize:18,gap:20},children:[i.jsx("div",{children:d.I18n.t("This content cannot be loaded because it uses insecure HTTP protocol.")}),i.jsx("div",{children:d.I18n.t("But you can open this link in new tab:")}),i.jsx("a",{href:this.state.href,target:"_blank",rel:"noopener noreferrer",children:this.state.href})]}):i.jsxs("div",{style:u.root,children:[this.state.loading?i.jsx(l.LinearProgress,{style:{position:"absolute",zIndex:2,width:"100%"}}):null,this.state.loading&&this.props.icon?i.jsx("div",{style:{position:"absolute",zIndex:2,width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",fontSize:48},children:typeof this.props.icon=="string"?i.jsx("img",{src:this.props.icon,alt:"icon",style:{maxWidth:200,width:"100%",opacity:.7}}):this.props.icon}):null,i.jsx("iframe",{ref:t=>this.refIframe=t,title:this.props.tab,style:{display:"block",position:"relative",left:0,top:0,width:"100%",height:"100%",color:"black",zIndex:1,borderRadius:0,boxShadow:"none",border:"0px solid #888"},src:this.state.href,onLoad:()=>{this.props.supportsLoadingMessage||(this.setState({loading:!1}),this.loadingTimer&&(clearInterval(this.loadingTimer),this.loadingTimer=null))},onError:t=>{t.target.onerror=null,this.state.href.includes("tab_m.html")?this.setState(e=>({href:e.href.replace("tab_m.html","tab.html")})):this.loadingTimer||=setInterval(()=>this.setState({loadingKey:this.state.loadingKey+1}),3e3)}})]}):i.jsx(l.LinearProgress,{})}}export{J as default};
@@ -0,0 +1 @@
1
+ import{j as o}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as C}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{i as s,a as S}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as M}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{C as B}from"./Config-DVKaSpJQ.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import"./bootstrap-C5UDqwR8.js";import"./ace-DgO9yth5.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./createTheme-O_VGsRib.js";import"./ext-language_tools-DJmHbGA8.js";import"./preload-helper-BDBacUwf.js";import"./sdk-CXXcV9KR.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./ThemeProvider-DPY2Djdh.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";import"./en-US-B8gg5zk_.js";const T="0 2px 2px 0 rgba(0, 0, 0, .14),0 3px 1px -2px rgba(0, 0, 0, .12),0 1px 5px 0 rgba(0, 0, 0, .2)",R="0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)",n={root:e=>({position:"relative",m:"10px",width:300,minHeight:200,background:e.palette.background.default,boxShadow:T,display:"flex",transition:"box-shadow 0.5s",cursor:"pointer","&:hover":{boxShadow:R}}),imageBlock:{background:"silver",minHeight:60,display:"flex",padding:"0 10px 0 10px",position:"relative",justifyContent:"space-between",transition:"background 0.5s"},img:{width:60,height:60,marginTop:20,position:"relative","&:after":{content:'""',position:"absolute",zIndex:2,top:0,left:0,width:"100%",height:"100%",background:'url("img/no-image.svg") 100% 100% no-repeat',backgroundSize:"cover",backgroundColor:"#fff"}},adapter:{width:"100%",fontWeight:"bold",fontSize:15,verticalAlign:"middle",marginTop:"auto",borderTop:"1px solid silver",padding:"20px 4px",textAlign:"center",textTransform:"uppercase",textOverflow:"ellipsis",overflow:"hidden",color:"#ffab40"},instanceStateNotAlive1:{backgroundColor:"rgba(192, 192, 192, 0.4)"},wrapperDesc:{display:"flex",flexDirection:"column",width:"100%",overflow:"hidden"},desc:{padding:20,fontSize:15}};function z(e,r){return e&&typeof e=="object"?e[r]||e.en||"":e||""}const A=({icon:e,id:r,desc:d,lang:l,navigate:p})=>o.jsxs(s.Card,{onClick:p,sx:n.root,children:[o.jsx("div",{style:{...n.imageBlock,...n.instanceStateNotAlive1},children:o.jsx(s.CardMedia,{sx:n.img,component:"img",image:`adapter/${r.split(".")[0]}/${e}`})}),o.jsxs("div",{style:n.wrapperDesc,children:[o.jsx("div",{style:n.desc,children:z(d,l)}),o.jsx("div",{style:n.adapter,children:r})]})]}),t={appBar:e=>({transition:e.transitions.create(["margin","width"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})}),wrapperEasyMode:{height:"100%",borderRadius:0},wrapperCard:{padding:"80px 20px 20px",height:"100%",overflowY:"auto"},controlHeight:{display:"flex",flexFlow:"wrap",justifyContent:"center"},img:{width:60,height:60,position:"relative",borderRadius:60},logoWhite:{background:"white"},wrapperHeader:{display:"flex",alignItems:"center"},headerName:{fontSize:24,marginLeft:10},toolBar:{justifyContent:"space-between",margin:"5px 0"},paper:{height:"100%",paddingTop:80},iframe:{height:"100%",width:"100%",background:"#FFF",color:"#000",borderRadius:5,border:"1px solid #888"},IconButtons:{display:"flex"},logoPointer:{cursor:"pointer"}};class ai extends C.Component{constructor(r){super(r),this.state={configs:this.props.configs,strictMode:!this.props.configs}}componentDidMount(){this.props.configs||this.props.socket.getEasyMode().then(r=>this.setState({configs:r.configs}))}render(){const{t:r,themeName:d,toggleTheme:l,navigate:p,location:f,socket:x,themeType:_,theme:b,width:u,isFloatComma:v,dateFormat:y,configStored:w,getLocation:g,adminInstance:j}=this.props,{configs:m,strictMode:h}=this.state;if(!m)return o.jsx(s.CircularProgress,{});const k=f.id,i=m.find(({id:a})=>a===k);return o.jsxs(s.Paper,{style:t.wrapperEasyMode,children:[o.jsx(s.AppBar,{color:"default",position:"fixed",sx:t.appBar,children:o.jsxs(s.Toolbar,{style:t.toolBar,children:[o.jsxs("div",{style:t.wrapperHeader,children:[o.jsx(s.CardMedia,{onClick:h&&!g().dialog||i!=null&&i.tab?()=>p(i!=null&&i.tab?"easy":"tab-intro"):null,style:{...t.img,...d==="colored"?t.logoWhite:void 0,...h&&!g().dialog||i!=null&&i.tab?t.logoPointer:void 0},component:"img",image:"img/no-image.svg"}),o.jsx("div",{style:t.headerName,children:r("Easy Admin")})]}),o.jsxs("div",{style:t.IconButtons,children:[(h&&!g().dialog||(i==null?void 0:i.tab))&&o.jsx(s.IconButton,{size:"large",onClick:()=>p(i!=null&&i.tab?"easy":"tab-intro"),children:o.jsx(S.ArrowBack,{})}),o.jsx(M.ToggleThemeMenu,{t:r,toggleTheme:l,themeName:d,size:"large"})]})]})}),i?o.jsx(s.Paper,{style:t.paper,children:o.jsx(B,{expertMode:!0,style:t.iframe,adapter:i.id.split(".")[0],instance:parseInt(i.id.split(".")[1],10),jsonConfig:i.jsonConfig,materialize:i.materialize,tab:i==null?void 0:i.tab,socket:x,easyMode:!0,themeName:d,themeType:_,theme:b,width:u,t:r,lang:this.props.lang,icon:i.icon,adminInstance:j,configStored:w,dateFormat:y,isFloatComma:v,onRegisterIframeRef:a=>this.props.onRegisterIframeRef(a),onUnregisterIframeRef:a=>this.props.onUnregisterIframeRef(a),handleNavigation:this.props.handleNavigation})}):o.jsx("div",{style:t.wrapperCard,children:o.jsx("div",{style:t.controlHeight,children:m.sort((a,c)=>a.id<c.id?-1:a.id>c.id?1:0).map(a=>o.jsx(A,{lang:this.props.lang,navigate:()=>p(null,"config",a.id),...a},a.id))})})]})}}export{ai as default};
@@ -1,4 +1,4 @@
1
- import{j as s}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as I}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{i as O,a as k}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{h as ke,u as Ee,g as De,c as H,_ as Ge,D as Me,T as Je,i as Ue}from"./bootstrap-xC60EdKn.js";import{I as se,a as Ke,b as qe}from"./Fields-V2W2HJlv.js";import{i as c,a as b}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{z as ze,A as Ae}from"./index-Dy_ekAsY.js";import{_ as o}from"./preload-helper-BDBacUwf.js";import Se from"./list-C2A06nPE.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./ace-DgO9yth5.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./createTheme-O_VGsRib.js";import"./ext-language_tools-DJmHbGA8.js";import"./sdk-DTP6UH26.js";import"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import"./blueGrey-BFcAYvAO.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./en-US-B8gg5zk_.js";import"./iconBase-CB0tx1VT.js";var Ve={exports:{}},x={};/** @license React v17.0.2
1
+ import{j as s}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as I}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{i as O,a as k}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{h as ke,u as Ee,g as De,c as H,_ as Ge,D as Me,T as Je,i as Ue}from"./bootstrap-C5UDqwR8.js";import{I as se,a as Ke,b as qe}from"./Fields-BN3I4xea.js";import{i as c,a as b}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{z as ze,A as Ae}from"./index-Dy_ekAsY.js";import{_ as o}from"./preload-helper-BDBacUwf.js";import Se from"./list-C2A06nPE.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./ace-DgO9yth5.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./createTheme-O_VGsRib.js";import"./ext-language_tools-DJmHbGA8.js";import"./sdk-CXXcV9KR.js";import"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./ThemeProvider-DPY2Djdh.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";import"./en-US-B8gg5zk_.js";import"./iconBase-CB0tx1VT.js";var Ve={exports:{}},x={};/** @license React v17.0.2
2
2
  * react-is.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -1 +1 @@
1
- import{i as _}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{j as r}from"./DefaultPropsProvider-BZ42HOhu.js";import{j as d}from"./bootstrap-xC60EdKn.js";import{i as l,a as u}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as c}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";_.createContext(void 0);var o=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),f=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),x=e=>{let t=e.getInitialClientOffset(),n=e.getInitialSourceClientOffset();return t===null||n===null?{x:0,y:0}:o(t,n)},y=(e,t)=>{switch(e){case"left":case"top-start":case"bottom-start":return 0;case"right":case"top-end":case"bottom-end":return t.width;default:return t.width/2}},h=(e,t)=>{switch(e){case"top":case"top-start":case"top-end":return 0;case"bottom":case"bottom-start":case"bottom-end":return t.height;default:return t.height/2}},g=(e,t,n="center",a={x:0,y:0})=>{let i=e.getClientOffset();if(i===null)return null;if(!t.current||!t.current.getBoundingClientRect)return o(i,x(e));let s=t.current.getBoundingClientRect(),m={x:y(n,s),y:h(n,s)};return f(o(i,m),a)},C=e=>{let t=`translate(${e.x.toFixed(1)}px, ${e.y.toFixed(1)}px)`;return{pointerEvents:"none",position:"fixed",top:0,left:0,transform:t,WebkitTransform:t}},S=e=>{let t=_.useRef(null),n=d(a=>({currentOffset:g(a,t,e==null?void 0:e.placement,e==null?void 0:e.padding),isDragging:a.isDragging(),itemType:a.getItemType(),item:a.getItem(),monitor:a}));return!n.isDragging||n.currentOffset===null?{display:!1}:{display:!0,itemType:n.itemType,item:n.item,style:C(n.currentOffset),monitor:n.monitor,ref:t}};function O(e){const t=e.icon;return r.jsxs("div",{style:e.styles.formContainer,children:[t?r.jsx(t,{style:e.styles.formIcon}):null,r.jsx(l.FormControl,{style:e.styles.formControl,variant:"standard",children:r.jsx(l.TextField,{variant:"standard",label:e.t(e.label),autoComplete:e.autoComplete,error:!!e.error,helperText:e.error||"",value:e.value,onChange:n=>e.onChange(n.target.value),disabled:e.disabled,type:e.type,slotProps:{inputLabel:{shrink:!0},input:{readOnly:!1,endAdornment:e.value?r.jsx(l.InputAdornment,{position:"end",children:r.jsx(l.IconButton,{tabIndex:-1,size:"small",onClick:()=>e.onChange(""),children:r.jsx(u.Close,{})})}):null}}})})]})}function T(e){const t=e.icon;return r.jsxs("div",{style:{width:"100%"},children:[t?r.jsx(t,{style:e.previewStyle||e.styles.formIcon}):null,r.jsx(c.ColorPicker,{style:{...e.style||void 0,width:t?"calc(100% - 45px)":"100%",display:"inline-block",verticalAlign:"top"},label:e.t(e.label),onChange:e.onChange,value:e.value||""})]})}export{O as I,T as a,S as b};
1
+ import{i as _}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{j as r}from"./DefaultPropsProvider-BZ42HOhu.js";import{j as d}from"./bootstrap-C5UDqwR8.js";import{i as l,a as u}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as c}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";_.createContext(void 0);var o=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),f=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),x=e=>{let t=e.getInitialClientOffset(),n=e.getInitialSourceClientOffset();return t===null||n===null?{x:0,y:0}:o(t,n)},y=(e,t)=>{switch(e){case"left":case"top-start":case"bottom-start":return 0;case"right":case"top-end":case"bottom-end":return t.width;default:return t.width/2}},h=(e,t)=>{switch(e){case"top":case"top-start":case"top-end":return 0;case"bottom":case"bottom-start":case"bottom-end":return t.height;default:return t.height/2}},g=(e,t,n="center",a={x:0,y:0})=>{let i=e.getClientOffset();if(i===null)return null;if(!t.current||!t.current.getBoundingClientRect)return o(i,x(e));let s=t.current.getBoundingClientRect(),m={x:y(n,s),y:h(n,s)};return f(o(i,m),a)},C=e=>{let t=`translate(${e.x.toFixed(1)}px, ${e.y.toFixed(1)}px)`;return{pointerEvents:"none",position:"fixed",top:0,left:0,transform:t,WebkitTransform:t}},S=e=>{let t=_.useRef(null),n=d(a=>({currentOffset:g(a,t,e==null?void 0:e.placement,e==null?void 0:e.padding),isDragging:a.isDragging(),itemType:a.getItemType(),item:a.getItem(),monitor:a}));return!n.isDragging||n.currentOffset===null?{display:!1}:{display:!0,itemType:n.itemType,item:n.item,style:C(n.currentOffset),monitor:n.monitor,ref:t}};function O(e){const t=e.icon;return r.jsxs("div",{style:e.styles.formContainer,children:[t?r.jsx(t,{style:e.styles.formIcon}):null,r.jsx(l.FormControl,{style:e.styles.formControl,variant:"standard",children:r.jsx(l.TextField,{variant:"standard",label:e.t(e.label),autoComplete:e.autoComplete,error:!!e.error,helperText:e.error||"",value:e.value,onChange:n=>e.onChange(n.target.value),disabled:e.disabled,type:e.type,slotProps:{inputLabel:{shrink:!0},input:{readOnly:!1,endAdornment:e.value?r.jsx(l.InputAdornment,{position:"end",children:r.jsx(l.IconButton,{tabIndex:-1,size:"small",onClick:()=>e.onChange(""),children:r.jsx(u.Close,{})})}):null}}})})]})}function T(e){const t=e.icon;return r.jsxs("div",{style:{width:"100%"},children:[t?r.jsx(t,{style:e.previewStyle||e.styles.formIcon}):null,r.jsx(c.ColorPicker,{style:{...e.style||void 0,width:t?"calc(100% - 45px)":"100%",display:"inline-block",verticalAlign:"top"},label:e.t(e.label),onChange:e.onChange,value:e.value||""})]})}export{O as I,T as a,S as b};
@@ -1,4 +1,4 @@
1
- import{j as B}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as M}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{i as Be}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as se}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{a as Te}from"./ace-DgO9yth5.js";import{E as Ge,c as Ne}from"./bootstrap-xC60EdKn.js";import{C as $e}from"./CustomModal-DCjdghJB.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./createTheme-O_VGsRib.js";import"./ext-language_tools-DJmHbGA8.js";import"./preload-helper-BDBacUwf.js";import"./sdk-DTP6UH26.js";import"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import"./blueGrey-BFcAYvAO.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./en-US-B8gg5zk_.js";var De={},Se={};Se.byteLength=He;Se.toByteArray=We;Se.fromByteArray=Qe;var ee=[],K=[],ve=typeof Uint8Array<"u"?Uint8Array:Array,Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var me=0,qe=Le.length;me<qe;++me)ee[me]=Le[me],K[Le.charCodeAt(me)]=me;K[45]=62;K[95]=63;function Oe(h){var c=h.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=h.indexOf("=");u===-1&&(u=c);var d=u===c?0:4-u%4;return[u,d]}function He(h){var c=Oe(h),u=c[0],d=c[1];return(u+d)*3/4-d}function Ve(h,c,u){return(c+u)*3/4-u}function We(h){var c,u=Oe(h),d=u[0],f=u[1],a=new ve(Ve(h,d,f)),p=0,o=f>0?d-4:d,m;for(m=0;m<o;m+=4)c=K[h.charCodeAt(m)]<<18|K[h.charCodeAt(m+1)]<<12|K[h.charCodeAt(m+2)]<<6|K[h.charCodeAt(m+3)],a[p++]=c>>16&255,a[p++]=c>>8&255,a[p++]=c&255;return f===2&&(c=K[h.charCodeAt(m)]<<2|K[h.charCodeAt(m+1)]>>4,a[p++]=c&255),f===1&&(c=K[h.charCodeAt(m)]<<10|K[h.charCodeAt(m+1)]<<4|K[h.charCodeAt(m+2)]>>2,a[p++]=c>>8&255,a[p++]=c&255),a}function Je(h){return ee[h>>18&63]+ee[h>>12&63]+ee[h>>6&63]+ee[h&63]}function ze(h,c,u){for(var d,f=[],a=c;a<u;a+=3)d=(h[a]<<16&16711680)+(h[a+1]<<8&65280)+(h[a+2]&255),f.push(Je(d));return f.join("")}function Qe(h){for(var c,u=h.length,d=u%3,f=[],a=16383,p=0,o=u-d;p<o;p+=a)f.push(ze(h,p,p+a>o?o:p+a));return d===1?(c=h[u-1],f.push(ee[c>>2]+ee[c<<4&63]+"==")):d===2&&(c=(h[u-2]<<8)+h[u-1],f.push(ee[c>>10]+ee[c>>4&63]+ee[c<<2&63]+"=")),f.join("")}var Re={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Re.read=function(h,c,u,d,f){var a,p,o=f*8-d-1,m=(1<<o)-1,S=m>>1,w=-7,g=u?f-1:0,E=u?-1:1,x=h[c+g];for(g+=E,a=x&(1<<-w)-1,x>>=-w,w+=o;w>0;a=a*256+h[c+g],g+=E,w-=8);for(p=a&(1<<-w)-1,a>>=-w,w+=d;w>0;p=p*256+h[c+g],g+=E,w-=8);if(a===0)a=1-S;else{if(a===m)return p?NaN:(x?-1:1)*(1/0);p=p+Math.pow(2,d),a=a-S}return(x?-1:1)*p*Math.pow(2,a-d)};Re.write=function(h,c,u,d,f,a){var p,o,m,S=a*8-f-1,w=(1<<S)-1,g=w>>1,E=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=d?0:a-1,k=d?1:-1,A=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(o=isNaN(c)?1:0,p=w):(p=Math.floor(Math.log(c)/Math.LN2),c*(m=Math.pow(2,-p))<1&&(p--,m*=2),p+g>=1?c+=E/m:c+=E*Math.pow(2,1-g),c*m>=2&&(p++,m/=2),p+g>=w?(o=0,p=w):p+g>=1?(o=(c*m-1)*Math.pow(2,f),p=p+g):(o=c*Math.pow(2,g-1)*Math.pow(2,f),p=0));f>=8;h[u+x]=o&255,x+=k,o/=256,f-=8);for(p=p<<f|o,S+=f;S>0;h[u+x]=p&255,x+=k,p/=256,S-=8);h[u+x-k]|=A*128};/*!
1
+ import{j as B}from"./DefaultPropsProvider-BZ42HOhu.js";import{i as M}from"./iobroker_admin__loadShare__react__loadShare__-CMWK8WhK.js";import{i as Be}from"./iobroker_admin__loadShare___mf_0_mui_mf_1_icons_mf_2_material__loadShare__-Dy1SQ0vs.js";import{i as se}from"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-D-aUnioX.js";import{a as Te}from"./ace-DgO9yth5.js";import{E as Ge,c as Ne}from"./bootstrap-C5UDqwR8.js";import{C as $e}from"./CustomModal-DCjdghJB.js";import"./_commonjsHelpers-CE1G-McA.js";import"./iobroker_admin__mf_v__runtimeInit__mf_v__-CHE4rLsT.js";import"./emotion-serialize.esm-Q4o_CgeF.js";import"./iobroker_admin__loadShare___mf_0_emotion_mf_1_react__loadShare__-CXogaIXO.js";import"./iobroker_admin__loadShare__prop_mf_2_types__loadShare__-CpCTEixV.js";import"./iobroker_admin__loadShare__react_mf_2_dom__loadShare__-GTRt2eft.js";import"./useTheme-UOPilb5j.js";import"./createTheme-O_VGsRib.js";import"./ext-language_tools-DJmHbGA8.js";import"./preload-helper-BDBacUwf.js";import"./sdk-CXXcV9KR.js";import"./iobroker_admin__loadShare___mf_0_iobroker_mf_1_json_mf_2_config__loadShare__-DQH_iIDO.js";import"./iobroker_admin__loadShare__leaflet__loadShare__-BfU5U5_j.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-CKqanoMB.js";import"./iobroker_admin__loadShare__react_mf_2_dropzone__loadShare__-BF_gp27r.js";import"./ThemeProvider-DPY2Djdh.js";import"./emotion-cache.browser.esm-BgJfNZJN.js";import"./en-US-B8gg5zk_.js";var De={},Se={};Se.byteLength=He;Se.toByteArray=We;Se.fromByteArray=Qe;var ee=[],K=[],ve=typeof Uint8Array<"u"?Uint8Array:Array,Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var me=0,qe=Le.length;me<qe;++me)ee[me]=Le[me],K[Le.charCodeAt(me)]=me;K[45]=62;K[95]=63;function Oe(h){var c=h.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=h.indexOf("=");u===-1&&(u=c);var d=u===c?0:4-u%4;return[u,d]}function He(h){var c=Oe(h),u=c[0],d=c[1];return(u+d)*3/4-d}function Ve(h,c,u){return(c+u)*3/4-u}function We(h){var c,u=Oe(h),d=u[0],f=u[1],a=new ve(Ve(h,d,f)),p=0,o=f>0?d-4:d,m;for(m=0;m<o;m+=4)c=K[h.charCodeAt(m)]<<18|K[h.charCodeAt(m+1)]<<12|K[h.charCodeAt(m+2)]<<6|K[h.charCodeAt(m+3)],a[p++]=c>>16&255,a[p++]=c>>8&255,a[p++]=c&255;return f===2&&(c=K[h.charCodeAt(m)]<<2|K[h.charCodeAt(m+1)]>>4,a[p++]=c&255),f===1&&(c=K[h.charCodeAt(m)]<<10|K[h.charCodeAt(m+1)]<<4|K[h.charCodeAt(m+2)]>>2,a[p++]=c>>8&255,a[p++]=c&255),a}function Je(h){return ee[h>>18&63]+ee[h>>12&63]+ee[h>>6&63]+ee[h&63]}function ze(h,c,u){for(var d,f=[],a=c;a<u;a+=3)d=(h[a]<<16&16711680)+(h[a+1]<<8&65280)+(h[a+2]&255),f.push(Je(d));return f.join("")}function Qe(h){for(var c,u=h.length,d=u%3,f=[],a=16383,p=0,o=u-d;p<o;p+=a)f.push(ze(h,p,p+a>o?o:p+a));return d===1?(c=h[u-1],f.push(ee[c>>2]+ee[c<<4&63]+"==")):d===2&&(c=(h[u-2]<<8)+h[u-1],f.push(ee[c>>10]+ee[c>>4&63]+ee[c<<2&63]+"=")),f.join("")}var Re={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Re.read=function(h,c,u,d,f){var a,p,o=f*8-d-1,m=(1<<o)-1,S=m>>1,w=-7,g=u?f-1:0,E=u?-1:1,x=h[c+g];for(g+=E,a=x&(1<<-w)-1,x>>=-w,w+=o;w>0;a=a*256+h[c+g],g+=E,w-=8);for(p=a&(1<<-w)-1,a>>=-w,w+=d;w>0;p=p*256+h[c+g],g+=E,w-=8);if(a===0)a=1-S;else{if(a===m)return p?NaN:(x?-1:1)*(1/0);p=p+Math.pow(2,d),a=a-S}return(x?-1:1)*p*Math.pow(2,a-d)};Re.write=function(h,c,u,d,f,a){var p,o,m,S=a*8-f-1,w=(1<<S)-1,g=w>>1,E=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=d?0:a-1,k=d?1:-1,A=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(o=isNaN(c)?1:0,p=w):(p=Math.floor(Math.log(c)/Math.LN2),c*(m=Math.pow(2,-p))<1&&(p--,m*=2),p+g>=1?c+=E/m:c+=E*Math.pow(2,1-g),c*m>=2&&(p++,m/=2),p+g>=w?(o=0,p=w):p+g>=1?(o=(c*m-1)*Math.pow(2,f),p=p+g):(o=c*Math.pow(2,g-1)*Math.pow(2,f),p=0));f>=8;h[u+x]=o&255,x+=k,o/=256,f-=8);for(p=p<<f|o,S+=f;S>0;h[u+x]=p&255,x+=k,p/=256,S-=8);h[u+x-k]|=A*128};/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>