iobroker.eos-admin 9.0.26 → 9.0.28
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 +9 -15
- package/README.md +17 -227
- package/adminWww/.vite/manifest.json +194 -203
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13887 -13897
- package/adminWww/assets/{AdapterUpdateDialog-DIjnNZ5k.js → AdapterUpdateDialog-DBLX7GoO.js} +5 -5
- package/adminWww/assets/{Adapters-D8UOQg1q.js → Adapters-c250DTTU.js} +5 -5
- package/adminWww/assets/AddLink-0L0E-LsA.js +1 -0
- package/adminWww/assets/ColorLens-DA51K29x.js +1 -0
- package/adminWww/assets/ConfigManager-BBUXk8hZ.js +1 -0
- package/adminWww/assets/Enums-CWJJ2zNF.js +92 -0
- package/adminWww/assets/Fields-CNefAzNH.js +1 -0
- package/adminWww/assets/FileCopy-B16lEuur.js +1 -0
- package/adminWww/assets/Files-Bf8oZSk6.js +1 -0
- package/adminWww/assets/{Hosts-BToJLy61.js → Hosts-8gg41ODb.js} +6 -6
- package/adminWww/assets/Instances-PPTEPJQN.js +4 -0
- package/adminWww/assets/Intro-9c_ynpJu.js +2 -0
- package/adminWww/assets/Lens-9lkeoWGk.js +1 -0
- package/adminWww/assets/LinearScale-Be5h2beh.js +1 -0
- package/adminWww/assets/{Logs-xdFVJ6fZ.js → Logs-Brgb9kR_.js} +2 -2
- package/adminWww/assets/North-C2whbHM-.js +1 -0
- package/adminWww/assets/{Objects-DhyJ5eAY.js → Objects-DHVNfs_x.js} +4 -4
- package/adminWww/assets/Overview-CgnpH8e8.js +3 -0
- package/adminWww/assets/PersonOff-DqBq0Fho.js +1 -0
- package/adminWww/assets/PlaylistAdd-O8k92YBd.js +1 -0
- package/adminWww/assets/State-vVobamei.js +1 -0
- package/adminWww/assets/UsedResources-1fEUqiQ6.js +2 -0
- package/adminWww/assets/Users-oRpvFtQR.js +1 -0
- package/adminWww/assets/{bootstrap-BU7j1Fe_.js → bootstrap-st8VxLDc.js} +25 -25
- package/adminWww/assets/date-fns-C1dqkno9.js +1 -0
- package/adminWww/assets/{hostInit-Cgee6juw.js → hostInit-OQMl4yOT.js} +1 -1
- package/adminWww/assets/icons-material-DeF0gQyK.js +1 -0
- package/adminWww/assets/{index-BUZf1ftI.js → index-D4lV2S7J.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-CcjgaxiA.js → installSVGRenderer-1WdbDz-H.js} +1 -1
- package/adminWww/assets/isSameWeek-Crh37s7U.js +1 -0
- package/adminWww/assets/isWithinInterval-Bo1WiDfq.js +1 -0
- package/adminWww/assets/locale-hLcz_Xh2.js +1 -0
- package/adminWww/assets/{mf-entry-bootstrap-0-96d40e57.js → mf-entry-bootstrap-0-3b253ab0.js} +2 -2
- package/adminWww/assets/sentry-DwQQLI7N.js +1 -0
- package/adminWww/assets/startOfWeek-DJph8SIW.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.28.js +12 -0
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosDeviceEmsPlan.js +24 -1
- package/build/lib/eosDeviceEmsPlan.js.map +1 -1
- package/build/lib/eosModuleHost.js +66 -3
- package/build/lib/eosModuleHost.js.map +1 -1
- package/docs/DOKUMENTATION_9.0.27.md +7 -0
- package/docs/README.md +13 -0
- package/docs/UMSORTIERTE_DATEIEN.tsv +153 -0
- package/docs/reports/unified-9.0.14/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.16/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.17/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.18/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.21/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.22/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.27/ABHAENGIGKEITEN.md +27 -0
- package/docs/reports/unified-9.0.27/PRUEFBERICHT.md +68 -0
- package/docs/reports/unified-9.0.27/PRUEFERGEBNISSE.json +292 -0
- package/docs/reports/unified-9.0.27/SICHERHEITSBETRACHTUNG.md +26 -0
- package/docs/reports/unified-9.0.27/TIBBER_NEUSTART.md +23 -0
- package/docs/reports/unified-9.0.27/UPDATE_WIEDERANLAUF.md +46 -0
- package/docs/reports/unified-9.0.27/raw/INDEX.json +347 -0
- package/docs/reports/unified-9.0.27/raw/admin-build-mirror-review.json +75 -0
- package/docs/reports/unified-9.0.27/raw/ajv-production-reachability.json +35 -0
- package/docs/reports/unified-9.0.27/raw/backend-build.log +5 -0
- package/docs/reports/unified-9.0.27/raw/baseline-devices.log +138 -0
- package/docs/reports/unified-9.0.27/raw/baseline-module-startup.log +82 -0
- package/docs/reports/unified-9.0.27/raw/baseline-ocpp-contract.log +93 -0
- package/docs/reports/unified-9.0.27/raw/baseline-ocpp-frontend.log +255 -0
- package/docs/reports/unified-9.0.27/raw/baseline-repository-tools.log +84 -0
- package/docs/reports/unified-9.0.27/raw/browser-blocked.log +38 -0
- package/docs/reports/unified-9.0.27/raw/controller-725-reproduction-node24.log +4 -0
- package/docs/reports/unified-9.0.27/raw/devices-child-rpc-diagnostic.log +34 -0
- package/docs/reports/unified-9.0.27/raw/devices-filter-without-readiness.log +15 -0
- package/docs/reports/unified-9.0.27/raw/devices-final-web-filtered-node22.log +107 -0
- package/docs/reports/unified-9.0.27/raw/devices-final-web-filtered-node24.log +26 -0
- package/docs/reports/unified-9.0.27/raw/eos-update-path-node24.log +52 -0
- package/docs/reports/unified-9.0.27/raw/frontend-build.log +152 -0
- package/docs/reports/unified-9.0.27/raw/influx/provenance.json +42 -0
- package/docs/reports/unified-9.0.27/raw/installer-build.log +26 -0
- package/docs/reports/unified-9.0.27/raw/lint.log +5 -0
- package/docs/reports/unified-9.0.27/raw/modules-build.log +5 -0
- package/docs/reports/unified-9.0.27/raw/node22-tests-final.log +16976 -0
- package/docs/reports/unified-9.0.27/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.27/raw/node24-tests-final.log +2831 -0
- package/docs/reports/unified-9.0.27/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.27/raw/npm-audit-development.json +398 -0
- package/docs/reports/unified-9.0.27/raw/npm-audit-production.json +77 -0
- package/docs/reports/unified-9.0.27/raw/npm-production-ajv-tree.json +33 -0
- package/docs/reports/unified-9.0.27/raw/npm-production-ajv-tree.stderr +1 -0
- package/docs/reports/unified-9.0.27/raw/npm926-dateivergleich.json +6 -0
- package/docs/reports/unified-9.0.27/raw/production-audit-review.json +30 -0
- package/docs/reports/unified-9.0.27/raw/release-targeted.log +118 -0
- package/docs/reports/unified-9.0.27/raw/restart-regressions-node22.log +361 -0
- package/docs/reports/unified-9.0.27/raw/sbom-generation.json +11 -0
- package/docs/reports/unified-9.0.27/raw/source-fixtures.json +30 -0
- package/docs/reports/unified-9.0.27/raw/targeted-ocpp-frontend.log +26 -0
- package/docs/reports/unified-9.0.27/raw/test-environment.json +24 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/REVIEW.md +40 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/appcenter-overwrite-patched-scratch.log +11 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/appcenter-overwrite-repro.log +33 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/customer-tariff-lint.log +0 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/customer-tariff-typecheck.log +0 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/process-disk-restart-node24.log +10 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/roundtrip-built-diagnostic.log +58 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/roundtrip-built-ipc-counts.log +45 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/roundtrip-built-node24.log +42 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/roundtrip-final-node22.log +134 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/roundtrip-final-node24.log +28 -0
- package/docs/reports/unified-9.0.27/raw/tibber/backend/roundtrip-source-node22-diagnostic.log +220 -0
- package/docs/reports/unified-9.0.27/raw/tibber/independent/tariff-background-hydration-review.log +1 -0
- package/docs/reports/unified-9.0.27/raw/tibber/independent/tibber-header-object-mask-review.log +1 -0
- package/docs/reports/unified-9.0.27/raw/tibber/independent/tibber-independent-frontend-review.log +14 -0
- package/docs/reports/unified-9.0.27/raw/tibber/independent/tibber-independent-scope-review.log +1 -0
- package/docs/reports/unified-9.0.27/raw/tibber/independent/tibber-mapping-targeted-node24.log +2184 -0
- package/docs/reports/unified-9.0.27/raw/tibber/independent/tibber-parent-persistence-review.log +20 -0
- package/docs/reports/unified-9.0.27/raw/tibber/tariff-review/appcenter-tariff-roundtrip-baseline.log +57 -0
- package/docs/reports/unified-9.0.27/raw/tibber/tariff-review/customer-editor-final.log +24 -0
- package/docs/reports/unified-9.0.27/raw/tibber/tariff-review/frontend-guard-baseline.log +303 -0
- package/docs/reports/unified-9.0.27/raw/tibber/tariff-review/frontend-guard-final.log +14 -0
- package/docs/reports/unified-9.0.27/raw/tibber-appcenter-baseline.log +33 -0
- package/docs/reports/unified-9.0.27/raw/tibber-background-hydration-baseline.log +1 -0
- package/docs/reports/unified-9.0.27/raw/tibber-form-baseline.log +57 -0
- package/docs/reports/unified-9.0.27/raw/tibber-mapping-targeted-node24.log +2184 -0
- package/docs/reports/unified-9.0.27/raw/tibber-minimal-fix-isolation.log +11 -0
- package/docs/reports/unified-9.0.27/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.27/raw/ui-build.log +7 -0
- package/docs/reports/unified-9.0.28/PRUEFBERICHT.md +40 -0
- package/docs/reports/unified-9.0.28/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.28/raw/INDEX.json +87 -0
- package/docs/reports/unified-9.0.28/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.28/raw/frontend.log +151 -0
- package/docs/reports/unified-9.0.28/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.28/raw/lint.log +5 -0
- package/docs/reports/unified-9.0.28/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.28/raw/node22-tests-final.log +17060 -0
- package/docs/reports/unified-9.0.28/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.28/raw/node24-tests-final.log +2845 -0
- package/docs/reports/unified-9.0.28/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.28/raw/npm-audit-runtime.json +77 -0
- package/docs/reports/unified-9.0.28/raw/runtime-mirror-check.log +1 -0
- package/docs/reports/unified-9.0.28/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.28/raw/ui-runtime.log +7 -0
- package/docs/reports/unified-9.0.4/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.5/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.6/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.7/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.8/PRUEFBERICHT.md +1 -1
- package/docs/reports/unified-9.0.9/PRUEFBERICHT.md +1 -1
- package/{START_HIER_9.0.1.md → docs/start/START_HIER_9.0.1.md} +5 -5
- package/{START_HIER_9.0.10.md → docs/start/START_HIER_9.0.10.md} +1 -1
- package/{START_HIER_9.0.11.md → docs/start/START_HIER_9.0.11.md} +1 -1
- package/{START_HIER_9.0.12.md → docs/start/START_HIER_9.0.12.md} +1 -1
- package/{START_HIER_9.0.13.md → docs/start/START_HIER_9.0.13.md} +2 -2
- package/{START_HIER_9.0.14.md → docs/start/START_HIER_9.0.14.md} +1 -1
- package/{START_HIER_9.0.15.md → docs/start/START_HIER_9.0.15.md} +2 -2
- package/{START_HIER_9.0.16.md → docs/start/START_HIER_9.0.16.md} +1 -1
- package/{START_HIER_9.0.17.md → docs/start/START_HIER_9.0.17.md} +2 -2
- package/{START_HIER_9.0.18.md → docs/start/START_HIER_9.0.18.md} +4 -4
- package/{START_HIER_9.0.19.md → docs/start/START_HIER_9.0.19.md} +2 -2
- package/{START_HIER_9.0.2.md → docs/start/START_HIER_9.0.2.md} +2 -2
- package/{START_HIER_9.0.20.md → docs/start/START_HIER_9.0.20.md} +1 -1
- package/{START_HIER_9.0.21.md → docs/start/START_HIER_9.0.21.md} +1 -1
- package/{START_HIER_9.0.22.md → docs/start/START_HIER_9.0.22.md} +4 -4
- package/{START_HIER_9.0.24.md → docs/start/START_HIER_9.0.24.md} +1 -1
- package/{START_HIER_9.0.25.md → docs/start/START_HIER_9.0.25.md} +1 -1
- package/{START_HIER_9.0.26.md → docs/start/START_HIER_9.0.26.md} +1 -1
- package/docs/start/START_HIER_9.0.27.md +33 -0
- package/docs/start/START_HIER_9.0.28.md +20 -0
- package/{START_HIER_9.0.3.md → docs/start/START_HIER_9.0.3.md} +3 -3
- package/{START_HIER_9.0.4.md → docs/start/START_HIER_9.0.4.md} +3 -3
- package/{START_HIER_9.0.5.md → docs/start/START_HIER_9.0.5.md} +2 -2
- package/{START_HIER_9.0.6.md → docs/start/START_HIER_9.0.6.md} +3 -3
- package/{START_HIER_9.0.7.md → docs/start/START_HIER_9.0.7.md} +4 -4
- package/{START_HIER_9.0.8.md → docs/start/START_HIER_9.0.8.md} +3 -3
- package/{START_HIER_9.0.9.md → docs/start/START_HIER_9.0.9.md} +1 -1
- package/docs/unified/ARCHITECTURE.md +37 -1
- package/docs/unified/BESTANDSUEBERNAHME_9_0_7.md +1 -1
- package/docs/unified/INSTALL_PUBLISH.md +2 -2
- package/io-package.json +12 -12
- package/modules/devices/admin/ems-assignment.js +1 -0
- package/package.json +38 -34
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +378 -146
- package/release-manifests/unified/frontend.cdx.json +6 -6
- package/release-manifests/unified/installer.cdx.json +6 -6
- package/release-manifests/unified/obsolete-admin-assets.json +171 -6
- 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/io-package.json +5 -1
- package/ui/lib/customer-tariff.js +73 -1
- package/ui/lib/installer-lifecycle.js +5 -3
- package/ui/lib/ocpp-auto-discovery.js +53 -6
- package/ui/lib/smarthome-device-detection.js +177 -4
- package/ui/main.js +171 -95
- package/ui/package.json +1 -1
- package/ui/www/ems-apps.js +188 -130
- package/ui/www/licenses/smarthome-markdown-components.json +156 -156
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/smarthome-config-workspace.css +7 -0
- package/ui/www/smarthome-config.html +4 -4
- package/ui/www/smarthome-config.js +178 -163
- package/ui/www/smarthome-device-config.js +131 -6
- package/ui/www/smarthome-setup.js +252 -59
- package/adminWww/assets/AccessTime-CuR73YC3.js +0 -1
- package/adminWww/assets/ConfigManager-CAvT_4-g.js +0 -1
- package/adminWww/assets/Enums-CrNUOX0d.js +0 -92
- package/adminWww/assets/Fields-D-0qFiqr.js +0 -1
- package/adminWww/assets/Files-BL8kvaeC.js +0 -1
- package/adminWww/assets/Instances-Dlrp1KGP.js +0 -4
- package/adminWww/assets/Intro-5EbxvP4X.js +0 -2
- package/adminWww/assets/KeyboardArrowRight-ifvmV1ZL.js +0 -1
- package/adminWww/assets/MoreHoriz-CS7nODK8.js +0 -1
- package/adminWww/assets/Overview-BspgcFB7.js +0 -3
- package/adminWww/assets/Pageview-wzrLQZ-j.js +0 -1
- package/adminWww/assets/PersonOff-YtHcY0sV.js +0 -1
- package/adminWww/assets/Star-D8VNXawT.js +0 -1
- package/adminWww/assets/State-CJ1mKH_U.js +0 -1
- package/adminWww/assets/UsedResources-BMiCxqWH.js +0 -2
- package/adminWww/assets/Users-DrlJHRa5.js +0 -1
- package/adminWww/assets/ViewCompact-D7bHgn99.js +0 -1
- package/adminWww/assets/ViewSidebar-CjClbCI5.js +0 -1
- package/adminWww/assets/WifiTethering-DJ9VO12W.js +0 -1
- package/adminWww/assets/date-fns-BtR4dG_j.js +0 -1
- package/adminWww/assets/en-US-BjjaEI6N.js +0 -1
- package/adminWww/assets/icons-material-C0U9EKON.js +0 -1
- package/adminWww/assets/isSameWeek-WMSJR5Qs.js +0 -1
- package/adminWww/assets/locale-DN6Bdkdt.js +0 -1
- package/adminWww/assets/sentry-CPzCHrwe.js +0 -1
- package/adminWww/assets/setYear-DDSuW45e.js +0 -1
- package/adminWww/remoteEntry-eos-9.0.26.js +0 -12
- /package/{START_HIER_9.0.23.md → docs/start/START_HIER_9.0.23.md} +0 -0
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-sJBDdmOt.js";import{$a as t,Ao as n,Ci as r,Cr as i,Do as a,Dr as o,Eo as s,Er as c,Es as l,Ha as u,Hs as d,Ja as f,Js as p,Ka as m,Ko as h,Kr as g,Lr as _,Mo as v,No as y,Oa as ee,Or as b,Po as x,Qa as S,Qi as C,Qo as w,Rr as te,Sr as T,To as ne,Ts as E,Us as D,Vo as re,Vs as O,Wa as ie,Wo as ae,Wr as k,Xi as oe,Xo as se,Ya as ce,Ys as le,Za as ue,Zi as A,Zs as j,ao as de,ar as M,as as fe,ba as pe,bi as N,bo as P,br as F,cr as me,dc as he,do as ge,ec as _e,eo as ve,fc as ye,ga as be,go as I,io as xe,jo as Se,lo as Ce,mc as we,mo as L,no as Te,ns as Ee,oi as R,os as De,pa as Oe,pc as z,po as B,ps as ke,qs as V,ro as Ae,rs as je,sc as H,so as Me,sr as Ne,ss as Pe,tc as Fe,to as Ie,tr as Le,ts as Re,ua as ze,uc as U,uo as Be,us as Ve,wr as He,xa as Ue,xo as We,xr as Ge,yo as W,yr as Ke,ys as qe}from"./loadShare-eager-dmdYQhAl.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./ViewSidebar-CjClbCI5.js";import{n as tt,r as nt,t as rt}from"./Pageview-wzrLQZ-j.js";import{n as it,t as at}from"./KeyboardArrowRight-ifvmV1ZL.js";import{t as ot}from"./InfoOutlined-Bggo2-pX.js";import{n as st,t as ct}from"./UnfoldMore-DOHSVdRn.js";import{t as lt}from"./AdminUtils-Dc1eHsx5.js";import{B as ut,H as dt,L as ft,Ot as pt,R as mt,W as ht,xt as gt,z as _t}from"./bootstrap-BU7j1Fe_.js";import{n as vt,r as yt,t as bt}from"./Fields-D-0qFiqr.js";var xt=e((e=>{var t=60103,n=60106,r=60107,i=60108,a=60114,o=60109,s=60110,c=60112,l=60113,u=60120,d=60115,f=60116;if(typeof Symbol==`function`&&Symbol.for){var p=Symbol.for;t=p(`react.element`),n=p(`react.portal`),r=p(`react.fragment`),i=p(`react.strict_mode`),a=p(`react.profiler`),o=p(`react.provider`),s=p(`react.context`),c=p(`react.forward_ref`),l=p(`react.suspense`),u=p(`react.suspense_list`),d=p(`react.memo`),f=p(`react.lazy`),p(`react.block`),p(`react.server.block`),p(`react.fundamental`),p(`react.debug_trace_mode`),p(`react.legacy_hidden`)}function m(e){if(typeof e==`object`&&e){var p=e.$$typeof;switch(p){case t:switch(e=e.type,e){case r:case a:case i:case l:case u:return e;default:switch(e&&=e.$$typeof,e){case s:case c:case f:case d:case o:return e;default:return p}}case n:return p}}}e.isFragment=function(e){return m(e)===r}})),St=e(((e,t)=>{t.exports=xt()}))();function Ct(e,t){let n=getComputedStyle(t);if(!n)return;let r=e===K.Horizontal?t.clientWidth:t.clientHeight;return r===0?void 0:(e===K.Horizontal?r-=parseFloat(n.paddingLeft)+parseFloat(n.paddingRight):r-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),r)}function wt(e,t,n=[],r={condition:!0}){let{condition:i}=r,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,[`condition`]);H((()=>(i&&window.addEventListener(e,t,a),()=>{i&&window.removeEventListener(e,t)})),[e,t,i,...n])}(function(e,t){t===void 0&&(t={});var n=t.insertAt;if(typeof document<`u`){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}})(`/* === Main Container === */
|
|
2
|
-
.__dbk__container {
|
|
3
|
-
height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
|
|
6
|
-
display: flex;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.__dbk__container.Horizontal {
|
|
11
|
-
flex-direction: row;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.__dbk__container.Vertical {
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
}
|
|
17
|
-
/* ====== */
|
|
18
|
-
|
|
19
|
-
/* === Wrapper for each child element === */
|
|
20
|
-
.__dbk__child-wrapper {
|
|
21
|
-
height: 100%;
|
|
22
|
-
width: 100%;
|
|
23
|
-
}
|
|
24
|
-
/* ====== */
|
|
25
|
-
|
|
26
|
-
/* === Gutter === */
|
|
27
|
-
.__dbk__gutter {
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
}
|
|
32
|
-
/* .__dbk__gutter > div {
|
|
33
|
-
background: red;
|
|
34
|
-
} */
|
|
35
|
-
.__dbk__gutter.Horizontal {
|
|
36
|
-
height: 100%;
|
|
37
|
-
padding: 0 2px;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
}
|
|
40
|
-
.__dbk__gutter.Horizontal:hover {
|
|
41
|
-
cursor: col-resize;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.__dbk__gutter.Vertical {
|
|
45
|
-
width: 100%;
|
|
46
|
-
padding: 2px 0;
|
|
47
|
-
flex-direction: row;
|
|
48
|
-
}
|
|
49
|
-
.__dbk__gutter.Vertical:hover {
|
|
50
|
-
cursor: row-resize;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.__dbk__gutter.Light {
|
|
54
|
-
background: #EDF0EF;
|
|
55
|
-
}
|
|
56
|
-
.__dbk__gutter.Light:hover > .__dbk__dragger {
|
|
57
|
-
background: #76747B;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.__dbk__gutter.Dark {
|
|
61
|
-
background: #020203;
|
|
62
|
-
}
|
|
63
|
-
.__dbk__gutter.Dark:hover > .__dbk__dragger {
|
|
64
|
-
background: #9995A3;
|
|
65
|
-
}
|
|
66
|
-
/* ====== */
|
|
67
|
-
|
|
68
|
-
/* === Gutter's Dragger === */
|
|
69
|
-
.__dbk__dragger {
|
|
70
|
-
border-radius: 2px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.__dbk__dragger.Horizontal {
|
|
74
|
-
width: 4px;
|
|
75
|
-
height: 24px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.__dbk__dragger.Vertical {
|
|
79
|
-
width: 24px;
|
|
80
|
-
height: 4px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.__dbk__dragger.Light {
|
|
84
|
-
background: #A6ACB5;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.__dbk__dragger.Dark {
|
|
88
|
-
background: #434252;
|
|
89
|
-
}
|
|
90
|
-
/* ====== */`);var Tt=V.forwardRef((({className:e,theme:t,draggerClassName:n,direction:r=K.Vertical,onDragging:i},a)=>{let o=`__dbk__gutter ${r} ${e||t}`,s=`__dbk__dragger ${r} ${n||t}`;return d(`div`,Object.assign({className:o,ref:a,dir:r,onMouseDown:i,onTouchStart:jt?i:void 0},{children:d(`div`,{className:s},void 0)}),void 0)})),G;function Et(e,t,n){let r,i;return t?(r=e/2,i=e):n?(r=e,i=e/2):(r=e,i=e),{aGutterSize:r,bGutterSize:i}}function Dt(e,t){switch(t.type){case G.SetIsReadyToCompute:return Object.assign(Object.assign({},e),{isReady:t.payload.isReady});case G.CreatePairs:{let{direction:n,children:r,gutters:i}=t.payload,a=r[0].parentNode;if(!a)throw Error(`Cannot create pairs - parent is undefined.`);let o=Ct(n,a);if(o===void 0)throw Error(`Cannot create pairs - parent has undefined or zero size: ${o}.`);let s=[];return r.forEach(((e,t)=>{if(t>0){let e=r[t-1],o=r[t],c=i[t-1],l=n===K.Horizontal?e.getBoundingClientRect().left:e.getBoundingClientRect().top,u=n===K.Horizontal?o.getBoundingClientRect().right:o.getBoundingClientRect().bottom,d=n===K.Horizontal?e.getBoundingClientRect().width+c.getBoundingClientRect().width+o.getBoundingClientRect().width:e.getBoundingClientRect().height+c.getBoundingClientRect().height+o.getBoundingClientRect().height,f=n===K.Horizontal?c.getBoundingClientRect().width:c.getBoundingClientRect().height,p={idx:t-1,a:e,b:o,gutter:c,parent:a,start:l,end:u,size:d,gutterSize:f,aSizePct:100/r.length,bSizePct:100/r.length};s.push(p)}})),Object.assign(Object.assign({},e),{pairs:s})}case G.StartDragging:{let{gutterIdx:n}=t.payload;return Object.assign(Object.assign({},e),{isDragging:!0,draggingIdx:n})}case G.StopDragging:return Object.assign(Object.assign({},e),{isDragging:!1});case G.CalculateSizes:{let{direction:n,gutterIdx:r}=t.payload,i=e.pairs[r],a=Ct(n,i.parent);if(!a)throw Error(`Cannot calculate sizes - 'pair.parent' has undefined or zero size.`);let o=i.gutter[n===K.Horizontal?`clientWidth`:`clientHeight`],{aGutterSize:s,bGutterSize:c}=Et(o,r===0,r===e.pairs.length-1),l,u,d,f,p;return n===K.Horizontal?(l=i.a.getBoundingClientRect().left,u=i.b.getBoundingClientRect().right,f=(i.a.getBoundingClientRect().width+s)/a*100,p=(i.b.getBoundingClientRect().width+c)/a*100,d=i.a.getBoundingClientRect().width+s+c+i.b.getBoundingClientRect().width):(l=i.a.getBoundingClientRect().top,u=i.b.getBoundingClientRect().bottom,f=(i.a.getBoundingClientRect().height+s)/a*100,p=(i.b.getBoundingClientRect().height+c)/a*100,d=i.a.getBoundingClientRect().height+s+c+i.b.getBoundingClientRect().height),e.pairs[r]=Object.assign(Object.assign({},i),{start:l,end:u,size:d,aSizePct:f,bSizePct:p,gutterSize:o}),Object.assign({},e)}default:return e}}function Ot(e,t=0,n=[]){return p.toArray(e).reduce(((e,r,i)=>((0,St.isFragment)(r)?e.push.apply(e,Ot(r.props.children,t+1,n.concat(r.key||i))):_e(r)?e.push(le(r,{key:n.concat(String(r.key)).join(`.`)})):typeof r!=`string`&&typeof r!=`number`||e.push(r),e)),[])}(function(e){e[e.SetIsReadyToCompute=0]=`SetIsReadyToCompute`,e[e.CreatePairs=1]=`CreatePairs`,e[e.CalculateSizes=2]=`CalculateSizes`,e[e.StartDragging=3]=`StartDragging`,e[e.StopDragging=4]=`StopDragging`})(G||={});var kt=e=>`changedTouches`in e,K,At;(function(e){e.Horizontal=`Horizontal`,e.Vertical=`Vertical`})(K||={}),function(e){e.Light=`Light`,e.Dark=`Dark`}(At||={});var jt=typeof window<`u`&&`ontouchstart`in window;function Mt(e){return e===K.Horizontal?`col-resize`:`row-resize`}var Nt={isReady:!1,isDragging:!1,pairs:[]};function Pt({direction:e=K.Horizontal,minWidths:t=[],minHeights:n=[],initialSizes:r,gutterTheme:i=At.Dark,gutterClassName:a,draggerClassName:o,children:s,onResizeStarted:c,onResizeFinished:l,classes:u=[]}){let f=Ot(s),[p,m]=he(Dt,Nt),h=ye(null),g=ye([]),_=ye([]);g.current=[],_.current=[];let v=V.useCallback((e=>{m({type:G.SetIsReadyToCompute,payload:{isReady:e}})}),[]),y=V.useCallback(((e,t)=>{m({type:G.StartDragging,payload:{gutterIdx:t}});let n=p.pairs[t];c==null||c(n.idx),n.a.style.userSelect=`none`,n.b.style.userSelect=`none`,n.gutter.style.cursor=Mt(e),n.parent.style.cursor=Mt(e),document.body.style.cursor=Mt(e)}),[p.pairs]),ee=V.useCallback((()=>{m({type:G.StopDragging});let t=[];for(let n=0;n<p.pairs.length;n++){let r=p.pairs[n],i=Ct(e,r.parent);if(i===void 0)throw Error(`Cannot call the 'onResizeFinished' callback - parentSize is undefined`);if(r.gutterSize===void 0)throw Error(`Cannot call 'onResizeFinished' callback - gutterSize is undefined`);let a=n===0,o=n===p.pairs.length-1,s=r.a.getBoundingClientRect()[e===K.Horizontal?`width`:`height`],{aGutterSize:c,bGutterSize:l}=Et(r.gutterSize,a,o),u=(s+c)/i*100;if(t.push(u),o){let n=(r.b.getBoundingClientRect()[e===K.Horizontal?`width`:`height`]+l)/i*100;t.push(n)}}if(p.draggingIdx===void 0)throw Error(`Could not reset cursor and user-select because 'state.draggingIdx' is undefined`);let n=p.pairs[p.draggingIdx];l==null||l(n.idx,t),n.a.style.userSelect=``,n.b.style.userSelect=``,n.gutter.style.cursor=``,n.parent.style.cursor=``,document.body.style.cursor=``}),[p.draggingIdx,p.pairs,e]),b=V.useCallback(((e,t)=>{m({type:G.CalculateSizes,payload:{direction:e,gutterIdx:t}})}),[]),x=V.useCallback(((e,t,n)=>{m({type:G.CreatePairs,payload:{direction:e,children:t,gutters:n}})}),[]),S=V.useCallback(((e,t,n,r)=>{let i=t[0].parentNode;if(!i)throw Error(`Cannot set initial sizes - parent is undefined`);if(Ct(e,i)===void 0)throw Error(`Cannot set initial sizes - parent has undefined size`);t.forEach(((i,a)=>{let o=a===0,s=a===t.length-1,c,l=0;t.length>1&&(l=n[s?a-1:a].getBoundingClientRect()[e===K.Horizontal?`width`:`height`],l=o||s?l/2:l),c=r&&a<r.length?`calc(${r[a]}% - ${l}px)`:`calc(${100/t.length}% - ${l}px)`,e===K.Horizontal?(i.style.width=c,i.style.height=`100%`):(i.style.height=c,i.style.width=`100%`)}))}),[]),C=V.useCallback(((e,t)=>{if(p.draggingIdx===void 0)throw Error(`Cannot adjust size - 'draggingIdx' is undefined`);let n=p.pairs[p.draggingIdx];if(n.size===void 0)throw Error(`Cannot adjust size - 'pair.size' is undefined`);if(n.gutterSize===void 0)throw Error(`Cannot adjust size - 'pair.gutterSize' is undefined`);let r=n.aSizePct+n.bSizePct,i=t/n.size*r,a=r-t/n.size*r,o=p.draggingIdx===0,s=p.draggingIdx===p.pairs.length-1,{aGutterSize:c,bGutterSize:l}=Et(n.gutterSize,o,s),u=`calc(${i}% - ${c}px)`,d=`calc(${a}% - ${l}px)`;e===K.Horizontal?(n.a.style.width=u,n.b.style.width=d):(n.a.style.height=u,n.b.style.height=d)}),[p.draggingIdx,p.pairs,e]),w=V.useCallback(((e,t,n)=>{if(!p.isDragging)return;if(p.draggingIdx===void 0)throw Error(`Cannot drag - 'draggingIdx' is undefined`);let r=p.pairs[p.draggingIdx];if(r.start===void 0)throw Error(`Cannot drag - 'pair.start' is undefined`);if(r.size===void 0)throw Error(`Cannot drag - 'pair.size' is undefined`);if(r.gutterSize===void 0)throw Error(`Cannot drag - 'pair.gutterSize' is undefined`);let i=function(e,t){let n=kt(t)?t.changedTouches[0]:t;return e===K.Horizontal?n.clientX:n.clientY}(t,e)-r.start,a=16,o=16;n.length>p.draggingIdx&&(a=n[p.draggingIdx]),n.length>=p.draggingIdx+1&&(o=n[p.draggingIdx+1]),i<r.gutterSize+a&&(i=r.gutterSize+a),i>=r.size-(r.gutterSize+o)&&(i=r.size-(r.gutterSize+o)),C(t,i)}),[p.isDragging,p.draggingIdx,p.pairs,C]),te=()=>{if(p.isDragging){if(p.draggingIdx===void 0)throw Error(`Cannot calculate sizes after dragging = 'state.draggingIdx' is undefined`);b(e,p.draggingIdx),ee()}},T=r=>{p.isDragging&&(kt(r)&&r.preventDefault(),w(r,e,e===K.Horizontal?t:n))};function ne(e,t){if(!e.current)throw Error(`Can't add element to ref object - ref isn't initialized`);t&&!e.current.includes(t)&&e.current.push(t)}return wt(`mouseup`,te,[p.isDragging,ee]),wt(`mousemove`,T,[e,p.isDragging,w,t,n]),wt(`touchend`,te,[p.isDragging,ee],{condition:jt}),wt(`touchmove`,T,[e,p.isDragging,w,t,n],{condition:jt,passive:!jt}),H((function(){if(!h.current)return;let t=h.current.parentElement;if(!t)return;let n=new ResizeObserver((()=>{let n=getComputedStyle(t),r=e===K.Horizontal?t.clientWidth:t.clientHeight;v(!!n&&!!r)}));return n.observe(t),()=>{n.disconnect()}}),[h.current,e]),H((function(){if(p.isReady&&(!g.current||g.current[0].offsetParent)){if(!g.current||!_.current)throw Error(`Cannot create pairs - either variable 'childRefs' or 'gutterRefs' is undefined`);f.length<=1?S(e,g.current,_.current,r):(S(e,g.current,_.current,r),x(e,g.current,_.current))}}),[s,p.isReady,e,S,x,r]),d(`div`,Object.assign({className:`__dbk__container ${e}`,ref:h},{children:p.isReady&&f.map(((t,n)=>D(V.Fragment,{children:[d(`div`,Object.assign({ref:e=>ne(g,e),className:`__dbk__child-wrapper `+(n<u.length?u[n]:``)},{children:t}),void 0),n<f.length-1&&d(Tt,{ref:e=>ne(_,e),className:a,theme:i,draggerClassName:o,direction:e,onDragging:()=>{b(e,t=n),y(e,t);return;var t}},void 0)]},n)))}),void 0)}function Ft(e){let[,t]=ut(()=>({accept:[`enum`],drop:()=>({enumId:e.categoryData._id}),collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})})),n=k.getInvertedColor(e.categoryData.common.color,e.themeType,!0);return D(I,{component:`span`,ref:e=>{t(e)},style:{...e.styles.categoryTitle,color:n},sx:{".enum-button":{visibility:lt.isTouchDevice()?`visible`:`hidden`},"&:hover .enum-button":{visibility:`visible`}},children:[e.categoryData.common.icon?d(F,{style:e.styles.icon,src:e.categoryData.common.icon}):null,typeof e.categoryData.common.name==`string`?e.categoryData.common.name:e.categoryData.common.name[e.lang]||e.categoryData.common.name.en,d(h,{className:`enum-button`,size:`small`,style:{color:n},onClick:()=>{e.showEnumEditDialog(e.categoryData,!1)},children:d(B,{title:e.t(`Edit`),placement:`top`,slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(pe,{})})}),e.categoryData.common.dontDelete?null:d(h,{className:`enum-button`,size:`small`,style:{color:n},onClick:()=>e.showEnumDeleteDialog(e.categoryData),children:d(B,{title:e.t(`Delete`),placement:`top`,slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(u,{})})})]})}var q={contentRoot:{padding:`16px 24px`},dialogTitle:{borderBottom:`1px solid #00000020`,padding:0,width:`100%`},dialogActions:{borderTop:`1px solid #00000020`,width:`100%`},dialog:{},iconPreview:{height:32,width:32},colorPicker:{},formIcon:{margin:10,opacity:.6},formContainer:{display:`flex`,justifyContent:`center`,alignItems:`center`},formControl:{display:`flex`,padding:`0 0 24px 0`,flexGrow:1e3}},It=e=>e.replace(k.FORBIDDEN_CHARS,`_`).replace(/\s/g,`_`).replace(/\./g,`_`).replace(/,/g,`_`).replace(/__/g,`_`).replace(/__/g,`_`).toLowerCase(),Lt=e=>e.split(`.`).pop()||``,Rt=(e,t)=>e&&typeof e==`object`?e[t]||e.en:e||``,zt=(e,t)=>{let n=e.split(`.`);return n[n.length-1]=t,n.join(`.`)};function Bt(e){let t=e.enums.find(t=>t._id===e.enum._id),r=!!Lt(e.enum._id)&&!!e.getName(e.enum.common.name);return e.isNew&&t&&r&&(r=!1),D(n,{fullWidth:e.innerWidth<500,open:!0,onClose:(t,n)=>{n!==`backdropClick`&&n!==`escapeKeyDown`&&e.onClose()},children:[d(x,{style:{...q.dialogTitle,padding:12},children:e.t(`Enum parameters`)}),d(v,{sx:{"&.MuiDialogContent-root":q.contentRoot},children:D(ae,{container:!0,spacing:2,style:q.dialog,children:[d(ae,{size:{xs:12,md:6},children:d(vt,{label:`Name`,t:e.t,value:e.getName(e.enum.common.name),onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));!e.enum.common.dontDelete&&It(e.getName(n.common.name))===Lt(n._id)&&(n._id=zt(n._id,It(t))),n.common.name=t,e.onChange(n)},autoComplete:`off`,icon:N,styles:q})}),d(ae,{size:{xs:12,md:6},children:d(vt,{label:`ID edit`,t:e.t,disabled:e.enum.common.dontDelete,value:e.enum._id.split(`.`)[e.enum._id.split(`.`).length-1],onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n._id=zt(n._id,It(t)),e.onChange(n)},icon:tt,styles:q})}),d(ae,{size:{xs:12,md:6},children:d(vt,{label:`ID preview`,t:e.t,disabled:!0,value:e.enum._id,icon:rt,styles:q})}),d(ae,{size:{xs:12,md:6},children:d(vt,{label:`Description`,t:e.t,value:Rt(e.enum.common.desc,e.lang),onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n.common.desc=t,e.onChange(n)},icon:Ue,styles:q})}),d(ae,{size:{xs:12,md:6},children:d(Ge,{label:`Icon`,onlyDevices:e.enum._id.startsWith(`enum.functions.`),onlyRooms:e.enum._id.startsWith(`enum.rooms.`),value:e.enum.common.icon,onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n.common.icon=t,e.onChange(n)},previewStyle:q.iconPreview,icon:be,customStyles:q})}),d(ae,{size:{xs:12,md:6},children:d(bt,{label:`Color`,value:e.enum.common.color||``,previewStyle:q.iconPreview,onChange:t=>{let n=JSON.parse(JSON.stringify(e.enum));n.common.color=t,e.onChange(n)},icon:nt,style:q.colorPicker,styles:q,t:e.t})})]})}),D(Se,{style:q.dialogActions,children:[d(W,{variant:`contained`,color:`primary`,autoFocus:!0,onClick:()=>e.saveData(),disabled:!r||!e.changed,startIcon:d(ie,{}),children:e.t(`Save`)}),d(W,{variant:`contained`,color:`grey`,onClick:e.onClose,startIcon:d(m,{}),children:e.t(`Cancel`)})]})]})}l();var Vt={icon:{width:32,height:32},customGroupButton:{},enumTemplateButton:{justifyContent:`end`,margin:4,padding:`4px 8px`},enumTemplateLabel:{textAlign:`right`,opacity:.4,overflow:`hidden`,textOverflow:`ellipsis`,flexGrow:1},fullHeight:{height:`calc(100% - 32px)`,maxHeight:900},filter:{marginLeft:16,marginTop:0,marginBottom:0},content:{display:`grid`,width:`100%`,gridTemplateColumns:`repeat(4,1fr)`},title:{lineHeight:`45px`,verticalAlign:`middle`,display:`inline-block`}},Ht=class extends Fe{constructor(e){super(e),E(this,`templates`,void 0),this.templates=T(e.prefix.startsWith(`enum.functions`)?`devices`:`rooms`),this.state={filter:``}}render(){return D(n,{maxWidth:`md`,fullWidth:!0,sx:{"& .MuiPaper-root":Vt.fullHeight},open:!0,onClose:this.props.onClose,children:[D(x,{children:[this.props.t(this.props.prefix.startsWith(`enum.functions`)?`Create new function`:`Create new room`),d(Ce,{variant:`standard`,style:Vt.filter,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value.toLowerCase()}),placeholder:this.props.t(`Filter`),margin:`dense`,slotProps:{input:{endAdornment:this.state.filter?d(h,{tabIndex:-1,size:`small`,onClick:()=>this.setState({filter:``}),children:d(C,{})}):null}}})]}),d(v,{style:{textAlign:`center`},children:d(`div`,{style:Vt.content,children:this.templates.map((e,t)=>{let n=lt.getText(e.name,this.props.lang)||e._id;return this.props.enums[`${this.props.prefix}.${e._id}`]?null:!this.state.filter||n.toLowerCase().includes(this.state.filter)?d(W,{color:`grey`,variant:`outlined`,onClick:()=>{this.props.onClose(),this.props.createEnumTemplate(this.props.prefix,{_id:`${this.props.prefix}.${e._id}`,type:`enum`,common:{name:e.name,icon:e.icon},native:{}})},style:Vt.enumTemplateButton,startIcon:d(F,{src:e.icon,style:Vt.icon}),children:d(`span`,{style:Vt.enumTemplateLabel,children:n})},t):null})})}),D(Se,{children:[d(W,{variant:`contained`,color:`primary`,style:Vt.customGroupButton,onClick:()=>{this.props.onClose(),this.props.showEnumEditDialog(this.props.getEnumTemplate(this.props.prefix),!0)},startIcon:d(Ze,{}),children:this.props.prefix===`enum.rooms`?this.props.t(`Custom room`):this.props.prefix===`enum.functions`?this.props.t(`Custom function`):this.props.t(`Custom enumeration`)}),d(W,{color:`grey`,variant:`contained`,onClick:this.props.onClose,startIcon:d(m,{}),children:this.props.t(`Cancel`)})]})]})}};function Ut(e){return D(n,{open:!0,onClose:e.onClose,children:[d(x,{children:e.t(`Please confirm`)}),d(v,{children:d(y,{children:e.t(`Do you want to delete enum "%s"?`,e.getName(e.enum.common.name))})}),D(Se,{children:[d(W,{variant:`contained`,autoFocus:!0,color:`primary`,onClick:()=>e.deleteEnum(e.enum._id),startIcon:d(u,{}),children:e.t(`Delete`)}),d(W,{variant:`contained`,color:`grey`,onClick:e.onClose,startIcon:d(m,{}),children:e.t(`Cancel`)})]})]})}var Wt=[`state`,`channel`,`device`];function Gt(e,t){var n;(n=e.children)==null||n.forEach(e=>{e.data.sumVisibility!==!1&&(e.data.obj&&Wt.includes(e.data.obj.type)?t.push(e.data.obj._id):Gt(e,t))})}var Kt=e=>{let[t,n]=z({DragWrapper:null}),r=V.useRef(null);return H(()=>{n({DragWrapper:t=>{var n,i,a,s;let c={type:`object`,end:(t,n)=>{let r=n.getDropResult();if(t.data&&r){if(t.data.obj)e.addItemToEnum(t.data.obj._id,r.enumId);else{let n=[];Gt(t,n),n.length&&e.addFolderToEnum(t.data.id,n,r.enumId)}}},item:{data:t.item.data,children:t.item.children,preview:t.item.data&&t.item.data.obj?D(We,{variant:`outlined`,style:e.stylesParent.enumGroupMember,children:[(n=t.item.data.obj.common)!=null&&n.icon?d(F,{style:e.stylesParent.icon,src:r.current?o(r.current,t.item.data.obj._id,e.lang):t.item.data.obj.common.icon}):b[t.item.data.obj.type]||d(Oe,{style:e.stylesParent.icon}),D(`div`,{children:[d(`div`,{children:(i=t.item.data.obj.common)!=null&&i.name?e.getName((a=t.item.data.obj.common)==null?void 0:a.name):t.item.data.obj._id}),(s=t.item.data.obj.common)!=null&&s.name?d(`div`,{style:{fontStyle:`italic`,fontSize:`smaller`,opacity:.7},children:t.item.data.obj._id}):null]})]},t.item.data.obj._id):null},collect:e=>({isDragging:e.isDragging()})},[{isDragging:l},u,f]=dt(c);return H(()=>{f(_t(),{captureDraggingState:!0})},[f]),d(I,{sx:t.style,ref:e=>{u(e)},style:{backgroundColor:l?`rgba(100,152,255,0.1)`:void 0},children:t.children},t.item.data.id)}})},[e.stylesParent,e.addItemToEnum,e.addFolderToEnum,e.getName]),t?d(c,{t:e.t,socket:e.socket,types:[`state`,`channel`,`device`],columns:[`name`,`type`,`role`,`room`,`func`],lang:e.lang,dragEnabled:!0,theme:e.theme,themeName:e.theme.name,themeType:e.theme.palette.mode,DragWrapper:t.DragWrapper||void 0,setObjectsReference:e=>r.current=e,levelPadding:10}):null};function qt(e,t,n){var r,i;if(!e||typeof e!=`object`)return!1;let a=e;if(a.enumId){let e=a.enumId.split(`.`).slice(0,-1).join(`.`);return a.enumId!==n&&!n.startsWith(`${a.enumId}.`)&&e!==n}if(!t)return!1;let o=a.memberId||((r=a.data)==null?void 0:r.id);return!!o&&!((i=t.common)!=null&&(i=i.members)!=null&&i.includes(o))}function Jt(e,t){let n=e=>{var n;return(t((n=e.data)==null||(n=n.common)==null?void 0:n.name)||e.id.split(`.`).pop()||``).toLowerCase()};return[...e].sort((e,t)=>n(e).localeCompare(n(t)))}var J={list:{py:.5},row:{gap:`6px`,py:`4px`,pr:1,mx:.5,my:`1px`,minHeight:40,borderRadius:`6px`},rowDropOver:e=>({outline:`2px dashed ${e.palette.primary.main}`,outlineOffset:`-2px`}),expander:{width:28,flexShrink:0,display:`flex`,justifyContent:`center`},colorStripe:{width:4,alignSelf:`stretch`,borderRadius:`2px`,flexShrink:0},iconWrapper:{display:`flex`,flexShrink:0},icon:{width:24,height:24},name:{flexGrow:1,minWidth:0},folderName:{fontStyle:`italic`,opacity:.7},count:{fontSize:12,lineHeight:`20px`,minWidth:22,px:`6px`,borderRadius:`10px`,textAlign:`center`,flexShrink:0,backgroundColor:`action.selected`},preview:e=>({px:1.5,py:.75,borderRadius:`6px`,backgroundColor:e.palette.background.paper,boxShadow:e.shadows[4],whiteSpace:`nowrap`}),empty:{p:3,textAlign:`center`,opacity:.6}};function Yt(e,t){var n;return!t.search||t.getName((n=e.data)==null||(n=n.common)==null?void 0:n.name).toLowerCase().includes(t.search)||e.id.toLowerCase().includes(t.search)||Object.values(e.children).some(e=>Yt(e,t))}function Xt(e,t){return Jt(e.filter(e=>Yt(e,t)),t.getName)}function Zt(e){var t,n,r,i;let{item:a,level:o,list:s}=e,c=a.data,l=s.getName(c==null||(t=c.common)==null?void 0:t.name)||a.id.split(`.`).pop()||a.id,u=Xt(Object.values(a.children),s),f=!s.search&&!!s.closed[a.id],p=lt.isTouchDevice(),[{isOver:m,canDrop:g},_]=ut(()=>({accept:[`object`,`enum`,`enum-member`],drop:(e,t)=>t.didDrop()?void 0:{enumId:a.id},canDrop:e=>qt(e,c,a.id),collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}),[c,a.id]),[{isDragging:v},y,ee]=dt(()=>{var e;return{type:`enum`,item:()=>({enumId:a.id,preview:d(I,{sx:J.preview,children:l})}),canDrag:!!c&&!((e=c.common)!=null&&e.dontDelete),end:(e,t)=>{let n=t.getDropResult();n!=null&&n.enumId&&s.moveEnum(e.enumId,n.enumId)},collect:e=>({isDragging:e.isDragging()})}},[a.id,c,l,s.moveEnum]);H(()=>{ee(_t(),{captureDraggingState:!0})},[ee]);let b=(c==null||(n=c.common)==null||(n=n.members)==null?void 0:n.length)||0;return D(O,{children:[D(Re,{id:`enum-row-${a.id}`,ref:e=>{_(e),p||y(e)},selected:s.selectedId===a.id,onClick:()=>c?s.onSelect(a.id):s.onToggle(a.id),sx:k.getStyle(s.theme,J.row,{pl:`${4+o*20}px`},m&&g&&J.rowDropOver),style:{opacity:v||s.updating.includes(a.id)?.5:1},children:[d(I,{sx:J.expander,children:u.length?d(h,{size:`small`,onClick:e=>{e.stopPropagation(),s.onToggle(a.id)},children:d(f?at:Qe,{fontSize:`small`})}):null}),d(I,{component:`span`,sx:J.colorStripe,style:{backgroundColor:(c==null||(r=c.common)==null?void 0:r.color)||`transparent`}}),d(`span`,{style:J.iconWrapper,ref:p?e=>{y(e)}:void 0,children:c!=null&&(i=c.common)!=null&&i.icon?d(F,{src:c.common.icon,style:J.icon}):d(Oe,{style:J.icon})}),d(I,{sx:J.name,children:d(L,{variant:`body2`,noWrap:!0,sx:c?void 0:J.folderName,title:a.id,children:l})}),b?d(I,{component:`span`,sx:J.count,children:b}):null]}),u.length&&!f?u.map(e=>d(Zt,{item:e,level:o+1,list:s},e.id)):null]})}function Qt(e){let t=Xt(e.items,e);return t.length?d(w,{dense:!0,sx:J.list,children:t.map(t=>d(Zt,{item:t,level:0,list:e},t.id))}):d(I,{sx:J.empty,children:e.t(e.search?`No entries found`:`There are no entries in this category yet`)})}var $t=!1,en=new Set;function tn(e){$t!==e&&($t=e,en.forEach(e=>e()))}function nn(e){tn(e.shiftKey||e.ctrlKey||e.altKey)}function rn(e){var t;$t&&((t=e.dataTransfer)==null?void 0:t.dropEffect)===`move`&&(e.dataTransfer.dropEffect=`copy`)}function an(){tn(!1),[`dragenter`,`dragover`,`drop`].forEach(e=>window.addEventListener(e,nn,!0)),[`dragenter`,`dragover`].forEach(e=>window.addEventListener(e,rn))}function on(){[`dragenter`,`dragover`,`drop`].forEach(e=>window.removeEventListener(e,nn,!0)),[`dragenter`,`dragover`].forEach(e=>window.removeEventListener(e,rn));let e=$t;return tn(!1),e}function sn(e){return en.add(e),()=>en.delete(e)}function cn(){return we(sn,()=>$t)}var Y={root:{display:`flex`,flexDirection:`column`,height:`100%`,minWidth:0,flexGrow:1},dropActive:e=>({outline:`2px dashed ${e.palette.primary.main}`,outlineOffset:`-4px`}),header:e=>({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1.5,px:2,py:1.5,borderBottom:`1px solid ${e.palette.divider}`,flexShrink:0}),tile:e=>({width:52,height:52,borderRadius:`10px`,border:`2px solid ${e.palette.divider}`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0}),tileIcon:{width:36,height:36},headerText:{flexGrow:1,minWidth:160},mono:{fontFamily:`monospace`,opacity:.7},headerDescription:{opacity:.8},headerActions:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:.5},content:{flexGrow:1,overflowY:`auto`,p:2,display:`flex`,flexDirection:`column`,gap:1.5},subEntries:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:1},subEntriesLabel:{opacity:.7},group:e=>({border:`1px solid ${e.palette.divider}`,borderRadius:`8px`,overflow:`hidden`,flexShrink:0}),groupHeader:e=>({display:`flex`,alignItems:`center`,gap:1.5,px:1.5,py:.75,backgroundColor:e.palette.action.hover}),row:e=>({display:`flex`,alignItems:`center`,gap:1.5,pl:5,pr:1.5,py:.5,borderTop:`1px solid ${e.palette.divider}`,"&:hover":{backgroundColor:e.palette.action.hover}}),groupName:{fontWeight:600},rowIconWrapper:{display:`flex`,flexShrink:0},rowIcon:{width:24,height:24},missingIcon:{width:24,height:24,color:`warning.main`},rowText:{flexGrow:1,minWidth:0},rowId:{fontFamily:`monospace`,opacity:.6,display:`block`},role:{fontFamily:`monospace`,opacity:.6,width:150,flexShrink:0,display:{xs:`none`,md:`block`}},value:{width:110,flexShrink:0,textAlign:`right`,fontVariantNumeric:`tabular-nums`},chips:{display:`flex`,flexWrap:`wrap`,justifyContent:`flex-end`,gap:.5,maxWidth:{xs:120,md:260}},chipIcon:{width:16,height:16},removePlaceholder:{width:30,flexShrink:0},dragHint:{display:`flex`,alignItems:`center`,gap:1,opacity:.7,flexShrink:0},dragHintIcon:{fontSize:18},emptyMembers:e=>({border:`2px dashed ${e.palette.divider}`,borderRadius:`8px`,p:4,textAlign:`center`,opacity:.7}),preview:e=>({px:1.5,py:.75,borderRadius:`6px`,backgroundColor:e.palette.background.paper,boxShadow:e.shadows[4],whiteSpace:`nowrap`}),previewHint:{display:`flex`,alignItems:`center`,gap:.5,fontSize:11,opacity:.7},previewHintCopy:{color:`primary.main`,fontWeight:600,opacity:1},previewHintIcon:{fontSize:14}};function ln(e,t,n,r){let i=[],a={},o=[],s=[];for(let r of e){let e=t[r];if(!e){o.push(r);continue}let c=r;if(e.type===`state`||e.type===`channel`){let i=k.getParentId(r),a=i?t[i]||n[i]:void 0;i&&(e.type===`state`||(a==null?void 0:a.type)===`device`)&&(c=i)}let l=a[c];l||(l={id:c,obj:t[c]||n[c],isMember:!1,states:[]},a[c]=l,i.push(l)),c===r?(l.isMember=!0,l.obj=e):(l.states.push(e),e.type===`state`&&s.push(r))}let c=(e,t)=>{var n;return(r(e==null||(n=e.common)==null?void 0:n.name)||t.split(`.`).pop()||t).toLowerCase()};return i.sort((e,t)=>c(e.obj,e.id).localeCompare(c(t.obj,t.id))),i.forEach(e=>e.states.sort((e,t)=>c(e,e._id).localeCompare(c(t,t._id)))),{groups:i,missing:o,stateIds:s}}function un(e,t){var n,r;if(!e||e.val===null||e.val===void 0)return`–`;let i=e.val;typeof i==`number`&&(i=Math.round(i*1e3)/1e3);let a=(n=t.common)==null?void 0:n.states;if(a&&typeof a==`object`&&!Array.isArray(a)){let e=a[String(i)];if(e)return e}let o=typeof i==`object`?JSON.stringify(i):String(i),s=(r=t.common)==null?void 0:r.unit;return s?`${o} ${s}`:o}function dn(e){let t=cn(),{t:n}=e,i=null;return t?i=D(I,{sx:k.getStyle(e.theme,Y.previewHint,Y.previewHintCopy),children:[d(r,{sx:Y.previewHintIcon}),n(`Copy · stays in "%s" too`,e.enumName)]}):lt.isTouchDevice()||(i=D(I,{sx:Y.previewHint,children:[d(pt,{sx:Y.previewHintIcon}),n(`Move · hold Shift, Ctrl or Alt to copy`)]})),D(I,{sx:Y.preview,children:[d(`div`,{children:e.name}),i]})}function fn(e){var t,n;let{obj:r,t:i}=e,a=e.isMember&&!r,o=e.getName(r==null||(t=r.common)==null?void 0:t.name)||e.memberId.split(`.`).pop()||e.memberId,c=e.isMember&&!!r,l=lt.isTouchDevice(),[{isDragging:u},f,p]=dt(()=>({type:`enum-member`,item:()=>(an(),{memberId:e.memberId,fromEnumId:e.enumId,preview:d(dn,{name:o,enumName:e.enumName,t:i,theme:e.theme})}),canDrag:c,end:(t,n)=>{let r=on(),i=n.getDropResult();i!=null&&i.enumId&&i.enumId!==t.fromEnumId&&e.onMove(t.memberId,i.enumId,r)},collect:e=>({isDragging:e.isDragging()})}),[e.memberId,e.enumId,e.enumName,e.onMove,e.theme,o,c,i]);H(()=>{p(_t(),{captureDraggingState:!0})},[p]);let _=r&&Ke(r)||e.parent&&Ke(e.parent)||null,v;v=a?d(R,{sx:Y.missingIcon}):_?d(F,{src:_,style:Y.rowIcon}):!r||r.type===`channel`?d(g,{style:Y.rowIcon}):r.type===`device`?d(Le,{style:Y.rowIcon}):d(M,{style:Y.rowIcon});let y=(r==null?void 0:r.type)===`state`?un(e.state,r):void 0;return D(I,{ref:e=>{l||f(e)},sx:e.header?Y.groupHeader:Y.row,style:{opacity:u?.4:1,cursor:c&&!l?`grab`:void 0},children:[d(`span`,{style:Y.rowIconWrapper,ref:l?e=>{f(e)}:void 0,children:v}),D(I,{sx:Y.rowText,children:[d(L,{variant:`body2`,noWrap:!0,sx:e.header?Y.groupName:void 0,children:a?e.memberId:o}),d(L,{variant:`caption`,component:`div`,noWrap:!0,sx:Y.rowId,children:a?i(`Object does not exist any more`):e.memberId})]}),r!=null&&(n=r.common)!=null&&n.role?d(L,{variant:`caption`,noWrap:!0,sx:Y.role,children:r.common.role}):null,y===void 0?null:d(L,{variant:`body2`,noWrap:!0,sx:Y.value,style:e.state&&!e.state.ack?{fontStyle:`italic`}:void 0,title:y,children:y}),d(I,{sx:Y.chips,children:e.chips.map(t=>{var n,r;return d(s,{size:`small`,label:e.getName((n=t.common)==null?void 0:n.name)||t._id.split(`.`).pop(),icon:(r=t.common)!=null&&r.icon?d(F,{src:t.common.icon,style:Y.chipIcon}):void 0,title:t._id,onClick:()=>e.onSelect(t._id)},t._id)})}),e.isMember?d(B,{title:i(`Remove`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{size:`small`,onClick:()=>e.onRemove(e.memberId),children:d(m,{fontSize:`small`})})}):d(`span`,{style:Y.removePlaceholder})]})}function pn(e){var t,n,i,a,o,c;let{enumItem:l,t:f}=e,p=((t=l.common)==null?void 0:t.members)||[],m=`${l._id.split(`.`).slice(0,2).join(`.`)}.`,g=U(()=>Object.values(e.enums).filter(e=>(e._id.startsWith(`enum.rooms.`)||e._id.startsWith(`enum.functions.`))&&!e._id.startsWith(m)),[e.enums,m]),_=e=>g.filter(t=>{var n;return(n=t.common)==null||(n=n.members)==null?void 0:n.includes(e)}),{groups:v,missing:y,stateIds:b}=U(()=>ln(p,e.members,e.parents,e.getName),[p,e.members,e.parents,e.getName]),[x,S]=z({}),C=b.join(`
|
|
91
|
-
`);H(()=>{let t=C?C.split(`
|
|
92
|
-
`):[],n=(e,t)=>S(n=>({...n,[e]:t}));return t.length&&e.socket.subscribeState(t,n).catch(e=>console.error(`Cannot subscribe on the members:`,e)),()=>{t.length&&e.socket.unsubscribeState(t,n)}},[e.socket,C]);let[{isOver:w,canDrop:te},T]=ut(()=>({accept:[`object`,`enum-member`],drop:(e,t)=>t.didDrop()?void 0:{enumId:l._id},canDrop:e=>qt(e,l,l._id),collect:e=>({isOver:e.isOver(),canDrop:e.canDrop()})}),[l]),ne=e.getName((n=l.common)==null?void 0:n.name)||l._id.split(`.`).pop(),E=(i=l.common)!=null&&i.desc?e.getName(l.common.desc):``,re=Jt(e.subEntries,e.getName),O={enumId:l._id,enumName:ne||l._id,t:f,theme:e.theme,getName:e.getName,onSelect:e.onSelect,onRemove:e.onRemoveMember,onMove:e.onMoveMember};return D(I,{ref:e=>{T(e)},sx:k.getStyle(e.theme,Y.root,w&&te&&Y.dropActive),style:{opacity:e.updating?.6:1},children:[D(I,{sx:Y.header,children:[e.onBack?d(B,{title:f(`Back`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{onClick:e.onBack,children:d(ee,{})})}):null,d(I,{sx:Y.tile,style:(a=l.common)!=null&&a.color?{borderColor:l.common.color}:void 0,children:(o=l.common)!=null&&o.icon?d(F,{src:l.common.icon,style:Y.tileIcon}):d(Oe,{style:Y.tileIcon})}),D(I,{sx:Y.headerText,children:[d(L,{variant:`h6`,noWrap:!0,children:ne}),D(L,{variant:`caption`,component:`div`,noWrap:!0,sx:Y.mono,children:[l._id,` · `,f(`%s members`,p.length)]}),E?d(L,{variant:`body2`,sx:Y.headerDescription,children:E}):null]}),D(I,{sx:Y.headerActions,children:[d(W,{variant:`contained`,size:`small`,startIcon:d(Xe,{}),onClick:e.onAddObjects,children:f(`Add objects`)}),d(B,{title:f(`Add child`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{onClick:e.onAddChild,children:d(r,{})})}),d(B,{title:f(`Edit`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{onClick:e.onEdit,children:d(pe,{})})}),d(B,{title:f(`Clone`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{onClick:e.onClone,children:d(it,{})})}),d(B,{title:f(`Delete`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(`span`,{children:d(h,{disabled:!!((c=l.common)!=null&&c.dontDelete),onClick:e.onDelete,children:d(u,{})})})})]})]}),D(I,{sx:Y.content,children:[re.length?D(I,{sx:Y.subEntries,children:[D(L,{variant:`body2`,sx:Y.subEntriesLabel,children:[f(`Sub-entries`),`:`]}),re.map(t=>{var n,r;return d(s,{label:e.getName((n=t.data)==null||(n=n.common)==null?void 0:n.name)||t.id.split(`.`).pop(),icon:(r=t.data)!=null&&(r=r.common)!=null&&r.icon?d(F,{src:t.data.common.icon,style:Y.chipIcon}):void 0,disabled:!t.data,onClick:()=>e.onSelect(t.id)},t.id)})]}):null,v.map(e=>D(I,{sx:Y.group,children:[d(fn,{...O,header:!0,memberId:e.id,obj:e.obj,isMember:e.isMember,chips:_(e.id)}),e.states.map(t=>j(fn,{...O,key:t._id,memberId:t._id,obj:t,parent:e.obj,isMember:!0,state:x[t._id],chips:_(t._id)}))]},e.id)),y.length?d(I,{sx:Y.group,children:y.map(e=>j(fn,{...O,key:e,header:!0,memberId:e,isMember:!0,chips:[]}))}):null,p.length>0&&!e.onBack&&!lt.isTouchDevice()?D(L,{variant:`caption`,component:`div`,sx:Y.dragHint,children:[d(ot,{sx:Y.dragHintIcon}),f(`Drag an object onto another entry in the list to move it there. Hold Shift, Ctrl or Alt to copy it.`)]}):null,p.length?null:d(I,{sx:Y.emptyMembers,children:f(`Drag states, channels or devices from the object list here or use "Add objects"`)})]})]})}var mn=oe.default||oe,hn=`enum.rooms.`,gn=`enum.functions.`,_n=`enumsAssignmentOnlyDevices`;function vn(){return window._localStorage||window.localStorage}var yn=[`system`,`_design`,`enum`,`script`],bn=[`beleuchtung`,`lighting`,`licht`,`light`,`lampe`,`lamp`],xn=[`beschattung`,`shading`,`rollladen`,`rolladen`,`jalousie`,`shutter`,`blind`,`rollo`],Sn=[`heizung`,`heating`,`thermostat`,`klima`,`climate`],Cn=[`klima`,`climate`,`lüftung`,`ventilation`,`heizung`,`heating`],wn=[`temperatur`,`temperature`,`klima`,`climate`,`wetter`,`weather`],Tn=[`sicherheit`,`security`,`alarm`],En=[`steckdose`,`socket`,`schalter`,`switch`],Dn=[`multimedia`,`media`,`musik`,`music`,`audio`,`unterhaltung`,`entertainment`],On=[`taster`,`button`,`schalter`,`switch`],kn={[A.light]:bn,[A.dimmer]:bn,[A.ct]:bn,[A.rgb]:bn,[A.rgbSingle]:bn,[A.rgbwSingle]:bn,[A.hue]:bn,[A.cie]:bn,[A.blind]:xn,[A.blindButtons]:xn,[A.thermostat]:Sn,[A.airCondition]:Cn,[A.airPurifier]:Cn,[A.airQuality]:Cn,[A.fan]:Cn,[A.temperature]:wn,[A.humidity]:wn,[A.socket]:En,[A.window]:[`fenster`,`window`],[A.windowTilt]:[`fenster`,`window`],[A.door]:[`tür`,`door`],[A.gate]:[`garagentor`,`gate`,`garage`],[A.lock]:[`schloss`,`lock`,...Tn],[A.motion]:Tn,[A.fireAlarm]:Tn,[A.floodAlarm]:Tn,[A.coAlarm]:Tn,[A.camera]:[`kamera`,`camera`,...Tn],[A.media]:Dn,[A.volume]:Dn,[A.volumeGroup]:Dn,[A.vacuumCleaner]:[`staubsauger`,`vacuum`,`reinigung`,`cleaning`],[A.electricity]:[`energie`,`energy`,`strom`,`verbrauch`,`consumption`],[A.weatherCurrent]:[`wetter`,`weather`],[A.weatherForecast]:[`wetter`,`weather`],[A.pump]:[`pumpe`,`pump`,`bewässerung`,`irrigation`],[A.button]:On,[A.buttonSensor]:On,[A.illuminance]:[`helligkeit`,`brightness`,...bn]},X={root:{display:`flex`,flexDirection:`column`,flexGrow:1,minWidth:0,height:`100%`},toolbar:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1.5,px:2,py:1},search:{minWidth:200},instance:{minWidth:160},filter:{"& .MuiToggleButton-root":{textTransform:`none`,py:.25}},bulkBar:e=>({display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:1,px:2,py:.75,backgroundColor:e.palette.action.selected}),table:{flexGrow:1,overflow:`auto`},headerCell:e=>({backgroundColor:e.palette.background.paper,whiteSpace:`nowrap`}),nameBox:{display:`flex`,alignItems:`center`,gap:1.5,minWidth:220},nameText:{minWidth:0},icon:{width:24,height:24,flexShrink:0},mono:{fontFamily:`monospace`,opacity:.6,display:`block`},type:{display:`flex`,alignItems:`center`,gap:1,whiteSpace:`nowrap`},typeIcon:{width:20,height:20},cell:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:.5,minWidth:180},chipIcon:{width:16,height:16},partialChip:{opacity:.6},suggestionChip:{borderStyle:`dashed`,opacity:.7},menuIcon:{width:20,height:20},empty:{p:4,textAlign:`center`,opacity:.6}};function An(e,t,n){let r=new Set;for(let e of t)r.add(e.substring(0,e.lastIndexOf(`.`)));let i=[];for(let s of t){var a,o;let t=e[s];if((t==null?void 0:t.type)!==`device`&&(t==null?void 0:t.type)!==`channel`)continue;let c=s.split(`.`);if(c.length<3||yn.includes(c[0])||c[c.length-1]===`info`||!r.has(s))continue;let l=c.slice(0,-1).join(`.`);i.push({id:s,obj:t,instance:`${c[0]}.${c[1]}`,level:+(((a=e[l])==null?void 0:a.type)===`device`),name:n((o=t.common)==null?void 0:o.name)||c[c.length-1]})}return i}function jn(e,t){let n=new Map,r=new Map;for(let a of Object.values(e)){var i;if(a._id.startsWith(t))for(let e of((i=a.common)==null?void 0:i.members)||[]){let t=n.get(e);t?t.includes(a._id)||t.push(a._id):n.set(e,[a._id]);let i=e.split(`.`);for(let e=2;e<i.length;e++){let t=i.slice(0,e).join(`.`),n=r.get(t);n||(n=new Set,r.set(t,n)),n.add(a._id)}}}return{direct:n,children:r}}function Mn(e,t){let n=t.direct.get(e)||[],r=[],i=e.split(`.`);for(let e=2;e<i.length;e++)for(let a of t.direct.get(i.slice(0,e).join(`.`))||[])!n.includes(a)&&!r.includes(a)&&r.push(a);return{direct:n,inherited:r,partial:[...t.children.get(e)||[]].filter(e=>!n.includes(e)&&!r.includes(e))}}var Nn=e=>!!(e.direct.length||e.inherited.length||e.partial.length);function Pn(e){return e.toLowerCase().replace(/[\s_.-]/g,``)}function Fn(e,t){let n=e?kn[e]:void 0;if(!n)return null;for(let e of n){let n=t.find(t=>{var n;let r=[t._id.split(`.`).pop()||``],i=(n=t.common)==null?void 0:n.name;return typeof i==`string`?r.push(i):i&&r.push(...Object.values(i).filter(e=>typeof e==`string`)),r.some(t=>Pn(t).includes(e))});if(n)return n}return null}function In(e,t,n,r){e[t]||={},(e[t][n]||=[]).push(r)}function Ln(e){let{assignment:t,t:n}=e,i=t=>{var n;return(n=e.enums[t])!=null&&(n=n.common)!=null&&n.icon?d(F,{src:e.enums[t].common.icon,style:X.chipIcon}):void 0};return D(I,{sx:X.cell,children:[t.direct.map(t=>d(s,{size:`small`,label:e.getLabel(t),icon:i(t),onClick:e.onOpenEnum?()=>{var n;return(n=e.onOpenEnum)==null?void 0:n.call(e,t)}:void 0,onDelete:()=>e.onRemove(t)},t)),t.inherited.map(t=>d(B,{title:n(`Assigned via the device`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(s,{size:`small`,variant:`outlined`,color:`primary`,label:e.getLabel(t),icon:i(t),onClick:e.onOpenEnum?()=>{var n;return(n=e.onOpenEnum)==null?void 0:n.call(e,t)}:void 0})},t)),t.partial.map(t=>d(B,{title:n(`Assigned via single states`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(s,{size:`small`,variant:`outlined`,color:`primary`,sx:X.partialChip,label:e.getLabel(t),icon:i(t),onClick:e.onOpenEnum?()=>{var n;return(n=e.onOpenEnum)==null?void 0:n.call(e,t)}:void 0})},t)),e.suggestion?d(B,{title:n(`Suggestion from the detected device type`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(s,{size:`small`,variant:`outlined`,color:`primary`,sx:X.suggestionChip,icon:d(r,{}),label:e.getLabel(e.suggestion._id),onClick:()=>e.suggestion&&e.onAccept(e.suggestion._id)})}):null,d(h,{size:`small`,onClick:t=>e.onOpenMenu(t.currentTarget),children:d(r,{fontSize:`small`})})]})}function Rn(e){let{t:n,enums:r,getName:o}=e,[s,c]=z(null),[l,u]=z(0),[f,p]=z(``),[m,_]=z(``),[v,y]=z(e.initialFilter||`all`),[ee,b]=z(0),[x,S]=z(50),[w,te]=z([]),[T,E]=z(null),[O,ae]=z(!1),[k,oe]=z(()=>vn().getItem(_n)!==`false`),ce=U(()=>new mn,[]),le=ye(new Map);H(()=>{He()},[]),H(()=>{setTimeout(()=>{c(null),e.socket.getObjects(!0,!0).then(e=>{le.current.clear(),c(e)}).catch(e=>{console.error(`Cannot read the objects:`,e),c({})})},0)},[e.socket,l]);let j=U(()=>s?Object.keys(s).sort():[],[s]),M=U(()=>s?An(s,j,o):[],[s,j,o]),pe=U(()=>[...new Set(M.map(e=>e.instance))].sort(),[M]),N=U(()=>jn(r,hn),[r]),P=U(()=>jn(r,gn),[r]),me=e=>{let t=e.split(`.`),n=[];for(let e=3;e<=t.length;e++){var i;let a=t.slice(0,e).join(`.`);n.push(o((i=r[a])==null||(i=i.common)==null?void 0:i.name)||t[e-1])}return n.join(` / `)},he=e=>Object.values(r).filter(t=>t._id.startsWith(e)).sort((e,t)=>me(e._id).localeCompare(me(t._id))),_e=U(()=>Object.values(r).filter(e=>e._id.startsWith(gn)),[r]),be=e=>{if(!s)return null;if(le.current.has(e))return le.current.get(e)||null;let t=null;try{var n;let r=ce.detect({objects:s,id:e,_keysOptional:j,_keysOptionalSorted:!0,_usedIdsOptional:[],ignoreIndicators:[`UNREACH_STICKY`],excludedTypes:[A.info,A.instance,A.chart,A.image,A.location,A.locationOne]});t=(r==null||(n=r[0])==null?void 0:n.type)||null}catch(t){console.warn(`Cannot detect the type of "${e}":`,t)}return le.current.set(e,t),t},Se=e=>Nn(Mn(e,P))?null:Fn(be(e),_e),we=f.trim().toLowerCase(),R=M.filter(e=>(!m||e.instance===m)&&(!we||e.name.toLowerCase().includes(we)||e.id.toLowerCase().includes(we))&&(!k||!!be(e.id)||Nn(Mn(e.id,N))||Nn(Mn(e.id,P)))),Oe=R.filter(e=>!Nn(Mn(e.id,N))),V=R.filter(e=>!Nn(Mn(e.id,P))),Me=v===`noRoom`?Oe:v===`noFunction`?V:R,Ne=Math.max(0,Math.ceil(Me.length/x)-1),Pe=Math.min(ee,Ne),Fe=Me.slice(Pe*x,(Pe+1)*x),Re=async t=>{if(Object.keys(t).length){ae(!0);try{await e.onChangeMembers(t)}finally{ae(!1)}}},Ve=(e,t)=>{let n={};In(n,t,Mn(e,t.startsWith(hn)?N:P).direct.includes(t)?`remove`:`add`,e),Re(n)},Ue=(e,t)=>{let n=e===hn?N:P,r={};for(let e of w){let i=Mn(e,n).direct;i.filter(e=>e!==t).forEach(t=>In(r,t,`remove`,e)),t&&!i.includes(t)&&In(r,t,`add`,e)}Re(r)},We=e=>{let t={};for(let n of e){let e=Se(n);e&&In(t,e._id,`add`,n)}Re(t)},Ge=()=>{if(!T)return null;let e=T.prefix===hn?N:P,t=T.rowId?Mn(T.rowId,e).direct:[],r=()=>E(null);return D(fe,{open:!0,anchorEl:T.anchor,onClose:r,children:[T.mode===`set`?D(De,{onClick:()=>{r(),Ue(T.prefix,null)},children:[d(Ee,{children:d(C,{fontSize:`small`})}),d(je,{children:n(T.prefix===hn?`No room`:`No function`)})]}):null,he(T.prefix).map(e=>{var n;return D(De,{onClick:()=>{r(),T.mode===`set`?Ue(T.prefix,e._id):T.rowId&&Ve(T.rowId,e._id)},children:[d(Ee,{children:t.includes(e._id)?d(ie,{fontSize:`small`}):(n=e.common)!=null&&n.icon?d(F,{src:e.common.icon,style:X.menuIcon}):null}),d(je,{children:me(e._id)})]},e._id)})]})},qe=t=>{let a=Ke(t.obj),o=be(t.id),s=w.includes(t.id);return D(de,{hover:!0,selected:s,children:[d(Ie,{padding:`checkbox`,children:d(ne,{size:`small`,checked:s,onChange:()=>te(s?w.filter(e=>e!==t.id):[...w,t.id])})}),d(Ie,{children:D(I,{sx:X.nameBox,style:{paddingLeft:t.level*24},children:[a?d(F,{src:a,style:X.icon}):t.obj.type===`device`?d(Le,{style:X.icon}):d(g,{style:X.icon}),D(I,{sx:X.nameText,children:[d(L,{variant:`body2`,noWrap:!0,children:t.name}),d(L,{variant:`caption`,component:`div`,noWrap:!0,sx:X.mono,children:t.id})]})]})}),d(Ie,{children:o?D(I,{sx:X.type,children:[d(i,{type:o,style:X.typeIcon}),d(L,{variant:`body2`,children:n(`type-${o}`)})]}):`–`}),d(Ie,{children:d(Ln,{assignment:Mn(t.id,N),enums:r,getLabel:me,t:n,onRemove:e=>Ve(t.id,e),onAccept:e=>Ve(t.id,e),onOpenEnum:e.onOpenEnum,onOpenMenu:e=>E({anchor:e,prefix:hn,mode:`toggle`,rowId:t.id})})}),d(Ie,{children:d(Ln,{assignment:Mn(t.id,P),suggestion:Se(t.id),enums:r,getLabel:me,t:n,onRemove:e=>Ve(t.id,e),onAccept:e=>Ve(t.id,e),onOpenEnum:e.onOpenEnum,onOpenMenu:e=>E({anchor:e,prefix:gn,mode:`toggle`,rowId:t.id})})})]},t.id)},Je=!!Me.length&&Me.every(e=>w.includes(e.id));return D(I,{sx:X.root,children:[D(I,{sx:X.toolbar,children:[d(Ce,{variant:`standard`,placeholder:n(`Filter`),sx:X.search,value:f,onChange:e=>{p(e.target.value),b(0)},slotProps:{input:{endAdornment:f?d(h,{tabIndex:-1,size:`small`,onClick:()=>p(``),children:d(C,{})}):null}}}),D(ke,{variant:`standard`,displayEmpty:!0,sx:X.instance,value:m,onChange:e=>{_(e.target.value),b(0)},children:[d(De,{value:``,children:n(`All instances`)}),pe.map(e=>d(De,{value:e,children:e},e))]}),D(ge,{size:`small`,exclusive:!0,sx:X.filter,value:v,onChange:(e,t)=>{t&&(y(t),b(0))},children:[D(Be,{value:`all`,children:[n(`All`),` (`,R.length,`)`]}),D(Be,{value:`noRoom`,children:[n(`Without room`),` (`,Oe.length,`)`]}),D(Be,{value:`noFunction`,children:[n(`Without function`),` (`,V.length,`)`]})]}),d(B,{title:n(`Show only objects, which were detected as a device or which already have a room or a function`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(re,{label:n(`Only detected devices`),control:d(ue,{size:`small`,checked:k,onChange:e=>{oe(e.target.checked),vn().setItem(_n,e.target.checked?`true`:`false`),b(0)}})})}),d(I,{sx:{flexGrow:1}}),d(B,{title:n(`Reload`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{onClick:()=>u(l+1),children:d(ze,{})})})]}),w.length?D(I,{sx:X.bulkBar,children:[d(L,{variant:`body2`,children:n(`%s selected`,w.length)}),d(W,{size:`small`,variant:`outlined`,disabled:O,onClick:e=>E({anchor:e.currentTarget,prefix:hn,mode:`set`}),children:n(`Set room`)}),d(W,{size:`small`,variant:`outlined`,disabled:O,onClick:e=>E({anchor:e.currentTarget,prefix:gn,mode:`set`}),children:n(`Set function`)}),d(W,{size:`small`,variant:`contained`,disabled:O,startIcon:O?d(a,{size:16,color:`inherit`}):d($e,{}),onClick:()=>We(w),children:n(`Accept suggestions`)}),d(I,{sx:{flexGrow:1}}),d(W,{size:`small`,color:`grey`,onClick:()=>te([]),children:n(`Clear selection`)})]}):null,!s||O?d(se,{}):null,D(Te,{sx:X.table,children:[D(t,{size:`small`,stickyHeader:!0,children:[d(Ae,{children:D(de,{children:[d(Ie,{padding:`checkbox`,sx:X.headerCell,children:d(ne,{size:`small`,checked:Je,indeterminate:!Je&&!!w.length,onChange:()=>te(Je?[]:Me.map(e=>e.id))})}),d(Ie,{sx:X.headerCell,children:n(`Device or channel`)}),d(Ie,{sx:X.headerCell,children:n(`Detected type`)}),d(Ie,{sx:X.headerCell,children:n(`Rooms`)}),d(Ie,{sx:X.headerCell,children:n(`Functions`)})]})}),d(ve,{children:Fe.map(e=>qe(e))})]}),s&&!Me.length?d(I,{sx:X.empty,children:n(`No devices or channels found`)}):null]}),d(xe,{component:`div`,count:Me.length,page:Pe,rowsPerPage:x,rowsPerPageOptions:[25,50,100],onPageChange:(e,t)=>b(t),onRowsPerPageChange:e=>{S(parseInt(e.target.value,10)),b(0)}}),Ge()]})}var zn=[`cellar`,`basement`,`ground_floor`,`upstairs`,`second_floor`,`attic`,`outdoors`],Bn=[`living_room`,`kitchen`,`dining_room`,`bedroom`,`nursery`,`guest_room`,`bathroom`,`wc`,`office`,`corridor`,`laundry_room`,`storeroom`,`garage`,`garden`,`terrace`,`balcony`],Vn=[`living_room`,`kitchen`,`bedroom`,`bathroom`],Hn=[`ground_floor`,`upstairs`],Un=[`lighting`,`shading`,`heating`,`climate`,`socket`,`window`,`door`,`security`,`smoke_detector`,`music`,`weather`,`temperature_sensor`,`consumption`],Wn=[`lighting`,`shading`,`heating`,`socket`,`window`,`door`],Gn=[`Floors`,`Rooms`,`Functions`,`Assign devices`,`Overview`],Kn={"enum.rooms":{en:`Rooms`,de:`Räume`,ru:`Комнаты`,pt:`Divisões`,nl:`Kamers`,fr:`Pièces`,it:`Stanze`,es:`Habitaciones`,pl:`Pomieszczenia`,uk:`Кімнати`,"zh-cn":`房间`},"enum.functions":{en:`Functions`,de:`Funktionen`,ru:`Функции`,pt:`Funções`,nl:`Functies`,fr:`Fonctions`,it:`Funzioni`,es:`Funciones`,pl:`Funkcje`,uk:`Функції`,"zh-cn":`功能`}},Z={dialogPaper:{height:`85vh`},stepper:{px:3,pb:2},content:{display:`flex`,flexDirection:`column`,gap:2},assignment:{display:`flex`,height:`100%`,minHeight:0,p:0},hint:{opacity:.8},group:{display:`flex`,flexDirection:`column`,gap:1},groupTitle:{fontWeight:600},tiles:{display:`grid`,gridTemplateColumns:`repeat(auto-fill, minmax(130px, 1fr))`,gap:1},tile:e=>({position:`relative`,display:`flex`,flexDirection:`column`,justifyContent:`center`,gap:.5,p:1,height:110,borderRadius:`8px`,border:`2px solid ${e.palette.divider}`,transition:`border-color 0.2s, background-color 0.2s`,"&:hover":{borderColor:e.palette.text.disabled}}),tileSelected:e=>({borderColor:e.palette.primary.main,backgroundColor:e.palette.action.selected,"&:hover":{borderColor:e.palette.primary.main}}),tileLocked:{opacity:.6},tileCheck:{position:`absolute`,top:6,right:6,fontSize:20},tileIcon:{width:40,height:40},tileName:{textAlign:`center`,lineHeight:1.2},addRow:{display:`flex`,alignItems:`center`,gap:1},summary:{display:`flex`,flexDirection:`column`,gap:1}};function qn(e){let t=Object.keys(e).filter(e=>e.startsWith(`enum.rooms.`)),n=new Set;for(let e of t){let t=e.split(`.`);(t.length>3||zn.includes(t[2]))&&n.add(t[2])}let r={};for(let e of t){let t=e.split(`.`);t.length===4?(r[t[2]]||=[]).push(t[3]):t.length===3&&!n.has(t[2])&&(r[``]||=[]).push(t[2])}let i=Object.keys(e).filter(e=>e.startsWith(`enum.functions.`)&&e.split(`.`).length===3).map(e=>e.split(`.`)[2]);return{floors:[...n],rooms:r,functions:i}}function Jn(e){return e.trim().toLowerCase().replace(k.FORBIDDEN_CHARS,`_`).replace(/[\s.,]+/g,`_`).replace(/_+/g,`_`).replace(/^_|_$/g,``)}function Yn(e){return e.filter((t,n)=>e.findIndex(e=>e._id===t._id)===n)}var Xn=(e,t)=>e.includes(t)?e.filter(e=>e!==t):[...e,t];function Zn(e){return D(P,{disabled:e.locked,onClick:e.onClick,sx:k.getStyle(e.theme,Z.tile,e.selected&&Z.tileSelected,e.locked&&Z.tileLocked),children:[e.selected?d(gt,{color:`primary`,sx:Z.tileCheck}):null,e.icon?d(F,{src:e.icon,style:Z.tileIcon}):d(Oe,{style:Z.tileIcon}),d(L,{variant:`body2`,sx:Z.tileName,children:e.name}),e.locked&&e.lockedText?d(L,{variant:`caption`,sx:Z.hint,children:e.lockedText}):null]})}function Qn(e){let[t,n]=z(``),i=Jn(t),a=!!i&&!e.usedIds.includes(i),o=()=>{a&&(e.onAdd({id:i,name:t.trim()}),n(``))};return D(I,{sx:Z.addRow,children:[d(Ce,{variant:`standard`,placeholder:e.placeholder,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o()}}),d(W,{size:`small`,startIcon:d(r,{}),disabled:!a,onClick:o,children:e.t(`Add`)})]})}function $n(e){let{t,enums:r,getName:i}=e,a=U(()=>Yn(T(`rooms`)),[]),o=U(()=>Yn(T(`devices`)),[]),[s,c]=z(()=>qn(r)),[l,u]=z(0),[p,h]=z(()=>s.floors.length>0),[g,_]=z(()=>s.floors.length?[]:[...Hn]),[y,b]=z([]),[S,C]=z(()=>{var e;return!s.floors.length&&!((e=s.rooms[``])!=null&&e.length)?{"":[...Vn]}:{}}),[w,te]=z({}),[ne,E]=z(()=>s.functions.length?[]:[...Wn]),[re,ae]=z([]),[k,oe]=z(!1),[se,le]=z(!1),[ue,A]=z(!1),[j,de]=z({floors:0,rooms:0,functions:0}),M=e=>i(e.name)||e.id,fe=e=>({id:e._id,name:e.name,icon:e.icon}),pe=(e,t)=>{var n,i;return{id:t,name:((n=r[e])==null||(n=n.common)==null?void 0:n.name)||t,icon:(i=r[e])==null||(i=i.common)==null?void 0:i.icon}},N=[...zn.map(e=>a.find(t=>t._id===e)).filter(e=>!!e).map(fe),...s.floors.filter(e=>!zn.includes(e)).map(e=>pe(`enum.rooms.${e}`,e)),...y],P=e=>s.floors.includes(e)||g.includes(e),F=p?N.filter(e=>P(e.id)):[{id:``,name:``}],me=(e,t)=>e?`enum.rooms.${e}.${t}`:`enum.rooms.${t}`,he=(e,t)=>{var n;return!!((n=s.rooms[e])!=null&&n.includes(t))},_e=(e,t)=>{var n;return he(e,t)||!!((n=S[e])!=null&&n.includes(t))},ve=e=>e.map(e=>{var t;return i((t=r[e])==null||(t=t.common)==null?void 0:t.name).trim().toLowerCase()}).filter(e=>e),ye=e=>{let t=ve((s.rooms[e]||[]).map(t=>me(e,t)));return[...a.filter(n=>!zn.includes(n._id)&&(he(e,n._id)||!t.includes(i(n.name).trim().toLowerCase()))).map(fe),...(s.rooms[e]||[]).filter(e=>!a.find(t=>t._id===e)).map(t=>pe(me(e,t),t)),...w[e]||[]]},be=e=>{let t=ye(e).filter(t=>k||Bn.includes(t.id)||_e(e,t.id)||!a.find(e=>e._id===t.id)),n=e=>{let t=Bn.indexOf(e.id);return t===-1?Bn.length:t};return t.sort((e,t)=>n(e)-n(t)||M(e).localeCompare(M(t)))},xe=e=>s.functions.includes(e),Ce=e=>xe(e)||ne.includes(e),we=ve(s.functions.map(e=>`enum.functions.${e}`)),Te=[...o.filter(e=>xe(e._id)||!we.includes(i(e.name).trim().toLowerCase())).map(fe),...s.functions.filter(e=>!o.find(t=>t._id===e)).map(e=>pe(`enum.functions.${e}`,e)),...re],Ee=Te.filter(e=>se||Un.includes(e.id)||Ce(e.id)||!o.find(t=>t._id===e.id)).sort((e,t)=>{let n=e=>{let t=Un.indexOf(e.id);return t===-1?Un.length:t};return n(e)-n(t)||M(e).localeCompare(M(t))}),R=(()=>{let e=[],t=(t,n,i)=>{!r[t]&&!e.find(e=>e._id===t)&&e.push({_id:t,type:`enum`,common:{name:n,icon:i,members:[]},native:{}})},n=t=>{!r[t]&&!e.find(e=>e._id===t)&&e.push({_id:t,type:`enum`,common:{name:Kn[t],members:[],dontDelete:!0},native:{}})},i=0,a=0,o=0;if(p)for(let e of N)g.includes(e.id)&&!s.floors.includes(e.id)&&(n(`enum.rooms`),t(`enum.rooms.${e.id}`,e.name,e.icon),i++);for(let e of F)for(let r of S[e.id]||[]){let i=ye(e.id).find(e=>e.id===r);i&&!he(e.id,r)&&(n(`enum.rooms`),t(me(e.id,r),i.name,i.icon),a++)}for(let e of ne){let r=Te.find(t=>t.id===e);r&&!xe(e)&&(n(`enum.functions`),t(`enum.functions.${e}`,r.name,r.icon),o++)}return{list:e,floors:i,rooms:a,functions:o}})(),De=async()=>{if(R.list.length){A(!0),await e.onCreateEnums(R.list),A(!1),de({floors:j.floors+R.floors,rooms:j.rooms+R.rooms,functions:j.functions+R.functions});let t={...r};R.list.forEach(e=>t[e._id]=e),c(qn(t)),_([]),C({}),E([])}u(3)};return D(n,{open:!0,fullWidth:!0,maxWidth:`lg`,fullScreen:e.fullScreen,onClose:(t,n)=>{n!==`backdropClick`&&e.onClose()},sx:{"& .MuiDialog-paper":e.fullScreen?void 0:Z.dialogPaper},children:[d(x,{children:t(`Set up rooms and functions`)}),d(I,{sx:Z.stepper,children:d(ce,{activeStep:l,alternativeLabel:!0,children:Gn.map(e=>d(qe,{children:d(f,{children:t(e)})},e))})}),D(v,{dividers:!0,sx:l===3?Z.assignment:void 0,children:[l===0?D(I,{sx:Z.content,children:[D(ge,{size:`small`,exclusive:!0,value:p?`floors`:`flat`,onChange:(e,t)=>t&&h(t===`floors`),children:[d(Be,{value:`floors`,children:t(`With floors`)}),d(Be,{value:`flat`,children:t(`Without floors`)})]}),d(L,{variant:`body2`,sx:Z.hint,children:t(p?`Every floor becomes a room, which contains the rooms of this floor`:`Without floors, all rooms are on the same level`)}),p?D(O,{children:[d(I,{sx:Z.tiles,children:N.map(n=>d(Zn,{name:M(n),icon:n.icon,selected:P(n.id),locked:s.floors.includes(n.id),lockedText:t(`Already exists`),theme:e.theme,onClick:()=>_(Xn(g,n.id))},n.id))}),d(Qn,{t,placeholder:t(`Custom floor`),usedIds:a.map(e=>e._id).concat(N.map(e=>e.id)),onAdd:e=>{b([...y,e]),_([...g,e.id])}})]}):null]}):null,l===1?(()=>{var n;return D(I,{sx:Z.content,children:[d(L,{variant:`body2`,sx:Z.hint,children:t(p?`Select the rooms of every floor. Rooms that already exist stay unchanged`:`Select the rooms. Rooms that already exist stay unchanged`)}),F.length?null:d(L,{children:t(`Select at least one floor`)}),F.map(n=>D(I,{sx:Z.group,children:[p?d(L,{variant:`subtitle1`,sx:Z.groupTitle,children:M(n)}):null,d(I,{sx:Z.tiles,children:be(n.id).map(r=>d(Zn,{name:M(r),icon:r.icon,selected:_e(n.id,r.id),locked:he(n.id,r.id),lockedText:t(`Already exists`),theme:e.theme,onClick:()=>C({...S,[n.id]:Xn(S[n.id]||[],r.id)})},r.id))}),d(Qn,{t,placeholder:t(`Custom room`),usedIds:ye(n.id).map(e=>e.id).concat(zn),onAdd:e=>{te({...w,[n.id]:[...w[n.id]||[],e]}),C({...S,[n.id]:[...S[n.id]||[],e.id]})}})]},n.id)),p&&(n=s.rooms[``])!=null&&n.length?D(I,{sx:Z.group,children:[d(L,{variant:`subtitle1`,sx:Z.groupTitle,children:t(`Rooms without floor`)}),d(I,{sx:Z.tiles,children:s.rooms[``].map(n=>{var a,o;return d(Zn,{name:i((a=r[`enum.rooms.${n}`])==null||(a=a.common)==null?void 0:a.name)||n,icon:(o=r[`enum.rooms.${n}`])==null||(o=o.common)==null?void 0:o.icon,selected:!0,locked:!0,lockedText:t(`Already exists`),theme:e.theme,onClick:()=>void 0},n)})})]}):null,d(I,{children:d(W,{size:`small`,onClick:()=>oe(!k),children:t(k?`Show less`:`Show more`)})})]})})():null,l===2?D(I,{sx:Z.content,children:[d(L,{variant:`body2`,sx:Z.hint,children:t(`Select the functions of your devices. Functions that already exist stay unchanged`)}),d(I,{sx:Z.tiles,children:Ee.map(n=>d(Zn,{name:M(n),icon:n.icon,selected:Ce(n.id),locked:xe(n.id),lockedText:t(`Already exists`),theme:e.theme,onClick:()=>E(Xn(ne,n.id))},n.id))}),d(Qn,{t,placeholder:t(`Custom function`),usedIds:Te.map(e=>e.id),onAdd:e=>{ae([...re,e]),E([...ne,e.id])}}),d(I,{children:d(W,{size:`small`,onClick:()=>le(!se),children:t(se?`Show less`:`Show more`)})})]}):null,l===3?d(Rn,{socket:e.socket,enums:r,t,theme:e.theme,getName:i,initialFilter:`noRoom`,onChangeMembers:e.onChangeMembers}):null,l===4?(()=>{let e=new Set,n=new Set;for(let t of Object.values(r))if(t._id.startsWith(`enum.rooms.`)){var i;(i=t.common)==null||(i=i.members)==null||i.forEach(t=>e.add(t))}else if(t._id.startsWith(`enum.functions.`)){var a;(a=t.common)==null||(a=a.members)==null||a.forEach(e=>n.add(e))}return D(I,{sx:Z.summary,children:[d(L,{variant:`h6`,children:t(`The rooms and functions are ready`)}),d(L,{children:t(`Created: %s floors, %s rooms, %s functions`,j.floors,j.rooms,j.functions)}),d(L,{children:t(`%s objects are in a room`,e.size)}),d(L,{children:t(`%s objects have a function`,n.size)}),d(L,{variant:`body2`,sx:Z.hint,children:t(`You can change everything at any time in the categories view or in the assignment view`)})]})})():null]}),D(Se,{children:[l<4?d(W,{color:`grey`,disabled:ue,startIcon:d(m,{}),onClick:e.onClose,children:t(`Cancel`)}):null,d(I,{sx:{flexGrow:1}}),l>0&&l<4?d(W,{color:`grey`,variant:`outlined`,disabled:ue,startIcon:d(ee,{}),onClick:()=>u(l-1),children:t(`Back`)}):null,l<2?d(W,{variant:`contained`,endIcon:d(pt,{}),disabled:l===1&&!F.length,onClick:()=>u(l+1),children:t(`Next`)}):null,l===2?d(W,{variant:`contained`,loading:ue,endIcon:d(pt,{}),onClick:()=>void De(),children:t(R.list.length?`Create and continue`:`Next`)}):null,l===3?d(W,{variant:`contained`,endIcon:d(pt,{}),onClick:()=>u(4),children:t(`Next`)}):null,l===4?d(W,{variant:`contained`,startIcon:d(ie,{}),onClick:e.onClose,children:t(`Finish`)}):null]})]})}l();var er=800,tr=500,Q={root:{display:`flex`,flexDirection:`column`,height:`100%`,overflow:`hidden`},topBar:e=>({display:`flex`,alignItems:`center`,gap:1,px:1,borderBottom:`1px solid ${e.palette.divider}`,flexShrink:0}),tabs:{minWidth:0},wizardButton:{flexShrink:0,minWidth:0,my:.75,textTransform:`none`},viewToggle:{flexShrink:0,my:.75,"& .MuiToggleButton-root":{textTransform:`none`,gap:.75,py:.25}},body:{display:`flex`,flexGrow:1,minHeight:0},split:{flexGrow:1,minWidth:0,height:`100%`},main:{display:`flex`,flexGrow:1,minWidth:0,height:`100%`},listPane:e=>({width:300,flexShrink:0,display:`flex`,flexDirection:`column`,height:`100%`,borderRight:`1px solid ${e.palette.divider}`}),listPaneNarrow:{width:`100%`,borderRight:0},listToolbar:{display:`flex`,alignItems:`center`,gap:.5,px:1.5,py:1},filter:{flexGrow:1},listScroll:{flexGrow:1,overflowY:`auto`,overflowX:`hidden`},detailsEmpty:{flexGrow:1,display:`flex`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,opacity:.6,p:3},objectsPane:{height:`100%`,overflow:`auto`},rail:e=>({width:40,flexShrink:0,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:1.5,pt:1.5,cursor:`pointer`,color:e.palette.text.secondary,borderLeft:`1px solid ${e.palette.divider}`,"&:hover":{color:e.palette.primary.main,backgroundColor:e.palette.action.hover}}),railText:{writingMode:`vertical-rl`,transform:`rotate(180deg)`,fontSize:13,fontWeight:500,letterSpacing:`0.04em`,whiteSpace:`nowrap`},enumGroupMember:{display:`flex`,gap:8,alignItems:`center`,padding:`8px 16px`},icon:{height:32,width:32,marginRight:5,display:`inline-block`},categoryTitle:{flexDirection:`row`,alignItems:`center`,display:`inline-flex`}},nr=()=>{let e=yt(),t=e.display,{item:n,style:r}=e;return t?d(`div`,{style:{...r,zIndex:1e3},children:n.preview}):null},rr={favorites:{_id:`enum.favorites`,type:`enum`,common:{name:{en:`Favorites`,de:`Favoriten`,ru:`Избранное`,pt:`Favoritos`,nl:`Favorieten`,fr:`Favoris`,it:`Preferiti`,es:`Favoritos`,pl:`Ulubione`,uk:`Обране`,"zh-cn":`收藏夹`}},native:{}}},ir={_id:``,type:`enum`,common:{name:``,color:``,desc:``,members:[]},native:{}};function $(){return window._localStorage||window.localStorage}function ar(e,t,n){try{let t=$().getItem(e);if(t){let e=JSON.parse(t);if(n(e))return e}}catch{}return t}var or=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function sr(e){return e instanceof Error?e.message:typeof e==`string`?e:JSON.stringify(e)}var cr=class e extends Fe{constructor(t){super(t),E(this,`fastUpdate`,!1),E(this,`updateTimeout`,null),E(this,`changeEnums`,null),E(this,`lastEnums`,null),E(this,`updateCounter`,0),E(this,`selectAfterUpdate`,null),E(this,`memberChangesQueue`,Promise.resolve()),E(this,`onResize`,()=>{let e=window.innerWidth<er;e!==this.state.narrow&&this.setState({narrow:e})}),E(this,`getEnumTemplate`,t=>{let n=JSON.parse(JSON.stringify(ir)),{_id:r,name:i}=e.findNewUniqueName(t,Object.values(this.state.enums||{}),this.props.t(`Enum`));return n._id=r,n.common.name=i,n}),E(this,`createEnumTemplate`,(e,t)=>{let n=this.getEnumTemplate(e);n._id=t._id,n.common={...n.common,...t.common},this.selectAfterUpdate=n._id,this.addUpdating([n._id]).then(()=>this.props.socket.setObject(n._id,n)).catch(e=>window.alert(`Cannot create enum: ${e}`))}),E(this,`onObjectChange`,(e,t)=>{let n=t,r;if(this.state.enums&&e.startsWith(`enum.`)){let t=this.changeEnums||this.lastEnums||this.state.enums;if(n){let i=t[e];if(!i||i&&JSON.stringify(i)!==JSON.stringify(n)){let i=this.changeEnums||JSON.parse(JSON.stringify(t));i[e]=n,this.changeEnums=i,r=!0}}else if(t[e]){let n=this.changeEnums||JSON.parse(JSON.stringify(t));delete n[e],this.changeEnums=n,r=!0}}r&&(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null;let e=this.changeEnums||void 0;this.changeEnums=null,this.updateData(e).then(()=>{var e;let t=this.selectAfterUpdate;t&&(e=this.state.enums)!=null&&e[t]&&(this.selectAfterUpdate=null,this.selectEnum(t))}).catch(()=>void 0)},this.fastUpdate?0:200),this.fastUpdate=!1)}),E(this,`updateData`,async e=>{let t=++this.updateCounter,n=e||await this.props.socket.getForeignObjects(`enum.*`,`enum`);this.lastEnums=n;let r=new Set;Object.values(n).forEach(e=>{var t;return(t=e.common)==null||(t=t.members)==null?void 0:t.forEach(e=>r.add(e))});let i=await this.readObjects([...r]),a=new Set;for(let e of Object.keys(i))if(i[e].type===`state`||i[e].type===`channel`){let t=k.getParentId(e);t&&t.includes(`.`)&&!i[t]&&a.add(t)}let o=await this.readObjects([...a]);t===this.updateCounter&&this.setState({enums:n,members:i,parents:o,updating:[]},()=>this.buildTree(n))}),E(this,`setCurrentCategory`,(e,t)=>{e===this.state.currentCategory?t==null||t():(this.setState({currentCategory:e},()=>t==null?void 0:t()),$().setItem(`enumCurrentCategory`,e))}),E(this,`selectEnum`,e=>{let t=e.split(`.`)[1],n={...this.state.selected,[t]:e};$().setItem(`enumsSelected`,JSON.stringify(n));let r=this.state.enumsClosed,i=e.split(`.`);for(let e=3;e<i.length;e++){let t=i.slice(0,e).join(`.`);r[t]&&(r={...r},delete r[t])}r!==this.state.enumsClosed&&$().setItem(`enumsClosed`,JSON.stringify(r)),this.setCurrentCategory(t,()=>this.setState({selected:n,enumsClosed:r,showDetails:!0},()=>setTimeout(()=>{var t;return(t=document.getElementById(`enum-row-${e}`))==null?void 0:t.scrollIntoView({block:`nearest`})},50)))}),E(this,`addEnum`,e=>{[`functions`,`rooms`].includes(e.split(`.`)[1])?this.setState({enumTemplateDialog:e}):this.showEnumEditDialog(this.getEnumTemplate(e),!0)}),E(this,`addItemsToEnum`,(e,t)=>{var n;if(!((n=this.state.enums)!=null&&n[t]))return;let r=JSON.parse(JSON.stringify(this.state.enums[t]));r.common||={},r.common.members||=[];let i=r.common.members,a=e.filter(e=>!i.includes(e));a.length&&(i.push(...a),this.fastUpdate=!0,this.props.socket.setObject(r._id,r).catch(e=>window.alert(`Cannot set enum: ${e}`)))}),E(this,`addItemToEnum`,(e,t)=>this.addItemsToEnum([e],t)),E(this,`addFolderToEnum`,(e,t,n)=>this.setState({addFolderDialog:{folderId:e,ids:t,enumId:n}})),E(this,`removeMemberFromEnum`,(e,t)=>{var n,r;let i=(n=this.state.enums)==null?void 0:n[t];if(!(i!=null&&(r=i.common)!=null&&(r=r.members)!=null&&r.includes(e)))return;let a=JSON.parse(JSON.stringify(i));a.common.members=(a.common.members||[]).filter(t=>t!==e),this.fastUpdate=!0,this.props.socket.setObject(a._id,a).catch(e=>window.alert(`Cannot update enum: ${e}`))}),E(this,`moveMember`,async(e,t,n,r)=>{let i=this.state.enums||{};if(i[n]){this.fastUpdate=!0;try{var a,o;if(!r&&(a=i[t])!=null&&(a=a.common)!=null&&(a=a.members)!=null&&a.includes(e)){let n=JSON.parse(JSON.stringify(i[t]));n.common.members=(n.common.members||[]).filter(t=>t!==e),await this.props.socket.setObject(n._id,n)}if(!((o=i[n].common)!=null&&(o=o.members)!=null&&o.includes(e))){let t=JSON.parse(JSON.stringify(i[n]));t.common.members||=[],t.common.members.push(e),t.common.members.sort(),await this.props.socket.setObject(t._id,t)}}catch(e){window.alert(`Cannot move member: ${sr(e)}`)}}}),E(this,`moveEnum`,async(e,t)=>{let n=e.split(`.`).slice(0,-1).join(`.`);if(t===e||t.startsWith(`${e}.`)||n===t)return;let r=this.state.enums||{},i=`${t}${e.substring(n.length)}`;if(r[i]){window.alert(this.props.t(`Entry "%s" already exists`,i));return}let a=Object.keys(r).filter(t=>t===e||t.startsWith(`${e}.`)).sort((e,t)=>e.length-t.length);await this.addUpdating(a),this.selectAfterUpdate=i;try{for(let e of a){let i=`${t}${e.substring(n.length)}`,a=JSON.parse(JSON.stringify(r[e]));a._id=i,await this.props.socket.setObject(i,a),await this.props.socket.delObject(e)}}catch(e){window.alert(`Cannot move enum: ${sr(e)}`)}}),E(this,`showEnumEditDialog`,(e,t)=>{let n={changed:!1};n.newItem=JSON.parse(JSON.stringify(e)),n.originalItem=JSON.parse(JSON.stringify(e)),n.isNew=t,this.setState({enumEditDialog:n})}),E(this,`showEnumDeleteDialog`,e=>this.setState({enumDeleteDialog:e})),E(this,`saveEnum`,async()=>{var e,t,n;let r=(e=this.state.enumEditDialog)==null?void 0:e.newItem,i=(t=this.state.enumEditDialog)==null||(t=t.originalItem)==null?void 0:t._id;if(!r||!i)return;let a=this.state.enums||{};if(((n=this.state.enumEditDialog)!=null&&n.isNew||i!==r._id)&&(this.selectAfterUpdate=r._id),await this.addUpdating([i]),await this.props.socket.setObject(r._id,r),i!==r._id)try{await this.props.socket.delObject(i);for(let e of Object.keys(a))if(e.startsWith(`${i}.`)){let t=JSON.parse(JSON.stringify(a[e]));t._id=t._id.replace(`${i}.`,`${r._id}.`),await this.props.socket.setObject(t._id,t),await this.props.socket.delObject(e)}}catch(e){window.alert(`Cannot save enum: ${sr(e)}`)}this.setState({enumEditDialog:null})}),E(this,`deleteEnum`,async e=>{let t=this.state.enums||{},n=Object.keys(t).filter(t=>t===e||t.startsWith(`${e}.`));await this.addUpdating(n);try{for(let e of n)await this.props.socket.delObject(e)}catch(e){window.alert(`Cannot delete enum: ${sr(e)}`)}this.setState({enumDeleteDialog:null})}),E(this,`copyEnum`,e=>{var t,n;let r=JSON.parse(JSON.stringify((t=this.state.enums)==null?void 0:t[e])),i,a=1;do i=e+a.toString(),a++;while((n=this.state.enums)!=null&&n[i]);r._id=i,this.selectAfterUpdate=i,this.props.socket.setObject(i,r).catch(e=>window.alert(`Cannot copy enum: ${e}`))}),E(this,`toggleEnum`,e=>{let t={...this.state.enumsClosed,[e]:!this.state.enumsClosed[e]};this.setState({enumsClosed:t}),$().setItem(`enumsClosed`,JSON.stringify(t))}),E(this,`toggleAllEnums`,e=>{let t={};e&&Object.keys(this.state.enums||{}).forEach(e=>t[e]=!0),this.setState({enumsClosed:t}),$().setItem(`enumsClosed`,JSON.stringify(t))}),E(this,`toggleObjects`,()=>{let e=!this.state.showObjects;this.setState({showObjects:e}),$().setItem(`enumsShowObjects`,e?`true`:`false`)}),E(this,`changeEnumFormData`,e=>{var t;let n=JSON.parse(JSON.stringify(this.state.enumEditDialog));n.newItem=JSON.parse(JSON.stringify(e)),n.changed=JSON.stringify(n.newItem)!==JSON.stringify(((t=this.state.enums)==null?void 0:t[n.originalItem])||{}),this.setState({enumEditDialog:n})}),E(this,`getName`,e=>lt.getText(e,this.props.lang)),E(this,`setView`,e=>{this.setState({view:e}),$().setItem(`enumsView`,e)}),E(this,`openEnum`,e=>{this.setView(`categories`),this.selectEnum(e)}),E(this,`changeMembers`,e=>{let t=this.memberChangesQueue.then(()=>this.applyMemberChanges(e));return this.memberChangesQueue=t.catch(()=>void 0),t}),E(this,`createEnums`,async e=>{this.fastUpdate=!0;for(let n of[...e].sort((e,t)=>e._id.length-t._id.length)){var t;if(!((t=this.state.enums)!=null&&t[n._id]))try{await this.props.socket.setObject(n._id,n)}catch(e){window.alert(`Cannot create enum: ${sr(e)}`)}}}),this.state={enums:null,enumsTree:null,currentCategory:$().getItem(`enumCurrentCategory`)||``,filter:``,enumEditDialog:null,enumTemplateDialog:null,enumDeleteDialog:null,members:{},parents:{},categoryPopoverOpen:!1,enumsClosed:ar(`enumsClosed`,{},or),updating:[],narrow:window.innerWidth<er,splitSizes:ar(`enumsSplitSizes2`,[70,30],e=>Array.isArray(e)&&e.length===2),showObjects:$().getItem(`enumsShowObjects`)!==`false`,addObjectsDialog:null,addFolderDialog:null,selected:ar(`enumsSelected`,{},or),showDetails:!1,view:$().getItem(`enumsView`)===`assignment`?`assignment`:`categories`,wizardOpen:!1}}async componentDidMount(){window.addEventListener(`resize`,this.onResize),await this.updateData(),await this.props.socket.subscribeObject(`enum.*`,this.onObjectChange)}componentWillUnmount(){window.removeEventListener(`resize`,this.onResize),this.props.socket.unsubscribeObject(`enum.*`,this.onObjectChange),this.updateTimeout&&=(clearTimeout(this.updateTimeout),null)}addUpdating(e){let t=[...this.state.updating,...e.filter(e=>!this.state.updating.includes(e))];return new Promise(e=>this.setState({updating:t},()=>e()))}async readObjects(e){let t={};for(let n=0;n<e.length;n+=tr){let r=e.slice(n,n+tr),i;try{i=await this.props.socket.getObjectsById(r)}catch(e){console.warn(`Cannot read the objects at once, read them one by one:`,e)}for(let e of r){let n=i?i[e]:void 0;if(!i)try{n=await this.props.socket.getObject(e)}catch(t){console.error(`Cannot read the object "${e}":`,t)}n&&(t[e]=n)}}return t}buildTree(e){var t;let n={data:null,children:{},id:``};for(let t of Object.keys(e)){let r=t.split(`.`),i=n;for(let e=0;e<r.length;e++)i.children[r[e]]||={data:null,children:{},id:r.slice(0,e+1).join(`.`)},i=i.children[r[e]];i.data=e[t]}let r=((t=n.children.enum)==null?void 0:t.children)||{},i=r[this.state.currentCategory]?this.state.currentCategory:Object.keys(r)[0]||``;this.setCurrentCategory(i,()=>this.setState({enumsTree:n},()=>{!Object.keys(e).some(e=>e.startsWith(`enum.rooms.`))&&!$().getItem(`enumsWizardOffered`)&&($().setItem(`enumsWizardOffered`,`true`),this.setState({wizardOpen:!0}))}))}findTreeItem(e){let t=this.state.enumsTree;for(let n of e.split(`.`))t=(t==null?void 0:t.children[n])||null;return t}findFirstEnum(e){for(let t of Jt(Object.values(e.children),this.getName)){if(t.data)return t.id;let e=this.findFirstEnum(t);if(e)return e}return null}getSelectedId(){var e,t;let n=this.state.selected[this.state.currentCategory];if(n&&(e=this.state.enums)!=null&&e[n])return n;if(this.state.narrow)return null;let r=(t=this.state.enumsTree)==null||(t=t.children.enum)==null?void 0:t.children[this.state.currentCategory];return r?this.findFirstEnum(r):null}getEnumName(e){var t;return this.getName((t=this.state.enums)==null||(t=t[e])==null||(t=t.common)==null?void 0:t.name)||e.split(`.`).pop()||e}static _isUniqueName(e,t,n,r){return!t.find(t=>t._id===`${e}.${n.toLowerCase()}_${r}`)}static findNewUniqueName(t,n,r){let i=1;for(;!e._isUniqueName(t,n,r,i);)i++;return{_id:`${t}.${r.toLowerCase()}_${i}`,name:`${r} ${i}`}}renderEditDialog(){return this.state.enumEditDialog?d(Bt,{onClose:()=>this.setState({enumEditDialog:null}),enums:Object.values(this.state.enums||{}),enum:this.state.enumEditDialog.newItem,getName:this.getName,isNew:!!this.state.enumEditDialog.isNew,t:this.props.t,lang:this.props.lang,changed:this.state.enumEditDialog.changed,onChange:this.changeEnumFormData,saveData:this.saveEnum,innerWidth:window.innerWidth}):null}renderDeleteDialog(){return this.state.enumDeleteDialog?d(Ut,{onClose:()=>this.setState({enumDeleteDialog:null}),enum:this.state.enumDeleteDialog,getName:this.getName,t:this.props.t,deleteEnum:this.deleteEnum}):null}renderTemplateDialog(){return this.state.enumTemplateDialog?d(Ht,{prefix:this.state.enumTemplateDialog,onClose:()=>this.setState({enumTemplateDialog:null}),t:this.props.t,lang:this.props.lang,createEnumTemplate:this.createEnumTemplate,showEnumEditDialog:this.showEnumEditDialog,enums:this.state.enums||{},getEnumTemplate:this.getEnumTemplate}):null}renderAddObjectsDialog(){let e=this.state.addObjectsDialog;return e?d(me,{dialogName:`enumsAddObjects`,title:this.props.t(`Add objects to "%s"`,this.getEnumName(e)),ok:this.props.t(`Add objects`),multiSelect:!0,types:[`state`,`channel`,`device`],columns:[`name`,`type`,`role`,`room`,`func`],socket:this.props.socket,lang:this.props.lang,theme:this.props.theme,themeName:this.props.theme.name,themeType:this.props.themeType,onClose:()=>this.setState({addObjectsDialog:null}),onOk:t=>{let n=Array.isArray(t)?t:t?[t]:[];this.addItemsToEnum(n,e)}}):null}renderAddFolderDialog(){let e=this.state.addFolderDialog;return e?d(Ne,{title:this.props.t(`Add objects`),text:this.props.t(`Add %s objects from "%s" to "%s"?`,e.ids.length.toString(),e.folderId,this.getEnumName(e.enumId)),ok:this.props.t(`Add objects`),onClose:t=>this.setState({addFolderDialog:null},()=>t&&this.addItemsToEnum(e.ids,e.enumId))}):null}async applyMemberChanges(e){let t=Object.keys(e).filter(e=>{var t;return(t=this.state.enums)==null?void 0:t[e]});if(!t.length)return;await this.addUpdating(t);let n={};for(let a of t)try{var r,i;let t=await this.props.socket.getObject(a)||((r=this.state.enums)==null?void 0:r[a]);if(!t)continue;let o=((i=t.common)==null?void 0:i.members)||[],s=e[a].remove||[],c=o.filter(e=>!s.includes(e));for(let t of e[a].add||[])c.includes(t)||c.push(t);if(JSON.stringify(c)===JSON.stringify(o))continue;let l=JSON.parse(JSON.stringify(t));l.common.members=c,this.fastUpdate=!0,await this.props.socket.setObject(l._id,l),n[l._id]=l}catch(e){window.alert(`Cannot update enum: ${sr(e)}`)}Object.keys(n).length?await this.updateData({...this.state.enums||{},...n}):this.setState({updating:[]})}renderWizard(){return!this.state.wizardOpen||!this.state.enums?null:d($n,{socket:this.props.socket,enums:this.state.enums,t:this.props.t,theme:this.props.theme,getName:this.getName,fullScreen:this.state.narrow,onCreateEnums:this.createEnums,onChangeMembers:this.changeMembers,onClose:()=>this.setState({wizardOpen:!1})})}renderViewToggle(){let{t:e}=this.props;return D(ge,{size:`small`,exclusive:!0,sx:Q.viewToggle,value:this.state.view,onChange:(e,t)=>t&&this.setView(t),children:[D(Be,{value:`categories`,title:e(`Categories`),children:[d(Je,{fontSize:`small`}),this.state.narrow?null:e(`Categories`)]}),D(Be,{value:`assignment`,title:e(`Assignment`),children:[d(Ye,{fontSize:`small`}),this.state.narrow?null:e(`Assignment`)]})]})}renderTopBar(e){let{t}=this.props;return D(I,{sx:Q.topBar,children:[this.renderViewToggle(),d(B,{title:t(`Set up rooms and functions`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(W,{size:`small`,variant:`outlined`,sx:Q.wizardButton,startIcon:d($e,{}),onClick:()=>this.setState({wizardOpen:!0}),children:this.state.narrow?null:t(`Assistant`)})}),this.state.view===`categories`?D(O,{children:[d(B,{title:t(`Add enum`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{id:`categoryPopoverButton`,size:`small`,onClick:()=>e.favorites?this.showEnumEditDialog(this.getEnumTemplate(`enum`),!0):this.setState({categoryPopoverOpen:!0}),children:d(r,{})})}),d(Ve,{open:this.state.categoryPopoverOpen,onClose:()=>this.setState({categoryPopoverOpen:!1}),anchorEl:()=>document.getElementById(`categoryPopoverButton`),anchorOrigin:{vertical:`bottom`,horizontal:`right`},children:D(Pe,{children:[e.favorites?null:d(De,{onClick:()=>{this.setState({categoryPopoverOpen:!1}),this.createEnumTemplate(`enum`,rr.favorites)},children:t(`Favorites`)}),d(De,{onClick:()=>{this.setState({categoryPopoverOpen:!1}),this.showEnumEditDialog(this.getEnumTemplate(`enum`),!0)},children:t(`Custom enum`)})]})}),Object.keys(e).length?d(Me,{value:e[this.state.currentCategory]?this.state.currentCategory:!1,variant:`scrollable`,scrollButtons:`auto`,sx:Q.tabs,onChange:(e,t)=>this.setCurrentCategory(t,()=>this.setState({showDetails:!1})),children:Object.keys(e).map(t=>{var n;let r=e[t],i=r.data||{_id:r.id,common:{name:r.id.split(`.`).pop()||``},type:`enum`,native:{}};return d(S,{component:`span`,style:{backgroundColor:((n=i.common)==null?void 0:n.color)||void 0,borderRadius:4},label:d(Ft,{categoryData:i,showEnumEditDialog:this.showEnumEditDialog,showEnumDeleteDialog:this.showEnumDeleteDialog,styles:Q,...this.props}),value:t},t)})}):null]}):null,d(I,{sx:{flexGrow:1}}),this.state.narrow||this.state.view!==`categories`||!this.state.showObjects?null:d(B,{title:t(`Hide object list`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{color:`primary`,onClick:this.toggleObjects,children:d(et,{})})})]})}renderListPane(e,t){let{t:n}=this.props,i=e?Object.values(e.children):[],a=Object.values(this.state.enums||{}).some(e=>e._id.startsWith(`enum.${this.state.currentCategory}.`)&&e._id.split(`.`).length>3),o=Object.values(this.state.enumsClosed).some(e=>e);return D(I,{sx:k.getStyle(this.props.theme,Q.listPane,this.state.narrow&&Q.listPaneNarrow),children:[D(I,{sx:Q.listToolbar,children:[d(Ce,{variant:`standard`,placeholder:n(`Filter`),sx:Q.filter,value:this.state.filter,onChange:e=>this.setState({filter:e.target.value}),slotProps:{input:{endAdornment:this.state.filter?d(h,{tabIndex:-1,size:`small`,onClick:()=>this.setState({filter:``}),children:d(C,{})}):null}}}),a?d(B,{title:n(o?`Expand all`:`Collapse all`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(h,{size:`small`,onClick:()=>this.toggleAllEnums(!o),children:d(o?ct:st,{})})}):null,d(B,{title:n(`Add group`),slotProps:{popper:{sx:{pointerEvents:`none`}}},children:d(`span`,{children:d(h,{size:`small`,disabled:!this.state.currentCategory,onClick:()=>this.addEnum(`enum.${this.state.currentCategory}`),children:d(r,{})})})})]}),d(I,{sx:Q.listScroll,children:d(Qt,{items:i,selectedId:t,onSelect:this.selectEnum,closed:this.state.enumsClosed,onToggle:this.toggleEnum,search:this.state.filter.trim().toLowerCase(),updating:this.state.updating,getName:this.getName,moveEnum:this.moveEnum,t:n,theme:this.props.theme})})]})}renderDetailsPane(e){var t;let n=e?(t=this.state.enums)==null?void 0:t[e]:void 0;if(!e||!n)return d(I,{sx:Q.detailsEmpty,children:this.props.t(`Select an entry on the left`)});let r=this.findTreeItem(e);return d(pn,{enumItem:n,enums:this.state.enums||{},subEntries:r?Object.values(r.children):[],members:this.state.members,parents:this.state.parents,socket:this.props.socket,t:this.props.t,theme:this.props.theme,getName:this.getName,updating:this.state.updating.includes(e),onBack:this.state.narrow?()=>this.setState({showDetails:!1}):void 0,onSelect:this.selectEnum,onEdit:()=>this.showEnumEditDialog(n,!1),onClone:()=>this.copyEnum(e),onDelete:()=>this.showEnumDeleteDialog(n),onAddChild:()=>this.addEnum(e),onAddObjects:()=>this.setState({addObjectsDialog:e}),onRemoveMember:t=>this.removeMemberFromEnum(t,e),onMoveMember:(t,n,r)=>void this.moveMember(t,e,n,r)})}renderRail(){return D(I,{sx:Q.rail,title:this.props.t(`Show object list`),onClick:this.toggleObjects,children:[d(et,{}),d(`span`,{style:Q.railText,children:this.props.t(`Object list`)})]})}render(){var e;let t=this.state.enumsTree;if(!t)return d(se,{});let n=((e=t.children.enum)==null?void 0:e.children)||{},r=this.getSelectedId(),i;return i=this.state.narrow?this.state.showDetails&&r?this.renderDetailsPane(r):this.renderListPane(n[this.state.currentCategory],r):D(I,{sx:Q.main,children:[this.renderListPane(n[this.state.currentCategory],r),this.renderDetailsPane(r)]}),D(O,{children:[D(ht,{backend:lt.isTouchDevice()?ft:mt,children:[d(nr,{}),D(I,{sx:Q.root,children:[this.renderTopBar(n),d(I,{sx:Q.body,children:this.state.view===`assignment`?d(Rn,{socket:this.props.socket,enums:this.state.enums||{},t:this.props.t,theme:this.props.theme,getName:this.getName,onChangeMembers:this.changeMembers,onOpenEnum:this.openEnum}):!this.state.narrow&&this.state.showObjects?d(I,{sx:Q.split,children:D(Pt,{direction:K.Horizontal,initialSizes:this.state.splitSizes,minWidths:[600,320],onResizeFinished:(e,t)=>{let n=[t[0],t[1]];this.setState({splitSizes:n}),$().setItem(`enumsSplitSizes2`,JSON.stringify(n))},gutterClassName:this.props.themeType===`dark`?`Dark visGutter`:`Light visGutter`,children:[i,d(I,{sx:Q.objectsPane,children:d(Kt,{addItemToEnum:this.addItemToEnum,addFolderToEnum:this.addFolderToEnum,getName:this.getName,stylesParent:Q,t:this.props.t,socket:this.props.socket,lang:this.props.lang,theme:this.props.theme})})]})}):D(O,{children:[i,this.state.narrow?null:this.renderRail()]})})]})]}),this.renderEditDialog(),this.renderDeleteDialog(),this.renderTemplateDialog(),this.renderAddObjectsDialog(),this.renderAddFolderDialog(),this.renderWizard()]})}};function lr(e){return d(_,{children:d(te,{style:{display:`flex`,flexDirection:`column`,overflow:`auto`},children:d(cr,{socket:e.socket,t:e.t,lang:e.lang,themeType:e.themeType,theme:e.theme})})})}export{lr as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bo as e,Hs as t,Ka as n,Ko as r,Us as i,Xs as a,fc as o,jr as s,lo as c,qo as l}from"./loadShare-eager-dmdYQhAl.js";import{V as u}from"./bootstrap-BU7j1Fe_.js";a(void 0);var d=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),f=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),p=e=>{let t=e.getInitialClientOffset(),n=e.getInitialSourceClientOffset();return t===null||n===null?{x:0,y:0}:d(t,n)},m=(e,t)=>{switch(e){case`left`:case`top-start`:case`bottom-start`:return 0;case`right`:case`top-end`:case`bottom-end`:return t.width;default:return t.width/2}},h=(e,t)=>{switch(e){case`top`:case`top-start`:case`top-end`:return 0;case`bottom`:case`bottom-start`:case`bottom-end`:return t.height;default:return t.height/2}},g=(e,t,n=`center`,r={x:0,y:0})=>{let i=e.getClientOffset();if(i===null)return null;if(!t.current||!t.current.getBoundingClientRect)return d(i,p(e));let a=t.current.getBoundingClientRect();return f(d(i,{x:m(n,a),y:h(n,a)}),r)},_=e=>{let t=`translate(${e.x.toFixed(1)}px, ${e.y.toFixed(1)}px)`;return{pointerEvents:`none`,position:`fixed`,top:0,left:0,transform:t,WebkitTransform:t}},v=e=>{let t=o(null),n=u(n=>({currentOffset:g(n,t,e==null?void 0:e.placement,e==null?void 0:e.padding),isDragging:n.isDragging(),itemType:n.getItemType(),item:n.getItem(),monitor:n}));return!n.isDragging||n.currentOffset===null?{display:!1}:{display:!0,itemType:n.itemType,item:n.item,style:_(n.currentOffset),monitor:n.monitor,ref:t}};function y(a){let o=a.icon;return i(`div`,{style:a.styles.formContainer,children:[o?t(o,{style:a.styles.formIcon}):null,t(e,{style:a.styles.formControl,variant:`standard`,children:t(c,{variant:`standard`,label:a.t(a.label),autoComplete:a.autoComplete,error:!!a.error,helperText:a.error||``,value:a.value,onChange:e=>{var t;return(t=a.onChange)==null?void 0:t.call(a,e.target.value)},disabled:a.disabled,type:a.type,slotProps:{inputLabel:{shrink:!0},input:{readOnly:!1,endAdornment:a.value?t(l,{position:`end`,children:t(r,{tabIndex:-1,size:`small`,onClick:()=>{var e;return(e=a.onChange)==null?void 0:e.call(a,``)},children:t(n,{})})}):null}}})})]})}function b(e){let n=e.icon;return i(`div`,{style:{width:`100%`},children:[n?t(n,{style:e.previewStyle||e.styles.formIcon}):null,t(s,{style:{...e.style||void 0,width:n?`calc(100% - 45px)`:`100%`,display:`inline-block`,verticalAlign:`top`},label:e.t(e.label),onChange:e.onChange,value:e.value||``})]})}export{y as n,v as r,b as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./rolldown-runtime-sJBDdmOt.js";import{Ar as n,Es as r,Hs as i,Lr as a,Nr as o,Rr as s,To as c,Tr as l,Ts as u,Us as d,Xo as f,Za as p,c as m,pc as h,sc as g,tc as _,ur as v,vr as y}from"./loadShare-eager-dmdYQhAl.js";import{t as b}from"./AdminUtils-Dc1eHsx5.js";import{M as x}from"./bootstrap-BU7j1Fe_.js";import{t as S}from"./CustomModal-Do2qVZr7.js";var C=t((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){for(var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),w=t((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),T=t((e=>{var t=C(),n=w(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){let t=e.length<0?0:_(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(Q(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){let t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||ce(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(Q(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return X(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return se(e).length;default:if(i)return r?-1:X(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return F(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return te(this,t,n);case`latin1`:case`binary`:return P(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ne(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e||s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ce(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(i)n=0;else return-1}if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o=0;for(;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(ce(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return Z(X(t,e.length-n),e,n,r)}function O(e,t,n,r){return Z(ae(t),e,n,r)}function k(e,t,n,r){return Z(se(t),e,n,r)}function A(e,t,n,r){return Z(oe(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return N(r)}var ee=4096;function N(e){let t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function te(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function P(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function F(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=le[e[r]];return i}function ne(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function I(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t+this[++e]*256+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*256+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*256+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*256+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=this[e+4]+this[e+5]*256+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*256+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=$(function(e){e>>>=0,q(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&J(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*256+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*256+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),n.read(this,e,!1,52,8)};function L(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;L(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function R(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function z(e,t,n,r,i){re(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=$(function(e,t=0){return R(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=$(function(e,t=0){return z(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);L(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=$(function(e,t=0){return R(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=$(function(e,t=0){return z(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function B(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function V(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return V(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return V(this,e,t,!1,n)};function H(e,t,r,i,a){return t=+t,r>>>=0,a||B(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return H(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return H(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var U={};function W(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}W(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),W(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),W(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=G(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=G(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function G(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function K(e,t,n){q(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&J(t,e.length-(n+1))}function re(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new U.ERR_OUT_OF_RANGE(`value`,i,e)}K(r,i,a)}function q(e,t){if(typeof e!=`number`)throw new U.ERR_INVALID_ARG_TYPE(t,`number`,e)}function J(e,t,n){throw Math.floor(e)===e?t<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(q(e,n),new U.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var Y=/[^+/0-9A-Za-z-_]/g;function ie(e){if(e=e.split(`=`)[0],e=e.trim().replace(Y,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function X(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function ae(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function oe(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function se(e){return t.toByteArray(ie(e))}function Z(e,t,n,r){let i=0;for(;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Q(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function ce(e){return e!==e}var le=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function $(e){return typeof BigInt>`u`?ue:e}function ue(){throw Error(`BigInt not supported`)}})),E=t(((e,t)=>{ace.define(`ace/ext/modelist`,[`require`,`exports`,`module`],function(e,t,n){var r=[];function i(e){for(var t=c.text,n=e.split(/[\/\\]/).pop(),i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var a=function(){function e(e,t,n){this.name=e,this.caption=t,this.mode=`ace/mode/`+e,this.extensions=n;var r=/\^/.test(n)?n.replace(/\|(\^)?/g,function(e,t){return`$|`+(t?`^`:`^.*\\.`)})+`$`:`\\.(`+n+`)$`;this.extRe=new RegExp(r,`gi`)}return e.prototype.supportsFile=function(e){return e.match(this.extRe)},e}(),o={ABAP:[`abap`],ABC:[`abc`],ActionScript:[`as`],ADA:[`ada|adb`],Alda:[`alda`],Apache_Conf:[`^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd`],Apex:[`apex|cls|trigger|tgr`],AQL:[`aql`],AsciiDoc:[`asciidoc|adoc`],ASL:[`dsl|asl|asl.json`],Assembly_ARM32:[`s`],Assembly_x86:[`asm|a`],Astro:[`astro`],AutoHotKey:[`ahk`],Basic:[`bas|bak`],BatchFile:[`bat|cmd`],BibTeX:[`bib`],C_Cpp:[`cpp|c|cc|cxx|h|hh|hpp|ino`],C9Search:[`c9search_results`],Cedar:[`cedar`],CedarSchema:[`cedarschema`],Cirru:[`cirru|cr`],Clojure:[`clj|cljs`],Clue:[`clue`],Cobol:[`CBL|COB`],coffee:[`coffee|cf|cson|^Cakefile`],ColdFusion:[`cfm|cfc`],Crystal:[`cr`],CSharp:[`cs`],Csound_Document:[`csd`],Csound_Orchestra:[`orc`],Csound_Score:[`sco`],CSS:[`css`],CSV:[`csv`],Curly:[`curly`],Cuttlefish:[`conf`],D:[`d|di`],Dart:[`dart`],Diff:[`diff|patch`],Django:[`djt|html.djt|dj.html|djhtml`],Dockerfile:[`^Dockerfile`],Dot:[`dot`],Drools:[`drl`],Edifact:[`edi`],Eiffel:[`e|ge`],EJS:[`ejs`],Elixir:[`ex|exs`],Elm:[`elm`],Erlang:[`erl|hrl`],Flix:[`flix`],Forth:[`frt|fs|ldr|fth|4th`],Fortran:[`f|f90`],FSharp:[`fsi|fs|ml|mli|fsx|fsscript`],FSL:[`fsl`],FTL:[`ftl`],Gcode:[`gcode`],GDResource:[`tres|tscn`],GDScript:[`gd`],GDShader:[`gdshader|gdshaderinc`],Gherkin:[`feature`],Gitignore:[`^.gitignore`],Glsl:[`glsl|frag|vert`],Gobstones:[`gbs`],golang:[`go`],GraphQLSchema:[`gql`],GROQ:[`groq`],Groovy:[`groovy`],HAML:[`haml`],Handlebars:[`hbs|handlebars|tpl|mustache`],Haskell:[`hs`],Haskell_Cabal:[`cabal`],haXe:[`hx`],Hjson:[`hjson`],HTML:[`html|htm|xhtml|we|wpy`],HTML_Elixir:[`eex|html.eex`],HTML_Ruby:[`erb|rhtml|html.erb`],INI:[`ini|conf|cfg|prefs`],Io:[`io`],Ion:[`ion`],Jack:[`jack`],Jade:[`jade|pug`],Java:[`java`],JavaScript:[`js|jsm|cjs|mjs`],JEXL:[`jexl`],JSON:[`json`],JSON5:[`json5`],JSONiq:[`jq`],JSP:[`jsp`],JSSM:[`jssm|jssm_state`],JSX:[`jsx`],Julia:[`jl`],Kotlin:[`kt|kts`],LaTeX:[`tex|latex|ltx|bib`],Latte:[`latte`],LESS:[`less`],Liquid:[`liquid`],Lisp:[`lisp`],LiveScript:[`ls`],LogiQL:[`logic|lql`],Logtalk:[`lgt`],LSL:[`lsl`],Lua:[`lua`],LuaPage:[`lp`],Lucene:[`lucene`],Makefile:[`^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make`],Markdown:[`md|markdown`],Mask:[`mask`],MATLAB:[`matlab`],Maze:[`mz`],MediaWiki:[`wiki|mediawiki`],MEL:[`mel`],MIPS:[`s|asm`],MIXAL:[`mixal`],MUSHCode:[`mc|mush`],MySQL:[`mysql`],Mariadb:[`mariadb`],Nasal:[`nas`],Nginx:[`nginx|conf`],Nim:[`nim`],Nix:[`nix`],NSIS:[`nsi|nsh|nsdinc`],Nunjucks:[`nunjucks|nunjs|nj|njk`],ObjectiveC:[`m|mm`],OCaml:[`ml|mli`],Odin:[`odin`],PartiQL:[`partiql|pql`],Pascal:[`pas|p`],Perl:[`pl|pm`],pgSQL:[`pgsql`],PHP:[`php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module`],PHP_Laravel_blade:[`blade.php`],Pig:[`pig`],PLSQL:[`plsql`],Powershell:[`ps1`],Praat:[`praat|praatscript|psc|proc`],Prisma:[`prisma`],Prolog:[`plg|prolog`],Properties:[`properties`],Protobuf:[`proto`],PRQL:[`prql`],Puppet:[`epp|pp`],Python:[`py`],QML:[`qml`],R:[`r`],Raku:[`raku|rakumod|rakutest|p6|pl6|pm6`],Razor:[`cshtml|asp`],RDoc:[`Rd`],Red:[`red|reds`],RHTML:[`Rhtml`],Robot:[`robot|resource`],RST:[`rst`],Ruby:[`rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile`],Rust:[`rs`],SaC:[`sac`],SASS:[`sass`],SCAD:[`scad`],Scala:[`scala|sbt`],Scheme:[`scm|sm|rkt|oak|scheme`],Scrypt:[`scrypt`],SCSS:[`scss`],SH:[`sh|bash|^.bashrc`],SJS:[`sjs`],Slim:[`slim|skim`],Smarty:[`smarty|tpl`],Smithy:[`smithy`],snippets:[`snippets`],Soy_Template:[`soy`],Space:[`space`],SPARQL:[`rq`],SQL:[`sql`],SQLServer:[`sqlserver`],Stylus:[`styl|stylus`],SVG:[`svg`],Swift:[`swift`],Tcl:[`tcl`],Terraform:[`tf`,`tfvars`,`terragrunt`],Tex:[`tex`],Text:[`txt`],Textile:[`textile`],Toml:[`toml`],TSV:[`tsv`],TSX:[`tsx`],Turtle:[`ttl`],Twig:[`twig|swig`],Typescript:[`ts|mts|cts|typescript|str`],Vala:[`vala`],VBScript:[`vbs|vb`],Velocity:[`vm`],Verilog:[`v|vh|sv|svh`],VHDL:[`vhd|vhdl`],Visualforce:[`vfp|component|page`],Vue:[`vue`],Wollok:[`wlk|wpgm|wtest`],XML:[`xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml`],XQuery:[`xq`],YAML:[`yaml|yml`],Zeek:[`zeek|bro`],Zig:[`zig`]},s={ObjectiveC:`Objective-C`,CSharp:`C#`,golang:`Go`,C_Cpp:`C and C++`,Csound_Document:`Csound Document`,Csound_Orchestra:`Csound`,Csound_Score:`Csound Score`,coffee:`CoffeeScript`,HTML_Ruby:`HTML (Ruby)`,HTML_Elixir:`HTML (Elixir)`,FTL:`FreeMarker`,PHP_Laravel_blade:`PHP (Blade Template)`,Perl6:`Perl 6`,AutoHotKey:`AutoHotkey / AutoIt`},c={};for(var l in o){var u=o[l],d=(s[l]||l).replace(/_/g,` `),f=l.toLowerCase(),p=new a(f,d,u[0]);c[f]=p,r.push(p)}t.getModeForPath=i,t.modes=r,t.modesByName=c}),(function(){ace.require([`ace/ext/modelist`],function(n){typeof t==`object`&&typeof e==`object`&&t&&(t.exports=n)})})()})),D=T(),O=e(m(),1);E(),r();var k=O.require?O.require(`ace/ext/modelist`):O.acequire(`ace/ext/modelist`),A=class e extends y{constructor(e){super(e),u(this,`writeFile64`,()=>{let e=this.props.href.split(`/`),t=this.state.editingValue||``;e.splice(0,2);let n=e[0],r=e.splice(1).join(`/`);this.props.socket.writeFile64(n,r,D.Buffer.from(t).toString(`base64`)).then(()=>this.props.onClose()).catch(e=>window.alert(`Cannot write file: ${e}`))}),Object.assign(this.state,{editing:!!this.props.formatEditFile||!1})}static getEditFile(e){switch(e){case`json`:return`json`;case`json5`:return`json5`;case`js`:return`javascript`;case`html`:return`html`;case`txt`:return`html`;default:return k.getModeForPath(`testFile.${e}`).mode.split(`/`).pop()||`text`}}getEditorOrViewer(){return i(x,{mode:e.getEditFile(this.props.formatEditFile),themeType:this.props.themeType,value:this.state.editingValue||this.state.code||this.state.text||void 0,onChange:this.state.editing?e=>this.setState({editingValue:e,changed:!0}):void 0})}onSave(){this.writeFile64()}},j=[{Owner:[{name:`read`,valueNum:1024,title:`read owner`},{name:`write`,valueNum:512,title:`write owner`}]},{Group:[{name:`read`,valueNum:64,title:`read group`},{name:`write`,valueNum:32,title:`write group`}]},{Everyone:[{name:`read`,valueNum:4,title:`read everyone`},{name:`write`,valueNum:2,title:`write everyone`}]}],M=(e,t,n)=>(e|=t&n,e&=t|~n&65535,e),ee=({value:e,setValue:t,t:n,differentValues:r,applyToChildren:a,mask:o,setMask:s,disabled:l})=>{g(()=>{if(a){let t=0;for(let n=0;n<r.length;n++)t|=e^r[n];s(t)}else s(0)},[r,a,s,e]);let u=new Set,f=e;for(let e of j)for(let t of e[Object.keys(e)[0]])f-t.valueNum>=0&&(f-=t.valueNum,u.add(t.valueNum));return i(`div`,{style:{display:`flex`,width:`fit-content`,margin:20,border:`1px solid`,borderLeft:0},children:j.map(r=>{let a=Object.keys(r)[0];return d(`div`,{style:{width:150,height:150,display:`flex`,flexDirection:`column`,alignItems:`center`,borderLeft:`1px solid`},children:[i(`div`,{style:{height:50,display:`flex`,alignItems:`center`,fontSize:18,borderBottom:`1px solid silver`,width:`100%`,justifyContent:`center`},children:n(a)}),i(`div`,{style:{display:`flex`,width:`100%`},children:r[a].map((r,a)=>{let f=u.has(r.valueNum),p=o&r.valueNum;return d(`div`,{style:{display:`flex`,flexDirection:`column`,flex:1,alignItems:`center`,borderRight:a===0?`1px solid`:0},children:[i(`div`,{style:{height:50,borderBottom:`1px solid`,width:`100%`,justifyContent:`center`,display:`flex`,alignItems:`center`,color:`silver`},children:n(r.name)}),i(`div`,{style:{height:50,display:`flex`},children:i(c,{disabled:l,checked:f,color:p?`primary`:`secondary`,indeterminate:!!p,style:p?{opacity:.5}:void 0,onChange:n=>{p&&(o&=~r.valueNum&65535,s(o));let i=e;n.target.checked?i|=r.valueNum:i&=~r.valueNum&65535,t(i)}})})]},r.valueNum)})})]},a)})})};async function N(e,t,n){let r=t[e];if(!r){let i=e.split(`/`),a=i.length,o=i.shift()||null,s=i.join(`/`),c=await n.readDir(o,s);t[e]=[];for(let n=0;n<c.length;n++){let r=c[n],i={id:`${e}/${r.file}`,ext:b.getFileExtension(r.file),folder:r.isDir,name:r.file,size:r.stats&&r.stats.size,modified:r.modifiedAt,acl:r.acl,level:a};t[e].push(i)}r=t[e]}for(let e=0;e<r.length;e++){let i=r[e];i.folder&&await N(i.id,t,n)}}function te(e){let t={};return Object.keys(e).forEach(n=>{t[n]={folder:!0,id:n,level:0,name:n},e[n].forEach(e=>{t[e.id]=e})}),t}async function P(e,t,n,r=``,i=``,a=0){if(typeof n==`string`&&(n=n.split(`/`),a=0,r=n.shift()||``,i=``),!(n.length>=a)){if(t[r+i]){if(n.length-1===a){let o=`${r+i}/${n[a]}`,s=t[r+i].find(e=>e.id===o);s&&s.folder&&await N(r+i,t,e);return}i+=`/${n[a]}`,await P(e,t,n,r,i,a+1)}else{let o=await e.readDir(r||null,i);t[r+i]=[],o.forEach(e=>{let n={id:`${i}/${e.file}`,ext:b.getFileExtension(e.file),folder:e.isDir,name:e.file,size:e.stats&&e.stats.size,modified:e.modifiedAt,acl:e.acl,level:a};t[r+i].push(n)}),await P(e,t,n,r,i,a+1)}}}var F=`different`,ne=({onClose:e,onApply:t,selected:n,applyChangesToObject:r,applyChangesToFile:a,objects:s,t:c,themeType:u,folders:m,socket:_,theme:v})=>{let y=n.substring(0,n.lastIndexOf(`/`))||n,b=(n.split(`/`).length===1?m[`/`].find(({id:e})=>e===n):m[y].find(({id:e})=>e===n))||{},[x,C]=h(null),[w,T]=h(null),[E,D]=h([]),[O,k]=h([]),[A,j]=h(!1),[N,ne]=h(0),[I,L]=h(null),[R,z]=h(!1),[B,V]=h(!1),[H,U]=h([]),[W,G]=h(0),[K,re]=h([]),[q,J]=h(!0),[Y,ie]=h(!1),X=l.getLanguage();return g(()=>{let e=[],t=b.id,n=!1,r=!1,i=null,a=null,o=null,c=[],l=0;P(_,m,t).then(()=>{let u=te(m),d=`${t}/`;Object.keys(u).forEach(f=>{if(f!==`/`&&(f===t||f.startsWith(d))){if(!f.includes(`/`)&&s[f]){var p,m,h,g,_,v,y,b,x;let t=s[f];l++,c.push(t),o===null&&((p=t.acl)==null?void 0:p.file)!==void 0&&(o=t.acl.file),i===null&&((m=t.acl)==null?void 0:m.owner)!==void 0&&(i=t.acl.owner),a===null&&((h=t.acl)==null?void 0:h.ownerGroup)!==void 0&&(a=t.acl.ownerGroup),!R&&i!==((g=t.acl)==null?void 0:g.owner)&&((_=t.acl)==null?void 0:_.owner)!==void 0&&(n=!0),!B&&a!==((v=t.acl)==null?void 0:v.ownerGroup)&&((y=t.acl)==null?void 0:y.ownerGroup)!==void 0&&(r=!0),((b=t.acl)==null?void 0:b.file)!==void 0&&o!==((x=t.acl)==null?void 0:x.file)&&!e.includes(t.acl.file)&&e.push(t.acl.file)}else if(!u[f].folder){var S,C,w,T,E,D;l++;let t=u[f];if(c.push(t),o===null&&t.acl.permissions!==void 0&&(o=t.acl.permissions),i===null&&((S=t.acl)==null?void 0:S.owner)!==void 0){var O;i=(O=t.acl)==null?void 0:O.owner}if(a===null&&((C=t.acl)==null?void 0:C.ownerGroup)!==void 0){var k;a=(k=t.acl)==null?void 0:k.ownerGroup}!R&&i!==((w=t.acl)==null?void 0:w.owner)&&((T=t.acl)==null?void 0:T.owner)!==void 0&&(n=!0),!B&&a!==((E=t.acl)==null?void 0:E.ownerGroup)&&((D=t.acl)==null?void 0:D.ownerGroup)!==void 0&&(r=!0),t.acl.permissions!==void 0&&o!==t.acl.permissions&&!e.includes(t.acl.permissions)&&e.push(t.acl.permissions)}}});let f=[],p=[];Object.keys(s).forEach(e=>{let t=s[e];e.startsWith(`system.group.`)&&(t==null?void 0:t.type)===`group`?p.push(t):e.startsWith(`system.user.`)&&(t==null?void 0:t.type)===`user`&&f.push(t)});let h=s[`system.config`].common.defaultNewAcl;i||=h.owner,a||=h.ownerGroup,o||=h.file,L(o),C(i),T(a),z(n),V(r),D(f),k(p),b!=null&&b.folder&&j(!0),ne(l),U(e),re(c)})},[s,n]),g(()=>{if(A)R&&x!==F&&C(F),B&&w!==F&&T(F);else{if(x&&x===F){var e;C(((e=s[n])==null||(e=e.acl)==null?void 0:e.owner)||null)}if(w&&w===F){var t;T(((t=s[n])==null||(t=t.acl)==null?void 0:t.ownerGroup)||null)}}console.log(`stateOwnerUser ${x}`)},[A,x,w,R,B]),K.length?i(S,{theme:v,titleButtonApply:`apply`,overflowHidden:!0,disableApply:q,progress:Y,onClose:e,onApply:()=>{ie(!0),setTimeout(async()=>{var e;let n=((e=s[`system.config`].common)==null||(e=e.defaultNewAcl)==null?void 0:e.file)||1636;if(A){let e=~W&65535;for(let t=0;t<K.length;t++){let s=K[t],m=!1,h=s,g=s;if(h._id){var i,o,c,l;let t=M(((i=h.acl)==null?void 0:i.file)||n,I??0,e);t!==((o=h.acl)==null?void 0:o.file)&&(h.acl=h.acl||{},h.acl.file=t,m=!0),x!==F&&x!==((c=h.acl)==null?void 0:c.owner)&&(h.acl=h.acl||{},h.acl.owner=x??``,m=!0),w!==F&&w!==((l=h.acl)==null?void 0:l.ownerGroup)&&(h.acl=h.acl||{},h.acl.ownerGroup=w??``,m=!0);try{m&&await r(h)}catch(e){console.error(e)}}else if(g&&!g.folder){var u,d,f,p;let t={},r=M(((u=g.acl)==null?void 0:u.permissions)||n,I??0,e);if(r!==((d=g.acl)==null?void 0:d.permissions)&&(t.permissions=r,m=!0),x!==F&&x!==((f=g.acl)==null?void 0:f.owner)&&(t.owner=x??void 0,m=!0),w!==F&&w!==((p=g.acl)==null?void 0:p.ownerGroup)&&(t.ownerGroup=w??void 0,m=!0),m){let e=g.id.split(`/`),n=e.shift()||``,r=e.join(`/`);try{await a(n,r,t)}catch(e){console.error(e)}}}}}else{let e=b.id.split(`/`),t=e.shift()||``,n=e.join(`/`),i={},o=!1;if(!b.folder){var m,h,g;((m=b.acl)==null?void 0:m.permissions)!==I&&(i.permissions=I??void 0,o=!0),((h=b.acl)==null?void 0:h.owner)!==x&&(i.owner=x??void 0,o=!0),((g=b.acl)==null?void 0:g.ownerGroup)!==w&&(i.ownerGroup=w??void 0,o=!0),o&&await a(t,n,i)}else if(!e.length&&s[b.id]){var _,v,y;let e=s[b.id];((_=e.acl)==null?void 0:_.file)!==I&&(e.acl=e.acl||{},e.acl.file=I??0,o=!0),((v=e.acl)==null?void 0:v.owner)!==x&&(e.acl=e.acl||{},e.acl.owner=x??``,o=!0),((y=e.acl)==null?void 0:y.ownerGroup)!==w&&(e.acl=e.acl||{},e.acl.ownerGroup=w??``,o=!0),o&&await r(e)}}ie(!1),t()},200)},children:d(`div`,{style:{display:`flex`,flexDirection:`column`},children:[i(`div`,{style:{margin:10,fontSize:20},children:c(`Access control list: %s`,n)}),d(`div`,{style:{display:`flex`},children:[i(o,{fullWidth:!0,style:{marginRight:10},label:c(`Owner user`),lang:X,list:E,t:c,disabled:Y,value:x||void 0,themeType:u,different:R?F:!1,onChange:e=>{z(!1),C(e),J(!1)}}),i(o,{fullWidth:!0,label:c(`Owner group`),lang:X,list:O,t:c,disabled:Y,value:w||void 0,themeType:u,different:B?F:!1,onChange:e=>{V(!1),T(e),J(!1)}})]}),d(`div`,{style:{display:`flex`,margin:10,alignItems:`center`,fontSize:10,marginLeft:0,color:`silver`},children:[i(`div`,{style:!b.folder||!A?{color:`green`}:void 0,children:c(`to apply one item`)}),i(p,{disabled:K.length===1||Y,checked:!s[b.id]&&!!b.folder||A,onChange:e=>{j(e.target.checked),J(!1)},color:`primary`}),d(`div`,{style:b.folder||A?{color:`green`}:void 0,children:[c(`to apply with children`),` `,b.folder||N>1?`(${N} ${c(`object(s)`)})`:``]})]}),Y&&i(f,{}),i(`div`,{style:{overflowY:`auto`},children:d(`div`,{children:[i(`h2`,{children:c(`File rights`)}),i(ee,{disabled:Y,mask:W,setMask:G,applyToChildren:A,differentValues:H,t:c,setValue:e=>{L(e),J(!1)},value:I??0})]})})]})}):i(f,{})};r();var I=[`select`,`view`],L=class e extends _{constructor(e){super(e),u(this,`t`,void 0),u(this,`wordCache`,void 0),u(this,`objects`,void 0),u(this,`navigateTo`,null),u(this,`translate`,(e,t,n)=>t===void 0?(this.wordCache[e]||(this.wordCache[e]=this.props.t(e)),this.wordCache[e]):this.props.t(e,t,n)),this.t=this.translate,this.wordCache={},this.objects={}}componentDidMount(){this.props.socket.getObjects(!0,!0).then(e=>this.objects=e)}static isAppDialogOpen(){let e=n.getLocation().dialog;return!!e&&!I.includes(e)}renderAclDialog(e){return i(ne,{theme:this.props.theme,themeType:this.props.themeType,applyChangesToObject:async t=>{let n=await this.props.socket.getObject(t._id);n.acl=t.acl,await this.props.socket.setObject(n._id,n);let r=n;r!=null&&r.acl&&e.updateItemsAcl([{id:r._id,acl:r.acl,level:0,name:r._id,folder:!1}])},applyChangesToFile:async(t,n,r)=>{let i=r||{},a;if((i.owner||i.ownerGroup)&&i.permissions?(await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup}),a=await this.props.socket.chmodFile(t,n,{mode:i.permissions})):i.permissions?a=await this.props.socket.chmodFile(t,n,{mode:i.permissions}):(i.owner||i.ownerGroup)&&(a=await this.props.socket.chownFile(t,n,{owner:i.owner,ownerGroup:i.ownerGroup})),Array.isArray(a))for(let n=0;n<a.length;n++){let r=a[n];r&&r.file&&r.acl&&e.updateItemsAcl([{id:`${t}/${r.path?`${r.path}/`:``}${r.file}`,acl:r.acl,level:0,name:``,folder:!1}])}},selected:e.state.selected,folders:e.state.folders,objects:this.objects,socket:this.props.socket,t:this.t,onClose:()=>e.setState({modalEditOfAccess:!1}),onApply:()=>e.setState({modalEditOfAccess:!1})})}render(){if(!this.props.ready)return i(f,{});if(!e.isAppDialogOpen()){let e=n.getLocation();this.navigateTo=e.tab===`tab-files`&&e.id?{mode:e.dialog===`view`?`view`:`select`,id:e.id}:null}let t=this.navigateTo;return i(a,{children:i(s,{overflow:`auto`,children:i(v,{navigateTo:t,onNavigateTo:t=>{e.isAppDialogOpen()||(t!=null&&t.id?n.doNavigate(`tab-files`,t.mode,t.id):n.doNavigate(`tab-files`))},showViewTypeButton:!0,ready:this.props.ready,socket:this.props.socket,themeType:this.props.themeType,theme:this.props.theme,lang:this.props.lang,t:this.props.t,showToolbar:!0,allowUpload:!0,allowView:!0,allowDownload:!0,allowCreateFolder:!0,allowDelete:!0,expertMode:this.props.expertMode,modalEditOfAccessControl:e=>this.renderAclDialog(e),FileViewer:A})})})}};export{L as default};
|