zigbee2mqtt-windfront 1.0.4 → 1.0.5

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 (204) hide show
  1. package/README.md +0 -1
  2. package/dist/assets/{About-CLsLFL3T.js → About-Bwc-SnjR.js} +1 -1
  3. package/dist/assets/About-Bwc-SnjR.js.br +0 -0
  4. package/dist/assets/{Availability-Lz4Com13.js → Availability-Jxv3jj-f.js} +1 -1
  5. package/dist/assets/Availability-Jxv3jj-f.js.br +0 -0
  6. package/dist/assets/{Bind-CZ1WLp2A.js → Bind-CCmoXBga.js} +1 -1
  7. package/dist/assets/Bind-CCmoXBga.js.br +0 -0
  8. package/dist/assets/{Bridge-K1QLb7zL.js → Bridge-B00gjrw-.js} +1 -1
  9. package/dist/assets/Bridge-B00gjrw-.js.br +0 -0
  10. package/dist/assets/{CheckboxField-CTB2svCJ.js → CheckboxField-aJECTtGJ.js} +1 -1
  11. package/dist/assets/CheckboxField-aJECTtGJ.js.br +0 -0
  12. package/dist/assets/{ClusterSinglePicker-hojoD83c.js → ClusterSinglePicker-Ckri6Ml1.js} +1 -1
  13. package/dist/assets/ClusterSinglePicker-Ckri6Ml1.js.br +0 -0
  14. package/dist/assets/{Clusters-C_rvuzWi.js → Clusters-C4Yp-rHe.js} +1 -1
  15. package/dist/assets/Clusters-C4Yp-rHe.js.br +0 -0
  16. package/dist/assets/Dashboard-CjpyYRjt.js +1 -0
  17. package/dist/assets/Dashboard-CjpyYRjt.js.br +0 -0
  18. package/dist/assets/{DashboardFeatureWrapper-DyAAb85w.js → DashboardFeatureWrapper-DZDafjVF.js} +1 -1
  19. package/dist/assets/DashboardFeatureWrapper-DZDafjVF.js.br +0 -0
  20. package/dist/assets/{DebouncedInput-CBB2lTWU.js → DebouncedInput-hrRL_knE.js} +1 -1
  21. package/dist/assets/DebouncedInput-hrRL_knE.js.br +0 -0
  22. package/dist/assets/{DevConsole-CtAF7h-Q.js → DevConsole-B4vldyLk.js} +1 -1
  23. package/dist/assets/DevConsole-B4vldyLk.js.br +0 -0
  24. package/dist/assets/{DevConsole-CV22sos7.js → DevConsole-FoMbBemz.js} +1 -1
  25. package/dist/assets/DevConsole-FoMbBemz.js.br +0 -0
  26. package/dist/assets/DeviceCard-C2NVxg8O.js +1 -0
  27. package/dist/assets/DeviceCard-C2NVxg8O.js.br +0 -0
  28. package/dist/assets/{DeviceControlEditName-BCsg_DkH.js → DeviceControlEditName-B_UgBTKk.js} +1 -1
  29. package/dist/assets/DeviceControlEditName-B_UgBTKk.js.br +0 -0
  30. package/dist/assets/{DeviceInfo-CbtcWXuI.js → DeviceInfo-D7K10Qfz.js} +1 -1
  31. package/dist/assets/DeviceInfo-D7K10Qfz.js.br +0 -0
  32. package/dist/assets/{DevicePage-DBSCBunk.js → DevicePage-BuRX-zbG.js} +2 -2
  33. package/dist/assets/DevicePage-BuRX-zbG.js.br +0 -0
  34. package/dist/assets/{DevicePicker-CvcAHg8J.js → DevicePicker-Dt0o_iaP.js} +1 -1
  35. package/dist/assets/DevicePicker-Dt0o_iaP.js.br +0 -0
  36. package/dist/assets/{DeviceSettings-BDVnR54i.js → DeviceSettings-DPEQ0NWl.js} +1 -1
  37. package/dist/assets/DeviceSettings-DPEQ0NWl.js.br +0 -0
  38. package/dist/assets/{DeviceSpecificSettings-DmZZAo9h.js → DeviceSpecificSettings-B5ywqTh7.js} +1 -1
  39. package/dist/assets/DeviceSpecificSettings-B5ywqTh7.js.br +0 -0
  40. package/dist/assets/Devices-DAG6vs0G.js +1 -0
  41. package/dist/assets/Devices-DAG6vs0G.js.br +0 -0
  42. package/dist/assets/DevicesPage-BgcI1RZT.js +1 -0
  43. package/dist/assets/DevicesPage-BgcI1RZT.js.br +0 -0
  44. package/dist/assets/{DisplayValue-BRvbaOY3.js → DisplayValue-CjZXHxIO.js} +1 -1
  45. package/dist/assets/DisplayValue-CjZXHxIO.js.br +0 -0
  46. package/dist/assets/{Donate-DXg8VSiU.js → Donate-BI8FFOLc.js} +1 -1
  47. package/dist/assets/Donate-BI8FFOLc.js.br +0 -0
  48. package/dist/assets/{EndpointPicker-DXxNp6I_.js → EndpointPicker-CX9S9S7k.js} +1 -1
  49. package/dist/assets/EndpointPicker-CX9S9S7k.js.br +0 -0
  50. package/dist/assets/{Exposes-CTV1Q_bO.js → Exposes-CZ40iv73.js} +1 -1
  51. package/dist/assets/Exposes-CZ40iv73.js.br +0 -0
  52. package/dist/assets/{Feature-BYaimoIP.js → Feature-DhPZqYWh.js} +1 -1
  53. package/dist/assets/Feature-DhPZqYWh.js.br +0 -0
  54. package/dist/assets/Frontend-D8k0f0AR.js +1 -0
  55. package/dist/assets/Frontend-D8k0f0AR.js.br +0 -0
  56. package/dist/assets/{GroupPage-_n96EBBd.js → GroupPage-H559xYGM.js} +2 -2
  57. package/dist/assets/GroupPage-H559xYGM.js.br +0 -0
  58. package/dist/assets/{GroupSettings-Cy3exzPA.js → GroupSettings-CEzY10KG.js} +1 -1
  59. package/dist/assets/GroupSettings-CEzY10KG.js.br +0 -0
  60. package/dist/assets/Groups-QvxyfbK9.js +1 -0
  61. package/dist/assets/Groups-QvxyfbK9.js.br +0 -0
  62. package/dist/assets/GroupsPage-DQRrJ45C.js +1 -0
  63. package/dist/assets/GroupsPage-DQRrJ45C.js.br +0 -0
  64. package/dist/assets/{HomePage-BMrQ2Tkh.js → HomePage-Dqztw8Hc.js} +1 -1
  65. package/dist/assets/HomePage-Dqztw8Hc.js.br +0 -0
  66. package/dist/assets/{InputField-ywTsvyXp.js → InputField-TubacR8F.js} +1 -1
  67. package/dist/assets/InputField-TubacR8F.js.br +0 -0
  68. package/dist/assets/{LastSeen-CNqb-eoa.js → LastSeen-DjUuaYXi.js} +1 -1
  69. package/dist/assets/LastSeen-DjUuaYXi.js.br +0 -0
  70. package/dist/assets/LogsPage-DrJ3t-Cv.js +1 -0
  71. package/dist/assets/LogsPage-DrJ3t-Cv.js.br +0 -0
  72. package/dist/assets/{Lqi-DaXrZL2F.js → Lqi-BNx2QV2z.js} +1 -1
  73. package/dist/assets/Lqi-BNx2QV2z.js.br +0 -0
  74. package/dist/assets/{NetworkPage-DJdg--Uu.js → NetworkPage-C4sfYTKz.js} +2 -2
  75. package/dist/assets/NetworkPage-C4sfYTKz.js.br +0 -0
  76. package/dist/assets/{NumberField-DM8no8LD.js → NumberField-B10BRlkz.js} +1 -1
  77. package/dist/assets/NumberField-B10BRlkz.js.br +0 -0
  78. package/dist/assets/OtaPage-M9j8HXqi.js +1 -0
  79. package/dist/assets/OtaPage-M9j8HXqi.js.br +0 -0
  80. package/dist/assets/{PowerSource-CYKTc3dJ.js → PowerSource-CT5LulZX.js} +1 -1
  81. package/dist/assets/PowerSource-CT5LulZX.js.br +0 -0
  82. package/dist/assets/{RawNetworkData-BCA0bmwX.js → RawNetworkData-uldf8APR.js} +4 -4
  83. package/dist/assets/RawNetworkData-uldf8APR.js.br +0 -0
  84. package/dist/assets/{RawNetworkMap-C9o-OWbT.js → RawNetworkMap-CAdhahgm.js} +59 -59
  85. package/dist/assets/RawNetworkMap-CAdhahgm.js.br +0 -0
  86. package/dist/assets/{RecallRemove-CBFynfHA.js → RecallRemove-CLsmJI45.js} +1 -1
  87. package/dist/assets/RecallRemove-CLsmJI45.js.br +0 -0
  88. package/dist/assets/{Reporting-DzW3ODXL.js → Reporting-Bo6_VF2b.js} +1 -1
  89. package/dist/assets/Reporting-Bo6_VF2b.js.br +0 -0
  90. package/dist/assets/Scene-BXVtU8op.js +1 -0
  91. package/dist/assets/Scene-BXVtU8op.js.br +0 -0
  92. package/dist/assets/{SelectField-CRKLuxXb.js → SelectField-CboFEeLv.js} +1 -1
  93. package/dist/assets/SelectField-CboFEeLv.js.br +0 -0
  94. package/dist/assets/{Settings-B6lokg6Q.js → Settings-B5wIMTA9.js} +1 -1
  95. package/dist/assets/Settings-B5wIMTA9.js.br +0 -0
  96. package/dist/assets/{SettingsList-DG1vIHZD.js → SettingsList-BXXsCJCy.js} +1 -1
  97. package/dist/assets/SettingsList-BXXsCJCy.js.br +0 -0
  98. package/dist/assets/SettingsPage-DnvMw2Gc.js +2 -0
  99. package/dist/assets/SettingsPage-DnvMw2Gc.js.br +0 -0
  100. package/dist/assets/{State-3CifFtE3.js → State--9WxnrT8.js} +1 -1
  101. package/dist/assets/State--9WxnrT8.js.br +0 -0
  102. package/dist/assets/{Table-CSTYjWMC.js → Table-CK8_rY6Z.js} +1 -1
  103. package/dist/assets/Table-CK8_rY6Z.js.br +0 -0
  104. package/dist/assets/{TextareaField-lt-zWiXi.js → TextareaField-Cb3faakR.js} +1 -1
  105. package/dist/assets/TextareaField-Cb3faakR.js.br +0 -0
  106. package/dist/assets/Tools-DdvQNnDA.js +1 -0
  107. package/dist/assets/Tools-DdvQNnDA.js.br +0 -0
  108. package/dist/assets/{TouchlinkPage-C5lEVFKL.js → TouchlinkPage-DGFmsjIH.js} +1 -1
  109. package/dist/assets/TouchlinkPage-DGFmsjIH.js.br +0 -0
  110. package/dist/assets/{VendorLink-DxyjV7EH.js → VendorLink-CQWJDUO2.js} +1 -1
  111. package/dist/assets/VendorLink-CQWJDUO2.js.br +0 -0
  112. package/dist/assets/{_createCompounder-0jJLm6ui.js → _createCompounder-COpq92ed.js} +1 -1
  113. package/dist/assets/_createCompounder-COpq92ed.js.br +0 -0
  114. package/dist/assets/{capitalize-Bw26IpMp.js → capitalize-JuEfl3u2.js} +1 -1
  115. package/dist/assets/capitalize-JuEfl3u2.js.br +0 -0
  116. package/dist/assets/{index-Dpr5JorG.js → index-CUIfkU6p.js} +1 -1
  117. package/dist/assets/index-CUIfkU6p.js.br +0 -0
  118. package/dist/assets/{index-CjAIuMGC.js → index-Cs-KexR1.js} +5 -5
  119. package/dist/assets/index-Cs-KexR1.js.br +0 -0
  120. package/dist/assets/index-vRya9HWu.css +1 -0
  121. package/dist/assets/index-vRya9HWu.css.br +0 -0
  122. package/dist/assets/{jszip.min-CCrNpiZ9.js → jszip.min-1QgvwwzN.js} +1 -1
  123. package/dist/assets/jszip.min-1QgvwwzN.js.br +0 -0
  124. package/dist/assets/snakeCase-XNTmpa2i.js +1 -0
  125. package/dist/assets/snakeCase-XNTmpa2i.js.br +0 -0
  126. package/dist/index.html +2 -2
  127. package/dist/index.html.br +0 -0
  128. package/package.json +2 -2
  129. package/dist/assets/About-CLsLFL3T.js.br +0 -0
  130. package/dist/assets/Availability-Lz4Com13.js.br +0 -0
  131. package/dist/assets/Bind-CZ1WLp2A.js.br +0 -0
  132. package/dist/assets/Bridge-K1QLb7zL.js.br +0 -0
  133. package/dist/assets/CheckboxField-CTB2svCJ.js.br +0 -1
  134. package/dist/assets/ClusterSinglePicker-hojoD83c.js.br +0 -0
  135. package/dist/assets/Clusters-C_rvuzWi.js.br +0 -0
  136. package/dist/assets/Dashboard-D_ZnzhGn.js +0 -1
  137. package/dist/assets/Dashboard-D_ZnzhGn.js.br +0 -0
  138. package/dist/assets/DashboardFeatureWrapper-DyAAb85w.js.br +0 -3
  139. package/dist/assets/DebouncedInput-CBB2lTWU.js.br +0 -0
  140. package/dist/assets/DevConsole-CV22sos7.js.br +0 -0
  141. package/dist/assets/DevConsole-CtAF7h-Q.js.br +0 -0
  142. package/dist/assets/DeviceCard-CnbDGTrJ.js +0 -1
  143. package/dist/assets/DeviceCard-CnbDGTrJ.js.br +0 -0
  144. package/dist/assets/DeviceControlEditName-BCsg_DkH.js.br +0 -0
  145. package/dist/assets/DeviceInfo-CbtcWXuI.js.br +0 -0
  146. package/dist/assets/DevicePage-DBSCBunk.js.br +0 -0
  147. package/dist/assets/DevicePicker-CvcAHg8J.js.br +0 -0
  148. package/dist/assets/DeviceSettings-BDVnR54i.js.br +0 -0
  149. package/dist/assets/DeviceSpecificSettings-DmZZAo9h.js.br +0 -0
  150. package/dist/assets/Devices-DaZ0Iq80.js +0 -1
  151. package/dist/assets/Devices-DaZ0Iq80.js.br +0 -0
  152. package/dist/assets/DevicesPage-BMe9I7Ih.js +0 -1
  153. package/dist/assets/DevicesPage-BMe9I7Ih.js.br +0 -0
  154. package/dist/assets/DisplayValue-BRvbaOY3.js.br +0 -0
  155. package/dist/assets/Donate-DXg8VSiU.js.br +0 -0
  156. package/dist/assets/EndpointPicker-DXxNp6I_.js.br +0 -0
  157. package/dist/assets/Exposes-CTV1Q_bO.js.br +0 -0
  158. package/dist/assets/Feature-BYaimoIP.js.br +0 -0
  159. package/dist/assets/Frontend-CBrpGju1.js +0 -1
  160. package/dist/assets/Frontend-CBrpGju1.js.br +0 -0
  161. package/dist/assets/GroupPage-_n96EBBd.js.br +0 -0
  162. package/dist/assets/GroupSettings-Cy3exzPA.js.br +0 -0
  163. package/dist/assets/Groups-DRGPF1Hy.js +0 -1
  164. package/dist/assets/Groups-DRGPF1Hy.js.br +0 -0
  165. package/dist/assets/GroupsPage-sWVQmask.js +0 -1
  166. package/dist/assets/GroupsPage-sWVQmask.js.br +0 -0
  167. package/dist/assets/HomePage-BMrQ2Tkh.js.br +0 -0
  168. package/dist/assets/InputField-ywTsvyXp.js.br +0 -2
  169. package/dist/assets/LastSeen-CNqb-eoa.js.br +0 -0
  170. package/dist/assets/LogsPage-DbQuayvM.js +0 -1
  171. package/dist/assets/LogsPage-DbQuayvM.js.br +0 -0
  172. package/dist/assets/Lqi-DaXrZL2F.js.br +0 -0
  173. package/dist/assets/NetworkPage-DJdg--Uu.js.br +0 -0
  174. package/dist/assets/NumberField-DM8no8LD.js.br +0 -0
  175. package/dist/assets/OtaPage-C6jRKx2c.js +0 -1
  176. package/dist/assets/OtaPage-C6jRKx2c.js.br +0 -0
  177. package/dist/assets/PowerSource-CYKTc3dJ.js.br +0 -0
  178. package/dist/assets/RawNetworkData-BCA0bmwX.js.br +0 -0
  179. package/dist/assets/RawNetworkMap-C9o-OWbT.js.br +0 -0
  180. package/dist/assets/RecallRemove-CBFynfHA.js.br +0 -0
  181. package/dist/assets/Reporting-DzW3ODXL.js.br +0 -0
  182. package/dist/assets/Scene-D2eGOgyK.js +0 -1
  183. package/dist/assets/Scene-D2eGOgyK.js.br +0 -0
  184. package/dist/assets/SelectField-CRKLuxXb.js.br +0 -1
  185. package/dist/assets/Settings-B6lokg6Q.js.br +0 -0
  186. package/dist/assets/SettingsList-DG1vIHZD.js.br +0 -0
  187. package/dist/assets/SettingsPage-DRmUsKcF.js +0 -2
  188. package/dist/assets/SettingsPage-DRmUsKcF.js.br +0 -0
  189. package/dist/assets/State-3CifFtE3.js.br +0 -0
  190. package/dist/assets/Table-CSTYjWMC.js.br +0 -0
  191. package/dist/assets/TextareaField-lt-zWiXi.js.br +0 -0
  192. package/dist/assets/Tools-B8svP-O8.js +0 -1
  193. package/dist/assets/Tools-B8svP-O8.js.br +0 -0
  194. package/dist/assets/TouchlinkPage-C5lEVFKL.js.br +0 -0
  195. package/dist/assets/VendorLink-DxyjV7EH.js.br +0 -0
  196. package/dist/assets/_createCompounder-0jJLm6ui.js.br +0 -0
  197. package/dist/assets/capitalize-Bw26IpMp.js.br +0 -0
  198. package/dist/assets/index-BlshbhbW.css +0 -1
  199. package/dist/assets/index-BlshbhbW.css.br +0 -0
  200. package/dist/assets/index-CjAIuMGC.js.br +0 -0
  201. package/dist/assets/index-Dpr5JorG.js.br +0 -0
  202. package/dist/assets/jszip.min-CCrNpiZ9.js.br +0 -0
  203. package/dist/assets/snakeCase-DiSj8W4z.js +0 -1
  204. package/dist/assets/snakeCase-DiSj8W4z.js.br +0 -0
