@matter-server/dashboard 1.4.0 → 1.4.1-alpha.0-20261008-d619c2e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/README.md +13 -13
  2. package/dist/esm/client/models/descriptions.d.ts.map +1 -1
  3. package/dist/esm/client/models/descriptions.js +479 -28
  4. package/dist/esm/client/models/descriptions.js.map +1 -1
  5. package/dist/esm/components/avsum-ptz-strip.d.ts.map +1 -1
  6. package/dist/esm/components/avsum-ptz-strip.js +6 -6
  7. package/dist/esm/components/avsum-ptz-strip.js.map +1 -1
  8. package/dist/esm/components/semantic-tag-chips.d.ts +16 -0
  9. package/dist/esm/components/semantic-tag-chips.d.ts.map +1 -0
  10. package/dist/esm/components/semantic-tag-chips.js +22 -0
  11. package/dist/esm/components/semantic-tag-chips.js.map +6 -0
  12. package/dist/esm/pages/cluster-commands/clusters/access-control-commands.d.ts.map +1 -1
  13. package/dist/esm/pages/cluster-commands/clusters/access-control-commands.js +3 -2
  14. package/dist/esm/pages/cluster-commands/clusters/access-control-commands.js.map +1 -1
  15. package/dist/esm/pages/cluster-commands/clusters/avsum-commands.d.ts.map +1 -1
  16. package/dist/esm/pages/cluster-commands/clusters/avsum-commands.js +34 -34
  17. package/dist/esm/pages/cluster-commands/clusters/avsum-commands.js.map +1 -1
  18. package/dist/esm/pages/cluster-commands/clusters/basic-information-commands.d.ts.map +1 -1
  19. package/dist/esm/pages/cluster-commands/clusters/basic-information-commands.js +2 -1
  20. package/dist/esm/pages/cluster-commands/clusters/basic-information-commands.js.map +1 -1
  21. package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.d.ts.map +1 -1
  22. package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.js +16 -4
  23. package/dist/esm/pages/cluster-commands/clusters/closure-control-commands.js.map +1 -1
  24. package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.d.ts +41 -0
  25. package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.d.ts.map +1 -0
  26. package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.js +459 -0
  27. package/dist/esm/pages/cluster-commands/clusters/closure-dimension-commands.js.map +6 -0
  28. package/dist/esm/pages/cluster-commands/clusters/commodity-tariff-commands.js +1 -1
  29. package/dist/esm/pages/cluster-commands/clusters/commodity-tariff-commands.js.map +1 -1
  30. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.d.ts +34 -0
  31. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.d.ts.map +1 -0
  32. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.js +324 -0
  33. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-commands.js.map +6 -0
  34. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.d.ts +30 -0
  35. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.d.ts.map +1 -0
  36. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.js +167 -0
  37. package/dist/esm/pages/cluster-commands/clusters/device-energy-management-mode-commands.js.map +6 -0
  38. package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.d.ts +56 -0
  39. package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.d.ts.map +1 -0
  40. package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.js +1919 -0
  41. package/dist/esm/pages/cluster-commands/clusters/door-lock-commands.js.map +6 -0
  42. package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.d.ts +58 -0
  43. package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.d.ts.map +1 -0
  44. package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.js +886 -0
  45. package/dist/esm/pages/cluster-commands/clusters/energy-evse-commands.js.map +6 -0
  46. package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.d.ts.map +1 -1
  47. package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.js +2 -1
  48. package/dist/esm/pages/cluster-commands/clusters/icd-management-commands.js.map +1 -1
  49. package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.d.ts +25 -0
  50. package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.d.ts.map +1 -0
  51. package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.js +135 -0
  52. package/dist/esm/pages/cluster-commands/clusters/ikea-valve-calibration-commands.js.map +6 -0
  53. package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.d.ts +30 -0
  54. package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.d.ts.map +1 -0
  55. package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.js +266 -0
  56. package/dist/esm/pages/cluster-commands/clusters/media-playback-commands.js.map +6 -0
  57. package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.d.ts +27 -0
  58. package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.d.ts.map +1 -0
  59. package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.js +215 -0
  60. package/dist/esm/pages/cluster-commands/clusters/operational-state-commands.js.map +6 -0
  61. package/dist/esm/pages/cluster-commands/clusters/service-area-commands.d.ts +47 -0
  62. package/dist/esm/pages/cluster-commands/clusters/service-area-commands.d.ts.map +1 -0
  63. package/dist/esm/pages/cluster-commands/clusters/service-area-commands.js +344 -0
  64. package/dist/esm/pages/cluster-commands/clusters/service-area-commands.js.map +6 -0
  65. package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.d.ts +24 -2
  66. package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.d.ts.map +1 -1
  67. package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.js +368 -6
  68. package/dist/esm/pages/cluster-commands/clusters/thermostat-commands.js.map +1 -1
  69. package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.d.ts +29 -0
  70. package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.d.ts.map +1 -0
  71. package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.js +262 -0
  72. package/dist/esm/pages/cluster-commands/clusters/water-heater-management-commands.js.map +6 -0
  73. package/dist/esm/pages/cluster-commands/index.d.ts +10 -0
  74. package/dist/esm/pages/cluster-commands/index.d.ts.map +1 -1
  75. package/dist/esm/pages/cluster-commands/index.js +10 -0
  76. package/dist/esm/pages/cluster-commands/index.js.map +1 -1
  77. package/dist/esm/pages/matter-cluster-view.d.ts.map +1 -1
  78. package/dist/esm/pages/matter-cluster-view.js +6 -24
  79. package/dist/esm/pages/matter-cluster-view.js.map +1 -1
  80. package/dist/esm/pages/matter-endpoint-view.d.ts.map +1 -1
  81. package/dist/esm/pages/matter-endpoint-view.js +20 -2
  82. package/dist/esm/pages/matter-endpoint-view.js.map +1 -1
  83. package/dist/esm/pages/matter-network-view.d.ts +16 -0
  84. package/dist/esm/pages/matter-network-view.d.ts.map +1 -1
  85. package/dist/esm/pages/matter-network-view.js +55 -6
  86. package/dist/esm/pages/matter-network-view.js.map +1 -1
  87. package/dist/esm/pages/matter-node-view.d.ts.map +1 -1
  88. package/dist/esm/pages/matter-node-view.js +33 -4
  89. package/dist/esm/pages/matter-node-view.js.map +1 -1
  90. package/dist/esm/pages/network/border-router-store.d.ts +19 -0
  91. package/dist/esm/pages/network/border-router-store.d.ts.map +1 -1
  92. package/dist/esm/pages/network/border-router-store.js +61 -3
  93. package/dist/esm/pages/network/border-router-store.js.map +1 -1
  94. package/dist/esm/pages/network/network-details.d.ts +0 -3
  95. package/dist/esm/pages/network/network-details.d.ts.map +1 -1
  96. package/dist/esm/pages/network/network-details.js +15 -22
  97. package/dist/esm/pages/network/network-details.js.map +1 -1
  98. package/dist/esm/pages/network/network-utils.d.ts +4 -6
  99. package/dist/esm/pages/network/network-utils.d.ts.map +1 -1
  100. package/dist/esm/pages/network/network-utils.js +19 -13
  101. package/dist/esm/pages/network/network-utils.js.map +1 -1
  102. package/dist/esm/pages/network/thread-graph.d.ts +0 -5
  103. package/dist/esm/pages/network/thread-graph.d.ts.map +1 -1
  104. package/dist/esm/pages/network/thread-graph.js +21 -38
  105. package/dist/esm/pages/network/thread-graph.js.map +1 -1
  106. package/dist/esm/util/closure-control.d.ts +1 -0
  107. package/dist/esm/util/closure-control.d.ts.map +1 -1
  108. package/dist/esm/util/closure-control.js +5 -0
  109. package/dist/esm/util/closure-control.js.map +1 -1
  110. package/dist/esm/util/closure-dimension.d.ts +83 -0
  111. package/dist/esm/util/closure-dimension.d.ts.map +1 -0
  112. package/dist/esm/util/closure-dimension.js +238 -0
  113. package/dist/esm/util/closure-dimension.js.map +6 -0
  114. package/dist/esm/util/commodity-tariff.d.ts +1 -2
  115. package/dist/esm/util/commodity-tariff.d.ts.map +1 -1
  116. package/dist/esm/util/commodity-tariff.js +9 -17
  117. package/dist/esm/util/commodity-tariff.js.map +1 -1
  118. package/dist/esm/util/device-energy-management-mode.d.ts +35 -0
  119. package/dist/esm/util/device-energy-management-mode.d.ts.map +1 -0
  120. package/dist/esm/util/device-energy-management-mode.js +80 -0
  121. package/dist/esm/util/device-energy-management-mode.js.map +6 -0
  122. package/dist/esm/util/device-energy-management.d.ts +90 -0
  123. package/dist/esm/util/device-energy-management.d.ts.map +1 -0
  124. package/dist/esm/util/device-energy-management.js +230 -0
  125. package/dist/esm/util/device-energy-management.js.map +6 -0
  126. package/dist/esm/util/device-icons.d.ts.map +1 -1
  127. package/dist/esm/util/device-icons.js +3 -3
  128. package/dist/esm/util/device-icons.js.map +1 -1
  129. package/dist/esm/util/door-lock.d.ts +249 -0
  130. package/dist/esm/util/door-lock.d.ts.map +1 -0
  131. package/dist/esm/util/door-lock.js +724 -0
  132. package/dist/esm/util/door-lock.js.map +6 -0
  133. package/dist/esm/util/endpoint-label.d.ts +13 -0
  134. package/dist/esm/util/endpoint-label.d.ts.map +1 -0
  135. package/dist/esm/util/endpoint-label.js +41 -0
  136. package/dist/esm/util/endpoint-label.js.map +6 -0
  137. package/dist/esm/util/energy-evse.d.ts +116 -0
  138. package/dist/esm/util/energy-evse.d.ts.map +1 -0
  139. package/dist/esm/util/energy-evse.js +308 -0
  140. package/dist/esm/util/energy-evse.js.map +6 -0
  141. package/dist/esm/util/enum-label.d.ts +24 -0
  142. package/dist/esm/util/enum-label.d.ts.map +1 -0
  143. package/dist/esm/util/enum-label.js +24 -0
  144. package/dist/esm/util/enum-label.js.map +6 -0
  145. package/dist/esm/util/error-text.d.ts +8 -0
  146. package/dist/esm/util/error-text.d.ts.map +1 -0
  147. package/dist/esm/util/error-text.js +12 -0
  148. package/dist/esm/util/error-text.js.map +6 -0
  149. package/dist/esm/util/ikea-valve-calibration.d.ts +21 -0
  150. package/dist/esm/util/ikea-valve-calibration.d.ts.map +1 -0
  151. package/dist/esm/util/ikea-valve-calibration.js +43 -0
  152. package/dist/esm/util/ikea-valve-calibration.js.map +6 -0
  153. package/dist/esm/util/media-playback.d.ts +47 -0
  154. package/dist/esm/util/media-playback.d.ts.map +1 -0
  155. package/dist/esm/util/media-playback.js +119 -0
  156. package/dist/esm/util/media-playback.js.map +6 -0
  157. package/dist/esm/util/operational-state.d.ts +102 -0
  158. package/dist/esm/util/operational-state.d.ts.map +1 -0
  159. package/dist/esm/util/operational-state.js +212 -0
  160. package/dist/esm/util/operational-state.js.map +6 -0
  161. package/dist/esm/util/semantic-tags.d.ts +3 -0
  162. package/dist/esm/util/semantic-tags.d.ts.map +1 -1
  163. package/dist/esm/util/semantic-tags.js +5 -1
  164. package/dist/esm/util/semantic-tags.js.map +1 -1
  165. package/dist/esm/util/service-area.d.ts +88 -0
  166. package/dist/esm/util/service-area.d.ts.map +1 -0
  167. package/dist/esm/util/service-area.js +185 -0
  168. package/dist/esm/util/service-area.js.map +6 -0
  169. package/dist/esm/util/shared-styles.d.ts +1 -0
  170. package/dist/esm/util/shared-styles.d.ts.map +1 -1
  171. package/dist/esm/util/shared-styles.js +37 -17
  172. package/dist/esm/util/shared-styles.js.map +1 -1
  173. package/dist/esm/util/thermostat-schedule.d.ts +10 -4
  174. package/dist/esm/util/thermostat-schedule.d.ts.map +1 -1
  175. package/dist/esm/util/thermostat-schedule.js +34 -10
  176. package/dist/esm/util/thermostat-schedule.js.map +1 -1
  177. package/dist/esm/util/thermostat-suggestions.d.ts +31 -0
  178. package/dist/esm/util/thermostat-suggestions.d.ts.map +1 -0
  179. package/dist/esm/util/thermostat-suggestions.js +74 -0
  180. package/dist/esm/util/thermostat-suggestions.js.map +6 -0
  181. package/dist/esm/util/time.d.ts +24 -0
  182. package/dist/esm/util/time.d.ts.map +1 -0
  183. package/dist/esm/util/time.js +42 -0
  184. package/dist/esm/util/time.js.map +6 -0
  185. package/dist/esm/util/water-heater-management.d.ts +56 -0
  186. package/dist/esm/util/water-heater-management.d.ts.map +1 -0
  187. package/dist/esm/util/water-heater-management.js +147 -0
  188. package/dist/esm/util/water-heater-management.js.map +6 -0
  189. package/dist/web/index.html +4 -0
  190. package/dist/web/js/{attribute-write-dialog-Dj2vnLR_.js → attribute-write-dialog-DrJZQaXy.js} +1 -1
  191. package/dist/web/js/{command-invoke-dialog-DJY2HePu.js → command-invoke-dialog-D_zf390T.js} +1 -1
  192. package/dist/web/js/{commission-node-dialog-BAzJcdYg.js → commission-node-dialog-DIBv_ihK.js} +5 -5
  193. package/dist/web/js/{commission-node-existing-DDtYs7R-.js → commission-node-existing-ApIugQzz.js} +1 -1
  194. package/dist/web/js/{commission-node-thread-Bf0XhUqn.js → commission-node-thread-DdEySLrf.js} +1 -1
  195. package/dist/web/js/{commission-node-wifi-DL4q7kzh.js → commission-node-wifi-BIhsmTCV.js} +1 -1
  196. package/dist/web/js/{dialog-box-BquhCceT.js → dialog-box-Df4y4onO.js} +1 -1
  197. package/dist/web/js/{fabric-label-dialog-iLm9DGea.js → fabric-label-dialog-BFs_iHTp.js} +1 -1
  198. package/dist/web/js/main.js +61 -28
  199. package/dist/web/js/{matter-dashboard-app-RcyNZLl_.js → matter-dashboard-app-DfcntGqC.js} +17911 -10233
  200. package/dist/web/js/{node-acl-add-dialog-CyWYXa6M.js → node-acl-add-dialog-DPG7FkNs.js} +1 -1
  201. package/dist/web/js/{node-binding-dialog-BjQ0KYzx.js → node-binding-dialog-CvQuClGz.js} +1 -1
  202. package/dist/web/js/{node-label-dialog-BNUn3Joo.js → node-label-dialog-DNEWL6Ku.js} +1 -1
  203. package/dist/web/js/{settings-dialog-DvAq6gKo.js → settings-dialog-BvAdX2Jo.js} +1 -1
  204. package/package.json +7 -7
  205. package/src/client/models/descriptions.ts +479 -28
  206. package/src/components/avsum-ptz-strip.ts +10 -9
  207. package/src/components/semantic-tag-chips.ts +30 -0
  208. package/src/pages/cluster-commands/AGENTS.md +1 -0
  209. package/src/pages/cluster-commands/clusters/access-control-commands.ts +3 -2
  210. package/src/pages/cluster-commands/clusters/avsum-commands.ts +44 -42
  211. package/src/pages/cluster-commands/clusters/basic-information-commands.ts +2 -1
  212. package/src/pages/cluster-commands/clusters/closure-control-commands.ts +16 -4
  213. package/src/pages/cluster-commands/clusters/closure-dimension-commands.ts +512 -0
  214. package/src/pages/cluster-commands/clusters/commodity-tariff-commands.ts +1 -1
  215. package/src/pages/cluster-commands/clusters/device-energy-management-commands.ts +426 -0
  216. package/src/pages/cluster-commands/clusters/device-energy-management-mode-commands.ts +172 -0
  217. package/src/pages/cluster-commands/clusters/door-lock-commands.ts +2120 -0
  218. package/src/pages/cluster-commands/clusters/energy-evse-commands.ts +1048 -0
  219. package/src/pages/cluster-commands/clusters/icd-management-commands.ts +2 -1
  220. package/src/pages/cluster-commands/clusters/ikea-valve-calibration-commands.ts +129 -0
  221. package/src/pages/cluster-commands/clusters/media-playback-commands.ts +313 -0
  222. package/src/pages/cluster-commands/clusters/operational-state-commands.ts +234 -0
  223. package/src/pages/cluster-commands/clusters/service-area-commands.ts +395 -0
  224. package/src/pages/cluster-commands/clusters/thermostat-commands.ts +418 -7
  225. package/src/pages/cluster-commands/clusters/water-heater-management-commands.ts +275 -0
  226. package/src/pages/cluster-commands/index.ts +10 -0
  227. package/src/pages/matter-cluster-view.ts +6 -28
  228. package/src/pages/matter-endpoint-view.ts +24 -2
  229. package/src/pages/matter-network-view.ts +67 -6
  230. package/src/pages/matter-node-view.ts +35 -4
  231. package/src/pages/network/border-router-store.ts +77 -2
  232. package/src/pages/network/network-details.ts +15 -26
  233. package/src/pages/network/network-utils.ts +15 -15
  234. package/src/pages/network/thread-graph.ts +32 -48
  235. package/src/util/closure-control.ts +5 -0
  236. package/src/util/closure-dimension.ts +307 -0
  237. package/src/util/commodity-tariff.ts +9 -23
  238. package/src/util/device-energy-management-mode.ts +132 -0
  239. package/src/util/device-energy-management.ts +378 -0
  240. package/src/util/device-icons.ts +4 -6
  241. package/src/util/door-lock.ts +1076 -0
  242. package/src/util/endpoint-label.ts +70 -0
  243. package/src/util/energy-evse.ts +472 -0
  244. package/src/util/enum-label.ts +39 -0
  245. package/src/util/error-text.ts +10 -0
  246. package/src/util/ikea-valve-calibration.ts +54 -0
  247. package/src/util/media-playback.ts +132 -0
  248. package/src/util/operational-state.ts +251 -0
  249. package/src/util/semantic-tags.ts +6 -0
  250. package/src/util/service-area.ts +313 -0
  251. package/src/util/shared-styles.ts +37 -17
  252. package/src/util/thermostat-schedule.ts +39 -11
  253. package/src/util/thermostat-suggestions.ts +93 -0
  254. package/src/util/time.ts +54 -0
  255. package/src/util/water-heater-management.ts +217 -0
