iobroker.eos-admin 9.0.31 → 9.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEXOWATT_EOS_BUILD_INFO.json +10 -11
- package/README.md +7 -7
- package/adminWww/.vite/manifest.json +233 -224
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13897 -13887
- package/adminWww/assets/AccessTime-CuR73YC3.js +1 -0
- package/adminWww/assets/{AdapterUpdateDialog-UhaQHyF1.js → AdapterUpdateDialog-5L75o18m.js} +5 -5
- package/adminWww/assets/{Adapters-Di3sM_ky.js → Adapters-FcghjF7E.js} +5 -5
- package/adminWww/assets/ConfigManager-BnHarBfH.js +1 -0
- package/adminWww/assets/Enums-BjLbLLQL.js +92 -0
- package/adminWww/assets/Fields-DDE1hVOa.js +1 -0
- package/adminWww/assets/Files-CDjnR4q6.js +1 -0
- package/adminWww/assets/{Hosts-DXjTE0pX.js → Hosts-CJKQaNrD.js} +6 -6
- package/adminWww/assets/Instances-DZNl369k.js +4 -0
- package/adminWww/assets/Intro-CjAmMGDB.js +2 -0
- package/adminWww/assets/KeyboardArrowRight-ifvmV1ZL.js +1 -0
- package/adminWww/assets/{Logs-DTo6XJF_.js → Logs-rUAV7SwM.js} +2 -2
- package/adminWww/assets/MoreHoriz-CS7nODK8.js +1 -0
- package/adminWww/assets/{Objects-DyEBMDK6.js → Objects-CqOH6rT_.js} +4 -4
- package/adminWww/assets/Overview-BOtXqsMy.js +3 -0
- package/adminWww/assets/Pageview-wzrLQZ-j.js +1 -0
- package/adminWww/assets/PersonOff-YtHcY0sV.js +1 -0
- package/adminWww/assets/Star-D8VNXawT.js +1 -0
- package/adminWww/assets/State-C8ncThop.js +1 -0
- package/adminWww/assets/UsedResources-lUYJqy4F.js +2 -0
- package/adminWww/assets/Users-CK1Cax82.js +1 -0
- package/adminWww/assets/ViewCompact-D7bHgn99.js +1 -0
- package/adminWww/assets/ViewSidebar-CjClbCI5.js +1 -0
- package/adminWww/assets/WifiTethering-DJ9VO12W.js +1 -0
- package/adminWww/assets/{bootstrap-BQ4OzwbT.js → bootstrap-CC0Qr-kr.js} +25 -25
- package/adminWww/assets/date-fns-BtR4dG_j.js +1 -0
- package/adminWww/assets/en-US-BjjaEI6N.js +1 -0
- package/adminWww/assets/{hostInit-CGSSNegd.js → hostInit-DqGL6nY8.js} +1 -1
- package/adminWww/assets/icons-material-07rWS63O.js +1 -0
- package/adminWww/assets/{index-C4CShixx.js → index-BhhkToP2.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-DeaOAT3W.js → installSVGRenderer-B4-7lSQZ.js} +1 -1
- package/adminWww/assets/isSameWeek-WMSJR5Qs.js +1 -0
- package/adminWww/assets/locale-DN6Bdkdt.js +1 -0
- package/adminWww/assets/{mf-entry-bootstrap-0-c5733c2d.js → mf-entry-bootstrap-0-1afd2287.js} +2 -2
- package/adminWww/assets/sentry-CPzCHrwe.js +1 -0
- package/adminWww/assets/setYear-DDSuW45e.js +1 -0
- package/adminWww/index.html +23 -23
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-9.0.31.js → remoteEntry-eos-9.0.34.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosDeviceEmsPlan.js +285 -9
- package/build/lib/eosDeviceEmsPlan.js.map +1 -1
- package/build/lib/eosDeviceEmsService.js +29 -2
- package/build/lib/eosDeviceEmsService.js.map +1 -1
- package/build/lib/eosUiProcess.js +31 -14
- package/build/lib/eosUiProcess.js.map +1 -1
- package/build/lib/eosUiProcessRpc.js +3 -1
- package/build/lib/eosUiProcessRpc.js.map +1 -1
- package/build/lib/eosUiProcessWorker.js +6 -4
- package/build/lib/eosUiProcessWorker.js.map +1 -1
- package/docs/README.md +3 -2
- package/docs/reports/unified-9.0.32/PRUEFBERICHT.md +34 -0
- package/docs/reports/unified-9.0.32/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.32/raw/INDEX.json +102 -0
- package/docs/reports/unified-9.0.32/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.32/raw/browser-cadence-headless.json +63 -0
- package/docs/reports/unified-9.0.32/raw/browser-flow-headless.json +328 -0
- package/docs/reports/unified-9.0.32/raw/focused.log +67 -0
- package/docs/reports/unified-9.0.32/raw/frontend.log +151 -0
- package/docs/reports/unified-9.0.32/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.32/raw/lint.log +5 -0
- package/docs/reports/unified-9.0.32/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.32/raw/node22-tests-final.log +17212 -0
- package/docs/reports/unified-9.0.32/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.32/raw/node24-tests-final.log +2869 -0
- package/docs/reports/unified-9.0.32/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.32/raw/sbom.log +2 -0
- package/docs/reports/unified-9.0.32/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.32/raw/ui-runtime.log +8 -0
- package/docs/reports/unified-9.0.32/raw/version-parity-928-929.log +6 -0
- package/docs/reports/unified-9.0.33/PRUEFBERICHT.md +60 -0
- package/docs/reports/unified-9.0.33/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.33/raw/INDEX.json +272 -0
- package/docs/reports/unified-9.0.33/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.33/raw/browser/UI_REVIEW.json +147 -0
- package/docs/reports/unified-9.0.33/raw/browser/admin-bundle.log +136 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-backup-settings-browser.log +67 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-customer-tariff-startup-browser.log +43 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-energyflow-browser-smoke.log +438 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-energyflow-cadence-browser-10s.log +108 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-evcs-delete-browser.log +1 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-history-setup-browser-smoke.log +49 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-kiosk-browser.log +59 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-ocpp-admin-browser.log +71 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-ocpp-installer-discovery-browser.log +11 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-pwa-trust-browser.log +35 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-controls-browser.log +78 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-health-browser.log +49 -0
- package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-login-browser.log +34 -0
- package/docs/reports/unified-9.0.33/raw/browser/smarthome.log +46 -0
- package/docs/reports/unified-9.0.33/raw/browser-ten-seconds.json +108 -0
- package/docs/reports/unified-9.0.33/raw/changed-test-coverage.json +116 -0
- package/docs/reports/unified-9.0.33/raw/connected-control-node22.jsonl +42 -0
- package/docs/reports/unified-9.0.33/raw/connected-control-summary-node22.json +103 -0
- package/docs/reports/unified-9.0.33/raw/connected-control-summary.json +103 -0
- package/docs/reports/unified-9.0.33/raw/connected-control.jsonl +42 -0
- package/docs/reports/unified-9.0.33/raw/display-ui-node22.log +162 -0
- package/docs/reports/unified-9.0.33/raw/display-ui.log +35 -0
- package/docs/reports/unified-9.0.33/raw/frontend.log +151 -0
- package/docs/reports/unified-9.0.33/raw/git-delivery-fix.log +10 -0
- package/docs/reports/unified-9.0.33/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.33/raw/license-central-node24.log +173 -0
- package/docs/reports/unified-9.0.33/raw/lint-final.log +45 -0
- package/docs/reports/unified-9.0.33/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.33/raw/node22-npm-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/node22-tests-final.log +17646 -0
- package/docs/reports/unified-9.0.33/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/node24-npm-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/node24-tests-final.log +2941 -0
- package/docs/reports/unified-9.0.33/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.33/raw/process-final-node22.log +220 -0
- package/docs/reports/unified-9.0.33/raw/process-final-node24.log +110 -0
- package/docs/reports/unified-9.0.33/raw/ram-picker.jsonl +12 -0
- package/docs/reports/unified-9.0.33/raw/reg-combined-node22.log +622 -0
- package/docs/reports/unified-9.0.33/raw/reg-combined.log +108 -0
- package/docs/reports/unified-9.0.33/raw/sbom-final.log +8 -0
- package/docs/reports/unified-9.0.33/raw/tariff-update-all-final-node22.log +1185 -0
- package/docs/reports/unified-9.0.33/raw/typecheck-final.log +5 -0
- package/docs/reports/unified-9.0.33/raw/ui-functional-node24.log +430 -0
- package/docs/reports/unified-9.0.33/raw/ui-runtime-final-verification.log +1 -0
- package/docs/reports/unified-9.0.33/raw/update-controller-standard-7-2-5.log +4 -0
- package/docs/reports/unified-9.0.33/raw/worker-memory-eos933.log +12 -0
- package/docs/reports/unified-9.0.33/raw/worker-memory-flow932.log +12 -0
- package/docs/reports/unified-9.0.34/PRUEFBERICHT.md +40 -0
- package/docs/reports/unified-9.0.34/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.34/raw/INDEX.json +137 -0
- package/docs/reports/unified-9.0.34/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.34/raw/dashboard-interval.json +108 -0
- package/docs/reports/unified-9.0.34/raw/fixtures-verification.log +44 -0
- package/docs/reports/unified-9.0.34/raw/frontend.log +152 -0
- package/docs/reports/unified-9.0.34/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.34/raw/lint.log +45 -0
- package/docs/reports/unified-9.0.34/raw/mira-dashboard-browser.json +1 -0
- package/docs/reports/unified-9.0.34/raw/mira-devices-browser.log +9 -0
- package/docs/reports/unified-9.0.34/raw/mira-memory-process.json +379 -0
- package/docs/reports/unified-9.0.34/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.34/raw/node22-mira.log +216 -0
- package/docs/reports/unified-9.0.34/raw/node22-protocol-to-ems.log +8 -0
- package/docs/reports/unified-9.0.34/raw/node22-tests-final.log +17850 -0
- package/docs/reports/unified-9.0.34/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.34/raw/node24-mira.log +40 -0
- package/docs/reports/unified-9.0.34/raw/node24-protocol-to-ems.log +6 -0
- package/docs/reports/unified-9.0.34/raw/node24-tests-final.log +2973 -0
- package/docs/reports/unified-9.0.34/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.34/raw/protocol-to-ems.cjs +364 -0
- package/docs/reports/unified-9.0.34/raw/release-metadata.log +13 -0
- package/docs/reports/unified-9.0.34/raw/sbom.log +8 -0
- package/docs/reports/unified-9.0.34/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.34/raw/ui-runtime.log +8 -0
- package/docs/start/START_HIER_9.0.32.md +16 -0
- package/docs/start/START_HIER_9.0.33.md +32 -0
- package/docs/start/START_HIER_9.0.34.md +25 -0
- package/io-package.json +16 -16
- package/modules/devices/admin/alias-contract-v1.json +22 -0
- package/modules/devices/admin/ems-assignment.js +6 -1
- package/modules/devices/admin/host-bridge.js +2 -0
- package/modules/devices/admin/index.html +16 -0
- package/modules/devices/admin/index_m.js +168 -9
- package/modules/devices/admin/templates.json +976 -0
- package/modules/devices/checks/emsAssignment.check.js +52 -2
- package/modules/devices/index.js +5 -1
- package/modules/devices/lib/alias-contract-v1.json +22 -0
- package/modules/devices/lib/deviceRuntime.js +17 -7
- package/modules/devices/lib/drivers/modbus.js +1 -1
- package/modules/devices/lib/drivers/modbusRtuBus.js +7 -1
- package/modules/devices/lib/drivers/ovumMira.js +148 -0
- package/modules/devices/lib/ovumMiraAliases.js +61 -0
- package/modules/devices/lib/ovumMiraConnection.js +32 -0
- package/modules/devices/lib/templates.json +976 -0
- package/modules/devices/test/aliasContractV1.test.js +4 -4
- package/modules/devices/test/deviceAliasSemantics.test.js +2 -2
- package/modules/devices/test/fixtures/approved-additive-templates.json +3 -1
- package/modules/devices/test/ovumMiraPairing.test.js +76 -0
- package/modules/devices/test/ovumMiraTemplates.test.js +110 -0
- package/modules/devices/test/ovumMiraTransport.test.js +162 -0
- package/package.json +10 -5
- package/release-manifests/unified/build-environment.cdx.json +7 -7
- package/release-manifests/unified/files.json +302 -180
- package/release-manifests/unified/frontend.cdx.json +7 -7
- package/release-manifests/unified/installer.cdx.json +7 -7
- package/release-manifests/unified/obsolete-admin-assets.json +281 -28
- package/release-manifests/unified/runtime.cdx.json +28 -28
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-manifest.cjs +2 -2
- package/ui/ems/consumers/ovum-mira.js +164 -0
- package/ui/ems/consumers/sg-ready.js +26 -6
- package/ui/ems/datapoints.js +12 -4
- package/ui/ems/modules/charging-management.js +58 -67
- package/ui/ems/modules/core-limits.js +59 -36
- package/ui/ems/modules/para14a.js +3 -2
- package/ui/ems/modules/prime-mover-control.js +141 -29
- package/ui/ems/modules/stage-a-diagnostics.js +4 -2
- package/ui/ems/modules/storage-control.js +31 -38
- package/ui/ems/modules/storage-mapping.js +14 -13
- package/ui/ems/modules/tarif-vis.js +38 -56
- package/ui/ems/modules/thermal-control.js +91 -10
- package/ui/ems/services/measurement-freshness.js +58 -21
- package/ui/ems/services/safety-envelope.js +13 -6
- package/ui/io-package.json +13 -1
- package/ui/lib/datapoint-picker.js +27 -20
- package/ui/lib/installer-lifecycle.js +11 -2
- package/ui/lib/tariff-price.js +7 -1
- package/ui/lib/ts-mirrors/ems/core-limits/core-runtime.js +5 -1
- package/ui/main.js +313 -188
- package/ui/package.json +4 -3
- package/ui/www/app.js +238 -100
- package/ui/www/ems-apps.js +30 -10
- package/ui/www/index.html +1 -0
- package/ui/www/licenses/smarthome-markdown-components.json +156 -156
- package/ui/www/live-display.js +38 -4
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/power-measurements.js +28 -3
- package/adminWww/assets/AddLink-0L0E-LsA.js +0 -1
- package/adminWww/assets/ColorLens-DA51K29x.js +0 -1
- package/adminWww/assets/ConfigManager-C2naRwDl.js +0 -1
- package/adminWww/assets/Enums-B9ucB-qg.js +0 -92
- package/adminWww/assets/Fields-DN41WFbp.js +0 -1
- package/adminWww/assets/FileCopy-B16lEuur.js +0 -1
- package/adminWww/assets/Files-C3PbbeNR.js +0 -1
- package/adminWww/assets/Instances-PKvEjDNQ.js +0 -4
- package/adminWww/assets/Intro-BnYMjDZr.js +0 -2
- package/adminWww/assets/Lens-9lkeoWGk.js +0 -1
- package/adminWww/assets/LinearScale-Be5h2beh.js +0 -1
- package/adminWww/assets/North-C2whbHM-.js +0 -1
- package/adminWww/assets/Overview-CWLYuqZx.js +0 -3
- package/adminWww/assets/PersonOff-DqBq0Fho.js +0 -1
- package/adminWww/assets/PlaylistAdd-O8k92YBd.js +0 -1
- package/adminWww/assets/State-Ca9_Ke_c.js +0 -1
- package/adminWww/assets/UsedResources-20bsoxmj.js +0 -2
- package/adminWww/assets/Users-yZyZX-18.js +0 -1
- package/adminWww/assets/date-fns-C1dqkno9.js +0 -1
- package/adminWww/assets/icons-material-C3PNaipj.js +0 -1
- package/adminWww/assets/isSameWeek-Crh37s7U.js +0 -1
- package/adminWww/assets/isWithinInterval-Bo1WiDfq.js +0 -1
- package/adminWww/assets/locale-hLcz_Xh2.js +0 -1
- package/adminWww/assets/sentry-DwQQLI7N.js +0 -1
- package/adminWww/assets/startOfWeek-DJph8SIW.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{Aa as n,An as r,Ao as i,Ar as a,Bo as o,Ci as s,Co as c,Es as l,Fi as u,Ha as d,Ho as f,Hs as p,Io as ee,Is as te,Jo as m,Ka as h,Ko as g,Lr as ne,Ls as re,Mo as ie,Oo as _,Pi as ae,Po as oe,Ps as se,Qa as ce,Qs as le,Ro as ue,Rr as de,Rs as fe,Si as pe,To as v,Tr as y,Ts as b,Uo as x,Ur as me,Us as S,Vo as C,Vs as w,Wa as he,Wo as T,Wr as E,Xo as ge,Za as _e,Zn as ve,ba as ye,co as be,ea as xe,er as D,fo as Se,gi as Ce,go as O,ha as we,hs as Te,is as Ee,jo as De,kr as Oe,lo as k,ls as A,mo as j,ms as ke,oi as Ae,os as M,pc as je,po as N,ps as P,qa as F,qo as Me,qs as I,r as Ne,sa as Pe,sc as Fe,so as Ie,sr as Le,tc as L,tn as Re,ua as ze,wo as Be,xa as Ve,xo as He,yo as R,zr as Ue,zs as We}from"./loadShare-eager-dmdYQhAl.js";import{i as Ge,t as z}from"./AdminUtils-Dc1eHsx5.js";import{Q as Ke,n as qe,o as Je,tt as Ye}from"./bootstrap-BQ4OzwbT.js";import{t as Xe}from"./ViewList-DVj9ENkU.js";import{t as Ze}from"./AdapterUpdateDialog-UhaQHyF1.js";import{t as Qe}from"./CustomModal-Do2qVZr7.js";import{t as $e}from"./Cached-DXXpEqUN.js";import{i as et}from"./Usb-C8HitPqx.js";import{t as tt}from"./Computer-BBU3Cm9-.js";import{t as nt}from"./UsedResources-20bsoxmj.js";var rt=e(t(((e,t,n)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>=t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(t[e].length>4?NaN:parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t=0;for(;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=``;this.zoneId&&(t=`%${this.zoneId}`);let n=this.toNormalizedString(),r=n.slice(0,n.length-t.length),i=0,a=-1,o=-1,s;for(;s=e.exec(r);){let e=(s[0].match(/0/g)||[]).length;e>o&&(o=e,i=s.index,a=s[0].length)}return a<0?r+t:`${r.substring(0,i)}::${r.substring(i+a)}${t}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t&&t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch(e){throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`,{cause:e})}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(n)}))(),1);l();var it=class extends L{constructor(e){super(e),b(this,`updating`,!1),b(this,`textareaRef`,I.createRef()),b(this,`link`,`${window.location.protocol}//${window.location.host}/`),b(this,`interval`,null),b(this,`startTimeout`,null),this.state={response:null,error:null,starting:!0}}setUpdating(e){this.updating!==e&&(this.updating=e,this.props.onUpdating(e))}async findIpAddress(){var e,t;if((await this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`)).common.host===this.props.hostId)return;let n=await this.props.socket.getObject(this.props.hostId),r=await this.props.socket.readBaseSettings(this.props.hostId),i=(r==null||(e=r.config)==null||(e=e.objects)==null?void 0:e.host)||``;if(i&&i!==`localhost`&&(i=rt.default.parse(Array.isArray(i)?i[0]:i).toString(),n!=null&&(t=n.native)!=null&&(t=t.hardware)!=null&&t.networkInterfaces))for(let e of Object.values(n.native.hardware.networkInterfaces))e.find(e=>{try{let t=rt.default.parseCIDR(e.cidr).toString();e.internal===!1&&i.match(t)&&(this.link=`${window.location.protocol}//${e.family===`IPv6`?`[${e.address}]`:e.address}:${window.location.port}`)}catch{}return!1})}async componentDidMount(){try{await this.findIpAddress()}catch(e){console.error(`Cannot find ip address: ${e.message}`)}try{await this.props.socket.upgradeController(this.props.hostId,this.props.version,parseInt(this.props.adminInstance.split(`.`).pop()||``,10))}catch(e){console.error(`Cannot update controller: ${e.message}`),this.setState({error:y.t(`Not updatable`),starting:!1}),this.setUpdating(!1);return}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),null),this.startTimeout&&=(clearTimeout(this.startTimeout),null)}async checkStatus(){console.log(`Request update status from: ${this.link}`);try{let e=await(await fetch(this.link)).text();console.log(`Received status: ${e}`);let t=JSON.parse(e);t!=null&&t.stderr&&(t.stderr=t.stderr.filter(e=>e.trim())),t&&!t.running&&t.success&&t.stdout?(t.stdout.push(``),t.stdout.push(`---------------------------------------------------`),t.stdout.push(y.t(`%s was successfully updated to %s`,`js-controller`,this.props.version))):t!=null&&t.stdout&&(t.stdout.unshift(``),t.stdout.unshift(`---------------------------------------------------`),t.stdout.unshift(y.t(`updating %s to %s...`,`js-controller`,this.props.version))),this.setState({response:t,error:null},()=>{t&&!t.running?(this.setUpdating(!1),this.interval&&=(clearInterval(this.interval),null)):t!=null&&t.running&&this.setUpdating(!0),this.textareaRef.current&&setTimeout(()=>this.textareaRef.current&&(this.textareaRef.current.scrollTop=this.textareaRef.current.scrollHeight),100)})}catch(e){this.state.starting||this.setState({error:e.toString()},()=>this.setUpdating(!1))}}render(){var e,t,n,r,a;return S(i,{onClose:(e,t)=>{t!==`escapeKeyDown`&&t!==`backdropClick`&&this.props.onClose()},open:!0,maxWidth:`lg`,fullWidth:!0,children:[p(oe,{children:y.t(`Updating %s...`,`js-controller`)}),S(ie,{style:{height:400,padding:`0 20px`,overflow:`hidden`},children:[(!this.state.response||this.state.response.running)&&!this.state.error?p(ge,{}):null,this.state.response||this.state.error?p(`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:(e=this.state.response)!=null&&e.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
|
+
import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{Aa as n,An as r,Ao as i,Ar as a,Bo as o,Ci as s,Co as c,Es as l,Fi as u,Ha as d,Ho as f,Hs as p,Io as ee,Is as te,Jo as m,Ka as h,Ko as g,Lr as ne,Ls as re,Mo as ie,Oo as _,Pi as ae,Po as oe,Ps as se,Qa as ce,Qs as le,Ro as ue,Rr as de,Rs as fe,Si as pe,To as v,Tr as y,Ts as b,Uo as x,Ur as me,Us as S,Vo as C,Vs as w,Wa as he,Wo as T,Wr as E,Xo as ge,Za as _e,Zn as ve,ba as ye,co as be,ea as xe,er as D,fo as Se,gi as Ce,go as O,ha as we,hs as Te,is as Ee,jo as De,kr as Oe,lo as k,ls as A,mo as j,ms as ke,oi as Ae,os as M,pc as je,po as N,ps as P,qa as F,qo as Me,qs as I,r as Ne,sa as Pe,sc as Fe,so as Ie,sr as Le,tc as L,tn as Re,ua as ze,wo as Be,xa as Ve,xo as He,yo as R,zr as Ue,zs as We}from"./loadShare-eager-dmdYQhAl.js";import{i as Ge}from"./Usb-C8HitPqx.js";import{t as Ke}from"./Cached-DXXpEqUN.js";import{t as qe}from"./Computer-BBU3Cm9-.js";import{t as Je}from"./ViewList-DVj9ENkU.js";import{i as Ye,t as z}from"./AdminUtils-Dc1eHsx5.js";import{M as Xe,a as Ze,j as Qe,n as $e}from"./bootstrap-CC0Qr-kr.js";import{t as et}from"./AdapterUpdateDialog-5L75o18m.js";import{t as tt}from"./CustomModal-Do2qVZr7.js";import{t as nt}from"./UsedResources-lUYJqy4F.js";var rt=e(t(((e,t,n)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>=t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(t[e].length>4?NaN:parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv4 CIDR format`,{cause:e})}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,"toString",{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t=0;for(;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}return(t=e.match(r.twoOctet))?(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})():(t=e.match(r.threeOctet))?(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})():null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=``;this.zoneId&&(t=`%${this.zoneId}`);let n=this.toNormalizedString(),r=n.slice(0,n.length-t.length),i=0,a=-1,o=-1,s;for(;s=e.exec(r);){let e=(s[0].match(/0/g)||[]).length;e>o&&(o=e,i=s.index,a=s[0].length)}return a<0?r+t:`${r.substring(0,i)}::${r.substring(i+a)}${t}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format`,{cause:e})}},p.IPv6.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t&&t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),Number.isNaN(e)||e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch(e){throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`,{cause:e})}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(n)}))(),1);l();var it=class extends L{constructor(e){super(e),b(this,`updating`,!1),b(this,`textareaRef`,I.createRef()),b(this,`link`,`${window.location.protocol}//${window.location.host}/`),b(this,`interval`,null),b(this,`startTimeout`,null),this.state={response:null,error:null,starting:!0}}setUpdating(e){this.updating!==e&&(this.updating=e,this.props.onUpdating(e))}async findIpAddress(){var e,t;if((await this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`)).common.host===this.props.hostId)return;let n=await this.props.socket.getObject(this.props.hostId),r=await this.props.socket.readBaseSettings(this.props.hostId),i=(r==null||(e=r.config)==null||(e=e.objects)==null?void 0:e.host)||``;if(i&&i!==`localhost`&&(i=rt.default.parse(Array.isArray(i)?i[0]:i).toString(),n!=null&&(t=n.native)!=null&&(t=t.hardware)!=null&&t.networkInterfaces))for(let e of Object.values(n.native.hardware.networkInterfaces))e.find(e=>{try{let t=rt.default.parseCIDR(e.cidr).toString();e.internal===!1&&i.match(t)&&(this.link=`${window.location.protocol}//${e.family===`IPv6`?`[${e.address}]`:e.address}:${window.location.port}`)}catch{}return!1})}async componentDidMount(){try{await this.findIpAddress()}catch(e){console.error(`Cannot find ip address: ${e.message}`)}try{await this.props.socket.upgradeController(this.props.hostId,this.props.version,parseInt(this.props.adminInstance.split(`.`).pop()||``,10))}catch(e){console.error(`Cannot update controller: ${e.message}`),this.setState({error:y.t(`Not updatable`),starting:!1}),this.setUpdating(!1);return}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),null),this.startTimeout&&=(clearTimeout(this.startTimeout),null)}async checkStatus(){console.log(`Request update status from: ${this.link}`);try{let e=await(await fetch(this.link)).text();console.log(`Received status: ${e}`);let t=JSON.parse(e);t!=null&&t.stderr&&(t.stderr=t.stderr.filter(e=>e.trim())),t&&!t.running&&t.success&&t.stdout?(t.stdout.push(``),t.stdout.push(`---------------------------------------------------`),t.stdout.push(y.t(`%s was successfully updated to %s`,`js-controller`,this.props.version))):t!=null&&t.stdout&&(t.stdout.unshift(``),t.stdout.unshift(`---------------------------------------------------`),t.stdout.unshift(y.t(`updating %s to %s...`,`js-controller`,this.props.version))),this.setState({response:t,error:null},()=>{t&&!t.running?(this.setUpdating(!1),this.interval&&=(clearInterval(this.interval),null)):t!=null&&t.running&&this.setUpdating(!0),this.textareaRef.current&&setTimeout(()=>this.textareaRef.current&&(this.textareaRef.current.scrollTop=this.textareaRef.current.scrollHeight),100)})}catch(e){this.state.starting||this.setState({error:e.toString()},()=>this.setUpdating(!1))}}render(){var e,t,n,r,a;return S(i,{onClose:(e,t)=>{t!==`escapeKeyDown`&&t!==`backdropClick`&&this.props.onClose()},open:!0,maxWidth:`lg`,fullWidth:!0,children:[p(oe,{children:y.t(`Updating %s...`,`js-controller`)}),S(ie,{style:{height:400,padding:`0 20px`,overflow:`hidden`},children:[(!this.state.response||this.state.response.running)&&!this.state.error?p(ge,{}):null,this.state.response||this.state.error?p(`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:(e=this.state.response)!=null&&e.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(`
|
|
2
2
|
`):this.state.response.stdout.join(`
|
|
3
3
|
`),readOnly:!0}):null]}),p(De,{children:p(R,{id:`js-controller-updater-close`,variant:`contained`,disabled:this.state.starting||!this.state.error&&((t=this.state.response)==null?void 0:t.running),onClick:()=>{var e;(e=this.state.response)!=null&&e.success&&window.location.reload(),this.props.onClose()},color:(n=this.state.response)!=null&&n.success?`primary`:`grey`,startIcon:(r=this.state.response)!=null&&r.success?p(ze,{}):p(h,{}),children:(a=this.state.response)!=null&&a.success?y.t(`Reload`):y.t(`Close`)})})]})}},B={root:{width:`100%`,height:`auto`,display:`flex`,flexDirection:`column`,overflow:`auto`,padding:10},paper:{maxWidth:1e3},overflowHidden:{display:`flex`,overflow:`hidden`},h1:{fontWeight:500,fontSize:35,margin:`10px 0`},h2:e=>({p:`10px 7px`,fontSize:25,fontWeight:300,borderRadius:`3px`,background:`#4dabf5`,color:e.palette.mode===`dark`?`black`:`white`}),h22:e=>({p:0,m:0,fontSize:25,fontWeight:300,borderRadius:`3px`,background:`#4dabf5`,color:e.palette.mode===`dark`?`black`:`white`}),standardText:{fontSize:15,margin:`10px 0`,"& > a":{textDecoration:`none`,color:`#1e88e5`}},standardTextSmall:{fontSize:12,color:`black`},standardTextSmall2:{fontSize:12},pre:{whiteSpace:`pre-wrap`,background:`#e4e3e3`,padding:10,borderRadius:3,position:`relative`},copyButton:{color:`black`,position:`absolute`,right:10,top:4},comment:{color:`#00000078`},accordionSummary:{background:`#4dabf5`,borderRadius:`3px`,"& .MuiAccordionSummary-content":{m:0}},accordionDetails:{display:`flex`,flexDirection:`column`},code:e=>({backgroundColor:e.palette.mode===`dark`?`#123456`:`#93bbe7`,p:`0 3px 0 3px`}),copyButtonSmall:{width:31,height:16}};function at(e,t,n){let r=e.split(`
|
|
4
4
|
`),i=[],a=!1;for(let e=0;e<r.length;e++){let o=r[e].toLowerCase();o.startsWith(`##`)&&(a=o.includes(t.toLowerCase())&&(!n||!o.includes(n.toLowerCase()))),a||i.push(r[e])}return i.join(`
|
|
5
|
-
`)}var ot=({socket:e,hostId:t,version:n,onClose:a})=>{let[o,s]=je(null),[c,l]=je(``),[u,d]=je(``),f=e=>{E.copyToClipboard(e),window.alert(y.t(`Copied`))};return Fe(()=>{t&&typeof t==`string`||console.error(`Invalid hostId: "${t}" with type ${typeof t}`),c&&u||!t||typeof t!=`string`||e.getHostInfoShort(t).then(e=>{e.location&&e.location!==c&&l(e.location),e.os&&e.os!==u&&d(e.os),fetch(`https://raw.githubusercontent.com/ioBroker/ioBroker.docs/master/admin/${y.getLanguage()}/controller-upgrade.md`).then(e=>e.text()).then(t=>{let r=e.os||u,i=(e.location||c).replace(/\\/g,`/`);t=r===`win32`?at(t,`linux`,`windows`):at(t,`windows`,`linux`),t=t.replace(/cd \/opt\/iobroker/g,`cd ${i}`),t=t.replace(/cd C:\\iobroker/g,`cd ${i}`),t=t.replace(/x\.y\.z/g,n);let a=t.split(`<!-- copy`),o=[];a.forEach(e=>{if(e.includes(`-->`)){let t=e.split(`-->`),n=t[0],r=t[1],i=!1;n.startsWith(` small`)&&(n=n.replace(/^ {2}small /,``),i=!0),n=n.replace(/^\n\r/,``).replace(/^\n/,``),i?o.push(p(g,{onClick:()=>f(n),children:p(D,{})},`b${o.length}`)):o.push(p(R,{variant:`contained`,onClick:()=>f(n),startIcon:p(D,{}),children:y.t(`Copy to clipboard`)},`b${o.length}`)),o.push(r)}else o.push(e)}),s(o)})}).catch(e=>window.alert(`Cannot get information about host "${t}": ${e}`))},[c,u,e,n,t]),S(i,{onClose:()=>a(),open:!0,sx:{"& .MuiDialog-paper":B.paper},children:[p(oe,{children:y.t(`js-controller upgrade instructions`)}),p(ie,{style:o?null:B.overflowHidden,dividers:!0,children:o?p(w,{children:o==null?void 0:o.map((e,t)=>typeof e==`object`?e:p(
|
|
5
|
+
`)}var ot=({socket:e,hostId:t,version:n,onClose:a})=>{let[o,s]=je(null),[c,l]=je(``),[u,d]=je(``),f=e=>{E.copyToClipboard(e),window.alert(y.t(`Copied`))};return Fe(()=>{t&&typeof t==`string`||console.error(`Invalid hostId: "${t}" with type ${typeof t}`),c&&u||!t||typeof t!=`string`||e.getHostInfoShort(t).then(e=>{e.location&&e.location!==c&&l(e.location),e.os&&e.os!==u&&d(e.os),fetch(`https://raw.githubusercontent.com/ioBroker/ioBroker.docs/master/admin/${y.getLanguage()}/controller-upgrade.md`).then(e=>e.text()).then(t=>{let r=e.os||u,i=(e.location||c).replace(/\\/g,`/`);t=r===`win32`?at(t,`linux`,`windows`):at(t,`windows`,`linux`),t=t.replace(/cd \/opt\/iobroker/g,`cd ${i}`),t=t.replace(/cd C:\\iobroker/g,`cd ${i}`),t=t.replace(/x\.y\.z/g,n);let a=t.split(`<!-- copy`),o=[];a.forEach(e=>{if(e.includes(`-->`)){let t=e.split(`-->`),n=t[0],r=t[1],i=!1;n.startsWith(` small`)&&(n=n.replace(/^ {2}small /,``),i=!0),n=n.replace(/^\n\r/,``).replace(/^\n/,``),i?o.push(p(g,{onClick:()=>f(n),children:p(D,{})},`b${o.length}`)):o.push(p(R,{variant:`contained`,onClick:()=>f(n),startIcon:p(D,{}),children:y.t(`Copy to clipboard`)},`b${o.length}`)),o.push(r)}else o.push(e)}),s(o)})}).catch(e=>window.alert(`Cannot get information about host "${t}": ${e}`))},[c,u,e,n,t]),S(i,{onClose:()=>a(),open:!0,sx:{"& .MuiDialog-paper":B.paper},children:[p(oe,{children:y.t(`js-controller upgrade instructions`)}),p(ie,{style:o?null:B.overflowHidden,dividers:!0,children:o?p(w,{children:o==null?void 0:o.map((e,t)=>typeof e==`object`?e:p(Ze,{components:{em:({...e})=>p(g,{style:B.copyButtonSmall,onClick:()=>f(e.children[0].toString()),children:p(D,{})}),a:({children:e,...t})=>p(`a`,{style:{color:`inherit`},...t,children:e}),code:({children:e,ref:t,...n})=>p(O,{component:`code`,sx:B.code,ref:t,...n,children:e})},children:e},`t_${t}`))}):S(He,{style:B.root,children:[p(O,{component:`div`,sx:B.standardText,children:y.t(`Due to the different hardware and platforms under which ioBroker runs, the js-controller has to be updated manually. Further details can be found in the appropriate section.`)}),p(O,{component:`h2`,sx:B.h2,children:y.t(`General information for all platforms`)}),S(O,{component:`div`,sx:B.standardText,children:[y.t(`For an update from js-controller 1.x to 2.x please always read the information at`),` `,p(`a`,{href:`https://forum.iobroker.net/topic/26759/js-controller-2-jetzt-f%C3%BCr-alle-im-stable`,target:`_blank`,rel:`noreferrer`,children:`forum`}),`.`]}),p(O,{component:`div`,sx:B.standardText,children:y.t(`Otherwise please update the slaves first with an update of master-slave systems and the master last!`)}),u!==`win32`&&S(w,{children:[p(O,{component:`h2`,sx:B.h2,children:y.t(`Linux/macOS (new installer)`)}),p(O,{component:`div`,sx:B.standardText,children:y.t(`This is the recommended option`)}),p(O,{component:`div`,sx:B.standardText,children:y.t(`Please execute the following commands in an SSH shell (console):`)}),S(`pre`,{style:B.pre,children:[p(g,{size:`small`,onClick:()=>{window.alert(y.t(`Copied`)),f(`iob backup
|
|
6
6
|
iob stop
|
|
7
7
|
iob update
|
|
8
8
|
iob upgrade self
|
|
@@ -20,7 +20,7 @@ iob status
|
|
|
20
20
|
iob update
|
|
21
21
|
iob upgrade self
|
|
22
22
|
`)},style:B.copyButton,children:p(D,{})}),S(`div`,{style:B.standardTextSmall,children:[`cd`,(c||`C:\\iobroker`).replace(/\//g,`\\`),` `,c?null:y.t(`(or where ioBroker was installed)`)]}),p(`div`,{style:B.standardTextSmall,children:`iob backup`}),S(`div`,{style:B.standardTextSmall,children:[`iob stop`,y.t(`to stop the ioBroker service`)]}),S(`div`,{style:B.standardTextSmall,children:[`iob status`,y.t(`to check if ioBroker has finished`)]}),p(`div`,{style:B.standardTextSmall,children:`iob update`}),p(`div`,{style:B.standardTextSmall,children:`iob upgrade self`})]}),p(`div`,{style:B.standardTextSmall2,children:y.t(`Start ioBroker service or reboot computer, then ioBroker should restart and you can be sure that all the old processes were finished.`)})]}),S(F,{style:{paddingTop:14},children:[p(ee,{sx:B.accordionSummary,expandIcon:p(r,{}),children:p(O,{component:`h2`,sx:B.h22,children:y.t(`Emergency Linux / macOS / Windows`)})}),S(_,{style:B.accordionDetails,children:[p(O,{component:`div`,sx:B.standardText,children:y.t(`(manual reinstallation, if somehow nothing works after the update)`)}),p(O,{component:`div`,sx:B.standardText,children:y.t(`On Windows first please call in the start menu under "ioBroker" the command line of the relevant ioBroker instance. The correct directory is then set automatically. On Linux or macOS please go to the ioBroker directory.`)}),p(O,{component:`div`,sx:B.standardText,children:y.t(`Run npm install iobroker.js-controller there. A specific version can be installed using npm install iobroker.js-controller@x.y.z (replace x.y.z with the desired version).`)}),p(O,{component:`div`,sx:B.standardText,children:y.t(`If there are problems with access rights when running on Linux the command has to be changed slightly:`)}),p(`div`,{style:B.standardTextSmall2,children:y.t(`For systems created with the new Linux installer:`)}),S(`pre`,{style:B.pre,children:[p(g,{size:`small`,onClick:()=>{window.alert(y.t(`Copied`)),f(`cd ${u===`win32`?(c||`C:\\iobroker`).replace(/\//g,`\\`):c||`/opt/iobroker`}
|
|
23
|
-
sudo -u iobroker -H npm install iobroker.js-controller`)},style:B.copyButton,children:p(D,{})}),S(`div`,{style:B.standardTextSmall,children:[`cd`,u===`win32`?(c||`C:\\iobroker`).replace(/\//g,`\\`):c||`/opt/iobroker`]}),p(`div`,{style:B.standardTextSmall,children:`sudo -u iobroker -H npm install iobroker.js-controller`})]}),p(`div`,{style:B.standardTextSmall2,children:y.t(`For systems installed manually under Linux, prefix sudo or run as root.`)}),p(O,{component:`div`,sx:B.standardText,children:y.t(`This way is only necessary in very few cases and please consult the forum beforehand!`)})]})]})]})}),S(De,{children:[p(R,{id:`js-controller-dialog-changelog`,variant:`contained`,onClick:()=>{window.open(Ge,`_blank`)},color:`grey`,startIcon:p(Ve,{}),children:y.t(`Show whole changelog`)}),p(R,{id:`js-controller-dialog-ok`,variant:`contained`,onClick:()=>a(),color:`primary`,startIcon:p(h,{}),children:y.t(`Ok`)})]})]})};l();var V={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:`calc(100% - 16px)`,marginBottom:16,marginRight:8,marginLeft:8},RAM:{width:400,marginRight:8}},st=class extends L{constructor(e){super(e),b(this,`focusRef`,void 0);let t=this.props.settings||{};this.state={memoryLimitMB:t.memoryLimitMB||0,hostname:t.hostname||``,statisticsInterval:t.statisticsInterval||15e3,checkDiskInterval:t.checkDiskInterval||3e5,instanceStartInterval:t.instanceStartInterval||2e3,compact:t.compact||!1,allowShellCommands:t.allowShellCommands||!1,memLimitWarn:t.memLimitWarn||100,memLimitError:t.memLimitError||50,noChmod:t.noChmod||!1},this.focusRef=le()}componentDidMount(){var e;(e=this.focusRef.current)==null||e.focus()}onChange(){this.props.onChange({memoryLimitMB:this.state.memoryLimitMB,hostname:this.state.hostname,statisticsInterval:this.state.statisticsInterval,checkDiskInterval:this.state.checkDiskInterval,noChmod:this.state.noChmod,instanceStartInterval:this.state.instanceStartInterval,compact:this.state.compact,allowShellCommands:this.state.allowShellCommands,memLimitWarn:this.state.memLimitWarn,memLimitError:this.state.memLimitError})}render(){return p(A,{style:V.paper,children:p(T,{style:V.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Host name`),style:V.controlItem,value:this.state.hostname||this.props.currentHost.replace(`system.host.`,``),onChange:e=>this.setState({hostname:e.target.value},()=>this.onChange()),helperText:this.props.t(`You can change the host name, but be aware, that all instances must be assigned anew`)})}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Check disk space interval`),style:V.controlItem,value:this.state.checkDiskInterval,type:`number`,slotProps:{htmlInput:{min:1e3}},onChange:e=>this.setState({checkDiskInterval:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`How oft the disk will be checked. Do not set it to low, because it can affect system performance. Value is in ms`)})}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Instance statistics update interval`),style:V.controlItem,value:this.state.statisticsInterval,type:`number`,slotProps:{htmlInput:{min:5e3}},onChange:e=>this.setState({statisticsInterval:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`How oft the instance statistics will be updated. Used RAM, CPU and so on. Value is in ms`)})}),S(T,{style:V.controlItem,children:[p(C,{control:p(v,{checked:this.state.compact,onChange:e=>this.setState({compact:e.target.checked},()=>this.onChange())}),label:this.props.t(`Compact mode`)}),p(`div`,{children:this.props.t(`When enabled adapter instances can run in one or few processes to save RAM usage.`)})]}),S(T,{style:V.controlItem,children:[p(C,{control:p(v,{checked:this.state.allowShellCommands,onChange:e=>this.setState({allowShellCommands:e.target.checked},()=>this.onChange())}),label:this.props.t(`Allow shell's commands`)}),p(`div`,{children:this.props.t(`Allow execution of sendToHost("shell", "cli command")`)})]}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Limit RAM size for controller`),style:V.controlItem,value:this.state.memoryLimitMB,type:`number`,onChange:e=>this.setState({memoryLimitMB:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`MB`)})}),p(T,{children:S(T,{container:!0,direction:`row`,style:V.controlItem,children:[p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Show warning im log if RAM less than`),style:V.RAM,value:this.state.memLimitWarn,type:`number`,onChange:e=>this.setState({memLimitWarn:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`MB`)})}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Show error in log if RAM less than`),style:V.RAM,value:this.state.memLimitError,type:`number`,onChange:e=>this.setState({memLimitError:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`MB`)})})]})})]})})})}};l();var H={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:`calc(100% - 16px)`,marginBottom:16,marginRight:8,marginLeft:8},RAM:{width:400,marginRight:8}},ct=class extends L{constructor(e){super(e),b(this,`focusRef`,void 0);let t=this.props.settings||{};this.state={enabled:t.enabled||!1,secure:t.secure||!0,password:``},t.password&&this.props.socket.decrypt(t.password).then(e=>this.setState({password:e})),this.focusRef=le()}componentDidMount(){var e;(e=this.focusRef.current)==null||e.focus()}onChange(){let e={enabled:this.state.enabled,secure:this.state.secure};this.state.password?this.props.socket.encrypt(this.state.password).then(t=>{e.password=t,this.props.onChange(e)}):this.props.onChange(e)}render(){return p(A,{style:H.paper,children:p(`form`,{style:H.form,noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),children:p(T,{style:H.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[S(T,{style:H.controlItem,children:[p(C,{control:p(v,{checked:this.state.enabled,onChange:e=>this.setState({enabled:e.target.checked},()=>this.onChange())}),label:this.props.t(`Allow slave connections`)}),p(`div`,{children:this.props.t(`When activated this host can be discovered by other iobroker installations in your network to become the master of a multihost system.`)})]}),S(T,{style:H.controlItem,children:[p(C,{control:p(v,{checked:this.state.secure,onChange:e=>this.setState({secure:e.target.checked},()=>this.onChange())}),label:this.props.t(`With password`)}),p(`div`,{children:this.props.t(`Ask password by connection establishment`)})]}),this.state.secure?p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Multi-host password`),style:H.controlItem,value:this.state.password,type:`password`,slotProps:{input:{autoComplete:`new-password`},htmlInput:{autoComplete:`off`}},autoComplete:`off`,onChange:e=>this.setState({password:e.target.value},()=>this.onChange())})}):null]})})})})}};l();var U={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:400,marginBottom:16,marginRight:8,marginLeft:8},dangerZone:{backgroundColor:`rgba(255, 165, 0, 0.05)`,border:`2px solid rgba(255, 165, 0)`,marginBottom:8},dangerZoneHeader:{background:`rgba(255, 165, 0)`,color:`#FFF`,paddingLeft:16,paddingTop:4,paddingBottom:4,marginTop:-1,marginLeft:-1},warning:e=>({p:1,fontSize:14,color:e.palette.mode===`dark`?`#ffa500`:`#b17200`})},lt=9001,ut={autoCompress:{sizeFactor:2,sizeFactorMinimumSize:25e3},throttleFS:{intervalMs:6e4,maxBufferedCommands:1e3}},dt=class e extends L{constructor(t){super(t),b(this,`focusRef`,void 0);let n=this.props.settings||{};n.options||={auth_pass:``,retry_max_delay:2e3,retry_max_count:19,db:0,family:0},n.backup||={disabled:!1,files:24,hours:48,period:120,path:``},n.jsonlOptions||=ut,n.jsonlOptions.autoCompress||=ut.autoCompress,n.jsonlOptions.throttleFS||=ut.throttleFS,this.state={type:n.type||`file`,host:Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`,port:n.port||lt,connectTimeout:n.connectTimeout||2e3,writeFileInterval:n.writeFileInterval||5e3,dataDir:n.dataDir||``,options_auth_pass:n.options.auth_pass||n.pass||``,options_retry_max_delay:n.options.retry_max_delay||2e3,options_retry_max_count:n.options.retry_max_count||19,options_db:n.options.db||0,options_family:n.options.family||0,backup_disabled:n.backup.disabled||!1,backup_files:n.backup.files||24,backup_hours:n.backup.hours||48,backup_period:n.backup.period||120,backup_path:n.backup.path||``,jsonlOptions_autoCompress_sizeFactor:n.jsonlOptions.autoCompress.sizeFactor||2,jsonlOptions_autoCompress_sizeFactorMinimumSize:n.jsonlOptions.autoCompress.sizeFactorMinimumSize||25e3,jsonlOptions_throttleFS_intervalMs:n.jsonlOptions.throttleFS.intervalMs||6e4,jsonlOptions_throttleFS_maxBufferedCommands:n.jsonlOptions.throttleFS.maxBufferedCommands||100,textIP:e.calculateTextIP(Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`),IPs:[`0.0.0.0`,`127.0.0.1`],loading:!0,showWarningDialog:!1,toConfirmType:``,originalDBType:n.type||`file`,noFileCache:n.noFileCache||!1},this.focusRef=le()}static calculateTextIP(e,t){return Array.isArray(e)||e.match(/[^.\d]/)||e.includes(`,`)?!0:t?!t.includes(e):!1}componentDidMount(){this.props.socket.getIpAddresses(this.props.currentHost).then(t=>{let n=[...t];n.includes(`0.0.0.0`)||n.push(`0.0.0.0`),n.includes(`127.0.0.1`)||n.push(`127.0.0.1`);let r=e.calculateTextIP(this.state.host,n);this.setState({IPs:n,loading:!1,textIP:r},()=>this.focusRef.current&&this.focusRef.current.focus())})}componentDidUpdate(t){if(t.settings!==this.props.settings){let t=this.props.settings||{},n=Array.isArray(t.host)?t.host.join(`,`):t.host||`127.0.0.1`;if(n!==this.state.host){let t=e.calculateTextIP(n,this.state.IPs);this.setState({host:n,textIP:t})}}}onChange(){let e={type:this.state.type,host:this.state.host,port:parseInt(this.state.port,10),noFileCache:this.state.noFileCache,connectTimeout:parseInt(this.state.connectTimeout,10),writeFileInterval:parseInt(this.state.writeFileInterval,10),dataDir:this.state.dataDir,options:{auth_pass:this.state.options_auth_pass||null,retry_max_delay:parseInt(this.state.options_retry_max_delay,10),retry_max_count:parseInt(this.state.options_retry_max_count,10),db:parseInt(this.state.options_db,10),family:parseInt(this.state.options_family,10)},backup:{disabled:this.state.backup_disabled,files:parseInt(this.state.backup_files,10),hours:parseInt(this.state.backup_hours,10),period:parseInt(this.state.backup_period,10),path:this.state.backup_path},jsonlOptions:{autoCompress:{sizeFactor:parseInt(this.state.jsonlOptions_autoCompress_sizeFactor,10),sizeFactorMinimumSize:parseInt(this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,10)},throttleFS:{intervalMs:parseInt(this.state.jsonlOptions_throttleFS_intervalMs,10),maxBufferedCommands:parseInt(this.state.jsonlOptions_throttleFS_maxBufferedCommands,10)}}};e.jsonlOptions.autoCompress.sizeFactor<2&&(e.jsonlOptions.autoCompress.sizeFactor=2),e.jsonlOptions.autoCompress.sizeFactorMinimumSize<0&&(e.jsonlOptions.autoCompress.sizeFactorMinimumSize=0),e.jsonlOptions.throttleFS.intervalMs<0&&(e.jsonlOptions.throttleFS.intervalMs=0),e.jsonlOptions.throttleFS.maxBufferedCommands<0&&(e.jsonlOptions.throttleFS.maxBufferedCommands=0),this.props.onChange(e)}renderWarning(){return this.state.showWarningDialog?p(Le,{title:this.props.t(`Please confirm`),text:this.props.t(`switch_db_note`),onClose:e=>{if(e){let e;e=this.state.toConfirmType===`redis`?6379:lt,this.setState({type:this.state.toConfirmType||`file`,showWarningDialog:!1,port:e},()=>this.onChange())}else this.setState({showWarningDialog:!1})}}):null}render(){return S(A,{style:U.paper,children:[this.state.loading?p(ge,{}):null,this.renderWarning(),S(T,{style:{...U.gridSettings,...U.dangerZone},children:[p(`h3`,{style:U.dangerZoneHeader,title:this.props.t(`Invalid settings in these fields could lead to dead host`),children:this.props.t(`Danger zone`)}),p(O,{component:`p`,sx:U.warning,children:this.props.t(`base_settings_hint`)}),S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:p(N,{title:this.props.t(`switch_db_note`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:S(o,{style:U.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Type`)}),S(P,{variant:`standard`,value:this.state.type,onChange:e=>{if(e.target.value!==this.state.originalDBType)this.setState({toConfirmType:e.target.value,showWarningDialog:!0});else{let t;t=e.target.value===`redis`?6379:lt,this.setState({type:e.target.value,port:t},()=>this.onChange())}},children:[p(M,{value:`jsonl`,children:`JSON Lines`}),p(M,{value:`file`,children:this.props.t(`File`)}),p(M,{value:`redis`,children:`Redis`})]})]})})}),p(T,{style:{paddingLeft:8},children:p(C,{control:p(_e,{checked:this.state.textIP,onChange:e=>this.setState({textIP:e.target.checked},()=>this.onChange())}),label:this.props.t(`IP is domain or more than one address`)})}),p(T,{children:this.state.textIP?p(k,{variant:`standard`,style:U.controlItem,value:this.state.host,type:`text`,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),label:this.props.t(`Bind IP address`),helperText:this.props.t(`You can enter more than one address divided by comma`)}):S(o,{style:U.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Bind IP address`)}),p(P,{variant:`standard`,value:this.state.host,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),children:this.state.IPs.map(e=>p(M,{value:e,children:e===`0.0.0.0`?`0.0.0.0 [${this.props.t(`All addresses`)}]`:e},e))})]})}),p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.port,type:`number`,slotProps:{htmlInput:{min:1,max:65535}},onChange:e=>this.setState({port:e.target.value},()=>this.onChange()),label:this.props.t(`Port`)})}),this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.dataDir,helperText:this.props.t(`Optional. Always relative to iobroker.js-controller/`),onChange:e=>this.setState({dataDir:e.target.value},()=>this.onChange()),label:this.props.t(`Directory path`)})}):null,p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_auth_pass,type:`password`,helperText:this.props.t(`Optional`),slotProps:{input:{autoComplete:`new-password`},htmlInput:{autoComplete:`off`}},autoComplete:`off`,onChange:e=>this.setState({options_auth_pass:e.target.value},()=>this.onChange()),label:this.state.type===`redis`?this.props.t(`Redis password`):this.props.t(`Connection password`)})})]})]}),p(T,{style:U.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.connectTimeout,helperText:this.props.t(`ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({connectTimeout:e.target.value},()=>this.onChange()),label:this.props.t(`Connect timeout`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,variant:`standard`,style:U.controlItem,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.noFileCache,onChange:e=>this.setState({noFileCache:e.target.checked},()=>this.onChange())}),label:this.props.t(`No file cache`)})}),p(x,{children:this.props.t(`Always read files from disk and do not cache them in RAM. Used for debugging.`)})]})}):null,this.state.type===`file`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.writeFileInterval,helperText:this.props.t(`How often the data from RAM will be saved on disk in ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({writeFileInterval:e.target.value},()=>this.onChange()),label:this.props.t(`Store file interval`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_retry_max_delay,type:`number`,helperText:this.props.t(`Maximum delay between connection attempts`),onChange:e=>this.setState({options_retry_max_delay:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum delay`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_retry_max_count,type:`number`,helperText:this.props.t(`Maximum number of connection retries`),onChange:e=>this.setState({options_retry_max_count:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum count`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_db,type:`number`,helperText:this.props.t(`Used for sentinels`),onChange:e=>this.setState({options_db:e.target.value},()=>this.onChange()),label:this.props.t(`DB number`)})}):null,this.state.type===`redis`?p(T,{children:S(o,{style:U.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Family number`)}),S(P,{variant:`standard`,value:this.state.options_family,onChange:e=>this.setState({options_family:e.target.value},()=>this.onChange()),children:[p(M,{value:0,children:`auto`}),p(M,{value:4,children:`IPv4`}),p(M,{value:6,children:`IPv6`})]}),p(x,{children:this.props.t(`Used for sentinels`)})]})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactor,type:`number`,slotProps:{htmlInput:{min:2}},helperText:this.props.t(`The JSONL DB is append-only and will contain unnecessary entries after a while.`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactor:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`It will be compressed when the uncompressed size is >= size * sizeFactor AND >= sizeFactorMinimumSize`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactorMinimumSize:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor minimum size`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_throttleFS_intervalMs,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Write to the database file no more than every X milliseconds`),onChange:e=>this.setState({jsonlOptions_throttleFS_intervalMs:e.target.value},()=>this.onChange()),label:this.props.t(`Minimal write interval`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_throttleFS_maxBufferedCommands,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Force writing after this many changes have been buffered. This reduces memory consumption and data loss in case of a crash`),onChange:e=>this.setState({jsonlOptions_throttleFS_maxBufferedCommands:e.target.value},()=>this.onChange()),label:this.props.t(`Maximum changes before write`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,style:U.controlItem,variant:`standard`,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.backup_disabled,onChange:e=>this.setState({backup_disabled:e.target.checked},()=>this.onChange())}),label:this.props.t(`No on-the-fly backup`)})}),p(x,{children:this.props.t(`By every write the backup of object.json will be created.`)})]})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_files,type:`number`,helperText:this.props.t(`Minimal number of backup files, after the deletion will be executed according to the backup time settings`),onChange:e=>this.setState({backup_files:e.target.value},()=>this.onChange()),label:this.props.t(`Number of files`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_hours,type:`number`,helperText:this.props.t(`All backups older than these hours will be deleted, but only if the number of files is greater than of the files number`),onChange:e=>this.setState({backup_hours:e.target.value},()=>this.onChange()),label:this.props.t(`Backup hours`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_period,type:`number`,helperText:this.props.t(`By default the backup is every 2 hours. Time is in minutes. To disable backup set the value to 0`),onChange:e=>this.setState({backup_period:e.target.value},()=>this.onChange()),label:this.props.t(`How often`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_path,helperText:this.props.t(`Absolute path to backup directory or empty to backup in data directory. Leave it empty for default storage place.`),onChange:e=>this.setState({backup_path:e.target.value},()=>this.onChange()),label:this.props.t(`Path`)})}):null]})})]})}};l();var W={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:400,marginBottom:16,marginRight:8,marginLeft:8},dangerZone:{backgroundColor:`rgba(255, 165, 0, 0.05)`,border:`2px solid rgba(255, 165, 0)`,marginBottom:8},dangerZoneHeader:{background:`rgba(255, 165, 0)`,color:`#FFF`,paddingLeft:16,paddingTop:4,paddingBottom:4,marginTop:-1,marginLeft:-1},warning:e=>({p:1,fontSize:14,color:e.palette.mode===`dark`?`#ffa500`:`#b17200`})},ft=9e3,pt={autoCompress:{sizeFactor:2,sizeFactorMinimumSize:25e3},throttleFS:{intervalMs:6e4,maxBufferedCommands:1e3}},mt=class e extends L{constructor(t){super(t),b(this,`focusRef`,void 0);let n=this.props.settings||{};n.options||={auth_pass:``,retry_max_delay:2e3,retry_max_count:19,db:0,family:0},n.backup||={disabled:!1,files:24,hours:48,period:120,path:``},n.jsonlOptions||=pt,n.jsonlOptions.autoCompress||=pt.autoCompress,n.jsonlOptions.throttleFS||=pt.throttleFS,this.state={type:n.type||`file`,host:Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`,port:n.port||ft,connectTimeout:n.connectTimeout||2e3,writeFileInterval:n.writeFileInterval||5e3,dataDir:n.dataDir||``,options_auth_pass:n.options.auth_pass||n.pass||``,options_retry_max_delay:n.options.retry_max_delay||2e3,options_retry_max_count:n.options.retry_max_count||19,options_db:n.options.db||0,options_family:n.options.family||0,backup_disabled:n.backup.disabled||!1,backup_files:n.backup.files||24,backup_hours:n.backup.hours||48,backup_period:n.backup.period||120,backup_path:n.backup.path||``,jsonlOptions_autoCompress_sizeFactor:n.jsonlOptions.autoCompress.sizeFactor||2,jsonlOptions_autoCompress_sizeFactorMinimumSize:n.jsonlOptions.autoCompress.sizeFactorMinimumSize||25e3,jsonlOptions_throttleFS_intervalMs:n.jsonlOptions.throttleFS.intervalMs||6e4,jsonlOptions_throttleFS_maxBufferedCommands:n.jsonlOptions.throttleFS.maxBufferedCommands||100,textIP:e.calculateTextIP(Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`),IPs:[`0.0.0.0`,`127.0.0.1`],loading:!0,showWarningDialog:!1,toConfirmType:``,originalDBType:n.type||`file`,noFileCache:n.noFileCache||!1},this.focusRef=le()}static calculateTextIP(e,t){return Array.isArray(e)||e.match(/[^.\d]/)||e.includes(`,`)?!0:t?!t.includes(e):!1}componentDidMount(){this.props.socket.getIpAddresses(this.props.currentHost).then(t=>{let n=[...t];n.includes(`0.0.0.0`)||n.push(`0.0.0.0`),n.includes(`127.0.0.1`)||n.push(`127.0.0.1`);let r=e.calculateTextIP(Array.isArray(this.state.host)?this.state.host[0]:this.state.host,n);this.setState({IPs:n,loading:!1,textIP:r},()=>this.focusRef.current&&this.focusRef.current.focus())})}componentDidUpdate(t){if(t.settings!==this.props.settings){let t=this.props.settings||{},n=Array.isArray(t.host)?t.host.join(`,`):t.host||`127.0.0.1`;if(n!==this.state.host){let t=e.calculateTextIP(n,this.state.IPs);this.setState({host:n,textIP:t})}}}onChange(){let e={type:this.state.type,host:this.state.host,port:parseInt(this.state.port,10),noFileCache:this.state.noFileCache,connectTimeout:parseInt(this.state.connectTimeout,10),writeFileInterval:parseInt(this.state.writeFileInterval,10),dataDir:this.state.dataDir,options:{auth_pass:this.state.options_auth_pass||null,retry_max_delay:parseInt(this.state.options_retry_max_delay,10),retry_max_count:parseInt(this.state.options_retry_max_count,10),db:parseInt(this.state.options_db,10),family:parseInt(this.state.options_family,10)},backup:{disabled:this.state.backup_disabled,files:parseInt(this.state.backup_files,10),hours:parseInt(this.state.backup_hours,10),period:parseInt(this.state.backup_period,10),path:this.state.backup_path},jsonlOptions:{autoCompress:{sizeFactor:parseInt(this.state.jsonlOptions_autoCompress_sizeFactor,10),sizeFactorMinimumSize:parseInt(this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,10)},throttleFS:{intervalMs:parseInt(this.state.jsonlOptions_throttleFS_intervalMs,10),maxBufferedCommands:parseInt(this.state.jsonlOptions_throttleFS_maxBufferedCommands,10)}}};e.jsonlOptions.autoCompress.sizeFactor<2&&(e.jsonlOptions.autoCompress.sizeFactor=2),e.jsonlOptions.autoCompress.sizeFactorMinimumSize<0&&(e.jsonlOptions.autoCompress.sizeFactorMinimumSize=0),e.jsonlOptions.throttleFS.intervalMs<0&&(e.jsonlOptions.throttleFS.intervalMs=0),e.jsonlOptions.throttleFS.maxBufferedCommands<0&&(e.jsonlOptions.throttleFS.maxBufferedCommands=0),this.props.onChange(e)}renderWarning(){return this.state.showWarningDialog?p(Le,{title:this.props.t(`Please confirm`),text:this.props.t(`switch_db_note`),onClose:e=>{if(e){let e;e=this.state.toConfirmType===`redis`?6379:ft,this.setState({type:this.state.toConfirmType||`file`,showWarningDialog:!1,port:e},()=>this.onChange())}else this.setState({showWarningDialog:!1})}}):null}render(){return S(A,{style:W.paper,children:[this.state.loading?p(ge,{}):null,this.renderWarning(),S(T,{style:{...W.gridSettings,...W.dangerZone},children:[p(`h3`,{style:W.dangerZoneHeader,title:this.props.t(`Invalid settings in these fields could lead to dead host`),children:this.props.t(`Danger zone`)}),p(O,{component:`p`,sx:W.warning,children:this.props.t(`base_settings_hint`)}),S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:p(N,{title:this.props.t(`switch_db_note`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:S(o,{style:W.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Type`)}),S(P,{variant:`standard`,value:this.state.type,onChange:e=>{if(e.target.value!==this.state.originalDBType)this.setState({toConfirmType:e.target.value,showWarningDialog:!0});else{let t;t=e.target.value===`redis`?6379:ft,this.setState({type:e.target.value,port:t},()=>this.onChange())}},children:[p(M,{value:`jsonl`,children:`JSON Lines`}),p(M,{value:`file`,children:this.props.t(`File`)}),p(M,{value:`redis`,children:`Redis`})]})]})})}),p(T,{style:{paddingLeft:8},children:p(C,{control:p(_e,{checked:this.state.textIP,onChange:e=>this.setState({textIP:e.target.checked},()=>this.onChange())}),label:this.props.t(`IP is domain or more than one address`)})}),p(T,{children:this.state.textIP?p(k,{variant:`standard`,style:W.controlItem,value:this.state.host,type:`text`,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),label:this.props.t(`Bind IP address`),helperText:this.props.t(`You can enter more than one address divided by comma`)}):S(o,{style:W.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Bind IP address`)}),p(P,{variant:`standard`,value:this.state.host,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),children:this.state.IPs.map(e=>p(M,{value:e,children:e===`0.0.0.0`?`0.0.0.0 [${this.props.t(`All addresses`)}]`:e},e))})]})}),p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.port,type:`number`,slotProps:{htmlInput:{min:1,max:65535}},onChange:e=>this.setState({port:e.target.value},()=>this.onChange()),label:this.props.t(`Port`)})}),this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.dataDir,helperText:this.props.t(`Optional. Always relative to iobroker.js-controller/`),onChange:e=>this.setState({dataDir:e.target.value},()=>this.onChange()),label:this.props.t(`Directory path`)})}):null,p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_auth_pass,type:`password`,helperText:this.props.t(`Optional`),slotProps:{input:{autoComplete:`new-password`},htmlInput:{autoComplete:`off`}},autoComplete:`off`,onChange:e=>this.setState({options_auth_pass:e.target.value},()=>this.onChange()),label:this.state.type===`redis`?this.props.t(`Redis password`):this.props.t(`Connection password`)})})]})]}),p(T,{style:W.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.connectTimeout,helperText:this.props.t(`ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({connectTimeout:e.target.value},()=>this.onChange()),label:this.props.t(`Connect timeout`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,variant:`standard`,style:W.controlItem,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.noFileCache,onChange:e=>this.setState({noFileCache:e.target.checked},()=>this.onChange())}),label:this.props.t(`No file cache`)})}),p(x,{children:this.props.t(`Always read files from disk and do not cache them in RAM. Used for debugging.`)})]})}):null,this.state.type===`file`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.writeFileInterval,helperText:this.props.t(`How often the data from RAM will be saved on disk in ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({writeFileInterval:e.target.value},()=>this.onChange()),label:this.props.t(`Store file interval`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_retry_max_delay,type:`number`,helperText:this.props.t(`Maximum delay between connection attempts`),onChange:e=>this.setState({options_retry_max_delay:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum delay`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_retry_max_count,type:`number`,helperText:this.props.t(`Maximum number of connection retries`),onChange:e=>this.setState({options_retry_max_count:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum count`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_db,type:`number`,helperText:this.props.t(`Used for sentinels`),onChange:e=>this.setState({options_db:e.target.value},()=>this.onChange()),label:this.props.t(`DB number`)})}):null,this.state.type===`redis`?p(T,{children:S(o,{style:W.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Family number`)}),S(P,{variant:`standard`,value:this.state.options_family,onChange:e=>this.setState({options_family:e.target.value},()=>this.onChange()),children:[p(M,{value:0,children:`auto`}),p(M,{value:4,children:`IPv4`}),p(M,{value:6,children:`IPv6`})]}),p(x,{children:this.props.t(`Used for sentinels`)})]})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactor,type:`number`,slotProps:{htmlInput:{min:2}},helperText:this.props.t(`The JSONL DB is append-only and will contain unnecessary entries after a while.`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactor:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`It will be compressed when the uncompressed size is >= size * sizeFactor AND >= sizeFactorMinimumSize`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactorMinimumSize:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor minimum size`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_throttleFS_intervalMs,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Write to the database file no more than every X milliseconds`),onChange:e=>this.setState({jsonlOptions_throttleFS_intervalMs:e.target.value},()=>this.onChange()),label:this.props.t(`Minimal write interval`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_throttleFS_maxBufferedCommands,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Force writing after this many changes have been buffered. This reduces memory consumption and data loss in case of a crash`),onChange:e=>this.setState({jsonlOptions_throttleFS_maxBufferedCommands:e.target.value},()=>this.onChange()),label:this.props.t(`Maximum changes before write`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,style:W.controlItem,variant:`standard`,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.backup_disabled,onChange:e=>this.setState({backup_disabled:e.target.checked},()=>this.onChange())}),label:this.props.t(`No on-the-fly backup`)})}),p(x,{children:this.props.t(`By every write the backup of object.json will be created.`)})]})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_files,type:`number`,helperText:this.props.t(`Minimal number of backup files, after the deletion will be executed according to the backup time settings`),onChange:e=>this.setState({backup_files:e.target.value},()=>this.onChange()),label:this.props.t(`Number of files`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_hours,type:`number`,helperText:this.props.t(`All backups older than these hours will be deleted, but only if the number of files is greater than of the files number`),onChange:e=>this.setState({backup_hours:e.target.value},()=>this.onChange()),label:this.props.t(`Backup hours`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_period,type:`number`,helperText:this.props.t(`By default the backup is every 2 hours. Time is in minutes. To disable backup set the value to 0`),onChange:e=>this.setState({backup_period:e.target.value},()=>this.onChange()),label:this.props.t(`How often`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_path,helperText:this.props.t(`Absolute path to backup directory or empty to backup in data directory. Leave it empty for default storage place.`),onChange:e=>this.setState({backup_path:e.target.value},()=>this.onChange()),label:this.props.t(`Path`)})}):null]})})]})}},ht=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAbCAYAAADMIInqAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAiPSURBVFhH7Zd7UFTXGcDPvXffy8IusMsbQUEgoyiKD4pBnoKgVkoRX1WpNia2QZ2MzFTS2MykmlqiMzWJqSUxJq1KG0VrE0GxqSgSNVEx4SEaAeXNLrDsLvve2+/cvQusgIHWf2jymzns+b5zLvd+3/nOd75DoGEsWJDLaWvrXsXhcH/S3a0ODArynqfRDLRptfo6qVRcRdOGww8fftbGTv+/YNAB/v4ZsSrVQJHBYAunaVb5BBwOMri58farVI9eR+iejVVPakj8x8dn6cKWlv5zev3YxmMsFiRQqYyv8fleb+XnH2CenexQ2JCqqroLRiMKYHWIzyctLi680ujo4Aa93nDfbDZ72WxIYB/FQUMsbG5+VNHf/6DRrpu8kFeu3EnRaKzhrIxEIq5ZLhdHqdUXMior31+mVJ5fFhKiiBCLqXp2CrJaETKbyTxWnNSQtbWP5w4Pe3d30cWWln9+w4oMdXV/bw8K8tgLZoNkYZpeb5zLDE5yIJ7n7EZI8jtWRl5eLl91dn4azYqDxMZu4ldWVrqxaQMgIAnWK1lhkODgDLHNRuVqNIYMiJQ5Wq0JnCocsFjM/w4PD/ikqurop+zUUYHnY8xmIs9mIxI7O7V4QSDajJc8PEQfZ2fHXyguPhPa2KiLwXNJklLZbDf+wTw4Cr3rkUg8j5dDSYYOOyslRI8Ccs6FJP6J+XZizpz1+bduPf49M8pA0zKZ8N3U1NlvyeWuTYcOFTwlLToTGZmdcu9e9xGj0RZkzxXOEARtE4nIE/v2bdmVl7e+nVUzyGTpHKGQ+BCMXgOOG5FgKQr/tf4xPNxPUFPT8QKWeDzqlsn0rzEjsSMe+fCnCdtcFsG6DfscC0fwUZvPsp9PS3rbSoSHZ/k+eKBshAzPY8cZeDwSGnELHHJ51qyg6tWrUz5/+eW1j9jhESxevDn9xo3Gs3q9lcOqxkQm456fPj1g+fXrRyGbIHTsWAm1e/f7x1tbNauYCU+BJFE/JGRX3P9OByQgH/hpE8+XIEGE2K5kGRDKX3HL+foAWV9/qk0q5f8BDGWH7JhMNqTVWiGEbTsrKx9+uHPne80KRfrNmTPXrC0uLmXWw8HBg8dcqqtbPhgynrbKZLwTQUGibIR0yWFhnoVwqpjsYxCavaalarX6JVZE+/Z9tKS1td/JeD6f6AkOdi9FyPBmYKC0xh4BCDmMnwi6m1pk7hx8PYPQoNzfdSYujQ2MJCowUHQQPuJFCD+uXTc6sAJwUlAfgHO2InQZZ0SoI9JWt7frTzATwJEyGf/V3t6Lg3kFM2/ez1Lv3HlcajbbHe3pKap9553tkTk5aVZPz7RLSqU+kRkAKIq+BnljRXd3mQrLOEKOHy/PraioP6zXWwYjbLwRgPukkEL86SKnrUCI3S87bdTZs1dFNTX1boOhLEheMotl7O3v4cHfq1JdKMB9L6/0k52duhzcFwhI4+bNSTEkSTiVzFwuhywqKr/a32+aimU4blFUlL9XWFiQ9dSpqna12sA4nsslLYsXh0WXl79XjeXhBAdnHmps7PkVK07IAc6A2YSwhDM1ZpOTAxyUlFwSFxS8PVWpHIi3Wul4CO2EgQGLjB1mgPygjYz0nvbllye7CGJRBU1Tz2M9GA4RIGTmPEl/vxEyOrPtAfzb62XvSzuh0GZ6kO1rVKrzMxjhCcLCVkY0NPTU0rT9s/87B1CwqrzXBJk7C6V5ew2jlrOZmUm62tqSr7u6yg7BKmeFhMgVvr4SOCmGIgJyhItAIEjCfZp2GIX3KI3gTjFqGzIeg/8XlrHhQ+swZYqc7Y3Ez0+uFQqdcvXEILg6QiTP8v5c/wY2nlGtWZO/A380Bq8evOQvhYW7Rpzvu3Yd4BQVlTX39hp8WRVyc+Nvg4rxMIcTV2GxEEwEgAt0kHb+bO+PDZfLRb6+fr9pbm6AjYkjwJ7lpFJBTV9f2agREBW1NqK6urUWEiHDhCKA5tynvGf+VH7y9l1GduDvv0KPUBx4wN7k8uRUdsgJcADl4pLcAAcezMMtjl6wYAOTyYODV5506Pn8BGtW1o6ZzEPjIDd3j6tYnNzjeJ7LjTfHxm6cxQ474eGRCrdQx/sX0zxe4lfs0KhgB0CjO+Kos6r8nMG7znBIqNDO2EPQ3uC2V7h8+Q6nFcjKeoW4cuXuL3U6UyirgqsxaZNIRJW47+rK+8SxPaAIIq9evf9qQsJWp6MyJeVFF6Ew7ixCMfdwEwhi6yIjV8iOHn29381NeJudBtuE5lRWfvvuxo17IlgVKir6G7VkyUtbIA9B1ToBbIgmKOkBzozkHI/9xY9ZrRPEwoUb5l+/3nwN7gODHwz3fo1C4XpDpdLcNJstkLH5cZAIfwQJkZ2BjzHBZaWyLJ4VIXSTIXTNz+E+Ab6E2uJqQIDk47t3v33o7i71s9l4+X19RmYco1AIz3R1lWbifkzMhqVffNH0mSO5YSQSnkUs5pbDTbSZz+c/DxXic8Pfj/muLTAemDdGR6974/btlgJ8yxsfliaFQpIABjSxCuyAGSYTfRNWib02Pw1zvUQijtdoLsLet+Pnl36ktVX7C/aTxsWzcABzCqxbt2TP3LlTdkC1ph6e6Z8EanlIfLxrYrEoebjxmL6+8m9cXbmLoAgC/ej/Az/v4SG4A9Vd4nDjMf7+XtvCwhR/5XDwJWskoIdj0Ou0XO7Cap4NTu7Ozv61d0tLx4aamuZZUqlrUm+vjhmXSPidXC5V7evrfnrTprTzW7fmMEfIaCQnbxHX1bWt7OnRZXh6ypLUah0SiwUDRqPxWmCg/Nz8+aGnjxz5rXNdOgyIxpj2dvULcNOLV6sHRJ6erkip7CkJDQ06tX37j+/n5xc1dnRomLnPIgImFVASB3h7L4PwGt8pMB5GLYS+T/zgAPb3e8sPDmB/Jw34voKPREf730DoP5pKhvU07RMQAAAAAElFTkSuQmCC`;l();var G={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`hidden`,padding:8},gridSettings:e=>({height:`calc(100% - ${e.mixins.toolbar.minHeight}px)`,width:`100%`,overflow:`auto`}),controlItem:{width:400,marginBottom:16,marginRight:8,marginLeft:8},delButton:{position:`absolute`,top:2,right:48},addButton:{marginRight:8},buttonIcon:{height:24},headingIcon:{height:24,marginRight:8}},gt=class extends L{constructor(e){super(e),b(this,`focusRef`,void 0);let t=this.props.settings||{};t.transport||={},Object.keys(t.transport).forEach(e=>{var n;if((n=t.transport)!=null&&n[e]){if(t.transport[e].type===`file`){let n=t.transport[e].maxSize,r=typeof n==`string`?n.includes(`k`)?.1:n.includes(`g`)?10:1:1;t.transport[e].maxSize=(parseInt(t.transport[e].maxSize,10)||0)*r,t.transport[e].level=t.transport[e].level||``,t.transport[e].maxFiles=t.transport[e].maxFiles||0}else t.transport[e].type===`syslog`?(t.transport[e].level=t.transport[e].level||``,t.transport[e].host=t.transport[e].host||``,t.transport[e].port=t.transport[e].port||0,t.transport[e].path=t.transport[e].path||``,t.transport[e].facility=t.transport[e].facility||``,t.transport[e].sysLogType=t.transport[e].sysLogType||``,t.transport[e].app_name=t.transport[e].app_name||``,t.transport[e].eol=t.transport[e].eol||``):t.transport[e].type===`http`?(t.transport[e].level=t.transport[e].level||``,t.transport[e].host=t.transport[e].host||``,t.transport[e].port=t.transport[e].port||0,t.transport[e].path=t.transport[e].path||`/`,t.transport[e].auth=t.transport[e].auth||`None`,t.transport[e].ssl=t.transport[e].ssl||!1):t.transport[e].type===`stream`?(t.transport[e].stream=t.transport[e].stream||``,t.transport[e].level=t.transport[e].level||``,t.transport[e].silent=t.transport[e].silent||!1,t.transport[e].eol=t.transport[e].eol||``):t.transport[e].type===`seq`&&(t.transport[e].level=t.transport[e].level||``,t.transport[e].serverUrl=t.transport[e].serverUrl||``,t.transport[e].apiKey=t.transport[e].apiKey||``,t.transport[e].eol=t.transport[e].eol||``)}}),this.state={level:t.level||`info`,maxDays:t.maxDays||7,noStdout:t.noStdout||!0,transport:t.transport||{},expanded:[]},this.focusRef=le()}componentDidMount(){var e;(e=this.focusRef.current)==null||e.focus()}onChange(){let e={level:this.state.level,maxDays:parseInt(this.state.maxDays,10),noStdout:this.state.noStdout,transport:{}},t=e.transport;Object.keys(this.state.transport).forEach(e=>{if(t[e]=JSON.parse(JSON.stringify(this.state.transport[e])),this.state.transport[e].type===`file`){if(t[e].maxSize=parseInt(t[e].maxSize,10)||void 0,t[e].maxSize){var n;t[e].maxSize=`${(n=t[e].maxSize)==null?void 0:n.toString()}m`}t[e].maxFiles=parseInt(t[e].maxFiles,10)||void 0}else this.state.transport[e].type===`syslog`?(t[e].port||delete t[e].port,t[e].path||delete t[e].path,t[e].sysLogType||delete t[e].sysLogType,t[e].app_name||delete t[e].app_name,t[e].eol||delete t[e].eol):this.state.transport[e].type===`http`?(t[e].host=t[e].host||``,t[e].port=parseInt(t[e].port,10)||80,t[e].path=t[e].path||`/`,t[e].auth=t[e].auth||``,t[e].ssl=t[e].ssl||!1):this.state.transport[e].type===`stream`&&(t[e].stream=t[e].stream||``,t[e].level=t[e].level||`info`,t[e].silent=t[e].silent||!1,t[e].eol=t[e].eol||``)}),this.props.onChange(e)}onDelete(e){let t=JSON.parse(JSON.stringify(this.state.transport));delete t[e],this.setState({transport:t},()=>this.onChange())}renderEnabled(e){return p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.transport[e].enabled,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].enabled=t.target.checked,this.setState({transport:n},()=>this.onChange())}}),label:this.props.t(`Enabled`)})})}renderLogLevel(e){return this.state.transport[e].enabled?p(T,{children:S(o,{style:G.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Level`)}),S(P,{variant:`standard`,value:this.state.transport[e].level||`_`,renderValue:()=>this.state.transport[e].level||this.props.t(`default`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].level=t.target.value===`_`?``:t.target.value,this.setState({transport:n},()=>this.onChange())},children:[p(M,{value:`_`,children:this.props.t(`default`)}),p(M,{value:`silly`,children:`silly`}),p(M,{value:`debug`,children:`debug`}),p(M,{value:`info`,children:`info`}),p(M,{value:`warn`,children:`warn`}),p(M,{value:`error`,children:`error`})]}),p(x,{children:this.props.t(`Level of messages that this transport should log (default: level set on parent logger)`)})]})}):null}renderSyslog(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(tt,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].host,helperText:this.props.t(`The host running syslogd, defaults to localhost`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].host=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].port,type:`number`,helperText:this.props.t(`The port on the host that syslog is running on, defaults to syslogd's default port(514/UDP).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].port=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Port`)})}):null,this.state.transport[e].enabled?p(T,{children:S(o,{style:G.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Protocol`)}),S(P,{variant:`standard`,value:this.state.transport[e].protocol,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].protocol=t.target.value,this.setState({transport:n},()=>this.onChange())},children:[p(M,{value:`udp4`,children:`udp4`}),p(M,{value:`tcp4`,children:`tcp4`}),p(M,{value:`unix`,children:`unix`}),p(M,{value:`unix-connect`,children:`unix-connect`})]})]})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].path,helperText:this.props.t(`The path to the syslog dgram socket (i.e. /dev/log or /var/run/syslog for OS X).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].path=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Path`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].facility,helperText:this.props.t(`Syslog facility to use (Default: local0).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].facility=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Facility`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].localhost,helperText:this.props.t(`Host to indicate that log messages are coming from (Default: localhost).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].localhost=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Log name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].sysLogType,helperText:this.props.t(`The type of the syslog protocol to use (Default: BSD).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].sysLogType=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`SysLog Type`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].app_name,helperText:this.props.t(`The name of the application (Default: process.title).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].app_name=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Application name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].eol,helperText:this.props.t(`The end of line character to be added to the end of the message (Default: Message without modifications).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].eol=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`End of line char`)})}):null]})})]},e)}renderFile(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{style:{background:`rgba(128, 128, 128, 0.3)`},expandIcon:p(r,{}),children:[p(we,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].filename,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].filename=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].fileext,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].fileext=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File extension`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].maxSize,type:`number`,helperText:this.props.t(`MB`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].maxSize=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Maximal size of one file`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].maxFiles,type:`number`,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].maxFiles=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Maximal number of files`)})}):null]})})]},e)}renderHttp(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(n,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].host,helperText:this.props.t(`Remote host of the HTTP logging endpoint`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].host=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Host`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].port,type:`number`,helperText:this.props.t(`Remote port of the HTTP logging endpoint`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].port=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Port`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].path,helperText:this.props.t(`Remote URI of the HTTP logging endpoint`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].path=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Path`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].auth,helperText:this.props.t(`An object representing the username and password for HTTP Basic Auth`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].auth=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Auth`)})}):null,this.state.transport[e].enabled?p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.transport[e].ssl,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].ssl=t.target.checked,this.setState({transport:n},()=>this.onChange())}}),label:this.props.t(`SSL`)})}):null]})})]},e)}renderStream(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(ve,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].stream,helperText:this.props.t(`any Node.js stream. If an objectMode stream is provided then the entire info object will be written. Otherwise info[MESSAGE] will be written`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].stream=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.transport[e].silent,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].silent=t.target.checked,this.setState({transport:n},()=>this.onChange())}}),label:this.props.t(`Silent`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].eol,helperText:this.props.t(`Line-ending character to use. (default: os.EOL).)`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].eol=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`EOL`)})}):null]})})]},e)}renderSEQ(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(`img`,{style:G.headingIcon,src:ht,alt:`seq`}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].serverUrl,helperText:this.props.t(`The http(s) URL including port of the seq server. If you use HTTPS a real certificate is needed; self signed certs are ot accepted.`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].serverUrl=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Server URL`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].apiKey,helperText:this.props.t(`The apiKey of the seq system`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].apiKey=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`API key`)})}):null]})})]},e)}findFreeName(e){for(let t=1;;t++)if(!Object.keys(this.state.transport).find(n=>n===e+t))return e+t}add(e){if(e===`file`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,filename:`log/iobroker`,fileext:`.log`,maxSize:0,maxFiles:0},this.setState({transport:n},()=>this.onChange())}else if(e===`syslog`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,host:`127.0.0.1`,port:0,protocol:`udp4`,path:``,facility:``,localhost:`iobroker`,sysLogType:``,app_name:``,eol:``},this.setState({transport:n},()=>this.onChange())}else if(e===`http`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,host:`127.0.0.1`,port:80,path:`/`,auth:`None`,ssl:!1},this.setState({transport:n},()=>this.onChange())}else if(e===`stream`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,stream:`/dev/null`,level:`info`,silent:!1,eol:``},this.setState({transport:n},()=>this.onChange())}else if(e===`seq`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,level:`info`,serverUrl:`http://IP:PORT`,apiKey:``},this.setState({transport:n},()=>this.onChange())}}render(){return S(A,{style:G.paper,children:[p(T,{sx:G.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:S(o,{style:G.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Level`)}),S(P,{variant:`standard`,value:this.state.level,onChange:e=>this.setState({level:e.target.value},()=>this.onChange()),children:[p(M,{value:`silly`,children:`silly`}),p(M,{value:`debug`,children:`debug`}),p(M,{value:`info`,children:`info`}),p(M,{value:`warn`,children:`warn`}),p(M,{value:`error`,children:`error`})]})]})}),p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.maxDays,helperText:this.props.t(`Every day one file`),type:`number`,onChange:e=>this.setState({maxDays:e.target.value},()=>this.onChange()),label:this.props.t(`Maximum number of days`)})}),p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.noStdout,onChange:e=>this.setState({noStdout:e.target.checked},()=>this.onChange())}),label:this.props.t(`No stdout outputs`)})}),Object.keys(this.state.transport).map(e=>{switch(this.state.transport[e].type){case`syslog`:return this.renderSyslog(e);case`file`:return this.renderFile(e);case`http`:return this.renderHttp(e);case`stream`:return this.renderStream(e);case`seq`:return this.renderSEQ(e);default:return null}})]})}),S(Se,{children:[S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`file`),startIcon:p(s,{}),children:[p(we,{style:G.buttonIcon}),this.props.t(`File log`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`syslog`),startIcon:p(s,{}),children:[p(tt,{style:G.buttonIcon}),this.props.t(`Syslog`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`http`),startIcon:p(s,{}),children:[p(n,{style:G.buttonIcon}),this.props.t(`HTTP log`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`stream`),startIcon:p(s,{}),children:[p(ve,{style:G.buttonIcon}),this.props.t(`Stream log`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`seq`),startIcon:p(s,{}),children:[p(`img`,{src:ht,style:G.buttonIcon,alt:`seq`}),this.props.t(`SEQ log`)]})]})]})}},_t={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},title:{width:`100%`,height:32},divWithoutTitle:{width:`100%`,height:`calc(100% - 32px)`,border:`2px solid #00000000`},error:{border:`2px solid #FF0000`}},vt=class extends L{constructor(e){super(e),this.state={settings:JSON.stringify(this.props.settings||{},null,2),error:!1}}onChange(e){let t={settings:e};try{let n=JSON.parse(e);this.state.error&&(t.error=!1),this.setState(t,()=>this.props.onChange(n))}catch{t.error=!0,this.setState(t)}}render(){return S(A,{style:_t.paper,children:[p(`div`,{style:_t.title,children:this.props.t(`For future use`)}),p(`div`,{style:{..._t.divWithoutTitle,...this.state.error?_t.error:void 0},children:p(Ye,{themeType:this.props.themeType,value:this.state.settings,onChange:e=>this.onChange(e)})})]})}};l();var K={content:{height:500,overflow:`hidden`},tabPanel:e=>({width:`100%`,height:`calc(100% - ${e.mixins.toolbar.minHeight}px)`,overflow:`auto`}),selected:e=>({color:e.palette.mode===`dark`?`#FFF !important`:`#222 !important`})},yt=[`system`,`multihost`,`objects`,`states`,`log`,`plugins`],bt=class extends L{constructor(e){super(e),b(this,`originalSettings`,void 0);let t=a.getLocation(),n=t.tab===`tab-hosts`&&t.dialog===`base-settings`&&t.id===e.currentHost?yt.indexOf(t.arg):-1;this.state={currentTab:n>=0?n:0,hasChanges:[],currentHost:this.props.currentHost,loading:!0,confirmExit:!1,showRestart:!1,system:null,multihostService:null,objects:null,states:null,log:null,plugins:null,dnsResolution:`ipv4first`,dataDir:``,saving:!1}}isRouted(){let e=a.getLocation();return e.tab===`tab-hosts`&&e.dialog===`base-settings`&&e.id===this.props.currentHost}async componentDidMount(){await this.getSettings(this.state.currentHost),this.isRouted()&&a.getLocation().arg!==yt[this.state.currentTab]&&a.doNavigate(null,null,null,yt[this.state.currentTab])}renderDialogConfirm(){return this.state.confirmExit?p(Le,{text:this.props.t(`Discard unsaved changes?`),onClose:e=>this.setState({confirmExit:!1},()=>e&&this.props.onClose())}):null}renderRestartDialog(){return this.state.showRestart?p(Le,{title:this.props.t(`Please confirm`),text:S(w,{children:[p(`div`,{children:this.props.t(`Restart works only if controller started as system service.`)}),p(`div`,{children:this.props.t(`Would you like to restart the controller for your changes to take effect?`)})]}),ok:this.props.t(`Restart`),cancel:this.props.t(`No restart`),onClose:e=>this.setState({showRestart:!1},()=>{e&&this.props.socket.restartController(this.props.currentHost).then(()=>setTimeout(()=>window.location.reload(),500)).catch(e=>window.alert(`Cannot restart: ${e}`)),this.props.onClose()})}):null}async getSettings(e){let t=await this.props.socket.readBaseSettings(e||this.state.currentHost);t!=null&&t.config&&(this.originalSettings=z.clone(t.config),this.setState({loading:!1,system:t.config.system,multihostService:t.config.multihostService,objects:t.config.objects,states:t.config.states,log:t.config.log,plugins:t.config.plugins,dnsResolution:t.config.dnsResolution||`ipv4first`,dataDir:t.config.dataDir}))}onSave(e){let t={system:this.state.system,multihostService:this.state.multihostService,objects:this.state.objects,states:this.state.states,log:this.state.log,plugins:this.state.plugins},n={...this.originalSettings,...t};this.setState({saving:!0},()=>{this.props.socket.writeBaseSettings(e||this.state.currentHost,n).then(()=>{this.originalSettings=JSON.parse(JSON.stringify(t)),this.setState({hasChanges:[],showRestart:!0,saving:!1})}).catch(e=>{window.alert(`Cannot save settings: ${e}`),this.setState({saving:!1})})})}updateSettings(e,t){let n=[...this.state.hasChanges],r=JSON.stringify(this.originalSettings[e])!==JSON.stringify(t),i=n.indexOf(e);r&&i===-1?n.push(e):!r&&i!==-1&&n.splice(i,1),this.setState({[e]:t,hasChanges:n})}renderSystem(){let e=`system`;return p(st,{settings:this.state[e]||{},t:this.props.t,currentHost:this.props.currentHost,onChange:t=>this.updateSettings(e,t)})}renderMultihost(){let e=`multihostService`;return p(ct,{settings:this.state[e]||{},t:this.props.t,socket:this.props.socket,onChange:t=>this.updateSettings(e,t)})}renderObjects(){let e=`objects`;return p(dt,{settings:this.state[e]||{},t:this.props.t,socket:this.props.socket,currentHost:this.props.currentHost,onChange:t=>this.updateSettings(e,t)})}renderStates(){let e=`states`;return p(mt,{settings:this.state[e]||{},t:this.props.t,socket:this.props.socket,currentHost:this.props.currentHost,onChange:t=>this.updateSettings(e,t)})}renderLog(){return p(gt,{settings:this.state.log||{},t:this.props.t,onChange:e=>this.updateSettings(`log`,e)})}renderPlugins(){let e=`plugins`;return p(vt,{settings:this.state[e]||{},t:this.props.t,themeType:this.props.themeType,onChange:t=>this.updateSettings(e,t)})}render(){return S(i,{style:K.dialog,open:!0,onClose:()=>!1,fullWidth:!0,maxWidth:`xl`,"aria-labelledby":`base-settings-dialog-title`,children:[S(oe,{id:`base-settings-dialog-title`,children:[this.props.t(`Host Base Settings`),`: `,this.props.currentHostName||this.props.currentHost]}),S(ie,{style:K.content,children:[p(Ee,{position:`static`,children:S(Ie,{value:this.state.currentTab,onChange:(e,t)=>{this.setState({currentTab:t}),this.isRouted()&&a.doNavigate(null,null,null,yt[t])},"aria-label":`system tabs`,indicatorColor:`secondary`,children:[p(ce,{label:this.props.t(`System`),id:`system-tab`,"aria-controls":`simple-tabpanel-0`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`Multi-host`),id:`multihost-tab`,sx:{"&.Mui-selected":K.selected},"aria-controls":`simple-tabpanel-1`}),p(ce,{label:this.props.t(`Objects`),id:`objects-tab`,"aria-controls":`simple-tabpanel-3`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`States`),id:`states-tab`,"aria-controls":`simple-tabpanel-4`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`Log`),id:`log-tab`,"aria-controls":`simple-tabpanel-5`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`Plugins`),id:`plugins-tab`,"aria-controls":`simple-tabpanel-6`,sx:{"&.Mui-selected":K.selected}})]})}),this.state.loading?p(ge,{}):null,!this.state.loading&&this.state.currentTab===0?p(O,{component:`div`,sx:K.tabPanel,children:this.renderSystem()}):null,!this.state.loading&&this.state.currentTab===1?p(O,{component:`div`,sx:K.tabPanel,children:this.renderMultihost()}):null,!this.state.loading&&this.state.currentTab===2?p(O,{component:`div`,sx:K.tabPanel,children:this.renderObjects()}):null,!this.state.loading&&this.state.currentTab===3?p(O,{component:`div`,sx:K.tabPanel,children:this.renderStates()}):null,!this.state.loading&&this.state.currentTab===4?p(O,{component:`div`,sx:K.tabPanel,children:this.renderLog()}):null,!this.state.loading&&this.state.currentTab===5?p(O,{component:`div`,sx:K.tabPanel,children:this.renderPlugins()}):null,this.renderDialogConfirm(),this.renderRestartDialog()]}),S(De,{children:[p(R,{variant:`contained`,disabled:!this.state.hasChanges.length||this.state.saving,onClick:()=>this.onSave(),color:`primary`,startIcon:p(he,{}),children:this.props.t(`Save & Close`)}),p(R,{variant:`contained`,color:`grey`,disabled:this.state.saving,onClick:()=>this.state.hasChanges.length?this.setState({confirmExit:!0}):this.props.onClose(),startIcon:p(h,{}),children:this.state.hasChanges.length?this.props.t(`Cancel`):this.props.t(`Close`)})]})]})}};l();var q={error:{border:`2px solid #FF0000`},id:{fontStyle:`italic`},dialog:{height:`calc(100% - 64px)`},button:{marginTop:20,marginLeft:8},funcDivEdit:{width:`100%`},funcEditName:{display:`inline-block`,width:85},funcEdit:{width:400},marginTop:{marginTop:20},commonTabWrapper:{flexFlow:`wrap`,display:`flex`},commonWrapper:{width:500,minWidth:300},flexDrop:{width:`100%`,maxWidth:500,margin:`auto`,display:`flex`},marginBlock:{marginTop:20},buttonAdd:{minWidth:150},textField:{width:`100%`},flex:{display:`flex`},removeButton:{mt:`13px`,alignSelf:`flex-start`,flexShrink:0},color:{width:70},buttonRemoveWrapper:{position:`absolute`,zIndex:222,right:0},tabsPadding:{padding:`0px 24px`}},xt=class extends L{constructor(e){super(e),b(this,`originalObj`,void 0),this.state={text:JSON.stringify(this.props.obj,null,2),error:!1,changed:!1},this.originalObj=JSON.stringify(this.props.obj,null,2)}prepareObject(e){e||=this.state.text;try{let t=JSON.parse(e);return t._id=this.props.obj._id,t}catch{return null}}onChange(e){let t={text:e},n=this.prepareObject(e);n?(t.changed=this.originalObj!==JSON.stringify(n,null,2),this.state.error&&(t.error=!1)):t.error=!0,this.setState(t)}onUpdate(){try{let e=JSON.parse(this.state.text);e._id=this.props.obj._id,this.props.onClose(e)}catch{}}setCommonItem(e,t,n){e.common[t]=n,this.onChange(JSON.stringify(e,null,2))}removeCommonItem(e,t){delete e.common.common[t],this.onChange(JSON.stringify(e,null,2))}buttonAddKey(e,t){let{t:n}=this.props;return p(`div`,{style:q.marginBlock,children:p(R,{style:q.buttonAdd,variant:`contained`,color:`secondary`,onClick:t,startIcon:p(s,{}),children:n(`Add ${e}`)})})}buttonRemoveKey(e,t){let{t:n}=this.props;return p(N,{title:n(`Remove ${e}`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:p(g,{size:`small`,sx:q.removeButton,onClick:t,children:p(h,{})})})}renderCommonEdit(){try{let e=JSON.parse(this.state.text),{t}=this.props;return S(`div`,{style:q.commonTabWrapper,children:[S(`div`,{style:q.commonWrapper,children:[e.common.title===void 0?this.buttonAddKey(`title`,()=>this.setCommonItem(e,`title`,``)):p(k,{variant:`standard`,disabled:!1,label:t(`title`),style:{...q.marginBlock,...q.textField},fullWidth:!0,value:e.common.title,onChange:t=>this.setCommonItem(e,`title`,t.target.value),slotProps:{input:{endAdornment:e.common.title?p(Me,{position:`end`,children:p(g,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(e,`title`,``),children:p(h,{})})}):null}}}),e.common.color===void 0?this.buttonAddKey(`color`,()=>this.setCommonItem(e,`color`,``)):S(`div`,{style:q.flex,children:[p(k,{variant:`standard`,disabled:!1,style:{...q.marginBlock,...q.color},label:t(`Color`),type:`color`,value:e.common.color,onChange:t=>this.setCommonItem(e,`color`,t.target.value),slotProps:{input:{endAdornment:e.common.color?p(Me,{position:`end`,children:p(g,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(e,`color`,``),children:p(h,{})})}):null}}}),this.buttonRemoveKey(`color`,()=>this.removeCommonItem(e,`color`))]})]}),e.common.icon===void 0?p(`div`,{style:q.flexDrop,children:this.buttonAddKey(`icon`,()=>this.setCommonItem(e,`icon`,``))}):S(`div`,{style:q.flexDrop,children:[p(me,{disabled:!1,crop:!0,maxSize:262144,icon:e.common.icon,removeIconFunc:()=>this.setCommonItem(e,`icon`,``),onChange:t=>this.setCommonItem(e,`icon`,t)}),this.buttonRemoveKey(`icon`,()=>this.removeCommonItem(e,`icon`))]})]})}catch{return p(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}render(){return S(i,{sx:{"& .MuiDialog-paper":q.dialog},open:!0,maxWidth:`lg`,fullWidth:!0,fullScreen:!1,onClose:()=>this.props.onClose(),"aria-labelledby":`edit-value-dialog-title`,"aria-describedby":`edit-value-dialog-description`,children:[S(oe,{id:`edit-value-dialog-title`,children:[this.props.t(`Edit host settings`),`:`,p(`span`,{style:q.id,children:this.props.obj._id})]}),p(ie,{children:this.renderCommonEdit()}),S(De,{children:[p(R,{variant:`contained`,disabled:this.state.error||!this.state.changed,onClick:()=>this.onUpdate(),color:`primary`,startIcon:p(he,{}),children:this.props.t(`Write`)}),p(R,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:p(h,{}),children:this.props.t(`Cancel`)})]})]})}};l();var St=`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)`,Ct=`0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)`,wt=`
|
|
23
|
+
sudo -u iobroker -H npm install iobroker.js-controller`)},style:B.copyButton,children:p(D,{})}),S(`div`,{style:B.standardTextSmall,children:[`cd`,u===`win32`?(c||`C:\\iobroker`).replace(/\//g,`\\`):c||`/opt/iobroker`]}),p(`div`,{style:B.standardTextSmall,children:`sudo -u iobroker -H npm install iobroker.js-controller`})]}),p(`div`,{style:B.standardTextSmall2,children:y.t(`For systems installed manually under Linux, prefix sudo or run as root.`)}),p(O,{component:`div`,sx:B.standardText,children:y.t(`This way is only necessary in very few cases and please consult the forum beforehand!`)})]})]})]})}),S(De,{children:[p(R,{id:`js-controller-dialog-changelog`,variant:`contained`,onClick:()=>{window.open(Ye,`_blank`)},color:`grey`,startIcon:p(Ve,{}),children:y.t(`Show whole changelog`)}),p(R,{id:`js-controller-dialog-ok`,variant:`contained`,onClick:()=>a(),color:`primary`,startIcon:p(h,{}),children:y.t(`Ok`)})]})]})};l();var V={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:`calc(100% - 16px)`,marginBottom:16,marginRight:8,marginLeft:8},RAM:{width:400,marginRight:8}},st=class extends L{constructor(e){super(e),b(this,`focusRef`,void 0);let t=this.props.settings||{};this.state={memoryLimitMB:t.memoryLimitMB||0,hostname:t.hostname||``,statisticsInterval:t.statisticsInterval||15e3,checkDiskInterval:t.checkDiskInterval||3e5,instanceStartInterval:t.instanceStartInterval||2e3,compact:t.compact||!1,allowShellCommands:t.allowShellCommands||!1,memLimitWarn:t.memLimitWarn||100,memLimitError:t.memLimitError||50,noChmod:t.noChmod||!1},this.focusRef=le()}componentDidMount(){var e;(e=this.focusRef.current)==null||e.focus()}onChange(){this.props.onChange({memoryLimitMB:this.state.memoryLimitMB,hostname:this.state.hostname,statisticsInterval:this.state.statisticsInterval,checkDiskInterval:this.state.checkDiskInterval,noChmod:this.state.noChmod,instanceStartInterval:this.state.instanceStartInterval,compact:this.state.compact,allowShellCommands:this.state.allowShellCommands,memLimitWarn:this.state.memLimitWarn,memLimitError:this.state.memLimitError})}render(){return p(A,{style:V.paper,children:p(T,{style:V.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Host name`),style:V.controlItem,value:this.state.hostname||this.props.currentHost.replace(`system.host.`,``),onChange:e=>this.setState({hostname:e.target.value},()=>this.onChange()),helperText:this.props.t(`You can change the host name, but be aware, that all instances must be assigned anew`)})}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Check disk space interval`),style:V.controlItem,value:this.state.checkDiskInterval,type:`number`,slotProps:{htmlInput:{min:1e3}},onChange:e=>this.setState({checkDiskInterval:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`How oft the disk will be checked. Do not set it to low, because it can affect system performance. Value is in ms`)})}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Instance statistics update interval`),style:V.controlItem,value:this.state.statisticsInterval,type:`number`,slotProps:{htmlInput:{min:5e3}},onChange:e=>this.setState({statisticsInterval:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`How oft the instance statistics will be updated. Used RAM, CPU and so on. Value is in ms`)})}),S(T,{style:V.controlItem,children:[p(C,{control:p(v,{checked:this.state.compact,onChange:e=>this.setState({compact:e.target.checked},()=>this.onChange())}),label:this.props.t(`Compact mode`)}),p(`div`,{children:this.props.t(`When enabled adapter instances can run in one or few processes to save RAM usage.`)})]}),S(T,{style:V.controlItem,children:[p(C,{control:p(v,{checked:this.state.allowShellCommands,onChange:e=>this.setState({allowShellCommands:e.target.checked},()=>this.onChange())}),label:this.props.t(`Allow shell's commands`)}),p(`div`,{children:this.props.t(`Allow execution of sendToHost("shell", "cli command")`)})]}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Limit RAM size for controller`),style:V.controlItem,value:this.state.memoryLimitMB,type:`number`,onChange:e=>this.setState({memoryLimitMB:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`MB`)})}),p(T,{children:S(T,{container:!0,direction:`row`,style:V.controlItem,children:[p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Show warning im log if RAM less than`),style:V.RAM,value:this.state.memLimitWarn,type:`number`,onChange:e=>this.setState({memLimitWarn:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`MB`)})}),p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Show error in log if RAM less than`),style:V.RAM,value:this.state.memLimitError,type:`number`,onChange:e=>this.setState({memLimitError:parseInt(e.target.value,10)},()=>this.onChange()),helperText:this.props.t(`MB`)})})]})})]})})})}};l();var H={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:`calc(100% - 16px)`,marginBottom:16,marginRight:8,marginLeft:8},RAM:{width:400,marginRight:8}},ct=class extends L{constructor(e){super(e),b(this,`focusRef`,void 0);let t=this.props.settings||{};this.state={enabled:t.enabled||!1,secure:t.secure||!0,password:``},t.password&&this.props.socket.decrypt(t.password).then(e=>this.setState({password:e})),this.focusRef=le()}componentDidMount(){var e;(e=this.focusRef.current)==null||e.focus()}onChange(){let e={enabled:this.state.enabled,secure:this.state.secure};this.state.password?this.props.socket.encrypt(this.state.password).then(t=>{e.password=t,this.props.onChange(e)}):this.props.onChange(e)}render(){return p(A,{style:H.paper,children:p(`form`,{style:H.form,noValidate:!0,autoComplete:`off`,onSubmit:e=>e.preventDefault(),children:p(T,{style:H.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[S(T,{style:H.controlItem,children:[p(C,{control:p(v,{checked:this.state.enabled,onChange:e=>this.setState({enabled:e.target.checked},()=>this.onChange())}),label:this.props.t(`Allow slave connections`)}),p(`div`,{children:this.props.t(`When activated this host can be discovered by other iobroker installations in your network to become the master of a multihost system.`)})]}),S(T,{style:H.controlItem,children:[p(C,{control:p(v,{checked:this.state.secure,onChange:e=>this.setState({secure:e.target.checked},()=>this.onChange())}),label:this.props.t(`With password`)}),p(`div`,{children:this.props.t(`Ask password by connection establishment`)})]}),this.state.secure?p(T,{children:p(k,{variant:`standard`,label:this.props.t(`Multi-host password`),style:H.controlItem,value:this.state.password,type:`password`,slotProps:{input:{autoComplete:`new-password`},htmlInput:{autoComplete:`off`}},autoComplete:`off`,onChange:e=>this.setState({password:e.target.value},()=>this.onChange())})}):null]})})})})}};l();var U={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:400,marginBottom:16,marginRight:8,marginLeft:8},dangerZone:{backgroundColor:`rgba(255, 165, 0, 0.05)`,border:`2px solid rgba(255, 165, 0)`,marginBottom:8},dangerZoneHeader:{background:`rgba(255, 165, 0)`,color:`#FFF`,paddingLeft:16,paddingTop:4,paddingBottom:4,marginTop:-1,marginLeft:-1},warning:e=>({p:1,fontSize:14,color:e.palette.mode===`dark`?`#ffa500`:`#b17200`})},lt=9001,ut={autoCompress:{sizeFactor:2,sizeFactorMinimumSize:25e3},throttleFS:{intervalMs:6e4,maxBufferedCommands:1e3}},dt=class e extends L{constructor(t){super(t),b(this,`focusRef`,void 0);let n=this.props.settings||{};n.options||={auth_pass:``,retry_max_delay:2e3,retry_max_count:19,db:0,family:0},n.backup||={disabled:!1,files:24,hours:48,period:120,path:``},n.jsonlOptions||=ut,n.jsonlOptions.autoCompress||=ut.autoCompress,n.jsonlOptions.throttleFS||=ut.throttleFS,this.state={type:n.type||`file`,host:Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`,port:n.port||lt,connectTimeout:n.connectTimeout||2e3,writeFileInterval:n.writeFileInterval||5e3,dataDir:n.dataDir||``,options_auth_pass:n.options.auth_pass||n.pass||``,options_retry_max_delay:n.options.retry_max_delay||2e3,options_retry_max_count:n.options.retry_max_count||19,options_db:n.options.db||0,options_family:n.options.family||0,backup_disabled:n.backup.disabled||!1,backup_files:n.backup.files||24,backup_hours:n.backup.hours||48,backup_period:n.backup.period||120,backup_path:n.backup.path||``,jsonlOptions_autoCompress_sizeFactor:n.jsonlOptions.autoCompress.sizeFactor||2,jsonlOptions_autoCompress_sizeFactorMinimumSize:n.jsonlOptions.autoCompress.sizeFactorMinimumSize||25e3,jsonlOptions_throttleFS_intervalMs:n.jsonlOptions.throttleFS.intervalMs||6e4,jsonlOptions_throttleFS_maxBufferedCommands:n.jsonlOptions.throttleFS.maxBufferedCommands||100,textIP:e.calculateTextIP(Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`),IPs:[`0.0.0.0`,`127.0.0.1`],loading:!0,showWarningDialog:!1,toConfirmType:``,originalDBType:n.type||`file`,noFileCache:n.noFileCache||!1},this.focusRef=le()}static calculateTextIP(e,t){return Array.isArray(e)||e.match(/[^.\d]/)||e.includes(`,`)?!0:t?!t.includes(e):!1}componentDidMount(){this.props.socket.getIpAddresses(this.props.currentHost).then(t=>{let n=[...t];n.includes(`0.0.0.0`)||n.push(`0.0.0.0`),n.includes(`127.0.0.1`)||n.push(`127.0.0.1`);let r=e.calculateTextIP(this.state.host,n);this.setState({IPs:n,loading:!1,textIP:r},()=>this.focusRef.current&&this.focusRef.current.focus())})}componentDidUpdate(t){if(t.settings!==this.props.settings){let t=this.props.settings||{},n=Array.isArray(t.host)?t.host.join(`,`):t.host||`127.0.0.1`;if(n!==this.state.host){let t=e.calculateTextIP(n,this.state.IPs);this.setState({host:n,textIP:t})}}}onChange(){let e={type:this.state.type,host:this.state.host,port:parseInt(this.state.port,10),noFileCache:this.state.noFileCache,connectTimeout:parseInt(this.state.connectTimeout,10),writeFileInterval:parseInt(this.state.writeFileInterval,10),dataDir:this.state.dataDir,options:{auth_pass:this.state.options_auth_pass||null,retry_max_delay:parseInt(this.state.options_retry_max_delay,10),retry_max_count:parseInt(this.state.options_retry_max_count,10),db:parseInt(this.state.options_db,10),family:parseInt(this.state.options_family,10)},backup:{disabled:this.state.backup_disabled,files:parseInt(this.state.backup_files,10),hours:parseInt(this.state.backup_hours,10),period:parseInt(this.state.backup_period,10),path:this.state.backup_path},jsonlOptions:{autoCompress:{sizeFactor:parseInt(this.state.jsonlOptions_autoCompress_sizeFactor,10),sizeFactorMinimumSize:parseInt(this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,10)},throttleFS:{intervalMs:parseInt(this.state.jsonlOptions_throttleFS_intervalMs,10),maxBufferedCommands:parseInt(this.state.jsonlOptions_throttleFS_maxBufferedCommands,10)}}};e.jsonlOptions.autoCompress.sizeFactor<2&&(e.jsonlOptions.autoCompress.sizeFactor=2),e.jsonlOptions.autoCompress.sizeFactorMinimumSize<0&&(e.jsonlOptions.autoCompress.sizeFactorMinimumSize=0),e.jsonlOptions.throttleFS.intervalMs<0&&(e.jsonlOptions.throttleFS.intervalMs=0),e.jsonlOptions.throttleFS.maxBufferedCommands<0&&(e.jsonlOptions.throttleFS.maxBufferedCommands=0),this.props.onChange(e)}renderWarning(){return this.state.showWarningDialog?p(Le,{title:this.props.t(`Please confirm`),text:this.props.t(`switch_db_note`),onClose:e=>{if(e){let e;e=this.state.toConfirmType===`redis`?6379:lt,this.setState({type:this.state.toConfirmType||`file`,showWarningDialog:!1,port:e},()=>this.onChange())}else this.setState({showWarningDialog:!1})}}):null}render(){return S(A,{style:U.paper,children:[this.state.loading?p(ge,{}):null,this.renderWarning(),S(T,{style:{...U.gridSettings,...U.dangerZone},children:[p(`h3`,{style:U.dangerZoneHeader,title:this.props.t(`Invalid settings in these fields could lead to dead host`),children:this.props.t(`Danger zone`)}),p(O,{component:`p`,sx:U.warning,children:this.props.t(`base_settings_hint`)}),S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:p(N,{title:this.props.t(`switch_db_note`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:S(o,{style:U.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Type`)}),S(P,{variant:`standard`,value:this.state.type,onChange:e=>{if(e.target.value!==this.state.originalDBType)this.setState({toConfirmType:e.target.value,showWarningDialog:!0});else{let t;t=e.target.value===`redis`?6379:lt,this.setState({type:e.target.value,port:t},()=>this.onChange())}},children:[p(M,{value:`jsonl`,children:`JSON Lines`}),p(M,{value:`file`,children:this.props.t(`File`)}),p(M,{value:`redis`,children:`Redis`})]})]})})}),p(T,{style:{paddingLeft:8},children:p(C,{control:p(_e,{checked:this.state.textIP,onChange:e=>this.setState({textIP:e.target.checked},()=>this.onChange())}),label:this.props.t(`IP is domain or more than one address`)})}),p(T,{children:this.state.textIP?p(k,{variant:`standard`,style:U.controlItem,value:this.state.host,type:`text`,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),label:this.props.t(`Bind IP address`),helperText:this.props.t(`You can enter more than one address divided by comma`)}):S(o,{style:U.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Bind IP address`)}),p(P,{variant:`standard`,value:this.state.host,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),children:this.state.IPs.map(e=>p(M,{value:e,children:e===`0.0.0.0`?`0.0.0.0 [${this.props.t(`All addresses`)}]`:e},e))})]})}),p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.port,type:`number`,slotProps:{htmlInput:{min:1,max:65535}},onChange:e=>this.setState({port:e.target.value},()=>this.onChange()),label:this.props.t(`Port`)})}),this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.dataDir,helperText:this.props.t(`Optional. Always relative to iobroker.js-controller/`),onChange:e=>this.setState({dataDir:e.target.value},()=>this.onChange()),label:this.props.t(`Directory path`)})}):null,p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_auth_pass,type:`password`,helperText:this.props.t(`Optional`),slotProps:{input:{autoComplete:`new-password`},htmlInput:{autoComplete:`off`}},autoComplete:`off`,onChange:e=>this.setState({options_auth_pass:e.target.value},()=>this.onChange()),label:this.state.type===`redis`?this.props.t(`Redis password`):this.props.t(`Connection password`)})})]})]}),p(T,{style:U.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.connectTimeout,helperText:this.props.t(`ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({connectTimeout:e.target.value},()=>this.onChange()),label:this.props.t(`Connect timeout`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,variant:`standard`,style:U.controlItem,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.noFileCache,onChange:e=>this.setState({noFileCache:e.target.checked},()=>this.onChange())}),label:this.props.t(`No file cache`)})}),p(x,{children:this.props.t(`Always read files from disk and do not cache them in RAM. Used for debugging.`)})]})}):null,this.state.type===`file`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.writeFileInterval,helperText:this.props.t(`How often the data from RAM will be saved on disk in ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({writeFileInterval:e.target.value},()=>this.onChange()),label:this.props.t(`Store file interval`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_retry_max_delay,type:`number`,helperText:this.props.t(`Maximum delay between connection attempts`),onChange:e=>this.setState({options_retry_max_delay:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum delay`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_retry_max_count,type:`number`,helperText:this.props.t(`Maximum number of connection retries`),onChange:e=>this.setState({options_retry_max_count:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum count`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.options_db,type:`number`,helperText:this.props.t(`Used for sentinels`),onChange:e=>this.setState({options_db:e.target.value},()=>this.onChange()),label:this.props.t(`DB number`)})}):null,this.state.type===`redis`?p(T,{children:S(o,{style:U.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Family number`)}),S(P,{variant:`standard`,value:this.state.options_family,onChange:e=>this.setState({options_family:e.target.value},()=>this.onChange()),children:[p(M,{value:0,children:`auto`}),p(M,{value:4,children:`IPv4`}),p(M,{value:6,children:`IPv6`})]}),p(x,{children:this.props.t(`Used for sentinels`)})]})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactor,type:`number`,slotProps:{htmlInput:{min:2}},helperText:this.props.t(`The JSONL DB is append-only and will contain unnecessary entries after a while.`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactor:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`It will be compressed when the uncompressed size is >= size * sizeFactor AND >= sizeFactorMinimumSize`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactorMinimumSize:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor minimum size`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_throttleFS_intervalMs,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Write to the database file no more than every X milliseconds`),onChange:e=>this.setState({jsonlOptions_throttleFS_intervalMs:e.target.value},()=>this.onChange()),label:this.props.t(`Minimal write interval`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.jsonlOptions_throttleFS_maxBufferedCommands,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Force writing after this many changes have been buffered. This reduces memory consumption and data loss in case of a crash`),onChange:e=>this.setState({jsonlOptions_throttleFS_maxBufferedCommands:e.target.value},()=>this.onChange()),label:this.props.t(`Maximum changes before write`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,style:U.controlItem,variant:`standard`,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.backup_disabled,onChange:e=>this.setState({backup_disabled:e.target.checked},()=>this.onChange())}),label:this.props.t(`No on-the-fly backup`)})}),p(x,{children:this.props.t(`By every write the backup of object.json will be created.`)})]})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_files,type:`number`,helperText:this.props.t(`Minimal number of backup files, after the deletion will be executed according to the backup time settings`),onChange:e=>this.setState({backup_files:e.target.value},()=>this.onChange()),label:this.props.t(`Number of files`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_hours,type:`number`,helperText:this.props.t(`All backups older than these hours will be deleted, but only if the number of files is greater than of the files number`),onChange:e=>this.setState({backup_hours:e.target.value},()=>this.onChange()),label:this.props.t(`Backup hours`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_period,type:`number`,helperText:this.props.t(`By default the backup is every 2 hours. Time is in minutes. To disable backup set the value to 0`),onChange:e=>this.setState({backup_period:e.target.value},()=>this.onChange()),label:this.props.t(`How often`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:U.controlItem,value:this.state.backup_path,helperText:this.props.t(`Absolute path to backup directory or empty to backup in data directory. Leave it empty for default storage place.`),onChange:e=>this.setState({backup_path:e.target.value},()=>this.onChange()),label:this.props.t(`Path`)})}):null]})})]})}};l();var W={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},controlItem:{width:400,marginBottom:16,marginRight:8,marginLeft:8},dangerZone:{backgroundColor:`rgba(255, 165, 0, 0.05)`,border:`2px solid rgba(255, 165, 0)`,marginBottom:8},dangerZoneHeader:{background:`rgba(255, 165, 0)`,color:`#FFF`,paddingLeft:16,paddingTop:4,paddingBottom:4,marginTop:-1,marginLeft:-1},warning:e=>({p:1,fontSize:14,color:e.palette.mode===`dark`?`#ffa500`:`#b17200`})},ft=9e3,pt={autoCompress:{sizeFactor:2,sizeFactorMinimumSize:25e3},throttleFS:{intervalMs:6e4,maxBufferedCommands:1e3}},mt=class e extends L{constructor(t){super(t),b(this,`focusRef`,void 0);let n=this.props.settings||{};n.options||={auth_pass:``,retry_max_delay:2e3,retry_max_count:19,db:0,family:0},n.backup||={disabled:!1,files:24,hours:48,period:120,path:``},n.jsonlOptions||=pt,n.jsonlOptions.autoCompress||=pt.autoCompress,n.jsonlOptions.throttleFS||=pt.throttleFS,this.state={type:n.type||`file`,host:Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`,port:n.port||ft,connectTimeout:n.connectTimeout||2e3,writeFileInterval:n.writeFileInterval||5e3,dataDir:n.dataDir||``,options_auth_pass:n.options.auth_pass||n.pass||``,options_retry_max_delay:n.options.retry_max_delay||2e3,options_retry_max_count:n.options.retry_max_count||19,options_db:n.options.db||0,options_family:n.options.family||0,backup_disabled:n.backup.disabled||!1,backup_files:n.backup.files||24,backup_hours:n.backup.hours||48,backup_period:n.backup.period||120,backup_path:n.backup.path||``,jsonlOptions_autoCompress_sizeFactor:n.jsonlOptions.autoCompress.sizeFactor||2,jsonlOptions_autoCompress_sizeFactorMinimumSize:n.jsonlOptions.autoCompress.sizeFactorMinimumSize||25e3,jsonlOptions_throttleFS_intervalMs:n.jsonlOptions.throttleFS.intervalMs||6e4,jsonlOptions_throttleFS_maxBufferedCommands:n.jsonlOptions.throttleFS.maxBufferedCommands||100,textIP:e.calculateTextIP(Array.isArray(n.host)?n.host.join(`,`):n.host||`127.0.0.1`),IPs:[`0.0.0.0`,`127.0.0.1`],loading:!0,showWarningDialog:!1,toConfirmType:``,originalDBType:n.type||`file`,noFileCache:n.noFileCache||!1},this.focusRef=le()}static calculateTextIP(e,t){return Array.isArray(e)||e.match(/[^.\d]/)||e.includes(`,`)?!0:t?!t.includes(e):!1}componentDidMount(){this.props.socket.getIpAddresses(this.props.currentHost).then(t=>{let n=[...t];n.includes(`0.0.0.0`)||n.push(`0.0.0.0`),n.includes(`127.0.0.1`)||n.push(`127.0.0.1`);let r=e.calculateTextIP(Array.isArray(this.state.host)?this.state.host[0]:this.state.host,n);this.setState({IPs:n,loading:!1,textIP:r},()=>this.focusRef.current&&this.focusRef.current.focus())})}componentDidUpdate(t){if(t.settings!==this.props.settings){let t=this.props.settings||{},n=Array.isArray(t.host)?t.host.join(`,`):t.host||`127.0.0.1`;if(n!==this.state.host){let t=e.calculateTextIP(n,this.state.IPs);this.setState({host:n,textIP:t})}}}onChange(){let e={type:this.state.type,host:this.state.host,port:parseInt(this.state.port,10),noFileCache:this.state.noFileCache,connectTimeout:parseInt(this.state.connectTimeout,10),writeFileInterval:parseInt(this.state.writeFileInterval,10),dataDir:this.state.dataDir,options:{auth_pass:this.state.options_auth_pass||null,retry_max_delay:parseInt(this.state.options_retry_max_delay,10),retry_max_count:parseInt(this.state.options_retry_max_count,10),db:parseInt(this.state.options_db,10),family:parseInt(this.state.options_family,10)},backup:{disabled:this.state.backup_disabled,files:parseInt(this.state.backup_files,10),hours:parseInt(this.state.backup_hours,10),period:parseInt(this.state.backup_period,10),path:this.state.backup_path},jsonlOptions:{autoCompress:{sizeFactor:parseInt(this.state.jsonlOptions_autoCompress_sizeFactor,10),sizeFactorMinimumSize:parseInt(this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,10)},throttleFS:{intervalMs:parseInt(this.state.jsonlOptions_throttleFS_intervalMs,10),maxBufferedCommands:parseInt(this.state.jsonlOptions_throttleFS_maxBufferedCommands,10)}}};e.jsonlOptions.autoCompress.sizeFactor<2&&(e.jsonlOptions.autoCompress.sizeFactor=2),e.jsonlOptions.autoCompress.sizeFactorMinimumSize<0&&(e.jsonlOptions.autoCompress.sizeFactorMinimumSize=0),e.jsonlOptions.throttleFS.intervalMs<0&&(e.jsonlOptions.throttleFS.intervalMs=0),e.jsonlOptions.throttleFS.maxBufferedCommands<0&&(e.jsonlOptions.throttleFS.maxBufferedCommands=0),this.props.onChange(e)}renderWarning(){return this.state.showWarningDialog?p(Le,{title:this.props.t(`Please confirm`),text:this.props.t(`switch_db_note`),onClose:e=>{if(e){let e;e=this.state.toConfirmType===`redis`?6379:ft,this.setState({type:this.state.toConfirmType||`file`,showWarningDialog:!1,port:e},()=>this.onChange())}else this.setState({showWarningDialog:!1})}}):null}render(){return S(A,{style:W.paper,children:[this.state.loading?p(ge,{}):null,this.renderWarning(),S(T,{style:{...W.gridSettings,...W.dangerZone},children:[p(`h3`,{style:W.dangerZoneHeader,title:this.props.t(`Invalid settings in these fields could lead to dead host`),children:this.props.t(`Danger zone`)}),p(O,{component:`p`,sx:W.warning,children:this.props.t(`base_settings_hint`)}),S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:p(N,{title:this.props.t(`switch_db_note`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:S(o,{style:W.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Type`)}),S(P,{variant:`standard`,value:this.state.type,onChange:e=>{if(e.target.value!==this.state.originalDBType)this.setState({toConfirmType:e.target.value,showWarningDialog:!0});else{let t;t=e.target.value===`redis`?6379:ft,this.setState({type:e.target.value,port:t},()=>this.onChange())}},children:[p(M,{value:`jsonl`,children:`JSON Lines`}),p(M,{value:`file`,children:this.props.t(`File`)}),p(M,{value:`redis`,children:`Redis`})]})]})})}),p(T,{style:{paddingLeft:8},children:p(C,{control:p(_e,{checked:this.state.textIP,onChange:e=>this.setState({textIP:e.target.checked},()=>this.onChange())}),label:this.props.t(`IP is domain or more than one address`)})}),p(T,{children:this.state.textIP?p(k,{variant:`standard`,style:W.controlItem,value:this.state.host,type:`text`,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),label:this.props.t(`Bind IP address`),helperText:this.props.t(`You can enter more than one address divided by comma`)}):S(o,{style:W.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Bind IP address`)}),p(P,{variant:`standard`,value:this.state.host,onChange:e=>this.setState({host:e.target.value},()=>this.onChange()),children:this.state.IPs.map(e=>p(M,{value:e,children:e===`0.0.0.0`?`0.0.0.0 [${this.props.t(`All addresses`)}]`:e},e))})]})}),p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.port,type:`number`,slotProps:{htmlInput:{min:1,max:65535}},onChange:e=>this.setState({port:e.target.value},()=>this.onChange()),label:this.props.t(`Port`)})}),this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.dataDir,helperText:this.props.t(`Optional. Always relative to iobroker.js-controller/`),onChange:e=>this.setState({dataDir:e.target.value},()=>this.onChange()),label:this.props.t(`Directory path`)})}):null,p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_auth_pass,type:`password`,helperText:this.props.t(`Optional`),slotProps:{input:{autoComplete:`new-password`},htmlInput:{autoComplete:`off`}},autoComplete:`off`,onChange:e=>this.setState({options_auth_pass:e.target.value},()=>this.onChange()),label:this.state.type===`redis`?this.props.t(`Redis password`):this.props.t(`Connection password`)})})]})]}),p(T,{style:W.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.connectTimeout,helperText:this.props.t(`ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({connectTimeout:e.target.value},()=>this.onChange()),label:this.props.t(`Connect timeout`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,variant:`standard`,style:W.controlItem,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.noFileCache,onChange:e=>this.setState({noFileCache:e.target.checked},()=>this.onChange())}),label:this.props.t(`No file cache`)})}),p(x,{children:this.props.t(`Always read files from disk and do not cache them in RAM. Used for debugging.`)})]})}):null,this.state.type===`file`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.writeFileInterval,helperText:this.props.t(`How often the data from RAM will be saved on disk in ms`),type:`number`,slotProps:{htmlInput:{min:200}},onChange:e=>this.setState({writeFileInterval:e.target.value},()=>this.onChange()),label:this.props.t(`Store file interval`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_retry_max_delay,type:`number`,helperText:this.props.t(`Maximum delay between connection attempts`),onChange:e=>this.setState({options_retry_max_delay:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum delay`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_retry_max_count,type:`number`,helperText:this.props.t(`Maximum number of connection retries`),onChange:e=>this.setState({options_retry_max_count:e.target.value},()=>this.onChange()),label:this.props.t(`Retry maximum count`)})}):null,this.state.type===`redis`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.options_db,type:`number`,helperText:this.props.t(`Used for sentinels`),onChange:e=>this.setState({options_db:e.target.value},()=>this.onChange()),label:this.props.t(`DB number`)})}):null,this.state.type===`redis`?p(T,{children:S(o,{style:W.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Family number`)}),S(P,{variant:`standard`,value:this.state.options_family,onChange:e=>this.setState({options_family:e.target.value},()=>this.onChange()),children:[p(M,{value:0,children:`auto`}),p(M,{value:4,children:`IPv4`}),p(M,{value:6,children:`IPv6`})]}),p(x,{children:this.props.t(`Used for sentinels`)})]})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactor,type:`number`,slotProps:{htmlInput:{min:2}},helperText:this.props.t(`The JSONL DB is append-only and will contain unnecessary entries after a while.`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactor:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_autoCompress_sizeFactorMinimumSize,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`It will be compressed when the uncompressed size is >= size * sizeFactor AND >= sizeFactorMinimumSize`),onChange:e=>this.setState({jsonlOptions_autoCompress_sizeFactorMinimumSize:e.target.value},()=>this.onChange()),label:this.props.t(`Auto-compress size factor minimum size`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_throttleFS_intervalMs,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Write to the database file no more than every X milliseconds`),onChange:e=>this.setState({jsonlOptions_throttleFS_intervalMs:e.target.value},()=>this.onChange()),label:this.props.t(`Minimal write interval`)})}):null,this.state.type===`jsonl`?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.jsonlOptions_throttleFS_maxBufferedCommands,type:`number`,slotProps:{htmlInput:{min:0}},helperText:this.props.t(`Force writing after this many changes have been buffered. This reduces memory consumption and data loss in case of a crash`),onChange:e=>this.setState({jsonlOptions_throttleFS_maxBufferedCommands:e.target.value},()=>this.onChange()),label:this.props.t(`Maximum changes before write`)})}):null,this.state.type===`file`||this.state.type===`jsonl`?p(T,{children:S(o,{component:`fieldset`,style:W.controlItem,variant:`standard`,children:[p(f,{children:p(C,{control:p(v,{checked:this.state.backup_disabled,onChange:e=>this.setState({backup_disabled:e.target.checked},()=>this.onChange())}),label:this.props.t(`No on-the-fly backup`)})}),p(x,{children:this.props.t(`By every write the backup of object.json will be created.`)})]})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_files,type:`number`,helperText:this.props.t(`Minimal number of backup files, after the deletion will be executed according to the backup time settings`),onChange:e=>this.setState({backup_files:e.target.value},()=>this.onChange()),label:this.props.t(`Number of files`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_hours,type:`number`,helperText:this.props.t(`All backups older than these hours will be deleted, but only if the number of files is greater than of the files number`),onChange:e=>this.setState({backup_hours:e.target.value},()=>this.onChange()),label:this.props.t(`Backup hours`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_period,type:`number`,helperText:this.props.t(`By default the backup is every 2 hours. Time is in minutes. To disable backup set the value to 0`),onChange:e=>this.setState({backup_period:e.target.value},()=>this.onChange()),label:this.props.t(`How often`)})}):null,(this.state.type===`file`||this.state.type===`jsonl`)&&!this.state.backup_disabled?p(T,{children:p(k,{variant:`standard`,style:W.controlItem,value:this.state.backup_path,helperText:this.props.t(`Absolute path to backup directory or empty to backup in data directory. Leave it empty for default storage place.`),onChange:e=>this.setState({backup_path:e.target.value},()=>this.onChange()),label:this.props.t(`Path`)})}):null]})})]})}},ht=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAbCAYAAADMIInqAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAiPSURBVFhH7Zd7UFTXGcDPvXffy8IusMsbQUEgoyiKD4pBnoKgVkoRX1WpNia2QZ2MzFTS2MykmlqiMzWJqSUxJq1KG0VrE0GxqSgSNVEx4SEaAeXNLrDsLvve2+/cvQusgIHWf2jymzns+b5zLvd+3/nOd75DoGEsWJDLaWvrXsXhcH/S3a0ODArynqfRDLRptfo6qVRcRdOGww8fftbGTv+/YNAB/v4ZsSrVQJHBYAunaVb5BBwOMri58farVI9eR+iejVVPakj8x8dn6cKWlv5zev3YxmMsFiRQqYyv8fleb+XnH2CenexQ2JCqqroLRiMKYHWIzyctLi680ujo4Aa93nDfbDZ72WxIYB/FQUMsbG5+VNHf/6DRrpu8kFeu3EnRaKzhrIxEIq5ZLhdHqdUXMior31+mVJ5fFhKiiBCLqXp2CrJaETKbyTxWnNSQtbWP5w4Pe3d30cWWln9+w4oMdXV/bw8K8tgLZoNkYZpeb5zLDE5yIJ7n7EZI8jtWRl5eLl91dn4azYqDxMZu4ldWVrqxaQMgIAnWK1lhkODgDLHNRuVqNIYMiJQ5Wq0JnCocsFjM/w4PD/ikqurop+zUUYHnY8xmIs9mIxI7O7V4QSDajJc8PEQfZ2fHXyguPhPa2KiLwXNJklLZbDf+wTw4Cr3rkUg8j5dDSYYOOyslRI8Ccs6FJP6J+XZizpz1+bduPf49M8pA0zKZ8N3U1NlvyeWuTYcOFTwlLToTGZmdcu9e9xGj0RZkzxXOEARtE4nIE/v2bdmVl7e+nVUzyGTpHKGQ+BCMXgOOG5FgKQr/tf4xPNxPUFPT8QKWeDzqlsn0rzEjsSMe+fCnCdtcFsG6DfscC0fwUZvPsp9PS3rbSoSHZ/k+eKBshAzPY8cZeDwSGnELHHJ51qyg6tWrUz5/+eW1j9jhESxevDn9xo3Gs3q9lcOqxkQm456fPj1g+fXrRyGbIHTsWAm1e/f7x1tbNauYCU+BJFE/JGRX3P9OByQgH/hpE8+XIEGE2K5kGRDKX3HL+foAWV9/qk0q5f8BDGWH7JhMNqTVWiGEbTsrKx9+uHPne80KRfrNmTPXrC0uLmXWw8HBg8dcqqtbPhgynrbKZLwTQUGibIR0yWFhnoVwqpjsYxCavaalarX6JVZE+/Z9tKS1td/JeD6f6AkOdi9FyPBmYKC0xh4BCDmMnwi6m1pk7hx8PYPQoNzfdSYujQ2MJCowUHQQPuJFCD+uXTc6sAJwUlAfgHO2InQZZ0SoI9JWt7frTzATwJEyGf/V3t6Lg3kFM2/ez1Lv3HlcajbbHe3pKap9553tkTk5aVZPz7RLSqU+kRkAKIq+BnljRXd3mQrLOEKOHy/PraioP6zXWwYjbLwRgPukkEL86SKnrUCI3S87bdTZs1dFNTX1boOhLEheMotl7O3v4cHfq1JdKMB9L6/0k52duhzcFwhI4+bNSTEkSTiVzFwuhywqKr/a32+aimU4blFUlL9XWFiQ9dSpqna12sA4nsslLYsXh0WXl79XjeXhBAdnHmps7PkVK07IAc6A2YSwhDM1ZpOTAxyUlFwSFxS8PVWpHIi3Wul4CO2EgQGLjB1mgPygjYz0nvbllye7CGJRBU1Tz2M9GA4RIGTmPEl/vxEyOrPtAfzb62XvSzuh0GZ6kO1rVKrzMxjhCcLCVkY0NPTU0rT9s/87B1CwqrzXBJk7C6V5ew2jlrOZmUm62tqSr7u6yg7BKmeFhMgVvr4SOCmGIgJyhItAIEjCfZp2GIX3KI3gTjFqGzIeg/8XlrHhQ+swZYqc7Y3Ez0+uFQqdcvXEILg6QiTP8v5c/wY2nlGtWZO/A380Bq8evOQvhYW7Rpzvu3Yd4BQVlTX39hp8WRVyc+Nvg4rxMIcTV2GxEEwEgAt0kHb+bO+PDZfLRb6+fr9pbm6AjYkjwJ7lpFJBTV9f2agREBW1NqK6urUWEiHDhCKA5tynvGf+VH7y9l1GduDvv0KPUBx4wN7k8uRUdsgJcADl4pLcAAcezMMtjl6wYAOTyYODV5506Pn8BGtW1o6ZzEPjIDd3j6tYnNzjeJ7LjTfHxm6cxQ474eGRCrdQx/sX0zxe4lfs0KhgB0CjO+Kos6r8nMG7znBIqNDO2EPQ3uC2V7h8+Q6nFcjKeoW4cuXuL3U6UyirgqsxaZNIRJW47+rK+8SxPaAIIq9evf9qQsJWp6MyJeVFF6Ew7ixCMfdwEwhi6yIjV8iOHn29381NeJudBtuE5lRWfvvuxo17IlgVKir6G7VkyUtbIA9B1ToBbIgmKOkBzozkHI/9xY9ZrRPEwoUb5l+/3nwN7gODHwz3fo1C4XpDpdLcNJstkLH5cZAIfwQJkZ2BjzHBZaWyLJ4VIXSTIXTNz+E+Ab6E2uJqQIDk47t3v33o7i71s9l4+X19RmYco1AIz3R1lWbifkzMhqVffNH0mSO5YSQSnkUs5pbDTbSZz+c/DxXic8Pfj/muLTAemDdGR6974/btlgJ8yxsfliaFQpIABjSxCuyAGSYTfRNWib02Pw1zvUQijtdoLsLet+Pnl36ktVX7C/aTxsWzcABzCqxbt2TP3LlTdkC1ph6e6Z8EanlIfLxrYrEoebjxmL6+8m9cXbmLoAgC/ej/Az/v4SG4A9Vd4nDjMf7+XtvCwhR/5XDwJWskoIdj0Ou0XO7Cap4NTu7Ozv61d0tLx4aamuZZUqlrUm+vjhmXSPidXC5V7evrfnrTprTzW7fmMEfIaCQnbxHX1bWt7OnRZXh6ypLUah0SiwUDRqPxWmCg/Nz8+aGnjxz5rXNdOgyIxpj2dvULcNOLV6sHRJ6erkip7CkJDQ06tX37j+/n5xc1dnRomLnPIgImFVASB3h7L4PwGt8pMB5GLYS+T/zgAPb3e8sPDmB/Jw34voKPREf730DoP5pKhvU07RMQAAAAAElFTkSuQmCC`;l();var G={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`hidden`,padding:8},gridSettings:e=>({height:`calc(100% - ${e.mixins.toolbar.minHeight}px)`,width:`100%`,overflow:`auto`}),controlItem:{width:400,marginBottom:16,marginRight:8,marginLeft:8},delButton:{position:`absolute`,top:2,right:48},addButton:{marginRight:8},buttonIcon:{height:24},headingIcon:{height:24,marginRight:8}},gt=class extends L{constructor(e){super(e),b(this,`focusRef`,void 0);let t=this.props.settings||{};t.transport||={},Object.keys(t.transport).forEach(e=>{var n;if((n=t.transport)!=null&&n[e]){if(t.transport[e].type===`file`){let n=t.transport[e].maxSize,r=typeof n==`string`?n.includes(`k`)?.1:n.includes(`g`)?10:1:1;t.transport[e].maxSize=(parseInt(t.transport[e].maxSize,10)||0)*r,t.transport[e].level=t.transport[e].level||``,t.transport[e].maxFiles=t.transport[e].maxFiles||0}else t.transport[e].type===`syslog`?(t.transport[e].level=t.transport[e].level||``,t.transport[e].host=t.transport[e].host||``,t.transport[e].port=t.transport[e].port||0,t.transport[e].path=t.transport[e].path||``,t.transport[e].facility=t.transport[e].facility||``,t.transport[e].sysLogType=t.transport[e].sysLogType||``,t.transport[e].app_name=t.transport[e].app_name||``,t.transport[e].eol=t.transport[e].eol||``):t.transport[e].type===`http`?(t.transport[e].level=t.transport[e].level||``,t.transport[e].host=t.transport[e].host||``,t.transport[e].port=t.transport[e].port||0,t.transport[e].path=t.transport[e].path||`/`,t.transport[e].auth=t.transport[e].auth||`None`,t.transport[e].ssl=t.transport[e].ssl||!1):t.transport[e].type===`stream`?(t.transport[e].stream=t.transport[e].stream||``,t.transport[e].level=t.transport[e].level||``,t.transport[e].silent=t.transport[e].silent||!1,t.transport[e].eol=t.transport[e].eol||``):t.transport[e].type===`seq`&&(t.transport[e].level=t.transport[e].level||``,t.transport[e].serverUrl=t.transport[e].serverUrl||``,t.transport[e].apiKey=t.transport[e].apiKey||``,t.transport[e].eol=t.transport[e].eol||``)}}),this.state={level:t.level||`info`,maxDays:t.maxDays||7,noStdout:t.noStdout||!0,transport:t.transport||{},expanded:[]},this.focusRef=le()}componentDidMount(){var e;(e=this.focusRef.current)==null||e.focus()}onChange(){let e={level:this.state.level,maxDays:parseInt(this.state.maxDays,10),noStdout:this.state.noStdout,transport:{}},t=e.transport;Object.keys(this.state.transport).forEach(e=>{if(t[e]=JSON.parse(JSON.stringify(this.state.transport[e])),this.state.transport[e].type===`file`){if(t[e].maxSize=parseInt(t[e].maxSize,10)||void 0,t[e].maxSize){var n;t[e].maxSize=`${(n=t[e].maxSize)==null?void 0:n.toString()}m`}t[e].maxFiles=parseInt(t[e].maxFiles,10)||void 0}else this.state.transport[e].type===`syslog`?(t[e].port||delete t[e].port,t[e].path||delete t[e].path,t[e].sysLogType||delete t[e].sysLogType,t[e].app_name||delete t[e].app_name,t[e].eol||delete t[e].eol):this.state.transport[e].type===`http`?(t[e].host=t[e].host||``,t[e].port=parseInt(t[e].port,10)||80,t[e].path=t[e].path||`/`,t[e].auth=t[e].auth||``,t[e].ssl=t[e].ssl||!1):this.state.transport[e].type===`stream`&&(t[e].stream=t[e].stream||``,t[e].level=t[e].level||`info`,t[e].silent=t[e].silent||!1,t[e].eol=t[e].eol||``)}),this.props.onChange(e)}onDelete(e){let t=JSON.parse(JSON.stringify(this.state.transport));delete t[e],this.setState({transport:t},()=>this.onChange())}renderEnabled(e){return p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.transport[e].enabled,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].enabled=t.target.checked,this.setState({transport:n},()=>this.onChange())}}),label:this.props.t(`Enabled`)})})}renderLogLevel(e){return this.state.transport[e].enabled?p(T,{children:S(o,{style:G.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Level`)}),S(P,{variant:`standard`,value:this.state.transport[e].level||`_`,renderValue:()=>this.state.transport[e].level||this.props.t(`default`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].level=t.target.value===`_`?``:t.target.value,this.setState({transport:n},()=>this.onChange())},children:[p(M,{value:`_`,children:this.props.t(`default`)}),p(M,{value:`silly`,children:`silly`}),p(M,{value:`debug`,children:`debug`}),p(M,{value:`info`,children:`info`}),p(M,{value:`warn`,children:`warn`}),p(M,{value:`error`,children:`error`})]}),p(x,{children:this.props.t(`Level of messages that this transport should log (default: level set on parent logger)`)})]})}):null}renderSyslog(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(qe,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].host,helperText:this.props.t(`The host running syslogd, defaults to localhost`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].host=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].port,type:`number`,helperText:this.props.t(`The port on the host that syslog is running on, defaults to syslogd's default port(514/UDP).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].port=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Port`)})}):null,this.state.transport[e].enabled?p(T,{children:S(o,{style:G.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Protocol`)}),S(P,{variant:`standard`,value:this.state.transport[e].protocol,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].protocol=t.target.value,this.setState({transport:n},()=>this.onChange())},children:[p(M,{value:`udp4`,children:`udp4`}),p(M,{value:`tcp4`,children:`tcp4`}),p(M,{value:`unix`,children:`unix`}),p(M,{value:`unix-connect`,children:`unix-connect`})]})]})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].path,helperText:this.props.t(`The path to the syslog dgram socket (i.e. /dev/log or /var/run/syslog for OS X).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].path=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Path`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].facility,helperText:this.props.t(`Syslog facility to use (Default: local0).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].facility=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Facility`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].localhost,helperText:this.props.t(`Host to indicate that log messages are coming from (Default: localhost).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].localhost=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Log name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].sysLogType,helperText:this.props.t(`The type of the syslog protocol to use (Default: BSD).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].sysLogType=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`SysLog Type`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].app_name,helperText:this.props.t(`The name of the application (Default: process.title).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].app_name=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Application name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].eol,helperText:this.props.t(`The end of line character to be added to the end of the message (Default: Message without modifications).`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].eol=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`End of line char`)})}):null]})})]},e)}renderFile(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{style:{background:`rgba(128, 128, 128, 0.3)`},expandIcon:p(r,{}),children:[p(we,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].filename,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].filename=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].fileext,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].fileext=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File extension`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].maxSize,type:`number`,helperText:this.props.t(`MB`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].maxSize=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Maximal size of one file`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].maxFiles,type:`number`,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].maxFiles=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Maximal number of files`)})}):null]})})]},e)}renderHttp(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(n,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].host,helperText:this.props.t(`Remote host of the HTTP logging endpoint`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].host=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Host`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].port,type:`number`,helperText:this.props.t(`Remote port of the HTTP logging endpoint`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].port=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Port`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].path,helperText:this.props.t(`Remote URI of the HTTP logging endpoint`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].path=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Path`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].auth,helperText:this.props.t(`An object representing the username and password for HTTP Basic Auth`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].auth=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Auth`)})}):null,this.state.transport[e].enabled?p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.transport[e].ssl,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].ssl=t.target.checked,this.setState({transport:n},()=>this.onChange())}}),label:this.props.t(`SSL`)})}):null]})})]},e)}renderStream(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(ve,{style:G.headingIcon}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].stream,helperText:this.props.t(`any Node.js stream. If an objectMode stream is provided then the entire info object will be written. Otherwise info[MESSAGE] will be written`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].stream=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`File name`)})}):null,this.state.transport[e].enabled?p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.transport[e].silent,onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].silent=t.target.checked,this.setState({transport:n},()=>this.onChange())}}),label:this.props.t(`Silent`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].eol,helperText:this.props.t(`Line-ending character to use. (default: os.EOL).)`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].eol=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`EOL`)})}):null]})})]},e)}renderSEQ(e){return S(F,{expanded:this.state.expanded.includes(e),onChange:()=>{let t=[...this.state.expanded],n=t.indexOf(e);n===-1?t.push(e):t.splice(n,1),this.setState({expanded:t})},children:[S(ee,{expandIcon:p(r,{}),style:{position:`relative`,background:`rgba(128, 128, 128, 0.3)`},children:[p(`img`,{style:G.headingIcon,src:ht,alt:`seq`}),p(j,{style:G.heading,children:e}),p(ue,{size:`small`,style:G.delButton,onClick:()=>this.onDelete(e),children:p(d,{})})]}),p(_,{children:S(T,{container:!0,sx:{flexDirection:`column`},children:[this.renderEnabled(e),this.renderLogLevel(e),this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].serverUrl,helperText:this.props.t(`The http(s) URL including port of the seq server. If you use HTTPS a real certificate is needed; self signed certs are ot accepted.`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].serverUrl=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`Server URL`)})}):null,this.state.transport[e].enabled?p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.transport[e].apiKey,helperText:this.props.t(`The apiKey of the seq system`),onChange:t=>{let n=JSON.parse(JSON.stringify(this.state.transport));n[e].apiKey=t.target.value,this.setState({transport:n},()=>this.onChange())},label:this.props.t(`API key`)})}):null]})})]},e)}findFreeName(e){for(let t=1;;t++)if(!Object.keys(this.state.transport).find(n=>n===e+t))return e+t}add(e){if(e===`file`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,filename:`log/iobroker`,fileext:`.log`,maxSize:0,maxFiles:0},this.setState({transport:n},()=>this.onChange())}else if(e===`syslog`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,host:`127.0.0.1`,port:0,protocol:`udp4`,path:``,facility:``,localhost:`iobroker`,sysLogType:``,app_name:``,eol:``},this.setState({transport:n},()=>this.onChange())}else if(e===`http`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,host:`127.0.0.1`,port:80,path:`/`,auth:`None`,ssl:!1},this.setState({transport:n},()=>this.onChange())}else if(e===`stream`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,stream:`/dev/null`,level:`info`,silent:!1,eol:``},this.setState({transport:n},()=>this.onChange())}else if(e===`seq`){let t=this.findFreeName(e),n=JSON.parse(JSON.stringify(this.state.transport));n[t]={type:e,enabled:!0,level:`info`,serverUrl:`http://IP:PORT`,apiKey:``},this.setState({transport:n},()=>this.onChange())}}render(){return S(A,{style:G.paper,children:[p(T,{sx:G.gridSettings,children:S(T,{container:!0,sx:{flexDirection:`column`},children:[p(T,{children:S(o,{style:G.controlItem,variant:`standard`,children:[p(m,{children:this.props.t(`Level`)}),S(P,{variant:`standard`,value:this.state.level,onChange:e=>this.setState({level:e.target.value},()=>this.onChange()),children:[p(M,{value:`silly`,children:`silly`}),p(M,{value:`debug`,children:`debug`}),p(M,{value:`info`,children:`info`}),p(M,{value:`warn`,children:`warn`}),p(M,{value:`error`,children:`error`})]})]})}),p(T,{children:p(k,{variant:`standard`,style:G.controlItem,value:this.state.maxDays,helperText:this.props.t(`Every day one file`),type:`number`,onChange:e=>this.setState({maxDays:e.target.value},()=>this.onChange()),label:this.props.t(`Maximum number of days`)})}),p(T,{children:p(C,{style:G.controlItem,control:p(v,{checked:this.state.noStdout,onChange:e=>this.setState({noStdout:e.target.checked},()=>this.onChange())}),label:this.props.t(`No stdout outputs`)})}),Object.keys(this.state.transport).map(e=>{switch(this.state.transport[e].type){case`syslog`:return this.renderSyslog(e);case`file`:return this.renderFile(e);case`http`:return this.renderHttp(e);case`stream`:return this.renderStream(e);case`seq`:return this.renderSEQ(e);default:return null}})]})}),S(Se,{children:[S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`file`),startIcon:p(s,{}),children:[p(we,{style:G.buttonIcon}),this.props.t(`File log`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`syslog`),startIcon:p(s,{}),children:[p(qe,{style:G.buttonIcon}),this.props.t(`Syslog`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`http`),startIcon:p(s,{}),children:[p(n,{style:G.buttonIcon}),this.props.t(`HTTP log`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`stream`),startIcon:p(s,{}),children:[p(ve,{style:G.buttonIcon}),this.props.t(`Stream log`)]}),S(R,{color:`grey`,style:G.addButton,variant:`contained`,onClick:()=>this.add(`seq`),startIcon:p(s,{}),children:[p(`img`,{src:ht,style:G.buttonIcon,alt:`seq`}),this.props.t(`SEQ log`)]})]})]})}},_t={paper:{height:`100%`,maxHeight:`100%`,maxWidth:`100%`,overflow:`auto`,padding:8},title:{width:`100%`,height:32},divWithoutTitle:{width:`100%`,height:`calc(100% - 32px)`,border:`2px solid #00000000`},error:{border:`2px solid #FF0000`}},vt=class extends L{constructor(e){super(e),this.state={settings:JSON.stringify(this.props.settings||{},null,2),error:!1}}onChange(e){let t={settings:e};try{let n=JSON.parse(e);this.state.error&&(t.error=!1),this.setState(t,()=>this.props.onChange(n))}catch{t.error=!0,this.setState(t)}}render(){return S(A,{style:_t.paper,children:[p(`div`,{style:_t.title,children:this.props.t(`For future use`)}),p(`div`,{style:{..._t.divWithoutTitle,...this.state.error?_t.error:void 0},children:p(Xe,{themeType:this.props.themeType,value:this.state.settings,onChange:e=>this.onChange(e)})})]})}};l();var K={content:{height:500,overflow:`hidden`},tabPanel:e=>({width:`100%`,height:`calc(100% - ${e.mixins.toolbar.minHeight}px)`,overflow:`auto`}),selected:e=>({color:e.palette.mode===`dark`?`#FFF !important`:`#222 !important`})},yt=[`system`,`multihost`,`objects`,`states`,`log`,`plugins`],bt=class extends L{constructor(e){super(e),b(this,`originalSettings`,void 0);let t=a.getLocation(),n=t.tab===`tab-hosts`&&t.dialog===`base-settings`&&t.id===e.currentHost?yt.indexOf(t.arg):-1;this.state={currentTab:n>=0?n:0,hasChanges:[],currentHost:this.props.currentHost,loading:!0,confirmExit:!1,showRestart:!1,system:null,multihostService:null,objects:null,states:null,log:null,plugins:null,dnsResolution:`ipv4first`,dataDir:``,saving:!1}}isRouted(){let e=a.getLocation();return e.tab===`tab-hosts`&&e.dialog===`base-settings`&&e.id===this.props.currentHost}async componentDidMount(){await this.getSettings(this.state.currentHost),this.isRouted()&&a.getLocation().arg!==yt[this.state.currentTab]&&a.doNavigate(null,null,null,yt[this.state.currentTab])}renderDialogConfirm(){return this.state.confirmExit?p(Le,{text:this.props.t(`Discard unsaved changes?`),onClose:e=>this.setState({confirmExit:!1},()=>e&&this.props.onClose())}):null}renderRestartDialog(){return this.state.showRestart?p(Le,{title:this.props.t(`Please confirm`),text:S(w,{children:[p(`div`,{children:this.props.t(`Restart works only if controller started as system service.`)}),p(`div`,{children:this.props.t(`Would you like to restart the controller for your changes to take effect?`)})]}),ok:this.props.t(`Restart`),cancel:this.props.t(`No restart`),onClose:e=>this.setState({showRestart:!1},()=>{e&&this.props.socket.restartController(this.props.currentHost).then(()=>setTimeout(()=>window.location.reload(),500)).catch(e=>window.alert(`Cannot restart: ${e}`)),this.props.onClose()})}):null}async getSettings(e){let t=await this.props.socket.readBaseSettings(e||this.state.currentHost);t!=null&&t.config&&(this.originalSettings=z.clone(t.config),this.setState({loading:!1,system:t.config.system,multihostService:t.config.multihostService,objects:t.config.objects,states:t.config.states,log:t.config.log,plugins:t.config.plugins,dnsResolution:t.config.dnsResolution||`ipv4first`,dataDir:t.config.dataDir}))}onSave(e){let t={system:this.state.system,multihostService:this.state.multihostService,objects:this.state.objects,states:this.state.states,log:this.state.log,plugins:this.state.plugins},n={...this.originalSettings,...t};this.setState({saving:!0},()=>{this.props.socket.writeBaseSettings(e||this.state.currentHost,n).then(()=>{this.originalSettings=JSON.parse(JSON.stringify(t)),this.setState({hasChanges:[],showRestart:!0,saving:!1})}).catch(e=>{window.alert(`Cannot save settings: ${e}`),this.setState({saving:!1})})})}updateSettings(e,t){let n=[...this.state.hasChanges],r=JSON.stringify(this.originalSettings[e])!==JSON.stringify(t),i=n.indexOf(e);r&&i===-1?n.push(e):!r&&i!==-1&&n.splice(i,1),this.setState({[e]:t,hasChanges:n})}renderSystem(){let e=`system`;return p(st,{settings:this.state[e]||{},t:this.props.t,currentHost:this.props.currentHost,onChange:t=>this.updateSettings(e,t)})}renderMultihost(){let e=`multihostService`;return p(ct,{settings:this.state[e]||{},t:this.props.t,socket:this.props.socket,onChange:t=>this.updateSettings(e,t)})}renderObjects(){let e=`objects`;return p(dt,{settings:this.state[e]||{},t:this.props.t,socket:this.props.socket,currentHost:this.props.currentHost,onChange:t=>this.updateSettings(e,t)})}renderStates(){let e=`states`;return p(mt,{settings:this.state[e]||{},t:this.props.t,socket:this.props.socket,currentHost:this.props.currentHost,onChange:t=>this.updateSettings(e,t)})}renderLog(){return p(gt,{settings:this.state.log||{},t:this.props.t,onChange:e=>this.updateSettings(`log`,e)})}renderPlugins(){let e=`plugins`;return p(vt,{settings:this.state[e]||{},t:this.props.t,themeType:this.props.themeType,onChange:t=>this.updateSettings(e,t)})}render(){return S(i,{style:K.dialog,open:!0,onClose:()=>!1,fullWidth:!0,maxWidth:`xl`,"aria-labelledby":`base-settings-dialog-title`,children:[S(oe,{id:`base-settings-dialog-title`,children:[this.props.t(`Host Base Settings`),`: `,this.props.currentHostName||this.props.currentHost]}),S(ie,{style:K.content,children:[p(Ee,{position:`static`,children:S(Ie,{value:this.state.currentTab,onChange:(e,t)=>{this.setState({currentTab:t}),this.isRouted()&&a.doNavigate(null,null,null,yt[t])},"aria-label":`system tabs`,indicatorColor:`secondary`,children:[p(ce,{label:this.props.t(`System`),id:`system-tab`,"aria-controls":`simple-tabpanel-0`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`Multi-host`),id:`multihost-tab`,sx:{"&.Mui-selected":K.selected},"aria-controls":`simple-tabpanel-1`}),p(ce,{label:this.props.t(`Objects`),id:`objects-tab`,"aria-controls":`simple-tabpanel-3`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`States`),id:`states-tab`,"aria-controls":`simple-tabpanel-4`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`Log`),id:`log-tab`,"aria-controls":`simple-tabpanel-5`,sx:{"&.Mui-selected":K.selected}}),p(ce,{label:this.props.t(`Plugins`),id:`plugins-tab`,"aria-controls":`simple-tabpanel-6`,sx:{"&.Mui-selected":K.selected}})]})}),this.state.loading?p(ge,{}):null,!this.state.loading&&this.state.currentTab===0?p(O,{component:`div`,sx:K.tabPanel,children:this.renderSystem()}):null,!this.state.loading&&this.state.currentTab===1?p(O,{component:`div`,sx:K.tabPanel,children:this.renderMultihost()}):null,!this.state.loading&&this.state.currentTab===2?p(O,{component:`div`,sx:K.tabPanel,children:this.renderObjects()}):null,!this.state.loading&&this.state.currentTab===3?p(O,{component:`div`,sx:K.tabPanel,children:this.renderStates()}):null,!this.state.loading&&this.state.currentTab===4?p(O,{component:`div`,sx:K.tabPanel,children:this.renderLog()}):null,!this.state.loading&&this.state.currentTab===5?p(O,{component:`div`,sx:K.tabPanel,children:this.renderPlugins()}):null,this.renderDialogConfirm(),this.renderRestartDialog()]}),S(De,{children:[p(R,{variant:`contained`,disabled:!this.state.hasChanges.length||this.state.saving,onClick:()=>this.onSave(),color:`primary`,startIcon:p(he,{}),children:this.props.t(`Save & Close`)}),p(R,{variant:`contained`,color:`grey`,disabled:this.state.saving,onClick:()=>this.state.hasChanges.length?this.setState({confirmExit:!0}):this.props.onClose(),startIcon:p(h,{}),children:this.state.hasChanges.length?this.props.t(`Cancel`):this.props.t(`Close`)})]})]})}};l();var q={error:{border:`2px solid #FF0000`},id:{fontStyle:`italic`},dialog:{height:`calc(100% - 64px)`},button:{marginTop:20,marginLeft:8},funcDivEdit:{width:`100%`},funcEditName:{display:`inline-block`,width:85},funcEdit:{width:400},marginTop:{marginTop:20},commonTabWrapper:{flexFlow:`wrap`,display:`flex`},commonWrapper:{width:500,minWidth:300},flexDrop:{width:`100%`,maxWidth:500,margin:`auto`,display:`flex`},marginBlock:{marginTop:20},buttonAdd:{minWidth:150},textField:{width:`100%`},flex:{display:`flex`},removeButton:{mt:`13px`,alignSelf:`flex-start`,flexShrink:0},color:{width:70},buttonRemoveWrapper:{position:`absolute`,zIndex:222,right:0},tabsPadding:{padding:`0px 24px`}},xt=class extends L{constructor(e){super(e),b(this,`originalObj`,void 0),this.state={text:JSON.stringify(this.props.obj,null,2),error:!1,changed:!1},this.originalObj=JSON.stringify(this.props.obj,null,2)}prepareObject(e){e||=this.state.text;try{let t=JSON.parse(e);return t._id=this.props.obj._id,t}catch{return null}}onChange(e){let t={text:e},n=this.prepareObject(e);n?(t.changed=this.originalObj!==JSON.stringify(n,null,2),this.state.error&&(t.error=!1)):t.error=!0,this.setState(t)}onUpdate(){try{let e=JSON.parse(this.state.text);e._id=this.props.obj._id,this.props.onClose(e)}catch{}}setCommonItem(e,t,n){e.common[t]=n,this.onChange(JSON.stringify(e,null,2))}removeCommonItem(e,t){delete e.common.common[t],this.onChange(JSON.stringify(e,null,2))}buttonAddKey(e,t){let{t:n}=this.props;return p(`div`,{style:q.marginBlock,children:p(R,{style:q.buttonAdd,variant:`contained`,color:`secondary`,onClick:t,startIcon:p(s,{}),children:n(`Add ${e}`)})})}buttonRemoveKey(e,t){let{t:n}=this.props;return p(N,{title:n(`Remove ${e}`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:p(g,{size:`small`,sx:q.removeButton,onClick:t,children:p(h,{})})})}renderCommonEdit(){try{let e=JSON.parse(this.state.text),{t}=this.props;return S(`div`,{style:q.commonTabWrapper,children:[S(`div`,{style:q.commonWrapper,children:[e.common.title===void 0?this.buttonAddKey(`title`,()=>this.setCommonItem(e,`title`,``)):p(k,{variant:`standard`,disabled:!1,label:t(`title`),style:{...q.marginBlock,...q.textField},fullWidth:!0,value:e.common.title,onChange:t=>this.setCommonItem(e,`title`,t.target.value),slotProps:{input:{endAdornment:e.common.title?p(Me,{position:`end`,children:p(g,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(e,`title`,``),children:p(h,{})})}):null}}}),e.common.color===void 0?this.buttonAddKey(`color`,()=>this.setCommonItem(e,`color`,``)):S(`div`,{style:q.flex,children:[p(k,{variant:`standard`,disabled:!1,style:{...q.marginBlock,...q.color},label:t(`Color`),type:`color`,value:e.common.color,onChange:t=>this.setCommonItem(e,`color`,t.target.value),slotProps:{input:{endAdornment:e.common.color?p(Me,{position:`end`,children:p(g,{tabIndex:-1,size:`small`,onClick:()=>this.setCommonItem(e,`color`,``),children:p(h,{})})}):null}}}),this.buttonRemoveKey(`color`,()=>this.removeCommonItem(e,`color`))]})]}),e.common.icon===void 0?p(`div`,{style:q.flexDrop,children:this.buttonAddKey(`icon`,()=>this.setCommonItem(e,`icon`,``))}):S(`div`,{style:q.flexDrop,children:[p(me,{disabled:!1,crop:!0,maxSize:262144,icon:e.common.icon,removeIconFunc:()=>this.setCommonItem(e,`icon`,``),onChange:t=>this.setCommonItem(e,`icon`,t)}),this.buttonRemoveKey(`icon`,()=>this.removeCommonItem(e,`icon`))]})]})}catch{return p(`div`,{children:this.props.t(`Cannot parse JSON!`)})}}render(){return S(i,{sx:{"& .MuiDialog-paper":q.dialog},open:!0,maxWidth:`lg`,fullWidth:!0,fullScreen:!1,onClose:()=>this.props.onClose(),"aria-labelledby":`edit-value-dialog-title`,"aria-describedby":`edit-value-dialog-description`,children:[S(oe,{id:`edit-value-dialog-title`,children:[this.props.t(`Edit host settings`),`:`,p(`span`,{style:q.id,children:this.props.obj._id})]}),p(ie,{children:this.renderCommonEdit()}),S(De,{children:[p(R,{variant:`contained`,disabled:this.state.error||!this.state.changed,onClick:()=>this.onUpdate(),color:`primary`,startIcon:p(he,{}),children:this.props.t(`Write`)}),p(R,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:p(h,{}),children:this.props.t(`Cancel`)})]})]})}};l();var St=`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)`,Ct=`0 8px 17px 0 rgba(0, 0, 0, .2),0 6px 20px 0 rgba(0, 0, 0, .19)`,wt=`
|
|
24
24
|
@keyframes newValueAnimationHostDark {
|
|
25
25
|
0% {
|
|
26
26
|
color: #00f900;
|
|
@@ -115,6 +115,6 @@ sudo -u iobroker -H npm install iobroker.js-controller`)},style:B.copyButton,chi
|
|
|
115
115
|
height: 160px;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
`,J={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`}},collapseOff:{height:0},footerBlock:e=>({background:e.palette.background.default,p:`10px`,display:`flex`,justifyContent:`space-between`}),hidden:{display:`none`},emptyButton:{width:48},greenText:e=>({color:e.palette.success.dark}),wrapperAvailable:{display:`flex`,alignItems:`center`},buttonUpdate:{border:`1px solid ${re[700]}`,padding:`2px 7px`,borderRadius:`5px`,display:`flex`,alignItems:`center`,cursor:`pointer`,transition:`background 0.5s`,"&:hover":{background:`#00800026`}},buttonUpdateIcon:{height:20,width:20,marginRight:10},debug:{backgroundColor:se[700]},info:{backgroundColor:fe[700]},warn:{backgroundColor:te[700]},error:{backgroundColor:We[700]},smallAvatar:{width:24,height:24},formControl:{display:`flex`},baseSettingsButton:{transform:`rotate(45deg)`},tooltip:{pointerEvents:`none`}},Tt=[`silly`,`debug`,`info`,`warn`,`error`];function Et(e,t){let n=e.className.split(` `),r=n.indexOf(t);r!==-1&&(n.splice(r,1),e.className=n.join(` `)),n.push(t),setTimeout(t=>e.className=t,100,n.join(` `))}function Dt(e){return e===`debug`?p(
|
|
119
|
-
`)),window.alert(this.props.t(`Copied`))}renderUpdateButton(e,t){return e?p(N,{title:this.props.t(`Update`),slotProps:{popper:{sx:J.tooltip}},children:S(O,{component:`div`,onClick:e=>(e.stopPropagation(),this.openHostUpdateDialog()),sx:J.buttonUpdate,children:[p(g,{style:J.buttonUpdateIcon,size:`small`,children:p(ze,{})}),p(`span`,{style:{color:re[700]},children:this.props.available})]})}):p(`span`,{style:t,children:this.props.available})}renderHostBaseEdit(){return this.props.expertMode?p(N,{title:this.props.t(`Host Base Settings`),slotProps:{popper:{sx:J.tooltip}},children:p(`div`,{children:p(g,{size:`large`,disabled:!this.props.alive,onClick:e=>{e.stopPropagation(),a.doNavigate(`tab-hosts`,`base-settings`,this.props.hostId)},children:p(pe,{style:J.baseSettingsButton})})})}):null}renderExtendButton(e){return p(N,{title:this.props.t(e?`collapse`:`Expand`),slotProps:{popper:{sx:J.tooltip}},children:p(`div`,{children:p(g,{size:`large`,children:p(e?u:ae,{})})})})}renderRestartButton(){return p(N,{title:this.props.t(`Restart host`),slotProps:{popper:{sx:J.tooltip}},children:p(`div`,{children:p(g,{size:`large`,disabled:!this.props.alive,onClick:e=>{e.stopPropagation(),this.props.socket.restartController(this.props.hostId).catch(e=>window.alert(`Cannot restart: ${e}`))},children:p(
|
|
120
|
-
`),r=``,i=!1;for(let e=0;e<n.length;e++)if(n[e].startsWith(`## `)){if(i)break;n[e].startsWith(`## ${t}`)&&(i=!0)}else i&&(r+=`${n[e].replace(/^\*\s*/,``).replace(/^\(\w+\)\s*/,``)}\n`);return r}getNews(t){let n=this.props.jsControllerInfo,r=this.props.host.common.installedVersion,i=[],a=n==null?void 0:n.news;return r&&a&&Object.keys(a).forEach(n=>{try{if(Ne.gt(n,r)||t){let t=!1,r=this.props.noTranslation?a[n].en:a[n][this.props.lang]||a[n].en;if(a[n].en===`see CHANGELOG.md`&&this.state.changeLog){let i=e.extractNews(this.state.changeLog,n);i&&(r=i,t=!0)}i.push({version:n,news:r,downloaded:t})}}catch{console.warn(`Cannot compare "${n}" and "${r}" of js-controller on ${this.props.host._id}`)}}),i}baseSettingsSettingsDialog(){return this.state.baseSettingsDialog?p(bt,{currentHost:this.props.hostId,themeType:this.props.themeType,currentHostName:this.props.host.common.name,onClose:()=>a.doNavigate(`tab-hosts`),socket:this.props.socket,t:this.props.t},`base`):null}renderEditObjectDialog(){return this.state.editDialog?p(xt,{obj:this.props.host,t:this.props.t,onClose:e=>{a.doNavigate(`tab-hosts`),e&&this.props.socket.setObject(e._id,e).then(()=>this.forceUpdate()).catch(e=>alert(`Cannot write object: ${e}`))}}):null}renderDialogs(){return S(w,{children:[this.renderDialogLogLevel(),this.renderHostUpdateDialog(),this.renderUpdateDialog(),this.renderEditObjectDialog(),this.baseSettingsSettingsDialog()]})}};b(Y,`formatInfo`,{Uptime:z.formatSeconds,"System uptime":z.formatSeconds,RAM:z.formatRam,Speed:z.formatSpeed,"Disk size":z.formatBytes,"Disk free":z.formatBytes,time:e=>new Date(e).toLocaleString()});var X={...J,root:e=>({position:`relative`,m:`10px`,width:300,minHeight:200,background:e.palette.background.default,boxShadow:St,display:`flex`,flexDirection:`column`,transition:`box-shadow 0.5s`,"&:hover":{boxShadow:Ct},"& .warning":{backgroundColor:`#de0000 !important`,"&:before":{position:`absolute`,right:0,top:-5,content:`"⚠"`,fontSize:25,height:`30px`,width:`30px`,color:`black`},animation:`$warning 2.5s ease-in-out infinite alternate`}}),imageBlock:{minHeight:60,display:`flex`,padding:`0 10px 0 10px`,position:`relative`,justifyContent:`space-between`,transition:`background 0.5s`},fab:{position:`absolute`,bottom:-20,width:40,height:40,right:20},collapse:{height:`100%`,position:`absolute`,width:`100%`,zIndex:3,marginTop:`auto`,bottom:0,transition:`height 0.3s`,justifyContent:`space-between`,display:`flex`,flexDirection:`column`},collapseOff:{height:0},close:{display:`flex`,ml:`auto`,mt:`-4px`},onOffLine:{alignSelf:`center`,width:`100%`,height:4},adapter:e=>({width:`100%`,fontWeight:`bold`,fontSize:16,verticalAlign:`middle`,pl:1,pt:2,color:e.palette.mode===`dark`?`#333`:`#555`}),cardContentInfo:e=>({overflow:`auto`,paddingTop:0,backgroundColor:e.palette.background.paper,color:e.palette.mode===`dark`?`#EEE`:`#111`}),cardContentH5:{height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,paddingBottom:`10px !important`},marginTop10:{marginTop:10},displayFlex:{display:`flex`},marginLeft5:{marginLeft:5},enableButton:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},instanceStateNotAlive1:{backgroundColor:`rgba(192, 192, 192, 0.4)`},green:{background:`#00ce00`,position:`relative`},red:{background:`#da0000`},dotLine:{width:50,height:`100%`,background:`linear-gradient(90deg, rgba(0,206,0,0.7497373949579832) 0%, rgba(31,255,1,1) 50%, rgba(0,206,0,0.7805497198879552) 100%)`,zIndex:2,position:`absolute`,left:-11},versionDate:{alignSelf:`center`},cardContentDiv:{position:`sticky`,right:0,top:0,paddingTop:10},badge:{cursor:`pointer`},curdContentFlexCenter:{display:`flex`,alignItems:`center`,ml:`4px`},marginRight:{marginRight:`auto`},ul:{paddingTop:0,paddingBottom:0,paddingLeft:16,paddingRight:8},value:{marginLeft:5},label:{fontWeight:`bold`}},Ot=class extends Y{getHostDescriptionAll(){return this.props.hostData?typeof this.props.hostData==`string`?this.props.hostData:!this.props.hostData||typeof this.props.hostData!=`object`?p(`ul`,{style:X.ul,children:p(ke,{})},`ul`):p(`ul`,{style:X.ul,children:Object.keys(this.props.hostData).map(e=>p(`li`,{children:S(`span`,{style:X.black,children:[S(`span`,{style:X.label,children:[this.props.t(e),`: `]}),p(`span`,{style:X.value,children:Y.formatInfo[e]?Y.formatInfo[e](this.props.hostData[e],this.props.t):this.props.hostData[e]||`--`})]})},e))},`ul`):p(ke,{})}render(){let e=(this.props.isCurrentHost||this.props.alive)&&z.updateAvailable(this.props.host.common.installedVersion,this.props.available),t=this.getHostDescriptionAll();return S(He,{sx:E.getStyle(this.props.theme,X.root,this.props.hidden&&X.hidden),children:[this.renderDialogs(),this.state.openCollapse&&S(`div`,{style:{...X.collapse,...this.state.openCollapse?void 0:X.collapseOff},children:[S(c,{sx:X.cardContentInfo,children:[p(`div`,{style:X.cardContentDiv,onClick:()=>this.setState({openCollapse:!1}),children:p(g,{size:`small`,sx:X.close,onClick:()=>this.setState({openCollapse:!1}),children:p(h,{})})}),t,p(nt,{socket:this.props.socket,hostId:this.props.hostId,t:this.props.t})]}),p(O,{component:`div`,sx:X.footerBlock})]}),p(`div`,{style:{...X.onOffLine,...this.props.alive?X.green:X.red},children:this.props.alive&&p(`div`,{style:X.dotLine})}),S(`div`,{ref:this.refWarning,style:{...X.imageBlock,...this.props.alive?void 0:X.instanceStateNotAlive1,background:this.props.host.common.color||`inherit`},children:[p(Be,{sx:X.img,component:`img`,image:this.props.host.common.icon||`img/no-image.svg`}),p(O,{component:`div`,style:E.getStyle(this.props.theme,X.adapter,{color:this.props.host.common.color&&E.invertColor(this.props.host.common.color,!0)||`inherit`}),children:this.renderNotificationsBadge(this.props.host.common.name,!0)}),this.state.openCollapse?null:p(ue,{onClick:()=>this.setState({openCollapse:!0}),style:X.fab,color:`primary`,"aria-label":`add`,title:this.props.t(`Click for more`),children:p(Re,{})})]}),S(c,{style:X.cardContentH5,children:[p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[p(`span`,{style:X.label,children:`CPU:`}),p(`div`,{ref:this.refCpu,style:X.value,children:`- %`})]})}),p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[p(`span`,{style:X.label,children:`RAM:`}),p(`div`,{ref:this.refMem,style:X.value,children:`- %`})]})}),p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[S(`span`,{style:X.label,children:[this.props.t(`Uptime`),`:`]}),p(`div`,{ref:this.refUptime,style:X.value,children:`-d -h`})]})}),S(j,{variant:`body2`,color:`textSecondary`,component:`div`,style:X.wrapperAvailable,children:[S(`span`,{style:X.label,children:[this.props.t(`Available`),` js-controller:`]}),p(O,{component:`div`,sx:{...e?X.greenText:void 0,...X.curdContentFlexCenter},children:this.renderUpdateButton(e)})]}),S(j,{variant:`body2`,color:`textSecondary`,component:`p`,children:[S(`span`,{style:X.label,children:[this.props.t(`Installed`),` js-controller:`]}),p(`span`,{style:X.value,children:this.props.host.common.installedVersion})]}),p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[S(`span`,{style:X.label,children:[this.props.t(`Events`),`:`]}),p(`div`,{ref:this.refEvents,style:X.value,children:`- / -`})]})}),p(`div`,{style:X.marginTop10,children:S(j,{component:`span`,style:X.enableButton,children:[this.renderEditButton(),this.renderHostBaseEdit(),this.renderRestartButton(),this.props.expertMode&&this.state.logLevel&&this.renderLogLevel(),this.renderRemoveButton(),this.renderCopyButton()]})})]})]},this.props.hostId)}},Z={...J,root:e=>({position:`relative`,m:`7px`,background:e.palette.background.default,boxShadow:St,overflow:`hidden`,transition:`box-shadow 0.5s,height 0.3s`,"&:hover":{boxShadow:Ct}}),imageBlock:{marginRight:6,minHeight:60,width:`100%`,maxWidth:300,display:`flex`,padding:`0 10px 0 10px`,position:`relative`,justifyContent:`space-between`,transition:`background 0.5s`,alignItems:`baseline`},collapse:{height:`auto`,backgroundColor:`rgba(128, 128, 128, 0.1)`,width:`100%`,zIndex:3,marginTop:`auto`,bottom:0,justifyContent:`space-between`,display:`flex`,flexDirection:`column`},onOff:{alignSelf:`center`,width:4,height:`100%`},host:e=>({width:`100%`,fontWeight:`bold`,fontSize:16,paddingLeft:`8px`,alignSelf:`center`,color:e.palette.mode===`dark`?`#ddd`:`#222`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`}),cardContentH5:{height:`100%`,display:`flex`,width:`100%`,justifyContent:`space-between`,padding:`10px !important`,alignItems:`center`},marginTop10:{marginLeft:`auto`,display:`flex`},enableButton:{display:`flex`,justifyContent:`space-between`},green:{background:`#00ce00`,position:`relative`,overflow:`hidden`},dotLine:{width:10,height:20,background:`linear-gradient( rgba(0,206,0,0.7497373949579832) 0%, rgba(31,255,1,1) 50%, rgba(0,206,0,0.7805497198879552) 100%)`,zIndex:2,position:`absolute`,top:-21},red:{background:`#da0000`},flex:{flex:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},cardContentInfo:{overflow:`auto`,paddingTop:0,justifyContent:`center`,display:`flex`,height:`auto`,flexShrink:0,position:`relative`},cursorNoDrop:{cursor:`no-drop !important`},wrapperFlex:{display:`flex`,cursor:`pointer`,"& .warning":{backgroundColor:`#de0000 !important`,"&:before":{position:`absolute`,right:0,top:-5,content:`"⚠"`,fontSize:25,height:`30px`,width:`30px`,color:`black`},animation:`$warning 2.5s ease-in-out infinite alternate`},"@media screen and (max-width: 500px)":{flexDirection:`column`}},wrapperColor:{position:`relative`,overflow:`hidden`},hidden1100:{"@media screen and (max-width: 1100px)":{display:`none !important`}},hidden800:{"@media screen and (max-width: 800px)":{display:`none !important`}},hidden600:{"@media screen and (max-width: 600px)":{display:`none !important`}},badge:{top:14},curdContentFlexCenter:{display:`flex`,alignItems:`center`},wrapperInfo:{display:`flex`,flexFlow:`wrap`,width:`100%`,justifyContent:`space-around`},wrapperBlockItem:{display:`flex`,flexFlow:`nowrap`,whiteSpace:`nowrap`,margin:10},bold:{fontWeight:`bold`},nowrap:{display:`flex`,flexFlow:`nowrap`,flex:1,whiteSpace:`nowrap`,marginRight:5},cell:{}},kt=class extends Y{renderValue(e){return typeof this.props.hostData==`object`?S(`div`,{style:Z.wrapperBlockItem,children:[S(`span`,{style:{...Z.bold,...Z.nowrap},children:[this.props.t(e),`: `]}),Y.formatInfo[e]?Y.formatInfo[e](this.props.hostData[e],this.props.t):this.props.hostData[e]||`--`]},e):null}getHostDescriptionAll(){return this.props.hostData?typeof this.props.hostData==`string`?this.props.hostData:S(`div`,{style:Z.wrapperInfo,children:[p(`div`,{style:Z.marginRight,children:this.props.hostData&&typeof this.props.hostData==`object`?Object.keys(this.props.hostData).map((e,t)=>t<=5&&this.renderValue(e)):p(ke,{})}),p(`div`,{style:Z.marginRight,children:this.props.hostData&&typeof this.props.hostData==`object`?Object.keys(this.props.hostData).map((e,t)=>t>5&&t<12&&this.renderValue(e)):p(ke,{})}),p(`div`,{style:Z.marginRight,children:this.props.hostData&&typeof this.props.hostData==`object`?Object.keys(this.props.hostData).map((e,t)=>t>=12&&this.renderValue(e)):p(ke,{})})]}):p(ke,{})}render(){let e=(this.props.isCurrentHost||this.props.alive)&&z.updateAvailable(this.props.host.common.installedVersion,this.props.available),t=this.getHostDescriptionAll();return S(O,{component:`div`,sx:E.getStyle(this.props.theme,Z.root,this.props.hidden&&Z.hidden,{border:`2px solid ${this.props.host.common.color||`inherit`}`,borderRadius:`5px`}),children:[this.renderDialogs(),S(O,{component:`div`,sx:{...Z.wrapperFlex,...this.props.alive?void 0:Z.cursorNoDrop},onClick:this.state.openDialogLogLevel?void 0:()=>this.setState({openCollapse:!this.state.openCollapse}),children:[S(`div`,{style:Z.wrapperColor,children:[p(`div`,{style:{...Z.onOff,...this.props.alive?Z.green:Z.red}}),this.props.alive&&p(`div`,{style:Z.dotLine})]}),S(`div`,{ref:this.refWarning,style:{...Z.imageBlock,background:this.props.host.common.color||`inherit`},children:[this.renderNotificationsBadge(p(Be,{sx:Z.img,component:`img`,image:this.props.host.common.icon||`img/no-image.svg`}),!0),p(`div`,{style:E.getStyle(this.props.theme,Z.host,{color:this.props.host.common.color&&E.invertColor(this.props.host.common.color,!0)||`inherit`}),children:this.props.host.common.name})]}),S(c,{sx:{"&.MuiCardContent-root":Z.cardContentH5},children:[p(j,{sx:{...Z.flex,...Z.hidden800,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refCpu,children:`- %`})}),p(j,{sx:{...Z.flex,...Z.hidden800,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refMem,children:`- %`})}),p(j,{sx:{...Z.flex,...Z.hidden800,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refUptime,children:`-/-`})}),p(j,{sx:{...Z.flex,...Z.hidden1100},variant:`body2`,color:`textSecondary`,component:`p`,children:this.props.host.common.installedVersion}),p(j,{sx:{...Z.flex,...Z.hidden1100,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(O,{component:`div`,sx:{...e?Z.greenText:void 0,...Z.curdContentFlexCenter},children:this.renderUpdateButton(e)})}),p(j,{sx:{...Z.flex,...Z.hidden600,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refEvents,children:`- / -`})}),p(`div`,{style:Z.marginTop10,children:S(j,{component:`span`,style:Z.enableButton,children:[this.renderEditButton(),this.renderHostBaseEdit(),this.renderRestartButton(),this.props.expertMode&&this.state.logLevel?this.renderLogLevel():p(`div`,{style:Z.emptyButton}),this.renderRemoveButton(),this.renderExtendButton(!!this.state.openCollapse)]})})]})]}),this.state.openCollapse?S(`div`,{style:Z.collapse,onClick:e=>e.stopPropagation(),children:[p(c,{style:Z.cardContentInfo,children:typeof t==`object`?S(w,{children:[t,this.renderCopyButton({height:44,width:44})]}):p(j,{variant:`body2`,color:`textSecondary`,children:t})}),p(nt,{socket:this.props.socket,hostId:this.props.hostId,t:this.props.t}),p(O,{component:`div`,sx:Z.footerBlock})]}):null]},this.props.hostId)}};l();var Q={grow:{flexGrow:1},cards:{display:`flex`,flexFlow:`wrap`,justifyContent:`center`},tabHeaderWrapper:{height:30,display:`flex`,margin:7},tabHeaderFirstItem:{width:306,paddingLeft:30,fontSize:14,fontWeight:600,alignSelf:`center`},tabHeaderItem:{flex:1,fontSize:14,fontWeight:600,alignSelf:`center`},tabHeaderItemButton:{fontSize:14,fontWeight:600,alignSelf:`center`},widthButtons:{width:240},tabFlex:{display:`flex`,flex:1,padding:`0 10px`},bold:{fontWeight:`bold`},marginRight:{marginRight:`auto`},hidden1100:{"@media screen and (max-width: 1100px)":{display:`none !important`}},hidden800:{"@media screen and (max-width: 800px)":{display:`none !important`}},hidden600:{"@media screen and (max-width: 600px)":{display:`none !important`}},jsController:{fontSize:12,opacity:.4,display:`block`,whiteSpace:`nowrap`},tooltip:{pointerEvents:`none`}},$={};function At(e){var t;if((t=e.dockerInformation)!=null&&t.isDocker){let t=e.dockerInformation.isOfficial?`official image`:`unofficial image`;e.dockerInformation.isOfficial&&(t+=` - ${e.dockerInformation.officialVersion}`),e.Platform=`${e.Platform} (${t})`}delete e.dockerInformation}var jt=class extends L{constructor(e){super(e),b(this,`t`,(e,t,n)=>(t!==void 0&&n!==void 0&&!$[`${e} ${t} ${n}`]?$[`${e} ${t} ${n}`]=this.props.t(e,t,n):t!==void 0&&!$[`${e} ${t}`]?$[`${e} ${t}`]=this.props.t(e,t):$[e]||($[e]=this.props.t(e)),t!==void 0&&n!==void 0?$[`${e} ${t} ${n}`]:t===void 0?$[e]:$[`${e} ${t}`])),b(this,`updateHosts`,e=>{let t=JSON.parse(JSON.stringify(this.state.hosts)),n=JSON.parse(JSON.stringify(this.state.alive));Promise.all(e.map(async e=>{let r=t.findIndex(t=>t._id===e.id);if(r!==-1)e.obj?t[r]=e.obj:t.splice(r,1);else{let r=await this.props.socket.getState(`${e.id}.alive`);n[e.id]=!!(r!=null&&r.val),t.push(e.obj)}})).then(()=>{let e={hosts:t,alive:n};this.state.filterText&&t.length<=2&&(e.filterText=``),this.setState(e)})}),b(this,`updateHostsAlive`,e=>{let t=JSON.parse(JSON.stringify(this.state.alive)),n=!1;e.forEach(e=>{e.type===`deleted`?t[e.id]!==void 0&&(delete t[e.id],n=!0):!!t[e.id]!=!!e.alive&&(t[e.id]=e.alive,n=!0)}),n&&this.setState({alive:t})}),this.state={viewMode:(window._localStorage||window.localStorage).getItem(`Hosts.viewMode`)===`true`,alive:{},hosts:[],repository:{},hostsData:{},filterText:(window._localStorage||window.localStorage).getItem(`Hosts.filterText`)||``,showSlowConnectionWarning:!1,readTimeoutMs:qe.getReadTimeoutMs()}}componentDidMount(){this.readInfo().then(()=>{this.props.hostsWorker.registerHandler(this.updateHosts),this.props.hostsWorker.registerAliveHandler(this.updateHostsAlive)})}componentWillUnmount(){this.props.hostsWorker.unregisterHandler(this.updateHosts),this.props.hostsWorker.unregisterAliveHandler(this.updateHostsAlive)}getHostsData(e,t){let n=[];for(let r=0;r<e.length;r++)if(t[e[r]._id]){let t=this.props.socket.getHostInfo(e[r]._id,void 0,this.state.readTimeoutMs).catch(t=>(console.error(`Cannot get getHostInfo: ${t}`),t.toString().includes(`timeout`)&&this.setState({showSlowConnectionWarning:!0}),{id:e[r]._id,data:t.toString()})).then(t=>(At(t),{id:e[r]._id,data:t}));n.push(t)}else n.push(Promise.resolve({id:e[r]._id,data:`offline`}));return Promise.all(n).then(e=>{let t={};return e.forEach(e=>t[e.id]=e.data),t})}async readInfo(){try{let e=await this.props.socket.getHosts(!0),t=await Ke(this.props.socket,this.props.currentHost,{update:!1,lang:this.props.lang,adapters:[`js-controller`]},!1,this.state.readTimeoutMs),n=JSON.parse(JSON.stringify(this.state.alive));for(let t=0;t<e.length;t++){let r=await this.props.socket.getState(`${e[t]._id}.alive`);n[e[t]._id]=r?!!r.val:!1}let r={alive:n,hosts:e,hostsData:await this.getHostsData(e,n),repository:t};this.state.filterText&&e.length<=2&&(r.filterText=``),this.setState(r)}catch(e){window.alert(`Cannot getRepository: ${e}`),e.toString().includes(`timeout`)&&this.setState({showSlowConnectionWarning:!0})}}getPanelsOrRows(){let e=this.renderHosts().filter(e=>e);return e.length?e:this.t(`All items are filtered out`)}renderSlowConnectionWarning(){return this.state.showSlowConnectionWarning?p(qe,{readTimeoutMs:this.state.readTimeoutMs,t:this.t,onClose:async e=>{this.setState({showSlowConnectionWarning:!1}),e&&(this.setState({readTimeoutMs:e}),await this.readInfo())}}):null}renderHosts(){return this.state.hosts.map(e=>{var t;if(this.state.filterText&&!e.common.name.toLowerCase().includes(this.state.filterText.toLowerCase()))return null;let n=this.state.viewMode?Ot:kt;return p(n,{adminInstance:this.props.adminInstance,alive:this.state.alive[e._id],available:((t=this.state.repository[`js-controller`])==null?void 0:t.version)||`-`,executeCommandRemove:()=>this.props.executeCommand(`host remove ${e.common.name}`),expertMode:this.props.expertMode,host:e,hostData:this.state.hostsData[e._id],hostId:e._id,hostsWorker:this.props.hostsWorker,isCurrentHost:this.props.currentHost===e._id,jsControllerInfo:this.state.repository[`js-controller`],lang:this.props.lang,noTranslation:this.props.noTranslation,onUpdating:this.props.onUpdating,showAdaptersWarning:this.props.showAdaptersWarning,socket:this.props.socket,systemConfig:this.props.systemConfig,t:this.t,theme:this.props.theme,themeType:this.props.themeType,toggleTranslation:this.props.toggleTranslation},e._id)})}renderTableHeader(){let e=window.innerWidth<100?10:window.innerWidth<1200?12:14;return S(`div`,{style:Q.tabHeaderWrapper,children:[p(`div`,{style:Q.tabHeaderFirstItem,children:this.t(`Name:`)}),S(`div`,{style:Q.tabFlex,children:[p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden800,{fontSize:e}),children:`CPU`}),p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden800,{fontSize:e}),children:`RAM`}),p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden800,{fontSize:e}),children:this.t(`Uptime`)}),S(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden1100,{fontSize:e}),children:[this.t(`Installed`),p(`div`,{style:Q.jsController,children:`js-controller`})]}),S(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden1100,{fontSize:e}),children:[this.t(`Available`),p(`div`,{style:Q.jsController,children:`js-controller`})]}),p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden600,{fontSize:e}),children:this.t(`Events`)}),p(`div`,{style:{...Q.tabHeaderItemButton,width:this.props.expertMode?292:244}})]})]})}render(){return this.state.hosts.length?S(ne,{children:[p(`style`,{children:wt}),this.renderSlowConnectionWarning(),S(Ue,{children:[p(N,{title:this.t(`Show / hide List`),slotProps:{popper:{sx:Q.tooltip}},children:p(g,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Hosts.viewMode`,this.state.viewMode?`false`:`true`),this.setState({viewMode:!this.state.viewMode})},children:this.state.viewMode?p(Pe,{}):p(Xe,{})})}),p(N,{title:this.t(`Reload`),slotProps:{popper:{sx:Q.tooltip}},children:p(g,{size:`large`,onClick:()=>this.forceUpdate(),children:p(ze,{})})}),p(`div`,{style:Q.grow}),this.state.hosts.length>2?p(k,{variant:`standard`,label:this.t(`Filter`),style:{margin:`5px 0`},value:this.state.filterText,onChange:e=>{(window._localStorage||window.localStorage).setItem(`Hosts.viewMode`,e.target.value),this.setState({filterText:e.target.value})},slotProps:{input:{endAdornment:this.state.filterText?p(Me,{position:`end`,children:p(g,{tabIndex:-1,size:`small`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Hosts.viewMode`,``),this.setState({filterText:``})},children:p(h,{})})}):null}}}):null,p(`div`,{style:Q.grow})]}),S(de,{overflow:`auto`,children:[!E.isStableRepository(this.props.systemConfig.common.activeRepo)&&String(this.props.systemConfig.common.activeRepo||``).toLowerCase()!==`nexowatt`?p(O,{sx:{marginX:2,width:`calc(100% - 32px)`,alignSelf:`center`},children:p(Oe,{type:`warning`,children:this.t(`Active repo is "%s"`,this.props.systemConfig.common.activeRepo)})}):null,S(`div`,{style:this.state.viewMode?Q.cards:void 0,children:[!this.state.viewMode&&this.renderTableHeader(),this.getPanelsOrRows()]})]})]}):p(ge,{})}};export{jt as default};
|
|
118
|
+
`,J={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`}},collapseOff:{height:0},footerBlock:e=>({background:e.palette.background.default,p:`10px`,display:`flex`,justifyContent:`space-between`}),hidden:{display:`none`},emptyButton:{width:48},greenText:e=>({color:e.palette.success.dark}),wrapperAvailable:{display:`flex`,alignItems:`center`},buttonUpdate:{border:`1px solid ${re[700]}`,padding:`2px 7px`,borderRadius:`5px`,display:`flex`,alignItems:`center`,cursor:`pointer`,transition:`background 0.5s`,"&:hover":{background:`#00800026`}},buttonUpdateIcon:{height:20,width:20,marginRight:10},debug:{backgroundColor:se[700]},info:{backgroundColor:fe[700]},warn:{backgroundColor:te[700]},error:{backgroundColor:We[700]},smallAvatar:{width:24,height:24},formControl:{display:`flex`},baseSettingsButton:{transform:`rotate(45deg)`},tooltip:{pointerEvents:`none`}},Tt=[`silly`,`debug`,`info`,`warn`,`error`];function Et(e,t){let n=e.className.split(` `),r=n.indexOf(t);r!==-1&&(n.splice(r,1),e.className=n.join(` `)),n.push(t),setTimeout(t=>e.className=t,100,n.join(` `))}function Dt(e){return e===`debug`?p(Ge,{}):e===`info`?p(xe,{}):e===`warn`?p(Ae,{}):e===`error`?p(Ce,{}):null}var Y=class e extends L{constructor(t){super(t),b(this,`refEvents`,I.createRef()),b(this,`refWarning`,I.createRef()),b(this,`refCpu`,I.createRef()),b(this,`refMem`,I.createRef()),b(this,`refUptime`,I.createRef()),b(this,`outputCache`,`-`),b(this,`inputCache`,`-`),b(this,`cpuCache`,`- %`),b(this,`memCache`,`- %`),b(this,`uptimeCache`,`-`),b(this,`diskFreeCache`,1),b(this,`diskSizeCache`,1),b(this,`diskWarningCache`,1),b(this,`notificationHandler`,t=>{t!=null&&t[this.props.hostId]&&this.setState({hostNotifications:{notifications:t[this.props.hostId],...e.calculateWarning(t[this.props.hostId])}})}),b(this,`eventsInputFunc`,(e,t)=>{this.inputCache=t&&t.val!==null?`⇥${t.val}`:`-`,this.refEvents.current&&(this.refEvents.current.innerHTML=`${this.inputCache} / ${this.outputCache}`,Et(this.refEvents.current,`newValueHost-${this.props.themeType||`light`}`))}),b(this,`eventsOutputFunc`,(e,t)=>{this.outputCache=t&&t.val!==null?`↦${t.val}`:`-`,this.refEvents.current&&(this.refEvents.current.innerHTML=`${this.inputCache} / ${this.outputCache}`,Et(this.refEvents.current,`newValueHost-${this.props.themeType||`light`}`))}),b(this,`warningFunc`,(e,t)=>{e.endsWith(`diskFree`)?this.diskFreeCache=(t==null?void 0:t.val)||0:e.endsWith(`diskSize`)?this.diskSizeCache=(t==null?void 0:t.val)||0:e.endsWith(`diskWarning`)&&(this.diskWarningCache=(t==null?void 0:t.val)||0);let n=this.diskFreeCache/this.diskSizeCache*100<=this.diskWarningCache;this.refWarning.current&&(n?(this.refWarning.current.setAttribute(`title`,this.props.t(`Warning: Free space on disk is low`)),this.refWarning.current.classList.add(`warning`)):(this.refWarning.current.removeAttribute(`title`),this.refWarning.current.classList.remove(`warning`)))}),b(this,`cpuFunc`,(e,t)=>{this.cpuCache=this.formatValue(t,`%`),this.refCpu.current&&(this.refCpu.current.innerHTML=this.cpuCache,Et(this.refCpu.current,`newValueHost-${this.props.themeType||`light`}`))}),b(this,`memFunc`,(e,t)=>{this.memCache=this.formatValue(t,`%`),this.refMem.current&&(this.refMem.current.innerHTML=this.memCache,Et(this.refMem.current,`newValueHost-${this.props.themeType||`light`}`))}),b(this,`uptimeFunc`,(e,t)=>{if(t!=null&&t.val){let e=Math.floor(t.val/86400),n=Math.floor(t.val%86400/3600);this.uptimeCache=e?`${e}d${n}h`:`${n}h`}this.refUptime.current&&(this.refUptime.current.innerHTML=this.uptimeCache,Et(this.refUptime.current,`newValueHost-${this.props.themeType||`light`}`))}),b(this,`logLevelFunc`,(e,t)=>{t&&this.setState({logLevel:t.val,logLevelSelect:t.val})}),this.state={logLevel:``,logLevelSelect:``,hostNotifications:{notifications:null,warning:0,other:0},openDialogLogLevel:!1,hostUpdateDialog:!1,updateAvailable:!1,instructionDialog:!1,updateDialog:!1,baseSettingsDialog:!1,editDialog:!1,changeLog:null}}static getDerivedStateFromProps(e,t){let n=a.getLocation(),r=n.tab===`tab-hosts`&&n.id===e.hostId,i=r&&n.dialog===`settings`,o=r&&n.dialog===`base-settings`;return i!==t.editDialog||o!==t.baseSettingsDialog?{editDialog:i,baseSettingsDialog:o}:null}async getInitialDiskStates(){let e=await this.props.socket.getState(`${this.props.hostId}.diskWarning`);this.diskWarningCache=(e==null?void 0:e.val)??this.diskWarningCache;let t=await this.props.socket.getState(`${this.props.hostId}.diskFree`);this.diskFreeCache=(t==null?void 0:t.val)??this.diskFreeCache;let n=await this.props.socket.getState(`${this.props.hostId}.diskSize`);this.diskSizeCache=(n==null?void 0:n.val)??this.diskSizeCache}readChangeLog(){this.state.changeLog||fetch(Ye.replace(`github.com`,`raw.githubusercontent.com`).replace(`/blob/`,`/`)).then(e=>e.text()).then(e=>this.setState({changeLog:e})).catch(e=>console.error(`Cannot read changelog: ${e}`))}componentDidMount(){this.props.hostsWorker.registerNotificationHandler(this.notificationHandler),this.props.hostsWorker.getNotifications(this.props.hostId).then(e=>this.notificationHandler(e)),this.props.socket.subscribeState(`${this.props.hostId}.inputCount`,this.eventsInputFunc),this.props.socket.subscribeState(`${this.props.hostId}.outputCount`,this.eventsOutputFunc),this.props.socket.subscribeState(`${this.props.hostId}.cpu`,this.cpuFunc),this.props.socket.subscribeState(`${this.props.hostId}.mem`,this.memFunc),this.props.socket.subscribeState(`${this.props.hostId}.uptime`,this.uptimeFunc),this.getInitialDiskStates().finally(async()=>{await this.props.socket.subscribeState(`${this.props.hostId}.diskFree`,this.warningFunc),await this.props.socket.subscribeState(`${this.props.hostId}.diskSize`,this.warningFunc),await this.props.socket.subscribeState(`${this.props.hostId}.diskWarning`,this.warningFunc)}),this.props.socket.subscribeState(`${this.props.hostId}.logLevel`,this.logLevelFunc)}componentWillUnmount(){this.props.hostsWorker.unregisterNotificationHandler(this.notificationHandler),this.props.socket.unsubscribeState(`${this.props.hostId}.inputCount`,this.eventsInputFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.outputCount`,this.eventsOutputFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.cpu`,this.cpuFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.mem`,this.memFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.uptime`,this.uptimeFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.diskFree`,this.warningFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.diskSize`,this.warningFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.diskWarning`,this.warningFunc),this.props.socket.unsubscribeState(`${this.props.hostId}.logLevel`,this.logLevelFunc)}static calculateWarning(e){let t={warning:0,other:0};if(!e)return t;let{result:n}=e;if(!n||!n.system)return t;if(Object.keys(n.system.categories).length){let e=n.system.categories;for(let n of Object.values(e))Object.keys(n.instances).forEach(()=>n.severity===`alert`?t.warning++:t.other++)}return t}formatValue(e,t){return!e||e.val===null||e.val===void 0?`-${t?` ${t}`:``}`:this.props.systemConfig.common.isFloatComma?e.val.toString().replace(`.`,`,`)+(t?` ${t}`:``):e.val+(t?` ${t}`:``)}renderDialogLogLevel(){return this.state.openDialogLogLevel?S(tt,{theme:this.props.theme,title:this.props.t(`Edit log level rule for %s`,this.props.host.common.name),onApply:()=>{this.props.socket.setState(`${this.props.hostId}.logLevel`,this.state.logLevelSelect).catch(e=>window.alert(`Cannot set log level: ${e}`)),this.setState({openDialogLogLevel:!1})},onClose:()=>this.setState({openDialogLogLevel:!1,logLevelSelect:this.state.logLevel}),children:[S(o,{style:{...J.formControl,marginTop:8},variant:`outlined`,children:[p(m,{children:this.props.t(`log level`)}),p(P,{variant:`standard`,value:this.state.logLevelSelect,fullWidth:!0,onChange:e=>this.setState({logLevelSelect:e.target.value}),children:Tt.map(e=>p(M,{value:e,children:this.props.t(e)},e))})]}),S(o,{style:J.formControl,variant:`outlined`,children:[p(x,{children:this.props.t(`Log level will be reset to the saved level after the restart of the controller`)}),S(x,{children:[this.props.t(`You can set the log level permanently in the base host settings`),p(pe,{style:J.baseSettingsButton})]})]})]}):null}onCopy(){let t=[];if(this.refCpu.current&&t.push(`CPU: ${this.refCpu.current.innerHTML}`),this.refMem.current&&t.push(`RAM: ${this.refMem.current.innerHTML}`),this.refUptime.current&&t.push(`${this.props.t(`Uptime`)}: ${this.refUptime.current.innerHTML}`),t.push(`${this.props.t(`Available`)}: ${this.props.available}`),t.push(`${this.props.t(`Installed`)}: ${this.props.host.common.installedVersion}`),this.refEvents.current&&t.push(`${this.props.t(`Events`)}: ${this.refEvents.current.innerHTML}`),this.props.hostData&&typeof this.props.hostData==`object`){let n=this.props.hostData;Object.keys(n).map(r=>t.push(`${this.props.t(r)}: ${e.formatInfo[r]?e.formatInfo[r](n[r],this.props.t):n[r]||`--`}`))}E.copyToClipboard(t.join(`
|
|
119
|
+
`)),window.alert(this.props.t(`Copied`))}renderUpdateButton(e,t){return e?p(N,{title:this.props.t(`Update`),slotProps:{popper:{sx:J.tooltip}},children:S(O,{component:`div`,onClick:e=>(e.stopPropagation(),this.openHostUpdateDialog()),sx:J.buttonUpdate,children:[p(g,{style:J.buttonUpdateIcon,size:`small`,children:p(ze,{})}),p(`span`,{style:{color:re[700]},children:this.props.available})]})}):p(`span`,{style:t,children:this.props.available})}renderHostBaseEdit(){return this.props.expertMode?p(N,{title:this.props.t(`Host Base Settings`),slotProps:{popper:{sx:J.tooltip}},children:p(`div`,{children:p(g,{size:`large`,disabled:!this.props.alive,onClick:e=>{e.stopPropagation(),a.doNavigate(`tab-hosts`,`base-settings`,this.props.hostId)},children:p(pe,{style:J.baseSettingsButton})})})}):null}renderExtendButton(e){return p(N,{title:this.props.t(e?`collapse`:`Expand`),slotProps:{popper:{sx:J.tooltip}},children:p(`div`,{children:p(g,{size:`large`,children:p(e?u:ae,{})})})})}renderRestartButton(){return p(N,{title:this.props.t(`Restart host`),slotProps:{popper:{sx:J.tooltip}},children:p(`div`,{children:p(g,{size:`large`,disabled:!this.props.alive,onClick:e=>{e.stopPropagation(),this.props.socket.restartController(this.props.hostId).catch(e=>window.alert(`Cannot restart: ${e}`))},children:p(Ke,{})})})})}renderEditButton(){return p(g,{size:`large`,onClick:e=>{e.stopPropagation(),a.doNavigate(`tab-hosts`,`settings`,this.props.hostId)},children:p(ye,{})})}renderRemoveButton(){return!this.props.alive&&!this.props.isCurrentHost?p(N,{title:this.props.alive||this.props.isCurrentHost?this.props.t(`You cannot delete host, when it is alive`):this.props.t(`Remove`),slotProps:{popper:{sx:J.tooltip}},children:p(g,{size:`large`,onClick:e=>{e.stopPropagation(),this.props.executeCommandRemove()},children:p(d,{})})}):p(`div`,{style:J.emptyButton})}renderCopyButton(e){return p(N,{title:this.props.t(`Copy`),slotProps:{popper:{sx:J.tooltip}},children:p(g,{size:`large`,onClick:()=>this.onCopy(),style:e,children:p(D,{})})})}renderLogLevel(){return p(N,{title:`${this.props.t(`loglevel`)} ${this.state.logLevel}`,slotProps:{popper:{sx:J.tooltip}},children:p(g,{size:`large`,onClick:e=>{e.stopPropagation(),this.setState({openDialogLogLevel:!0})},children:p(Te,{style:{...J.smallAvatar,...J[this.state.logLevel]},children:Dt(this.state.logLevel)})})})}renderNotificationsBadge(e,t){return p(be,{sx:t?{right:-3,top:13,padding:`0 4px`,cursor:`pointer`}:{cursor:`pointer`},title:this.props.t(`Hosts notifications`),badgeContent:this.state.hostNotifications.warning+this.state.hostNotifications.other,style:J.badge,color:this.state.hostNotifications.warning>0?`error`:`secondary`,onClick:e=>{e.stopPropagation(),this.props.showAdaptersWarning({[this.props.hostId]:this.state.hostNotifications.notifications},this.props.hostId)},children:e})}async openHostUpdateDialog(){let e=await this.props.socket.checkFeatureSupported(`CONTROLLER_UI_UPGRADE`);this.setState({hostUpdateDialog:!0,updateAvailable:e}),this.readChangeLog()}renderHostUpdateDialog(){return this.state.hostUpdateDialog?p(et,{adapter:this.props.host.common.name,adapterObject:this.props.jsControllerInfo,t:this.props.t,textUpdate:this.state.updateAvailable?this.props.t(`Start update`):this.props.t(`Show instructions`),textInstruction:this.props.t(`Show whole changelog`),rightDependencies:!0,news:this.getNews(),toggleTranslation:this.props.toggleTranslation,noTranslation:this.props.noTranslation,onUpdate:()=>{this.state.updateAvailable?this.setState({hostUpdateDialog:!1,updateDialog:!0}):this.setState({hostUpdateDialog:!1,instructionDialog:!0})},theme:this.props.theme,installedVersion:this.props.host.common.installedVersion,onInstruction:()=>{window.open(Ye,`_blank`)},onClose:()=>this.setState({hostUpdateDialog:!1})}):null}renderUpdateDialog(){return this.state.updateAvailable&&this.state.updateDialog?p(it,{socket:this.props.socket,hostId:this.props.hostId,version:this.props.jsControllerInfo.version,onClose:()=>this.setState({updateDialog:!1}),adminInstance:this.props.adminInstance,onUpdating:e=>this.props.onUpdating(e),themeType:this.props.themeType}):this.state.instructionDialog?p(ot,{socket:this.props.socket,hostId:this.props.hostId,version:this.props.jsControllerInfo.version,onClose:()=>this.setState({instructionDialog:!1})}):null}static extractNews(e,t){let n=e.split(`
|
|
120
|
+
`),r=``,i=!1;for(let e=0;e<n.length;e++)if(n[e].startsWith(`## `)){if(i)break;n[e].startsWith(`## ${t}`)&&(i=!0)}else i&&(r+=`${n[e].replace(/^\*\s*/,``).replace(/^\(\w+\)\s*/,``)}\n`);return r}getNews(t){let n=this.props.jsControllerInfo,r=this.props.host.common.installedVersion,i=[],a=n==null?void 0:n.news;return r&&a&&Object.keys(a).forEach(n=>{try{if(Ne.gt(n,r)||t){let t=!1,r=this.props.noTranslation?a[n].en:a[n][this.props.lang]||a[n].en;if(a[n].en===`see CHANGELOG.md`&&this.state.changeLog){let i=e.extractNews(this.state.changeLog,n);i&&(r=i,t=!0)}i.push({version:n,news:r,downloaded:t})}}catch{console.warn(`Cannot compare "${n}" and "${r}" of js-controller on ${this.props.host._id}`)}}),i}baseSettingsSettingsDialog(){return this.state.baseSettingsDialog?p(bt,{currentHost:this.props.hostId,themeType:this.props.themeType,currentHostName:this.props.host.common.name,onClose:()=>a.doNavigate(`tab-hosts`),socket:this.props.socket,t:this.props.t},`base`):null}renderEditObjectDialog(){return this.state.editDialog?p(xt,{obj:this.props.host,t:this.props.t,onClose:e=>{a.doNavigate(`tab-hosts`),e&&this.props.socket.setObject(e._id,e).then(()=>this.forceUpdate()).catch(e=>alert(`Cannot write object: ${e}`))}}):null}renderDialogs(){return S(w,{children:[this.renderDialogLogLevel(),this.renderHostUpdateDialog(),this.renderUpdateDialog(),this.renderEditObjectDialog(),this.baseSettingsSettingsDialog()]})}};b(Y,`formatInfo`,{Uptime:z.formatSeconds,"System uptime":z.formatSeconds,RAM:z.formatRam,Speed:z.formatSpeed,"Disk size":z.formatBytes,"Disk free":z.formatBytes,time:e=>new Date(e).toLocaleString()});var X={...J,root:e=>({position:`relative`,m:`10px`,width:300,minHeight:200,background:e.palette.background.default,boxShadow:St,display:`flex`,flexDirection:`column`,transition:`box-shadow 0.5s`,"&:hover":{boxShadow:Ct},"& .warning":{backgroundColor:`#de0000 !important`,"&:before":{position:`absolute`,right:0,top:-5,content:`"⚠"`,fontSize:25,height:`30px`,width:`30px`,color:`black`},animation:`$warning 2.5s ease-in-out infinite alternate`}}),imageBlock:{minHeight:60,display:`flex`,padding:`0 10px 0 10px`,position:`relative`,justifyContent:`space-between`,transition:`background 0.5s`},fab:{position:`absolute`,bottom:-20,width:40,height:40,right:20},collapse:{height:`100%`,position:`absolute`,width:`100%`,zIndex:3,marginTop:`auto`,bottom:0,transition:`height 0.3s`,justifyContent:`space-between`,display:`flex`,flexDirection:`column`},collapseOff:{height:0},close:{display:`flex`,ml:`auto`,mt:`-4px`},onOffLine:{alignSelf:`center`,width:`100%`,height:4},adapter:e=>({width:`100%`,fontWeight:`bold`,fontSize:16,verticalAlign:`middle`,pl:1,pt:2,color:e.palette.mode===`dark`?`#333`:`#555`}),cardContentInfo:e=>({overflow:`auto`,paddingTop:0,backgroundColor:e.palette.background.paper,color:e.palette.mode===`dark`?`#EEE`:`#111`}),cardContentH5:{height:`100%`,display:`flex`,flexDirection:`column`,justifyContent:`space-between`,paddingBottom:`10px !important`},marginTop10:{marginTop:10},displayFlex:{display:`flex`},marginLeft5:{marginLeft:5},enableButton:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},instanceStateNotAlive1:{backgroundColor:`rgba(192, 192, 192, 0.4)`},green:{background:`#00ce00`,position:`relative`},red:{background:`#da0000`},dotLine:{width:50,height:`100%`,background:`linear-gradient(90deg, rgba(0,206,0,0.7497373949579832) 0%, rgba(31,255,1,1) 50%, rgba(0,206,0,0.7805497198879552) 100%)`,zIndex:2,position:`absolute`,left:-11},versionDate:{alignSelf:`center`},cardContentDiv:{position:`sticky`,right:0,top:0,paddingTop:10},badge:{cursor:`pointer`},curdContentFlexCenter:{display:`flex`,alignItems:`center`,ml:`4px`},marginRight:{marginRight:`auto`},ul:{paddingTop:0,paddingBottom:0,paddingLeft:16,paddingRight:8},value:{marginLeft:5},label:{fontWeight:`bold`}},Ot=class extends Y{getHostDescriptionAll(){return this.props.hostData?typeof this.props.hostData==`string`?this.props.hostData:!this.props.hostData||typeof this.props.hostData!=`object`?p(`ul`,{style:X.ul,children:p(ke,{})},`ul`):p(`ul`,{style:X.ul,children:Object.keys(this.props.hostData).map(e=>p(`li`,{children:S(`span`,{style:X.black,children:[S(`span`,{style:X.label,children:[this.props.t(e),`: `]}),p(`span`,{style:X.value,children:Y.formatInfo[e]?Y.formatInfo[e](this.props.hostData[e],this.props.t):this.props.hostData[e]||`--`})]})},e))},`ul`):p(ke,{})}render(){let e=(this.props.isCurrentHost||this.props.alive)&&z.updateAvailable(this.props.host.common.installedVersion,this.props.available),t=this.getHostDescriptionAll();return S(He,{sx:E.getStyle(this.props.theme,X.root,this.props.hidden&&X.hidden),children:[this.renderDialogs(),this.state.openCollapse&&S(`div`,{style:{...X.collapse,...this.state.openCollapse?void 0:X.collapseOff},children:[S(c,{sx:X.cardContentInfo,children:[p(`div`,{style:X.cardContentDiv,onClick:()=>this.setState({openCollapse:!1}),children:p(g,{size:`small`,sx:X.close,onClick:()=>this.setState({openCollapse:!1}),children:p(h,{})})}),t,p(nt,{socket:this.props.socket,hostId:this.props.hostId,t:this.props.t})]}),p(O,{component:`div`,sx:X.footerBlock})]}),p(`div`,{style:{...X.onOffLine,...this.props.alive?X.green:X.red},children:this.props.alive&&p(`div`,{style:X.dotLine})}),S(`div`,{ref:this.refWarning,style:{...X.imageBlock,...this.props.alive?void 0:X.instanceStateNotAlive1,background:this.props.host.common.color||`inherit`},children:[p(Be,{sx:X.img,component:`img`,image:this.props.host.common.icon||`img/no-image.svg`}),p(O,{component:`div`,style:E.getStyle(this.props.theme,X.adapter,{color:this.props.host.common.color&&E.invertColor(this.props.host.common.color,!0)||`inherit`}),children:this.renderNotificationsBadge(this.props.host.common.name,!0)}),this.state.openCollapse?null:p(ue,{onClick:()=>this.setState({openCollapse:!0}),style:X.fab,color:`primary`,"aria-label":`add`,title:this.props.t(`Click for more`),children:p(Re,{})})]}),S(c,{style:X.cardContentH5,children:[p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[p(`span`,{style:X.label,children:`CPU:`}),p(`div`,{ref:this.refCpu,style:X.value,children:`- %`})]})}),p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[p(`span`,{style:X.label,children:`RAM:`}),p(`div`,{ref:this.refMem,style:X.value,children:`- %`})]})}),p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[S(`span`,{style:X.label,children:[this.props.t(`Uptime`),`:`]}),p(`div`,{ref:this.refUptime,style:X.value,children:`-d -h`})]})}),S(j,{variant:`body2`,color:`textSecondary`,component:`div`,style:X.wrapperAvailable,children:[S(`span`,{style:X.label,children:[this.props.t(`Available`),` js-controller:`]}),p(O,{component:`div`,sx:{...e?X.greenText:void 0,...X.curdContentFlexCenter},children:this.renderUpdateButton(e)})]}),S(j,{variant:`body2`,color:`textSecondary`,component:`p`,children:[S(`span`,{style:X.label,children:[this.props.t(`Installed`),` js-controller:`]}),p(`span`,{style:X.value,children:this.props.host.common.installedVersion})]}),p(j,{variant:`body2`,color:`textSecondary`,component:`div`,children:S(`div`,{style:X.displayFlex,children:[S(`span`,{style:X.label,children:[this.props.t(`Events`),`:`]}),p(`div`,{ref:this.refEvents,style:X.value,children:`- / -`})]})}),p(`div`,{style:X.marginTop10,children:S(j,{component:`span`,style:X.enableButton,children:[this.renderEditButton(),this.renderHostBaseEdit(),this.renderRestartButton(),this.props.expertMode&&this.state.logLevel&&this.renderLogLevel(),this.renderRemoveButton(),this.renderCopyButton()]})})]})]},this.props.hostId)}},Z={...J,root:e=>({position:`relative`,m:`7px`,background:e.palette.background.default,boxShadow:St,overflow:`hidden`,transition:`box-shadow 0.5s,height 0.3s`,"&:hover":{boxShadow:Ct}}),imageBlock:{marginRight:6,minHeight:60,width:`100%`,maxWidth:300,display:`flex`,padding:`0 10px 0 10px`,position:`relative`,justifyContent:`space-between`,transition:`background 0.5s`,alignItems:`baseline`},collapse:{height:`auto`,backgroundColor:`rgba(128, 128, 128, 0.1)`,width:`100%`,zIndex:3,marginTop:`auto`,bottom:0,justifyContent:`space-between`,display:`flex`,flexDirection:`column`},onOff:{alignSelf:`center`,width:4,height:`100%`},host:e=>({width:`100%`,fontWeight:`bold`,fontSize:16,paddingLeft:`8px`,alignSelf:`center`,color:e.palette.mode===`dark`?`#ddd`:`#222`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`}),cardContentH5:{height:`100%`,display:`flex`,width:`100%`,justifyContent:`space-between`,padding:`10px !important`,alignItems:`center`},marginTop10:{marginLeft:`auto`,display:`flex`},enableButton:{display:`flex`,justifyContent:`space-between`},green:{background:`#00ce00`,position:`relative`,overflow:`hidden`},dotLine:{width:10,height:20,background:`linear-gradient( rgba(0,206,0,0.7497373949579832) 0%, rgba(31,255,1,1) 50%, rgba(0,206,0,0.7805497198879552) 100%)`,zIndex:2,position:`absolute`,top:-21},red:{background:`#da0000`},flex:{flex:1,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`},cardContentInfo:{overflow:`auto`,paddingTop:0,justifyContent:`center`,display:`flex`,height:`auto`,flexShrink:0,position:`relative`},cursorNoDrop:{cursor:`no-drop !important`},wrapperFlex:{display:`flex`,cursor:`pointer`,"& .warning":{backgroundColor:`#de0000 !important`,"&:before":{position:`absolute`,right:0,top:-5,content:`"⚠"`,fontSize:25,height:`30px`,width:`30px`,color:`black`},animation:`$warning 2.5s ease-in-out infinite alternate`},"@media screen and (max-width: 500px)":{flexDirection:`column`}},wrapperColor:{position:`relative`,overflow:`hidden`},hidden1100:{"@media screen and (max-width: 1100px)":{display:`none !important`}},hidden800:{"@media screen and (max-width: 800px)":{display:`none !important`}},hidden600:{"@media screen and (max-width: 600px)":{display:`none !important`}},badge:{top:14},curdContentFlexCenter:{display:`flex`,alignItems:`center`},wrapperInfo:{display:`flex`,flexFlow:`wrap`,width:`100%`,justifyContent:`space-around`},wrapperBlockItem:{display:`flex`,flexFlow:`nowrap`,whiteSpace:`nowrap`,margin:10},bold:{fontWeight:`bold`},nowrap:{display:`flex`,flexFlow:`nowrap`,flex:1,whiteSpace:`nowrap`,marginRight:5},cell:{}},kt=class extends Y{renderValue(e){return typeof this.props.hostData==`object`?S(`div`,{style:Z.wrapperBlockItem,children:[S(`span`,{style:{...Z.bold,...Z.nowrap},children:[this.props.t(e),`: `]}),Y.formatInfo[e]?Y.formatInfo[e](this.props.hostData[e],this.props.t):this.props.hostData[e]||`--`]},e):null}getHostDescriptionAll(){return this.props.hostData?typeof this.props.hostData==`string`?this.props.hostData:S(`div`,{style:Z.wrapperInfo,children:[p(`div`,{style:Z.marginRight,children:this.props.hostData&&typeof this.props.hostData==`object`?Object.keys(this.props.hostData).map((e,t)=>t<=5&&this.renderValue(e)):p(ke,{})}),p(`div`,{style:Z.marginRight,children:this.props.hostData&&typeof this.props.hostData==`object`?Object.keys(this.props.hostData).map((e,t)=>t>5&&t<12&&this.renderValue(e)):p(ke,{})}),p(`div`,{style:Z.marginRight,children:this.props.hostData&&typeof this.props.hostData==`object`?Object.keys(this.props.hostData).map((e,t)=>t>=12&&this.renderValue(e)):p(ke,{})})]}):p(ke,{})}render(){let e=(this.props.isCurrentHost||this.props.alive)&&z.updateAvailable(this.props.host.common.installedVersion,this.props.available),t=this.getHostDescriptionAll();return S(O,{component:`div`,sx:E.getStyle(this.props.theme,Z.root,this.props.hidden&&Z.hidden,{border:`2px solid ${this.props.host.common.color||`inherit`}`,borderRadius:`5px`}),children:[this.renderDialogs(),S(O,{component:`div`,sx:{...Z.wrapperFlex,...this.props.alive?void 0:Z.cursorNoDrop},onClick:this.state.openDialogLogLevel?void 0:()=>this.setState({openCollapse:!this.state.openCollapse}),children:[S(`div`,{style:Z.wrapperColor,children:[p(`div`,{style:{...Z.onOff,...this.props.alive?Z.green:Z.red}}),this.props.alive&&p(`div`,{style:Z.dotLine})]}),S(`div`,{ref:this.refWarning,style:{...Z.imageBlock,background:this.props.host.common.color||`inherit`},children:[this.renderNotificationsBadge(p(Be,{sx:Z.img,component:`img`,image:this.props.host.common.icon||`img/no-image.svg`}),!0),p(`div`,{style:E.getStyle(this.props.theme,Z.host,{color:this.props.host.common.color&&E.invertColor(this.props.host.common.color,!0)||`inherit`}),children:this.props.host.common.name})]}),S(c,{sx:{"&.MuiCardContent-root":Z.cardContentH5},children:[p(j,{sx:{...Z.flex,...Z.hidden800,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refCpu,children:`- %`})}),p(j,{sx:{...Z.flex,...Z.hidden800,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refMem,children:`- %`})}),p(j,{sx:{...Z.flex,...Z.hidden800,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refUptime,children:`-/-`})}),p(j,{sx:{...Z.flex,...Z.hidden1100},variant:`body2`,color:`textSecondary`,component:`p`,children:this.props.host.common.installedVersion}),p(j,{sx:{...Z.flex,...Z.hidden1100,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(O,{component:`div`,sx:{...e?Z.greenText:void 0,...Z.curdContentFlexCenter},children:this.renderUpdateButton(e)})}),p(j,{sx:{...Z.flex,...Z.hidden600,...Z.cell},variant:`body2`,color:`textSecondary`,component:`div`,children:p(`div`,{ref:this.refEvents,children:`- / -`})}),p(`div`,{style:Z.marginTop10,children:S(j,{component:`span`,style:Z.enableButton,children:[this.renderEditButton(),this.renderHostBaseEdit(),this.renderRestartButton(),this.props.expertMode&&this.state.logLevel?this.renderLogLevel():p(`div`,{style:Z.emptyButton}),this.renderRemoveButton(),this.renderExtendButton(!!this.state.openCollapse)]})})]})]}),this.state.openCollapse?S(`div`,{style:Z.collapse,onClick:e=>e.stopPropagation(),children:[p(c,{style:Z.cardContentInfo,children:typeof t==`object`?S(w,{children:[t,this.renderCopyButton({height:44,width:44})]}):p(j,{variant:`body2`,color:`textSecondary`,children:t})}),p(nt,{socket:this.props.socket,hostId:this.props.hostId,t:this.props.t}),p(O,{component:`div`,sx:Z.footerBlock})]}):null]},this.props.hostId)}};l();var Q={grow:{flexGrow:1},cards:{display:`flex`,flexFlow:`wrap`,justifyContent:`center`},tabHeaderWrapper:{height:30,display:`flex`,margin:7},tabHeaderFirstItem:{width:306,paddingLeft:30,fontSize:14,fontWeight:600,alignSelf:`center`},tabHeaderItem:{flex:1,fontSize:14,fontWeight:600,alignSelf:`center`},tabHeaderItemButton:{fontSize:14,fontWeight:600,alignSelf:`center`},widthButtons:{width:240},tabFlex:{display:`flex`,flex:1,padding:`0 10px`},bold:{fontWeight:`bold`},marginRight:{marginRight:`auto`},hidden1100:{"@media screen and (max-width: 1100px)":{display:`none !important`}},hidden800:{"@media screen and (max-width: 800px)":{display:`none !important`}},hidden600:{"@media screen and (max-width: 600px)":{display:`none !important`}},jsController:{fontSize:12,opacity:.4,display:`block`,whiteSpace:`nowrap`},tooltip:{pointerEvents:`none`}},$={};function At(e){var t;if((t=e.dockerInformation)!=null&&t.isDocker){let t=e.dockerInformation.isOfficial?`official image`:`unofficial image`;e.dockerInformation.isOfficial&&(t+=` - ${e.dockerInformation.officialVersion}`),e.Platform=`${e.Platform} (${t})`}delete e.dockerInformation}var jt=class extends L{constructor(e){super(e),b(this,`t`,(e,t,n)=>(t!==void 0&&n!==void 0&&!$[`${e} ${t} ${n}`]?$[`${e} ${t} ${n}`]=this.props.t(e,t,n):t!==void 0&&!$[`${e} ${t}`]?$[`${e} ${t}`]=this.props.t(e,t):$[e]||($[e]=this.props.t(e)),t!==void 0&&n!==void 0?$[`${e} ${t} ${n}`]:t===void 0?$[e]:$[`${e} ${t}`])),b(this,`updateHosts`,e=>{let t=JSON.parse(JSON.stringify(this.state.hosts)),n=JSON.parse(JSON.stringify(this.state.alive));Promise.all(e.map(async e=>{let r=t.findIndex(t=>t._id===e.id);if(r!==-1)e.obj?t[r]=e.obj:t.splice(r,1);else{let r=await this.props.socket.getState(`${e.id}.alive`);n[e.id]=!!(r!=null&&r.val),t.push(e.obj)}})).then(()=>{let e={hosts:t,alive:n};this.state.filterText&&t.length<=2&&(e.filterText=``),this.setState(e)})}),b(this,`updateHostsAlive`,e=>{let t=JSON.parse(JSON.stringify(this.state.alive)),n=!1;e.forEach(e=>{e.type===`deleted`?t[e.id]!==void 0&&(delete t[e.id],n=!0):!!t[e.id]!=!!e.alive&&(t[e.id]=e.alive,n=!0)}),n&&this.setState({alive:t})}),this.state={viewMode:(window._localStorage||window.localStorage).getItem(`Hosts.viewMode`)===`true`,alive:{},hosts:[],repository:{},hostsData:{},filterText:(window._localStorage||window.localStorage).getItem(`Hosts.filterText`)||``,showSlowConnectionWarning:!1,readTimeoutMs:$e.getReadTimeoutMs()}}componentDidMount(){this.readInfo().then(()=>{this.props.hostsWorker.registerHandler(this.updateHosts),this.props.hostsWorker.registerAliveHandler(this.updateHostsAlive)})}componentWillUnmount(){this.props.hostsWorker.unregisterHandler(this.updateHosts),this.props.hostsWorker.unregisterAliveHandler(this.updateHostsAlive)}getHostsData(e,t){let n=[];for(let r=0;r<e.length;r++)if(t[e[r]._id]){let t=this.props.socket.getHostInfo(e[r]._id,void 0,this.state.readTimeoutMs).catch(t=>(console.error(`Cannot get getHostInfo: ${t}`),t.toString().includes(`timeout`)&&this.setState({showSlowConnectionWarning:!0}),{id:e[r]._id,data:t.toString()})).then(t=>(At(t),{id:e[r]._id,data:t}));n.push(t)}else n.push(Promise.resolve({id:e[r]._id,data:`offline`}));return Promise.all(n).then(e=>{let t={};return e.forEach(e=>t[e.id]=e.data),t})}async readInfo(){try{let e=await this.props.socket.getHosts(!0),t=await Qe(this.props.socket,this.props.currentHost,{update:!1,lang:this.props.lang,adapters:[`js-controller`]},!1,this.state.readTimeoutMs),n=JSON.parse(JSON.stringify(this.state.alive));for(let t=0;t<e.length;t++){let r=await this.props.socket.getState(`${e[t]._id}.alive`);n[e[t]._id]=r?!!r.val:!1}let r={alive:n,hosts:e,hostsData:await this.getHostsData(e,n),repository:t};this.state.filterText&&e.length<=2&&(r.filterText=``),this.setState(r)}catch(e){window.alert(`Cannot getRepository: ${e}`),e.toString().includes(`timeout`)&&this.setState({showSlowConnectionWarning:!0})}}getPanelsOrRows(){let e=this.renderHosts().filter(e=>e);return e.length?e:this.t(`All items are filtered out`)}renderSlowConnectionWarning(){return this.state.showSlowConnectionWarning?p($e,{readTimeoutMs:this.state.readTimeoutMs,t:this.t,onClose:async e=>{this.setState({showSlowConnectionWarning:!1}),e&&(this.setState({readTimeoutMs:e}),await this.readInfo())}}):null}renderHosts(){return this.state.hosts.map(e=>{var t;if(this.state.filterText&&!e.common.name.toLowerCase().includes(this.state.filterText.toLowerCase()))return null;let n=this.state.viewMode?Ot:kt;return p(n,{adminInstance:this.props.adminInstance,alive:this.state.alive[e._id],available:((t=this.state.repository[`js-controller`])==null?void 0:t.version)||`-`,executeCommandRemove:()=>this.props.executeCommand(`host remove ${e.common.name}`),expertMode:this.props.expertMode,host:e,hostData:this.state.hostsData[e._id],hostId:e._id,hostsWorker:this.props.hostsWorker,isCurrentHost:this.props.currentHost===e._id,jsControllerInfo:this.state.repository[`js-controller`],lang:this.props.lang,noTranslation:this.props.noTranslation,onUpdating:this.props.onUpdating,showAdaptersWarning:this.props.showAdaptersWarning,socket:this.props.socket,systemConfig:this.props.systemConfig,t:this.t,theme:this.props.theme,themeType:this.props.themeType,toggleTranslation:this.props.toggleTranslation},e._id)})}renderTableHeader(){let e=window.innerWidth<100?10:window.innerWidth<1200?12:14;return S(`div`,{style:Q.tabHeaderWrapper,children:[p(`div`,{style:Q.tabHeaderFirstItem,children:this.t(`Name:`)}),S(`div`,{style:Q.tabFlex,children:[p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden800,{fontSize:e}),children:`CPU`}),p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden800,{fontSize:e}),children:`RAM`}),p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden800,{fontSize:e}),children:this.t(`Uptime`)}),S(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden1100,{fontSize:e}),children:[this.t(`Installed`),p(`div`,{style:Q.jsController,children:`js-controller`})]}),S(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden1100,{fontSize:e}),children:[this.t(`Available`),p(`div`,{style:Q.jsController,children:`js-controller`})]}),p(O,{component:`div`,sx:E.getStyle(this.props.theme,Q.tabHeaderItem,Q.hidden600,{fontSize:e}),children:this.t(`Events`)}),p(`div`,{style:{...Q.tabHeaderItemButton,width:this.props.expertMode?292:244}})]})]})}render(){return this.state.hosts.length?S(ne,{children:[p(`style`,{children:wt}),this.renderSlowConnectionWarning(),S(Ue,{children:[p(N,{title:this.t(`Show / hide List`),slotProps:{popper:{sx:Q.tooltip}},children:p(g,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Hosts.viewMode`,this.state.viewMode?`false`:`true`),this.setState({viewMode:!this.state.viewMode})},children:this.state.viewMode?p(Pe,{}):p(Je,{})})}),p(N,{title:this.t(`Reload`),slotProps:{popper:{sx:Q.tooltip}},children:p(g,{size:`large`,onClick:()=>this.forceUpdate(),children:p(ze,{})})}),p(`div`,{style:Q.grow}),this.state.hosts.length>2?p(k,{variant:`standard`,label:this.t(`Filter`),style:{margin:`5px 0`},value:this.state.filterText,onChange:e=>{(window._localStorage||window.localStorage).setItem(`Hosts.viewMode`,e.target.value),this.setState({filterText:e.target.value})},slotProps:{input:{endAdornment:this.state.filterText?p(Me,{position:`end`,children:p(g,{tabIndex:-1,size:`small`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Hosts.viewMode`,``),this.setState({filterText:``})},children:p(h,{})})}):null}}}):null,p(`div`,{style:Q.grow})]}),S(de,{overflow:`auto`,children:[!E.isStableRepository(this.props.systemConfig.common.activeRepo)&&String(this.props.systemConfig.common.activeRepo||``).toLowerCase()!==`nexowatt`?p(O,{sx:{marginX:2,width:`calc(100% - 32px)`,alignSelf:`center`},children:p(Oe,{type:`warning`,children:this.t(`Active repo is "%s"`,this.props.systemConfig.common.activeRepo)})}):null,S(`div`,{style:this.state.viewMode?Q.cards:void 0,children:[!this.state.viewMode&&this.renderTableHeader(),this.getPanelsOrRows()]})]})]}):p(ge,{})}};export{jt as default};
|