@@ -1 +1 @@
1
- import{a7 as J,aJ as Fe,aK as Ie,aL as Be,l as qe,aM as Ge,aN as Me,aO as Oe,aP as Ve,aQ as He,az as ee,aR as te,aS as Le,aT as Pe,aU as ze,aV as Ue,aW as We,aX as De,aY as re,aZ as Xe,a_ as ae,a$ as Ye,b0 as Ke,b1 as L,b2 as ne,b3 as se,U as Qe,b4 as Ze,b5 as Je,b6 as et,b7 as tt,b8 as rt,b9 as at,ba as nt,bb as st,bc as ot,bd as ct,be as lt,bf as it,bg as ut,bh as mt,bi as ft,bj as xt,bk as ht,bl as pt,bm as gt,bn as R,aB as dt,bo as oe,bp as bt,bq as _t,br as yt,bs as Ct,bt as de,bu as jt,bv as be,bw as vt,bx as St,by as Tt,r as l,j as s,b as A,B as v,F as Z,bz as kt,aj as Et,bA as Nt,bB as wt,E as At}from"./index-CjAIuMGC.js";import{D as V}from"./DisplayValue-BRvbaOY3.js";import{r as _e,a as Rt}from"./_createCompounder-0jJLm6ui.js";import{r as $t,a as Ft}from"./capitalize-Bw26IpMp.js";var P,ce;function It(){if(ce)return P;ce=1;var e=$t(),r=_e(),a=r(function(t,o,n){return o=o.toLowerCase(),t+(n?e(o):o)});return P=a,P}var Bt=It();const qt=J(Bt);var z,le;function Gt(){if(le)return z;le=1;var e=_e(),r=Ft(),a=e(function(t,o,n){return t+(n?" ":"")+r(o)});return z=a,z}var Mt=Gt();const Ot=J(Mt),Vt={battery_low:R,humidity:gt,illuminance:L,pressure:pt,co2:ht,voltage:xt,state:ft,brightness:L,occupancy:mt,presence:ut,current:it,power:lt,energy:ct,frequency:ot,tamper:st,smoke:nt,radiation_dose_per_hour:at,radioactive_events_per_minute:rt,power_factor:tt,mode:et,sound:Je,position:Ze,alarm:Qe,color_xy:se,color_hs:se,color_temp:ne,color_temp_startup:ne,illuminance_lux:L,soil_moisture:Ke,water_leak:re,week:Ye,workdays_schedule:ae,holidays_schedule:ae,away_mode:Xe,vibration:re,power_outage_count:De,action:We,angle_x:Ue,angle_y:ze,angle_z:Pe,side:Le,humidity_alarm:te,temperature_alarm:te,approach_distance:ee,distance:ee,trigger_count:He,level_config:Ve,station:Oe,effect:Me,linkquality:Ge,system_mode:qe,gradient:Be,sensitivity:Ie,test:Fe},Ht=(e,r)=>{let a=R;return e==null||(e>=85?(a=de,r.push("text-success")):e>=65?a=jt:e>=40?a=be:e>=20?a=vt:(a=R,r.push("text-error"))),a},Lt=(e,r)=>{let a=R;switch(e){case"high":{a=de,r.push("text-success");break}case"medium":{a=be;break}case"low":{a=R,r.push("text-error");break}}return a},Pt=(e,r,a)=>{let t=oe;return e==null||(r==="°F"&&(e=(e-32)/1.8),e>=30?(t=bt,a.push("text-error")):e>=25?t=_t:e>=20?t=yt:e>=15?t=Ct:e<5&&(t=oe,a.push("text-info"))),t},zt=(e,r,a)=>{let t;const o=[],n={};switch(e){case"battery":{t=Ht(r,o);break}case"battery_state":{t=Lt(r,o);break}case"battery_low":{r&&o.push("text-error");break}case"device_temperature":case"temperature":case"local_temperature":{t=Pt(r,a,o);break}case"humidity":{r!=null&&r>60&&o.push("text-info");break}case"contact":{t=r?St:Tt,r||o.push("text-primary");break}case"occupancy":{r&&(o.push("text-warning"),n.beat=!0);break}case"presence":{r&&(o.push("text-warning"),n.beat=!0);break}case"tamper":{r&&(o.push("text-error"),n.beatFade=!0,n.shake=!0);break}case"water_leak":{r&&(o.push("text-primary"),n.beatFade=!0);break}case"vibration":{r&&(o.push("text-primary"),n.shake=!0);break}}return t?[t,o.join(" "),n]:(t=Vt[e],t?[t,o.join(" "),n]:[dt,"opacity-0",{}])},Ut=e=>`${e.type}-${e.name}-${e.label}-${e.property}-${e.access}-${e.category}-${e.endpoint}`;var y=(e=>(e[e.STATE=1]="STATE",e[e.SET=2]="SET",e[e.GET=4]="GET",e[e.STATE_SET=3]="STATE_SET",e[e.STATE_GET=5]="STATE_GET",e[e.ALL=7]="ALL",e))(y||{});const $=l.memo(({feature:e,deviceValue:r})=>s.jsxs("div",{children:[e.property&&s.jsx("span",{className:"font-bold",children:s.jsx(V,{value:r,name:e.name})}),"unit"in e&&s.jsx("span",{className:"text-xs ms-1",children:e.unit})]})),F=l.memo(e=>s.jsxs("div",{className:"alert alert-warning",role:"alert",children:["Unknown access ",s.jsx("pre",{children:e.feature.access})]})),Wt=l.memo(e=>{const{feature:{access:r=y.SET,name:a,property:t,value_off:o,value_on:n},deviceValue:m,onChange:c,minimal:f}=e,{t:i}=A("zigbee"),h=l.useCallback(x=>c({[t]:x}),[t,c]),u=l.useCallback(x=>c({[t]:x.target.checked?n:o}),[n,o,t,c]);if(r&y.SET){const x=m!=null,p=!f||f&&!x;return s.jsxs("div",{children:[p&&s.jsx(v,{className:"btn btn-link",item:o,onClick:h,children:s.jsx(V,{value:o,name:a})}),x?s.jsx("input",{className:"toggle",type:"checkbox",checked:m===n,onChange:u}):s.jsx(Z,{icon:kt,title:i("unknown")}),p&&s.jsx(v,{className:"btn btn-link",item:n,onClick:h,children:s.jsx(V,{value:n,name:a})})]})}return r&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),N=l.memo(e=>{const{feature:r,onChange:a,parentFeatures:t,onRead:o,device:n,deviceState:m,featureWrapperClass:c,minimal:f,steps:i}=e,{type:h,property:u}=r,[x,p]=l.useState({}),{t:_}=A(["composite","common"]),j=l.useMemo(()=>Et({},m,x),[m,x]),k="features"in r&&r.features||[],E=l.useMemo(()=>{if(h==="composite"&&t!==void 0){if(t.length===1)return!0;if(t.length===2){const b=t[1].type;return b!=null&&b!=="composite"&&b!=="list"}}return!1},[h,t]);l.useEffect(()=>{p({})},[n.ieee_address]);const g=l.useCallback(b=>{p({...x,...b}),E||a(h==="composite"&&u?{[u]:{...x,...b}}:b)},[x,h,u,E,a]),d=l.useCallback(()=>{const b={...m,...x};a(u?{[u]:b}:b)},[u,a,x,m]),C=l.useCallback(b=>{h==="composite"?o==null||o(u?{[u]:b}:b):o==null||o(b)},[o,h,u]);return s.jsxs(s.Fragment,{children:[k.map(b=>s.jsx(Re,{feature:b,parentFeatures:t??[],device:n,deviceState:j,onChange:g,onRead:C,featureWrapperClass:c,minimal:f,steps:i==null?void 0:i[b.name]},Ut(b))),E&&s.jsx("div",{children:s.jsx(v,{className:`btn btn-primary ${f?" btn-sm":""}`,onClick:d,children:_("common:apply")})})]})}),Dt=l.memo(e=>s.jsx(N,{...e}));var U,ie;function Xt(){if(ie)return U;ie=1;function e(r,a,t){return r===r&&(t!==void 0&&(r=r<=t?r:t),a!==void 0&&(r=r>=a?r:a)),r}return U=e,U}var W,ue;function Yt(){if(ue)return W;ue=1;var e=/\s/;function r(a){for(var t=a.length;t--&&e.test(a.charAt(t)););return t}return W=r,W}var D,me;function Kt(){if(me)return D;me=1;var e=Yt(),r=/^\s+/;function a(t){return t&&t.slice(0,e(t)+1).replace(r,"")}return D=a,D}var X,fe;function Qt(){if(fe)return X;fe=1;var e=Kt(),r=Nt(),a=Rt(),t=NaN,o=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,m=/^0o[0-7]+$/i,c=parseInt;function f(i){if(typeof i=="number")return i;if(a(i))return t;if(r(i)){var h=typeof i.valueOf=="function"?i.valueOf():i;i=r(h)?h+"":h}if(typeof i!="string")return i===0?i:+i;i=e(i);var u=n.test(i);return u||m.test(i)?c(i.slice(2),u?2:8):o.test(i)?t:+i}return X=f,X}var Y,xe;function Zt(){if(xe)return Y;xe=1;var e=Xt(),r=Qt();function a(t,o,n){return n===void 0&&(n=o,o=void 0),n!==void 0&&(n=r(n),n=n===n?n:0),o!==void 0&&(o=r(o),o=o===o?o:0),e(r(t),o,n)}return Y=a,Y}var Jt=Zt();const T=J(Jt),er=[.412453,.35758,.180423,.212671,.71516,.072169,.019334,.119193,.950227],tr=[3.2404813432005266,-1.5371515162713183,-.49853632616888777,-.9692549499965684,1.8759900014898907,.041555926558292815,.05564663913517715,-.20404133836651123,1.0573110696453443],ye=.42,Ce=.0031308,je=12.92,H=.055,M=e=>e<=Ce?je*e:(1+H)*e**ye-H,rr=1/ye,ar=M(Ce),nr=1/je,K=e=>e<=ar?e*nr:((e+H)/(1+H))**rr,ve=(e,r)=>{const a=[0,0,0];for(let t=0;t<3;t++){a[t]=0;for(let o=0;o<3;o++)a[t]+=r[t*3+o]*e[o]}return a},he=(e,r,a)=>{const t=[K(e),K(r),K(a)];return ve(t,er)},sr=(e,r,a)=>{const t=ve([e,r,a],tr);return[M(t[0]),M(t[1]),M(t[2])]},Se=(e,r,a)=>{const t=1-e-r;return sr(a/r*e,a,a/r*t)},Te=(e,r,a=10)=>{let t=1;for(let o=0;o<a;o++){const n=Math.max(...Se(e,r,t));t=t/n}return t},I=(e,r,a)=>{if(e/=255,r/=255,a/=255,e<1e-12&&r<1e-12&&a<1e-12){const[c,f,i]=he(1,1,1),h=c+f+i;return[c/h,f/h,0]}const[t,o,n]=he(e,r,a),m=t+o+n;return[t/m,o/m,o]},or=(e,r,a)=>{a===void 0&&(a=Te(e,r));const[t,o,n]=Se(e,r,a);return[T(t*255,0,255),T(o*255,0,255),T(n*255,0,255)]},B=(e,r,a)=>{e/=255,r/=255,a/=255;const t=Math.max(e,r,a),o=t-Math.min(e,r,a),n=o?(t===e?(r-a)/o+(r<a?6:0):t===r?2+(a-e)/o:4+(e-r)/o)*60:0,m=t?o/t*100:0,c=t*100;return[T(n,0,360),T(m,0,100),T(c,0,100)]},cr=(e,r,a)=>{r/=100,a/=100;const t=~~(e/60),o=e/60-t,n=a*(1-r),m=a*(1-r*o),c=a*(1-r*(1-o)),f=t%6,i=[a,m,n,n,c,a][f]*255,h=[c,a,a,m,n,n][f]*255,u=[n,n,c,a,a,m][f]*255;return[T(i,0,255),T(h,0,255),T(u,0,255)]},q=(e,r,a)=>{const[t,o,n]=[e,r,a].map(m=>Math.round(m).toString(16).padStart(2,"0"));return`#${t}${o}${n}`},lr=e=>(e=e.slice(1),Array.from({length:3}).map((r,a)=>Number.parseInt(e.slice(a*2,a*2+2),16))),w=(e,r)=>{switch(r){case"color_xy":{const{x:a=.313,y:t=.329,Y:o=Te(a,t===0?.329:t)}=e,n=t===0?[255,255,255]:or(a,t,o);return{color_rgb:n,color_hs:B(...n),color_xy:[a,t,o],hex:q(...n)}}case"color_hs":{const{hue:a=0,saturation:t=0}=e,o=100,n=cr(a,t,o);return{color_rgb:n,color_hs:[a,t,o],color_xy:I(...n),hex:q(...n)}}case"color_rgb":{const{r:a=255,g:t=255,b:o=255}=e;return{color_rgb:[a,t,o],color_hs:B(a,t,o),color_xy:I(a,t,o),hex:q(a,t,o)}}case"hex":{const a=e,t=lr(a);return{color_rgb:t,color_hs:B(...t),color_xy:I(...t),hex:a}}default:{const a=[255,255,255];return{color_rgb:a,color_hs:B(...a),color_xy:I(...a),hex:q(...a)}}}},pe=(e,r)=>{switch(r){case"color_xy":return{x:e.color_xy[0],y:e.color_xy[1]};case"color_hs":return{hue:e.color_hs[0],saturation:e.color_hs[1]};case"color_rgb":return{r:e.color_rgb[0],g:e.color_rgb[1],b:e.color_rgb[2]};case"hex":return e.hex}},ke=e=>`${e[0].toFixed(3)}, ${e[1].toFixed(3)}, ${e[2].toFixed(3)}`,O=e=>`${e[0].toFixed(2)}°, ${e[1].toFixed(2)}%, ${e[2].toFixed(2)}%`,Ee=e=>`${e[0].toFixed(0)}, ${e[1].toFixed(0)}, ${e[2].toFixed(0)}`,Ne=e=>e,ge=e=>({color_xy:ke(e.color_xy),color_hs:O(e.color_hs),color_rgb:Ee(e.color_rgb),hex:Ne(e.hex)}),ir=e=>{const r=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((a,t)=>+(r[t]??0))},ur=e=>{const r=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((a,t)=>T(+(r[t]??0),0,t?100:360))},mr=e=>{const r=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((a,t)=>T(+(r[t]??0),0,255))},Q=(e,r)=>{switch(r){case"color_xy":{const a=ir(e);return w({x:a[0],y:a[1]},"color_xy")}case"color_hs":{const a=ur(e);return w({hue:a[0],saturation:a[1]},"color_hs")}case"color_rgb":{const a=mr(e);return w({r:a[0],g:a[1],b:a[2]},"color_rgb")}case"hex":return w(e,"hex")}},fr="linear-gradient(to right, white, transparent)",xr="linear-gradient(to right, rgb(255, 0, 0), rgb(255, 255, 0), rgb(0, 255, 0), rgb(0, 255, 255), rgb(0, 0, 255), rgb(255, 0, 255), rgb(255, 0, 0))",G=l.memo(({label:e,...r})=>s.jsxs("label",{className:"input",children:[e,s.jsx("input",{type:"text",className:"grow",...r})]})),we=l.memo(e=>{const{onChange:r,value:a={},format:t,minimal:o}=e,[n,m]=l.useState(w(a,t)),[c,f]=l.useState(ge(n)),[i,h]=l.useState({color_rgb:!1,color_hs:!1,color_xy:!1,hex:!1});l.useEffect(()=>{const g=w(a,t);m(g),f(ge(g))},[a,t]),l.useEffect(()=>{if(!i.color_xy){const g=ke(n.color_xy);f(d=>({...d,color_xy:g}))}},[i.color_xy,n.color_xy]),l.useEffect(()=>{if(!i.color_hs){const g=O(n.color_hs);f(d=>({...d,color_hs:g}))}},[i.color_hs,n.color_hs]),l.useEffect(()=>{if(!i.color_rgb){const g=Ee(n.color_rgb);f(d=>({...d,color_rgb:g}))}},[i.color_rgb,n.color_rgb]),l.useEffect(()=>{if(!i.hex){const g=Ne(n.hex);f(d=>({...d,hex:g}))}},[i.hex,n.hex]);const u=l.useCallback(g=>{if(g.target.value){const d=Array.from(n.color_hs);d[1]=g.target.valueAsNumber;const C=O(d);f(b=>({...b,color_hs:C})),m(Q(C,"color_hs"))}},[n.color_hs]),x=l.useCallback(g=>{if(g.target.value){const d=Array.from(n.color_hs),C=d[1];d[1]=C===0?100:C,d[0]=g.target.valueAsNumber;const b=O(d);f($e=>({...$e,color_hs:b})),m(Q(b,"color_hs"))}},[n.color_hs]),p=l.useCallback(g=>{const{value:d,name:C}=g.target;f(b=>({...b,[C]:d})),m(Q(d,C))},[]),_=l.useCallback(g=>{h(d=>({...d,[g.target.name]:!0}))},[]),j=l.useCallback(g=>{h(d=>({...d,[g.target.name]:!1})),r(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,r]),k=l.useCallback(()=>{r(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,r]),E=l.useMemo(()=>`hsl(${n.color_hs[0]}, 100%, 50%)`,[n.color_hs[0]]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:100,value:n.color_hs[1],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:fr,backgroundColor:E},onChange:u,onTouchEnd:k,onMouseUp:k})})}),s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:360,value:n.color_hs[0],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:xr},onChange:x,onTouchEnd:k,onMouseUp:k})})}),!o&&s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 justify-around",children:[s.jsx(G,{label:"hex",name:"hex",value:c.hex,onChange:p,onFocus:_,onBlur:j}),s.jsx(G,{label:"rgb",name:"color_rgb",value:c.color_rgb,onChange:p,onFocus:_,onBlur:j}),s.jsx(G,{label:"hsv",name:"color_hs",value:c.color_hs,onChange:p,onFocus:_,onBlur:j}),s.jsx(G,{label:"xyY",name:"color_xy",value:c.color_xy,onChange:p,onFocus:_,onBlur:j})]})]})}),hr=l.memo(e=>{const{deviceValue:r,feature:{name:a,features:t,property:o},onChange:n,minimal:m}=e,c=l.useMemo(()=>{const i={};for(const h of t)i[h.name]=(r==null?void 0:r[h.property])??0;return i},[r,t]),f=l.useCallback(i=>n({[o??"color"]:i}),[o,n]);return s.jsx(we,{onChange:f,value:c,format:a,minimal:m})}),pr={position:[0,25,50,75,100].map(e=>({value:e,name:`${e}`})),tilt:[0,25,50,75,100].map(e=>({value:e,name:`${e}`}))},gr=l.memo(e=>s.jsx(N,{...e,steps:pr}));function S(e){return typeof e!="object"}const Ae=l.memo(e=>{const{onChange:r,values:a,value:t,minimal:o}=e,{t:n}=A("common"),m=l.useCallback(c=>{const f=a.find(i=>S(i)?i===c.target.value:i.value===Number.parseInt(c.target.value,10));r(f)},[a,r]);return o?s.jsxs("select",{className:"select",onChange:m,value:S(t)?t:t==null?void 0:t.value,children:[s.jsx("option",{value:"",disabled:!0,children:n("select_value")}),a.map(c=>s.jsx("option",{value:S(c)?c:c.value,children:S(c)?c:c.name},S(c)?c:c.name))]}):s.jsx("div",{className:"join join-vertical lg:join-horizontal",children:a.map(c=>s.jsx(v,{className:`btn btn-soft btn-sm join-item${(S(c)?c===t:c.value===(S(t)?t:t==null?void 0:t.value))?" btn-active":""}`,onClick:f=>r(f),item:S(c)?c:c.value,title:S(c)?`${c}`:c.description,children:S(c)?s.jsx(V,{value:c,name:""}):c.name},S(c)?c:c.name))})}),dr=6,br=l.memo(e=>{const{onChange:r,feature:{access:a=y.SET,values:t,property:o},deviceValue:n,minimal:m}=e;return a&y.SET?s.jsx(Ae,{onChange:c=>r({[o]:c}),values:t,value:n||"",minimal:m||t.length>dr}):a&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),_r=l.memo(e=>s.jsx(N,{...e})),yr=l.memo(e=>{const{minimal:r,onChange:a,feature:{length_min:t,length_max:o,property:n},deviceValue:m}=e,{t:c}=A(["gradient","common"]),[f,i]=l.useState(t>0?Array(t).fill("#ffffff"):[]);l.useEffect(()=>{m&&Array.isArray(m)&&m.length>0&&i(m)},[m]);const h=l.useCallback((g,d)=>{const C=Array.from(f);C[g]=d,i(C)},[f]),u=l.useCallback(()=>{const g=Array.from(f);g.push("#ffffff"),i(g)},[f]),x=l.useCallback(g=>{const d=Array.from(f);d.splice(g,1),i(d)},[f]),p=l.useCallback(()=>a({[n??"gradient"]:f}),[f,n,a]),[_,j]=l.useState(!1),[k,E]=l.useState(!1);return l.useEffect(()=>{j(f.length<o),E(f.length>t)},[f,t,o]),s.jsxs("div",{className:"flex flex-col gap-2",children:[f.map((g,d)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 items-center",children:[s.jsx(we,{onChange:C=>{h(d,C.hex)},value:g,format:"hex"}),k&&s.jsx(v,{className:"btn btn-error",onClick:()=>x(d),children:"-"})]},`${g}-${d}`)),_&&s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(v,{className:"btn btn-success",onClick:u,children:"+"})}),s.jsx("div",{children:s.jsx(v,{className:`btn btn-primary ${r?" btn-sm":""}`,onClick:p,children:c("common:apply")})})]})}),Cr={brightness:[0,25,50,75,100].map(e=>({value:wt(e,[0,100],[0,255]),name:`${e}%`})),color_temp:[1e3,2e3,3e3,4e3,5e3,6500].map(e=>({value:1e6/e,name:`${e}K`}))},jr=l.memo(e=>s.jsx(N,{...e,steps:Cr}));function vr(e){return e.type==="composite"&&(e.name==="color_xy"||e.name==="color_hs")}const Sr=l.memo(e=>{var p;const{t:r}=A(["featureDescriptions","featureNames","zigbee"]),{children:a,feature:t,deviceValue:o,onRead:n}=e,m=t.unit,c=l.useMemo(()=>zt(t.name,o,m),[m,t.name,o]),f=l.useMemo(()=>t.property&&t.access&y.GET||vr(t),[t]),i=(p=e.parentFeatures)==null?void 0:p[e.parentFeatures.length-1],h=t.name==="state"?t.property:t.name;let u=t.label||r(`featureNames:${h}`,{defaultValue:Ot(qt(h))});i!=null&&i.label&&t.name==="state"&&i.type!=="light"&&i.type!=="switch"&&(u=`${i.label} ${t.label.charAt(0).toLowerCase()}${t.label.slice(1)}`);const x=l.useCallback(_=>{_.property&&(n==null||n({[_.property]:""}))},[n]);return s.jsxs("div",{className:"list-row",children:[s.jsx("div",{children:s.jsx(Z,{icon:c[0],fixedWidth:!0,className:c[1],...c[2],size:"2xl"})}),s.jsxs("div",{children:[s.jsxs("div",{children:[u,t.endpoint?` (${r("zigbee:endpoint")}: ${t.endpoint})`:""]}),s.jsx("div",{className:"text-xs font-semibold opacity-60",children:t.description&&r(t.description)})]}),s.jsx("div",{className:"list-col-wrap flex flex-col gap-2",children:a}),f&&s.jsx(v,{item:t,onClick:x,className:"btn btn-xs btn-square btn-primary",children:s.jsx(Z,{icon:At})})]})}),Tr=l.memo(e=>{const{onChange:r,value:a,feature:t,parentFeatures:o}=e,[n,m]=l.useState(a);l.useEffect(()=>{m(a)},[a]);const c=l.useCallback(u=>{m(u),r(u)},[r]),f=l.useCallback((u,x)=>{const p=Array.from(n);typeof u=="object"&&(u={...n[x],...u}),p[x]=u,c(p)},[n,c]),i=l.useCallback(u=>{const x=Array.from(n);x.splice(u,1),c(x)},[n,c]),h=l.useCallback(()=>m([...n,{}]),[n]);return n.length===0?s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(v,{className:"btn btn-success col-1",onClick:h,children:"+"})}):s.jsx(s.Fragment,{children:n.map((u,x)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2",children:[s.jsx(Re,{feature:t,device:{},deviceState:u,onChange:p=>f(p,x),onRead:p=>{},featureWrapperClass:Sr,parentFeatures:o}),s.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[s.jsx(v,{item:x,className:"btn btn-error btn-square join-item",onClick:i,children:"-"}),n.length-1===x&&s.jsx(v,{className:"btn btn-success btn-square join-item",onClick:h,children:"+"})]})]},x))})}),kr=l.memo(e=>{const{feature:r,minimal:a,parentFeatures:t,onChange:o,deviceValue:n}=e,[m,c]=l.useState({value:r.property?(n==null?void 0:n[r.property])??[]:[]}),{t:f}=A(["list","common"]),i=l.useMemo(()=>{if(t!==void 0){if(t.length===1)return!0;if(t.length===2){const _=t[1].type;return _!=null&&_!=="composite"&&_!=="list"}}return!1},[t]),h=l.useCallback(_=>{c({value:_}),i||o(r.property?{[r.property]:_}:_)},[r.property,o,i]),u=l.useCallback(()=>{o(r.property?{[r.property]:m.value}:m.value)},[r.property,o,m.value]),{access:x=y.SET,item_type:p}=r;return x&y.SET?s.jsxs(s.Fragment,{children:[s.jsx(Tr,{feature:p,parentFeatures:[...t,r],onChange:h,value:m.value}),i&&s.jsx("div",{children:s.jsx(v,{className:`btn btn-primary ${a?" btn-sm":""}`,onClick:u,disabled:m.value.length===0,children:f("common:apply")})})]}):x&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),Er=l.memo(e=>s.jsx(N,{...e})),Nr=l.memo(e=>{const{onChange:r,value:a,valueStep:t,min:o,max:n,unit:m,steps:c,minimal:f,...i}=e,[h,u]=l.useState(a),x=o!=null&&n!=null;l.useEffect(()=>{u(a)},[a]);const p=l.useCallback(j=>!!j.target.value&&u(j.target.valueAsNumber),[]),_=l.useCallback(j=>!j.target.validationMessage&&r(h),[h,r]);return s.jsxs("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:[!f&&c?s.jsx(Ae,{values:c,onChange:r,value:h}):null,x?s.jsxs("div",{className:"w-full max-w-xs",children:[s.jsx("input",{min:o,max:n,step:t,type:"range",className:"range range-xs range-primary validator",value:h,onChange:p,onTouchEnd:_,onMouseUp:_,...i}),s.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[s.jsx("span",{children:o}),f&&s.jsx("span",{children:h}),s.jsx("span",{children:n})]})]}):null,(!f||!x)&&s.jsxs("label",{className:"input",children:[s.jsx("input",{type:"number",className:"grow validator",value:h,step:t,onChange:p,onBlur:_,min:o,max:n,...i}),m]})]})}),wr=l.memo(e=>{const{feature:{presets:r,access:a=y.SET,property:t,unit:o,value_max:n,value_min:m,value_step:c},deviceValue:f,steps:i,onChange:h,minimal:u}=e;return a&y.SET?s.jsx(Nr,{onChange:x=>h({[t]:x}),value:f??"",min:m,max:n,step:c,steps:r!=null&&r.length?r:i,unit:o,minimal:u}):a&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),Ar=l.memo(e=>s.jsx(N,{...e})),Rr=l.memo(e=>{const{onChange:r,value:a,...t}=e,[o,n]=l.useState(a);return l.useEffect(()=>{n(a)},[a]),s.jsx("input",{type:"text",className:"input validator",value:o,onChange:m=>n(m.target.value),onBlur:m=>!m.target.validationMessage&&r(o),...t})}),$r=l.memo(e=>{const{feature:{access:r=y.SET,property:a},deviceValue:t,onChange:o}=e;return r&y.SET?s.jsx(Rr,{onChange:n=>o({[a]:n}),value:t??""}):r&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),Fr=e=>`${e.type}-${e.name}-${e.label}-${e.access}-${e.category}-${e.property}-${e.endpoint}`,Re=l.memo(e=>{const{feature:r,device:a,deviceState:t,steps:o,onRead:n,onChange:m,featureWrapperClass:c,minimal:f,parentFeatures:i}=e,h=l.useMemo(()=>r.property?t[r.property]:void 0,[r.property,t[r.property]]),u=l.useMemo(()=>Fr(r),[r]),x=l.useMemo(()=>({device:a,deviceValue:h,onChange:m,onRead:n,featureWrapperClass:c,minimal:f,parentFeatures:i}),[a,h,m,n,c,f,i]),p=l.useMemo(()=>({feature:r,onRead:n,deviceValue:h,parentFeatures:i}),[r,n,h,i]);switch(r.type){case"binary":return s.jsx(c,{...p,children:s.jsx(Wt,{feature:r,...x},u)},u);case"numeric":return s.jsx(c,{...p,children:s.jsx(wr,{feature:r,...x,steps:o},u)},u);case"list":return r.name==="gradient"&&r.length_min!=null&&r.length_max!=null?s.jsx(c,{...p,children:s.jsx(yr,{feature:r,...x},u)},u):s.jsx(c,{...p,children:s.jsx(kr,{feature:r,...x},u)},u);case"text":return s.jsx(c,{...p,children:s.jsx($r,{feature:r,...x},u)},u);case"enum":return s.jsx(c,{...p,children:s.jsx(br,{feature:r,...x},u)},u);case"light":return s.jsx(jr,{feature:r,...x,deviceState:t},u);case"switch":return s.jsx(Ar,{feature:r,...x,deviceState:t},u);case"cover":return s.jsx(gr,{feature:r,...x,deviceState:t},u);case"lock":return s.jsx(Er,{feature:r,...x,deviceState:t},u);case"climate":return s.jsx(Dt,{feature:r,...x,deviceState:t},u);case"fan":return s.jsx(_r,{feature:r,...x,deviceState:t},u);case"composite":{if(r.name==="color_xy"||r.name==="color_hs")return s.jsx(c,{...p,children:s.jsx(hr,{feature:r,...x},u)},u);const _=i&&r.property?t[r.property]:t;return s.jsx(N,{feature:r,...x,deviceState:_},u)}default:return console.error("Unsupported feature",r),s.jsx(c,{...p,children:s.jsx("pre",{children:JSON.stringify(r,null,4)})},u)}});export{Re as F,Sr as a,y as b,zt as c,qt as d,Ut as g,Ot as s};
1
+ import{aa as J,aM as Fe,aN as Ie,aO as Be,l as qe,aP as Ge,aQ as Me,aR as Oe,aS as Ve,aT as He,aD as ee,aU as te,aV as Pe,aW as Le,aX as ze,aY as De,aZ as Ue,a_ as We,a$ as re,b0 as Xe,b1 as ae,b2 as Ye,b3 as Qe,b4 as P,b5 as ne,b6 as se,Y as Ke,b7 as Ze,b8 as Je,b9 as et,ba as tt,bb as rt,bc as at,bd as nt,be as st,bf as ot,bg as ct,bh as lt,bi as it,bj as ut,bk as mt,bl as ft,bm as xt,bn as ht,bo as pt,bp as gt,bq as R,aF as dt,br as oe,bs as bt,bt as _t,bu as yt,bv as Ct,bw as de,bx as jt,by as be,bz as vt,bA as St,bB as Tt,r as l,j as s,b as A,B as v,F as Z,bC as kt,am as Et,bD as Nt,bE as wt,J as At}from"./index-Cs-KexR1.js";import{D as V}from"./DisplayValue-CjZXHxIO.js";import{r as _e,a as Rt}from"./_createCompounder-COpq92ed.js";import{r as $t,a as Ft}from"./capitalize-JuEfl3u2.js";var L,ce;function It(){if(ce)return L;ce=1;var e=$t(),r=_e(),a=r(function(t,o,n){return o=o.toLowerCase(),t+(n?e(o):o)});return L=a,L}var Bt=It();const qt=J(Bt);var z,le;function Gt(){if(le)return z;le=1;var e=_e(),r=Ft(),a=e(function(t,o,n){return t+(n?" ":"")+r(o)});return z=a,z}var Mt=Gt();const Ot=J(Mt),Vt={battery_low:R,humidity:gt,illuminance:P,pressure:pt,co2:ht,voltage:xt,state:ft,brightness:P,occupancy:mt,presence:ut,current:it,power:lt,energy:ct,frequency:ot,tamper:st,smoke:nt,radiation_dose_per_hour:at,radioactive_events_per_minute:rt,power_factor:tt,mode:et,sound:Je,position:Ze,alarm:Ke,color_xy:se,color_hs:se,color_temp:ne,color_temp_startup:ne,illuminance_lux:P,soil_moisture:Qe,water_leak:re,week:Ye,workdays_schedule:ae,holidays_schedule:ae,away_mode:Xe,vibration:re,power_outage_count:We,action:Ue,angle_x:De,angle_y:ze,angle_z:Le,side:Pe,humidity_alarm:te,temperature_alarm:te,approach_distance:ee,distance:ee,trigger_count:He,level_config:Ve,station:Oe,effect:Me,linkquality:Ge,system_mode:qe,gradient:Be,sensitivity:Ie,test:Fe},Ht=(e,r)=>{let a=R;return e==null||(e>=85?(a=de,r.push("text-success")):e>=65?a=jt:e>=40?a=be:e>=20?a=vt:(a=R,r.push("text-error"))),a},Pt=(e,r)=>{let a=R;switch(e){case"high":{a=de,r.push("text-success");break}case"medium":{a=be;break}case"low":{a=R,r.push("text-error");break}}return a},Lt=(e,r,a)=>{let t=oe;return e==null||(r==="°F"&&(e=(e-32)/1.8),e>=30?(t=bt,a.push("text-error")):e>=25?t=_t:e>=20?t=yt:e>=15?t=Ct:e<5&&(t=oe,a.push("text-info"))),t},zt=(e,r,a)=>{let t;const o=[],n={};switch(e){case"battery":{t=Ht(r,o);break}case"battery_state":{t=Pt(r,o);break}case"battery_low":{r&&o.push("text-error");break}case"device_temperature":case"temperature":case"local_temperature":{t=Lt(r,a,o);break}case"humidity":{r!=null&&r>60&&o.push("text-info");break}case"contact":{t=r?St:Tt,r||o.push("text-primary");break}case"occupancy":{r&&(o.push("text-warning"),n.beat=!0);break}case"presence":{r&&(o.push("text-warning"),n.beat=!0);break}case"tamper":{r&&(o.push("text-error"),n.beatFade=!0,n.shake=!0);break}case"water_leak":{r&&(o.push("text-primary"),n.beatFade=!0);break}case"vibration":{r&&(o.push("text-primary"),n.shake=!0);break}}return t?[t,o.join(" "),n]:(t=Vt[e],t?[t,o.join(" "),n]:[dt,"opacity-0",{}])},Dt=e=>`${e.type}-${e.name}-${e.label}-${e.property}-${e.access}-${e.category}-${e.endpoint}`;var y=(e=>(e[e.STATE=1]="STATE",e[e.SET=2]="SET",e[e.GET=4]="GET",e[e.STATE_SET=3]="STATE_SET",e[e.STATE_GET=5]="STATE_GET",e[e.ALL=7]="ALL",e))(y||{});const $=l.memo(({feature:e,deviceValue:r})=>s.jsxs("div",{children:[e.property&&s.jsx("span",{className:"font-bold",children:s.jsx(V,{value:r,name:e.name})}),"unit"in e&&s.jsx("span",{className:"text-xs ms-1",children:e.unit})]})),F=l.memo(e=>s.jsxs("div",{className:"alert alert-warning",role:"alert",children:["Unknown access ",s.jsx("pre",{children:e.feature.access})]})),Ut=l.memo(e=>{const{feature:{access:r=y.SET,name:a,property:t,value_off:o,value_on:n},deviceValue:m,onChange:c,minimal:f}=e,{t:i}=A("zigbee"),h=l.useCallback(x=>c({[t]:x}),[t,c]),u=l.useCallback(x=>c({[t]:x.target.checked?n:o}),[n,o,t,c]);if(r&y.SET){const x=m!=null,p=!f||f&&!x;return s.jsxs("div",{children:[p&&s.jsx(v,{className:"btn btn-link",item:o,onClick:h,children:s.jsx(V,{value:o,name:a})}),x?s.jsx("input",{className:"toggle",type:"checkbox",checked:m===n,onChange:u}):s.jsx(Z,{icon:kt,title:i("unknown")}),p&&s.jsx(v,{className:"btn btn-link",item:n,onClick:h,children:s.jsx(V,{value:n,name:a})})]})}return r&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),N=l.memo(e=>{const{feature:r,onChange:a,parentFeatures:t,onRead:o,device:n,deviceState:m,featureWrapperClass:c,minimal:f,steps:i}=e,{type:h,property:u}=r,[x,p]=l.useState({}),{t:_}=A(["composite","common"]),j=l.useMemo(()=>Et({},m,x),[m,x]),k="features"in r&&r.features||[],E=l.useMemo(()=>{if(h==="composite"&&t!==void 0){if(t.length===1)return!0;if(t.length===2){const b=t[1].type;return b!=null&&b!=="composite"&&b!=="list"}}return!1},[h,t]);l.useEffect(()=>{p({})},[n.ieee_address]);const g=l.useCallback(b=>{p({...x,...b}),E||a(h==="composite"&&u?{[u]:{...x,...b}}:b)},[x,h,u,E,a]),d=l.useCallback(()=>{const b={...m,...x};a(u?{[u]:b}:b)},[u,a,x,m]),C=l.useCallback(b=>{h==="composite"?o==null||o(u?{[u]:b}:b):o==null||o(b)},[o,h,u]);return s.jsxs(s.Fragment,{children:[k.map(b=>s.jsx(Re,{feature:b,parentFeatures:t??[],device:n,deviceState:j,onChange:g,onRead:C,featureWrapperClass:c,minimal:f,steps:i==null?void 0:i[b.name]},Dt(b))),E&&s.jsx("div",{children:s.jsx(v,{className:`btn btn-primary ${f?" btn-sm":""}`,onClick:d,children:_("common:apply")})})]})}),Wt=l.memo(e=>s.jsx(N,{...e}));var D,ie;function Xt(){if(ie)return D;ie=1;function e(r,a,t){return r===r&&(t!==void 0&&(r=r<=t?r:t),a!==void 0&&(r=r>=a?r:a)),r}return D=e,D}var U,ue;function Yt(){if(ue)return U;ue=1;var e=/\s/;function r(a){for(var t=a.length;t--&&e.test(a.charAt(t)););return t}return U=r,U}var W,me;function Qt(){if(me)return W;me=1;var e=Yt(),r=/^\s+/;function a(t){return t&&t.slice(0,e(t)+1).replace(r,"")}return W=a,W}var X,fe;function Kt(){if(fe)return X;fe=1;var e=Qt(),r=Nt(),a=Rt(),t=NaN,o=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,m=/^0o[0-7]+$/i,c=parseInt;function f(i){if(typeof i=="number")return i;if(a(i))return t;if(r(i)){var h=typeof i.valueOf=="function"?i.valueOf():i;i=r(h)?h+"":h}if(typeof i!="string")return i===0?i:+i;i=e(i);var u=n.test(i);return u||m.test(i)?c(i.slice(2),u?2:8):o.test(i)?t:+i}return X=f,X}var Y,xe;function Zt(){if(xe)return Y;xe=1;var e=Xt(),r=Kt();function a(t,o,n){return n===void 0&&(n=o,o=void 0),n!==void 0&&(n=r(n),n=n===n?n:0),o!==void 0&&(o=r(o),o=o===o?o:0),e(r(t),o,n)}return Y=a,Y}var Jt=Zt();const T=J(Jt),er=[.412453,.35758,.180423,.212671,.71516,.072169,.019334,.119193,.950227],tr=[3.2404813432005266,-1.5371515162713183,-.49853632616888777,-.9692549499965684,1.8759900014898907,.041555926558292815,.05564663913517715,-.20404133836651123,1.0573110696453443],ye=.42,Ce=.0031308,je=12.92,H=.055,M=e=>e<=Ce?je*e:(1+H)*e**ye-H,rr=1/ye,ar=M(Ce),nr=1/je,Q=e=>e<=ar?e*nr:((e+H)/(1+H))**rr,ve=(e,r)=>{const a=[0,0,0];for(let t=0;t<3;t++){a[t]=0;for(let o=0;o<3;o++)a[t]+=r[t*3+o]*e[o]}return a},he=(e,r,a)=>{const t=[Q(e),Q(r),Q(a)];return ve(t,er)},sr=(e,r,a)=>{const t=ve([e,r,a],tr);return[M(t[0]),M(t[1]),M(t[2])]},Se=(e,r,a)=>{const t=1-e-r;return sr(a/r*e,a,a/r*t)},Te=(e,r,a=10)=>{let t=1;for(let o=0;o<a;o++){const n=Math.max(...Se(e,r,t));t=t/n}return t},I=(e,r,a)=>{if(e/=255,r/=255,a/=255,e<1e-12&&r<1e-12&&a<1e-12){const[c,f,i]=he(1,1,1),h=c+f+i;return[c/h,f/h,0]}const[t,o,n]=he(e,r,a),m=t+o+n;return[t/m,o/m,o]},or=(e,r,a)=>{a===void 0&&(a=Te(e,r));const[t,o,n]=Se(e,r,a);return[T(t*255,0,255),T(o*255,0,255),T(n*255,0,255)]},B=(e,r,a)=>{e/=255,r/=255,a/=255;const t=Math.max(e,r,a),o=t-Math.min(e,r,a),n=o?(t===e?(r-a)/o+(r<a?6:0):t===r?2+(a-e)/o:4+(e-r)/o)*60:0,m=t?o/t*100:0,c=t*100;return[T(n,0,360),T(m,0,100),T(c,0,100)]},cr=(e,r,a)=>{r/=100,a/=100;const t=~~(e/60),o=e/60-t,n=a*(1-r),m=a*(1-r*o),c=a*(1-r*(1-o)),f=t%6,i=[a,m,n,n,c,a][f]*255,h=[c,a,a,m,n,n][f]*255,u=[n,n,c,a,a,m][f]*255;return[T(i,0,255),T(h,0,255),T(u,0,255)]},q=(e,r,a)=>{const[t,o,n]=[e,r,a].map(m=>Math.round(m).toString(16).padStart(2,"0"));return`#${t}${o}${n}`},lr=e=>(e=e.slice(1),Array.from({length:3}).map((r,a)=>Number.parseInt(e.slice(a*2,a*2+2),16))),w=(e,r)=>{switch(r){case"color_xy":{const{x:a=.313,y:t=.329,Y:o=Te(a,t===0?.329:t)}=e,n=t===0?[255,255,255]:or(a,t,o);return{color_rgb:n,color_hs:B(...n),color_xy:[a,t,o],hex:q(...n)}}case"color_hs":{const{hue:a=0,saturation:t=0}=e,o=100,n=cr(a,t,o);return{color_rgb:n,color_hs:[a,t,o],color_xy:I(...n),hex:q(...n)}}case"color_rgb":{const{r:a=255,g:t=255,b:o=255}=e;return{color_rgb:[a,t,o],color_hs:B(a,t,o),color_xy:I(a,t,o),hex:q(a,t,o)}}case"hex":{const a=e,t=lr(a);return{color_rgb:t,color_hs:B(...t),color_xy:I(...t),hex:a}}default:{const a=[255,255,255];return{color_rgb:a,color_hs:B(...a),color_xy:I(...a),hex:q(...a)}}}},pe=(e,r)=>{switch(r){case"color_xy":return{x:e.color_xy[0],y:e.color_xy[1]};case"color_hs":return{hue:e.color_hs[0],saturation:e.color_hs[1]};case"color_rgb":return{r:e.color_rgb[0],g:e.color_rgb[1],b:e.color_rgb[2]};case"hex":return e.hex}},ke=e=>`${e[0].toFixed(3)}, ${e[1].toFixed(3)}, ${e[2].toFixed(3)}`,O=e=>`${e[0].toFixed(2)}°, ${e[1].toFixed(2)}%, ${e[2].toFixed(2)}%`,Ee=e=>`${e[0].toFixed(0)}, ${e[1].toFixed(0)}, ${e[2].toFixed(0)}`,Ne=e=>e,ge=e=>({color_xy:ke(e.color_xy),color_hs:O(e.color_hs),color_rgb:Ee(e.color_rgb),hex:Ne(e.hex)}),ir=e=>{const r=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((a,t)=>+(r[t]??0))},ur=e=>{const r=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((a,t)=>T(+(r[t]??0),0,t?100:360))},mr=e=>{const r=e.match(/\d+(\.\d+)?/gu)??[];return Array.from({length:3}).map((a,t)=>T(+(r[t]??0),0,255))},K=(e,r)=>{switch(r){case"color_xy":{const a=ir(e);return w({x:a[0],y:a[1]},"color_xy")}case"color_hs":{const a=ur(e);return w({hue:a[0],saturation:a[1]},"color_hs")}case"color_rgb":{const a=mr(e);return w({r:a[0],g:a[1],b:a[2]},"color_rgb")}case"hex":return w(e,"hex")}},fr="linear-gradient(to right, white, transparent)",xr="linear-gradient(to right, rgb(255, 0, 0), rgb(255, 255, 0), rgb(0, 255, 0), rgb(0, 255, 255), rgb(0, 0, 255), rgb(255, 0, 255), rgb(255, 0, 0))",G=l.memo(({label:e,...r})=>s.jsxs("label",{className:"input",children:[e,s.jsx("input",{type:"text",className:"grow",...r})]})),we=l.memo(e=>{const{onChange:r,value:a={},format:t,minimal:o}=e,[n,m]=l.useState(w(a,t)),[c,f]=l.useState(ge(n)),[i,h]=l.useState({color_rgb:!1,color_hs:!1,color_xy:!1,hex:!1});l.useEffect(()=>{const g=w(a,t);m(g),f(ge(g))},[a,t]),l.useEffect(()=>{if(!i.color_xy){const g=ke(n.color_xy);f(d=>({...d,color_xy:g}))}},[i.color_xy,n.color_xy]),l.useEffect(()=>{if(!i.color_hs){const g=O(n.color_hs);f(d=>({...d,color_hs:g}))}},[i.color_hs,n.color_hs]),l.useEffect(()=>{if(!i.color_rgb){const g=Ee(n.color_rgb);f(d=>({...d,color_rgb:g}))}},[i.color_rgb,n.color_rgb]),l.useEffect(()=>{if(!i.hex){const g=Ne(n.hex);f(d=>({...d,hex:g}))}},[i.hex,n.hex]);const u=l.useCallback(g=>{if(g.target.value){const d=Array.from(n.color_hs);d[1]=g.target.valueAsNumber;const C=O(d);f(b=>({...b,color_hs:C})),m(K(C,"color_hs"))}},[n.color_hs]),x=l.useCallback(g=>{if(g.target.value){const d=Array.from(n.color_hs),C=d[1];d[1]=C===0?100:C,d[0]=g.target.valueAsNumber;const b=O(d);f($e=>({...$e,color_hs:b})),m(K(b,"color_hs"))}},[n.color_hs]),p=l.useCallback(g=>{const{value:d,name:C}=g.target;f(b=>({...b,[C]:d})),m(K(d,C))},[]),_=l.useCallback(g=>{h(d=>({...d,[g.target.name]:!0}))},[]),j=l.useCallback(g=>{h(d=>({...d,[g.target.name]:!1})),r(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,r]),k=l.useCallback(()=>{r(t==="hex"?{hex:n.hex}:pe(n,t))},[n,t,r]),E=l.useMemo(()=>`hsl(${n.color_hs[0]}, 100%, 50%)`,[n.color_hs[0]]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:100,value:n.color_hs[1],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:fr,backgroundColor:E},onChange:u,onTouchEnd:k,onMouseUp:k})})}),s.jsx("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:s.jsx("div",{className:`w-full${o?" max-w-xs":""}`,children:s.jsx("input",{type:"range",min:0,max:360,value:n.color_hs[0],className:`range [--range-bg:transparent] [--range-fill:0] w-full${o?" range-xs ":""}`,style:{backgroundImage:xr},onChange:x,onTouchEnd:k,onMouseUp:k})})}),!o&&s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 justify-around",children:[s.jsx(G,{label:"hex",name:"hex",value:c.hex,onChange:p,onFocus:_,onBlur:j}),s.jsx(G,{label:"rgb",name:"color_rgb",value:c.color_rgb,onChange:p,onFocus:_,onBlur:j}),s.jsx(G,{label:"hsv",name:"color_hs",value:c.color_hs,onChange:p,onFocus:_,onBlur:j}),s.jsx(G,{label:"xyY",name:"color_xy",value:c.color_xy,onChange:p,onFocus:_,onBlur:j})]})]})}),hr=l.memo(e=>{const{deviceValue:r,feature:{name:a,features:t,property:o},onChange:n,minimal:m}=e,c=l.useMemo(()=>{const i={};for(const h of t)i[h.name]=(r==null?void 0:r[h.property])??0;return i},[r,t]),f=l.useCallback(i=>n({[o??"color"]:i}),[o,n]);return s.jsx(we,{onChange:f,value:c,format:a,minimal:m})}),pr={position:[0,25,50,75,100].map(e=>({value:e,name:`${e}`})),tilt:[0,25,50,75,100].map(e=>({value:e,name:`${e}`}))},gr=l.memo(e=>s.jsx(N,{...e,steps:pr}));function S(e){return typeof e!="object"}const Ae=l.memo(e=>{const{onChange:r,values:a,value:t,minimal:o}=e,{t:n}=A("common"),m=l.useCallback(c=>{const f=a.find(i=>S(i)?i===c.target.value:i.value===Number.parseInt(c.target.value,10));r(f)},[a,r]);return o?s.jsxs("select",{className:"select",onChange:m,value:S(t)?t:t==null?void 0:t.value,children:[s.jsx("option",{value:"",disabled:!0,children:n("select_value")}),a.map(c=>s.jsx("option",{value:S(c)?c:c.value,children:S(c)?c:c.name},S(c)?c:c.name))]}):s.jsx("div",{className:"join join-vertical lg:join-horizontal",children:a.map(c=>s.jsx(v,{className:`btn btn-soft btn-sm join-item${(S(c)?c===t:c.value===(S(t)?t:t==null?void 0:t.value))?" btn-active":""}`,onClick:f=>r(f),item:S(c)?c:c.value,title:S(c)?`${c}`:c.description,children:S(c)?s.jsx(V,{value:c,name:""}):c.name},S(c)?c:c.name))})}),dr=6,br=l.memo(e=>{const{onChange:r,feature:{access:a=y.SET,values:t,property:o},deviceValue:n,minimal:m}=e;return a&y.SET?s.jsx(Ae,{onChange:c=>r({[o]:c}),values:t,value:n||"",minimal:m||t.length>dr}):a&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),_r=l.memo(e=>s.jsx(N,{...e})),yr=l.memo(e=>{const{minimal:r,onChange:a,feature:{length_min:t,length_max:o,property:n},deviceValue:m}=e,{t:c}=A(["gradient","common"]),[f,i]=l.useState(t>0?Array(t).fill("#ffffff"):[]);l.useEffect(()=>{m&&Array.isArray(m)&&m.length>0&&i(m)},[m]);const h=l.useCallback((g,d)=>{const C=Array.from(f);C[g]=d,i(C)},[f]),u=l.useCallback(()=>{const g=Array.from(f);g.push("#ffffff"),i(g)},[f]),x=l.useCallback(g=>{const d=Array.from(f);d.splice(g,1),i(d)},[f]),p=l.useCallback(()=>a({[n??"gradient"]:f}),[f,n,a]),[_,j]=l.useState(!1),[k,E]=l.useState(!1);return l.useEffect(()=>{j(f.length<o),E(f.length>t)},[f,t,o]),s.jsxs("div",{className:"flex flex-col gap-2",children:[f.map((g,d)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2 items-center",children:[s.jsx(we,{onChange:C=>{h(d,C.hex)},value:g,format:"hex"}),k&&s.jsx(v,{className:"btn btn-error",onClick:()=>x(d),children:"-"})]},`${g}-${d}`)),_&&s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(v,{className:"btn btn-success",onClick:u,children:"+"})}),s.jsx("div",{children:s.jsx(v,{className:`btn btn-primary ${r?" btn-sm":""}`,onClick:p,children:c("common:apply")})})]})}),Cr={brightness:[0,25,50,75,100].map(e=>({value:wt(e,[0,100],[0,255]),name:`${e}%`})),color_temp:[1e3,2e3,3e3,4e3,5e3,6500].map(e=>({value:1e6/e,name:`${e}K`}))},jr=l.memo(e=>s.jsx(N,{...e,steps:Cr}));function vr(e){return e.type==="composite"&&(e.name==="color_xy"||e.name==="color_hs")}const Sr=l.memo(e=>{var p;const{t:r}=A(["featureDescriptions","featureNames","zigbee"]),{children:a,feature:t,deviceValue:o,onRead:n}=e,m=t.unit,c=l.useMemo(()=>zt(t.name,o,m),[m,t.name,o]),f=l.useMemo(()=>t.property&&t.access&y.GET||vr(t),[t]),i=(p=e.parentFeatures)==null?void 0:p[e.parentFeatures.length-1],h=t.name==="state"?t.property:t.name;let u=t.label||r(`featureNames:${h}`,{defaultValue:Ot(qt(h))});i!=null&&i.label&&t.name==="state"&&i.type!=="light"&&i.type!=="switch"&&(u=`${i.label} ${t.label.charAt(0).toLowerCase()}${t.label.slice(1)}`);const x=l.useCallback(_=>{_.property&&(n==null||n({[_.property]:""}))},[n]);return s.jsxs("div",{className:"list-row",children:[s.jsx("div",{children:s.jsx(Z,{icon:c[0],fixedWidth:!0,className:c[1],...c[2],size:"2xl"})}),s.jsxs("div",{children:[s.jsxs("div",{children:[u,t.endpoint?` (${r("zigbee:endpoint")}: ${t.endpoint})`:""]}),s.jsx("div",{className:"text-xs font-semibold opacity-60",children:t.description&&r(t.description)})]}),s.jsx("div",{className:"list-col-wrap flex flex-col gap-2",children:a}),f&&s.jsx(v,{item:t,onClick:x,className:"btn btn-xs btn-square btn-primary",children:s.jsx(Z,{icon:At})})]})}),Tr=l.memo(e=>{const{onChange:r,value:a,feature:t,parentFeatures:o}=e,[n,m]=l.useState(a);l.useEffect(()=>{m(a)},[a]);const c=l.useCallback(u=>{m(u),r(u)},[r]),f=l.useCallback((u,x)=>{const p=Array.from(n);typeof u=="object"&&(u={...n[x],...u}),p[x]=u,c(p)},[n,c]),i=l.useCallback(u=>{const x=Array.from(n);x.splice(u,1),c(x)},[n,c]),h=l.useCallback(()=>m([...n,{}]),[n]);return n.length===0?s.jsx("div",{className:"flex flex-row flex-wrap gap-2",children:s.jsx(v,{className:"btn btn-success col-1",onClick:h,children:"+"})}):s.jsx(s.Fragment,{children:n.map((u,x)=>s.jsxs("div",{className:"flex flex-row flex-wrap gap-2",children:[s.jsx(Re,{feature:t,device:{},deviceState:u,onChange:p=>f(p,x),onRead:p=>{},featureWrapperClass:Sr,parentFeatures:o}),s.jsxs("div",{className:"join join-vertical lg:join-horizontal",children:[s.jsx(v,{item:x,className:"btn btn-error btn-square join-item",onClick:i,children:"-"}),n.length-1===x&&s.jsx(v,{className:"btn btn-success btn-square join-item",onClick:h,children:"+"})]})]},x))})}),kr=l.memo(e=>{const{feature:r,minimal:a,parentFeatures:t,onChange:o,deviceValue:n}=e,[m,c]=l.useState({value:r.property?(n==null?void 0:n[r.property])??[]:[]}),{t:f}=A(["list","common"]),i=l.useMemo(()=>{if(t!==void 0){if(t.length===1)return!0;if(t.length===2){const _=t[1].type;return _!=null&&_!=="composite"&&_!=="list"}}return!1},[t]),h=l.useCallback(_=>{c({value:_}),i||o(r.property?{[r.property]:_}:_)},[r.property,o,i]),u=l.useCallback(()=>{o(r.property?{[r.property]:m.value}:m.value)},[r.property,o,m.value]),{access:x=y.SET,item_type:p}=r;return x&y.SET?s.jsxs(s.Fragment,{children:[s.jsx(Tr,{feature:p,parentFeatures:[...t,r],onChange:h,value:m.value}),i&&s.jsx("div",{children:s.jsx(v,{className:`btn btn-primary ${a?" btn-sm":""}`,onClick:u,disabled:m.value.length===0,children:f("common:apply")})})]}):x&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),Er=l.memo(e=>s.jsx(N,{...e})),Nr=l.memo(e=>{const{onChange:r,value:a,valueStep:t,min:o,max:n,unit:m,steps:c,minimal:f,...i}=e,[h,u]=l.useState(a),x=o!=null&&n!=null;l.useEffect(()=>{u(a)},[a]);const p=l.useCallback(j=>!!j.target.value&&u(j.target.valueAsNumber),[]),_=l.useCallback(j=>!j.target.validationMessage&&r(h),[h,r]);return s.jsxs("div",{className:"flex flex-row flex-wrap gap-3 items-center",children:[!f&&c?s.jsx(Ae,{values:c,onChange:r,value:h}):null,x?s.jsxs("div",{className:"w-full max-w-xs",children:[s.jsx("input",{min:o,max:n,step:t,type:"range",className:"range range-xs range-primary validator",value:h,onChange:p,onTouchEnd:_,onMouseUp:_,...i}),s.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[s.jsx("span",{children:o}),f&&s.jsx("span",{children:h}),s.jsx("span",{children:n})]})]}):null,(!f||!x)&&s.jsxs("label",{className:"input",children:[s.jsx("input",{type:"number",className:"grow validator",value:h,step:t,onChange:p,onBlur:_,min:o,max:n,...i}),m]})]})}),wr=l.memo(e=>{const{feature:{presets:r,access:a=y.SET,property:t,unit:o,value_max:n,value_min:m,value_step:c},deviceValue:f,steps:i,onChange:h,minimal:u}=e;return a&y.SET?s.jsx(Nr,{onChange:x=>h({[t]:x}),value:f??"",min:m,max:n,step:c,steps:r!=null&&r.length?r:i,unit:o,minimal:u}):a&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),Ar=l.memo(e=>s.jsx(N,{...e})),Rr=l.memo(e=>{const{onChange:r,value:a,...t}=e,[o,n]=l.useState(a);return l.useEffect(()=>{n(a)},[a]),s.jsx("input",{type:"text",className:"input validator",value:o,onChange:m=>n(m.target.value),onBlur:m=>!m.target.validationMessage&&r(o),...t})}),$r=l.memo(e=>{const{feature:{access:r=y.SET,property:a},deviceValue:t,onChange:o}=e;return r&y.SET?s.jsx(Rr,{onChange:n=>o({[a]:n}),value:t??""}):r&y.STATE?s.jsx($,{...e}):s.jsx(F,{...e})}),Fr=e=>`${e.type}-${e.name}-${e.label}-${e.access}-${e.category}-${e.property}-${e.endpoint}`,Re=l.memo(e=>{const{feature:r,device:a,deviceState:t,steps:o,onRead:n,onChange:m,featureWrapperClass:c,minimal:f,parentFeatures:i}=e,h=l.useMemo(()=>r.property?t[r.property]:void 0,[r.property,t[r.property]]),u=l.useMemo(()=>Fr(r),[r]),x=l.useMemo(()=>({device:a,deviceValue:h,onChange:m,onRead:n,featureWrapperClass:c,minimal:f,parentFeatures:i}),[a,h,m,n,c,f,i]),p=l.useMemo(()=>({feature:r,onRead:n,deviceValue:h,parentFeatures:i}),[r,n,h,i]);switch(r.type){case"binary":return s.jsx(c,{...p,children:s.jsx(Ut,{feature:r,...x},u)},u);case"numeric":return s.jsx(c,{...p,children:s.jsx(wr,{feature:r,...x,steps:o},u)},u);case"list":return r.name==="gradient"&&r.length_min!=null&&r.length_max!=null?s.jsx(c,{...p,children:s.jsx(yr,{feature:r,...x},u)},u):s.jsx(c,{...p,children:s.jsx(kr,{feature:r,...x},u)},u);case"text":return s.jsx(c,{...p,children:s.jsx($r,{feature:r,...x},u)},u);case"enum":return s.jsx(c,{...p,children:s.jsx(br,{feature:r,...x},u)},u);case"light":return s.jsx(jr,{feature:r,...x,deviceState:t},u);case"switch":return s.jsx(Ar,{feature:r,...x,deviceState:t},u);case"cover":return s.jsx(gr,{feature:r,...x,deviceState:t},u);case"lock":return s.jsx(Er,{feature:r,...x,deviceState:t},u);case"climate":return s.jsx(Wt,{feature:r,...x,deviceState:t},u);case"fan":return s.jsx(_r,{feature:r,...x,deviceState:t},u);case"composite":{if(r.name==="color_xy"||r.name==="color_hs")return s.jsx(c,{...p,children:s.jsx(hr,{feature:r,...x},u)},u);const _=i&&r.property?t[r.property]:t;return s.jsx(N,{feature:r,...x,deviceState:_},u)}default:return console.error("Unsupported feature",r),s.jsx(c,{...p,children:s.jsx("pre",{children:JSON.stringify(r,null,4)})},u)}});export{Re as F,Sr as a,y as b,zt as c,qt as d,Dt as g,Ot as s};
@@ -0,0 +1 @@
1
+ import{b as P,r as n,s as t,H as g,v,bP as h,bQ as f,C as E,aG as b,aH as w,aI as N,aJ as j,bR as H,bS as F,D as q,bT as W,bU as G,j as e,Q as k}from"./index-Cs-KexR1.js";import{C as B}from"./CheckboxField-aJECTtGJ.js";import{I as T}from"./InputField-TubacR8F.js";import{N as y}from"./NumberField-B10BRlkz.js";import{S as o}from"./SelectField-CboFEeLv.js";function z(){const{t:s}=P(["settings","navbar","network","common"]),[r,S]=n.useState(t.get(g,"devices")),[l,D]=n.useState(t.get(v,!1)),[i,M]=n.useState(t.get(h,254)),[c,C]=n.useState(t.get(f,4)),[d,A]=n.useState(t.get(E,"data")),[m,K]=n.useState(t.get(b,"forceDirected2d")),[u,O]=n.useState(t.get(w,"all")),[p,Y]=n.useState(t.get(N,-750)),[_,L]=n.useState(t.get(j,50));n.useEffect(()=>{t.set(g,r)},[r]),n.useEffect(()=>{t.set(v,l)},[l]),n.useEffect(()=>{t.set(h,i)},[i]),n.useEffect(()=>{t.set(f,c)},[c]),n.useEffect(()=>{t.set(E,d)},[d]),n.useEffect(()=>{t.set(b,m)},[m]),n.useEffect(()=>{t.set(w,u)},[u]),n.useEffect(()=>{t.set(N,p)},[p]),n.useEffect(()=>{t.set(j,_)},[_]);const I=n.useCallback(()=>{t.remove(H),t.remove(g),t.remove(v),t.remove(h),t.remove(f),t.remove(E),t.remove(b),t.remove(w),t.remove(N),t.remove(j),t.remove(F),t.remove(q),window.location.reload()},[]),R=n.useCallback(()=>{t.remove(W),t.remove(G),window.location.reload()},[]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-vertical sm:alert-horizontal",children:[s("frontend_notice"),e.jsxs("div",{className:"flex flex-row flex-wrap gap-2",children:[e.jsx(k,{className:"btn btn-sm btn-error",onClick:I,title:s("reset_settings"),modalDescription:s("common:dialog_confirmation_prompt"),modalCancelLabel:s("common:cancel"),children:s("reset_settings")}),e.jsx(k,{className:"btn btn-sm btn-error",onClick:R,title:s("reset_auth"),modalDescription:s("common:dialog_confirmation_prompt"),modalCancelLabel:s("common:cancel"),children:s("reset_auth")})]})]}),e.jsxs("div",{className:"flex flex-row flex-wrap gap-4 mt-3",children:[e.jsxs(o,{name:"homepage",label:s("homepage"),onChange:a=>!a.target.validationMessage&&S(a.target.value),value:r,required:!0,children:[e.jsx("option",{value:"devices",children:s("navbar:devices")}),e.jsx("option",{value:"dashboard",children:s("navbar:dashboard")})]}),e.jsx(B,{name:"dashboard_column_display",label:s("dashboard_column_display"),checked:l,onChange:a=>D(a.target.checked)}),e.jsx(T,{type:"number",name:"permit_join_time",label:s("permit_join_time"),min:10,max:254,required:!0,value:i,onChange:a=>!a.target.validationMessage&&!!a.target.value&&M(a.target.valueAsNumber)}),e.jsx(T,{type:"number",name:"max_on_screen_notifications",label:s("max_on_screen_notifications"),min:1,max:5,required:!0,value:c,onChange:a=>!a.target.validationMessage&&!!a.target.value&&C(a.target.valueAsNumber)})]}),e.jsx("h2",{className:"text-lg mt-2",children:s("network_raw")}),e.jsx("div",{className:"flex flex-row flex-wrap gap-4",children:e.jsxs(o,{name:"network:display_type",label:s("network:display_type"),onChange:a=>!a.target.validationMessage&&A(a.target.value),value:d,required:!0,children:[e.jsx("option",{value:"data",children:s("network:data")}),e.jsx("option",{value:"map",children:s("network:map")})]})}),e.jsx("h2",{className:"text-lg mt-2",children:s("network_map")}),e.jsxs("div",{className:"flex flex-row flex-wrap gap-4",children:[e.jsxs(o,{name:"network:layout_type",label:s("network:layout_type"),onChange:a=>!a.target.validationMessage&&K(a.target.value),value:m,required:!0,children:[e.jsx("option",{value:"forceDirected2d",children:"forceDirected2d"}),e.jsx("option",{value:"forceDirected3d",children:"forceDirected3d"}),e.jsx("option",{value:"radialOut2d",children:"radialOut2d"}),e.jsx("option",{value:"radialOut3d",children:"radialOut3d"})]}),e.jsxs(o,{name:"network:label_type",label:s("network:label_type"),onChange:a=>!a.target.validationMessage&&O(a.target.value),value:u,required:!0,children:[e.jsx("option",{value:"all",children:"all"}),e.jsx("option",{value:"auto",children:"auto"}),e.jsx("option",{value:"none",children:"none"}),e.jsx("option",{value:"nodes",children:"nodes"}),e.jsx("option",{value:"edges",children:"edges"})]}),e.jsx("div",{className:"min-w-xs",children:e.jsx(y,{name:"network:node_strength",label:s("network:node_strength"),onSubmit:(a,x)=>x&&typeof a=="number"&&Y(a),min:-1e3,max:-100,step:10,defaultValue:p})}),e.jsx("div",{className:"min-w-xs",children:e.jsx(y,{name:"network:link_distance",label:s("network:link_distance"),onSubmit:(a,x)=>x&&typeof a=="number"&&L(a),min:10,max:200,step:5,defaultValue:_})})]})]})}export{z as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-DaZ0Iq80.js","./index-CjAIuMGC.js","./index-BlshbhbW.css","./RecallRemove-CBFynfHA.js","./DashboardFeatureWrapper-DyAAb85w.js","./Feature-BYaimoIP.js","./DisplayValue-BRvbaOY3.js","./_createCompounder-0jJLm6ui.js","./capitalize-Bw26IpMp.js","./InputField-ywTsvyXp.js","./SelectField-CRKLuxXb.js","./DevicePicker-CvcAHg8J.js","./EndpointPicker-DXxNp6I_.js","./DeviceCard-CnbDGTrJ.js","./LastSeen-CNqb-eoa.js","./Lqi-DaXrZL2F.js","./PowerSource-CYKTc3dJ.js","./index-Dpr5JorG.js","./snakeCase-DiSj8W4z.js","./GroupSettings-Cy3exzPA.js","./SettingsList-DG1vIHZD.js","./CheckboxField-CTB2svCJ.js","./NumberField-DM8no8LD.js"])))=>i.map(i=>d[i]);
2
- import{r,b as g,j as e,L as f,P as j,F as m,f as v,u as b,d as h,a as _,N as p,o as N,k as w,_ as x}from"./index-CjAIuMGC.js";const y=r.memo(l=>{const{groups:n,currentGroup:s,tab:o="devices"}=l,[c,d]=r.useState(""),{t}=g("common"),u=r.useMemo(()=>n.filter(a=>a.friendly_name.toLowerCase().includes(c.toLowerCase())&&a.id!==(s==null?void 0:s.id)).map(a=>e.jsx("li",{children:e.jsx(f,{to:`/group/${a.id}/${o}`,onClick:()=>d(""),className:"dropdown-item",children:a.friendly_name})},a.id)),[n,c,s,o]);return e.jsxs(j,{name:"header-group-selector",buttonChildren:`${s?`#${s.id} - ${s.friendly_name}`:t("unknown_group")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(m,{icon:v}),e.jsx("input",{type:"search",placeholder:t("type_to_filter"),onChange:a=>d(a.target.value),value:c})]},"search"),u]})}),T=r.lazy(async()=>await x(()=>import("./Devices-DaZ0Iq80.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]),import.meta.url)),$=r.lazy(async()=>await x(()=>import("./GroupSettings-Cy3exzPA.js"),__vite__mapDeps([19,1,2,20,21,9,22,10]),import.meta.url));function E(){const l=b(),{t:n}=g(["groups","common"]),{groupId:s,tab:o}=h(),c=_(i=>i.groups),d=Number.parseInt(s,10),t=s?c.find(i=>i.id===d):void 0;r.useEffect(()=>{!o&&t&&l(`/group/${t.id}/devices`,{replace:!0})},[o,t,l]);const u=({isActive:i})=>i?"tab tab-active":"tab",a=r.useMemo(()=>{if(!t)return e.jsx("div",{className:"flex-auto justify-center items-center",children:n("common:unknown_group")});switch(o){case"devices":return e.jsx(T,{group:t});case"settings":return e.jsx($,{group:t})}},[o,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(y,{groups:c,currentGroup:t,tab:o}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${s}/devices`,className:u,children:[e.jsx(m,{icon:N,className:"me-2"}),n("common:devices")]}),e.jsxs(p,{to:`/group/${s}/settings`,className:u,children:[e.jsx(m,{icon:w,className:"me-2"}),n("settings")]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:a})]})}export{E as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-DAG6vs0G.js","./index-Cs-KexR1.js","./index-vRya9HWu.css","./RecallRemove-CLsmJI45.js","./DashboardFeatureWrapper-DZDafjVF.js","./Feature-DhPZqYWh.js","./DisplayValue-CjZXHxIO.js","./_createCompounder-COpq92ed.js","./capitalize-JuEfl3u2.js","./InputField-TubacR8F.js","./SelectField-CboFEeLv.js","./DevicePicker-Dt0o_iaP.js","./EndpointPicker-CX9S9S7k.js","./DeviceCard-C2NVxg8O.js","./LastSeen-DjUuaYXi.js","./Lqi-BNx2QV2z.js","./PowerSource-CT5LulZX.js","./index-CUIfkU6p.js","./snakeCase-XNTmpa2i.js","./GroupSettings-CEzY10KG.js","./SettingsList-BXXsCJCy.js","./CheckboxField-aJECTtGJ.js","./NumberField-B10BRlkz.js"])))=>i.map(i=>d[i]);
2
+ import{r,b as g,j as e,L as f,P as j,F as m,f as v,u as b,d as h,a as _,N as p,o as N,k as w,_ as x}from"./index-Cs-KexR1.js";const y=r.memo(l=>{const{groups:n,currentGroup:s,tab:o="devices"}=l,[c,d]=r.useState(""),{t}=g("common"),u=r.useMemo(()=>n.filter(a=>a.friendly_name.toLowerCase().includes(c.toLowerCase())&&a.id!==(s==null?void 0:s.id)).map(a=>e.jsx("li",{children:e.jsx(f,{to:`/group/${a.id}/${o}`,onClick:()=>d(""),className:"dropdown-item",children:a.friendly_name})},a.id)),[n,c,s,o]);return e.jsxs(j,{name:"header-group-selector",buttonChildren:`${s?`#${s.id} - ${s.friendly_name}`:t("unknown_group")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(m,{icon:v}),e.jsx("input",{type:"search",placeholder:t("type_to_filter"),onChange:a=>d(a.target.value),value:c})]},"search"),u]})}),T=r.lazy(async()=>await x(()=>import("./Devices-DAG6vs0G.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]),import.meta.url)),$=r.lazy(async()=>await x(()=>import("./GroupSettings-CEzY10KG.js"),__vite__mapDeps([19,1,2,20,21,9,22,10]),import.meta.url));function E(){const l=b(),{t:n}=g(["groups","common"]),{groupId:s,tab:o}=h(),c=_(i=>i.groups),d=Number.parseInt(s,10),t=s?c.find(i=>i.id===d):void 0;r.useEffect(()=>{!o&&t&&l(`/group/${t.id}/devices`,{replace:!0})},[o,t,l]);const u=({isActive:i})=>i?"tab tab-active":"tab",a=r.useMemo(()=>{if(!t)return e.jsx("div",{className:"flex-auto justify-center items-center",children:n("common:unknown_group")});switch(o){case"devices":return e.jsx(T,{group:t});case"settings":return e.jsx($,{group:t})}},[o,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(y,{groups:c,currentGroup:t,tab:o}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${s}/devices`,className:u,children:[e.jsx(m,{icon:N,className:"me-2"}),n("common:devices")]}),e.jsxs(p,{to:`/group/${s}/settings`,className:u,children:[e.jsx(m,{icon:w,className:"me-2"}),n("settings")]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:a})]})}export{E as default};
@@ -1 +1 @@
1
- import{b as c,a as l,r as i,W as m,j as e,F as p,C as d,bH as f}from"./index-CjAIuMGC.js";import{S as g}from"./SettingsList-DG1vIHZD.js";import"./CheckboxField-CTB2svCJ.js";import"./InputField-ywTsvyXp.js";import"./NumberField-DM8no8LD.js";import"./SelectField-CRKLuxXb.js";function j({group:s}){const{t:n}=c(["settings","common"]),o=l(t=>t.bridgeInfo),{sendMessage:r}=i.useContext(m),a=i.useCallback(async t=>{await r("bridge/request/group/options",{id:s.id.toString(),options:t})},[r,s.id]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(p,{icon:d,size:"2xl"}),e.jsx("a",{href:f,target:"_blank",rel:"noreferrer",className:"link link-hover",children:n("common:read_the_docs_info")})]}),e.jsx(g,{schema:o.config_schema.definitions.group??{properties:{}},data:o.config.groups[s.id]??{},set:a})]})}export{j as default};
1
+ import{b as c,a as l,r as i,W as m,j as e,F as p,I as d,bK as f}from"./index-Cs-KexR1.js";import{S as g}from"./SettingsList-BXXsCJCy.js";import"./CheckboxField-aJECTtGJ.js";import"./InputField-TubacR8F.js";import"./NumberField-B10BRlkz.js";import"./SelectField-CboFEeLv.js";function j({group:s}){const{t:n}=c(["settings","common"]),o=l(t=>t.bridgeInfo),{sendMessage:r}=i.useContext(m),a=i.useCallback(async t=>{await r("bridge/request/group/options",{id:s.id.toString(),options:t})},[r,s.id]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(p,{icon:d,size:"2xl"}),e.jsx("a",{href:f,target:"_blank",rel:"noreferrer",className:"link link-hover",children:n("common:read_the_docs_info")})]}),e.jsx(g,{schema:o.config_schema.definitions.group??{properties:{}},data:o.config.groups[s.id]??{},set:a})]})}export{j as default};
@@ -0,0 +1 @@
1
+ import{r,b as _,j as e,a as w,W as C,ac as N,B as k,L as y,Q as G,F as S,x as M}from"./index-Cs-KexR1.js";import{E}from"./EndpointPicker-CX9S9S7k.js";import{S as I}from"./SelectField-CboFEeLv.js";const q=r.memo(n=>{const{t:o}=_("common"),{groups:a,value:c,label:l,onChange:m,...i}=n,g=r.useCallback(u=>{const{value:d}=u.target,x=Number.parseInt(d,10);m(a.find(b=>x===b.id))},[a,m]),p=r.useMemo(()=>{const u=[];for(const d of a)u.push(e.jsx("option",{value:d.id,children:d.friendly_name},d.id));return u},[a]);return e.jsxs(I,{name:"group_picker",label:l,value:c,onChange:g,...i,children:[e.jsx("option",{value:"",disabled:!0,children:o("select_group")}),p]})});function A({device:n}){const{t:o}=_(["groups","zigbee","common"]),a=w(s=>s.groups),{sendMessage:c}=r.useContext(C),[l,m]=r.useState(""),[i,g]=r.useState(""),p=r.useMemo(()=>N(n),[n]),[u,d]=r.useMemo(()=>{const s=[],t=[];for(const f of a){const j=f.members.filter(h=>h.ieee_address===n.ieee_address);if(j.length>0)for(const h of j)s.push([f,h.endpoint]);else t.push(f)}return[s,t]},[a,n.ieee_address]),x=r.useCallback(s=>{g(s.id),m(p.values().next().value)},[p]),b=r.useCallback(async()=>await c("bridge/request/group/members/add",{group:i.toString(),endpoint:l,device:n.ieee_address}),[c,i,n.ieee_address,l]),v=r.useCallback(async([s,t])=>await c("bridge/request/group/members/remove",{device:n.ieee_address,endpoint:t,group:s.id.toString()}),[c,n.ieee_address]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row flex-wrap justify-around items-start gap-3 my-2",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:o("add_to_group")}),e.jsxs("div",{className:"mb-3",children:[e.jsx(q,{label:o("zigbee:group"),value:i,groups:d,onChange:x,required:!0}),e.jsx(E,{label:o("zigbee:endpoint"),values:p,value:l,onChange:s=>m(s),required:!0})]}),e.jsx(k,{onClick:b,className:"btn btn-primary",disabled:l==null||i==null||l===""||i==="",children:o("add_to_group")})]})}),e.jsx("div",{className:"flex flex-row flex-wrap justify-center gap-3 mt-3",children:u.map(([s,t])=>e.jsxs("ul",{className:"w-[23rem] list bg-base-200 rounded-box shadow-md",children:[e.jsxs("li",{className:"list-row grow",children:[e.jsxs("div",{children:[e.jsxs(y,{to:`/group/${s.id}/devices`,className:"link link-hover",children:["#",s.id," - ",s.friendly_name,t?` (${o("endpoint")}: ${t})`:""]}),e.jsx("div",{className:"text-xs opacity-50",children:s.description||""})]}),e.jsxs("div",{className:"list-col-wrap text-sm w-full gap-2",children:[e.jsxs("div",{className:"badge badge-soft badge-ghost cursor-default me-2",children:[o("group_members"),": ",s.members.length]}),e.jsxs("div",{className:"badge badge-soft badge-ghost cursor-default me-2",children:[o("group_scenes"),": ",s.scenes.length]})]})]}),e.jsx("li",{className:"flex flex-row flex-wrap gap-1 m-4 justify-around items-center",children:e.jsx(G,{item:[s,t],onClick:v,className:"btn btn-square btn-error btn-sm",title:o("remove_from_group"),modalDescription:o("common:dialog_confirmation_prompt"),modalCancelLabel:o("common:cancel"),children:e.jsx(S,{icon:M})})})]},`${s.id}-${t}`))})]})}export{A as default};
@@ -0,0 +1 @@
1
+ import{w as h,K as _,b as j,r as o,j as a,M as N,B as d,a as w,W as C,L as g,F as b,O as k,Q as F,x as S}from"./index-Cs-KexR1.js";import{I as p}from"./InputField-TubacR8F.js";import{T as G}from"./Table-CK8_rY6Z.js";import"./DebouncedInput-hrRL_knE.js";const M=h.create(i=>{const{name:t,onRename:r}=i,c=_(),{t:l}=j(["groups","common"]),[s,n]=o.useState(t);return o.useEffect(()=>{n(t)},[t]),a.jsx(N,{isOpen:c.visible,title:`${l("rename_group")} ${t}`,footer:a.jsxs(a.Fragment,{children:[a.jsx(d,{className:"btn btn-neutral",onClick:c.remove,children:l("common:cancel")}),a.jsx(d,{className:"btn btn-primary ms-1",onClick:async()=>{s&&(c.remove(),await r(t,s))},children:l("rename_group")})]}),children:a.jsx("div",{className:"flex flex-col gap-2",children:a.jsx(p,{name:"friendly_name",label:l("common:friendly_name"),onChange:u=>n(u.target.value),value:s,type:"text",required:!0})})})});function T(){const[i,t]=o.useState(""),[r,c]=o.useState(""),l=w(e=>e.groups),{sendMessage:s}=o.useContext(C),{t:n}=j(["groups","common"]),u=o.useCallback(async()=>{const e={friendly_name:i};r!==void 0&&(e.id=r),await s("bridge/request/group/add",e)},[i,r,s]),x=o.useCallback(async(e,m)=>await s("bridge/request/group/rename",{from:e,to:m}),[s]),f=o.useCallback(async e=>await s("bridge/request/group/remove",{id:e}),[s]),y=o.useMemo(()=>i?!r||!l.find(e=>e.id.toString()===r):!1,[i,r,l]),v=o.useMemo(()=>[{id:"group_id",header:n("group_id"),accessorFn:e=>e.id,cell:({row:{original:e}})=>{var m;return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"avatar"}),a.jsxs("div",{className:"flex flex-col",children:[a.jsx(g,{to:`/group/${e.id}/devices`,className:"link link-hover",children:e.id}),e.description&&a.jsx("div",{className:"text-xs opacity-50",children:e.description}),a.jsx("div",{className:"flex flex-row gap-1 mt-2",children:a.jsxs("span",{className:"badge badge-soft badge-sm badge-ghost cursor-default",children:[n("scenes"),": ",((m=e.scenes)==null?void 0:m.length)??0]})})]})]})}},{id:"friendly_name",header:n("common:friendly_name"),accessorFn:e=>e.friendly_name,cell:({row:{original:e}})=>a.jsx(g,{to:`/group/${e.id}/devices`,className:"link link-hover",children:e.friendly_name})},{id:"members",header:n("group_members"),accessorFn:e=>e.members.length??0,enableColumnFilter:!1},{header:"",id:"actions",cell:({row:{original:e}})=>a.jsxs("div",{className:"join join-horizontal",children:[a.jsx(d,{className:"btn btn-primary btn-sm join-item",onClick:async()=>await h.show(M,{name:e.friendly_name,onRename:x}),title:n("rename_group"),disabled:e.friendly_name==="default_bind_group",children:a.jsx(b,{icon:k})}),a.jsx(F,{title:n("remove_group"),item:e.id.toString(),onClick:f,className:"btn btn-error btn-sm join-item",modalDescription:n("common:dialog_confirmation_prompt"),modalCancelLabel:n("common:cancel"),children:a.jsx(b,{icon:S})})]}),enableSorting:!1,enableColumnFilter:!1}],[x,f,n]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"collapse collapse-arrow bg-base-100 shadow mb-3",children:[a.jsx("input",{type:"checkbox"}),a.jsx("div",{className:"collapse-title text-lg font-semibold text-center",children:n("create_group")}),a.jsx("div",{className:"collapse-content",children:a.jsxs("div",{className:"flex flex-row flex-wrap justify-center gap-2",children:[a.jsx(p,{type:"text",name:"friendly_name",label:n("common:friendly_name"),value:i,placeholder:n("friendly_name_placeholder"),onChange:e=>t(e.target.value),required:!0}),a.jsx(p,{type:"number",name:"group_id",label:n("group_id"),value:r,detail:n("common:optional"),min:0,max:255,onChange:e=>c(e.target.value)}),a.jsx(d,{onClick:u,className:"btn btn-primary self-center",disabled:!y,children:n("create_group")})]})})]}),a.jsx(G,{id:"all-groups",columns:v,data:l})]})}export{T as default};
@@ -1 +1 @@
1
- import{u as s,r as t,s as r,H as o,j as a}from"./index-CjAIuMGC.js";function n(){const e=s();return t.useEffect(()=>{e(r.get(o)==="dashboard"?"/dashboard":"/devices",{replace:!0})},[e]),a.jsx(a.Fragment,{})}export{n as default};
1
+ import{u as s,r as t,s as r,H as o,j as a}from"./index-Cs-KexR1.js";function n(){const e=s();return t.useEffect(()=>{e(r.get(o)==="dashboard"?"/dashboard":"/devices",{replace:!0})},[e]),a.jsx(a.Fragment,{})}export{n as default};
@@ -1 +1 @@
1
- import{r as i,j as e}from"./index-CjAIuMGC.js";const c=i.memo(s=>{const{label:l,detail:t,onChange:a,onBlur:n,...r}=s;return e.jsxs("fieldset",{className:"fieldset",children:[l&&e.jsx("legend",{className:"fieldset-legend",children:l}),e.jsx("input",{className:`input min-w-xs${s.pattern||s.required?" validator":""}`,onChange:a,onBlur:n,...r}),t&&e.jsx("p",{className:"label",children:t})]})});export{c as I};
1
+ import{r as i,j as e}from"./index-Cs-KexR1.js";const c=i.memo(s=>{const{label:l,detail:t,onChange:a,onBlur:n,...r}=s;return e.jsxs("fieldset",{className:"fieldset",children:[l&&e.jsx("legend",{className:"fieldset-legend",children:l}),e.jsx("input",{className:`input min-w-xs${s.pattern||s.required?" validator":""}`,onChange:a,onBlur:n,...r}),t&&e.jsx("p",{className:"label",children:t})]})});export{c as I};
@@ -1 +1 @@
1
- import{aI as c,r as l,b as D,c as m,j as o,a1 as v}from"./index-CjAIuMGC.js";var s=[60,60,24,7,365/7/12,12];function g(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}function p(e,t){var n=e<0?1:0;e=Math.abs(e);for(var r=e,a=0;e>=s[a]&&a<s.length;a++)e/=s[a];return e=Math.floor(e),a*=2,e>(a===0?9:1)&&(a+=1),t(e,a,r)[n].replace("%s",e.toString())}function u(e,t){var n=new Date;return(+n-+g(e))/1e3}var x=function(e,t,n){var r=u(e);return p(r,c(t))};const h=l.memo(({lastSeen:e,config:t})=>{const{i18n:n}=D(),r=m(e,t);return r?o.jsx("span",{title:v(r),children:x(r,n.language)}):o.jsx(o.Fragment,{children:"N/A"})});export{h as L};
1
+ import{aL as c,r as l,b as D,c as m,j as o,a4 as v}from"./index-Cs-KexR1.js";var s=[60,60,24,7,365/7/12,12];function g(e){return e instanceof Date?e:!isNaN(e)||/^\d+$/.test(e)?new Date(parseInt(e)):(e=(e||"").trim().replace(/\.\d+/,"").replace(/-/,"/").replace(/-/,"/").replace(/(\d)T(\d)/,"$1 $2").replace(/Z/," UTC").replace(/([+-]\d\d):?(\d\d)/," $1$2"),new Date(e))}function p(e,t){var n=e<0?1:0;e=Math.abs(e);for(var r=e,a=0;e>=s[a]&&a<s.length;a++)e/=s[a];return e=Math.floor(e),a*=2,e>(a===0?9:1)&&(a+=1),t(e,a,r)[n].replace("%s",e.toString())}function u(e,t){var n=new Date;return(+n-+g(e))/1e3}var x=function(e,t,n){var r=u(e);return p(r,c(t))};const h=l.memo(({lastSeen:e,config:t})=>{const{i18n:n}=D(),r=m(e,t);return r?o.jsx("span",{title:v(r),children:x(r,n.language)}):o.jsx(o.Fragment,{children:"N/A"})});export{h as L};
@@ -0,0 +1 @@
1
+ import{r as l,W as _,A as C,a as g,b as w,$ as y,j as s,a0 as u,F as k,f as N,a1 as S,a2 as E,B as I,a3 as A,a4 as M}from"./index-Cs-KexR1.js";import{C as F}from"./CheckboxField-aJECTtGJ.js";import{D as G}from"./DebouncedInput-hrRL_knE.js";import{S as d}from"./SelectField-CboFEeLv.js";const D={error:"bg-error text-error-content",warning:"bg-warning text-warning-content",info:"bg-info text-info-content",debug:"bg-accent text-accent-content opacity-50"};function T(){const{sendMessage:m}=l.useContext(_),[t,c]=l.useState(""),[n,x]=l.useState("all"),[r,f]=l.useState(!1),h=C(),L=g(e=>e.logsLimit),b=g(e=>e.bridgeInfo.config.advanced.log_level),{t:a}=w("logs"),p=g(e=>e.logs),o=l.useMemo(()=>p.filter(e=>(n==="all"||e.level===n)&&(r||!t||e.message.toLowerCase().includes(t.toLowerCase()))),[t,r,n,p]),j=l.useCallback((e,i)=>t&&e.toLowerCase().includes(t.toLowerCase())?D[i]:y[i],[t]),v=l.useCallback(async e=>{await m("bridge/request/options",{options:{advanced:{log_level:e}}})},[m]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-row flex-wrap gap-3 items-top",children:[s.jsxs(d,{name:"log_level",label:a("show_only"),value:n,onChange:e=>x(e.target.value),children:[s.jsx("option",{value:"all",children:"all"},"all"),u.map(e=>s.jsx("option",{value:e,children:e},e))]}),s.jsxs("fieldset",{className:"fieldset",children:[s.jsx("legend",{className:"fieldset-legend",children:a("filter_by_text")}),s.jsxs("label",{className:"input w-64",children:[s.jsx(k,{icon:N}),s.jsx(G,{className:"",type:"search",onChange:e=>c(e.toString()),placeholder:a("common:search"),value:t,disabled:o.length===0}),s.jsx("kbd",{className:"kbd kbd-sm cursor-pointer",onClick:()=>c(""),onKeyUp:e=>{e.key==="enter"&&c("")},title:a("common:clear"),children:"x"})]})]}),s.jsx(F,{name:"highlight_only",label:a("highlight_only"),checked:r,onChange:e=>f(e.target.checked)}),s.jsx(d,{name:"log_limit",label:a("logs_limit"),onChange:e=>{h(E(Number.parseInt(e.target.value)))},value:L,children:S.map(e=>s.jsx("option",{value:e,children:e},e))}),s.jsx(I,{onClick:()=>{h(A())},className:"btn btn-primary self-center",disabled:o.length===0,children:a("common:clear")}),s.jsx("div",{className:"ml-auto",children:s.jsx(d,{name:"log_level_config",label:a("log_level_config"),value:b,onChange:e=>!e.target.validationMessage&&v(e.target.value),children:u.map(e=>s.jsx("option",{value:e,children:e},e))})})]}),s.jsx("div",{className:"mockup-code w-full mt-1 mb-3",children:o.length>0?o.map((e,i)=>s.jsx("pre",{"data-prefix":i,className:j(e.message,e.level),children:s.jsxs("code",{children:["[",e.timestamp,"] ",e.message]})},`${e.timestamp}-${e.message}`)):s.jsx("pre",{"data-prefix":"~",children:s.jsxs("code",{children:["[",M(new Date),"] ",a("empty_logs_message")]})})})]})}export{T as default};
@@ -1 +1 @@
1
- import{r,j as t,F as i,aM as a}from"./index-CjAIuMGC.js";import{D as n}from"./DisplayValue-BRvbaOY3.js";const x=r.memo(({value:s})=>{let e="";return s&&(s<75?e="text-error":s<125?e="text-warning":s>200&&(e="text-success")),t.jsxs(t.Fragment,{children:[t.jsx(i,{icon:a,className:e})," ",t.jsx("span",{className:e,children:t.jsx(n,{value:s,name:"linkquality"})})]})});export{x as L};
1
+ import{r,j as t,F as i,aP as a}from"./index-Cs-KexR1.js";import{D as n}from"./DisplayValue-CjZXHxIO.js";const x=r.memo(({value:s})=>{let e="";return s&&(s<75?e="text-error":s<125?e="text-warning":s>200&&(e="text-success")),t.jsxs(t.Fragment,{children:[t.jsx(i,{icon:a,className:e})," ",t.jsx("span",{className:e,children:t.jsx(n,{value:s,name:"linkquality"})})]})});export{x as L};
Binary file
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-BCA0bmwX.js","./index-CjAIuMGC.js","./index-BlshbhbW.css","./PowerSource-CYKTc3dJ.js","./index-Dpr5JorG.js","./snakeCase-DiSj8W4z.js","./_createCompounder-0jJLm6ui.js","./DebouncedInput-CBB2lTWU.js","./index-BN7eS8uY.js","./Lqi-DaXrZL2F.js","./DisplayValue-BRvbaOY3.js","./RawNetworkMap-C9o-OWbT.js"])))=>i.map(i=>d[i]);
2
- import{x as C,r as s,W as E,b as R,a as d,s as m,y as h,z as M,A as T,j as e,F as n,C as x,B as z,E as A,i as S,_ as g}from"./index-CjAIuMGC.js";import{C as D}from"./CheckboxField-CTB2svCJ.js";import{S as f}from"./SelectField-CRKLuxXb.js";const F=s.lazy(async()=>await g(()=>import("./RawNetworkData-BCA0bmwX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)),I=s.lazy(async()=>await g(()=>import("./RawNetworkMap-C9o-OWbT.js"),__vite__mapDeps([11,1,2,8]),import.meta.url));function W(){const o=C(),{sendMessage:u}=s.useContext(E),{t:a}=R(["network","common"]),i=d(t=>t.networkMapIsLoading),r=d(t=>t.networkMap),[l,w]=s.useState("raw"),[c,j]=s.useState(!1),[p,k]=s.useState(m.get(h,"data")),v=s.useCallback(t=>{t.target.value&&w(t.target.value)},[]),y=s.useCallback(t=>{t.target.value&&(m.set(h,t.target.value),k(t.target.value))},[]),b=s.useCallback(t=>{j(t.target.checked)},[]),_=s.useCallback(async()=>{o(M(void 0)),o(T()),await u("bridge/request/networkmap",{type:l,routes:c})},[l,c,o,u]),N=s.useMemo(()=>{if(i)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:e.jsx("span",{className:"loading loading-infinity loading-xl"})}),e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:a("loading")})]});if(r)switch(r.type){case"raw":return p==="data"?e.jsx(F,{map:r.value}):e.jsx(I,{map:r.value});case"graphviz":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(n,{icon:x,size:"2xl"}),a("copy_paste_on"),e.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),e.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:r.value})]});case"plantuml":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(n,{icon:x,size:"2xl"}),a("copy_paste_on"),e.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),e.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:r.value})]})}return null},[r,i,p,a]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row justify-center gap-3 mb-2",children:[e.jsxs(f,{name:"type",label:a("type"),value:l,onChange:v,children:[e.jsx("option",{value:"raw",children:a("raw")}),e.jsx("option",{value:"graphviz",children:a("graphviz")}),e.jsx("option",{value:"plantuml",children:a("plantuml")})]}),e.jsx(D,{name:"enable_routes",label:a("enable_routes"),checked:c,onChange:b}),e.jsx(z,{className:"btn btn-primary btn-square self-center ms-3 me-6",onClick:_,title:a(r?"reload":"load"),disabled:i,children:r?e.jsx(n,{icon:A}):e.jsx(n,{icon:S})}),l==="raw"&&e.jsxs(f,{name:"display_type",label:a("display_type"),value:p,onChange:y,children:[e.jsx("option",{value:"data",children:a("data")}),e.jsx("option",{value:"map",children:a("map")})]})]}),N]})}export{W as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./RawNetworkData-uldf8APR.js","./index-Cs-KexR1.js","./index-vRya9HWu.css","./PowerSource-CT5LulZX.js","./index-CUIfkU6p.js","./snakeCase-XNTmpa2i.js","./_createCompounder-COpq92ed.js","./DebouncedInput-hrRL_knE.js","./index-BN7eS8uY.js","./Lqi-BNx2QV2z.js","./DisplayValue-CjZXHxIO.js","./RawNetworkMap-CAdhahgm.js"])))=>i.map(i=>d[i]);
2
+ import{A as C,r as s,W as E,b as R,a as d,s as m,C as h,E as M,G as T,j as e,F as n,I as x,B as z,J as A,i as I,_ as g}from"./index-Cs-KexR1.js";import{C as S}from"./CheckboxField-aJECTtGJ.js";import{S as f}from"./SelectField-CboFEeLv.js";const D=s.lazy(async()=>await g(()=>import("./RawNetworkData-uldf8APR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)),F=s.lazy(async()=>await g(()=>import("./RawNetworkMap-CAdhahgm.js"),__vite__mapDeps([11,1,2,8]),import.meta.url));function W(){const o=C(),{sendMessage:u}=s.useContext(E),{t:a}=R(["network","common"]),i=d(t=>t.networkMapIsLoading),r=d(t=>t.networkMap),[l,w]=s.useState("raw"),[c,j]=s.useState(!1),[p,k]=s.useState(m.get(h,"data")),v=s.useCallback(t=>{t.target.value&&w(t.target.value)},[]),y=s.useCallback(t=>{t.target.value&&(m.set(h,t.target.value),k(t.target.value))},[]),b=s.useCallback(t=>{j(t.target.checked)},[]),_=s.useCallback(async()=>{o(M(void 0)),o(T()),await u("bridge/request/networkmap",{type:l,routes:c})},[l,c,o,u]),N=s.useMemo(()=>{if(i)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:e.jsx("span",{className:"loading loading-infinity loading-xl"})}),e.jsx("div",{className:"flex flex-row justify-center items-center gap-2",children:a("loading")})]});if(r)switch(r.type){case"raw":return p==="data"?e.jsx(D,{map:r.value}):e.jsx(F,{map:r.value});case"graphviz":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(n,{icon:x,size:"2xl"}),a("copy_paste_on"),e.jsx("a",{href:"https://dreampuf.github.io/GraphvizOnline",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://dreampuf.github.io/GraphvizOnline"}),e.jsx("a",{href:"https://edotor.net/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://edotor.net/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:r.value})]});case"plantuml":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"alert alert-info alert-soft mb-3",role:"alert",children:[e.jsx(n,{icon:x,size:"2xl"}),a("copy_paste_on"),e.jsx("a",{href:"https://editor.plantuml.com/uml/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://editor.plantuml.com/uml/"}),e.jsx("a",{href:"https://www.planttext.com/",target:"_blank",rel:"noreferrer",className:"link link-hover",children:"https://www.planttext.com/"})]}),e.jsx("textarea",{className:"textarea w-full",rows:5,readOnly:!0,value:r.value})]})}return null},[r,i,p,a]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-row justify-center gap-3 mb-2",children:[e.jsxs(f,{name:"type",label:a("type"),value:l,onChange:v,children:[e.jsx("option",{value:"raw",children:a("raw")}),e.jsx("option",{value:"graphviz",children:a("graphviz")}),e.jsx("option",{value:"plantuml",children:a("plantuml")})]}),e.jsx(S,{name:"enable_routes",label:a("enable_routes"),checked:c,onChange:b}),e.jsx(z,{className:"btn btn-primary btn-square self-center ms-3 me-6",onClick:_,title:a(r?"reload":"load"),disabled:i,children:r?e.jsx(n,{icon:A}):e.jsx(n,{icon:I})}),l==="raw"&&e.jsxs(f,{name:"display_type",label:a("display_type"),value:p,onChange:y,children:[e.jsx("option",{value:"data",children:a("data")}),e.jsx("option",{value:"map",children:a("map")})]})]}),N]})}export{W as default};
@@ -1 +1 @@
1
- import{r as n,j as e}from"./index-CjAIuMGC.js";const h=n.memo(a=>{const{label:c,detail:m,onChange:t,onSubmit:r,defaultValue:i,minimal:d,...x}=a,[s,o]=n.useState(i);n.useEffect(()=>{o(i)},[i]);const j=n.useCallback(l=>{o(l.target.value?l.target.valueAsNumber:""),t==null||t(l)},[t]),u=n.useCallback(l=>{r==null||r(s,!l.target.validationMessage)},[r,s]);return e.jsxs("fieldset",{className:"fieldset",children:[c&&e.jsx("legend",{className:"fieldset-legend",children:c}),a.min!=null&&a.max!=null&&e.jsxs("div",{className:"w-full max-w-xs",children:[e.jsx("input",{className:"range range-xs range-primary",onChange:j,onTouchEnd:u,onMouseUp:u,...x,type:"range",value:s}),e.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[e.jsx("span",{children:a.min}),d&&e.jsx("span",{children:s}),e.jsx("span",{children:a.max})]})]}),!d&&e.jsx("input",{className:`input${a.pattern||a.required?" validator":""}`,onChange:j,onBlur:u,...x,type:"number",value:s}),m&&e.jsx("p",{className:"label whitespace-normal",children:m})]})});export{h as N};
1
+ import{r as n,j as e}from"./index-Cs-KexR1.js";const h=n.memo(a=>{const{label:c,detail:m,onChange:t,onSubmit:r,defaultValue:i,minimal:d,...x}=a,[s,o]=n.useState(i);n.useEffect(()=>{o(i)},[i]);const j=n.useCallback(l=>{o(l.target.value?l.target.valueAsNumber:""),t==null||t(l)},[t]),u=n.useCallback(l=>{r==null||r(s,!l.target.validationMessage)},[r,s]);return e.jsxs("fieldset",{className:"fieldset",children:[c&&e.jsx("legend",{className:"fieldset-legend",children:c}),a.min!=null&&a.max!=null&&e.jsxs("div",{className:"w-full max-w-xs",children:[e.jsx("input",{className:"range range-xs range-primary",onChange:j,onTouchEnd:u,onMouseUp:u,...x,type:"range",value:s}),e.jsxs("div",{className:"flex justify-between px-1 mt-1 text-xs",children:[e.jsx("span",{children:a.min}),d&&e.jsx("span",{children:s}),e.jsx("span",{children:a.max})]})]}),!d&&e.jsx("input",{className:`input${a.pattern||a.required?" validator":""}`,onChange:j,onBlur:u,...x,type:"number",value:s}),m&&e.jsx("p",{className:"label whitespace-normal",children:m})]})});export{h as N};
@@ -0,0 +1 @@
1
+ import{r as l,b as g,j as s,B as N,Q as h,F as f,R as j,a as y,W as $,L,S as D}from"./index-Cs-KexR1.js";import{D as M,P as z}from"./PowerSource-CT5LulZX.js";import{T as A}from"./Table-CK8_rY6Z.js";import{M as P,V as q}from"./VendorLink-CQWJDUO2.js";import"./index-CUIfkU6p.js";import"./snakeCase-XNTmpa2i.js";import"./_createCompounder-COpq92ed.js";import"./DebouncedInput-hrRL_knE.js";const B=l.memo(({label:t,remaining:i,progress:n})=>{if(i&&i>0){const a=Math.floor(i/3600),o=Math.floor(i/60)%60,m=Math.floor(i%60),r=a>0,u=o>0;return s.jsxs(s.Fragment,{children:[s.jsx("progress",{className:"progress w-48",value:n,max:"100"}),s.jsxs("div",{children:[t," ",`${r?`${a}:`:""}${u?`${o}:`:""}${m}`]})]})}return s.jsx("progress",{className:"progress w-48",value:n,max:"100"})}),U=l.memo(t=>{const{t:i}=g(["ota","common"]),{device:n,state:a,onCheckClick:o,onUpdateClick:m,onScheduleClick:r,onUnscheduleClick:u}=t;return a==null||a.state==="idle"?s.jsxs("div",{className:"join join-horizontal",children:[s.jsx(N,{className:"btn btn-primary btn-sm join-item",onClick:o,item:n.ieee_address,children:i("check")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]}):a.state==="updating"?s.jsx(B,{label:i("remaining_time"),remaining:a.remaining,progress:a.progress}):s.jsx("div",{className:"join join-horizontal",children:a.state==="available"?s.jsxs(s.Fragment,{children:[s.jsx(h,{className:"btn btn-error btn-sm join-item",onClick:m,item:n.ieee_address,title:i("update"),modalDescription:i("common:dialog_confirmation_prompt"),modalCancelLabel:i("common:cancel"),children:i("update")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]}):a.state==="scheduled"?s.jsx(h,{className:"btn btn-sm btn-error join-item",onClick:u,item:n.ieee_address,title:i("unschedule"),modalDescription:i("common:dialog_confirmation_prompt"),modalCancelLabel:i("common:cancel"),children:i("unschedule")}):s.jsxs(s.Fragment,{children:[s.jsx(N,{className:"btn btn-primary btn-sm join-item",onClick:o,item:n.ieee_address,children:i("check")}),s.jsx(h,{className:"btn btn-info btn-sm join-item",onClick:r,item:n.ieee_address,title:i("schedule"),modalDescription:i("schedule_info"),modalCancelLabel:i("common:cancel"),children:s.jsx(f,{icon:j})})]})})}),S=l.memo(t=>{const{t:i}=g("ota"),n=l.useMemo(()=>{if(t.version==null||t.version<0)return;const a=t.version.toString(16).padStart(8,"0"),o=`${a[0]}.${a[1]}`,m=a.slice(2,4),r=`${a[4]}.${a[5]}`,u=a.slice(6);return[o,m,r,u]},[t.version]);return n===void 0?s.jsx(s.Fragment,{children:"N/A"}):s.jsxs("div",{className:"join join-vertical",children:[s.jsxs("span",{className:"badge badge-sm badge-soft badge-ghost cursor-default join-item w-full",children:[i("app"),": ",`${n[0]} build ${n[1]}`]}),s.jsxs("span",{className:"badge badge-sm badge-soft badge-ghost cursor-default join-item w-full",children:[i("stack"),": ",`${n[2]} build ${n[3]}`]})]})}),O=l.memo(({device:t})=>{var o,m,r,u;const{t:i}=g("zigbee");let n="https://github.com/Koenkk/zigbee-OTA/releases";const a=t.software_build_id||i("unknown");switch((o=t==null?void 0:t.definition)==null?void 0:o.vendor){case"IKEA":n="https://ww8.ikea.com/ikeahomesmart/releasenotes/releasenotes.html";break;case"Inovelli":n="https://help.inovelli.com/en/articles/8503774-what-is-the-latest-firmware-version-for-your-device#h_b74c1e7dc6";break;case"Philips":n=`https://www.philips-hue.com/en-us/support/release-notes/${(m=t.definition)!=null&&m.exposes.find(b=>b.type==="light")?"lamps":"accessories"}`;break;case"Ubisys":n=`https://www.ubisys.de/en/support/firmware/change-logs-${(u=(r=t.definition)==null?void 0:r.model)==null?void 0:u.replace(/[-]/g,"").toLowerCase()}/`;break}return s.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:n,className:"link link-hover",children:a})});function H(){const t=y(e=>e.devices),i=y(e=>e.deviceStates),{sendMessage:n}=l.useContext($),{t:a}=g(["ota","zigbee","common"]),[o,m]=l.useState([]);l.useEffect(()=>{m([])},[t]);const r=l.useMemo(()=>{var c;const e=[];for(const d of t)if((c=d.definition)!=null&&c.supports_ota&&!d.disabled){const p=i[d.friendly_name]??{};e.push({device:d,state:p.update,batteryState:d.power_source==="Battery"?{batteryPercent:p.battery,batteryState:p.battery_state,batteryLow:p.battery_low}:void 0,selected:o.includes(d.ieee_address)})}return e},[i,t,o]),u=l.useCallback(e=>{e.target.checked?m(r.map(({device:c})=>c.ieee_address)):m([])},[r]),b=l.useCallback((e,c)=>{m(c?[...o,e.ieee_address]:o.filter(d=>d!==e.ieee_address))},[o]),x=l.useCallback(async()=>{await Promise.allSettled(o.map(e=>n("bridge/request/device/ota_update/check",{id:e})))},[n,o]),k=l.useCallback(async()=>{await Promise.allSettled(o.map(e=>n("bridge/request/device/ota_update/update",{id:e})))},[n,o]),_=l.useCallback(async e=>await n("bridge/request/device/ota_update/check",{id:e}),[n]),C=l.useCallback(async e=>await n("bridge/request/device/ota_update/update",{id:e}),[n]),w=l.useCallback(async e=>await n("bridge/request/device/ota_update/schedule",{id:e}),[n]),v=l.useCallback(async e=>await n("bridge/request/device/ota_update/unschedule",{id:e}),[n]),F=l.useMemo(()=>[{id:"select",header:()=>s.jsx("label",{children:s.jsx("input",{type:"checkbox",className:"checkbox",onChange:u,defaultChecked:o.length===r.length})}),accessorFn:()=>"",cell:({row:{original:{device:e,selected:c}}})=>s.jsx("label",{children:s.jsx("input",{type:"checkbox",className:"checkbox",onChange:d=>b(e,d.target.checked),defaultChecked:c})}),enableColumnFilter:!1,enableSorting:!1},{header:a("common:friendly_name"),accessorFn:({device:e})=>[e.friendly_name,e.description,e.ieee_address].join(" "),cell:({row:{original:{device:e,state:c,batteryState:d}}})=>s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"avatar",children:s.jsx("div",{className:"h-12 w-12",style:{overflow:"visible"},children:s.jsx(M,{device:e,otaState:c==null?void 0:c.state,disabled:!1})})}),s.jsxs("div",{className:"flex flex-col",children:[s.jsxs(L,{to:`/device/${e.ieee_address}/info`,className:"link link-hover",children:[e.friendly_name,e.friendly_name!==e.ieee_address?` (${e.ieee_address})`:""]}),e.description&&s.jsx("div",{className:"text-xs opacity-50",children:e.description}),s.jsxs("div",{className:"flex flex-row gap-1 my-1 items-center",children:[s.jsxs("span",{className:"badge badge-sm badge-soft badge-ghost cursor-default",title:a("zigbee:firmware_id"),children:[s.jsx(f,{icon:D}),s.jsx(O,{device:e}),e.date_code?s.jsxs("span",{title:a("zigbee:firmware_build_date"),children:[" (",e.date_code,")"]}):void 0]}),d&&s.jsx("span",{className:"badge badge-sm badge-soft badge-ghost cursor-default",children:s.jsx(z,{device:e,...d})})]})]})]})},{header:a("zigbee:model"),accessorFn:({device:e})=>{var c,d;return[(c=e.definition)==null?void 0:c.model,e.model_id,(d=e.definition)==null?void 0:d.vendor,e.manufacturer].join(" ")},cell:({row:{original:{device:e}}})=>s.jsxs(s.Fragment,{children:[s.jsx(P,{device:e}),s.jsx("div",{children:s.jsx("span",{className:"badge badge-sm badge-ghost",title:a("zigbee:manufacturer"),children:s.jsx(q,{device:e})})})]})},{header:a("firmware_version"),accessorFn:({state:e})=>e==null?void 0:e.installed_version,cell:({row:{original:{state:e}}})=>s.jsx(S,{version:e==null?void 0:e.installed_version}),enableColumnFilter:!1},{header:a("available_firmware_version"),accessorFn:({state:e})=>e==null?void 0:e.latest_version,cell:({row:{original:{state:e}}})=>s.jsx(S,{version:e==null?void 0:e.latest_version}),enableColumnFilter:!1},{header:()=>s.jsxs("div",{className:"join join-vertical",children:[s.jsx(h,{className:"btn btn-error btn-xs join-item",onClick:x,title:a("check_selected"),modalDescription:a("common:dialog_confirmation_prompt"),modalCancelLabel:a("common:cancel"),disabled:o.length===0,children:a("check_selected")}),s.jsx(h,{className:"btn btn-error btn-xs join-item",onClick:k,title:a("update_selected"),modalDescription:a("update_selected_info"),modalCancelLabel:a("common:cancel"),disabled:o.length===0,children:a("update_selected")})]}),accessorFn:({state:e})=>e==null?void 0:e.state,id:"check_all",cell:({row:{original:{device:e,state:c}}})=>s.jsx(U,{device:e,state:c,onCheckClick:_,onUpdateClick:C,onScheduleClick:w,onUnscheduleClick:v}),enableSorting:!1,enableColumnFilter:!1}],[o.length,r.length,u,b,x,k,_,C,w,v,a]);return s.jsx(A,{id:"ota-devices",columns:F,data:r})}export{H as default};
@@ -1 +1 @@
1
- import{j as a,F as m,U as N,r as b,b as _,ag as P,bC as D,bD as I,E as L,bE as B,bF as $,bz as F,bG as k,bd as A,bt as v,bu as z,bv as S,bw as M,bn as h}from"./index-CjAIuMGC.js";import{g as T,a as x}from"./index-Dpr5JorG.js";import{s as j}from"./snakeCase-DiSj8W4z.js";function C({error:t,children:e}){return t?a.jsx(m,{icon:N,size:"3x",className:"text-error",title:"Missing image"}):e}function g(t){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function Q(t,e){if(g(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(g(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function G(t){var e=Q(t,"string");return g(e)=="symbol"?e:e+""}function K(t,e,r){return(e=G(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var q=function(t){var e=t.crossOrigin,r=e===void 0?"":e;return function(n){return new Promise(function(s,o){var i=new Image;r&&(i.crossOrigin=r),i.onload=function(){i.decode?i.decode().then(s).catch(o):s()},i.onerror=o,i.src=n})}};function O(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?O(Object(r),!0).forEach(function(n){K(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Z=function(e){return e.filter(function(r){return r})},H=function(e){return Array.isArray(e)?e:[e]},f={},R=function(e,r){var n=!1;return new Promise(function(s,o){var i=function(u){return r(u).then(function(){n=!0,s(u)})};e.reduce(function(l,u){return l.catch(function(){if(!n)return i(u)})},i(e.shift())).catch(o)})};function U(t){var e=t.srcList,r=t.imgPromise,n=r===void 0?q({}):r,s=t.useSuspense,o=s===void 0?!0:s,i=b.useState(!1),l=i[1],u=Z(H(e)),c=u.join("");if(f[c]||(f[c]={promise:R(u,n),cache:"pending",error:null}),f[c].cache==="resolved")return{src:f[c].src,isLoading:!1,error:null};if(f[c].cache==="rejected"){if(o)throw f[c].error;return{isLoading:!1,error:f[c].error,src:void 0}}if(f[c].promise.then(function(d){f[c]=w(w({},f[c]),{},{cache:"resolved",src:d}),o||l(c)}).catch(function(d){f[c]=w(w({},f[c]),{},{cache:"rejected",error:d}),o||l(c)}),o)throw f[c].promise;return{isLoading:!0,src:void 0,error:null}}const E=b.memo(({device:t={},className:e})=>{var i;const r=(i=t.definition)==null?void 0:i.icon,n=T(t),s=[];r&&s.push(r),n&&s.push(n),n!==x&&s.push(x);const{src:o}=U({srcList:s});return a.jsx("img",{alt:t.ieee_address,crossOrigin:"anonymous",src:o,className:e})}),X=b.memo(t=>{const{t:e}=_("zigbee"),{device:r={},disabled:n,otaState:s,className:o,noIndicator:i}=t,l=b.useMemo(()=>r.interview_state===P.InProgress?a.jsx(m,{icon:D,spin:!0,title:e("interviewing"),className:"indicator-item indicator-bottom indicator-end text-info"}):r.interview_state===P.Failed?a.jsx(m,{icon:N,beat:!0,title:e("interview_failed"),className:"indicator-item indicator-bottom indicator-end text-error"}):r.supported?null:a.jsx(m,{icon:I,beat:!0,title:e("unsupported"),className:"indicator-item indicator-bottom indicator-end text-warning"}),[r.interview_state,r.supported,e]);return a.jsx(b.Suspense,{fallback:a.jsx("img",{alt:r.ieee_address,src:x}),children:a.jsx(C,{children:i?a.jsx(E,{device:r,className:`grid place-items-center${o?` ${o}`:""}`}):a.jsxs("div",{className:"indicator w-full",children:[s==="updating"&&a.jsx(m,{icon:L,spin:!0,title:e("updating_firmware"),className:"indicator-item indicator-top indicator-end text-info"}),l,n&&a.jsx(m,{icon:B,title:e("common:disabled"),className:"indicator-item indicator-middle indicator-center text-error",size:"2xl"}),a.jsx(E,{device:r,className:`grid place-items-center${o?` ${o}`:""}`})]})})})}),Y=b.memo(t=>{const{device:e,batteryPercent:r,batteryState:n,batteryLow:s,showLevel:o,...i}=t,{t:l}=_("zigbee");let u;switch(e!=null&&e.power_source&&(u=e.power_source),u){case"Battery":{let c=l("battery"),d="",p=v,y=!1;if(r!=null)d=`${r}%`,r>=85?p=v:r>=65?p=z:r>=40?p=S:r>=20?p=M:(p=h,y=!0);else if(n!=null)switch(d=n,n){case"high":p=v;break;case"medium":p=S;break;case"low":p=h,y=!0;break}else s!=null&&(d=s?"low":"ok",p=s?h:v);return s===!0&&(y=!0),d!==""&&(c+=`, ${l("power_level")}: ${d}`),a.jsxs("span",{className:y?"text-error":"",children:[a.jsx(m,{icon:p,fade:y,title:c,...i}),o&&a.jsx("span",{className:"ps-2",children:d})]})}case"Mains (single phase)":case"Mains (3 phase)":case"DC Source":return a.jsx(m,{icon:A,title:l(j(u)),...i});case"Emergency mains and transfer switch":case"Emergency mains constantly powered":return a.jsx(m,{icon:k,title:l(j(u)),...i});default:return(e==null?void 0:e.type)==="GreenPower"?a.jsx(m,{icon:$,title:"Green",...i}):a.jsx(m,{icon:F,title:u?l(j(u)):void 0,...i})}});export{X as D,Y as P};
1
+ import{j as a,F as m,Y as _,r as b,b as E,aj as P,bF as I,bG as D,J as L,bH as B,bI as $,bC as F,bJ as k,bg as A,bw as v,bx as z,by as S,bz as M,bq as h}from"./index-Cs-KexR1.js";import{g as T,a as x}from"./index-CUIfkU6p.js";import{s as j}from"./snakeCase-XNTmpa2i.js";function C({error:t,children:e}){return t?a.jsx(m,{icon:_,size:"3x",className:"text-error",title:"Missing image"}):e}function g(t){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function Q(t,e){if(g(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(g(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function q(t){var e=Q(t,"string");return g(e)=="symbol"?e:e+""}function G(t,e,r){return(e=q(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var K=function(t){var e=t.crossOrigin,r=e===void 0?"":e;return function(n){return new Promise(function(s,o){var i=new Image;r&&(i.crossOrigin=r),i.onload=function(){i.decode?i.decode().then(s).catch(o):s()},i.onerror=o,i.src=n})}};function O(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?O(Object(r),!0).forEach(function(n){G(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var H=function(e){return e.filter(function(r){return r})},J=function(e){return Array.isArray(e)?e:[e]},f={},Z=function(e,r){var n=!1;return new Promise(function(s,o){var i=function(u){return r(u).then(function(){n=!0,s(u)})};e.reduce(function(l,u){return l.catch(function(){if(!n)return i(u)})},i(e.shift())).catch(o)})};function R(t){var e=t.srcList,r=t.imgPromise,n=r===void 0?K({}):r,s=t.useSuspense,o=s===void 0?!0:s,i=b.useState(!1),l=i[1],u=H(J(e)),c=u.join("");if(f[c]||(f[c]={promise:Z(u,n),cache:"pending",error:null}),f[c].cache==="resolved")return{src:f[c].src,isLoading:!1,error:null};if(f[c].cache==="rejected"){if(o)throw f[c].error;return{isLoading:!1,error:f[c].error,src:void 0}}if(f[c].promise.then(function(d){f[c]=w(w({},f[c]),{},{cache:"resolved",src:d}),o||l(c)}).catch(function(d){f[c]=w(w({},f[c]),{},{cache:"rejected",error:d}),o||l(c)}),o)throw f[c].promise;return{isLoading:!0,src:void 0,error:null}}const N=b.memo(({device:t={},className:e})=>{var i;const r=(i=t.definition)==null?void 0:i.icon,n=T(t),s=[];r&&s.push(r),n&&s.push(n),n!==x&&s.push(x);const{src:o}=R({srcList:s});return a.jsx("img",{alt:t.ieee_address,crossOrigin:"anonymous",src:o,className:e})}),W=b.memo(t=>{const{t:e}=E("zigbee"),{device:r={},disabled:n,otaState:s,className:o,noIndicator:i}=t,l=b.useMemo(()=>r.interview_state===P.InProgress?a.jsx(m,{icon:I,spin:!0,title:e("interviewing"),className:"indicator-item indicator-bottom indicator-end text-info"}):r.interview_state===P.Failed?a.jsx(m,{icon:_,beat:!0,title:e("interview_failed"),className:"indicator-item indicator-bottom indicator-end text-error"}):r.supported?null:a.jsx(m,{icon:D,beat:!0,title:e("unsupported"),className:"indicator-item indicator-bottom indicator-end text-warning"}),[r.interview_state,r.supported,e]);return a.jsx(b.Suspense,{fallback:a.jsx("img",{alt:r.ieee_address,src:x}),children:a.jsx(C,{children:i?a.jsx(N,{device:r,className:`grid place-items-center${o?` ${o}`:""}`}):a.jsxs("div",{className:"indicator w-full",children:[s==="updating"&&a.jsx(m,{icon:L,spin:!0,title:e("updating_firmware"),className:"indicator-item indicator-top indicator-end text-info"}),l,n&&a.jsx(m,{icon:B,title:e("common:disabled"),className:"indicator-item indicator-middle indicator-center text-error",size:"2xl"}),a.jsx(N,{device:r,className:`grid place-items-center${o?` ${o}`:""}`})]})})})}),X=b.memo(t=>{const{device:e,batteryPercent:r,batteryState:n,batteryLow:s,showLevel:o,...i}=t,{t:l}=E("zigbee");let u;switch(e!=null&&e.power_source&&(u=e.power_source),u){case"Battery":{let c=l("battery"),d="",p=v,y=!1;if(r!=null)d=`${r}%`,r>=85?p=v:r>=65?p=z:r>=40?p=S:r>=20?p=M:(p=h,y=!0);else if(n!=null)switch(d=n,n){case"high":p=v;break;case"medium":p=S;break;case"low":p=h,y=!0;break}else s!=null&&(d=s?"low":"ok",p=s?h:v);return s===!0&&(y=!0),d!==""&&(c+=`, ${l("power_level")}: ${d}`),a.jsxs("span",{className:y?"text-error":"",children:[a.jsx(m,{icon:p,fade:y,title:c,...i}),o&&a.jsx("span",{className:"ps-2",children:d})]})}case"Mains (single phase)":case"Mains (3 phase)":case"DC Source":return a.jsx(m,{icon:A,title:l(j(u)),...i});case"Emergency mains and transfer switch":case"Emergency mains constantly powered":return a.jsx(m,{icon:k,title:l(j(u)),...i});default:return(e==null?void 0:e.type)==="GreenPower"?a.jsx(m,{icon:$,title:"Green",...i}):a.jsx(m,{icon:F,title:u?l(j(u)):void 0,...i})}});export{W as D,X as P};