@@ -0,0 +1,1919 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __typeError = (msg) => {
4
+ throw TypeError(msg);
5
+ };
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11
+ if (kind && result) __defProp(target, key, result);
12
+ return result;
13
+ };
14
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
15
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
16
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
17
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
18
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
19
+ var __privateWrapper = (obj, member, setter, getter) => ({
20
+ set _(value) {
21
+ __privateSet(obj, member, value, setter);
22
+ },
23
+ get _() {
24
+ return __privateGet(obj, member, getter);
25
+ }
26
+ });
27
+ /**
28
+ * @license
29
+ * Copyright 2025-2026 Open Home Foundation
30
+ * SPDX-License-Identifier: Apache-2.0
31
+ */
32
+ var _context, _usersRequested, _holidayRequested, _usersGeneration, _schedulesGeneration, _holidayGeneration, _busyGeneration, _freeIndexCapacity, _expiringTimeoutDirty, _expiringTimeoutAwaitingReport, _DoorLockClusterCommands_instances, scheduleCapacityReady_fn, schedulesSupported_fn, holidaySupported_fn, userManagementSupported_fn, expiringUserSupported_fn, isCurrent_fn, loadUsers_fn, loadSchedules_fn, loadHolidaySchedules_fn, selectUser_fn, reloadSchedules_fn, runScheduleCommand_fn, runHolidayCommand_fn, reportFailure_fn, pinForCommand_fn, pinFieldSupported_fn, missingRequiredPin_fn, operateLock_fn, unlockWithTimeout_fn, saveExpiringTimeout_fn, saveEditor_fn, clearWeekDay_fn, clearYearDay_fn, confirmClearAll_fn, clearHoliday_fn, confirmClearAllHoliday_fn, startAddUser_fn, cancelAddUser_fn, saveNewUser_fn, removeSelectedUser_fn, renderLockPanel_fn, renderSchedulePanel_fn, renderUserSelector_fn, renderExpiringTimeoutRow_fn, renderAddUserEditor_fn, renderUserBadges_fn, visibleSlots_fn, renderEmptySlotsToggle_fn, renderWeekDaySection_fn, renderWeekTimeline_fn, renderWeekDaySlot_fn, renderWeekDayEditor_fn, renderYearDaySection_fn, renderYearDaySlot_fn, renderYearDayEditor_fn, renderHolidaySection_fn, renderHolidaySlot_fn, renderHolidayEditor_fn, renderEditorActions_fn, slotCountLabel_fn, renderSlotsPlaceholder_fn;
33
+ import "@material/web/button/filled-button";
34
+ import "@material/web/button/outlined-button";
35
+ import "@material/web/iconbutton/outlined-icon-button";
36
+ import "@material/web/progress/circular-progress";
37
+ import {
38
+ mdiAccountPlusOutline,
39
+ mdiAccountRemoveOutline,
40
+ mdiCalendarRange,
41
+ mdiCalendarWeek,
42
+ mdiClose,
43
+ mdiContentSaveOutline,
44
+ mdiLock,
45
+ mdiLockOpenVariant,
46
+ mdiPencilOutline,
47
+ mdiPlus,
48
+ mdiRefresh,
49
+ mdiTrashCanOutline
50
+ } from "@mdi/js";
51
+ import { css, html, nothing } from "lit";
52
+ import { customElement, state } from "lit/decorators.js";
53
+ import { live } from "lit/directives/live.js";
54
+ import { showAlertDialog, showPromptDialog } from "../../../components/dialog-box/show-dialog-box.js";
55
+ import "../../../components/ha-svg-icon.js";
56
+ import { handleAsync } from "../../../util/async-handler.js";
57
+ import {
58
+ addUser,
59
+ createExpiringPinUser,
60
+ buildDaySegments,
61
+ clearHolidaySchedule,
62
+ clearWeekDaySchedule,
63
+ clearYearDaySchedule,
64
+ DAY_BITS,
65
+ DAY_LABELS,
66
+ DOOR_LOCK_CLUSTER_ID,
67
+ formatDaysMask,
68
+ formatDoorState,
69
+ formatExpiringTimeoutHint,
70
+ formatScheduleStatus,
71
+ formatLockState,
72
+ formatLockType,
73
+ formatOperatingMode,
74
+ formatWallClock,
75
+ defaultHolidayMode,
76
+ hasPinCredential,
77
+ holidayModeChoices,
78
+ formatTimeOfDay,
79
+ formatUserLabel,
80
+ formatUserStatus,
81
+ formatUserType,
82
+ fromDateTimeInputValue,
83
+ holidayScheduleRangeError,
84
+ isEmptyScheduleStatus,
85
+ isFeatureActive,
86
+ lockDoor,
87
+ maskHasDay,
88
+ nextFreeUserIndex,
89
+ nowAsWallClock,
90
+ parseTimeOfDay,
91
+ pinCodeLengthError,
92
+ readActuatorEnabled,
93
+ readDoorState,
94
+ readExpiringUserTimeout,
95
+ readHolidaySchedule,
96
+ readHolidaySchedulesSupported,
97
+ readLockState,
98
+ readLockType,
99
+ readMaxPinCodeLength,
100
+ readMinPinCodeLength,
101
+ readNumberOfPinUsersSupported,
102
+ readTotalUsersSupported,
103
+ readUser,
104
+ readUsers,
105
+ removeUser,
106
+ readWeekDaySchedule,
107
+ readWeekDaySchedulesPerUser,
108
+ readYearDaySchedule,
109
+ readYearDaySchedulesPerUser,
110
+ requiresPinForRemoteOperation,
111
+ SCHEDULE_INDEX_ALL,
112
+ supportedOperatingModes,
113
+ supportsCommand,
114
+ toDateTimeInputValue,
115
+ toggleMaskDay,
116
+ UNLOCK_WITH_TIMEOUT_COMMAND_ID,
117
+ unlockDoor,
118
+ unlockWithTimeout,
119
+ userNameLengthError,
120
+ USER_NAME_MAX_LENGTH,
121
+ USER_TYPE_EXPIRING,
122
+ weekDayScheduleRangeError,
123
+ writeExpiringUserTimeout,
124
+ writeHolidaySchedule,
125
+ writeWeekDaySchedule,
126
+ writeYearDaySchedule,
127
+ yearDayScheduleRangeError
128
+ } from "../../../util/door-lock.js";
129
+ import { errorText } from "../../../util/error-text.js";
130
+ import { BaseClusterCommands } from "../base-cluster-commands.js";
131
+ import { registerClusterCommands } from "../registry.js";
132
+ const HOUR_TICKS = [0, 6, 12, 18, 24];
133
+ const DEFAULT_UNLOCK_TIMEOUT_SECONDS = 60;
134
+ const DEFAULT_START_TIME = "08:00";
135
+ const DEFAULT_END_TIME = "18:00";
136
+ const DATE_TIME_MIN = "2000-01-01T00:00:00";
137
+ const DATE_TIME_MAX = "2136-02-07T06:28:15";
138
+ const USER_SCAN_FALLBACK = 32;
139
+ const EXPIRING_USER_TIMEOUT_MAX_MINUTES = 2880;
140
+ const USER_TYPE_STANDARD = 0;
141
+ let DoorLockClusterCommands = class extends BaseClusterCommands {
142
+ constructor() {
143
+ super(...arguments);
144
+ __privateAdd(this, _DoorLockClusterCommands_instances);
145
+ this._selectedUserIndex = null;
146
+ this._loadingUsers = false;
147
+ this._loadingSchedules = false;
148
+ this._loadingHoliday = false;
149
+ this._freeUserIndex = null;
150
+ this._editor = null;
151
+ this._addingUser = false;
152
+ this._newUserName = "";
153
+ this._newUserType = USER_TYPE_STANDARD;
154
+ this._newUserPin = "";
155
+ this._expiringTimeoutInput = "";
156
+ this._showEmptyWeekDay = false;
157
+ this._showEmptyYearDay = false;
158
+ this._showEmptyHoliday = false;
159
+ this._busy = false;
160
+ this._pinCode = "";
161
+ this._unlockTimeout = String(DEFAULT_UNLOCK_TIMEOUT_SECONDS);
162
+ __privateAdd(this, _context);
163
+ __privateAdd(this, _usersRequested, false);
164
+ __privateAdd(this, _holidayRequested, false);
165
+ /**
166
+ * One counter per loader, bumped by that loader when it starts and by a context change. A single
167
+ * shared counter would let an unrelated bump — picking a user, saving a schedule — strand a loader
168
+ * that had already returned as stale, leaving its spinner and disabled buttons up for good.
169
+ */
170
+ __privateAdd(this, _usersGeneration, 0);
171
+ __privateAdd(this, _schedulesGeneration, 0);
172
+ __privateAdd(this, _holidayGeneration, 0);
173
+ /**
174
+ * Bumped only on a node/endpoint context change: a lock/unlock or schedule command run against the
175
+ * old context must not clear `_busy` for a new one.
176
+ */
177
+ __privateAdd(this, _busyGeneration, 0);
178
+ __privateAdd(this, _freeIndexCapacity, null);
179
+ /** Set once the operator edits the expiry field, so a device report cannot overwrite what they typed. */
180
+ __privateAdd(this, _expiringTimeoutDirty, false);
181
+ /** The value last written, still awaiting the report that confirms the lock took it. */
182
+ __privateAdd(this, _expiringTimeoutAwaitingReport, null);
183
+ }
184
+ willUpdate(changedProperties) {
185
+ super.willUpdate(changedProperties);
186
+ if (!this.client || !this.node || this.cluster !== DOOR_LOCK_CLUSTER_ID) return;
187
+ const context = `${String(this.node.node_id)}/${this.endpoint}`;
188
+ if (__privateGet(this, _context) !== context) {
189
+ __privateSet(this, _context, context);
190
+ __privateWrapper(this, _usersGeneration)._++;
191
+ __privateWrapper(this, _schedulesGeneration)._++;
192
+ __privateWrapper(this, _holidayGeneration)._++;
193
+ __privateWrapper(this, _busyGeneration)._++;
194
+ __privateSet(this, _usersRequested, false);
195
+ __privateSet(this, _holidayRequested, false);
196
+ this._users = void 0;
197
+ this._selectedUserIndex = null;
198
+ this._weekDaySlots = void 0;
199
+ this._yearDaySlots = void 0;
200
+ this._holidaySlots = void 0;
201
+ this._loadingUsers = false;
202
+ this._loadingSchedules = false;
203
+ this._loadingHoliday = false;
204
+ this._userLoadError = void 0;
205
+ this._scheduleLoadError = void 0;
206
+ this._holidayLoadError = void 0;
207
+ this._freeUserIndex = null;
208
+ __privateSet(this, _freeIndexCapacity, null);
209
+ this._editor = null;
210
+ this._editorError = void 0;
211
+ this._addingUser = false;
212
+ this._newUserName = "";
213
+ this._newUserType = USER_TYPE_STANDARD;
214
+ this._newUserPin = "";
215
+ this._userEditorError = void 0;
216
+ this._expiringTimeoutInput = "";
217
+ __privateSet(this, _expiringTimeoutDirty, false);
218
+ __privateSet(this, _expiringTimeoutAwaitingReport, null);
219
+ this._showEmptyWeekDay = false;
220
+ this._showEmptyYearDay = false;
221
+ this._showEmptyHoliday = false;
222
+ this._busy = false;
223
+ this._pinCode = "";
224
+ this._unlockTimeout = String(DEFAULT_UNLOCK_TIMEOUT_SECONDS);
225
+ }
226
+ const userCapacity = readTotalUsersSupported(this.node, this.endpoint);
227
+ if (this._users !== void 0 && userCapacity !== __privateGet(this, _freeIndexCapacity)) {
228
+ __privateSet(this, _freeIndexCapacity, userCapacity);
229
+ this._freeUserIndex = nextFreeUserIndex(this._users, userCapacity ?? USER_SCAN_FALLBACK);
230
+ }
231
+ const expiringTimeout = readExpiringUserTimeout(this.node, this.endpoint);
232
+ if (__privateGet(this, _expiringTimeoutAwaitingReport) !== null && expiringTimeout === __privateGet(this, _expiringTimeoutAwaitingReport)) {
233
+ __privateSet(this, _expiringTimeoutAwaitingReport, null);
234
+ __privateSet(this, _expiringTimeoutDirty, false);
235
+ }
236
+ if (!__privateGet(this, _expiringTimeoutDirty) && expiringTimeout !== null) {
237
+ this._expiringTimeoutInput = String(expiringTimeout);
238
+ }
239
+ if (!__privateGet(this, _usersRequested) && __privateMethod(this, _DoorLockClusterCommands_instances, userManagementSupported_fn).call(this) && __privateMethod(this, _DoorLockClusterCommands_instances, scheduleCapacityReady_fn).call(this)) {
240
+ __privateSet(this, _usersRequested, true);
241
+ handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, loadUsers_fn).call(this))();
242
+ }
243
+ if (!__privateGet(this, _holidayRequested) && __privateMethod(this, _DoorLockClusterCommands_instances, holidaySupported_fn).call(this) && readHolidaySchedulesSupported(this.node, this.endpoint) !== null) {
244
+ __privateSet(this, _holidayRequested, true);
245
+ handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, loadHolidaySchedules_fn).call(this))();
246
+ }
247
+ }
248
+ render() {
249
+ if (!this.node || this.cluster !== DOOR_LOCK_CLUSTER_ID) return nothing;
250
+ const showUsersPanel = __privateMethod(this, _DoorLockClusterCommands_instances, schedulesSupported_fn).call(this) || __privateMethod(this, _DoorLockClusterCommands_instances, userManagementSupported_fn).call(this);
251
+ return html`${__privateMethod(this, _DoorLockClusterCommands_instances, renderLockPanel_fn).call(this)}${showUsersPanel ? __privateMethod(this, _DoorLockClusterCommands_instances, renderSchedulePanel_fn).call(this) : nothing}`;
252
+ }
253
+ };
254
+ _context = new WeakMap();
255
+ _usersRequested = new WeakMap();
256
+ _holidayRequested = new WeakMap();
257
+ _usersGeneration = new WeakMap();
258
+ _schedulesGeneration = new WeakMap();
259
+ _holidayGeneration = new WeakMap();
260
+ _busyGeneration = new WeakMap();
261
+ _freeIndexCapacity = new WeakMap();
262
+ _expiringTimeoutDirty = new WeakMap();
263
+ _expiringTimeoutAwaitingReport = new WeakMap();
264
+ _DoorLockClusterCommands_instances = new WeakSet();
265
+ /**
266
+ * Whether the schedule-capacity attributes #loadSchedules depends on are cached yet.
267
+ *
268
+ * NumberOfTotalUsersSupported is deliberately not checked here: #loadUsers already has a graceful
269
+ * fallback for it (USER_SCAN_FALLBACK), for a lock that never reports it at all — readUsers's walk
270
+ * terminates on NextUserIndex regardless, so an oversized scan bound just costs a few harmless extra
271
+ * round trips. WDSCH/YDSCH capacity has no such fallback: reading it as absent silently substitutes 0
272
+ * slots, hiding a section's content entirely, so those are worth waiting for.
273
+ */
274
+ scheduleCapacityReady_fn = function() {
275
+ if (isFeatureActive(this.node, this.endpoint, "WDSCH") && readWeekDaySchedulesPerUser(this.node, this.endpoint) === null) {
276
+ return false;
277
+ }
278
+ if (isFeatureActive(this.node, this.endpoint, "YDSCH") && readYearDaySchedulesPerUser(this.node, this.endpoint) === null) {
279
+ return false;
280
+ }
281
+ return true;
282
+ };
283
+ schedulesSupported_fn = function() {
284
+ return isFeatureActive(this.node, this.endpoint, "WDSCH") || isFeatureActive(this.node, this.endpoint, "YDSCH") || __privateMethod(this, _DoorLockClusterCommands_instances, holidaySupported_fn).call(this);
285
+ };
286
+ holidaySupported_fn = function() {
287
+ return isFeatureActive(this.node, this.endpoint, "HDSCH");
288
+ };
289
+ /** Whether the lock exposes a user database at all — independent of whether it also supports schedules. */
290
+ userManagementSupported_fn = function() {
291
+ return isFeatureActive(this.node, this.endpoint, "USR");
292
+ };
293
+ /**
294
+ * Whether the "Temporary PIN" user type can be offered. PIN implies USR, but neither guarantees
295
+ * ExpiringUser support: UserTypeEnum's Expiring value and ExpiringUserTimeout are both optional under
296
+ * USR, so the attribute's presence is the only reliable signal a lock actually accepts it.
297
+ */
298
+ expiringUserSupported_fn = function() {
299
+ return isFeatureActive(this.node, this.endpoint, "PIN") && __privateMethod(this, _DoorLockClusterCommands_instances, userManagementSupported_fn).call(this) && readExpiringUserTimeout(this.node, this.endpoint) !== null;
300
+ };
301
+ /** Whether a load started for `node`/`endpoint` at `generation` still owns its loader's counter. */
302
+ isCurrent_fn = function(node, endpoint, generation, current) {
303
+ return this.isSameContext(node, endpoint) && generation === current;
304
+ };
305
+ loadUsers_fn = async function() {
306
+ const node = this.node;
307
+ const endpoint = this.endpoint;
308
+ const generation = ++__privateWrapper(this, _usersGeneration)._;
309
+ const previousSelection = this._selectedUserIndex;
310
+ this._loadingUsers = true;
311
+ this._userLoadError = void 0;
312
+ try {
313
+ const capacity = readTotalUsersSupported(node, endpoint);
314
+ const maxUsers = capacity ?? USER_SCAN_FALLBACK;
315
+ const users = await readUsers(this.client, node.node_id, endpoint, maxUsers);
316
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _usersGeneration))) return;
317
+ this._users = users;
318
+ __privateSet(this, _freeIndexCapacity, capacity);
319
+ this._freeUserIndex = nextFreeUserIndex(users, maxUsers);
320
+ const selected = users.some((user) => user.userIndex === previousSelection) ? previousSelection : users[0]?.userIndex ?? null;
321
+ this._selectedUserIndex = selected;
322
+ if (selected !== null) {
323
+ await __privateMethod(this, _DoorLockClusterCommands_instances, loadSchedules_fn).call(this, node, endpoint, selected);
324
+ }
325
+ } catch (error) {
326
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _usersGeneration))) return;
327
+ this._userLoadError = errorText(error);
328
+ } finally {
329
+ if (__privateGet(this, _usersGeneration) === generation) this._loadingUsers = false;
330
+ }
331
+ };
332
+ loadSchedules_fn = async function(node, endpoint, userIndex) {
333
+ const generation = ++__privateWrapper(this, _schedulesGeneration)._;
334
+ this._loadingSchedules = true;
335
+ this._scheduleLoadError = void 0;
336
+ try {
337
+ const weekDayCount = isFeatureActive(node, endpoint, "WDSCH") ? readWeekDaySchedulesPerUser(node, endpoint) ?? 0 : 0;
338
+ const yearDayCount = isFeatureActive(node, endpoint, "YDSCH") ? readYearDaySchedulesPerUser(node, endpoint) ?? 0 : 0;
339
+ this._weekDaySlots = [];
340
+ this._yearDaySlots = [];
341
+ const weekDaySlots = new Array();
342
+ for (let index = 1; index <= weekDayCount; index++) {
343
+ const slot = await readWeekDaySchedule(this.client, node.node_id, endpoint, index, userIndex);
344
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _schedulesGeneration))) return;
345
+ weekDaySlots.push(slot);
346
+ this._weekDaySlots = [...weekDaySlots];
347
+ }
348
+ const yearDaySlots = new Array();
349
+ for (let index = 1; index <= yearDayCount; index++) {
350
+ const slot = await readYearDaySchedule(this.client, node.node_id, endpoint, index, userIndex);
351
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _schedulesGeneration))) return;
352
+ yearDaySlots.push(slot);
353
+ this._yearDaySlots = [...yearDaySlots];
354
+ }
355
+ const user = await readUser(this.client, node.node_id, endpoint, userIndex);
356
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _schedulesGeneration)) || user === null) return;
357
+ this._users = this._users?.map((candidate) => candidate.userIndex === userIndex ? user : candidate);
358
+ } catch (error) {
359
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _schedulesGeneration))) return;
360
+ this._scheduleLoadError = errorText(error);
361
+ } finally {
362
+ if (__privateGet(this, _schedulesGeneration) === generation) this._loadingSchedules = false;
363
+ }
364
+ };
365
+ loadHolidaySchedules_fn = async function() {
366
+ const node = this.node;
367
+ const endpoint = this.endpoint;
368
+ const generation = ++__privateWrapper(this, _holidayGeneration)._;
369
+ this._loadingHoliday = true;
370
+ this._holidayLoadError = void 0;
371
+ try {
372
+ const capacity = readHolidaySchedulesSupported(node, endpoint) ?? 0;
373
+ const slots = new Array();
374
+ this._holidaySlots = [];
375
+ for (let index = 1; index <= capacity; index++) {
376
+ const slot = await readHolidaySchedule(this.client, node.node_id, endpoint, index);
377
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _holidayGeneration))) return;
378
+ slots.push(slot);
379
+ this._holidaySlots = [...slots];
380
+ }
381
+ } catch (error) {
382
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, isCurrent_fn).call(this, node, endpoint, generation, __privateGet(this, _holidayGeneration))) return;
383
+ this._holidayLoadError = errorText(error);
384
+ } finally {
385
+ if (__privateGet(this, _holidayGeneration) === generation) this._loadingHoliday = false;
386
+ }
387
+ };
388
+ selectUser_fn = function(userIndex) {
389
+ if (userIndex === this._selectedUserIndex) return;
390
+ this._selectedUserIndex = userIndex;
391
+ this._weekDaySlots = void 0;
392
+ this._yearDaySlots = void 0;
393
+ this._showEmptyWeekDay = false;
394
+ this._showEmptyYearDay = false;
395
+ this._editor = null;
396
+ this._editorError = void 0;
397
+ this._scheduleLoadError = void 0;
398
+ handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, loadSchedules_fn).call(this, this.node, this.endpoint, userIndex))();
399
+ };
400
+ reloadSchedules_fn = function() {
401
+ const userIndex = this._selectedUserIndex;
402
+ if (userIndex === null) return;
403
+ handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, loadSchedules_fn).call(this, this.node, this.endpoint, userIndex))();
404
+ };
405
+ runScheduleCommand_fn = async function(title, run) {
406
+ const node = this.node;
407
+ const endpoint = this.endpoint;
408
+ const userIndex = this._selectedUserIndex;
409
+ if (this._busy) return;
410
+ const busyGeneration = __privateGet(this, _busyGeneration);
411
+ this._busy = true;
412
+ try {
413
+ await run(node, endpoint);
414
+ if (!this.isSameContext(node, endpoint) || this._selectedUserIndex !== userIndex) return;
415
+ this._editor = null;
416
+ this._editorError = void 0;
417
+ __privateMethod(this, _DoorLockClusterCommands_instances, reloadSchedules_fn).call(this);
418
+ } catch (error) {
419
+ __privateMethod(this, _DoorLockClusterCommands_instances, reportFailure_fn).call(this, title, error, node, endpoint);
420
+ } finally {
421
+ if (__privateGet(this, _busyGeneration) === busyGeneration) this._busy = false;
422
+ }
423
+ };
424
+ runHolidayCommand_fn = async function(title, run) {
425
+ const node = this.node;
426
+ const endpoint = this.endpoint;
427
+ if (this._busy) return;
428
+ const busyGeneration = __privateGet(this, _busyGeneration);
429
+ this._busy = true;
430
+ try {
431
+ await run(node, endpoint);
432
+ if (!this.isSameContext(node, endpoint)) return;
433
+ this._editor = null;
434
+ this._editorError = void 0;
435
+ await __privateMethod(this, _DoorLockClusterCommands_instances, loadHolidaySchedules_fn).call(this);
436
+ } catch (error) {
437
+ __privateMethod(this, _DoorLockClusterCommands_instances, reportFailure_fn).call(this, title, error, node, endpoint);
438
+ } finally {
439
+ if (__privateGet(this, _busyGeneration) === busyGeneration) this._busy = false;
440
+ }
441
+ };
442
+ /** Only alerts while the panel still shows the node the command was sent to; the dialog names no device. */
443
+ reportFailure_fn = function(title, error, node, endpoint) {
444
+ if (!this.isSameContext(node, endpoint)) {
445
+ console.error(`${title} (panel moved on)`, error);
446
+ return;
447
+ }
448
+ showAlertDialog({ title, text: errorText(error) }).catch(
449
+ (alertError) => console.error(`Failed to show the "${title}" dialog`, alertError)
450
+ );
451
+ };
452
+ pinForCommand_fn = function() {
453
+ const pin = this._pinCode.trim();
454
+ return pin === "" ? void 0 : pin;
455
+ };
456
+ /**
457
+ * Whether the lock supports a PIN sent in a remote Lock/Unlock/UnlockWithTimeout command at all: COTA
458
+ * gates that (spec §5.2.4.7), independently of whether PinCredential is otherwise supported.
459
+ */
460
+ pinFieldSupported_fn = function() {
461
+ return isFeatureActive(this.node, this.endpoint, "COTA") && isFeatureActive(this.node, this.endpoint, "PIN");
462
+ };
463
+ /**
464
+ * Why the lock will refuse this operation without ever being asked, or undefined when it can proceed.
465
+ * Synchronous so callers can claim `_busy` without an await in between, which would otherwise let a
466
+ * second click through the guard. Only reports a missing PIN where one can actually be entered —
467
+ * #pinFieldSupported() gates the field itself, so this must agree with it.
468
+ */
469
+ missingRequiredPin_fn = function() {
470
+ if (!__privateMethod(this, _DoorLockClusterCommands_instances, pinFieldSupported_fn).call(this)) return void 0;
471
+ if (__privateMethod(this, _DoorLockClusterCommands_instances, pinForCommand_fn).call(this) !== void 0) return void 0;
472
+ if (!requiresPinForRemoteOperation(this.node, this.endpoint)) return void 0;
473
+ return "This lock requires a PIN for remote operations.";
474
+ };
475
+ operateLock_fn = async function(action) {
476
+ const node = this.node;
477
+ const endpoint = this.endpoint;
478
+ const title = action === "lock" ? "Lock failed" : "Unlock failed";
479
+ if (this._busy) return;
480
+ const missingPin = __privateMethod(this, _DoorLockClusterCommands_instances, missingRequiredPin_fn).call(this);
481
+ if (missingPin !== void 0) {
482
+ await showAlertDialog({ title: "PIN required", text: missingPin });
483
+ return;
484
+ }
485
+ const busyGeneration = __privateGet(this, _busyGeneration);
486
+ this._busy = true;
487
+ try {
488
+ const operate = action === "lock" ? lockDoor : unlockDoor;
489
+ await operate(this.client, node.node_id, endpoint, __privateMethod(this, _DoorLockClusterCommands_instances, pinForCommand_fn).call(this));
490
+ } catch (error) {
491
+ __privateMethod(this, _DoorLockClusterCommands_instances, reportFailure_fn).call(this, title, error, node, endpoint);
492
+ } finally {
493
+ if (__privateGet(this, _busyGeneration) === busyGeneration) this._busy = false;
494
+ }
495
+ };
496
+ unlockWithTimeout_fn = async function() {
497
+ const node = this.node;
498
+ const endpoint = this.endpoint;
499
+ if (this._busy) return;
500
+ const timeout = Number(this._unlockTimeout);
501
+ if (!Number.isInteger(timeout) || timeout < 1 || timeout > 65535) {
502
+ await showAlertDialog({ title: "Unlock failed", text: "The timeout must be 1 to 65535 seconds." });
503
+ return;
504
+ }
505
+ const missingPin = __privateMethod(this, _DoorLockClusterCommands_instances, missingRequiredPin_fn).call(this);
506
+ if (missingPin !== void 0) {
507
+ await showAlertDialog({ title: "PIN required", text: missingPin });
508
+ return;
509
+ }
510
+ const busyGeneration = __privateGet(this, _busyGeneration);
511
+ this._busy = true;
512
+ try {
513
+ await unlockWithTimeout(this.client, node.node_id, endpoint, timeout, __privateMethod(this, _DoorLockClusterCommands_instances, pinForCommand_fn).call(this));
514
+ } catch (error) {
515
+ __privateMethod(this, _DoorLockClusterCommands_instances, reportFailure_fn).call(this, "Unlock failed", error, node, endpoint);
516
+ } finally {
517
+ if (__privateGet(this, _busyGeneration) === busyGeneration) this._busy = false;
518
+ }
519
+ };
520
+ saveExpiringTimeout_fn = async function() {
521
+ const node = this.node;
522
+ const endpoint = this.endpoint;
523
+ if (this._busy) return;
524
+ const minutes = Number(this._expiringTimeoutInput);
525
+ if (!Number.isInteger(minutes) || minutes < 1 || minutes > EXPIRING_USER_TIMEOUT_MAX_MINUTES) {
526
+ await showAlertDialog({
527
+ title: "Invalid timeout",
528
+ text: `The timeout must be 1 to ${EXPIRING_USER_TIMEOUT_MAX_MINUTES} minutes.`
529
+ });
530
+ return;
531
+ }
532
+ const busyGeneration = __privateGet(this, _busyGeneration);
533
+ this._busy = true;
534
+ try {
535
+ await writeExpiringUserTimeout(this.client, node.node_id, endpoint, minutes);
536
+ if (this.isSameContext(node, endpoint)) __privateSet(this, _expiringTimeoutAwaitingReport, minutes);
537
+ } catch (error) {
538
+ __privateMethod(this, _DoorLockClusterCommands_instances, reportFailure_fn).call(this, "Set Temporary PIN expiry failed", error, node, endpoint);
539
+ } finally {
540
+ if (__privateGet(this, _busyGeneration) === busyGeneration) this._busy = false;
541
+ }
542
+ };
543
+ saveEditor_fn = function() {
544
+ const editor = this._editor;
545
+ if (editor === null) return;
546
+ if (editor.kind === "holiday") {
547
+ const localStartTime2 = fromDateTimeInputValue(editor.start);
548
+ const localEndTime2 = fromDateTimeInputValue(editor.end);
549
+ if (localStartTime2 === null || localEndTime2 === null) {
550
+ this._editorError = "Enter both a start and an end date.";
551
+ return;
552
+ }
553
+ const schedule2 = {
554
+ holidayIndex: editor.index,
555
+ localStartTime: localStartTime2,
556
+ localEndTime: localEndTime2,
557
+ operatingMode: editor.operatingMode
558
+ };
559
+ const rangeError2 = holidayScheduleRangeError(schedule2);
560
+ if (rangeError2 !== null) {
561
+ this._editorError = rangeError2;
562
+ return;
563
+ }
564
+ handleAsync(
565
+ () => __privateMethod(this, _DoorLockClusterCommands_instances, runHolidayCommand_fn).call(this, "Set holiday schedule failed", (node, endpoint) => writeHolidaySchedule(this.client, node.node_id, endpoint, schedule2))
566
+ )();
567
+ return;
568
+ }
569
+ const userIndex = this._selectedUserIndex;
570
+ if (userIndex === null) return;
571
+ if (editor.kind === "weekDay") {
572
+ const start = parseTimeOfDay(editor.start);
573
+ const end = parseTimeOfDay(editor.end);
574
+ if (start === null || end === null) {
575
+ this._editorError = "Enter both times as HH:MM.";
576
+ return;
577
+ }
578
+ const schedule2 = {
579
+ weekDayIndex: editor.index,
580
+ daysMask: editor.daysMask,
581
+ startHour: start.hour,
582
+ startMinute: start.minute,
583
+ endHour: end.hour,
584
+ endMinute: end.minute
585
+ };
586
+ const rangeError2 = weekDayScheduleRangeError(schedule2);
587
+ if (rangeError2 !== null) {
588
+ this._editorError = rangeError2;
589
+ return;
590
+ }
591
+ handleAsync(
592
+ () => __privateMethod(this, _DoorLockClusterCommands_instances, runScheduleCommand_fn).call(this, "Set week day schedule failed", (node, endpoint) => writeWeekDaySchedule(this.client, node.node_id, endpoint, userIndex, schedule2))
593
+ )();
594
+ return;
595
+ }
596
+ const localStartTime = fromDateTimeInputValue(editor.start);
597
+ const localEndTime = fromDateTimeInputValue(editor.end);
598
+ if (localStartTime === null || localEndTime === null) {
599
+ this._editorError = "Enter both a start and an end date.";
600
+ return;
601
+ }
602
+ const schedule = { yearDayIndex: editor.index, localStartTime, localEndTime };
603
+ const rangeError = yearDayScheduleRangeError(schedule);
604
+ if (rangeError !== null) {
605
+ this._editorError = rangeError;
606
+ return;
607
+ }
608
+ handleAsync(
609
+ () => __privateMethod(this, _DoorLockClusterCommands_instances, runScheduleCommand_fn).call(this, "Set year day schedule failed", (node, endpoint) => writeYearDaySchedule(this.client, node.node_id, endpoint, userIndex, schedule))
610
+ )();
611
+ };
612
+ clearWeekDay_fn = async function(weekDayIndex) {
613
+ const userIndex = this._selectedUserIndex;
614
+ if (userIndex === null) return;
615
+ if (weekDayIndex === SCHEDULE_INDEX_ALL && !await __privateMethod(this, _DoorLockClusterCommands_instances, confirmClearAll_fn).call(this, "week day", userIndex)) return;
616
+ await __privateMethod(this, _DoorLockClusterCommands_instances, runScheduleCommand_fn).call(this, "Clear week day schedule failed", (node, endpoint) => clearWeekDaySchedule(this.client, node.node_id, endpoint, userIndex, weekDayIndex));
617
+ };
618
+ clearYearDay_fn = async function(yearDayIndex) {
619
+ const userIndex = this._selectedUserIndex;
620
+ if (userIndex === null) return;
621
+ if (yearDayIndex === SCHEDULE_INDEX_ALL && !await __privateMethod(this, _DoorLockClusterCommands_instances, confirmClearAll_fn).call(this, "year day", userIndex)) return;
622
+ await __privateMethod(this, _DoorLockClusterCommands_instances, runScheduleCommand_fn).call(this, "Clear year day schedule failed", (node, endpoint) => clearYearDaySchedule(this.client, node.node_id, endpoint, userIndex, yearDayIndex));
623
+ };
624
+ confirmClearAll_fn = async function(kind, userIndex) {
625
+ const node = this.node;
626
+ const endpoint = this.endpoint;
627
+ const user = this._users?.find((candidate) => candidate.userIndex === userIndex);
628
+ const confirmed = await showPromptDialog({
629
+ title: `Clear all ${kind} schedules`,
630
+ text: `Every ${kind} schedule of ${user ? formatUserLabel(user) : "this user"} will be removed from the lock.`,
631
+ confirmText: "Clear all"
632
+ });
633
+ return confirmed && this.isSameContext(node, endpoint) && this._selectedUserIndex === userIndex;
634
+ };
635
+ clearHoliday_fn = async function(holidayIndex) {
636
+ if (holidayIndex === SCHEDULE_INDEX_ALL) {
637
+ const node = this.node;
638
+ const endpoint = this.endpoint;
639
+ if (!await __privateMethod(this, _DoorLockClusterCommands_instances, confirmClearAllHoliday_fn).call(this)) return;
640
+ if (!this.isSameContext(node, endpoint)) return;
641
+ }
642
+ await __privateMethod(this, _DoorLockClusterCommands_instances, runHolidayCommand_fn).call(this, "Clear holiday schedule failed", (node, endpoint) => clearHolidaySchedule(this.client, node.node_id, endpoint, holidayIndex));
643
+ };
644
+ confirmClearAllHoliday_fn = function() {
645
+ return showPromptDialog({
646
+ title: "Clear all holiday schedules",
647
+ text: "Every holiday schedule will be removed from the lock. This applies lock-wide, not to a single user.",
648
+ confirmText: "Clear all"
649
+ });
650
+ };
651
+ startAddUser_fn = function() {
652
+ this._userEditorError = void 0;
653
+ this._newUserName = "";
654
+ this._newUserType = USER_TYPE_STANDARD;
655
+ this._newUserPin = "";
656
+ this._addingUser = true;
657
+ };
658
+ cancelAddUser_fn = function() {
659
+ this._addingUser = false;
660
+ this._userEditorError = void 0;
661
+ };
662
+ saveNewUser_fn = async function() {
663
+ const node = this.node;
664
+ const endpoint = this.endpoint;
665
+ const userName = this._newUserName.trim();
666
+ const nameError = userNameLengthError(userName);
667
+ if (nameError !== null) {
668
+ this._userEditorError = nameError;
669
+ return;
670
+ }
671
+ const expiring = __privateMethod(this, _DoorLockClusterCommands_instances, expiringUserSupported_fn).call(this) && this._newUserType === USER_TYPE_EXPIRING;
672
+ const pin = this._newUserPin.trim();
673
+ if (expiring) {
674
+ const pinError = pinCodeLengthError(
675
+ pin,
676
+ readMinPinCodeLength(node, endpoint),
677
+ readMaxPinCodeLength(node, endpoint)
678
+ );
679
+ if (pinError !== null) {
680
+ this._userEditorError = pinError;
681
+ return;
682
+ }
683
+ if (readNumberOfPinUsersSupported(node, endpoint) === null) {
684
+ this._userEditorError = "The lock hasn't reported its PIN credential capacity yet.";
685
+ return;
686
+ }
687
+ }
688
+ const userIndex = this._freeUserIndex;
689
+ if (userIndex === null) {
690
+ this._userEditorError = "The lock's user database is full.";
691
+ return;
692
+ }
693
+ if (this._busy) return;
694
+ const busyGeneration = __privateGet(this, _busyGeneration);
695
+ this._busy = true;
696
+ try {
697
+ let failure = null;
698
+ if (expiring) {
699
+ const capacity = readNumberOfPinUsersSupported(node, endpoint);
700
+ if (capacity === null) {
701
+ this._userEditorError = "The lock's PIN credential capacity is no longer available.";
702
+ return;
703
+ }
704
+ failure = await createExpiringPinUser(
705
+ this.client,
706
+ node.node_id,
707
+ endpoint,
708
+ userIndex,
709
+ userName,
710
+ pin,
711
+ capacity
712
+ );
713
+ } else {
714
+ await addUser(this.client, node.node_id, endpoint, userIndex, userName);
715
+ }
716
+ if (!this.isSameContext(node, endpoint)) {
717
+ if (failure !== null) console.error("Creating the temporary PIN user failed", failure);
718
+ return;
719
+ }
720
+ if (failure?.outcome === "rolled-back") {
721
+ this._userEditorError = `${failure.reason} The user was removed again; nothing was changed.`;
722
+ return;
723
+ }
724
+ this._addingUser = false;
725
+ this._newUserName = "";
726
+ this._newUserPin = "";
727
+ this._userEditorError = void 0;
728
+ __privateSet(this, _usersRequested, true);
729
+ this._selectedUserIndex = userIndex;
730
+ this._weekDaySlots = void 0;
731
+ this._yearDaySlots = void 0;
732
+ await __privateMethod(this, _DoorLockClusterCommands_instances, loadUsers_fn).call(this);
733
+ if (failure !== null && this.isSameContext(node, endpoint)) {
734
+ showAlertDialog({
735
+ title: "The temporary PIN could not be set",
736
+ text: `${failure.reason} User ${userIndex} ("${userName}") was created on the lock but has no PIN, and removing it again also failed (${failure.rollbackReason}). It cannot open the door \u2014 delete it from the user list and try again.`
737
+ }).catch((alertError) => console.error("Failed to show the PIN failure dialog", alertError));
738
+ }
739
+ } catch (error) {
740
+ if (!this.isSameContext(node, endpoint)) return;
741
+ this._userEditorError = errorText(error);
742
+ } finally {
743
+ if (__privateGet(this, _busyGeneration) === busyGeneration) this._busy = false;
744
+ }
745
+ };
746
+ removeSelectedUser_fn = async function() {
747
+ const userIndex = this._selectedUserIndex;
748
+ if (userIndex === null) return;
749
+ const node = this.node;
750
+ const endpoint = this.endpoint;
751
+ const user = this._users?.find((candidate) => candidate.userIndex === userIndex);
752
+ const confirmed = await showPromptDialog({
753
+ title: "Remove user",
754
+ text: `${user ? formatUserLabel(user) : "This user"} and all of its schedules will be removed from the lock.`,
755
+ confirmText: "Remove"
756
+ });
757
+ if (!confirmed || !this.isSameContext(node, endpoint)) return;
758
+ if (this._busy) return;
759
+ const busyGeneration = __privateGet(this, _busyGeneration);
760
+ this._busy = true;
761
+ try {
762
+ await removeUser(this.client, node.node_id, endpoint, userIndex);
763
+ if (!this.isSameContext(node, endpoint)) return;
764
+ __privateSet(this, _usersRequested, true);
765
+ await __privateMethod(this, _DoorLockClusterCommands_instances, loadUsers_fn).call(this);
766
+ } catch (error) {
767
+ __privateMethod(this, _DoorLockClusterCommands_instances, reportFailure_fn).call(this, "Remove user failed", error, node, endpoint);
768
+ } finally {
769
+ if (__privateGet(this, _busyGeneration) === busyGeneration) this._busy = false;
770
+ }
771
+ };
772
+ renderLockPanel_fn = function() {
773
+ const lockState = readLockState(this.node, this.endpoint);
774
+ const doorState = formatDoorState(readDoorState(this.node, this.endpoint));
775
+ const lockType = formatLockType(readLockType(this.node, this.endpoint));
776
+ const actuatorEnabled = readActuatorEnabled(this.node, this.endpoint);
777
+ const pinRequired = requiresPinForRemoteOperation(this.node, this.endpoint);
778
+ const showPin = __privateMethod(this, _DoorLockClusterCommands_instances, pinFieldSupported_fn).call(this);
779
+ const showTimeout = supportsCommand(this.node, this.endpoint, UNLOCK_WITH_TIMEOUT_COMMAND_ID);
780
+ return html`
781
+ <details class="command-panel" open>
782
+ <summary>
783
+ <ha-svg-icon .path=${lockState === 1 ? mdiLock : mdiLockOpenVariant}></ha-svg-icon>
784
+ Lock Control
785
+ </summary>
786
+ <div class="command-content">
787
+ <div class="status-row">
788
+ <span class="state-chip ${lockState === 1 ? "locked" : lockState === null ? "" : "unlocked"}">
789
+ ${formatLockState(lockState)}
790
+ </span>
791
+ ${doorState !== null ? html`<span class="meta">Door: ${doorState}</span>` : nothing}
792
+ ${lockType !== null ? html`<span class="meta">${lockType}</span>` : nothing}
793
+ ${actuatorEnabled === false ? html`<span class="meta warn">Actuator disabled</span>` : nothing}
794
+ </div>
795
+ <div class="command-row">
796
+ ${showPin ? html`
797
+ <label for="doorLockPin">PIN${pinRequired ? " (required)" : ""}:</label>
798
+ <input
799
+ id="doorLockPin"
800
+ type="password"
801
+ autocomplete="off"
802
+ .value=${live(this._pinCode)}
803
+ @input=${(event) => {
804
+ this._pinCode = event.target.value;
805
+ }}
806
+ />
807
+ ` : nothing}
808
+ <md-filled-button
809
+ ?disabled=${this._busy}
810
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, operateLock_fn).call(this, "lock"))}
811
+ >
812
+ <ha-svg-icon slot="icon" .path=${mdiLock}></ha-svg-icon>
813
+ Lock
814
+ </md-filled-button>
815
+ <md-outlined-button
816
+ ?disabled=${this._busy}
817
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, operateLock_fn).call(this, "unlock"))}
818
+ >
819
+ <ha-svg-icon slot="icon" .path=${mdiLockOpenVariant}></ha-svg-icon>
820
+ Unlock
821
+ </md-outlined-button>
822
+ ${showTimeout ? html`
823
+ <label for="doorLockTimeout">Timeout (s):</label>
824
+ <input
825
+ id="doorLockTimeout"
826
+ type="number"
827
+ min="1"
828
+ max="65535"
829
+ .value=${live(this._unlockTimeout)}
830
+ @input=${(event) => {
831
+ this._unlockTimeout = event.target.value;
832
+ }}
833
+ />
834
+ <md-outlined-button
835
+ ?disabled=${this._busy}
836
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, unlockWithTimeout_fn).call(this))}
837
+ >
838
+ Unlock with timeout
839
+ </md-outlined-button>
840
+ ` : nothing}
841
+ </div>
842
+ </div>
843
+ </details>
844
+ `;
845
+ };
846
+ renderSchedulePanel_fn = function() {
847
+ const weekDayActive = isFeatureActive(this.node, this.endpoint, "WDSCH");
848
+ const yearDayActive = isFeatureActive(this.node, this.endpoint, "YDSCH");
849
+ const holidayActive = __privateMethod(this, _DoorLockClusterCommands_instances, holidaySupported_fn).call(this);
850
+ const userActive = __privateMethod(this, _DoorLockClusterCommands_instances, userManagementSupported_fn).call(this);
851
+ const perUserActive = weekDayActive || yearDayActive;
852
+ const features = [
853
+ userActive && "USR",
854
+ weekDayActive && "WDSCH",
855
+ yearDayActive && "YDSCH",
856
+ holidayActive && "HDSCH"
857
+ ].filter((code) => code !== false);
858
+ return html`
859
+ <details class="command-panel" open>
860
+ <summary>
861
+ <ha-svg-icon .path=${mdiCalendarWeek}></ha-svg-icon>
862
+ Users &amp; Access Schedules
863
+ <span class="feature-map-badge">FeatureMap: ${features.join(" \xB7 ")}</span>
864
+ </summary>
865
+ <div class="command-content">
866
+ ${this._userLoadError !== void 0 ? html`<p class="error">${this._userLoadError}</p>` : nothing}
867
+ ${this._scheduleLoadError !== void 0 ? html`<p class="error">${this._scheduleLoadError}</p>` : nothing}
868
+ ${userActive ? html`
869
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderUserSelector_fn).call(this)}
870
+ ${this._selectedUserIndex === null ? nothing : html`
871
+ ${weekDayActive ? __privateMethod(this, _DoorLockClusterCommands_instances, renderWeekDaySection_fn).call(this) : nothing}
872
+ ${yearDayActive ? __privateMethod(this, _DoorLockClusterCommands_instances, renderYearDaySection_fn).call(this) : nothing}
873
+ `}
874
+ ` : perUserActive ? html`<p class="empty">
875
+ Schedules are assigned per user, which this lock does not expose: it reports no User
876
+ (USR) feature, so its user database cannot be read.
877
+ </p>` : nothing}
878
+ ${holidayActive ? __privateMethod(this, _DoorLockClusterCommands_instances, renderHolidaySection_fn).call(this) : nothing}
879
+ </div>
880
+ </details>
881
+ `;
882
+ };
883
+ renderUserSelector_fn = function() {
884
+ const users = this._users;
885
+ if (this._loadingUsers && users === void 0) {
886
+ return html`<div class="loading">
887
+ <md-circular-progress indeterminate></md-circular-progress>
888
+ Reading the user database…
889
+ </div>`;
890
+ }
891
+ const busy = this._busy || this._loadingUsers || this._loadingSchedules;
892
+ const capacityKnown = readTotalUsersSupported(this.node, this.endpoint) !== null;
893
+ const canAddUser = users !== void 0 && capacityKnown && this._freeUserIndex !== null;
894
+ return html`
895
+ <div class="command-row">
896
+ ${users === void 0 || users.length === 0 ? html`<span class="empty">No users are programmed on this lock.</span>` : html`
897
+ <label for="doorLockUser">User:</label>
898
+ <select
899
+ id="doorLockUser"
900
+ ?disabled=${busy}
901
+ @change=${(event) => __privateMethod(this, _DoorLockClusterCommands_instances, selectUser_fn).call(this, Number(event.target.value))}
902
+ >
903
+ ${users.map(
904
+ (user) => html`
905
+ <option
906
+ value=${user.userIndex}
907
+ .selected=${user.userIndex === this._selectedUserIndex}
908
+ >
909
+ #${user.userIndex} · ${formatUserLabel(user)}
910
+ </option>
911
+ `
912
+ )}
913
+ </select>
914
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderUserBadges_fn).call(this)}
915
+ <md-outlined-icon-button
916
+ title="Remove user"
917
+ aria-label="Remove user"
918
+ ?disabled=${busy || this._selectedUserIndex === null}
919
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, removeSelectedUser_fn).call(this))}
920
+ >
921
+ <ha-svg-icon .path=${mdiAccountRemoveOutline}></ha-svg-icon>
922
+ </md-outlined-icon-button>
923
+ `}
924
+ <md-outlined-button
925
+ ?disabled=${busy}
926
+ @click=${() => {
927
+ __privateSet(this, _usersRequested, true);
928
+ this._editor = null;
929
+ this._editorError = void 0;
930
+ handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, loadUsers_fn).call(this))();
931
+ }}
932
+ >
933
+ <ha-svg-icon slot="icon" .path=${mdiRefresh}></ha-svg-icon>
934
+ Reload
935
+ </md-outlined-button>
936
+ ${canAddUser ? html`<md-outlined-button
937
+ ?disabled=${busy || this._addingUser}
938
+ @click=${() => __privateMethod(this, _DoorLockClusterCommands_instances, startAddUser_fn).call(this)}
939
+ >
940
+ <ha-svg-icon slot="icon" .path=${mdiAccountPlusOutline}></ha-svg-icon>
941
+ Add user
942
+ </md-outlined-button>` : nothing}
943
+ </div>
944
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderExpiringTimeoutRow_fn).call(this)} ${this._addingUser ? __privateMethod(this, _DoorLockClusterCommands_instances, renderAddUserEditor_fn).call(this) : nothing}
945
+ `;
946
+ };
947
+ /** ExpiringUserTimeout is lock-wide, not per-user, so it is edited independently of the Add user form. */
948
+ renderExpiringTimeoutRow_fn = function() {
949
+ if (readExpiringUserTimeout(this.node, this.endpoint) === null) return nothing;
950
+ return html`
951
+ <div class="command-row">
952
+ <label for="expiringTimeout">Temporary PIN expiry (min):</label>
953
+ <input
954
+ id="expiringTimeout"
955
+ type="number"
956
+ min="1"
957
+ max=${EXPIRING_USER_TIMEOUT_MAX_MINUTES}
958
+ .value=${live(this._expiringTimeoutInput)}
959
+ @input=${(event) => {
960
+ this._expiringTimeoutInput = event.target.value;
961
+ __privateSet(this, _expiringTimeoutDirty, true);
962
+ }}
963
+ />
964
+ <md-outlined-button ?disabled=${this._busy} @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, saveExpiringTimeout_fn).call(this))}>
965
+ <ha-svg-icon slot="icon" .path=${mdiContentSaveOutline}></ha-svg-icon>
966
+ Save
967
+ </md-outlined-button>
968
+ </div>
969
+ `;
970
+ };
971
+ renderAddUserEditor_fn = function() {
972
+ const canAddExpiring = __privateMethod(this, _DoorLockClusterCommands_instances, expiringUserSupported_fn).call(this);
973
+ const expiring = canAddExpiring && this._newUserType === USER_TYPE_EXPIRING;
974
+ const minPinLength = readMinPinCodeLength(this.node, this.endpoint);
975
+ const maxPinLength = readMaxPinCodeLength(this.node, this.endpoint);
976
+ return html`
977
+ <div class="editor">
978
+ <div class="editor-row">
979
+ <label for="newUserName">Name:</label>
980
+ <input
981
+ id="newUserName"
982
+ type="text"
983
+ maxlength=${USER_NAME_MAX_LENGTH}
984
+ .value=${live(this._newUserName)}
985
+ @input=${(event) => {
986
+ this._newUserName = event.target.value;
987
+ }}
988
+ />
989
+ ${canAddExpiring ? html`
990
+ <label for="newUserType">Type:</label>
991
+ <select
992
+ id="newUserType"
993
+ @change=${(event) => {
994
+ this._newUserType = Number(event.target.value);
995
+ }}
996
+ >
997
+ <option value=${USER_TYPE_STANDARD} .selected=${!expiring}>Standard</option>
998
+ <option value=${USER_TYPE_EXPIRING} .selected=${expiring}>Temporary PIN</option>
999
+ </select>
1000
+ ` : nothing}
1001
+ <md-outlined-button ?disabled=${this._busy} @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, saveNewUser_fn).call(this))}>
1002
+ <ha-svg-icon slot="icon" .path=${mdiContentSaveOutline}></ha-svg-icon>
1003
+ Save
1004
+ </md-outlined-button>
1005
+ <md-outlined-icon-button title="Cancel" aria-label="Cancel" @click=${() => __privateMethod(this, _DoorLockClusterCommands_instances, cancelAddUser_fn).call(this)}>
1006
+ <ha-svg-icon .path=${mdiClose}></ha-svg-icon>
1007
+ </md-outlined-icon-button>
1008
+ </div>
1009
+ ${expiring ? html`
1010
+ <div class="editor-row">
1011
+ <label for="newUserPin">PIN:</label>
1012
+ <input
1013
+ id="newUserPin"
1014
+ type="password"
1015
+ autocomplete="off"
1016
+ maxlength=${maxPinLength ?? nothing}
1017
+ .value=${live(this._newUserPin)}
1018
+ @input=${(event) => {
1019
+ this._newUserPin = event.target.value;
1020
+ }}
1021
+ />
1022
+ ${minPinLength !== null || maxPinLength !== null ? html`<span class="meta">
1023
+ ${minPinLength ?? 1}–${maxPinLength ?? "?"} bytes
1024
+ </span>` : nothing}
1025
+ </div>
1026
+ ` : nothing}
1027
+ ${this._userEditorError !== void 0 ? html`<p class="error">${this._userEditorError}</p>` : nothing}
1028
+ </div>
1029
+ `;
1030
+ };
1031
+ renderUserBadges_fn = function() {
1032
+ const user = this._users?.find((candidate) => candidate.userIndex === this._selectedUserIndex);
1033
+ if (user === void 0) return nothing;
1034
+ const status = formatUserStatus(user.userStatus);
1035
+ const type = formatUserType(user.userType);
1036
+ const expiringHint = user.userType === USER_TYPE_EXPIRING ? formatExpiringTimeoutHint(readExpiringUserTimeout(this.node, this.endpoint)) : null;
1037
+ return html`
1038
+ ${status !== null ? html`<span class="meta">${status}</span>` : nothing}
1039
+ ${type !== null ? html`<span class="meta">${type}</span>` : nothing}
1040
+ ${hasPinCredential(user) ? html`<span class="meta">PIN</span>` : nothing}
1041
+ ${expiringHint !== null ? html`<span class="meta">${expiringHint}</span>` : nothing}
1042
+ `;
1043
+ };
1044
+ /**
1045
+ * Every occupied slot, plus (unless expanded) just the next empty one — so there is always a visible
1046
+ * "+" to add a schedule without listing every empty slot up front. A slot the lock failed to report
1047
+ * is never collapsed: it is not an offer to write, and hiding it would hide the failure.
1048
+ */
1049
+ visibleSlots_fn = function(slots, expanded) {
1050
+ if (expanded) return slots;
1051
+ let shownEmpty = false;
1052
+ return slots.filter((slot) => {
1053
+ if (slot.schedule !== null || !isEmptySlot(slot)) return true;
1054
+ if (shownEmpty) return false;
1055
+ shownEmpty = true;
1056
+ return true;
1057
+ });
1058
+ };
1059
+ /** Toggle for the slot list's collapsed empty slots; hidden when there's nothing meaningful to collapse. */
1060
+ renderEmptySlotsToggle_fn = function(emptyTotal, expanded, toggle) {
1061
+ if (emptyTotal <= 1) return nothing;
1062
+ const hiddenCount = expanded ? 0 : emptyTotal - 1;
1063
+ return html`<button class="slot-list-toggle" @click=${toggle}>
1064
+ ${expanded ? "Hide empty slots" : `Show ${hiddenCount} more empty slot${hiddenCount === 1 ? "" : "s"}`}
1065
+ </button>`;
1066
+ };
1067
+ renderWeekDaySection_fn = function() {
1068
+ const slots = this._weekDaySlots;
1069
+ const capacity = readWeekDaySchedulesPerUser(this.node, this.endpoint) ?? 0;
1070
+ const used = slots?.filter((slot) => slot.schedule !== null).length ?? 0;
1071
+ const expanded = this._showEmptyWeekDay;
1072
+ const loading = this._loadingSchedules;
1073
+ const incomplete = loading || this._scheduleLoadError !== void 0;
1074
+ const busy = this._busy || incomplete;
1075
+ return html`
1076
+ <div class="section">
1077
+ <div class="section-header">
1078
+ <span>WEEK DAY SCHEDULES · ${__privateMethod(this, _DoorLockClusterCommands_instances, slotCountLabel_fn).call(this, slots, used, capacity, loading)}</span>
1079
+ ${used > 0 ? html`<button
1080
+ class="link-action"
1081
+ ?disabled=${busy}
1082
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, clearWeekDay_fn).call(this, SCHEDULE_INDEX_ALL))}
1083
+ >
1084
+ Clear all
1085
+ </button>` : nothing}
1086
+ </div>
1087
+ ${slots === void 0 || capacity === 0 ? __privateMethod(this, _DoorLockClusterCommands_instances, renderSlotsPlaceholder_fn).call(this, capacity) : html`
1088
+ ${used > 0 ? __privateMethod(this, _DoorLockClusterCommands_instances, renderWeekTimeline_fn).call(this, slots) : nothing}
1089
+ <ul class="slot-list">
1090
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, visibleSlots_fn).call(this, slots, expanded).map(
1091
+ (slot) => __privateMethod(this, _DoorLockClusterCommands_instances, renderWeekDaySlot_fn).call(this, slot, busy)
1092
+ )}
1093
+ </ul>
1094
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderEmptySlotsToggle_fn).call(this, countEmptySlots(slots), expanded, () => {
1095
+ this._showEmptyWeekDay = !expanded;
1096
+ })}
1097
+ `}
1098
+ </div>
1099
+ `;
1100
+ };
1101
+ renderWeekTimeline_fn = function(slots) {
1102
+ return html`
1103
+ <div class="schedule-grid">
1104
+ <div class="grid-ticks">
1105
+ ${HOUR_TICKS.map((hour) => html`<span>${String(hour).padStart(2, "0")}:00</span>`)}
1106
+ </div>
1107
+ ${DAY_LABELS.map((label, day) => {
1108
+ const segments = buildDaySegments(slots, day);
1109
+ return html`
1110
+ <div class="grid-row ${segments.length > 0 ? "" : "dimmed"}">
1111
+ <span class="day-label">${label}</span>
1112
+ <div class="day-timeline">
1113
+ ${segments.map(
1114
+ (segment) => html`
1115
+ <span
1116
+ class="segment"
1117
+ style=${`left:${segment.startMin / 1440 * 100}%;width:${(segment.endMin - segment.startMin) / 1440 * 100}%`}
1118
+ title=${`#${segment.weekDayIndex} \xB7 ${formatTimeOfDay(
1119
+ Math.floor(segment.startMin / 60),
1120
+ segment.startMin % 60
1121
+ )}\u2013${formatTimeOfDay(
1122
+ Math.floor(segment.endMin / 60),
1123
+ segment.endMin % 60
1124
+ )}`}
1125
+ ></span>
1126
+ `
1127
+ )}
1128
+ </div>
1129
+ </div>
1130
+ `;
1131
+ })}
1132
+ </div>
1133
+ `;
1134
+ };
1135
+ renderWeekDaySlot_fn = function(slot, busy) {
1136
+ const editor = this._editor;
1137
+ if (editor?.kind === "weekDay" && editor.index === slot.weekDayIndex) {
1138
+ return html`<li class="slot-row editing">${__privateMethod(this, _DoorLockClusterCommands_instances, renderWeekDayEditor_fn).call(this, editor)}</li>`;
1139
+ }
1140
+ const schedule = slot.schedule;
1141
+ return html`
1142
+ <li class="slot-row">
1143
+ <span class="slot-index">#${slot.weekDayIndex}</span>
1144
+ ${schedule === null ? html`<span class="slot-empty">${formatScheduleStatus(slot.status)}</span>` : html`
1145
+ <span class="slot-days">${formatDaysMask(schedule.daysMask)}</span>
1146
+ <span class="slot-window">
1147
+ ${formatTimeOfDay(schedule.startHour, schedule.startMinute)}–${formatTimeOfDay(
1148
+ schedule.endHour,
1149
+ schedule.endMinute
1150
+ )}
1151
+ </span>
1152
+ `}
1153
+ <span class="slot-actions">
1154
+ <md-outlined-icon-button
1155
+ title=${schedule === null ? "Set schedule" : "Edit schedule"}
1156
+ aria-label=${schedule === null ? "Set schedule" : "Edit schedule"}
1157
+ ?disabled=${busy}
1158
+ @click=${() => {
1159
+ this._editorError = void 0;
1160
+ this._editor = {
1161
+ kind: "weekDay",
1162
+ index: slot.weekDayIndex,
1163
+ daysMask: schedule?.daysMask ?? 0,
1164
+ start: schedule === null ? DEFAULT_START_TIME : formatTimeOfDay(schedule.startHour, schedule.startMinute),
1165
+ end: schedule === null ? DEFAULT_END_TIME : formatTimeOfDay(schedule.endHour, schedule.endMinute)
1166
+ };
1167
+ }}
1168
+ >
1169
+ <ha-svg-icon .path=${schedule === null ? mdiPlus : mdiPencilOutline}></ha-svg-icon>
1170
+ </md-outlined-icon-button>
1171
+ ${schedule === null ? nothing : html`<md-outlined-icon-button
1172
+ title="Clear schedule"
1173
+ aria-label="Clear schedule"
1174
+ ?disabled=${busy}
1175
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, clearWeekDay_fn).call(this, slot.weekDayIndex))}
1176
+ >
1177
+ <ha-svg-icon .path=${mdiTrashCanOutline}></ha-svg-icon>
1178
+ </md-outlined-icon-button>`}
1179
+ </span>
1180
+ </li>
1181
+ `;
1182
+ };
1183
+ renderWeekDayEditor_fn = function(editor) {
1184
+ return html`
1185
+ <div class="editor">
1186
+ <div class="editor-row">
1187
+ <span class="slot-index">#${editor.index}</span>
1188
+ <div class="day-toggles">
1189
+ ${DAY_LABELS.map((label, day) => {
1190
+ const bit = DAY_BITS[day];
1191
+ const active = maskHasDay(editor.daysMask, bit);
1192
+ return html`<button
1193
+ class="day-toggle ${active ? "active" : ""}"
1194
+ aria-pressed=${active ? "true" : "false"}
1195
+ @click=${() => {
1196
+ this._editor = { ...editor, daysMask: toggleMaskDay(editor.daysMask, bit) };
1197
+ }}
1198
+ >
1199
+ ${label}
1200
+ </button>`;
1201
+ })}
1202
+ </div>
1203
+ </div>
1204
+ <div class="editor-row">
1205
+ <label for="weekDayStart">From:</label>
1206
+ <input
1207
+ id="weekDayStart"
1208
+ type="time"
1209
+ .value=${editor.start}
1210
+ @input=${(event) => {
1211
+ this._editor = { ...editor, start: event.target.value };
1212
+ }}
1213
+ />
1214
+ <label for="weekDayEnd">To:</label>
1215
+ <input
1216
+ id="weekDayEnd"
1217
+ type="time"
1218
+ .value=${editor.end}
1219
+ @input=${(event) => {
1220
+ this._editor = { ...editor, end: event.target.value };
1221
+ }}
1222
+ />
1223
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderEditorActions_fn).call(this)}
1224
+ </div>
1225
+ ${this._editorError !== void 0 ? html`<p class="error">${this._editorError}</p>` : nothing}
1226
+ </div>
1227
+ `;
1228
+ };
1229
+ renderYearDaySection_fn = function() {
1230
+ const slots = this._yearDaySlots;
1231
+ const capacity = readYearDaySchedulesPerUser(this.node, this.endpoint) ?? 0;
1232
+ const used = slots?.filter((slot) => slot.schedule !== null).length ?? 0;
1233
+ const expanded = this._showEmptyYearDay;
1234
+ const loading = this._loadingSchedules;
1235
+ const incomplete = loading || this._scheduleLoadError !== void 0;
1236
+ const busy = this._busy || incomplete;
1237
+ return html`
1238
+ <div class="section">
1239
+ <div class="section-header">
1240
+ <span>YEAR DAY SCHEDULES · ${__privateMethod(this, _DoorLockClusterCommands_instances, slotCountLabel_fn).call(this, slots, used, capacity, loading)}</span>
1241
+ ${used > 0 ? html`<button
1242
+ class="link-action"
1243
+ ?disabled=${busy}
1244
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, clearYearDay_fn).call(this, SCHEDULE_INDEX_ALL))}
1245
+ >
1246
+ Clear all
1247
+ </button>` : nothing}
1248
+ </div>
1249
+ ${slots === void 0 || capacity === 0 ? __privateMethod(this, _DoorLockClusterCommands_instances, renderSlotsPlaceholder_fn).call(this, capacity) : html`
1250
+ <ul class="slot-list">
1251
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, visibleSlots_fn).call(this, slots, expanded).map(
1252
+ (slot) => __privateMethod(this, _DoorLockClusterCommands_instances, renderYearDaySlot_fn).call(this, slot, busy)
1253
+ )}
1254
+ </ul>
1255
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderEmptySlotsToggle_fn).call(this, countEmptySlots(slots), expanded, () => {
1256
+ this._showEmptyYearDay = !expanded;
1257
+ })}
1258
+ <p class="hint">
1259
+ <ha-svg-icon .path=${mdiCalendarRange}></ha-svg-icon>
1260
+ Date ranges are the lock's own local time, shown here unchanged rather than converted
1261
+ into this browser's time zone.
1262
+ </p>
1263
+ `}
1264
+ </div>
1265
+ `;
1266
+ };
1267
+ renderYearDaySlot_fn = function(slot, busy) {
1268
+ const editor = this._editor;
1269
+ if (editor?.kind === "yearDay" && editor.index === slot.yearDayIndex) {
1270
+ return html`<li class="slot-row editing">${__privateMethod(this, _DoorLockClusterCommands_instances, renderYearDayEditor_fn).call(this, editor)}</li>`;
1271
+ }
1272
+ const schedule = slot.schedule;
1273
+ return html`
1274
+ <li class="slot-row">
1275
+ <span class="slot-index">#${slot.yearDayIndex}</span>
1276
+ ${schedule === null ? html`<span class="slot-empty">${formatScheduleStatus(slot.status)}</span>` : html`<span class="slot-window wide">
1277
+ ${formatWallClock(schedule.localStartTime)} → ${formatWallClock(schedule.localEndTime)}
1278
+ </span>`}
1279
+ <span class="slot-actions">
1280
+ <md-outlined-icon-button
1281
+ title=${schedule === null ? "Set schedule" : "Edit schedule"}
1282
+ aria-label=${schedule === null ? "Set schedule" : "Edit schedule"}
1283
+ ?disabled=${busy}
1284
+ @click=${() => {
1285
+ this._editorError = void 0;
1286
+ const now = nowAsWallClock();
1287
+ this._editor = {
1288
+ kind: "yearDay",
1289
+ index: slot.yearDayIndex,
1290
+ start: toDateTimeInputValue(schedule?.localStartTime ?? now),
1291
+ end: toDateTimeInputValue(schedule?.localEndTime ?? now + 86400)
1292
+ };
1293
+ }}
1294
+ >
1295
+ <ha-svg-icon .path=${schedule === null ? mdiPlus : mdiPencilOutline}></ha-svg-icon>
1296
+ </md-outlined-icon-button>
1297
+ ${schedule === null ? nothing : html`<md-outlined-icon-button
1298
+ title="Clear schedule"
1299
+ aria-label="Clear schedule"
1300
+ ?disabled=${busy}
1301
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, clearYearDay_fn).call(this, slot.yearDayIndex))}
1302
+ >
1303
+ <ha-svg-icon .path=${mdiTrashCanOutline}></ha-svg-icon>
1304
+ </md-outlined-icon-button>`}
1305
+ </span>
1306
+ </li>
1307
+ `;
1308
+ };
1309
+ renderYearDayEditor_fn = function(editor) {
1310
+ return html`
1311
+ <div class="editor">
1312
+ <div class="editor-row">
1313
+ <span class="slot-index">#${editor.index}</span>
1314
+ <label for="yearDayStart">From:</label>
1315
+ <input
1316
+ id="yearDayStart"
1317
+ type="datetime-local"
1318
+ step="1"
1319
+ min=${DATE_TIME_MIN}
1320
+ max=${DATE_TIME_MAX}
1321
+ .value=${editor.start}
1322
+ @input=${(event) => {
1323
+ this._editor = { ...editor, start: event.target.value };
1324
+ }}
1325
+ />
1326
+ <label for="yearDayEnd">To:</label>
1327
+ <input
1328
+ id="yearDayEnd"
1329
+ type="datetime-local"
1330
+ step="1"
1331
+ min=${DATE_TIME_MIN}
1332
+ max=${DATE_TIME_MAX}
1333
+ .value=${editor.end}
1334
+ @input=${(event) => {
1335
+ this._editor = { ...editor, end: event.target.value };
1336
+ }}
1337
+ />
1338
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderEditorActions_fn).call(this)}
1339
+ </div>
1340
+ ${this._editorError !== void 0 ? html`<p class="error">${this._editorError}</p>` : nothing}
1341
+ </div>
1342
+ `;
1343
+ };
1344
+ renderHolidaySection_fn = function() {
1345
+ const slots = this._holidaySlots;
1346
+ const capacity = readHolidaySchedulesSupported(this.node, this.endpoint) ?? 0;
1347
+ const used = slots?.filter((slot) => slot.schedule !== null).length ?? 0;
1348
+ const loading = this._loadingHoliday;
1349
+ const incomplete = loading || this._holidayLoadError !== void 0;
1350
+ const busy = this._busy || incomplete;
1351
+ const expanded = this._showEmptyHoliday;
1352
+ return html`
1353
+ <div class="section">
1354
+ <div class="section-header">
1355
+ <span>HOLIDAY SCHEDULES · ${__privateMethod(this, _DoorLockClusterCommands_instances, slotCountLabel_fn).call(this, slots, used, capacity, loading)}</span>
1356
+ ${used > 0 ? html`<button
1357
+ class="link-action"
1358
+ ?disabled=${busy}
1359
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, clearHoliday_fn).call(this, SCHEDULE_INDEX_ALL))}
1360
+ >
1361
+ Clear all
1362
+ </button>` : nothing}
1363
+ </div>
1364
+ ${this._holidayLoadError !== void 0 ? html`<p class="error">${this._holidayLoadError}</p>` : nothing}
1365
+ ${slots === void 0 || capacity === 0 ? __privateMethod(this, _DoorLockClusterCommands_instances, renderSlotsPlaceholder_fn).call(this, capacity) : html`
1366
+ <ul class="slot-list">
1367
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, visibleSlots_fn).call(this, slots, expanded).map((slot) => __privateMethod(this, _DoorLockClusterCommands_instances, renderHolidaySlot_fn).call(this, slot, busy))}
1368
+ </ul>
1369
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderEmptySlotsToggle_fn).call(this, countEmptySlots(slots), expanded, () => {
1370
+ this._showEmptyHoliday = !expanded;
1371
+ })}
1372
+ <p class="hint">
1373
+ <ha-svg-icon .path=${mdiCalendarRange}></ha-svg-icon>
1374
+ Applies to the whole lock, not a single user. Date ranges are the lock's own local
1375
+ time, shown here unchanged rather than converted into this browser's time zone.
1376
+ </p>
1377
+ `}
1378
+ </div>
1379
+ `;
1380
+ };
1381
+ renderHolidaySlot_fn = function(slot, busy) {
1382
+ const editor = this._editor;
1383
+ if (editor?.kind === "holiday" && editor.index === slot.holidayIndex) {
1384
+ return html`<li class="slot-row editing">${__privateMethod(this, _DoorLockClusterCommands_instances, renderHolidayEditor_fn).call(this, editor)}</li>`;
1385
+ }
1386
+ const schedule = slot.schedule;
1387
+ return html`
1388
+ <li class="slot-row">
1389
+ <span class="slot-index">#${slot.holidayIndex}</span>
1390
+ ${schedule === null ? html`<span class="slot-empty">${formatScheduleStatus(slot.status)}</span>` : html`<span class="slot-window wide">
1391
+ ${formatWallClock(schedule.localStartTime)} → ${formatWallClock(schedule.localEndTime)} ·
1392
+ ${formatOperatingMode(schedule.operatingMode)}
1393
+ </span>`}
1394
+ <span class="slot-actions">
1395
+ <md-outlined-icon-button
1396
+ title=${schedule === null ? "Set schedule" : "Edit schedule"}
1397
+ aria-label=${schedule === null ? "Set schedule" : "Edit schedule"}
1398
+ ?disabled=${busy}
1399
+ @click=${() => {
1400
+ this._editorError = void 0;
1401
+ const now = nowAsWallClock();
1402
+ this._editor = {
1403
+ kind: "holiday",
1404
+ index: slot.holidayIndex,
1405
+ start: toDateTimeInputValue(schedule?.localStartTime ?? now),
1406
+ end: toDateTimeInputValue(schedule?.localEndTime ?? now + 86400),
1407
+ operatingMode: schedule?.operatingMode ?? defaultHolidayMode(supportedOperatingModes(this.node, this.endpoint))
1408
+ };
1409
+ }}
1410
+ >
1411
+ <ha-svg-icon .path=${schedule === null ? mdiPlus : mdiPencilOutline}></ha-svg-icon>
1412
+ </md-outlined-icon-button>
1413
+ ${schedule === null ? nothing : html`<md-outlined-icon-button
1414
+ title="Clear schedule"
1415
+ aria-label="Clear schedule"
1416
+ ?disabled=${busy}
1417
+ @click=${handleAsync(() => __privateMethod(this, _DoorLockClusterCommands_instances, clearHoliday_fn).call(this, slot.holidayIndex))}
1418
+ >
1419
+ <ha-svg-icon .path=${mdiTrashCanOutline}></ha-svg-icon>
1420
+ </md-outlined-icon-button>`}
1421
+ </span>
1422
+ </li>
1423
+ `;
1424
+ };
1425
+ renderHolidayEditor_fn = function(editor) {
1426
+ return html`
1427
+ <div class="editor">
1428
+ <div class="editor-row">
1429
+ <span class="slot-index">#${editor.index}</span>
1430
+ <label for="holidayStart">From:</label>
1431
+ <input
1432
+ id="holidayStart"
1433
+ type="datetime-local"
1434
+ step="1"
1435
+ min=${DATE_TIME_MIN}
1436
+ max=${DATE_TIME_MAX}
1437
+ .value=${editor.start}
1438
+ @input=${(event) => {
1439
+ this._editor = { ...editor, start: event.target.value };
1440
+ }}
1441
+ />
1442
+ <label for="holidayEnd">To:</label>
1443
+ <input
1444
+ id="holidayEnd"
1445
+ type="datetime-local"
1446
+ step="1"
1447
+ min=${DATE_TIME_MIN}
1448
+ max=${DATE_TIME_MAX}
1449
+ .value=${editor.end}
1450
+ @input=${(event) => {
1451
+ this._editor = { ...editor, end: event.target.value };
1452
+ }}
1453
+ />
1454
+ <label for="holidayMode">Mode:</label>
1455
+ <select
1456
+ id="holidayMode"
1457
+ @change=${(event) => {
1458
+ this._editor = {
1459
+ ...editor,
1460
+ operatingMode: Number(event.target.value)
1461
+ };
1462
+ }}
1463
+ >
1464
+ ${holidayModeChoices(
1465
+ supportedOperatingModes(this.node, this.endpoint),
1466
+ editor.operatingMode
1467
+ ).map(
1468
+ (mode) => html`<option value=${mode} .selected=${mode === editor.operatingMode}>
1469
+ ${formatOperatingMode(mode)}
1470
+ </option>`
1471
+ )}
1472
+ </select>
1473
+ ${__privateMethod(this, _DoorLockClusterCommands_instances, renderEditorActions_fn).call(this)}
1474
+ </div>
1475
+ ${this._editorError !== void 0 ? html`<p class="error">${this._editorError}</p>` : nothing}
1476
+ </div>
1477
+ `;
1478
+ };
1479
+ renderEditorActions_fn = function() {
1480
+ return html`
1481
+ <md-outlined-button ?disabled=${this._busy} @click=${() => __privateMethod(this, _DoorLockClusterCommands_instances, saveEditor_fn).call(this)}>
1482
+ <ha-svg-icon slot="icon" .path=${mdiContentSaveOutline}></ha-svg-icon>
1483
+ Save
1484
+ </md-outlined-button>
1485
+ <md-outlined-icon-button
1486
+ title="Cancel"
1487
+ aria-label="Cancel"
1488
+ @click=${() => {
1489
+ this._editor = null;
1490
+ this._editorError = void 0;
1491
+ }}
1492
+ >
1493
+ <ha-svg-icon .path=${mdiClose}></ha-svg-icon>
1494
+ </md-outlined-icon-button>
1495
+ `;
1496
+ };
1497
+ slotCountLabel_fn = function(slots, used, capacity, loading) {
1498
+ if (loading && slots !== void 0 && slots.length < capacity) {
1499
+ return `reading ${slots.length + 1} of ${capacity}\u2026`;
1500
+ }
1501
+ return `${used}/${capacity} slots`;
1502
+ };
1503
+ renderSlotsPlaceholder_fn = function(capacity) {
1504
+ if (capacity === 0) return html`<p class="empty">The lock reports no schedule slots.</p>`;
1505
+ return html`<div class="loading">
1506
+ <md-circular-progress indeterminate></md-circular-progress>
1507
+ Reading ${capacity} slots…
1508
+ </div>`;
1509
+ };
1510
+ DoorLockClusterCommands.styles = [
1511
+ BaseClusterCommands.styles,
1512
+ css`
1513
+ :host {
1514
+ display: flex;
1515
+ flex-direction: column;
1516
+ gap: 12px;
1517
+ }
1518
+
1519
+ .feature-map-badge {
1520
+ margin-left: auto;
1521
+ font-size: 0.75rem;
1522
+ font-weight: 400;
1523
+ color: var(--md-sys-color-on-surface-variant);
1524
+ }
1525
+
1526
+ .status-row {
1527
+ display: flex;
1528
+ align-items: center;
1529
+ flex-wrap: wrap;
1530
+ gap: 8px 12px;
1531
+ margin-bottom: 12px;
1532
+ }
1533
+
1534
+ .state-chip {
1535
+ padding: 4px 12px;
1536
+ border-radius: 8px;
1537
+ font-weight: 500;
1538
+ background: var(--md-sys-color-surface-container-highest);
1539
+ color: var(--md-sys-color-on-surface);
1540
+ }
1541
+
1542
+ .state-chip.locked {
1543
+ background: var(--md-sys-color-secondary-container);
1544
+ color: var(--md-sys-color-on-secondary-container);
1545
+ }
1546
+
1547
+ .state-chip.unlocked {
1548
+ background: color-mix(in srgb, var(--danger-color) 18%, transparent);
1549
+ color: var(--md-sys-color-on-surface);
1550
+ }
1551
+
1552
+ .meta {
1553
+ font-size: 0.8rem;
1554
+ color: var(--md-sys-color-on-surface-variant);
1555
+ }
1556
+
1557
+ .meta.warn {
1558
+ color: var(--danger-color);
1559
+ }
1560
+
1561
+ .command-row input[type="password"],
1562
+ .command-row input[type="time"],
1563
+ .command-row input[type="datetime-local"] {
1564
+ padding: 8px;
1565
+ border: 1px solid var(--md-sys-color-outline);
1566
+ border-radius: 4px;
1567
+ background: var(--md-sys-color-surface);
1568
+ color: var(--md-sys-color-on-surface);
1569
+ font: inherit;
1570
+ }
1571
+
1572
+ .command-row select {
1573
+ padding: 8px;
1574
+ border: 1px solid var(--md-sys-color-outline);
1575
+ border-radius: 4px;
1576
+ background: var(--md-sys-color-surface);
1577
+ color: var(--md-sys-color-on-surface);
1578
+ font: inherit;
1579
+ }
1580
+
1581
+ .section {
1582
+ margin-top: 16px;
1583
+ }
1584
+
1585
+ .section-header {
1586
+ display: flex;
1587
+ align-items: center;
1588
+ gap: 12px;
1589
+ font-weight: 500;
1590
+ font-size: 0.8rem;
1591
+ letter-spacing: 0.04em;
1592
+ color: var(--md-sys-color-on-surface-variant);
1593
+ margin-bottom: 8px;
1594
+ }
1595
+
1596
+ .link-action {
1597
+ margin-left: auto;
1598
+ border: none;
1599
+ background: none;
1600
+ padding: 0;
1601
+ font: inherit;
1602
+ font-size: 0.75rem;
1603
+ letter-spacing: 0.04em;
1604
+ color: var(--danger-color);
1605
+ cursor: pointer;
1606
+ }
1607
+
1608
+ .link-action[disabled] {
1609
+ opacity: 0.5;
1610
+ cursor: default;
1611
+ }
1612
+
1613
+ .slot-list-toggle {
1614
+ display: block;
1615
+ margin: 4px 0 0 0;
1616
+ border: none;
1617
+ background: none;
1618
+ padding: 0;
1619
+ font: inherit;
1620
+ font-size: 0.75rem;
1621
+ letter-spacing: 0.04em;
1622
+ color: var(--md-sys-color-primary);
1623
+ cursor: pointer;
1624
+ }
1625
+
1626
+ .schedule-grid {
1627
+ margin-bottom: 12px;
1628
+ }
1629
+
1630
+ .grid-ticks {
1631
+ display: flex;
1632
+ justify-content: space-between;
1633
+ font-size: 0.7rem;
1634
+ color: var(--md-sys-color-on-surface-variant);
1635
+ padding: 0 0 4px 48px;
1636
+ }
1637
+
1638
+ .grid-row {
1639
+ display: flex;
1640
+ align-items: center;
1641
+ gap: 8px;
1642
+ padding: 2px 0;
1643
+ }
1644
+
1645
+ .grid-row.dimmed {
1646
+ opacity: 0.45;
1647
+ }
1648
+
1649
+ .day-label {
1650
+ width: 40px;
1651
+ flex-shrink: 0;
1652
+ font-size: 0.8rem;
1653
+ font-weight: 500;
1654
+ }
1655
+
1656
+ .grid-row:not(.dimmed) .day-label {
1657
+ font-weight: 700;
1658
+ color: var(--md-sys-color-on-surface);
1659
+ }
1660
+
1661
+ .day-timeline {
1662
+ position: relative;
1663
+ flex: 1;
1664
+ height: 18px;
1665
+ border-radius: 4px;
1666
+ overflow: hidden;
1667
+ background: var(--md-sys-color-surface-container-highest);
1668
+ }
1669
+
1670
+ .segment {
1671
+ position: absolute;
1672
+ top: 0;
1673
+ bottom: 0;
1674
+ min-width: 2px;
1675
+ background: var(--md-sys-color-primary);
1676
+ }
1677
+
1678
+ .slot-list {
1679
+ list-style: none;
1680
+ margin: 0;
1681
+ padding: 0;
1682
+ display: flex;
1683
+ flex-direction: column;
1684
+ gap: 4px;
1685
+ }
1686
+
1687
+ .slot-row {
1688
+ display: flex;
1689
+ align-items: center;
1690
+ gap: 12px;
1691
+ padding: 8px 12px;
1692
+ border-radius: 8px;
1693
+ background: var(--md-sys-color-surface-container-highest);
1694
+ }
1695
+
1696
+ .slot-row.editing {
1697
+ background: var(--md-sys-color-surface-container-high);
1698
+ }
1699
+
1700
+ .slot-index {
1701
+ font-family: var(--monospace-font);
1702
+ font-size: 0.8rem;
1703
+ color: var(--md-sys-color-on-surface-variant);
1704
+ width: 28px;
1705
+ flex-shrink: 0;
1706
+ }
1707
+
1708
+ .slot-days {
1709
+ min-width: 104px;
1710
+ font-weight: 500;
1711
+ }
1712
+
1713
+ .slot-window {
1714
+ font-family: var(--monospace-font);
1715
+ color: var(--md-sys-color-on-surface-variant);
1716
+ }
1717
+
1718
+ .slot-window.wide {
1719
+ flex: 1;
1720
+ }
1721
+
1722
+ .slot-empty {
1723
+ flex: 1;
1724
+ font-style: italic;
1725
+ color: var(--md-sys-color-on-surface-variant);
1726
+ }
1727
+
1728
+ .slot-actions {
1729
+ display: inline-flex;
1730
+ align-items: center;
1731
+ gap: 4px;
1732
+ margin-left: auto;
1733
+ flex-shrink: 0;
1734
+ }
1735
+
1736
+ .slot-actions md-outlined-icon-button {
1737
+ --md-outlined-icon-button-container-height: 32px;
1738
+ --md-outlined-icon-button-container-width: 32px;
1739
+ --md-outlined-icon-button-icon-size: 16px;
1740
+ }
1741
+
1742
+ .editor {
1743
+ display: flex;
1744
+ flex-direction: column;
1745
+ gap: 8px;
1746
+ width: 100%;
1747
+ }
1748
+
1749
+ .editor-row {
1750
+ display: flex;
1751
+ align-items: center;
1752
+ flex-wrap: wrap;
1753
+ gap: 8px;
1754
+ }
1755
+
1756
+ .editor-row label {
1757
+ font-size: 14px;
1758
+ color: var(--md-sys-color-on-surface-variant);
1759
+ }
1760
+
1761
+ .editor-row input,
1762
+ .editor-row select {
1763
+ padding: 6px 8px;
1764
+ border: 1px solid var(--md-sys-color-outline);
1765
+ border-radius: 4px;
1766
+ background: var(--md-sys-color-surface);
1767
+ color: var(--md-sys-color-on-surface);
1768
+ font: inherit;
1769
+ }
1770
+
1771
+ .day-toggles {
1772
+ display: inline-flex;
1773
+ flex-wrap: wrap;
1774
+ gap: 4px;
1775
+ }
1776
+
1777
+ .day-toggle {
1778
+ padding: 4px 10px;
1779
+ border-radius: 8px;
1780
+ border: 1px solid var(--md-sys-color-outline);
1781
+ background: transparent;
1782
+ color: var(--md-sys-color-on-surface-variant);
1783
+ font: inherit;
1784
+ font-size: 0.8rem;
1785
+ cursor: pointer;
1786
+ }
1787
+
1788
+ .day-toggle.active {
1789
+ background: var(--md-sys-color-secondary-container);
1790
+ color: var(--md-sys-color-on-secondary-container);
1791
+ border-color: transparent;
1792
+ }
1793
+
1794
+ .loading {
1795
+ display: flex;
1796
+ align-items: center;
1797
+ gap: 12px;
1798
+ color: var(--md-sys-color-on-surface-variant);
1799
+ font-size: 0.9rem;
1800
+ }
1801
+
1802
+ .loading md-circular-progress {
1803
+ --md-circular-progress-size: 24px;
1804
+ }
1805
+
1806
+ .hint {
1807
+ display: flex;
1808
+ align-items: center;
1809
+ gap: 6px;
1810
+ margin: 8px 0 0 0;
1811
+ font-size: 0.75rem;
1812
+ color: var(--md-sys-color-on-surface-variant);
1813
+ }
1814
+
1815
+ .hint ha-svg-icon {
1816
+ --mdc-icon-size: 14px;
1817
+ }
1818
+
1819
+ .empty {
1820
+ color: var(--md-sys-color-on-surface-variant);
1821
+ margin: 0;
1822
+ }
1823
+
1824
+ .error {
1825
+ color: var(--danger-color);
1826
+ margin: 8px 0 0 0;
1827
+ font-size: 0.85rem;
1828
+ }
1829
+ `
1830
+ ];
1831
+ __decorateClass([
1832
+ state()
1833
+ ], DoorLockClusterCommands.prototype, "_users", 2);
1834
+ __decorateClass([
1835
+ state()
1836
+ ], DoorLockClusterCommands.prototype, "_selectedUserIndex", 2);
1837
+ __decorateClass([
1838
+ state()
1839
+ ], DoorLockClusterCommands.prototype, "_weekDaySlots", 2);
1840
+ __decorateClass([
1841
+ state()
1842
+ ], DoorLockClusterCommands.prototype, "_yearDaySlots", 2);
1843
+ __decorateClass([
1844
+ state()
1845
+ ], DoorLockClusterCommands.prototype, "_holidaySlots", 2);
1846
+ __decorateClass([
1847
+ state()
1848
+ ], DoorLockClusterCommands.prototype, "_loadingUsers", 2);
1849
+ __decorateClass([
1850
+ state()
1851
+ ], DoorLockClusterCommands.prototype, "_loadingSchedules", 2);
1852
+ __decorateClass([
1853
+ state()
1854
+ ], DoorLockClusterCommands.prototype, "_loadingHoliday", 2);
1855
+ __decorateClass([
1856
+ state()
1857
+ ], DoorLockClusterCommands.prototype, "_userLoadError", 2);
1858
+ __decorateClass([
1859
+ state()
1860
+ ], DoorLockClusterCommands.prototype, "_scheduleLoadError", 2);
1861
+ __decorateClass([
1862
+ state()
1863
+ ], DoorLockClusterCommands.prototype, "_holidayLoadError", 2);
1864
+ __decorateClass([
1865
+ state()
1866
+ ], DoorLockClusterCommands.prototype, "_freeUserIndex", 2);
1867
+ __decorateClass([
1868
+ state()
1869
+ ], DoorLockClusterCommands.prototype, "_editor", 2);
1870
+ __decorateClass([
1871
+ state()
1872
+ ], DoorLockClusterCommands.prototype, "_editorError", 2);
1873
+ __decorateClass([
1874
+ state()
1875
+ ], DoorLockClusterCommands.prototype, "_addingUser", 2);
1876
+ __decorateClass([
1877
+ state()
1878
+ ], DoorLockClusterCommands.prototype, "_newUserName", 2);
1879
+ __decorateClass([
1880
+ state()
1881
+ ], DoorLockClusterCommands.prototype, "_newUserType", 2);
1882
+ __decorateClass([
1883
+ state()
1884
+ ], DoorLockClusterCommands.prototype, "_newUserPin", 2);
1885
+ __decorateClass([
1886
+ state()
1887
+ ], DoorLockClusterCommands.prototype, "_userEditorError", 2);
1888
+ __decorateClass([
1889
+ state()
1890
+ ], DoorLockClusterCommands.prototype, "_expiringTimeoutInput", 2);
1891
+ __decorateClass([
1892
+ state()
1893
+ ], DoorLockClusterCommands.prototype, "_showEmptyWeekDay", 2);
1894
+ __decorateClass([
1895
+ state()
1896
+ ], DoorLockClusterCommands.prototype, "_showEmptyYearDay", 2);
1897
+ __decorateClass([
1898
+ state()
1899
+ ], DoorLockClusterCommands.prototype, "_showEmptyHoliday", 2);
1900
+ __decorateClass([
1901
+ state()
1902
+ ], DoorLockClusterCommands.prototype, "_busy", 2);
1903
+ __decorateClass([
1904
+ state()
1905
+ ], DoorLockClusterCommands.prototype, "_pinCode", 2);
1906
+ __decorateClass([
1907
+ state()
1908
+ ], DoorLockClusterCommands.prototype, "_unlockTimeout", 2);
1909
+ DoorLockClusterCommands = __decorateClass([
1910
+ customElement("door-lock-cluster-commands")
1911
+ ], DoorLockClusterCommands);
1912
+ function isEmptySlot(slot) {
1913
+ return slot.schedule === null && isEmptyScheduleStatus(slot.status);
1914
+ }
1915
+ function countEmptySlots(slots) {
1916
+ return slots.filter(isEmptySlot).length;
1917
+ }
1918
+ registerClusterCommands(DOOR_LOCK_CLUSTER_ID, "door-lock-cluster-commands");
1919
+ //# sourceMappingURL=door-lock-commands.js.map