From ef9868f192bd0af114c39655b85cef01ce00e5bf Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Wed, 16 Sep 2026 15:29:53 +0000 Subject: [PATCH] 217 files --- AGENTS.md | 9 +- .../maintenance_supporter/__init__.py | 12 +- .../config_flow_options_global.py | 7 + .../maintenance_supporter/const.py | 4 + .../frontend-src/components/settings-view.ts | 39 + .../frontend-src/components/task-dialog.ts | 9 +- .../frontend-src/locales/cs.json | 7 + .../frontend-src/locales/da.json | 7 + .../frontend-src/locales/de.json | 7 + .../frontend-src/locales/en.json | 7 + .../frontend-src/locales/es.json | 7 + .../frontend-src/locales/fi.json | 7 + .../frontend-src/locales/fr.json | 7 + .../frontend-src/locales/hi.json | 7 + .../frontend-src/locales/hu.json | 7 + .../frontend-src/locales/it.json | 7 + .../frontend-src/locales/ja.json | 7 + .../frontend-src/locales/ko.json | 7 + .../frontend-src/locales/nb.json | 7 + .../frontend-src/locales/nl.json | 7 + .../frontend-src/locales/pl.json | 7 + .../frontend-src/locales/pt-br.json | 7 + .../frontend-src/locales/pt.json | 7 + .../frontend-src/locales/ru.json | 7 + .../frontend-src/locales/sv.json | 7 + .../frontend-src/locales/tr.json | 7 + .../frontend-src/locales/uk.json | 7 + .../frontend-src/locales/zh.json | 7 + .../frontend/locales/cs.json | 7 + .../frontend/locales/da.json | 7 + .../frontend/locales/de.json | 7 + .../frontend/locales/en.json | 7 + .../frontend/locales/es.json | 7 + .../frontend/locales/fi.json | 7 + .../frontend/locales/fr.json | 7 + .../frontend/locales/hi.json | 7 + .../frontend/locales/hu.json | 7 + .../frontend/locales/it.json | 7 + .../frontend/locales/ja.json | 7 + .../frontend/locales/ko.json | 7 + .../frontend/locales/nb.json | 7 + .../frontend/locales/nl.json | 7 + .../frontend/locales/pl.json | 7 + .../frontend/locales/pt-br.json | 7 + .../frontend/locales/pt.json | 7 + .../frontend/locales/ru.json | 7 + .../frontend/locales/sv.json | 7 + .../frontend/locales/tr.json | 7 + .../frontend/locales/uk.json | 7 + .../frontend/locales/zh.json | 7 + .../frontend/maintenance-calendar-card.js | 182 +- .../frontend/maintenance-card.js | 50 +- .../frontend/maintenance-panel.js | 6 +- .../frontend/maintenance-strategy-shim.js | 4 +- ... adopt-problem-sensors-dialog-2C6DAJNM.js} | 4 +- .../adopt-problem-sensors-dialog-F7GLLLJ2.js | 250 -- .../adopt-problem-sensors-dialog-LETFD4EK.js | 250 -- .../adopt-problem-sensors-dialog-MUGSDLVO.js | 250 -- .../frontend/panel-chunks/chunk-3RZNOGQY.js | 88 - .../{chunk-D52RXZ4R.js => chunk-3UVOHVFS.js} | 2 +- .../frontend/panel-chunks/chunk-4OPY4VQ5.js | 1281 ------- .../{chunk-OMI4RPEK.js => chunk-6RV6BU2W.js} | 4 +- .../frontend/panel-chunks/chunk-73OGSTHK.js | 2 - .../frontend/panel-chunks/chunk-7QC673DD.js | 79 - .../frontend/panel-chunks/chunk-AKVULK73.js | 153 - .../frontend/panel-chunks/chunk-AN3A6RAI.js | 79 - .../{chunk-P4T4X54D.js => chunk-C2DCJ26U.js} | 4 +- .../frontend/panel-chunks/chunk-EPXIDVO3.js | 88 - .../frontend/panel-chunks/chunk-FE4LECIX.js | 2 - .../frontend/panel-chunks/chunk-FS7VLXOK.js | 213 -- .../{chunk-AZKZNFFK.js => chunk-G76Z2Z4C.js} | 8 +- .../frontend/panel-chunks/chunk-GRODOZHK.js | 153 - .../frontend/panel-chunks/chunk-H235LAFJ.js | 2 - .../frontend/panel-chunks/chunk-HMRAXB77.js | 393 -- .../frontend/panel-chunks/chunk-IL2HOGSI.js | 2 - .../frontend/panel-chunks/chunk-IOW4PMB5.js | 88 - .../frontend/panel-chunks/chunk-KRAXVQN3.js | 2 - .../frontend/panel-chunks/chunk-KVN7NIIW.js | 213 -- .../frontend/panel-chunks/chunk-LGSRBPFD.js | 1412 -------- .../{chunk-A6LVKMPW.js => chunk-LJBGBUDY.js} | 2 +- .../frontend/panel-chunks/chunk-LXDQIXSO.js | 2 - .../frontend/panel-chunks/chunk-NOXOKE42.js | 2 - .../frontend/panel-chunks/chunk-NP3X3ILW.js | 213 -- .../{chunk-4IXJEKWO.js => chunk-NZPPXRKZ.js} | 10 +- .../frontend/panel-chunks/chunk-OHSAYUYA.js | 2 - .../frontend/panel-chunks/chunk-OI2BG3RF.js | 1410 -------- .../{chunk-EO7HST7S.js => chunk-OTS5U34S.js} | 4 +- .../{chunk-BFRW5MGC.js => chunk-OXPKT66L.js} | 14 +- .../frontend/panel-chunks/chunk-PTYEFLBL.js | 939 ----- .../{chunk-WZP72YIY.js => chunk-RSV5IULH.js} | 4 +- .../{chunk-R7OIT4C5.js => chunk-SBK5UZCL.js} | 96 +- .../{chunk-6IQODYQV.js => chunk-TCEU2O2H.js} | 4 +- .../frontend/panel-chunks/chunk-TF6DLWEC.js | 2 - .../frontend/panel-chunks/chunk-THG66UT5.js | 153 - .../frontend/panel-chunks/chunk-TVK2JN4G.js | 2 - .../frontend/panel-chunks/chunk-U3UD3G6U.js | 79 - .../frontend/panel-chunks/chunk-U6MI7BIF.js | 939 ----- .../frontend/panel-chunks/chunk-VNJMQWX4.js | 393 -- .../frontend/panel-chunks/chunk-VNYLIDZN.js | 2 - .../{chunk-F4SM4QET.js => chunk-W2HMC6OR.js} | 4 +- .../frontend/panel-chunks/chunk-WG3MZHOS.js | 1289 ------- .../frontend/panel-chunks/chunk-WQO7M6UD.js | 1281 ------- .../frontend/panel-chunks/chunk-WTWETRW4.js | 2 - .../frontend/panel-chunks/chunk-X5NUHJD3.js | 937 ----- .../frontend/panel-chunks/chunk-XCPYIT7M.js | 2 - .../frontend/panel-chunks/chunk-XKVTMCJS.js | 2 - .../frontend/panel-chunks/chunk-XM5ER255.js | 448 --- .../{chunk-6FKJJO4T.js => chunk-XRSEIZKJ.js} | 4 +- .../frontend/panel-chunks/chunk-XXGPRYJO.js | 2 - .../frontend/panel-chunks/chunk-YUCXSTBQ.js | 2 - .../{chunk-B4ELBSAY.js => chunk-Z4FODB56.js} | 4 +- .../frontend/panel-chunks/chunk-Z4FQHWRJ.js | 2 - .../{chunk-A2LPO2HZ.js => chunk-ZCBGAPJD.js} | 4 +- .../frontend/panel-chunks/chunk-ZLVS6B3E.js | 2 - .../frontend/panel-chunks/chunk-ZSJQYRHU.js | 2 - .../frontend/panel-chunks/chunk-ZYL7NR3G.js | 1410 -------- .../panel-chunks/complete-dialog-6I7ZE4B2.js | 2 + .../panel-chunks/complete-dialog-7QU2UUEO.js | 2 - .../panel-chunks/complete-dialog-JUICYXSD.js | 2 - .../panel-chunks/complete-dialog-N6EFNVQ2.js | 2 - .../panel-chunks/complete-dialog-UPLYCC44.js | 2 - .../panel-chunks/dialog-mount-2N6TICRI.js | 2 - .../panel-chunks/dialog-mount-63ZHQOD5.js | 2 - .../panel-chunks/dialog-mount-DACUEWGB.js | 2 + .../panel-chunks/dialog-mount-LCWF3KPK.js | 2 - .../panel-chunks/dialog-mount-SLWA7G3U.js | 2 - .../panel-chunks/object-dialog-3S3T4FYV.js | 2 - .../panel-chunks/object-dialog-7DRSIILH.js | 2 - .../panel-chunks/object-dialog-CB47KB4P.js | 2 - .../panel-chunks/object-dialog-JFCVO3XR.js | 2 - .../panel-chunks/object-dialog-V5TRDSAR.js | 2 + .../panel-chunks/qr-dialog-CYEDWF3M.js | 2 - .../panel-chunks/qr-dialog-JXN7TAPX.js | 2 - .../panel-chunks/qr-dialog-ND4XOZOC.js | 2 + .../panel-chunks/qr-dialog-RBGTL4ZC.js | 2 - .../panel-chunks/qr-dialog-VLJFNEK6.js | 2 - ...-XJQ7WKV6.js => settings-view-BOF5YKYH.js} | 24 +- .../panel-chunks/settings-view-FKUL2UH5.js | 1343 ------- .../panel-chunks/settings-view-J5TAOE5R.js | 1293 ------- .../panel-chunks/settings-view-W7DPLYBV.js | 1337 ------- .../suggested-setups-dialog-N5E54UCC.js | 146 - ...js => suggested-setups-dialog-OTTCDLIG.js} | 4 +- .../suggested-setups-dialog-YAP3OISD.js | 146 - .../suggested-setups-dialog-Z3KDVCAS.js | 146 - .../panel-chunks/task-dialog-5V36PJTB.js | 2 + .../panel-chunks/task-dialog-7KIHLR4V.js | 2 - .../panel-chunks/task-dialog-7YY6LHLL.js | 2 - .../panel-chunks/task-dialog-FOGJHCSB.js | 2 - .../panel-chunks/task-dialog-PZMOKNLO.js | 2 - .../chunks/budget-section-card-GTMPOTSI.js | 125 - ...QR3.js => budget-section-card-ILO66YA4.js} | 4 +- .../chunks/budget-section-card-XNGOFRAV.js | 125 - .../chunks/budget-section-card-ZJW7YTHU.js | 125 - .../{chunk-APM7GQQR.js => chunk-62AO4XFY.js} | 2 +- .../strategy/chunks/chunk-AVD72T2Q.js | 1281 ------- .../strategy/chunks/chunk-C4KIMTDR.js | 88 - .../{chunk-4QSUIFST.js => chunk-CH4XIFVT.js} | 4 +- .../strategy/chunks/chunk-CW4GSGTQ.js | 60 - .../strategy/chunks/chunk-DNYI2KQV.js | 2 - .../strategy/chunks/chunk-FMRXSKNC.js | 2 - .../strategy/chunks/chunk-GOJ5CE7B.js | 2 - .../strategy/chunks/chunk-HCTB4FTI.js | 2 - .../{chunk-DFNEXAVU.js => chunk-KK4NNJHL.js} | 4 +- .../strategy/chunks/chunk-LRS2DZQN.js | 2 - .../{chunk-CWHLCD4F.js => chunk-NKXHANLV.js} | 2 +- .../strategy/chunks/chunk-NUYQDL2V.js | 1281 ------- .../strategy/chunks/chunk-PZLMPK5Y.js | 88 - .../strategy/chunks/chunk-QP4GVVMP.js | 1289 ------- .../strategy/chunks/chunk-TY5VMGUH.js | 60 - .../strategy/chunks/chunk-UKCMA2RG.js | 88 - .../strategy/chunks/chunk-VMGD53HU.js | 2 - .../strategy/chunks/chunk-WIO3PYFT.js | 60 - .../{chunk-A7GYNFDF.js => chunk-ZBY2DACR.js} | 12 +- .../strategy/chunks/dialog-mount-4OVR4WJA.js | 3177 ---------------- .../strategy/chunks/dialog-mount-DKBN7VVX.js | 3177 ---------------- ...t-EX65KHSI.js => dialog-mount-PK3764GA.js} | 40 +- .../strategy/chunks/dialog-mount-TBFMCACO.js | 3213 ----------------- .../chunks/groups-section-card-UECFCP5O.js | 137 - ...XMG.js => groups-section-card-V63GWVBG.js} | 4 +- .../chunks/groups-section-card-VYXAQET4.js | 137 - .../chunks/groups-section-card-X34HJTMC.js | 137 - .../chunks/vacation-section-card-2O34KKIU.js | 134 - ...E.js => vacation-section-card-LORMB24Z.js} | 4 +- .../chunks/vacation-section-card-SZEIZ5UX.js | 134 - .../chunks/vacation-section-card-WYXSFXU4.js | 134 - .../maintenance-dashboard-strategy.js | 6 +- .../helpers/battery_fleet.py | 108 +- .../helpers/battery_fleet_setup.py | 10 + .../helpers/settings_registry.py | 4 + .../maintenance_supporter/manifest.json | 2 +- .../maintenance_supporter/parts_runtime.py | 12 +- .../maintenance_supporter/strings.json | 2 + .../translations/cs.json | 2 + .../translations/da.json | 2 + .../translations/de.json | 2 + .../translations/en.json | 2 + .../translations/es.json | 2 + .../translations/fi.json | 2 + .../translations/fr.json | 2 + .../translations/hi.json | 2 + .../translations/hu.json | 2 + .../translations/it.json | 2 + .../translations/ja.json | 2 + .../translations/ko.json | 2 + .../translations/nb.json | 2 + .../translations/nl.json | 2 + .../translations/pl.json | 2 + .../translations/pt-BR.json | 2 + .../translations/pt.json | 2 + .../translations/ru.json | 2 + .../translations/sv.json | 2 + .../translations/tr.json | 2 + .../translations/uk.json | 2 + .../translations/zh-Hans.json | 2 + .../websocket/__init__.py | 2 + .../websocket/dashboard.py | 4 + zigbee2mqtt/state.json | 28 +- 217 files changed, 864 insertions(+), 34306 deletions(-) rename custom_components/maintenance_supporter/frontend/panel-chunks/{adopt-problem-sensors-dialog-4BL3RPJP.js => adopt-problem-sensors-dialog-2C6DAJNM.js} (97%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/adopt-problem-sensors-dialog-F7GLLLJ2.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/adopt-problem-sensors-dialog-LETFD4EK.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/adopt-problem-sensors-dialog-MUGSDLVO.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-3RZNOGQY.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-D52RXZ4R.js => chunk-3UVOHVFS.js} (92%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-4OPY4VQ5.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-OMI4RPEK.js => chunk-6RV6BU2W.js} (98%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-73OGSTHK.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-7QC673DD.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-AKVULK73.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-AN3A6RAI.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-P4T4X54D.js => chunk-C2DCJ26U.js} (96%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-EPXIDVO3.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-FE4LECIX.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-FS7VLXOK.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-AZKZNFFK.js => chunk-G76Z2Z4C.js} (89%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-GRODOZHK.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-H235LAFJ.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-HMRAXB77.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-IL2HOGSI.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-IOW4PMB5.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-KRAXVQN3.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-KVN7NIIW.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-LGSRBPFD.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-A6LVKMPW.js => chunk-LJBGBUDY.js} (95%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-LXDQIXSO.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-NOXOKE42.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-NP3X3ILW.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-4IXJEKWO.js => chunk-NZPPXRKZ.js} (98%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-OHSAYUYA.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-OI2BG3RF.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-EO7HST7S.js => chunk-OTS5U34S.js} (96%) rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-BFRW5MGC.js => chunk-OXPKT66L.js} (63%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-PTYEFLBL.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-WZP72YIY.js => chunk-RSV5IULH.js} (97%) rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-R7OIT4C5.js => chunk-SBK5UZCL.js} (61%) rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-6IQODYQV.js => chunk-TCEU2O2H.js} (98%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-TF6DLWEC.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-THG66UT5.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-TVK2JN4G.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-U3UD3G6U.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-U6MI7BIF.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-VNJMQWX4.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-VNYLIDZN.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-F4SM4QET.js => chunk-W2HMC6OR.js} (98%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-WG3MZHOS.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-WQO7M6UD.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-WTWETRW4.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-X5NUHJD3.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-XCPYIT7M.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-XKVTMCJS.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-XM5ER255.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-6FKJJO4T.js => chunk-XRSEIZKJ.js} (97%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-XXGPRYJO.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-YUCXSTBQ.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-B4ELBSAY.js => chunk-Z4FODB56.js} (94%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-Z4FQHWRJ.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{chunk-A2LPO2HZ.js => chunk-ZCBGAPJD.js} (61%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-ZLVS6B3E.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-ZSJQYRHU.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/chunk-ZYL7NR3G.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/complete-dialog-6I7ZE4B2.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/complete-dialog-7QU2UUEO.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/complete-dialog-JUICYXSD.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/complete-dialog-N6EFNVQ2.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/complete-dialog-UPLYCC44.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/dialog-mount-2N6TICRI.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/dialog-mount-63ZHQOD5.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/dialog-mount-DACUEWGB.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/dialog-mount-LCWF3KPK.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/dialog-mount-SLWA7G3U.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/object-dialog-3S3T4FYV.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/object-dialog-7DRSIILH.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/object-dialog-CB47KB4P.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/object-dialog-JFCVO3XR.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/object-dialog-V5TRDSAR.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/qr-dialog-CYEDWF3M.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/qr-dialog-JXN7TAPX.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/qr-dialog-ND4XOZOC.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/qr-dialog-RBGTL4ZC.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/qr-dialog-VLJFNEK6.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{settings-view-XJQ7WKV6.js => settings-view-BOF5YKYH.js} (93%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/settings-view-FKUL2UH5.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/settings-view-J5TAOE5R.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/settings-view-W7DPLYBV.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/suggested-setups-dialog-N5E54UCC.js rename custom_components/maintenance_supporter/frontend/panel-chunks/{suggested-setups-dialog-EYSXUVLV.js => suggested-setups-dialog-OTTCDLIG.js} (98%) delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/suggested-setups-dialog-YAP3OISD.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/suggested-setups-dialog-Z3KDVCAS.js create mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/task-dialog-5V36PJTB.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/task-dialog-7KIHLR4V.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/task-dialog-7YY6LHLL.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/task-dialog-FOGJHCSB.js delete mode 100644 custom_components/maintenance_supporter/frontend/panel-chunks/task-dialog-PZMOKNLO.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/budget-section-card-GTMPOTSI.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{budget-section-card-GWCFNQR3.js => budget-section-card-ILO66YA4.js} (96%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/budget-section-card-XNGOFRAV.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/budget-section-card-ZJW7YTHU.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{chunk-APM7GQQR.js => chunk-62AO4XFY.js} (94%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-AVD72T2Q.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-C4KIMTDR.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{chunk-4QSUIFST.js => chunk-CH4XIFVT.js} (94%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-CW4GSGTQ.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-DNYI2KQV.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-FMRXSKNC.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-GOJ5CE7B.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-HCTB4FTI.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{chunk-DFNEXAVU.js => chunk-KK4NNJHL.js} (98%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-LRS2DZQN.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{chunk-CWHLCD4F.js => chunk-NKXHANLV.js} (98%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-NUYQDL2V.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-PZLMPK5Y.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-QP4GVVMP.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-TY5VMGUH.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-UKCMA2RG.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-VMGD53HU.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/chunk-WIO3PYFT.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{chunk-A7GYNFDF.js => chunk-ZBY2DACR.js} (65%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/dialog-mount-4OVR4WJA.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/dialog-mount-DKBN7VVX.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{dialog-mount-EX65KHSI.js => dialog-mount-PK3764GA.js} (91%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/dialog-mount-TBFMCACO.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/groups-section-card-UECFCP5O.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{groups-section-card-H7274XMG.js => groups-section-card-V63GWVBG.js} (97%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/groups-section-card-VYXAQET4.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/groups-section-card-X34HJTMC.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/vacation-section-card-2O34KKIU.js rename custom_components/maintenance_supporter/frontend/strategy/chunks/{vacation-section-card-JZ3FWKSE.js => vacation-section-card-LORMB24Z.js} (96%) delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/vacation-section-card-SZEIZ5UX.js delete mode 100644 custom_components/maintenance_supporter/frontend/strategy/chunks/vacation-section-card-WYXSFXU4.js diff --git a/AGENTS.md b/AGENTS.md index 369ef9ff..adc58ad4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -159,6 +159,11 @@ dashboards. These files are designed for editing. Load `home-assistant-configuration` before changing one — it carries the mandatory style guide, the safe-write path, and the reload/restart rules. +Automation edits are complete only after the approved safe write, approved +`automation.reload` via `call_service`, and read-only load verification. Report +saved/reloaded/verified separately. If reload is unapproved or unavailable in the +current tool profile, report it as pending; never bypass the profile via shell. + ### 2. MCP tools (runtime API) Real-time interaction with the running instance: @@ -182,8 +187,8 @@ is missing, the profile is reduced — say so instead of working around it. ### 3. hab CLI (Home Assistant Builder) A CLI designed for AI agents, pre-authenticated via the Supervisor token. It is -the primary path for dashboards, areas/floors/zones/labels, helpers, scripts, -scenes, blueprints, backups, people, categories, to-do lists, notifications, +the primary path for dashboards, areas/floors/zones/labels, helpers, +blueprints, backups, people, categories, to-do lists, notifications, integrations, repairs, events and templates — the registry-level work that has no YAML file behind it. diff --git a/custom_components/maintenance_supporter/__init__.py b/custom_components/maintenance_supporter/__init__.py index ee53eea8..0e604dbd 100644 --- a/custom_components/maintenance_supporter/__init__.py +++ b/custom_components/maintenance_supporter/__init__.py @@ -450,6 +450,15 @@ async def _async_setup_shared(hass: HomeAssistant) -> bool: """ hass.data.setdefault(DOMAIN, {}) + # The Lovelace card / calendar card / strategy modules FIRST (#184): HA + # builds the list of extra module scripts into index.html at the moment a + # page is served, and the frontend does not load modules registered later + # into an already open page. Every await below (stores, indexes) used to + # sit in front of this line — on a slow hub a dashboard opened during + # start-up came without our modules ("Custom element doesn't exist") until + # a manual refresh. Register before anything that can take time. + await async_register_card(hass) + # "Business day" scheduling (the day-of-month `business` flag) follows the # user's Workday integration when one is configured — public holidays and # custom working weekdays instead of the plain Mon-Fri rule (#83 follow-up). @@ -861,9 +870,6 @@ async def _async_setup_shared(hass: HomeAssistant) -> bool: # Register WebSocket commands async_register_commands(hass) - # Register Lovelace card (always available) - await async_register_card(hass) - # Register listener for mobile app notification action buttons async def _handle_notification_action(event: Event) -> None: """Handle mobile_app_notification_action events from Companion App.""" diff --git a/custom_components/maintenance_supporter/config_flow_options_global.py b/custom_components/maintenance_supporter/config_flow_options_global.py index 54b40425..6cac3a4e 100644 --- a/custom_components/maintenance_supporter/config_flow_options_global.py +++ b/custom_components/maintenance_supporter/config_flow_options_global.py @@ -30,6 +30,7 @@ from .const import ( CONF_ADVANCED_PREDICTIONS, CONF_ADVANCED_SCHEDULE_TIME, CONF_ADVANCED_SEASONAL, + CONF_BATTERY_AUTO_RECORD_RECOVERY, CONF_BATTERY_LOW_PERCENT, CONF_BATTERY_RECOVERED_PERCENT, CONF_BUDGET_ALERT_THRESHOLD, @@ -703,6 +704,12 @@ class GlobalOptionsFlow(OptionsFlow): mode=selector.NumberSelectorMode.BOX, ) ), + # #181 follow-up (advanced): a level-driven recovery records + # the replacement in Battery Notes and consumes the cells. + vol.Optional( + CONF_BATTERY_AUTO_RECORD_RECOVERY, + default=self._opt(CONF_BATTERY_AUTO_RECORD_RECOVERY), + ): selector.BooleanSelector(), vol.Optional( CONF_NOTIFICATIONS_ENABLED, default=self._opt(CONF_NOTIFICATIONS_ENABLED), diff --git a/custom_components/maintenance_supporter/const.py b/custom_components/maintenance_supporter/const.py index 9fd1e225..6dbbc5a9 100644 --- a/custom_components/maintenance_supporter/const.py +++ b/custom_components/maintenance_supporter/const.py @@ -873,5 +873,9 @@ MISSING_ENTITY_THRESHOLD_REFRESHES = 6 # ~30 min at 5-min intervals CONF_BATTERY_RECOVERED_PERCENT = "battery_recovered_percent" DEFAULT_BATTERY_RECOVERED_PERCENT = 50 BATTERY_RECOVERED_PERCENT_RANGE: tuple[int, int] = (20, 100) +# #181 follow-up (advanced, default off): when the latch releases a battery +# BECAUSE ITS LEVEL rose above the recovery threshold, record the replacement +# in Battery Notes and consume the type's spare cells — no tap needed. +CONF_BATTERY_AUTO_RECORD_RECOVERY = "battery_auto_record_recovery" # D#182: the shopping-search template is user-settable (max URL length). MAX_PART_SEARCH_URL_TEMPLATE_LENGTH = 500 diff --git a/custom_components/maintenance_supporter/frontend-src/components/settings-view.ts b/custom_components/maintenance_supporter/frontend-src/components/settings-view.ts index e2adb7f7..4c9299a5 100644 --- a/custom_components/maintenance_supporter/frontend-src/components/settings-view.ts +++ b/custom_components/maintenance_supporter/frontend-src/components/settings-view.ts @@ -56,6 +56,7 @@ interface SettingsResponse { battery_low_percent?: number; /** #180: a low battery counts as replaced only once its level is above this. */ battery_recovered_percent?: number; + battery_auto_record_recovery?: boolean; /** D#182: shopping-search URL with {q} ("" = automatic) + the automatic value in effect. */ part_search_url_template?: string; part_search_url_default?: string; @@ -517,6 +518,28 @@ export class MaintenanceSettingsView extends LitElement { return runWs(this, payload, { fallbackKey, busy, onError: (msg) => this._showToast(msg) }); } + @state() private _compacting = false; + + /** #170: renumber every object, task and completion sequentially — an + * explicit, admin-only action behind a confirm (printed booklets keep the + * old numbers, so this is never done silently). */ + private async _compactReferenceNumbers(): Promise { + const L = this._lang; + if (this._compacting || !window.confirm(t("settings_compact_refs_confirm", L))) return; + const res = await this._ws<{ objects: number; tasks: number; completions: number }>( + { type: "maintenance_supporter/reference_numbers/compact" }, + "action_error", + (b) => { this._compacting = b; }, + ); + if (!res) return; + this._showToast( + t("settings_compact_refs_done", L) + .replace("{objects}", String(res.objects)) + .replace("{tasks}", String(res.tasks)) + .replace("{completions}", String(res.completions)), + ); + } + /** Bounded integer settings: an out-of-range entry used to be dropped * silently while the field kept showing it (bug review 2026-09-04). Now * it is named in a toast and the field snaps back to the stored value; @@ -870,6 +893,13 @@ export class MaintenanceSettingsView extends LitElement { ${this._intSetting("battery_recovered_percent", g.battery_recovered_percent ?? 50)}
${t("settings_battery_recovered_percent_hint", L)}
+ +
${t("settings_battery_auto_record_hint", L)}
${this._renderBatteryNotesHint(L)} ${this._renderBatteryLifetimes(L)}
${t("settings_thresholds_hint", L)}
@@ -896,6 +926,15 @@ export class MaintenanceSettingsView extends LitElement { @change=${(e: Event) => this._updateSetting("ref_numbers_in_lists", (e.target as HTMLInputElement).checked)} />
${t("settings_ref_numbers_in_lists_hint", L)}
+ ${this.hass?.user?.is_admin + ? html`
+ ${t("settings_compact_refs", L)} + +
+
${t("settings_compact_refs_hint", L)}
` + : nothing} @@ -1758,7 +1758,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" ${this._phaseSeq.map((i,a)=>l` ${a+1}. ${t(i)} - + `)} - `}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(gt.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let t of e.keys())if(m._PREVIEW_RELEVANT.has(String(t))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),t=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!t){this._pickerProbeStrikes=0;return}let i=(c,p,g=0)=>{if(!(!c||g>10)){(c.tagName?.toLowerCase()??"")==="ha-entity-picker"&&p.push(c);for(let f of[c.shadowRoot,c])if(f)for(let w of Array.from(f.children??[]))i(w,p,g+1)}},a=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let c of a)i(c,o);let h=o.length===0||o.some(c=>c.offsetHeight===0);if(e.offsetHeight===0||h){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return u;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((o,h)=>{let c=new Date(`${o}T12:00:00`).getDay();return`${Ae(c===0?6:c-1,e,"short")} ${B(o,e)}${h===0?t:""}`}).join(" \xB7 "),a=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`
${n("schedule_preview_ontime",e)}
`:u;return l` + `}_toggleWeekday(e){this._weekdays=this._weekdays.includes(e)?this._weekdays.filter(t=>t!==e):[...this._weekdays,e]}_previewScheduleDict(){if(this._scheduleType==="one_time")return this._dueDate?{kind:"one_time",due_date:this._dueDate}:null;if(mt.includes(this._scheduleType))return{...this._buildSchedule(),...this._recurrenceExtras()};let e=parseInt(this._intervalDays,10);return this._scheduleType==="manual"||!e||e<=0?null:{kind:"interval",every:e,unit:this._intervalUnit,anchor:this._intervalAnchor,...this._recurrenceExtras()}}updated(e){super.updated?.(e),this._scheduleEntityPickerProbe();for(let t of e.keys())if(g._PREVIEW_RELEVANT.has(String(t))){this._schedulePreviewRefresh();return}}_scheduleEntityPickerProbe(){this._entityPickerFallback||this._pickerProbeTimer!==void 0||!this._open||this._scheduleType!=="sensor_based"||(this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),1500))}_probeEntityPickers(){if(this._pickerProbeTimer=void 0,this._entityPickerFallback||!this._open)return;let e=this.shadowRoot?.querySelector("ha-form.entity-picker-form"),t=(this.shadowRoot?.querySelector(".content")?.offsetHeight??0)>0;if(!e||!t){this._pickerProbeStrikes=0;return}let i=(c,p,m=0)=>{if(!(!c||m>10)){(c.tagName?.toLowerCase()??"")==="ha-entity-picker"&&p.push(c);for(let f of[c.shadowRoot,c])if(f)for(let w of Array.from(f.children??[]))i(w,p,m+1)}},a=[...this.shadowRoot?.querySelectorAll("ha-form.entity-picker-form")??[]],o=[];for(let c of a)i(c,o);let _=o.length===0||o.some(c=>c.offsetHeight===0);if(e.offsetHeight===0||_){if(this._pickerProbeStrikes+=1,this._pickerProbeStrikes>=2){this._entityPickerFallback=!0;return}this._pickerProbeTimer=setTimeout(()=>this._probeEntityPickers(),700)}else this._pickerProbeStrikes=0}_schedulePreviewRefresh(){this._previewTimer&&clearTimeout(this._previewTimer),this._previewTimer=setTimeout(()=>{this._fetchSchedulePreview()},300)}async _fetchSchedulePreview(){let e=this._open?this._previewScheduleDict():null;if(!e){this._schedulePreview=[],this._schedulePreviewEnded=!1;return}let t=++this._previewSeq;try{let i=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/schedule/preview",schedule:e,...this._lastPerformed?{last_performed:this._lastPerformed}:{}});if(t!==this._previewSeq)return;this._schedulePreview=i.occurrences||[],this._schedulePreviewEnded=!!i.series_ended}catch{}}_renderSchedulePreview(){if(this._schedulePreview.length===0)return u;let e=this._lang,t=this.scheduleTimeEnabled&&this._scheduleTimeOn&&this._scheduleTime?` ${this._scheduleTime}`:"",i=this._schedulePreview.map((o,_)=>{let c=new Date(`${o}T12:00:00`).getDay();return`${Ae(c===0?6:c-1,e,"short")} ${B(o,e)}${_===0?t:""}`}).join(" \xB7 "),a=this._scheduleType==="time_based"&&this._intervalAnchor==="completion"?l`
${n("schedule_preview_ontime",e)}
`:u;return l`
${n("schedule_preview_title",e)}: ${i}${this._schedulePreviewEnded?l` ${n("schedule_preview_ends",e)}`:u} ${a}
- `}_buildSchedule(){let e=i=>{let a=parseInt(this._calOffset,10)||0;return a&&(i.offset=Math.max(-15,Math.min(a,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,a)=>i-a)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||gt.includes(this._scheduleType)))return u;let i=Tn(e);return l` + `}_buildSchedule(){let e=i=>{let a=parseInt(this._calOffset,10)||0;return a&&(i.offset=Math.max(-15,Math.min(a,15))),i};if(this._scheduleType==="weekdays")return e({kind:"weekdays",weekdays:[...this._weekdays].sort((i,a)=>i-a)});if(this._scheduleType==="nth_weekday")return e({kind:"nth_weekday",nth:parseInt(this._nth,10),weekday:parseInt(this._nthWeekday,10)});let t={kind:"day_of_month",day:this._domLastDay?-1:parseInt(this._domDay,10)||1};return this._domBusiness&&(t.business=!0),e(t)}_recurrenceExtras(){let e={};if(this._seasonMonths.length&&(e.season_months=[...this._seasonMonths].sort((t,i)=>t-i)),this._endsMode==="count"){let t=parseInt(this._endsCount,10);t>=1&&(e.ends={count:t})}else this._endsMode==="until"&&this._endsUntil&&(e.ends={until:this._endsUntil});return e}_toggleSeasonMonth(e){this._seasonMonths=this._seasonMonths.includes(e)?this._seasonMonths.filter(t=>t!==e):[...this._seasonMonths,e]}_renderRecurrenceExtras(){let e=this._lang;if(!(this._scheduleType==="time_based"||mt.includes(this._scheduleType)))return u;let i=Tn(e);return l`
${n("season_window_hint",e)}
@@ -2130,7 +2130,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" max="15" .value=${this._calOffset} @input=${t=>this._calOffset=t.target.value} - >`}_thresholdLimitsOverlap(){let e=parseFloat(this._triggerAbove),t=parseFloat(this._triggerBelow);return!isNaN(e)&&!isNaN(t)&&t>e}_renderTriggerLiveHint(){if(this._triggerType==="compound")return u;let e=this._triggerType==="threshold"&&this._thresholdLimitsOverlap()?l`
${n("trigger_hint_overlap",this._lang)}
`:u,t=this._triggerEntityId||this._triggerEntityIds[0];if(!t||!this.hass?.states)return e;let i=this.hass.states[t];if(!i)return e;let a=this._lang,o=i.attributes?.unit_of_measurement,h=typeof o=="string"&&o?` ${o}`:"",c=this._triggerAttribute?i.attributes?.[this._triggerAttribute]:i.state,p=typeof c=="number"?c:parseFloat(String(c)),g=c!=="unknown"&&c!=="unavailable"&&c!=null&&!isNaN(p),f=y=>L(y,a,{maximumFractionDigits:1}),w=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),$=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN($))return u;g&&w.push(n("trigger_hint_now",a).replace("{value}",f(p)+h)),isNaN(y)||w.push(n("trigger_hint_above",a).replace("{target}",f(y)+h)),isNaN($)||w.push(n("trigger_hint_below",a).replace("{target}",f($)+h))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return u;this._triggerDeltaMode?this._taskId?w.push(n("trigger_hint_counter_delta_edit",a).replace("{target}",f(y)+h)):g?w.push(n("trigger_hint_counter_delta",a).replace("{value}",f(p)+h).replace("{due}",f(p+y)+h).replace("{target}",f(y)+h)):w.push(n("trigger_hint_counter_delta_edit",a).replace("{target}",f(y)+h)):(g&&w.push(n("trigger_hint_now",a).replace("{value}",f(p)+h)),w.push(n("trigger_hint_counter_abs",a).replace("{target}",f(y)+h)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return u;w.push(n("trigger_hint_runtime",a).replace("{hours}",f(y))),w.push(n("trigger_hint_state_now",a).replace("{value}",String(i.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,$=this._triggerToState.trim();w.push(($?n("trigger_hint_state_change_to",a).replace("{state}",$):n("trigger_hint_state_change",a)).replace("{count}",String(y))),w.push(n("trigger_hint_state_now",a).replace("{value}",String(i.state)))}return w.length?l`
${w.join(" ")}
${e}`:e}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?l` + >`}_thresholdLimitsOverlap(){let e=parseFloat(this._triggerAbove),t=parseFloat(this._triggerBelow);return!isNaN(e)&&!isNaN(t)&&t>e}_renderTriggerLiveHint(){if(this._triggerType==="compound")return u;let e=this._triggerType==="threshold"&&this._thresholdLimitsOverlap()?l`
${n("trigger_hint_overlap",this._lang)}
`:u,t=this._triggerEntityId||this._triggerEntityIds[0];if(!t||!this.hass?.states)return e;let i=this.hass.states[t];if(!i)return e;let a=this._lang,o=i.attributes?.unit_of_measurement,_=typeof o=="string"&&o?` ${o}`:"",c=this._triggerAttribute?i.attributes?.[this._triggerAttribute]:i.state,p=typeof c=="number"?c:parseFloat(String(c)),m=c!=="unknown"&&c!=="unavailable"&&c!=null&&!isNaN(p),f=y=>L(y,a,{maximumFractionDigits:1}),w=[];if(this._triggerType==="threshold"){let y=parseFloat(this._triggerAbove),$=parseFloat(this._triggerBelow);if(isNaN(y)&&isNaN($))return u;m&&w.push(n("trigger_hint_now",a).replace("{value}",f(p)+_)),isNaN(y)||w.push(n("trigger_hint_above",a).replace("{target}",f(y)+_)),isNaN($)||w.push(n("trigger_hint_below",a).replace("{target}",f($)+_))}else if(this._triggerType==="counter"){let y=parseFloat(this._triggerTargetValue);if(isNaN(y))return u;this._triggerDeltaMode?this._taskId?w.push(n("trigger_hint_counter_delta_edit",a).replace("{target}",f(y)+_)):m?w.push(n("trigger_hint_counter_delta",a).replace("{value}",f(p)+_).replace("{due}",f(p+y)+_).replace("{target}",f(y)+_)):w.push(n("trigger_hint_counter_delta_edit",a).replace("{target}",f(y)+_)):(m&&w.push(n("trigger_hint_now",a).replace("{value}",f(p)+_)),w.push(n("trigger_hint_counter_abs",a).replace("{target}",f(y)+_)))}else if(this._triggerType==="runtime"){let y=parseFloat(this._triggerRuntimeHours);if(isNaN(y))return u;w.push(n("trigger_hint_runtime",a).replace("{hours}",f(y))),w.push(n("trigger_hint_state_now",a).replace("{value}",String(i.state)))}else if(this._triggerType==="state_change"){let y=parseInt(this._triggerTargetChanges,10)||1,$=this._triggerToState.trim();w.push(($?n("trigger_hint_state_change_to",a).replace("{state}",$):n("trigger_hint_state_change",a)).replace("{count}",String(y))),w.push(n("trigger_hint_state_now",a).replace("{value}",String(i.state)))}return w.length?l`
${w.join(" ")}
${e}`:e}_renderTriggerTypeFields(){let e=this._lang;return this._triggerType==="threshold"?l` ${n("parts_load_failed",e)}
`:u} - ${this.parts.length||this._foreignOwners.length?l` + ${this._isFleetTask?l`
${n("task_parts_fleet_hint",e)}
`:this.parts.length||this._foreignOwners.length?l`
${this.parts.map(i=>this._renderConsumesRow(i))} @@ -2591,7 +2591,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"
- `}};m._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),m.styles=E` + `}};g._PREVIEW_RELEVANT=new Set(["_open","_scheduleType","_intervalDays","_intervalUnit","_intervalAnchor","_dueDate","_weekdays","_nth","_nthWeekday","_domDay","_domLastDay","_domBusiness","_calOffset","_seasonMonths","_endsMode","_endsCount","_endsUntil","_lastPerformed"]),g.styles=E` .dialog-title { font-size: 18px; font-weight: 500; @@ -2988,20 +2988,21 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" font-size: 14px; cursor: pointer; } - `,d([v({attribute:!1})],m.prototype,"hass",2),d([v({type:Boolean,attribute:"checklists-enabled"})],m.prototype,"checklistsEnabled",2),d([v({type:Boolean,attribute:"schedule-time-enabled"})],m.prototype,"scheduleTimeEnabled",2),d([v({type:Boolean,attribute:"completion-actions-enabled"})],m.prototype,"completionActionsEnabled",2),d([v({type:Number,attribute:"default-warning-days"})],m.prototype,"defaultWarningDays",2),d([_()],m.prototype,"parts",2),d([_()],m.prototype,"_foreignOwners",2),d([_()],m.prototype,"_open",2),d([_()],m.prototype,"_entityPickerFallback",2),d([_()],m.prototype,"_loading",2),d([_()],m.prototype,"_error",2),d([_()],m.prototype,"_warning",2),d([_()],m.prototype,"_entryId",2),d([_()],m.prototype,"_taskId",2),d([_()],m.prototype,"_objectChoices",2),d([_()],m.prototype,"_name",2),d([_()],m.prototype,"_type",2),d([_()],m.prototype,"_scheduleType",2),d([_()],m.prototype,"_intervalDays",2),d([_()],m.prototype,"_intervalUnit",2),d([_()],m.prototype,"_dueDate",2),d([_()],m.prototype,"_warningDays",2),d([_()],m.prototype,"_earliestCompletionDays",2),d([_()],m.prototype,"_intervalAnchor",2),d([_()],m.prototype,"_weekdays",2),d([_()],m.prototype,"_nth",2),d([_()],m.prototype,"_nthWeekday",2),d([_()],m.prototype,"_domDay",2),d([_()],m.prototype,"_domLastDay",2),d([_()],m.prototype,"_domBusiness",2),d([_()],m.prototype,"_calOffset",2),d([_()],m.prototype,"_seasonMonths",2),d([_()],m.prototype,"_endsMode",2),d([_()],m.prototype,"_endsCount",2),d([_()],m.prototype,"_endsUntil",2),d([_()],m.prototype,"_schedulePreview",2),d([_()],m.prototype,"_schedulePreviewEnded",2),d([_()],m.prototype,"_notes",2),d([_()],m.prototype,"_documentationUrl",2),d([_()],m.prototype,"_customIcon",2),d([_()],m.prototype,"_priority",2),d([_()],m.prototype,"_labels",2),d([_()],m.prototype,"_mirrorTodoEntities",2),d([_()],m.prototype,"_enabled",2),d([_()],m.prototype,"_triggerEntityId",2),d([_()],m.prototype,"_triggerEntityIds",2),d([_()],m.prototype,"_triggerEntityLogic",2),d([_()],m.prototype,"_triggerAttribute",2),d([_()],m.prototype,"_triggerType",2),d([_()],m.prototype,"_triggerAbove",2),d([_()],m.prototype,"_triggerBelow",2),d([_()],m.prototype,"_triggerEquals",2),d([_()],m.prototype,"_triggerNotEquals",2),d([_()],m.prototype,"_triggerForMinutes",2),d([_()],m.prototype,"_triggerCombinator",2),d([_()],m.prototype,"_triggerTargetValue",2),d([_()],m.prototype,"_triggerDeltaMode",2),d([_()],m.prototype,"_triggerBaselineValue",2),d([_()],m.prototype,"_liveBaselineValue",2),d([_()],m.prototype,"_autoCompleteOnRecovery",2),d([_()],m.prototype,"_triggerFromState",2),d([_()],m.prototype,"_triggerToState",2),d([_()],m.prototype,"_triggerTargetChanges",2),d([_()],m.prototype,"_triggerRuntimeHours",2),d([_()],m.prototype,"_triggerRuntimeMaxSession",2),d([_()],m.prototype,"_triggerOnStates",2),d([_()],m.prototype,"_compoundLogic",2),d([_()],m.prototype,"_compoundConditions",2),d([_()],m.prototype,"_suggestedAttributes",2),d([_()],m.prototype,"_availableAttributes",2),d([_()],m.prototype,"_entityDomain",2),d([_()],m.prototype,"_lastPerformed",2),d([_()],m.prototype,"_nfcTagId",2),d([_()],m.prototype,"_requireTagScan",2),d([_()],m.prototype,"_allowSkip",2),d([_()],m.prototype,"_notifyEnabled",2),d([_()],m.prototype,"_readingUnit",2),d([_()],m.prototype,"_readings",2),d([_()],m.prototype,"_consumesParts",2),d([_()],m.prototype,"_partsLoadFailed",2),d([_()],m.prototype,"_availableTags",2),d([_()],m.prototype,"_responsibleUserId",2),d([_()],m.prototype,"_assigneePool",2),d([_()],m.prototype,"_rotationStrategy",2),d([_()],m.prototype,"_availableUsers",2),d([_()],m.prototype,"_checklistText",2),d([_()],m.prototype,"_phaseDefs",2),d([_()],m.prototype,"_phaseSeq",2),d([_()],m.prototype,"_requiredCompletion",2),d([_()],m.prototype,"_scheduleTime",2),d([_()],m.prototype,"_scheduleTimeOn",2),d([_()],m.prototype,"_actionService",2),d([_()],m.prototype,"_actionTargetEntity",2),d([_()],m.prototype,"_actionData",2),d([_()],m.prototype,"_actionDataJsonFallback",2),d([_()],m.prototype,"_actionTesting",2),d([_()],m.prototype,"_actionTestResult",2),d([_()],m.prototype,"_actionTestError",2),d([_()],m.prototype,"_qcNotes",2),d([_()],m.prototype,"_qcCost",2),d([_()],m.prototype,"_qcDuration",2),d([_()],m.prototype,"_qcFeedback",2),d([_()],m.prototype,"_environmentalEntity",2),d([_()],m.prototype,"_environmentalAttribute",2),d([_()],m.prototype,"_adaptiveEnabled",2),d([_()],m.prototype,"_adaptiveAlpha",2),d([_()],m.prototype,"_adaptiveMin",2),d([_()],m.prototype,"_adaptiveMax",2),d([_()],m.prototype,"_adaptiveSeasonal",2),d([_()],m.prototype,"_adaptivePrediction",2),d([_()],m.prototype,"_conditionAttrOptions",2);Wt=m;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",Wt)});async function An(s,r,e,t){let i=new FormData;i.append("entry_id",r);for(let h of t)i.append("tags",h);i.append("file",e,e.name);let a=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${s.auth?.data?.access_token??""}`},body:i});if(a.status===413)throw new Error("doc_too_large");if(!a.ok)throw new Error("doc_upload_failed");let o=await a.json();if(!o.id)throw new Error("doc_upload_failed");return{id:o.id,deduped:!!o.deduped,duplicate_in_object:o.duplicate_in_object??null}}async function Hr(s,r,e){return(await An(s,r,e,["photo"])).id}async function Kt(s,r){await Promise.all(r.map(e=>s.connection.sendMessagePromise({type:"maintenance_supporter/documents/delete",doc_id:e}).catch(()=>{})))}var jr=x(()=>{"use strict";ut()});var Pe,Yt=x(()=>{"use strict";C();jr();Pe=class{constructor(r,e){this.host=r;this.opts=e;this.photos=[];this.uploadedIds=[];this.uploading=!1;this.errorKey="";this.max=e.max??10,r.addController(this)}hostConnected(){}get ids(){return this.photos.map(r=>r.id)}get remaining(){return Math.max(this.max-this.photos.length,0)}get full(){return this.remaining===0}errorText(r){return this.errorKey?n(this.errorKey,r).replace("{max}",String(this.max)):""}clearError(){this.errorKey=""}reset(r=[]){this._revokeAll(),this.photos=r.map(e=>({id:e,preview:""})),this.uploadedIds=[],this.uploading=!1,this.errorKey="",this.host.requestUpdate()}async addFiles(r){if(r.length===0)return;let e=r.slice(0,this.remaining);this.uploading=!0,this.errorKey="",this.host.requestUpdate();try{for(let t of e){let i=await Hr(this.opts.hass(),this.opts.entryId(),t);this.uploadedIds=[...this.uploadedIds,i],this.photos=[...this.photos,{id:i,preview:URL.createObjectURL(t)}],this.host.requestUpdate()}r.length>e.length&&(this.errorKey="photos_limit")}catch(t){this.errorKey=t instanceof Error&&t.message==="doc_too_large"?"doc_too_large":"doc_upload_failed"}finally{this.uploading=!1,this.host.requestUpdate()}}remove(r){let e=this.photos.find(t=>t.id===r);e?.preview&&URL.revokeObjectURL(e.preview),this.photos=this.photos.filter(t=>t.id!==r),this.uploadedIds.includes(r)&&(this.uploadedIds=this.uploadedIds.filter(t=>t!==r),Kt(this.opts.hass(),[r])),this.host.requestUpdate()}discardOrphans(){if(this.uploadedIds.length===0)return;let r=this.uploadedIds;this.uploadedIds=[],Kt(this.opts.hass(),r)}markAttached(){this.uploadedIds=[]}_revokeAll(){for(let r of this.photos)r.preview&&URL.revokeObjectURL(r.preview)}}});function mt(){if(window.externalApp!==void 0)return!0;let r=typeof navigator<"u"&&navigator.userAgent||"";return/Home Assistant\//.test(r)&&/Android/.test(r)}var Gt=x(()=>{"use strict"});function Dr(s){try{return localStorage.getItem(s)}catch{return null}}function Or(s,r){try{localStorage.setItem(s,r)}catch{}}var Qt,Mr=x(()=>{"use strict";Qt={objectSections:"msp-object-sections",printOptions:"msp-print-options",batteryRosterOpen:"msp-bf-roster-open",docSort:"msp-doc-sort",cameraDevice:"msp-camera-device",overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view",objectsCache:"msp-objects-cache",gettingStartedDismissed:"msp-gs-dismissed",batteryRosterSort:"ms_bf_roster_sort"}});function zr(){if(!mt())return!1;let s=typeof navigator<"u"?navigator.mediaDevices:void 0;return!!s&&typeof s.getUserMedia=="function"}var Cn,In,pe,Jt=x(()=>{"use strict";I();F();C();Gt();Mr();Cn=1920,In=.88,pe=class extends S{constructor(){super(...arguments);this.lang="en";this._open=!1;this._busy=!1;this._devices=[];this._stream=null}async open(){if(this._open)return;let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||typeof e.getUserMedia!="function"){this._unavailable("no_media_devices");return}let t=Dr(Qt.cameraDevice),i=!1;if(t)try{this._stream=await e.getUserMedia({video:{deviceId:{exact:t}},audio:!1}),i=!0}catch{}if(!i){try{this._stream=await e.getUserMedia({video:{facingMode:{ideal:"environment"},advanced:[{zoom:1}]},audio:!1})}catch(o){this._unavailable(o instanceof Error?o.name||o.message:String(o));return}await this._preferMainBackCamera(e)}await this._applyZoomOne(),await this._listDevices(e),this._open=!0,await this.updateComplete;let a=this._video;if(a&&this._stream){a.srcObject=this._stream;try{await a.play()}catch{}}}async _preferMainBackCamera(e){if(typeof e.enumerateDevices!="function")return;let t=[];try{t=await e.enumerateDevices()}catch{return}let i=c=>{let p=/camera2?\s*(\d+)/i.exec(c.label);return p?Number(p[1]):Number.MAX_SAFE_INTEGER},a=t.filter(c=>c.kind==="videoinput"&&c.deviceId&&/back|rear|environment|rück|hinten/i.test(c.label)).sort((c,p)=>i(c)-i(p)),h=this._stream?.getVideoTracks()[0]?.getSettings().deviceId;if(a.length>1&&a[0].deviceId!==h)try{let c=await e.getUserMedia({video:{deviceId:{exact:a[0].deviceId}},audio:!1});for(let p of this._stream?.getTracks()??[])p.stop();this._stream=c}catch{}}async _applyZoomOne(){let e=this._stream?.getVideoTracks()[0],t=e&&typeof e.getCapabilities=="function"?e.getCapabilities():void 0;if(t?.zoom&&typeof t.zoom.min=="number"&&t.zoom.min<1&&(t.zoom.max??1)>=1)try{await e.applyConstraints({advanced:[{zoom:1}]})}catch{}}async _listDevices(e){if(typeof e.enumerateDevices=="function")try{this._devices=(await e.enumerateDevices()).filter(t=>t.kind==="videoinput"&&!!t.deviceId)}catch{this._devices=[]}}get _currentDeviceId(){return this._stream?.getVideoTracks()[0]?.getSettings().deviceId}async _switchCamera(){let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||this._devices.length<2||this._busy)return;let t=this._devices.map(o=>o.deviceId),i=t.indexOf(this._currentDeviceId??""),a=t[(i+1)%t.length];this._busy=!0;try{let o=await e.getUserMedia({video:{deviceId:{exact:a}},audio:!1});for(let c of this._stream?.getTracks()??[])c.stop();this._stream=o,await this._applyZoomOne(),Or(Qt.cameraDevice,a);let h=this._video;if(h){h.srcObject=o;try{await h.play()}catch{}}}catch{}finally{this._busy=!1}}close(){this._stopStream(),this._open=!1,this._busy=!1}disconnectedCallback(){super.disconnectedCallback(),this._stopStream()}get _video(){return this.shadowRoot?.querySelector("video")??null}_stopStream(){for(let t of this._stream?.getTracks()??[])t.stop();this._stream=null;let e=this._video;e&&(e.srcObject=null)}_unavailable(e){this._stopStream(),this._open=!1,this.dispatchEvent(new CustomEvent("capture-unavailable",{detail:{reason:e},bubbles:!0,composed:!0}))}async _shoot(){let e=this._video;if(!(!e||this._busy)){this._busy=!0;try{let t=e.videoWidth||640,i=e.videoHeight||480,a=Math.min(1,Cn/Math.max(t,i)),o=document.createElement("canvas");o.width=Math.round(t*a),o.height=Math.round(i*a);let h=o.getContext("2d");if(!h)throw new Error("no_canvas");h.drawImage(e,0,0,o.width,o.height);let c=await new Promise(f=>o.toBlob(f,"image/jpeg",In));if(!c)throw new Error("no_blob");let p=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),g=new File([c],`photo-${p}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:g},bubbles:!0,composed:!0}))}catch(t){this._unavailable(t instanceof Error?t.message:String(t))}finally{this._busy=!1}}}render(){if(!this._open)return u;let e=this.lang;return l` + `,d([v({attribute:!1})],g.prototype,"hass",2),d([v({type:Boolean,attribute:"checklists-enabled"})],g.prototype,"checklistsEnabled",2),d([v({type:Boolean,attribute:"schedule-time-enabled"})],g.prototype,"scheduleTimeEnabled",2),d([v({type:Boolean,attribute:"completion-actions-enabled"})],g.prototype,"completionActionsEnabled",2),d([v({type:Number,attribute:"default-warning-days"})],g.prototype,"defaultWarningDays",2),d([h()],g.prototype,"parts",2),d([h()],g.prototype,"_foreignOwners",2),d([h()],g.prototype,"_open",2),d([h()],g.prototype,"_entityPickerFallback",2),d([h()],g.prototype,"_loading",2),d([h()],g.prototype,"_error",2),d([h()],g.prototype,"_warning",2),d([h()],g.prototype,"_entryId",2),d([h()],g.prototype,"_taskId",2),d([h()],g.prototype,"_isFleetTask",2),d([h()],g.prototype,"_objectChoices",2),d([h()],g.prototype,"_name",2),d([h()],g.prototype,"_type",2),d([h()],g.prototype,"_scheduleType",2),d([h()],g.prototype,"_intervalDays",2),d([h()],g.prototype,"_intervalUnit",2),d([h()],g.prototype,"_dueDate",2),d([h()],g.prototype,"_warningDays",2),d([h()],g.prototype,"_earliestCompletionDays",2),d([h()],g.prototype,"_intervalAnchor",2),d([h()],g.prototype,"_weekdays",2),d([h()],g.prototype,"_nth",2),d([h()],g.prototype,"_nthWeekday",2),d([h()],g.prototype,"_domDay",2),d([h()],g.prototype,"_domLastDay",2),d([h()],g.prototype,"_domBusiness",2),d([h()],g.prototype,"_calOffset",2),d([h()],g.prototype,"_seasonMonths",2),d([h()],g.prototype,"_endsMode",2),d([h()],g.prototype,"_endsCount",2),d([h()],g.prototype,"_endsUntil",2),d([h()],g.prototype,"_schedulePreview",2),d([h()],g.prototype,"_schedulePreviewEnded",2),d([h()],g.prototype,"_notes",2),d([h()],g.prototype,"_documentationUrl",2),d([h()],g.prototype,"_customIcon",2),d([h()],g.prototype,"_priority",2),d([h()],g.prototype,"_labels",2),d([h()],g.prototype,"_mirrorTodoEntities",2),d([h()],g.prototype,"_enabled",2),d([h()],g.prototype,"_triggerEntityId",2),d([h()],g.prototype,"_triggerEntityIds",2),d([h()],g.prototype,"_triggerEntityLogic",2),d([h()],g.prototype,"_triggerAttribute",2),d([h()],g.prototype,"_triggerType",2),d([h()],g.prototype,"_triggerAbove",2),d([h()],g.prototype,"_triggerBelow",2),d([h()],g.prototype,"_triggerEquals",2),d([h()],g.prototype,"_triggerNotEquals",2),d([h()],g.prototype,"_triggerForMinutes",2),d([h()],g.prototype,"_triggerCombinator",2),d([h()],g.prototype,"_triggerTargetValue",2),d([h()],g.prototype,"_triggerDeltaMode",2),d([h()],g.prototype,"_triggerBaselineValue",2),d([h()],g.prototype,"_liveBaselineValue",2),d([h()],g.prototype,"_autoCompleteOnRecovery",2),d([h()],g.prototype,"_triggerFromState",2),d([h()],g.prototype,"_triggerToState",2),d([h()],g.prototype,"_triggerTargetChanges",2),d([h()],g.prototype,"_triggerRuntimeHours",2),d([h()],g.prototype,"_triggerRuntimeMaxSession",2),d([h()],g.prototype,"_triggerOnStates",2),d([h()],g.prototype,"_compoundLogic",2),d([h()],g.prototype,"_compoundConditions",2),d([h()],g.prototype,"_suggestedAttributes",2),d([h()],g.prototype,"_availableAttributes",2),d([h()],g.prototype,"_entityDomain",2),d([h()],g.prototype,"_lastPerformed",2),d([h()],g.prototype,"_nfcTagId",2),d([h()],g.prototype,"_requireTagScan",2),d([h()],g.prototype,"_allowSkip",2),d([h()],g.prototype,"_notifyEnabled",2),d([h()],g.prototype,"_readingUnit",2),d([h()],g.prototype,"_readings",2),d([h()],g.prototype,"_consumesParts",2),d([h()],g.prototype,"_partsLoadFailed",2),d([h()],g.prototype,"_availableTags",2),d([h()],g.prototype,"_responsibleUserId",2),d([h()],g.prototype,"_assigneePool",2),d([h()],g.prototype,"_rotationStrategy",2),d([h()],g.prototype,"_availableUsers",2),d([h()],g.prototype,"_checklistText",2),d([h()],g.prototype,"_phaseDefs",2),d([h()],g.prototype,"_phaseSeq",2),d([h()],g.prototype,"_requiredCompletion",2),d([h()],g.prototype,"_scheduleTime",2),d([h()],g.prototype,"_scheduleTimeOn",2),d([h()],g.prototype,"_actionService",2),d([h()],g.prototype,"_actionTargetEntity",2),d([h()],g.prototype,"_actionData",2),d([h()],g.prototype,"_actionDataJsonFallback",2),d([h()],g.prototype,"_actionTesting",2),d([h()],g.prototype,"_actionTestResult",2),d([h()],g.prototype,"_actionTestError",2),d([h()],g.prototype,"_qcNotes",2),d([h()],g.prototype,"_qcCost",2),d([h()],g.prototype,"_qcDuration",2),d([h()],g.prototype,"_qcFeedback",2),d([h()],g.prototype,"_environmentalEntity",2),d([h()],g.prototype,"_environmentalAttribute",2),d([h()],g.prototype,"_adaptiveEnabled",2),d([h()],g.prototype,"_adaptiveAlpha",2),d([h()],g.prototype,"_adaptiveMin",2),d([h()],g.prototype,"_adaptiveMax",2),d([h()],g.prototype,"_adaptiveSeasonal",2),d([h()],g.prototype,"_adaptivePrediction",2),d([h()],g.prototype,"_conditionAttrOptions",2);Wt=g;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",Wt)});async function An(s,r,e,t){let i=new FormData;i.append("entry_id",r);for(let _ of t)i.append("tags",_);i.append("file",e,e.name);let a=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${s.auth?.data?.access_token??""}`},body:i});if(a.status===413)throw new Error("doc_too_large");if(!a.ok)throw new Error("doc_upload_failed");let o=await a.json();if(!o.id)throw new Error("doc_upload_failed");return{id:o.id,deduped:!!o.deduped,duplicate_in_object:o.duplicate_in_object??null}}async function Hr(s,r,e){return(await An(s,r,e,["photo"])).id}async function Kt(s,r){await Promise.all(r.map(e=>s.connection.sendMessagePromise({type:"maintenance_supporter/documents/delete",doc_id:e}).catch(()=>{})))}var jr=x(()=>{"use strict";ut()});var Pe,Yt=x(()=>{"use strict";C();jr();Pe=class{constructor(r,e){this.host=r;this.opts=e;this.photos=[];this.uploadedIds=[];this.uploading=!1;this.errorKey="";this.max=e.max??10,r.addController(this)}hostConnected(){}get ids(){return this.photos.map(r=>r.id)}get remaining(){return Math.max(this.max-this.photos.length,0)}get full(){return this.remaining===0}errorText(r){return this.errorKey?n(this.errorKey,r).replace("{max}",String(this.max)):""}clearError(){this.errorKey=""}reset(r=[]){this._revokeAll(),this.photos=r.map(e=>({id:e,preview:""})),this.uploadedIds=[],this.uploading=!1,this.errorKey="",this.host.requestUpdate()}async addFiles(r){if(r.length===0)return;let e=r.slice(0,this.remaining);this.uploading=!0,this.errorKey="",this.host.requestUpdate();try{for(let t of e){let i=await Hr(this.opts.hass(),this.opts.entryId(),t);this.uploadedIds=[...this.uploadedIds,i],this.photos=[...this.photos,{id:i,preview:URL.createObjectURL(t)}],this.host.requestUpdate()}r.length>e.length&&(this.errorKey="photos_limit")}catch(t){this.errorKey=t instanceof Error&&t.message==="doc_too_large"?"doc_too_large":"doc_upload_failed"}finally{this.uploading=!1,this.host.requestUpdate()}}remove(r){let e=this.photos.find(t=>t.id===r);e?.preview&&URL.revokeObjectURL(e.preview),this.photos=this.photos.filter(t=>t.id!==r),this.uploadedIds.includes(r)&&(this.uploadedIds=this.uploadedIds.filter(t=>t!==r),Kt(this.opts.hass(),[r])),this.host.requestUpdate()}discardOrphans(){if(this.uploadedIds.length===0)return;let r=this.uploadedIds;this.uploadedIds=[],Kt(this.opts.hass(),r)}markAttached(){this.uploadedIds=[]}_revokeAll(){for(let r of this.photos)r.preview&&URL.revokeObjectURL(r.preview)}}});function gt(){if(window.externalApp!==void 0)return!0;let r=typeof navigator<"u"&&navigator.userAgent||"";return/Home Assistant\//.test(r)&&/Android/.test(r)}var Gt=x(()=>{"use strict"});function Dr(s){try{return localStorage.getItem(s)}catch{return null}}function Or(s,r){try{localStorage.setItem(s,r)}catch{}}var Qt,Mr=x(()=>{"use strict";Qt={objectSections:"msp-object-sections",printOptions:"msp-print-options",batteryRosterOpen:"msp-bf-roster-open",docSort:"msp-doc-sort",cameraDevice:"msp-camera-device",overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view",objectsCache:"msp-objects-cache",gettingStartedDismissed:"msp-gs-dismissed",batteryRosterSort:"ms_bf_roster_sort"}});function zr(){if(!gt())return!1;let s=typeof navigator<"u"?navigator.mediaDevices:void 0;return!!s&&typeof s.getUserMedia=="function"}var Cn,In,re,Jt=x(()=>{"use strict";I();F();C();Gt();Mr();Cn=1920,In=.88,re=class extends S{constructor(){super(...arguments);this.lang="en";this._open=!1;this._busy=!1;this._devices=[];this._deviceIndex=-1;this._stream=null}async open(){if(this._open)return;let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||typeof e.getUserMedia!="function"){this._unavailable("no_media_devices");return}let t=Dr(Qt.cameraDevice),i=!1;if(t)try{this._stream=await e.getUserMedia({video:{deviceId:{exact:t}},audio:!1}),i=!0}catch{}if(!i){try{this._stream=await e.getUserMedia({video:{facingMode:{ideal:"environment"},zoom:1,advanced:[{zoom:1}]},audio:!1})}catch(o){this._unavailable(o instanceof Error?o.name||o.message:String(o));return}await this._preferMainBackCamera(e)}await this._applyZoomOne(),await this._listDevices(e),this._deviceIndex=this._indexOfCurrent(t&&i?t:null),this._open=!0,await this.updateComplete;let a=this._video;if(a&&this._stream){a.srcObject=this._stream;try{await a.play()}catch{}}}async _preferMainBackCamera(e){if(typeof e.enumerateDevices!="function")return;let t=[];try{t=await e.enumerateDevices()}catch{return}let i=c=>{let p=/camera2?\s*(\d+)/i.exec(c.label);return p?Number(p[1]):Number.MAX_SAFE_INTEGER},a=t.filter(c=>c.kind==="videoinput"&&c.deviceId&&/back|rear|environment|rück|hinten/i.test(c.label)).sort((c,p)=>i(c)-i(p)),_=this._stream?.getVideoTracks()[0]?.getSettings().deviceId;if(a.length>1&&a[0].deviceId!==_)try{let c=await e.getUserMedia({video:{deviceId:{exact:a[0].deviceId}},audio:!1});for(let p of this._stream?.getTracks()??[])p.stop();this._stream=c}catch{}}async _applyZoomOne(){let e=this._stream?.getVideoTracks()[0],t=e&&typeof e.getCapabilities=="function"?e.getCapabilities():void 0;if(!(!t?.zoom||typeof t.zoom.min!="number"||t.zoom.min>=1||(t.zoom.max??1)<1))for(let i of[{zoom:1},{advanced:[{zoom:1}]}])try{await e.applyConstraints(i);return}catch{}}_indexOfCurrent(e){let t=this._devices.map(a=>a.deviceId),i=this._currentDeviceId;for(let a of[e,i])if(a){let o=t.indexOf(a);if(o>=0)return o}return-1}async _listDevices(e){if(typeof e.enumerateDevices=="function")try{this._devices=(await e.enumerateDevices()).filter(t=>t.kind==="videoinput"&&!!t.deviceId)}catch{this._devices=[]}}get _currentDeviceId(){return this._stream?.getVideoTracks()[0]?.getSettings().deviceId}async _switchCamera(){let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||this._devices.length<2||this._busy)return;let t=this._devices.map(i=>i.deviceId);this._busy=!0;try{for(let i=1;io.toBlob(f,"image/jpeg",In));if(!c)throw new Error("no_blob");let p=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),m=new File([c],`photo-${p}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:m},bubbles:!0,composed:!0}))}catch(t){this._unavailable(t instanceof Error?t.message:String(t))}finally{this._busy=!1}}}render(){if(!this._open)return u;let e=this.lang;return l` - `}};pe.styles=E` + `}};re.styles=E` :host { display: contents; } .overlay { position: fixed; inset: 0; z-index: 10000; @@ -3021,10 +3022,11 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" .cancel { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.6); } .switch { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.6); padding: 10px 12px; } .switch ha-icon { --mdc-icon-size: 22px; } + .switch-pos { font-size: 12px; opacity: 0.85; } .shoot { background: var(--primary-color, #03a9f4); color: #fff; border: none; font-weight: 600; } .shoot[disabled] { opacity: 0.6; cursor: default; } .shoot ha-icon { --mdc-icon-size: 22px; } - `,d([v({type:String})],pe.prototype,"lang",2),d([_()],pe.prototype,"_open",2),d([_()],pe.prototype,"_busy",2),d([_()],pe.prototype,"_devices",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",pe)});var ft,K,Ze=x(()=>{"use strict";I();F();C();Gt();Jt();Jt();ft=E` + `,d([v({type:String})],re.prototype,"lang",2),d([h()],re.prototype,"_open",2),d([h()],re.prototype,"_busy",2),d([h()],re.prototype,"_devices",2),d([h()],re.prototype,"_deviceIndex",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",re)});var ft,K,Ze=x(()=>{"use strict";I();F();C();Gt();Jt();Jt();ft=E` ms-photo-picker { display: contents; } .photo-pickers { display: flex; @@ -3053,7 +3055,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" color: var(--secondary-text-color); margin-top: 4px; } -`,K=class extends S{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=mt();this._inAppCamera=zr()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let t=e.target,i=Array.from(t.files??[]);t.value="",this._emit(i)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return u;let e=this.lang,t=this._locked?"disabled":"",i=this.busy?n("uploading",e):n("doc_camera",e),a=n(this._singlePick?"choose_photo":"choose_photos",e);return l` +`,K=class extends S{constructor(){super(...arguments);this.lang="en";this.disabled=!1;this.busy=!1;this.accept="image/*";this.showCamera=!0;this.showGallery=!0;this.compact=!1;this.remaining=1/0;this._singlePick=gt();this._inAppCamera=zr()}createRenderRoot(){return this}get _locked(){return this.disabled||this.busy}_emit(e){e.length!==0&&this.dispatchEvent(new CustomEvent("files-picked",{detail:{files:e},bubbles:!0,composed:!0}))}_onInput(e){let t=e.target,i=Array.from(t.files??[]);t.value="",this._emit(i)}_onCameraClick(e){!this._inAppCamera||this._locked||(e.preventDefault(),this.querySelector("ms-camera-capture")?.open())}_onCameraUnavailable(){this._inAppCamera=!1,this.querySelector(".photo-pick-camera input")?.click()}_onKeydown(e){e.key!=="Enter"&&e.key!==" "||(e.preventDefault(),!this._locked&&e.currentTarget.click())}render(){if(this.remaining<=0||!this.showCamera&&!this.showGallery)return u;let e=this.lang,t=this._locked?"disabled":"",i=this.busy?n("uploading",e):n("doc_camera",e),a=n(this._singlePick?"choose_photo":"choose_photos",e);return l`
${this.showCamera?l``}get _missingRequired(){let e={notes:this._notes.trim()!=="",cost:this._cost.trim()!=="",duration:this._duration.trim()!=="",photo:this._photos.photos.length>0,user:!!this.hass?.user};return this.requiredFields.filter(t=>!e[t])}_req(e){return this.requiredFields.includes(e)?l``:u}_partsCostSuggestion(){if(this.restockDefault!==null){let i=parseFloat(this._restockQty);return this.restockUnitCost==null||!Number.isFinite(i)||i<=0?null:Math.round(this.restockUnitCost*i*100)/100}if(!this.parts.length)return null;let e=0,t=!1;for(let i of Object.values(this._usedParts)){let a=this.parts.find(o=>J({part_id:o.id,entry_id:o.entry_id})===J(i));a?.cost!=null&&(e+=a.cost*(i.quantity||1),t=!0)}return t?Math.round(e*100)/100:null}_renderCostSuggestion(e){if(this._cost.trim()!=="")return u;let t=this._partsCostSuggestion();if(t==null||t<=0)return u;let i=le(t,this.currencySymbol,e);return l`
- `}_renderAdaptive(e){let t=this._lang,i=this._features.adaptive&&e.suggested_interval&&e.suggested_interval!==e.interval_days,a=e.degradation_trend!=null&&e.degradation_trend!=="insufficient_data"||e.days_until_threshold!=null||e.environmental_factor!=null&&e.environmental_factor!==1,o=this._features.adaptive&&e.interval_analysis?.weibull_beta!=null&&e.interval_analysis?.weibull_eta!=null,h=this._features.seasonal&&e.seasonal_factor&&e.seasonal_factor!==1;return!i&&!a&&!o&&!h?l`
+ `}_renderAdaptive(e){let t=this._lang,i=this._features.adaptive&&e.suggested_interval&&e.suggested_interval!==e.interval_days,a=e.degradation_trend!=null&&e.degradation_trend!=="insufficient_data"||e.days_until_threshold!=null||e.environmental_factor!=null&&e.environmental_factor!==1,o=this._features.adaptive&&e.interval_analysis?.weibull_beta!=null&&e.interval_analysis?.weibull_eta!=null,_=this._features.seasonal&&e.seasonal_factor&&e.seasonal_factor!==1;return!i&&!a&&!o&&!_?l`
${n("adaptive_no_data",t)}
`:l`
@@ -4123,12 +4125,12 @@ ${c?`
${c}
`:""} ${i?this._renderRecommendation(e):u} ${a?ns(e,t,this._features):u} ${o?rs(e,t):u} - ${h?l` + ${_?l` ${cs(e,t,this._features)} ${e.seasonal_factors?.length===12||e.interval_analysis?.seasonal_factors?.length===12?ps(e,t):u} `:u}
- `}_renderDetails(e){let t=this._lang,i=e.history||[],a=i.filter(c=>c.type==="completed"),o=a.reduce((c,p)=>c+(typeof p.cost=="number"?p.cost:0),0),h=(()=>{let c=a.map(p=>typeof p.duration=="number"?p.duration:null).filter(p=>p!=null);return c.length?Math.round(c.reduce((p,g)=>p+g,0)/c.length):null})();return l` + `}_renderDetails(e){let t=this._lang,i=e.history||[],a=i.filter(c=>c.type==="completed"),o=a.reduce((c,p)=>c+(typeof p.cost=="number"?p.cost:0),0),_=(()=>{let c=a.map(p=>typeof p.duration=="number"?p.duration:null).filter(p=>p!=null);return c.length?Math.round(c.reduce((p,m)=>p+m,0)/c.length):null})();return l`
@@ -4137,11 +4139,11 @@ ${c?`
${c}
`:""}
${n("total_cost",t)} - ${le(o,this._currencySymbol,t)} + ${de(o,this._currencySymbol,t)}
${n("avg_duration",t)} - ${dt(h,t)} + ${dt(_,t)}
@@ -4150,7 +4152,7 @@ ${c?`
${c}
`:""}
${i.length===0?l`
${n("history_empty",t)}
`:l`
- ${[...i].reverse().slice(0,20).map(c=>ts(c,{lang:t,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:p=>this._onEditHistoryEntry(p),readingUnit:e.reading_unit,readingSlotDelta:(p,g)=>hr(i,p,g),taskRef:this._taskRef},{compact:!0}))} + ${[...i].reverse().slice(0,20).map(c=>ts(c,{lang:t,hass:this.hass,currencySymbol:this._currencySymbol,openEdit:p=>this._onEditHistoryEntry(p),readingUnit:e.reading_unit,readingSlotDelta:(p,m)=>hr(i,p,m),taskRef:this._taskRef},{compact:!0}))} ${i.length>20?l`
… +${i.length-20} ${n("older_entries",t)}
`:u}
`} @@ -4165,7 +4167,7 @@ ${c?`
${c}
`:""} ${t.name}
- +
${t.next_due?l`${n("next_due",e)}: ${B(t.next_due,e)}`:u} @@ -4434,7 +4436,7 @@ ${c?`
${c}
`:""} .weibull-section, .seasonal-card-compact { max-width: 100%; } .weibull-chart svg { max-width: 100%; height: auto; } .details-toggle { gap: 12px; flex-wrap: wrap; } - `],d([v({attribute:!1})],R.prototype,"hass",2),d([_()],R.prototype,"_open",2),d([_()],R.prototype,"_entryId",2),d([_()],R.prototype,"_taskId",2),d([_()],R.prototype,"_task",2),d([_()],R.prototype,"_objectName",2),d([_()],R.prototype,"_taskRef",2),d([_()],R.prototype,"_busy",2),d([_()],R.prototype,"_error",2),d([_()],R.prototype,"_showSkip",2),d([_()],R.prototype,"_showReset",2),d([_()],R.prototype,"_showDetails",2),d([_()],R.prototype,"_showAdaptive",2),d([_()],R.prototype,"_skipReason",2),d([_()],R.prototype,"_resetDate",2),d([_()],R.prototype,"_features",2),d([_()],R.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",R)});function _s(s){return!!s&&/^https?:\/\//i.test(s)}var gs=x(()=>{"use strict"});function ms(s){return s?customElements.get("ha-markdown")?l``:l`${s}`:u}var fs=x(()=>{"use strict";I()});var X,vs=x(()=>{"use strict";I();gs();fs();F();C();ce();X=class extends S{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return H(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=N(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(Z(),re)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(Z(),re)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=n("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=N(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=n("confirm_archive_object",this._lang);if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=N(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(Z(),re)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return u;let e=this._lang,t=this._data,i=t?.object,a=t?.tasks||[],o=this.hass?.user?.is_admin??!0;return l` + `],d([v({attribute:!1})],R.prototype,"hass",2),d([h()],R.prototype,"_open",2),d([h()],R.prototype,"_entryId",2),d([h()],R.prototype,"_taskId",2),d([h()],R.prototype,"_task",2),d([h()],R.prototype,"_objectName",2),d([h()],R.prototype,"_taskRef",2),d([h()],R.prototype,"_busy",2),d([h()],R.prototype,"_error",2),d([h()],R.prototype,"_showSkip",2),d([h()],R.prototype,"_showReset",2),d([h()],R.prototype,"_showDetails",2),d([h()],R.prototype,"_showAdaptive",2),d([h()],R.prototype,"_skipReason",2),d([h()],R.prototype,"_resetDate",2),d([h()],R.prototype,"_features",2),d([h()],R.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",R)});function _s(s){return!!s&&/^https?:\/\//i.test(s)}var ms=x(()=>{"use strict"});function gs(s){return s?customElements.get("ha-markdown")?l``:l`${s}`:u}var fs=x(()=>{"use strict";I()});var X,vs=x(()=>{"use strict";I();ms();fs();F();C();pe();X=class extends S{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return H(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=N(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(Z(),se)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(Z(),se)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=n("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=N(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=n("confirm_archive_object",this._lang);if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=N(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(Z(),se)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return u;let e=this._lang,t=this._data,i=t?.object,a=t?.tasks||[],o=this.hass?.user?.is_admin??!0;return l`
${a.length===0?l`
${n("no_tasks",e)}
`:l`
- ${a.map(h=>l` -
this._onTaskClick(h.id)}> - - ${h.name} - ${n(h.status||"ok",e)} + ${a.map(_=>l` +
this._onTaskClick(_.id)}> + + ${_.name} + ${n(_.status||"ok",e)}
`)}
@@ -4466,7 +4468,7 @@ ${c?`
${c}
`:""} ${i.notes?l`
${n("object_notes_label",e)} -
${ms(i.notes)}
+
${gs(i.notes)}
`:u} @@ -4561,7 +4563,7 @@ ${c?`
${c}
`:""} .btn ha-icon { --mdc-icon-size: 16px; } .loading { padding: 24px; text-align: center; color: var(--secondary-text-color); } .error { padding: 8px; border-radius: 6px; background: rgba(211,47,47,0.1); color: var(--error-color); font-size: 13px; } - `,d([v({attribute:!1})],X.prototype,"hass",2),d([_()],X.prototype,"_open",2),d([_()],X.prototype,"_entryId",2),d([_()],X.prototype,"_data",2),d([_()],X.prototype,"_busy",2),d([_()],X.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",X)});function ys(){let s=window;return s.__msSettingsCache??={promise:null}}function vt(s){let r=ys();if(r.promise)return r.promise;let e=s.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(t=>({features:t.features??ni.features,defaultWarningDays:t.general?.default_warning_days??7,rowActionStyle:t.general?.row_action_style??ni.rowActionStyle})).catch(()=>(r.promise===e&&(r.promise=null),ni));return r.promise=e,e}function bs(){ys().promise=null}var ni,xs=x(()=>{"use strict";ni={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact"}});var re={};Ts(re,{__resetSettingsCacheForTests:()=>Zn,getRowActionStyle:()=>Jn,openCompleteDialog:()=>ra,openCreateObjectDialog:()=>Xn,openCreateTaskDialog:()=>ta,openEditObjectDialog:()=>ea,openEditTaskDialog:()=>ia,openHistoryEditDialog:()=>ai,openObjectQuickActions:()=>na,openQrDialog:()=>sa,openTaskQuickActions:()=>oi});function yt(){return document.querySelector("home-assistant")?.hass}function Qn(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function se(s){let r=Qn(),e=r.querySelector(s)??document.body.querySelector(s);return e?e.parentNode!==r&&r.appendChild(e):(e=document.createElement(s),r.appendChild(e)),e}function ne(s){let r=yt();if(!r)return!1;s.hass=r;let e=H(r);return Ge(e)||Qe(e).then(()=>{s.requestUpdate?.()}),jt(r.locale,r.config?.country),!0}function Jn(s){return vt(s).then(r=>r.rowActionStyle)}function Zn(){bs()}function Xn(){let s=se(ws);return ne(s)?(s.openCreate(),!0):!1}function ea(s,r){let e=se(ws);return ne(e)?(e.openEdit(s,r),!0):!1}function ta(s="",r){let e=se($s);if(!ne(e))return!1;let t=yt();return t?((async()=>{let i=await vt(t),a=e;a.checklistsEnabled=i.features.checklists,a.scheduleTimeEnabled=i.features.schedule_time,a.completionActionsEnabled=i.features.completion_actions,a.defaultWarningDays=i.defaultWarningDays,a.openCreate(s,r)})(),!0):!1}function ia(s,r){let e=se($s);if(!ne(e))return!1;let t=yt();return t?((async()=>{try{let[i,a]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:s}),vt(t)]),o=(i.tasks||[]).find(c=>c.id===r);if(!o){console.warn(`openEditTaskDialog: task ${r} not found in entry ${s}`);return}let h=e;h.checklistsEnabled=a.features.checklists,h.scheduleTimeEnabled=a.features.schedule_time,h.completionActionsEnabled=a.features.completion_actions,h.defaultWarningDays=a.defaultWarningDays,await h.openEdit(s,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function ai(s){let r=se(Vn);return ne(r)?(r.openEdit(s),!0):!1}function ra(s){let r=se(Wn);return ne(r)?(Qr(r,s,H(yt())),!0):!1}function sa(s){let r=se(Kn);return ne(r)?(r.openForTask(s.entry_id,s.task_id,s.object_name,s.task_name),!0):!1}function oi(s,r){let e=se(Yn);return ne(e)?(e.openFor(s,r),!0):!1}function na(s){let r=se(Gn);return ne(r)?(r.openFor(s),!0):!1}var ws,$s,Vn,Wn,Kn,Yn,Gn,Z=x(()=>{"use strict";br();Nr();Fr();Wr();Yr();hs();vs();C();ii();xs();ws="maintenance-object-dialog",$s="maintenance-task-dialog",Vn="maintenance-history-edit-dialog",Wn="maintenance-complete-dialog",Kn="maintenance-qr-dialog",Yn="maintenance-task-quick-actions-dialog",Gn="maintenance-object-quick-actions-dialog"});I();F();Nt();I();var Fi=E` + `,d([v({attribute:!1})],X.prototype,"hass",2),d([h()],X.prototype,"_open",2),d([h()],X.prototype,"_entryId",2),d([h()],X.prototype,"_data",2),d([h()],X.prototype,"_busy",2),d([h()],X.prototype,"_error",2);customElements.get("maintenance-object-quick-actions-dialog")||customElements.define("maintenance-object-quick-actions-dialog",X)});function ys(){let s=window;return s.__msSettingsCache??={promise:null}}function vt(s){let r=ys();if(r.promise)return r.promise;let e=s.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).then(t=>({features:t.features??ni.features,defaultWarningDays:t.general?.default_warning_days??7,rowActionStyle:t.general?.row_action_style??ni.rowActionStyle})).catch(()=>(r.promise===e&&(r.promise=null),ni));return r.promise=e,e}function bs(){ys().promise=null}var ni,xs=x(()=>{"use strict";ni={features:{adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1},defaultWarningDays:7,rowActionStyle:"buttons_compact"}});var se={};Ts(se,{__resetSettingsCacheForTests:()=>Zn,getRowActionStyle:()=>Jn,openCompleteDialog:()=>ra,openCreateObjectDialog:()=>Xn,openCreateTaskDialog:()=>ta,openEditObjectDialog:()=>ea,openEditTaskDialog:()=>ia,openHistoryEditDialog:()=>ai,openObjectQuickActions:()=>na,openQrDialog:()=>sa,openTaskQuickActions:()=>oi});function yt(){return document.querySelector("home-assistant")?.hass}function Qn(){return document.querySelector("home-assistant")?.shadowRoot??document.body}function ne(s){let r=Qn(),e=r.querySelector(s)??document.body.querySelector(s);return e?e.parentNode!==r&&r.appendChild(e):(e=document.createElement(s),r.appendChild(e)),e}function ae(s){let r=yt();if(!r)return!1;s.hass=r;let e=H(r);return Ge(e)||Qe(e).then(()=>{s.requestUpdate?.()}),jt(r.locale,r.config?.country),!0}function Jn(s){return vt(s).then(r=>r.rowActionStyle)}function Zn(){bs()}function Xn(){let s=ne(ws);return ae(s)?(s.openCreate(),!0):!1}function ea(s,r){let e=ne(ws);return ae(e)?(e.openEdit(s,r),!0):!1}function ta(s="",r){let e=ne($s);if(!ae(e))return!1;let t=yt();return t?((async()=>{let i=await vt(t),a=e;a.checklistsEnabled=i.features.checklists,a.scheduleTimeEnabled=i.features.schedule_time,a.completionActionsEnabled=i.features.completion_actions,a.defaultWarningDays=i.defaultWarningDays,a.openCreate(s,r)})(),!0):!1}function ia(s,r){let e=ne($s);if(!ae(e))return!1;let t=yt();return t?((async()=>{try{let[i,a]=await Promise.all([t.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:s}),vt(t)]),o=(i.tasks||[]).find(c=>c.id===r);if(!o){console.warn(`openEditTaskDialog: task ${r} not found in entry ${s}`);return}let _=e;_.checklistsEnabled=a.features.checklists,_.scheduleTimeEnabled=a.features.schedule_time,_.completionActionsEnabled=a.features.completion_actions,_.defaultWarningDays=a.defaultWarningDays,await _.openEdit(s,o)}catch(i){console.warn("openEditTaskDialog: failed to load task/features",i)}})(),!0):!1}function ai(s){let r=ne(Vn);return ae(r)?(r.openEdit(s),!0):!1}function ra(s){let r=ne(Wn);return ae(r)?(Qr(r,s,H(yt())),!0):!1}function sa(s){let r=ne(Kn);return ae(r)?(r.openForTask(s.entry_id,s.task_id,s.object_name,s.task_name),!0):!1}function oi(s,r){let e=ne(Yn);return ae(e)?(e.openFor(s,r),!0):!1}function na(s){let r=ne(Gn);return ae(r)?(r.openFor(s),!0):!1}var ws,$s,Vn,Wn,Kn,Yn,Gn,Z=x(()=>{"use strict";br();Nr();Fr();Wr();Yr();hs();vs();C();ii();xs();ws="maintenance-object-dialog",$s="maintenance-task-dialog",Vn="maintenance-history-edit-dialog",Wn="maintenance-complete-dialog",Kn="maintenance-qr-dialog",Yn="maintenance-task-quick-actions-dialog",Gn="maintenance-object-quick-actions-dialog"});I();F();Nt();I();var Fi=E` .cal-controls { display: flex; gap: 12px; @@ -4758,7 +4760,7 @@ ${c?`
${c}
`:""} .cal-pill-day { font-size: 17px; } .cal-user-filter { margin-left: 0; width: 100%; } } -`;C();function lr(s){let r=window;r.customCards=r.customCards||[],r.customCards.some(e=>e.type===s.type)||r.customCards.push(s)}Mt();Z();var W=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._objectFilter="";this._configuredObjects=[];this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){if(this._config={...e},e.past_days&&[30,90].includes(e.past_days)?this._pastDays=e.past_days:e.window_days&&[7,14,30,365].includes(e.window_days)&&(this._windowDays=e.window_days,this._pastDays=0),typeof e.user_filter=="string"&&(this._userFilter=e.user_filter),typeof e.object_filter=="string")this._objectFilter=e.object_filter,this._configuredObjects=[];else if(Array.isArray(e.object_filter)){let t=e.object_filter.filter(i=>typeof i=="string"&&i!=="");this._objectFilter=t.length===1?t[0]:"",this._configuredObjects=t.length>1?t:[]}}getCardSize(){return 6}get _lang(){return H(this.hass)}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){if(super.updated(e),Gi(this,e),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t,lt(this._stats.budget)}catch{}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this._openHistoryEntry(e);return}oi(e.entry_id,e.task_id)||this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}async _openHistoryEntry(e){try{let t=await mr(this.hass,e.entry_id,e.task_id,e.history_timestamp);if(!t||ai(t))return}catch{}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}))}render(){if(!this.hass)return u;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,a=this._config.title,o=null;this._userFilter&&(o=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let h=b=>{let Q=b.toLowerCase();return this._objects.find(q=>q.entry_id===b||q.object.name.toLowerCase()===Q)?.entry_id??null},c=new Set(this._configuredObjects.map(h).filter(b=>b!==null)),p=c.size?this._objects.filter(b=>c.has(b.entry_id)):this._objects,g=this._config.show_object_filter!==!1&&p.length>1,f=this._objectFilter?h(this._objectFilter):null,w=f&&p.some(b=>b.entry_id===f)?p.filter(b=>b.entry_id===f):p,y=new Date;y.setHours(0,0,0,0);let $=this._pastDays>0,A=$?zi(w,y,this._pastDays,o):Mi(w,y,this._windowDays,o),z=ve(y),U=this._windowDays===365||$,D=U?A.filter(b=>b.events.length>0):A,G=b=>{let Q=`cal-status-${b.status}`,we=b.projected?"cal-event-projected":"",q=b.status==="overdue"&&b.days_until_due!=null?` (${ir(b.days_until_due,e)})`:"",O=b.projected&&b.interval_days?l`${b.interval_unit&&b.interval_unit!=="days"?`${b.interval_days} ${n("unit_"+b.interval_unit,e)}`:n("cal_every_n_days",e).replace("{n}",String(b.interval_days))}`:u,he=b.schedule_type==="sensor_based",Ne=he?l`e.type===s.type)||r.customCards.push(s)}Mt();Z();var W=class extends S{constructor(){super(...arguments);this._config={type:"custom:maintenance-supporter-calendar-card"};this._objects=[];this._stats=null;this._windowDays=30;this._pastDays=0;this._userFilter="";this._objectFilter="";this._configuredObjects=[];this._unsub=null;this._dataLoaded=!1;this._lastConnection=null}static getConfigElement(){return document.createElement("maintenance-supporter-calendar-card-editor")}static getStubConfig(){return{type:"custom:maintenance-supporter-calendar-card",window_days:30,show_window_chips:!0,show_user_filter:!0}}setConfig(e){if(this._config={...e},e.past_days&&[30,90].includes(e.past_days)?this._pastDays=e.past_days:e.window_days&&[7,14,30,365].includes(e.window_days)&&(this._windowDays=e.window_days,this._pastDays=0),typeof e.user_filter=="string"&&(this._userFilter=e.user_filter),typeof e.object_filter=="string")this._objectFilter=e.object_filter,this._configuredObjects=[];else if(Array.isArray(e.object_filter)){let t=e.object_filter.filter(i=>typeof i=="string"&&i!=="");this._objectFilter=t.length===1?t[0]:"",this._configuredObjects=t.length>1?t:[]}}getCardSize(){return 6}get _lang(){return H(this.hass)}disconnectedCallback(){if(super.disconnectedCallback(),this._unsub){try{this._unsub()}catch{}this._unsub=null}this._dataLoaded=!1,this._lastConnection=null}updated(e){if(super.updated(e),Gi(this,e),e.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}}}async _loadData(){try{let[e,t]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects"}),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"})]);this._objects=e.objects,this._stats=t,lt(this._stats.budget)}catch{}}async _subscribe(){try{let e=await this.hass.connection.subscribeMessage(t=>{let i=t;this._objects=i.objects},{type:"maintenance_supporter/subscribe"});if(!this.isConnected){e();return}this._unsub=e}catch{}}_onEventClick(e){if(e.history_timestamp){this._openHistoryEntry(e);return}oi(e.entry_id,e.task_id)||this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:open-task",entry_id:e.entry_id,task_id:e.task_id},bubbles:!0,composed:!0}))}async _openHistoryEntry(e){try{let t=await gr(this.hass,e.entry_id,e.task_id,e.history_timestamp);if(!t||ai(t))return}catch{}this.dispatchEvent(new CustomEvent("ll-custom",{detail:{type:"maintenance-supporter:edit-history",entry_id:e.entry_id,task_id:e.task_id,original_timestamp:e.history_timestamp},bubbles:!0,composed:!0}))}render(){if(!this.hass)return u;let e=this._lang,t=this._config.show_window_chips!==!1,i=this._config.show_user_filter!==!1,a=this._config.title,o=null;this._userFilter&&(o=this._userFilter==="current_user"?this.hass?.user?.id??null:this._userFilter);let _=b=>{let Q=b.toLowerCase();return this._objects.find(q=>q.entry_id===b||q.object.name.toLowerCase()===Q)?.entry_id??null},c=new Set(this._configuredObjects.map(_).filter(b=>b!==null)),p=c.size?this._objects.filter(b=>c.has(b.entry_id)):this._objects,m=this._config.show_object_filter!==!1&&p.length>1,f=this._objectFilter?_(this._objectFilter):null,w=f&&p.some(b=>b.entry_id===f)?p.filter(b=>b.entry_id===f):p,y=new Date;y.setHours(0,0,0,0);let $=this._pastDays>0,A=$?zi(w,y,this._pastDays,o):Mi(w,y,this._windowDays,o),z=ve(y),U=this._windowDays===365||$,D=U?A.filter(b=>b.events.length>0):A,G=b=>{let Q=`cal-status-${b.status}`,we=b.projected?"cal-event-projected":"",q=b.status==="overdue"&&b.days_until_due!=null?` (${ir(b.days_until_due,e)})`:"",O=b.projected&&b.interval_days?l`${b.interval_unit&&b.interval_unit!=="days"?`${b.interval_days} ${n("unit_"+b.interval_unit,e)}`:n("cal_every_n_days",e).replace("{n}",String(b.interval_days))}`:u,he=b.schedule_type==="sensor_based",Ne=he?l``:l``,qe=he&&b.prediction_confidence&&b.status!=="triggered"&&!b.projected?l` @@ -4773,9 +4775,9 @@ ${c?`
${c}
`:""} ${qe} ${O}
- ${b.avg_cost!=null&&b.avg_cost>0?l`${le(b.avg_cost,ks,e)}`:u} + ${b.avg_cost!=null&&b.avg_cost>0?l`${de(b.avg_cost,ks,e)}`:u}
- `},ae=b=>{let[Q,we,q]=b.date.split("-").map(Number),O=new Date(Q,we-1,q),he=b.date===z,Ne=rr(O,e,"short"),qe=sr(O,e,"long");return l` + `},oe=b=>{let[Q,we,q]=b.date.split("-").map(Number),O=new Date(Q,we-1,q),he=b.date===z,Ne=rr(O,e,"short"),qe=sr(O,e,"long");return l`
${Ne} @@ -4820,7 +4822,7 @@ ${c?`
${c}
`:""} `:u} - ${g?l` + ${m?l` this._valueChanged("title",c.target.value)} />
@@ -4923,7 +4925,7 @@ ${c?`
${c}
`:""} font-size: 12px; color: var(--secondary-text-color, #666); } - `,d([v({attribute:!1})],Le.prototype,"hass",2),d([_()],Le.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",W);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",Le);lr({type:"maintenance-supporter-calendar-card",name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{W as MaintenanceCalendarCard}; + `,d([v({attribute:!1})],Le.prototype,"hass",2),d([h()],Le.prototype,"_config",2);customElements.get("maintenance-supporter-calendar-card")||customElements.define("maintenance-supporter-calendar-card",W);customElements.get("maintenance-supporter-calendar-card-editor")||customElements.define("maintenance-supporter-calendar-card-editor",Le);lr({type:"maintenance-supporter-calendar-card",name:"Maintenance Supporter \u2014 Calendar",description:"Rolling calendar of maintenance tasks with 7/14/30/365 day windows, source icons, and prediction-confidence pills.",preview:!0});export{W as MaintenanceCalendarCard}; /*! Bundled license information: @lit/reactive-element/css-tag.js: diff --git a/custom_components/maintenance_supporter/frontend/maintenance-card.js b/custom_components/maintenance_supporter/frontend/maintenance-card.js index 999268cf..b76a1c7a 100644 --- a/custom_components/maintenance_supporter/frontend/maintenance-card.js +++ b/custom_components/maintenance_supporter/frontend/maintenance-card.js @@ -1,9 +1,9 @@ -/*! maintenance_supporter frontend 2.87.0 */ -var Ai=Object.defineProperty;var Rs=Object.getOwnPropertyDescriptor;var w=(s,r,e)=>()=>{if(e)throw e[0];try{return s&&(r=s(s=0)),r}catch(t){throw e=[t],t}};var Ps=(s,r)=>{for(var e in r)Ai(s,e,{get:r[e],enumerable:!0})};var d=(s,r,e,t)=>{for(var i=t>1?void 0:t?Rs(r,e):r,a=s.length-1,l;a>=0;a--)(l=s[a])&&(i=(t?l(r,e,i):l(i))||i);return t&&i&&Ai(r,e,i),i};var st,nt,At,Ci,Oe,Ii,k,Ri,Ct,It=w(()=>{st=globalThis,nt=st.ShadowRoot&&(st.ShadyCSS===void 0||st.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,At=Symbol(),Ci=new WeakMap,Oe=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==At)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(nt&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Ci.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ci.set(e,r))}return r}toString(){return this.cssText}},Ii=s=>new Oe(typeof s=="string"?s:s+"",void 0,At),k=(s,...r)=>{let e=s.length===1?s[0]:r.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[a+1],s[0]);return new Oe(e,s,At)},Ri=(s,r)=>{if(nt)s.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=st.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,s.appendChild(t)}},Ct=nt?s=>s:s=>s instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Ii(e)})(s):s});var Ls,Ns,js,Hs,Os,qs,at,Pi,Ds,Ms,qe,De,ot,Li,ee,Me=w(()=>{It();It();({is:Ls,defineProperty:Ns,getOwnPropertyDescriptor:js,getOwnPropertyNames:Hs,getOwnPropertySymbols:Os,getPrototypeOf:qs}=Object),at=globalThis,Pi=at.trustedTypes,Ds=Pi?Pi.emptyScript:"",Ms=at.reactiveElementPolyfillSupport,qe=(s,r)=>s,De={toAttribute(s,r){switch(r){case Boolean:s=s?Ds:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,r){let e=s;switch(r){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},ot=(s,r)=>!Ls(s,r),Li={attribute:!0,type:String,converter:De,reflect:!1,useDefault:!1,hasChanged:ot};Symbol.metadata??=Symbol("metadata"),at.litPropertyMetadata??=new WeakMap;ee=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Li){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Ns(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:a}=js(this.prototype,r)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let u=i?.call(this);a?.call(this,l),this.requestUpdate(r,u,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Li}static _$Ei(){if(this.hasOwnProperty(qe("elementProperties")))return;let r=qs(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(qe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qe("properties"))){let e=this.properties,t=[...Hs(e),...Os(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ct(i))}else r!==void 0&&e.push(Ct(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ri(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let a=(t.converter?.toAttribute!==void 0?t.converter:De).toAttribute(e,t.type);this._$Em=r,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let a=t.getPropertyOptions(i),l=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:De;this._$Em=i;let u=l.fromAttribute(e,a.type);this[i]=u??this._$Ej?.get(i)??u,this._$Em=null}}requestUpdate(r,e,t,i=!1,a){if(r!==void 0){let l=this.constructor;if(i===!1&&(a=this[r]),t??=l.getPropertyOptions(r),!((t.hasChanged??ot)(a,e)||t.useDefault&&t.reflect&&a===this._$Ej?.get(r)&&!this.hasAttribute(l._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:a},l){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,l??e??this[r]),a!==!0||l!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,a]of t){let{wrapped:l}=a,u=this[i];l!==!0||this._$AL.has(i)||u===void 0||this.C(i,void 0,a,u)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(r){}firstUpdated(r){}};ee.elementStyles=[],ee.shadowRootOptions={mode:"open"},ee[qe("elementProperties")]=new Map,ee[qe("finalized")]=new Map,Ms?.({ReactiveElement:ee}),(at.reactiveElementVersions??=[]).push("2.1.2")});function Bi(s,r){if(!qt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ji!==void 0?ji.createHTML(r):r}function $e(s,r,e=s,t){if(r===fe)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Ue(r)?void 0:r._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(s),i._$AT(s,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=$e(s,i._$AS(s,r.values),i,t)),r}var Ot,Ni,lt,ji,zi,oe,Fi,zs,ge,Fe,Ue,qt,Fs,Rt,ze,Hi,Oi,_e,qi,Di,Ui,Dt,o,Ee,ba,fe,c,Mi,me,Us,Be,Pt,Ve,ke,Lt,Nt,jt,Ht,Bs,Vi,dt=w(()=>{Ot=globalThis,Ni=s=>s,lt=Ot.trustedTypes,ji=lt?lt.createPolicy("lit-html",{createHTML:s=>s}):void 0,zi="$lit$",oe=`lit$${Math.random().toFixed(9).slice(2)}$`,Fi="?"+oe,zs=`<${Fi}>`,ge=document,Fe=()=>ge.createComment(""),Ue=s=>s===null||typeof s!="object"&&typeof s!="function",qt=Array.isArray,Fs=s=>qt(s)||typeof s?.[Symbol.iterator]=="function",Rt=`[ +/*! maintenance_supporter frontend 2.88.0 */ +var Ai=Object.defineProperty;var Rs=Object.getOwnPropertyDescriptor;var w=(s,r,e)=>()=>{if(e)throw e[0];try{return s&&(r=s(s=0)),r}catch(t){throw e=[t],t}};var Ps=(s,r)=>{for(var e in r)Ai(s,e,{get:r[e],enumerable:!0})};var d=(s,r,e,t)=>{for(var i=t>1?void 0:t?Rs(r,e):r,a=s.length-1,l;a>=0;a--)(l=s[a])&&(i=(t?l(r,e,i):l(i))||i);return t&&i&&Ai(r,e,i),i};var st,nt,At,Ci,Oe,Ii,k,Ri,Ct,It=w(()=>{st=globalThis,nt=st.ShadowRoot&&(st.ShadyCSS===void 0||st.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,At=Symbol(),Ci=new WeakMap,Oe=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==At)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if(nt&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Ci.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ci.set(e,r))}return r}toString(){return this.cssText}},Ii=s=>new Oe(typeof s=="string"?s:s+"",void 0,At),k=(s,...r)=>{let e=s.length===1?s[0]:r.reduce((t,i,a)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[a+1],s[0]);return new Oe(e,s,At)},Ri=(s,r)=>{if(nt)s.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of r){let t=document.createElement("style"),i=st.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,s.appendChild(t)}},Ct=nt?s=>s:s=>s instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Ii(e)})(s):s});var Ls,Ns,js,Hs,Os,qs,at,Pi,Ds,Ms,qe,De,ot,Li,ee,Me=w(()=>{It();It();({is:Ls,defineProperty:Ns,getOwnPropertyDescriptor:js,getOwnPropertyNames:Hs,getOwnPropertySymbols:Os,getPrototypeOf:qs}=Object),at=globalThis,Pi=at.trustedTypes,Ds=Pi?Pi.emptyScript:"",Ms=at.reactiveElementPolyfillSupport,qe=(s,r)=>s,De={toAttribute(s,r){switch(r){case Boolean:s=s?Ds:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,r){let e=s;switch(r){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},ot=(s,r)=>!Ls(s,r),Li={attribute:!0,type:String,converter:De,reflect:!1,useDefault:!1,hasChanged:ot};Symbol.metadata??=Symbol("metadata"),at.litPropertyMetadata??=new WeakMap;ee=class extends HTMLElement{static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Li){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&Ns(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:a}=js(this.prototype,r)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let u=i?.call(this);a?.call(this,l),this.requestUpdate(r,u,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Li}static _$Ei(){if(this.hasOwnProperty(qe("elementProperties")))return;let r=qs(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(qe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qe("properties"))){let e=this.properties,t=[...Hs(e),...Os(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ct(i))}else r!==void 0&&e.push(Ct(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(r=>r(this))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ri(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(r=>r.hostConnected?.())}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach(r=>r.hostDisconnected?.())}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let a=(t.converter?.toAttribute!==void 0?t.converter:De).toAttribute(e,t.type);this._$Em=r,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let a=t.getPropertyOptions(i),l=typeof a.converter=="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:De;this._$Em=i;let u=l.fromAttribute(e,a.type);this[i]=u??this._$Ej?.get(i)??u,this._$Em=null}}requestUpdate(r,e,t,i=!1,a){if(r!==void 0){let l=this.constructor;if(i===!1&&(a=this[r]),t??=l.getPropertyOptions(r),!((t.hasChanged??ot)(a,e)||t.useDefault&&t.reflect&&a===this._$Ej?.get(r)&&!this.hasAttribute(l._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:a},l){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,l??e??this[r]),a!==!0||l!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,a]of this._$Ep)this[i]=a;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,a]of t){let{wrapped:l}=a,u=this[i];l!==!0||this._$AL.has(i)||u===void 0||this.C(i,void 0,a,u)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(r){}firstUpdated(r){}};ee.elementStyles=[],ee.shadowRootOptions={mode:"open"},ee[qe("elementProperties")]=new Map,ee[qe("finalized")]=new Map,Ms?.({ReactiveElement:ee}),(at.reactiveElementVersions??=[]).push("2.1.2")});function Bi(s,r){if(!qt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ji!==void 0?ji.createHTML(r):r}function $e(s,r,e=s,t){if(r===fe)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,a=Ue(r)?void 0:r._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(s),i._$AT(s,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=$e(s,i._$AS(s,r.values),i,t)),r}var Ot,Ni,lt,ji,zi,le,Fi,zs,ge,Fe,Ue,qt,Fs,Rt,ze,Hi,Oi,_e,qi,Di,Ui,Dt,o,Ee,ba,fe,c,Mi,me,Us,Be,Pt,Ve,ke,Lt,Nt,jt,Ht,Bs,Vi,dt=w(()=>{Ot=globalThis,Ni=s=>s,lt=Ot.trustedTypes,ji=lt?lt.createPolicy("lit-html",{createHTML:s=>s}):void 0,zi="$lit$",le=`lit$${Math.random().toFixed(9).slice(2)}$`,Fi="?"+le,zs=`<${Fi}>`,ge=document,Fe=()=>ge.createComment(""),Ue=s=>s===null||typeof s!="object"&&typeof s!="function",qt=Array.isArray,Fs=s=>qt(s)||typeof s?.[Symbol.iterator]=="function",Rt=`[ \f\r]`,ze=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hi=/-->/g,Oi=/>/g,_e=RegExp(`>|${Rt}(?:([^\\s"'>=/]+)(${Rt}*=${Rt}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),qi=/'/g,Di=/"/g,Ui=/^(?:script|style|textarea|title)$/i,Dt=s=>(r,...e)=>({_$litType$:s,strings:r,values:e}),o=Dt(1),Ee=Dt(2),ba=Dt(3),fe=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Mi=new WeakMap,me=ge.createTreeWalker(ge,129);Us=(s,r)=>{let e=s.length-1,t=[],i,a=r===2?"":r===3?"":"",l=ze;for(let u=0;u"?(l=i??ze,b=-1):m[1]===void 0?b=-2:(b=l.lastIndex-m[2].length,_=m[1],l=m[3]===void 0?_e:m[3]==='"'?Di:qi):l===Di||l===qi?l=_e:l===Hi||l===Oi?l=ze:(l=_e,i=void 0);let x=l===_e&&s[u+1].startsWith("/>")?" ":"";a+=l===ze?h+zs:b>=0?(t.push(_),h.slice(0,b)+zi+h.slice(b)+oe+x):h+oe+(b===-2?u:x)}return[Bi(s,a+(s[e]||"")+(r===2?"":r===3?"":"")),t]},Be=class s{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,u=r.length-1,h=this.parts,[_,m]=Us(r,e);if(this.el=s.createElement(_,t),me.currentNode=this.el.content,e===2||e===3){let b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=me.nextNode())!==null&&h.length0){i.textContent=lt?lt.emptyScript:"";for(let x=0;x2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=c}_$AI(r,e=this,t,i){let a=this.strings,l=!1;if(a===void 0)r=$e(this,r,e,0),l=!Ue(r)||r!==this._$AH&&r!==fe,l&&(this._$AH=r);else{let u=r,h,_;for(r=a[0],h=0;h{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new Ve(r.insertBefore(Fe(),a),a,void 0,e??{})}return i._$AI(s),i}});var Mt,E,Vs,Wi=w(()=>{Me();Me();dt();dt();Mt=globalThis,E=class extends ee{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Vi(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return fe}};E._$litElement$=!0,E.finalized=!0,Mt.litElementHydrateSupport?.({LitElement:E});Vs=Mt.litElementPolyfillSupport;Vs?.({LitElement:E});(Mt.litElementVersions??=[]).push("4.2.2")});var Ki=w(()=>{});var I=w(()=>{Me();dt();Wi();Ki()});var Gi=w(()=>{});function v(s){return(r,e)=>typeof e=="object"?Xs(s,r,e):((t,i,a)=>{let l=i.hasOwnProperty(a);return i.constructor.createProperty(a,t),l?Object.getOwnPropertyDescriptor(i,a):void 0})(s,r,e)}var Zs,Xs,Ft=w(()=>{Me();Zs={attribute:!0,type:String,converter:De,reflect:!1,hasChanged:ot},Xs=(s=Zs,r,e)=>{let{kind:t,metadata:i}=e,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),t==="setter"&&((s=Object.create(s)).wrapped=!0),a.set(e.name,s),t==="accessor"){let{name:l}=e;return{set(u){let h=r.get.call(this);r.set.call(this,u),this.requestUpdate(l,h,s,!0,u)},init(u){return u!==void 0&&this.C(l,void 0,s,u),u}}}if(t==="setter"){let{name:l}=e;return function(u){let h=this[l];r.call(this,u),this.requestUpdate(l,h,s,!0,u)}}throw Error("Unsupported decorator location: "+t)}});function p(s){return v({...s,state:!0,attribute:!1})}var Qi=w(()=>{Ft();});var Ji=w(()=>{});var Se=w(()=>{});var Zi=w(()=>{Se();});var Xi=w(()=>{Se();});var er=w(()=>{Se();});var tr=w(()=>{Se();});var ir=w(()=>{Se();});var q=w(()=>{Gi();Ft();Qi();Ji();Zi();Xi();er();tr();ir()});var sr,rr=w(()=>{sr={maintenance:"Maintenance",objects:"Objects",tasks:"Tasks",overdue:"Overdue",due_soon:"Due Soon",triggered:"Triggered",trigger_replaced:"Trigger replaced",trigger_removed:"Trigger removed",ok:"OK",all:"All",new_object:"+ New Object",templates_from:"From template",templates_title:"Start from a template",templates_task_count:"{n} tasks",template_created:"Created from template",onboard_hint:"Add your first object to start tracking maintenance.",edit:"Edit",duplicate:"Duplicate",task_duplicated:"Task duplicated",task_moved:"Task moved",move_task_target:"Target object",move_task_message:"Choose the object this task should belong to. Its history, readings and trigger state move with it; it gets a new reference number and its entities are recreated under the new object. Linked documents stay with the current object.",move_task_title:"Move task",move_task:"Move to another object\u2026",object_duplicated:"Object duplicated",delete:"Delete",add_task:"+ Add Task",complete:"Complete",completed:"Completed",skip:"Skip",skipped:"Skipped",missed:"Missed",reset:"Reset",snooze:"Snooze",snoozed:"Snoozed",cancel:"Cancel",bulk_select:"Select",bulk_select_all:"Select all",bulk_n_selected:"{n} selected",bulk_completed:"{n} tasks completed",bulk_archived:"{n} tasks archived",completing:"Completing\u2026",interval:"Interval",warning:"Warning",last_performed:"Last performed",next_due:"Next due",days_until_due:"Days until due",avg_duration:"Avg duration",trigger:"Trigger",trigger_type:"Trigger type",threshold_above:"Upper limit",threshold_below:"Lower limit",threshold:"Threshold",counter:"Counter",state_change:"State change",runtime:"Runtime",runtime_hours:"Target runtime (hours)",target_value:"Target value",target_changes:"Target changes",for_minutes:"For (minutes)",time_based:"Time-based",sensor_based:"Sensor-based",manual:"Manual",one_time:"One-time",weekdays:"Weekdays",nth_weekday:"Nth weekday of month",day_of_month:"Day of month",recurrence_on_days:"Repeat on",recurrence_occurrence:"Occurrence",recurrence_weekday:"Weekday",recurrence_day:"Day of month (1\u201331)",recurrence_last_day:"Last day of the month",recurrence_business_day:"Business days only (roll back from weekend)",recurrence_offset:"Offset (days, \xB1)",recurrence_offset_help:"Shift the date by \xB1N days, e.g. -2 = two days before.",last_day_month:"Last day of month",last_business_day_month:"Last business day",ord_1:"1st",ord_2:"2nd",ord_3:"3rd",ord_4:"4th",ord_5:"5th",ord_last:"Last",day_word:"Day",interval_value:"Interval",interval_unit:"Unit",unit_days:"Days",unit_weeks:"Weeks",unit_months:"Months",unit_years:"Years",due_date:"Due date",cleaning:"Cleaning",inspection:"Inspection",replacement:"Replacement",calibration:"Calibration",service:"Service",reading:"Reading",custom:"Custom",history:"History",cost:"Cost",report_button:"Report",report_title:"Maintenance report",report_generated:"Generated",report_times_done:"Done",report_total_cost:"Total cost",report_notes:"Notes",report_col_type:"Type",report_col_status:"Status",report_col_schedule:"Schedule",duration:"Duration",minutes_short:"min",both:"Both",trigger_val:"Trigger value",complete_title:"Complete: ",checklist:"Checklist",require_on_completion:"Require on completion",checklist_steps_optional:"Checklist steps (optional)",checklist_placeholder:`Clean filter +\f\r"'\`<>=]|("|')|))|$)`,"g"),qi=/'/g,Di=/"/g,Ui=/^(?:script|style|textarea|title)$/i,Dt=s=>(r,...e)=>({_$litType$:s,strings:r,values:e}),o=Dt(1),Ee=Dt(2),ba=Dt(3),fe=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Mi=new WeakMap,me=ge.createTreeWalker(ge,129);Us=(s,r)=>{let e=s.length-1,t=[],i,a=r===2?"":r===3?"":"",l=ze;for(let u=0;u"?(l=i??ze,b=-1):m[1]===void 0?b=-2:(b=l.lastIndex-m[2].length,_=m[1],l=m[3]===void 0?_e:m[3]==='"'?Di:qi):l===Di||l===qi?l=_e:l===Hi||l===Oi?l=ze:(l=_e,i=void 0);let x=l===_e&&s[u+1].startsWith("/>")?" ":"";a+=l===ze?h+zs:b>=0?(t.push(_),h.slice(0,b)+zi+h.slice(b)+le+x):h+le+(b===-2?u:x)}return[Bi(s,a+(s[e]||"")+(r===2?"":r===3?"":"")),t]},Be=class s{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let a=0,l=0,u=r.length-1,h=this.parts,[_,m]=Us(r,e);if(this.el=s.createElement(_,t),me.currentNode=this.el.content,e===2||e===3){let b=this.el.content.firstChild;b.replaceWith(...b.childNodes)}for(;(i=me.nextNode())!==null&&h.length0){i.textContent=lt?lt.emptyScript:"";for(let x=0;x2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=c}_$AI(r,e=this,t,i){let a=this.strings,l=!1;if(a===void 0)r=$e(this,r,e,0),l=!Ue(r)||r!==this._$AH&&r!==fe,l&&(this._$AH=r);else{let u=r,h,_;for(r=a[0],h=0;h{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let a=e?.renderBefore??null;t._$litPart$=i=new Ve(r.insertBefore(Fe(),a),a,void 0,e??{})}return i._$AI(s),i}});var Mt,E,Vs,Wi=w(()=>{Me();Me();dt();dt();Mt=globalThis,E=class extends ee{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Vi(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return fe}};E._$litElement$=!0,E.finalized=!0,Mt.litElementHydrateSupport?.({LitElement:E});Vs=Mt.litElementPolyfillSupport;Vs?.({LitElement:E});(Mt.litElementVersions??=[]).push("4.2.2")});var Ki=w(()=>{});var I=w(()=>{Me();dt();Wi();Ki()});var Gi=w(()=>{});function v(s){return(r,e)=>typeof e=="object"?Xs(s,r,e):((t,i,a)=>{let l=i.hasOwnProperty(a);return i.constructor.createProperty(a,t),l?Object.getOwnPropertyDescriptor(i,a):void 0})(s,r,e)}var Zs,Xs,Ft=w(()=>{Me();Zs={attribute:!0,type:String,converter:De,reflect:!1,hasChanged:ot},Xs=(s=Zs,r,e)=>{let{kind:t,metadata:i}=e,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),t==="setter"&&((s=Object.create(s)).wrapped=!0),a.set(e.name,s),t==="accessor"){let{name:l}=e;return{set(u){let h=r.get.call(this);r.set.call(this,u),this.requestUpdate(l,h,s,!0,u)},init(u){return u!==void 0&&this.C(l,void 0,s,u),u}}}if(t==="setter"){let{name:l}=e;return function(u){let h=this[l];r.call(this,u),this.requestUpdate(l,h,s,!0,u)}}throw Error("Unsupported decorator location: "+t)}});function p(s){return v({...s,state:!0,attribute:!1})}var Qi=w(()=>{Ft();});var Ji=w(()=>{});var Se=w(()=>{});var Zi=w(()=>{Se();});var Xi=w(()=>{Se();});var er=w(()=>{Se();});var tr=w(()=>{Se();});var ir=w(()=>{Se();});var q=w(()=>{Gi();Ft();Qi();Ji();Zi();Xi();er();tr();ir()});var sr,rr=w(()=>{sr={maintenance:"Maintenance",objects:"Objects",tasks:"Tasks",overdue:"Overdue",due_soon:"Due Soon",triggered:"Triggered",trigger_replaced:"Trigger replaced",trigger_removed:"Trigger removed",ok:"OK",all:"All",new_object:"+ New Object",templates_from:"From template",templates_title:"Start from a template",templates_task_count:"{n} tasks",template_created:"Created from template",onboard_hint:"Add your first object to start tracking maintenance.",edit:"Edit",duplicate:"Duplicate",task_duplicated:"Task duplicated",task_moved:"Task moved",move_task_target:"Target object",move_task_message:"Choose the object this task should belong to. Its history, readings and trigger state move with it; it gets a new reference number and its entities are recreated under the new object. Linked documents stay with the current object.",move_task_title:"Move task",move_task:"Move to another object\u2026",object_duplicated:"Object duplicated",delete:"Delete",add_task:"+ Add Task",complete:"Complete",completed:"Completed",skip:"Skip",skipped:"Skipped",missed:"Missed",reset:"Reset",snooze:"Snooze",snoozed:"Snoozed",cancel:"Cancel",bulk_select:"Select",bulk_select_all:"Select all",bulk_n_selected:"{n} selected",bulk_completed:"{n} tasks completed",bulk_archived:"{n} tasks archived",completing:"Completing\u2026",interval:"Interval",warning:"Warning",last_performed:"Last performed",next_due:"Next due",days_until_due:"Days until due",avg_duration:"Avg duration",trigger:"Trigger",trigger_type:"Trigger type",threshold_above:"Upper limit",threshold_below:"Lower limit",threshold:"Threshold",counter:"Counter",state_change:"State change",runtime:"Runtime",runtime_hours:"Target runtime (hours)",target_value:"Target value",target_changes:"Target changes",for_minutes:"For (minutes)",time_based:"Time-based",sensor_based:"Sensor-based",manual:"Manual",one_time:"One-time",weekdays:"Weekdays",nth_weekday:"Nth weekday of month",day_of_month:"Day of month",recurrence_on_days:"Repeat on",recurrence_occurrence:"Occurrence",recurrence_weekday:"Weekday",recurrence_day:"Day of month (1\u201331)",recurrence_last_day:"Last day of the month",recurrence_business_day:"Business days only (roll back from weekend)",recurrence_offset:"Offset (days, \xB1)",recurrence_offset_help:"Shift the date by \xB1N days, e.g. -2 = two days before.",last_day_month:"Last day of month",last_business_day_month:"Last business day",ord_1:"1st",ord_2:"2nd",ord_3:"3rd",ord_4:"4th",ord_5:"5th",ord_last:"Last",day_word:"Day",interval_value:"Interval",interval_unit:"Unit",unit_days:"Days",unit_weeks:"Weeks",unit_months:"Months",unit_years:"Years",due_date:"Due date",cleaning:"Cleaning",inspection:"Inspection",replacement:"Replacement",calibration:"Calibration",service:"Service",reading:"Reading",custom:"Custom",history:"History",cost:"Cost",report_button:"Report",report_title:"Maintenance report",report_generated:"Generated",report_times_done:"Done",report_total_cost:"Total cost",report_notes:"Notes",report_col_type:"Type",report_col_status:"Status",report_col_schedule:"Schedule",duration:"Duration",minutes_short:"min",both:"Both",trigger_val:"Trigger value",complete_title:"Complete: ",checklist:"Checklist",require_on_completion:"Require on completion",checklist_steps_optional:"Checklist steps (optional)",checklist_placeholder:`Clean filter Replace seal -Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",all_parts:"All parts",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",trigger_equals:"Trigger when equal to (=)",trigger_not_equals:"Trigger when different from (\u2260)",for_at_least_minutes:"For at least (minutes)",safety_interval:"Safety interval (optional)",trigger_combinator:"Combine trigger and interval",trigger_combinator_any:"Trigger or interval (whichever first)",trigger_combinator_all:"Trigger and interval (both required)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",adaptive_prediction_enabled:"Enable sensor-driven predictions",adaptive_seasonal_enabled:"Enable seasonal awareness",adaptive_max_interval:"Maximum interval (days)",adaptive_min_interval:"Minimum interval (days)",adaptive_ewa_alpha:"Learning rate (alpha)",adaptive_enabled:"Enable adaptive scheduling",adaptive_section_title:"Adaptive Scheduling",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Selected",loading_chart:"Loading chart data...",hide_outliers:"Hide outliers (sensor glitches)",was_maintenance_needed:"Was this maintenance needed?",feedback_needed:"Needed",feedback_not_needed:"Not needed",feedback_not_sure:"Not sure",suggested_interval:"Suggested interval",apply_suggestion:"Apply",reanalyze:"Re-analyze",reanalyze_result:"New analysis",reanalyze_insufficient_data:"Not enough data to produce a recommendation",data_points:"data points",dismiss_suggestion:"Dismiss",confidence_low:"Low",confidence_medium:"Medium",confidence_high:"High",recommended:"recommended",seasonal_awareness:"Seasonal Awareness",edit_seasonal_overrides:"Edit seasonal factors",seasonal_overrides_title:"Seasonal factors (override)",seasonal_overrides_hint:"Factor per month (0.1\u20135.0). Empty = learned automatically.",seasonal_override_invalid:"Invalid value",seasonal_override_range:"Factor must be between 0.1 and 5.0",clear_all:"Clear all",clear:"Clear",date_type_toggle:"Type the date",date_type_invalid:"Not a valid date \u2014 try 1978-03-15, a year like 1978, or your own date format",seasonal_chart_title:"Seasonal Factors",seasonal_learned:"Learned",seasonal_manual:"Manual",month_jan:"Jan",month_feb:"Feb",month_mar:"Mar",month_apr:"Apr",month_may:"May",month_jun:"Jun",month_jul:"Jul",month_aug:"Aug",month_sep:"Sep",month_oct:"Oct",month_nov:"Nov",month_dec:"Dec",sensor_prediction:"Sensor Prediction",degradation_trend:"Trend",trend_rising:"Rising",trend_falling:"Falling",trend_stable:"Stable",trend_insufficient_data:"Insufficient data",days_until_threshold:"Days until threshold",threshold_exceeded:"Threshold exceeded",environmental_adjustment:"Environmental factor",sensor_prediction_urgency:"Sensor predicts threshold in ~{days} days",day_short:"day",weibull_reliability_curve:"Reliability Curve",weibull_failure_probability:"Failure Probability",weibull_r_squared:"Fit R\xB2",beta_early_failures:"Early Failures",beta_random_failures:"Random Failures",beta_wear_out:"Wear-out",beta_highly_predictable:"Highly Predictable",confidence_interval:"Confidence Interval",confidence_conservative:"Conservative",confidence_aggressive:"Optimistic",current_interval_marker:"Current interval",recommended_marker:"Recommended",characteristic_life:"Characteristic life",chart_mini_sparkline:"Trend sparkline",chart_history:"Cost and duration history",chart_seasonal:"Seasonal factors, 12 months",chart_weibull:"Weibull reliability curve",chart_sparkline:"Sensor trigger value chart",days_progress:"Days progress",qr_code:"QR Code",qr_generating:"Generating QR code\u2026",qr_error:"Failed to generate QR code.",qr_error_no_url:"No HA URL configured. Please set an external or internal URL in Settings \u2192 System \u2192 Network.",save_error:"Failed to save. Please try again.",subsave_warning:"Saved, but one setting was rejected: {detail}",qr_print:"Print",qr_download:"Download SVG",qr_action_view:"View maintenance info",qr_action_complete:"Mark maintenance as complete",qr_url_mode:"Link type",qr_mode_companion:"Companion App",qr_mode_local:"Local (mDNS)",qr_mode_server:"Server URL",overview:"Overview",recent_activities:"Recent Activities",search_notes:"Search notes",avg_cost:"Avg Cost",current:"Current",shorter:"Shorter",longer:"Longer",normal:"Normal",disabled:"Disabled",compound_logic:"Compound logic",compound:"Compound (multiple conditions)",compound_logic_and:"AND \u2014 all conditions must trigger",compound_logic_or:"OR \u2014 any condition triggers",compound_help:"Combine several sensor conditions into one trigger.",compound_no_conditions:"No conditions yet \u2014 add at least one.",compound_add_condition:"Add condition",compound_condition:"Condition",compound_remove_condition:"Remove condition",card_title:"Title",card_show_header:"Show header with statistics",card_show_actions:"Show action buttons",card_action_style:"Complete button style",card_compact:"Compact mode",card_max_items:"Max items (0 = all)",card_filter_status:"Filter by status",card_filter_status_help:"Empty = show all statuses.",card_filter_objects:"Filter by objects",card_filter_objects_help:"Empty = show all objects.",card_filter_areas:"Filter by areas",card_filter_areas_help:"Empty = show all areas.",card_filter_priority_help:"Empty = show all priorities. Tasks without an explicit priority count as Normal.",card_filter_entities:"Filter by entities (entity_ids)",card_filter_entities_help:"Pick sensor / binary_sensor entities from this integration. Empty = all.",card_loading_objects:"Loading objects\u2026",card_load_error:"Could not load objects \u2014 check the WebSocket connection.",card_no_tasks_title:"No maintenance tasks yet",card_no_tasks_cta:"\u2192 Create one in the Maintenance panel",no_objects:"No objects yet.",action_error:"Action failed. Please try again.",area_id_optional:"Area (optional)",installation_date_optional:"Installation date (optional)",warranty_expiry_optional:"Warranty expiry (optional)",warranty:"Warranty",warranty_valid_until:"valid until {date}",warranty_expires_in:"expires in {days} days",warranty_expired:"expired",cal_past_windows:"Past windows",cal_forward_windows:"Forward windows",history_edit_title:"Edit history entry",history_delete_entry:"Delete entry",history_delete_confirm:"Delete this history entry? The task's last-performed date falls back to the previous completion; photos stay with the object and consumed parts are not restocked.",history_edit_timestamp:"Timestamp",manufacturer:"Manufacturer",model:"Model",area:"Area",actions:"Actions",view_mode_label:"View",view_cards:"Card view",view_table:"Table view",objects_table_columns_label:"Objects table columns",objects_table_columns_hint:"Choose which columns appear in the objects table view.",custom_icon_optional:"Icon (optional, e.g. mdi:wrench)",task_enabled:"Task enabled",skip_reason_prompt:"Skip this task?",reason_optional:"Reason (optional)",reset_date_prompt:"Mark task as performed?",reset_date_optional:"Last performed date (optional, defaults to today)",notes_label:"Notes",documentation_label:"Documentation",no_nfc_tag:"\u2014 No tag \u2014",dashboard:"Dashboard",tab_today:"Today",palette_placeholder:"Search objects, tasks, spare parts, documents, notes\u2026",palette_no_results:"No matches",palette_hint:"\u2191\u2193 to navigate \xB7 Enter to open \xB7 Esc to close \xB7 / opens the search anywhere",search_open:"Search",search_group_parts:"Spare parts",search_group_content:"In documents",search_group_history:"History notes",search_page:"Page {page}",search_empty_hint:"Type to search objects, tasks, spare parts, documents and notes",search_searching:"Searching documents and notes\u2026",search_index_status:"Full-text search: {indexed} of {total} files indexed \xB7 {no_text} without text layer \xB7 {pending} pending",today_all_caught_up:"All caught up! Nothing due this week.",today_overdue:"Overdue",today_due_today:"Due today",today_this_week:"This week",settings:"Settings",settings_features:"Advanced Features",settings_features_desc:"Enable or disable advanced features. Disabling hides them from the UI but does not delete data.",feat_adaptive:"Adaptive Scheduling",feat_adaptive_desc:"Learn optimal intervals from maintenance history",feat_predictions:"Sensor Predictions",feat_predictions_desc:"Predict trigger dates from sensor degradation",feat_seasonal:"Seasonal Adjustments",feat_seasonal_desc:"Adjust intervals based on seasonal patterns",feat_environmental:"Environmental Correlation",feat_environmental_desc:"Correlate intervals with temperature/humidity",feat_budget:"Budget Tracking",feat_budget_desc:"Track monthly and yearly maintenance spending",feat_groups:"Task Groups",feat_groups_desc:"Organize tasks into logical groups",feat_checklists:"Checklists",feat_checklists_desc:"Multi-step procedures for task completion",settings_general:"General",settings_default_warning:"Default warning days",settings_consumable_threshold:"Consumable low threshold (%)",settings_battery_low_percent:"Battery low threshold (%)",settings_battery_recovered_percent:"Battery counts as replaced above (%)",settings_battery_recovered_percent_hint:"A low battery stays counted as low until its level rises above this value or a replacement is recorded \u2014 so a level hovering around the low threshold cannot complete the fleet task again and again.",settings_battery_lifetimes:"Typical battery lifetimes",settings_battery_lifetimes_hint:'Only used for batteries without a percentage: a Battery Notes note that has just a type and a last-replaced date, or a sensor that only reports "low". Their due date is last replaced + this lifetime. Batteries that report a level get their forecast from the measured discharge instead. Once the fleet has seen three replacements of a type, the median interval takes over from the built-in value \u2014 your own value always wins.',settings_battery_lifetime_months:"months",settings_battery_lifetime_reset:"Use default",settings_battery_lifetime_in_fleet:"in your fleet",settings_battery_lifetime_learned_models:"Learned per model: {list}",settings_thresholds_hint:"Defaults for new Suggested setups (percent-remaining consumables) and for fleet batteries without their own Battery Notes threshold. Existing tasks keep their value.",settings_part_search_url:"Shopping search link",settings_part_search_url_hint:"URL with {q} in place of the search terms, used for parts without a product link. Leave empty for the automatic store (by country, then by language).",settings_value_out_of_range:"Value must be between {min} and {max}",bn_summary:"{name}: {pct} % for {n} batteries",bn_floor_decides:"Your {floor} % floor decides for all of them; the higher of the two thresholds counts per battery.",bn_above_floor:"That is above your {floor} % floor, so {name} decides for all noted batteries.",bn_overrides:"{n} devices with their own threshold:",bn_more:"+ {n} more",settings_row_actions:"Task row actions",settings_ref_numbers_in_lists:"Reference numbers in lists",settings_ref_numbers_in_lists_hint:"Show the #8 / #8.3 chips in front of object and task names in the Today list, the task table, the object cards and the objects table.",row_actions_buttons_compact:"Buttons (icons only on phones)",row_actions_buttons:"Buttons with text",row_actions_icons:"Icons (classic)",row_actions_follow:"Follow the household setting",settings_panel_enabled:"Sidebar panel",settings_panel_title:"Sidebar panel title",settings_notifications:"Notifications",settings_notify_service:"Notification service",settings_shopping_list:"Shopping list (buy tasks)",settings_shopping_list_help:"Low-part buy reminders appear in this to-do list; checking one off restocks the part.",shopping_list_none:"Off \u2014 no shopping list",settings_install_assist_sentences:"Install Assist sentences",settings_install_assist_sentences_hint:"Copies the voice sentences into your configuration so the classic Assist agent recognises them. A file you edited yourself is never overwritten.",test_notification:"Test notification",send_test:"Send test",testing:"Sending\u2026",test_notification_success:"Test notification sent",test_notification_failed:"Test notification failed",notify_per_person:"Per-person delivery",member_avatars:"Member avatars",member_avatars_hint:"Shown next to assigned tasks \u2014 initials in the member's colour. Defaults come from the name; set your own initials or pick a colour to tell members apart.",member_initials:"Initials",member_color:"Colour",member_avatar_reset:"Reset",notify_no_own_device:"No own device \u2014 uses the household service",settings_notify_due_soon:"Notify when due soon",settings_notify_overdue:"Notify when overdue",settings_notify_triggered:"Notify when triggered",settings_interval_hours:"Repeat interval (hours, 0 = once)",settings_quiet_hours:"Quiet hours",settings_quiet_start:"Start",settings_quiet_end:"End",settings_max_per_day:"Max notifications per day (0 = unlimited)",settings_bundling:"Bundle notifications",settings_bundle_threshold:"Bundle threshold",settings_reminder_leads:"Extra reminders (days before due)",settings_reminder_leads_hint:"Comma-separated lead times, e.g. 14, 3, 0 \u2014 one extra reminder fires on each matching day. Empty = off.",settings_actions:"Mobile Action Buttons",settings_action_complete:"Show 'Complete' button",settings_action_skip:"Show 'Skip' button",settings_action_snooze:"Show 'Snooze' button",settings_weekly_digest:"Weekly digest",settings_weekly_digest_hint:"A single summary notification on Monday morning when tasks are due.",settings_warranty_reminder:"Warranty expiry reminder",settings_warranty_reminder_days:"Days before expiry",settings_warranty_reminder_hint:"Notify once when an object's warranty is this many days from expiring.",settings_snooze_hours:"Snooze duration (hours)",settings_budget:"Budget",settings_currency:"Currency",settings_currency_decimals:"Decimal places for amounts",settings_currency_decimals_hint:"How many decimals every amount shows: KPIs, budgets, costs in lists and reports, budget alerts. 0 = whole numbers.",settings_budget_monthly:"Monthly budget",settings_budget_yearly:"Yearly budget",settings_budget_alerts:"Budget alerts",settings_budget_threshold:"Alert threshold (%)",settings_import_export:"Import / Export",settings_export_json:"Export JSON",settings_export_yaml:"Export YAML",settings_export_csv:"Export CSV",settings_export_settings:"Export settings (JSON)",settings_import_placeholder:"Paste JSON or CSV content here\u2026",settings_import_btn:"Import",settings_import_success:"{count} objects imported successfully.",settings_export_success:"Export downloaded.",settings_saved:"Setting saved.",settings_include_history:"Include history",settings_export_selection:"Limit to selected objects (optional)",settings_docs_archive:"Documents archive (with files)",settings_docs_archive_hint:"The JSON/YAML/CSV exports carry settings only. This ZIP includes the uploaded file contents so a restore is complete.",settings_docs_export_btn:"Download documents ZIP",settings_docs_import_btn:"Restore documents ZIP",settings_docs_import_success:"Restored: {blobs} files, {docs} documents",sort_alphabetical:"Alphabetical",sort_due_soonest:"Due soonest",sort_task_count:"Task count",sort_area:"Area",sort_assigned_user:"Assigned user",sort_group:"Group",groupby_none:"No grouping",groupby_area:"By area",groupby_group:"By group",groupby_user:"By user",groupby_object:"By object",filter_label:"Filter",user_label:"User",photo_label:"Photo",sort_label:"Sort",group_by_label:"Group by",state_value_help:'Use the HA state value (usually lowercase, e.g. "on"/"off"). Case is normalised on save.',target_changes_help:"Number of matching transitions before the trigger fires (default: 1).",state_latch_help:"With 1 transition the trigger is a latch: it recovers when the entity leaves the To-state \u2014 or, with only a From-state set, when it returns to that state.",for_minutes_state_help:"0 counts every change immediately. Set minutes and the new state must hold that long first \u2014 brief flickers then neither trigger nor count.",qr_print_title:"Print QR codes",qr_print_desc:"Generate a printable page of QR codes to cut out and stick on your equipment.",qr_print_load:"Load objects",qr_print_filter:"Filter",qr_print_objects:"Objects",qr_print_actions:"Actions",qr_print_url_mode:"Link type",qr_print_estimate:"Estimated QR codes",qr_print_over_limit:"cap is 200, narrow the filter",qr_print_generate:"Generate QR codes",qr_print_generating:"Generating\u2026",qr_print_ready:"QR codes ready",qr_print_print_button:"Print",qr_print_empty:"Nothing to generate",qr_action_skip:"Skip",vacation_title:"Vacation mode",vacation_active:"active",vacation_ended:"ended",vacation_desc:"Plan a vacation: notifications are paused during the period plus a buffer of days. You can opt specific tasks back in.",vacation_enable:"Enable vacation mode",vacation_start:"Start",vacation_end:"End",vacation_buffer:"Buffer (days)",vacation_exempt_title:"Notify anyway during vacation",vacation_exempt_desc:"Pick tasks that should still notify during vacation (e.g. critical pool chemistry).",vacation_load_tasks:"Load tasks",vacation_preview_btn:"Show preview",vacation_preview_affected:"tasks affected",vacation_event_due_soon:"becomes due soon",vacation_event_overdue:"becomes overdue",vacation_event_triggered_est:"sensor trigger possible",vacation_sensor_based:"(sensor-based)",vacation_action_notify:"Notify anyway",vacation_action_unsilence:"Silence again",vacation_marked_complete:"Marked complete",vacation_marked_skip:"Skipped",vacation_end_now:"End vacation now",add:"Add",show_stats:"Show stats + graphs",hide_stats:"Hide stats",adaptive_no_data:"Not enough completion history yet for adaptive analysis. Complete this task a few more times to unlock interval recommendations and reliability charts.",suggestion_applied:"Suggested interval applied",vacation_mode:"Vacation mode",vacation_status_active:"Active now",vacation_status_scheduled:"Scheduled",vacation_status_inactive:"Inactive",vacation_end_now_confirm:"End vacation immediately?",vacation_exempt_count:"exempt",vacation_advanced:"Advanced\u2026",vacation_open_panel:"Open in panel",enable:"Enable",saved:"Saved",budget_monthly_set:"Set monthly",budget_yearly_set:"Set yearly",budget_advanced:"Currency, alerts\u2026",budget_open_panel:"Open in panel",groups_empty:"No groups yet.",group_new_placeholder:"Add group\u2026",group_delete_confirm:'Delete group "{name}"?',groups_manage_tasks:"Manage task assignments\u2026",groups_open_panel:"Open in panel",unassigned:"Unassigned",no_area:"No area",has_overdue:"Has overdue tasks",object:"Object",settings_panel_access:"Panel access",settings_panel_access_desc:"Admins always have full access. To delegate create, edit and delete to specific non-admins, switch this on and pick them below \u2014 everyone else sees only Complete and Skip.",settings_operator_write:"Allow selected users to create, edit & delete",settings_operator_write_desc:"Off: only admins can change content. On: the selected users below get full access too.",no_non_admin_users:"No non-admin users found. Add some in Settings \u2192 People.",owner_label:"Owner",feat_completion_actions:"Completion actions",feat_completion_actions_desc:"Per-task HA action on complete + quick-complete QR with pre-set values.",on_complete_action_title:"On complete: trigger HA action (optional)",on_complete_action_desc:"Calls an HA service when the task is completed \u2014 e.g. reset a counter on the device.",on_complete_action_target:"Target entity",on_complete_action_target_hint:"Note: the entity domain must match the service \u2014 e.g. 'button.press' only works on button.*, 'counter.increment' only on counter.*, 'input_button.press' only on input_button.* etc. On a mismatch the action will silently fail (HA logs 'Referenced entities ... missing or not currently available').",on_complete_action_data:"Data (JSON, optional)",on_complete_action_test:"Validate configuration",on_complete_action_test_success:"\u2713 Configuration valid (action will fire only on task completion)",on_complete_action_test_failed:"Failed",quick_complete_defaults_title:"Quick-complete defaults (for QR scans, optional)",quick_complete_defaults_desc:"Pre-set values for quick-complete QR scans. Without these, the QR opens the complete dialog.",quick_complete_defaults_notes:"Notes",quick_complete_defaults_cost:"Cost",quick_complete_defaults_duration:"Duration (minutes)",quick_complete_defaults_feedback_none:"No feedback",quick_complete_defaults_feedback_needed:"Was needed",quick_complete_defaults_feedback_not_needed:"Not needed",quick_complete_success:"Quickly marked complete",show_all_objects:"Show all objects",show_all_tasks:"Clear filter \u2014 show all tasks",filter_to_overdue:"Filter task list to overdue only",filter_to_due_soon:"Filter task list to due-soon only",filter_to_triggered:"Filter task list to triggered only",open_task:"Open task",show_details:"Show history + stats",hide_details:"Hide details",history_empty:"No history yet.",history_edit_button:"Edit entry",total_cost:"Total cost",times_performed:"Performed",older_entries:"older",open_in_panel:"Open in Maintenance panel",skip_reason:"Skip reason (optional)",reset_to_date:"Reset last_performed to",delete_task_confirm:"Delete this task and its history?",delete_object_confirm:"Delete this object and all its tasks?",loading:"Loading\u2026",archive:"Archive",undo:"Undo",task_archived:"Task archived",object_archived:"Object archived",unarchive:"Unarchive",archived:"Archived",show_archived:"Show archived",hide_archived:"Hide archived",section_collapse:"Collapse section",section_expand:"Expand section",confirm_archive_object:"Archive this object and its tasks? They keep their history and can be unarchived later.",settings_archive:"Archive & Retention",settings_archive_desc:"Retire completed one-off tasks without deleting them. Archived items are hidden and inert but keep their history and cost.",settings_archive_oneoff_days:"Auto-archive completed one-off tasks after (days, 0 = off)",settings_delete_archived_oneoff_days:"Auto-delete archived one-off tasks after (days, 0 = never)",archive_object:"Archive object",unarchive_object:"Unarchive object",documents:"Documents",documents_empty:"No documents yet.",doc_upload:"Upload file",doc_uploading:"Uploading\u2026",doc_add_link:"Add link",doc_link_url:"URL (https://\u2026)",doc_link_title:"Title (optional)",doc_open:"Open",doc_delete_confirm:'Delete "{name}"?',doc_too_large:"File is too large (max 25 MB).",doc_upload_failed:"Upload failed.",completion_photos_optional:"Completion photos (optional)",completion_photos:"Completion photos",choose_photos:"Choose photos",choose_photo:"Choose photo",photos_android_hint:"The Android app hands over one photo per pick \u2014 each pick is added.",photos_limit:"Up to {max} photos per completion",history_edit_photos_hint:"Removing a photo here keeps the file in the object's documents.",uploading:"Uploading\u2026",remove:"Remove",doc_deduped:"Already stored elsewhere \u2014 shared, no extra space used.",doc_dup_in_object:"This file is already attached to this object.",doc_link_invalid:"Only http/https links are allowed.",doc_cat_manual:"Manual",doc_cat_warranty:"Warranty",doc_cat_invoice:"Invoice",doc_cat_spare_parts:"Spare parts",doc_cat_photo:"Photo",doc_cat_other:"Other",doc_link_badge:"Link",doc_storage_title:"Document storage",doc_storage_saved:"Saved via deduplication",doc_storage_refresh:"Refresh",doc_download:"Download",doc_close:"Close",doc_camera:"Take photo",camera_capture_shoot:"Capture",camera_switch_lens:"Switch camera",doc_drop_hint:"Drop files here",doc_task_none:"No documents linked to this task.",doc_link_existing:"Link a document\u2026",doc_attach:"Link",doc_unlink:"Unlink",doc_page:"Page",chart_range_7d:"7d",chart_range_30d:"30d",chart_range_90d:"90d",chart_range_1y:"1y",chart_since_service:"since last service",chart_no_stats:"No long-term statistics for this entity \u2014 showing maintenance-event values only",auto_complete_on_recovery:"Auto-complete when the sensor recovers",auto_complete_on_recovery_help:"Records a completion (sets last performed) when the trigger clears itself \u2014 e.g. salt refilled, filter replaced.",doc_search:"Search documents\u2026",doc_search_none:"No matching documents",doc_description:"Description (optional)",doc_sort:"Sort documents",doc_sort_newest:"Newest first",doc_sort_oldest:"Oldest first",doc_sort_title:"By title (1, 2, 3 \u2026)",doc_sort_category:"By category",link_device_optional:"Link to existing device (optional)",parent_object_optional:"Parent object (optional)",parent_none:"(No parent)",paused:"Paused",pause_object:"Pause",resume_object:"Resume",pause_until_prompt:"Freeze this object's schedules \u2014 nothing becomes due and nothing notifies until it is resumed. Optionally set an auto-resume date.",pause_until_label:"Resume on (optional)",object_paused:"Object paused",object_resumed:"Object resumed \u2014 schedules restarted",object_paused_badge:"Paused",paused_until_label:"until",replace_object:"Replace\u2026",replace_object_prompt:"Retire this object and create a successor. History and costs stay archived on the old one; tasks and documents carry over to the new one, counters start fresh.",replace_name_label:"Successor name",object_replaced:"Object replaced \u2014 successor created",reading_unit_label:"Reading unit (e.g. kWh, m\xB3)",reading_unit_help:"Shown next to the recorded value when completing this task.",reading_value_label:"Reading value",reading_label:"Reading",readings_section:"Readings",readings_hint:"Several named values per completion \u2014 one row per meter. Leave empty to record a single value.",reading_name_label:"Reading name",reading_unit_short:"Unit",reading_add:"Add reading",reading_duplicate_name:"Name already used",reading_last:"last: {value}",reading_below_last:"Lower than the last reading ({value})",settings_templates_label:"Template gallery",settings_templates_hint:`Untick templates you'll never need \u2014 they disappear from the "From template" pickers (panel and config flow). Nothing else changes; you can re-enable them any time.`,worksheet:"Work sheet",worksheet_scan_view:"Scan to open the task",worksheet_scan_complete:"Scan to complete",worksheet_manual_excerpt:"Manual excerpt",worksheet_pages:"pages",worksheet_printed:"Printed",worksheet_never:"Never",card_all_caught_up:"All caught up \u2014 nothing needs attention",postpone:"Postpone",postpone_date_prompt:"Postpone this occurrence to which date?",postpone_date_label:"New due date",postponed:"Postponed",postponed_to:"Postponed to",season_window_label:"Seasonal window (months)",season_window_hint:"Only due in the selected months; off-season dates roll to the next active month. None = all year.",series_end_label:"Ends",series_end_never:"Never (repeats indefinitely)",series_end_after_count:"After a number of times",series_end_until:"On a date",series_end_count_label:"Number of times",series_end_until_label:"End date",parts_section:"Parts & consumables",parts_inventory_value:"Inventory value",part_add:"Add part",part_name:"Name",part_vendor:"Manufacturer",part_storage_location:"Storage location",part_product_url:"Product URL",part_unit:"Unit",part_cost:"Unit price",part_stock:"Stock",part_reorder_threshold:"Reorder at",part_restock_quantity:"Restock quantity",part_auto_buy:"Auto-create buy task when low",part_restock:"Adjust stock",parts_used_by:"Used by",restock_quantity_label:"Quantity bought",consumes_parts_label:"Consumes parts",shared_parts_other_objects:"Parts from other objects",shared_parts_help:"Several objects can share one stock. Completing this task takes from the owning object.",shared_part_unknown:"Unknown part",parts_load_failed:"Couldn't load this object's parts \u2014 the consumes-parts options are unavailable right now.",adopt_problem_button:"Adopt problem sensors",adopt_problem_title:"Adopt problem sensors",adopt_problem_hint:"Turn HA problem sensors (printer errors, filter warnings, low battery) into maintenance tasks that trigger while the problem is active and clear themselves when it resolves.",adopt_problem_none:"No problem sensors found that aren't already tracked.",adopt_problem_active:"active",adopt_problem_ok:"ok",adopt_problem_new_object:"(new)",adopt_problem_adopt:"Adopt selected",adopt_problem_done:"Adopted {tasks} problem sensor(s)",views_label:"Views",views_none:"\u2014 No view \u2014",views_manage:"Save / manage views",views_dialog_title:"Saved views",views_dialog_hint:"Save the current filters as a named view everyone can reuse.",views_name_placeholder:"View name",views_save_current:"Save current filters",views_none_yet:"No saved views yet.",close:"Close",trigger_hint_now:"The sensor reads {value} right now.",trigger_hint_above:"The task triggers once it rises above {target}.",trigger_hint_below:"It triggers once it falls below {target}.",trigger_hint_overlap:"These limits overlap: every reading triggers the task and it can never recover. Leave one of them empty.",trigger_hint_counter_delta:"Counts from the current reading ({value}): due at {due} (+{target}), and the count restarts after each completion.",trigger_hint_counter_delta_edit:"Counts usage since the last completion: due after +{target}; the count restarts after each completion.",trigger_hint_counter_abs:"The task becomes due once the sensor reaches {target}.",trigger_hint_runtime:"The task becomes due after {hours} h of accumulated on-time; the counter restarts after each completion.",trigger_hint_state_change:"The task becomes due after {count} state change(s).",trigger_hint_state_change_to:"The task becomes due after {count} change(s) to \u201C{state}\u201D.",trigger_hint_state_now:"Current state: {value}.",adopt_problem_part:"Uses part: {name}",label_filter:"Label",all_labels:"All labels",settings_notify_scope:"Notify only for view",settings_notify_scope_all:"All tasks",settings_notify_scope_hint:"Only tasks matching the selected saved view's label/user filters send reminders. Status, sorting and grouping of the view are ignored here.",settings_notify_completed:"Completion notifications",settings_notify_completed_hint:`Household news when a task is completed, with the reason and who did it. "Automatic only" announces just the completions nobody made on the spot: sensor recovery, shopping-list check-off, an automation's service call. Sent to the household service only; quiet hours and the daily cap apply.`,notify_completed_off:"Off",notify_completed_automatic:"Automatic completions only",notify_completed_all:"All completions",settings_notify_rule:"Your own notification rule",settings_notify_rule_hint:"Every notification also fires the event maintenance_supporter_notification (kind, status, object, task, reference numbers, priority, deep link, the payload). Route it with an automation \u2014 e.g. into Ticker, Telegram or Pushover.",settings_notify_event_only:"Only fire the event, send nothing myself",settings_notify_event_only_hint:"Your automation is the whole delivery. Rate limits, quiet hours and the daily cap still apply to when the event fires.",settings_notify_extra_data:"Extra notification data (template)",settings_notify_extra_data_hint:"JSON or YAML, Jinja allowed; merged into the notify call's data (your keys win). Variables: kind, status, priority, labels, notes, area_name, object_name, task_name, object_ref, task_ref, days_until_due, next_due, last_performed, responsible_user_id, sensor_entity_id, url, target, title, message. Test it with the Send test button.",card_saved_view:"Saved view",card_saved_view_none:"None",card_saved_view_help:"Applies the view's status, user and label filters on top of the filters above. The view's sorting and grouping are panel display settings and are not applied on the card.",panel_card_tab:"Open on tab",panel_card_tab_default:"Remembered tab (as in the panel)",panel_card_view:"Open with saved view",panel_card_height:"Height",panel_card_height_help:"Empty = fill the screen below the card (panel view). Otherwise a CSS length such as 600px or 80vh for views with other cards.",panel_card_not_registered:"The Maintenance Supporter panel is not available \u2014 is the integration set up?",panel_card_load_failed:"The Maintenance Supporter panel could not be loaded \u2014 reload the page (after an update: clear the browser cache).",doc_part_none:"No documents linked to this part.",settings_templates_toggle_group:"Enable or disable all templates in this group",setups_button:"Suggested setups",setups_title:"Suggested setups (Beta)",setups_hint:"Devices of supported integrations whose consumable sensors can drive maintenance tasks. Adopting creates the object and wires each task to its sensor \u2014 it triggers when the consumable runs low and resolves itself after replacement.",setups_none:"No supported devices with unwired consumable sensors found.",setups_adopt:"Set up selected",setups_done:"{tasks} sensor-wired tasks created.",complete_parts_used:"Parts used this time",part_delete_confirm:"Delete part '{name}'? Its stock tracking, task links and any open buy reminder will be removed.",baseline_start_value:"Start reading (optional)",baseline_start_help:"Counting starts from this reading. Leave empty to count from the current value; enter the reading at the last service so usage since then already counts.",setups_baseline_hint:"reading at last service (optional)",baseline_start_help_edit:"Leave empty to keep the existing counting. Entering a value re-anchors the counting (e.g. the reading at the last service).",baseline_current_effective:"Currently effective start value: {value}",runtime_on_states:"Active states",runtime_on_states_help:"States that count as running \u2014 default: on. E.g. mowing, cleaning, printing. With an attribute selected, its values are matched instead.",runtime_max_session:"Max session runtime (seconds)",runtime_max_session_help:"A single run counts at most this many seconds \u2014 protects against a sensor stuck ON (lost connection, restart). Empty = no cap.",trend_approaching:"Heading toward the threshold",trend_easing:"Easing away from the threshold",split_select_hint:"Select a task to see its details here",setups_target_new:"Create new: {name}",schedule_preview_title:"Next dates",schedule_preview_ontime:"Assuming on-time completion.",schedule_preview_ends:"(series ends)",adopt_problem_responsible:"Responsible user for all adopted tasks (optional)",adopt_for_minutes_hint:"Only trigger once the problem has persisted this long \u2014 0 reacts to the first flicker.",adopt_problem_configure:"Configure",history_auto:"Automatic",battery_fleet_title:"Battery fleet",battery_fleet_none_low:"All batteries OK \u2014 nothing to replace.",battery_fleet_buy_now:"Buy now",battery_fleet_soon:"Needed soon",battery_fleet_soon_hint:"Predicted from the last replacement date \u2014 order ahead.",battery_fleet_mark_all:"Mark all replaced",battery_fleet_mark_one:"Mark this battery replaced",battery_fleet_offline:"offline",battery_fleet_no_sensor:"No sensor",battery_fleet_trigger_lost:"This task's sensor trigger was lost \u2014 it will not fire or auto-complete.",battery_fleet_repair:"Repair",battery_fleet_exclude:"Exclude from the fleet",battery_fleet_excluded:"Excluded",battery_fleet_include:"Track again",battery_fleet_all:"All tracked batteries",battery_fleet_all_hint:"Exclude a device here to drop it from the fleet before it ever reports low \u2014 a vacuum that recharges itself, or a phone that warns you on its own.",battery_fleet_add:"Add a battery",battery_fleet_add_hint:"Pick a battery sensor the automatic discovery missed \u2014 it joins the roster immediately.",battery_fleet_track_self:"Track self-charging batteries",battery_fleet_track_self_hint:"Phones, vacuums and other devices that recharge themselves appear as rechargeables \u2014 a low one asks for a charge, never for new cells.",battery_fleet_due_without_sensor:"Treat a passed forecast as due when a battery has no sensor",battery_fleet_due_without_sensor_hint:"Some devices report no battery level at all \u2014 Battery Notes only knows the type and the last replacement. Once the typical lifetime has passed, such a battery counts as low and the fleet task reminds you; marking it replaced resets the forecast.",battery_fleet_status_low:"Low",battery_fleet_status_soon:"Soon",battery_fleet_status_ok:"Healthy",battery_fleet_status_due:"Due",battery_fleet_predicted_on:"Expected around {date}",battery_fleet_predicted_typical:"Expected around {date} \u2014 {months} months typical for {type} ({source})",lifetime_source_default:"built-in default",lifetime_source_table:"built-in table",lifetime_source_learned:"learned from {n} replacements",lifetime_source_override:"your setting",lifetime_source_learned_device:"learned from this device's {n} replacements",lifetime_source_learned_model:"learned from {n} replacements on devices of this model",battery_fleet_predicted_trend:"Predicted from this battery's discharge trend: around {date} ({confidence})",battery_fleet_rechargeable:"Rechargeable: charge instead of replacing \u2014 never on the shopping list",battery_fleet_sort_name:"Sort by name",battery_fleet_sort_urgency:"Sort by urgency",battery_fleet_mark_recharged:"Mark as recharged",battery_fleet_sparkline_hint:"Battery level over the last 30 days \u2014 dotted: projected until the low threshold",battery_fleet_filter_type:"Show only this battery type",battery_fleet_record_replacement:"The level jumped around {date} \u2014 record this replacement in Battery Notes",battery_fleet_total:"{n} batteries tracked",battery_fleet_setup_button:"Battery fleet",battery_fleet_setup_done:"Battery fleet set up \u2014 one task tracks all your batteries.",update_banner:"A newer version of Maintenance Supporter is on the server \u2014 reload to update the panel.",update_reload:"Reload",row_actions_banner:"Complete and Skip in task rows are now buttons. Prefer the old icons?",row_actions_keep:"Keep buttons",row_actions_back:"Back to icons",battery_fleet_forecast_overdue:"Predicted date passed \u2014 the battery still reports healthy. If you swapped it, record the replacement; otherwise the forecast was off.",cost_from_parts:"Use \u2248 {amount} from parts",dismiss:"Dismiss",gs_label:"Getting started \u2014 these hints retire as your setup grows",gs_setups_chip:"Suggested setups found {n} devices with pre-wired triggers",gs_adopt_chip:"{n} problem sensors can become maintenance tasks",gs_fleet_chip:"One click sets up the battery fleet",cal_editor_window:"Default window",cal_editor_window_week:"Week (7 days)",cal_editor_window_fortnight:"Fortnight (14 days)",cal_editor_window_month:"Month (30 days, default)",cal_editor_window_year:"Year (365 days, empty days collapsed)",cal_editor_show_chips:"Show window chips inside the card",cal_editor_chips_hint:"Hide the chips when the card is embedded in a strategy view that already serves as the window selector.",cal_editor_show_user_filter:"Show user filter dropdown",cal_editor_default_user:"Default user filter",cal_editor_my_tasks:"My tasks (current user)",cal_editor_show_object_filter:"Show object filter dropdown",cal_editor_object_hint:'Pre-select one object via YAML: object_filter: "" \u2014 or a list of names to restrict the card to several objects.',object_history_section:"History (all tasks)",object_history_all_tasks:"All tasks",object_history_empty:"No entries in this range.",object_history_cap_note:"History keeps up to 500 entries per task \u2014 very old entries may be missing.",service_record_title:"Service record",service_record_print:"Service record (PDF)",date:"Date",service_record_entries:"entries",ref_number:"Reference number",print_options_title:"Print service record",print_layout:"Layout",print_layout_chronological:"Chronological",print_layout_by_task:"By task",print_include:"Include",print_inc_readings:"Readings",print_inc_parts:"Parts used",print_inc_photos:"Photos",print_inc_documents:"Linked documents",print_inc_doc_desc:"Document descriptions",print_inc_checklist:"Checklist",print_inc_notes:"Notes",print_inc_costs:"Cost and duration",print_inc_person:"Completed by",print_inc_refs:"Reference numbers",print_inc_bare:"Completions without details",print_inc_qr:"QR code per task",print_button:"Print",report_scan_hint:"Scan to open the task",completed_by:"Completed by",date_from:"From",date_to:"To",phases_section:"Cycle phases (optional)",phases_hint:"Different work on one shared schedule \u2014 each completion moves to the next step (e.g. small service, small service, big service).",phase_add:"Add phase",phase_name:"Phase name",phase_sequence_label:"Cycle order",phase_sequence_add_step:"Add step",phase_current:"Current phase",phase_set:"Set as current",chart_history_fallback:"No long-term statistics for this entity \u2014 showing recorder state history (typically the last ~10 days)",chart_history_alarm:"Trigger view from recorder state history: 1 = alert state held for the hold time, 0 = fine (typically the last ~10 days)",chart_history_count:"Change count rebuilt from recorder state history since the last service (typically the last ~10 days)",prediction_cycles:"Learned from cycles",phase_require_override:"Override \u201CRequire on completion\u201D for this phase",history_add_past:"Add past completion",require_tag_scan:"Only complete by scanning the tag",require_tag_scan_help:"Proof of presence: Done is blocked on every surface until the NFC tag or QR code on the thing itself is scanned. Automations can pass 'via_tag_scan' to the complete service.",disallow_skip:"Don't allow skipping",disallow_skip_help:"The Skip action disappears from every surface, and the server refuses a skip from automations and voice too.",no_notifications:"No notifications for this task",no_notifications_help:"No reminders for this task \u2014 no status notifications, repeats, lead-time reminders or bundles. It still shows on the dashboard and in its entities; the weekly digest still counts it.",require_tag_scan_hint:"This task completes only by scanning its NFC tag or QR code on the thing itself \u2014 saving here will be refused."}});var nr,ar=w(()=>{"use strict";nr="2.87.0"});var ve,Ut,or=w(()=>{"use strict";ve={ok:"var(--success-color, #4caf50)",due_soon:"var(--warning-color, #ff9800)",overdue:"var(--error-color, #f44336)",triggered:"var(--deep-orange-color, #ff5722)",archived:"var(--disabled-color, #9e9e9e)",paused:"var(--info-color, #2196f3)"},Ut={ok:"mdi:check-circle",due_soon:"mdi:alert-circle",overdue:"mdi:alert-octagon",triggered:"mdi:bell-alert",archived:"mdi:archive-outline",paused:"mdi:pause-circle-outline",completed:"mdi:check-circle",skipped:"mdi:skip-next",missed:"mdi:calendar-remove",reset:"mdi:refresh"}});function le(s){return s?.currency_symbol||tn}function rn(s){be.en=Object.assign({},s,be.en??{})}function Qe(s){let r=(s||Bt).toLowerCase();return r.startsWith("pt")&&r.endsWith("br")?"pt-br":r.substring(0,2)}function n(s,r){let e=Qe(r);return be[e]?.[s]??be.en[s]??s}function pt(s,r){r.has("hass")&&Wt(s.hass?.locale,s.hass?.config?.country);let e=s.hass?.language;e&&!Vt(e)&&Je(e).then(()=>s.requestUpdate())}function P(s){return s?.language||"en"}function Vt(s){let r=Qe(s);return r===Bt||r in be}function Je(s){let r=Qe(s);return r===Bt||r in be||!sn.has(r)?Promise.resolve():(r in Ke||(Ke[r]=fetch(`${nn}/${r}.json?v=${nr}`).then(e=>e.ok?e.json():null).then(e=>{e?be[r]=e:delete Ke[r]}).catch(()=>{delete Ke[r]})),Ke[r])}function dr(s){let r=Qe(s);return{de:"de-DE",en:"en-US",nl:"nl-NL",fr:"fr-FR",it:"it-IT",es:"es-ES",pt:"pt-PT",ru:"ru-RU",uk:"uk-UA",zh:"zh-CN",da:"da-DK",fi:"fi-FI",nb:"nb-NO",ja:"ja-JP",hi:"hi-IN",pl:"pl-PL",cs:"cs-CZ",sv:"sv-SE","pt-br":"pt-BR",hu:"hu-HU",ko:"ko-KR",tr:"tr-TR"}[r]??"en-US"}function an(s){pr.decimals=typeof s=="number"&&Number.isInteger(s)&&s>=0&&s<=3?s:0}function on(){return pr.decimals??0}function ht(s){s&&s.currency_decimals!==void 0&&s.currency_decimals!==null&&an(Number(s.currency_decimals))}function Wt(s,r){s&&(te.date=s.date_format,te.time=s.time_format,te.number=s.number_format,r!==void 0&&(te.country=r||void 0))}function ln(s){switch(te.number){case"comma_decimal":return["en-US","en"];case"decimal_comma":return["de","es","it"];case"space_comma":return["fr","sv","cs"];case"system":return;default:return dr(s)}}function O(s,r,e){if(!Number.isFinite(s))return String(s);let t=typeof e=="number"?{minimumFractionDigits:e,maximumFractionDigits:e}:{maximumFractionDigits:2,...e};if(te.number==="none"){let i=Math.pow(10,t.maximumFractionDigits??2);return String(Math.round(s*i)/i)}try{return new Intl.NumberFormat(ln(r),t).format(s)}catch{return new Intl.NumberFormat(void 0,t).format(s)}}function Ae(s,r,e,t){let i=O(s,e,t??on());return r?`${i} ${r}`:i}function Te(s){let r=dr(s),e=te.country;if(e&&/^[A-Za-z]{2}$/.test(e)){let t=`${Qe(s).split("-")[0]}-${e.toUpperCase()}`;try{return new Intl.DateTimeFormat(t),t}catch{}}return r}function hr(s,r){let e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),i=String(s.getFullYear());switch(te.date){case"DMY":return`${e}/${t}/${i}`;case"MDY":return`${t}/${e}/${i}`;case"YMD":return`${i}-${t}-${e}`;case"system":return s.toLocaleDateString(void 0,{day:"2-digit",month:"2-digit",year:"numeric"});default:return s.toLocaleDateString(Te(r),{day:"2-digit",month:"2-digit",year:"numeric"})}}function ur(s,r){switch(te.time){case"12":return s.toLocaleTimeString(Te(r),{hour:"2-digit",minute:"2-digit",hour12:!0});case"24":return s.toLocaleTimeString(Te(r),{hour:"2-digit",minute:"2-digit",hour12:!1});case"system":return s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});default:return s.toLocaleTimeString(Te(r),{hour:"2-digit",minute:"2-digit"})}}function F(s,r){if(!s)return"\u2014";try{let e=s.includes("T")?s:s+"T00:00:00";return hr(new Date(e),r)}catch{return s}}function _r(s,r){if(!s)return"\u2014";try{let e=new Date(s);return hr(e,r)+" "+ur(e,r)}catch{return s}}function Kt(s,r){if(s==null)return"\u2014";let e=r||"en";return s<0?`${Math.abs(s)} ${n("d_overdue",e)}`:s===0?n("today",e):`${s} ${n(s===1?"day":"days",e)}`}function Ye(s,r,e){return s==null?"\u2014":`${s} ${n("unit_"+(r||"days"),e)}`}function ut(s,r){return s==null?"\u2014":`${O(s,r,{maximumFractionDigits:1})} ${n("minutes_short",r)}`}function Ge(s,r,e="long"){return new Date(Date.UTC(2024,0,1+s)).toLocaleDateString(Te(r),{weekday:e,timeZone:"UTC"})}function mr(s,r,e="long"){return new Date(Date.UTC(2024,s,1)).toLocaleDateString(Te(r),{month:e,timeZone:"UTC"})}function gr(s,r){let e=s.schedule;if(s.schedule_type==="sensor_based"){let i=n("sensor_based",r),a=e&&e.kind==="interval"&&e.every?e.every:s.interval_days;return a?`${i} \xB7 ${Ye(a,(e&&e.kind==="interval"?e.unit:s.interval_unit)||"days",r)}`:i}let t=e?.offset?` ${e.offset>0?"+":"\u2212"}${Math.abs(e.offset)}d`:"";switch(e?.kind){case"weekdays":return((e.weekdays||[]).map(i=>Ge(i,r,"short")).join(" & ")||"\u2014")+t;case"nth_weekday":return e.weekday==null||e.nth==null?"\u2014":`${e.nth===-1?n("ord_last",r):n("ord_"+e.nth,r)} ${Ge(e.weekday,r,"long")}${t}`;case"day_of_month":return e.day==null?"\u2014":(e.day===-1?n(e.business?"last_business_day_month":"last_day_month",r):`${n("day_word",r)} ${e.day}`)+t;case"one_time":return s.due_date?F(s.due_date,r):n("one_time",r);case"manual":return n("manual",r);case"interval":return Ye(e.every,e.unit,r)}return s.schedule_type==="one_time"?s.due_date?F(s.due_date,r):n("one_time",r):s.schedule_type==="manual"?n("manual",r):s.schedule_type==="sensor_based"?n("sensor_based",r):s.interval_days!=null?Ye(s.interval_days,s.interval_unit,r):"\u2014"}function fr(s,r){s.currentTarget.dispatchEvent(new CustomEvent("hass-more-info",{detail:{entityId:r},bubbles:!0,composed:!0}))}var tn,Bt,lr,be,sn,nn,Ke,cr,te,pr,vr,dn,cn,_t,C=w(()=>{"use strict";I();rr();ar();or();tn="\u20AC";Bt="en",lr=(()=>{let s=window;return s.__msLocales||(s.__msLocales={store:{},inflight:{}}),s.__msLocales})(),be=lr.store;rn(sr);sn=new Set(["de","nl","fr","it","es","pt","pt-br","ru","uk","pl","cs","sv","zh","da","fi","nb","ja","hi","hu","ko","tr"]),nn="/maintenance_supporter_locales",Ke=lr.inflight;cr=window,te=cr.__msDateTimePrefs??={},pr=cr.__msMoneyPrefs??={};vr=k` +Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:"{field}: too long (max {n} characters)",err_too_short:"{field}: too short (min {n} characters)",err_value_too_high:"{field}: too large (max {n})",err_value_too_low:"{field}: too small (min {n})",err_required:"{field}: required",err_wrong_type:"{field}: wrong type (expected: {type})",err_invalid_choice:"{field}: not an allowed value",err_invalid_value:"{field}: invalid value",ws_err_not_found:"Not found \u2014 it may have been deleted meanwhile",ws_err_invalid_input:"Invalid input",ws_err_invalid_date:"Invalid date",ws_err_invalid_format:"Invalid format",ws_err_invalid_url:"Invalid link",ws_err_invalid_mirror_todo:"Invalid to-do list",ws_err_not_configured:"Not set up yet",ws_err_not_loaded:"Not loaded yet \u2014 try again in a moment",ws_err_limit_reached:"Limit reached",ws_err_too_many:"Too many entries",ws_err_too_large:"Too large",ws_err_not_archived:"Not archived",ws_err_invalid_target:"Invalid target",ws_err_create_failed:"Could not be created",ws_err_archived:"Archived \u2014 restore it first",ws_err_already_archived:"Already archived",ws_err_unavailable:"Currently unavailable",ws_err_unauthorized:"Not permitted for your user",ws_err_too_many_views:"Too many saved views",ws_err_storage_unavailable:"Storage is not available",ws_err_replace_failed:"Replacement failed",ws_err_not_paused:"Not paused",ws_err_not_available:"Nothing available",ws_err_no_url:"No link given",ws_err_no_phases:"This task has no phases",ws_err_invalid_view:"Invalid view",ws_err_invalid_user:"Unknown user",ws_err_invalid_range:"Invalid range",ws_err_invalid_parent:"Invalid parent object",ws_err_invalid_device:"Unknown device",ws_err_empty_csv:"The CSV file is empty",ws_err_empty:"Nothing to import",ws_err_duplicate_failed:"Could not duplicate",ws_err_already_paused:"Already paused",ws_err_invalid_cursor:"Invalid phase position",ws_err_invalid_entity_slug:"Invalid entity name",ws_err_invalid_trigger_config:"Invalid trigger configuration",ws_err_no_defaults:"No quick-complete defaults set",ws_err_self_link_device:"An object cannot be linked to itself",ws_err_too_early:"Too early \u2014 this task can only be completed closer to its due date",ws_err_invalid_search_template:"The search link must be an http(s) URL containing {q}",feat_schedule_time:"Time-of-day scheduling",feat_schedule_time_desc:"Tasks become overdue at a specific time of day instead of midnight.",schedule_time_toggle:"Due at a specific time",schedule_time_help:"Empty = midnight (default). HA timezone.",at_time:"at",notes_optional:"Notes (optional)",notes_markdown_hint:"Markdown is supported \u2014 **bold**, lists, [links](\u2026)",cost_optional:"Cost (optional)",duration_minutes:"Duration in minutes (optional)",completed_at_optional:"Completed at (optional, empty = now)",completed_at_pick:"Set date & time",completed_at_future_error:"The completion date cannot be in the future.",days:"days",day:"day",today:"Today",d_overdue:"d overdue",no_tasks:"No maintenance tasks yet. Create an object to get started.",no_tasks_short:"No tasks",no_history:"No history entries yet.",show_all:"Show all",cost_duration_chart:"Cost & Duration",installed:"Installed",confirm_delete_object:"Delete this object and all its tasks?",confirm_delete_task:"Delete this task?",min:"Min",max:"Max",save:"Save",saving:"Saving\u2026",edit_task:"Edit Task",new_task:"New Maintenance Task",task_name:"Task name",maintenance_type:"Maintenance type",priority:"Priority",labels:"Labels",labels_placeholder:"e.g. safety, seasonal, tenant-visible",labels_help:"Comma-separated tags for filtering and reporting.",task_mirror_todo:"Mirror into to-do lists",task_mirror_todo_hint:"The task appears in these lists while it is due; checking it off there completes it here.",priority_low:"Low",priority_normal:"Normal",priority_high:"High",all_priorities:"All priorities",schedule_type:"Schedule type",interval_days:"Interval (days)",warning_days:"Warning days",earliest_completion_days:"Earliest completion (days before due)",earliest_completion_days_help:"Leave empty to allow completing any time. 0 = only on/after the due date.",last_performed_optional:"Last performed (optional)",interval_anchor:"Interval anchor",anchor_completion:"From completion date",anchor_planned:"From planned date (no drift)",edit_object:"Edit Object",name:"Name",manufacturer_optional:"Manufacturer (optional)",model_optional:"Model (optional)",serial_number_optional:"Serial number (optional)",serial_number_label:"S/N",documentation_url_label:"Manual",object_notes_label:"Notes",sort_due_date:"Due date",sort_object:"Object name",sort_type:"Type",sort_task_name:"Task name",all_objects:"All objects",all_parts:"All parts",tasks_lower:"tasks",no_tasks_yet:"No tasks yet",add_first_task:"Add first task",trigger_configuration:"Trigger Configuration",entity_id:"Entity ID",comma_separated:"comma-separated",entity_logic:"Entity logic",entity_logic_any:"Any entity triggers",entity_logic_all:"All entities must trigger",entities:"entities",attribute_optional:"Attribute (optional, blank = state)",use_entity_state:"Use entity state (no attribute)",trigger_above:"Trigger above",trigger_below:"Trigger below",trigger_equals:"Trigger when equal to (=)",trigger_not_equals:"Trigger when different from (\u2260)",for_at_least_minutes:"For at least (minutes)",safety_interval:"Safety interval (optional)",trigger_combinator:"Combine trigger and interval",trigger_combinator_any:"Trigger or interval (whichever first)",trigger_combinator_all:"Trigger and interval (both required)",delta_mode:"Delta mode",from_state_optional:"From state (optional)",to_state_optional:"To state (optional)",documentation_url_optional:"Documentation URL (optional)",object_notes_optional:"Notes (optional)",nfc_tag_id_optional:"NFC Tag ID (optional)",nfc_tags_empty_help:"No NFC tags registered in Home Assistant yet.",nfc_tags_open_settings:"Open Tags settings",nfc_tags_refresh:"Refresh",environmental_entity_optional:"Environmental sensor (optional)",environmental_entity_helper:"e.g. sensor.outdoor_temperature \u2014 adjusts the interval based on environmental conditions",adaptive_prediction_enabled:"Enable sensor-driven predictions",adaptive_seasonal_enabled:"Enable seasonal awareness",adaptive_max_interval:"Maximum interval (days)",adaptive_min_interval:"Minimum interval (days)",adaptive_ewa_alpha:"Learning rate (alpha)",adaptive_enabled:"Enable adaptive scheduling",adaptive_section_title:"Adaptive Scheduling",environmental_attribute_optional:"Environmental attribute (optional)",nfc_tag_id:"NFC Tag ID",nfc_linked:"NFC tag linked",nfc_link_hint:"Click to link NFC tag",responsible_user:"Responsible User",shared_with:"Shared with (rotation)",shared_with_help:"Pick multiple people to share this task; the responsible person rotates on each completion.",rotation_strategy:"Rotation",rotation_none:"No rotation",rotation_round_robin:"Round-robin",rotation_least_completed:"Least completed",rotation_random:"Random",no_user_assigned:"(No user assigned)",all_users:"All Users",my_tasks:"My Tasks",tab_calendar:"Calendar",cal_no_events:"No maintenance",cal_every_n_days:"every {n} days",cal_source_time:"Time-based",cal_source_time_adaptive:"Time-based (adaptive)",cal_source_sensor:"Sensor-based",cal_predicted:"predicted",cal_confidence_high:"high confidence",cal_confidence_medium:"medium confidence",cal_confidence_low:"low confidence",budget_monthly:"Monthly budget",budget_yearly:"Yearly budget",groups:"Groups",new_group:"New group",edit_group:"Edit group",no_groups:"No groups yet",delete_group:"Delete group",delete_group_confirm:"Delete group '{name}'?",group_select_tasks:"Select tasks",group_name_required:"Name is required",description_optional:"Description (optional)",selected:"Selected",loading_chart:"Loading chart data...",hide_outliers:"Hide outliers (sensor glitches)",was_maintenance_needed:"Was this maintenance needed?",feedback_needed:"Needed",feedback_not_needed:"Not needed",feedback_not_sure:"Not sure",suggested_interval:"Suggested interval",apply_suggestion:"Apply",reanalyze:"Re-analyze",reanalyze_result:"New analysis",reanalyze_insufficient_data:"Not enough data to produce a recommendation",data_points:"data points",dismiss_suggestion:"Dismiss",confidence_low:"Low",confidence_medium:"Medium",confidence_high:"High",recommended:"recommended",seasonal_awareness:"Seasonal Awareness",edit_seasonal_overrides:"Edit seasonal factors",seasonal_overrides_title:"Seasonal factors (override)",seasonal_overrides_hint:"Factor per month (0.1\u20135.0). Empty = learned automatically.",seasonal_override_invalid:"Invalid value",seasonal_override_range:"Factor must be between 0.1 and 5.0",clear_all:"Clear all",clear:"Clear",date_type_toggle:"Type the date",date_type_invalid:"Not a valid date \u2014 try 1978-03-15, a year like 1978, or your own date format",seasonal_chart_title:"Seasonal Factors",seasonal_learned:"Learned",seasonal_manual:"Manual",month_jan:"Jan",month_feb:"Feb",month_mar:"Mar",month_apr:"Apr",month_may:"May",month_jun:"Jun",month_jul:"Jul",month_aug:"Aug",month_sep:"Sep",month_oct:"Oct",month_nov:"Nov",month_dec:"Dec",sensor_prediction:"Sensor Prediction",degradation_trend:"Trend",trend_rising:"Rising",trend_falling:"Falling",trend_stable:"Stable",trend_insufficient_data:"Insufficient data",days_until_threshold:"Days until threshold",threshold_exceeded:"Threshold exceeded",environmental_adjustment:"Environmental factor",sensor_prediction_urgency:"Sensor predicts threshold in ~{days} days",day_short:"day",weibull_reliability_curve:"Reliability Curve",weibull_failure_probability:"Failure Probability",weibull_r_squared:"Fit R\xB2",beta_early_failures:"Early Failures",beta_random_failures:"Random Failures",beta_wear_out:"Wear-out",beta_highly_predictable:"Highly Predictable",confidence_interval:"Confidence Interval",confidence_conservative:"Conservative",confidence_aggressive:"Optimistic",current_interval_marker:"Current interval",recommended_marker:"Recommended",characteristic_life:"Characteristic life",chart_mini_sparkline:"Trend sparkline",chart_history:"Cost and duration history",chart_seasonal:"Seasonal factors, 12 months",chart_weibull:"Weibull reliability curve",chart_sparkline:"Sensor trigger value chart",days_progress:"Days progress",qr_code:"QR Code",qr_generating:"Generating QR code\u2026",qr_error:"Failed to generate QR code.",qr_error_no_url:"No HA URL configured. Please set an external or internal URL in Settings \u2192 System \u2192 Network.",save_error:"Failed to save. Please try again.",subsave_warning:"Saved, but one setting was rejected: {detail}",qr_print:"Print",qr_download:"Download SVG",qr_action_view:"View maintenance info",qr_action_complete:"Mark maintenance as complete",qr_url_mode:"Link type",qr_mode_companion:"Companion App",qr_mode_local:"Local (mDNS)",qr_mode_server:"Server URL",overview:"Overview",recent_activities:"Recent Activities",search_notes:"Search notes",avg_cost:"Avg Cost",current:"Current",shorter:"Shorter",longer:"Longer",normal:"Normal",disabled:"Disabled",compound_logic:"Compound logic",compound:"Compound (multiple conditions)",compound_logic_and:"AND \u2014 all conditions must trigger",compound_logic_or:"OR \u2014 any condition triggers",compound_help:"Combine several sensor conditions into one trigger.",compound_no_conditions:"No conditions yet \u2014 add at least one.",compound_add_condition:"Add condition",compound_condition:"Condition",compound_remove_condition:"Remove condition",card_title:"Title",card_show_header:"Show header with statistics",card_show_actions:"Show action buttons",card_action_style:"Complete button style",card_compact:"Compact mode",card_max_items:"Max items (0 = all)",card_filter_status:"Filter by status",card_filter_status_help:"Empty = show all statuses.",card_filter_objects:"Filter by objects",card_filter_objects_help:"Empty = show all objects.",card_filter_areas:"Filter by areas",card_filter_areas_help:"Empty = show all areas.",card_filter_priority_help:"Empty = show all priorities. Tasks without an explicit priority count as Normal.",card_filter_entities:"Filter by entities (entity_ids)",card_filter_entities_help:"Pick sensor / binary_sensor entities from this integration. Empty = all.",card_loading_objects:"Loading objects\u2026",card_load_error:"Could not load objects \u2014 check the WebSocket connection.",card_no_tasks_title:"No maintenance tasks yet",card_no_tasks_cta:"\u2192 Create one in the Maintenance panel",no_objects:"No objects yet.",action_error:"Action failed. Please try again.",area_id_optional:"Area (optional)",installation_date_optional:"Installation date (optional)",warranty_expiry_optional:"Warranty expiry (optional)",warranty:"Warranty",warranty_valid_until:"valid until {date}",warranty_expires_in:"expires in {days} days",warranty_expired:"expired",cal_past_windows:"Past windows",cal_forward_windows:"Forward windows",history_edit_title:"Edit history entry",history_delete_entry:"Delete entry",history_delete_confirm:"Delete this history entry? The task's last-performed date falls back to the previous completion; photos stay with the object and consumed parts are not restocked.",history_edit_timestamp:"Timestamp",manufacturer:"Manufacturer",model:"Model",area:"Area",actions:"Actions",view_mode_label:"View",view_cards:"Card view",view_table:"Table view",objects_table_columns_label:"Objects table columns",objects_table_columns_hint:"Choose which columns appear in the objects table view.",custom_icon_optional:"Icon (optional, e.g. mdi:wrench)",task_enabled:"Task enabled",skip_reason_prompt:"Skip this task?",reason_optional:"Reason (optional)",reset_date_prompt:"Mark task as performed?",reset_date_optional:"Last performed date (optional, defaults to today)",notes_label:"Notes",documentation_label:"Documentation",no_nfc_tag:"\u2014 No tag \u2014",dashboard:"Dashboard",tab_today:"Today",palette_placeholder:"Search objects, tasks, spare parts, documents, notes\u2026",palette_no_results:"No matches",palette_hint:"\u2191\u2193 to navigate \xB7 Enter to open \xB7 Esc to close \xB7 / opens the search anywhere",search_open:"Search",search_group_parts:"Spare parts",search_group_content:"In documents",search_group_history:"History notes",search_page:"Page {page}",search_empty_hint:"Type to search objects, tasks, spare parts, documents and notes",search_searching:"Searching documents and notes\u2026",search_index_status:"Full-text search: {indexed} of {total} files indexed \xB7 {no_text} without text layer \xB7 {pending} pending",today_all_caught_up:"All caught up! Nothing due this week.",today_overdue:"Overdue",today_due_today:"Due today",today_this_week:"This week",settings:"Settings",settings_features:"Advanced Features",settings_features_desc:"Enable or disable advanced features. Disabling hides them from the UI but does not delete data.",feat_adaptive:"Adaptive Scheduling",feat_adaptive_desc:"Learn optimal intervals from maintenance history",feat_predictions:"Sensor Predictions",feat_predictions_desc:"Predict trigger dates from sensor degradation",feat_seasonal:"Seasonal Adjustments",feat_seasonal_desc:"Adjust intervals based on seasonal patterns",feat_environmental:"Environmental Correlation",feat_environmental_desc:"Correlate intervals with temperature/humidity",feat_budget:"Budget Tracking",feat_budget_desc:"Track monthly and yearly maintenance spending",feat_groups:"Task Groups",feat_groups_desc:"Organize tasks into logical groups",feat_checklists:"Checklists",feat_checklists_desc:"Multi-step procedures for task completion",settings_general:"General",settings_default_warning:"Default warning days",settings_consumable_threshold:"Consumable low threshold (%)",settings_battery_low_percent:"Battery low threshold (%)",settings_battery_recovered_percent:"Battery counts as replaced above (%)",settings_battery_recovered_percent_hint:"A low battery stays counted as low until its level rises above this value or a replacement is recorded \u2014 so a level hovering around the low threshold cannot complete the fleet task again and again.",settings_battery_auto_record:"Record a replacement automatically when a low battery recovers",settings_battery_auto_record_hint:"When a battery that was low rises above the recovery threshold, the replacement date is recorded in Battery Notes and the spare cells are taken from stock \u2014 no tap needed.",settings_battery_lifetimes:"Typical battery lifetimes",settings_battery_lifetimes_hint:'Only used for batteries without a percentage: a Battery Notes note that has just a type and a last-replaced date, or a sensor that only reports "low". Their due date is last replaced + this lifetime. Batteries that report a level get their forecast from the measured discharge instead. Once the fleet has seen three replacements of a type, the median interval takes over from the built-in value \u2014 your own value always wins.',settings_battery_lifetime_months:"months",settings_battery_lifetime_reset:"Use default",settings_battery_lifetime_in_fleet:"in your fleet",settings_battery_lifetime_learned_models:"Learned per model: {list}",settings_thresholds_hint:"Defaults for new Suggested setups (percent-remaining consumables) and for fleet batteries without their own Battery Notes threshold. Existing tasks keep their value.",settings_part_search_url:"Shopping search link",settings_part_search_url_hint:"URL with {q} in place of the search terms, used for parts without a product link. Leave empty for the automatic store (by country, then by language).",settings_value_out_of_range:"Value must be between {min} and {max}",bn_summary:"{name}: {pct} % for {n} batteries",bn_floor_decides:"Your {floor} % floor decides for all of them; the higher of the two thresholds counts per battery.",bn_above_floor:"That is above your {floor} % floor, so {name} decides for all noted batteries.",bn_overrides:"{n} devices with their own threshold:",bn_more:"+ {n} more",settings_row_actions:"Task row actions",settings_ref_numbers_in_lists:"Reference numbers in lists",settings_ref_numbers_in_lists_hint:"Show the #8 / #8.3 chips in front of object and task names in the Today list, the task table, the object cards and the objects table.",settings_compact_refs:"Compact reference numbers",settings_compact_refs_hint:"Renumbers all objects, tasks and completions in order (1, 2, 3 \u2026) and closes the gaps left by deletions. Numbers already printed on service booklets, photos or notes will no longer match.",settings_compact_refs_confirm:"Renumber every object, task and completion sequentially in creation order? Numbers already written on printed service booklets, photos or notes will no longer match. This cannot be undone.",settings_compact_refs_done:"Renumbered {objects} objects, {tasks} tasks and {completions} completions.",row_actions_buttons_compact:"Buttons (icons only on phones)",row_actions_buttons:"Buttons with text",row_actions_icons:"Icons (classic)",row_actions_follow:"Follow the household setting",settings_panel_enabled:"Sidebar panel",settings_panel_title:"Sidebar panel title",settings_notifications:"Notifications",settings_notify_service:"Notification service",settings_shopping_list:"Shopping list (buy tasks)",settings_shopping_list_help:"Low-part buy reminders appear in this to-do list; checking one off restocks the part.",shopping_list_none:"Off \u2014 no shopping list",settings_install_assist_sentences:"Install Assist sentences",settings_install_assist_sentences_hint:"Copies the voice sentences into your configuration so the classic Assist agent recognises them. A file you edited yourself is never overwritten.",test_notification:"Test notification",send_test:"Send test",testing:"Sending\u2026",test_notification_success:"Test notification sent",test_notification_failed:"Test notification failed",notify_per_person:"Per-person delivery",member_avatars:"Member avatars",member_avatars_hint:"Shown next to assigned tasks \u2014 initials in the member's colour. Defaults come from the name; set your own initials or pick a colour to tell members apart.",member_initials:"Initials",member_color:"Colour",member_avatar_reset:"Reset",notify_no_own_device:"No own device \u2014 uses the household service",settings_notify_due_soon:"Notify when due soon",settings_notify_overdue:"Notify when overdue",settings_notify_triggered:"Notify when triggered",settings_interval_hours:"Repeat interval (hours, 0 = once)",settings_quiet_hours:"Quiet hours",settings_quiet_start:"Start",settings_quiet_end:"End",settings_max_per_day:"Max notifications per day (0 = unlimited)",settings_bundling:"Bundle notifications",settings_bundle_threshold:"Bundle threshold",settings_reminder_leads:"Extra reminders (days before due)",settings_reminder_leads_hint:"Comma-separated lead times, e.g. 14, 3, 0 \u2014 one extra reminder fires on each matching day. Empty = off.",settings_actions:"Mobile Action Buttons",settings_action_complete:"Show 'Complete' button",settings_action_skip:"Show 'Skip' button",settings_action_snooze:"Show 'Snooze' button",settings_weekly_digest:"Weekly digest",settings_weekly_digest_hint:"A single summary notification on Monday morning when tasks are due.",settings_warranty_reminder:"Warranty expiry reminder",settings_warranty_reminder_days:"Days before expiry",settings_warranty_reminder_hint:"Notify once when an object's warranty is this many days from expiring.",settings_snooze_hours:"Snooze duration (hours)",settings_budget:"Budget",settings_currency:"Currency",settings_currency_decimals:"Decimal places for amounts",settings_currency_decimals_hint:"How many decimals every amount shows: KPIs, budgets, costs in lists and reports, budget alerts. 0 = whole numbers.",settings_budget_monthly:"Monthly budget",settings_budget_yearly:"Yearly budget",settings_budget_alerts:"Budget alerts",settings_budget_threshold:"Alert threshold (%)",settings_import_export:"Import / Export",settings_export_json:"Export JSON",settings_export_yaml:"Export YAML",settings_export_csv:"Export CSV",settings_export_settings:"Export settings (JSON)",settings_import_placeholder:"Paste JSON or CSV content here\u2026",settings_import_btn:"Import",settings_import_success:"{count} objects imported successfully.",settings_export_success:"Export downloaded.",settings_saved:"Setting saved.",settings_include_history:"Include history",settings_export_selection:"Limit to selected objects (optional)",settings_docs_archive:"Documents archive (with files)",settings_docs_archive_hint:"The JSON/YAML/CSV exports carry settings only. This ZIP includes the uploaded file contents so a restore is complete.",settings_docs_export_btn:"Download documents ZIP",settings_docs_import_btn:"Restore documents ZIP",settings_docs_import_success:"Restored: {blobs} files, {docs} documents",sort_alphabetical:"Alphabetical",sort_due_soonest:"Due soonest",sort_task_count:"Task count",sort_area:"Area",sort_assigned_user:"Assigned user",sort_group:"Group",groupby_none:"No grouping",groupby_area:"By area",groupby_group:"By group",groupby_user:"By user",groupby_object:"By object",filter_label:"Filter",user_label:"User",photo_label:"Photo",sort_label:"Sort",group_by_label:"Group by",state_value_help:'Use the HA state value (usually lowercase, e.g. "on"/"off"). Case is normalised on save.',target_changes_help:"Number of matching transitions before the trigger fires (default: 1).",state_latch_help:"With 1 transition the trigger is a latch: it recovers when the entity leaves the To-state \u2014 or, with only a From-state set, when it returns to that state.",for_minutes_state_help:"0 counts every change immediately. Set minutes and the new state must hold that long first \u2014 brief flickers then neither trigger nor count.",qr_print_title:"Print QR codes",qr_print_desc:"Generate a printable page of QR codes to cut out and stick on your equipment.",qr_print_load:"Load objects",qr_print_filter:"Filter",qr_print_objects:"Objects",qr_print_actions:"Actions",qr_print_url_mode:"Link type",qr_print_estimate:"Estimated QR codes",qr_print_over_limit:"cap is 200, narrow the filter",qr_print_generate:"Generate QR codes",qr_print_generating:"Generating\u2026",qr_print_ready:"QR codes ready",qr_print_print_button:"Print",qr_print_empty:"Nothing to generate",qr_action_skip:"Skip",vacation_title:"Vacation mode",vacation_active:"active",vacation_ended:"ended",vacation_desc:"Plan a vacation: notifications are paused during the period plus a buffer of days. You can opt specific tasks back in.",vacation_enable:"Enable vacation mode",vacation_start:"Start",vacation_end:"End",vacation_buffer:"Buffer (days)",vacation_exempt_title:"Notify anyway during vacation",vacation_exempt_desc:"Pick tasks that should still notify during vacation (e.g. critical pool chemistry).",vacation_load_tasks:"Load tasks",vacation_preview_btn:"Show preview",vacation_preview_affected:"tasks affected",vacation_event_due_soon:"becomes due soon",vacation_event_overdue:"becomes overdue",vacation_event_triggered_est:"sensor trigger possible",vacation_sensor_based:"(sensor-based)",vacation_action_notify:"Notify anyway",vacation_action_unsilence:"Silence again",vacation_marked_complete:"Marked complete",vacation_marked_skip:"Skipped",vacation_end_now:"End vacation now",add:"Add",show_stats:"Show stats + graphs",hide_stats:"Hide stats",adaptive_no_data:"Not enough completion history yet for adaptive analysis. Complete this task a few more times to unlock interval recommendations and reliability charts.",suggestion_applied:"Suggested interval applied",vacation_mode:"Vacation mode",vacation_status_active:"Active now",vacation_status_scheduled:"Scheduled",vacation_status_inactive:"Inactive",vacation_end_now_confirm:"End vacation immediately?",vacation_exempt_count:"exempt",vacation_advanced:"Advanced\u2026",vacation_open_panel:"Open in panel",enable:"Enable",saved:"Saved",budget_monthly_set:"Set monthly",budget_yearly_set:"Set yearly",budget_advanced:"Currency, alerts\u2026",budget_open_panel:"Open in panel",groups_empty:"No groups yet.",group_new_placeholder:"Add group\u2026",group_delete_confirm:'Delete group "{name}"?',groups_manage_tasks:"Manage task assignments\u2026",groups_open_panel:"Open in panel",unassigned:"Unassigned",no_area:"No area",has_overdue:"Has overdue tasks",object:"Object",settings_panel_access:"Panel access",settings_panel_access_desc:"Admins always have full access. To delegate create, edit and delete to specific non-admins, switch this on and pick them below \u2014 everyone else sees only Complete and Skip.",settings_operator_write:"Allow selected users to create, edit & delete",settings_operator_write_desc:"Off: only admins can change content. On: the selected users below get full access too.",no_non_admin_users:"No non-admin users found. Add some in Settings \u2192 People.",owner_label:"Owner",feat_completion_actions:"Completion actions",feat_completion_actions_desc:"Per-task HA action on complete + quick-complete QR with pre-set values.",on_complete_action_title:"On complete: trigger HA action (optional)",on_complete_action_desc:"Calls an HA service when the task is completed \u2014 e.g. reset a counter on the device.",on_complete_action_target:"Target entity",on_complete_action_target_hint:"Note: the entity domain must match the service \u2014 e.g. 'button.press' only works on button.*, 'counter.increment' only on counter.*, 'input_button.press' only on input_button.* etc. On a mismatch the action will silently fail (HA logs 'Referenced entities ... missing or not currently available').",on_complete_action_data:"Data (JSON, optional)",on_complete_action_test:"Validate configuration",on_complete_action_test_success:"\u2713 Configuration valid (action will fire only on task completion)",on_complete_action_test_failed:"Failed",quick_complete_defaults_title:"Quick-complete defaults (for QR scans, optional)",quick_complete_defaults_desc:"Pre-set values for quick-complete QR scans. Without these, the QR opens the complete dialog.",quick_complete_defaults_notes:"Notes",quick_complete_defaults_cost:"Cost",quick_complete_defaults_duration:"Duration (minutes)",quick_complete_defaults_feedback_none:"No feedback",quick_complete_defaults_feedback_needed:"Was needed",quick_complete_defaults_feedback_not_needed:"Not needed",quick_complete_success:"Quickly marked complete",show_all_objects:"Show all objects",show_all_tasks:"Clear filter \u2014 show all tasks",filter_to_overdue:"Filter task list to overdue only",filter_to_due_soon:"Filter task list to due-soon only",filter_to_triggered:"Filter task list to triggered only",open_task:"Open task",show_details:"Show history + stats",hide_details:"Hide details",history_empty:"No history yet.",history_edit_button:"Edit entry",total_cost:"Total cost",times_performed:"Performed",older_entries:"older",open_in_panel:"Open in Maintenance panel",skip_reason:"Skip reason (optional)",reset_to_date:"Reset last_performed to",delete_task_confirm:"Delete this task and its history?",delete_object_confirm:"Delete this object and all its tasks?",loading:"Loading\u2026",archive:"Archive",undo:"Undo",task_archived:"Task archived",object_archived:"Object archived",unarchive:"Unarchive",archived:"Archived",show_archived:"Show archived",hide_archived:"Hide archived",section_collapse:"Collapse section",section_expand:"Expand section",confirm_archive_object:"Archive this object and its tasks? They keep their history and can be unarchived later.",settings_archive:"Archive & Retention",settings_archive_desc:"Retire completed one-off tasks without deleting them. Archived items are hidden and inert but keep their history and cost.",settings_archive_oneoff_days:"Auto-archive completed one-off tasks after (days, 0 = off)",settings_delete_archived_oneoff_days:"Auto-delete archived one-off tasks after (days, 0 = never)",archive_object:"Archive object",unarchive_object:"Unarchive object",documents:"Documents",documents_empty:"No documents yet.",doc_upload:"Upload file",doc_uploading:"Uploading\u2026",doc_add_link:"Add link",doc_link_url:"URL (https://\u2026)",doc_link_title:"Title (optional)",doc_open:"Open",doc_delete_confirm:'Delete "{name}"?',doc_too_large:"File is too large (max 25 MB).",doc_upload_failed:"Upload failed.",completion_photos_optional:"Completion photos (optional)",completion_photos:"Completion photos",choose_photos:"Choose photos",choose_photo:"Choose photo",photos_android_hint:"The Android app hands over one photo per pick \u2014 each pick is added.",photos_limit:"Up to {max} photos per completion",history_edit_photos_hint:"Removing a photo here keeps the file in the object's documents.",uploading:"Uploading\u2026",remove:"Remove",doc_deduped:"Already stored elsewhere \u2014 shared, no extra space used.",doc_dup_in_object:"This file is already attached to this object.",doc_link_invalid:"Only http/https links are allowed.",doc_cat_manual:"Manual",doc_cat_warranty:"Warranty",doc_cat_invoice:"Invoice",doc_cat_spare_parts:"Spare parts",doc_cat_photo:"Photo",doc_cat_other:"Other",doc_link_badge:"Link",doc_storage_title:"Document storage",doc_storage_saved:"Saved via deduplication",doc_storage_refresh:"Refresh",doc_download:"Download",doc_close:"Close",doc_camera:"Take photo",camera_capture_shoot:"Capture",camera_switch_lens:"Switch camera",doc_drop_hint:"Drop files here",doc_task_none:"No documents linked to this task.",doc_link_existing:"Link a document\u2026",doc_attach:"Link",doc_unlink:"Unlink",doc_page:"Page",chart_range_7d:"7d",chart_range_30d:"30d",chart_range_90d:"90d",chart_range_1y:"1y",chart_since_service:"since last service",chart_no_stats:"No long-term statistics for this entity \u2014 showing maintenance-event values only",auto_complete_on_recovery:"Auto-complete when the sensor recovers",auto_complete_on_recovery_help:"Records a completion (sets last performed) when the trigger clears itself \u2014 e.g. salt refilled, filter replaced.",doc_search:"Search documents\u2026",doc_search_none:"No matching documents",doc_description:"Description (optional)",doc_sort:"Sort documents",doc_sort_newest:"Newest first",doc_sort_oldest:"Oldest first",doc_sort_title:"By title (1, 2, 3 \u2026)",doc_sort_category:"By category",link_device_optional:"Link to existing device (optional)",parent_object_optional:"Parent object (optional)",parent_none:"(No parent)",paused:"Paused",pause_object:"Pause",resume_object:"Resume",pause_until_prompt:"Freeze this object's schedules \u2014 nothing becomes due and nothing notifies until it is resumed. Optionally set an auto-resume date.",pause_until_label:"Resume on (optional)",object_paused:"Object paused",object_resumed:"Object resumed \u2014 schedules restarted",object_paused_badge:"Paused",paused_until_label:"until",replace_object:"Replace\u2026",replace_object_prompt:"Retire this object and create a successor. History and costs stay archived on the old one; tasks and documents carry over to the new one, counters start fresh.",replace_name_label:"Successor name",object_replaced:"Object replaced \u2014 successor created",reading_unit_label:"Reading unit (e.g. kWh, m\xB3)",reading_unit_help:"Shown next to the recorded value when completing this task.",reading_value_label:"Reading value",reading_label:"Reading",readings_section:"Readings",readings_hint:"Several named values per completion \u2014 one row per meter. Leave empty to record a single value.",reading_name_label:"Reading name",reading_unit_short:"Unit",reading_add:"Add reading",reading_duplicate_name:"Name already used",reading_last:"last: {value}",reading_below_last:"Lower than the last reading ({value})",settings_templates_label:"Template gallery",settings_templates_hint:`Untick templates you'll never need \u2014 they disappear from the "From template" pickers (panel and config flow). Nothing else changes; you can re-enable them any time.`,worksheet:"Work sheet",worksheet_scan_view:"Scan to open the task",worksheet_scan_complete:"Scan to complete",worksheet_manual_excerpt:"Manual excerpt",worksheet_pages:"pages",worksheet_printed:"Printed",worksheet_never:"Never",card_all_caught_up:"All caught up \u2014 nothing needs attention",postpone:"Postpone",postpone_date_prompt:"Postpone this occurrence to which date?",postpone_date_label:"New due date",postponed:"Postponed",postponed_to:"Postponed to",season_window_label:"Seasonal window (months)",season_window_hint:"Only due in the selected months; off-season dates roll to the next active month. None = all year.",series_end_label:"Ends",series_end_never:"Never (repeats indefinitely)",series_end_after_count:"After a number of times",series_end_until:"On a date",series_end_count_label:"Number of times",series_end_until_label:"End date",parts_section:"Parts & consumables",parts_inventory_value:"Inventory value",part_add:"Add part",part_name:"Name",part_vendor:"Manufacturer",part_storage_location:"Storage location",part_product_url:"Product URL",part_unit:"Unit",part_cost:"Unit price",part_stock:"Stock",part_reorder_threshold:"Reorder at",part_restock_quantity:"Restock quantity",part_auto_buy:"Auto-create buy task when low",part_restock:"Adjust stock",parts_used_by:"Used by",restock_quantity_label:"Quantity bought",consumes_parts_label:"Consumes parts",task_parts_fleet_hint:"Battery quantities come from Battery Notes per device \u2014 nothing to link here.",shared_parts_other_objects:"Parts from other objects",shared_parts_help:"Several objects can share one stock. Completing this task takes from the owning object.",shared_part_unknown:"Unknown part",parts_load_failed:"Couldn't load this object's parts \u2014 the consumes-parts options are unavailable right now.",adopt_problem_button:"Adopt problem sensors",adopt_problem_title:"Adopt problem sensors",adopt_problem_hint:"Turn HA problem sensors (printer errors, filter warnings, low battery) into maintenance tasks that trigger while the problem is active and clear themselves when it resolves.",adopt_problem_none:"No problem sensors found that aren't already tracked.",adopt_problem_active:"active",adopt_problem_ok:"ok",adopt_problem_new_object:"(new)",adopt_problem_adopt:"Adopt selected",adopt_problem_done:"Adopted {tasks} problem sensor(s)",views_label:"Views",views_none:"\u2014 No view \u2014",views_manage:"Save / manage views",views_dialog_title:"Saved views",views_dialog_hint:"Save the current filters as a named view everyone can reuse.",views_name_placeholder:"View name",views_save_current:"Save current filters",views_none_yet:"No saved views yet.",close:"Close",trigger_hint_now:"The sensor reads {value} right now.",trigger_hint_above:"The task triggers once it rises above {target}.",trigger_hint_below:"It triggers once it falls below {target}.",trigger_hint_overlap:"These limits overlap: every reading triggers the task and it can never recover. Leave one of them empty.",trigger_hint_counter_delta:"Counts from the current reading ({value}): due at {due} (+{target}), and the count restarts after each completion.",trigger_hint_counter_delta_edit:"Counts usage since the last completion: due after +{target}; the count restarts after each completion.",trigger_hint_counter_abs:"The task becomes due once the sensor reaches {target}.",trigger_hint_runtime:"The task becomes due after {hours} h of accumulated on-time; the counter restarts after each completion.",trigger_hint_state_change:"The task becomes due after {count} state change(s).",trigger_hint_state_change_to:"The task becomes due after {count} change(s) to \u201C{state}\u201D.",trigger_hint_state_now:"Current state: {value}.",adopt_problem_part:"Uses part: {name}",label_filter:"Label",all_labels:"All labels",settings_notify_scope:"Notify only for view",settings_notify_scope_all:"All tasks",settings_notify_scope_hint:"Only tasks matching the selected saved view's label/user filters send reminders. Status, sorting and grouping of the view are ignored here.",settings_notify_completed:"Completion notifications",settings_notify_completed_hint:`Household news when a task is completed, with the reason and who did it. "Automatic only" announces just the completions nobody made on the spot: sensor recovery, shopping-list check-off, an automation's service call. Sent to the household service only; quiet hours and the daily cap apply.`,notify_completed_off:"Off",notify_completed_automatic:"Automatic completions only",notify_completed_all:"All completions",settings_notify_rule:"Your own notification rule",settings_notify_rule_hint:"Every notification also fires the event maintenance_supporter_notification (kind, status, object, task, reference numbers, priority, deep link, the payload). Route it with an automation \u2014 e.g. into Ticker, Telegram or Pushover.",settings_notify_event_only:"Only fire the event, send nothing myself",settings_notify_event_only_hint:"Your automation is the whole delivery. Rate limits, quiet hours and the daily cap still apply to when the event fires.",settings_notify_extra_data:"Extra notification data (template)",settings_notify_extra_data_hint:"JSON or YAML, Jinja allowed; merged into the notify call's data (your keys win). Variables: kind, status, priority, labels, notes, area_name, object_name, task_name, object_ref, task_ref, days_until_due, next_due, last_performed, responsible_user_id, sensor_entity_id, url, target, title, message. Test it with the Send test button.",card_saved_view:"Saved view",card_saved_view_none:"None",card_saved_view_help:"Applies the view's status, user and label filters on top of the filters above. The view's sorting and grouping are panel display settings and are not applied on the card.",panel_card_tab:"Open on tab",panel_card_tab_default:"Remembered tab (as in the panel)",panel_card_view:"Open with saved view",panel_card_height:"Height",panel_card_height_help:"Empty = fill the screen below the card (panel view). Otherwise a CSS length such as 600px or 80vh for views with other cards.",panel_card_not_registered:"The Maintenance Supporter panel is not available \u2014 is the integration set up?",panel_card_load_failed:"The Maintenance Supporter panel could not be loaded \u2014 reload the page (after an update: clear the browser cache).",doc_part_none:"No documents linked to this part.",settings_templates_toggle_group:"Enable or disable all templates in this group",setups_button:"Suggested setups",setups_title:"Suggested setups (Beta)",setups_hint:"Devices of supported integrations whose consumable sensors can drive maintenance tasks. Adopting creates the object and wires each task to its sensor \u2014 it triggers when the consumable runs low and resolves itself after replacement.",setups_none:"No supported devices with unwired consumable sensors found.",setups_adopt:"Set up selected",setups_done:"{tasks} sensor-wired tasks created.",complete_parts_used:"Parts used this time",part_delete_confirm:"Delete part '{name}'? Its stock tracking, task links and any open buy reminder will be removed.",baseline_start_value:"Start reading (optional)",baseline_start_help:"Counting starts from this reading. Leave empty to count from the current value; enter the reading at the last service so usage since then already counts.",setups_baseline_hint:"reading at last service (optional)",baseline_start_help_edit:"Leave empty to keep the existing counting. Entering a value re-anchors the counting (e.g. the reading at the last service).",baseline_current_effective:"Currently effective start value: {value}",runtime_on_states:"Active states",runtime_on_states_help:"States that count as running \u2014 default: on. E.g. mowing, cleaning, printing. With an attribute selected, its values are matched instead.",runtime_max_session:"Max session runtime (seconds)",runtime_max_session_help:"A single run counts at most this many seconds \u2014 protects against a sensor stuck ON (lost connection, restart). Empty = no cap.",trend_approaching:"Heading toward the threshold",trend_easing:"Easing away from the threshold",split_select_hint:"Select a task to see its details here",setups_target_new:"Create new: {name}",schedule_preview_title:"Next dates",schedule_preview_ontime:"Assuming on-time completion.",schedule_preview_ends:"(series ends)",adopt_problem_responsible:"Responsible user for all adopted tasks (optional)",adopt_for_minutes_hint:"Only trigger once the problem has persisted this long \u2014 0 reacts to the first flicker.",adopt_problem_configure:"Configure",history_auto:"Automatic",battery_fleet_title:"Battery fleet",battery_fleet_none_low:"All batteries OK \u2014 nothing to replace.",battery_fleet_buy_now:"Buy now",battery_fleet_soon:"Needed soon",battery_fleet_soon_hint:"Predicted from the last replacement date \u2014 order ahead.",battery_fleet_mark_all:"Mark all replaced",battery_fleet_mark_one:"Mark this battery replaced",battery_fleet_offline:"offline",battery_fleet_no_sensor:"No sensor",battery_fleet_trigger_lost:"This task's sensor trigger was lost \u2014 it will not fire or auto-complete.",battery_fleet_repair:"Repair",battery_fleet_exclude:"Exclude from the fleet",battery_fleet_excluded:"Excluded",battery_fleet_include:"Track again",battery_fleet_all:"All tracked batteries",battery_fleet_all_hint:"Exclude a device here to drop it from the fleet before it ever reports low \u2014 a vacuum that recharges itself, or a phone that warns you on its own.",battery_fleet_add:"Add a battery",battery_fleet_add_hint:"Pick a battery sensor the automatic discovery missed \u2014 it joins the roster immediately.",battery_fleet_track_self:"Track self-charging batteries",battery_fleet_track_self_hint:"Phones, vacuums and other devices that recharge themselves appear as rechargeables \u2014 a low one asks for a charge, never for new cells.",battery_fleet_due_without_sensor:"Treat a passed forecast as due when a battery has no sensor",battery_fleet_due_without_sensor_hint:"Some devices report no battery level at all \u2014 Battery Notes only knows the type and the last replacement. Once the typical lifetime has passed, such a battery counts as low and the fleet task reminds you; marking it replaced resets the forecast.",battery_fleet_status_low:"Low",battery_fleet_status_soon:"Soon",battery_fleet_status_ok:"Healthy",battery_fleet_status_due:"Due",battery_fleet_predicted_on:"Expected around {date}",battery_fleet_predicted_typical:"Expected around {date} \u2014 {months} months typical for {type} ({source})",lifetime_source_default:"built-in default",lifetime_source_table:"built-in table",lifetime_source_learned:"learned from {n} replacements",lifetime_source_override:"your setting",lifetime_source_learned_device:"learned from this device's {n} replacements",lifetime_source_learned_model:"learned from {n} replacements on devices of this model",battery_fleet_predicted_trend:"Predicted from this battery's discharge trend: around {date} ({confidence})",battery_fleet_rechargeable:"Rechargeable: charge instead of replacing \u2014 never on the shopping list",battery_fleet_sort_name:"Sort by name",battery_fleet_sort_urgency:"Sort by urgency",battery_fleet_mark_recharged:"Mark as recharged",battery_fleet_sparkline_hint:"Battery level over the last 30 days \u2014 dotted: projected until the low threshold",battery_fleet_filter_type:"Show only this battery type",battery_fleet_record_replacement:"The level jumped around {date} \u2014 record this replacement in Battery Notes",battery_fleet_total:"{n} batteries tracked",battery_fleet_setup_button:"Battery fleet",battery_fleet_setup_done:"Battery fleet set up \u2014 one task tracks all your batteries.",update_banner:"A newer version of Maintenance Supporter is on the server \u2014 reload to update the panel.",update_reload:"Reload",row_actions_banner:"Complete and Skip in task rows are now buttons. Prefer the old icons?",row_actions_keep:"Keep buttons",row_actions_back:"Back to icons",battery_fleet_forecast_overdue:"Predicted date passed \u2014 the battery still reports healthy. If you swapped it, record the replacement; otherwise the forecast was off.",cost_from_parts:"Use \u2248 {amount} from parts",dismiss:"Dismiss",gs_label:"Getting started \u2014 these hints retire as your setup grows",gs_setups_chip:"Suggested setups found {n} devices with pre-wired triggers",gs_adopt_chip:"{n} problem sensors can become maintenance tasks",gs_fleet_chip:"One click sets up the battery fleet",cal_editor_window:"Default window",cal_editor_window_week:"Week (7 days)",cal_editor_window_fortnight:"Fortnight (14 days)",cal_editor_window_month:"Month (30 days, default)",cal_editor_window_year:"Year (365 days, empty days collapsed)",cal_editor_show_chips:"Show window chips inside the card",cal_editor_chips_hint:"Hide the chips when the card is embedded in a strategy view that already serves as the window selector.",cal_editor_show_user_filter:"Show user filter dropdown",cal_editor_default_user:"Default user filter",cal_editor_my_tasks:"My tasks (current user)",cal_editor_show_object_filter:"Show object filter dropdown",cal_editor_object_hint:'Pre-select one object via YAML: object_filter: "" \u2014 or a list of names to restrict the card to several objects.',object_history_section:"History (all tasks)",object_history_all_tasks:"All tasks",object_history_empty:"No entries in this range.",object_history_cap_note:"History keeps up to 500 entries per task \u2014 very old entries may be missing.",service_record_title:"Service record",service_record_print:"Service record (PDF)",date:"Date",service_record_entries:"entries",ref_number:"Reference number",print_options_title:"Print service record",print_layout:"Layout",print_layout_chronological:"Chronological",print_layout_by_task:"By task",print_include:"Include",print_inc_readings:"Readings",print_inc_parts:"Parts used",print_inc_photos:"Photos",print_inc_documents:"Linked documents",print_inc_doc_desc:"Document descriptions",print_inc_checklist:"Checklist",print_inc_notes:"Notes",print_inc_costs:"Cost and duration",print_inc_person:"Completed by",print_inc_refs:"Reference numbers",print_inc_bare:"Completions without details",print_inc_qr:"QR code per task",print_button:"Print",report_scan_hint:"Scan to open the task",completed_by:"Completed by",date_from:"From",date_to:"To",phases_section:"Cycle phases (optional)",phases_hint:"Different work on one shared schedule \u2014 each completion moves to the next step (e.g. small service, small service, big service).",phase_add:"Add phase",phase_name:"Phase name",phase_sequence_label:"Cycle order",phase_sequence_add_step:"Add step",phase_current:"Current phase",phase_set:"Set as current",chart_history_fallback:"No long-term statistics for this entity \u2014 showing recorder state history (typically the last ~10 days)",chart_history_alarm:"Trigger view from recorder state history: 1 = alert state held for the hold time, 0 = fine (typically the last ~10 days)",chart_history_count:"Change count rebuilt from recorder state history since the last service (typically the last ~10 days)",prediction_cycles:"Learned from cycles",phase_require_override:"Override \u201CRequire on completion\u201D for this phase",history_add_past:"Add past completion",require_tag_scan:"Only complete by scanning the tag",require_tag_scan_help:"Proof of presence: Done is blocked on every surface until the NFC tag or QR code on the thing itself is scanned. Automations can pass 'via_tag_scan' to the complete service.",disallow_skip:"Don't allow skipping",disallow_skip_help:"The Skip action disappears from every surface, and the server refuses a skip from automations and voice too.",no_notifications:"No notifications for this task",no_notifications_help:"No reminders for this task \u2014 no status notifications, repeats, lead-time reminders or bundles. It still shows on the dashboard and in its entities; the weekly digest still counts it.",require_tag_scan_hint:"This task completes only by scanning its NFC tag or QR code on the thing itself \u2014 saving here will be refused."}});var nr,ar=w(()=>{"use strict";nr="2.88.0"});var ve,Ut,or=w(()=>{"use strict";ve={ok:"var(--success-color, #4caf50)",due_soon:"var(--warning-color, #ff9800)",overdue:"var(--error-color, #f44336)",triggered:"var(--deep-orange-color, #ff5722)",archived:"var(--disabled-color, #9e9e9e)",paused:"var(--info-color, #2196f3)"},Ut={ok:"mdi:check-circle",due_soon:"mdi:alert-circle",overdue:"mdi:alert-octagon",triggered:"mdi:bell-alert",archived:"mdi:archive-outline",paused:"mdi:pause-circle-outline",completed:"mdi:check-circle",skipped:"mdi:skip-next",missed:"mdi:calendar-remove",reset:"mdi:refresh"}});function de(s){return s?.currency_symbol||tn}function rn(s){be.en=Object.assign({},s,be.en??{})}function Qe(s){let r=(s||Bt).toLowerCase();return r.startsWith("pt")&&r.endsWith("br")?"pt-br":r.substring(0,2)}function n(s,r){let e=Qe(r);return be[e]?.[s]??be.en[s]??s}function pt(s,r){r.has("hass")&&Wt(s.hass?.locale,s.hass?.config?.country);let e=s.hass?.language;e&&!Vt(e)&&Je(e).then(()=>s.requestUpdate())}function P(s){return s?.language||"en"}function Vt(s){let r=Qe(s);return r===Bt||r in be}function Je(s){let r=Qe(s);return r===Bt||r in be||!sn.has(r)?Promise.resolve():(r in Ke||(Ke[r]=fetch(`${nn}/${r}.json?v=${nr}`).then(e=>e.ok?e.json():null).then(e=>{e?be[r]=e:delete Ke[r]}).catch(()=>{delete Ke[r]})),Ke[r])}function dr(s){let r=Qe(s);return{de:"de-DE",en:"en-US",nl:"nl-NL",fr:"fr-FR",it:"it-IT",es:"es-ES",pt:"pt-PT",ru:"ru-RU",uk:"uk-UA",zh:"zh-CN",da:"da-DK",fi:"fi-FI",nb:"nb-NO",ja:"ja-JP",hi:"hi-IN",pl:"pl-PL",cs:"cs-CZ",sv:"sv-SE","pt-br":"pt-BR",hu:"hu-HU",ko:"ko-KR",tr:"tr-TR"}[r]??"en-US"}function an(s){pr.decimals=typeof s=="number"&&Number.isInteger(s)&&s>=0&&s<=3?s:0}function on(){return pr.decimals??0}function ht(s){s&&s.currency_decimals!==void 0&&s.currency_decimals!==null&&an(Number(s.currency_decimals))}function Wt(s,r){s&&(te.date=s.date_format,te.time=s.time_format,te.number=s.number_format,r!==void 0&&(te.country=r||void 0))}function ln(s){switch(te.number){case"comma_decimal":return["en-US","en"];case"decimal_comma":return["de","es","it"];case"space_comma":return["fr","sv","cs"];case"system":return;default:return dr(s)}}function O(s,r,e){if(!Number.isFinite(s))return String(s);let t=typeof e=="number"?{minimumFractionDigits:e,maximumFractionDigits:e}:{maximumFractionDigits:2,...e};if(te.number==="none"){let i=Math.pow(10,t.maximumFractionDigits??2);return String(Math.round(s*i)/i)}try{return new Intl.NumberFormat(ln(r),t).format(s)}catch{return new Intl.NumberFormat(void 0,t).format(s)}}function Ae(s,r,e,t){let i=O(s,e,t??on());return r?`${i} ${r}`:i}function Te(s){let r=dr(s),e=te.country;if(e&&/^[A-Za-z]{2}$/.test(e)){let t=`${Qe(s).split("-")[0]}-${e.toUpperCase()}`;try{return new Intl.DateTimeFormat(t),t}catch{}}return r}function hr(s,r){let e=String(s.getDate()).padStart(2,"0"),t=String(s.getMonth()+1).padStart(2,"0"),i=String(s.getFullYear());switch(te.date){case"DMY":return`${e}/${t}/${i}`;case"MDY":return`${t}/${e}/${i}`;case"YMD":return`${i}-${t}-${e}`;case"system":return s.toLocaleDateString(void 0,{day:"2-digit",month:"2-digit",year:"numeric"});default:return s.toLocaleDateString(Te(r),{day:"2-digit",month:"2-digit",year:"numeric"})}}function ur(s,r){switch(te.time){case"12":return s.toLocaleTimeString(Te(r),{hour:"2-digit",minute:"2-digit",hour12:!0});case"24":return s.toLocaleTimeString(Te(r),{hour:"2-digit",minute:"2-digit",hour12:!1});case"system":return s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});default:return s.toLocaleTimeString(Te(r),{hour:"2-digit",minute:"2-digit"})}}function F(s,r){if(!s)return"\u2014";try{let e=s.includes("T")?s:s+"T00:00:00";return hr(new Date(e),r)}catch{return s}}function _r(s,r){if(!s)return"\u2014";try{let e=new Date(s);return hr(e,r)+" "+ur(e,r)}catch{return s}}function Kt(s,r){if(s==null)return"\u2014";let e=r||"en";return s<0?`${Math.abs(s)} ${n("d_overdue",e)}`:s===0?n("today",e):`${s} ${n(s===1?"day":"days",e)}`}function Ye(s,r,e){return s==null?"\u2014":`${s} ${n("unit_"+(r||"days"),e)}`}function ut(s,r){return s==null?"\u2014":`${O(s,r,{maximumFractionDigits:1})} ${n("minutes_short",r)}`}function Ge(s,r,e="long"){return new Date(Date.UTC(2024,0,1+s)).toLocaleDateString(Te(r),{weekday:e,timeZone:"UTC"})}function mr(s,r,e="long"){return new Date(Date.UTC(2024,s,1)).toLocaleDateString(Te(r),{month:e,timeZone:"UTC"})}function gr(s,r){let e=s.schedule;if(s.schedule_type==="sensor_based"){let i=n("sensor_based",r),a=e&&e.kind==="interval"&&e.every?e.every:s.interval_days;return a?`${i} \xB7 ${Ye(a,(e&&e.kind==="interval"?e.unit:s.interval_unit)||"days",r)}`:i}let t=e?.offset?` ${e.offset>0?"+":"\u2212"}${Math.abs(e.offset)}d`:"";switch(e?.kind){case"weekdays":return((e.weekdays||[]).map(i=>Ge(i,r,"short")).join(" & ")||"\u2014")+t;case"nth_weekday":return e.weekday==null||e.nth==null?"\u2014":`${e.nth===-1?n("ord_last",r):n("ord_"+e.nth,r)} ${Ge(e.weekday,r,"long")}${t}`;case"day_of_month":return e.day==null?"\u2014":(e.day===-1?n(e.business?"last_business_day_month":"last_day_month",r):`${n("day_word",r)} ${e.day}`)+t;case"one_time":return s.due_date?F(s.due_date,r):n("one_time",r);case"manual":return n("manual",r);case"interval":return Ye(e.every,e.unit,r)}return s.schedule_type==="one_time"?s.due_date?F(s.due_date,r):n("one_time",r):s.schedule_type==="manual"?n("manual",r):s.schedule_type==="sensor_based"?n("sensor_based",r):s.interval_days!=null?Ye(s.interval_days,s.interval_unit,r):"\u2014"}function fr(s,r){s.currentTarget.dispatchEvent(new CustomEvent("hass-more-info",{detail:{entityId:r},bubbles:!0,composed:!0}))}var tn,Bt,lr,be,sn,nn,Ke,cr,te,pr,vr,dn,cn,_t,C=w(()=>{"use strict";I();rr();ar();or();tn="\u20AC";Bt="en",lr=(()=>{let s=window;return s.__msLocales||(s.__msLocales={store:{},inflight:{}}),s.__msLocales})(),be=lr.store;rn(sr);sn=new Set(["de","nl","fr","it","es","pt","pt-br","ru","uk","pl","cs","sv","zh","da","fi","nb","ja","hi","hu","ko","tr"]),nn="/maintenance_supporter_locales",Ke=lr.inflight;cr=window,te=cr.__msDateTimePrefs??={},pr=cr.__msMoneyPrefs??={};vr=k` .field { display: flex; flex-direction: column; gap: 4px; } .field-label { font-size: 12px; color: var(--secondary-text-color); } .field-input { @@ -1245,7 +1245,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" .stat-item .stat-label { font-size: 11px; white-space: normal; text-align: center; line-height: 1.2; hyphens: auto; overflow-wrap: anywhere; } .stat-value { font-size: 20px; } } -`});function br(s,r,e){let t=new Blob([s],{type:e}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=r,a.target="_blank",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var Yt=w(()=>{"use strict"});async function pn(s,r,e=300){return(await s.connection.sendMessagePromise({type:"auth/sign_path",path:r,expires:e})).path}async function Gt(s,r,e=300){return pn(s,`/api/maintenance_supporter/document/${r}`,e)}async function yr(s,r,e=""){let t=window.open("about:blank","_blank");try{let i=await Gt(s,r);t&&(t.location.href=new URL(i+e,window.location.origin).href)}catch(i){throw t&&t.close(),i}}var Qt=w(()=>{"use strict";Yt()});function mt(s){return!!s&&/^https?:\/\//i.test(s)}var Jt=w(()=>{"use strict"});function hn(s){let r=(s||"").split(/\s+/).filter(Boolean);return r.length===0?"?":r.length===1?r[0][0].toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function un(s){let r=0;for(let e of s)r=r*31+e.charCodeAt(0)>>>0;return xr[r%xr.length]}function gt(s){return s?{id:s.id,name:s.name,initials:s.initials||hn(s.name),color:s.color||un(s.id)}:null}function Zt(s){return s?o`${s.initials}`:c}var xr,Xt=w(()=>{"use strict";I();xr=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"]});var Ie,ei=w(()=>{"use strict";Xt();Ie=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestampt.id===r)?.name||null}getPerson(r){return gt(this.getUser(r))}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function _n(s,r){if(r<=0)return 0;let e=typeof s=="number"&&Number.isFinite(s)?Math.trunc(s):0;return e<0?0:e%r}function mn(s){return!!(s?.phases&&s.phase_sequence&&s.phase_sequence.length>0)}function ti(s){if(!s||!mn(s))return null;let r=s.phase_sequence,e=_n(s.phase_cursor,r.length),t=r[e],i=s.phases?.[t];return i?{id:t,name:i.name,index:e,count:r.length,notes:i.notes,checklist:i.checklist!==void 0?i.checklist:s.checklist??[],consumesParts:i.consumes_parts!==void 0?i.consumes_parts:s.consumes_parts??[],requiredFields:i.required_completion_fields!==void 0?i.required_completion_fields:s.required_completion_fields??[]}:null}function de(s){let r=ti(s);return r?`${r.index+1}/${r.count} \xB7 ${r.name}`:""}var ft=w(()=>{"use strict"});function wr(){let s=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:r=>r.map(()=>Math.floor(Math.random()*256))}).getRandomValues(s),Array.from(s,r=>r.toString(16).padStart(2,"0")).join("")}function ce(s){let r=s?.reading_values;if(!Array.isArray(r))return[];let e=[],t=new Set;for(let i of r){if(!i||typeof i!="object")continue;let a=i;typeof a.id!="string"||!a.id||t.has(a.id)||typeof a.value!="number"||!Number.isFinite(a.value)||(t.add(a.id),e.push({id:a.id,name:typeof a.name=="string"?a.name:a.id,unit:typeof a.unit=="string"?a.unit:null,value:a.value}))}return e}function $r(s){return s.filter(r=>r.type==="completed"&&(r.reading_value!=null||ce(r).length>0)).sort((r,e)=>r.timestamp.localeCompare(e.timestamp))}function kr(s){return $r(s??[]).map(r=>({timestamp:r.timestamp,values:ce(r)})).filter(r=>r.values.length>0)}function Er(s,r,e){let t;for(let i of s){if(e!==void 0){let l=new Date(i.timestamp).getTime();if(!isNaN(l)&&l>=e)break}let a=i.values.find(l=>l.id===r);a&&(t=a)}return t}function Sr(s,r,e){let t=ce(r).find(a=>a.id===e);if(!t)return null;let i=null;for(let a of $r(s)){if(a.timestamp>=r.timestamp)break;let l=ce(a).find(u=>u.id===e);l&&(i=l.value)}return i==null?null:t.value-i}function Tr(s){let r=new Set,e=new Set;for(let t of s){let i=(t.name||"").trim().toLowerCase();i&&(r.has(i)?e.add(t.id):r.add(i))}return e}function Ar(s){let r=[],e=new Set,t=new Set;for(let i of s){let a=(i.name||"").trim();if(!(!a||e.has(i.id)||t.has(a.toLowerCase()))&&(e.add(i.id),t.add(a.toLowerCase()),r.push({id:i.id,name:a,unit:(i.unit||"").trim()||null}),r.length>=20))break}return r}var ye=w(()=>{"use strict"});function Q(s){return`${s.entry_id??""}\0${s.part_id}`}function Cr(s,r,e,t){let i=!!s.entry_id&&s.entry_id!==r,a=i?s.entry_id:r,l=e.find(m=>m.entry_id===a),u=(l?.parts||[]).find(m=>m.id===s.part_id)||null,h=i&&l?.object?.name||"",_=u?.name||n("shared_part_unknown",t);return{part:u,foreign:i,ownerName:h,label:h?`${_} (${h})`:_}}function Ir(s,r,e,t){let{part:i,label:a}=Cr(s,r,e,t),l=i&&i.stock!==null&&i.stock!==void 0?` (${i.stock}${i.unit?" "+i.unit:""})`:"",u=i?.storage_location?` \u2014 ${i.storage_location}`:"";return`${s.quantity}\xD7 ${a}${l}${u}`}function Rr(s,r,e,t){let a=(e.find(u=>u.entry_id===r)?.parts||[]).map(u=>({...u})),l=new Set(a.map(u=>Q({part_id:u.id})));for(let u of s?.consumes_parts||[]){if(!u.entry_id||u.entry_id===r)continue;let h=Q(u);if(l.has(h))continue;l.add(h);let{part:_,ownerName:m}=Cr(u,r,e,t);a.push({id:u.part_id,name:_?.name||n("shared_part_unknown",t),unit:_?.unit,stock:_?.stock??null,storage_location:_?.storage_location,entry_id:u.entry_id,owner_name:m})}return a}var vt=w(()=>{"use strict";C()});function Ze(s){let r=s.task??null,e=r?ti(r):null,t=e?e.consumesParts:r?.consumes_parts||[],i=!!r?.part_ref,a=s.objects.find(h=>h.entry_id===s.entryId)?.parts||[],l=i?a.find(h=>h.id===r.part_ref.part_id):void 0,u=s.checklistsEnabled??!0;return{entry_id:s.entryId,task_id:s.taskId,task_name:s.taskName,checklist:e?u?e.checklist:[]:s.checklist??[],adaptive_enabled:!!s.adaptiveEnabled,required_completion_fields:e?e.requiredFields:r?.required_completion_fields||[],task_type:r?.type||"",reading_unit:r?.reading_unit||"",readings:r?.readings||[],reading_history:kr(r?.history),parts:i?[]:Rr({consumes_parts:t},s.entryId,s.objects,s.lang),consumes_parts:i?[]:t,phase_label:e?de(r):"",require_tag_scan:!!r?.require_tag_scan,restock_default:i?l?.restock_quantity??1:null,restock_unit_cost:i?l?.cost??null:null,currency_symbol:le({currency_symbol:s.currencySymbol}),consumes_info:t.map(h=>Ir(h,s.entryId,s.objects,s.lang)),checklist_prefill:r?.checklist_progress||{},via_tag_scan:!!s.viaTagScan}}function Xe(s,r,e){s.entryId=r.entry_id,s.taskId=r.task_id,s.taskName=r.task_name,s.lang=e,s.checklist=r.checklist??[],s.adaptiveEnabled=!!r.adaptive_enabled,s.requiredFields=r.required_completion_fields??[],s.taskType=r.task_type??"",s.readingUnit=r.reading_unit??"",s.readings=r.readings??[],s.readingHistory=r.reading_history??[],s.parts=r.parts??[],s.consumesParts=r.consumes_parts??[],s.phaseLabel=r.phase_label??"",s.requireTagScan=!!r.require_tag_scan,s.restockDefault=r.restock_default??null,s.restockUnitCost=r.restock_unit_cost??null,s.currencySymbol=le(r),s.consumesInfo=r.consumes_info??[],s.checklistPrefill=r.checklist_prefill??{},s.viaTagScan=!!r.via_tag_scan,s.open({viaTagScan:!!r.via_tag_scan})}var bt=w(()=>{"use strict";ye();vt();ft();C()});function bn(s){let r=s.replace(/_ids?$/,"").split("_").filter(Boolean);if(r.length===0)return s;let e=r.join(" ");return e.charAt(0).toUpperCase()+e.slice(1)}function yn(s,r){let e=vn[s];if(e){let t=n(e,r);if(t&&t!==e)return t}return bn(s)}function xn(s){let r=[...s.matchAll(/\['([^']+)'\]/g)].map(i=>i[1]),e=r.length?r[r.length-1]:void 0,t;return(t=s.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=s.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=s.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=s.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(s)?{field:e,rule:"required"}:(t=s.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(s)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(s)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function wn(s,r){let e=new Set(Pr(r));return Pr(s).every(t=>e.has(t))}function R(s,r,e){if(e=e??n("action_error",r),typeof s=="string")return s;if(typeof s!="object"||s===null)return e;let t=s,i=t.message||t.error?.message||"",a=t.code||t.error?.code||"",l=a?fn[a]:void 0;if(!i&&!l)return e;let u=xn(i),h=u.field?yn(u.field,r):"",_=m=>n(m,r).replace("{field}",h).replace("{n}",u.param??"");switch(u.rule){case"too_long":return _("err_too_long");case"too_short":return _("err_too_short");case"value_too_high":return _("err_value_too_high");case"value_too_low":return _("err_value_too_low");case"required":return _("err_required");case"wrong_type":return _("err_wrong_type").replace("{type}",u.param??"");case"invalid_choice":return _("err_invalid_choice");case"invalid_value":return _("err_invalid_value");default:if(l){let m=n(l,r);return i&&!wn(i,a)?`${m} (${i})`:m}return i||e}}var fn,vn,Pr,ie=w(()=>{"use strict";C();fn={already_archived:"ws_err_already_archived",already_paused:"ws_err_already_paused",archived:"ws_err_archived",create_failed:"ws_err_create_failed",duplicate_failed:"ws_err_duplicate_failed",empty:"ws_err_empty",empty_csv:"ws_err_empty_csv",invalid_cursor:"ws_err_invalid_cursor",invalid_date:"ws_err_invalid_date",invalid_device:"ws_err_invalid_device",invalid_entity_slug:"ws_err_invalid_entity_slug",invalid_format:"ws_err_invalid_format",invalid_input:"ws_err_invalid_input",invalid_mirror_todo:"ws_err_invalid_mirror_todo",invalid_parent:"ws_err_invalid_parent",invalid_range:"ws_err_invalid_range",invalid_search_template:"ws_err_invalid_search_template",invalid_target:"ws_err_invalid_target",invalid_trigger_config:"ws_err_invalid_trigger_config",invalid_url:"ws_err_invalid_url",invalid_user:"ws_err_invalid_user",invalid_view:"ws_err_invalid_view",limit_reached:"ws_err_limit_reached",no_defaults:"ws_err_no_defaults",no_phases:"ws_err_no_phases",no_url:"ws_err_no_url",not_archived:"ws_err_not_archived",not_available:"ws_err_not_available",not_configured:"ws_err_not_configured",not_found:"ws_err_not_found",not_loaded:"ws_err_not_loaded",not_paused:"ws_err_not_paused",replace_failed:"ws_err_replace_failed",self_link_device:"ws_err_self_link_device",storage_unavailable:"ws_err_storage_unavailable",too_early:"ws_err_too_early",too_large:"ws_err_too_large",too_many:"ws_err_too_many",too_many_views:"ws_err_too_many_views",unauthorized:"ws_err_unauthorized",unavailable:"ws_err_unavailable"},vn={entry_id:"object",name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};Pr=s=>s.toLowerCase().split(/[^a-z0-9]+/).filter(r=>r.length>1)});var ii,et,ri=w(()=>{"use strict";ii=["notes","cost","duration","photo","user"],et={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});function yt(s){if(!s)return[];let r=[],e=s.photo_doc_id;typeof e=="string"&&r.push(e);let t=s.photo_doc_ids;Array.isArray(t)&&r.push(...t);let i=[];for(let a of r){if(typeof a!="string")continue;let l=a.trim();if(!(!l||i.includes(l))&&(i.push(l),i.length>=10))break}return i}var xt=w(()=>{"use strict"});async function $n(s,r,e,t){let i=new FormData;i.append("entry_id",r);for(let u of t)i.append("tags",u);i.append("file",e,e.name);let a=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${s.auth?.data?.access_token??""}`},body:i});if(a.status===413)throw new Error("doc_too_large");if(!a.ok)throw new Error("doc_upload_failed");let l=await a.json();if(!l.id)throw new Error("doc_upload_failed");return{id:l.id,deduped:!!l.deduped,duplicate_in_object:l.duplicate_in_object??null}}async function Nr(s,r,e){return(await $n(s,r,e,["photo"])).id}async function si(s,r){await Promise.all(r.map(e=>s.connection.sendMessagePromise({type:"maintenance_supporter/documents/delete",doc_id:e}).catch(()=>{})))}var jr=w(()=>{"use strict";xt()});var Re,ni=w(()=>{"use strict";C();jr();Re=class{constructor(r,e){this.host=r;this.opts=e;this.photos=[];this.uploadedIds=[];this.uploading=!1;this.errorKey="";this.max=e.max??10,r.addController(this)}hostConnected(){}get ids(){return this.photos.map(r=>r.id)}get remaining(){return Math.max(this.max-this.photos.length,0)}get full(){return this.remaining===0}errorText(r){return this.errorKey?n(this.errorKey,r).replace("{max}",String(this.max)):""}clearError(){this.errorKey=""}reset(r=[]){this._revokeAll(),this.photos=r.map(e=>({id:e,preview:""})),this.uploadedIds=[],this.uploading=!1,this.errorKey="",this.host.requestUpdate()}async addFiles(r){if(r.length===0)return;let e=r.slice(0,this.remaining);this.uploading=!0,this.errorKey="",this.host.requestUpdate();try{for(let t of e){let i=await Nr(this.opts.hass(),this.opts.entryId(),t);this.uploadedIds=[...this.uploadedIds,i],this.photos=[...this.photos,{id:i,preview:URL.createObjectURL(t)}],this.host.requestUpdate()}r.length>e.length&&(this.errorKey="photos_limit")}catch(t){this.errorKey=t instanceof Error&&t.message==="doc_too_large"?"doc_too_large":"doc_upload_failed"}finally{this.uploading=!1,this.host.requestUpdate()}}remove(r){let e=this.photos.find(t=>t.id===r);e?.preview&&URL.revokeObjectURL(e.preview),this.photos=this.photos.filter(t=>t.id!==r),this.uploadedIds.includes(r)&&(this.uploadedIds=this.uploadedIds.filter(t=>t!==r),si(this.opts.hass(),[r])),this.host.requestUpdate()}discardOrphans(){if(this.uploadedIds.length===0)return;let r=this.uploadedIds;this.uploadedIds=[],si(this.opts.hass(),r)}markAttached(){this.uploadedIds=[]}_revokeAll(){for(let r of this.photos)r.preview&&URL.revokeObjectURL(r.preview)}}});function kn(s){let e=F("2001-02-03",s).match(/\d+/g)||[],t=u=>e.findIndex(h=>Number(h)===u),i=t(2001),a=t(2),l=t(3);return i===0?"YMD":a>=0&&l>=0&&a9999||r<1||r>12||e<1||e>31)return null;let t=new Date(s,r-1,e);return t.getFullYear()!==s||t.getMonth()!==r-1||t.getDate()!==e?null:`${s}-${String(r).padStart(2,"0")}-${String(e).padStart(2,"0")}`}function Hr(s,r){let e=s.trim(),t;if(t=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return Pe(+t[1],+t[2],+t[3]);if(t=e.match(/^(\d{4})$/))return Pe(+t[1],1,1);if(t=e.match(/^(\d{1,2})[./](\d{4})$/))return Pe(+t[2],+t[1],1);if(t=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return Pe(+t[3],+t[2],+t[1]);if(t=e.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let i=+t[1],a=+t[2],l=+t[3];return kn(r)==="MDY"?Pe(l,i,a):Pe(l,a,i)}return null}var Or=w(()=>{"use strict";C()});function En(s,r){if(r)switch(s){case"date":return r.split("T")[0];case"time":return r.length===5?`${r}:00`:r;case"datetime":{let[e,t="00:00:00"]=r.split("T");return`${e} ${t.length===5?`${t}:00`:t}`}}}function Sn(s,r){if(typeof r!="string"||!r)return"";switch(s){case"date":return r.slice(0,10);case"time":return r.slice(0,5);case"datetime":{let[e,t="00:00:00"]=r.split(" ");return`${e}T${t.length===5?`${t}:00`:t}`}}}var M,Le=w(()=>{"use strict";I();q();C();Or();M=class extends E{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let e=Hr(this._typed,this.lang);if(!e){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(e)}_onTypedKey(e){e.key==="Enter"?(e.preventDefault(),this._commitTyped()):e.key==="Escape"&&(e.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(e){e.stopPropagation(),this._emit(Sn(this.kind,e.detail?.value))}_clear(){this._emit("")}_emit(e){e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:e}})))}render(){return o` +`});function br(s,r,e){let t=new Blob([s],{type:e}),i=URL.createObjectURL(t),a=document.createElement("a");a.href=i,a.download=r,a.target="_blank",a.rel="noopener",a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(i),6e4)}var Yt=w(()=>{"use strict"});async function pn(s,r,e=300){return(await s.connection.sendMessagePromise({type:"auth/sign_path",path:r,expires:e})).path}async function Gt(s,r,e=300){return pn(s,`/api/maintenance_supporter/document/${r}`,e)}async function yr(s,r,e=""){let t=window.open("about:blank","_blank");try{let i=await Gt(s,r);t&&(t.location.href=new URL(i+e,window.location.origin).href)}catch(i){throw t&&t.close(),i}}var Qt=w(()=>{"use strict";Yt()});function mt(s){return!!s&&/^https?:\/\//i.test(s)}var Jt=w(()=>{"use strict"});function hn(s){let r=(s||"").split(/\s+/).filter(Boolean);return r.length===0?"?":r.length===1?r[0][0].toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function un(s){let r=0;for(let e of s)r=r*31+e.charCodeAt(0)>>>0;return xr[r%xr.length]}function gt(s){return s?{id:s.id,name:s.name,initials:s.initials||hn(s.name),color:s.color||un(s.id)}:null}function Zt(s){return s?o`${s.initials}`:c}var xr,Xt=w(()=>{"use strict";I();xr=["#c62828","#ad1457","#6a1b9a","#4527a0","#283593","#1565c0","#00838f","#2e7d32","#558b2f","#ef6c00","#6d4c41","#546e7a"]});var Ie,ei=w(()=>{"use strict";Xt();Ie=class{constructor(r){this.usersCache=null;this.cacheTimestamp=0;this.CACHE_TTL_MS=6e4;this.hass=r}updateHass(r){this.hass=r}async getUsers(r=!1){let e=Date.now();if(!r&&this.usersCache&&e-this.cacheTimestampt.id===r)?.name||null}getPerson(r){return gt(this.getUser(r))}getUser(r){return!r||!this.usersCache?null:this.usersCache.find(e=>e.id===r)||null}getCurrentUserId(){return this.hass.user?.id||null}isCurrentUser(r){return r?r===this.getCurrentUserId():!1}clearCache(){this.usersCache=null,this.cacheTimestamp=0}}});function _n(s,r){if(r<=0)return 0;let e=typeof s=="number"&&Number.isFinite(s)?Math.trunc(s):0;return e<0?0:e%r}function mn(s){return!!(s?.phases&&s.phase_sequence&&s.phase_sequence.length>0)}function ti(s){if(!s||!mn(s))return null;let r=s.phase_sequence,e=_n(s.phase_cursor,r.length),t=r[e],i=s.phases?.[t];return i?{id:t,name:i.name,index:e,count:r.length,notes:i.notes,checklist:i.checklist!==void 0?i.checklist:s.checklist??[],consumesParts:i.consumes_parts!==void 0?i.consumes_parts:s.consumes_parts??[],requiredFields:i.required_completion_fields!==void 0?i.required_completion_fields:s.required_completion_fields??[]}:null}function ce(s){let r=ti(s);return r?`${r.index+1}/${r.count} \xB7 ${r.name}`:""}var ft=w(()=>{"use strict"});function wr(){let s=new Uint8Array(4);return(globalThis.crypto??{getRandomValues:r=>r.map(()=>Math.floor(Math.random()*256))}).getRandomValues(s),Array.from(s,r=>r.toString(16).padStart(2,"0")).join("")}function pe(s){let r=s?.reading_values;if(!Array.isArray(r))return[];let e=[],t=new Set;for(let i of r){if(!i||typeof i!="object")continue;let a=i;typeof a.id!="string"||!a.id||t.has(a.id)||typeof a.value!="number"||!Number.isFinite(a.value)||(t.add(a.id),e.push({id:a.id,name:typeof a.name=="string"?a.name:a.id,unit:typeof a.unit=="string"?a.unit:null,value:a.value}))}return e}function $r(s){return s.filter(r=>r.type==="completed"&&(r.reading_value!=null||pe(r).length>0)).sort((r,e)=>r.timestamp.localeCompare(e.timestamp))}function kr(s){return $r(s??[]).map(r=>({timestamp:r.timestamp,values:pe(r)})).filter(r=>r.values.length>0)}function Er(s,r,e){let t;for(let i of s){if(e!==void 0){let l=new Date(i.timestamp).getTime();if(!isNaN(l)&&l>=e)break}let a=i.values.find(l=>l.id===r);a&&(t=a)}return t}function Sr(s,r,e){let t=pe(r).find(a=>a.id===e);if(!t)return null;let i=null;for(let a of $r(s)){if(a.timestamp>=r.timestamp)break;let l=pe(a).find(u=>u.id===e);l&&(i=l.value)}return i==null?null:t.value-i}function Tr(s){let r=new Set,e=new Set;for(let t of s){let i=(t.name||"").trim().toLowerCase();i&&(r.has(i)?e.add(t.id):r.add(i))}return e}function Ar(s){let r=[],e=new Set,t=new Set;for(let i of s){let a=(i.name||"").trim();if(!(!a||e.has(i.id)||t.has(a.toLowerCase()))&&(e.add(i.id),t.add(a.toLowerCase()),r.push({id:i.id,name:a,unit:(i.unit||"").trim()||null}),r.length>=20))break}return r}var ye=w(()=>{"use strict"});function Q(s){return`${s.entry_id??""}\0${s.part_id}`}function Cr(s,r,e,t){let i=!!s.entry_id&&s.entry_id!==r,a=i?s.entry_id:r,l=e.find(m=>m.entry_id===a),u=(l?.parts||[]).find(m=>m.id===s.part_id)||null,h=i&&l?.object?.name||"",_=u?.name||n("shared_part_unknown",t);return{part:u,foreign:i,ownerName:h,label:h?`${_} (${h})`:_}}function Ir(s,r,e,t){let{part:i,label:a}=Cr(s,r,e,t),l=i&&i.stock!==null&&i.stock!==void 0?` (${i.stock}${i.unit?" "+i.unit:""})`:"",u=i?.storage_location?` \u2014 ${i.storage_location}`:"";return`${s.quantity}\xD7 ${a}${l}${u}`}function Rr(s,r,e,t){let a=(e.find(u=>u.entry_id===r)?.parts||[]).map(u=>({...u})),l=new Set(a.map(u=>Q({part_id:u.id})));for(let u of s?.consumes_parts||[]){if(!u.entry_id||u.entry_id===r)continue;let h=Q(u);if(l.has(h))continue;l.add(h);let{part:_,ownerName:m}=Cr(u,r,e,t);a.push({id:u.part_id,name:_?.name||n("shared_part_unknown",t),unit:_?.unit,stock:_?.stock??null,storage_location:_?.storage_location,entry_id:u.entry_id,owner_name:m})}return a}var vt=w(()=>{"use strict";C()});function Ze(s){let r=s.task??null,e=r?ti(r):null,t=e?e.consumesParts:r?.consumes_parts||[],i=!!r?.part_ref,a=s.objects.find(h=>h.entry_id===s.entryId)?.parts||[],l=i?a.find(h=>h.id===r.part_ref.part_id):void 0,u=s.checklistsEnabled??!0;return{entry_id:s.entryId,task_id:s.taskId,task_name:s.taskName,checklist:e?u?e.checklist:[]:s.checklist??[],adaptive_enabled:!!s.adaptiveEnabled,required_completion_fields:e?e.requiredFields:r?.required_completion_fields||[],task_type:r?.type||"",reading_unit:r?.reading_unit||"",readings:r?.readings||[],reading_history:kr(r?.history),parts:i?[]:Rr({consumes_parts:t},s.entryId,s.objects,s.lang),consumes_parts:i?[]:t,phase_label:e?ce(r):"",require_tag_scan:!!r?.require_tag_scan,restock_default:i?l?.restock_quantity??1:null,restock_unit_cost:i?l?.cost??null:null,currency_symbol:de({currency_symbol:s.currencySymbol}),consumes_info:t.map(h=>Ir(h,s.entryId,s.objects,s.lang)),checklist_prefill:r?.checklist_progress||{},via_tag_scan:!!s.viaTagScan}}function Xe(s,r,e){s.entryId=r.entry_id,s.taskId=r.task_id,s.taskName=r.task_name,s.lang=e,s.checklist=r.checklist??[],s.adaptiveEnabled=!!r.adaptive_enabled,s.requiredFields=r.required_completion_fields??[],s.taskType=r.task_type??"",s.readingUnit=r.reading_unit??"",s.readings=r.readings??[],s.readingHistory=r.reading_history??[],s.parts=r.parts??[],s.consumesParts=r.consumes_parts??[],s.phaseLabel=r.phase_label??"",s.requireTagScan=!!r.require_tag_scan,s.restockDefault=r.restock_default??null,s.restockUnitCost=r.restock_unit_cost??null,s.currencySymbol=de(r),s.consumesInfo=r.consumes_info??[],s.checklistPrefill=r.checklist_prefill??{},s.viaTagScan=!!r.via_tag_scan,s.open({viaTagScan:!!r.via_tag_scan})}var bt=w(()=>{"use strict";ye();vt();ft();C()});function bn(s){let r=s.replace(/_ids?$/,"").split("_").filter(Boolean);if(r.length===0)return s;let e=r.join(" ");return e.charAt(0).toUpperCase()+e.slice(1)}function yn(s,r){let e=vn[s];if(e){let t=n(e,r);if(t&&t!==e)return t}return bn(s)}function xn(s){let r=[...s.matchAll(/\['([^']+)'\]/g)].map(i=>i[1]),e=r.length?r[r.length-1]:void 0,t;return(t=s.match(/length of value must be at most (\d+)/))?{field:e,rule:"too_long",param:t[1]}:(t=s.match(/length of value must be at least (\d+)/))?{field:e,rule:"too_short",param:t[1]}:(t=s.match(/value must be at most (\S+)/))?{field:e,rule:"value_too_high",param:t[1]}:(t=s.match(/value must be at least (\S+)/))?{field:e,rule:"value_too_low",param:t[1]}:/required key not provided/.test(s)?{field:e,rule:"required"}:(t=s.match(/expected (\w+)/))?{field:e,rule:"wrong_type",param:t[1]}:/value must be one of/.test(s)?{field:e,rule:"invalid_choice"}:/not a valid value/.test(s)?{field:e,rule:"invalid_value"}:{field:e,rule:"unknown"}}function wn(s,r){let e=new Set(Pr(r));return Pr(s).every(t=>e.has(t))}function R(s,r,e){if(e=e??n("action_error",r),typeof s=="string")return s;if(typeof s!="object"||s===null)return e;let t=s,i=t.message||t.error?.message||"",a=t.code||t.error?.code||"",l=a?fn[a]:void 0;if(!i&&!l)return e;let u=xn(i),h=u.field?yn(u.field,r):"",_=m=>n(m,r).replace("{field}",h).replace("{n}",u.param??"");switch(u.rule){case"too_long":return _("err_too_long");case"too_short":return _("err_too_short");case"value_too_high":return _("err_value_too_high");case"value_too_low":return _("err_value_too_low");case"required":return _("err_required");case"wrong_type":return _("err_wrong_type").replace("{type}",u.param??"");case"invalid_choice":return _("err_invalid_choice");case"invalid_value":return _("err_invalid_value");default:if(l){let m=n(l,r);return i&&!wn(i,a)?`${m} (${i})`:m}return i||e}}var fn,vn,Pr,ie=w(()=>{"use strict";C();fn={already_archived:"ws_err_already_archived",already_paused:"ws_err_already_paused",archived:"ws_err_archived",create_failed:"ws_err_create_failed",duplicate_failed:"ws_err_duplicate_failed",empty:"ws_err_empty",empty_csv:"ws_err_empty_csv",invalid_cursor:"ws_err_invalid_cursor",invalid_date:"ws_err_invalid_date",invalid_device:"ws_err_invalid_device",invalid_entity_slug:"ws_err_invalid_entity_slug",invalid_format:"ws_err_invalid_format",invalid_input:"ws_err_invalid_input",invalid_mirror_todo:"ws_err_invalid_mirror_todo",invalid_parent:"ws_err_invalid_parent",invalid_range:"ws_err_invalid_range",invalid_search_template:"ws_err_invalid_search_template",invalid_target:"ws_err_invalid_target",invalid_trigger_config:"ws_err_invalid_trigger_config",invalid_url:"ws_err_invalid_url",invalid_user:"ws_err_invalid_user",invalid_view:"ws_err_invalid_view",limit_reached:"ws_err_limit_reached",no_defaults:"ws_err_no_defaults",no_phases:"ws_err_no_phases",no_url:"ws_err_no_url",not_archived:"ws_err_not_archived",not_available:"ws_err_not_available",not_configured:"ws_err_not_configured",not_found:"ws_err_not_found",not_loaded:"ws_err_not_loaded",not_paused:"ws_err_not_paused",replace_failed:"ws_err_replace_failed",self_link_device:"ws_err_self_link_device",storage_unavailable:"ws_err_storage_unavailable",too_early:"ws_err_too_early",too_large:"ws_err_too_large",too_many:"ws_err_too_many",too_many_views:"ws_err_too_many_views",unauthorized:"ws_err_unauthorized",unavailable:"ws_err_unavailable"},vn={entry_id:"object",name:"name",task_type:"maintenance_type",schedule_type:"schedule_type",interval_days:"interval_days",interval_anchor:"interval_anchor",warning_days:"warning_days",last_performed:"last_performed_optional",notes:"notes_optional",documentation_url:"documentation_url_optional",custom_icon:"custom_icon_optional",nfc_tag_id:"nfc_tag_id_optional",responsible_user_id:"responsible_user",entity_slug:"entity_slug",entity_id:"entity_id",area_id:"area_id_optional",manufacturer:"manufacturer_optional",model:"model_optional",serial_number:"serial_number_optional",installation_date:"installation_date_optional",warranty_expiry:"warranty_expiry_optional",checklist:"checklist_steps_optional",reason:"reason",feedback:"feedback",cost:"cost",duration:"duration",description:"description_optional",environmental_entity:"environmental_entity_optional",environmental_attribute:"environmental_attribute_optional",trigger_above:"trigger_above",trigger_below:"trigger_below",trigger_equals:"trigger_equals",trigger_not_equals:"trigger_not_equals",trigger_for_minutes:"trigger_for_minutes"};Pr=s=>s.toLowerCase().split(/[^a-z0-9]+/).filter(r=>r.length>1)});var ii,et,ri=w(()=>{"use strict";ii=["notes","cost","duration","photo","user"],et={notes:"notes_label",cost:"cost",duration:"duration",photo:"photo_label",user:"user_label"}});function yt(s){if(!s)return[];let r=[],e=s.photo_doc_id;typeof e=="string"&&r.push(e);let t=s.photo_doc_ids;Array.isArray(t)&&r.push(...t);let i=[];for(let a of r){if(typeof a!="string")continue;let l=a.trim();if(!(!l||i.includes(l))&&(i.push(l),i.length>=10))break}return i}var xt=w(()=>{"use strict"});async function $n(s,r,e,t){let i=new FormData;i.append("entry_id",r);for(let u of t)i.append("tags",u);i.append("file",e,e.name);let a=await fetch("/api/maintenance_supporter/document/upload",{method:"POST",headers:{Authorization:`Bearer ${s.auth?.data?.access_token??""}`},body:i});if(a.status===413)throw new Error("doc_too_large");if(!a.ok)throw new Error("doc_upload_failed");let l=await a.json();if(!l.id)throw new Error("doc_upload_failed");return{id:l.id,deduped:!!l.deduped,duplicate_in_object:l.duplicate_in_object??null}}async function Nr(s,r,e){return(await $n(s,r,e,["photo"])).id}async function si(s,r){await Promise.all(r.map(e=>s.connection.sendMessagePromise({type:"maintenance_supporter/documents/delete",doc_id:e}).catch(()=>{})))}var jr=w(()=>{"use strict";xt()});var Re,ni=w(()=>{"use strict";C();jr();Re=class{constructor(r,e){this.host=r;this.opts=e;this.photos=[];this.uploadedIds=[];this.uploading=!1;this.errorKey="";this.max=e.max??10,r.addController(this)}hostConnected(){}get ids(){return this.photos.map(r=>r.id)}get remaining(){return Math.max(this.max-this.photos.length,0)}get full(){return this.remaining===0}errorText(r){return this.errorKey?n(this.errorKey,r).replace("{max}",String(this.max)):""}clearError(){this.errorKey=""}reset(r=[]){this._revokeAll(),this.photos=r.map(e=>({id:e,preview:""})),this.uploadedIds=[],this.uploading=!1,this.errorKey="",this.host.requestUpdate()}async addFiles(r){if(r.length===0)return;let e=r.slice(0,this.remaining);this.uploading=!0,this.errorKey="",this.host.requestUpdate();try{for(let t of e){let i=await Nr(this.opts.hass(),this.opts.entryId(),t);this.uploadedIds=[...this.uploadedIds,i],this.photos=[...this.photos,{id:i,preview:URL.createObjectURL(t)}],this.host.requestUpdate()}r.length>e.length&&(this.errorKey="photos_limit")}catch(t){this.errorKey=t instanceof Error&&t.message==="doc_too_large"?"doc_too_large":"doc_upload_failed"}finally{this.uploading=!1,this.host.requestUpdate()}}remove(r){let e=this.photos.find(t=>t.id===r);e?.preview&&URL.revokeObjectURL(e.preview),this.photos=this.photos.filter(t=>t.id!==r),this.uploadedIds.includes(r)&&(this.uploadedIds=this.uploadedIds.filter(t=>t!==r),si(this.opts.hass(),[r])),this.host.requestUpdate()}discardOrphans(){if(this.uploadedIds.length===0)return;let r=this.uploadedIds;this.uploadedIds=[],si(this.opts.hass(),r)}markAttached(){this.uploadedIds=[]}_revokeAll(){for(let r of this.photos)r.preview&&URL.revokeObjectURL(r.preview)}}});function kn(s){let e=F("2001-02-03",s).match(/\d+/g)||[],t=u=>e.findIndex(h=>Number(h)===u),i=t(2001),a=t(2),l=t(3);return i===0?"YMD":a>=0&&l>=0&&a9999||r<1||r>12||e<1||e>31)return null;let t=new Date(s,r-1,e);return t.getFullYear()!==s||t.getMonth()!==r-1||t.getDate()!==e?null:`${s}-${String(r).padStart(2,"0")}-${String(e).padStart(2,"0")}`}function Hr(s,r){let e=s.trim(),t;if(t=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/))return Pe(+t[1],+t[2],+t[3]);if(t=e.match(/^(\d{4})$/))return Pe(+t[1],1,1);if(t=e.match(/^(\d{1,2})[./](\d{4})$/))return Pe(+t[2],+t[1],1);if(t=e.match(/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/))return Pe(+t[3],+t[2],+t[1]);if(t=e.match(/^(\d{1,2})[/-](\d{1,2})[/-](\d{4})$/)){let i=+t[1],a=+t[2],l=+t[3];return kn(r)==="MDY"?Pe(l,i,a):Pe(l,a,i)}return null}var Or=w(()=>{"use strict";C()});function En(s,r){if(r)switch(s){case"date":return r.split("T")[0];case"time":return r.length===5?`${r}:00`:r;case"datetime":{let[e,t="00:00:00"]=r.split("T");return`${e} ${t.length===5?`${t}:00`:t}`}}}function Sn(s,r){if(typeof r!="string"||!r)return"";switch(s){case"date":return r.slice(0,10);case"time":return r.slice(0,5);case"datetime":{let[e,t="00:00:00"]=r.split(" ");return`${e}T${t.length===5?`${t}:00`:t}`}}}var M,Le=w(()=>{"use strict";I();q();C();Or();M=class extends E{constructor(){super(...arguments);this.kind="date";this.label="";this.value="";this.clearable=!1;this.disabled=!1;this.required=!1;this.lang="en";this._typing=!1;this._typed="";this._typedInvalid=!1}_startTyping(){this._typed=this.value,this._typedInvalid=!1,this._typing=!0,this.updateComplete.then(()=>this.shadowRoot?.querySelector("input.typed")?.focus())}_commitTyped(){if(!this._typed.trim()){this._typing=!1;return}let e=Hr(this._typed,this.lang);if(!e){this._typedInvalid=!0;return}this._typing=!1,this._typedInvalid=!1,this._emit(e)}_onTypedKey(e){e.key==="Enter"?(e.preventDefault(),this._commitTyped()):e.key==="Escape"&&(e.preventDefault(),this._typing=!1,this._typedInvalid=!1)}_selector(){switch(this.kind){case"date":return{date:{}};case"time":return{time:{no_second:!0}};case"datetime":return{datetime:{}}}}_onSelectorChange(e){e.stopPropagation(),this._emit(Sn(this.kind,e.detail?.value))}_clear(){this._emit("")}_emit(e){e!==this.value&&(this.value=e,this.dispatchEvent(new CustomEvent("value-changed",{bubbles:!0,composed:!0,detail:{value:e}})))}render(){return o`
${this.label?o`${this.label}${this.required?o`*`:c}`:c}
@@ -1331,20 +1331,21 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" } input.typed[aria-invalid="true"] { border-color: var(--error-color, #f44336); } input.typed:focus { outline: 2px solid var(--primary-color); outline-offset: -1px; } - `,d([v({attribute:!1})],M.prototype,"hass",2),d([v()],M.prototype,"kind",2),d([v()],M.prototype,"label",2),d([v()],M.prototype,"value",2),d([v()],M.prototype,"helper",2),d([v({type:Boolean})],M.prototype,"clearable",2),d([v({type:Boolean})],M.prototype,"disabled",2),d([v({type:Boolean})],M.prototype,"required",2),d([v()],M.prototype,"lang",2),d([p()],M.prototype,"_typing",2),d([p()],M.prototype,"_typed",2),d([p()],M.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",M)});function wt(){if(window.externalApp!==void 0)return!0;let r=typeof navigator<"u"&&navigator.userAgent||"";return/Home Assistant\//.test(r)&&/Android/.test(r)}var ai=w(()=>{"use strict"});function tt(s){try{return localStorage.getItem(s)}catch{return null}}function it(s,r){try{localStorage.setItem(s,r)}catch{}}var pe,oi=w(()=>{"use strict";pe={objectSections:"msp-object-sections",printOptions:"msp-print-options",batteryRosterOpen:"msp-bf-roster-open",docSort:"msp-doc-sort",cameraDevice:"msp-camera-device",overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view",objectsCache:"msp-objects-cache",gettingStartedDismissed:"msp-gs-dismissed",batteryRosterSort:"ms_bf_roster_sort"}});function qr(){if(!wt())return!1;let s=typeof navigator<"u"?navigator.mediaDevices:void 0;return!!s&&typeof s.getUserMedia=="function"}var Tn,An,he,li=w(()=>{"use strict";I();q();C();ai();oi();Tn=1920,An=.88,he=class extends E{constructor(){super(...arguments);this.lang="en";this._open=!1;this._busy=!1;this._devices=[];this._stream=null}async open(){if(this._open)return;let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||typeof e.getUserMedia!="function"){this._unavailable("no_media_devices");return}let t=tt(pe.cameraDevice),i=!1;if(t)try{this._stream=await e.getUserMedia({video:{deviceId:{exact:t}},audio:!1}),i=!0}catch{}if(!i){try{this._stream=await e.getUserMedia({video:{facingMode:{ideal:"environment"},advanced:[{zoom:1}]},audio:!1})}catch(l){this._unavailable(l instanceof Error?l.name||l.message:String(l));return}await this._preferMainBackCamera(e)}await this._applyZoomOne(),await this._listDevices(e),this._open=!0,await this.updateComplete;let a=this._video;if(a&&this._stream){a.srcObject=this._stream;try{await a.play()}catch{}}}async _preferMainBackCamera(e){if(typeof e.enumerateDevices!="function")return;let t=[];try{t=await e.enumerateDevices()}catch{return}let i=h=>{let _=/camera2?\s*(\d+)/i.exec(h.label);return _?Number(_[1]):Number.MAX_SAFE_INTEGER},a=t.filter(h=>h.kind==="videoinput"&&h.deviceId&&/back|rear|environment|rück|hinten/i.test(h.label)).sort((h,_)=>i(h)-i(_)),u=this._stream?.getVideoTracks()[0]?.getSettings().deviceId;if(a.length>1&&a[0].deviceId!==u)try{let h=await e.getUserMedia({video:{deviceId:{exact:a[0].deviceId}},audio:!1});for(let _ of this._stream?.getTracks()??[])_.stop();this._stream=h}catch{}}async _applyZoomOne(){let e=this._stream?.getVideoTracks()[0],t=e&&typeof e.getCapabilities=="function"?e.getCapabilities():void 0;if(t?.zoom&&typeof t.zoom.min=="number"&&t.zoom.min<1&&(t.zoom.max??1)>=1)try{await e.applyConstraints({advanced:[{zoom:1}]})}catch{}}async _listDevices(e){if(typeof e.enumerateDevices=="function")try{this._devices=(await e.enumerateDevices()).filter(t=>t.kind==="videoinput"&&!!t.deviceId)}catch{this._devices=[]}}get _currentDeviceId(){return this._stream?.getVideoTracks()[0]?.getSettings().deviceId}async _switchCamera(){let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||this._devices.length<2||this._busy)return;let t=this._devices.map(l=>l.deviceId),i=t.indexOf(this._currentDeviceId??""),a=t[(i+1)%t.length];this._busy=!0;try{let l=await e.getUserMedia({video:{deviceId:{exact:a}},audio:!1});for(let h of this._stream?.getTracks()??[])h.stop();this._stream=l,await this._applyZoomOne(),it(pe.cameraDevice,a);let u=this._video;if(u){u.srcObject=l;try{await u.play()}catch{}}}catch{}finally{this._busy=!1}}close(){this._stopStream(),this._open=!1,this._busy=!1}disconnectedCallback(){super.disconnectedCallback(),this._stopStream()}get _video(){return this.shadowRoot?.querySelector("video")??null}_stopStream(){for(let t of this._stream?.getTracks()??[])t.stop();this._stream=null;let e=this._video;e&&(e.srcObject=null)}_unavailable(e){this._stopStream(),this._open=!1,this.dispatchEvent(new CustomEvent("capture-unavailable",{detail:{reason:e},bubbles:!0,composed:!0}))}async _shoot(){let e=this._video;if(!(!e||this._busy)){this._busy=!0;try{let t=e.videoWidth||640,i=e.videoHeight||480,a=Math.min(1,Tn/Math.max(t,i)),l=document.createElement("canvas");l.width=Math.round(t*a),l.height=Math.round(i*a);let u=l.getContext("2d");if(!u)throw new Error("no_canvas");u.drawImage(e,0,0,l.width,l.height);let h=await new Promise(b=>l.toBlob(b,"image/jpeg",An));if(!h)throw new Error("no_blob");let _=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),m=new File([h],`photo-${_}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:m},bubbles:!0,composed:!0}))}catch(t){this._unavailable(t instanceof Error?t.message:String(t))}finally{this._busy=!1}}}render(){if(!this._open)return c;let e=this.lang;return o` + `,d([v({attribute:!1})],M.prototype,"hass",2),d([v()],M.prototype,"kind",2),d([v()],M.prototype,"label",2),d([v()],M.prototype,"value",2),d([v()],M.prototype,"helper",2),d([v({type:Boolean})],M.prototype,"clearable",2),d([v({type:Boolean})],M.prototype,"disabled",2),d([v({type:Boolean})],M.prototype,"required",2),d([v()],M.prototype,"lang",2),d([p()],M.prototype,"_typing",2),d([p()],M.prototype,"_typed",2),d([p()],M.prototype,"_typedInvalid",2);customElements.get("ms-date-field")||customElements.define("ms-date-field",M)});function wt(){if(window.externalApp!==void 0)return!0;let r=typeof navigator<"u"&&navigator.userAgent||"";return/Home Assistant\//.test(r)&&/Android/.test(r)}var ai=w(()=>{"use strict"});function tt(s){try{return localStorage.getItem(s)}catch{return null}}function it(s,r){try{localStorage.setItem(s,r)}catch{}}var he,oi=w(()=>{"use strict";he={objectSections:"msp-object-sections",printOptions:"msp-print-options",batteryRosterOpen:"msp-bf-roster-open",docSort:"msp-doc-sort",cameraDevice:"msp-camera-device",overviewTab:"msp-overview-tab",collapsedSections:"msp-collapsed-sections",chartRange:"msp-chart-range",chartHideOutliers:"msp-chart-hide-outliers",taskSort:"maintenance_supporter_sort",objectSort:"maintenance_supporter_object_sort",groupBy:"maintenance_supporter_groupby",objectView:"maintenance_supporter_object_view",objectsCache:"msp-objects-cache",gettingStartedDismissed:"msp-gs-dismissed",batteryRosterSort:"ms_bf_roster_sort"}});function qr(){if(!wt())return!1;let s=typeof navigator<"u"?navigator.mediaDevices:void 0;return!!s&&typeof s.getUserMedia=="function"}var Tn,An,re,li=w(()=>{"use strict";I();q();C();ai();oi();Tn=1920,An=.88,re=class extends E{constructor(){super(...arguments);this.lang="en";this._open=!1;this._busy=!1;this._devices=[];this._deviceIndex=-1;this._stream=null}async open(){if(this._open)return;let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||typeof e.getUserMedia!="function"){this._unavailable("no_media_devices");return}let t=tt(he.cameraDevice),i=!1;if(t)try{this._stream=await e.getUserMedia({video:{deviceId:{exact:t}},audio:!1}),i=!0}catch{}if(!i){try{this._stream=await e.getUserMedia({video:{facingMode:{ideal:"environment"},zoom:1,advanced:[{zoom:1}]},audio:!1})}catch(l){this._unavailable(l instanceof Error?l.name||l.message:String(l));return}await this._preferMainBackCamera(e)}await this._applyZoomOne(),await this._listDevices(e),this._deviceIndex=this._indexOfCurrent(t&&i?t:null),this._open=!0,await this.updateComplete;let a=this._video;if(a&&this._stream){a.srcObject=this._stream;try{await a.play()}catch{}}}async _preferMainBackCamera(e){if(typeof e.enumerateDevices!="function")return;let t=[];try{t=await e.enumerateDevices()}catch{return}let i=h=>{let _=/camera2?\s*(\d+)/i.exec(h.label);return _?Number(_[1]):Number.MAX_SAFE_INTEGER},a=t.filter(h=>h.kind==="videoinput"&&h.deviceId&&/back|rear|environment|rück|hinten/i.test(h.label)).sort((h,_)=>i(h)-i(_)),u=this._stream?.getVideoTracks()[0]?.getSettings().deviceId;if(a.length>1&&a[0].deviceId!==u)try{let h=await e.getUserMedia({video:{deviceId:{exact:a[0].deviceId}},audio:!1});for(let _ of this._stream?.getTracks()??[])_.stop();this._stream=h}catch{}}async _applyZoomOne(){let e=this._stream?.getVideoTracks()[0],t=e&&typeof e.getCapabilities=="function"?e.getCapabilities():void 0;if(!(!t?.zoom||typeof t.zoom.min!="number"||t.zoom.min>=1||(t.zoom.max??1)<1))for(let i of[{zoom:1},{advanced:[{zoom:1}]}])try{await e.applyConstraints(i);return}catch{}}_indexOfCurrent(e){let t=this._devices.map(a=>a.deviceId),i=this._currentDeviceId;for(let a of[e,i])if(a){let l=t.indexOf(a);if(l>=0)return l}return-1}async _listDevices(e){if(typeof e.enumerateDevices=="function")try{this._devices=(await e.enumerateDevices()).filter(t=>t.kind==="videoinput"&&!!t.deviceId)}catch{this._devices=[]}}get _currentDeviceId(){return this._stream?.getVideoTracks()[0]?.getSettings().deviceId}async _switchCamera(){let e=typeof navigator<"u"?navigator.mediaDevices:void 0;if(!e||this._devices.length<2||this._busy)return;let t=this._devices.map(i=>i.deviceId);this._busy=!0;try{for(let i=1;il.toBlob(b,"image/jpeg",An));if(!h)throw new Error("no_blob");let _=new Date().toISOString().replace(/[-:]/g,"").slice(0,15),m=new File([h],`photo-${_}.jpg`,{type:"image/jpeg"});this.close(),this.dispatchEvent(new CustomEvent("photo-captured",{detail:{file:m},bubbles:!0,composed:!0}))}catch(t){this._unavailable(t instanceof Error?t.message:String(t))}finally{this._busy=!1}}}render(){if(!this._open)return c;let e=this.lang;return o` - `}};he.styles=k` + `}};re.styles=k` :host { display: contents; } .overlay { position: fixed; inset: 0; z-index: 10000; @@ -1364,10 +1365,11 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" .cancel { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.6); } .switch { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.6); padding: 10px 12px; } .switch ha-icon { --mdc-icon-size: 22px; } + .switch-pos { font-size: 12px; opacity: 0.85; } .shoot { background: var(--primary-color, #03a9f4); color: #fff; border: none; font-weight: 600; } .shoot[disabled] { opacity: 0.6; cursor: default; } .shoot ha-icon { --mdc-icon-size: 22px; } - `,d([v({type:String})],he.prototype,"lang",2),d([p()],he.prototype,"_open",2),d([p()],he.prototype,"_busy",2),d([p()],he.prototype,"_devices",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",he)});var $t,W,rt=w(()=>{"use strict";I();q();C();ai();li();li();$t=k` + `,d([v({type:String})],re.prototype,"lang",2),d([p()],re.prototype,"_open",2),d([p()],re.prototype,"_busy",2),d([p()],re.prototype,"_devices",2),d([p()],re.prototype,"_deviceIndex",2);customElements.get("ms-camera-capture")||customElements.define("ms-camera-capture",re)});var $t,W,rt=w(()=>{"use strict";I();q();C();ai();li();li();$t=k` ms-photo-picker { display: contents; } .photo-pickers { display: flex; @@ -2005,9 +2007,9 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" color: var(--error-color, #f44336); font-size: 13px; } - `,d([v({attribute:!1})],N.prototype,"hass",2),d([v({attribute:!1})],N.prototype,"objects",2),d([p()],N.prototype,"_open",2),d([p()],N.prototype,"_loading",2),d([p()],N.prototype,"_error",2),d([p()],N.prototype,"_name",2),d([p()],N.prototype,"_manufacturer",2),d([p()],N.prototype,"_model",2),d([p()],N.prototype,"_serialNumber",2),d([p()],N.prototype,"_areaId",2),d([p()],N.prototype,"_installationDate",2),d([p()],N.prototype,"_warrantyExpiry",2),d([p()],N.prototype,"_documentationUrl",2),d([p()],N.prototype,"_notes",2),d([p()],N.prototype,"_haDeviceId",2),d([p()],N.prototype,"_parentEntryId",2),d([p()],N.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",N)});var hi,Mr,zr,Fr=w(()=>{"use strict";hi=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock"],Mr=["sensor"],zr=["temperature","humidity","pressure"]});async function ui(s,r,e={}){e.busy?.(!0);try{return await s.hass.connection.sendMessagePromise(r)}catch(t){let i=P(s.hass);e.onError?.(R(t,i,e.fallbackKey?n(e.fallbackKey,i):void 0));return}finally{e.busy?.(!1)}}var Ur=w(()=>{"use strict";ie();C()});function Nn(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function Hn(s){return{entityIds:(s.entity_ids||(s.entity_id?[s.entity_id]:[])).join(", "),type:s.type||"threshold",attribute:s.attribute||"",above:s.trigger_above?.toString()??"",below:s.trigger_below?.toString()??"",equals:s.trigger_equals?.toString()??"",notEquals:s.trigger_not_equals?.toString()??"",forMinutes:s.trigger_for_minutes?.toString()??"0",targetValue:s.trigger_target_value?.toString()??"",deltaMode:s.trigger_delta_mode||!1,fromState:s.trigger_from_state||"",toState:s.trigger_to_state||"",targetChanges:s.trigger_target_changes?.toString()??"",runtimeHours:s.trigger_runtime_hours?.toString()??"",onStates:(s.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(s).filter(([e])=>!jn.has(e)&&!e.startsWith("_")))}}function On(s){let r=s.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={...s.carry||{},entity_id:r[0],entity_ids:r,type:s.type};if(s.attribute&&(e.attribute=s.attribute),s.type==="threshold"){let t=parseFloat(s.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(s.below);isNaN(i)||(e.trigger_below=i);let a=parseFloat(s.equals);isNaN(a)||(e.trigger_equals=a);let l=parseFloat(s.notEquals);isNaN(l)||(e.trigger_not_equals=l);let u=parseInt(s.forMinutes,10);isNaN(u)||(e.trigger_for_minutes=u)}else if(s.type==="counter"){let t=parseFloat(s.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=s.deltaMode}else if(s.type==="state_change"){s.fromState&&(e.trigger_from_state=s.fromState),s.toState&&(e.trigger_to_state=s.toState);let t=parseInt(s.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(s.type==="runtime"){let t=parseFloat(s.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(s.onStates||"").split(",").map(a=>a.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function qn(s){return Array.from({length:7},(r,e)=>Ge(e,s,"short"))}function Dn(s){return Array.from({length:12},(r,e)=>mr(e,s,"short"))}var In,Rn,Pn,Et,Br,Vr,Ln,re,jn,f,_i,Wr=w(()=>{"use strict";I();q();C();ei();vt();ye();Fr();ie();Ur();ri();pi();Le();In=["cleaning","inspection","replacement","calibration","service","reading","custom"],Rn=["low","normal","high"],Pn=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],Et=["weekdays","nth_weekday","day_of_month"],Br=["time_based","one_time",...Et],Vr=["threshold","counter","state_change","runtime"],Ln=[...Vr,"compound"],re={alpha:"0.3",min:"7",max:"365"};jn=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);f=class f extends E{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._warning="";this._entryId="";this._taskId=null;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._mirrorTodoEntities=[];this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerEquals="";this._triggerNotEquals="";this._triggerForMinutes="0";this._triggerCombinator="any";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._triggerBaselineValue="";this._liveBaselineValue=null;this._autoCompleteOnRecovery=!1;this._triggerFromState="";this._triggerToState="";this._triggerTargetChanges="";this._triggerRuntimeHours="";this._triggerRuntimeMaxSession="";this._triggerOnStates="";this._compoundLogic="AND";this._compoundConditions=[];this._suggestedAttributes=[];this._availableAttributes=[];this._entityDomain="";this._lastPerformed="";this._nfcTagId="";this._requireTagScan=!1;this._allowSkip=!0;this._notifyEnabled=!0;this._readingUnit="";this._readings=[];this._consumesParts={};this._partsLoadFailed=!1;this._availableTags=[];this._responsibleUserId=null;this._assigneePool=[];this._rotationStrategy="";this._availableUsers=[];this._checklistText="";this._phaseDefs=[];this._phaseSeq=[];this._requiredCompletion=[];this._scheduleTime="";this._scheduleTimeOn=!1;this._actionService="";this._actionTargetEntity="";this._actionData={};this._actionDataJsonFallback="";this._actionTesting=!1;this._actionTestResult="";this._actionTestError="";this._qcNotes="";this._qcCost="";this._qcDuration="";this._qcFeedback="";this._environmentalEntity="";this._environmentalAttribute="";this._environmentalInitial="";this._environmentalAttributeInitial="";this._adaptiveEnabled=!1;this._adaptiveAlpha=re.alpha;this._adaptiveMin=re.min;this._adaptiveMax=re.max;this._adaptiveSeasonal=!0;this._adaptivePrediction=!0;this._adaptiveInitial="";this._userService=null;this._conditionAttrOptions={};this._conditionAttrPending=new Set}_adaptiveSnapshot(){return JSON.stringify([this._adaptiveEnabled,this._adaptiveAlpha,this._adaptiveMin,this._adaptiveMax,this._adaptiveSeasonal,this._adaptivePrediction])}get _lang(){return P(this.hass)}async openCreate(e,t){this._entryId=e,this._taskId=null,this._error="",this._warning="",!e&&t&&t.length>0?(this._objectChoices=t.map(i=>({entry_id:i.entry_id,name:i.object.name})).sort((i,a)=>i.name.localeCompare(a.name)),this._entryId=this._objectChoices[0].entry_id):this._objectChoices=[],this._resetFields(),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}async openEdit(e,t){this._entryId=e,this._taskId=t.id,this._error="",this._warning="",this._objectChoices=[],this._name=t.name,this._type=t.type,this._scheduleType=t.schedule_type,this._intervalDays=t.interval_days!=null?String(t.interval_days):"",this._intervalUnit=t.interval_unit||"days",this._dueDate=t.due_date||"";let i=t.schedule;this._weekdays=i?.kind==="weekdays"?[...i.weekdays??[]]:[],this._nth=i?.kind==="nth_weekday"?String(i.nth??1):"1",this._nthWeekday=i?.kind==="nth_weekday"?String(i.weekday??5):"5",this._domDay=i?.kind==="day_of_month"&&(i.day??1)>=1?String(i.day??1):"1",this._domLastDay=i?.kind==="day_of_month"&&i.day===-1,this._domBusiness=i?.kind==="day_of_month"&&i.business===!0,this._calOffset=i?.offset?String(i.offset):"0",this._seasonMonths=Array.isArray(i?.season_months)?[...i.season_months]:[];let a=i?.ends;a&&typeof a.count=="number"?(this._endsMode="count",this._endsCount=String(a.count),this._endsUntil=""):a&&typeof a.until=="string"?(this._endsMode="until",this._endsUntil=a.until,this._endsCount=""):(this._endsMode="never",this._endsCount="",this._endsUntil=""),this._warningDays=t.warning_days.toString(),this._earliestCompletionDays=t.earliest_completion_days!=null?String(t.earliest_completion_days):"",this._intervalAnchor=t.interval_anchor||"completion",this._notes=t.notes||"",this._documentationUrl=t.documentation_url||"",this._customIcon=t.custom_icon||"",this._priority=t.priority||"normal",this._labels=(t.labels||[]).join(", "),this._mirrorTodoEntities=[...t.mirror_todo_entities||[]],this._enabled=t.enabled!==!1,this._lastPerformed=t.last_performed||"",this._nfcTagId=t.nfc_tag_id||"",this._requireTagScan=!!t.require_tag_scan,this._allowSkip=t.allow_skip!==!1,this._notifyEnabled=t.notify_enabled!==!1,this._readingUnit=t.reading_unit||"",this._readings=(t.readings||[]).map(_=>({..._})),this._consumesParts=Object.fromEntries((t.consumes_parts||[]).map(_=>[Q(_),{..._}])),this._responsibleUserId=t.responsible_user_id||null,this._assigneePool=[...t.assignee_pool||[]],this._rotationStrategy=t.rotation_strategy||"",this._checklistText=(t.checklist||[]).join(` + `,d([v({attribute:!1})],N.prototype,"hass",2),d([v({attribute:!1})],N.prototype,"objects",2),d([p()],N.prototype,"_open",2),d([p()],N.prototype,"_loading",2),d([p()],N.prototype,"_error",2),d([p()],N.prototype,"_name",2),d([p()],N.prototype,"_manufacturer",2),d([p()],N.prototype,"_model",2),d([p()],N.prototype,"_serialNumber",2),d([p()],N.prototype,"_areaId",2),d([p()],N.prototype,"_installationDate",2),d([p()],N.prototype,"_warrantyExpiry",2),d([p()],N.prototype,"_documentationUrl",2),d([p()],N.prototype,"_notes",2),d([p()],N.prototype,"_haDeviceId",2),d([p()],N.prototype,"_parentEntryId",2),d([p()],N.prototype,"_entryId",2);customElements.get("maintenance-object-dialog")||customElements.define("maintenance-object-dialog",N)});var hi,Mr,zr,Fr=w(()=>{"use strict";hi=["sensor","binary_sensor","number","input_number","input_boolean","switch","climate","vacuum","cover","fan","light","water_heater","humidifier","media_player","weather","air_quality","valve","lawn_mower","lock"],Mr=["sensor"],zr=["temperature","humidity","pressure"]});async function ui(s,r,e={}){e.busy?.(!0);try{return await s.hass.connection.sendMessagePromise(r)}catch(t){let i=P(s.hass);e.onError?.(R(t,i,e.fallbackKey?n(e.fallbackKey,i):void 0));return}finally{e.busy?.(!1)}}var Ur=w(()=>{"use strict";ie();C()});function Nn(){return{entityIds:"",type:"threshold",attribute:"",above:"",below:"",equals:"",notEquals:"",forMinutes:"0",targetValue:"",deltaMode:!1,fromState:"",toState:"",targetChanges:"",runtimeHours:"",onStates:"",carry:{}}}function Hn(s){return{entityIds:(s.entity_ids||(s.entity_id?[s.entity_id]:[])).join(", "),type:s.type||"threshold",attribute:s.attribute||"",above:s.trigger_above?.toString()??"",below:s.trigger_below?.toString()??"",equals:s.trigger_equals?.toString()??"",notEquals:s.trigger_not_equals?.toString()??"",forMinutes:s.trigger_for_minutes?.toString()??"0",targetValue:s.trigger_target_value?.toString()??"",deltaMode:s.trigger_delta_mode||!1,fromState:s.trigger_from_state||"",toState:s.trigger_to_state||"",targetChanges:s.trigger_target_changes?.toString()??"",runtimeHours:s.trigger_runtime_hours?.toString()??"",onStates:(s.trigger_on_states||[]).join(", "),carry:Object.fromEntries(Object.entries(s).filter(([e])=>!jn.has(e)&&!e.startsWith("_")))}}function On(s){let r=s.entityIds.split(",").map(t=>t.trim()).filter(Boolean);if(r.length===0)return null;let e={...s.carry||{},entity_id:r[0],entity_ids:r,type:s.type};if(s.attribute&&(e.attribute=s.attribute),s.type==="threshold"){let t=parseFloat(s.above);isNaN(t)||(e.trigger_above=t);let i=parseFloat(s.below);isNaN(i)||(e.trigger_below=i);let a=parseFloat(s.equals);isNaN(a)||(e.trigger_equals=a);let l=parseFloat(s.notEquals);isNaN(l)||(e.trigger_not_equals=l);let u=parseInt(s.forMinutes,10);isNaN(u)||(e.trigger_for_minutes=u)}else if(s.type==="counter"){let t=parseFloat(s.targetValue);isNaN(t)||(e.trigger_target_value=t),e.trigger_delta_mode=s.deltaMode}else if(s.type==="state_change"){s.fromState&&(e.trigger_from_state=s.fromState),s.toState&&(e.trigger_to_state=s.toState);let t=parseInt(s.targetChanges,10);isNaN(t)||(e.trigger_target_changes=t)}else if(s.type==="runtime"){let t=parseFloat(s.runtimeHours);isNaN(t)||(e.trigger_runtime_hours=t);let i=(s.onStates||"").split(",").map(a=>a.trim()).filter(Boolean);i.length>0&&(e.trigger_on_states=i)}return e}function qn(s){return Array.from({length:7},(r,e)=>Ge(e,s,"short"))}function Dn(s){return Array.from({length:12},(r,e)=>mr(e,s,"short"))}var In,Rn,Pn,Et,Br,Vr,Ln,se,jn,f,_i,Wr=w(()=>{"use strict";I();q();C();ei();vt();ye();Fr();ie();Ur();ri();pi();Le();In=["cleaning","inspection","replacement","calibration","service","reading","custom"],Rn=["low","normal","high"],Pn=["time_based","weekdays","nth_weekday","day_of_month","sensor_based","one_time","manual"],Et=["weekdays","nth_weekday","day_of_month"],Br=["time_based","one_time",...Et],Vr=["threshold","counter","state_change","runtime"],Ln=[...Vr,"compound"],se={alpha:"0.3",min:"7",max:"365"};jn=new Set(["entity_id","entity_ids","type","attribute","trigger_above","trigger_below","trigger_equals","trigger_not_equals","trigger_for_minutes","trigger_target_value","trigger_delta_mode","trigger_from_state","trigger_to_state","trigger_target_changes","trigger_runtime_hours","trigger_on_states"]);f=class f extends E{constructor(){super(...arguments);this.checklistsEnabled=!1;this.scheduleTimeEnabled=!1;this.completionActionsEnabled=!1;this.defaultWarningDays=7;this.parts=[];this._foreignOwners=[];this._open=!1;this._entityPickerFallback=!1;this._pickerProbeStrikes=0;this._loading=!1;this._error="";this._warning="";this._entryId="";this._taskId=null;this._isFleetTask=!1;this._objectChoices=[];this._name="";this._type="custom";this._scheduleType="time_based";this._intervalDays="30";this._intervalUnit="days";this._dueDate="";this._warningDays="7";this._earliestCompletionDays="";this._intervalAnchor="completion";this._weekdays=[];this._nth="1";this._nthWeekday="5";this._domDay="1";this._domLastDay=!1;this._domBusiness=!1;this._calOffset="0";this._seasonMonths=[];this._endsMode="never";this._endsCount="";this._endsUntil="";this._schedulePreview=[];this._schedulePreviewEnded=!1;this._previewSeq=0;this._notes="";this._documentationUrl="";this._customIcon="";this._priority="normal";this._labels="";this._mirrorTodoEntities=[];this._enabled=!0;this._triggerEntityId="";this._triggerEntityIds=[];this._triggerEntityLogic="any";this._triggerAttribute="";this._triggerType="threshold";this._triggerAbove="";this._triggerBelow="";this._triggerEquals="";this._triggerNotEquals="";this._triggerForMinutes="0";this._triggerCombinator="any";this._triggerTargetValue="";this._triggerDeltaMode=!1;this._triggerBaselineValue="";this._liveBaselineValue=null;this._autoCompleteOnRecovery=!1;this._triggerFromState="";this._triggerToState="";this._triggerTargetChanges="";this._triggerRuntimeHours="";this._triggerRuntimeMaxSession="";this._triggerOnStates="";this._compoundLogic="AND";this._compoundConditions=[];this._suggestedAttributes=[];this._availableAttributes=[];this._entityDomain="";this._lastPerformed="";this._nfcTagId="";this._requireTagScan=!1;this._allowSkip=!0;this._notifyEnabled=!0;this._readingUnit="";this._readings=[];this._consumesParts={};this._partsLoadFailed=!1;this._availableTags=[];this._responsibleUserId=null;this._assigneePool=[];this._rotationStrategy="";this._availableUsers=[];this._checklistText="";this._phaseDefs=[];this._phaseSeq=[];this._requiredCompletion=[];this._scheduleTime="";this._scheduleTimeOn=!1;this._actionService="";this._actionTargetEntity="";this._actionData={};this._actionDataJsonFallback="";this._actionTesting=!1;this._actionTestResult="";this._actionTestError="";this._qcNotes="";this._qcCost="";this._qcDuration="";this._qcFeedback="";this._environmentalEntity="";this._environmentalAttribute="";this._environmentalInitial="";this._environmentalAttributeInitial="";this._adaptiveEnabled=!1;this._adaptiveAlpha=se.alpha;this._adaptiveMin=se.min;this._adaptiveMax=se.max;this._adaptiveSeasonal=!0;this._adaptivePrediction=!0;this._adaptiveInitial="";this._userService=null;this._conditionAttrOptions={};this._conditionAttrPending=new Set}_adaptiveSnapshot(){return JSON.stringify([this._adaptiveEnabled,this._adaptiveAlpha,this._adaptiveMin,this._adaptiveMax,this._adaptiveSeasonal,this._adaptivePrediction])}get _lang(){return P(this.hass)}async openCreate(e,t){this._entryId=e,this._taskId=null,this._isFleetTask=!1,this._error="",this._warning="",!e&&t&&t.length>0?(this._objectChoices=t.map(i=>({entry_id:i.entry_id,name:i.object.name})).sort((i,a)=>i.name.localeCompare(a.name)),this._entryId=this._objectChoices[0].entry_id):this._objectChoices=[],this._resetFields(),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}async openEdit(e,t){this._entryId=e,this._taskId=t.id,this._error="",this._warning="",this._objectChoices=[],this._isFleetTask=t.battery_fleet_task===!0,this._name=t.name,this._type=t.type,this._scheduleType=t.schedule_type,this._intervalDays=t.interval_days!=null?String(t.interval_days):"",this._intervalUnit=t.interval_unit||"days",this._dueDate=t.due_date||"";let i=t.schedule;this._weekdays=i?.kind==="weekdays"?[...i.weekdays??[]]:[],this._nth=i?.kind==="nth_weekday"?String(i.nth??1):"1",this._nthWeekday=i?.kind==="nth_weekday"?String(i.weekday??5):"5",this._domDay=i?.kind==="day_of_month"&&(i.day??1)>=1?String(i.day??1):"1",this._domLastDay=i?.kind==="day_of_month"&&i.day===-1,this._domBusiness=i?.kind==="day_of_month"&&i.business===!0,this._calOffset=i?.offset?String(i.offset):"0",this._seasonMonths=Array.isArray(i?.season_months)?[...i.season_months]:[];let a=i?.ends;a&&typeof a.count=="number"?(this._endsMode="count",this._endsCount=String(a.count),this._endsUntil=""):a&&typeof a.until=="string"?(this._endsMode="until",this._endsUntil=a.until,this._endsCount=""):(this._endsMode="never",this._endsCount="",this._endsUntil=""),this._warningDays=t.warning_days.toString(),this._earliestCompletionDays=t.earliest_completion_days!=null?String(t.earliest_completion_days):"",this._intervalAnchor=t.interval_anchor||"completion",this._notes=t.notes||"",this._documentationUrl=t.documentation_url||"",this._customIcon=t.custom_icon||"",this._priority=t.priority||"normal",this._labels=(t.labels||[]).join(", "),this._mirrorTodoEntities=[...t.mirror_todo_entities||[]],this._enabled=t.enabled!==!1,this._lastPerformed=t.last_performed||"",this._nfcTagId=t.nfc_tag_id||"",this._requireTagScan=!!t.require_tag_scan,this._allowSkip=t.allow_skip!==!1,this._notifyEnabled=t.notify_enabled!==!1,this._readingUnit=t.reading_unit||"",this._readings=(t.readings||[]).map(_=>({..._})),this._consumesParts=Object.fromEntries((t.consumes_parts||[]).map(_=>[Q(_),{..._}])),this._responsibleUserId=t.responsible_user_id||null,this._assigneePool=[...t.assignee_pool||[]],this._rotationStrategy=t.rotation_strategy||"",this._checklistText=(t.checklist||[]).join(` `),this._phaseDefs=Object.entries(t.phases||{}).map(([_,m])=>{let{name:b,checklist:y,consumes_parts:x,required_completion_fields:g,...$}=m,z=m.consumes_parts||[],L=z.findIndex(H=>!H.entry_id),A=L>=0?z[L]:void 0;return{id:_,name:m.name||_,checklistText:(m.checklist||[]).join(` -`),partId:A?.part_id||"",partQty:A?.quantity!=null?String(A.quantity):"",reqOverride:m.required_completion_fields!==void 0,reqFields:[...m.required_completion_fields||[]],extraParts:z.filter((H,we)=>we!==L).map(H=>({...H})),carry:$}}),this._phaseSeq=[...t.phase_sequence||[]],this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"",this._scheduleTimeOn=!!t.schedule_time;let l=t.on_complete_action;if(l&&l.service){this._actionService=l.service;let _=l.target?.entity_id;this._actionTargetEntity=Array.isArray(_)?_[0]||"":_||"",this._actionData=l.data&&typeof l.data=="object"?{...l.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let u=t.quick_complete_defaults;this._qcNotes=u?.notes||"",this._qcCost=u?.cost!=null?String(u.cost):"",this._qcDuration=u?.duration!=null?String(u.duration):"",this._qcFeedback=u?.feedback||"";let h=t.adaptive_config||{};if(this._environmentalEntity=h.environmental_entity||"",this._environmentalAttribute=h.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!h.enabled,this._adaptiveAlpha=h.ewa_alpha?.toString()??re.alpha,this._adaptiveMin=h.min_interval_days?.toString()??re.min,this._adaptiveMax=h.max_interval_days?.toString()??re.max,this._adaptiveSeasonal=h.seasonal_enabled!==!1,this._adaptivePrediction=h.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),t.trigger_config){let _=t.trigger_config;this._triggerEntityId=_.entity_id||_.entity_ids&&_.entity_ids[0]||"",this._triggerEntityIds=_.entity_ids||(_.entity_id?[_.entity_id]:[]),this._triggerEntityLogic=_.entity_logic||"any",this._triggerAttribute=_.attribute||"",this._triggerType=_.type||"threshold",this._triggerAbove=_.trigger_above?.toString()||"",this._triggerBelow=_.trigger_below?.toString()||"",this._triggerEquals=_.trigger_equals?.toString()||"",this._triggerNotEquals=_.trigger_not_equals?.toString()||"",this._triggerForMinutes=_.trigger_for_minutes?.toString()||"0",this._triggerCombinator=_.trigger_combinator==="all"?"all":"any",this._triggerTargetValue=_.trigger_target_value?.toString()||"",this._triggerDeltaMode=_.trigger_delta_mode||!1,this._triggerBaselineValue=_.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=_.auto_complete_on_recovery||!1,this._triggerFromState=_.trigger_from_state||"",this._triggerToState=_.trigger_to_state||"",this._triggerTargetChanges=_.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=_.trigger_runtime_hours?.toString()||"",this._triggerRuntimeMaxSession=_.trigger_runtime_max_session_seconds?.toString()||"",this._triggerOnStates=(_.trigger_on_states||[]).join(", "),_.type==="compound"?(this._compoundLogic=_.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(_.conditions||[]).map(Hn)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=re.alpha,this._adaptiveMin=re.min,this._adaptiveMax=re.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerEquals="",this._triggerNotEquals="",this._triggerForMinutes="0",this._triggerCombinator="any",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerRuntimeMaxSession="",this._triggerOnStates="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new Ie(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}let a=this._actionTargetEntity.trim();if(a){let l=a.split(".")[0];if(l!==t&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(t)){this._actionTestResult="error",this._actionTestError=`Service "${e}" only works on ${t}.* entities; entity "${a}" is in ${l}.* \u2014 pick a service that matches the entity domain (e.g. ${l}.${i})`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}if(!this.hass.states?.[a]){this._actionTestResult="error",this._actionTestError=`Target entity "${a}" not found in Home Assistant \u2014 the entity may have been renamed or its integration removed.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}}this._actionTestResult="ok",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3)}_buildActionData(){if(this._actionDataJsonFallback.trim())try{let e=JSON.parse(this._actionDataJsonFallback);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{...this._actionData}}_serviceSchema(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e))return null;let[t,i]=e.split("."),a=this.hass?.services?.[t]?.[i]?.fields;return!a||Object.keys(a).length===0?null:Object.entries(a).map(([l,u])=>({name:l,required:!!u.required,selector:u.selector||{text:{}}}))}_renderCompletionActionsSection(e){if(!this.completionActionsEnabled)return c;let t=this._serviceSchema();return o` +`),partId:A?.part_id||"",partQty:A?.quantity!=null?String(A.quantity):"",reqOverride:m.required_completion_fields!==void 0,reqFields:[...m.required_completion_fields||[]],extraParts:z.filter((H,we)=>we!==L).map(H=>({...H})),carry:$}}),this._phaseSeq=[...t.phase_sequence||[]],this._requiredCompletion=[...t.required_completion_fields||[]],this._scheduleTime=t.schedule_time||"",this._scheduleTimeOn=!!t.schedule_time;let l=t.on_complete_action;if(l&&l.service){this._actionService=l.service;let _=l.target?.entity_id;this._actionTargetEntity=Array.isArray(_)?_[0]||"":_||"",this._actionData=l.data&&typeof l.data=="object"?{...l.data}:{},this._actionDataJsonFallback=""}else this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="";let u=t.quick_complete_defaults;this._qcNotes=u?.notes||"",this._qcCost=u?.cost!=null?String(u.cost):"",this._qcDuration=u?.duration!=null?String(u.duration):"",this._qcFeedback=u?.feedback||"";let h=t.adaptive_config||{};if(this._environmentalEntity=h.environmental_entity||"",this._environmentalAttribute=h.environmental_attribute||"",this._environmentalInitial=this._environmentalEntity,this._environmentalAttributeInitial=this._environmentalAttribute,this._adaptiveEnabled=!!h.enabled,this._adaptiveAlpha=h.ewa_alpha?.toString()??se.alpha,this._adaptiveMin=h.min_interval_days?.toString()??se.min,this._adaptiveMax=h.max_interval_days?.toString()??se.max,this._adaptiveSeasonal=h.seasonal_enabled!==!1,this._adaptivePrediction=h.sensor_prediction_enabled!==!1,this._adaptiveInitial=this._adaptiveSnapshot(),t.trigger_config){let _=t.trigger_config;this._triggerEntityId=_.entity_id||_.entity_ids&&_.entity_ids[0]||"",this._triggerEntityIds=_.entity_ids||(_.entity_id?[_.entity_id]:[]),this._triggerEntityLogic=_.entity_logic||"any",this._triggerAttribute=_.attribute||"",this._triggerType=_.type||"threshold",this._triggerAbove=_.trigger_above?.toString()||"",this._triggerBelow=_.trigger_below?.toString()||"",this._triggerEquals=_.trigger_equals?.toString()||"",this._triggerNotEquals=_.trigger_not_equals?.toString()||"",this._triggerForMinutes=_.trigger_for_minutes?.toString()||"0",this._triggerCombinator=_.trigger_combinator==="all"?"all":"any",this._triggerTargetValue=_.trigger_target_value?.toString()||"",this._triggerDeltaMode=_.trigger_delta_mode||!1,this._triggerBaselineValue=_.trigger_baseline_value?.toString()||"",this._liveBaselineValue=t.trigger_baseline_value??null,this._autoCompleteOnRecovery=_.auto_complete_on_recovery||!1,this._triggerFromState=_.trigger_from_state||"",this._triggerToState=_.trigger_to_state||"",this._triggerTargetChanges=_.trigger_target_changes?.toString()||"",this._triggerRuntimeHours=_.trigger_runtime_hours?.toString()||"",this._triggerRuntimeMaxSession=_.trigger_runtime_max_session_seconds?.toString()||"",this._triggerOnStates=(_.trigger_on_states||[]).join(", "),_.type==="compound"?(this._compoundLogic=_.compound_logic==="OR"?"OR":"AND",this._compoundConditions=(_.conditions||[]).map(Hn)):(this._compoundLogic="AND",this._compoundConditions=[])}else this._resetTriggerFields();this._triggerEntityId&&this._fetchEntityAttributes(this._triggerEntityId),await Promise.all([this._loadUsers(),this._loadTags(),this._loadParts(),this._loadForeignPools()]),this._open=!0}_resetFields(){this._name="",this._type="custom",this._scheduleType="time_based",this._intervalDays="30",this._intervalUnit="days",this._dueDate="",this._warningDays=String(this.defaultWarningDays),this._earliestCompletionDays="",this._intervalAnchor="completion",this._weekdays=[],this._nth="1",this._nthWeekday="5",this._domDay="1",this._domLastDay=!1,this._domBusiness=!1,this._calOffset="0",this._seasonMonths=[],this._endsMode="never",this._endsCount="",this._endsUntil="",this._notes="",this._documentationUrl="",this._customIcon="",this._priority="normal",this._labels="",this._mirrorTodoEntities=[],this._enabled=!0,this._lastPerformed="",this._nfcTagId="",this._requireTagScan=!1,this._allowSkip=!0,this._readingUnit="",this._readings=[],this._consumesParts={},this._responsibleUserId=null,this._assigneePool=[],this._rotationStrategy="",this._checklistText="",this._phaseDefs=[],this._phaseSeq=[],this._requiredCompletion=[],this._scheduleTime="",this._scheduleTimeOn=!1,this._environmentalEntity="",this._environmentalAttribute="",this._environmentalInitial="",this._environmentalAttributeInitial="",this._adaptiveEnabled=!1,this._adaptiveAlpha=se.alpha,this._adaptiveMin=se.min,this._adaptiveMax=se.max,this._adaptiveSeasonal=!0,this._adaptivePrediction=!0,this._adaptiveInitial=this._adaptiveSnapshot(),this._actionService="",this._actionTargetEntity="",this._actionData={},this._actionDataJsonFallback="",this._actionTesting=!1,this._actionTestResult="",this._qcNotes="",this._qcCost="",this._qcDuration="",this._qcFeedback="",this._resetTriggerFields()}_resetTriggerFields(){this._triggerEntityId="",this._triggerEntityIds=[],this._triggerEntityLogic="any",this._triggerAttribute="",this._suggestedAttributes=[],this._availableAttributes=[],this._entityDomain="",this._triggerType="threshold",this._triggerAbove="",this._triggerBelow="",this._triggerEquals="",this._triggerNotEquals="",this._triggerForMinutes="0",this._triggerCombinator="any",this._triggerTargetValue="",this._triggerDeltaMode=!1,this._triggerBaselineValue="",this._liveBaselineValue=null,this._autoCompleteOnRecovery=!1,this._triggerFromState="",this._triggerToState="",this._triggerTargetChanges="",this._triggerRuntimeHours="",this._triggerRuntimeMaxSession="",this._triggerOnStates="",this._compoundLogic="AND",this._compoundConditions=[]}async _loadUsers(){this._userService||(this._userService=new Ie(this.hass));try{this._availableUsers=await this._userService.getUsers()}catch(e){console.error("Failed to load users:",e),this._availableUsers=[]}}_toggleAssignee(e){this._assigneePool=this._assigneePool.includes(e)?this._assigneePool.filter(t=>t!==e):[...this._assigneePool,e]}async _testAction(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e)){this._actionTestResult="error",this._actionTestError="Invalid service format (expected 'domain.service')",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3);return}let[t,i]=e.split(".");if(!this.hass?.services?.[t]?.[i]){this._actionTestResult="error",this._actionTestError=`Service "${e}" is not registered in Home Assistant. Check spelling and that the integration providing it is loaded.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}let a=this._actionTargetEntity.trim();if(a){let l=a.split(".")[0];if(l!==t&&!new Set(["homeassistant","scene","notify","persistent_notification"]).has(t)){this._actionTestResult="error",this._actionTestError=`Service "${e}" only works on ${t}.* entities; entity "${a}" is in ${l}.* \u2014 pick a service that matches the entity domain (e.g. ${l}.${i})`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}if(!this.hass.states?.[a]){this._actionTestResult="error",this._actionTestError=`Target entity "${a}" not found in Home Assistant \u2014 the entity may have been renamed or its integration removed.`,setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},8e3);return}}this._actionTestResult="ok",setTimeout(()=>{this._actionTestResult="",this._actionTestError=""},5e3)}_buildActionData(){if(this._actionDataJsonFallback.trim())try{let e=JSON.parse(this._actionDataJsonFallback);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{...this._actionData}}_serviceSchema(){let e=this._actionService.trim();if(!e||!/^[a-z][a-z0-9_]*\.[a-z0-9_]+$/.test(e))return null;let[t,i]=e.split("."),a=this.hass?.services?.[t]?.[i]?.fields;return!a||Object.keys(a).length===0?null:Object.entries(a).map(([l,u])=>({name:l,required:!!u.required,selector:u.selector||{text:{}}}))}_renderCompletionActionsSection(e){if(!this.completionActionsEnabled)return c;let t=this._serviceSchema();return o`
${n("on_complete_action_title",e)}

${n("on_complete_action_desc",e)}

@@ -2723,7 +2725,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" ${this._renderReadingsEditor(e)} `:c} ${this._partsLoadFailed?o`
${n("parts_load_failed",e)}
`:c} - ${this.parts.length||this._foreignOwners.length?o` + ${this._isFleetTask?o`
${n("task_parts_fleet_hint",e)}
`:this.parts.length||this._foreignOwners.length?o`
${this.parts.map(i=>this._renderConsumesRow(i))} @@ -3434,7 +3436,7 @@ Test pressure`,checklist_help:"One step per line. Max 100 items.",err_too_long:" font-size: 14px; cursor: pointer; } - `,d([v({attribute:!1})],f.prototype,"hass",2),d([v({type:Boolean,attribute:"checklists-enabled"})],f.prototype,"checklistsEnabled",2),d([v({type:Boolean,attribute:"schedule-time-enabled"})],f.prototype,"scheduleTimeEnabled",2),d([v({type:Boolean,attribute:"completion-actions-enabled"})],f.prototype,"completionActionsEnabled",2),d([v({type:Number,attribute:"default-warning-days"})],f.prototype,"defaultWarningDays",2),d([p()],f.prototype,"parts",2),d([p()],f.prototype,"_foreignOwners",2),d([p()],f.prototype,"_open",2),d([p()],f.prototype,"_entityPickerFallback",2),d([p()],f.prototype,"_loading",2),d([p()],f.prototype,"_error",2),d([p()],f.prototype,"_warning",2),d([p()],f.prototype,"_entryId",2),d([p()],f.prototype,"_taskId",2),d([p()],f.prototype,"_objectChoices",2),d([p()],f.prototype,"_name",2),d([p()],f.prototype,"_type",2),d([p()],f.prototype,"_scheduleType",2),d([p()],f.prototype,"_intervalDays",2),d([p()],f.prototype,"_intervalUnit",2),d([p()],f.prototype,"_dueDate",2),d([p()],f.prototype,"_warningDays",2),d([p()],f.prototype,"_earliestCompletionDays",2),d([p()],f.prototype,"_intervalAnchor",2),d([p()],f.prototype,"_weekdays",2),d([p()],f.prototype,"_nth",2),d([p()],f.prototype,"_nthWeekday",2),d([p()],f.prototype,"_domDay",2),d([p()],f.prototype,"_domLastDay",2),d([p()],f.prototype,"_domBusiness",2),d([p()],f.prototype,"_calOffset",2),d([p()],f.prototype,"_seasonMonths",2),d([p()],f.prototype,"_endsMode",2),d([p()],f.prototype,"_endsCount",2),d([p()],f.prototype,"_endsUntil",2),d([p()],f.prototype,"_schedulePreview",2),d([p()],f.prototype,"_schedulePreviewEnded",2),d([p()],f.prototype,"_notes",2),d([p()],f.prototype,"_documentationUrl",2),d([p()],f.prototype,"_customIcon",2),d([p()],f.prototype,"_priority",2),d([p()],f.prototype,"_labels",2),d([p()],f.prototype,"_mirrorTodoEntities",2),d([p()],f.prototype,"_enabled",2),d([p()],f.prototype,"_triggerEntityId",2),d([p()],f.prototype,"_triggerEntityIds",2),d([p()],f.prototype,"_triggerEntityLogic",2),d([p()],f.prototype,"_triggerAttribute",2),d([p()],f.prototype,"_triggerType",2),d([p()],f.prototype,"_triggerAbove",2),d([p()],f.prototype,"_triggerBelow",2),d([p()],f.prototype,"_triggerEquals",2),d([p()],f.prototype,"_triggerNotEquals",2),d([p()],f.prototype,"_triggerForMinutes",2),d([p()],f.prototype,"_triggerCombinator",2),d([p()],f.prototype,"_triggerTargetValue",2),d([p()],f.prototype,"_triggerDeltaMode",2),d([p()],f.prototype,"_triggerBaselineValue",2),d([p()],f.prototype,"_liveBaselineValue",2),d([p()],f.prototype,"_autoCompleteOnRecovery",2),d([p()],f.prototype,"_triggerFromState",2),d([p()],f.prototype,"_triggerToState",2),d([p()],f.prototype,"_triggerTargetChanges",2),d([p()],f.prototype,"_triggerRuntimeHours",2),d([p()],f.prototype,"_triggerRuntimeMaxSession",2),d([p()],f.prototype,"_triggerOnStates",2),d([p()],f.prototype,"_compoundLogic",2),d([p()],f.prototype,"_compoundConditions",2),d([p()],f.prototype,"_suggestedAttributes",2),d([p()],f.prototype,"_availableAttributes",2),d([p()],f.prototype,"_entityDomain",2),d([p()],f.prototype,"_lastPerformed",2),d([p()],f.prototype,"_nfcTagId",2),d([p()],f.prototype,"_requireTagScan",2),d([p()],f.prototype,"_allowSkip",2),d([p()],f.prototype,"_notifyEnabled",2),d([p()],f.prototype,"_readingUnit",2),d([p()],f.prototype,"_readings",2),d([p()],f.prototype,"_consumesParts",2),d([p()],f.prototype,"_partsLoadFailed",2),d([p()],f.prototype,"_availableTags",2),d([p()],f.prototype,"_responsibleUserId",2),d([p()],f.prototype,"_assigneePool",2),d([p()],f.prototype,"_rotationStrategy",2),d([p()],f.prototype,"_availableUsers",2),d([p()],f.prototype,"_checklistText",2),d([p()],f.prototype,"_phaseDefs",2),d([p()],f.prototype,"_phaseSeq",2),d([p()],f.prototype,"_requiredCompletion",2),d([p()],f.prototype,"_scheduleTime",2),d([p()],f.prototype,"_scheduleTimeOn",2),d([p()],f.prototype,"_actionService",2),d([p()],f.prototype,"_actionTargetEntity",2),d([p()],f.prototype,"_actionData",2),d([p()],f.prototype,"_actionDataJsonFallback",2),d([p()],f.prototype,"_actionTesting",2),d([p()],f.prototype,"_actionTestResult",2),d([p()],f.prototype,"_actionTestError",2),d([p()],f.prototype,"_qcNotes",2),d([p()],f.prototype,"_qcCost",2),d([p()],f.prototype,"_qcDuration",2),d([p()],f.prototype,"_qcFeedback",2),d([p()],f.prototype,"_environmentalEntity",2),d([p()],f.prototype,"_environmentalAttribute",2),d([p()],f.prototype,"_adaptiveEnabled",2),d([p()],f.prototype,"_adaptiveAlpha",2),d([p()],f.prototype,"_adaptiveMin",2),d([p()],f.prototype,"_adaptiveMax",2),d([p()],f.prototype,"_adaptiveSeasonal",2),d([p()],f.prototype,"_adaptivePrediction",2),d([p()],f.prototype,"_conditionAttrOptions",2);_i=f;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",_i)});var ue,mi=w(()=>{"use strict";I();q();Qt();ue=class extends E{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await Gt(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?c:this._url?o` + `,d([v({attribute:!1})],f.prototype,"hass",2),d([v({type:Boolean,attribute:"checklists-enabled"})],f.prototype,"checklistsEnabled",2),d([v({type:Boolean,attribute:"schedule-time-enabled"})],f.prototype,"scheduleTimeEnabled",2),d([v({type:Boolean,attribute:"completion-actions-enabled"})],f.prototype,"completionActionsEnabled",2),d([v({type:Number,attribute:"default-warning-days"})],f.prototype,"defaultWarningDays",2),d([p()],f.prototype,"parts",2),d([p()],f.prototype,"_foreignOwners",2),d([p()],f.prototype,"_open",2),d([p()],f.prototype,"_entityPickerFallback",2),d([p()],f.prototype,"_loading",2),d([p()],f.prototype,"_error",2),d([p()],f.prototype,"_warning",2),d([p()],f.prototype,"_entryId",2),d([p()],f.prototype,"_taskId",2),d([p()],f.prototype,"_isFleetTask",2),d([p()],f.prototype,"_objectChoices",2),d([p()],f.prototype,"_name",2),d([p()],f.prototype,"_type",2),d([p()],f.prototype,"_scheduleType",2),d([p()],f.prototype,"_intervalDays",2),d([p()],f.prototype,"_intervalUnit",2),d([p()],f.prototype,"_dueDate",2),d([p()],f.prototype,"_warningDays",2),d([p()],f.prototype,"_earliestCompletionDays",2),d([p()],f.prototype,"_intervalAnchor",2),d([p()],f.prototype,"_weekdays",2),d([p()],f.prototype,"_nth",2),d([p()],f.prototype,"_nthWeekday",2),d([p()],f.prototype,"_domDay",2),d([p()],f.prototype,"_domLastDay",2),d([p()],f.prototype,"_domBusiness",2),d([p()],f.prototype,"_calOffset",2),d([p()],f.prototype,"_seasonMonths",2),d([p()],f.prototype,"_endsMode",2),d([p()],f.prototype,"_endsCount",2),d([p()],f.prototype,"_endsUntil",2),d([p()],f.prototype,"_schedulePreview",2),d([p()],f.prototype,"_schedulePreviewEnded",2),d([p()],f.prototype,"_notes",2),d([p()],f.prototype,"_documentationUrl",2),d([p()],f.prototype,"_customIcon",2),d([p()],f.prototype,"_priority",2),d([p()],f.prototype,"_labels",2),d([p()],f.prototype,"_mirrorTodoEntities",2),d([p()],f.prototype,"_enabled",2),d([p()],f.prototype,"_triggerEntityId",2),d([p()],f.prototype,"_triggerEntityIds",2),d([p()],f.prototype,"_triggerEntityLogic",2),d([p()],f.prototype,"_triggerAttribute",2),d([p()],f.prototype,"_triggerType",2),d([p()],f.prototype,"_triggerAbove",2),d([p()],f.prototype,"_triggerBelow",2),d([p()],f.prototype,"_triggerEquals",2),d([p()],f.prototype,"_triggerNotEquals",2),d([p()],f.prototype,"_triggerForMinutes",2),d([p()],f.prototype,"_triggerCombinator",2),d([p()],f.prototype,"_triggerTargetValue",2),d([p()],f.prototype,"_triggerDeltaMode",2),d([p()],f.prototype,"_triggerBaselineValue",2),d([p()],f.prototype,"_liveBaselineValue",2),d([p()],f.prototype,"_autoCompleteOnRecovery",2),d([p()],f.prototype,"_triggerFromState",2),d([p()],f.prototype,"_triggerToState",2),d([p()],f.prototype,"_triggerTargetChanges",2),d([p()],f.prototype,"_triggerRuntimeHours",2),d([p()],f.prototype,"_triggerRuntimeMaxSession",2),d([p()],f.prototype,"_triggerOnStates",2),d([p()],f.prototype,"_compoundLogic",2),d([p()],f.prototype,"_compoundConditions",2),d([p()],f.prototype,"_suggestedAttributes",2),d([p()],f.prototype,"_availableAttributes",2),d([p()],f.prototype,"_entityDomain",2),d([p()],f.prototype,"_lastPerformed",2),d([p()],f.prototype,"_nfcTagId",2),d([p()],f.prototype,"_requireTagScan",2),d([p()],f.prototype,"_allowSkip",2),d([p()],f.prototype,"_notifyEnabled",2),d([p()],f.prototype,"_readingUnit",2),d([p()],f.prototype,"_readings",2),d([p()],f.prototype,"_consumesParts",2),d([p()],f.prototype,"_partsLoadFailed",2),d([p()],f.prototype,"_availableTags",2),d([p()],f.prototype,"_responsibleUserId",2),d([p()],f.prototype,"_assigneePool",2),d([p()],f.prototype,"_rotationStrategy",2),d([p()],f.prototype,"_availableUsers",2),d([p()],f.prototype,"_checklistText",2),d([p()],f.prototype,"_phaseDefs",2),d([p()],f.prototype,"_phaseSeq",2),d([p()],f.prototype,"_requiredCompletion",2),d([p()],f.prototype,"_scheduleTime",2),d([p()],f.prototype,"_scheduleTimeOn",2),d([p()],f.prototype,"_actionService",2),d([p()],f.prototype,"_actionTargetEntity",2),d([p()],f.prototype,"_actionData",2),d([p()],f.prototype,"_actionDataJsonFallback",2),d([p()],f.prototype,"_actionTesting",2),d([p()],f.prototype,"_actionTestResult",2),d([p()],f.prototype,"_actionTestError",2),d([p()],f.prototype,"_qcNotes",2),d([p()],f.prototype,"_qcCost",2),d([p()],f.prototype,"_qcDuration",2),d([p()],f.prototype,"_qcFeedback",2),d([p()],f.prototype,"_environmentalEntity",2),d([p()],f.prototype,"_environmentalAttribute",2),d([p()],f.prototype,"_adaptiveEnabled",2),d([p()],f.prototype,"_adaptiveAlpha",2),d([p()],f.prototype,"_adaptiveMin",2),d([p()],f.prototype,"_adaptiveMax",2),d([p()],f.prototype,"_adaptiveSeasonal",2),d([p()],f.prototype,"_adaptivePrediction",2),d([p()],f.prototype,"_conditionAttrOptions",2);_i=f;customElements.get("maintenance-task-dialog")||customElements.define("maintenance-task-dialog",_i)});var ue,mi=w(()=>{"use strict";I();q();Qt();ue=class extends E{constructor(){super(...arguments);this.docId="";this._url="";this._failed=!1;this._signedFor=""}updated(){this.hass&&this.docId&&this._signedFor!==this.docId&&(this._signedFor=this.docId,this._url="",this._failed=!1,this._sign())}async _sign(){try{this._url=await Gt(this.hass,this.docId)}catch{this._failed=!0}}render(){return this._failed||!this.docId?c:this._url?o` this._failed=!0} /> @@ -3877,9 +3879,9 @@ ${h?`
${h}
`:""} color: var(--text-primary-color, #fff); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); } - `,d([v({attribute:!1})],K.prototype,"hass",2),d([v()],K.prototype,"lang",2),d([p()],K.prototype,"_open",2),d([p()],K.prototype,"_loading",2),d([p()],K.prototype,"_error",2),d([p()],K.prototype,"_viewResult",2),d([p()],K.prototype,"_completeResult",2),d([p()],K.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",K)});var Qr=w(()=>{"use strict"});function Jr(s){let r=s.getFullYear(),e=String(s.getMonth()+1).padStart(2,"0"),t=String(s.getDate()).padStart(2,"0");return`${r}-${e}-${t}`}var Zr=w(()=>{"use strict";Qr()});function Xr(s,r,e,t){let i=e,a=h=>typeof h=="string"?h:null,l=h=>typeof h=="number"?h:null,u=a(i.timestamp)??"";return{entry_id:s,task_id:r,original_timestamp:u,type:a(i.type)||"completed",timestamp:u,notes:a(i.notes),cost:l(i.cost),duration:l(i.duration),completed_by:a(i.completed_by),used_parts:Array.isArray(i.used_parts)?i.used_parts:null,photo_doc_ids:yt(i),reading_value:l(i.reading_value),reading_values:ce(i),readings:t?.readings??[],task_type:t?.type??null,reading_unit:t?.reading_unit??null}}var es=w(()=>{"use strict";xt();ye()});function zn(s){return s&&ts(s.ref_no)?String(s.ref_no):null}function is(s,r){let e=zn(s);return e&&r&&ts(r.ref_no)?`${e}.${r.ref_no}`:null}function rs(s,r){return s?o`#${s}`:c}var ts,gi=w(()=>{"use strict";I();ts=s=>typeof s=="number"&&Number.isInteger(s)&&s>0});var ss=w(()=>{"use strict"});function Un(s,r){return s.taskRef&&r.ref_no?`${s.taskRef}-${r.ref_no}`:null}function Bn(s,r){let e=yt(r);return e.length>0?o`
+ `,d([v({attribute:!1})],K.prototype,"hass",2),d([v()],K.prototype,"lang",2),d([p()],K.prototype,"_open",2),d([p()],K.prototype,"_loading",2),d([p()],K.prototype,"_error",2),d([p()],K.prototype,"_viewResult",2),d([p()],K.prototype,"_completeResult",2),d([p()],K.prototype,"_urlMode",2);customElements.get("maintenance-qr-dialog")||customElements.define("maintenance-qr-dialog",K)});var Qr=w(()=>{"use strict"});function Jr(s){let r=s.getFullYear(),e=String(s.getMonth()+1).padStart(2,"0"),t=String(s.getDate()).padStart(2,"0");return`${r}-${e}-${t}`}var Zr=w(()=>{"use strict";Qr()});function Xr(s,r,e,t){let i=e,a=h=>typeof h=="string"?h:null,l=h=>typeof h=="number"?h:null,u=a(i.timestamp)??"";return{entry_id:s,task_id:r,original_timestamp:u,type:a(i.type)||"completed",timestamp:u,notes:a(i.notes),cost:l(i.cost),duration:l(i.duration),completed_by:a(i.completed_by),used_parts:Array.isArray(i.used_parts)?i.used_parts:null,photo_doc_ids:yt(i),reading_value:l(i.reading_value),reading_values:pe(i),readings:t?.readings??[],task_type:t?.type??null,reading_unit:t?.reading_unit??null}}var es=w(()=>{"use strict";xt();ye()});function zn(s){return s&&ts(s.ref_no)?String(s.ref_no):null}function is(s,r){let e=zn(s);return e&&r&&ts(r.ref_no)?`${e}.${r.ref_no}`:null}function rs(s,r){return s?o`#${s}`:c}var ts,gi=w(()=>{"use strict";I();ts=s=>typeof s=="number"&&Number.isInteger(s)&&s>0});var ss=w(()=>{"use strict"});function Un(s,r){return s.taskRef&&r.ref_no?`${s.taskRef}-${r.ref_no}`:null}function Bn(s,r){let e=yt(r);return e.length>0?o`
${e.map(t=>o``)} -
`:c}function Vn(s,r){let e=r.lang,t=l=>O(l,e,{maximumFractionDigits:3}),i=l=>l==null?"":` (${l>=0?"+":""}${t(l)})`,a=ce(s);return a.length>0?o`
+
`:c}function Vn(s,r){let e=r.lang,t=l=>O(l,e,{maximumFractionDigits:3}),i=l=>l==null?"":` (${l>=0?"+":""}${t(l)})`,a=pe(s);return a.length>0?o`
${a.map(l=>o` ${l.name} ${t(l.value)}${l.unit?` ${l.unit}`:""}${i(r.readingSlotDelta?.(s,l.id))} @@ -4098,7 +4100,7 @@ ${h?`
${h}
`:""} ${us.map((g,$)=>o`${n(g,r)}`)}
- `}var us,gs=w(()=>{"use strict";I();C();kt();us=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var j,fs=w(()=>{"use strict";I();q();C();ie();Zr();bt();ft();es();ye();gi();as();ls();cs();hs();Le();gs();j=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1;this._currencySymbol=""}get _lang(){return P(this.hass)}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=Jr(new Date),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._currencySymbol=le(e?.budget),ht(e?.budget),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null,this._taskRef=is(e.object,t)}catch(e){this._error=R(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=R(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(Z(),se)).then(async({openCompleteDialog:e})=>{let t=this._task,i=[];try{i=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(Ze({entryId:this._entryId,taskId:this._taskId,taskName:t.name,task:t,objects:i,lang:this._lang,checklist:t.checklist||[],adaptiveEnabled:!!t.adaptive_config?.enabled,currencySymbol:this._currencySymbol}))&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(Z(),se)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(Z(),se)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=n("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=n("suggestion_applied",this._lang),this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${n("reanalyze_result",this._lang)}: ${Ye(e.recommended_interval,"days",this._lang)} (${e.data_points} pts)`:n("reanalyze_insufficient_data",this._lang),await this._loadTask(),setTimeout(()=>{this._toast=""},3500)}catch(e){this._error=R(e,this._lang)}finally{this._busy=!1}}}_onEditHistoryEntry(e){if(!this._entryId||!this._taskId)return;let t=Xr(this._entryId,this._taskId,e,this._task);Promise.resolve().then(()=>(Z(),se)).then(({openHistoryEditDialog:i})=>i(t))}_renderRecommendation(e){if(!this._features.adaptive||!e.suggested_interval||e.suggested_interval===e.interval_days)return c;let t=this._lang;return o` + `}var us,gs=w(()=>{"use strict";I();C();kt();us=["month_jan","month_feb","month_mar","month_apr","month_may","month_jun","month_jul","month_aug","month_sep","month_oct","month_nov","month_dec"]});var j,fs=w(()=>{"use strict";I();q();C();ie();Zr();bt();ft();es();ye();gi();as();ls();cs();hs();Le();gs();j=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._taskId=null;this._task=null;this._objectName="";this._taskRef=null;this._busy=!1;this._error="";this._showSkip=!1;this._showReset=!1;this._showDetails=!1;this._showAdaptive=!1;this._skipReason="";this._resetDate="";this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._toast="";this._featuresLoaded=!1;this._currencySymbol=""}get _lang(){return P(this.hass)}async openFor(e,t){this._entryId=e,this._taskId=t,this._error="",this._showSkip=!1,this._showReset=!1,this._showAdaptive=!1,this._skipReason="",this._resetDate=Jr(new Date),this._open=!0,await Promise.all([this._loadTask(),this._loadFeatures()])}async _loadFeatures(){if(!this._featuresLoaded)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"});e?.features&&(this._features={...this._features,...e.features}),this._currencySymbol=de(e?.budget),ht(e?.budget),this._featuresLoaded=!0}catch{}}close(){this._open=!1,this._task=null,this._error=""}async _loadTask(){if(!(!this._entryId||!this._taskId))try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._objectName=e.object?.name||"";let t=(e.tasks||[]).find(i=>i.id===this._taskId);this._task=t??null,this._taskRef=is(e.object,t)}catch(e){this._error=R(e,this._lang)}}async _runWs(e){this._busy=!0,this._error="";try{return await this.hass.connection.sendMessagePromise(e),this._busy=!1,!0}catch(t){return this._error=R(t,this._lang),this._busy=!1,!1}}_notifyChanged(e){this.dispatchEvent(new CustomEvent("task-action-fired",{detail:{entry_id:this._entryId,task_id:this._taskId,action:e},bubbles:!0,composed:!0}))}_onComplete(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(Z(),ne)).then(async({openCompleteDialog:e})=>{let t=this._task,i=[];try{i=(await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0})).objects||[]}catch{}e(Ze({entryId:this._entryId,taskId:this._taskId,taskName:t.name,task:t,objects:i,lang:this._lang,checklist:t.checklist||[],adaptiveEnabled:!!t.adaptive_config?.enabled,currencySymbol:this._currencySymbol}))&&(this._notifyChanged("complete"),this.close())})}async _onSkipConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/skip",entry_id:this._entryId,task_id:this._taskId,reason:this._skipReason.trim()||null})&&(this._notifyChanged("skip"),this.close())}async _onResetConfirm(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/reset",entry_id:this._entryId,task_id:this._taskId,date:this._resetDate||void 0})&&(this._notifyChanged("reset"),this.close())}_onEdit(){!this._entryId||!this._taskId||Promise.resolve().then(()=>(Z(),ne)).then(({openEditTaskDialog:e})=>{e(this._entryId,this._taskId),this.close()})}_onQr(){!this._entryId||!this._taskId||!this._task||Promise.resolve().then(()=>(Z(),ne)).then(({openQrDialog:e})=>{e({entry_id:this._entryId,task_id:this._taskId,task_name:this._task.name,object_name:this._objectName}),this.close()})}async _onDelete(){if(!this._entryId||!this._taskId)return;let e=n("delete_task_confirm",this._lang)||`Delete "${this._task?.name}"?`;if(!window.confirm(e))return;await this._runWs({type:"maintenance_supporter/task/delete",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("delete"),this.close())}async _onArchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/archive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("archive"),this.close())}async _onUnarchive(){if(!this._entryId||!this._taskId)return;await this._runWs({type:"maintenance_supporter/task/unarchive",entry_id:this._entryId,task_id:this._taskId})&&(this._notifyChanged("unarchive"),this.close())}_onOpenInPanel(){if(!this._entryId||!this._taskId)return;let e=`/maintenance-supporter?entry_id=${encodeURIComponent(this._entryId)}&task_id=${encodeURIComponent(this._taskId)}`;history.pushState(null,"",e),window.dispatchEvent(new CustomEvent("location-changed")),this.close()}async _applySuggestion(){if(!this._entryId||!this._taskId||!this._task?.suggested_interval)return;await this._runWs({type:"maintenance_supporter/task/apply_suggestion",entry_id:this._entryId,task_id:this._taskId,interval:this._task.suggested_interval})&&(this._toast=n("suggestion_applied",this._lang),this._notifyChanged("apply_suggestion"),await this._loadTask(),setTimeout(()=>{this._toast=""},2500))}async _reanalyzeInterval(){if(!(!this._entryId||!this._taskId)){this._busy=!0,this._error="";try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/task/analyze_interval",entry_id:this._entryId,task_id:this._taskId});this._toast=e.recommended_interval?`${n("reanalyze_result",this._lang)}: ${Ye(e.recommended_interval,"days",this._lang)} (${e.data_points} pts)`:n("reanalyze_insufficient_data",this._lang),await this._loadTask(),setTimeout(()=>{this._toast=""},3500)}catch(e){this._error=R(e,this._lang)}finally{this._busy=!1}}}_onEditHistoryEntry(e){if(!this._entryId||!this._taskId)return;let t=Xr(this._entryId,this._taskId,e,this._task);Promise.resolve().then(()=>(Z(),ne)).then(({openHistoryEditDialog:i})=>i(t))}_renderRecommendation(e){if(!this._features.adaptive||!e.suggested_interval||e.suggested_interval===e.interval_days)return c;let t=this._lang;return o`

${n("suggested_interval",t)}

${ps(e.interval_days,e.suggested_interval,e.interval_confidence||"medium",t)} @@ -4165,13 +4167,13 @@ ${h?`
${h}
`:""} ${t.name}
- +
${t.next_due?o`${n("next_due",e)}: ${F(t.next_due,e)}`:c} ${t.last_performed?o`${n("last_performed",e)}: ${F(t.last_performed,e)}`:c} ${t.schedule?.kind&&!["manual","one_time"].includes(t.schedule.kind)||t.interval_days!=null?o`${n("interval",e)}: ${gr(t,e)}`:c} - ${de(t)?o`${n("phase_current",e)}: ${de(t)}`:c} + ${ce(t)?o`${n("phase_current",e)}: ${ce(t)}`:c}
@@ -4434,7 +4436,7 @@ ${h?`
${h}
`:""} .weibull-section, .seasonal-card-compact { max-width: 100%; } .weibull-chart svg { max-width: 100%; height: auto; } .details-toggle { gap: 12px; flex-wrap: wrap; } - `],d([v({attribute:!1})],j.prototype,"hass",2),d([p()],j.prototype,"_open",2),d([p()],j.prototype,"_entryId",2),d([p()],j.prototype,"_taskId",2),d([p()],j.prototype,"_task",2),d([p()],j.prototype,"_objectName",2),d([p()],j.prototype,"_taskRef",2),d([p()],j.prototype,"_busy",2),d([p()],j.prototype,"_error",2),d([p()],j.prototype,"_showSkip",2),d([p()],j.prototype,"_showReset",2),d([p()],j.prototype,"_showDetails",2),d([p()],j.prototype,"_showAdaptive",2),d([p()],j.prototype,"_skipReason",2),d([p()],j.prototype,"_resetDate",2),d([p()],j.prototype,"_features",2),d([p()],j.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",j)});function vs(s){return s?customElements.get("ha-markdown")?o``:o`${s}`:c}var bs=w(()=>{"use strict";I()});var X,ys=w(()=>{"use strict";I();Jt();bs();q();C();ie();X=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return P(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=R(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(Z(),se)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(Z(),se)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=n("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=R(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=n("confirm_archive_object",this._lang);if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=R(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(Z(),se)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return c;let e=this._lang,t=this._data,i=t?.object,a=t?.tasks||[],l=this.hass?.user?.is_admin??!0;return o` + `],d([v({attribute:!1})],j.prototype,"hass",2),d([p()],j.prototype,"_open",2),d([p()],j.prototype,"_entryId",2),d([p()],j.prototype,"_taskId",2),d([p()],j.prototype,"_task",2),d([p()],j.prototype,"_objectName",2),d([p()],j.prototype,"_taskRef",2),d([p()],j.prototype,"_busy",2),d([p()],j.prototype,"_error",2),d([p()],j.prototype,"_showSkip",2),d([p()],j.prototype,"_showReset",2),d([p()],j.prototype,"_showDetails",2),d([p()],j.prototype,"_showAdaptive",2),d([p()],j.prototype,"_skipReason",2),d([p()],j.prototype,"_resetDate",2),d([p()],j.prototype,"_features",2),d([p()],j.prototype,"_toast",2);customElements.get("maintenance-task-quick-actions-dialog")||customElements.define("maintenance-task-quick-actions-dialog",j)});function vs(s){return s?customElements.get("ha-markdown")?o``:o`${s}`:c}var bs=w(()=>{"use strict";I()});var X,ys=w(()=>{"use strict";I();Jt();bs();q();C();ie();X=class extends E{constructor(){super(...arguments);this._open=!1;this._entryId=null;this._data=null;this._busy=!1;this._error=""}get _lang(){return P(this.hass)}async openFor(e){this._entryId=e,this._error="",this._open=!0,await this._load()}close(){this._open=!1,this._data=null,this._error=""}async _load(){if(this._entryId)try{let e=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object",entry_id:this._entryId});this._data=e}catch(e){this._error=R(e,this._lang)}}_onEditObject(){!this._entryId||!this._data||Promise.resolve().then(()=>(Z(),ne)).then(({openEditObjectDialog:e})=>{e(this._entryId,this._data.object),this.close()})}_onAddTask(){this._entryId&&Promise.resolve().then(()=>(Z(),ne)).then(({openCreateTaskDialog:e})=>{e(this._entryId),this.close()})}async _onDelete(){if(!this._entryId||!this._data)return;let e=n("delete_object_confirm",this._lang)||`Delete "${this._data.object.name}" and all its tasks?`;if(window.confirm(e)){this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/object/delete",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-deleted",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=R(t,this._lang)}finally{this._busy=!1}}}async _onArchiveObject(){if(!this._entryId||!this._data)return;let e=!!this._data.object.archived;if(!e){let t=n("confirm_archive_object",this._lang);if(!window.confirm(t))return}this._busy=!0,this._error="";try{await this.hass.connection.sendMessagePromise({type:e?"maintenance_supporter/object/unarchive":"maintenance_supporter/object/archive",entry_id:this._entryId}),this.dispatchEvent(new CustomEvent("object-changed",{detail:{entry_id:this._entryId},bubbles:!0,composed:!0})),this.close()}catch(t){this._error=R(t,this._lang)}finally{this._busy=!1}}_onTaskClick(e){this._entryId&&Promise.resolve().then(()=>(Z(),ne)).then(({openTaskQuickActions:t})=>{t(this._entryId,e)})}render(){if(!this._open)return c;let e=this._lang,t=this._data,i=t?.object,a=t?.tasks||[],l=this.hass?.user?.is_admin??!0;return o`
`:""} x2=${T(y(m))} y2=${z} >`:c} - `}static _storedSort(){return tt(pe.batteryRosterSort)==="name"?"name":"urgency"}_setSort(e){this._rosterSort=e,it(pe.batteryRosterSort,e)}_sortedRoster(e){let t=this._typeFilter===null?e:e.filter(a=>a.battery_type===this._typeFilter);if(this._rosterSort==="name")return t;let i=a=>a.status==="low"?-1e3+(a.level??101)/101:a.days_until??1/0;return[...t].sort((a,l)=>i(a)-i(l)||a.device_name.localeCompare(l.device_name))}_predictedDate(e){return this._fmtDate(Date.now()+e*864e5)}_fmtDate(e){let t=new Date(e),i=a=>String(a).padStart(2,"0");return F(`${t.getFullYear()}-${i(t.getMonth()+1)}-${i(t.getDate())}`,this._lang)}_shoppingLine(e){return Object.entries(e).map(([t,i])=>o`
- `}var Ut=class extends H{createRenderRoot(){return this}render(){return!this.task||!this.ctx?h:o`${Pi(this.task,this.ctx)}`}};g([S({attribute:!1})],Ut.prototype,"task",2),g([S({attribute:!1})],Ut.prototype,"ctx",2);customElements.get("maintenance-task-detail-view")||customElements.define("maintenance-task-detail-view",Ut);function Li(l){if(l.total<=0)return{start:0,end:0,padTop:0,padBottom:0};let c=l.overscan??12,t=Math.max(1,l.step??6),e=Math.max(1,l.rowHeight),i=Math.floor((l.scrollTop-l.listTop)/e),a=Math.ceil(l.viewportHeight/e)+1,n=Math.max(0,i-c);n=Math.floor(n/t)*t;let d=Math.min(l.total,Math.max(i,0)+a+c);return d=Math.min(l.total,Math.ceil(d/t)*t),n>=d&&(n=Math.min(n,Math.max(0,l.total-1)),d=Math.min(l.total,n+Math.max(a,1))),{start:n,end:d,padTop:n*e,padBottom:(l.total-d)*e}}var he={mode:"top",marginTop:0,lastScrollTop:0};function Hi(l,c){return l==="top"?8:c.viewH-c.paneH-8}function Ni(l){let c=l.scrollTop+8-l.layoutTop,t=Math.max(0,l.listH-l.paneH);return{mode:"top",marginTop:c>t?Math.max(0,c):0,lastScrollTop:l.scrollTop}}function Bi(l,c){let t=c.scrollTop,e=c.scrollTop>l.lastScrollTop?"down":c.scrollTop0&&e==="up")d=Math.max(0,Math.min(d,c.scrollTop+8-c.layoutTop)),d<=i&&(d=0);else if(!a&&e==="down"&&n==="top"){let r=c.renderedTop-c.layoutTop;r<=i&&(n="bottom",d=Math.max(0,r))}else!a&&e==="up"&&n==="bottom"&&(d=Math.min(Math.max(0,c.renderedTop-c.layoutTop),i),c.scrollTop+8<=c.layoutTop+d&&(n="top",d=0));return{mode:n,marginTop:d,lastScrollTop:t}}var ue=2,Cs=250,Ot={objects:6,tasks:10,parts:6,documents:8,history:6},Ds="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",Me=["due_date","object","type","task_name","area","assigned_user","group"],Fi=["none","area","group","user","object"],As=["overdue","due_soon","triggered","ok"],qi=["tasks","documents","parts","history"],w=class extends H{constructor(){super(...arguments);this.narrow=!1;this.tight=!1;this.split=!1;this._tightObserver=null;this.panel={};this.embedded=!1;this.presets={};this._presetsApplied=!1;this._mountPath=null;this._objects=[];this._stats=null;this._view="overview";this._allParts=null;this._selectedEntryId=null;this._selectedTaskId=null;this._filterStatus="";this._filterUser=null;this._filterLabel=null;this._filterPriority="";this._savedViews=[];this._activeViewId="";this._unsub=null;this._chartRangeDays=(()=>{try{let t=parseInt(Z(D.chartRange)||"",10);return[7,30,90,365].includes(t)?t:30}catch{return 30}})();this._hideOutliers=(()=>{try{return Z(D.chartHideOutliers)==="1"}catch{return!1}})();this._historyFilter=null;this._budget=null;this._groups={};this._detailStatsData=new Map;this._miniStatsData=new Map;this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._adminPanelUserIds=[];this._operatorWriteEnabled=!1;this._defaultWarningDays=7;this._rowActionStyle="buttons_compact";this._refsInLists=!1;this._rowActionNotice=!1;this._actionLoading=!1;this._moreMenuOpen=!1;this._objMenuOpen=!1;this._toastMessage="";this._toastUndo=null;this._toastActionLabel="";this._filtersOpen=!1;this._newMenuOpen=!1;this._gsSetupsCount=0;this._gsAdoptCount=0;this._gsLoaded=!1;this._batteryFleetSetupAvailable=!1;this._staleBundle=!1;this._staleChecked=!1;this._toastTimer=null;this._dismissedSuggestions=new Set;this._overviewTab=(()=>{try{let t=Z(D.overviewTab);return t==="today"||t==="calendar"?t:"dashboard"}catch{return"dashboard"}})();this._activeTab="overview";this._costDurationToggle="both";this._historySearch="";this._sortMode="due_date";this._objectSortMode="alphabetical";this._groupByMode="none";this._objectViewMode="cards";this._objectsTableColumns=Fe;this._showArchived=!1;this._bulkMode=!1;this._bulkSelected=new Set;this._virtStart=0;this._virtEnd=0;this._virtRowHeight=53;this._virtTotalRows=0;this._virtScrollAttached=!1;this._virtRaf=0;this._stickyState=he;this._stickySelectPending=!1;this._stickyRaf=0;this._stickyAttached=!1;this._stickyObserver=null;this._collapsedGroups=new Set;this._collapsedSections=(()=>{try{return new Set(JSON.parse(Z(D.collapsedSections)||"[]"))}catch{return new Set}})();this._objectSectionsCollapsed=(()=>{try{let t=JSON.parse(Z(D.objectSections)||"[]");return new Set((Array.isArray(t)?t:[]).filter(e=>qi.includes(e)))}catch{return new Set}})();this._objectSectionOverride=null;this._paletteOpen=!1;this._paletteQuery="";this._paletteActive=0;this._searchRemote=null;this._searchTimer=null;this._searchSeq=0;this._templateGalleryOpen=!1;this._templates=[];this._templateCategories={};this._templateBusy=!1;this._statsService=null;this._userService=null;this._dataLoaded=!1;this._lastConnection=null;this._popstateHandler=t=>this._onPopState(t);this._locationChangedHandler=()=>this._onLocationChanged();this._lazyUi=null;this._onStickyScroll=()=>{this._stickyRaf||(this._stickyRaf=requestAnimationFrame(()=>{this._stickyRaf=0,this._updateStickyPane()}))};this._onVirtualScroll=()=>{this._virtRaf||(this._virtRaf=requestAnimationFrame(()=>{this._virtRaf=0,this._updateVirtualWindow()}))};this._deepLinkHandled=!1;this._deepLinkInPlace=!1;this._initialLoadDone=!1;this._kpiRefreshInFlight=!1;this._kpiRefreshPending=!1;this._paletteKeydown=t=>{if(t.key==="/"&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&!this._paletteOpen){let i=t.composedPath()[0];if(i instanceof HTMLElement&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.tagName==="SELECT"||i.isContentEditable))return;t.preventDefault(),this._openPalette();return}if(!this._paletteOpen)return;let e=this._paletteResults;if(t.key==="Escape")t.preventDefault(),this._closePalette();else if(t.key==="ArrowDown")t.preventDefault(),this._paletteActive=Math.min(this._paletteActive+1,e.length-1);else if(t.key==="ArrowUp")t.preventDefault(),this._paletteActive=Math.max(this._paletteActive-1,0);else if(t.key==="Enter"){t.preventDefault();let i=e[this._paletteActive];i&&this._selectPaletteResult(i)}};this._onDialogEvent=async()=>{try{await this._loadData()}catch{}};this._onCalendarLlCustom=t=>{let e=t.detail;e?.type==="maintenance-supporter:open-task"&&e.entry_id&&e.task_id&&(t.stopPropagation(),this._showTask(e.entry_id,e.task_id))};this._fullHistory=null;this._onHistoryEntrySaved=async()=>{await this._loadData()}}get _currencySymbol(){return Kt(this._budget)}get _lang(){return U(this.hass)}get _isOperator(){let t=this.hass?.user;return t?t.is_admin?!1:!(this._operatorWriteEnabled&&this._adminPanelUserIds.includes(t.id)):!0}_ensureLazyUi(){return this._lazyUi||(this._lazyUi=Promise.all([import("/maintenance_supporter_panelfiles/panel-chunks/object-dialog-JFCVO3XR.js"),import("/maintenance_supporter_panelfiles/panel-chunks/task-dialog-PZMOKNLO.js"),import("/maintenance_supporter_panelfiles/panel-chunks/complete-dialog-UPLYCC44.js"),import("/maintenance_supporter_panelfiles/panel-chunks/qr-dialog-JXN7TAPX.js"),import("/maintenance_supporter_panelfiles/panel-chunks/adopt-problem-sensors-dialog-MUGSDLVO.js"),import("/maintenance_supporter_panelfiles/panel-chunks/suggested-setups-dialog-YAP3OISD.js"),import("/maintenance_supporter_panelfiles/panel-chunks/settings-view-XJQ7WKV6.js")]).then(()=>this.updateComplete)),this._lazyUi}async _ui(t){return await this._ensureLazyUi(),this.shadowRoot?.querySelector(t)??null}connectedCallback(){super.connectedCallback(),this._mountPath=window.location.pathname;let t=window.requestIdleCallback,e=()=>this._ensureLazyUi();t?t(e,{timeout:3e3}):window.setTimeout(e,1500),window.addEventListener("popstate",this._popstateHandler),window.addEventListener("location-changed",this._locationChangedHandler),window.addEventListener("keydown",this._paletteKeydown),typeof ResizeObserver<"u"&&(this._tightObserver=new ResizeObserver(i=>{let a=i[0]?.contentRect.width??0;a>0&&(this.tight=a<1e3),a>0&&(this.split=a>=1500)}),this._tightObserver.observe(this)),window.addEventListener("resize",this._onVirtualScroll,{passive:!0});try{let i=Z(D.taskSort);i&&Me.includes(i)&&(this._sortMode=i);let a=Z(D.objectSort);a&&["alphabetical","due_soonest","task_count"].includes(a)&&(this._objectSortMode=a);let n=Z(D.groupBy);n&&Fi.includes(n)&&(this._groupByMode=n);let d=Z(D.objectView);(d==="cards"||d==="table")&&(this._objectViewMode=d)}catch{}if(this._objects.length===0){let i=fi();i&&(this._objects=i.objects,i.stats&&(this._stats=i.stats))}}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._popstateHandler),window.removeEventListener("location-changed",this._locationChangedHandler),window.removeEventListener("keydown",this._paletteKeydown),this._tightObserver?.disconnect(),this._tightObserver=null,window.removeEventListener("resize",this._onVirtualScroll),this.shadowRoot?.querySelector(".content")?.removeEventListener("scroll",this._onVirtualScroll),this._virtScrollAttached=!1,this._virtRaf&&cancelAnimationFrame(this._virtRaf),this._detachStickyPane(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._initialLoadDone=!1,this._lastConnection=null,this._deepLinkHandled=!1,this._searchTimer&&(clearTimeout(this._searchTimer),this._searchTimer=null),this._toastTimer&&(clearTimeout(this._toastTimer),this._toastTimer=null),this._toastMessage="",this._toastUndo=null,this._toastActionLabel="",this._statsService?.clearCache(),this._statsService=null}willUpdate(t){super.willUpdate(t),t.has("_groupByMode")&&this._collapsedGroups.size>0&&(this._collapsedGroups=new Set)}updated(t){if(super.updated(t),At(this,t),t.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,history.replaceState({msp_view:"overview",msp_entry:null,msp_task:null},""),this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}this._statsService?this._statsService.updateHass(this.hass):(this._statsService=new ae(this.hass),this._fetchMiniStatsForOverview()),this._userService?this._userService.updateHass(this.hass):(this._userService=new Je(this.hass),this._userService.getUsers())}let e=this.shadowRoot?.querySelector(".content");e&&!this._virtScrollAttached&&(e.addEventListener("scroll",this._onVirtualScroll,{passive:!0}),this._virtScrollAttached=!0),this._updateVirtualWindow(),this._syncStickyPane(e)}_syncStickyPane(t){let e=this.shadowRoot?.querySelector(".split-pane");if(!e||!t){this._stickyAttached&&this._detachStickyPane();return}this._stickyAttached||(t.addEventListener("scroll",this._onStickyScroll,{passive:!0}),window.addEventListener("resize",this._onStickyScroll),typeof ResizeObserver<"u"&&(this._stickyObserver=new ResizeObserver(this._onStickyScroll)),this._stickyAttached=!0),this._stickyObserver?.observe(e),this._updateStickyPane()}_detachStickyPane(){this.shadowRoot?.querySelector(".content")?.removeEventListener("scroll",this._onStickyScroll),window.removeEventListener("resize",this._onStickyScroll),this._stickyObserver?.disconnect(),this._stickyObserver=null,this._stickyRaf&&cancelAnimationFrame(this._stickyRaf),this._stickyRaf=0,this._stickyAttached=!1,this._stickyState=he,this._stickySelectPending=!1}_updateStickyPane(){let t=this.shadowRoot,e=t?.querySelector(".content"),i=t?.querySelector(".split-pane"),a=t?.querySelector(".split-layout"),n=t?.querySelector(".split-list");if(!e||!i||!a||!n)return;let d=e.getBoundingClientRect().top-e.scrollTop,r={scrollTop:e.scrollTop,viewH:e.clientHeight,paneH:i.offsetHeight,listH:n.offsetHeight,layoutTop:a.getBoundingClientRect().top-d,renderedTop:i.getBoundingClientRect().top-d};this._stickySelectPending&&r.scrollTop===this._stickyState.lastScrollTop?this._stickyState=Ni(r):(this._stickySelectPending=!1,this._stickyState=Bi(this._stickyState,r));let p=this._stickyState;i.style.top=`${Hi(p.mode,r)}px`,i.style.marginTop=p.marginTop>0?`${p.marginTop}px`:""}_resetStickyPane(){let t=this.shadowRoot?.querySelector(".content");this._stickyState={...he,lastScrollTop:t?.scrollTop??0},this._stickySelectPending=!0}_updateVirtualWindow(){let t=this.shadowRoot?.querySelector(".content"),e=this.shadowRoot?.querySelector(".task-table.virtual");if(!t||!e)return;let i=e.querySelector(".task-row:not(.virt-sizer)");i&&i.offsetHeight>20&&(this._virtRowHeight=i.offsetHeight);let a=e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop,n=Li({scrollTop:t.scrollTop,viewportHeight:t.clientHeight,listTop:a,rowHeight:this._virtRowHeight,total:this._virtTotalRows});(n.start!==this._virtStart||n.end!==this._virtEnd)&&(this._virtStart=n.start,this._virtEnd=n.end)}async _loadData(){let[t,e,i,a,n,d]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"}).catch(()=>null)]);if(d&&(this._savedViews=d.views||[]),t&&(this._objects=qt(t.objects),xe(this._objects,e??this._stats??null),this._maybeLoadGettingStarted()),this._detailOpen()&&this._fetchFullHistory(this._selectedEntryId,this._selectedTaskId),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/battery_fleet/status"}).then(r=>{this._batteryFleetSetupAvailable=!!r.available&&!r.configured}).catch(()=>{this._batteryFleetSetupAvailable=!1}),this._staleChecked||(this._staleChecked=!0,this.hass.connection.sendMessagePromise({type:"maintenance_supporter/version"}).then(r=>{this._staleBundle=Ce(r?.version)}).catch(()=>{})),e&&(this._stats=e),i&&(this._budget=i,Pt(this._budget)),a&&(this._groups=a.groups||{}),n){let r=n;this._features=r.features,this._adminPanelUserIds=r.admin_panel_user_ids||[],this._operatorWriteEnabled=r.operator_write_enabled??!1;let p=r.general?.default_warning_days;typeof p=="number"&&p>=0&&p<=365&&(this._defaultWarningDays=p);let u=r.general?.row_action_style;this._rowActionStyle=u==="icons"||u==="buttons"?u:"buttons_compact",this._rowActionNotice=r.general?.row_action_notice_pending===!0,this._refsInLists=r.general?.ref_numbers_in_lists===!0,this._objectsTableColumns=qe(r.objects_table_columns)}this._fetchMiniStatsForOverview(),this._initialLoadDone=!0,this._handleDeepLink()}_onLocationChanged(){if(!this._initialLoadDone||!window.location.search||this.embedded&&this._mountPath!==null&&window.location.pathname!==this._mountPath)return;if(!this.embedded){let e=`/${typeof this.panel?.url_path=="string"?this.panel.url_path:"maintenance-supporter"}`,i=window.location.pathname;if(i!==e&&!i.startsWith(`${e}/`))return}this._deepLinkHandled=!1,this._deepLinkInPlace=!0;try{this._handleDeepLink()}finally{this._deepLinkInPlace=!1}history.state?.msp_view||history.replaceState({msp_view:this._view,msp_entry:this._selectedEntryId,msp_task:this._selectedTaskId},"")}_handleDeepLink(){if(this._deepLinkHandled)return;let t=new URLSearchParams(window.location.search),e=t.get("ms_action"),i=()=>{let x=window.location.pathname+window.location.hash;history.replaceState(history.state,"",x)};if(e==="add_object"){this._deepLinkHandled=!0,i(),this._ui("maintenance-object-dialog").then(x=>x?.openCreate());return}if(e==="open_vacation"||e==="open_budget"||e==="open_groups"||e==="open_settings"){if(this._deepLinkHandled=!0,i(),!this.hass?.user?.is_admin)return;this._overviewTab="settings",this._ensureLazyUi().then(()=>requestAnimationFrame(()=>{let x=this.shadowRoot?.querySelector("maintenance-settings-view"),M=e.replace("open_","");x?.scrollToSection?.(M)}));return}if(this.embedded&&!this._presetsApplied){this._presetsApplied=!0;let x=this.presets?.tab??"",M=(this.presets?.view??"").trim();if(!t.has("tab")&&ye.includes(x)&&(x!=="settings"||this.hass?.user?.is_admin)&&(this._overviewTab=x),!t.has("view")&&M){let k=M.toLowerCase(),I=this._savedViews.find(O=>O.id===M)??this._savedViews.find(O=>O.name.trim().toLowerCase()===k);I&&(this._overviewTab="dashboard",this._applyView(I.id))}}let a=t.get("tab"),n=t.get("view"),d=t.get("sort"),r=t.get("status");if(a!==null||n!==null||d!==null||r!==null){if(i(),this._view!=="overview"&&(this._view="overview",this._selectedEntryId=null,this._selectedTaskId=null,this._moreMenuOpen=!1,this._scrollContentToTop()),ye.includes(a??"")&&(a!=="settings"||this.hass?.user?.is_admin)&&this._setOverviewTab(a),n!==null){let x=n.trim().toLowerCase(),M=this._savedViews.find(k=>k.id===n)??this._savedViews.find(k=>k.name.trim().toLowerCase()===x);M&&(this._overviewTab!=="dashboard"&&this._setOverviewTab("dashboard"),this._applyView(M.id))}Me.includes(d??"")&&(this._sortMode=d,this._activeViewId="",G(D.taskSort,this._sortMode)),As.includes(r??"")&&(this._overviewTab!=="dashboard"&&this._setOverviewTab("dashboard"),this._filterByStatus(r))}let p=t.get("entry_id");if(!p)return;this._deepLinkHandled=!0;let u=t.get("task_id"),_=t.get("action"),v=t.get("section"),f=qi.includes(v??"")?v:null,b=window.location.pathname+window.location.hash;history.replaceState(history.state,"",b);let R=this._getObject(p);if(!R){this._showOverview();return}if(u){let x=R.tasks.find(M=>M.id===u);if(!x){this._showObject(p,f);return}this._showTask(p,u),_==="complete"?requestAnimationFrame(()=>{this._openCompleteDialog(p,u,x.name,this._features.checklists?x.checklist:void 0,this._features.adaptive&&!!x.adaptive_config?.enabled)}):_==="quick_complete"&&requestAnimationFrame(()=>{this._handleQuickComplete(p,u,x)})}else this._showObject(p,f)}_isCounterEntity(t){if(!t)return!1;let e=t.type||"threshold";return e==="counter"||e==="state_change"}async _fetchDetailStats(t,e){if(!this._statsService)return;let i=await this._statsService.getDetailStats(t,e,this._chartRangeDays),a=new Map(this._detailStatsData);a.set(t,i),this._detailStatsData=a}_setChartRange(t){if(t===this._chartRangeDays)return;this._chartRangeDays=t;try{G(D.chartRange,String(t))}catch{}let e=this._selectedEntryId&&this._selectedTaskId?this._getTask(this._selectedEntryId,this._selectedTaskId):null,i=e?.trigger_config?.entity_id;if(i){let a=new Map(this._detailStatsData);a.delete(i),this._detailStatsData=a,this._fetchDetailStats(i,this._isCounterEntity(e.trigger_config))}}_setHideOutliers(t){if(t!==this._hideOutliers){this._hideOutliers=t;try{G(D.chartHideOutliers,t?"1":"0")}catch{}}}async _fetchMiniStatsForOverview(){if(!this._statsService)return;let t=[];for(let i of this._objects)for(let a of i.tasks){let n=a.trigger_config?.entity_id;n&&t.push({entityId:n,isCounter:this._isCounterEntity(a.trigger_config)})}if(t.length===0)return;let e=await this._statsService.getBatchMiniStats(t);this._miniStatsData=new Map([...this._miniStatsData,...e])}async _subscribe(){try{let t=await this.hass.connection.subscribeMessage(e=>{let i=e,a=vi(this._objects,i);a!==null&&(this._objects=a,e.objects&&xe(a,this._stats??null),this._refreshKpis(),this._detailOpen()&&(i.objects||(i.delta||[]).some(n=>n.entry_id===this._selectedEntryId))&&this._fetchFullHistory(this._selectedEntryId,this._selectedTaskId))},{type:"maintenance_supporter/subscribe",deltas:!0,compact:!0});if(!this.isConnected){t();return}this._unsub=t}catch{}}async _refreshKpis(){if(this._kpiRefreshInFlight){this._kpiRefreshPending=!0;return}this._kpiRefreshInFlight=!0;try{do{this._kpiRefreshPending=!1;let[t,e]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"}).catch(()=>null)]);if(!this.isConnected)return;t&&(this._stats=t),e&&(this._budget=e,Pt(this._budget))}while(this._kpiRefreshPending)}finally{this._kpiRefreshInFlight=!1}}get _taskRows(){let t=[];for(let _ of this._objects)for(let v of _.tasks){if(!this._showArchived&&v.archived||this._filterStatus&&v.status!==this._filterStatus)continue;if(this._filterUser){let b=this._filterUser==="current_user"?this._userService?.getCurrentUserId():this._filterUser;if(v.responsible_user_id!==b)continue}if(this._filterLabel&&!(v.labels||[]).includes(this._filterLabel)||this._filterPriority&&(v.priority||"normal")!==this._filterPriority)continue;let f=[];for(let b of Object.values(this._groups))b.task_refs?.some(R=>R.entry_id===_.entry_id&&R.task_id===v.id)&&f.push(b.name);t.push({entry_id:_.entry_id,task_id:v.id,object_name:_.object.name,allow_skip:v.allow_skip!==!1,notify_enabled:v.notify_enabled!==!1,task_name:v.name,type:v.type,schedule_type:v.schedule_type,status:v.status,days_until_due:v.days_until_due??null,next_due:v.next_due??null,trigger_active:v.trigger_active,trigger_current_value:v.trigger_current_value??null,trigger_current_delta:v.trigger_current_delta??null,trigger_config:v.trigger_config??null,trigger_entity_info:v.trigger_entity_info??null,times_performed:v.times_performed,total_cost:v.total_cost,interval_days:v.interval_days??null,interval_unit:v.interval_unit??null,interval_anchor:v.interval_anchor??null,is_done:v.is_done??!1,archived:v.archived??!1,history:v.history||[],enabled:v.enabled,nfc_tag_id:v.nfc_tag_id??null,priority:v.priority??"normal",labels:v.labels??[],area_id:_.object.area_id??null,responsible_user_id:v.responsible_user_id??null,group_names:f})}let e={overdue:0,triggered:1,due_soon:2,ok:3},i=(_,v)=>(e[_.status]??9)-(e[v.status]??9),a=(_,v)=>(_.days_until_due??99999)-(v.days_until_due??99999),n=(_,v)=>i(_,v)||a(_,v),d=_=>_.area_id&&this.hass?.areas?.[_.area_id]?.name||"",r=_=>_.responsible_user_id&&this._userService?.getUserName(_.responsible_user_id)||"",p=_=>_.group_names[0]||"",u={due_date:n,object:(_,v)=>_.object_name.localeCompare(v.object_name)||n(_,v),type:(_,v)=>_.type.localeCompare(v.type)||n(_,v),task_name:(_,v)=>_.task_name.localeCompare(v.task_name),area:(_,v)=>{let f=d(_),b=d(v);return!f&&b?1:f&&!b?-1:f.localeCompare(b)||n(_,v)},assigned_user:(_,v)=>{let f=r(_),b=r(v);return!f&&b?1:f&&!b?-1:f.localeCompare(b)||n(_,v)},group:(_,v)=>{let f=p(_),b=p(v);return!f&&b?1:f&&!b?-1:f.localeCompare(b)||n(_,v)}};return t.sort(u[this._sortMode]),t}_getObject(t){return this._objects.find(e=>e.entry_id===t)}_getTask(t,e){return this._getObject(t)?.tasks.find(a=>a.id===e)}_listRef(t,e){if(!this._refsInLists)return h;let i=this._getObject(t);return Dt(xt(i?.object,i?.tasks.find(a=>a.id===e)))}_objRef(t){return this._refsInLists?Dt(yt(t)):h}_pushPanelState(t,e,i){let a={msp_view:t,msp_entry:e||null,msp_task:i||null};this._deepLinkInPlace?history.replaceState(a,""):history.pushState(a,"")}_onPopState(t){let e=t.state;if(e?.msp_view&&(this._view=e.msp_view,this._selectedEntryId=e.msp_entry||null,this._selectedTaskId=e.msp_task||null,this._moreMenuOpen=!1,this._objectSectionOverride=null,e.msp_view==="all_parts"&&this._loadAllParts(),e.msp_view==="task"&&e.msp_entry&&e.msp_task)){this._historyFilter=null;let i=this._getTask(e.msp_entry,e.msp_task);i?.trigger_config?.entity_id&&this._fetchDetailStats(i.trigger_config.entity_id,this._isCounterEntity(i.trigger_config))}}_showOverview(){this._pushPanelState("overview"),this._view="overview",this._selectedEntryId=null,this._selectedTaskId=null,this._moreMenuOpen=!1,this._scrollContentToTop()}_showAllObjects(){this._pushPanelState("all_objects"),this._view="all_objects",this._selectedEntryId=null,this._selectedTaskId=null,this._scrollContentToTop()}_showAllParts(){this._pushPanelState("all_parts"),this._view="all_parts",this._selectedEntryId=null,this._selectedTaskId=null,this._scrollContentToTop(),this._loadAllParts()}async _loadAllParts(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});this._allParts=t.parts||[]}catch{this._allParts=[]}}_filterByStatus(t){this._filterStatus=t,this._activeViewId="",this._overviewTab!=="dashboard"&&(this._overviewTab="dashboard"),this._scrollContentToTop()}get _allLabels(){let t=new Set;for(let e of this._objects)for(let i of e.tasks)for(let a of i.labels||[])t.add(a);return[...t].sort((e,i)=>e.localeCompare(i))}get _currentFilters(){return{status:this._filterStatus,user_id:this._filterUser,label:this._filterLabel,priority:this._filterPriority,archived:this._showArchived,sort_mode:this._sortMode,group_by:this._groupByMode}}_applyView(t){if(this._activeViewId=t,!t)return;let e=this._savedViews.find(a=>a.id===t);if(!e)return;let i=e.filters;this._filterStatus=i.status||"",this._filterUser=i.user_id||null,this._filterLabel=i.label||null,this._filterPriority=i.priority||"",this._showArchived=!!i.archived,Me.includes(i.sort_mode)&&(this._sortMode=i.sort_mode),Fi.includes(i.group_by)&&(this._groupByMode=i.group_by);try{G(D.taskSort,this._sortMode),G(D.groupBy,this._groupByMode)}catch{}this._overviewTab!=="dashboard"&&(this._overviewTab="dashboard")}_openSavedViewsDialog(){this.shadowRoot.querySelector("maintenance-saved-views-dialog")?.open(this._currentFilters,this._savedViews)}_onSavedViewsChanged(t){this._savedViews=t.detail.views||[],this._activeViewId&&!this._savedViews.some(e=>e.id===this._activeViewId)&&(this._activeViewId="")}_scrollContentToTop(){requestAnimationFrame(()=>{let t=this.shadowRoot?.querySelector(".content");t&&t.scrollTo({top:0,behavior:"smooth"})})}_showObject(t,e=null){this._pushPanelState("object",t),this._view="object",this._selectedEntryId=t,this._selectedTaskId=null,this._objectSectionOverride=e,e?this._scrollToObjectSection(e):this._scrollContentToTop()}_scrollToObjectSection(t){this.updateComplete.then(()=>requestAnimationFrame(()=>{let e=this.shadowRoot?.querySelector(`.obj-section[data-section="${t}"]`);e?e.scrollIntoView({block:"start",behavior:"smooth"}):this._scrollContentToTop()}))}_toggleObjectSection(t){let e=new Set(this._objectSectionsCollapsed);this._objectSectionOverride===t||!e.has(t)?e.add(t):e.delete(t),this._objectSectionOverride===t&&(this._objectSectionOverride=null),this._objectSectionsCollapsed=e,G(D.objectSections,JSON.stringify([...e]))}_splitActive(){return this.split&&!this.narrow&&!this.tight&&this._view==="overview"&&this._overviewTab==="dashboard"&&!this._bulkMode}_detailOpen(){return(this._view==="task"||this._splitActive())&&!!this._selectedEntryId&&!!this._selectedTaskId}_showFullTaskPage(t,e){this._view!=="task"&&(this._pushPanelState("task",t,e),this._view="task",this._selectedEntryId=t,this._selectedTaskId=e,this._scrollContentToTop())}_showTask(t,e){if(this._splitActive()){this._selectedEntryId=t,this._selectedTaskId=e,this._activeTab="overview",this._historyFilter=null,this._historySearch="",this._resetStickyPane(),this._fetchFullHistory(t,e);let a=this._getTask(t,e);a?.trigger_config?.entity_id&&this._fetchDetailStats(a.trigger_config.entity_id,this._isCounterEntity(a.trigger_config));return}this._pushPanelState("task",t,e),this._view="task",this._selectedEntryId=t,this._selectedTaskId=e,this._activeTab="overview",this._historyFilter=null,this._historySearch="",this._scrollContentToTop(),this._fetchFullHistory(t,e);let i=this._getTask(t,e);if(i?.trigger_config?.entity_id){let a=i.trigger_config.entity_id,n=this._isCounterEntity(i.trigger_config);this._fetchDetailStats(a,n)}}_showToast(t){this._toastTimer&&clearTimeout(this._toastTimer),this._toastUndo=null,this._toastActionLabel="",this._toastMessage=t,this._toastTimer=setTimeout(()=>{this._toastMessage="",this._toastTimer=null},4e3)}_showActionToast(t,e,i){this._showUndoToast(t,i),this._toastActionLabel=e}_showUndoToast(t,e){this._toastTimer&&clearTimeout(this._toastTimer),this._toastActionLabel="",this._toastMessage=t,this._toastUndo=e,this._toastTimer=setTimeout(()=>{this._toastMessage="",this._toastUndo=null,this._toastTimer=null},7e3)}_runToastUndo(){let t=this._toastUndo;this._toastTimer&&clearTimeout(this._toastTimer),this._toastMessage="",this._toastUndo=null,this._toastTimer=null,t?.()}_openPalette(){this._paletteQuery="",this._paletteActive=0,this._paletteOpen=!0,this._searchRemote=null,this.updateComplete.then(()=>{this.shadowRoot?.querySelector(".palette-input")?.focus()})}_closePalette(){this._paletteOpen=!1,this._paletteQuery="",this._searchRemote=null,this._searchTimer&&(clearTimeout(this._searchTimer),this._searchTimer=null)}_onPaletteInput(t){this._paletteQuery=t,this._paletteActive=0,this._searchTimer&&clearTimeout(this._searchTimer);let e=t.trim();if(e.length{this._searchTimer=null;let i=++this._searchSeq;this.hass.connection.sendMessagePromise({type:"maintenance_supporter/search",query:e,limit:Ot.documents}).then(a=>{i!==this._searchSeq||!this._paletteOpen||(this._searchRemote={query:e,documents:a.documents||[],history:a.history||[]})}).catch(()=>{i!==this._searchSeq||!this._paletteOpen||(this._searchRemote={query:e,documents:[],history:[]})})},Cs)}get _paletteResults(){let t=this._lang,e=this._paletteQuery.trim();if(e.lengthx?[M,s("archived",t)].filter(Boolean).join(" \xB7 "):M;r.task==null&&a.push({kind:"object",entryId:v.entry_id,label:f.name||"",sub:R(f.archived,s("object",t)),score:1e3,icon:"mdi:package-variant-closed",ref:b});for(let x of v.tasks)r.task!=null&&x.ref_no!==r.task||n.push({kind:"task",entryId:v.entry_id,taskId:x.id,label:x.name||"",sub:R(x.archived||f.archived,f.name||""),score:r.task==null?900:1e3,icon:"mdi:clipboard-check-outline",ref:xt(f,x)})}if(a.length||n.length){let v=this._searchRemote&&this._searchRemote.query===e?this._searchRemote:null,f=[...a,...n.slice(0,Ot.tasks)];for(let b of v?.history.slice(0,1)??[])f.push({kind:"history",entryId:b.entry_id,taskId:b.task_id,label:b.task_name||"",sub:[b.object_name,b.timestamp?Q(b.timestamp,t):""].filter(Boolean).join(" \xB7 "),snippet:b.snippet||"",score:b.score,icon:"mdi:note-text-outline",ref:b.ref??null});return f}}for(let v of this._objects){let f=v.object;if(f.archived)continue;let b=f.name||"",R=Ct(i,[{text:b,weight:3},{text:f.manufacturer,weight:2},{text:f.model,weight:2},{text:f.serial_number,weight:2},{text:f.notes,weight:1}]);if(R>0){let x=[f.manufacturer,f.model].filter(Boolean).join(" ");a.push({kind:"object",entryId:v.entry_id,label:b,sub:x||s("object",t),score:R,icon:"mdi:package-variant-closed",ref:yt(f)})}for(let x of v.tasks){if(x.archived)continue;let M=(x.labels||[]).join(" "),k=Ct(i,[{text:x.name,weight:3},{text:b,weight:2},{text:M,weight:2},{text:x.notes,weight:1}]);if(k>0){let I=(x.labels||[]).length?` #${(x.labels||[]).join(" #")}`:"";n.push({kind:"task",entryId:v.entry_id,taskId:x.id,label:x.name||"",sub:b+I,score:k,icon:"mdi:clipboard-check-outline",ref:xt(f,x)})}}for(let x of v.parts||[]){let M=Ct(i,[{text:x.name,weight:3},{text:x.mpn,weight:2},{text:x.vendor,weight:1},{text:x.storage_location,weight:1},{text:x.notes,weight:1}]);M>0&&d.push({kind:"part",entryId:v.entry_id,label:x.name||"",sub:[b,x.mpn].filter(Boolean).join(" \xB7 "),score:M,icon:"mdi:cog-outline"})}}let p=(v,f)=>f.score-v.score||v.label.localeCompare(f.label),u=[...a.sort(p).slice(0,Ot.objects),...n.sort(p).slice(0,Ot.tasks),...d.sort(p).slice(0,Ot.parts)],_=this._searchRemote&&this._searchRemote.query===e?this._searchRemote:null;if(_){let v=_.documents.slice(0,Ot.documents);for(let f of[...v.filter(b=>b.match!=="content"),...v.filter(b=>b.match==="content")])u.push({kind:f.match==="content"?"content":"document",entryId:f.entry_id,docId:f.id,docKind:f.kind,url:f.url,page:f.page??null,label:f.title||f.filename||f.url||"",sub:f.object_name||"",snippet:f.snippet||"",score:f.score,icon:f.kind==="weblink"?"mdi:link-variant":"mdi:file-document-outline"});for(let f of _.history.slice(0,Ot.history))u.push({kind:"history",entryId:f.entry_id,taskId:f.task_id,label:f.task_name||"",ref:f.ref??null,sub:[f.object_name,f.timestamp?Q(f.timestamp,t):""].filter(Boolean).join(" \xB7 "),snippet:f.snippet||"",score:f.score,icon:f.type==="skipped"?"mdi:skip-next-circle-outline":"mdi:note-text-outline"})}return u}_selectPaletteResult(t){let e=this._paletteQuery.trim();switch(this._closePalette(),t.kind){case"task":t.taskId&&this._showTask(t.entryId,t.taskId);return;case"history":if(!t.taskId)return;this._showTask(t.entryId,t.taskId),this._activeTab="history",this._historySearch=e;return;case"document":case"content":t.docKind==="weblink"?at(t.url)&&window.open(t.url,"_blank","noopener"):t.docId&&wt(this.hass,t.docId,t.page?`#page=${t.page}`:"").catch(()=>{}),this._showObject(t.entryId,"documents");return;case"part":this._showObject(t.entryId,"parts");return;default:this._showObject(t.entryId)}}_renderPalette(){if(!this._paletteOpen)return h;let t=this._lang,e=this._paletteResults,i=this._paletteQuery.trim(),a={object:s("objects",t),task:s("tasks",t),part:s("search_group_parts",t),document:s("documents",t),content:s("search_group_content",t),history:s("search_group_history",t)},n=i.length>=ue&&(!this._searchRemote||this._searchRemote.query!==i),d=null;return o` + `}var Ut=class extends H{createRenderRoot(){return this}render(){return!this.task||!this.ctx?h:o`${Pi(this.task,this.ctx)}`}};g([S({attribute:!1})],Ut.prototype,"task",2),g([S({attribute:!1})],Ut.prototype,"ctx",2);customElements.get("maintenance-task-detail-view")||customElements.define("maintenance-task-detail-view",Ut);function Li(l){if(l.total<=0)return{start:0,end:0,padTop:0,padBottom:0};let c=l.overscan??12,t=Math.max(1,l.step??6),e=Math.max(1,l.rowHeight),i=Math.floor((l.scrollTop-l.listTop)/e),a=Math.ceil(l.viewportHeight/e)+1,n=Math.max(0,i-c);n=Math.floor(n/t)*t;let d=Math.min(l.total,Math.max(i,0)+a+c);return d=Math.min(l.total,Math.ceil(d/t)*t),n>=d&&(n=Math.min(n,Math.max(0,l.total-1)),d=Math.min(l.total,n+Math.max(a,1))),{start:n,end:d,padTop:n*e,padBottom:(l.total-d)*e}}var he={mode:"top",marginTop:0,lastScrollTop:0};function Hi(l,c){return l==="top"?8:c.viewH-c.paneH-8}function Ni(l){let c=l.scrollTop+8-l.layoutTop,t=Math.max(0,l.listH-l.paneH);return{mode:"top",marginTop:c>t?Math.max(0,c):0,lastScrollTop:l.scrollTop}}function Bi(l,c){let t=c.scrollTop,e=c.scrollTop>l.lastScrollTop?"down":c.scrollTop0&&e==="up")d=Math.max(0,Math.min(d,c.scrollTop+8-c.layoutTop)),d<=i&&(d=0);else if(!a&&e==="down"&&n==="top"){let r=c.renderedTop-c.layoutTop;r<=i&&(n="bottom",d=Math.max(0,r))}else!a&&e==="up"&&n==="bottom"&&(d=Math.min(Math.max(0,c.renderedTop-c.layoutTop),i),c.scrollTop+8<=c.layoutTop+d&&(n="top",d=0));return{mode:n,marginTop:d,lastScrollTop:t}}var ue=2,Cs=250,Ot={objects:6,tasks:10,parts:6,documents:8,history:6},Ds="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",Me=["due_date","object","type","task_name","area","assigned_user","group"],Fi=["none","area","group","user","object"],As=["overdue","due_soon","triggered","ok"],qi=["tasks","documents","parts","history"],w=class extends H{constructor(){super(...arguments);this.narrow=!1;this.tight=!1;this.split=!1;this._tightObserver=null;this.panel={};this.embedded=!1;this.presets={};this._presetsApplied=!1;this._mountPath=null;this._objects=[];this._stats=null;this._view="overview";this._allParts=null;this._selectedEntryId=null;this._selectedTaskId=null;this._filterStatus="";this._filterUser=null;this._filterLabel=null;this._filterPriority="";this._savedViews=[];this._activeViewId="";this._unsub=null;this._chartRangeDays=(()=>{try{let t=parseInt(Z(D.chartRange)||"",10);return[7,30,90,365].includes(t)?t:30}catch{return 30}})();this._hideOutliers=(()=>{try{return Z(D.chartHideOutliers)==="1"}catch{return!1}})();this._historyFilter=null;this._budget=null;this._groups={};this._detailStatsData=new Map;this._miniStatsData=new Map;this._features={adaptive:!1,predictions:!1,seasonal:!1,environmental:!1,budget:!1,groups:!1,checklists:!1,schedule_time:!1,completion_actions:!1};this._adminPanelUserIds=[];this._operatorWriteEnabled=!1;this._defaultWarningDays=7;this._rowActionStyle="buttons_compact";this._refsInLists=!1;this._rowActionNotice=!1;this._actionLoading=!1;this._moreMenuOpen=!1;this._objMenuOpen=!1;this._toastMessage="";this._toastUndo=null;this._toastActionLabel="";this._filtersOpen=!1;this._newMenuOpen=!1;this._gsSetupsCount=0;this._gsAdoptCount=0;this._gsLoaded=!1;this._batteryFleetSetupAvailable=!1;this._staleBundle=!1;this._staleChecked=!1;this._toastTimer=null;this._dismissedSuggestions=new Set;this._overviewTab=(()=>{try{let t=Z(D.overviewTab);return t==="today"||t==="calendar"?t:"dashboard"}catch{return"dashboard"}})();this._activeTab="overview";this._costDurationToggle="both";this._historySearch="";this._sortMode="due_date";this._objectSortMode="alphabetical";this._groupByMode="none";this._objectViewMode="cards";this._objectsTableColumns=Fe;this._showArchived=!1;this._bulkMode=!1;this._bulkSelected=new Set;this._virtStart=0;this._virtEnd=0;this._virtRowHeight=53;this._virtTotalRows=0;this._virtScrollAttached=!1;this._virtRaf=0;this._stickyState=he;this._stickySelectPending=!1;this._stickyRaf=0;this._stickyAttached=!1;this._stickyObserver=null;this._collapsedGroups=new Set;this._collapsedSections=(()=>{try{return new Set(JSON.parse(Z(D.collapsedSections)||"[]"))}catch{return new Set}})();this._objectSectionsCollapsed=(()=>{try{let t=JSON.parse(Z(D.objectSections)||"[]");return new Set((Array.isArray(t)?t:[]).filter(e=>qi.includes(e)))}catch{return new Set}})();this._objectSectionOverride=null;this._paletteOpen=!1;this._paletteQuery="";this._paletteActive=0;this._searchRemote=null;this._searchTimer=null;this._searchSeq=0;this._templateGalleryOpen=!1;this._templates=[];this._templateCategories={};this._templateBusy=!1;this._statsService=null;this._userService=null;this._dataLoaded=!1;this._lastConnection=null;this._popstateHandler=t=>this._onPopState(t);this._locationChangedHandler=()=>this._onLocationChanged();this._lazyUi=null;this._onStickyScroll=()=>{this._stickyRaf||(this._stickyRaf=requestAnimationFrame(()=>{this._stickyRaf=0,this._updateStickyPane()}))};this._onVirtualScroll=()=>{this._virtRaf||(this._virtRaf=requestAnimationFrame(()=>{this._virtRaf=0,this._updateVirtualWindow()}))};this._deepLinkHandled=!1;this._deepLinkInPlace=!1;this._initialLoadDone=!1;this._kpiRefreshInFlight=!1;this._kpiRefreshPending=!1;this._paletteKeydown=t=>{if(t.key==="/"&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&!this._paletteOpen){let i=t.composedPath()[0];if(i instanceof HTMLElement&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.tagName==="SELECT"||i.isContentEditable))return;t.preventDefault(),this._openPalette();return}if(!this._paletteOpen)return;let e=this._paletteResults;if(t.key==="Escape")t.preventDefault(),this._closePalette();else if(t.key==="ArrowDown")t.preventDefault(),this._paletteActive=Math.min(this._paletteActive+1,e.length-1);else if(t.key==="ArrowUp")t.preventDefault(),this._paletteActive=Math.max(this._paletteActive-1,0);else if(t.key==="Enter"){t.preventDefault();let i=e[this._paletteActive];i&&this._selectPaletteResult(i)}};this._onDialogEvent=async()=>{try{await this._loadData()}catch{}};this._onCalendarLlCustom=t=>{let e=t.detail;e?.type==="maintenance-supporter:open-task"&&e.entry_id&&e.task_id&&(t.stopPropagation(),this._showTask(e.entry_id,e.task_id))};this._fullHistory=null;this._onHistoryEntrySaved=async()=>{await this._loadData()}}get _currencySymbol(){return Kt(this._budget)}get _lang(){return U(this.hass)}get _isOperator(){let t=this.hass?.user;return t?t.is_admin?!1:!(this._operatorWriteEnabled&&this._adminPanelUserIds.includes(t.id)):!0}_ensureLazyUi(){return this._lazyUi||(this._lazyUi=Promise.all([import("/maintenance_supporter_panelfiles/panel-chunks/object-dialog-V5TRDSAR.js"),import("/maintenance_supporter_panelfiles/panel-chunks/task-dialog-5V36PJTB.js"),import("/maintenance_supporter_panelfiles/panel-chunks/complete-dialog-6I7ZE4B2.js"),import("/maintenance_supporter_panelfiles/panel-chunks/qr-dialog-ND4XOZOC.js"),import("/maintenance_supporter_panelfiles/panel-chunks/adopt-problem-sensors-dialog-2C6DAJNM.js"),import("/maintenance_supporter_panelfiles/panel-chunks/suggested-setups-dialog-OTTCDLIG.js"),import("/maintenance_supporter_panelfiles/panel-chunks/settings-view-BOF5YKYH.js")]).then(()=>this.updateComplete)),this._lazyUi}async _ui(t){return await this._ensureLazyUi(),this.shadowRoot?.querySelector(t)??null}connectedCallback(){super.connectedCallback(),this._mountPath=window.location.pathname;let t=window.requestIdleCallback,e=()=>this._ensureLazyUi();t?t(e,{timeout:3e3}):window.setTimeout(e,1500),window.addEventListener("popstate",this._popstateHandler),window.addEventListener("location-changed",this._locationChangedHandler),window.addEventListener("keydown",this._paletteKeydown),typeof ResizeObserver<"u"&&(this._tightObserver=new ResizeObserver(i=>{let a=i[0]?.contentRect.width??0;a>0&&(this.tight=a<1e3),a>0&&(this.split=a>=1500)}),this._tightObserver.observe(this)),window.addEventListener("resize",this._onVirtualScroll,{passive:!0});try{let i=Z(D.taskSort);i&&Me.includes(i)&&(this._sortMode=i);let a=Z(D.objectSort);a&&["alphabetical","due_soonest","task_count"].includes(a)&&(this._objectSortMode=a);let n=Z(D.groupBy);n&&Fi.includes(n)&&(this._groupByMode=n);let d=Z(D.objectView);(d==="cards"||d==="table")&&(this._objectViewMode=d)}catch{}if(this._objects.length===0){let i=fi();i&&(this._objects=i.objects,i.stats&&(this._stats=i.stats))}}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._popstateHandler),window.removeEventListener("location-changed",this._locationChangedHandler),window.removeEventListener("keydown",this._paletteKeydown),this._tightObserver?.disconnect(),this._tightObserver=null,window.removeEventListener("resize",this._onVirtualScroll),this.shadowRoot?.querySelector(".content")?.removeEventListener("scroll",this._onVirtualScroll),this._virtScrollAttached=!1,this._virtRaf&&cancelAnimationFrame(this._virtRaf),this._detachStickyPane(),this._unsub&&(this._unsub(),this._unsub=null),this._dataLoaded=!1,this._initialLoadDone=!1,this._lastConnection=null,this._deepLinkHandled=!1,this._searchTimer&&(clearTimeout(this._searchTimer),this._searchTimer=null),this._toastTimer&&(clearTimeout(this._toastTimer),this._toastTimer=null),this._toastMessage="",this._toastUndo=null,this._toastActionLabel="",this._statsService?.clearCache(),this._statsService=null}willUpdate(t){super.willUpdate(t),t.has("_groupByMode")&&this._collapsedGroups.size>0&&(this._collapsedGroups=new Set)}updated(t){if(super.updated(t),At(this,t),t.has("hass")&&this.hass){if(!this._dataLoaded)this._dataLoaded=!0,this._lastConnection=this.hass.connection,history.replaceState({msp_view:"overview",msp_entry:null,msp_task:null},""),this._loadData(),this._subscribe();else if(this.hass.connection!==this._lastConnection){if(this._lastConnection=this.hass.connection,this._unsub){try{this._unsub()}catch{}this._unsub=null}this._subscribe(),this._loadData()}this._statsService?this._statsService.updateHass(this.hass):(this._statsService=new ae(this.hass),this._fetchMiniStatsForOverview()),this._userService?this._userService.updateHass(this.hass):(this._userService=new Je(this.hass),this._userService.getUsers())}let e=this.shadowRoot?.querySelector(".content");e&&!this._virtScrollAttached&&(e.addEventListener("scroll",this._onVirtualScroll,{passive:!0}),this._virtScrollAttached=!0),this._updateVirtualWindow(),this._syncStickyPane(e)}_syncStickyPane(t){let e=this.shadowRoot?.querySelector(".split-pane");if(!e||!t){this._stickyAttached&&this._detachStickyPane();return}this._stickyAttached||(t.addEventListener("scroll",this._onStickyScroll,{passive:!0}),window.addEventListener("resize",this._onStickyScroll),typeof ResizeObserver<"u"&&(this._stickyObserver=new ResizeObserver(this._onStickyScroll)),this._stickyAttached=!0),this._stickyObserver?.observe(e),this._updateStickyPane()}_detachStickyPane(){this.shadowRoot?.querySelector(".content")?.removeEventListener("scroll",this._onStickyScroll),window.removeEventListener("resize",this._onStickyScroll),this._stickyObserver?.disconnect(),this._stickyObserver=null,this._stickyRaf&&cancelAnimationFrame(this._stickyRaf),this._stickyRaf=0,this._stickyAttached=!1,this._stickyState=he,this._stickySelectPending=!1}_updateStickyPane(){let t=this.shadowRoot,e=t?.querySelector(".content"),i=t?.querySelector(".split-pane"),a=t?.querySelector(".split-layout"),n=t?.querySelector(".split-list");if(!e||!i||!a||!n)return;let d=e.getBoundingClientRect().top-e.scrollTop,r={scrollTop:e.scrollTop,viewH:e.clientHeight,paneH:i.offsetHeight,listH:n.offsetHeight,layoutTop:a.getBoundingClientRect().top-d,renderedTop:i.getBoundingClientRect().top-d};this._stickySelectPending&&r.scrollTop===this._stickyState.lastScrollTop?this._stickyState=Ni(r):(this._stickySelectPending=!1,this._stickyState=Bi(this._stickyState,r));let p=this._stickyState;i.style.top=`${Hi(p.mode,r)}px`,i.style.marginTop=p.marginTop>0?`${p.marginTop}px`:""}_resetStickyPane(){let t=this.shadowRoot?.querySelector(".content");this._stickyState={...he,lastScrollTop:t?.scrollTop??0},this._stickySelectPending=!0}_updateVirtualWindow(){let t=this.shadowRoot?.querySelector(".content"),e=this.shadowRoot?.querySelector(".task-table.virtual");if(!t||!e)return;let i=e.querySelector(".task-row:not(.virt-sizer)");i&&i.offsetHeight>20&&(this._virtRowHeight=i.offsetHeight);let a=e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop,n=Li({scrollTop:t.scrollTop,viewportHeight:t.clientHeight,listTop:a,rowHeight:this._virtRowHeight,total:this._virtTotalRows});(n.start!==this._virtStart||n.end!==this._virtEnd)&&(this._virtStart=n.start,this._virtEnd=n.end)}async _loadData(){let[t,e,i,a,n,d]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/objects",compact:!0}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/groups"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/settings"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/views/list"}).catch(()=>null)]);if(d&&(this._savedViews=d.views||[]),t&&(this._objects=qt(t.objects),xe(this._objects,e??this._stats??null),this._maybeLoadGettingStarted()),this._detailOpen()&&this._fetchFullHistory(this._selectedEntryId,this._selectedTaskId),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/battery_fleet/status"}).then(r=>{this._batteryFleetSetupAvailable=!!r.available&&!r.configured}).catch(()=>{this._batteryFleetSetupAvailable=!1}),this._staleChecked||(this._staleChecked=!0,this.hass.connection.sendMessagePromise({type:"maintenance_supporter/version"}).then(r=>{this._staleBundle=Ce(r?.version)}).catch(()=>{})),e&&(this._stats=e),i&&(this._budget=i,Pt(this._budget)),a&&(this._groups=a.groups||{}),n){let r=n;this._features=r.features,this._adminPanelUserIds=r.admin_panel_user_ids||[],this._operatorWriteEnabled=r.operator_write_enabled??!1;let p=r.general?.default_warning_days;typeof p=="number"&&p>=0&&p<=365&&(this._defaultWarningDays=p);let u=r.general?.row_action_style;this._rowActionStyle=u==="icons"||u==="buttons"?u:"buttons_compact",this._rowActionNotice=r.general?.row_action_notice_pending===!0,this._refsInLists=r.general?.ref_numbers_in_lists===!0,this._objectsTableColumns=qe(r.objects_table_columns)}this._fetchMiniStatsForOverview(),this._initialLoadDone=!0,this._handleDeepLink()}_onLocationChanged(){if(!this._initialLoadDone||!window.location.search||this.embedded&&this._mountPath!==null&&window.location.pathname!==this._mountPath)return;if(!this.embedded){let e=`/${typeof this.panel?.url_path=="string"?this.panel.url_path:"maintenance-supporter"}`,i=window.location.pathname;if(i!==e&&!i.startsWith(`${e}/`))return}this._deepLinkHandled=!1,this._deepLinkInPlace=!0;try{this._handleDeepLink()}finally{this._deepLinkInPlace=!1}history.state?.msp_view||history.replaceState({msp_view:this._view,msp_entry:this._selectedEntryId,msp_task:this._selectedTaskId},"")}_handleDeepLink(){if(this._deepLinkHandled)return;let t=new URLSearchParams(window.location.search),e=t.get("ms_action"),i=()=>{let x=window.location.pathname+window.location.hash;history.replaceState(history.state,"",x)};if(e==="add_object"){this._deepLinkHandled=!0,i(),this._ui("maintenance-object-dialog").then(x=>x?.openCreate());return}if(e==="open_vacation"||e==="open_budget"||e==="open_groups"||e==="open_settings"){if(this._deepLinkHandled=!0,i(),!this.hass?.user?.is_admin)return;this._overviewTab="settings",this._ensureLazyUi().then(()=>requestAnimationFrame(()=>{let x=this.shadowRoot?.querySelector("maintenance-settings-view"),M=e.replace("open_","");x?.scrollToSection?.(M)}));return}if(this.embedded&&!this._presetsApplied){this._presetsApplied=!0;let x=this.presets?.tab??"",M=(this.presets?.view??"").trim();if(!t.has("tab")&&ye.includes(x)&&(x!=="settings"||this.hass?.user?.is_admin)&&(this._overviewTab=x),!t.has("view")&&M){let k=M.toLowerCase(),I=this._savedViews.find(O=>O.id===M)??this._savedViews.find(O=>O.name.trim().toLowerCase()===k);I&&(this._overviewTab="dashboard",this._applyView(I.id))}}let a=t.get("tab"),n=t.get("view"),d=t.get("sort"),r=t.get("status");if(a!==null||n!==null||d!==null||r!==null){if(i(),this._view!=="overview"&&(this._view="overview",this._selectedEntryId=null,this._selectedTaskId=null,this._moreMenuOpen=!1,this._scrollContentToTop()),ye.includes(a??"")&&(a!=="settings"||this.hass?.user?.is_admin)&&this._setOverviewTab(a),n!==null){let x=n.trim().toLowerCase(),M=this._savedViews.find(k=>k.id===n)??this._savedViews.find(k=>k.name.trim().toLowerCase()===x);M&&(this._overviewTab!=="dashboard"&&this._setOverviewTab("dashboard"),this._applyView(M.id))}Me.includes(d??"")&&(this._sortMode=d,this._activeViewId="",G(D.taskSort,this._sortMode)),As.includes(r??"")&&(this._overviewTab!=="dashboard"&&this._setOverviewTab("dashboard"),this._filterByStatus(r))}let p=t.get("entry_id");if(!p)return;this._deepLinkHandled=!0;let u=t.get("task_id"),_=t.get("action"),v=t.get("section"),f=qi.includes(v??"")?v:null,b=window.location.pathname+window.location.hash;history.replaceState(history.state,"",b);let R=this._getObject(p);if(!R){this._showOverview();return}if(u){let x=R.tasks.find(M=>M.id===u);if(!x){this._showObject(p,f);return}this._showTask(p,u),_==="complete"?requestAnimationFrame(()=>{this._openCompleteDialog(p,u,x.name,this._features.checklists?x.checklist:void 0,this._features.adaptive&&!!x.adaptive_config?.enabled)}):_==="quick_complete"&&requestAnimationFrame(()=>{this._handleQuickComplete(p,u,x)})}else this._showObject(p,f)}_isCounterEntity(t){if(!t)return!1;let e=t.type||"threshold";return e==="counter"||e==="state_change"}async _fetchDetailStats(t,e){if(!this._statsService)return;let i=await this._statsService.getDetailStats(t,e,this._chartRangeDays),a=new Map(this._detailStatsData);a.set(t,i),this._detailStatsData=a}_setChartRange(t){if(t===this._chartRangeDays)return;this._chartRangeDays=t;try{G(D.chartRange,String(t))}catch{}let e=this._selectedEntryId&&this._selectedTaskId?this._getTask(this._selectedEntryId,this._selectedTaskId):null,i=e?.trigger_config?.entity_id;if(i){let a=new Map(this._detailStatsData);a.delete(i),this._detailStatsData=a,this._fetchDetailStats(i,this._isCounterEntity(e.trigger_config))}}_setHideOutliers(t){if(t!==this._hideOutliers){this._hideOutliers=t;try{G(D.chartHideOutliers,t?"1":"0")}catch{}}}async _fetchMiniStatsForOverview(){if(!this._statsService)return;let t=[];for(let i of this._objects)for(let a of i.tasks){let n=a.trigger_config?.entity_id;n&&t.push({entityId:n,isCounter:this._isCounterEntity(a.trigger_config)})}if(t.length===0)return;let e=await this._statsService.getBatchMiniStats(t);this._miniStatsData=new Map([...this._miniStatsData,...e])}async _subscribe(){try{let t=await this.hass.connection.subscribeMessage(e=>{let i=e,a=vi(this._objects,i);a!==null&&(this._objects=a,e.objects&&xe(a,this._stats??null),this._refreshKpis(),this._detailOpen()&&(i.objects||(i.delta||[]).some(n=>n.entry_id===this._selectedEntryId))&&this._fetchFullHistory(this._selectedEntryId,this._selectedTaskId))},{type:"maintenance_supporter/subscribe",deltas:!0,compact:!0});if(!this.isConnected){t();return}this._unsub=t}catch{}}async _refreshKpis(){if(this._kpiRefreshInFlight){this._kpiRefreshPending=!0;return}this._kpiRefreshInFlight=!0;try{do{this._kpiRefreshPending=!1;let[t,e]=await Promise.all([this.hass.connection.sendMessagePromise({type:"maintenance_supporter/statistics"}).catch(()=>null),this.hass.connection.sendMessagePromise({type:"maintenance_supporter/budget_status"}).catch(()=>null)]);if(!this.isConnected)return;t&&(this._stats=t),e&&(this._budget=e,Pt(this._budget))}while(this._kpiRefreshPending)}finally{this._kpiRefreshInFlight=!1}}get _taskRows(){let t=[];for(let _ of this._objects)for(let v of _.tasks){if(!this._showArchived&&v.archived||this._filterStatus&&v.status!==this._filterStatus)continue;if(this._filterUser){let b=this._filterUser==="current_user"?this._userService?.getCurrentUserId():this._filterUser;if(v.responsible_user_id!==b)continue}if(this._filterLabel&&!(v.labels||[]).includes(this._filterLabel)||this._filterPriority&&(v.priority||"normal")!==this._filterPriority)continue;let f=[];for(let b of Object.values(this._groups))b.task_refs?.some(R=>R.entry_id===_.entry_id&&R.task_id===v.id)&&f.push(b.name);t.push({entry_id:_.entry_id,task_id:v.id,object_name:_.object.name,allow_skip:v.allow_skip!==!1,notify_enabled:v.notify_enabled!==!1,task_name:v.name,type:v.type,schedule_type:v.schedule_type,status:v.status,days_until_due:v.days_until_due??null,next_due:v.next_due??null,trigger_active:v.trigger_active,trigger_current_value:v.trigger_current_value??null,trigger_current_delta:v.trigger_current_delta??null,trigger_config:v.trigger_config??null,trigger_entity_info:v.trigger_entity_info??null,times_performed:v.times_performed,total_cost:v.total_cost,interval_days:v.interval_days??null,interval_unit:v.interval_unit??null,interval_anchor:v.interval_anchor??null,is_done:v.is_done??!1,archived:v.archived??!1,history:v.history||[],enabled:v.enabled,nfc_tag_id:v.nfc_tag_id??null,priority:v.priority??"normal",labels:v.labels??[],area_id:_.object.area_id??null,responsible_user_id:v.responsible_user_id??null,group_names:f})}let e={overdue:0,triggered:1,due_soon:2,ok:3},i=(_,v)=>(e[_.status]??9)-(e[v.status]??9),a=(_,v)=>(_.days_until_due??99999)-(v.days_until_due??99999),n=(_,v)=>i(_,v)||a(_,v),d=_=>_.area_id&&this.hass?.areas?.[_.area_id]?.name||"",r=_=>_.responsible_user_id&&this._userService?.getUserName(_.responsible_user_id)||"",p=_=>_.group_names[0]||"",u={due_date:n,object:(_,v)=>_.object_name.localeCompare(v.object_name)||n(_,v),type:(_,v)=>_.type.localeCompare(v.type)||n(_,v),task_name:(_,v)=>_.task_name.localeCompare(v.task_name),area:(_,v)=>{let f=d(_),b=d(v);return!f&&b?1:f&&!b?-1:f.localeCompare(b)||n(_,v)},assigned_user:(_,v)=>{let f=r(_),b=r(v);return!f&&b?1:f&&!b?-1:f.localeCompare(b)||n(_,v)},group:(_,v)=>{let f=p(_),b=p(v);return!f&&b?1:f&&!b?-1:f.localeCompare(b)||n(_,v)}};return t.sort(u[this._sortMode]),t}_getObject(t){return this._objects.find(e=>e.entry_id===t)}_getTask(t,e){return this._getObject(t)?.tasks.find(a=>a.id===e)}_listRef(t,e){if(!this._refsInLists)return h;let i=this._getObject(t);return Dt(xt(i?.object,i?.tasks.find(a=>a.id===e)))}_objRef(t){return this._refsInLists?Dt(yt(t)):h}_pushPanelState(t,e,i){let a={msp_view:t,msp_entry:e||null,msp_task:i||null};this._deepLinkInPlace?history.replaceState(a,""):history.pushState(a,"")}_onPopState(t){let e=t.state;if(e?.msp_view&&(this._view=e.msp_view,this._selectedEntryId=e.msp_entry||null,this._selectedTaskId=e.msp_task||null,this._moreMenuOpen=!1,this._objectSectionOverride=null,e.msp_view==="all_parts"&&this._loadAllParts(),e.msp_view==="task"&&e.msp_entry&&e.msp_task)){this._historyFilter=null;let i=this._getTask(e.msp_entry,e.msp_task);i?.trigger_config?.entity_id&&this._fetchDetailStats(i.trigger_config.entity_id,this._isCounterEntity(i.trigger_config))}}_showOverview(){this._pushPanelState("overview"),this._view="overview",this._selectedEntryId=null,this._selectedTaskId=null,this._moreMenuOpen=!1,this._scrollContentToTop()}_showAllObjects(){this._pushPanelState("all_objects"),this._view="all_objects",this._selectedEntryId=null,this._selectedTaskId=null,this._scrollContentToTop()}_showAllParts(){this._pushPanelState("all_parts"),this._view="all_parts",this._selectedEntryId=null,this._selectedTaskId=null,this._scrollContentToTop(),this._loadAllParts()}async _loadAllParts(){try{let t=await this.hass.connection.sendMessagePromise({type:"maintenance_supporter/parts/overview"});this._allParts=t.parts||[]}catch{this._allParts=[]}}_filterByStatus(t){this._filterStatus=t,this._activeViewId="",this._overviewTab!=="dashboard"&&(this._overviewTab="dashboard"),this._scrollContentToTop()}get _allLabels(){let t=new Set;for(let e of this._objects)for(let i of e.tasks)for(let a of i.labels||[])t.add(a);return[...t].sort((e,i)=>e.localeCompare(i))}get _currentFilters(){return{status:this._filterStatus,user_id:this._filterUser,label:this._filterLabel,priority:this._filterPriority,archived:this._showArchived,sort_mode:this._sortMode,group_by:this._groupByMode}}_applyView(t){if(this._activeViewId=t,!t)return;let e=this._savedViews.find(a=>a.id===t);if(!e)return;let i=e.filters;this._filterStatus=i.status||"",this._filterUser=i.user_id||null,this._filterLabel=i.label||null,this._filterPriority=i.priority||"",this._showArchived=!!i.archived,Me.includes(i.sort_mode)&&(this._sortMode=i.sort_mode),Fi.includes(i.group_by)&&(this._groupByMode=i.group_by);try{G(D.taskSort,this._sortMode),G(D.groupBy,this._groupByMode)}catch{}this._overviewTab!=="dashboard"&&(this._overviewTab="dashboard")}_openSavedViewsDialog(){this.shadowRoot.querySelector("maintenance-saved-views-dialog")?.open(this._currentFilters,this._savedViews)}_onSavedViewsChanged(t){this._savedViews=t.detail.views||[],this._activeViewId&&!this._savedViews.some(e=>e.id===this._activeViewId)&&(this._activeViewId="")}_scrollContentToTop(){requestAnimationFrame(()=>{let t=this.shadowRoot?.querySelector(".content");t&&t.scrollTo({top:0,behavior:"smooth"})})}_showObject(t,e=null){this._pushPanelState("object",t),this._view="object",this._selectedEntryId=t,this._selectedTaskId=null,this._objectSectionOverride=e,e?this._scrollToObjectSection(e):this._scrollContentToTop()}_scrollToObjectSection(t){this.updateComplete.then(()=>requestAnimationFrame(()=>{let e=this.shadowRoot?.querySelector(`.obj-section[data-section="${t}"]`);e?e.scrollIntoView({block:"start",behavior:"smooth"}):this._scrollContentToTop()}))}_toggleObjectSection(t){let e=new Set(this._objectSectionsCollapsed);this._objectSectionOverride===t||!e.has(t)?e.add(t):e.delete(t),this._objectSectionOverride===t&&(this._objectSectionOverride=null),this._objectSectionsCollapsed=e,G(D.objectSections,JSON.stringify([...e]))}_splitActive(){return this.split&&!this.narrow&&!this.tight&&this._view==="overview"&&this._overviewTab==="dashboard"&&!this._bulkMode}_detailOpen(){return(this._view==="task"||this._splitActive())&&!!this._selectedEntryId&&!!this._selectedTaskId}_showFullTaskPage(t,e){this._view!=="task"&&(this._pushPanelState("task",t,e),this._view="task",this._selectedEntryId=t,this._selectedTaskId=e,this._scrollContentToTop())}_showTask(t,e){if(this._splitActive()){this._selectedEntryId=t,this._selectedTaskId=e,this._activeTab="overview",this._historyFilter=null,this._historySearch="",this._resetStickyPane(),this._fetchFullHistory(t,e);let a=this._getTask(t,e);a?.trigger_config?.entity_id&&this._fetchDetailStats(a.trigger_config.entity_id,this._isCounterEntity(a.trigger_config));return}this._pushPanelState("task",t,e),this._view="task",this._selectedEntryId=t,this._selectedTaskId=e,this._activeTab="overview",this._historyFilter=null,this._historySearch="",this._scrollContentToTop(),this._fetchFullHistory(t,e);let i=this._getTask(t,e);if(i?.trigger_config?.entity_id){let a=i.trigger_config.entity_id,n=this._isCounterEntity(i.trigger_config);this._fetchDetailStats(a,n)}}_showToast(t){this._toastTimer&&clearTimeout(this._toastTimer),this._toastUndo=null,this._toastActionLabel="",this._toastMessage=t,this._toastTimer=setTimeout(()=>{this._toastMessage="",this._toastTimer=null},4e3)}_showActionToast(t,e,i){this._showUndoToast(t,i),this._toastActionLabel=e}_showUndoToast(t,e){this._toastTimer&&clearTimeout(this._toastTimer),this._toastActionLabel="",this._toastMessage=t,this._toastUndo=e,this._toastTimer=setTimeout(()=>{this._toastMessage="",this._toastUndo=null,this._toastTimer=null},7e3)}_runToastUndo(){let t=this._toastUndo;this._toastTimer&&clearTimeout(this._toastTimer),this._toastMessage="",this._toastUndo=null,this._toastTimer=null,t?.()}_openPalette(){this._paletteQuery="",this._paletteActive=0,this._paletteOpen=!0,this._searchRemote=null,this.updateComplete.then(()=>{this.shadowRoot?.querySelector(".palette-input")?.focus()})}_closePalette(){this._paletteOpen=!1,this._paletteQuery="",this._searchRemote=null,this._searchTimer&&(clearTimeout(this._searchTimer),this._searchTimer=null)}_onPaletteInput(t){this._paletteQuery=t,this._paletteActive=0,this._searchTimer&&clearTimeout(this._searchTimer);let e=t.trim();if(e.length{this._searchTimer=null;let i=++this._searchSeq;this.hass.connection.sendMessagePromise({type:"maintenance_supporter/search",query:e,limit:Ot.documents}).then(a=>{i!==this._searchSeq||!this._paletteOpen||(this._searchRemote={query:e,documents:a.documents||[],history:a.history||[]})}).catch(()=>{i!==this._searchSeq||!this._paletteOpen||(this._searchRemote={query:e,documents:[],history:[]})})},Cs)}get _paletteResults(){let t=this._lang,e=this._paletteQuery.trim();if(e.lengthx?[M,s("archived",t)].filter(Boolean).join(" \xB7 "):M;r.task==null&&a.push({kind:"object",entryId:v.entry_id,label:f.name||"",sub:R(f.archived,s("object",t)),score:1e3,icon:"mdi:package-variant-closed",ref:b});for(let x of v.tasks)r.task!=null&&x.ref_no!==r.task||n.push({kind:"task",entryId:v.entry_id,taskId:x.id,label:x.name||"",sub:R(x.archived||f.archived,f.name||""),score:r.task==null?900:1e3,icon:"mdi:clipboard-check-outline",ref:xt(f,x)})}if(a.length||n.length){let v=this._searchRemote&&this._searchRemote.query===e?this._searchRemote:null,f=[...a,...n.slice(0,Ot.tasks)];for(let b of v?.history.slice(0,1)??[])f.push({kind:"history",entryId:b.entry_id,taskId:b.task_id,label:b.task_name||"",sub:[b.object_name,b.timestamp?Q(b.timestamp,t):""].filter(Boolean).join(" \xB7 "),snippet:b.snippet||"",score:b.score,icon:"mdi:note-text-outline",ref:b.ref??null});return f}}for(let v of this._objects){let f=v.object;if(f.archived)continue;let b=f.name||"",R=Ct(i,[{text:b,weight:3},{text:f.manufacturer,weight:2},{text:f.model,weight:2},{text:f.serial_number,weight:2},{text:f.notes,weight:1}]);if(R>0){let x=[f.manufacturer,f.model].filter(Boolean).join(" ");a.push({kind:"object",entryId:v.entry_id,label:b,sub:x||s("object",t),score:R,icon:"mdi:package-variant-closed",ref:yt(f)})}for(let x of v.tasks){if(x.archived)continue;let M=(x.labels||[]).join(" "),k=Ct(i,[{text:x.name,weight:3},{text:b,weight:2},{text:M,weight:2},{text:x.notes,weight:1}]);if(k>0){let I=(x.labels||[]).length?` #${(x.labels||[]).join(" #")}`:"";n.push({kind:"task",entryId:v.entry_id,taskId:x.id,label:x.name||"",sub:b+I,score:k,icon:"mdi:clipboard-check-outline",ref:xt(f,x)})}}for(let x of v.parts||[]){let M=Ct(i,[{text:x.name,weight:3},{text:x.mpn,weight:2},{text:x.vendor,weight:1},{text:x.storage_location,weight:1},{text:x.notes,weight:1}]);M>0&&d.push({kind:"part",entryId:v.entry_id,label:x.name||"",sub:[b,x.mpn].filter(Boolean).join(" \xB7 "),score:M,icon:"mdi:cog-outline"})}}let p=(v,f)=>f.score-v.score||v.label.localeCompare(f.label),u=[...a.sort(p).slice(0,Ot.objects),...n.sort(p).slice(0,Ot.tasks),...d.sort(p).slice(0,Ot.parts)],_=this._searchRemote&&this._searchRemote.query===e?this._searchRemote:null;if(_){let v=_.documents.slice(0,Ot.documents);for(let f of[...v.filter(b=>b.match!=="content"),...v.filter(b=>b.match==="content")])u.push({kind:f.match==="content"?"content":"document",entryId:f.entry_id,docId:f.id,docKind:f.kind,url:f.url,page:f.page??null,label:f.title||f.filename||f.url||"",sub:f.object_name||"",snippet:f.snippet||"",score:f.score,icon:f.kind==="weblink"?"mdi:link-variant":"mdi:file-document-outline"});for(let f of _.history.slice(0,Ot.history))u.push({kind:"history",entryId:f.entry_id,taskId:f.task_id,label:f.task_name||"",ref:f.ref??null,sub:[f.object_name,f.timestamp?Q(f.timestamp,t):""].filter(Boolean).join(" \xB7 "),snippet:f.snippet||"",score:f.score,icon:f.type==="skipped"?"mdi:skip-next-circle-outline":"mdi:note-text-outline"})}return u}_selectPaletteResult(t){let e=this._paletteQuery.trim();switch(this._closePalette(),t.kind){case"task":t.taskId&&this._showTask(t.entryId,t.taskId);return;case"history":if(!t.taskId)return;this._showTask(t.entryId,t.taskId),this._activeTab="history",this._historySearch=e;return;case"document":case"content":t.docKind==="weblink"?at(t.url)&&window.open(t.url,"_blank","noopener"):t.docId&&wt(this.hass,t.docId,t.page?`#page=${t.page}`:"").catch(()=>{}),this._showObject(t.entryId,"documents");return;case"part":this._showObject(t.entryId,"parts");return;default:this._showObject(t.entryId)}}_renderPalette(){if(!this._paletteOpen)return h;let t=this._lang,e=this._paletteResults,i=this._paletteQuery.trim(),a={object:s("objects",t),task:s("tasks",t),part:s("search_group_parts",t),document:s("documents",t),content:s("search_group_content",t),history:s("search_group_history",t)},n=i.length>=ue&&(!this._searchRemote||this._searchRemote.query!==i),d=null;return o`
this._closePalette()}>