homebridge-config-ui-x 5.0.0-beta.99 → 5.0.0

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 (205) hide show
  1. package/CHANGELOG.md +122 -5
  2. package/config.schema.json +1 -1
  3. package/dist/core/auth/auth.controller.d.ts +4 -0
  4. package/dist/core/config/config.service.d.ts +8 -0
  5. package/dist/core/config/config.service.js +2 -0
  6. package/dist/core/config/config.service.js.map +1 -1
  7. package/dist/main.js +1 -0
  8. package/dist/main.js.map +1 -1
  9. package/dist/modules/backup/backup.controller.d.ts +1 -0
  10. package/dist/modules/backup/backup.controller.js +11 -0
  11. package/dist/modules/backup/backup.controller.js.map +1 -1
  12. package/dist/modules/backup/backup.service.d.ts +1 -0
  13. package/dist/modules/backup/backup.service.js +19 -5
  14. package/dist/modules/backup/backup.service.js.map +1 -1
  15. package/dist/modules/config-editor/config-editor.service.js +2 -1
  16. package/dist/modules/config-editor/config-editor.service.js.map +1 -1
  17. package/dist/modules/platform-tools/docker/docker.service.js +8 -2
  18. package/dist/modules/platform-tools/docker/docker.service.js.map +1 -1
  19. package/dist/modules/plugins/plugins.controller.d.ts +2 -0
  20. package/dist/modules/plugins/plugins.controller.js +1 -1
  21. package/dist/modules/plugins/plugins.controller.js.map +1 -1
  22. package/dist/modules/plugins/plugins.service.d.ts +3 -0
  23. package/dist/modules/plugins/plugins.service.js +81 -47
  24. package/dist/modules/plugins/plugins.service.js.map +1 -1
  25. package/dist/modules/server/server.controller.d.ts +5 -0
  26. package/dist/modules/server/server.controller.js +25 -0
  27. package/dist/modules/server/server.controller.js.map +1 -1
  28. package/dist/modules/server/server.service.d.ts +9 -1
  29. package/dist/modules/server/server.service.js +97 -21
  30. package/dist/modules/server/server.service.js.map +1 -1
  31. package/dist/modules/status/status.gateway.d.ts +6 -0
  32. package/dist/modules/status/status.gateway.js +14 -0
  33. package/dist/modules/status/status.gateway.js.map +1 -1
  34. package/dist/modules/status/status.service.d.ts +26 -0
  35. package/dist/modules/status/status.service.js +112 -0
  36. package/dist/modules/status/status.service.js.map +1 -1
  37. package/package.json +11 -11
  38. package/public/3rdpartylicenses.txt +214 -187
  39. package/public/assets/hap-icons/{airpurifier.svg → air-purifier.svg} +11 -11
  40. package/public/assets/hap-icons/doorbell.svg +17 -0
  41. package/public/assets/hap-icons/filter-maintenance.svg +26 -0
  42. package/public/assets/hap-icons/microphone.svg +22 -0
  43. package/public/assets/hap-icons/security-system-active.svg +103 -0
  44. package/public/assets/hap-icons/{smokesensor.svg → smoke-sensor.svg} +15 -2
  45. package/public/assets/hap-icons/speaker.svg +27 -12
  46. package/public/assets/hap-icons/vacuum-off.svg +34 -0
  47. package/public/assets/hap-icons/vacuum-on.svg +73 -0
  48. package/public/chunk-2RH7XRJB.js +1 -0
  49. package/public/chunk-2V6GVJIK.js +1 -0
  50. package/public/chunk-3UCLNJIE.js +1 -0
  51. package/public/chunk-4J2HTHMW.js +1 -0
  52. package/public/chunk-4NQG4OIB.js +1 -0
  53. package/public/chunk-52HWZQJT.js +1 -0
  54. package/public/chunk-56R3JRVX.js +1 -0
  55. package/public/chunk-65A2CLMB.js +1 -0
  56. package/public/chunk-6LPAR6QB.js +1 -0
  57. package/public/chunk-6VMMFEEB.js +1 -0
  58. package/public/chunk-7RQP64IZ.js +12 -0
  59. package/public/{chunk-GMY5QOXR.js → chunk-BG5MCCBU.js} +6 -6
  60. package/public/chunk-C3HWKB2Q.js +5 -0
  61. package/public/{chunk-YJXHSHNO.js → chunk-CEVLFYVV.js} +1 -1
  62. package/public/chunk-CHYWVK3W.js +1 -0
  63. package/public/chunk-CR7NFTHI.js +4 -0
  64. package/public/{chunk-BRW7C4BZ.js → chunk-CXP6VKNZ.js} +1 -1
  65. package/public/chunk-CY3O5ACI.js +1 -0
  66. package/public/chunk-D5MSFLIQ.js +1 -0
  67. package/public/chunk-DVQU3KHF.js +1 -0
  68. package/public/chunk-EGPBTPS6.js +1 -0
  69. package/public/chunk-EI76KND2.js +2 -0
  70. package/public/chunk-EP7NNPU2.js +1 -0
  71. package/public/chunk-ESCMWFTR.js +1 -0
  72. package/public/chunk-FDBWBMB3.js +1 -0
  73. package/public/chunk-FO44GZVZ.js +5 -0
  74. package/public/chunk-FWNSHSUQ.js +1 -0
  75. package/public/chunk-G4DWZG7U.js +1 -0
  76. package/public/{chunk-2G7GNBIF.js → chunk-GEIS2BWE.js} +1 -1
  77. package/public/chunk-GPZM245P.js +1 -0
  78. package/public/chunk-H2VHR6F4.js +1 -0
  79. package/public/chunk-H5PKL3FP.js +2 -0
  80. package/public/chunk-HFVA7EOG.js +23 -0
  81. package/public/chunk-HU7QTSUZ.js +1 -0
  82. package/public/{chunk-IOWBVW62.js → chunk-HUAADM2I.js} +1 -1
  83. package/public/{chunk-WAA5KWIN.js → chunk-J7Q5BUJW.js} +1 -1
  84. package/public/chunk-KDVPFRHN.js +1 -0
  85. package/public/chunk-KOHQYRVP.js +20 -0
  86. package/public/chunk-MWGI7ZLY.js +28 -0
  87. package/public/chunk-NEZ6TZYE.js +1 -0
  88. package/public/chunk-OLDRUBZS.js +1 -0
  89. package/public/chunk-OYH4UIAH.js +1 -0
  90. package/public/chunk-Q4CZ7LVK.js +2 -0
  91. package/public/{chunk-RNHMRKPJ.js → chunk-QIOCGI3G.js} +5 -5
  92. package/public/chunk-QTTC6A7P.js +1 -0
  93. package/public/chunk-QUD3RGWL.js +1 -0
  94. package/public/{chunk-QMB5XE4Y.js → chunk-R3563DDE.js} +1 -1
  95. package/public/{chunk-B3LZRDAG.js → chunk-S42WFQ2L.js} +1 -1
  96. package/public/{chunk-UVOJ3BF7.js → chunk-THGDS273.js} +1 -1
  97. package/public/chunk-TSAWRS7P.js +8 -0
  98. package/public/chunk-U4GBERFR.js +1 -0
  99. package/public/chunk-UB4DU2JC.js +1 -0
  100. package/public/chunk-UJNEXGXC.js +1 -0
  101. package/public/chunk-ULJPS3WS.js +7 -0
  102. package/public/{chunk-XHI7IAUN.js → chunk-W4PQWIYG.js} +1 -1
  103. package/public/chunk-W542IB6H.js +1 -0
  104. package/public/{chunk-UTAVUGTT.js → chunk-WDFAWIMZ.js} +7 -7
  105. package/public/chunk-WF776GWR.js +1 -0
  106. package/public/chunk-WFYBML4S.js +1 -0
  107. package/public/chunk-XFFCMC6L.js +4 -0
  108. package/public/chunk-XIYHNDRN.js +1 -0
  109. package/public/chunk-YJ2Q2RAD.js +1 -0
  110. package/public/chunk-YYDFCQK6.js +3 -0
  111. package/public/chunk-YZN5MPV3.js +1 -0
  112. package/public/chunk-ZR6LFO7Q.js +1 -0
  113. package/public/index.html +2 -2
  114. package/public/main-I6NBG3JJ.js +1 -0
  115. package/public/{styles-PKR3EGHP.css → styles-ZKWHTEN5.css} +1 -1
  116. package/scripts/upgrade-install-plugin.sh +6 -1
  117. package/public/chunk-2CDSAOHD.js +0 -1
  118. package/public/chunk-2OUR67N4.js +0 -1
  119. package/public/chunk-3CYHPVRJ.js +0 -1
  120. package/public/chunk-3DF7CHZW.js +0 -1
  121. package/public/chunk-5F327T7H.js +0 -1
  122. package/public/chunk-6CNQKPV4.js +0 -1
  123. package/public/chunk-AF2VUIEE.js +0 -1
  124. package/public/chunk-ALG7CIS3.js +0 -5
  125. package/public/chunk-BGDBPFZN.js +0 -1
  126. package/public/chunk-BIRWL4X3.js +0 -1
  127. package/public/chunk-BMCQHGMB.js +0 -1
  128. package/public/chunk-BSGFKU4J.js +0 -4
  129. package/public/chunk-C6A3CFIK.js +0 -1
  130. package/public/chunk-C6LXQBT3.js +0 -1
  131. package/public/chunk-CG7LPZUJ.js +0 -1
  132. package/public/chunk-CLQDCNVA.js +0 -2
  133. package/public/chunk-CMO7ESK6.js +0 -8
  134. package/public/chunk-DDFZVHUO.js +0 -1
  135. package/public/chunk-DGIKPYZP.js +0 -8
  136. package/public/chunk-DNW5N3YO.js +0 -1
  137. package/public/chunk-EGELGD5H.js +0 -1
  138. package/public/chunk-EJBJOBK4.js +0 -1
  139. package/public/chunk-F4KGCHEZ.js +0 -1
  140. package/public/chunk-FATD52DV.js +0 -1
  141. package/public/chunk-FXS45ML3.js +0 -1
  142. package/public/chunk-G6KG4MKA.js +0 -1
  143. package/public/chunk-GTAHH5HN.js +0 -1
  144. package/public/chunk-HLTIIGIP.js +0 -1
  145. package/public/chunk-HLTWQSH5.js +0 -1
  146. package/public/chunk-IORHLUIJ.js +0 -1
  147. package/public/chunk-JADR4A63.js +0 -1
  148. package/public/chunk-KAUSPTCQ.js +0 -23
  149. package/public/chunk-KCQQTZKO.js +0 -5
  150. package/public/chunk-L3HD45SY.js +0 -6
  151. package/public/chunk-LDLWF7GI.js +0 -1
  152. package/public/chunk-LHL5TI6S.js +0 -1
  153. package/public/chunk-LX47K6J2.js +0 -1
  154. package/public/chunk-M2H64FFG.js +0 -1
  155. package/public/chunk-OAQSXFHE.js +0 -1
  156. package/public/chunk-ODU3K7H7.js +0 -1
  157. package/public/chunk-P3KVHPZJ.js +0 -1
  158. package/public/chunk-P64V4GHS.js +0 -29
  159. package/public/chunk-PI76B7WZ.js +0 -1
  160. package/public/chunk-PNSPASX3.js +0 -1
  161. package/public/chunk-PODF4FUD.js +0 -1
  162. package/public/chunk-PUIKXI6O.js +0 -1
  163. package/public/chunk-QIH36FRX.js +0 -1
  164. package/public/chunk-QMAGO5VD.js +0 -20
  165. package/public/chunk-R3VPSO5X.js +0 -7
  166. package/public/chunk-RFFIRBUY.js +0 -1
  167. package/public/chunk-RLGSRK2P.js +0 -1
  168. package/public/chunk-RN4NDBWE.js +0 -1
  169. package/public/chunk-U2HZ2JFO.js +0 -1
  170. package/public/chunk-VA5XNGEK.js +0 -1
  171. package/public/chunk-VHTQTL2S.js +0 -1
  172. package/public/chunk-VJEUBTTK.js +0 -1
  173. package/public/chunk-VLX322GM.js +0 -1
  174. package/public/chunk-VUYAK52W.js +0 -2
  175. package/public/chunk-X6PEPNG4.js +0 -1
  176. package/public/chunk-XP6B4WXR.js +0 -1
  177. package/public/chunk-XUH357B7.js +0 -1
  178. package/public/chunk-Y4QFUO3K.js +0 -1
  179. package/public/chunk-YZCEDH6X.js +0 -1
  180. package/public/chunk-YZWIZGAQ.js +0 -1
  181. package/public/chunk-ZF22CBM2.js +0 -1
  182. package/public/chunk-ZIBK7SYP.js +0 -1
  183. package/public/chunk-ZLCELPBH.js +0 -1
  184. package/public/chunk-ZMYR3JWC.js +0 -1
  185. package/public/main-AS7ULDAC.js +0 -1
  186. /package/public/assets/hap-icons/{airquality.svg → air-quality-sensor.svg} +0 -0
  187. /package/public/assets/hap-icons/{co2-sensor.svg → carbon-dioxide-sensor.svg} +0 -0
  188. /package/public/assets/hap-icons/{co-sensor.svg → carbon-monoxide-sensor.svg} +0 -0
  189. /package/public/assets/hap-icons/{contactsensor-closed.svg → contact-sensor-closed.svg} +0 -0
  190. /package/public/assets/hap-icons/{contactsensor-open.svg → contact-sensor-open.svg} +0 -0
  191. /package/public/assets/hap-icons/{garagedoor.svg → garage-door.svg} +0 -0
  192. /package/public/assets/hap-icons/{humidity.svg → humidity-sensor.svg} +0 -0
  193. /package/public/assets/hap-icons/{leaksensor.svg → leak-sensor.svg} +0 -0
  194. /package/public/assets/hap-icons/{lightbulb.svg → light-bulb.svg} +0 -0
  195. /package/public/assets/hap-icons/{light.svg → light-sensor.svg} +0 -0
  196. /package/public/assets/hap-icons/{motionsensor.svg → motion-sensor.svg} +0 -0
  197. /package/public/assets/hap-icons/{occupancysensor.svg → occupancy-sensor.svg} +0 -0
  198. /package/public/assets/hap-icons/{securitysystem-off.svg → security-system-off.svg} +0 -0
  199. /package/public/assets/hap-icons/{securitysystem-active.svg → security-system-triggered.svg} +0 -0
  200. /package/public/assets/hap-icons/{statelessprogrammableswitch.svg → stateless-programmable-switch.svg} +0 -0
  201. /package/public/assets/hap-icons/{valve-waterfaucet.svg → valve-faucet.svg} +0 -0
  202. /package/public/assets/hap-icons/{valve-showerhead.svg → valve-shower-head.svg} +0 -0
  203. /package/public/assets/hap-icons/{windowcovering-closed.svg → window-covering-closed.svg} +0 -0
  204. /package/public/assets/hap-icons/{windowcovering-open.svg → window-covering-open.svg} +0 -0
  205. /package/public/{polyfills-GCAZ7JAV.js → polyfills-WE4HA5DL.js} +0 -0
@@ -1,6 +0,0 @@
1
- import{a as cr}from"./chunk-KCQQTZKO.js";import{U as or,a as Qo,b as Jo,c as Zo,d as tn,f as sr}from"./chunk-CMO7ESK6.js";import{a as fi,b as ir}from"./chunk-VJEUBTTK.js";import{a as nr,b as Kn,o as dr,w as hr}from"./chunk-P64V4GHS.js";import{a as rr}from"./chunk-UVOJ3BF7.js";import{a as lr}from"./chunk-DGIKPYZP.js";import{a as ar}from"./chunk-RNHMRKPJ.js";import{m as Ye,n as Xe,o as Qi,p as Ko}from"./chunk-ALG7CIS3.js";import{b as Bo,c as Vo,e as Ho,l as No,n as jo,r as Uo,s as Yo,t as Xo,u as Go,v as qo,z as Ki}from"./chunk-VLX322GM.js";import{e as tr}from"./chunk-2G7GNBIF.js";import{a as _t}from"./chunk-YJXHSHNO.js";import{b as er}from"./chunk-B3LZRDAG.js";import{a as ac,b as zt}from"./chunk-XHI7IAUN.js";import{k as Ji,m as Zi,n as Ge}from"./chunk-XUH357B7.js";import{b as Gi,e as qi}from"./chunk-VUYAK52W.js";import{a as Gt,b as Z}from"./chunk-QMB5XE4Y.js";import{$ as ji,$a as f,Ac as w,Bc as S,Ca as hi,Cc as Mt,F as Mo,Fa as he,Fb as Ro,G as Yt,Gb as Ct,Hb as D,Ib as $,Jb as Un,K as To,Kb as Lt,Lb as wt,Lc as xt,M as Hi,Mb as vt,Nb as z,Nc as Ao,O as Po,Ob as x,Pb as m,Q as Ni,Qb as W,Ub as j,Xb as X,Yb as k,Zb as Yn,_b as Xn,a as kt,aa as Nn,b as de,ba as jn,bd as rt,cb as Wo,dc as bt,e as oc,eb as ui,ec as Xt,ed as Ce,fb as Wt,g as rc,ga as Eo,gc as Fo,gd as Ui,h as tt,ha as Do,hd as Yi,id as Xi,ja as $o,jc as y,jd as we,kc as T,la as R,lb as Y,lc as V,mb as Lo,mc as ne,n as ie,nb as zo,nc as Gn,o as So,qc as ft,r as Io,ra as A,rc as gt,sa as B,sc as mt,tb as ye,ua as Oo,ub as pi,w as At,wc as ot,x as ko,xc as Bt,yc as qn}from"./chunk-R3VPSO5X.js";var sc=oc((__,bm)=>{bm.exports=[{component:"UpdateInfoWidgetComponent",x:0,y:6,cols:4,rows:6,mobileOrder:10,hidePort:!0,hideOnMobile:!1,draggable:!0},{component:"BridgesWidgetComponent",x:15,y:0,cols:5,rows:12,mobileOrder:35,hideOnMobile:!1,draggable:!0},{component:"CpuWidgetComponent",x:4,y:0,cols:5,rows:3,mobileOrder:40,hideOnMobile:!1,draggable:!0,refreshInterval:10,historyItems:60},{component:"MemoryWidgetComponent",x:4,y:3,cols:5,rows:3,mobileOrder:50,hideOnMobile:!1,draggable:!0,refreshInterval:10,historyItems:60},{component:"NetworkWidgetComponent",x:4,y:6,cols:5,rows:3,mobileOrder:55,hideOnMobile:!1,draggable:!0,refreshInterval:10,historyItems:60,networkInterface:"en0"},{component:"UptimeWidgetComponent",x:4,y:9,cols:5,rows:3,mobileOrder:60,hideOnMobile:!1,draggable:!0},{component:"SystemInfoWidgetComponent",x:9,y:0,cols:6,rows:12,mobileOrder:70,hideOnMobile:!1,draggable:!0},{component:"HapQrcodeWidgetComponent",x:0,y:0,cols:4,rows:6,mobileOrder:100,hideOnMobile:!1,draggable:!0},{component:"HomebridgeLogsWidgetComponent",x:0,y:12,cols:20,rows:7,mobileOrder:1e3,hideOnMobile:!0,draggable:!0}]});var fr=["*"];function lc(i,e){if(i&1&&W(0,"div",0),i&2){let t=e.$index,n=k();z("ngStyle",n.gridRenderer.getGridColumnStyle(t))}}function cc(i,e){if(i&1&&W(0,"div",1),i&2){let t=e.$index,n=k();z("ngStyle",n.gridRenderer.getGridRowStyle(t))}}function dc(i,e){if(i&1){let t=j();x(0,"div",8),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}function hc(i,e){if(i&1){let t=j();x(0,"div",9),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}function uc(i,e){if(i&1){let t=j();x(0,"div",10),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}function pc(i,e){if(i&1){let t=j();x(0,"div",11),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}function fc(i,e){if(i&1){let t=j();x(0,"div",12),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}function gc(i,e){if(i&1){let t=j();x(0,"div",13),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}function mc(i,e){if(i&1){let t=j();x(0,"div",14),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}function bc(i,e){if(i&1){let t=j();x(0,"div",15),X("mousedown",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))})("touchstart",function(s){A(t);let o=k();return B(o.resize.dragStartDelay(s))}),m()}}var Q=function(i){return i.Fit="fit",i.ScrollVertical="scrollVertical",i.ScrollHorizontal="scrollHorizontal",i.Fixed="fixed",i.VerticalFixed="verticalFixed",i.HorizontalFixed="horizontalFixed",i}(Q||{}),gr=function(i){return i.Always="always",i.OnDragAndResize="onDrag&Resize",i.None="none",i}(gr||{}),at=function(i){return i.None="none",i.CompactUp="compactUp",i.CompactLeft="compactLeft",i.CompactUpAndLeft="compactUp&Left",i.CompactLeftAndUp="compactLeft&Up",i.CompactRight="compactRight",i.CompactUpAndRight="compactUp&Right",i.CompactRightAndUp="compactRight&Up",i.CompactDown="compactDown",i.CompactDownAndLeft="compactDown&Left",i.CompactLeftAndDown="compactLeft&Down",i.CompactDownAndRight="compactDown&Right",i.CompactRightAndDown="compactRight&Down",i}(at||{}),Pt=function(i){return i.LTR="ltr",i.RTL="rtl",i}(Pt||{}),Qn=class{gridster;constructor(e){this.gridster=e}destroy(){this.gridster=null}checkCompact(){this.gridster.$options.compactType!==at.None&&(this.gridster.$options.compactType===at.CompactUp?this.checkCompactMovement("y",-1):this.gridster.$options.compactType===at.CompactLeft?this.checkCompactMovement("x",-1):this.gridster.$options.compactType===at.CompactUpAndLeft?(this.checkCompactMovement("y",-1),this.checkCompactMovement("x",-1)):this.gridster.$options.compactType===at.CompactLeftAndUp?(this.checkCompactMovement("x",-1),this.checkCompactMovement("y",-1)):this.gridster.$options.compactType===at.CompactRight?this.checkCompactMovement("x",1):this.gridster.$options.compactType===at.CompactUpAndRight?(this.checkCompactMovement("y",-1),this.checkCompactMovement("x",1)):this.gridster.$options.compactType===at.CompactRightAndUp?(this.checkCompactMovement("x",1),this.checkCompactMovement("y",-1)):this.gridster.$options.compactType===at.CompactDown?this.checkCompactMovement("y",1):this.gridster.$options.compactType===at.CompactDownAndLeft?(this.checkCompactMovement("y",1),this.checkCompactMovement("x",-1)):this.gridster.$options.compactType===at.CompactDownAndRight?(this.checkCompactMovement("y",1),this.checkCompactMovement("x",1)):this.gridster.$options.compactType===at.CompactLeftAndDown?(this.checkCompactMovement("x",-1),this.checkCompactMovement("y",1)):this.gridster.$options.compactType===at.CompactRightAndDown&&(this.checkCompactMovement("x",1),this.checkCompactMovement("y",1)))}checkCompactItem(e){this.gridster.$options.compactType!==at.None&&(this.gridster.$options.compactType===at.CompactUp?this.moveTillCollision(e,"y",-1):this.gridster.$options.compactType===at.CompactLeft?this.moveTillCollision(e,"x",-1):this.gridster.$options.compactType===at.CompactUpAndLeft?(this.moveTillCollision(e,"y",-1),this.moveTillCollision(e,"x",-1)):this.gridster.$options.compactType===at.CompactLeftAndUp?(this.moveTillCollision(e,"x",-1),this.moveTillCollision(e,"y",-1)):this.gridster.$options.compactType===at.CompactUpAndRight?(this.moveTillCollision(e,"y",-1),this.moveTillCollision(e,"x",1)):this.gridster.$options.compactType===at.CompactDown?this.moveTillCollision(e,"y",1):this.gridster.$options.compactType===at.CompactDownAndLeft?(this.moveTillCollision(e,"y",1),this.moveTillCollision(e,"x",-1)):this.gridster.$options.compactType===at.CompactLeftAndDown?(this.moveTillCollision(e,"x",-1),this.moveTillCollision(e,"y",1)):this.gridster.$options.compactType===at.CompactDownAndRight?(this.moveTillCollision(e,"y",1),this.moveTillCollision(e,"x",1)):this.gridster.$options.compactType===at.CompactRightAndDown&&(this.moveTillCollision(e,"x",1),this.moveTillCollision(e,"y",1)))}checkCompactMovement(e,t){let n=!1;this.gridster.grid.forEach(s=>{s.$item.compactEnabled!==!1&&this.moveTillCollision(s.$item,e,t)&&(n=!0,s.item[e]=s.$item[e],s.itemChanged())}),n&&this.checkCompact()}moveTillCollision(e,t,n){return e[t]+=n,this.gridster.checkCollision(e)?(e[t]-=n,!1):(this.moveTillCollision(e,t,n),!0)}},xc={gridType:Q.Fit,scale:1,fixedColWidth:250,fixedRowHeight:250,keepFixedHeightInMobile:!1,keepFixedWidthInMobile:!1,setGridSize:!1,compactType:at.None,mobileBreakpoint:640,useBodyForBreakpoint:!1,allowMultiLayer:!1,defaultLayerIndex:0,maxLayerIndex:2,baseLayerIndex:1,minCols:1,maxCols:100,minRows:1,maxRows:100,defaultItemCols:1,defaultItemRows:1,maxItemCols:50,maxItemRows:50,minItemCols:1,minItemRows:1,minItemArea:1,maxItemArea:2500,addEmptyRowsCount:0,rowHeightRatio:1,margin:10,outerMargin:!0,outerMarginTop:null,outerMarginRight:null,outerMarginBottom:null,outerMarginLeft:null,useTransformPositioning:!0,scrollSensitivity:10,scrollSpeed:20,initCallback:void 0,destroyCallback:void 0,gridSizeChangedCallback:void 0,itemChangeCallback:void 0,itemResizeCallback:void 0,itemInitCallback:void 0,itemRemovedCallback:void 0,itemValidateCallback:void 0,enableEmptyCellClick:!1,enableEmptyCellContextMenu:!1,enableEmptyCellDrop:!1,enableEmptyCellDrag:!1,enableOccupiedCellDrop:!1,emptyCellClickCallback:void 0,emptyCellContextMenuCallback:void 0,emptyCellDropCallback:void 0,emptyCellDragCallback:void 0,emptyCellDragMaxCols:50,emptyCellDragMaxRows:50,ignoreMarginInRow:!1,draggable:{delayStart:0,enabled:!1,ignoreContentClass:"gridster-item-content",ignoreContent:!1,dragHandleClass:"drag-handler",stop:void 0,start:void 0,dropOverItems:!1,dropOverItemsCallback:void 0},resizable:{delayStart:0,enabled:!1,handles:{s:!0,e:!0,n:!0,w:!0,se:!0,ne:!0,sw:!0,nw:!0},stop:void 0,start:void 0},swap:!0,swapWhileDragging:!1,pushItems:!1,disablePushOnDrag:!1,disablePushOnResize:!1,pushDirections:{north:!0,east:!0,south:!0,west:!0},pushResizeItems:!1,displayGrid:gr.OnDragAndResize,disableWindowResize:!1,disableWarnings:!1,scrollToNewItems:!1,disableScrollHorizontal:!1,disableScrollVertical:!1,enableBoundaryControl:!1,disableAutoPositionOnConflict:!1,dirType:Pt.LTR},Rt=class i{static merge(e,t,n){for(let s in t)t[s]!==void 0&&n.hasOwnProperty(s)&&(typeof t[s]=="object"?(s in e||(e[s]={}),e[s]=i.merge(e[s],t[s],n[s])):e[s]=t[s]);return e}static checkTouchEvent(e){e.clientX===void 0&&e.touches&&(e.touches&&e.touches.length?(e.clientX=e.touches[0].clientX,e.clientY=e.touches[0].clientY):e.changedTouches&&e.changedTouches.length&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY))}static checkContentClassForEvent(e,t){if(e.$options.draggable.ignoreContent){if(!i.checkDragHandleClass(t.target,t.currentTarget,e.$options.draggable.dragHandleClass,e.$options.draggable.ignoreContentClass))return!0}else if(i.checkContentClass(t.target,t.currentTarget,e.$options.draggable.ignoreContentClass))return!0;return!1}static checkContentClassForEmptyCellClickEvent(e,t){return i.checkContentClass(t.target,t.currentTarget,e.$options.draggable.ignoreContentClass)||i.checkContentClass(t.target,t.currentTarget,e.$options.draggable.dragHandleClass)}static checkDragHandleClass(e,t,n,s){if(!e||e===t)return!1;if(e.hasAttribute("class")){let o=e.getAttribute("class").split(" ");if(o.indexOf(n)>-1)return!0;if(o.indexOf(s)>-1)return!1}return i.checkDragHandleClass(e.parentNode,t,n,s)}static checkContentClass(e,t,n){return!e||e===t?!1:e.hasAttribute("class")&&e.getAttribute("class").split(" ").indexOf(n)>-1?!0:i.checkContentClass(e.parentNode,t,n)}static compareItems(e,t){return e.y>t.y?-1:e.y<t.y?1:e.x>t.x?-1:1}},Jn=class{gridster;initialItem;removeEmptyCellClickListenerFn;removeEmptyCellTouchendListenerFn;removeEmptyCellContextMenuListenerFn;removeEmptyCellDropListenerFn;removeEmptyCellMousedownListenerFn;removeEmptyCellTouchstartListenerFn;removeWindowMousemoveListenerFn;removeWindowTouchmoveListenerFn;removeWindowMouseupListenerFn;removeWindowTouchendListenerFn;removeEmptyCellDragoverListenerFn;removeDocumentDragendListenerFn;constructor(e){this.gridster=e}destroy(){this.gridster.previewStyle&&this.gridster.previewStyle(),this.gridster.movingItem=null,this.initialItem=this.gridster=null,this.removeDocumentDragendListenerFn&&(this.removeDocumentDragendListenerFn(),this.removeDocumentDragendListenerFn=null)}updateOptions(){this.gridster.$options.enableEmptyCellClick&&!this.removeEmptyCellClickListenerFn&&this.gridster.options.emptyCellClickCallback?(this.removeEmptyCellClickListenerFn=this.gridster.renderer.listen(this.gridster.el,"click",this.emptyCellClickCb),this.removeEmptyCellTouchendListenerFn=this.gridster.renderer.listen(this.gridster.el,"touchend",this.emptyCellClickCb)):!this.gridster.$options.enableEmptyCellClick&&this.removeEmptyCellClickListenerFn&&this.removeEmptyCellTouchendListenerFn&&(this.removeEmptyCellClickListenerFn(),this.removeEmptyCellTouchendListenerFn(),this.removeEmptyCellClickListenerFn=null,this.removeEmptyCellTouchendListenerFn=null),this.gridster.$options.enableEmptyCellContextMenu&&!this.removeEmptyCellContextMenuListenerFn&&this.gridster.options.emptyCellContextMenuCallback?this.removeEmptyCellContextMenuListenerFn=this.gridster.renderer.listen(this.gridster.el,"contextmenu",this.emptyCellContextMenuCb):!this.gridster.$options.enableEmptyCellContextMenu&&this.removeEmptyCellContextMenuListenerFn&&(this.removeEmptyCellContextMenuListenerFn(),this.removeEmptyCellContextMenuListenerFn=null),this.gridster.$options.enableEmptyCellDrop&&!this.removeEmptyCellDropListenerFn&&this.gridster.options.emptyCellDropCallback?(this.removeEmptyCellDropListenerFn=this.gridster.renderer.listen(this.gridster.el,"drop",this.emptyCellDragDrop),this.gridster.zone.runOutsideAngular(()=>{this.removeEmptyCellDragoverListenerFn=this.gridster.renderer.listen(this.gridster.el,"dragover",this.emptyCellDragOver)}),this.removeDocumentDragendListenerFn=this.gridster.renderer.listen("document","dragend",()=>{this.gridster.movingItem=null,this.gridster.previewStyle()})):!this.gridster.$options.enableEmptyCellDrop&&this.removeEmptyCellDropListenerFn&&this.removeEmptyCellDragoverListenerFn&&this.removeDocumentDragendListenerFn&&(this.removeEmptyCellDropListenerFn(),this.removeEmptyCellDragoverListenerFn(),this.removeDocumentDragendListenerFn(),this.removeEmptyCellDragoverListenerFn=null,this.removeEmptyCellDropListenerFn=null,this.removeDocumentDragendListenerFn=null),this.gridster.$options.enableEmptyCellDrag&&!this.removeEmptyCellMousedownListenerFn&&this.gridster.options.emptyCellDragCallback?(this.removeEmptyCellMousedownListenerFn=this.gridster.renderer.listen(this.gridster.el,"mousedown",this.emptyCellMouseDown),this.removeEmptyCellTouchstartListenerFn=this.gridster.renderer.listen(this.gridster.el,"touchstart",this.emptyCellMouseDown)):!this.gridster.$options.enableEmptyCellDrag&&this.removeEmptyCellMousedownListenerFn&&this.removeEmptyCellTouchstartListenerFn&&(this.removeEmptyCellMousedownListenerFn(),this.removeEmptyCellTouchstartListenerFn(),this.removeEmptyCellMousedownListenerFn=null,this.removeEmptyCellTouchstartListenerFn=null)}emptyCellClickCb=e=>{if(!this.gridster||this.gridster.movingItem||Rt.checkContentClassForEmptyCellClickEvent(this.gridster,e))return;let t=this.getValidItemFromEvent(e);t&&(this.gridster.options.emptyCellClickCallback&&this.gridster.options.emptyCellClickCallback(e,t),this.gridster.cdRef.markForCheck())};emptyCellContextMenuCb=e=>{if(this.gridster.movingItem||Rt.checkContentClassForEmptyCellClickEvent(this.gridster,e))return;e.preventDefault(),e.stopPropagation();let t=this.getValidItemFromEvent(e);t&&(this.gridster.options.emptyCellContextMenuCallback&&this.gridster.options.emptyCellContextMenuCallback(e,t),this.gridster.cdRef.markForCheck())};emptyCellDragDrop=e=>{let t=this.getValidItemFromEvent(e);t&&(this.gridster.options.emptyCellDropCallback&&this.gridster.options.emptyCellDropCallback(e,t),this.gridster.cdRef.markForCheck())};emptyCellDragOver=e=>{e.preventDefault(),e.stopPropagation();let t=this.getValidItemFromEvent(e);t?(e.dataTransfer&&(e.dataTransfer.dropEffect="move"),this.gridster.movingItem=t):(e.dataTransfer&&(e.dataTransfer.dropEffect="none"),this.gridster.movingItem=null),this.gridster.previewStyle()};emptyCellMouseDown=e=>{if(Rt.checkContentClassForEmptyCellClickEvent(this.gridster,e))return;e.preventDefault(),e.stopPropagation();let t=this.getValidItemFromEvent(e);!t||e.buttons!==1&&!(e instanceof TouchEvent)||(this.initialItem=t,this.gridster.movingItem=t,this.gridster.previewStyle(),this.gridster.zone.runOutsideAngular(()=>{this.removeWindowMousemoveListenerFn=this.gridster.renderer.listen("window","mousemove",this.emptyCellMouseMove),this.removeWindowTouchmoveListenerFn=this.gridster.renderer.listen("window","touchmove",this.emptyCellMouseMove)}),this.removeWindowMouseupListenerFn=this.gridster.renderer.listen("window","mouseup",this.emptyCellMouseUp),this.removeWindowTouchendListenerFn=this.gridster.renderer.listen("window","touchend",this.emptyCellMouseUp))};emptyCellMouseMove=e=>{e.preventDefault(),e.stopPropagation();let t=this.getValidItemFromEvent(e,this.initialItem);t&&(this.gridster.movingItem=t,this.gridster.previewStyle())};emptyCellMouseUp=e=>{this.removeWindowMousemoveListenerFn(),this.removeWindowTouchmoveListenerFn(),this.removeWindowMouseupListenerFn(),this.removeWindowTouchendListenerFn();let t=this.getValidItemFromEvent(e,this.initialItem);t&&(this.gridster.movingItem=t),this.gridster.options.emptyCellDragCallback&&this.gridster.movingItem&&this.gridster.options.emptyCellDragCallback(e,this.gridster.movingItem),setTimeout(()=>{this.initialItem=null,this.gridster&&(this.gridster.movingItem=null,this.gridster.previewStyle())}),this.gridster.cdRef.markForCheck()};getPixelsX(e,t){let n=this.gridster.options.scale;return n?(e.clientX-t.left)/n+this.gridster.el.scrollLeft-this.gridster.gridRenderer.getLeftMargin():e.clientX+this.gridster.el.scrollLeft-t.left-this.gridster.gridRenderer.getLeftMargin()}getPixelsY(e,t){let n=this.gridster.options.scale;return n?(e.clientY-t.top)/n+this.gridster.el.scrollTop-this.gridster.gridRenderer.getTopMargin():e.clientY+this.gridster.el.scrollTop-t.top-this.gridster.gridRenderer.getTopMargin()}getValidItemFromEvent(e,t){e.preventDefault(),e.stopPropagation(),Rt.checkTouchEvent(e);let n=this.gridster.el.getBoundingClientRect(),s=this.getPixelsX(e,n),o=this.getPixelsY(e,n),r={x:this.gridster.pixelsToPositionX(s,Math.floor,!0),y:this.gridster.pixelsToPositionY(o,Math.floor,!0),cols:this.gridster.$options.defaultItemCols,rows:this.gridster.$options.defaultItemRows};if(t&&(r.cols=Math.min(Math.abs(t.x-r.x)+1,this.gridster.$options.emptyCellDragMaxCols),r.rows=Math.min(Math.abs(t.y-r.y)+1,this.gridster.$options.emptyCellDragMaxRows),t.x<r.x?r.x=t.x:t.x-r.x>this.gridster.$options.emptyCellDragMaxCols-1&&(r.x=this.gridster.movingItem?this.gridster.movingItem.x:0),t.y<r.y?r.y=t.y:t.y-r.y>this.gridster.$options.emptyCellDragMaxRows-1&&(r.y=this.gridster.movingItem?this.gridster.movingItem.y:0)),!(!this.gridster.$options.enableOccupiedCellDrop&&this.gridster.checkCollision(r)))return r}},Zn=class{gridster;lastGridColumnStyles={};lastGridRowStyles={};constructor(e){this.gridster=e}destroy(){this.gridster=null}updateItem(e,t,n){if(this.gridster.mobile)this.clearCellPosition(n,e),this.gridster.$options.keepFixedHeightInMobile?n.setStyle(e,"height",(t.rows-1)*this.gridster.$options.margin+t.rows*this.gridster.$options.fixedRowHeight+"px"):n.setStyle(e,"height",t.rows*this.gridster.curWidth/t.cols+"px"),this.gridster.$options.keepFixedWidthInMobile?n.setStyle(e,"width",this.gridster.$options.fixedColWidth+"px"):n.setStyle(e,"width",""),n.setStyle(e,"margin-bottom",this.gridster.$options.margin+"px"),n.setStyle(e,Pt.LTR?"margin-right":"margin-left","");else{let s=Math.round(this.gridster.curColWidth*t.x),o=Math.round(this.gridster.curRowHeight*t.y),r=this.gridster.curColWidth*t.cols-this.gridster.$options.margin,a=this.gridster.curRowHeight*t.rows-this.gridster.$options.margin;this.setCellPosition(n,e,s,o),n.setStyle(e,"width",r+"px"),n.setStyle(e,"height",a+"px");let l=null,c=null;this.gridster.$options.outerMargin&&(this.gridster.rows===t.rows+t.y&&(this.gridster.$options.outerMarginBottom!==null?l=this.gridster.$options.outerMarginBottom+"px":l=this.gridster.$options.margin+"px"),this.gridster.columns===t.cols+t.x&&(this.gridster.$options.outerMarginBottom!==null?c=this.gridster.$options.outerMarginRight+"px":c=this.gridster.$options.margin+"px")),n.setStyle(e,"margin-bottom",l),n.setStyle(e,Pt.LTR?"margin-right":"margin-left",c)}}updateGridster(){let e="",t="",n="",s="";if(this.gridster.$options.gridType===Q.Fit)e=Q.Fit,t=Q.ScrollVertical,n=Q.ScrollHorizontal,s=Q.Fixed;else if(this.gridster.$options.gridType===Q.ScrollVertical)this.gridster.curRowHeight=this.gridster.curColWidth*this.gridster.$options.rowHeightRatio,e=Q.ScrollVertical,t=Q.Fit,n=Q.ScrollHorizontal,s=Q.Fixed;else if(this.gridster.$options.gridType===Q.ScrollHorizontal){let o=this.gridster.$options.rowHeightRatio,r=o>=1?o:o+1;this.gridster.curColWidth=this.gridster.curRowHeight*r,e=Q.ScrollHorizontal,t=Q.Fit,n=Q.ScrollVertical,s=Q.Fixed}else this.gridster.$options.gridType===Q.Fixed?(this.gridster.curColWidth=this.gridster.$options.fixedColWidth+(this.gridster.$options.ignoreMarginInRow?0:this.gridster.$options.margin),this.gridster.curRowHeight=this.gridster.$options.fixedRowHeight+(this.gridster.$options.ignoreMarginInRow?0:this.gridster.$options.margin),e=Q.Fixed,t=Q.Fit,n=Q.ScrollVertical,s=Q.ScrollHorizontal):this.gridster.$options.gridType===Q.VerticalFixed?(this.gridster.curRowHeight=this.gridster.$options.fixedRowHeight+(this.gridster.$options.ignoreMarginInRow?0:this.gridster.$options.margin),e=Q.ScrollVertical,t=Q.Fit,n=Q.ScrollHorizontal,s=Q.Fixed):this.gridster.$options.gridType===Q.HorizontalFixed&&(this.gridster.curColWidth=this.gridster.$options.fixedColWidth+(this.gridster.$options.ignoreMarginInRow?0:this.gridster.$options.margin),e=Q.ScrollHorizontal,t=Q.Fit,n=Q.ScrollVertical,s=Q.Fixed);this.gridster.mobile||this.gridster.$options.setGridSize&&this.gridster.$options.gridType!==Q.Fit?this.gridster.renderer.removeClass(this.gridster.el,e):this.gridster.renderer.addClass(this.gridster.el,e),this.gridster.renderer.removeClass(this.gridster.el,t),this.gridster.renderer.removeClass(this.gridster.el,n),this.gridster.renderer.removeClass(this.gridster.el,s)}getGridColumnStyle(e){let t={left:this.gridster.curColWidth*e,width:this.gridster.curColWidth-this.gridster.$options.margin,height:this.gridster.gridRows.length*this.gridster.curRowHeight-this.gridster.$options.margin,style:{}};t.style=de(kt({},this.getLeftPosition(t.left)),{width:t.width+"px",height:t.height+"px"});let n=this.lastGridColumnStyles[e];return n&&n.left===t.left&&n.width===t.width&&n.height===t.height?n.style:(this.lastGridColumnStyles[e]=t,t.style)}getGridRowStyle(e){let t={top:this.gridster.curRowHeight*e,width:this.gridster.gridColumns.length*this.gridster.curColWidth+this.gridster.$options.margin,height:this.gridster.curRowHeight-this.gridster.$options.margin,style:{}};t.style=de(kt({},this.getTopPosition(t.top)),{width:t.width+"px",height:t.height+"px"});let n=this.lastGridRowStyles[e];return n&&n.top===t.top&&n.width===t.width&&n.height===t.height?n.style:(this.lastGridRowStyles[e]=t,t.style)}getLeftPosition(e){let t=this.gridster.$options.dirType===Pt.RTL?-e:e;return this.gridster.$options.useTransformPositioning?{transform:"translateX("+t+"px)"}:{left:this.getLeftMargin()+t+"px"}}getTopPosition(e){return this.gridster.$options.useTransformPositioning?{transform:"translateY("+e+"px)"}:{top:this.getTopMargin()+e+"px"}}clearCellPosition(e,t){this.gridster.$options.useTransformPositioning?e.setStyle(t,"transform",""):(e.setStyle(t,"top",""),e.setStyle(t,"left",""))}setCellPosition(e,t,n,s){let o=this.gridster.$options.dirType===Pt.RTL?-n:n;if(this.gridster.$options.useTransformPositioning){let r="translate3d("+o+"px, "+s+"px, 0)";e.setStyle(t,"transform",r)}else e.setStyle(t,"left",this.getLeftMargin()+o+"px"),e.setStyle(t,"top",this.getTopMargin()+s+"px")}getLeftMargin(){return this.gridster.$options.outerMargin?this.gridster.$options.outerMarginLeft!==null?this.gridster.$options.outerMarginLeft:this.gridster.$options.margin:0}getTopMargin(){return this.gridster.$options.outerMargin?this.gridster.$options.outerMarginTop!==null?this.gridster.$options.outerMarginTop:this.gridster.$options.margin:0}},_c=(()=>{class i{renderer;previewStyle$;gridRenderer;el;sub;constructor(t,n){this.renderer=n,this.el=t.nativeElement}ngOnInit(){this.sub=this.previewStyle$.subscribe(t=>this.previewStyle(t))}ngOnDestroy(){this.sub&&this.sub.unsubscribe()}previewStyle(t){t?(this.renderer.setStyle(this.el,"display","block"),this.gridRenderer.updateItem(this.el,t,this.renderer)):this.renderer.setStyle(this.el,"display","")}static \u0275fac=function(n){return new(n||i)(Wt(he),Wt(ui))};static \u0275cmp=Y({type:i,selectors:[["gridster-preview"]],inputs:{previewStyle$:"previewStyle$",gridRenderer:"gridRenderer"},decls:0,vars:0,template:function(n,s){},styles:[`gridster-preview{position:absolute;display:none;background:#00000026}
2
- `],encapsulation:2})}return i})(),ss=(()=>{class i{renderer;cdRef;zone;options;movingItem;el;$options;mobile;curWidth;curHeight;grid;columns=0;rows=0;curColWidth;curRowHeight;gridColumns=[];gridRows=[];windowResize;dragInProgress;emptyCell;compact;gridRenderer;previewStyle$=new ye;calculateLayout$=new ie;resize$=new ie;destroy$=new ie;constructor(t,n,s,o){this.renderer=n,this.cdRef=s,this.zone=o,this.el=t.nativeElement,this.$options=JSON.parse(JSON.stringify(xc)),this.mobile=!1,this.curWidth=0,this.curHeight=0,this.grid=[],this.curColWidth=0,this.curRowHeight=0,this.dragInProgress=!1,this.emptyCell=new Jn(this),this.compact=new Qn(this),this.gridRenderer=new Zn(this)}static checkCollisionTwoItemsForSwaping(t,n){let s=t.cols===1?0:1,o=n.cols===1?0:1,r=t.rows===1?0:1,a=n.rows===1?0:1;return t.x+s<n.x+n.cols&&t.x+t.cols>n.x+o&&t.y+r<n.y+n.rows&&t.y+t.rows>n.y+a}checkCollisionTwoItems(t,n){if(!(t.x<n.x+n.cols&&t.x+t.cols>n.x&&t.y<n.y+n.rows&&t.y+t.rows>n.y))return!1;if(!this.$options.allowMultiLayer)return!0;let o=this.$options.defaultLayerIndex,r=t.layerIndex===void 0?o:t.layerIndex,a=n.layerIndex===void 0?o:n.layerIndex;return r===a}ngOnInit(){this.options.initCallback&&this.options.initCallback(this),this.calculateLayout$.pipe(Hi(0),Nn(this.destroy$)).subscribe(()=>this.calculateLayout()),this.resize$.pipe(ji(()=>Mo(100)),Nn(this.destroy$)).subscribe(()=>this.resize())}ngOnChanges(t){t.options&&(this.setOptions(),this.options.api={optionsChanged:this.optionsChanged,resize:this.onResize,getNextPossiblePosition:this.getNextPossiblePosition,getFirstPossiblePosition:this.getFirstPossiblePosition,getLastPossiblePosition:this.getLastPossiblePosition,getItemComponent:n=>this.getItemComponent(n)},this.columns=this.$options.minCols,this.rows=this.$options.minRows+this.$options.addEmptyRowsCount,this.setGridSize(),this.calculateLayout())}resize(){let t,n;this.$options.gridType==="fit"&&!this.mobile?(n=this.el.offsetWidth,t=this.el.offsetHeight):(n=this.el.clientWidth,t=this.el.clientHeight),(n!==this.curWidth||t!==this.curHeight)&&this.checkIfToResize()&&this.onResize()}setOptions(){this.$options=Rt.merge(this.$options,this.options,this.$options),!this.$options.disableWindowResize&&!this.windowResize?this.windowResize=this.renderer.listen("window","resize",this.onResize):this.$options.disableWindowResize&&this.windowResize&&(this.windowResize(),this.windowResize=null),this.emptyCell.updateOptions()}optionsChanged=()=>{this.setOptions();let t=this.grid.length-1,n;for(;t>=0;t--)n=this.grid[t],n.updateOptions();this.calculateLayout()};ngOnDestroy(){this.destroy$.next(),this.previewStyle$.complete(),this.windowResize&&this.windowResize(),this.options&&this.options.destroyCallback&&this.options.destroyCallback(this),this.options&&this.options.api&&(this.options.api.resize=void 0,this.options.api.optionsChanged=void 0,this.options.api.getNextPossiblePosition=void 0,this.options.api=void 0),this.emptyCell.destroy(),this.emptyCell=null,this.compact.destroy(),this.compact=null}onResize=()=>{this.el.clientWidth&&(this.options.setGridSize&&(this.renderer.setStyle(this.el,"width",""),this.renderer.setStyle(this.el,"height","")),this.setGridSize(),this.calculateLayout())};checkIfToResize(){let t=this.el.clientWidth,n=this.el.offsetWidth,s=this.el.scrollWidth,o=this.el.clientHeight,r=this.el.offsetHeight,a=this.el.scrollHeight,l=t<n&&a>r&&a-r<n-t,c=o<r&&s>n&&s-n<r-o;return l?!1:!c}checkIfMobile(){return this.$options.useBodyForBreakpoint?this.$options.mobileBreakpoint>document.body.clientWidth:this.$options.mobileBreakpoint>this.curWidth}setGridSize(){let t=this.el,n,s;this.$options.setGridSize||this.$options.gridType===Q.Fit&&!this.mobile?(n=t.offsetWidth,s=t.offsetHeight):(n=t.clientWidth,s=t.clientHeight),this.curWidth=n,this.curHeight=s}setGridDimensions(){this.setGridSize(),!this.mobile&&this.checkIfMobile()?(this.mobile=!this.mobile,this.renderer.addClass(this.el,"mobile")):this.mobile&&!this.checkIfMobile()&&(this.mobile=!this.mobile,this.renderer.removeClass(this.el,"mobile"));let t=this.$options.minRows,n=this.$options.minCols,s=this.grid.length-1,o;for(;s>=0;s--)o=this.grid[s],o.notPlaced||(t=Math.max(t,o.$item.y+o.$item.rows),n=Math.max(n,o.$item.x+o.$item.cols));t+=this.$options.addEmptyRowsCount,(this.columns!==n||this.rows!==t)&&(this.columns=n,this.rows=t,this.options.gridSizeChangedCallback&&this.options.gridSizeChangedCallback(this))}calculateLayout(){if(this.compact&&this.compact.checkCompact(),this.setGridDimensions(),this.$options.outerMargin){let s=-this.$options.margin;this.$options.outerMarginLeft!==null?(s+=this.$options.outerMarginLeft,this.renderer.setStyle(this.el,"padding-left",this.$options.outerMarginLeft+"px")):(s+=this.$options.margin,this.renderer.setStyle(this.el,"padding-left",this.$options.margin+"px")),this.$options.outerMarginRight!==null?(s+=this.$options.outerMarginRight,this.renderer.setStyle(this.el,"padding-right",this.$options.outerMarginRight+"px")):(s+=this.$options.margin,this.renderer.setStyle(this.el,"padding-right",this.$options.margin+"px")),this.curColWidth=(this.curWidth-s)/this.columns;let o=-this.$options.margin;this.$options.outerMarginTop!==null?(o+=this.$options.outerMarginTop,this.renderer.setStyle(this.el,"padding-top",this.$options.outerMarginTop+"px")):(o+=this.$options.margin,this.renderer.setStyle(this.el,"padding-top",this.$options.margin+"px")),this.$options.outerMarginBottom!==null?(o+=this.$options.outerMarginBottom,this.renderer.setStyle(this.el,"padding-bottom",this.$options.outerMarginBottom+"px")):(o+=this.$options.margin,this.renderer.setStyle(this.el,"padding-bottom",this.$options.margin+"px")),this.curRowHeight=(this.curHeight-o)/this.rows*this.$options.rowHeightRatio}else this.curColWidth=(this.curWidth+this.$options.margin)/this.columns,this.curRowHeight=(this.curHeight+this.$options.margin)/this.rows*this.$options.rowHeightRatio,this.renderer.setStyle(this.el,"padding-left","0px"),this.renderer.setStyle(this.el,"padding-right","0px"),this.renderer.setStyle(this.el,"padding-top","0px"),this.renderer.setStyle(this.el,"padding-bottom","0px");this.gridRenderer.updateGridster(),this.$options.setGridSize?(this.renderer.addClass(this.el,"gridSize"),this.mobile||(this.renderer.setStyle(this.el,"width",this.columns*this.curColWidth+this.$options.margin+"px"),this.renderer.setStyle(this.el,"height",this.rows*this.curRowHeight+this.$options.margin+"px"))):(this.renderer.removeClass(this.el,"gridSize"),this.renderer.setStyle(this.el,"width",""),this.renderer.setStyle(this.el,"height","")),this.updateGrid();let t=this.grid.length-1,n;for(;t>=0;t--)n=this.grid[t],n.setSize(),n.drag.toggle(),n.resize.toggle();this.resize$.next()}updateGrid(){this.$options.displayGrid==="always"&&!this.mobile?this.renderer.addClass(this.el,"display-grid"):this.$options.displayGrid==="onDrag&Resize"&&this.dragInProgress?this.renderer.addClass(this.el,"display-grid"):(this.$options.displayGrid==="none"||!this.dragInProgress||this.mobile)&&this.renderer.removeClass(this.el,"display-grid"),this.setGridDimensions(),this.gridColumns.length=i.getNewArrayLength(this.columns,this.curWidth,this.curColWidth),this.gridRows.length=i.getNewArrayLength(this.rows,this.curHeight,this.curRowHeight),this.cdRef.markForCheck()}addItem(t){t.$item.cols===void 0&&(t.$item.cols=this.$options.defaultItemCols,t.item.cols=t.$item.cols,t.itemChanged()),t.$item.rows===void 0&&(t.$item.rows=this.$options.defaultItemRows,t.item.rows=t.$item.rows,t.itemChanged()),t.$item.x===-1||t.$item.y===-1?this.autoPositionItem(t):this.checkCollision(t.$item)&&(this.$options.disableWarnings||(t.notPlaced=!0,console.warn("Can't be placed in the bounds of the dashboard, trying to auto position!/n"+JSON.stringify(t.item,["cols","rows","x","y"]))),this.$options.disableAutoPositionOnConflict?t.notPlaced=!0:this.autoPositionItem(t)),this.grid.push(t),this.calculateLayout$.next()}removeItem(t){this.grid.splice(this.grid.indexOf(t),1),this.calculateLayout$.next(),this.options.itemRemovedCallback&&this.options.itemRemovedCallback(t.item,t)}checkCollision(t){let n=!1;if(this.options.itemValidateCallback&&(n=!this.options.itemValidateCallback(t)),!n&&this.checkGridCollision(t)&&(n=!0),!n){let s=this.findItemWithItem(t);s&&(n=s)}return n}checkGridCollision(t){let n=t.y>-1&&t.x>-1,s=t.cols+t.x<=this.$options.maxCols,o=t.rows+t.y<=this.$options.maxRows,r=t.maxItemCols===void 0?this.$options.maxItemCols:t.maxItemCols,a=t.minItemCols===void 0?this.$options.minItemCols:t.minItemCols,l=t.maxItemRows===void 0?this.$options.maxItemRows:t.maxItemRows,c=t.minItemRows===void 0?this.$options.minItemRows:t.minItemRows,d=t.cols<=r&&t.cols>=a,h=t.rows<=l&&t.rows>=c,u=t.minItemArea===void 0?this.$options.minItemArea:t.minItemArea,p=t.maxItemArea===void 0?this.$options.maxItemArea:t.maxItemArea,b=t.cols*t.rows,g=u<=b,_=p>=b;return!(n&&s&&o&&d&&h&&g&&_)}findItemWithItem(t){let n=0,s;for(;n<this.grid.length;n++)if(s=this.grid[n],s.$item!==t&&this.checkCollisionTwoItems(s.$item,t))return s;return!1}findItemsWithItem(t){let n=[],s=0,o;for(;s<this.grid.length;s++)o=this.grid[s],o.$item!==t&&this.checkCollisionTwoItems(o.$item,t)&&n.push(o);return n}autoPositionItem(t){this.getNextPossiblePosition(t.$item)?(t.notPlaced=!1,t.item.x=t.$item.x,t.item.y=t.$item.y,t.itemChanged()):(t.notPlaced=!0,this.$options.disableWarnings||console.warn("Can't be placed in the bounds of the dashboard!/n"+JSON.stringify(t.item,["cols","rows","x","y"])))}getNextPossiblePosition=(t,n={})=>{t.cols===-1&&(t.cols=this.$options.defaultItemCols),t.rows===-1&&(t.rows=this.$options.defaultItemRows),this.setGridDimensions();let s=n.y||0,o;for(;s<this.rows;s++)for(t.y=s,o=n.x||0;o<this.columns;o++)if(t.x=o,!this.checkCollision(t))return!0;let r=this.$options.maxRows>=this.rows+t.rows,a=this.$options.maxCols>=this.columns+t.cols;return!(this.rows<=this.columns&&r)&&a?(t.x=this.columns,t.y=0,!0):r?(t.y=this.rows,t.x=0,!0):!1};getFirstPossiblePosition=t=>{let n=Object.assign({},t);return this.getNextPossiblePosition(n),n};getLastPossiblePosition=t=>{let n={y:0,x:0};n=this.grid.reduce((o,r)=>{let a={y:r.$item.y+r.$item.rows-1,x:r.$item.x+r.$item.cols-1};return Rt.compareItems(o,a)===1?a:o},n);let s=Object.assign({},t);return this.getNextPossiblePosition(s,n),s};pixelsToPositionX(t,n,s){let o=n(t/this.curColWidth);return s?o:Math.max(o,0)}pixelsToPositionY(t,n,s){let o=n(t/this.curRowHeight);return s?o:Math.max(o,0)}positionXToPixels(t){return t*this.curColWidth}positionYToPixels(t){return t*this.curRowHeight}getItemComponent(t){return this.grid.find(n=>n.item===t)}checkCollisionForSwaping(t){let n=!1;if(this.options.itemValidateCallback&&(n=!this.options.itemValidateCallback(t)),!n&&this.checkGridCollision(t)&&(n=!0),!n){let s=this.findItemWithItemForSwapping(t);s&&(n=s)}return n}findItemWithItemForSwapping(t){let n=this.grid.length-1,s;for(;n>-1;n--)if(s=this.grid[n],s.$item!==t&&i.checkCollisionTwoItemsForSwaping(s.$item,t))return s;return!1}previewStyle(t=!1){this.movingItem?(this.compact&&t&&this.compact.checkCompactItem(this.movingItem),this.previewStyle$.next(this.movingItem)):this.previewStyle$.next(null)}static getNewArrayLength(t,n,s){let o=Math.max(t,Math.floor(n/s));return o<0?0:Number.isFinite(o)?Math.floor(o):0}static \u0275fac=function(n){return new(n||i)(Wt(he),Wt(ui),Wt(Ao),Wt(pi))};static \u0275cmp=Y({type:i,selectors:[["gridster"]],inputs:{options:"options"},features:[hi],ngContentSelectors:fr,decls:6,vars:2,consts:[[1,"gridster-column",3,"ngStyle"],[1,"gridster-row",3,"ngStyle"],[1,"gridster-preview",3,"gridRenderer","previewStyle$"]],template:function(n,s){n&1&&(Yn(),wt(0,lc,1,1,"div",0,Un),wt(2,cc,1,1,"div",1,Un),Xn(4),W(5,"gridster-preview",2)),n&2&&(vt(s.gridColumns),f(2),vt(s.gridRows),f(3),z("gridRenderer",s.gridRenderer)("previewStyle$",s.previewStyle$))},dependencies:[Ce,_c],styles:[`gridster{position:relative;box-sizing:border-box;background:gray;width:100%;height:100%;-webkit-user-select:none;user-select:none;display:block}gridster.fit{overflow-x:hidden;overflow-y:hidden}gridster.scrollVertical{overflow-x:hidden;overflow-y:auto}gridster.scrollHorizontal{overflow-x:auto;overflow-y:hidden}gridster.fixed{overflow:auto}gridster.mobile{overflow-x:hidden;overflow-y:auto}gridster.mobile gridster-item{position:relative}gridster.gridSize{height:initial;width:initial}gridster.gridSize.fit{height:100%;width:100%}gridster .gridster-column,gridster .gridster-row{position:absolute;display:none;transition:.3s;box-sizing:border-box}gridster.display-grid .gridster-column,gridster.display-grid .gridster-row{display:block}gridster .gridster-column{border-left:1px solid white;border-right:1px solid white}gridster .gridster-row{border-top:1px solid white;border-bottom:1px solid white}
3
- `],encapsulation:2})}return i})(),en=class{fromSouth;fromNorth;fromEast;fromWest;pushedItems;pushedItemsTemp;pushedItemsTempPath;pushedItemsPath;gridsterItem;gridster;pushedItemsOrder;tryPattern;iteration=0;constructor(e){this.pushedItems=[],this.pushedItemsTemp=[],this.pushedItemsTempPath=[],this.pushedItemsPath=[],this.gridsterItem=e,this.gridster=e.gridster,this.tryPattern={fromEast:[this.tryWest,this.trySouth,this.tryNorth,this.tryEast],fromWest:[this.tryEast,this.trySouth,this.tryNorth,this.tryWest],fromNorth:[this.trySouth,this.tryEast,this.tryWest,this.tryNorth],fromSouth:[this.tryNorth,this.tryEast,this.tryWest,this.trySouth]},this.fromSouth="fromSouth",this.fromNorth="fromNorth",this.fromEast="fromEast",this.fromWest="fromWest"}destroy(){this.gridster=this.gridsterItem=null}pushItems(e,t){if(this.gridster.$options.pushItems&&!t){this.pushedItemsOrder=[],this.iteration=0;let n=this.push(this.gridsterItem,e);return n||this.restoreTempItems(),this.pushedItemsOrder=[],this.pushedItemsTemp=[],this.pushedItemsTempPath=[],n}else return!1}restoreTempItems(){let e=this.pushedItemsTemp.length-1;for(;e>-1;e--)this.removeFromTempPushed(this.pushedItemsTemp[e])}restoreItems(){let e=0,t=this.pushedItems.length,n;for(;e<t;e++)n=this.pushedItems[e],n.$item.x=n.item.x||0,n.$item.y=n.item.y||0,n.setSize();this.pushedItems=[],this.pushedItemsPath=[]}setPushedItems(){let e=0,t=this.pushedItems.length,n;for(;e<t;e++)n=this.pushedItems[e],n.checkItemChanges(n.$item,n.item);this.pushedItems=[],this.pushedItemsPath=[]}checkPushBack(){let e=this.pushedItems.length-1,t=!1;for(;e>-1;e--)this.checkPushedItem(this.pushedItems[e],e)&&(t=!0);t&&this.checkPushBack()}push(e,t){if(this.iteration>100)return console.warn("max iteration reached"),!1;if(this.gridster.checkGridCollision(e.$item)||t==="")return!1;let n=this.gridster.findItemsWithItem(e.$item),s=t===this.fromNorth||t===this.fromWest;n.sort((c,d)=>s?d.$item.y-c.$item.y||d.$item.x-c.$item.x:c.$item.y-d.$item.y||c.$item.x-d.$item.x);let o=0,r,a=!0,l=[];for(;o<n.length;o++){if(r=n[o],r===this.gridsterItem)continue;if(!r.canBeDragged()){a=!1;break}let c=this.pushedItemsTemp.indexOf(r);if(c>-1&&this.pushedItemsTempPath[c].length>10){a=!1;break}if(this.tryPattern[t][0].call(this,r,e))this.pushedItemsOrder.push(r),l.push(r);else if(this.tryPattern[t][1].call(this,r,e))this.pushedItemsOrder.push(r),l.push(r);else if(this.tryPattern[t][2].call(this,r,e))this.pushedItemsOrder.push(r),l.push(r);else if(this.tryPattern[t][3].call(this,r,e))this.pushedItemsOrder.push(r),l.push(r);else{a=!1;break}}if(!a&&(o=this.pushedItemsOrder.lastIndexOf(l[0]),o>-1)){let c=this.pushedItemsOrder.length-1;for(;c>=o;c--)r=this.pushedItemsOrder[c],this.pushedItemsOrder.pop(),this.removeFromTempPushed(r),this.removeFromPushedItem(r)}return this.iteration++,a}trySouth(e,t){return this.gridster.$options.pushDirections.south?(this.addToTempPushed(e),e.$item.y=t.$item.y+t.$item.rows,this.push(e,this.fromNorth)?(e.setSize(),this.addToPushed(e),!0):(this.removeFromTempPushed(e),!1)):!1}tryNorth(e,t){return this.gridster.$options.pushDirections.north?(this.addToTempPushed(e),e.$item.y=t.$item.y-e.$item.rows,this.push(e,this.fromSouth)?(e.setSize(),this.addToPushed(e),!0):(this.removeFromTempPushed(e),!1)):!1}tryEast(e,t){return this.gridster.$options.pushDirections.east?(this.addToTempPushed(e),e.$item.x=t.$item.x+t.$item.cols,this.push(e,this.fromWest)?(e.setSize(),this.addToPushed(e),!0):(this.removeFromTempPushed(e),!1)):!1}tryWest(e,t){return this.gridster.$options.pushDirections.west?(this.addToTempPushed(e),e.$item.x=t.$item.x-e.$item.cols,this.push(e,this.fromEast)?(e.setSize(),this.addToPushed(e),!0):(this.removeFromTempPushed(e),!1)):!1}addToTempPushed(e){let t=this.pushedItemsTemp.indexOf(e);t===-1&&(t=this.pushedItemsTemp.push(e)-1,this.pushedItemsTempPath[t]=[]),this.pushedItemsTempPath[t].push({x:e.$item.x,y:e.$item.y})}removeFromTempPushed(e){let t=this.pushedItemsTemp.indexOf(e),n=this.pushedItemsTempPath[t].pop();n&&(e.$item.x=n.x,e.$item.y=n.y,e.setSize(),this.pushedItemsTempPath[t].length||(this.pushedItemsTemp.splice(t,1),this.pushedItemsTempPath.splice(t,1)))}addToPushed(e){if(this.pushedItems.indexOf(e)<0)this.pushedItems.push(e),this.pushedItemsPath.push([{x:e.item.x||0,y:e.item.y||0},{x:e.$item.x,y:e.$item.y}]);else{let t=this.pushedItems.indexOf(e);this.pushedItemsPath[t].push({x:e.$item.x,y:e.$item.y})}}removeFromPushed(e){e>-1&&(this.pushedItems.splice(e,1),this.pushedItemsPath.splice(e,1))}removeFromPushedItem(e){let t=this.pushedItems.indexOf(e);t>-1&&(this.pushedItemsPath[t].pop(),this.pushedItemsPath.length||(this.pushedItems.splice(t,1),this.pushedItemsPath.splice(t,1)))}checkPushedItem(e,t){let n=this.pushedItemsPath[t],s=n.length-2,o,r,a,l=!1;for(;s>-1;s--)o=n[s],r=e.$item.x,a=e.$item.y,e.$item.x=o.x,e.$item.y=o.y,this.gridster.findItemWithItem(e.$item)?(e.$item.x=r,e.$item.y=a):(e.setSize(),n.splice(s+1,n.length-s-1),l=!0);return n.length<2&&this.removeFromPushed(t),l}},gi,Le,mr=50,qt,mi,ue,bi,xi,_i,yi;function br(i,e,t,n,s,o,r,a,l,c){gi=i.$options.scrollSensitivity,Le=i.$options.scrollSpeed,qt=i.el,mi=l,ue=c;let d=qt.offsetWidth,h=qt.offsetHeight,u=qt.scrollLeft,p=qt.scrollTop,b=t-p,g=h+p-t-s,{clientX:_,clientY:C}=o;if(!i.$options.disableScrollVertical)if(r.clientY<C&&g<gi){if(wr(),mi&&ue&&!ue.south||yi)return;yi=ur(1,a,r)}else if(r.clientY>C&&p>0&&b<gi){if(Cr(),mi&&ue&&!ue.north||_i)return;_i=ur(-1,a,r)}else r.clientY!==C&&rs();let v=u+d-e-n,M=e-u;if(!i.$options.disableScrollHorizontal)if(r.clientX<_&&v<=gi){if(yr(),mi&&ue&&!ue.east||bi)return;bi=pr(1,a,r)}else if(r.clientX>_&&u>0&&M<gi){if(_r(),mi&&ue&&!ue.west||xi)return;xi=pr(-1,a,r)}else r.clientX!==_&&os()}function ur(i,e,t){let n=t.clientY;return window.setInterval(()=>{(!qt||i===-1&&qt.scrollTop-Le<0)&&rs(),qt.scrollTop+=i*Le,n+=i*Le,e({clientX:t.clientX,clientY:n})},mr)}function pr(i,e,t){let n=t.clientX;return window.setInterval(()=>{(!qt||i===-1&&qt.scrollLeft-Le<0)&&os(),qt.scrollLeft+=i*Le,n+=i*Le,e({clientX:n,clientY:t.clientY})},mr)}function xr(){os(),rs(),qt=null}function os(){_r(),yr()}function rs(){wr(),Cr()}function _r(){bi&&(clearInterval(bi),bi=0)}function yr(){xi&&(clearInterval(xi),xi=0)}function Cr(){yi&&(clearInterval(yi),yi=0)}function wr(){_i&&(clearInterval(_i),_i=0)}var ts=class{swapedItem;gridsterItem;gridster;constructor(e){this.gridsterItem=e,this.gridster=e.gridster}destroy(){this.gridster=this.gridsterItem=this.swapedItem=null}swapItems(){this.gridster.$options.swap&&(this.checkSwapBack(),this.checkSwap(this.gridsterItem))}checkSwapBack(){if(this.swapedItem){let e=this.swapedItem.$item.x,t=this.swapedItem.$item.y;this.swapedItem.$item.x=this.swapedItem.item.x||0,this.swapedItem.$item.y=this.swapedItem.item.y||0,this.gridster.checkCollision(this.swapedItem.$item)?(this.swapedItem.$item.x=e,this.swapedItem.$item.y=t):(this.swapedItem.setSize(),this.gridsterItem.$item.x=this.gridsterItem.item.x||0,this.gridsterItem.$item.y=this.gridsterItem.item.y||0,this.swapedItem=void 0)}}restoreSwapItem(){this.swapedItem&&(this.swapedItem.$item.x=this.swapedItem.item.x||0,this.swapedItem.$item.y=this.swapedItem.item.y||0,this.swapedItem.setSize(),this.swapedItem=void 0)}setSwapItem(){this.swapedItem&&(this.swapedItem.checkItemChanges(this.swapedItem.$item,this.swapedItem.item),this.swapedItem=void 0)}checkSwap(e){let t;if(this.gridster.$options.swapWhileDragging?t=this.gridster.checkCollisionForSwaping(e.$item):t=this.gridster.checkCollision(e.$item),t&&t!==!0&&t.canBeDragged()){let n=t,s=n.$item.x,o=n.$item.y,r=e.$item.x,a=e.$item.y,l=r-s,c=a-o;n.$item.x=e.item.x-l,n.$item.y=e.item.y-c,e.$item.x=n.item.x+l,e.$item.y=n.item.y+c,this.gridster.checkCollision(n.$item)||this.gridster.checkCollision(e.$item)?(e.$item.x=r,e.$item.y=a,n.$item.x=s,n.$item.y=o):(n.setSize(),this.swapedItem=n,this.gridster.$options.swapWhileDragging&&(this.gridsterItem.checkItemChanges(this.gridsterItem.$item,this.gridsterItem.item),this.setSwapItem()))}}},yc="gridster-item-resizable-handler",Ut=function(i){return i.UP="UP",i.DOWN="DOWN",i.LEFT="LEFT",i.RIGHT="RIGHT",i}(Ut||{}),es=class{zone;gridsterItem;gridster;lastMouse;offsetLeft;offsetTop;margin;outerMarginTop;outerMarginRight;outerMarginBottom;outerMarginLeft;diffTop;diffLeft;originalClientX;originalClientY;top;left;height;width;positionX;positionY;positionXBackup;positionYBackup;enabled;mousemove;mouseup;mouseleave;cancelOnBlur;touchmove;touchend;touchcancel;mousedown;touchstart;push;swap;path;collision=!1;constructor(e,t,n){this.zone=n,this.gridsterItem=e,this.gridster=t,this.lastMouse={clientX:0,clientY:0},this.path=[]}destroy(){this.gridster.previewStyle&&this.gridster.previewStyle(!0),this.gridsterItem=this.gridster=this.collision=null,this.mousedown&&(this.mousedown(),this.touchstart())}dragStart(e){e.which&&e.which!==1||(this.gridster.options.draggable&&this.gridster.options.draggable.start&&this.gridster.options.draggable.start(this.gridsterItem.item,this.gridsterItem,e),e.stopPropagation(),e.preventDefault(),this.zone.runOutsideAngular(()=>{this.mousemove=this.gridsterItem.renderer.listen("document","mousemove",this.dragMove),this.touchmove=this.gridster.renderer.listen(this.gridster.el,"touchmove",this.dragMove)}),this.mouseup=this.gridsterItem.renderer.listen("document","mouseup",this.dragStop),this.mouseleave=this.gridsterItem.renderer.listen("document","mouseleave",this.dragStop),this.cancelOnBlur=this.gridsterItem.renderer.listen("window","blur",this.dragStop),this.touchend=this.gridsterItem.renderer.listen("document","touchend",this.dragStop),this.touchcancel=this.gridsterItem.renderer.listen("document","touchcancel",this.dragStop),this.gridsterItem.renderer.addClass(this.gridsterItem.el,"gridster-item-moving"),this.margin=this.gridster.$options.margin,this.outerMarginTop=this.gridster.$options.outerMarginTop,this.outerMarginRight=this.gridster.$options.outerMarginRight,this.outerMarginBottom=this.gridster.$options.outerMarginBottom,this.outerMarginLeft=this.gridster.$options.outerMarginLeft,this.offsetLeft=this.gridster.el.scrollLeft-this.gridster.el.offsetLeft,this.offsetTop=this.gridster.el.scrollTop-this.gridster.el.offsetTop,this.left=this.gridsterItem.left-this.margin,this.top=this.gridsterItem.top-this.margin,this.originalClientX=e.clientX,this.originalClientY=e.clientY,this.width=this.gridsterItem.width,this.height=this.gridsterItem.height,this.gridster.$options.dirType===Pt.RTL?this.diffLeft=e.clientX-this.gridster.el.scrollWidth+this.gridsterItem.left:this.diffLeft=e.clientX+this.offsetLeft-this.margin-this.left,this.diffTop=e.clientY+this.offsetTop-this.margin-this.top,this.gridster.movingItem=this.gridsterItem.$item,this.gridster.previewStyle(!0),this.push=new en(this.gridsterItem),this.swap=new ts(this.gridsterItem),this.gridster.dragInProgress=!0,this.gridster.updateGrid(),this.path.push({x:this.gridsterItem.item.x||0,y:this.gridsterItem.item.y||0}))}dragMove=e=>{e.stopPropagation(),e.preventDefault(),Rt.checkTouchEvent(e);let t=this.getDirections(e);this.gridster.options.enableBoundaryControl&&(t.includes(Ut.UP)&&this.gridsterItem.el.getBoundingClientRect().top<this.gridster.el.getBoundingClientRect().top+(this.outerMarginTop??this.margin)&&(t=t.filter(n=>n!=Ut.UP),e=new MouseEvent(e.type,{clientX:e.clientX,clientY:this.lastMouse.clientY})),t.includes(Ut.LEFT)&&this.gridsterItem.el.getBoundingClientRect().left<this.gridster.el.getBoundingClientRect().left+(this.outerMarginLeft??this.margin)&&(t=t.filter(n=>n!=Ut.LEFT),e=new MouseEvent(e.type,{clientX:this.lastMouse.clientX,clientY:e.clientY})),t.includes(Ut.RIGHT)&&this.gridsterItem.el.getBoundingClientRect().right>this.gridster.el.getBoundingClientRect().right-(this.outerMarginRight??this.margin)&&(t=t.filter(n=>n!=Ut.RIGHT),e=new MouseEvent(e.type,{clientX:this.lastMouse.clientX,clientY:e.clientY})),t.includes(Ut.DOWN)&&this.gridsterItem.el.getBoundingClientRect().bottom>this.gridster.el.getBoundingClientRect().bottom-(this.outerMarginBottom??this.margin)&&(t=t.filter(n=>n!=Ut.DOWN),e=new MouseEvent(e.type,{clientX:e.clientX,clientY:this.lastMouse.clientY}))),t.length&&(this.offsetLeft=this.gridster.el.scrollLeft-this.gridster.el.offsetLeft,this.offsetTop=this.gridster.el.scrollTop-this.gridster.el.offsetTop,br(this.gridster,this.left,this.top,this.width,this.height,e,this.lastMouse,this.calculateItemPositionFromMousePosition),this.calculateItemPositionFromMousePosition(e))};calculateItemPositionFromMousePosition=e=>{this.gridster.options.scale?this.calculateItemPositionWithScale(e,this.gridster.options.scale):this.calculateItemPositionWithoutScale(e),this.calculateItemPosition(),this.lastMouse.clientX=e.clientX,this.lastMouse.clientY=e.clientY,this.zone.run(()=>{this.gridster.updateGrid()})};calculateItemPositionWithScale(e,t){this.gridster.$options.dirType===Pt.RTL?this.left=this.gridster.el.scrollWidth-this.originalClientX+(e.clientX-this.originalClientX)/t+this.diffLeft:this.left=this.originalClientX+(e.clientX-this.originalClientX)/t+this.offsetLeft-this.diffLeft,this.top=this.originalClientY+(e.clientY-this.originalClientY)/t+this.offsetTop-this.diffTop}calculateItemPositionWithoutScale(e){this.gridster.$options.dirType===Pt.RTL?this.left=this.gridster.el.scrollWidth-e.clientX+this.diffLeft:this.left=e.clientX+this.offsetLeft-this.diffLeft,this.top=e.clientY+this.offsetTop-this.diffTop}dragStop=e=>{e.stopPropagation(),e.preventDefault(),xr(),this.cancelOnBlur(),this.mousemove(),this.mouseup(),this.mouseleave(),this.touchmove(),this.touchend(),this.touchcancel(),this.gridsterItem.renderer.removeClass(this.gridsterItem.el,"gridster-item-moving"),this.gridster.dragInProgress=!1,this.gridster.updateGrid(),this.path=[],this.gridster.options.draggable&&this.gridster.options.draggable.stop?Promise.resolve(this.gridster.options.draggable.stop(this.gridsterItem.item,this.gridsterItem,e)).then(this.makeDrag,this.cancelDrag):this.makeDrag(),setTimeout(()=>{this.gridster&&(this.gridster.movingItem=null,this.gridster.previewStyle(!0))})};cancelDrag=()=>{this.gridsterItem.$item.x=this.gridsterItem.item.x||0,this.gridsterItem.$item.y=this.gridsterItem.item.y||0,this.gridsterItem.setSize(),this.push&&this.push.restoreItems(),this.swap&&this.swap.restoreSwapItem(),this.push&&(this.push.destroy(),this.push=null),this.swap&&(this.swap.destroy(),this.swap=null)};makeDrag=()=>{this.gridster.$options.draggable.dropOverItems&&this.gridster.options.draggable&&this.gridster.options.draggable.dropOverItemsCallback&&this.collision&&this.collision!==!0&&this.collision.$item&&this.gridster.options.draggable.dropOverItemsCallback(this.gridsterItem.item,this.collision.item,this.gridster),this.collision=!1,this.gridsterItem.setSize(),this.gridsterItem.checkItemChanges(this.gridsterItem.$item,this.gridsterItem.item),this.push&&this.push.setPushedItems(),this.swap&&this.swap.setSwapItem(),this.push&&(this.push.destroy(),this.push=null),this.swap&&(this.swap.destroy(),this.swap=null)};calculateItemPosition(){if(this.gridster.movingItem=this.gridsterItem.$item,this.positionX=this.gridster.pixelsToPositionX(this.left,Math.round),this.positionY=this.gridster.pixelsToPositionY(this.top,Math.round),this.positionXBackup=this.gridsterItem.$item.x,this.positionYBackup=this.gridsterItem.$item.y,this.gridsterItem.$item.x=this.positionX,this.gridster.checkGridCollision(this.gridsterItem.$item)&&(this.gridsterItem.$item.x=this.positionXBackup),this.gridsterItem.$item.y=this.positionY,this.gridster.checkGridCollision(this.gridsterItem.$item)&&(this.gridsterItem.$item.y=this.positionYBackup),this.gridster.gridRenderer.setCellPosition(this.gridsterItem.renderer,this.gridsterItem.el,this.left,this.top),this.positionXBackup!==this.gridsterItem.$item.x||this.positionYBackup!==this.gridsterItem.$item.y){let e=this.path[this.path.length-1],t="";e.x<this.gridsterItem.$item.x?t=this.push.fromWest:e.x>this.gridsterItem.$item.x?t=this.push.fromEast:e.y<this.gridsterItem.$item.y?t=this.push.fromNorth:e.y>this.gridsterItem.$item.y&&(t=this.push.fromSouth),this.push.pushItems(t,this.gridster.$options.disablePushOnDrag),this.swap.swapItems(),this.collision=this.gridster.checkCollision(this.gridsterItem.$item),this.collision?(this.gridsterItem.$item.x=this.positionXBackup,this.gridsterItem.$item.y=this.positionYBackup,this.gridster.$options.draggable.dropOverItems&&this.collision!==!0&&this.collision.$item&&(this.gridster.movingItem=null)):this.path.push({x:this.gridsterItem.$item.x,y:this.gridsterItem.$item.y}),this.push.checkPushBack()}else this.collision=!1;this.gridster.previewStyle(!0)}toggle(){let e=this.gridsterItem.canBeDragged();!this.enabled&&e?(this.enabled=!this.enabled,this.mousedown=this.gridsterItem.renderer.listen(this.gridsterItem.el,"mousedown",this.dragStartDelay),this.touchstart=this.gridsterItem.renderer.listen(this.gridsterItem.el,"touchstart",this.dragStartDelay)):this.enabled&&!e&&(this.enabled=!this.enabled,this.mousedown(),this.touchstart())}dragStartDelay=e=>{if(e.target.classList.contains(yc)||Rt.checkContentClassForEvent(this.gridster,e))return;if(Rt.checkTouchEvent(e),!this.gridster.$options.draggable.delayStart){this.dragStart(e);return}let n=setTimeout(()=>{this.dragStart(e),h()},this.gridster.$options.draggable.delayStart),s=this.gridsterItem.renderer.listen("document","mouseup",h),o=this.gridsterItem.renderer.listen("document","mouseleave",h),r=this.gridsterItem.renderer.listen("window","blur",h),a=this.gridsterItem.renderer.listen("document","touchmove",d),l=this.gridsterItem.renderer.listen("document","touchend",h),c=this.gridsterItem.renderer.listen("document","touchcancel",h);function d(u){Rt.checkTouchEvent(u),(Math.abs(u.clientX-e.clientX)>9||Math.abs(u.clientY-e.clientY)>9)&&h()}function h(){clearTimeout(n),r(),s(),o(),a(),l(),c()}};getDirections(e){let t=[];return this.lastMouse.clientX===0&&this.lastMouse.clientY===0&&(this.lastMouse.clientY=e.clientY,this.lastMouse.clientX=e.clientX),this.lastMouse.clientY>e.clientY&&t.push(Ut.UP),this.lastMouse.clientY<e.clientY&&t.push(Ut.DOWN),this.lastMouse.clientX<e.clientX&&t.push(Ut.RIGHT),this.lastMouse.clientX>e.clientX&&t.push(Ut.LEFT),t}},is=class{fromSouth;fromNorth;fromEast;fromWest;pushedItems;pushedItemsPath;gridsterItem;gridster;tryPattern;constructor(e){this.pushedItems=[],this.pushedItemsPath=[],this.gridsterItem=e,this.gridster=e.gridster,this.tryPattern={fromEast:this.tryWest,fromWest:this.tryEast,fromNorth:this.trySouth,fromSouth:this.tryNorth},this.fromSouth="fromSouth",this.fromNorth="fromNorth",this.fromEast="fromEast",this.fromWest="fromWest"}destroy(){this.gridster=this.gridsterItem=null}pushItems(e){return this.gridster.$options.pushResizeItems?this.push(this.gridsterItem,e):!1}restoreItems(){let e=0,t=this.pushedItems.length,n;for(;e<t;e++)n=this.pushedItems[e],n.$item.x=n.item.x||0,n.$item.y=n.item.y||0,n.$item.cols=n.item.cols||1,n.$item.row=n.item.row||1,n.setSize();this.pushedItems=[],this.pushedItemsPath=[]}setPushedItems(){let e=0,t=this.pushedItems.length,n;for(;e<t;e++)n=this.pushedItems[e],n.checkItemChanges(n.$item,n.item);this.pushedItems=[],this.pushedItemsPath=[]}checkPushBack(){let e=this.pushedItems.length-1,t=!1;for(;e>-1;e--)this.checkPushedItem(this.pushedItems[e],e)&&(t=!0);t&&this.checkPushBack()}push(e,t){let n=this.gridster.checkCollision(e.$item);if(n&&n!==!0&&n!==this.gridsterItem&&n.canBeResized()){if(this.tryPattern[t].call(this,n,e,t))return!0}else if(n===!1)return!0;return!1}trySouth(e,t,n){let s=e.$item.y,o=e.$item.rows;return e.$item.y=t.$item.y+t.$item.rows,e.$item.rows=o+s-e.$item.y,!this.gridster.checkCollisionTwoItems(e.$item,t.$item)&&!this.gridster.checkGridCollision(e.$item)?(e.setSize(),this.addToPushed(e),this.push(t,n),!0):(e.$item.y=s,e.$item.rows=o,!1)}tryNorth(e,t,n){let s=e.$item.rows;return e.$item.rows=t.$item.y-e.$item.y,!this.gridster.checkCollisionTwoItems(e.$item,t.$item)&&!this.gridster.checkGridCollision(e.$item)?(e.setSize(),this.addToPushed(e),this.push(t,n),!0):(e.$item.rows=s,!1)}tryEast(e,t,n){let s=e.$item.x,o=e.$item.cols;return e.$item.x=t.$item.x+t.$item.cols,e.$item.cols=o+s-e.$item.x,!this.gridster.checkCollisionTwoItems(e.$item,t.$item)&&!this.gridster.checkGridCollision(e.$item)?(e.setSize(),this.addToPushed(e),this.push(t,n),!0):(e.$item.x=s,e.$item.cols=o,!1)}tryWest(e,t,n){let s=e.$item.cols;return e.$item.cols=t.$item.x-e.$item.x,!this.gridster.checkCollisionTwoItems(e.$item,t.$item)&&!this.gridster.checkGridCollision(e.$item)?(e.setSize(),this.addToPushed(e),this.push(t,n),!0):(e.$item.cols=s,!1)}addToPushed(e){if(this.pushedItems.indexOf(e)<0)this.pushedItems.push(e),this.pushedItemsPath.push([{x:e.item.x||0,y:e.item.y||0,cols:e.item.cols||0,rows:e.item.rows||0},{x:e.$item.x,y:e.$item.y,cols:e.$item.cols,rows:e.$item.rows}]);else{let t=this.pushedItems.indexOf(e);this.pushedItemsPath[t].push({x:e.$item.x,y:e.$item.y,cols:e.$item.cols,rows:e.$item.rows})}}removeFromPushed(e){e>-1&&(this.pushedItems.splice(e,1),this.pushedItemsPath.splice(e,1))}checkPushedItem(e,t){let n=this.pushedItemsPath[t],s=n.length-2,o,r,a,l,c;for(;s>-1;s--)o=n[s],r=e.$item.x,a=e.$item.y,l=e.$item.cols,c=e.$item.rows,e.$item.x=o.x,e.$item.y=o.y,e.$item.cols=o.cols,e.$item.rows=o.rows,this.gridster.findItemWithItem(e.$item)?(e.$item.x=r,e.$item.y=a,e.$item.cols=l,e.$item.rows=c):(e.setSize(),n.splice(s+1,n.length-1-s));return n.length<2?(this.removeFromPushed(t),!0):!1}},ns=class{zone;gridsterItem;gridster;lastMouse;itemBackup;resizeEventScrollType;directionFunction=null;resizeEnabled;resizableHandles;mousemove;mouseup;mouseleave;cancelOnBlur;touchmove;touchend;touchcancel;push;pushResize;minHeight;minWidth;offsetTop;offsetLeft;diffTop;diffLeft;diffRight;diffBottom;margin;outerMarginTop;outerMarginRight;outerMarginBottom;outerMarginLeft;originalClientX;originalClientY;top;left;bottom;right;width;height;newPosition;constructor(e,t,n){this.zone=n,this.gridsterItem=e,this.gridster=t,this.lastMouse={clientX:0,clientY:0},this.itemBackup=[0,0,0,0],this.resizeEventScrollType={west:!1,east:!1,north:!1,south:!1}}destroy(){this.gridster?.previewStyle(),this.gridster=this.gridsterItem=null}dragStart(e){if(e.which&&e.which!==1)return;this.gridster.options.resizable&&this.gridster.options.resizable.start&&this.gridster.options.resizable.start(this.gridsterItem.item,this.gridsterItem,e),e.stopPropagation(),e.preventDefault(),this.zone.runOutsideAngular(()=>{this.mousemove=this.gridsterItem.renderer.listen("document","mousemove",this.dragMove),this.touchmove=this.gridster.renderer.listen(this.gridster.el,"touchmove",this.dragMove)}),this.mouseup=this.gridsterItem.renderer.listen("document","mouseup",this.dragStop),this.mouseleave=this.gridsterItem.renderer.listen("document","mouseleave",this.dragStop),this.cancelOnBlur=this.gridsterItem.renderer.listen("window","blur",this.dragStop),this.touchend=this.gridsterItem.renderer.listen("document","touchend",this.dragStop),this.touchcancel=this.gridsterItem.renderer.listen("document","touchcancel",this.dragStop),this.gridsterItem.renderer.addClass(this.gridsterItem.el,"gridster-item-resizing"),this.lastMouse.clientX=e.clientX,this.lastMouse.clientY=e.clientY,this.left=this.gridsterItem.left,this.top=this.gridsterItem.top,this.originalClientX=e.clientX,this.originalClientY=e.clientY,this.width=this.gridsterItem.width,this.height=this.gridsterItem.height,this.bottom=this.gridsterItem.top+this.gridsterItem.height,this.right=this.gridsterItem.left+this.gridsterItem.width,this.margin=this.gridster.$options.margin,this.outerMarginTop=this.gridster.$options.outerMarginTop,this.outerMarginRight=this.gridster.$options.outerMarginRight,this.outerMarginBottom=this.gridster.$options.outerMarginBottom,this.outerMarginLeft=this.gridster.$options.outerMarginLeft,this.offsetLeft=this.gridster.el.scrollLeft-this.gridster.el.offsetLeft,this.offsetTop=this.gridster.el.scrollTop-this.gridster.el.offsetTop,this.diffLeft=e.clientX+this.offsetLeft-this.left,this.diffRight=e.clientX+this.offsetLeft-this.right,this.diffTop=e.clientY+this.offsetTop-this.top,this.diffBottom=e.clientY+this.offsetTop-this.bottom,this.minHeight=this.gridster.positionYToPixels(this.gridsterItem.$item.minItemRows||this.gridster.$options.minItemRows)-this.margin,this.minWidth=this.gridster.positionXToPixels(this.gridsterItem.$item.minItemCols||this.gridster.$options.minItemCols)-this.margin,this.gridster.movingItem=this.gridsterItem.$item,this.gridster.previewStyle(),this.push=new en(this.gridsterItem),this.pushResize=new is(this.gridsterItem),this.gridster.dragInProgress=!0,this.gridster.updateGrid();let{classList:t}=e.target;t.contains("handle-n")?(this.resizeEventScrollType.north=!0,this.directionFunction=this.handleNorth):t.contains("handle-w")?this.gridster.$options.dirType===Pt.RTL?(this.resizeEventScrollType.east=!0,this.directionFunction=this.handleEast):(this.resizeEventScrollType.west=!0,this.directionFunction=this.handleWest):t.contains("handle-s")?(this.resizeEventScrollType.south=!0,this.directionFunction=this.handleSouth):t.contains("handle-e")?this.gridster.$options.dirType===Pt.RTL?(this.resizeEventScrollType.west=!0,this.directionFunction=this.handleWest):(this.resizeEventScrollType.east=!0,this.directionFunction=this.handleEast):t.contains("handle-nw")?this.gridster.$options.dirType===Pt.RTL?(this.resizeEventScrollType.north=!0,this.resizeEventScrollType.east=!0,this.directionFunction=this.handleNorthEast):(this.resizeEventScrollType.north=!0,this.resizeEventScrollType.west=!0,this.directionFunction=this.handleNorthWest):t.contains("handle-ne")?this.gridster.$options.dirType===Pt.RTL?(this.resizeEventScrollType.north=!0,this.resizeEventScrollType.west=!0,this.directionFunction=this.handleNorthWest):(this.resizeEventScrollType.north=!0,this.resizeEventScrollType.east=!0,this.directionFunction=this.handleNorthEast):t.contains("handle-sw")?this.gridster.$options.dirType===Pt.RTL?(this.resizeEventScrollType.south=!0,this.resizeEventScrollType.east=!0,this.directionFunction=this.handleSouthEast):(this.resizeEventScrollType.south=!0,this.resizeEventScrollType.west=!0,this.directionFunction=this.handleSouthWest):t.contains("handle-se")&&(this.gridster.$options.dirType===Pt.RTL?(this.resizeEventScrollType.south=!0,this.resizeEventScrollType.west=!0,this.directionFunction=this.handleSouthWest):(this.resizeEventScrollType.south=!0,this.resizeEventScrollType.east=!0,this.directionFunction=this.handleSouthEast))}dragMove=e=>{if(this.directionFunction===null)throw new Error("The `directionFunction` has not been set before calling `dragMove`.");e.stopPropagation(),e.preventDefault(),Rt.checkTouchEvent(e),this.offsetTop=this.gridster.el.scrollTop-this.gridster.el.offsetTop,this.offsetLeft=this.gridster.el.scrollLeft-this.gridster.el.offsetLeft,br(this.gridster,this.left,this.top,this.width,this.height,e,this.lastMouse,this.directionFunction,!0,this.resizeEventScrollType);let t=this.gridster.options.scale||1;this.directionFunction({clientX:this.originalClientX+(e.clientX-this.originalClientX)/t,clientY:this.originalClientY+(e.clientY-this.originalClientY)/t}),this.lastMouse.clientX=e.clientX,this.lastMouse.clientY=e.clientY,this.zone.run(()=>{this.gridster.updateGrid()})};dragStop=e=>{e.stopPropagation(),e.preventDefault(),xr(),this.mousemove(),this.mouseup(),this.mouseleave(),this.cancelOnBlur(),this.touchmove(),this.touchend(),this.touchcancel(),this.gridster.dragInProgress=!1,this.gridster.updateGrid(),this.gridster.options.resizable&&this.gridster.options.resizable.stop?Promise.resolve(this.gridster.options.resizable.stop(this.gridsterItem.item,this.gridsterItem,e)).then(this.makeResize,this.cancelResize):this.makeResize(),setTimeout(()=>{this.gridsterItem.renderer.removeClass(this.gridsterItem.el,"gridster-item-resizing"),this.gridster&&(this.gridster.movingItem=null,this.gridster.previewStyle())})};cancelResize=()=>{this.gridsterItem.$item.cols=this.gridsterItem.item.cols||1,this.gridsterItem.$item.rows=this.gridsterItem.item.rows||1,this.gridsterItem.$item.x=this.gridsterItem.item.x||0,this.gridsterItem.$item.y=this.gridsterItem.item.y||0,this.gridsterItem.setSize(),this.push.restoreItems(),this.pushResize.restoreItems(),this.push.destroy(),this.push=null,this.pushResize.destroy(),this.pushResize=null};makeResize=()=>{this.gridsterItem.setSize(),this.gridsterItem.checkItemChanges(this.gridsterItem.$item,this.gridsterItem.item),this.push.setPushedItems(),this.pushResize.setPushedItems(),this.push.destroy(),this.push=null,this.pushResize.destroy(),this.pushResize=null};handleNorth=e=>{this.top=e.clientY+this.offsetTop-this.diffTop,this.height=this.bottom-this.top,this.minHeight>this.height?(this.height=this.minHeight,this.top=this.bottom-this.minHeight):this.gridster.options.enableBoundaryControl&&(this.top=Math.max(0,this.top),this.height=this.bottom-this.top);let t=this.gridster.options.pushItems?this.margin:0;if(this.newPosition=this.gridster.pixelsToPositionY(this.top+t,Math.floor),this.gridsterItem.$item.y!==this.newPosition){if(this.itemBackup[1]=this.gridsterItem.$item.y,this.itemBackup[3]=this.gridsterItem.$item.rows,this.gridsterItem.$item.rows+=this.gridsterItem.$item.y-this.newPosition,this.gridsterItem.$item.y=this.newPosition,this.pushResize.pushItems(this.pushResize.fromSouth),this.push.pushItems(this.push.fromSouth,this.gridster.$options.disablePushOnResize),this.gridster.checkCollision(this.gridsterItem.$item)){this.gridsterItem.$item.y=this.itemBackup[1],this.gridsterItem.$item.rows=this.itemBackup[3],this.top=this.gridster.positionYToPixels(this.gridsterItem.$item.y),this.setItemTop(this.gridster.positionYToPixels(this.gridsterItem.$item.y)),this.setItemHeight(this.gridster.positionYToPixels(this.gridsterItem.$item.rows)-this.margin);return}else this.gridster.previewStyle();this.pushResize.checkPushBack(),this.push.checkPushBack()}this.setItemTop(this.top),this.setItemHeight(this.height)};handleWest=e=>{let t=this.gridster.$options.dirType===Pt.RTL?this.originalClientX+(this.originalClientX-e.clientX):e.clientX;this.left=t+this.offsetLeft-this.diffLeft,this.width=this.right-this.left,this.minWidth>this.width?(this.width=this.minWidth,this.left=this.right-this.minWidth):this.gridster.options.enableBoundaryControl&&(this.left=Math.max(0,this.left),this.width=this.right-this.left);let n=this.gridster.options.pushItems?this.margin:0;if(this.newPosition=this.gridster.pixelsToPositionX(this.left+n,Math.floor),this.gridsterItem.$item.x!==this.newPosition){if(this.itemBackup[0]=this.gridsterItem.$item.x,this.itemBackup[2]=this.gridsterItem.$item.cols,this.gridsterItem.$item.cols+=this.gridsterItem.$item.x-this.newPosition,this.gridsterItem.$item.x=this.newPosition,this.pushResize.pushItems(this.pushResize.fromEast),this.push.pushItems(this.push.fromEast,this.gridster.$options.disablePushOnResize),this.gridster.checkCollision(this.gridsterItem.$item)){this.gridsterItem.$item.x=this.itemBackup[0],this.gridsterItem.$item.cols=this.itemBackup[2],this.left=this.gridster.positionXToPixels(this.gridsterItem.$item.x),this.setItemLeft(this.gridster.positionXToPixels(this.gridsterItem.$item.x)),this.setItemWidth(this.gridster.positionXToPixels(this.gridsterItem.$item.cols)-this.margin);return}else this.gridster.previewStyle();this.pushResize.checkPushBack(),this.push.checkPushBack()}this.setItemLeft(this.left),this.setItemWidth(this.width)};handleSouth=e=>{if(this.height=e.clientY+this.offsetTop-this.diffBottom-this.top,this.minHeight>this.height&&(this.height=this.minHeight),this.bottom=this.top+this.height,this.gridster.options.enableBoundaryControl){let n=this.outerMarginBottom??this.margin,s=this.gridster.el.getBoundingClientRect();this.bottom=Math.min(this.bottom,s.bottom-s.top-2*n),this.height=this.bottom-this.top}let t=this.gridster.options.pushItems?0:this.margin;if(this.newPosition=this.gridster.pixelsToPositionY(this.bottom+t,Math.ceil),this.gridsterItem.$item.y+this.gridsterItem.$item.rows!==this.newPosition){if(this.itemBackup[3]=this.gridsterItem.$item.rows,this.gridsterItem.$item.rows=this.newPosition-this.gridsterItem.$item.y,this.pushResize.pushItems(this.pushResize.fromNorth),this.push.pushItems(this.push.fromNorth,this.gridster.$options.disablePushOnResize),this.gridster.checkCollision(this.gridsterItem.$item)){this.gridsterItem.$item.rows=this.itemBackup[3],this.setItemHeight(this.gridster.positionYToPixels(this.gridsterItem.$item.rows)-this.margin);return}else this.gridster.previewStyle();this.pushResize.checkPushBack(),this.push.checkPushBack()}this.setItemHeight(this.height)};handleEast=e=>{let t=this.gridster.$options.dirType===Pt.RTL?this.originalClientX+(this.originalClientX-e.clientX):e.clientX;if(this.width=t+this.offsetLeft-this.diffRight-this.left,this.minWidth>this.width&&(this.width=this.minWidth),this.right=this.left+this.width,this.gridster.options.enableBoundaryControl){let s=this.outerMarginRight??this.margin,o=this.gridster.el.getBoundingClientRect();this.right=Math.min(this.right,o.right-o.left-2*s),this.width=this.right-this.left}let n=this.gridster.options.pushItems?0:this.margin;if(this.newPosition=this.gridster.pixelsToPositionX(this.right+n,Math.ceil),this.gridsterItem.$item.x+this.gridsterItem.$item.cols!==this.newPosition){if(this.itemBackup[2]=this.gridsterItem.$item.cols,this.gridsterItem.$item.cols=this.newPosition-this.gridsterItem.$item.x,this.pushResize.pushItems(this.pushResize.fromWest),this.push.pushItems(this.push.fromWest,this.gridster.$options.disablePushOnResize),this.gridster.checkCollision(this.gridsterItem.$item)){this.gridsterItem.$item.cols=this.itemBackup[2],this.setItemWidth(this.gridster.positionXToPixels(this.gridsterItem.$item.cols)-this.margin);return}else this.gridster.previewStyle();this.pushResize.checkPushBack(),this.push.checkPushBack()}this.setItemWidth(this.width)};handleNorthWest=e=>{this.handleNorth(e),this.handleWest(e)};handleNorthEast=e=>{this.handleNorth(e),this.handleEast(e)};handleSouthWest=e=>{this.handleSouth(e),this.handleWest(e)};handleSouthEast=e=>{this.handleSouth(e),this.handleEast(e)};toggle(){this.resizeEnabled=this.gridsterItem.canBeResized(),this.resizableHandles=this.gridsterItem.getResizableHandles()}dragStartDelay(e){if(Rt.checkTouchEvent(e),!this.gridster.$options.resizable.delayStart){this.dragStart(e);return}let t=setTimeout(()=>{this.dragStart(e),d()},this.gridster.$options.resizable.delayStart),{cancelMouse:n,cancelMouseLeave:s,cancelOnBlur:o,cancelTouchMove:r,cancelTouchEnd:a,cancelTouchCancel:l}=this.zone.runOutsideAngular(()=>{let h=this.gridsterItem.renderer.listen("document","mouseup",d),u=this.gridsterItem.renderer.listen("document","mouseleave",d),p=this.gridsterItem.renderer.listen("window","blur",d),b=this.gridsterItem.renderer.listen("document","touchmove",c),g=this.gridsterItem.renderer.listen("document","touchend",d),_=this.gridsterItem.renderer.listen("document","touchcancel",d);return{cancelMouse:h,cancelMouseLeave:u,cancelOnBlur:p,cancelTouchMove:b,cancelTouchEnd:g,cancelTouchCancel:_}});function c(h){Rt.checkTouchEvent(h),(Math.abs(h.clientX-e.clientX)>9||Math.abs(h.clientY-e.clientY)>9)&&d()}function d(){clearTimeout(t),o(),n(),s(),r(),a(),l()}}setItemTop(e){this.gridster.gridRenderer.setCellPosition(this.gridsterItem.renderer,this.gridsterItem.el,this.left,e)}setItemLeft(e){this.gridster.gridRenderer.setCellPosition(this.gridsterItem.renderer,this.gridsterItem.el,e,this.top)}setItemHeight(e){this.gridsterItem.renderer.setStyle(this.gridsterItem.el,"height",e+"px")}setItemWidth(e){this.gridsterItem.renderer.setStyle(this.gridsterItem.el,"width",e+"px")}},vr=(()=>{class i{renderer;zone;item;itemInit=new ye;itemChange=new ye;itemResize=new ye;$item;el;gridster;top;left;width;height;drag;resize;notPlaced;init;get zIndex(){return this.getLayerIndex()+this.gridster.$options.baseLayerIndex}constructor(t,n,s,o){this.renderer=s,this.zone=o,this.el=t.nativeElement,this.$item={cols:-1,rows:-1,x:-1,y:-1},this.gridster=n,this.drag=new es(this,n,this.zone),this.resize=new ns(this,n,this.zone)}ngOnInit(){this.gridster.addItem(this)}ngOnChanges(t){t.item&&(this.updateOptions(),this.init||this.gridster.calculateLayout$.next()),t.item&&t.item.previousValue&&this.setSize()}updateOptions(){this.$item=Rt.merge(this.$item,this.item,{cols:void 0,rows:void 0,x:void 0,y:void 0,layerIndex:void 0,dragEnabled:void 0,resizeEnabled:void 0,compactEnabled:void 0,maxItemRows:void 0,minItemRows:void 0,maxItemCols:void 0,minItemCols:void 0,maxItemArea:void 0,minItemArea:void 0,resizableHandles:{s:void 0,e:void 0,n:void 0,w:void 0,se:void 0,ne:void 0,sw:void 0,nw:void 0}})}ngOnDestroy(){this.gridster.removeItem(this),this.drag.destroy(),this.resize.destroy(),this.gridster=this.drag=this.resize=null}setSize(){this.renderer.setStyle(this.el,"display",this.notPlaced?"":"block"),this.gridster.gridRenderer.updateItem(this.el,this.$item,this.renderer),this.updateItemSize()}updateItemSize(){let t=this.$item.y*this.gridster.curRowHeight,n=this.$item.x*this.gridster.curColWidth,s=this.$item.cols*this.gridster.curColWidth-this.gridster.$options.margin,o=this.$item.rows*this.gridster.curRowHeight-this.gridster.$options.margin;this.top=t,this.left=n,!this.init&&s>0&&o>0&&(this.init=!0,this.item.initCallback&&this.item.initCallback(this.item,this),this.gridster.options.itemInitCallback&&this.gridster.options.itemInitCallback(this.item,this),this.itemInit.next({item:this.item,itemComponent:this}),this.gridster.$options.scrollToNewItems&&this.el.scrollIntoView(!1)),(s!==this.width||o!==this.height)&&(this.width=s,this.height=o,this.gridster.options.itemResizeCallback&&this.gridster.options.itemResizeCallback(this.item,this),this.itemResize.next({item:this.item,itemComponent:this}))}itemChanged(){this.gridster.options.itemChangeCallback&&this.gridster.options.itemChangeCallback(this.item,this),this.itemChange.next({item:this.item,itemComponent:this})}checkItemChanges(t,n){t.rows===n.rows&&t.cols===n.cols&&t.x===n.x&&t.y===n.y||(this.gridster.checkCollision(this.$item)?(this.$item.x=n.x||0,this.$item.y=n.y||0,this.$item.cols=n.cols||1,this.$item.rows=n.rows||1,this.setSize()):(this.item.cols=this.$item.cols,this.item.rows=this.$item.rows,this.item.x=this.$item.x,this.item.y=this.$item.y,this.gridster.calculateLayout$.next(),this.itemChanged()))}canBeDragged(){let t=this.gridster.$options.draggable.enabled,n=this.$item.dragEnabled===void 0?t:this.$item.dragEnabled;return!this.gridster.mobile&&t&&n}canBeResized(){let t=this.gridster.$options.resizable.enabled,n=this.$item.resizeEnabled===void 0?t:this.$item.resizeEnabled;return!this.gridster.mobile&&t&&n}getResizableHandles(){let t=this.gridster.$options.resizable.handles,n=this.$item.resizableHandles;return n===void 0?t:kt(kt({},t),n)}bringToFront(t){if(t&&t<=0)return;let n=this.getLayerIndex(),s=this.gridster.$options.maxLayerIndex;if(n<s){let o=t?n+t:s;this.item.layerIndex=this.$item.layerIndex=o>s?s:o}}sendToBack(t){if(t&&t<=0)return;let n=this.getLayerIndex();if(n>0){let s=t?n-t:0;this.item.layerIndex=this.$item.layerIndex=s<0?0:s}}getLayerIndex(){return this.item.layerIndex!==void 0?this.item.layerIndex:this.gridster.$options.defaultLayerIndex!==void 0?this.gridster.$options.defaultLayerIndex:0}static \u0275fac=function(n){return new(n||i)(Wt(he),Wt(ss),Wt(ui),Wt(pi))};static \u0275cmp=Y({type:i,selectors:[["gridster-item"]],hostVars:2,hostBindings:function(n,s){n&2&&Fo("z-index",s.zIndex)},inputs:{item:"item"},outputs:{itemInit:"itemInit",itemChange:"itemChange",itemResize:"itemResize"},features:[hi],ngContentSelectors:fr,decls:9,vars:8,consts:[[1,"gridster-item-resizable-handler","handle-s"],[1,"gridster-item-resizable-handler","handle-e"],[1,"gridster-item-resizable-handler","handle-n"],[1,"gridster-item-resizable-handler","handle-w"],[1,"gridster-item-resizable-handler","handle-se"],[1,"gridster-item-resizable-handler","handle-ne"],[1,"gridster-item-resizable-handler","handle-sw"],[1,"gridster-item-resizable-handler","handle-nw"],[1,"gridster-item-resizable-handler","handle-s",3,"mousedown","touchstart"],[1,"gridster-item-resizable-handler","handle-e",3,"mousedown","touchstart"],[1,"gridster-item-resizable-handler","handle-n",3,"mousedown","touchstart"],[1,"gridster-item-resizable-handler","handle-w",3,"mousedown","touchstart"],[1,"gridster-item-resizable-handler","handle-se",3,"mousedown","touchstart"],[1,"gridster-item-resizable-handler","handle-ne",3,"mousedown","touchstart"],[1,"gridster-item-resizable-handler","handle-sw",3,"mousedown","touchstart"],[1,"gridster-item-resizable-handler","handle-nw",3,"mousedown","touchstart"]],template:function(n,s){n&1&&(Yn(),Xn(0),D(1,dc,1,0,"div",0),D(2,hc,1,0,"div",1),D(3,uc,1,0,"div",2),D(4,pc,1,0,"div",3),D(5,fc,1,0,"div",4),D(6,gc,1,0,"div",5),D(7,mc,1,0,"div",6),D(8,bc,1,0,"div",7)),n&2&&(f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.s&&s.resize.resizeEnabled?1:-1),f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.e&&s.resize.resizeEnabled?2:-1),f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.n&&s.resize.resizeEnabled?3:-1),f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.w&&s.resize.resizeEnabled?4:-1),f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.se&&s.resize.resizeEnabled?5:-1),f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.ne&&s.resize.resizeEnabled?6:-1),f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.sw&&s.resize.resizeEnabled?7:-1),f(),$(s.resize.resizableHandles!=null&&s.resize.resizableHandles.nw&&s.resize.resizeEnabled?8:-1))},styles:[`gridster-item{box-sizing:border-box;z-index:1;position:absolute;overflow:hidden;transition:.3s;display:none;background:#fff;-webkit-user-select:text;user-select:text}gridster-item.gridster-item-moving{cursor:move}gridster-item.gridster-item-resizing,gridster-item.gridster-item-moving{transition:0s;z-index:2;box-shadow:0 0 5px 5px #0003,0 6px 10px #00000024,0 1px 18px #0000001f}.gridster-item-resizable-handler{position:absolute;z-index:2}.gridster-item-resizable-handler.handle-n{cursor:ns-resize;height:10px;right:0;top:0;left:0}.gridster-item-resizable-handler.handle-e{cursor:ew-resize;width:10px;bottom:0;right:0;top:0}.gridster-item-resizable-handler.handle-s{cursor:ns-resize;height:10px;right:0;bottom:0;left:0}.gridster-item-resizable-handler.handle-w{cursor:ew-resize;width:10px;left:0;top:0;bottom:0}.gridster-item-resizable-handler.handle-ne{cursor:ne-resize;width:10px;height:10px;right:0;top:0}.gridster-item-resizable-handler.handle-nw{cursor:nw-resize;width:10px;height:10px;left:0;top:0}.gridster-item-resizable-handler.handle-se{cursor:se-resize;width:0;height:0;right:0;bottom:0;border-style:solid;border-width:0 0 10px 10px;border-color:transparent}.gridster-item-resizable-handler.handle-sw{cursor:sw-resize;width:10px;height:10px;left:0;bottom:0}gridster-item:hover .gridster-item-resizable-handler.handle-se{border-color:transparent transparent #ccc}
4
- `],encapsulation:2})}return i})();var Wm=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=Lo({type:i});static \u0275inj=Do({})}return i})();var Sr=(()=>{class i{$activeModal=R(Ye);constructor(){}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],decls:68,vars:12,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body","align-items-center","w-100","pb-0"],[1,"w-100","text-center","primary-text","mb-3"],[1,"fas","fa-fw","fa-heart",2,"font-size","75px"],["href","https://twitter.com/nfarina","target","_blank","rel","noopener noreferrer"],["href","https://twitter.com/khaost","target","_blank","rel","noopener noreferrer"],["href","https://github.com/homebridge/HAP-NodeJS","target","_blank","rel","noopener noreferrer"],["href","https://github.com/Supereg","target","_blank","rel","noopener noreferrer"],[1,"font-monospace"],["href","https://github.com/oznu","target","_blank","rel","noopener noreferrer"],["href","https://github.com/appletechy","target","_blank","rel","noopener noreferrer"],[1,"modal-footer","justify-content-between"],[1,"text-start"],[1,"text-center"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-end"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1)(2,"h5",2),y(3),w(4,"translate"),m(),x(5,"button",3),w(6,"translate"),X("click",function(){return s.$activeModal.dismiss("Dismiss")}),m()(),x(7,"div",4)(8,"div",5),W(9,"i",6),m(),x(10,"h5"),y(11,"Homebridge"),m(),x(12,"ul")(13,"li"),y(14," Homebridge was originally created by "),x(15,"a",7),y(16,"Nick Farina"),m(),y(17,". "),m(),x(18,"li"),y(19," The original HomeKit API work was done by "),x(20,"a",8),y(21,"Khaos Tian"),m(),y(22," in his "),x(23,"a",9),y(24,"HAP-NodeJS"),m(),y(25," project. "),m(),x(26,"li"),y(27," Homebridge and HAP-NodeJS have since been maintained and improved by "),x(28,"a",10),y(29,"Supereg"),m(),y(30,". "),m(),x(31,"li"),y(32," The "),x(33,"span",11),y(34,"hb-service"),m(),y(35," utility was created by "),x(36,"a",12),y(37,"oznu"),m(),y(38,". "),m()(),x(39,"h5"),y(40,"Homebridge UI"),m(),x(41,"ul")(42,"li"),y(43," Homebridge UI was originally created by "),x(44,"a",12),y(45,"oznu"),m(),y(46,". "),m()(),x(47,"h5"),y(48,"Homebridge Supporters"),m(),x(49,"ul")(50,"li"),y(51," Thanks to "),x(52,"a",13),y(53,"appletechy"),m(),y(54," for being an active and super supportive member of the community. "),m()(),x(55,"h5"),y(56,"Homebridge Plugins"),m(),x(57,"ul")(58,"li"),y(59,"Homebridge plugins are created by awesome developers in the Homebridge community."),m()()(),x(60,"div",14),W(61,"div",15),x(62,"div",16)(63,"button",17),w(64,"translate"),X("click",function(){return s.$activeModal.dismiss("Dismiss")}),y(65),w(66,"translate"),m()(),W(67,"div",18),m()()),n&2&&(f(3),T(S(4,4,"status.credits.title")),f(2),Ct("aria-label",S(6,6,"form.button_close")),f(58),Ct("aria-label",S(64,8,"form.button_close")),f(2),V(" ",S(66,10,"form.button_close")," "))},dependencies:[Z],encapsulation:2})}return i})();var Cc=(i,e)=>({"fa-sync fa-spin":i,"fa-city":e});function wc(i,e){if(i&1){let t=j();x(0,"li",6)(1,"span",7),y(2),w(3,"translate"),m(),x(4,"div",8)(5,"input",16),w(6,"translate"),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.hideNodeInfo,s)||(o.widget.hideNodeInfo=s),B(s)}),m(),W(7,"label",17),m()()}if(i&2){let t=k();f(2),T(S(3,3,"status.widget.hide_node_info")),f(3),ft("ngModel",t.widget.hideNodeInfo),Ct("aria-label",S(6,5,"status.widget.hide_node_info"))}}function vc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",19),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"div",21)(6,"span",22),W(7,"i",23),m(),x(8,"input",24),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.location,s)||(o.widget.location=s),B(s)}),m()()()(),x(9,"li",25),y(10,"Weather data is provided by OpenWeather."),m()}if(i&2){let t=k();f(2),V(" ",S(3,7,"status.widget.weather.label_search_for_your_city")," "),f(5),z("ngClass",Bt(9,Cc,t.searching,!t.searching)),f(),z("ngbTypeahead",t.searchCountryCodes)("resultFormatter",t.searchCountryCodeFormatter)("inputFormatter",t.searchCountryCodeFormatter)("editable",!1),ft("ngModel",t.widget.location)}}function Sc(i,e){if(i&1&&(x(0,"option",28),y(1),m()),i&2){let t=e.$implicit;z("value",t),f(),T(t)}}function Ic(i,e){if(i&1&&(x(0,"option",28),y(1),m()),i&2){let t=e.$implicit;z("value",t),f(),T(t)}}function kc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"select",27),mt("ngModelChange",function(s){A(t);let o=k(2);return gt(o.widget.theme,s)||(o.widget.theme=s),B(s)}),x(6,"option",29),y(7),w(8,"translate"),m(),x(9,"option",30),y(10),w(11,"translate"),m()()()()}if(i&2){let t=k(2);f(2),T(S(3,4,"settings.display.lighting_mode")),f(3),ft("ngModel",t.widget.theme),f(2),T(S(8,6,"settings.display.dark")),f(3),T(S(11,8,"settings.display.light"))}}function Mc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"select",27),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.fontSize,s)||(o.widget.fontSize=s),B(s)}),wt(6,Sc,2,2,"option",28,Lt),m()()(),x(8,"li",18)(9,"label",26),y(10),w(11,"translate"),m(),x(12,"div",20)(13,"select",27),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.fontWeight,s)||(o.widget.fontWeight=s),B(s)}),wt(14,Ic,2,2,"option",28,Lt),m()()(),D(16,kc,12,10,"li",18)}if(i&2){let t=k();f(2),T(S(3,5,"status.widget.font_size")),f(3),ft("ngModel",t.widget.fontSize),f(),vt(t.fontSizes),f(4),T(S(11,7,"status.widget.font_weight")),f(3),ft("ngModel",t.widget.fontWeight),f(),vt(t.fontWeights),f(2),$(t.isLightMode?16:-1)}}function Tc(i,e){if(i&1&&(x(0,"option",28),y(1),m()),i&2){let t=e.$implicit;z("value",t),f(),T(t)}}function Pc(i,e){if(i&1&&(x(0,"option",28),y(1),m()),i&2){let t=e.$implicit;z("value",t),f(),T(t)}}function Ec(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"select",27),mt("ngModelChange",function(s){A(t);let o=k(2);return gt(o.widget.theme,s)||(o.widget.theme=s),B(s)}),x(6,"option",29),y(7),w(8,"translate"),m(),x(9,"option",30),y(10),w(11,"translate"),m()()()()}if(i&2){let t=k(2);f(2),T(S(3,4,"settings.display.lighting_mode")),f(3),ft("ngModel",t.widget.theme),f(2),T(S(8,6,"settings.display.dark")),f(3),T(S(11,8,"settings.display.light"))}}function Dc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"select",27),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.fontSize,s)||(o.widget.fontSize=s),B(s)}),wt(6,Tc,2,2,"option",28,Lt),m()()(),x(8,"li",18)(9,"label",26),y(10),w(11,"translate"),m(),x(12,"div",20)(13,"select",27),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.fontWeight,s)||(o.widget.fontWeight=s),B(s)}),wt(14,Pc,2,2,"option",28,Lt),m()()(),D(16,Ec,12,10,"li",18)}if(i&2){let t=k();f(2),T(S(3,5,"status.widget.font_size")),f(3),ft("ngModel",t.widget.fontSize),f(),vt(t.fontSizes),f(4),T(S(11,7,"status.widget.font_weight")),f(3),ft("ngModel",t.widget.fontWeight),f(),vt(t.fontWeights),f(2),$(t.isLightMode?16:-1)}}function $c(i,e){if(i&1&&(x(0,"option",28),y(1),w(2,"date"),m()),i&2){let t=e.$implicit,n=k(2);z("value",t),f(),T(Mt(2,2,n.currentDate,t))}}function Oc(i,e){if(i&1&&(x(0,"option",28),y(1),w(2,"date"),m()),i&2){let t=e.$implicit,n=k(2);z("value",t),f(),T(Mt(2,2,n.currentDate,t))}}function Wc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"select",27),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.timeFormat,s)||(o.widget.timeFormat=s),B(s)}),wt(6,$c,3,5,"option",28,Lt),m()()(),x(8,"li",18)(9,"label",26),y(10),w(11,"translate"),m(),x(12,"div",20)(13,"select",27),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.dateFormat,s)||(o.widget.dateFormat=s),B(s)}),wt(14,Oc,3,5,"option",28,Lt),m()()()}if(i&2){let t=k();f(2),T(S(3,4,"status.widget.clock_timeformat")),f(3),ft("ngModel",t.widget.timeFormat),f(),vt(t.timeFormats),f(4),T(S(11,6,"status.widget.clock_dateformat")),f(3),ft("ngModel",t.widget.dateFormat),f(),vt(t.dateFormats)}}function Lc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"div",21)(6,"input",31),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.refreshInterval,s)||(o.widget.refreshInterval=s),B(s)}),m(),x(7,"span",32),y(8),w(9,"translate"),m()()()(),x(10,"li",18)(11,"label",26),y(12),w(13,"translate"),m(),x(14,"div",20)(15,"div",21)(16,"input",31),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.historyItems,s)||(o.widget.historyItems=s),B(s)}),m(),x(17,"span",32),y(18),w(19,"translate"),m()()()()}if(i&2){let t=k();f(2),T(S(3,6,"status.widget.network.refresh_interval")),f(4),ft("ngModel",t.widget.refreshInterval),f(2),T(S(9,8,"status.widget.network.seconds")),f(4),T(S(13,10,"status.widget.network.history_items")),f(4),ft("ngModel",t.widget.historyItems),f(2),T(S(19,12,"status.widget.network.items"))}}function zc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20)(5,"div",21)(6,"input",31),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.refreshInterval,s)||(o.widget.refreshInterval=s),B(s)}),m(),x(7,"span",32),y(8),w(9,"translate"),m()()()(),x(10,"li",18)(11,"label",26),y(12),w(13,"translate"),m(),x(14,"div",20)(15,"div",21)(16,"input",31),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.historyItems,s)||(o.widget.historyItems=s),B(s)}),m(),x(17,"span",32),y(18),w(19,"translate"),m()()()()}if(i&2){let t=k();f(2),T(S(3,6,"status.widget.network.refresh_interval")),f(4),ft("ngModel",t.widget.refreshInterval),f(2),T(S(9,8,"status.widget.network.seconds")),f(4),T(S(13,10,"status.widget.network.history_items")),f(4),ft("ngModel",t.widget.historyItems),f(2),T(S(19,12,"status.widget.network.items"))}}function Rc(i,e){if(i&1&&(x(0,"option",28),y(1),m()),i&2){let t=e.$implicit;z("value",t),f(),T(t)}}function Fc(i,e){if(i&1){let t=j();x(0,"select",27),mt("ngModelChange",function(s){A(t);let o=k(2);return gt(o.widget.networkInterface,s)||(o.widget.networkInterface=s),B(s)}),wt(1,Rc,2,2,"option",28,Lt),m()}if(i&2){let t=k(2);ft("ngModel",t.widget.networkInterface),f(),vt(t.networkInterfaces)}}function Ac(i,e){i&1&&(x(0,"span",34),y(1),w(2,"translate"),m()),i&2&&(f(),T(S(2,1,"status.widget.network.none_selected")))}function Bc(i,e){if(i&1){let t=j();x(0,"li",18)(1,"label",26),y(2),w(3,"translate"),m(),x(4,"div",20),D(5,Fc,3,1,"select",33),D(6,Ac,3,3,"span",34),m()(),x(7,"li",18)(8,"label",26),y(9),w(10,"translate"),m(),x(11,"div",20)(12,"div",21)(13,"input",31),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.refreshInterval,s)||(o.widget.refreshInterval=s),B(s)}),m(),x(14,"span",32),y(15),w(16,"translate"),m()()()(),x(17,"li",18)(18,"label",26),y(19),w(20,"translate"),m(),x(21,"div",20)(22,"div",21)(23,"input",31),mt("ngModelChange",function(s){A(t);let o=k();return gt(o.widget.historyItems,s)||(o.widget.historyItems=s),B(s)}),m(),x(24,"span",32),y(25),w(26,"translate"),m()()()()}if(i&2){let t=k();f(2),T(S(3,9,"status.widget.network.network_interface")),f(3),$(t.networkInterfaces.length?5:-1),f(),$(t.networkInterfaces.length?-1:6),f(3),T(S(10,11,"status.widget.network.refresh_interval")),f(4),ft("ngModel",t.widget.refreshInterval),f(2),T(S(16,13,"status.widget.network.seconds")),f(4),V(" ",S(20,15,"status.widget.network.history_items")," "),f(4),ft("ngModel",t.widget.historyItems),f(2),T(S(26,17,"status.widget.network.items"))}}var Ir=(()=>{class i{$activeModal=R(Ye);$api=R(Ge);$http=R(qi);$settings=R(zt);$translate=R(Gt);widget;searching;fontSizes=[10,11,12,13,14,15,16,17,18,19,20];fontWeights=["100","200","300","400","500","600","700","800","900","bold","normal"];currentDate=new Date;timeFormats=["h:mm a","h:mm:ss a","H:mm","H:mm:ss"];dateFormats=["yyyy-MM-dd","dd/MM/yy","dd/MM/yyyy","M/d/yy","M/dd/yyyy","dd.MM.yyyy","MMM d","MMM d, y","MMMM d, y","d MMMM y","EEEE, MMMM d, y","EEEE, d MMMM y","EEE, MMM d","EEEE","EEEE, MMM d"];networkInterfaces=[];isLightMode;constructor(){}searchCountryCodes=t=>t.pipe(Hi(300),Ni(),jn(()=>this.searching=!0),ji(n=>n.length<3?[]:this.findOpenWeatherMapCity(n).pipe(To(()=>(this.searching=!1,Io([]))))),jn(()=>this.searching=!1));searchCountryCodeFormatter=t=>`${t.name}, ${t.country}`;ngOnInit(){this.isLightMode=this.$settings.actualLightingMode==="light",(this.widget.component==="HomebridgeLogsWidgetComponent"||this.widget.component==="TerminalWidgetComponent")&&(this.widget.fontWeight||(this.widget.fontWeight="400"),this.widget.fontSize||(this.widget.fontSize=15),this.widget.theme||(this.widget.theme="dark")),this.widget.component==="NetworkWidgetComponent"&&At(this.$api.get("/server/network-interfaces/bridge")).then(t=>{this.networkInterfaces=t})}findOpenWeatherMapCity(t){return this.$http.get("https://api.openweathermap.org/data/2.5/find",{params:new Gi({fromObject:{q:t,type:"like",sort:"population",cnt:"30",appid:Zi.owm.appid,lang:this.$translate.currentLang}})}).pipe(ko(n=>n.list.map(s=>({id:s.id,name:s.name,country:s.sys.country,coord:s.coord}))))}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget"},decls:36,vars:23,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"list-group","list-group-box","mb-0"],[1,"list-group-item","d-flex","justify-content-between","align-items-center","flex-row","pb-2"],[1,"text-start"],[1,"text-end","grey-text","d-flex","align-items-center"],["type","checkbox","id","hideOnMobile",1,"rendux-input",3,"ngModelChange","ngModel"],["for","hideOnMobile",1,"rendux-label","ms-3"],[1,"modal-footer","justify-content-between"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-primary",3,"click"],["type","checkbox","id","hideNodeInfo",1,"rendux-input",3,"ngModelChange","ngModel"],["for","hideNodeInfo",1,"rendux-label","ms-3"],[1,"list-group-item","d-flex","flex-column","flex-md-row","align-items-center"],["for","city-search-input",1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"text-start","text-md-end","w-100","w-md-50"],[1,"input-group"],["id","",1,"input-group-text","custom-input"],[1,"fas","fa-fw",3,"ngClass"],["id","city-search-input","type","text",1,"form-control","custom-input",3,"ngModelChange","ngbTypeahead","resultFormatter","inputFormatter","editable","ngModel"],[1,"list-group-item","muted","grey-text","text-center"],[1,"mb-2","mb-md-0","w-100","w-md-50"],[1,"custom-select",3,"ngModelChange","ngModel"],[3,"value"],["value","dark"],["value","light"],["type","number","min","1","max","60",1,"form-control","custom-input",3,"ngModelChange","ngModel"],[1,"input-group-text","custom-input"],[1,"custom-select",3,"ngModel"],[1,"grey-text"]],template:function(n,s){if(n&1&&(x(0,"div",0)(1,"div",1)(2,"h5",2),y(3),w(4,"translate"),m(),x(5,"button",3),w(6,"translate"),X("click",function(){return s.$activeModal.dismiss("Dismiss")}),m()(),x(7,"div",4)(8,"ul",5)(9,"li",6)(10,"span",7),y(11),w(12,"translate"),m(),x(13,"div",8)(14,"input",9),w(15,"translate"),mt("ngModelChange",function(r){return gt(s.widget.hideOnMobile,r)||(s.widget.hideOnMobile=r),r}),m(),W(16,"label",10),m()(),D(17,wc,8,7,"li",6)(18,vc,11,12)(19,Mc,17,9)(20,Dc,17,9)(21,Wc,16,8)(22,Lc,20,14)(23,zc,20,14)(24,Bc,27,19),m()(),x(25,"div",11)(26,"div",7)(27,"button",12),w(28,"translate"),X("click",function(){return s.$activeModal.dismiss("Dismiss")}),y(29),w(30,"translate"),m()(),W(31,"div",13),x(32,"div",14)(33,"button",15),X("click",function(){return s.$activeModal.close()}),y(34),w(35,"translate"),m()()()()),n&2){let o;f(3),T(S(4,9,"status.widget.title_manage_widget")),f(2),Ct("aria-label",S(6,11,"form.button_close")),f(6),T(S(12,13,"status.widget.hide_on_mobile")),f(3),ft("ngModel",s.widget.hideOnMobile),Ct("aria-label",S(15,15,"status.widget.hide_on_mobile")),f(3),$((o=s.widget.component)==="UpdateInfoWidgetComponent"?17:o==="WeatherWidgetComponent"?18:o==="HomebridgeLogsWidgetComponent"?19:o==="TerminalWidgetComponent"?20:o==="ClockWidgetComponent"?21:o==="CpuWidgetComponent"?22:o==="MemoryWidgetComponent"?23:o==="NetworkWidgetComponent"?24:-1),f(10),Ct("aria-label",S(28,17,"form.button_close")),f(2),V(" ",S(30,19,"form.button_close")," "),f(5),V(" ",S(35,21,"form.button_save")," ")}},dependencies:[Ki,Yo,Xo,Vo,jo,Bo,Uo,Ho,qo,Go,No,rt,Ko,Xi,Z],encapsulation:2})}return i})();function Vc(i,e){if(i&1){let t=j();x(0,"li",12)(1,"span",13),y(2),m(),x(3,"span")(4,"input",14),w(5,"translate"),X("click",function(){let s=A(t).$implicit,o=k(2);return B(o.selectWidget(s))}),m(),W(6,"label",15),m()()}if(i&2){let t=e.$implicit;f(2),T(t.name),f(2),z("checked",t.shown)("id","widget"+t.name),Ct("aria-label",S(5,5,"form.button_show")+" "+t.name),f(2),z("for","widget"+t.name)}}function Hc(i,e){if(i&1&&(x(0,"ul",5),wt(1,Vc,7,7,"li",12,Lt),m()),i&2){let t=k();f(),vt(t.availableWidgets)}}var kr=(()=>{class i{$activeModal=R(Ye);$settings=R(zt);$translate=R(Gt);dashboard;resetLayout;lockLayout;unlockLayout;availableWidgets=[];constructor(){}ngOnInit(){let t=[{name:this.$translate.instant("status.services.updates"),component:"UpdateInfoWidgetComponent",hidden:!1,cols:10,rows:3,mobileOrder:10},{name:this.$translate.instant("status.widget.weather.title_weather"),component:"WeatherWidgetComponent",hidden:!1,cols:3,rows:5,mobileOrder:20,requiresConfig:!0},{name:this.$translate.instant("accessories.title_accessories"),component:"AccessoriesWidgetComponent",hidden:!this.$settings.env.enableAccessories,cols:7,rows:9,mobileOrder:30,hideOnMobile:!1},{name:this.$translate.instant("child_bridge.bridges"),component:"BridgesWidgetComponent",hidden:!1,cols:5,rows:9,mobileOrder:35},{name:this.$translate.instant("status.cpu.title_cpu"),component:"CpuWidgetComponent",hidden:!1,cols:5,rows:3,mobileOrder:40},{name:this.$translate.instant("status.memory.title_memory"),component:"MemoryWidgetComponent",hidden:!1,cols:5,rows:3,mobileOrder:50},{name:this.$translate.instant("status.network.title_network"),component:"NetworkWidgetComponent",hidden:!1,cols:10,rows:3,mobileOrder:55},{name:this.$translate.instant("status.uptime.title_uptime"),component:"UptimeWidgetComponent",hidden:!1,cols:5,rows:3,mobileOrder:60},{name:this.$translate.instant("status.widget.info"),component:"SystemInfoWidgetComponent",hidden:!1,cols:5,rows:9,mobileOrder:70},{name:this.$translate.instant("status.widget.add.label_pairing_code"),component:"HapQrcodeWidgetComponent",hidden:!1,cols:3,rows:7,mobileOrder:100},{name:this.$translate.instant("status.widget.homebridge_logs"),component:"HomebridgeLogsWidgetComponent",hidden:!1,cols:7,rows:6,mobileOrder:1e3,hideOnMobile:!0},{name:`Homebridge ${this.$translate.instant("menu.docker.terminal")}`,component:"TerminalWidgetComponent",hidden:!this.$settings.env.enableTerminalAccess,cols:7,rows:6,mobileOrder:1e3,hideOnMobile:!0},{name:this.$translate.instant("status.widget.clock"),component:"ClockWidgetComponent",cols:5,rows:3,mobileOrder:23,hideOnMobile:!0}];this.availableWidgets=t.filter(n=>!n.hidden).sort((n,s)=>n.name.localeCompare(s.name)).map(n=>de(kt({},n),{shown:this.dashboard.some(s=>s.component===n.component)}))}selectWidget(t){this.$activeModal.close(t)}doResetLayout(){this.resetLayout(),this.$activeModal.dismiss()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{dashboard:"dashboard",resetLayout:"resetLayout",lockLayout:"lockLayout",unlockLayout:"unlockLayout"},decls:20,vars:16,consts:[[1,"modal-content"],[1,"modal-header"],[1,"modal-title"],["type","button","data-bs-dismiss","modal",1,"btn-close",3,"click"],[1,"modal-body"],[1,"list-group","list-group-box","mb-0"],[1,"modal-footer","justify-content-between"],[1,"text-start"],["type","button","data-bs-dismiss","modal",1,"btn","btn-elegant",3,"click"],[1,"text-center"],[1,"text-end"],["type","button","data-bs-dismiss","modal",1,"btn","btn-danger",3,"click"],[1,"list-group-item","d-flex","justify-content-between","align-items-center"],[2,"word-break","break-all"],["type","checkbox",1,"rendux-input",3,"click","checked","id"],[1,"rendux-label","ms-3",3,"for"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1)(2,"h5",2),y(3),w(4,"translate"),m(),x(5,"button",3),w(6,"translate"),X("click",function(){return s.$activeModal.dismiss("Dismiss")}),m()(),x(7,"div",4),D(8,Hc,3,0,"ul",5),m(),x(9,"div",6)(10,"div",7)(11,"button",8),w(12,"translate"),X("click",function(){return s.$activeModal.dismiss("Dismiss")}),y(13),w(14,"translate"),m()(),W(15,"div",9),x(16,"div",10)(17,"button",11),X("click",function(){return s.doResetLayout()}),y(18),w(19,"translate"),m()()()()),n&2&&(f(3),T(S(4,6,"status.widget.show_hide")),f(2),Ct("aria-label",S(6,8,"form.button_close")),f(3),$(s.availableWidgets.length?8:-1),f(3),Ct("aria-label",S(12,10,"form.button_close")),f(2),V(" ",S(14,12,"form.button_close")," "),f(5),V(" ",S(19,14,"form.button_reset")," "))},dependencies:[Z,Ki],encapsulation:2})}return i})();var Nc=i=>({"widget-cursor":i});function jc(i,e){if(i&1&&(x(0,"div",5),W(1,"app-accessory-tile",6),m()),i&2){let t=k().$implicit;f(),z("service",t)}}function Uc(i,e){if(i&1&&D(0,jc,2,1,"div",5),i&2){let t=e.$implicit;$(t.hidden?-1:0)}}function Yc(i,e){if(i&1){let t=j();x(0,"div",4),mt("dragulaModelChange",function(s){A(t);let o=k();return gt(o.dashboardAccessories,s)||(o.dashboardAccessories=s),B(s)}),wt(1,Uc,1,1,null,null,Lt),m()}if(i&2){let t=k();z("dragula","widget-accessories-bag"),ft("dragulaModel",t.dashboardAccessories),f(),vt(t.dashboardAccessories)}}function Xc(i,e){i&1&&(x(0,"div",3)(1,"div",7)(2,"h1"),W(3,"i",8),m(),x(4,"p",9),y(5),w(6,"translate"),m()()()),i&2&&(f(5),T(S(6,1,"status.widget.accessories.choose_accessories")))}var Mr=(()=>{class i{$accessories=R(sr);$dragula=R(Qo);$md=R(rr);widget;isMobile=!1;dashboardAccessories=[];loaded=!1;accessoryDataSubscription;layoutSubscription;orderSubscription;constructor(){let t=this.$dragula;this.isMobile=this.$md.detect.mobile(),t.createGroup("widget-accessories-bag",{moves:n=>!this.isMobile&&!n.classList.contains("no-drag")}),this.orderSubscription=t.drop().subscribe(()=>{setTimeout(()=>{this.widget.accessoryOrder=this.dashboardAccessories.map(n=>n.uniqueId),this.widget.$saveWidgetsEvent.next(void 0)})})}ngOnInit(){return tt(this,null,function*(){this.accessoryDataSubscription=this.$accessories.accessoryData.subscribe(()=>{this.getDashboardAccessories()}),yield this.$accessories.start(),this.layoutSubscription=this.$accessories.layoutSaved.subscribe({next:()=>{this.getDashboardAccessories()}})})}getDashboardAccessories(){let t=[];for(let n of this.$accessories.rooms)for(let s of n.services)s.onDashboard&&t.push(s);this.widget.accessoryOrder&&this.widget.accessoryOrder.length&&t.sort((n,s)=>{let o=this.widget.accessoryOrder.findIndex(a=>a===n.uniqueId),r=this.widget.accessoryOrder.findIndex(a=>a===s.uniqueId);return o<r?-1:o>r?1:0}),this.dashboardAccessories=t,this.loaded=!0}ngOnDestroy(){this.$accessories.stop(),this.layoutSubscription.unsubscribe(),this.orderSubscription.unsubscribe(),this.accessoryDataSubscription.unsubscribe(),this.$dragula.destroy("widget-accessories-bag")}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget"},decls:6,vars:8,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-1","overflow-auto","no-scrollbars"],[1,"drag-handler","p-2",3,"ngClass"],[1,"d-flex","flex-wrap","gridster-item-content",3,"dragula","dragulaModel"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","gridster-item-content","text-center"],[1,"d-flex","flex-wrap","gridster-item-content",3,"dragulaModelChange","dragula","dragulaModel"],[1,"accessory-item","accessory-widget-box","noselect"],[3,"service"],[1,"d-flex","flex-column","w-100","pb-2"],[1,"fas","fa-fw","fa-user-cog"],[1,"grey-text"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1),y(2),w(3,"translate"),m(),D(4,Yc,3,2,"div",2),D(5,Xc,7,3,"div",3),m()),n&2&&(f(),z("ngClass",ot(6,Nc,s.widget.draggable)),f(),V(" ",S(3,4,"accessories.title_accessories")," "),f(2),$(s.dashboardAccessories.length?4:-1),f(),$(s.loaded&&!s.dashboardAccessories.length?5:-1))},dependencies:[rt,Zo,Jo,or,Z],encapsulation:2})}return i})();var Gc=i=>({"widget-cursor":i}),Tr=(i,e,t)=>({"fa-bridge-circle-check green-text":i,"fa-bridge-circle-exclamation text-warning":e,"fa-bridge-circle-xmark red-text":t}),Pr=(i,e)=>({"green-text":i,"grey-text":e});function qc(i,e){if(i&1){let t=j();x(0,"i",11),w(1,"translate"),X("click",function(){A(t);let s=k();return B(s.restartHomebridge())}),m()}i&2&&z("ngbTooltip",S(1,1,"menu.tooltip_restart"))}function Kc(i,e){i&1&&W(0,"i",9)}function Qc(i,e){if(i&1){let t=j();x(0,"i",11),w(1,"translate"),X("click",function(){A(t);let s=k().$implicit,o=k();return B(o.restartChildBridge(s))}),m()}i&2&&z("ngbTooltip",S(1,1,"menu.tooltip_restart"))}function Jc(i,e){i&1&&W(0,"i",9)}function Zc(i,e){if(i&1&&(x(0,"div",3)(1,"div",4),W(2,"i",5),w(3,"translate"),w(4,"translate"),m(),x(5,"div",6),y(6),m(),x(7,"div",7),D(8,Qc,2,3,"i",8),D(9,Jc,1,0,"i",9),W(10,"i",10),w(11,"translate"),m()()),i&2){let t=e.$implicit,n=k();f(2),z("ngClass",qn(14,Tr,t.status==="ok"&&!t.restarting&&!n.isRestarting,t.status==="pending"||t.restarting||n.isRestarting,t.status==="down"&&!t.restarting&&!n.isRestarting))("ngbTooltip",S(3,8,t.status==="down"&&!t.restarting&&!n.isRestarting?"status.services.label_not_running":"status.services.label_running")),Ct("aria-label",S(4,10,t.status==="down"&&!t.restarting&&!n.isRestarting?"status.services.label_not_running":"status.services.label_running")),f(4),T(t.name),f(2),$(t.status!=="pending"&&!t.restarting?8:-1),f(),$(t.status==="pending"||t.restarting?9:-1),f(),z("ngbTooltip",S(11,12,t.paired?"status.widget.qr_paired":"status.widget.qr_unpaired"))("ngClass",Bt(18,Pr,t.paired,!t.paired))}}var Er=(()=>{class i{$api=R(Ge);$toastr=R(Ji);$translate=R(Gt);$ws=R(_t);widget;homebridgeStatus={};childBridges=[];isRestarting=!1;ioMain;ioChild;constructor(){}ngOnInit(){return tt(this,null,function*(){this.ioMain=this.$ws.getExistingNamespace("status"),this.ioMain.socket.on("homebridge-status",t=>{this.homebridgeStatus=t,t.status==="up"&&(this.isRestarting=!1)}),this.ioMain.connected.subscribe(()=>tt(this,null,function*(){yield this.getHomebridgeStatus()})),this.ioMain.socket.connected&&(yield this.getHomebridgeStatus()),this.ioMain.socket.on("disconnect",()=>{this.homebridgeStatus.status="down"}),this.ioChild=this.$ws.connectToNamespace("child-bridges"),this.ioChild.connected.subscribe(()=>tt(this,null,function*(){this.getChildBridgeMetadata(),this.ioChild.socket.emit("monitor-child-bridge-status")})),this.ioChild.socket.on("child-bridge-status-update",t=>{let n=this.childBridges.find(s=>s.username===t.username);n?(Object.assign(n,t),t.status==="ok"&&(n.restarting=!1)):(this.childBridges.push(t),this.childBridges.sort((s,o)=>s.name.localeCompare(o.name)))})})}getHomebridgeStatus(){return tt(this,null,function*(){this.homebridgeStatus=yield At(this.ioMain.request("get-homebridge-status"))})}getChildBridgeMetadata(){this.ioChild.request("get-homebridge-child-bridge-status").subscribe(t=>{this.childBridges=t,this.childBridges=t.sort((n,s)=>n.name.localeCompare(s.name))})}restartChildBridge(t){return tt(this,null,function*(){try{t.restarting=!0,yield At(this.ioChild.request("restart-child-bridge",t.username))}catch(n){console.error(n),this.$toastr.error(this.$translate.instant("status.widget.bridge.restart_error"),this.$translate.instant("toast.title_error"))}finally{setTimeout(()=>{t.restarting=!1},15e3)}})}restartHomebridge(){this.isRestarting=!0,this.$api.put("/server/restart",{}).subscribe({error:t=>{console.error(t),this.$toastr.error(this.$translate.instant("restart.toast_server_restart_error"),this.$translate.instant("toast.title_error"))}}),setTimeout(()=>{this.isRestarting=!1},15e3)}ngOnDestroy(){this.ioMain.end(),this.ioChild.end()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget"},decls:19,vars:27,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-3","overflow-auto","no-scrollbars"],[1,"drag-handler","p-2",3,"ngClass"],[1,"d-flex","flex-wrap","w-100","mt-0","justify-content-start","gridster-item-content","overflow-auto","no-scrollbars","align-items-center"],[1,"hb-status-item","d-flex","flex-row","w-100","px-3","mt-2","mb-1",2,"min-width","max(25%, 225px)"],[1,"hb-status-icon","d-flex","align-items-center"],["container","body","placement","right","openDelay","150","triggers","hover",1,"fas","fa-fw",3,"ngClass","ngbTooltip"],[1,"align-self-center","flex-child","px-3"],[1,"grey-text","ms-auto","d-flex","align-items-center"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover","placement","left",1,"icon-button","fas","fa-fw","fa-power-off",3,"ngbTooltip"],[1,"fas","fa-fw","fa-spinner","fa-pulse"],["container","body","openDelay","150","triggers","hover","placement","left",1,"fas","fa-fw","ms-2","fa-link",3,"ngbTooltip","ngClass"],["href","javascript:void(0)","container","body","openDelay","150","triggers","hover","placement","left",1,"icon-button","fas","fa-fw","fa-power-off",3,"click","ngbTooltip"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1),y(2),w(3,"translate"),m(),x(4,"div",2)(5,"div",3)(6,"div",4),W(7,"i",5),w(8,"translate"),w(9,"translate"),m(),x(10,"div",6),y(11),m(),x(12,"div",7),D(13,qc,2,3,"i",8),D(14,Kc,1,0,"i",9),W(15,"i",10),w(16,"translate"),m()(),wt(17,Zc,12,21,"div",3,Lt),m()()),n&2&&(f(),z("ngClass",ot(18,Gc,s.widget.draggable)),f(),V(" ",S(3,10,"child_bridge.bridges")," "),f(5),z("ngClass",qn(20,Tr,s.homebridgeStatus.status==="up"&&!s.isRestarting,s.homebridgeStatus.status==="pending"||s.isRestarting,s.homebridgeStatus.status==="down"&&!s.isRestarting))("ngbTooltip",S(8,12,s.homebridgeStatus.status==="down"&&!s.isRestarting?"status.services.label_not_running":"status.services.label_running")),Ct("aria-label",S(9,14,s.homebridgeStatus.status==="down"&&!s.isRestarting?"status.services.label_not_running":"status.services.label_running")),f(4),T(s.homebridgeStatus.name||"Homebridge"),f(2),$(s.homebridgeStatus.status!=="pending"&&!s.isRestarting?13:-1),f(),$(s.homebridgeStatus.status==="pending"||s.isRestarting?14:-1),f(),z("ngbTooltip",S(16,16,s.homebridgeStatus.paired?"status.widget.qr_paired":"status.widget.qr_unpaired"))("ngClass",Bt(24,Pr,s.homebridgeStatus.paired,!s.homebridgeStatus.paired)),f(2),vt(s.childBridges))},dependencies:[rt,Qi,Z],styles:[".flex-child[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.hb-status-icon[_ngcontent-%COMP%]{font-size:20px}@media (max-width: 767px){.hb-status-item[_ngcontent-%COMP%]{width:100%}}"]})}return i})();var Dr=(()=>{class i{widget;currentTime=new Date;secondsCounter=Yt(1e3);secondsCounterSubscription;constructor(){}ngOnInit(){this.widget.timeFormat||(this.widget.timeFormat="H:mm"),this.widget.dateFormat||(this.widget.dateFormat="yyyy-MM-dd"),this.secondsCounterSubscription=this.secondsCounter.subscribe(()=>{this.currentTime=new Date})}ngOnDestroy(){this.secondsCounterSubscription.unsubscribe()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget"},decls:10,vars:8,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","py-3"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","text-center"],[1,"d-flex","justify-content-around","flex-wrap","w-100"],[1,"text-center","widget-value-parent-wrap"],[1,"widget-value","mb-0"],[1,"widget-value-label","grey-text"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4),y(5),w(6,"date"),m(),x(7,"div",5),y(8),w(9,"date"),m()()()()()),n&2&&(f(5),T(Mt(6,2,s.currentTime,s.widget.timeFormat)),f(3),T(Mt(9,5,s.currentTime,s.widget.dateFormat)))},dependencies:[Xi],encapsulation:2})}return i})();function vi(i){return i+.5|0}var ve=(i,e,t)=>Math.max(Math.min(i,t),e);function Ci(i){return ve(vi(i*2.55),0,255)}function Se(i){return ve(vi(i*255),0,255)}function pe(i){return ve(vi(i/2.55)/100,0,1)}function $r(i){return ve(vi(i*100),0,100)}var Kt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},ls=[..."0123456789ABCDEF"],td=i=>ls[i&15],ed=i=>ls[(i&240)>>4]+ls[i&15],nn=i=>(i&240)>>4===(i&15),id=i=>nn(i.r)&&nn(i.g)&&nn(i.b)&&nn(i.a);function nd(i){var e=i.length,t;return i[0]==="#"&&(e===4||e===5?t={r:255&Kt[i[1]]*17,g:255&Kt[i[2]]*17,b:255&Kt[i[3]]*17,a:e===5?Kt[i[4]]*17:255}:(e===7||e===9)&&(t={r:Kt[i[1]]<<4|Kt[i[2]],g:Kt[i[3]]<<4|Kt[i[4]],b:Kt[i[5]]<<4|Kt[i[6]],a:e===9?Kt[i[7]]<<4|Kt[i[8]]:255})),t}var sd=(i,e)=>i<255?e(i):"";function od(i){var e=id(i)?td:ed;return i?"#"+e(i.r)+e(i.g)+e(i.b)+sd(i.a,e):void 0}var rd=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function zr(i,e,t){let n=e*Math.min(t,1-t),s=(o,r=(o+i/30)%12)=>t-n*Math.max(Math.min(r-3,9-r,1),-1);return[s(0),s(8),s(4)]}function ad(i,e,t){let n=(s,o=(s+i/60)%6)=>t-t*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function ld(i,e,t){let n=zr(i,1,.5),s;for(e+t>1&&(s=1/(e+t),e*=s,t*=s),s=0;s<3;s++)n[s]*=1-e-t,n[s]+=e;return n}function cd(i,e,t,n,s){return i===s?(e-t)/n+(e<t?6:0):e===s?(t-i)/n+2:(i-e)/n+4}function cs(i){let t=i.r/255,n=i.g/255,s=i.b/255,o=Math.max(t,n,s),r=Math.min(t,n,s),a=(o+r)/2,l,c,d;return o!==r&&(d=o-r,c=a>.5?d/(2-o-r):d/(o+r),l=cd(t,n,s,d,o),l=l*60+.5),[l|0,c||0,a]}function ds(i,e,t,n){return(Array.isArray(e)?i(e[0],e[1],e[2]):i(e,t,n)).map(Se)}function hs(i,e,t){return ds(zr,i,e,t)}function dd(i,e,t){return ds(ld,i,e,t)}function hd(i,e,t){return ds(ad,i,e,t)}function Rr(i){return(i%360+360)%360}function ud(i){let e=rd.exec(i),t=255,n;if(!e)return;e[5]!==n&&(t=e[6]?Ci(+e[5]):Se(+e[5]));let s=Rr(+e[2]),o=+e[3]/100,r=+e[4]/100;return e[1]==="hwb"?n=dd(s,o,r):e[1]==="hsv"?n=hd(s,o,r):n=hs(s,o,r),{r:n[0],g:n[1],b:n[2],a:t}}function pd(i,e){var t=cs(i);t[0]=Rr(t[0]+e),t=hs(t),i.r=t[0],i.g=t[1],i.b=t[2]}function fd(i){if(!i)return;let e=cs(i),t=e[0],n=$r(e[1]),s=$r(e[2]);return i.a<255?`hsla(${t}, ${n}%, ${s}%, ${pe(i.a)})`:`hsl(${t}, ${n}%, ${s}%)`}var Or={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Wr={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};function gd(){let i={},e=Object.keys(Wr),t=Object.keys(Or),n,s,o,r,a;for(n=0;n<e.length;n++){for(r=a=e[n],s=0;s<t.length;s++)o=t[s],a=a.replace(o,Or[o]);o=parseInt(Wr[r],16),i[a]=[o>>16&255,o>>8&255,o&255]}return i}var sn;function md(i){sn||(sn=gd(),sn.transparent=[0,0,0,0]);let e=sn[i.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:e.length===4?e[3]:255}}var bd=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;function xd(i){let e=bd.exec(i),t=255,n,s,o;if(e){if(e[7]!==n){let r=+e[7];t=e[8]?Ci(r):ve(r*255,0,255)}return n=+e[1],s=+e[3],o=+e[5],n=255&(e[2]?Ci(n):ve(n,0,255)),s=255&(e[4]?Ci(s):ve(s,0,255)),o=255&(e[6]?Ci(o):ve(o,0,255)),{r:n,g:s,b:o,a:t}}}function _d(i){return i&&(i.a<255?`rgba(${i.r}, ${i.g}, ${i.b}, ${pe(i.a)})`:`rgb(${i.r}, ${i.g}, ${i.b})`)}var as=i=>i<=.0031308?i*12.92:Math.pow(i,1/2.4)*1.055-.055,qe=i=>i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4);function yd(i,e,t){let n=qe(pe(i.r)),s=qe(pe(i.g)),o=qe(pe(i.b));return{r:Se(as(n+t*(qe(pe(e.r))-n))),g:Se(as(s+t*(qe(pe(e.g))-s))),b:Se(as(o+t*(qe(pe(e.b))-o))),a:i.a+t*(e.a-i.a)}}function on(i,e,t){if(i){let n=cs(i);n[e]=Math.max(0,Math.min(n[e]+n[e]*t,e===0?360:1)),n=hs(n),i.r=n[0],i.g=n[1],i.b=n[2]}}function Fr(i,e){return i&&Object.assign(e||{},i)}function Lr(i){var e={r:0,g:0,b:0,a:255};return Array.isArray(i)?i.length>=3&&(e={r:i[0],g:i[1],b:i[2],a:255},i.length>3&&(e.a=Se(i[3]))):(e=Fr(i,{r:0,g:0,b:0,a:1}),e.a=Se(e.a)),e}function Cd(i){return i.charAt(0)==="r"?xd(i):ud(i)}var wi=class i{constructor(e){if(e instanceof i)return e;let t=typeof e,n;t==="object"?n=Lr(e):t==="string"&&(n=nd(e)||md(e)||Cd(e)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var e=Fr(this._rgb);return e&&(e.a=pe(e.a)),e}set rgb(e){this._rgb=Lr(e)}rgbString(){return this._valid?_d(this._rgb):void 0}hexString(){return this._valid?od(this._rgb):void 0}hslString(){return this._valid?fd(this._rgb):void 0}mix(e,t){if(e){let n=this.rgb,s=e.rgb,o,r=t===o?.5:t,a=2*r-1,l=n.a-s.a,c=((a*l===-1?a:(a+l)/(1+a*l))+1)/2;o=1-c,n.r=255&c*n.r+o*s.r+.5,n.g=255&c*n.g+o*s.g+.5,n.b=255&c*n.b+o*s.b+.5,n.a=r*n.a+(1-r)*s.a,this.rgb=n}return this}interpolate(e,t){return e&&(this._rgb=yd(this._rgb,e._rgb,t)),this}clone(){return new i(this.rgb)}alpha(e){return this._rgb.a=Se(e),this}clearer(e){let t=this._rgb;return t.a*=1-e,this}greyscale(){let e=this._rgb,t=vi(e.r*.3+e.g*.59+e.b*.11);return e.r=e.g=e.b=t,this}opaquer(e){let t=this._rgb;return t.a*=1+e,this}negate(){let e=this._rgb;return e.r=255-e.r,e.g=255-e.g,e.b=255-e.b,this}lighten(e){return on(this._rgb,2,e),this}darken(e){return on(this._rgb,2,-e),this}saturate(e){return on(this._rgb,1,e),this}desaturate(e){return on(this._rgb,1,-e),this}rotate(e){return pd(this._rgb,e),this}};function re(){}var qr=(()=>{let i=0;return()=>i++})();function G(i){return i==null}function lt(i){if(Array.isArray&&Array.isArray(i))return!0;let e=Object.prototype.toString.call(i);return e.slice(0,7)==="[object"&&e.slice(-6)==="Array]"}function q(i){return i!==null&&Object.prototype.toString.call(i)==="[object Object]"}function ht(i){return(typeof i=="number"||i instanceof Number)&&isFinite(+i)}function Vt(i,e){return ht(i)?i:e}function H(i,e){return typeof i>"u"?e:i}var Kr=(i,e)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100:+i/e,gs=(i,e)=>typeof i=="string"&&i.endsWith("%")?parseFloat(i)/100*e:+i;function nt(i,e,t){if(i&&typeof i.call=="function")return i.apply(t,e)}function et(i,e,t,n){let s,o,r;if(lt(i))if(o=i.length,n)for(s=o-1;s>=0;s--)e.call(t,i[s],s);else for(s=0;s<o;s++)e.call(t,i[s],s);else if(q(i))for(r=Object.keys(i),o=r.length,s=0;s<o;s++)e.call(t,i[r[s]],r[s])}function ki(i,e){let t,n,s,o;if(!i||!e||i.length!==e.length)return!1;for(t=0,n=i.length;t<n;++t)if(s=i[t],o=e[t],s.datasetIndex!==o.datasetIndex||s.index!==o.index)return!1;return!0}function dn(i){if(lt(i))return i.map(dn);if(q(i)){let e=Object.create(null),t=Object.keys(i),n=t.length,s=0;for(;s<n;++s)e[t[s]]=dn(i[t[s]]);return e}return i}function Qr(i){return["__proto__","prototype","constructor"].indexOf(i)===-1}function wd(i,e,t,n){if(!Qr(i))return;let s=e[i],o=t[i];q(s)&&q(o)?Qe(s,o,n):e[i]=dn(o)}function Qe(i,e,t){let n=lt(e)?e:[e],s=n.length;if(!q(i))return i;t=t||{};let o=t.merger||wd,r;for(let a=0;a<s;++a){if(r=n[a],!q(r))continue;let l=Object.keys(r);for(let c=0,d=l.length;c<d;++c)o(l[c],i,r,t)}return i}function Ze(i,e){return Qe(i,e,{merger:vd})}function vd(i,e,t){if(!Qr(i))return;let n=e[i],s=t[i];q(n)&&q(s)?Ze(n,s):Object.prototype.hasOwnProperty.call(e,i)||(e[i]=dn(s))}var Ar={"":i=>i,x:i=>i.x,y:i=>i.y};function Sd(i){let e=i.split("."),t=[],n="";for(let s of e)n+=s,n.endsWith("\\")?n=n.slice(0,-1)+".":(t.push(n),n="");return t}function Id(i){let e=Sd(i);return t=>{for(let n of e){if(n==="")break;t=t&&t[n]}return t}}function me(i,e){return(Ar[e]||(Ar[e]=Id(e)))(i)}function fn(i){return i.charAt(0).toUpperCase()+i.slice(1)}var ti=i=>typeof i<"u",fe=i=>typeof i=="function",ms=(i,e)=>{if(i.size!==e.size)return!1;for(let t of i)if(!e.has(t))return!1;return!0};function Jr(i){return i.type==="mouseup"||i.type==="click"||i.type==="contextmenu"}var J=Math.PI,ct=2*J,kd=ct+J,hn=Number.POSITIVE_INFINITY,Md=J/180,ut=J/2,ze=J/4,Br=J*2/3,ge=Math.log10,te=Math.sign;function ei(i,e,t){return Math.abs(i-e)<t}function bs(i){let e=Math.round(i);i=ei(i,e,i/1e3)?e:i;let t=Math.pow(10,Math.floor(ge(i))),n=i/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function Zr(i){let e=[],t=Math.sqrt(i),n;for(n=1;n<t;n++)i%n===0&&(e.push(n),e.push(i/n));return t===(t|0)&&e.push(t),e.sort((s,o)=>s-o).pop(),e}function Td(i){return typeof i=="symbol"||typeof i=="object"&&i!==null&&!(Symbol.toPrimitive in i||"toString"in i||"valueOf"in i)}function Ae(i){return!Td(i)&&!isNaN(parseFloat(i))&&isFinite(i)}function ta(i,e){let t=Math.round(i);return t-e<=i&&t+e>=i}function xs(i,e,t){let n,s,o;for(n=0,s=i.length;n<s;n++)o=i[n][t],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function Qt(i){return i*(J/180)}function gn(i){return i*(180/J)}function _s(i){if(!ht(i))return;let e=1,t=0;for(;Math.round(i*e)/e!==i;)e*=10,t++;return t}function ys(i,e){let t=e.x-i.x,n=e.y-i.y,s=Math.sqrt(t*t+n*n),o=Math.atan2(n,t);return o<-.5*J&&(o+=ct),{angle:o,distance:s}}function un(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function Pd(i,e){return(i-e+kd)%ct-J}function Et(i){return(i%ct+ct)%ct}function ii(i,e,t,n){let s=Et(i),o=Et(e),r=Et(t),a=Et(o-s),l=Et(r-s),c=Et(s-o),d=Et(s-r);return s===o||s===r||n&&o===r||a>l&&c<d}function It(i,e,t){return Math.max(e,Math.min(t,i))}function ea(i){return It(i,-32768,32767)}function ae(i,e,t,n=1e-6){return i>=Math.min(e,t)-n&&i<=Math.max(e,t)+n}function mn(i,e,t){t=t||(r=>i[r]<e);let n=i.length-1,s=0,o;for(;n-s>1;)o=s+n>>1,t(o)?s=o:n=o;return{lo:s,hi:n}}var se=(i,e,t,n)=>mn(i,t,n?s=>{let o=i[s][e];return o<t||o===t&&i[s+1][e]===t}:s=>i[s][e]<t),ia=(i,e,t)=>mn(i,t,n=>i[n][e]>=t);function na(i,e,t){let n=0,s=i.length;for(;n<s&&i[n]<e;)n++;for(;s>n&&i[s-1]>t;)s--;return n>0||s<i.length?i.slice(n,s):i}var sa=["push","pop","shift","splice","unshift"];function oa(i,e){if(i._chartjs){i._chartjs.listeners.push(e);return}Object.defineProperty(i,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),sa.forEach(t=>{let n="_onData"+fn(t),s=i[t];Object.defineProperty(i,t,{configurable:!0,enumerable:!1,value(...o){let r=s.apply(this,o);return i._chartjs.listeners.forEach(a=>{typeof a[n]=="function"&&a[n](...o)}),r}})})}function Cs(i,e){let t=i._chartjs;if(!t)return;let n=t.listeners,s=n.indexOf(e);s!==-1&&n.splice(s,1),!(n.length>0)&&(sa.forEach(o=>{delete i[o]}),delete i._chartjs)}function ws(i){let e=new Set(i);return e.size===i.length?i:Array.from(e)}var vs=function(){return typeof window>"u"?function(i){return i()}:window.requestAnimationFrame}();function Ss(i,e){let t=[],n=!1;return function(...s){t=s,n||(n=!0,vs.call(window,()=>{n=!1,i.apply(e,t)}))}}function ra(i,e){let t;return function(...n){return e?(clearTimeout(t),t=setTimeout(i,e,n)):i.apply(this,n),e}}var bn=i=>i==="start"?"left":i==="end"?"right":"center",Dt=(i,e,t)=>i==="start"?e:i==="end"?t:(e+t)/2,aa=(i,e,t,n)=>i===(n?"left":"right")?t:i==="center"?(e+t)/2:e;function Is(i,e,t){let n=e.length,s=0,o=n;if(i._sorted){let{iScale:r,vScale:a,_parsed:l}=i,c=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null,d=r.axis,{min:h,max:u,minDefined:p,maxDefined:b}=r.getUserBounds();if(p){if(s=Math.min(se(l,d,h).lo,t?n:se(e,d,r.getPixelForValue(h)).lo),c){let g=l.slice(0,s+1).reverse().findIndex(_=>!G(_[a.axis]));s-=Math.max(0,g)}s=It(s,0,n-1)}if(b){let g=Math.max(se(l,r.axis,u,!0).hi+1,t?0:se(e,d,r.getPixelForValue(u),!0).hi+1);if(c){let _=l.slice(g-1).findIndex(C=>!G(C[a.axis]));g+=Math.max(0,_)}o=It(g,s,n)-s}else o=n-s}return{start:s,count:o}}function ks(i){let{xScale:e,yScale:t,_scaleRanges:n}=i,s={xmin:e.min,xmax:e.max,ymin:t.min,ymax:t.max};if(!n)return i._scaleRanges=s,!0;let o=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==t.min||n.ymax!==t.max;return Object.assign(n,s),o}var rn=i=>i===0||i===1,Vr=(i,e,t)=>-(Math.pow(2,10*(i-=1))*Math.sin((i-e)*ct/t)),Hr=(i,e,t)=>Math.pow(2,-10*i)*Math.sin((i-e)*ct/t)+1,Ke={linear:i=>i,easeInQuad:i=>i*i,easeOutQuad:i=>-i*(i-2),easeInOutQuad:i=>(i/=.5)<1?.5*i*i:-.5*(--i*(i-2)-1),easeInCubic:i=>i*i*i,easeOutCubic:i=>(i-=1)*i*i+1,easeInOutCubic:i=>(i/=.5)<1?.5*i*i*i:.5*((i-=2)*i*i+2),easeInQuart:i=>i*i*i*i,easeOutQuart:i=>-((i-=1)*i*i*i-1),easeInOutQuart:i=>(i/=.5)<1?.5*i*i*i*i:-.5*((i-=2)*i*i*i-2),easeInQuint:i=>i*i*i*i*i,easeOutQuint:i=>(i-=1)*i*i*i*i+1,easeInOutQuint:i=>(i/=.5)<1?.5*i*i*i*i*i:.5*((i-=2)*i*i*i*i+2),easeInSine:i=>-Math.cos(i*ut)+1,easeOutSine:i=>Math.sin(i*ut),easeInOutSine:i=>-.5*(Math.cos(J*i)-1),easeInExpo:i=>i===0?0:Math.pow(2,10*(i-1)),easeOutExpo:i=>i===1?1:-Math.pow(2,-10*i)+1,easeInOutExpo:i=>rn(i)?i:i<.5?.5*Math.pow(2,10*(i*2-1)):.5*(-Math.pow(2,-10*(i*2-1))+2),easeInCirc:i=>i>=1?i:-(Math.sqrt(1-i*i)-1),easeOutCirc:i=>Math.sqrt(1-(i-=1)*i),easeInOutCirc:i=>(i/=.5)<1?-.5*(Math.sqrt(1-i*i)-1):.5*(Math.sqrt(1-(i-=2)*i)+1),easeInElastic:i=>rn(i)?i:Vr(i,.075,.3),easeOutElastic:i=>rn(i)?i:Hr(i,.075,.3),easeInOutElastic(i){return rn(i)?i:i<.5?.5*Vr(i*2,.1125,.45):.5+.5*Hr(i*2-1,.1125,.45)},easeInBack(i){return i*i*((1.70158+1)*i-1.70158)},easeOutBack(i){return(i-=1)*i*((1.70158+1)*i+1.70158)+1},easeInOutBack(i){let e=1.70158;return(i/=.5)<1?.5*(i*i*(((e*=1.525)+1)*i-e)):.5*((i-=2)*i*(((e*=1.525)+1)*i+e)+2)},easeInBounce:i=>1-Ke.easeOutBounce(1-i),easeOutBounce(i){return i<1/2.75?7.5625*i*i:i<2/2.75?7.5625*(i-=1.5/2.75)*i+.75:i<2.5/2.75?7.5625*(i-=2.25/2.75)*i+.9375:7.5625*(i-=2.625/2.75)*i+.984375},easeInOutBounce:i=>i<.5?Ke.easeInBounce(i*2)*.5:Ke.easeOutBounce(i*2-1)*.5+.5};function Ms(i){if(i&&typeof i=="object"){let e=i.toString();return e==="[object CanvasPattern]"||e==="[object CanvasGradient]"}return!1}function Ts(i){return Ms(i)?i:new wi(i)}function us(i){return Ms(i)?i:new wi(i).saturate(.5).darken(.1).hexString()}var Ed=["x","y","borderWidth","radius","tension"],Dd=["color","borderColor","backgroundColor"];function $d(i){i.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),i.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:e=>e!=="onProgress"&&e!=="onComplete"&&e!=="fn"}),i.set("animations",{colors:{type:"color",properties:Dd},numbers:{type:"number",properties:Ed}}),i.describe("animations",{_fallback:"animation"}),i.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:e=>e|0}}}})}function Od(i){i.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})}var Nr=new Map;function Wd(i,e){e=e||{};let t=i+JSON.stringify(e),n=Nr.get(t);return n||(n=new Intl.NumberFormat(i,e),Nr.set(t,n)),n}function ni(i,e,t){return Wd(e,t).format(i)}var la={values(i){return lt(i)?i:""+i},numeric(i,e,t){if(i===0)return"0";let n=this.chart.options.locale,s,o=i;if(t.length>1){let c=Math.max(Math.abs(t[0].value),Math.abs(t[t.length-1].value));(c<1e-4||c>1e15)&&(s="scientific"),o=Ld(i,t)}let r=ge(Math.abs(o)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:s,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),ni(i,n,l)},logarithmic(i,e,t){if(i===0)return"0";let n=t[e].significand||i/Math.pow(10,Math.floor(ge(i)));return[1,2,3,5,10,15].includes(n)||e>.8*t.length?la.numeric.call(this,i,e,t):""}};function Ld(i,e){let t=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;return Math.abs(t)>=1&&i!==Math.floor(i)&&(t=i-Math.floor(i)),t}var Mi={formatters:la};function zd(i){i.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(e,t)=>t.lineWidth,tickColor:(e,t)=>t.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Mi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),i.route("scale.ticks","color","","color"),i.route("scale.grid","color","","borderColor"),i.route("scale.border","color","","borderColor"),i.route("scale.title","color","","color"),i.describe("scale",{_fallback:!1,_scriptable:e=>!e.startsWith("before")&&!e.startsWith("after")&&e!=="callback"&&e!=="parser",_indexable:e=>e!=="borderDash"&&e!=="tickBorderDash"&&e!=="dash"}),i.describe("scales",{_fallback:"scale"}),i.describe("scale.ticks",{_scriptable:e=>e!=="backdropPadding"&&e!=="callback",_indexable:e=>e!=="backdropPadding"})}var ke=Object.create(null),xn=Object.create(null);function Si(i,e){if(!e)return i;let t=e.split(".");for(let n=0,s=t.length;n<s;++n){let o=t[n];i=i[o]||(i[o]=Object.create(null))}return i}function ps(i,e,t){return typeof e=="string"?Qe(Si(i,e),t):Qe(Si(i,""),e)}var fs=class{constructor(e,t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=n=>n.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(n,s)=>us(s.backgroundColor),this.hoverBorderColor=(n,s)=>us(s.borderColor),this.hoverColor=(n,s)=>us(s.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(e),this.apply(t)}set(e,t){return ps(this,e,t)}get(e){return Si(this,e)}describe(e,t){return ps(xn,e,t)}override(e,t){return ps(ke,e,t)}route(e,t,n,s){let o=Si(this,e),r=Si(this,n),a="_"+t;Object.defineProperties(o,{[a]:{value:o[t],writable:!0},[t]:{enumerable:!0,get(){let l=this[a],c=r[s];return q(l)?Object.assign({},c,l):H(l,c)},set(l){this[a]=l}}})}apply(e){e.forEach(t=>t(this))}},st=new fs({_scriptable:i=>!i.startsWith("on"),_indexable:i=>i!=="events",hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[$d,Od,zd]);function Rd(i){return!i||G(i.size)||G(i.family)?null:(i.style?i.style+" ":"")+(i.weight?i.weight+" ":"")+i.size+"px "+i.family}function Ii(i,e,t,n,s){let o=e[s];return o||(o=e[s]=i.measureText(s).width,t.push(s)),o>n&&(n=o),n}function ca(i,e,t,n){n=n||{};let s=n.data=n.data||{},o=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(s=n.data={},o=n.garbageCollect=[],n.font=e),i.save(),i.font=e;let r=0,a=t.length,l,c,d,h,u;for(l=0;l<a;l++)if(h=t[l],h!=null&&!lt(h))r=Ii(i,s,o,r,h);else if(lt(h))for(c=0,d=h.length;c<d;c++)u=h[c],u!=null&&!lt(u)&&(r=Ii(i,s,o,r,u));i.restore();let p=o.length/2;if(p>t.length){for(l=0;l<p;l++)delete s[o[l]];o.splice(0,p)}return r}function Me(i,e,t){let n=i.currentDevicePixelRatio,s=t!==0?Math.max(t/2,.5):0;return Math.round((e-s)*n)/n+s}function Ps(i,e){!e&&!i||(e=e||i.getContext("2d"),e.save(),e.resetTransform(),e.clearRect(0,0,i.width,i.height),e.restore())}function _n(i,e,t,n){Es(i,e,t,n,null)}function Es(i,e,t,n,s){let o,r,a,l,c,d,h,u,p=e.pointStyle,b=e.rotation,g=e.radius,_=(b||0)*Md;if(p&&typeof p=="object"&&(o=p.toString(),o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]")){i.save(),i.translate(t,n),i.rotate(_),i.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),i.restore();return}if(!(isNaN(g)||g<=0)){switch(i.beginPath(),p){default:s?i.ellipse(t,n,s/2,g,0,0,ct):i.arc(t,n,g,0,ct),i.closePath();break;case"triangle":d=s?s/2:g,i.moveTo(t+Math.sin(_)*d,n-Math.cos(_)*g),_+=Br,i.lineTo(t+Math.sin(_)*d,n-Math.cos(_)*g),_+=Br,i.lineTo(t+Math.sin(_)*d,n-Math.cos(_)*g),i.closePath();break;case"rectRounded":c=g*.516,l=g-c,r=Math.cos(_+ze)*l,h=Math.cos(_+ze)*(s?s/2-c:l),a=Math.sin(_+ze)*l,u=Math.sin(_+ze)*(s?s/2-c:l),i.arc(t-h,n-a,c,_-J,_-ut),i.arc(t+u,n-r,c,_-ut,_),i.arc(t+h,n+a,c,_,_+ut),i.arc(t-u,n+r,c,_+ut,_+J),i.closePath();break;case"rect":if(!b){l=Math.SQRT1_2*g,d=s?s/2:l,i.rect(t-d,n-l,2*d,2*l);break}_+=ze;case"rectRot":h=Math.cos(_)*(s?s/2:g),r=Math.cos(_)*g,a=Math.sin(_)*g,u=Math.sin(_)*(s?s/2:g),i.moveTo(t-h,n-a),i.lineTo(t+u,n-r),i.lineTo(t+h,n+a),i.lineTo(t-u,n+r),i.closePath();break;case"crossRot":_+=ze;case"cross":h=Math.cos(_)*(s?s/2:g),r=Math.cos(_)*g,a=Math.sin(_)*g,u=Math.sin(_)*(s?s/2:g),i.moveTo(t-h,n-a),i.lineTo(t+h,n+a),i.moveTo(t+u,n-r),i.lineTo(t-u,n+r);break;case"star":h=Math.cos(_)*(s?s/2:g),r=Math.cos(_)*g,a=Math.sin(_)*g,u=Math.sin(_)*(s?s/2:g),i.moveTo(t-h,n-a),i.lineTo(t+h,n+a),i.moveTo(t+u,n-r),i.lineTo(t-u,n+r),_+=ze,h=Math.cos(_)*(s?s/2:g),r=Math.cos(_)*g,a=Math.sin(_)*g,u=Math.sin(_)*(s?s/2:g),i.moveTo(t-h,n-a),i.lineTo(t+h,n+a),i.moveTo(t+u,n-r),i.lineTo(t-u,n+r);break;case"line":r=s?s/2:Math.cos(_)*g,a=Math.sin(_)*g,i.moveTo(t-r,n-a),i.lineTo(t+r,n+a);break;case"dash":i.moveTo(t,n),i.lineTo(t+Math.cos(_)*(s?s/2:g),n+Math.sin(_)*g);break;case!1:i.closePath();break}i.fill(),e.borderWidth>0&&i.stroke()}}function oe(i,e,t){return t=t||.5,!e||i&&i.x>e.left-t&&i.x<e.right+t&&i.y>e.top-t&&i.y<e.bottom+t}function Ti(i,e){i.save(),i.beginPath(),i.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),i.clip()}function Pi(i){i.restore()}function da(i,e,t,n,s){if(!e)return i.lineTo(t.x,t.y);if(s==="middle"){let o=(e.x+t.x)/2;i.lineTo(o,e.y),i.lineTo(o,t.y)}else s==="after"!=!!n?i.lineTo(e.x,t.y):i.lineTo(t.x,e.y);i.lineTo(t.x,t.y)}function ha(i,e,t,n){if(!e)return i.lineTo(t.x,t.y);i.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?t.cp2x:t.cp1x,n?t.cp2y:t.cp1y,t.x,t.y)}function Fd(i,e){e.translation&&i.translate(e.translation[0],e.translation[1]),G(e.rotation)||i.rotate(e.rotation),e.color&&(i.fillStyle=e.color),e.textAlign&&(i.textAlign=e.textAlign),e.textBaseline&&(i.textBaseline=e.textBaseline)}function Ad(i,e,t,n,s){if(s.strikethrough||s.underline){let o=i.measureText(n),r=e-o.actualBoundingBoxLeft,a=e+o.actualBoundingBoxRight,l=t-o.actualBoundingBoxAscent,c=t+o.actualBoundingBoxDescent,d=s.strikethrough?(l+c)/2:c;i.strokeStyle=i.fillStyle,i.beginPath(),i.lineWidth=s.decorationWidth||2,i.moveTo(r,d),i.lineTo(a,d),i.stroke()}}function Bd(i,e){let t=i.fillStyle;i.fillStyle=e.color,i.fillRect(e.left,e.top,e.width,e.height),i.fillStyle=t}function Te(i,e,t,n,s,o={}){let r=lt(e)?e:[e],a=o.strokeWidth>0&&o.strokeColor!=="",l,c;for(i.save(),i.font=s.string,Fd(i,o),l=0;l<r.length;++l)c=r[l],o.backdrop&&Bd(i,o.backdrop),a&&(o.strokeColor&&(i.strokeStyle=o.strokeColor),G(o.strokeWidth)||(i.lineWidth=o.strokeWidth),i.strokeText(c,t,n,o.maxWidth)),i.fillText(c,t,n,o.maxWidth),Ad(i,t,n,c,o),n+=Number(s.lineHeight);i.restore()}function si(i,e){let{x:t,y:n,w:s,h:o,radius:r}=e;i.arc(t+r.topLeft,n+r.topLeft,r.topLeft,1.5*J,J,!0),i.lineTo(t,n+o-r.bottomLeft),i.arc(t+r.bottomLeft,n+o-r.bottomLeft,r.bottomLeft,J,ut,!0),i.lineTo(t+s-r.bottomRight,n+o),i.arc(t+s-r.bottomRight,n+o-r.bottomRight,r.bottomRight,ut,0,!0),i.lineTo(t+s,n+r.topRight),i.arc(t+s-r.topRight,n+r.topRight,r.topRight,0,-ut,!0),i.lineTo(t+r.topLeft,n)}var Vd=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Hd=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Nd(i,e){let t=(""+i).match(Vd);if(!t||t[1]==="normal")return e*1.2;switch(i=+t[2],t[3]){case"px":return i;case"%":i/=100;break}return e*i}var jd=i=>+i||0;function yn(i,e){let t={},n=q(e),s=n?Object.keys(e):e,o=q(i)?n?r=>H(i[r],i[e[r]]):r=>i[r]:()=>i;for(let r of s)t[r]=jd(o(r));return t}function Ds(i){return yn(i,{top:"y",right:"x",bottom:"y",left:"x"})}function Pe(i){return yn(i,["topLeft","topRight","bottomLeft","bottomRight"])}function $t(i){let e=Ds(i);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function yt(i,e){i=i||{},e=e||st.font;let t=H(i.size,e.size);typeof t=="string"&&(t=parseInt(t,10));let n=H(i.style,e.style);n&&!(""+n).match(Hd)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);let s={family:H(i.family,e.family),lineHeight:Nd(H(i.lineHeight,e.lineHeight),t),size:t,style:n,weight:H(i.weight,e.weight),string:""};return s.string=Rd(s),s}function oi(i,e,t,n){let s=!0,o,r,a;for(o=0,r=i.length;o<r;++o)if(a=i[o],a!==void 0&&(e!==void 0&&typeof a=="function"&&(a=a(e),s=!1),t!==void 0&&lt(a)&&(a=a[t%a.length],s=!1),a!==void 0))return n&&!s&&(n.cacheable=!1),a}function ua(i,e,t){let{min:n,max:s}=i,o=gs(e,(s-n)/2),r=(a,l)=>t&&a===0?0:a+l;return{min:r(n,-Math.abs(o)),max:r(s,o)}}function be(i,e){return Object.assign(Object.create(i),e)}function Cn(i,e=[""],t,n,s=()=>i[0]){let o=t||i;typeof n>"u"&&(n=ga("_fallback",i));let r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:o,_fallback:n,_getTarget:s,override:a=>Cn([a,...i],e,o,n)};return new Proxy(r,{deleteProperty(a,l){return delete a[l],delete a._keys,delete i[0][l],!0},get(a,l){return pa(a,l,()=>Jd(l,e,i,a))},getOwnPropertyDescriptor(a,l){return Reflect.getOwnPropertyDescriptor(a._scopes[0],l)},getPrototypeOf(){return Reflect.getPrototypeOf(i[0])},has(a,l){return Ur(a).includes(l)},ownKeys(a){return Ur(a)},set(a,l,c){let d=a._storage||(a._storage=s());return a[l]=d[l]=c,delete a._keys,!0}})}function Fe(i,e,t,n){let s={_cacheable:!1,_proxy:i,_context:e,_subProxy:t,_stack:new Set,_descriptors:$s(i,n),setContext:o=>Fe(i,o,t,n),override:o=>Fe(i.override(o),e,t,n)};return new Proxy(s,{deleteProperty(o,r){return delete o[r],delete i[r],!0},get(o,r,a){return pa(o,r,()=>Yd(o,r,a))},getOwnPropertyDescriptor(o,r){return o._descriptors.allKeys?Reflect.has(i,r)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(i,r)},getPrototypeOf(){return Reflect.getPrototypeOf(i)},has(o,r){return Reflect.has(i,r)},ownKeys(){return Reflect.ownKeys(i)},set(o,r,a){return i[r]=a,delete o[r],!0}})}function $s(i,e={scriptable:!0,indexable:!0}){let{_scriptable:t=e.scriptable,_indexable:n=e.indexable,_allKeys:s=e.allKeys}=i;return{allKeys:s,scriptable:t,indexable:n,isScriptable:fe(t)?t:()=>t,isIndexable:fe(n)?n:()=>n}}var Ud=(i,e)=>i?i+fn(e):e,Os=(i,e)=>q(e)&&i!=="adapters"&&(Object.getPrototypeOf(e)===null||e.constructor===Object);function pa(i,e,t){if(Object.prototype.hasOwnProperty.call(i,e)||e==="constructor")return i[e];let n=t();return i[e]=n,n}function Yd(i,e,t){let{_proxy:n,_context:s,_subProxy:o,_descriptors:r}=i,a=n[e];return fe(a)&&r.isScriptable(e)&&(a=Xd(e,a,i,t)),lt(a)&&a.length&&(a=Gd(e,a,i,r.isIndexable)),Os(e,a)&&(a=Fe(a,s,o&&o[e],r)),a}function Xd(i,e,t,n){let{_proxy:s,_context:o,_subProxy:r,_stack:a}=t;if(a.has(i))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+i);a.add(i);let l=e(o,r||n);return a.delete(i),Os(i,l)&&(l=Ws(s._scopes,s,i,l)),l}function Gd(i,e,t,n){let{_proxy:s,_context:o,_subProxy:r,_descriptors:a}=t;if(typeof o.index<"u"&&n(i))return e[o.index%e.length];if(q(e[0])){let l=e,c=s._scopes.filter(d=>d!==l);e=[];for(let d of l){let h=Ws(c,s,i,d);e.push(Fe(h,o,r&&r[i],a))}}return e}function fa(i,e,t){return fe(i)?i(e,t):i}var qd=(i,e)=>i===!0?e:typeof i=="string"?me(e,i):void 0;function Kd(i,e,t,n,s){for(let o of e){let r=qd(t,o);if(r){i.add(r);let a=fa(r._fallback,t,s);if(typeof a<"u"&&a!==t&&a!==n)return a}else if(r===!1&&typeof n<"u"&&t!==n)return null}return!1}function Ws(i,e,t,n){let s=e._rootScopes,o=fa(e._fallback,t,n),r=[...i,...s],a=new Set;a.add(n);let l=jr(a,r,t,o||t,n);return l===null||typeof o<"u"&&o!==t&&(l=jr(a,r,o,l,n),l===null)?!1:Cn(Array.from(a),[""],s,o,()=>Qd(e,t,n))}function jr(i,e,t,n,s){for(;t;)t=Kd(i,e,t,n,s);return t}function Qd(i,e,t){let n=i._getTarget();e in n||(n[e]={});let s=n[e];return lt(s)&&q(t)?t:s||{}}function Jd(i,e,t,n){let s;for(let o of e)if(s=ga(Ud(o,i),t),typeof s<"u")return Os(i,s)?Ws(t,n,i,s):s}function ga(i,e){for(let t of e){if(!t)continue;let n=t[i];if(typeof n<"u")return n}}function Ur(i){let e=i._keys;return e||(e=i._keys=Zd(i._scopes)),e}function Zd(i){let e=new Set;for(let t of i)for(let n of Object.keys(t).filter(s=>!s.startsWith("_")))e.add(n);return Array.from(e)}function Ls(i,e,t,n){let{iScale:s}=i,{key:o="r"}=this._parsing,r=new Array(n),a,l,c,d;for(a=0,l=n;a<l;++a)c=a+t,d=e[c],r[a]={r:s.parse(me(d,o),c)};return r}var th=Number.EPSILON||1e-14,Je=(i,e)=>e<i.length&&!i[e].skip&&i[e],ma=i=>i==="x"?"y":"x";function eh(i,e,t,n){let s=i.skip?e:i,o=e,r=t.skip?e:t,a=un(o,s),l=un(r,o),c=a/(a+l),d=l/(a+l);c=isNaN(c)?0:c,d=isNaN(d)?0:d;let h=n*c,u=n*d;return{previous:{x:o.x-h*(r.x-s.x),y:o.y-h*(r.y-s.y)},next:{x:o.x+u*(r.x-s.x),y:o.y+u*(r.y-s.y)}}}function ih(i,e,t){let n=i.length,s,o,r,a,l,c=Je(i,0);for(let d=0;d<n-1;++d)if(l=c,c=Je(i,d+1),!(!l||!c)){if(ei(e[d],0,th)){t[d]=t[d+1]=0;continue}s=t[d]/e[d],o=t[d+1]/e[d],a=Math.pow(s,2)+Math.pow(o,2),!(a<=9)&&(r=3/Math.sqrt(a),t[d]=s*r*e[d],t[d+1]=o*r*e[d])}}function nh(i,e,t="x"){let n=ma(t),s=i.length,o,r,a,l=Je(i,0);for(let c=0;c<s;++c){if(r=a,a=l,l=Je(i,c+1),!a)continue;let d=a[t],h=a[n];r&&(o=(d-r[t])/3,a[`cp1${t}`]=d-o,a[`cp1${n}`]=h-o*e[c]),l&&(o=(l[t]-d)/3,a[`cp2${t}`]=d+o,a[`cp2${n}`]=h+o*e[c])}}function sh(i,e="x"){let t=ma(e),n=i.length,s=Array(n).fill(0),o=Array(n),r,a,l,c=Je(i,0);for(r=0;r<n;++r)if(a=l,l=c,c=Je(i,r+1),!!l){if(c){let d=c[e]-l[e];s[r]=d!==0?(c[t]-l[t])/d:0}o[r]=a?c?te(s[r-1])!==te(s[r])?0:(s[r-1]+s[r])/2:s[r-1]:s[r]}ih(i,s,o),nh(i,o,e)}function an(i,e,t){return Math.max(Math.min(i,t),e)}function oh(i,e){let t,n,s,o,r,a=oe(i[0],e);for(t=0,n=i.length;t<n;++t)r=o,o=a,a=t<n-1&&oe(i[t+1],e),o&&(s=i[t],r&&(s.cp1x=an(s.cp1x,e.left,e.right),s.cp1y=an(s.cp1y,e.top,e.bottom)),a&&(s.cp2x=an(s.cp2x,e.left,e.right),s.cp2y=an(s.cp2y,e.top,e.bottom)))}function ba(i,e,t,n,s){let o,r,a,l;if(e.spanGaps&&(i=i.filter(c=>!c.skip)),e.cubicInterpolationMode==="monotone")sh(i,s);else{let c=n?i[i.length-1]:i[0];for(o=0,r=i.length;o<r;++o)a=i[o],l=eh(c,a,i[Math.min(o+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,c=a}e.capBezierPoints&&oh(i,t)}function wn(){return typeof window<"u"&&typeof document<"u"}function vn(i){let e=i.parentNode;return e&&e.toString()==="[object ShadowRoot]"&&(e=e.host),e}function pn(i,e,t){let n;return typeof i=="string"?(n=parseInt(i,10),i.indexOf("%")!==-1&&(n=n/100*e.parentNode[t])):n=i,n}var Sn=i=>i.ownerDocument.defaultView.getComputedStyle(i,null);function rh(i,e){return Sn(i).getPropertyValue(e)}var ah=["top","right","bottom","left"];function Re(i,e,t){let n={};t=t?"-"+t:"";for(let s=0;s<4;s++){let o=ah[s];n[o]=parseFloat(i[e+"-"+o+t])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}var lh=(i,e,t)=>(i>0||e>0)&&(!t||!t.shadowRoot);function ch(i,e){let t=i.touches,n=t&&t.length?t[0]:i,{offsetX:s,offsetY:o}=n,r=!1,a,l;if(lh(s,o,i.target))a=s,l=o;else{let c=e.getBoundingClientRect();a=n.clientX-c.left,l=n.clientY-c.top,r=!0}return{x:a,y:l,box:r}}function Ee(i,e){if("native"in i)return i;let{canvas:t,currentDevicePixelRatio:n}=e,s=Sn(t),o=s.boxSizing==="border-box",r=Re(s,"padding"),a=Re(s,"border","width"),{x:l,y:c,box:d}=ch(i,t),h=r.left+(d&&a.left),u=r.top+(d&&a.top),{width:p,height:b}=e;return o&&(p-=r.width+a.width,b-=r.height+a.height),{x:Math.round((l-h)/p*t.width/n),y:Math.round((c-u)/b*t.height/n)}}function dh(i,e,t){let n,s;if(e===void 0||t===void 0){let o=i&&vn(i);if(!o)e=i.clientWidth,t=i.clientHeight;else{let r=o.getBoundingClientRect(),a=Sn(o),l=Re(a,"border","width"),c=Re(a,"padding");e=r.width-c.width-l.width,t=r.height-c.height-l.height,n=pn(a.maxWidth,o,"clientWidth"),s=pn(a.maxHeight,o,"clientHeight")}}return{width:e,height:t,maxWidth:n||hn,maxHeight:s||hn}}var ln=i=>Math.round(i*10)/10;function xa(i,e,t,n){let s=Sn(i),o=Re(s,"margin"),r=pn(s.maxWidth,i,"clientWidth")||hn,a=pn(s.maxHeight,i,"clientHeight")||hn,l=dh(i,e,t),{width:c,height:d}=l;if(s.boxSizing==="content-box"){let u=Re(s,"border","width"),p=Re(s,"padding");c-=p.width+u.width,d-=p.height+u.height}return c=Math.max(0,c-o.width),d=Math.max(0,n?c/n:d-o.height),c=ln(Math.min(c,r,l.maxWidth)),d=ln(Math.min(d,a,l.maxHeight)),c&&!d&&(d=ln(c/2)),(e!==void 0||t!==void 0)&&n&&l.height&&d>l.height&&(d=l.height,c=ln(Math.floor(d*n))),{width:c,height:d}}function zs(i,e,t){let n=e||1,s=Math.floor(i.height*n),o=Math.floor(i.width*n);i.height=Math.floor(i.height),i.width=Math.floor(i.width);let r=i.canvas;return r.style&&(t||!r.style.height&&!r.style.width)&&(r.style.height=`${i.height}px`,r.style.width=`${i.width}px`),i.currentDevicePixelRatio!==n||r.height!==s||r.width!==o?(i.currentDevicePixelRatio=n,r.height=s,r.width=o,i.ctx.setTransform(n,0,0,n,0,0),!0):!1}var _a=function(){let i=!1;try{let e={get passive(){return i=!0,!1}};wn()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch{}return i}();function Rs(i,e){let t=rh(i,e),n=t&&t.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Ie(i,e,t,n){return{x:i.x+t*(e.x-i.x),y:i.y+t*(e.y-i.y)}}function ya(i,e,t,n){return{x:i.x+t*(e.x-i.x),y:n==="middle"?t<.5?i.y:e.y:n==="after"?t<1?i.y:e.y:t>0?e.y:i.y}}function Ca(i,e,t,n){let s={x:i.cp2x,y:i.cp2y},o={x:e.cp1x,y:e.cp1y},r=Ie(i,s,t),a=Ie(s,o,t),l=Ie(o,e,t),c=Ie(r,a,t),d=Ie(a,l,t);return Ie(c,d,t)}var hh=function(i,e){return{x(t){return i+i+e-t},setWidth(t){e=t},textAlign(t){return t==="center"?t:t==="right"?"left":"right"},xPlus(t,n){return t-n},leftForLtr(t,n){return t-n}}},uh=function(){return{x(i){return i},setWidth(i){},textAlign(i){return i},xPlus(i,e){return i+e},leftForLtr(i,e){return i}}};function Be(i,e,t){return i?hh(e,t):uh()}function Fs(i,e){let t,n;(e==="ltr"||e==="rtl")&&(t=i.canvas.style,n=[t.getPropertyValue("direction"),t.getPropertyPriority("direction")],t.setProperty("direction",e,"important"),i.prevTextDirection=n)}function As(i,e){e!==void 0&&(delete i.prevTextDirection,i.canvas.style.setProperty("direction",e[0],e[1]))}function wa(i){return i==="angle"?{between:ii,compare:Pd,normalize:Et}:{between:ae,compare:(e,t)=>e-t,normalize:e=>e}}function Yr({start:i,end:e,count:t,loop:n,style:s}){return{start:i%t,end:e%t,loop:n&&(e-i+1)%t===0,style:s}}function ph(i,e,t){let{property:n,start:s,end:o}=t,{between:r,normalize:a}=wa(n),l=e.length,{start:c,end:d,loop:h}=i,u,p;if(h){for(c+=l,d+=l,u=0,p=l;u<p&&r(a(e[c%l][n]),s,o);++u)c--,d--;c%=l,d%=l}return d<c&&(d+=l),{start:c,end:d,loop:h,style:i.style}}function Bs(i,e,t){if(!t)return[i];let{property:n,start:s,end:o}=t,r=e.length,{compare:a,between:l,normalize:c}=wa(n),{start:d,end:h,loop:u,style:p}=ph(i,e,t),b=[],g=!1,_=null,C,v,M,E=()=>l(s,M,C)&&a(s,M)!==0,I=()=>a(o,C)===0||l(o,M,C),P=()=>g||E(),L=()=>!g||I();for(let O=d,F=d;O<=h;++O)v=e[O%r],!v.skip&&(C=c(v[n]),C!==M&&(g=l(C,s,o),_===null&&P()&&(_=a(C,s)===0?O:F),_!==null&&L()&&(b.push(Yr({start:_,end:O,loop:u,count:r,style:p})),_=null),F=O,M=C));return _!==null&&b.push(Yr({start:_,end:h,loop:u,count:r,style:p})),b}function Vs(i,e){let t=[],n=i.segments;for(let s=0;s<n.length;s++){let o=Bs(n[s],i.points,e);o.length&&t.push(...o)}return t}function fh(i,e,t,n){let s=0,o=e-1;if(t&&!n)for(;s<e&&!i[s].skip;)s++;for(;s<e&&i[s].skip;)s++;for(s%=e,t&&(o+=s);o>s&&i[o%e].skip;)o--;return o%=e,{start:s,end:o}}function gh(i,e,t,n){let s=i.length,o=[],r=e,a=i[e],l;for(l=e+1;l<=t;++l){let c=i[l%s];c.skip||c.stop?a.skip||(n=!1,o.push({start:e%s,end:(l-1)%s,loop:n}),e=r=c.stop?l:null):(r=l,a.skip&&(e=l)),a=c}return r!==null&&o.push({start:e%s,end:r%s,loop:n}),o}function va(i,e){let t=i.points,n=i.options.spanGaps,s=t.length;if(!s)return[];let o=!!i._loop,{start:r,end:a}=fh(t,s,o,n);if(n===!0)return Xr(i,[{start:r,end:a,loop:o}],t,e);let l=a<r?a+s:a,c=!!i._fullLoop&&r===0&&a===s-1;return Xr(i,gh(t,r,l,c),t,e)}function Xr(i,e,t,n){return!n||!n.setContext||!t?e:mh(i,e,t,n)}function mh(i,e,t,n){let s=i._chart.getContext(),o=Gr(i.options),{_datasetIndex:r,options:{spanGaps:a}}=i,l=t.length,c=[],d=o,h=e[0].start,u=h;function p(b,g,_,C){let v=a?-1:1;if(b!==g){for(b+=l;t[b%l].skip;)b-=v;for(;t[g%l].skip;)g+=v;b%l!==g%l&&(c.push({start:b%l,end:g%l,loop:_,style:C}),d=C,h=g%l)}}for(let b of e){h=a?h:b.start;let g=t[h%l],_;for(u=h+1;u<=b.end;u++){let C=t[u%l];_=Gr(n.setContext(be(s,{type:"segment",p0:g,p1:C,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),bh(_,d)&&p(h,u-1,b.loop,d),g=C,d=_}h<u-1&&p(h,u-1,b.loop,d)}return c}function Gr(i){return{backgroundColor:i.backgroundColor,borderCapStyle:i.borderCapStyle,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderJoinStyle:i.borderJoinStyle,borderWidth:i.borderWidth,borderColor:i.borderColor}}function bh(i,e){if(!e)return!1;let t=[],n=function(s,o){return Ms(o)?(t.includes(o)||t.push(o),t.indexOf(o)):o};return JSON.stringify(i,n)!==JSON.stringify(e,n)}function cn(i,e,t){return i.options.clip?i[t]:e[t]}function xh(i,e){let{xScale:t,yScale:n}=i;return t&&n?{left:cn(t,e,"left"),right:cn(t,e,"right"),top:cn(n,e,"top"),bottom:cn(n,e,"bottom")}:e}function Hs(i,e){let t=e._clip;if(t.disabled)return!1;let n=xh(e,i.chartArea);return{left:t.left===!1?0:n.left-(t.left===!0?0:t.left),right:t.right===!1?i.width:n.right+(t.right===!0?0:t.right),top:t.top===!1?0:n.top-(t.top===!0?0:t.top),bottom:t.bottom===!1?i.height:n.bottom+(t.bottom===!0?0:t.bottom)}}var to=class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,t,n,s){let o=t.listeners[s],r=t.duration;o.forEach(a=>a({chart:e,initial:t.initial,numSteps:r,currentStep:Math.min(n-t.start,r)}))}_refresh(){this._request||(this._running=!0,this._request=vs.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let t=0;this._charts.forEach((n,s)=>{if(!n.running||!n.items.length)return;let o=n.items,r=o.length-1,a=!1,l;for(;r>=0;--r)l=o[r],l._active?(l._total>n.duration&&(n.duration=l._total),l.tick(e),a=!0):(o[r]=o[o.length-1],o.pop());a&&(s.draw(),this._notify(s,n,e,"progress")),o.length||(n.running=!1,this._notify(s,n,e,"complete"),n.initial=!1),t+=o.length}),this._lastDate=e,t===0&&(this._running=!1)}_getAnims(e){let t=this._charts,n=t.get(e);return n||(n={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},t.set(e,n)),n}listen(e,t,n){this._getAnims(e).listeners[t].push(n)}add(e,t){!t||!t.length||this._getAnims(e).items.push(...t)}has(e){return this._getAnims(e).items.length>0}start(e){let t=this._charts.get(e);t&&(t.running=!0,t.start=Date.now(),t.duration=t.items.reduce((n,s)=>Math.max(n,s._duration),0),this._refresh())}running(e){if(!this._running)return!1;let t=this._charts.get(e);return!(!t||!t.running||!t.items.length)}stop(e){let t=this._charts.get(e);if(!t||!t.items.length)return;let n=t.items,s=n.length-1;for(;s>=0;--s)n[s].cancel();t.items=[],this._notify(e,t,Date.now(),"complete")}remove(e){return this._charts.delete(e)}},xe=new to,Sa="transparent",_h={boolean(i,e,t){return t>.5?e:i},color(i,e,t){let n=Ts(i||Sa),s=n.valid&&Ts(e||Sa);return s&&s.valid?s.mix(n,t).hexString():e},number(i,e,t){return i+(e-i)*t}},eo=class{constructor(e,t,n,s){let o=t[n];s=oi([e.to,s,o,e.from]);let r=oi([e.from,o,s]);this._active=!0,this._fn=e.fn||_h[e.type||typeof r],this._easing=Ke[e.easing]||Ke.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=t,this._prop=n,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(e,t,n){if(this._active){this._notify(!1);let s=this._target[this._prop],o=n-this._start,r=this._duration-o;this._start=n,this._duration=Math.floor(Math.max(r,e.duration)),this._total+=o,this._loop=!!e.loop,this._to=oi([e.to,t,s,e.from]),this._from=oi([e.from,s,t])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){let t=e-this._start,n=this._duration,s=this._prop,o=this._from,r=this._loop,a=this._to,l;if(this._active=o!==a&&(r||t<n),!this._active){this._target[s]=a,this._notify(!0);return}if(t<0){this._target[s]=o;return}l=t/n%2,l=r&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[s]=this._fn(o,a,l)}wait(){let e=this._promises||(this._promises=[]);return new Promise((t,n)=>{e.push({res:t,rej:n})})}_notify(e){let t=e?"res":"rej",n=this._promises||[];for(let s=0;s<n.length;s++)n[s][t]()}},On=class{constructor(e,t){this._chart=e,this._properties=new Map,this.configure(t)}configure(e){if(!q(e))return;let t=Object.keys(st.animation),n=this._properties;Object.getOwnPropertyNames(e).forEach(s=>{let o=e[s];if(!q(o))return;let r={};for(let a of t)r[a]=o[a];(lt(o.properties)&&o.properties||[s]).forEach(a=>{(a===s||!n.has(a))&&n.set(a,r)})})}_animateOptions(e,t){let n=t.options,s=Ch(e,n);if(!s)return[];let o=this._createAnimations(s,n);return n.$shared&&yh(e.options.$animations,n).then(()=>{e.options=n},()=>{}),o}_createAnimations(e,t){let n=this._properties,s=[],o=e.$animations||(e.$animations={}),r=Object.keys(t),a=Date.now(),l;for(l=r.length-1;l>=0;--l){let c=r[l];if(c.charAt(0)==="$")continue;if(c==="options"){s.push(...this._animateOptions(e,t));continue}let d=t[c],h=o[c],u=n.get(c);if(h)if(u&&h.active()){h.update(u,d,a);continue}else h.cancel();if(!u||!u.duration){e[c]=d;continue}o[c]=h=new eo(u,e,c,d),s.push(h)}return s}update(e,t){if(this._properties.size===0){Object.assign(e,t);return}let n=this._createAnimations(e,t);if(n.length)return xe.add(this._chart,n),!0}};function yh(i,e){let t=[],n=Object.keys(e);for(let s=0;s<n.length;s++){let o=i[n[s]];o&&o.active()&&t.push(o.wait())}return Promise.all(t)}function Ch(i,e){if(!e)return;let t=i.options;if(!t){i.options=e;return}return t.$shared&&(i.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t}function Ia(i,e){let t=i&&i.options||{},n=t.reverse,s=t.min===void 0?e:0,o=t.max===void 0?e:0;return{start:n?o:s,end:n?s:o}}function wh(i,e,t){if(t===!1)return!1;let n=Ia(i,t),s=Ia(e,t);return{top:s.end,right:n.end,bottom:s.start,left:n.start}}function vh(i){let e,t,n,s;return q(i)?(e=i.top,t=i.right,n=i.bottom,s=i.left):e=t=n=s=i,{top:e,right:t,bottom:n,left:s,disabled:i===!1}}function Sl(i,e){let t=[],n=i._getSortedDatasetMetas(e),s,o;for(s=0,o=n.length;s<o;++s)t.push(n[s].index);return t}function ka(i,e,t,n={}){let s=i.keys,o=n.mode==="single",r,a,l,c;if(e===null)return;let d=!1;for(r=0,a=s.length;r<a;++r){if(l=+s[r],l===t){if(d=!0,n.all)continue;break}c=i.values[l],ht(c)&&(o||e===0||te(e)===te(c))&&(e+=c)}return!d&&!n.all?0:e}function Sh(i,e){let{iScale:t,vScale:n}=e,s=t.axis==="x"?"x":"y",o=n.axis==="x"?"x":"y",r=Object.keys(i),a=new Array(r.length),l,c,d;for(l=0,c=r.length;l<c;++l)d=r[l],a[l]={[s]:d,[o]:i[d]};return a}function Ns(i,e){let t=i&&i.options.stacked;return t||t===void 0&&e.stack!==void 0}function Ih(i,e,t){return`${i.id}.${e.id}.${t.stack||t.type}`}function kh(i){let{min:e,max:t,minDefined:n,maxDefined:s}=i.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:s?t:Number.POSITIVE_INFINITY}}function Mh(i,e,t){let n=i[e]||(i[e]={});return n[t]||(n[t]={})}function Ma(i,e,t,n){for(let s of e.getMatchingVisibleMetas(n).reverse()){let o=i[s.index];if(t&&o>0||!t&&o<0)return s.index}return null}function Ta(i,e){let{chart:t,_cachedMeta:n}=i,s=t._stacks||(t._stacks={}),{iScale:o,vScale:r,index:a}=n,l=o.axis,c=r.axis,d=Ih(o,r,n),h=e.length,u;for(let p=0;p<h;++p){let b=e[p],{[l]:g,[c]:_}=b,C=b._stacks||(b._stacks={});u=C[c]=Mh(s,d,g),u[a]=_,u._top=Ma(u,r,!0,n.type),u._bottom=Ma(u,r,!1,n.type);let v=u._visualValues||(u._visualValues={});v[a]=_}}function js(i,e){let t=i.scales;return Object.keys(t).filter(n=>t[n].axis===e).shift()}function Th(i,e){return be(i,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function Ph(i,e,t){return be(i,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:t,index:e,mode:"default",type:"data"})}function Ei(i,e){let t=i.controller.index,n=i.vScale&&i.vScale.axis;if(n){e=e||i._parsed;for(let s of e){let o=s._stacks;if(!o||o[n]===void 0||o[n][t]===void 0)return;delete o[n][t],o[n]._visualValues!==void 0&&o[n]._visualValues[t]!==void 0&&delete o[n]._visualValues[t]}}}var Us=i=>i==="reset"||i==="none",Pa=(i,e)=>e?i:Object.assign({},i),Eh=(i,e,t)=>i&&!e.hidden&&e._stacked&&{keys:Sl(t,!0),values:null},$e=(()=>{class i{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){let t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Ns(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ei(this._cachedMeta),this.index=t}linkScales(){let t=this.chart,n=this._cachedMeta,s=this.getDataset(),o=(u,p,b,g)=>u==="x"?p:u==="r"?g:b,r=n.xAxisID=H(s.xAxisID,js(t,"x")),a=n.yAxisID=H(s.yAxisID,js(t,"y")),l=n.rAxisID=H(s.rAxisID,js(t,"r")),c=n.indexAxis,d=n.iAxisID=o(c,r,a,l),h=n.vAxisID=o(c,a,r,l);n.xScale=this.getScaleForId(r),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(l),n.iScale=this.getScaleForId(d),n.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){let n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){let t=this._cachedMeta;this._data&&Cs(this._data,this),t._stacked&&Ei(t)}_dataCheck(){let t=this.getDataset(),n=t.data||(t.data=[]),s=this._data;if(q(n)){let o=this._cachedMeta;this._data=Sh(n,o)}else if(s!==n){if(s){Cs(s,this);let o=this._cachedMeta;Ei(o),o._parsed=[]}n&&Object.isExtensible(n)&&oa(n,this),this._syncList=[],this._data=n}}addElements(){let t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){let n=this._cachedMeta,s=this.getDataset(),o=!1;this._dataCheck();let r=n._stacked;n._stacked=Ns(n.vScale,n),n.stack!==s.stack&&(o=!0,Ei(n),n.stack=s.stack),this._resyncElements(t),(o||r!==n._stacked)&&(Ta(this,n._parsed),n._stacked=Ns(n.vScale,n))}configure(){let t=this.chart.config,n=t.datasetScopeKeys(this._type),s=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(s,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){let{_cachedMeta:s,_data:o}=this,{iScale:r,_stacked:a}=s,l=r.axis,c=t===0&&n===o.length?!0:s._sorted,d=t>0&&s._parsed[t-1],h,u,p;if(this._parsing===!1)s._parsed=o,s._sorted=!0,p=o;else{lt(o[t])?p=this.parseArrayData(s,o,t,n):q(o[t])?p=this.parseObjectData(s,o,t,n):p=this.parsePrimitiveData(s,o,t,n);let b=()=>u[l]===null||d&&u[l]<d[l];for(h=0;h<n;++h)s._parsed[h+t]=u=p[h],c&&(b()&&(c=!1),d=u);s._sorted=c}a&&Ta(this,p)}parsePrimitiveData(t,n,s,o){let{iScale:r,vScale:a}=t,l=r.axis,c=a.axis,d=r.getLabels(),h=r===a,u=new Array(o),p,b,g;for(p=0,b=o;p<b;++p)g=p+s,u[p]={[l]:h||r.parse(d[g],g),[c]:a.parse(n[g],g)};return u}parseArrayData(t,n,s,o){let{xScale:r,yScale:a}=t,l=new Array(o),c,d,h,u;for(c=0,d=o;c<d;++c)h=c+s,u=n[h],l[c]={x:r.parse(u[0],h),y:a.parse(u[1],h)};return l}parseObjectData(t,n,s,o){let{xScale:r,yScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=new Array(o),h,u,p,b;for(h=0,u=o;h<u;++h)p=h+s,b=n[p],d[h]={x:r.parse(me(b,l),p),y:a.parse(me(b,c),p)};return d}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,s){let o=this.chart,r=this._cachedMeta,a=n[t.axis],l={keys:Sl(o,!0),values:n._stacks[t.axis]._visualValues};return ka(l,a,r.index,{mode:s})}updateRangeFromParsed(t,n,s,o){let r=s[n.axis],a=r===null?NaN:r,l=o&&s._stacks[n.axis];o&&l&&(o.values=l,a=ka(o,r,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,n){let s=this._cachedMeta,o=s._parsed,r=s._sorted&&t===s.iScale,a=o.length,l=this._getOtherScale(t),c=Eh(n,s,this.chart),d={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:u}=kh(l),p,b;function g(){b=o[p];let _=b[l.axis];return!ht(b[t.axis])||h>_||u<_}for(p=0;p<a&&!(!g()&&(this.updateRangeFromParsed(d,t,b,c),r));++p);if(r){for(p=a-1;p>=0;--p)if(!g()){this.updateRangeFromParsed(d,t,b,c);break}}return d}getAllParsedValues(t){let n=this._cachedMeta._parsed,s=[],o,r,a;for(o=0,r=n.length;o<r;++o)a=n[o][t.axis],ht(a)&&s.push(a);return s}getMaxOverflow(){return!1}getLabelAndValue(t){let n=this._cachedMeta,s=n.iScale,o=n.vScale,r=this.getParsed(t);return{label:s?""+s.getLabelForValue(r[s.axis]):"",value:o?""+o.getLabelForValue(r[o.axis]):""}}_update(t){let n=this._cachedMeta;this.update(t||"default"),n._clip=vh(H(this.options.clip,wh(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){let t=this._ctx,n=this.chart,s=this._cachedMeta,o=s.data||[],r=n.chartArea,a=[],l=this._drawStart||0,c=this._drawCount||o.length-l,d=this.options.drawActiveElementsOnTop,h;for(s.dataset&&s.dataset.draw(t,r,l,c),h=l;h<l+c;++h){let u=o[h];u.hidden||(u.active&&d?a.push(u):u.draw(t,r))}for(h=0;h<a.length;++h)a[h].draw(t,r)}getStyle(t,n){let s=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(s):this.resolveDataElementOptions(t||0,s)}getContext(t,n,s){let o=this.getDataset(),r;if(t>=0&&t<this._cachedMeta.data.length){let a=this._cachedMeta.data[t];r=a.$context||(a.$context=Ph(this.getContext(),t,a)),r.parsed=this.getParsed(t),r.raw=o.data[t],r.index=r.dataIndex=t}else r=this.$context||(this.$context=Th(this.chart.getContext(),this.index)),r.dataset=o,r.index=r.datasetIndex=this.index;return r.active=!!n,r.mode=s,r}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",s){let o=n==="active",r=this._cachedDataOpts,a=t+"-"+n,l=r[a],c=this.enableOptionSharing&&ti(s);if(l)return Pa(l,c);let d=this.chart.config,h=d.datasetElementScopeKeys(this._type,t),u=o?[`${t}Hover`,"hover",t,""]:[t,""],p=d.getOptionScopes(this.getDataset(),h),b=Object.keys(st.elements[t]),g=()=>this.getContext(s,o,n),_=d.resolveNamedOptions(p,b,g,u);return _.$shared&&(_.$shared=c,r[a]=Object.freeze(Pa(_,c))),_}_resolveAnimations(t,n,s){let o=this.chart,r=this._cachedDataOpts,a=`animation-${n}`,l=r[a];if(l)return l;let c;if(o.options.animation!==!1){let h=this.chart.config,u=h.datasetAnimationScopeKeys(this._type,n),p=h.getOptionScopes(this.getDataset(),u);c=h.createResolver(p,this.getContext(t,s,n))}let d=new On(o,c&&c.animations);return c&&c._cacheable&&(r[a]=Object.freeze(d)),d}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||Us(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){let s=this.resolveDataElementOptions(t,n),o=this._sharedOptions,r=this.getSharedOptions(s),a=this.includeOptions(n,r)||r!==o;return this.updateSharedOptions(r,n,s),{sharedOptions:r,includeOptions:a}}updateElement(t,n,s,o){Us(o)?Object.assign(t,s):this._resolveAnimations(n,o).update(t,s)}updateSharedOptions(t,n,s){t&&!Us(n)&&this._resolveAnimations(void 0,n).update(t,s)}_setStyle(t,n,s,o){t.active=o;let r=this.getStyle(n,o);this._resolveAnimations(n,s,o).update(t,{options:!o&&this.getSharedOptions(r)||r})}removeHoverStyle(t,n,s){this._setStyle(t,s,"active",!1)}setHoverStyle(t,n,s){this._setStyle(t,s,"active",!0)}_removeDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){let t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){let n=this._data,s=this._cachedMeta.data;for(let[l,c,d]of this._syncList)this[l](c,d);this._syncList=[];let o=s.length,r=n.length,a=Math.min(r,o);a&&this.parse(0,a),r>o?this._insertElements(o,r-o,t):r<o&&this._removeElements(r,o-r)}_insertElements(t,n,s=!0){let o=this._cachedMeta,r=o.data,a=t+n,l,c=d=>{for(d.length+=n,l=d.length-1;l>=a;l--)d[l]=d[l-n]};for(c(r),l=t;l<a;++l)r[l]=new this.dataElementType;this._parsing&&c(o._parsed),this.parse(t,n),s&&this.updateElements(r,t,n,"reset")}updateElements(t,n,s,o){}_removeElements(t,n){let s=this._cachedMeta;if(this._parsing){let o=s._parsed.splice(t,n);s._stacked&&Ei(s,o)}s.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{let[n,s,o]=t;this[n](s,o)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){let t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);let s=arguments.length-2;s&&this._sync(["_insertElements",t,s])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}return i})();function Dh(i,e){if(!i._cache.$bar){let t=i.getMatchingVisibleMetas(e),n=[];for(let s=0,o=t.length;s<o;s++)n=n.concat(t[s].controller.getAllParsedValues(i));i._cache.$bar=ws(n.sort((s,o)=>s-o))}return i._cache.$bar}function $h(i){let e=i.iScale,t=Dh(e,i.type),n=e._length,s,o,r,a,l=()=>{r===32767||r===-32768||(ti(a)&&(n=Math.min(n,Math.abs(r-a)||n)),a=r)};for(s=0,o=t.length;s<o;++s)r=e.getPixelForValue(t[s]),l();for(a=void 0,s=0,o=e.ticks.length;s<o;++s)r=e.getPixelForTick(s),l();return n}function Oh(i,e,t,n){let s=t.barThickness,o,r;return G(s)?(o=e.min*t.categoryPercentage,r=t.barPercentage):(o=s*n,r=1),{chunk:o/n,ratio:r,start:e.pixels[i]-o/2}}function Wh(i,e,t,n){let s=e.pixels,o=s[i],r=i>0?s[i-1]:null,a=i<s.length-1?s[i+1]:null,l=t.categoryPercentage;r===null&&(r=o-(a===null?e.end-e.start:a-o)),a===null&&(a=o+o-r);let c=o-(o-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:t.barPercentage,start:c}}function Lh(i,e,t,n){let s=t.parse(i[0],n),o=t.parse(i[1],n),r=Math.min(s,o),a=Math.max(s,o),l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),e[t.axis]=c,e._custom={barStart:l,barEnd:c,start:s,end:o,min:r,max:a}}function Il(i,e,t,n){return lt(i)?Lh(i,e,t,n):e[t.axis]=t.parse(i,n),e}function Ea(i,e,t,n){let s=i.iScale,o=i.vScale,r=s.getLabels(),a=s===o,l=[],c,d,h,u;for(c=t,d=t+n;c<d;++c)u=e[c],h={},h[s.axis]=a||s.parse(r[c],c),l.push(Il(u,h,o,c));return l}function Ys(i){return i&&i.barStart!==void 0&&i.barEnd!==void 0}function zh(i,e,t){return i!==0?te(i):(e.isHorizontal()?1:-1)*(e.min>=t?1:-1)}function Rh(i){let e,t,n,s,o;return i.horizontal?(e=i.base>i.x,t="left",n="right"):(e=i.base<i.y,t="bottom",n="top"),e?(s="end",o="start"):(s="start",o="end"),{start:t,end:n,reverse:e,top:s,bottom:o}}function Fh(i,e,t,n){let s=e.borderSkipped,o={};if(!s){i.borderSkipped=o;return}if(s===!0){i.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}let{start:r,end:a,reverse:l,top:c,bottom:d}=Rh(i);s==="middle"&&t&&(i.enableBorderRadius=!0,(t._top||0)===n?s=c:(t._bottom||0)===n?s=d:(o[Da(d,r,a,l)]=!0,s=c)),o[Da(s,r,a,l)]=!0,i.borderSkipped=o}function Da(i,e,t,n){return n?(i=Ah(i,e,t),i=$a(i,t,e)):i=$a(i,e,t),i}function Ah(i,e,t){return i===e?t:i===t?e:i}function $a(i,e,t){return i==="start"?e:i==="end"?t:i}function Bh(i,{inflateAmount:e},t){i.inflateAmount=e==="auto"?t===1?.33:0:e}var Vh=(()=>{class i extends $e{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,n,s,o){return Ea(t,n,s,o)}parseArrayData(t,n,s,o){return Ea(t,n,s,o)}parseObjectData(t,n,s,o){let{iScale:r,vScale:a}=t,{xAxisKey:l="x",yAxisKey:c="y"}=this._parsing,d=r.axis==="x"?l:c,h=a.axis==="x"?l:c,u=[],p,b,g,_;for(p=s,b=s+o;p<b;++p)_=n[p],g={},g[r.axis]=r.parse(me(_,d),p),u.push(Il(me(_,h),g,a,p));return u}updateRangeFromParsed(t,n,s,o){super.updateRangeFromParsed(t,n,s,o);let r=s._custom;r&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,r.min),t.max=Math.max(t.max,r.max))}getMaxOverflow(){return 0}getLabelAndValue(t){let n=this._cachedMeta,{iScale:s,vScale:o}=n,r=this.getParsed(t),a=r._custom,l=Ys(a)?"["+a.start+", "+a.end+"]":""+o.getLabelForValue(r[o.axis]);return{label:""+s.getLabelForValue(r[s.axis]),value:l}}initialize(){this.enableOptionSharing=!0,super.initialize();let t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){let n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,s,o){let r=o==="reset",{index:a,_cachedMeta:{vScale:l}}=this,c=l.getBasePixel(),d=l.isHorizontal(),h=this._getRuler(),{sharedOptions:u,includeOptions:p}=this._getSharedOptions(n,o);for(let b=n;b<n+s;b++){let g=this.getParsed(b),_=r||G(g[l.axis])?{base:c,head:c}:this._calculateBarValuePixels(b),C=this._calculateBarIndexPixels(b,h),v=(g._stacks||{})[l.axis],M={horizontal:d,base:_.base,enableBorderRadius:!v||Ys(g._custom)||a===v._top||a===v._bottom,x:d?_.head:C.center,y:d?C.center:_.head,height:d?C.size:Math.abs(_.size),width:d?Math.abs(_.size):C.size};p&&(M.options=u||this.resolveDataElementOptions(b,t[b].active?"active":o));let E=M.options||t[b].options;Fh(M,E,v,a),Bh(M,E,h.ratio),this.updateElement(t[b],b,M,o)}}_getStacks(t,n){let{iScale:s}=this._cachedMeta,o=s.getMatchingVisibleMetas(this._type).filter(h=>h.controller.options.grouped),r=s.options.stacked,a=[],l=this._cachedMeta.controller.getParsed(n),c=l&&l[s.axis],d=h=>{let u=h._parsed.find(b=>b[s.axis]===c),p=u&&u[h.vScale.axis];if(G(p)||isNaN(p))return!0};for(let h of o)if(!(n!==void 0&&d(h))&&((r===!1||a.indexOf(h.stack)===-1||r===void 0&&h.stack===void 0)&&a.push(h.stack),h.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){let t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(s=>t[s].axis===n).shift()}_getAxis(){let t={},n=this.getFirstScaleIdForIndexAxis();for(let s of this.chart.data.datasets)t[H(this.chart.options.indexAxis==="x"?s.xAxisID:s.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,s){let o=this._getStacks(t,s),r=n!==void 0?o.indexOf(n):-1;return r===-1?o.length-1:r}_getRuler(){let t=this.options,n=this._cachedMeta,s=n.iScale,o=[],r,a;for(r=0,a=n.data.length;r<a;++r)o.push(s.getPixelForValue(this.getParsed(r)[s.axis],r));let l=t.barThickness;return{min:l||$h(n),pixels:o,start:s._startPixel,end:s._endPixel,stackCount:this._getStackCount(),scale:s,grouped:t.grouped,ratio:l?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){let{_cachedMeta:{vScale:n,_stacked:s,index:o},options:{base:r,minBarLength:a}}=this,l=r||0,c=this.getParsed(t),d=c._custom,h=Ys(d),u=c[n.axis],p=0,b=s?this.applyStack(n,c,s):u,g,_;b!==u&&(p=b-u,b=u),h&&(u=d.barStart,b=d.barEnd-d.barStart,u!==0&&te(u)!==te(d.barEnd)&&(p=0),p+=u);let C=!G(r)&&!h?r:p,v=n.getPixelForValue(C);if(this.chart.getDataVisibility(t)?g=n.getPixelForValue(p+b):g=v,_=g-v,Math.abs(_)<a){_=zh(_,n,l)*a,u===l&&(v-=_/2);let M=n.getPixelForDecimal(0),E=n.getPixelForDecimal(1),I=Math.min(M,E),P=Math.max(M,E);v=Math.max(Math.min(v,P),I),g=v+_,s&&!h&&(c._stacks[n.axis]._visualValues[o]=n.getValueForPixel(g)-n.getValueForPixel(v))}if(v===n.getPixelForValue(l)){let M=te(_)*n.getLineWidthForValue(l)/2;v+=M,_-=M}return{size:_,base:v,head:g,center:g+_/2}}_calculateBarIndexPixels(t,n){let s=n.scale,o=this.options,r=o.skipNull,a=H(o.maxBarThickness,1/0),l,c,d=this._getAxisCount();if(n.grouped){let h=r?this._getStackCount(t):n.stackCount,u=o.barThickness==="flex"?Wh(t,n,o,h*d):Oh(t,n,o,h*d),p=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,b=this._getAxis().indexOf(H(p,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,r?t:void 0)+b;l=u.start+u.chunk*g+u.chunk/2,c=Math.min(a,u.chunk*u.ratio)}else l=s.getPixelForValue(this.getParsed(t)[s.axis],t),c=Math.min(a,n.min*n.ratio);return{base:l-c/2,head:l+c/2,center:l,size:c}}draw(){let t=this._cachedMeta,n=t.vScale,s=t.data,o=s.length,r=0;for(;r<o;++r)this.getParsed(r)[n.axis]!==null&&!s[r].hidden&&s[r].draw(this._ctx)}}return i})(),Hh=(()=>{class i extends $e{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,n,s,o){let r=super.parsePrimitiveData(t,n,s,o);for(let a=0;a<r.length;a++)r[a]._custom=this.resolveDataElementOptions(a+s).radius;return r}parseArrayData(t,n,s,o){let r=super.parseArrayData(t,n,s,o);for(let a=0;a<r.length;a++){let l=n[s+a];r[a]._custom=H(l[2],this.resolveDataElementOptions(a+s).radius)}return r}parseObjectData(t,n,s,o){let r=super.parseObjectData(t,n,s,o);for(let a=0;a<r.length;a++){let l=n[s+a];r[a]._custom=H(l&&l.r&&+l.r,this.resolveDataElementOptions(a+s).radius)}return r}getMaxOverflow(){let t=this._cachedMeta.data,n=0;for(let s=t.length-1;s>=0;--s)n=Math.max(n,t[s].size(this.resolveDataElementOptions(s))/2);return n>0&&n}getLabelAndValue(t){let n=this._cachedMeta,s=this.chart.data.labels||[],{xScale:o,yScale:r}=n,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y),d=a._custom;return{label:s[t]||"",value:"("+l+", "+c+(d?", "+d:"")+")"}}update(t){let n=this._cachedMeta.data;this.updateElements(n,0,n.length,t)}updateElements(t,n,s,o){let r=o==="reset",{iScale:a,vScale:l}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(n,o),h=a.axis,u=l.axis;for(let p=n;p<n+s;p++){let b=t[p],g=!r&&this.getParsed(p),_={},C=_[h]=r?a.getPixelForDecimal(.5):a.getPixelForValue(g[h]),v=_[u]=r?l.getBasePixel():l.getPixelForValue(g[u]);_.skip=isNaN(C)||isNaN(v),d&&(_.options=c||this.resolveDataElementOptions(p,b.active?"active":o),r&&(_.options.radius=0)),this.updateElement(b,p,_,o)}}resolveDataElementOptions(t,n){let s=this.getParsed(t),o=super.resolveDataElementOptions(t,n);o.$shared&&(o=Object.assign({},o,{$shared:!1}));let r=o.radius;return n!=="active"&&(o.radius=0),o.radius+=H(s&&s._custom,r),o}}return i})();function Nh(i,e,t){let n=1,s=1,o=0,r=0;if(e<ct){let a=i,l=a+e,c=Math.cos(a),d=Math.sin(a),h=Math.cos(l),u=Math.sin(l),p=(M,E,I)=>ii(M,a,l,!0)?1:Math.max(E,E*t,I,I*t),b=(M,E,I)=>ii(M,a,l,!0)?-1:Math.min(E,E*t,I,I*t),g=p(0,c,h),_=p(ut,d,u),C=b(J,c,h),v=b(J+ut,d,u);n=(g-C)/2,s=(_-v)/2,o=-(g+C)/2,r=-(_+v)/2}return{ratioX:n,ratioY:s,offsetX:o,offsetY:r}}var wo=(()=>{class i extends $e{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let n=t.data;if(n.labels.length&&n.datasets.length){let{labels:{pointStyle:s,color:o}}=t.legend.options;return n.labels.map((r,a)=>{let c=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,s){s.chart.toggleDataVisibility(n.index),s.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){let s=this.getDataset().data,o=this._cachedMeta;if(this._parsing===!1)o._parsed=s;else{let r=c=>+s[c];if(q(s[t])){let{key:c="value"}=this._parsing;r=d=>+me(s[d],c)}let a,l;for(a=t,l=t+n;a<l;++a)o._parsed[a]=r(a)}}_getRotation(){return Qt(this.options.rotation-90)}_getCircumference(){return Qt(this.options.circumference)}_getRotationExtents(){let t=ct,n=-ct;for(let s=0;s<this.chart.data.datasets.length;++s)if(this.chart.isDatasetVisible(s)&&this.chart.getDatasetMeta(s).type===this._type){let o=this.chart.getDatasetMeta(s).controller,r=o._getRotation(),a=o._getCircumference();t=Math.min(t,r),n=Math.max(n,r+a)}return{rotation:t,circumference:n-t}}update(t){let n=this.chart,{chartArea:s}=n,o=this._cachedMeta,r=o.data,a=this.getMaxBorderWidth()+this.getMaxOffset(r)+this.options.spacing,l=Math.max((Math.min(s.width,s.height)-a)/2,0),c=Math.min(Kr(this.options.cutout,l),1),d=this._getRingWeight(this.index),{circumference:h,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:b,offsetX:g,offsetY:_}=Nh(u,h,c),C=(s.width-a)/p,v=(s.height-a)/b,M=Math.max(Math.min(C,v)/2,0),E=gs(this.options.radius,M),I=Math.max(E*c,0),P=(E-I)/this._getVisibleDatasetWeightTotal();this.offsetX=g*E,this.offsetY=_*E,o.total=this.calculateTotal(),this.outerRadius=E-P*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-P*d,0),this.updateElements(r,0,r.length,t)}_circumference(t,n){let s=this.options,o=this._cachedMeta,r=this._getCircumference();return n&&s.animation.animateRotate||!this.chart.getDataVisibility(t)||o._parsed[t]===null||o.data[t].hidden?0:this.calculateCircumference(o._parsed[t]*r/ct)}updateElements(t,n,s,o){let r=o==="reset",a=this.chart,l=a.chartArea,d=a.options.animation,h=(l.left+l.right)/2,u=(l.top+l.bottom)/2,p=r&&d.animateScale,b=p?0:this.innerRadius,g=p?0:this.outerRadius,{sharedOptions:_,includeOptions:C}=this._getSharedOptions(n,o),v=this._getRotation(),M;for(M=0;M<n;++M)v+=this._circumference(M,r);for(M=n;M<n+s;++M){let E=this._circumference(M,r),I=t[M],P={x:h+this.offsetX,y:u+this.offsetY,startAngle:v,endAngle:v+E,circumference:E,outerRadius:g,innerRadius:b};C&&(P.options=_||this.resolveDataElementOptions(M,I.active?"active":o)),v+=E,this.updateElement(I,M,P,o)}}calculateTotal(){let t=this._cachedMeta,n=t.data,s=0,o;for(o=0;o<n.length;o++){let r=t._parsed[o];r!==null&&!isNaN(r)&&this.chart.getDataVisibility(o)&&!n[o].hidden&&(s+=Math.abs(r))}return s}calculateCircumference(t){let n=this._cachedMeta.total;return n>0&&!isNaN(t)?ct*(Math.abs(t)/n):0}getLabelAndValue(t){let n=this._cachedMeta,s=this.chart,o=s.data.labels||[],r=ni(n._parsed[t],s.options.locale);return{label:o[t]||"",value:r}}getMaxBorderWidth(t){let n=0,s=this.chart,o,r,a,l,c;if(!t){for(o=0,r=s.data.datasets.length;o<r;++o)if(s.isDatasetVisible(o)){a=s.getDatasetMeta(o),t=a.data,l=a.controller;break}}if(!t)return 0;for(o=0,r=t.length;o<r;++o)c=l.resolveDataElementOptions(o),c.borderAlign!=="inner"&&(n=Math.max(n,c.borderWidth||0,c.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let s=0,o=t.length;s<o;++s){let r=this.resolveDataElementOptions(s);n=Math.max(n,r.offset||0,r.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let s=0;s<t;++s)this.chart.isDatasetVisible(s)&&(n+=this._getRingWeight(s));return n}_getRingWeight(t){return Math.max(H(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}return i})(),jh=(()=>{class i extends $e{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){let n=this._cachedMeta,{dataset:s,data:o=[],_dataset:r}=n,a=this.chart._animationsDisabled,{start:l,count:c}=Is(n,o,a);this._drawStart=l,this._drawCount=c,ks(n)&&(l=0,c=o.length),s._chart=this.chart,s._datasetIndex=this.index,s._decimated=!!r._decimated,s.points=o;let d=this.resolveDatasetElementOptions(t);this.options.showLine||(d.borderWidth=0),d.segment=this.options.segment,this.updateElement(s,void 0,{animated:!a,options:d},t),this.updateElements(o,l,c,t)}updateElements(t,n,s,o){let r=o==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,{sharedOptions:h,includeOptions:u}=this._getSharedOptions(n,o),p=a.axis,b=l.axis,{spanGaps:g,segment:_}=this.options,C=Ae(g)?g:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||r||o==="none",M=n+s,E=t.length,I=n>0&&this.getParsed(n-1);for(let P=0;P<E;++P){let L=t[P],O=v?L:{};if(P<n||P>=M){O.skip=!0;continue}let F=this.getParsed(P),U=G(F[b]),N=O[p]=a.getPixelForValue(F[p],P),K=O[b]=r||U?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,F,c):F[b],P);O.skip=isNaN(N)||isNaN(K)||U,O.stop=P>0&&Math.abs(F[p]-I[p])>C,_&&(O.parsed=F,O.raw=d.data[P]),u&&(O.options=h||this.resolveDataElementOptions(P,L.active?"active":o)),v||this.updateElement(L,P,O,o),I=F}}getMaxOverflow(){let t=this._cachedMeta,n=t.dataset,s=n.options&&n.options.borderWidth||0,o=t.data||[];if(!o.length)return s;let r=o[0].size(this.resolveDataElementOptions(0)),a=o[o.length-1].size(this.resolveDataElementOptions(o.length-1));return Math.max(s,r,a)/2}draw(){let t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}return i})(),kl=(()=>{class i extends $e{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){let n=t.data;if(n.labels.length&&n.datasets.length){let{labels:{pointStyle:s,color:o}}=t.legend.options;return n.labels.map((r,a)=>{let c=t.getDatasetMeta(0).controller.getStyle(a);return{text:r,fillStyle:c.backgroundColor,strokeStyle:c.borderColor,fontColor:o,lineWidth:c.borderWidth,pointStyle:s,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,s){s.chart.toggleDataVisibility(n.index),s.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,n){super(t,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){let n=this._cachedMeta,s=this.chart,o=s.data.labels||[],r=ni(n._parsed[t].r,s.options.locale);return{label:o[t]||"",value:r}}parseObjectData(t,n,s,o){return Ls.bind(this)(t,n,s,o)}update(t){let n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,t)}getMinMax(){let t=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach((s,o)=>{let r=this.getParsed(o).r;!isNaN(r)&&this.chart.getDataVisibility(o)&&(r<n.min&&(n.min=r),r>n.max&&(n.max=r))}),n}_updateRadius(){let t=this.chart,n=t.chartArea,s=t.options,o=Math.min(n.right-n.left,n.bottom-n.top),r=Math.max(o/2,0),a=Math.max(s.cutoutPercentage?r/100*s.cutoutPercentage:1,0),l=(r-a)/t.getVisibleDatasetCount();this.outerRadius=r-l*this.index,this.innerRadius=this.outerRadius-l}updateElements(t,n,s,o){let r=o==="reset",a=this.chart,c=a.options.animation,d=this._cachedMeta.rScale,h=d.xCenter,u=d.yCenter,p=d.getIndexAngle(0)-.5*J,b=p,g,_=360/this.countVisibleElements();for(g=0;g<n;++g)b+=this._computeAngle(g,o,_);for(g=n;g<n+s;g++){let C=t[g],v=b,M=b+this._computeAngle(g,o,_),E=a.getDataVisibility(g)?d.getDistanceFromCenterForValue(this.getParsed(g).r):0;b=M,r&&(c.animateScale&&(E=0),c.animateRotate&&(v=M=p));let I={x:h,y:u,innerRadius:0,outerRadius:E,startAngle:v,endAngle:M,options:this.resolveDataElementOptions(g,C.active?"active":o)};this.updateElement(C,g,I,o)}}countVisibleElements(){let t=this._cachedMeta,n=0;return t.data.forEach((s,o)=>{!isNaN(this.getParsed(o).r)&&this.chart.getDataVisibility(o)&&n++}),n}_computeAngle(t,n,s){return this.chart.getDataVisibility(t)?Qt(this.resolveDataElementOptions(t,n).angle||s):0}}return i})(),Uh=(()=>{class i extends wo{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}}return i})(),Yh=(()=>{class i extends $e{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){let n=this._cachedMeta.vScale,s=this.getParsed(t);return{label:n.getLabels()[t],value:""+n.getLabelForValue(s[n.axis])}}parseObjectData(t,n,s,o){return Ls.bind(this)(t,n,s,o)}update(t){let n=this._cachedMeta,s=n.dataset,o=n.data||[],r=n.iScale.getLabels();if(s.points=o,t!=="resize"){let a=this.resolveDatasetElementOptions(t);this.options.showLine||(a.borderWidth=0);let l={_loop:!0,_fullLoop:r.length===o.length,options:a};this.updateElement(s,void 0,l,t)}this.updateElements(o,0,o.length,t)}updateElements(t,n,s,o){let r=this._cachedMeta.rScale,a=o==="reset";for(let l=n;l<n+s;l++){let c=t[l],d=this.resolveDataElementOptions(l,c.active?"active":o),h=r.getPointPositionForValue(l,this.getParsed(l).r),u=a?r.xCenter:h.x,p=a?r.yCenter:h.y,b={x:u,y:p,angle:h.angle,skip:isNaN(u)||isNaN(p),options:d};this.updateElement(c,l,b,o)}}}return i})(),Xh=(()=>{class i extends $e{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){let n=this._cachedMeta,s=this.chart.data.labels||[],{xScale:o,yScale:r}=n,a=this.getParsed(t),l=o.getLabelForValue(a.x),c=r.getLabelForValue(a.y);return{label:s[t]||"",value:"("+l+", "+c+")"}}update(t){let n=this._cachedMeta,{data:s=[]}=n,o=this.chart._animationsDisabled,{start:r,count:a}=Is(n,s,o);if(this._drawStart=r,this._drawCount=a,ks(n)&&(r=0,a=s.length),this.options.showLine){this.datasetElementType||this.addElements();let{dataset:l,_dataset:c}=n;l._chart=this.chart,l._datasetIndex=this.index,l._decimated=!!c._decimated,l.points=s;let d=this.resolveDatasetElementOptions(t);d.segment=this.options.segment,this.updateElement(l,void 0,{animated:!o,options:d},t)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(s,r,a,t)}addElements(){let{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,n,s,o){let r=o==="reset",{iScale:a,vScale:l,_stacked:c,_dataset:d}=this._cachedMeta,h=this.resolveDataElementOptions(n,o),u=this.getSharedOptions(h),p=this.includeOptions(o,u),b=a.axis,g=l.axis,{spanGaps:_,segment:C}=this.options,v=Ae(_)?_:Number.POSITIVE_INFINITY,M=this.chart._animationsDisabled||r||o==="none",E=n>0&&this.getParsed(n-1);for(let I=n;I<n+s;++I){let P=t[I],L=this.getParsed(I),O=M?P:{},F=G(L[g]),U=O[b]=a.getPixelForValue(L[b],I),N=O[g]=r||F?l.getBasePixel():l.getPixelForValue(c?this.applyStack(l,L,c):L[g],I);O.skip=isNaN(U)||isNaN(N)||F,O.stop=I>0&&Math.abs(L[b]-E[b])>v,C&&(O.parsed=L,O.raw=d.data[I]),p&&(O.options=u||this.resolveDataElementOptions(I,P.active?"active":o)),M||this.updateElement(P,I,O,o),E=L}this.updateSharedOptions(u,o,h)}getMaxOverflow(){let t=this._cachedMeta,n=t.data||[];if(!this.options.showLine){let l=0;for(let c=n.length-1;c>=0;--c)l=Math.max(l,n[c].size(this.resolveDataElementOptions(c))/2);return l>0&&l}let s=t.dataset,o=s.options&&s.options.borderWidth||0;if(!n.length)return o;let r=n[0].size(this.resolveDataElementOptions(0)),a=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(o,r,a)/2}}return i})(),Gh=Object.freeze({__proto__:null,BarController:Vh,BubbleController:Hh,DoughnutController:wo,LineController:jh,PieController:Uh,PolarAreaController:kl,RadarController:Yh,ScatterController:Xh});function Ve(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}var io=class i{static override(e){Object.assign(i.prototype,e)}options;constructor(e){this.options=e||{}}init(){}formats(){return Ve()}parse(){return Ve()}format(){return Ve()}add(){return Ve()}diff(){return Ve()}startOf(){return Ve()}endOf(){return Ve()}},qh={_date:io};function Kh(i,e,t,n){let{controller:s,data:o,_sorted:r}=i,a=s._cachedMeta.iScale,l=i.dataset&&i.dataset.options?i.dataset.options.spanGaps:null;if(a&&e===a.axis&&e!=="r"&&r&&o.length){let c=a._reversePixels?ia:se;if(n){if(s._sharedOptions){let d=o[0],h=typeof d.getRange=="function"&&d.getRange(e);if(h){let u=c(o,e,t-h),p=c(o,e,t+h);return{lo:u.lo,hi:p.hi}}}}else{let d=c(o,e,t);if(l){let{vScale:h}=s._cachedMeta,{_parsed:u}=i,p=u.slice(0,d.lo+1).reverse().findIndex(g=>!G(g[h.axis]));d.lo-=Math.max(0,p);let b=u.slice(d.hi).findIndex(g=>!G(g[h.axis]));d.hi+=Math.max(0,b)}return d}}return{lo:0,hi:o.length-1}}function Bi(i,e,t,n,s){let o=i.getSortedVisibleDatasetMetas(),r=t[e];for(let a=0,l=o.length;a<l;++a){let{index:c,data:d}=o[a],{lo:h,hi:u}=Kh(o[a],e,r,s);for(let p=h;p<=u;++p){let b=d[p];b.skip||n(b,c,p)}}}function Qh(i){let e=i.indexOf("x")!==-1,t=i.indexOf("y")!==-1;return function(n,s){let o=e?Math.abs(n.x-s.x):0,r=t?Math.abs(n.y-s.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(r,2))}}function Xs(i,e,t,n,s){let o=[];return!s&&!i.isPointInArea(e)||Bi(i,t,e,function(a,l,c){!s&&!oe(a,i.chartArea,0)||a.inRange(e.x,e.y,n)&&o.push({element:a,datasetIndex:l,index:c})},!0),o}function Jh(i,e,t,n){let s=[];function o(r,a,l){let{startAngle:c,endAngle:d}=r.getProps(["startAngle","endAngle"],n),{angle:h}=ys(r,{x:e.x,y:e.y});ii(h,c,d)&&s.push({element:r,datasetIndex:a,index:l})}return Bi(i,t,e,o),s}function Zh(i,e,t,n,s,o){let r=[],a=Qh(t),l=Number.POSITIVE_INFINITY;function c(d,h,u){let p=d.inRange(e.x,e.y,s);if(n&&!p)return;let b=d.getCenterPoint(s);if(!(!!o||i.isPointInArea(b))&&!p)return;let _=a(e,b);_<l?(r=[{element:d,datasetIndex:h,index:u}],l=_):_===l&&r.push({element:d,datasetIndex:h,index:u})}return Bi(i,t,e,c),r}function Gs(i,e,t,n,s,o){return!o&&!i.isPointInArea(e)?[]:t==="r"&&!n?Jh(i,e,t,s):Zh(i,e,t,n,s,o)}function Oa(i,e,t,n,s){let o=[],r=t==="x"?"inXRange":"inYRange",a=!1;return Bi(i,t,e,(l,c,d)=>{l[r]&&l[r](e[t],s)&&(o.push({element:l,datasetIndex:c,index:d}),a=a||l.inRange(e.x,e.y,s))}),n&&!a?[]:o}var tu={evaluateInteractionItems:Bi,modes:{index(i,e,t,n){let s=Ee(e,i),o=t.axis||"x",r=t.includeInvisible||!1,a=t.intersect?Xs(i,s,o,n,r):Gs(i,s,o,!1,n,r),l=[];return a.length?(i.getSortedVisibleDatasetMetas().forEach(c=>{let d=a[0].index,h=c.data[d];h&&!h.skip&&l.push({element:h,datasetIndex:c.index,index:d})}),l):[]},dataset(i,e,t,n){let s=Ee(e,i),o=t.axis||"xy",r=t.includeInvisible||!1,a=t.intersect?Xs(i,s,o,n,r):Gs(i,s,o,!1,n,r);if(a.length>0){let l=a[0].datasetIndex,c=i.getDatasetMeta(l).data;a=[];for(let d=0;d<c.length;++d)a.push({element:c[d],datasetIndex:l,index:d})}return a},point(i,e,t,n){let s=Ee(e,i),o=t.axis||"xy",r=t.includeInvisible||!1;return Xs(i,s,o,n,r)},nearest(i,e,t,n){let s=Ee(e,i),o=t.axis||"xy",r=t.includeInvisible||!1;return Gs(i,s,o,t.intersect,n,r)},x(i,e,t,n){let s=Ee(e,i);return Oa(i,s,"x",t.intersect,n)},y(i,e,t,n){let s=Ee(e,i);return Oa(i,s,"y",t.intersect,n)}}},Ml=["left","top","right","bottom"];function Di(i,e){return i.filter(t=>t.pos===e)}function Wa(i,e){return i.filter(t=>Ml.indexOf(t.pos)===-1&&t.box.axis===e)}function $i(i,e){return i.sort((t,n)=>{let s=e?n:t,o=e?t:n;return s.weight===o.weight?s.index-o.index:s.weight-o.weight})}function eu(i){let e=[],t,n,s,o,r,a;for(t=0,n=(i||[]).length;t<n;++t)s=i[t],{position:o,options:{stack:r,stackWeight:a=1}}=s,e.push({index:t,box:s,pos:o,horizontal:s.isHorizontal(),weight:s.weight,stack:r&&o+r,stackWeight:a});return e}function iu(i){let e={};for(let t of i){let{stack:n,pos:s,stackWeight:o}=t;if(!n||!Ml.includes(s))continue;let r=e[n]||(e[n]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=o}return e}function nu(i,e){let t=iu(i),{vBoxMaxWidth:n,hBoxMaxHeight:s}=e,o,r,a;for(o=0,r=i.length;o<r;++o){a=i[o];let{fullSize:l}=a.box,c=t[a.stack],d=c&&a.stackWeight/c.weight;a.horizontal?(a.width=d?d*n:l&&e.availableWidth,a.height=s):(a.width=n,a.height=d?d*s:l&&e.availableHeight)}return t}function su(i){let e=eu(i),t=$i(e.filter(c=>c.box.fullSize),!0),n=$i(Di(e,"left"),!0),s=$i(Di(e,"right")),o=$i(Di(e,"top"),!0),r=$i(Di(e,"bottom")),a=Wa(e,"x"),l=Wa(e,"y");return{fullSize:t,leftAndTop:n.concat(o),rightAndBottom:s.concat(l).concat(r).concat(a),chartArea:Di(e,"chartArea"),vertical:n.concat(s).concat(l),horizontal:o.concat(r).concat(a)}}function La(i,e,t,n){return Math.max(i[t],e[t])+Math.max(i[n],e[n])}function Tl(i,e){i.top=Math.max(i.top,e.top),i.left=Math.max(i.left,e.left),i.bottom=Math.max(i.bottom,e.bottom),i.right=Math.max(i.right,e.right)}function ou(i,e,t,n){let{pos:s,box:o}=t,r=i.maxPadding;if(!q(s)){t.size&&(i[s]-=t.size);let h=n[t.stack]||{size:0,count:1};h.size=Math.max(h.size,t.horizontal?o.height:o.width),t.size=h.size/h.count,i[s]+=t.size}o.getPadding&&Tl(r,o.getPadding());let a=Math.max(0,e.outerWidth-La(r,i,"left","right")),l=Math.max(0,e.outerHeight-La(r,i,"top","bottom")),c=a!==i.w,d=l!==i.h;return i.w=a,i.h=l,t.horizontal?{same:c,other:d}:{same:d,other:c}}function ru(i){let e=i.maxPadding;function t(n){let s=Math.max(e[n]-i[n],0);return i[n]+=s,s}i.y+=t("top"),i.x+=t("left"),t("right"),t("bottom")}function au(i,e){let t=e.maxPadding;function n(s){let o={left:0,top:0,right:0,bottom:0};return s.forEach(r=>{o[r]=Math.max(e[r],t[r])}),o}return n(i?["left","right"]:["top","bottom"])}function Li(i,e,t,n){let s=[],o,r,a,l,c,d;for(o=0,r=i.length,c=0;o<r;++o){a=i[o],l=a.box,l.update(a.width||e.w,a.height||e.h,au(a.horizontal,e));let{same:h,other:u}=ou(e,t,a,n);c|=h&&s.length,d=d||u,l.fullSize||s.push(a)}return c&&Li(s,e,t,n)||d}function In(i,e,t,n,s){i.top=t,i.left=e,i.right=e+n,i.bottom=t+s,i.width=n,i.height=s}function za(i,e,t,n){let s=t.padding,{x:o,y:r}=e;for(let a of i){let l=a.box,c=n[a.stack]||{count:1,placed:0,weight:1},d=a.stackWeight/c.weight||1;if(a.horizontal){let h=e.w*d,u=c.size||l.height;ti(c.start)&&(r=c.start),l.fullSize?In(l,s.left,r,t.outerWidth-s.right-s.left,u):In(l,e.left+c.placed,r,h,u),c.start=r,c.placed+=h,r=l.bottom}else{let h=e.h*d,u=c.size||l.width;ti(c.start)&&(o=c.start),l.fullSize?In(l,o,s.top,u,t.outerHeight-s.bottom-s.top):In(l,o,e.top+c.placed,u,h),c.start=o,c.placed+=h,o=l.right}}e.x=o,e.y=r}var Ft={addBox(i,e){i.boxes||(i.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},i.boxes.push(e)},removeBox(i,e){let t=i.boxes?i.boxes.indexOf(e):-1;t!==-1&&i.boxes.splice(t,1)},configure(i,e,t){e.fullSize=t.fullSize,e.position=t.position,e.weight=t.weight},update(i,e,t,n){if(!i)return;let s=$t(i.options.layout.padding),o=Math.max(e-s.width,0),r=Math.max(t-s.height,0),a=su(i.boxes),l=a.vertical,c=a.horizontal;et(i.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});let d=l.reduce((g,_)=>_.box.options&&_.box.options.display===!1?g:g+1,0)||1,h=Object.freeze({outerWidth:e,outerHeight:t,padding:s,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/d,hBoxMaxHeight:r/2}),u=Object.assign({},s);Tl(u,$t(n));let p=Object.assign({maxPadding:u,w:o,h:r,x:s.left,y:s.top},s),b=nu(l.concat(c),h);Li(a.fullSize,p,h,b),Li(l,p,h,b),Li(c,p,h,b)&&Li(l,p,h,b),ru(p),za(a.leftAndTop,p,h,b),p.x+=p.w,p.y+=p.h,za(a.rightAndBottom,p,h,b),i.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},et(a.chartArea,g=>{let _=g.box;Object.assign(_,i.chartArea),_.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}},Wn=class{acquireContext(e,t){}releaseContext(e){return!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}getDevicePixelRatio(){return 1}getMaximumSize(e,t,n,s){return t=Math.max(0,t||e.width),n=n||e.height,{width:t,height:Math.max(0,s?Math.floor(t/s):n)}}isAttached(e){return!0}updateConfig(e){}},no=class extends Wn{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}},Dn="$chartjs",lu={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ra=i=>i===null||i==="";function cu(i,e){let t=i.style,n=i.getAttribute("height"),s=i.getAttribute("width");if(i[Dn]={initial:{height:n,width:s,style:{display:t.display,height:t.height,width:t.width}}},t.display=t.display||"block",t.boxSizing=t.boxSizing||"border-box",Ra(s)){let o=Rs(i,"width");o!==void 0&&(i.width=o)}if(Ra(n))if(i.style.height==="")i.height=i.width/(e||2);else{let o=Rs(i,"height");o!==void 0&&(i.height=o)}return i}var Pl=_a?{passive:!0}:!1;function du(i,e,t){i&&i.addEventListener(e,t,Pl)}function hu(i,e,t){i&&i.canvas&&i.canvas.removeEventListener(e,t,Pl)}function uu(i,e){let t=lu[i.type]||i.type,{x:n,y:s}=Ee(i,e);return{type:t,chart:e,native:i,x:n!==void 0?n:null,y:s!==void 0?s:null}}function Ln(i,e){for(let t of i)if(t===e||t.contains(e))return!0}function pu(i,e,t){let n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ln(a.addedNodes,n),r=r&&!Ln(a.removedNodes,n);r&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}function fu(i,e,t){let n=i.canvas,s=new MutationObserver(o=>{let r=!1;for(let a of o)r=r||Ln(a.removedNodes,n),r=r&&!Ln(a.addedNodes,n);r&&t()});return s.observe(document,{childList:!0,subtree:!0}),s}var Ri=new Map,Fa=0;function El(){let i=window.devicePixelRatio;i!==Fa&&(Fa=i,Ri.forEach((e,t)=>{t.currentDevicePixelRatio!==i&&e()}))}function gu(i,e){Ri.size||window.addEventListener("resize",El),Ri.set(i,e)}function mu(i){Ri.delete(i),Ri.size||window.removeEventListener("resize",El)}function bu(i,e,t){let n=i.canvas,s=n&&vn(n);if(!s)return;let o=Ss((a,l)=>{let c=s.clientWidth;t(a,l),c<s.clientWidth&&t()},window),r=new ResizeObserver(a=>{let l=a[0],c=l.contentRect.width,d=l.contentRect.height;c===0&&d===0||o(c,d)});return r.observe(s),gu(i,o),r}function qs(i,e,t){t&&t.disconnect(),e==="resize"&&mu(i)}function xu(i,e,t){let n=i.canvas,s=Ss(o=>{i.ctx!==null&&t(uu(o,i))},i);return du(n,e,s),s}var so=class extends Wn{acquireContext(e,t){let n=e&&e.getContext&&e.getContext("2d");return n&&n.canvas===e?(cu(e,t),n):null}releaseContext(e){let t=e.canvas;if(!t[Dn])return!1;let n=t[Dn].initial;["height","width"].forEach(o=>{let r=n[o];G(r)?t.removeAttribute(o):t.setAttribute(o,r)});let s=n.style||{};return Object.keys(s).forEach(o=>{t.style[o]=s[o]}),t.width=t.width,delete t[Dn],!0}addEventListener(e,t,n){this.removeEventListener(e,t);let s=e.$proxies||(e.$proxies={}),r={attach:pu,detach:fu,resize:bu}[t]||xu;s[t]=r(e,t,n)}removeEventListener(e,t){let n=e.$proxies||(e.$proxies={}),s=n[t];if(!s)return;({attach:qs,detach:qs,resize:qs}[t]||hu)(e,t,s),n[t]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,t,n,s){return xa(e,t,n,s)}isAttached(e){let t=e&&vn(e);return!!(t&&t.isConnected)}};function _u(i){return!wn()||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas?no:so}var ee=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(e){let{x:t,y:n}=this.getProps(["x","y"],e);return{x:t,y:n}}hasValue(){return Ae(this.x)&&Ae(this.y)}getProps(e,t){let n=this.$animations;if(!t||!n)return this;let s={};return e.forEach(o=>{s[o]=n[o]&&n[o].active()?n[o]._to:this[o]}),s}};function yu(i,e){let t=i.options.ticks,n=Cu(i),s=Math.min(t.maxTicksLimit||n,n),o=t.major.enabled?vu(e):[],r=o.length,a=o[0],l=o[r-1],c=[];if(r>s)return Su(e,c,o,r/s),c;let d=wu(o,e,s);if(r>0){let h,u,p=r>1?Math.round((l-a)/(r-1)):null;for(kn(e,c,d,G(p)?0:a-p,a),h=0,u=r-1;h<u;h++)kn(e,c,d,o[h],o[h+1]);return kn(e,c,d,l,G(p)?e.length:l+p),c}return kn(e,c,d),c}function Cu(i){let e=i.options.offset,t=i._tickSize(),n=i._length/t+(e?0:1),s=i._maxLength/t;return Math.floor(Math.min(n,s))}function wu(i,e,t){let n=Iu(i),s=e.length/t;if(!n)return Math.max(s,1);let o=Zr(n);for(let r=0,a=o.length-1;r<a;r++){let l=o[r];if(l>s)return l}return Math.max(s,1)}function vu(i){let e=[],t,n;for(t=0,n=i.length;t<n;t++)i[t].major&&e.push(t);return e}function Su(i,e,t,n){let s=0,o=t[0],r;for(n=Math.ceil(n),r=0;r<i.length;r++)r===o&&(e.push(i[r]),s++,o=t[s*n])}function kn(i,e,t,n,s){let o=H(n,0),r=Math.min(H(s,i.length),i.length),a=0,l,c,d;for(t=Math.ceil(t),s&&(l=s-n,t=l/Math.floor(l/t)),d=o;d<0;)a++,d=Math.round(o+a*t);for(c=Math.max(o,0);c<r;c++)c===d&&(e.push(i[c]),a++,d=Math.round(o+a*t))}function Iu(i){let e=i.length,t,n;if(e<2)return!1;for(n=i[0],t=1;t<e;++t)if(i[t]-i[t-1]!==n)return!1;return n}var ku=i=>i==="left"?"right":i==="right"?"left":i,Aa=(i,e,t)=>e==="top"||e==="left"?i[e]+t:i[e]-t,Ba=(i,e)=>Math.min(e||i,i);function Va(i,e){let t=[],n=i.length/e,s=i.length,o=0;for(;o<s;o+=n)t.push(i[Math.floor(o)]);return t}function Mu(i,e,t){let n=i.ticks.length,s=Math.min(e,n-1),o=i._startPixel,r=i._endPixel,a=1e-6,l=i.getPixelForTick(s),c;if(!(t&&(n===1?c=Math.max(l-o,r-l):e===0?c=(i.getPixelForTick(1)-l)/2:c=(l-i.getPixelForTick(s-1))/2,l+=s<e?c:-c,l<o-a||l>r+a)))return l}function Tu(i,e){et(i,t=>{let n=t.gc,s=n.length/2,o;if(s>e){for(o=0;o<s;++o)delete t.data[n[o]];n.splice(0,s)}})}function Oi(i){return i.drawTicks?i.tickLength:0}function Ha(i,e){if(!i.display)return 0;let t=yt(i.font,e),n=$t(i.padding);return(lt(i.text)?i.text.length:1)*t.lineHeight+n.height}function Pu(i,e){return be(i,{scale:e,type:"scale"})}function Eu(i,e,t){return be(i,{tick:t,index:e,type:"tick"})}function Du(i,e,t){let n=bn(i);return(t&&e!=="right"||!t&&e==="right")&&(n=ku(n)),n}function $u(i,e,t,n){let{top:s,left:o,bottom:r,right:a,chart:l}=i,{chartArea:c,scales:d}=l,h=0,u,p,b,g=r-s,_=a-o;if(i.isHorizontal()){if(p=Dt(n,o,a),q(t)){let C=Object.keys(t)[0],v=t[C];b=d[C].getPixelForValue(v)+g-e}else t==="center"?b=(c.bottom+c.top)/2+g-e:b=Aa(i,t,e);u=a-o}else{if(q(t)){let C=Object.keys(t)[0],v=t[C];p=d[C].getPixelForValue(v)-_+e}else t==="center"?p=(c.left+c.right)/2-_+e:p=Aa(i,t,e);b=Dt(n,r,s),h=t==="left"?-ut:ut}return{titleX:p,titleY:b,maxWidth:u,rotation:h}}var Ne=class i extends ee{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,t){return e}getUserBounds(){let{_userMin:e,_userMax:t,_suggestedMin:n,_suggestedMax:s}=this;return e=Vt(e,Number.POSITIVE_INFINITY),t=Vt(t,Number.NEGATIVE_INFINITY),n=Vt(n,Number.POSITIVE_INFINITY),s=Vt(s,Number.NEGATIVE_INFINITY),{min:Vt(e,n),max:Vt(t,s),minDefined:ht(e),maxDefined:ht(t)}}getMinMax(e){let{min:t,max:n,minDefined:s,maxDefined:o}=this.getUserBounds(),r;if(s&&o)return{min:t,max:n};let a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)r=a[l].controller.getMinMax(this,e),s||(t=Math.min(t,r.min)),o||(n=Math.max(n,r.max));return t=o&&t>n?n:t,n=s&&t>n?t:n,{min:Vt(t,Vt(n,t)),max:Vt(n,Vt(t,n))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){let e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){nt(this.options.beforeUpdate,[this])}update(e,t,n){let{beginAtZero:s,grace:o,ticks:r}=this.options,a=r.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=t,this._margins=n=Object.assign({left:0,right:0,top:0,bottom:0},n),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+n.left+n.right:this.height+n.top+n.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=ua(this,o,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();let l=a<this.ticks.length;this._convertTicksToLabels(l?Va(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||r.source==="auto")&&(this.ticks=yu(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,t,n;this.isHorizontal()?(t=this.left,n=this.right):(t=this.top,n=this.bottom,e=!e),this._startPixel=t,this._endPixel=n,this._reversePixels=e,this._length=n-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){nt(this.options.afterUpdate,[this])}beforeSetDimensions(){nt(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){nt(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),nt(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){nt(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){let t=this.options.ticks,n,s,o;for(n=0,s=e.length;n<s;n++)o=e[n],o.label=nt(t.callback,[o.value,n,e],this)}afterTickToLabelConversion(){nt(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){nt(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){let e=this.options,t=e.ticks,n=Ba(this.ticks.length,e.ticks.maxTicksLimit),s=t.minRotation||0,o=t.maxRotation,r=s,a,l,c;if(!this._isVisible()||!t.display||s>=o||n<=1||!this.isHorizontal()){this.labelRotation=s;return}let d=this._getLabelSizes(),h=d.widest.width,u=d.highest.height,p=It(this.chart.width-h,0,this.maxWidth);a=e.offset?this.maxWidth/n:p/(n-1),h+6>a&&(a=p/(n-(e.offset?.5:1)),l=this.maxHeight-Oi(e.grid)-t.padding-Ha(e.title,this.chart.options.font),c=Math.sqrt(h*h+u*u),r=gn(Math.min(Math.asin(It((d.highest.height+6)/a,-1,1)),Math.asin(It(l/c,-1,1))-Math.asin(It(u/c,-1,1)))),r=Math.max(s,Math.min(o,r))),this.labelRotation=r}afterCalculateLabelRotation(){nt(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){nt(this.options.beforeFit,[this])}fit(){let e={width:0,height:0},{chart:t,options:{ticks:n,title:s,grid:o}}=this,r=this._isVisible(),a=this.isHorizontal();if(r){let l=Ha(s,t.options.font);if(a?(e.width=this.maxWidth,e.height=Oi(o)+l):(e.height=this.maxHeight,e.width=Oi(o)+l),n.display&&this.ticks.length){let{first:c,last:d,widest:h,highest:u}=this._getLabelSizes(),p=n.padding*2,b=Qt(this.labelRotation),g=Math.cos(b),_=Math.sin(b);if(a){let C=n.mirror?0:_*h.width+g*u.height;e.height=Math.min(this.maxHeight,e.height+C+p)}else{let C=n.mirror?0:g*h.width+_*u.height;e.width=Math.min(this.maxWidth,e.width+C+p)}this._calculatePadding(c,d,_,g)}}this._handleMargins(),a?(this.width=this._length=t.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=t.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,t,n,s){let{ticks:{align:o,padding:r},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){let d=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1),u=0,p=0;l?c?(u=s*e.width,p=n*t.height):(u=n*e.height,p=s*t.width):o==="start"?p=t.width:o==="end"?u=e.width:o!=="inner"&&(u=e.width/2,p=t.width/2),this.paddingLeft=Math.max((u-d+r)*this.width/(this.width-d),0),this.paddingRight=Math.max((p-h+r)*this.width/(this.width-h),0)}else{let d=t.height/2,h=e.height/2;o==="start"?(d=0,h=e.height):o==="end"&&(d=t.height,h=0),this.paddingTop=d+r,this.paddingBottom=h+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){nt(this.options.afterFit,[this])}isHorizontal(){let{axis:e,position:t}=this.options;return t==="top"||t==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let t,n;for(t=0,n=e.length;t<n;t++)G(e[t].label)&&(e.splice(t,1),n--,t--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){let t=this.options.ticks.sampleSize,n=this.ticks;t<n.length&&(n=Va(n,t)),this._labelSizes=e=this._computeLabelSizes(n,n.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,t,n){let{ctx:s,_longestTextCache:o}=this,r=[],a=[],l=Math.floor(t/Ba(t,n)),c=0,d=0,h,u,p,b,g,_,C,v,M,E,I;for(h=0;h<t;h+=l){if(b=e[h].label,g=this._resolveTickFontOptions(h),s.font=_=g.string,C=o[_]=o[_]||{data:{},gc:[]},v=g.lineHeight,M=E=0,!G(b)&&!lt(b))M=Ii(s,C.data,C.gc,M,b),E=v;else if(lt(b))for(u=0,p=b.length;u<p;++u)I=b[u],!G(I)&&!lt(I)&&(M=Ii(s,C.data,C.gc,M,I),E+=v);r.push(M),a.push(E),c=Math.max(M,c),d=Math.max(E,d)}Tu(o,t);let P=r.indexOf(c),L=a.indexOf(d),O=F=>({width:r[F]||0,height:a[F]||0});return{first:O(0),last:O(t-1),widest:O(P),highest:O(L),widths:r,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,t){return NaN}getValueForPixel(e){}getPixelForTick(e){let t=this.ticks;return e<0||e>t.length-1?null:this.getPixelForValue(t[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);let t=this._startPixel+e*this._length;return ea(this._alignToPixels?Me(this.chart,t,0):t)}getDecimalForPixel(e){let t=(e-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){let{min:e,max:t}=this;return e<0&&t<0?t:e>0&&t>0?e:0}getContext(e){let t=this.ticks||[];if(e>=0&&e<t.length){let n=t[e];return n.$context||(n.$context=Eu(this.getContext(),e,n))}return this.$context||(this.$context=Pu(this.chart.getContext(),this))}_tickSize(){let e=this.options.ticks,t=Qt(this.labelRotation),n=Math.abs(Math.cos(t)),s=Math.abs(Math.sin(t)),o=this._getLabelSizes(),r=e.autoSkipPadding||0,a=o?o.widest.width+r:0,l=o?o.highest.height+r:0;return this.isHorizontal()?l*n>a*s?a/n:l/s:l*s<a*n?l/n:a/s}_isVisible(){let e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){let t=this.axis,n=this.chart,s=this.options,{grid:o,position:r,border:a}=s,l=o.offset,c=this.isHorizontal(),h=this.ticks.length+(l?1:0),u=Oi(o),p=[],b=a.setContext(this.getContext()),g=b.display?b.width:0,_=g/2,C=function(dt){return Me(n,dt,g)},v,M,E,I,P,L,O,F,U,N,K,Tt;if(r==="top")v=C(this.bottom),L=this.bottom-u,F=v-_,N=C(e.top)+_,Tt=e.bottom;else if(r==="bottom")v=C(this.top),N=e.top,Tt=C(e.bottom)-_,L=v+_,F=this.top+u;else if(r==="left")v=C(this.right),P=this.right-u,O=v-_,U=C(e.left)+_,K=e.right;else if(r==="right")v=C(this.left),U=e.left,K=C(e.right)-_,P=v+_,O=this.left+u;else if(t==="x"){if(r==="center")v=C((e.top+e.bottom)/2+.5);else if(q(r)){let dt=Object.keys(r)[0],pt=r[dt];v=C(this.chart.scales[dt].getPixelForValue(pt))}N=e.top,Tt=e.bottom,L=v+_,F=L+u}else if(t==="y"){if(r==="center")v=C((e.left+e.right)/2);else if(q(r)){let dt=Object.keys(r)[0],pt=r[dt];v=C(this.chart.scales[dt].getPixelForValue(pt))}P=v-_,O=P-u,U=e.left,K=e.right}let jt=H(s.ticks.maxTicksLimit,h),it=Math.max(1,Math.ceil(h/jt));for(M=0;M<h;M+=it){let dt=this.getContext(M),pt=o.setContext(dt),Zt=a.setContext(dt),Ot=pt.lineWidth,je=pt.color,Vi=Zt.dash||[],Ue=Zt.dashOffset,ci=pt.tickWidth,Oe=pt.tickColor,di=pt.tickBorderDash||[],We=pt.tickBorderDashOffset;E=Mu(this,M,l),E!==void 0&&(I=Me(n,E,Ot),c?P=O=U=K=I:L=F=N=Tt=I,p.push({tx1:P,ty1:L,tx2:O,ty2:F,x1:U,y1:N,x2:K,y2:Tt,width:Ot,color:je,borderDash:Vi,borderDashOffset:Ue,tickWidth:ci,tickColor:Oe,tickBorderDash:di,tickBorderDashOffset:We}))}return this._ticksLength=h,this._borderValue=v,p}_computeLabelItems(e){let t=this.axis,n=this.options,{position:s,ticks:o}=n,r=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:d,mirror:h}=o,u=Oi(n.grid),p=u+d,b=h?-d:p,g=-Qt(this.labelRotation),_=[],C,v,M,E,I,P,L,O,F,U,N,K,Tt="middle";if(s==="top")P=this.bottom-b,L=this._getXAxisLabelAlignment();else if(s==="bottom")P=this.top+b,L=this._getXAxisLabelAlignment();else if(s==="left"){let it=this._getYAxisLabelAlignment(u);L=it.textAlign,I=it.x}else if(s==="right"){let it=this._getYAxisLabelAlignment(u);L=it.textAlign,I=it.x}else if(t==="x"){if(s==="center")P=(e.top+e.bottom)/2+p;else if(q(s)){let it=Object.keys(s)[0],dt=s[it];P=this.chart.scales[it].getPixelForValue(dt)+p}L=this._getXAxisLabelAlignment()}else if(t==="y"){if(s==="center")I=(e.left+e.right)/2-p;else if(q(s)){let it=Object.keys(s)[0],dt=s[it];I=this.chart.scales[it].getPixelForValue(dt)}L=this._getYAxisLabelAlignment(u).textAlign}t==="y"&&(l==="start"?Tt="top":l==="end"&&(Tt="bottom"));let jt=this._getLabelSizes();for(C=0,v=a.length;C<v;++C){M=a[C],E=M.label;let it=o.setContext(this.getContext(C));O=this.getPixelForTick(C)+o.labelOffset,F=this._resolveTickFontOptions(C),U=F.lineHeight,N=lt(E)?E.length:1;let dt=N/2,pt=it.color,Zt=it.textStrokeColor,Ot=it.textStrokeWidth,je=L;r?(I=O,L==="inner"&&(C===v-1?je=this.options.reverse?"left":"right":C===0?je=this.options.reverse?"right":"left":je="center"),s==="top"?c==="near"||g!==0?K=-N*U+U/2:c==="center"?K=-jt.highest.height/2-dt*U+U:K=-jt.highest.height+U/2:c==="near"||g!==0?K=U/2:c==="center"?K=jt.highest.height/2-dt*U:K=jt.highest.height-N*U,h&&(K*=-1),g!==0&&!it.showLabelBackdrop&&(I+=U/2*Math.sin(g))):(P=O,K=(1-N)*U/2);let Vi;if(it.showLabelBackdrop){let Ue=$t(it.backdropPadding),ci=jt.heights[C],Oe=jt.widths[C],di=K-Ue.top,We=0-Ue.left;switch(Tt){case"middle":di-=ci/2;break;case"bottom":di-=ci;break}switch(L){case"center":We-=Oe/2;break;case"right":We-=Oe;break;case"inner":C===v-1?We-=Oe:C>0&&(We-=Oe/2);break}Vi={left:We,top:di,width:Oe+Ue.width,height:ci+Ue.height,color:it.backdropColor}}_.push({label:E,font:F,textOffset:K,options:{rotation:g,color:pt,strokeColor:Zt,strokeWidth:Ot,textAlign:je,textBaseline:Tt,translation:[I,P],backdrop:Vi}})}return _}_getXAxisLabelAlignment(){let{position:e,ticks:t}=this.options;if(-Qt(this.labelRotation))return e==="top"?"left":"right";let s="center";return t.align==="start"?s="left":t.align==="end"?s="right":t.align==="inner"&&(s="inner"),s}_getYAxisLabelAlignment(e){let{position:t,ticks:{crossAlign:n,mirror:s,padding:o}}=this.options,r=this._getLabelSizes(),a=e+o,l=r.widest.width,c,d;return t==="left"?s?(d=this.right+o,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d+=l)):(d=this.right-a,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d=this.left)):t==="right"?s?(d=this.left+o,n==="near"?c="right":n==="center"?(c="center",d-=l/2):(c="left",d-=l)):(d=this.left+a,n==="near"?c="left":n==="center"?(c="center",d+=l/2):(c="right",d=this.right)):c="right",{textAlign:c,x:d}}_computeLabelArea(){if(this.options.ticks.mirror)return;let e=this.chart,t=this.options.position;if(t==="left"||t==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(t==="top"||t==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){let{ctx:e,options:{backgroundColor:t},left:n,top:s,width:o,height:r}=this;t&&(e.save(),e.fillStyle=t,e.fillRect(n,s,o,r),e.restore())}getLineWidthForValue(e){let t=this.options.grid;if(!this._isVisible()||!t.display)return 0;let s=this.ticks.findIndex(o=>o.value===e);return s>=0?t.setContext(this.getContext(s)).lineWidth:0}drawGrid(e){let t=this.options.grid,n=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e)),o,r,a=(l,c,d)=>{!d.width||!d.color||(n.save(),n.lineWidth=d.width,n.strokeStyle=d.color,n.setLineDash(d.borderDash||[]),n.lineDashOffset=d.borderDashOffset,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(c.x,c.y),n.stroke(),n.restore())};if(t.display)for(o=0,r=s.length;o<r;++o){let l=s[o];t.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),t.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){let{chart:e,ctx:t,options:{border:n,grid:s}}=this,o=n.setContext(this.getContext()),r=n.display?o.width:0;if(!r)return;let a=s.setContext(this.getContext(0)).lineWidth,l=this._borderValue,c,d,h,u;this.isHorizontal()?(c=Me(e,this.left,r)-r/2,d=Me(e,this.right,a)+a/2,h=u=l):(h=Me(e,this.top,r)-r/2,u=Me(e,this.bottom,a)+a/2,c=d=l),t.save(),t.lineWidth=o.width,t.strokeStyle=o.color,t.beginPath(),t.moveTo(c,h),t.lineTo(d,u),t.stroke(),t.restore()}drawLabels(e){if(!this.options.ticks.display)return;let n=this.ctx,s=this._computeLabelArea();s&&Ti(n,s);let o=this.getLabelItems(e);for(let r of o){let a=r.options,l=r.font,c=r.label,d=r.textOffset;Te(n,c,0,d,l,a)}s&&Pi(n)}drawTitle(){let{ctx:e,options:{position:t,title:n,reverse:s}}=this;if(!n.display)return;let o=yt(n.font),r=$t(n.padding),a=n.align,l=o.lineHeight/2;t==="bottom"||t==="center"||q(t)?(l+=r.bottom,lt(n.text)&&(l+=o.lineHeight*(n.text.length-1))):l+=r.top;let{titleX:c,titleY:d,maxWidth:h,rotation:u}=$u(this,l,t,a);Te(e,n.text,0,0,o,{color:n.color,maxWidth:h,rotation:u,textAlign:Du(a,t,s),textBaseline:"middle",translation:[c,d]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){let e=this.options,t=e.ticks&&e.ticks.z||0,n=H(e.grid&&e.grid.z,-1),s=H(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==i.prototype.draw?[{z:t,draw:o=>{this.draw(o)}}]:[{z:n,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:t,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(e){let t=this.chart.getSortedVisibleDatasetMetas(),n=this.axis+"AxisID",s=[],o,r;for(o=0,r=t.length;o<r;++o){let a=t[o];a[n]===this.id&&(!e||a.type===e)&&s.push(a)}return s}_resolveTickFontOptions(e){let t=this.options.ticks.setContext(this.getContext(e));return yt(t.font)}_maxDigits(){let e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}},ai=class{constructor(e,t,n){this.type=e,this.scope=t,this.override=n,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){let t=Object.getPrototypeOf(e),n;Lu(t)&&(n=this.register(t));let s=this.items,o=e.id,r=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+e);return o in s||(s[o]=e,Ou(e,r,n),this.override&&st.override(e.id,e.overrides)),r}get(e){return this.items[e]}unregister(e){let t=this.items,n=e.id,s=this.scope;n in t&&delete t[n],s&&n in st[s]&&(delete st[s][n],this.override&&delete ke[n])}};function Ou(i,e,t){let n=Qe(Object.create(null),[t?st.get(t):{},st.get(e),i.defaults]);st.set(e,n),i.defaultRoutes&&Wu(e,i.defaultRoutes),i.descriptors&&st.describe(e,i.descriptors)}function Wu(i,e){Object.keys(e).forEach(t=>{let n=t.split("."),s=n.pop(),o=[i].concat(n).join("."),r=e[t].split("."),a=r.pop(),l=r.join(".");st.route(o,s,l,a)})}function Lu(i){return"id"in i&&"defaults"in i}var oo=class{constructor(){this.controllers=new ai($e,"datasets",!0),this.elements=new ai(ee,"elements"),this.plugins=new ai(Object,"plugins"),this.scales=new ai(Ne,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,t,n){[...t].forEach(s=>{let o=n||this._getRegistryForType(s);n||o.isForType(s)||o===this.plugins&&s.id?this._exec(e,o,s):et(s,r=>{let a=n||this._getRegistryForType(r);this._exec(e,a,r)})})}_exec(e,t,n){let s=fn(e);nt(n["before"+s],[],n),t[e](n),nt(n["after"+s],[],n)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){let n=this._typedRegistries[t];if(n.isForType(e))return n}return this.plugins}_get(e,t,n){let s=t.get(e);if(s===void 0)throw new Error('"'+e+'" is not a registered '+n+".");return s}},ce=new oo,ro=class{constructor(){this._init=[]}notify(e,t,n,s){t==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));let o=s?this._descriptors(e).filter(s):this._descriptors(e),r=this._notify(o,e,t,n);return t==="afterDestroy"&&(this._notify(o,e,"stop"),this._notify(this._init,e,"uninstall")),r}_notify(e,t,n,s){s=s||{};for(let o of e){let r=o.plugin,a=r[n],l=[t,s,o.options];if(nt(a,l,r)===!1&&s.cancelable)return!1}return!0}invalidate(){G(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;let t=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),t}_createDescriptors(e,t){let n=e&&e.config,s=H(n.options&&n.options.plugins,{}),o=zu(n);return s===!1&&!t?[]:Fu(e,o,s,t)}_notifyStateChanges(e){let t=this._oldCache||[],n=this._cache,s=(o,r)=>o.filter(a=>!r.some(l=>a.plugin.id===l.plugin.id));this._notify(s(t,n),e,"stop"),this._notify(s(n,t),e,"start")}};function zu(i){let e={},t=[],n=Object.keys(ce.plugins.items);for(let o=0;o<n.length;o++)t.push(ce.getPlugin(n[o]));let s=i.plugins||[];for(let o=0;o<s.length;o++){let r=s[o];t.indexOf(r)===-1&&(t.push(r),e[r.id]=!0)}return{plugins:t,localIds:e}}function Ru(i,e){return!e&&i===!1?null:i===!0?{}:i}function Fu(i,{plugins:e,localIds:t},n,s){let o=[],r=i.getContext();for(let a of e){let l=a.id,c=Ru(n[l],s);c!==null&&o.push({plugin:a,options:Au(i.config,{plugin:a,local:t[l]},c,r)})}return o}function Au(i,{plugin:e,local:t},n,s){let o=i.pluginScopeKeys(e),r=i.getOptionScopes(n,o);return t&&e.defaults&&r.push(e.defaults),i.createResolver(r,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ao(i,e){let t=st.datasets[i]||{};return((e.datasets||{})[i]||{}).indexAxis||e.indexAxis||t.indexAxis||"x"}function Bu(i,e){let t=i;return i==="_index_"?t=e:i==="_value_"&&(t=e==="x"?"y":"x"),t}function Vu(i,e){return i===e?"_index_":"_value_"}function Na(i){if(i==="x"||i==="y"||i==="r")return i}function Hu(i){if(i==="top"||i==="bottom")return"x";if(i==="left"||i==="right")return"y"}function lo(i,...e){if(Na(i))return i;for(let t of e){let n=t.axis||Hu(t.position)||i.length>1&&Na(i[0].toLowerCase());if(n)return n}throw new Error(`Cannot determine type of '${i}' axis. Please provide 'axis' or 'position' option.`)}function ja(i,e,t){if(t[e+"AxisID"]===i)return{axis:e}}function Nu(i,e){if(e.data&&e.data.datasets){let t=e.data.datasets.filter(n=>n.xAxisID===i||n.yAxisID===i);if(t.length)return ja(i,"x",t[0])||ja(i,"y",t[0])}return{}}function ju(i,e){let t=ke[i.type]||{scales:{}},n=e.scales||{},s=ao(i.type,e),o=Object.create(null);return Object.keys(n).forEach(r=>{let a=n[r];if(!q(a))return console.error(`Invalid scale configuration for scale: ${r}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${r}`);let l=lo(r,a,Nu(r,i),st.scales[a.type]),c=Vu(l,s),d=t.scales||{};o[r]=Ze(Object.create(null),[{axis:l},a,d[l],d[c]])}),i.data.datasets.forEach(r=>{let a=r.type||i.type,l=r.indexAxis||ao(a,e),d=(ke[a]||{}).scales||{};Object.keys(d).forEach(h=>{let u=Bu(h,l),p=r[u+"AxisID"]||u;o[p]=o[p]||Object.create(null),Ze(o[p],[{axis:u},n[p],d[h]])})}),Object.keys(o).forEach(r=>{let a=o[r];Ze(a,[st.scales[a.type],st.scale])}),o}function Dl(i){let e=i.options||(i.options={});e.plugins=H(e.plugins,{}),e.scales=ju(i,e)}function $l(i){return i=i||{},i.datasets=i.datasets||[],i.labels=i.labels||[],i}function Uu(i){return i=i||{},i.data=$l(i.data),Dl(i),i}var Ua=new Map,Ol=new Set;function Mn(i,e){let t=Ua.get(i);return t||(t=e(),Ua.set(i,t),Ol.add(t)),t}var Wi=(i,e,t)=>{let n=me(e,t);n!==void 0&&i.add(n)},co=class{constructor(e){this._config=Uu(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=$l(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){let e=this._config;this.clearCache(),Dl(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return Mn(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,t){return Mn(`${e}.transition.${t}`,()=>[[`datasets.${e}.transitions.${t}`,`transitions.${t}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,t){return Mn(`${e}-${t}`,()=>[[`datasets.${e}.elements.${t}`,`datasets.${e}`,`elements.${t}`,""]])}pluginScopeKeys(e){let t=e.id,n=this.type;return Mn(`${n}-plugin-${t}`,()=>[[`plugins.${t}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,t){let n=this._scopeCache,s=n.get(e);return(!s||t)&&(s=new Map,n.set(e,s)),s}getOptionScopes(e,t,n){let{options:s,type:o}=this,r=this._cachedScopes(e,n),a=r.get(t);if(a)return a;let l=new Set;t.forEach(d=>{e&&(l.add(e),d.forEach(h=>Wi(l,e,h))),d.forEach(h=>Wi(l,s,h)),d.forEach(h=>Wi(l,ke[o]||{},h)),d.forEach(h=>Wi(l,st,h)),d.forEach(h=>Wi(l,xn,h))});let c=Array.from(l);return c.length===0&&c.push(Object.create(null)),Ol.has(t)&&r.set(t,c),c}chartOptionScopes(){let{options:e,type:t}=this;return[e,ke[t]||{},st.datasets[t]||{},{type:t},st,xn]}resolveNamedOptions(e,t,n,s=[""]){let o={$shared:!0},{resolver:r,subPrefixes:a}=Ya(this._resolverCache,e,s),l=r;if(Xu(r,t)){o.$shared=!1,n=fe(n)?n():n;let c=this.createResolver(e,n,a);l=Fe(r,n,c)}for(let c of t)o[c]=l[c];return o}createResolver(e,t,n=[""],s){let{resolver:o}=Ya(this._resolverCache,e,n);return q(t)?Fe(o,t,void 0,s):o}};function Ya(i,e,t){let n=i.get(e);n||(n=new Map,i.set(e,n));let s=t.join(),o=n.get(s);return o||(o={resolver:Cn(e,t),subPrefixes:t.filter(a=>!a.toLowerCase().includes("hover"))},n.set(s,o)),o}var Yu=i=>q(i)&&Object.getOwnPropertyNames(i).some(e=>fe(i[e]));function Xu(i,e){let{isScriptable:t,isIndexable:n}=$s(i);for(let s of e){let o=t(s),r=n(s),a=(r||o)&&i[s];if(o&&(fe(a)||Yu(a))||r&&lt(a))return!0}return!1}var Gu="4.5.0",qu=["top","bottom","left","right","chartArea"];function Xa(i,e){return i==="top"||i==="bottom"||qu.indexOf(i)===-1&&e==="x"}function Ga(i,e){return function(t,n){return t[i]===n[i]?t[e]-n[e]:t[i]-n[i]}}function qa(i){let e=i.chart,t=e.options.animation;e.notifyPlugins("afterRender"),nt(t&&t.onComplete,[i],e)}function Ku(i){let e=i.chart,t=e.options.animation;nt(t&&t.onProgress,[i],e)}function Wl(i){return wn()&&typeof i=="string"?i=document.getElementById(i):i&&i.length&&(i=i[0]),i&&i.canvas&&(i=i.canvas),i}var $n={},Ka=i=>{let e=Wl(i);return Object.values($n).filter(t=>t.canvas===e).pop()};function Qu(i,e,t){let n=Object.keys(i);for(let s of n){let o=+s;if(o>=e){let r=i[s];delete i[s],(t>0||o>e)&&(i[o+t]=r)}}}function Ju(i,e,t,n){return!t||i.type==="mouseout"?null:n?e:i}var An=(()=>{class i{static defaults=st;static instances=$n;static overrides=ke;static registry=ce;static version=Gu;static getChart=Ka;static register(...t){ce.add(...t),Qa()}static unregister(...t){ce.remove(...t),Qa()}constructor(t,n){let s=this.config=new co(n),o=Wl(t),r=Ka(o);if(r)throw new Error("Canvas is already in use. Chart with ID '"+r.id+"' must be destroyed before the canvas with ID '"+r.canvas.id+"' can be reused.");let a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||_u(o)),this.platform.updateConfig(s);let l=this.platform.acquireContext(o,a.aspectRatio),c=l&&l.canvas,d=c&&c.height,h=c&&c.width;if(this.id=qr(),this.ctx=l,this.canvas=c,this.width=h,this.height=d,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ro,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=ra(u=>this.update(u),a.resizeDelay||0),this._dataChanges=[],$n[this.id]=this,!l||!c){console.error("Failed to create chart: can't acquire context from the given item");return}xe.listen(this,"complete",qa),xe.listen(this,"progress",Ku),this._initialize(),this.attached&&this.update()}get aspectRatio(){let{options:{aspectRatio:t,maintainAspectRatio:n},width:s,height:o,_aspectRatio:r}=this;return G(t)?n&&r?r:o?s/o:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ce}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():zs(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Ps(this.canvas,this.ctx),this}stop(){return xe.stop(this),this}resize(t,n){xe.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){let s=this.options,o=this.canvas,r=s.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(o,t,n,r),l=s.devicePixelRatio||this.platform.getDevicePixelRatio(),c=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,zs(this,l,!0)&&(this.notifyPlugins("resize",{size:a}),nt(s.onResize,[this,a],this),this.attached&&this._doResize(c)&&this.render())}ensureScalesHaveIDs(){let n=this.options.scales||{};et(n,(s,o)=>{s.id=o})}buildOrUpdateScales(){let t=this.options,n=t.scales,s=this.scales,o=Object.keys(s).reduce((a,l)=>(a[l]=!1,a),{}),r=[];n&&(r=r.concat(Object.keys(n).map(a=>{let l=n[a],c=lo(a,l),d=c==="r",h=c==="x";return{options:l,dposition:d?"chartArea":h?"bottom":"left",dtype:d?"radialLinear":h?"category":"linear"}}))),et(r,a=>{let l=a.options,c=l.id,d=lo(c,l),h=H(l.type,a.dtype);(l.position===void 0||Xa(l.position,d)!==Xa(a.dposition))&&(l.position=a.dposition),o[c]=!0;let u=null;if(c in s&&s[c].type===h)u=s[c];else{let p=ce.getScale(h);u=new p({id:c,type:h,ctx:this.ctx,chart:this}),s[u.id]=u}u.init(l,t)}),et(o,(a,l)=>{a||delete s[l]}),et(s,a=>{Ft.configure(this,a,a.options),Ft.addBox(this,a)})}_updateMetasets(){let t=this._metasets,n=this.data.datasets.length,s=t.length;if(t.sort((o,r)=>o.index-r.index),s>n){for(let o=n;o<s;++o)this._destroyDatasetMeta(o);t.splice(n,s-n)}this._sortedMetasets=t.slice(0).sort(Ga("order","index"))}_removeUnreferencedMetasets(){let{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((s,o)=>{n.filter(r=>r===s._dataset).length===0&&this._destroyDatasetMeta(o)})}buildOrUpdateControllers(){let t=[],n=this.data.datasets,s,o;for(this._removeUnreferencedMetasets(),s=0,o=n.length;s<o;s++){let r=n[s],a=this.getDatasetMeta(s),l=r.type||this.config.type;if(a.type&&a.type!==l&&(this._destroyDatasetMeta(s),a=this.getDatasetMeta(s)),a.type=l,a.indexAxis=r.indexAxis||ao(l,this.options),a.order=r.order||0,a.index=s,a.label=""+r.label,a.visible=this.isDatasetVisible(s),a.controller)a.controller.updateIndex(s),a.controller.linkScales();else{let c=ce.getController(l),{datasetElementType:d,dataElementType:h}=st.datasets[l];Object.assign(c,{dataElementType:ce.getElement(h),datasetElementType:d&&ce.getElement(d)}),a.controller=new c(this,s),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){et(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){let n=this.config;n.update();let s=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),o=this._animationsDisabled=!s.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})===!1)return;let r=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let d=0,h=this.data.datasets.length;d<h;d++){let{controller:u}=this.getDatasetMeta(d),p=!o&&r.indexOf(u)===-1;u.buildOrUpdateElements(p),a=Math.max(+u.getMaxOverflow(),a)}a=this._minPadding=s.layout.autoPadding?a:0,this._updateLayout(a),o||et(r,d=>{d.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ga("z","_idx"));let{_active:l,_lastEvent:c}=this;c?this._eventHandler(c,!0):l.length&&this._updateHoverStyles(l,l,!0),this.render()}_updateScales(){et(this.scales,t=>{Ft.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){let t=this.options,n=new Set(Object.keys(this._listeners)),s=new Set(t.events);(!ms(n,s)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){let{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(let{method:s,start:o,count:r}of n){let a=s==="_removeElements"?-r:r;Qu(t,o,a)}}_getUniformDataChanges(){let t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];let n=this.data.datasets.length,s=r=>new Set(t.filter(a=>a[0]===r).map((a,l)=>l+","+a.splice(1).join(","))),o=s(0);for(let r=1;r<n;r++)if(!ms(o,s(r)))return;return Array.from(o).map(r=>r.split(",")).map(r=>({method:r[1],start:+r[2],count:+r[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Ft.update(this,this.width,this.height,t);let n=this.chartArea,s=n.width<=0||n.height<=0;this._layers=[],et(this.boxes,o=>{s&&o.position==="chartArea"||(o.configure&&o.configure(),this._layers.push(...o._layers()))},this),this._layers.forEach((o,r)=>{o._idx=r}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})!==!1){for(let n=0,s=this.data.datasets.length;n<s;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,s=this.data.datasets.length;n<s;++n)this._updateDataset(n,fe(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){let s=this.getDatasetMeta(t),o={meta:s,index:t,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",o)!==!1&&(s.controller._update(n),o.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",o))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(xe.has(this)?this.attached&&!xe.running(this)&&xe.start(this):(this.draw(),qa({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){let{width:s,height:o}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(s,o)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;let n=this._layers;for(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){let n=this._sortedMetasets,s=[],o,r;for(o=0,r=n.length;o<r;++o){let a=n[o];(!t||a.visible)&&s.push(a)}return s}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;let t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){let n=this.ctx,s={meta:t,index:t.index,cancelable:!0},o=Hs(this,t);this.notifyPlugins("beforeDatasetDraw",s)!==!1&&(o&&Ti(n,o),t.controller.draw(),o&&Pi(n),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return oe(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,s,o){let r=tu.modes[n];return typeof r=="function"?r(this,t,s,o):[]}getDatasetMeta(t){let n=this.data.datasets[t],s=this._metasets,o=s.filter(r=>r&&r._dataset===n).pop();return o||(o={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:t,_dataset:n,_parsed:[],_sorted:!1},s.push(o)),o}getContext(){return this.$context||(this.$context=be(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){let n=this.data.datasets[t];if(!n)return!1;let s=this.getDatasetMeta(t);return typeof s.hidden=="boolean"?!s.hidden:!n.hidden}setDatasetVisibility(t,n){let s=this.getDatasetMeta(t);s.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,s){let o=s?"show":"hide",r=this.getDatasetMeta(t),a=r.controller._resolveAnimations(void 0,o);ti(n)?(r.data[n].hidden=!s,this.update()):(this.setDatasetVisibility(t,s),a.update(r,{visible:s}),this.update(l=>l.datasetIndex===t?o:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){let n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),xe.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");let{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Ps(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete $n[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){let t=this._listeners,n=this.platform,s=(r,a)=>{n.addEventListener(this,r,a),t[r]=a},o=(r,a,l)=>{r.offsetX=a,r.offsetY=l,this._eventHandler(r)};et(this.options.events,r=>s(r,o))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});let t=this._responsiveListeners,n=this.platform,s=(c,d)=>{n.addEventListener(this,c,d),t[c]=d},o=(c,d)=>{t[c]&&(n.removeEventListener(this,c,d),delete t[c])},r=(c,d)=>{this.canvas&&this.resize(c,d)},a,l=()=>{o("attach",l),this.attached=!0,this.resize(),s("resize",r),s("detach",a)};a=()=>{this.attached=!1,o("resize",r),this._stop(),this._resize(0,0),s("attach",l)},n.isAttached(this.canvas)?l():a()}unbindEvents(){et(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},et(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,s){let o=s?"set":"remove",r,a,l,c;for(n==="dataset"&&(r=this.getDatasetMeta(t[0].datasetIndex),r.controller["_"+o+"DatasetHoverStyle"]()),l=0,c=t.length;l<c;++l){a=t[l];let d=a&&this.getDatasetMeta(a.datasetIndex).controller;d&&d[o+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){let n=this._active||[],s=t.map(({datasetIndex:r,index:a})=>{let l=this.getDatasetMeta(r);if(!l)throw new Error("No dataset found at index "+r);return{datasetIndex:r,element:l.data[a],index:a}});!ki(s,n)&&(this._active=s,this._lastEvent=null,this._updateHoverStyles(s,n))}notifyPlugins(t,n,s){return this._plugins.notify(this,t,n,s)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,s){let o=this.options.hover,r=(c,d)=>c.filter(h=>!d.some(u=>h.datasetIndex===u.datasetIndex&&h.index===u.index)),a=r(n,t),l=s?t:r(t,n);a.length&&this.updateHoverStyle(a,o.mode,!1),l.length&&o.mode&&this.updateHoverStyle(l,o.mode,!0)}_eventHandler(t,n){let s={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},o=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",s,o)===!1)return;let r=this._handleEvent(t,n,s.inChartArea);return s.cancelable=!1,this.notifyPlugins("afterEvent",s,o),(r||s.changed)&&this.render(),this}_handleEvent(t,n,s){let{_active:o=[],options:r}=this,a=n,l=this._getActiveElements(t,o,s,a),c=Jr(t),d=Ju(t,this._lastEvent,s,c);s&&(this._lastEvent=null,nt(r.onHover,[t,l,this],this),c&&nt(r.onClick,[t,l,this],this));let h=!ki(l,o);return(h||n)&&(this._active=l,this._updateHoverStyles(l,o,n)),this._lastEvent=d,h}_getActiveElements(t,n,s,o){if(t.type==="mouseout")return[];if(!s)return n;let r=this.options.hover;return this.getElementsAtEventForMode(t,r.mode,r,o)}}return i})();function Qa(){return et(An.instances,i=>i._plugins.invalidate())}function Zu(i,e,t){let{startAngle:n,x:s,y:o,outerRadius:r,innerRadius:a,options:l}=e,{borderWidth:c,borderJoinStyle:d}=l,h=Math.min(c/r,Et(n-t));if(i.beginPath(),i.arc(s,o,r-c/2,n+h/2,t-h/2),a>0){let u=Math.min(c/a,Et(n-t));i.arc(s,o,a+c/2,t-u/2,n+u/2,!0)}else{let u=Math.min(c/2,r*Et(n-t));if(d==="round")i.arc(s,o,u,t-J/2,n+J/2,!0);else if(d==="bevel"){let p=2*u*u,b=-p*Math.cos(t+J/2)+s,g=-p*Math.sin(t+J/2)+o,_=p*Math.cos(n+J/2)+s,C=p*Math.sin(n+J/2)+o;i.lineTo(b,g),i.lineTo(_,C)}}i.closePath(),i.moveTo(0,0),i.rect(0,0,i.canvas.width,i.canvas.height),i.clip("evenodd")}function tp(i,e,t){let{startAngle:n,pixelMargin:s,x:o,y:r,outerRadius:a,innerRadius:l}=e,c=s/a;i.beginPath(),i.arc(o,r,a,n-c,t+c),l>s?(c=s/l,i.arc(o,r,l,t+c,n-c,!0)):i.arc(o,r,s,t+ut,n-ut),i.closePath(),i.clip()}function ep(i){return yn(i,["outerStart","outerEnd","innerStart","innerEnd"])}function ip(i,e,t,n){let s=ep(i.options.borderRadius),o=(t-e)/2,r=Math.min(o,n*e/2),a=l=>{let c=(t-Math.min(o,l))*n/2;return It(l,0,Math.min(o,c))};return{outerStart:a(s.outerStart),outerEnd:a(s.outerEnd),innerStart:It(s.innerStart,0,r),innerEnd:It(s.innerEnd,0,r)}}function ri(i,e,t,n){return{x:t+i*Math.cos(e),y:n+i*Math.sin(e)}}function zn(i,e,t,n,s,o){let{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:d}=e,h=Math.max(e.outerRadius+n+t-c,0),u=d>0?d+n+t+c:0,p=0,b=s-l;if(n){let it=d>0?d-n:0,dt=h>0?h-n:0,pt=(it+dt)/2,Zt=pt!==0?b*pt/(pt+n):b;p=(b-Zt)/2}let g=Math.max(.001,b*h-t/J)/h,_=(b-g)/2,C=l+_+p,v=s-_-p,{outerStart:M,outerEnd:E,innerStart:I,innerEnd:P}=ip(e,u,h,v-C),L=h-M,O=h-E,F=C+M/L,U=v-E/O,N=u+I,K=u+P,Tt=C+I/N,jt=v-P/K;if(i.beginPath(),o){let it=(F+U)/2;if(i.arc(r,a,h,F,it),i.arc(r,a,h,it,U),E>0){let Ot=ri(O,U,r,a);i.arc(Ot.x,Ot.y,E,U,v+ut)}let dt=ri(K,v,r,a);if(i.lineTo(dt.x,dt.y),P>0){let Ot=ri(K,jt,r,a);i.arc(Ot.x,Ot.y,P,v+ut,jt+Math.PI)}let pt=(v-P/u+(C+I/u))/2;if(i.arc(r,a,u,v-P/u,pt,!0),i.arc(r,a,u,pt,C+I/u,!0),I>0){let Ot=ri(N,Tt,r,a);i.arc(Ot.x,Ot.y,I,Tt+Math.PI,C-ut)}let Zt=ri(L,C,r,a);if(i.lineTo(Zt.x,Zt.y),M>0){let Ot=ri(L,F,r,a);i.arc(Ot.x,Ot.y,M,C-ut,F)}}else{i.moveTo(r,a);let it=Math.cos(F)*h+r,dt=Math.sin(F)*h+a;i.lineTo(it,dt);let pt=Math.cos(U)*h+r,Zt=Math.sin(U)*h+a;i.lineTo(pt,Zt)}i.closePath()}function np(i,e,t,n,s){let{fullCircles:o,startAngle:r,circumference:a}=e,l=e.endAngle;if(o){zn(i,e,t,n,l,s);for(let c=0;c<o;++c)i.fill();isNaN(a)||(l=r+(a%ct||ct))}return zn(i,e,t,n,l,s),i.fill(),l}function sp(i,e,t,n,s){let{fullCircles:o,startAngle:r,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:d,borderDash:h,borderDashOffset:u,borderRadius:p}=l,b=l.borderAlign==="inner";if(!c)return;i.setLineDash(h||[]),i.lineDashOffset=u,b?(i.lineWidth=c*2,i.lineJoin=d||"round"):(i.lineWidth=c,i.lineJoin=d||"bevel");let g=e.endAngle;if(o){zn(i,e,t,n,g,s);for(let _=0;_<o;++_)i.stroke();isNaN(a)||(g=r+(a%ct||ct))}b&&tp(i,e,g),l.selfJoin&&g-r>=J&&p===0&&d!=="miter"&&Zu(i,e,g),o||(zn(i,e,t,n,g,s),i.stroke())}var ho=class extends ee{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:e=>e!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(e){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,e&&Object.assign(this,e)}inRange(e,t,n){let s=this.getProps(["x","y"],n),{angle:o,distance:r}=ys(s,{x:e,y:t}),{startAngle:a,endAngle:l,innerRadius:c,outerRadius:d,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],n),u=(this.options.spacing+this.options.borderWidth)/2,p=H(h,l-a),b=ii(o,a,l)&&a!==l,g=p>=ct||b,_=ae(r,c+u,d+u);return g&&_}getCenterPoint(e){let{x:t,y:n,startAngle:s,endAngle:o,innerRadius:r,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],e),{offset:l,spacing:c}=this.options,d=(s+o)/2,h=(r+a+c+l)/2;return{x:t+Math.cos(d)*h,y:n+Math.sin(d)*h}}tooltipPosition(e){return this.getCenterPoint(e)}draw(e){let{options:t,circumference:n}=this,s=(t.offset||0)/4,o=(t.spacing||0)/2,r=t.circular;if(this.pixelMargin=t.borderAlign==="inner"?.33:0,this.fullCircles=n>ct?Math.floor(n/ct):0,n===0||this.innerRadius<0||this.outerRadius<0)return;e.save();let a=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(a)*s,Math.sin(a)*s);let l=1-Math.sin(Math.min(J,n||0)),c=s*l;e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor,np(e,this,c,o,r),sp(e,this,c,o,r),e.restore()}};function Ll(i,e,t=e){i.lineCap=H(t.borderCapStyle,e.borderCapStyle),i.setLineDash(H(t.borderDash,e.borderDash)),i.lineDashOffset=H(t.borderDashOffset,e.borderDashOffset),i.lineJoin=H(t.borderJoinStyle,e.borderJoinStyle),i.lineWidth=H(t.borderWidth,e.borderWidth),i.strokeStyle=H(t.borderColor,e.borderColor)}function op(i,e,t){i.lineTo(t.x,t.y)}function rp(i){return i.stepped?da:i.tension||i.cubicInterpolationMode==="monotone"?ha:op}function zl(i,e,t={}){let n=i.length,{start:s=0,end:o=n-1}=t,{start:r,end:a}=e,l=Math.max(s,r),c=Math.min(o,a),d=s<r&&o<r||s>a&&o>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!d?n+c-l:c-l}}function ap(i,e,t,n){let{points:s,options:o}=e,{count:r,start:a,loop:l,ilen:c}=zl(s,t,n),d=rp(o),{move:h=!0,reverse:u}=n||{},p,b,g;for(p=0;p<=c;++p)b=s[(a+(u?c-p:p))%r],!b.skip&&(h?(i.moveTo(b.x,b.y),h=!1):d(i,g,b,u,o.stepped),g=b);return l&&(b=s[(a+(u?c:0))%r],d(i,g,b,u,o.stepped)),!!l}function lp(i,e,t,n){let s=e.points,{count:o,start:r,ilen:a}=zl(s,t,n),{move:l=!0,reverse:c}=n||{},d=0,h=0,u,p,b,g,_,C,v=E=>(r+(c?a-E:E))%o,M=()=>{g!==_&&(i.lineTo(d,_),i.lineTo(d,g),i.lineTo(d,C))};for(l&&(p=s[v(0)],i.moveTo(p.x,p.y)),u=0;u<=a;++u){if(p=s[v(u)],p.skip)continue;let E=p.x,I=p.y,P=E|0;P===b?(I<g?g=I:I>_&&(_=I),d=(h*d+E)/++h):(M(),i.lineTo(E,I),b=P,h=0,g=_=I),C=I}M()}function uo(i){let e=i.options,t=e.borderDash&&e.borderDash.length;return!i._decimated&&!i._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!t?lp:ap}function cp(i){return i.stepped?ya:i.tension||i.cubicInterpolationMode==="monotone"?Ca:Ie}function dp(i,e,t,n){let s=e._path;s||(s=e._path=new Path2D,e.path(s,t,n)&&s.closePath()),Ll(i,e.options),i.stroke(s)}function hp(i,e,t,n){let{segments:s,options:o}=e,r=uo(e);for(let a of s)Ll(i,o,a.style),i.beginPath(),r(i,e,a,{start:t,end:t+n-1})&&i.closePath(),i.stroke()}var up=typeof Path2D=="function";function pp(i,e,t,n){up&&!e.options.segment?dp(i,e,t,n):hp(i,e,t,n)}var Bn=(()=>{class i extends ee{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){let s=this.options;if((s.tension||s.cubicInterpolationMode==="monotone")&&!s.stepped&&!this._pointsUpdated){let o=s.spanGaps?this._loop:this._fullLoop;ba(this._points,s,t,o,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=va(this,this.options.segment))}first(){let t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){let t=this.segments,n=this.points,s=t.length;return s&&n[t[s-1].end]}interpolate(t,n){let s=this.options,o=t[n],r=this.points,a=Vs(this,{property:n,start:o,end:o});if(!a.length)return;let l=[],c=cp(s),d,h;for(d=0,h=a.length;d<h;++d){let{start:u,end:p}=a[d],b=r[u],g=r[p];if(b===g){l.push(b);continue}let _=Math.abs((o-b[n])/(g[n]-b[n])),C=c(b,g,_,s.stepped);C[n]=t[n],l.push(C)}return l.length===1?l[0]:l}pathSegment(t,n,s){return uo(this)(t,this,n,s)}path(t,n,s){let o=this.segments,r=uo(this),a=this._loop;n=n||0,s=s||this.points.length-n;for(let l of o)a&=r(t,this,l,{start:n,end:n+s-1});return!!a}draw(t,n,s,o){let r=this.options||{};(this.points||[]).length&&r.borderWidth&&(t.save(),pp(t,this,s,o),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}return i})();function Ja(i,e,t,n){let s=i.options,{[t]:o}=i.getProps([t],n);return Math.abs(e-o)<s.radius+s.hitRadius}var fp=(()=>{class i extends ee{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,s){let o=this.options,{x:r,y:a}=this.getProps(["x","y"],s);return Math.pow(t-r,2)+Math.pow(n-a,2)<Math.pow(o.hitRadius+o.radius,2)}inXRange(t,n){return Ja(this,t,"x",n)}inYRange(t,n){return Ja(this,t,"y",n)}getCenterPoint(t){let{x:n,y:s}=this.getProps(["x","y"],t);return{x:n,y:s}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);let s=n&&t.borderWidth||0;return(n+s)*2}draw(t,n){let s=this.options;this.skip||s.radius<.1||!oe(this,n,this.size(s)/2)||(t.strokeStyle=s.borderColor,t.lineWidth=s.borderWidth,t.fillStyle=s.backgroundColor,_n(t,s,this.x,this.y))}getRange(){let t=this.options||{};return t.radius+t.hitRadius}}return i})();function Rl(i,e){let{x:t,y:n,base:s,width:o,height:r}=i.getProps(["x","y","base","width","height"],e),a,l,c,d,h;return i.horizontal?(h=r/2,a=Math.min(t,s),l=Math.max(t,s),c=n-h,d=n+h):(h=o/2,a=t-h,l=t+h,c=Math.min(n,s),d=Math.max(n,s)),{left:a,top:c,right:l,bottom:d}}function De(i,e,t,n){return i?0:It(e,t,n)}function gp(i,e,t){let n=i.options.borderWidth,s=i.borderSkipped,o=Ds(n);return{t:De(s.top,o.top,0,t),r:De(s.right,o.right,0,e),b:De(s.bottom,o.bottom,0,t),l:De(s.left,o.left,0,e)}}function mp(i,e,t){let{enableBorderRadius:n}=i.getProps(["enableBorderRadius"]),s=i.options.borderRadius,o=Pe(s),r=Math.min(e,t),a=i.borderSkipped,l=n||q(s);return{topLeft:De(!l||a.top||a.left,o.topLeft,0,r),topRight:De(!l||a.top||a.right,o.topRight,0,r),bottomLeft:De(!l||a.bottom||a.left,o.bottomLeft,0,r),bottomRight:De(!l||a.bottom||a.right,o.bottomRight,0,r)}}function bp(i){let e=Rl(i),t=e.right-e.left,n=e.bottom-e.top,s=gp(i,t/2,n/2),o=mp(i,t/2,n/2);return{outer:{x:e.left,y:e.top,w:t,h:n,radius:o},inner:{x:e.left+s.l,y:e.top+s.t,w:t-s.l-s.r,h:n-s.t-s.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(s.t,s.l)),topRight:Math.max(0,o.topRight-Math.max(s.t,s.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(s.b,s.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(s.b,s.r))}}}}function Ks(i,e,t,n){let s=e===null,o=t===null,a=i&&!(s&&o)&&Rl(i,n);return a&&(s||ae(e,a.left,a.right))&&(o||ae(t,a.top,a.bottom))}function xp(i){return i.topLeft||i.topRight||i.bottomLeft||i.bottomRight}function _p(i,e){i.rect(e.x,e.y,e.w,e.h)}function Qs(i,e,t={}){let n=i.x!==t.x?-e:0,s=i.y!==t.y?-e:0,o=(i.x+i.w!==t.x+t.w?e:0)-n,r=(i.y+i.h!==t.y+t.h?e:0)-s;return{x:i.x+n,y:i.y+s,w:i.w+o,h:i.h+r,radius:i.radius}}var po=class extends ee{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){let{inflateAmount:t,options:{borderColor:n,backgroundColor:s}}=this,{inner:o,outer:r}=bp(this),a=xp(r.radius)?si:_p;e.save(),(r.w!==o.w||r.h!==o.h)&&(e.beginPath(),a(e,Qs(r,t,o)),e.clip(),a(e,Qs(o,-t,r)),e.fillStyle=n,e.fill("evenodd")),e.beginPath(),a(e,Qs(o,t)),e.fillStyle=s,e.fill(),e.restore()}inRange(e,t,n){return Ks(this,e,t,n)}inXRange(e,t){return Ks(this,e,null,t)}inYRange(e,t){return Ks(this,null,e,t)}getCenterPoint(e){let{x:t,y:n,base:s,horizontal:o}=this.getProps(["x","y","base","horizontal"],e);return{x:o?(t+s)/2:t,y:o?n:(n+s)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}},yp=Object.freeze({__proto__:null,ArcElement:ho,BarElement:po,LineElement:Bn,PointElement:fp}),fo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Za=fo.map(i=>i.replace("rgb(","rgba(").replace(")",", 0.5)"));function Fl(i){return fo[i%fo.length]}function Al(i){return Za[i%Za.length]}function Cp(i,e){return i.borderColor=Fl(e),i.backgroundColor=Al(e),++e}function wp(i,e){return i.backgroundColor=i.data.map(()=>Fl(e++)),e}function vp(i,e){return i.backgroundColor=i.data.map(()=>Al(e++)),e}function Sp(i){let e=0;return(t,n)=>{let s=i.getDatasetMeta(n).controller;s instanceof wo?e=wp(t,e):s instanceof kl?e=vp(t,e):s&&(e=Cp(t,e))}}function tl(i){let e;for(e in i)if(i[e].borderColor||i[e].backgroundColor)return!0;return!1}function Ip(i){return i&&(i.borderColor||i.backgroundColor)}function kp(){return st.borderColor!=="rgba(0,0,0,0.1)"||st.backgroundColor!=="rgba(0,0,0,0.1)"}var Mp={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(i,e,t){if(!t.enabled)return;let{data:{datasets:n},options:s}=i.config,{elements:o}=s,r=tl(n)||Ip(s)||o&&tl(o)||kp();if(!t.forceOverride&&r)return;let a=Sp(i);n.forEach(a)}};function Tp(i,e,t,n,s){let o=s.samples||n;if(o>=t)return i.slice(e,e+t);let r=[],a=(t-2)/(o-2),l=0,c=e+t-1,d=e,h,u,p,b,g;for(r[l++]=i[d],h=0;h<o-2;h++){let _=0,C=0,v,M=Math.floor((h+1)*a)+1+e,E=Math.min(Math.floor((h+2)*a)+1,t)+e,I=E-M;for(v=M;v<E;v++)_+=i[v].x,C+=i[v].y;_/=I,C/=I;let P=Math.floor(h*a)+1+e,L=Math.min(Math.floor((h+1)*a)+1,t)+e,{x:O,y:F}=i[d];for(p=b=-1,v=P;v<L;v++)b=.5*Math.abs((O-_)*(i[v].y-F)-(O-i[v].x)*(C-F)),b>p&&(p=b,u=i[v],g=v);r[l++]=u,d=g}return r[l++]=i[c],r}function Pp(i,e,t,n){let s=0,o=0,r,a,l,c,d,h,u,p,b,g,_=[],C=e+t-1,v=i[e].x,E=i[C].x-v;for(r=e;r<e+t;++r){a=i[r],l=(a.x-v)/E*n,c=a.y;let I=l|0;if(I===d)c<b?(b=c,h=r):c>g&&(g=c,u=r),s=(o*s+a.x)/++o;else{let P=r-1;if(!G(h)&&!G(u)){let L=Math.min(h,u),O=Math.max(h,u);L!==p&&L!==P&&_.push(de(kt({},i[L]),{x:s})),O!==p&&O!==P&&_.push(de(kt({},i[O]),{x:s}))}r>0&&P!==p&&_.push(i[P]),_.push(a),d=I,o=0,b=g=c,h=u=p=r}}return _}function Bl(i){if(i._decimated){let e=i._data;delete i._decimated,delete i._data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function el(i){i.data.datasets.forEach(e=>{Bl(e)})}function Ep(i,e){let t=e.length,n=0,s,{iScale:o}=i,{min:r,max:a,minDefined:l,maxDefined:c}=o.getUserBounds();return l&&(n=It(se(e,o.axis,r).lo,0,t-1)),c?s=It(se(e,o.axis,a).hi+1,n,t)-n:s=t-n,{start:n,count:s}}var Dp={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,e,t)=>{if(!t.enabled){el(i);return}let n=i.width;i.data.datasets.forEach((s,o)=>{let{_data:r,indexAxis:a}=s,l=i.getDatasetMeta(o),c=r||s.data;if(oi([a,i.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;let d=i.scales[l.xAxisID];if(d.type!=="linear"&&d.type!=="time"||i.options.parsing)return;let{start:h,count:u}=Ep(l,c),p=t.threshold||4*n;if(u<=p){Bl(s);return}G(r)&&(s._data=c,delete s.data,Object.defineProperty(s,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let b;switch(t.algorithm){case"lttb":b=Tp(c,h,u,n,t);break;case"min-max":b=Pp(c,h,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${t.algorithm}'`)}s._decimated=b})},destroy(i){el(i)}};function $p(i,e,t){let n=i.segments,s=i.points,o=e.points,r=[];for(let a of n){let{start:l,end:c}=a;c=Vn(l,c,s);let d=go(t,s[l],s[c],a.loop);if(!e.segments){r.push({source:a,target:d,start:s[l],end:s[c]});continue}let h=Vs(e,d);for(let u of h){let p=go(t,o[u.start],o[u.end],u.loop),b=Bs(a,s,p);for(let g of b)r.push({source:g,target:u,start:{[t]:il(d,p,"start",Math.max)},end:{[t]:il(d,p,"end",Math.min)}})}}return r}function go(i,e,t,n){if(n)return;let s=e[i],o=t[i];return i==="angle"&&(s=Et(s),o=Et(o)),{property:i,start:s,end:o}}function Op(i,e){let{x:t=null,y:n=null}=i||{},s=e.points,o=[];return e.segments.forEach(({start:r,end:a})=>{a=Vn(r,a,s);let l=s[r],c=s[a];n!==null?(o.push({x:l.x,y:n}),o.push({x:c.x,y:n})):t!==null&&(o.push({x:t,y:l.y}),o.push({x:t,y:c.y}))}),o}function Vn(i,e,t){for(;e>i;e--){let n=t[e];if(!isNaN(n.x)&&!isNaN(n.y))break}return e}function il(i,e,t,n){return i&&e?n(i[t],e[t]):i?i[t]:e?e[t]:0}function Vl(i,e){let t=[],n=!1;return lt(i)?(n=!0,t=i):t=Op(i,e),t.length?new Bn({points:t,options:{tension:0},_loop:n,_fullLoop:n}):null}function nl(i){return i&&i.fill!==!1}function Wp(i,e,t){let s=i[e].fill,o=[e],r;if(!t)return s;for(;s!==!1&&o.indexOf(s)===-1;){if(!ht(s))return s;if(r=i[s],!r)return!1;if(r.visible)return s;o.push(s),s=r.fill}return!1}function Lp(i,e,t){let n=Ap(i);if(q(n))return isNaN(n.value)?!1:n;let s=parseFloat(n);return ht(s)&&Math.floor(s)===s?zp(n[0],e,s,t):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function zp(i,e,t,n){return(i==="-"||i==="+")&&(t=e+t),t===e||t<0||t>=n?!1:t}function Rp(i,e){let t=null;return i==="start"?t=e.bottom:i==="end"?t=e.top:q(i)?t=e.getPixelForValue(i.value):e.getBasePixel&&(t=e.getBasePixel()),t}function Fp(i,e,t){let n;return i==="start"?n=t:i==="end"?n=e.options.reverse?e.min:e.max:q(i)?n=i.value:n=e.getBaseValue(),n}function Ap(i){let e=i.options,t=e.fill,n=H(t&&t.target,t);return n===void 0&&(n=!!e.backgroundColor),n===!1||n===null?!1:n===!0?"origin":n}function Bp(i){let{scale:e,index:t,line:n}=i,s=[],o=n.segments,r=n.points,a=Vp(e,t);a.push(Vl({x:null,y:e.bottom},n));for(let l=0;l<o.length;l++){let c=o[l];for(let d=c.start;d<=c.end;d++)Hp(s,r[d],a)}return new Bn({points:s,options:{}})}function Vp(i,e){let t=[],n=i.getMatchingVisibleMetas("line");for(let s=0;s<n.length;s++){let o=n[s];if(o.index===e)break;o.hidden||t.unshift(o.dataset)}return t}function Hp(i,e,t){let n=[];for(let s=0;s<t.length;s++){let o=t[s],{first:r,last:a,point:l}=Np(o,e,"x");if(!(!l||r&&a)){if(r)n.unshift(l);else if(i.push(l),!a)break}}i.push(...n)}function Np(i,e,t){let n=i.interpolate(e,t);if(!n)return{};let s=n[t],o=i.segments,r=i.points,a=!1,l=!1;for(let c=0;c<o.length;c++){let d=o[c],h=r[d.start][t],u=r[d.end][t];if(ae(s,h,u)){a=s===h,l=s===u;break}}return{first:a,last:l,point:n}}var Rn=class{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,t,n){let{x:s,y:o,radius:r}=this;return t=t||{start:0,end:ct},e.arc(s,o,r,t.end,t.start,!0),!n.bounds}interpolate(e){let{x:t,y:n,radius:s}=this,o=e.angle;return{x:t+Math.cos(o)*s,y:n+Math.sin(o)*s,angle:o}}};function jp(i){let{chart:e,fill:t,line:n}=i;if(ht(t))return Up(e,t);if(t==="stack")return Bp(i);if(t==="shape")return!0;let s=Yp(i);return s instanceof Rn?s:Vl(s,n)}function Up(i,e){let t=i.getDatasetMeta(e);return t&&i.isDatasetVisible(e)?t.dataset:null}function Yp(i){return(i.scale||{}).getPointPositionForValue?Gp(i):Xp(i)}function Xp(i){let{scale:e={},fill:t}=i,n=Rp(t,e);if(ht(n)){let s=e.isHorizontal();return{x:s?n:null,y:s?null:n}}return null}function Gp(i){let{scale:e,fill:t}=i,n=e.options,s=e.getLabels().length,o=n.reverse?e.max:e.min,r=Fp(t,e,o),a=[];if(n.grid.circular){let l=e.getPointPositionForValue(0,o);return new Rn({x:l.x,y:l.y,radius:e.getDistanceFromCenterForValue(r)})}for(let l=0;l<s;++l)a.push(e.getPointPositionForValue(l,r));return a}function Js(i,e,t){let n=jp(e),{chart:s,index:o,line:r,scale:a,axis:l}=e,c=r.options,d=c.fill,h=c.backgroundColor,{above:u=h,below:p=h}=d||{},b=s.getDatasetMeta(o),g=Hs(s,b);n&&r.points.length&&(Ti(i,t),qp(i,{line:r,target:n,above:u,below:p,area:t,scale:a,axis:l,clip:g}),Pi(i))}function qp(i,e){let{line:t,target:n,above:s,below:o,area:r,scale:a,clip:l}=e,c=t._loop?"angle":e.axis;i.save();let d=o;o!==s&&(c==="x"?(sl(i,n,r.top),Zs(i,{line:t,target:n,color:s,scale:a,property:c,clip:l}),i.restore(),i.save(),sl(i,n,r.bottom)):c==="y"&&(ol(i,n,r.left),Zs(i,{line:t,target:n,color:o,scale:a,property:c,clip:l}),i.restore(),i.save(),ol(i,n,r.right),d=s)),Zs(i,{line:t,target:n,color:d,scale:a,property:c,clip:l}),i.restore()}function sl(i,e,t){let{segments:n,points:s}=e,o=!0,r=!1;i.beginPath();for(let a of n){let{start:l,end:c}=a,d=s[l],h=s[Vn(l,c,s)];o?(i.moveTo(d.x,d.y),o=!1):(i.lineTo(d.x,t),i.lineTo(d.x,d.y)),r=!!e.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(h.x,t)}i.lineTo(e.first().x,t),i.closePath(),i.clip()}function ol(i,e,t){let{segments:n,points:s}=e,o=!0,r=!1;i.beginPath();for(let a of n){let{start:l,end:c}=a,d=s[l],h=s[Vn(l,c,s)];o?(i.moveTo(d.x,d.y),o=!1):(i.lineTo(t,d.y),i.lineTo(d.x,d.y)),r=!!e.pathSegment(i,a,{move:r}),r?i.closePath():i.lineTo(t,h.y)}i.lineTo(t,e.first().y),i.closePath(),i.clip()}function Zs(i,e){let{line:t,target:n,property:s,color:o,scale:r,clip:a}=e,l=$p(t,n,s);for(let{source:c,target:d,start:h,end:u}of l){let{style:{backgroundColor:p=o}={}}=c,b=n!==!0;i.save(),i.fillStyle=p,Kp(i,r,a,b&&go(s,h,u)),i.beginPath();let g=!!t.pathSegment(i,c),_;if(b){g?i.closePath():rl(i,n,u,s);let C=!!n.pathSegment(i,d,{move:g,reverse:!0});_=g&&C,_||rl(i,n,h,s)}i.closePath(),i.fill(_?"evenodd":"nonzero"),i.restore()}}function Kp(i,e,t,n){let s=e.chart.chartArea,{property:o,start:r,end:a}=n||{};if(o==="x"||o==="y"){let l,c,d,h;o==="x"?(l=r,c=s.top,d=a,h=s.bottom):(l=s.left,c=r,d=s.right,h=a),i.beginPath(),t&&(l=Math.max(l,t.left),d=Math.min(d,t.right),c=Math.max(c,t.top),h=Math.min(h,t.bottom)),i.rect(l,c,d-l,h-c),i.clip()}}function rl(i,e,t,n){let s=e.interpolate(t,n);s&&i.lineTo(s.x,s.y)}var Qp={id:"filler",afterDatasetsUpdate(i,e,t){let n=(i.data.datasets||[]).length,s=[],o,r,a,l;for(r=0;r<n;++r)o=i.getDatasetMeta(r),a=o.dataset,l=null,a&&a.options&&a instanceof Bn&&(l={visible:i.isDatasetVisible(r),index:r,fill:Lp(a,r,n),chart:i,axis:o.controller.options.indexAxis,scale:o.vScale,line:a}),o.$filler=l,s.push(l);for(r=0;r<n;++r)l=s[r],!(!l||l.fill===!1)&&(l.fill=Wp(s,r,t.propagate))},beforeDraw(i,e,t){let n=t.drawTime==="beforeDraw",s=i.getSortedVisibleDatasetMetas(),o=i.chartArea;for(let r=s.length-1;r>=0;--r){let a=s[r].$filler;a&&(a.line.updateControlPoints(o,a.axis),n&&a.fill&&Js(i.ctx,a,o))}},beforeDatasetsDraw(i,e,t){if(t.drawTime!=="beforeDatasetsDraw")return;let n=i.getSortedVisibleDatasetMetas();for(let s=n.length-1;s>=0;--s){let o=n[s].$filler;nl(o)&&Js(i.ctx,o,i.chartArea)}},beforeDatasetDraw(i,e,t){let n=e.meta.$filler;!nl(n)||t.drawTime!=="beforeDatasetDraw"||Js(i.ctx,n,i.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}},al=(i,e)=>{let{boxHeight:t=e,boxWidth:n=e}=i;return i.usePointStyle&&(t=Math.min(t,e),n=i.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:t,itemHeight:Math.max(e,t)}},Jp=(i,e)=>i!==null&&e!==null&&i.datasetIndex===e.datasetIndex&&i.index===e.index,Fn=class extends ee{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t,n){this.maxWidth=e,this.maxHeight=t,this._margins=n,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){let e=this.options.labels||{},t=nt(e.generateLabels,[this.chart],this)||[];e.filter&&(t=t.filter(n=>e.filter(n,this.chart.data))),e.sort&&(t=t.sort((n,s)=>e.sort(n,s,this.chart.data))),this.options.reverse&&t.reverse(),this.legendItems=t}fit(){let{options:e,ctx:t}=this;if(!e.display){this.width=this.height=0;return}let n=e.labels,s=yt(n.font),o=s.size,r=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=al(n,o),c,d;t.font=s.string,this.isHorizontal()?(c=this.maxWidth,d=this._fitRows(r,o,a,l)+10):(d=this.maxHeight,c=this._fitCols(r,s,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(d,e.maxHeight||this.maxHeight)}_fitRows(e,t,n,s){let{ctx:o,maxWidth:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],d=s+a,h=e;o.textAlign="left",o.textBaseline="middle";let u=-1,p=-d;return this.legendItems.forEach((b,g)=>{let _=n+t/2+o.measureText(b.text).width;(g===0||c[c.length-1]+_+2*a>r)&&(h+=d,c[c.length-(g>0?0:1)]=0,p+=d,u++),l[g]={left:0,top:p,row:u,width:_,height:s},c[c.length-1]+=_+a}),h}_fitCols(e,t,n,s){let{ctx:o,maxHeight:r,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],d=r-e,h=a,u=0,p=0,b=0,g=0;return this.legendItems.forEach((_,C)=>{let{itemWidth:v,itemHeight:M}=Zp(n,t,o,_,s);C>0&&p+M+2*a>d&&(h+=u+a,c.push({width:u,height:p}),b+=u+a,g++,u=p=0),l[C]={left:b,top:p,col:g,width:v,height:M},u=Math.max(u,v),p+=M+a}),h+=u,c.push({width:u,height:p}),h}adjustHitBoxes(){if(!this.options.display)return;let e=this._computeTitleHeight(),{legendHitBoxes:t,options:{align:n,labels:{padding:s},rtl:o}}=this,r=Be(o,this.left,this.width);if(this.isHorizontal()){let a=0,l=Dt(n,this.left+s,this.right-this.lineWidths[a]);for(let c of t)a!==c.row&&(a=c.row,l=Dt(n,this.left+s,this.right-this.lineWidths[a])),c.top+=this.top+e+s,c.left=r.leftForLtr(r.x(l),c.width),l+=c.width+s}else{let a=0,l=Dt(n,this.top+e+s,this.bottom-this.columnSizes[a].height);for(let c of t)c.col!==a&&(a=c.col,l=Dt(n,this.top+e+s,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+s,c.left=r.leftForLtr(r.x(c.left),c.width),l+=c.height+s}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){let e=this.ctx;Ti(e,this),this._draw(),Pi(e)}}_draw(){let{options:e,columnSizes:t,lineWidths:n,ctx:s}=this,{align:o,labels:r}=e,a=st.color,l=Be(e.rtl,this.left,this.width),c=yt(r.font),{padding:d}=r,h=c.size,u=h/2,p;this.drawTitle(),s.textAlign=l.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;let{boxWidth:b,boxHeight:g,itemHeight:_}=al(r,h),C=function(P,L,O){if(isNaN(b)||b<=0||isNaN(g)||g<0)return;s.save();let F=H(O.lineWidth,1);if(s.fillStyle=H(O.fillStyle,a),s.lineCap=H(O.lineCap,"butt"),s.lineDashOffset=H(O.lineDashOffset,0),s.lineJoin=H(O.lineJoin,"miter"),s.lineWidth=F,s.strokeStyle=H(O.strokeStyle,a),s.setLineDash(H(O.lineDash,[])),r.usePointStyle){let U={radius:g*Math.SQRT2/2,pointStyle:O.pointStyle,rotation:O.rotation,borderWidth:F},N=l.xPlus(P,b/2),K=L+u;Es(s,U,N,K,r.pointStyleWidth&&b)}else{let U=L+Math.max((h-g)/2,0),N=l.leftForLtr(P,b),K=Pe(O.borderRadius);s.beginPath(),Object.values(K).some(Tt=>Tt!==0)?si(s,{x:N,y:U,w:b,h:g,radius:K}):s.rect(N,U,b,g),s.fill(),F!==0&&s.stroke()}s.restore()},v=function(P,L,O){Te(s,O.text,P,L+_/2,c,{strikethrough:O.hidden,textAlign:l.textAlign(O.textAlign)})},M=this.isHorizontal(),E=this._computeTitleHeight();M?p={x:Dt(o,this.left+d,this.right-n[0]),y:this.top+d+E,line:0}:p={x:this.left+d,y:Dt(o,this.top+E+d,this.bottom-t[0].height),line:0},Fs(this.ctx,e.textDirection);let I=_+d;this.legendItems.forEach((P,L)=>{s.strokeStyle=P.fontColor,s.fillStyle=P.fontColor;let O=s.measureText(P.text).width,F=l.textAlign(P.textAlign||(P.textAlign=r.textAlign)),U=b+u+O,N=p.x,K=p.y;l.setWidth(this.width),M?L>0&&N+U+d>this.right&&(K=p.y+=I,p.line++,N=p.x=Dt(o,this.left+d,this.right-n[p.line])):L>0&&K+I>this.bottom&&(N=p.x=N+t[p.line].width+d,p.line++,K=p.y=Dt(o,this.top+E+d,this.bottom-t[p.line].height));let Tt=l.x(N);if(C(Tt,K,P),N=aa(F,N+b+u,M?N+U:this.right,e.rtl),v(l.x(N),K,P),M)p.x+=U+d;else if(typeof P.text!="string"){let jt=c.lineHeight;p.y+=Hl(P,jt)+d}else p.y+=I}),As(this.ctx,e.textDirection)}drawTitle(){let e=this.options,t=e.title,n=yt(t.font),s=$t(t.padding);if(!t.display)return;let o=Be(e.rtl,this.left,this.width),r=this.ctx,a=t.position,l=n.size/2,c=s.top+l,d,h=this.left,u=this.width;if(this.isHorizontal())u=Math.max(...this.lineWidths),d=this.top+c,h=Dt(e.align,h,this.right-u);else{let b=this.columnSizes.reduce((g,_)=>Math.max(g,_.height),0);d=c+Dt(e.align,this.top,this.bottom-b-e.labels.padding-this._computeTitleHeight())}let p=Dt(a,h,h+u);r.textAlign=o.textAlign(bn(a)),r.textBaseline="middle",r.strokeStyle=t.color,r.fillStyle=t.color,r.font=n.string,Te(r,t.text,p,d,n)}_computeTitleHeight(){let e=this.options.title,t=yt(e.font),n=$t(e.padding);return e.display?t.lineHeight+n.height:0}_getLegendItemAt(e,t){let n,s,o;if(ae(e,this.left,this.right)&&ae(t,this.top,this.bottom)){for(o=this.legendHitBoxes,n=0;n<o.length;++n)if(s=o[n],ae(e,s.left,s.left+s.width)&&ae(t,s.top,s.top+s.height))return this.legendItems[n]}return null}handleEvent(e){let t=this.options;if(!nf(e.type,t))return;let n=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){let s=this._hoveredItem,o=Jp(s,n);s&&!o&&nt(t.onLeave,[e,s,this],this),this._hoveredItem=n,n&&!o&&nt(t.onHover,[e,n,this],this)}else n&&nt(t.onClick,[e,n,this],this)}};function Zp(i,e,t,n,s){let o=tf(n,i,e,t),r=ef(s,n,e.lineHeight);return{itemWidth:o,itemHeight:r}}function tf(i,e,t,n){let s=i.text;return s&&typeof s!="string"&&(s=s.reduce((o,r)=>o.length>r.length?o:r)),e+t.size/2+n.measureText(s).width}function ef(i,e,t){let n=i;return typeof e.text!="string"&&(n=Hl(e,t)),n}function Hl(i,e){let t=i.text?i.text.length:0;return e*t}function nf(i,e){return!!((i==="mousemove"||i==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(i==="click"||i==="mouseup"))}var sf={id:"legend",_element:Fn,start(i,e,t){let n=i.legend=new Fn({ctx:i.ctx,options:t,chart:i});Ft.configure(i,n,t),Ft.addBox(i,n)},stop(i){Ft.removeBox(i,i.legend),delete i.legend},beforeUpdate(i,e,t){let n=i.legend;Ft.configure(i,n,t),n.options=t},afterUpdate(i){let e=i.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(i,e){e.replay||i.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(i,e,t){let n=e.datasetIndex,s=t.chart;s.isDatasetVisible(n)?(s.hide(n),e.hidden=!0):(s.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:i=>i.chart.options.color,boxWidth:40,padding:10,generateLabels(i){let e=i.data.datasets,{labels:{usePointStyle:t,pointStyle:n,textAlign:s,color:o,useBorderRadius:r,borderRadius:a}}=i.legend.options;return i._getSortedDatasetMetas().map(l=>{let c=l.controller.getStyle(t?0:void 0),d=$t(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(d.width+d.height)/4,strokeStyle:c.borderColor,pointStyle:n||c.pointStyle,rotation:c.rotation,textAlign:s||c.textAlign,borderRadius:r&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:i=>i.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:i=>!i.startsWith("on"),labels:{_scriptable:i=>!["generateLabels","filter","sort"].includes(i)}}},Fi=class extends ee{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,t){let n=this.options;if(this.left=0,this.top=0,!n.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=t;let s=lt(n.text)?n.text.length:1;this._padding=$t(n.padding);let o=s*yt(n.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){let e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){let{top:t,left:n,bottom:s,right:o,options:r}=this,a=r.align,l=0,c,d,h;return this.isHorizontal()?(d=Dt(a,n,o),h=t+e,c=o-n):(r.position==="left"?(d=n+e,h=Dt(a,s,t),l=J*-.5):(d=o-e,h=Dt(a,t,s),l=J*.5),c=s-t),{titleX:d,titleY:h,maxWidth:c,rotation:l}}draw(){let e=this.ctx,t=this.options;if(!t.display)return;let n=yt(t.font),o=n.lineHeight/2+this._padding.top,{titleX:r,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(o);Te(e,t.text,0,0,n,{color:t.color,maxWidth:l,rotation:c,textAlign:bn(t.align),textBaseline:"middle",translation:[r,a]})}};function of(i,e){let t=new Fi({ctx:i.ctx,options:e,chart:i});Ft.configure(i,t,e),Ft.addBox(i,t),i.titleBlock=t}var rf={id:"title",_element:Fi,start(i,e,t){of(i,t)},stop(i){let e=i.titleBlock;Ft.removeBox(i,e),delete i.titleBlock},beforeUpdate(i,e,t){let n=i.titleBlock;Ft.configure(i,n,t),n.options=t},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},Tn=new WeakMap,af={id:"subtitle",start(i,e,t){let n=new Fi({ctx:i.ctx,options:t,chart:i});Ft.configure(i,n,t),Ft.addBox(i,n),Tn.set(i,n)},stop(i){Ft.removeBox(i,Tn.get(i)),Tn.delete(i)},beforeUpdate(i,e,t){let n=Tn.get(i);Ft.configure(i,n,t),n.options=t},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}},zi={average(i){if(!i.length)return!1;let e,t,n=new Set,s=0,o=0;for(e=0,t=i.length;e<t;++e){let a=i[e].element;if(a&&a.hasValue()){let l=a.tooltipPosition();n.add(l.x),s+=l.y,++o}}return o===0||n.size===0?!1:{x:[...n].reduce((a,l)=>a+l)/n.size,y:s/o}},nearest(i,e){if(!i.length)return!1;let t=e.x,n=e.y,s=Number.POSITIVE_INFINITY,o,r,a;for(o=0,r=i.length;o<r;++o){let l=i[o].element;if(l&&l.hasValue()){let c=l.getCenterPoint(),d=un(e,c);d<s&&(s=d,a=l)}}if(a){let l=a.tooltipPosition();t=l.x,n=l.y}return{x:t,y:n}}};function le(i,e){return e&&(lt(e)?Array.prototype.push.apply(i,e):i.push(e)),i}function _e(i){return(typeof i=="string"||i instanceof String)&&i.indexOf(`
5
- `)>-1?i.split(`
6
- `):i}function lf(i,e){let{element:t,datasetIndex:n,index:s}=e,o=i.getDatasetMeta(n).controller,{label:r,value:a}=o.getLabelAndValue(s);return{chart:i,label:r,parsed:o.getParsed(s),raw:i.data.datasets[n].data[s],formattedValue:a,dataset:o.getDataset(),dataIndex:s,datasetIndex:n,element:t}}function ll(i,e){let t=i.chart.ctx,{body:n,footer:s,title:o}=i,{boxWidth:r,boxHeight:a}=e,l=yt(e.bodyFont),c=yt(e.titleFont),d=yt(e.footerFont),h=o.length,u=s.length,p=n.length,b=$t(e.padding),g=b.height,_=0,C=n.reduce((E,I)=>E+I.before.length+I.lines.length+I.after.length,0);if(C+=i.beforeBody.length+i.afterBody.length,h&&(g+=h*c.lineHeight+(h-1)*e.titleSpacing+e.titleMarginBottom),C){let E=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=p*E+(C-p)*l.lineHeight+(C-1)*e.bodySpacing}u&&(g+=e.footerMarginTop+u*d.lineHeight+(u-1)*e.footerSpacing);let v=0,M=function(E){_=Math.max(_,t.measureText(E).width+v)};return t.save(),t.font=c.string,et(i.title,M),t.font=l.string,et(i.beforeBody.concat(i.afterBody),M),v=e.displayColors?r+2+e.boxPadding:0,et(n,E=>{et(E.before,M),et(E.lines,M),et(E.after,M)}),v=0,t.font=d.string,et(i.footer,M),t.restore(),_+=b.width,{width:_,height:g}}function cf(i,e){let{y:t,height:n}=e;return t<n/2?"top":t>i.height-n/2?"bottom":"center"}function df(i,e,t,n){let{x:s,width:o}=n,r=t.caretSize+t.caretPadding;if(i==="left"&&s+o+r>e.width||i==="right"&&s-o-r<0)return!0}function hf(i,e,t,n){let{x:s,width:o}=t,{width:r,chartArea:{left:a,right:l}}=i,c="center";return n==="center"?c=s<=(a+l)/2?"left":"right":s<=o/2?c="left":s>=r-o/2&&(c="right"),df(c,i,e,t)&&(c="center"),c}function cl(i,e,t){let n=t.yAlign||e.yAlign||cf(i,t);return{xAlign:t.xAlign||e.xAlign||hf(i,e,t,n),yAlign:n}}function uf(i,e){let{x:t,width:n}=i;return e==="right"?t-=n:e==="center"&&(t-=n/2),t}function pf(i,e,t){let{y:n,height:s}=i;return e==="top"?n+=t:e==="bottom"?n-=s+t:n-=s/2,n}function dl(i,e,t,n){let{caretSize:s,caretPadding:o,cornerRadius:r}=i,{xAlign:a,yAlign:l}=t,c=s+o,{topLeft:d,topRight:h,bottomLeft:u,bottomRight:p}=Pe(r),b=uf(e,a),g=pf(e,l,c);return l==="center"?a==="left"?b+=c:a==="right"&&(b-=c):a==="left"?b-=Math.max(d,u)+s:a==="right"&&(b+=Math.max(h,p)+s),{x:It(b,0,n.width-e.width),y:It(g,0,n.height-e.height)}}function Pn(i,e,t){let n=$t(t.padding);return e==="center"?i.x+i.width/2:e==="right"?i.x+i.width-n.right:i.x+n.left}function hl(i){return le([],_e(i))}function ff(i,e,t){return be(i,{tooltip:e,tooltipItems:t,type:"tooltip"})}function ul(i,e){let t=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return t?i.override(t):i}var Nl={beforeTitle:re,title(i){if(i.length>0){let e=i[0],t=e.chart.data.labels,n=t?t.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return t[e.dataIndex]}return""},afterTitle:re,beforeBody:re,beforeLabel:re,label(i){if(this&&this.options&&this.options.mode==="dataset")return i.label+": "+i.formattedValue||i.formattedValue;let e=i.dataset.label||"";e&&(e+=": ");let t=i.formattedValue;return G(t)||(e+=t),e},labelColor(i){let t=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(i){let t=i.chart.getDatasetMeta(i.datasetIndex).controller.getStyle(i.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:re,afterBody:re,beforeFooter:re,footer:re,afterFooter:re};function Ht(i,e,t,n){let s=i[e].call(t,n);return typeof s>"u"?Nl[e].call(t,n):s}var pl=(()=>{class i extends ee{static positioners=zi;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let n=this.chart,s=this.options.setContext(this.getContext()),o=s.enabled&&n.options.animation&&s.animations,r=new On(this.chart,o);return o._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=ff(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){let{callbacks:s}=n,o=Ht(s,"beforeTitle",this,t),r=Ht(s,"title",this,t),a=Ht(s,"afterTitle",this,t),l=[];return l=le(l,_e(o)),l=le(l,_e(r)),l=le(l,_e(a)),l}getBeforeBody(t,n){return hl(Ht(n.callbacks,"beforeBody",this,t))}getBody(t,n){let{callbacks:s}=n,o=[];return et(t,r=>{let a={before:[],lines:[],after:[]},l=ul(s,r);le(a.before,_e(Ht(l,"beforeLabel",this,r))),le(a.lines,Ht(l,"label",this,r)),le(a.after,_e(Ht(l,"afterLabel",this,r))),o.push(a)}),o}getAfterBody(t,n){return hl(Ht(n.callbacks,"afterBody",this,t))}getFooter(t,n){let{callbacks:s}=n,o=Ht(s,"beforeFooter",this,t),r=Ht(s,"footer",this,t),a=Ht(s,"afterFooter",this,t),l=[];return l=le(l,_e(o)),l=le(l,_e(r)),l=le(l,_e(a)),l}_createItems(t){let n=this._active,s=this.chart.data,o=[],r=[],a=[],l=[],c,d;for(c=0,d=n.length;c<d;++c)l.push(lf(this.chart,n[c]));return t.filter&&(l=l.filter((h,u,p)=>t.filter(h,u,p,s))),t.itemSort&&(l=l.sort((h,u)=>t.itemSort(h,u,s))),et(l,h=>{let u=ul(t.callbacks,h);o.push(Ht(u,"labelColor",this,h)),r.push(Ht(u,"labelPointStyle",this,h)),a.push(Ht(u,"labelTextColor",this,h))}),this.labelColors=o,this.labelPointStyles=r,this.labelTextColors=a,this.dataPoints=l,l}update(t,n){let s=this.options.setContext(this.getContext()),o=this._active,r,a=[];if(!o.length)this.opacity!==0&&(r={opacity:0});else{let l=zi[s.position].call(this,o,this._eventPosition);a=this._createItems(s),this.title=this.getTitle(a,s),this.beforeBody=this.getBeforeBody(a,s),this.body=this.getBody(a,s),this.afterBody=this.getAfterBody(a,s),this.footer=this.getFooter(a,s);let c=this._size=ll(this,s),d=Object.assign({},l,c),h=cl(this.chart,s,d),u=dl(s,d,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,r={opacity:1,x:u.x,y:u.y,width:c.width,height:c.height,caretX:l.x,caretY:l.y}}this._tooltipItems=a,this.$context=void 0,r&&this._resolveAnimations().update(this,r),t&&s.external&&s.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,s,o){let r=this.getCaretPosition(t,s,o);n.lineTo(r.x1,r.y1),n.lineTo(r.x2,r.y2),n.lineTo(r.x3,r.y3)}getCaretPosition(t,n,s){let{xAlign:o,yAlign:r}=this,{caretSize:a,cornerRadius:l}=s,{topLeft:c,topRight:d,bottomLeft:h,bottomRight:u}=Pe(l),{x:p,y:b}=t,{width:g,height:_}=n,C,v,M,E,I,P;return r==="center"?(I=b+_/2,o==="left"?(C=p,v=C-a,E=I+a,P=I-a):(C=p+g,v=C+a,E=I-a,P=I+a),M=C):(o==="left"?v=p+Math.max(c,h)+a:o==="right"?v=p+g-Math.max(d,u)-a:v=this.caretX,r==="top"?(E=b,I=E-a,C=v-a,M=v+a):(E=b+_,I=E+a,C=v+a,M=v-a),P=E),{x1:C,x2:v,x3:M,y1:E,y2:I,y3:P}}drawTitle(t,n,s){let o=this.title,r=o.length,a,l,c;if(r){let d=Be(s.rtl,this.x,this.width);for(t.x=Pn(this,s.titleAlign,s),n.textAlign=d.textAlign(s.titleAlign),n.textBaseline="middle",a=yt(s.titleFont),l=s.titleSpacing,n.fillStyle=s.titleColor,n.font=a.string,c=0;c<r;++c)n.fillText(o[c],d.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+l,c+1===r&&(t.y+=s.titleMarginBottom-l)}}_drawColorBox(t,n,s,o,r){let a=this.labelColors[s],l=this.labelPointStyles[s],{boxHeight:c,boxWidth:d}=r,h=yt(r.bodyFont),u=Pn(this,"left",r),p=o.x(u),b=c<h.lineHeight?(h.lineHeight-c)/2:0,g=n.y+b;if(r.usePointStyle){let _={radius:Math.min(d,c)/2,pointStyle:l.pointStyle,rotation:l.rotation,borderWidth:1},C=o.leftForLtr(p,d)+d/2,v=g+c/2;t.strokeStyle=r.multiKeyBackground,t.fillStyle=r.multiKeyBackground,_n(t,_,C,v),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,_n(t,_,C,v)}else{t.lineWidth=q(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;let _=o.leftForLtr(p,d),C=o.leftForLtr(o.xPlus(p,1),d-2),v=Pe(a.borderRadius);Object.values(v).some(M=>M!==0)?(t.beginPath(),t.fillStyle=r.multiKeyBackground,si(t,{x:_,y:g,w:d,h:c,radius:v}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),si(t,{x:C,y:g+1,w:d-2,h:c-2,radius:v}),t.fill()):(t.fillStyle=r.multiKeyBackground,t.fillRect(_,g,d,c),t.strokeRect(_,g,d,c),t.fillStyle=a.backgroundColor,t.fillRect(C,g+1,d-2,c-2))}t.fillStyle=this.labelTextColors[s]}drawBody(t,n,s){let{body:o}=this,{bodySpacing:r,bodyAlign:a,displayColors:l,boxHeight:c,boxWidth:d,boxPadding:h}=s,u=yt(s.bodyFont),p=u.lineHeight,b=0,g=Be(s.rtl,this.x,this.width),_=function(F){n.fillText(F,g.x(t.x+b),t.y+p/2),t.y+=p+r},C=g.textAlign(a),v,M,E,I,P,L,O;for(n.textAlign=a,n.textBaseline="middle",n.font=u.string,t.x=Pn(this,C,s),n.fillStyle=s.bodyColor,et(this.beforeBody,_),b=l&&C!=="right"?a==="center"?d/2+h:d+2+h:0,I=0,L=o.length;I<L;++I){for(v=o[I],M=this.labelTextColors[I],n.fillStyle=M,et(v.before,_),E=v.lines,l&&E.length&&(this._drawColorBox(n,t,I,g,s),p=Math.max(u.lineHeight,c)),P=0,O=E.length;P<O;++P)_(E[P]),p=u.lineHeight;et(v.after,_)}b=0,p=u.lineHeight,et(this.afterBody,_),t.y-=r}drawFooter(t,n,s){let o=this.footer,r=o.length,a,l;if(r){let c=Be(s.rtl,this.x,this.width);for(t.x=Pn(this,s.footerAlign,s),t.y+=s.footerMarginTop,n.textAlign=c.textAlign(s.footerAlign),n.textBaseline="middle",a=yt(s.footerFont),n.fillStyle=s.footerColor,n.font=a.string,l=0;l<r;++l)n.fillText(o[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+s.footerSpacing}}drawBackground(t,n,s,o){let{xAlign:r,yAlign:a}=this,{x:l,y:c}=t,{width:d,height:h}=s,{topLeft:u,topRight:p,bottomLeft:b,bottomRight:g}=Pe(o.cornerRadius);n.fillStyle=o.backgroundColor,n.strokeStyle=o.borderColor,n.lineWidth=o.borderWidth,n.beginPath(),n.moveTo(l+u,c),a==="top"&&this.drawCaret(t,n,s,o),n.lineTo(l+d-p,c),n.quadraticCurveTo(l+d,c,l+d,c+p),a==="center"&&r==="right"&&this.drawCaret(t,n,s,o),n.lineTo(l+d,c+h-g),n.quadraticCurveTo(l+d,c+h,l+d-g,c+h),a==="bottom"&&this.drawCaret(t,n,s,o),n.lineTo(l+b,c+h),n.quadraticCurveTo(l,c+h,l,c+h-b),a==="center"&&r==="left"&&this.drawCaret(t,n,s,o),n.lineTo(l,c+u),n.quadraticCurveTo(l,c,l+u,c),n.closePath(),n.fill(),o.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){let n=this.chart,s=this.$animations,o=s&&s.x,r=s&&s.y;if(o||r){let a=zi[t.position].call(this,this._active,this._eventPosition);if(!a)return;let l=this._size=ll(this,t),c=Object.assign({},a,this._size),d=cl(n,t,c),h=dl(t,c,d,n);(o._to!==h.x||r._to!==h.y)&&(this.xAlign=d.xAlign,this.yAlign=d.yAlign,this.width=l.width,this.height=l.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,h))}}_willRender(){return!!this.opacity}draw(t){let n=this.options.setContext(this.getContext()),s=this.opacity;if(!s)return;this._updateAnimationTarget(n);let o={width:this.width,height:this.height},r={x:this.x,y:this.y};s=Math.abs(s)<.001?0:s;let a=$t(n.padding),l=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&l&&(t.save(),t.globalAlpha=s,this.drawBackground(r,t,o,n),Fs(t,n.textDirection),r.y+=a.top,this.drawTitle(r,t,n),this.drawBody(r,t,n),this.drawFooter(r,t,n),As(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){let s=this._active,o=t.map(({datasetIndex:l,index:c})=>{let d=this.chart.getDatasetMeta(l);if(!d)throw new Error("Cannot find a dataset at index "+l);return{datasetIndex:l,element:d.data[c],index:c}}),r=!ki(s,o),a=this._positionChanged(o,n);(r||a)&&(this._active=o,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,s=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;let o=this.options,r=this._active||[],a=this._getActiveElements(t,r,n,s),l=this._positionChanged(a,t),c=n||!ki(a,r)||l;return c&&(this._active=a,(o.enabled||o.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),c}_getActiveElements(t,n,s,o){let r=this.options;if(t.type==="mouseout")return[];if(!o)return n.filter(l=>this.chart.data.datasets[l.datasetIndex]&&this.chart.getDatasetMeta(l.datasetIndex).controller.getParsed(l.index)!==void 0);let a=this.chart.getElementsAtEventForMode(t,r.mode,r,s);return r.reverse&&a.reverse(),a}_positionChanged(t,n){let{caretX:s,caretY:o,options:r}=this,a=zi[r.position].call(this,t,n);return a!==!1&&(s!==a.x||o!==a.y)}}return i})(),gf={id:"tooltip",_element:pl,positioners:zi,afterInit(i,e,t){t&&(i.tooltip=new pl({chart:i,options:t}))},beforeUpdate(i,e,t){i.tooltip&&i.tooltip.initialize(t)},reset(i,e,t){i.tooltip&&i.tooltip.initialize(t)},afterDraw(i){let e=i.tooltip;if(e&&e._willRender()){let t={tooltip:e};if(i.notifyPlugins("beforeTooltipDraw",de(kt({},t),{cancelable:!0}))===!1)return;e.draw(i.ctx),i.notifyPlugins("afterTooltipDraw",t)}},afterEvent(i,e){if(i.tooltip){let t=e.replay;i.tooltip.handleEvent(e.event,t,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(i,e)=>e.bodyFont.size,boxWidth:(i,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Nl},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:i=>i!=="filter"&&i!=="itemSort"&&i!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},mf=Object.freeze({__proto__:null,Colors:Mp,Decimation:Dp,Filler:Qp,Legend:sf,SubTitle:af,Title:rf,Tooltip:gf}),bf=(i,e,t,n)=>(typeof e=="string"?(t=i.push(e)-1,n.unshift({index:t,label:e})):isNaN(e)&&(t=null),t);function xf(i,e,t,n){let s=i.indexOf(e);if(s===-1)return bf(i,e,t,n);let o=i.lastIndexOf(e);return s!==o?t:s}var _f=(i,e)=>i===null?null:It(Math.round(i),0,e);function fl(i){let e=this.getLabels();return i>=0&&i<e.length?e[i]:i}var yf=(()=>{class i extends Ne{static id="category";static defaults={ticks:{callback:fl}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){let n=this._addedLabels;if(n.length){let s=this.getLabels();for(let{index:o,label:r}of n)s[o]===r&&s.splice(o,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(G(t))return null;let s=this.getLabels();return n=isFinite(n)&&s[n]===t?n:xf(s,t,H(n,t),this._addedLabels),_f(n,s.length-1)}determineDataLimits(){let{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:s,max:o}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(s=0),n||(o=this.getLabels().length-1)),this.min=s,this.max=o}buildTicks(){let t=this.min,n=this.max,s=this.options.offset,o=[],r=this.getLabels();r=t===0&&n===r.length-1?r:r.slice(t,n+1),this._valueRange=Math.max(r.length-(s?0:1),1),this._startValue=this.min-(s?.5:0);for(let a=t;a<=n;a++)o.push({value:a});return o}getLabelForValue(t){return fl.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){let n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}return i})();function Cf(i,e){let t=[],{bounds:s,step:o,min:r,max:a,precision:l,count:c,maxTicks:d,maxDigits:h,includeBounds:u}=i,p=o||1,b=d-1,{min:g,max:_}=e,C=!G(r),v=!G(a),M=!G(c),E=(_-g)/(h+1),I=bs((_-g)/b/p)*p,P,L,O,F;if(I<1e-14&&!C&&!v)return[{value:g},{value:_}];F=Math.ceil(_/I)-Math.floor(g/I),F>b&&(I=bs(F*I/b/p)*p),G(l)||(P=Math.pow(10,l),I=Math.ceil(I*P)/P),s==="ticks"?(L=Math.floor(g/I)*I,O=Math.ceil(_/I)*I):(L=g,O=_),C&&v&&o&&ta((a-r)/o,I/1e3)?(F=Math.round(Math.min((a-r)/I,d)),I=(a-r)/F,L=r,O=a):M?(L=C?r:L,O=v?a:O,F=c-1,I=(O-L)/F):(F=(O-L)/I,ei(F,Math.round(F),I/1e3)?F=Math.round(F):F=Math.ceil(F));let U=Math.max(_s(I),_s(L));P=Math.pow(10,G(l)?U:l),L=Math.round(L*P)/P,O=Math.round(O*P)/P;let N=0;for(C&&(u&&L!==r?(t.push({value:r}),L<r&&N++,ei(Math.round((L+N*I)*P)/P,r,gl(r,E,i))&&N++):L<r&&N++);N<F;++N){let K=Math.round((L+N*I)*P)/P;if(v&&K>a)break;t.push({value:K})}return v&&u&&O!==a?t.length&&ei(t[t.length-1].value,a,gl(a,E,i))?t[t.length-1].value=a:t.push({value:a}):(!v||O===a)&&t.push({value:O}),t}function gl(i,e,{horizontal:t,minRotation:n}){let s=Qt(n),o=(t?Math.sin(s):Math.cos(s))||.001,r=.75*e*(""+i).length;return Math.min(e/o,r)}var li=class extends Ne{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,t){return G(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){let{beginAtZero:e}=this.options,{minDefined:t,maxDefined:n}=this.getUserBounds(),{min:s,max:o}=this,r=l=>s=t?s:l,a=l=>o=n?o:l;if(e){let l=te(s),c=te(o);l<0&&c<0?a(0):l>0&&c>0&&r(0)}if(s===o){let l=o===0?1:Math.abs(o*.05);a(o+l),e||r(s-l)}this.min=s,this.max=o}getTickLimit(){let e=this.options.ticks,{maxTicksLimit:t,stepSize:n}=e,s;return n?(s=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,s>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${s} ticks. Limiting to 1000.`),s=1e3)):(s=this.computeTickLimit(),t=t||11),t&&(s=Math.min(t,s)),s}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){let e=this.options,t=e.ticks,n=this.getTickLimit();n=Math.max(2,n);let s={maxTicks:n,bounds:e.bounds,min:e.min,max:e.max,precision:t.precision,step:t.stepSize,count:t.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:t.minRotation||0,includeBounds:t.includeBounds!==!1},o=this._range||this,r=Cf(s,o);return e.bounds==="ticks"&&xs(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}configure(){let e=this.ticks,t=this.min,n=this.max;if(super.configure(),this.options.offset&&e.length){let s=(n-t)/Math.max(e.length-1,1)/2;t-=s,n+=s}this._startValue=t,this._endValue=n,this._valueRange=n-t}getLabelForValue(e){return ni(e,this.chart.options.locale,this.options.ticks.format)}},mo=class extends li{static id="linear";static defaults={ticks:{callback:Mi.formatters.numeric}};determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=ht(e)?e:0,this.max=ht(t)?t:1,this.handleTickRangeOptions()}computeTickLimit(){let e=this.isHorizontal(),t=e?this.width:this.height,n=Qt(this.options.ticks.minRotation),s=(e?Math.sin(n):Math.cos(n))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(t/Math.min(40,o.lineHeight/s))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}},Ai=i=>Math.floor(ge(i)),He=(i,e)=>Math.pow(10,Ai(i)+e);function ml(i){return i/Math.pow(10,Ai(i))===1}function bl(i,e,t){let n=Math.pow(10,t),s=Math.floor(i/n);return Math.ceil(e/n)-s}function wf(i,e){let t=e-i,n=Ai(t);for(;bl(i,e,n)>10;)n++;for(;bl(i,e,n)<10;)n--;return Math.min(n,Ai(i))}function vf(i,{min:e,max:t}){e=Vt(i.min,e);let n=[],s=Ai(e),o=wf(e,t),r=o<0?Math.pow(10,Math.abs(o)):1,a=Math.pow(10,o),l=s>o?Math.pow(10,s):0,c=Math.round((e-l)*r)/r,d=Math.floor((e-l)/a/10)*a*10,h=Math.floor((c-d)/Math.pow(10,o)),u=Vt(i.min,Math.round((l+d+h*Math.pow(10,o))*r)/r);for(;u<t;)n.push({value:u,major:ml(u),significand:h}),h>=10?h=h<15?15:20:h++,h>=20&&(o++,h=2,r=o>=0?1:r),u=Math.round((l+d+h*Math.pow(10,o))*r)/r;let p=Vt(i.max,u);return n.push({value:p,major:ml(p),significand:h}),n}var bo=class extends Ne{static id="logarithmic";static defaults={ticks:{callback:Mi.formatters.logarithmic,major:{enabled:!0}}};constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,t){let n=li.prototype.parse.apply(this,[e,t]);if(n===0){this._zero=!0;return}return ht(n)&&n>0?n:null}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!0);this.min=ht(e)?Math.max(0,e):null,this.max=ht(t)?Math.max(0,t):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!ht(this._userMin)&&(this.min=e===He(this.min,0)?He(this.min,-1):He(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){let{minDefined:e,maxDefined:t}=this.getUserBounds(),n=this.min,s=this.max,o=a=>n=e?n:a,r=a=>s=t?s:a;n===s&&(n<=0?(o(1),r(10)):(o(He(n,-1)),r(He(s,1)))),n<=0&&o(He(s,-1)),s<=0&&r(He(n,1)),this.min=n,this.max=s}buildTicks(){let e=this.options,t={min:this._userMin,max:this._userMax},n=vf(t,this);return e.bounds==="ticks"&&xs(n,this,"value"),e.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}getLabelForValue(e){return e===void 0?"0":ni(e,this.chart.options.locale,this.options.ticks.format)}configure(){let e=this.min;super.configure(),this._startValue=ge(e),this._valueRange=ge(this.max)-ge(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(ge(e)-this._startValue)/this._valueRange)}getValueForPixel(e){let t=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+t*this._valueRange)}};function xo(i){let e=i.ticks;if(e.display&&i.display){let t=$t(e.backdropPadding);return H(e.font&&e.font.size,st.font.size)+t.height}return 0}function Sf(i,e,t){return t=lt(t)?t:[t],{w:ca(i,e.string,t),h:t.length*e.lineHeight}}function xl(i,e,t,n,s){return i===n||i===s?{start:e-t/2,end:e+t/2}:i<n||i>s?{start:e-t,end:e}:{start:e,end:e+t}}function If(i){let e={l:i.left+i._padding.left,r:i.right-i._padding.right,t:i.top+i._padding.top,b:i.bottom-i._padding.bottom},t=Object.assign({},e),n=[],s=[],o=i._pointLabels.length,r=i.options.pointLabels,a=r.centerPointLabels?J/o:0;for(let l=0;l<o;l++){let c=r.setContext(i.getPointLabelContext(l));s[l]=c.padding;let d=i.getPointPosition(l,i.drawingArea+s[l],a),h=yt(c.font),u=Sf(i.ctx,h,i._pointLabels[l]);n[l]=u;let p=Et(i.getIndexAngle(l)+a),b=Math.round(gn(p)),g=xl(b,d.x,u.w,0,180),_=xl(b,d.y,u.h,90,270);kf(t,e,p,g,_)}i.setCenterPoint(e.l-t.l,t.r-e.r,e.t-t.t,t.b-e.b),i._pointLabelItems=Pf(i,n,s)}function kf(i,e,t,n,s){let o=Math.abs(Math.sin(t)),r=Math.abs(Math.cos(t)),a=0,l=0;n.start<e.l?(a=(e.l-n.start)/o,i.l=Math.min(i.l,e.l-a)):n.end>e.r&&(a=(n.end-e.r)/o,i.r=Math.max(i.r,e.r+a)),s.start<e.t?(l=(e.t-s.start)/r,i.t=Math.min(i.t,e.t-l)):s.end>e.b&&(l=(s.end-e.b)/r,i.b=Math.max(i.b,e.b+l))}function Mf(i,e,t){let n=i.drawingArea,{extra:s,additionalAngle:o,padding:r,size:a}=t,l=i.getPointPosition(e,n+s+r,o),c=Math.round(gn(Et(l.angle+ut))),d=$f(l.y,a.h,c),h=Ef(c),u=Df(l.x,a.w,h);return{visible:!0,x:l.x,y:d,textAlign:h,left:u,top:d,right:u+a.w,bottom:d+a.h}}function Tf(i,e){if(!e)return!0;let{left:t,top:n,right:s,bottom:o}=i;return!(oe({x:t,y:n},e)||oe({x:t,y:o},e)||oe({x:s,y:n},e)||oe({x:s,y:o},e))}function Pf(i,e,t){let n=[],s=i._pointLabels.length,o=i.options,{centerPointLabels:r,display:a}=o.pointLabels,l={extra:xo(o)/2,additionalAngle:r?J/s:0},c;for(let d=0;d<s;d++){l.padding=t[d],l.size=e[d];let h=Mf(i,d,l);n.push(h),a==="auto"&&(h.visible=Tf(h,c),h.visible&&(c=h))}return n}function Ef(i){return i===0||i===180?"center":i<180?"left":"right"}function Df(i,e,t){return t==="right"?i-=e:t==="center"&&(i-=e/2),i}function $f(i,e,t){return t===90||t===270?i-=e/2:(t>270||t<90)&&(i-=e),i}function Of(i,e,t){let{left:n,top:s,right:o,bottom:r}=t,{backdropColor:a}=e;if(!G(a)){let l=Pe(e.borderRadius),c=$t(e.backdropPadding);i.fillStyle=a;let d=n-c.left,h=s-c.top,u=o-n+c.width,p=r-s+c.height;Object.values(l).some(b=>b!==0)?(i.beginPath(),si(i,{x:d,y:h,w:u,h:p,radius:l}),i.fill()):i.fillRect(d,h,u,p)}}function Wf(i,e){let{ctx:t,options:{pointLabels:n}}=i;for(let s=e-1;s>=0;s--){let o=i._pointLabelItems[s];if(!o.visible)continue;let r=n.setContext(i.getPointLabelContext(s));Of(t,r,o);let a=yt(r.font),{x:l,y:c,textAlign:d}=o;Te(t,i._pointLabels[s],l,c+a.lineHeight/2,a,{color:r.color,textAlign:d,textBaseline:"middle"})}}function jl(i,e,t,n){let{ctx:s}=i;if(t)s.arc(i.xCenter,i.yCenter,e,0,ct);else{let o=i.getPointPosition(0,e);s.moveTo(o.x,o.y);for(let r=1;r<n;r++)o=i.getPointPosition(r,e),s.lineTo(o.x,o.y)}}function Lf(i,e,t,n,s){let o=i.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!n||!a||!l||t<0||(o.save(),o.strokeStyle=a,o.lineWidth=l,o.setLineDash(s.dash||[]),o.lineDashOffset=s.dashOffset,o.beginPath(),jl(i,t,r,n),o.closePath(),o.stroke(),o.restore())}function zf(i,e,t){return be(i,{label:t,index:e,type:"pointLabel"})}var _o=class extends li{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Mi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){let e=this._padding=$t(xo(this.options)/2),t=this.width=this.maxWidth-e.width,n=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+t/2+e.left),this.yCenter=Math.floor(this.top+n/2+e.top),this.drawingArea=Math.floor(Math.min(t,n)/2)}determineDataLimits(){let{min:e,max:t}=this.getMinMax(!1);this.min=ht(e)&&!isNaN(e)?e:0,this.max=ht(t)&&!isNaN(t)?t:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/xo(this.options))}generateTickLabels(e){li.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((t,n)=>{let s=nt(this.options.pointLabels.callback,[t,n],this);return s||s===0?s:""}).filter((t,n)=>this.chart.getDataVisibility(n))}fit(){let e=this.options;e.display&&e.pointLabels.display?If(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,t,n,s){this.xCenter+=Math.floor((e-t)/2),this.yCenter+=Math.floor((n-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,t,n,s))}getIndexAngle(e){let t=ct/(this._pointLabels.length||1),n=this.options.startAngle||0;return Et(e*t+Qt(n))}getDistanceFromCenterForValue(e){if(G(e))return NaN;let t=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*t:(e-this.min)*t}getValueForDistanceFromCenter(e){if(G(e))return NaN;let t=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-t:this.min+t}getPointLabelContext(e){let t=this._pointLabels||[];if(e>=0&&e<t.length){let n=t[e];return zf(this.getContext(),e,n)}}getPointPosition(e,t,n=0){let s=this.getIndexAngle(e)-ut+n;return{x:Math.cos(s)*t+this.xCenter,y:Math.sin(s)*t+this.yCenter,angle:s}}getPointPositionForValue(e,t){return this.getPointPosition(e,this.getDistanceFromCenterForValue(t))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){let{left:t,top:n,right:s,bottom:o}=this._pointLabelItems[e];return{left:t,top:n,right:s,bottom:o}}drawBackground(){let{backgroundColor:e,grid:{circular:t}}=this.options;if(e){let n=this.ctx;n.save(),n.beginPath(),jl(this,this.getDistanceFromCenterForValue(this._endValue),t,this._pointLabels.length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){let e=this.ctx,t=this.options,{angleLines:n,grid:s,border:o}=t,r=this._pointLabels.length,a,l,c;if(t.pointLabels.display&&Wf(this,r),s.display&&this.ticks.forEach((d,h)=>{if(h!==0||h===0&&this.min<0){l=this.getDistanceFromCenterForValue(d.value);let u=this.getContext(h),p=s.setContext(u),b=o.setContext(u);Lf(this,p,l,r,b)}}),n.display){for(e.save(),a=r-1;a>=0;a--){let d=n.setContext(this.getPointLabelContext(a)),{color:h,lineWidth:u}=d;!u||!h||(e.lineWidth=u,e.strokeStyle=h,e.setLineDash(d.borderDash),e.lineDashOffset=d.borderDashOffset,l=this.getDistanceFromCenterForValue(t.reverse?this.min:this.max),c=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){let e=this.ctx,t=this.options,n=t.ticks;if(!n.display)return;let s=this.getIndexAngle(0),o,r;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(s),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!t.reverse)return;let c=n.setContext(this.getContext(l)),d=yt(c.font);if(o=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){e.font=d.string,r=e.measureText(a.label).width,e.fillStyle=c.backdropColor;let h=$t(c.backdropPadding);e.fillRect(-r/2-h.left,-o-d.size/2-h.top,r+h.width,d.size+h.height)}Te(e,a.label,0,-o,d,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),e.restore()}drawTitle(){}},Hn={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Nt=Object.keys(Hn);function _l(i,e){return i-e}function yl(i,e){if(G(e))return null;let t=i._adapter,{parser:n,round:s,isoWeekday:o}=i._parseOpts,r=e;return typeof n=="function"&&(r=n(r)),ht(r)||(r=typeof n=="string"?t.parse(r,n):t.parse(r)),r===null?null:(s&&(r=s==="week"&&(Ae(o)||o===!0)?t.startOf(r,"isoWeek",o):t.startOf(r,s)),+r)}function Cl(i,e,t,n){let s=Nt.length;for(let o=Nt.indexOf(i);o<s-1;++o){let r=Hn[Nt[o]],a=r.steps?r.steps:Number.MAX_SAFE_INTEGER;if(r.common&&Math.ceil((t-e)/(a*r.size))<=n)return Nt[o]}return Nt[s-1]}function Rf(i,e,t,n,s){for(let o=Nt.length-1;o>=Nt.indexOf(t);o--){let r=Nt[o];if(Hn[r].common&&i._adapter.diff(s,n,r)>=e-1)return r}return Nt[t?Nt.indexOf(t):0]}function Ff(i){for(let e=Nt.indexOf(i)+1,t=Nt.length;e<t;++e)if(Hn[Nt[e]].common)return Nt[e]}function wl(i,e,t){if(!t)i[e]=!0;else if(t.length){let{lo:n,hi:s}=mn(t,e),o=t[n]>=e?t[n]:t[s];i[o]=!0}}function Af(i,e,t,n){let s=i._adapter,o=+s.startOf(e[0].value,n),r=e[e.length-1].value,a,l;for(a=o;a<=r;a=+s.add(a,1,n))l=t[a],l>=0&&(e[l].major=!0);return e}function vl(i,e,t){let n=[],s={},o=e.length,r,a;for(r=0;r<o;++r)a=e[r],s[a]=r,n.push({value:a,major:!1});return o===0||!t?n:Af(i,n,s,t)}var yo=(()=>{class i extends Ne{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){let s=t.time||(t.time={}),o=this._adapter=new qh._date(t.adapters.date);o.init(n),Ze(s.displayFormats,o.formats()),this._parseOpts={parser:s.parser,round:s.round,isoWeekday:s.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:yl(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){let t=this.options,n=this._adapter,s=t.time.unit||"day",{min:o,max:r,minDefined:a,maxDefined:l}=this.getUserBounds();function c(d){!a&&!isNaN(d.min)&&(o=Math.min(o,d.min)),!l&&!isNaN(d.max)&&(r=Math.max(r,d.max))}(!a||!l)&&(c(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&c(this.getMinMax(!1))),o=ht(o)&&!isNaN(o)?o:+n.startOf(Date.now(),s),r=ht(r)&&!isNaN(r)?r:+n.endOf(Date.now(),s)+1,this.min=Math.min(o,r-1),this.max=Math.max(o+1,r)}_getLabelBounds(){let t=this.getLabelTimestamps(),n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],s=t[t.length-1]),{min:n,max:s}}buildTicks(){let t=this.options,n=t.time,s=t.ticks,o=s.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&o.length&&(this.min=this._userMin||o[0],this.max=this._userMax||o[o.length-1]);let r=this.min,a=this.max,l=na(o,r,a);return this._unit=n.unit||(s.autoSkip?Cl(n.minUnit,this.min,this.max,this._getLabelCapacity(r)):Rf(this,l.length,n.minUnit,this.min,this.max)),this._majorUnit=!s.major.enabled||this._unit==="year"?void 0:Ff(this._unit),this.initOffsets(o),t.reverse&&l.reverse(),vl(this,l,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,s=0,o,r;this.options.offset&&t.length&&(o=this.getDecimalForValue(t[0]),t.length===1?n=1-o:n=(this.getDecimalForValue(t[1])-o)/2,r=this.getDecimalForValue(t[t.length-1]),t.length===1?s=r:s=(r-this.getDecimalForValue(t[t.length-2]))/2);let a=t.length<3?.5:.25;n=It(n,0,a),s=It(s,0,a),this._offsets={start:n,end:s,factor:1/(n+1+s)}}_generate(){let t=this._adapter,n=this.min,s=this.max,o=this.options,r=o.time,a=r.unit||Cl(r.minUnit,n,s,this._getLabelCapacity(n)),l=H(o.ticks.stepSize,1),c=a==="week"?r.isoWeekday:!1,d=Ae(c)||c===!0,h={},u=n,p,b;if(d&&(u=+t.startOf(u,"isoWeek",c)),u=+t.startOf(u,d?"day":a),t.diff(s,n,a)>1e5*l)throw new Error(n+" and "+s+" are too far apart with stepSize of "+l+" "+a);let g=o.ticks.source==="data"&&this.getDataTimestamps();for(p=u,b=0;p<s;p=+t.add(p,l,a),b++)wl(h,p,g);return(p===s||o.bounds==="ticks"||b===1)&&wl(h,p,g),Object.keys(h).sort(_l).map(_=>+_)}getLabelForValue(t){let n=this._adapter,s=this.options.time;return s.tooltipFormat?n.format(t,s.tooltipFormat):n.format(t,s.displayFormats.datetime)}format(t,n){let o=this.options.time.displayFormats,r=this._unit,a=n||o[r];return this._adapter.format(t,a)}_tickFormatFunction(t,n,s,o){let r=this.options,a=r.ticks.callback;if(a)return nt(a,[t,n,s],this);let l=r.time.displayFormats,c=this._unit,d=this._majorUnit,h=c&&l[c],u=d&&l[d],p=s[n],b=d&&u&&p&&p.major;return this._adapter.format(t,o||(b?u:h))}generateTickLabels(t){let n,s,o;for(n=0,s=t.length;n<s;++n)o=t[n],o.label=this._tickFormatFunction(o.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){let n=this._offsets,s=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+s)*n.factor)}getValueForPixel(t){let n=this._offsets,s=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+s*(this.max-this.min)}_getLabelSize(t){let n=this.options.ticks,s=this.ctx.measureText(t).width,o=Qt(this.isHorizontal()?n.maxRotation:n.minRotation),r=Math.cos(o),a=Math.sin(o),l=this._resolveTickFontOptions(0).size;return{w:s*r+l*a,h:s*a+l*r}}_getLabelCapacity(t){let n=this.options.time,s=n.displayFormats,o=s[n.unit]||s.millisecond,r=this._tickFormatFunction(t,0,vl(this,[t],this._majorUnit),o),a=this._getLabelSize(r),l=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return l>0?l:1}getDataTimestamps(){let t=this._cache.data||[],n,s;if(t.length)return t;let o=this.getMatchingVisibleMetas();if(this._normalized&&o.length)return this._cache.data=o[0].controller.getAllParsedValues(this);for(n=0,s=o.length;n<s;++n)t=t.concat(o[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){let t=this._cache.labels||[],n,s;if(t.length)return t;let o=this.getLabels();for(n=0,s=o.length;n<s;++n)t.push(yl(this,o[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return ws(t.sort(_l))}}return i})();function En(i,e,t){let n=0,s=i.length-1,o,r,a,l;t?(e>=i[n].pos&&e<=i[s].pos&&({lo:n,hi:s}=se(i,"pos",e)),{pos:o,time:a}=i[n],{pos:r,time:l}=i[s]):(e>=i[n].time&&e<=i[s].time&&({lo:n,hi:s}=se(i,"time",e)),{time:o,pos:a}=i[n],{time:r,pos:l}=i[s]);let c=r-o;return c?a+(l-a)*(e-o)/c:a}var Co=class extends yo{static id="timeseries";static defaults=yo.defaults;constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){let e=this._getTimestampsForTable(),t=this._table=this.buildLookupTable(e);this._minPos=En(t,this.min),this._tableRange=En(t,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){let{min:t,max:n}=this,s=[],o=[],r,a,l,c,d;for(r=0,a=e.length;r<a;++r)c=e[r],c>=t&&c<=n&&s.push(c);if(s.length<2)return[{time:t,pos:0},{time:n,pos:1}];for(r=0,a=s.length;r<a;++r)d=s[r+1],l=s[r-1],c=s[r],Math.round((d+l)/2)!==c&&o.push({time:c,pos:r/(a-1)});return o}_generate(){let e=this.min,t=this.max,n=super.getDataTimestamps();return(!n.includes(e)||!n.length)&&n.splice(0,0,e),(!n.includes(t)||n.length===1)&&n.push(t),n.sort((s,o)=>s-o)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;let t=this.getDataTimestamps(),n=this.getLabelTimestamps();return t.length&&n.length?e=this.normalize(t.concat(n)):e=t.length?t:n,e=this._cache.all=e,e}getDecimalForValue(e){return(En(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){let t=this._offsets,n=this.getDecimalForPixel(e)/t.factor-t.end;return En(this._table,n*this._tableRange+this._minPos,!0)}},Bf=Object.freeze({__proto__:null,CategoryScale:yf,LinearScale:mo,LogarithmicScale:bo,RadialLinearScale:_o,TimeScale:yo,TimeSeriesScale:Co}),Ul=[Gh,yp,mf,Bf];var Yl=new $o("Configuration for ngCharts");function ib(...i){return{registerables:[...Ul,...i]}}function nb(...i){let e=Kn({},...i);return{provide:Yl,useValue:e}}var Vf=(()=>{let e=class e{constructor(){this.colorschemesOptions=new So(void 0)}setColorschemesOptions(n){this.pColorschemesOptions=n,this.colorschemesOptions.next(n)}getColorschemesOptions(){return this.pColorschemesOptions}};e.\u0275fac=function(s){return new(s||e)},e.\u0275prov=Eo({token:e,factory:e.\u0275fac,providedIn:"root"});let i=e;return i})(),Jt=(()=>{let e=class e{constructor(n,s,o,r){this.zone=s,this.themeService=o,this.type="bar",this.plugins=[],this.chartClick=new ye,this.chartHover=new ye,this.subs=[],this.themeOverrides={},r?.registerables&&An.register(...r.registerables),r?.defaults&&st.set(r.defaults),this.ctx=n.nativeElement.getContext("2d"),this.subs.push(this.themeService.colorschemesOptions.pipe(Ni()).subscribe(a=>this.themeChanged(a)))}ngOnChanges(n){let s=["type"],o=Object.getOwnPropertyNames(n);if(o.some(r=>s.includes(r))||o.every(r=>n[r].isFirstChange()))this.render();else{let r=this.getChartConfiguration();this.chart&&(Object.assign(this.chart.config.data,r.data),this.chart.config.plugins&&Object.assign(this.chart.config.plugins,r.plugins),this.chart.config.options&&Object.assign(this.chart.config.options,r.options)),this.update()}}ngOnDestroy(){this.chart&&(this.chart.destroy(),this.chart=void 0),this.subs.forEach(n=>n.unsubscribe())}render(){return this.chart&&this.chart.destroy(),this.zone.runOutsideAngular(()=>this.chart=new An(this.ctx,this.getChartConfiguration()))}update(n){this.chart&&this.zone.runOutsideAngular(()=>this.chart?.update(n))}hideDataset(n,s){this.chart&&(this.chart.getDatasetMeta(n).hidden=s,this.update())}isDatasetHidden(n){return this.chart?.getDatasetMeta(n)?.hidden}toBase64Image(){return this.chart?.toBase64Image()}themeChanged(n){this.themeOverrides=n,this.chart&&(this.chart.config.options&&Object.assign(this.chart.config.options,this.getChartOptions()),this.update())}getChartOptions(){return Kn({onHover:(n,s)=>{!this.chartHover.observed&&!this.chartHover.observers?.length||this.zone.run(()=>this.chartHover.emit({event:n,active:s}))},onClick:(n,s)=>{!this.chartClick.observed&&!this.chartClick.observers?.length||this.zone.run(()=>this.chartClick.emit({event:n,active:s}))}},this.themeOverrides,this.options,{plugins:{legend:{display:this.legend}}})}getChartConfiguration(){return{type:this.type,data:this.getChartData(),options:this.getChartOptions(),plugins:this.plugins}}getChartData(){return this.data?this.data:{labels:this.labels||[],datasets:this.datasets||[]}}};e.\u0275fac=function(s){return new(s||e)(Wt(he),Wt(pi),Wt(Vf),Wt(Yl,8))},e.\u0275dir=zo({type:e,selectors:[["canvas","baseChart",""]],inputs:{type:"type",legend:"legend",data:"data",options:"options",plugins:"plugins",labels:"labels",datasets:"datasets"},outputs:{chartClick:"chartClick",chartHover:"chartHover"},exportAs:["base-chart"],features:[hi]});let i=e;return i})();var Hf=["widgetbackground"],Nf=i=>({"widget-cursor":i});function jf(i,e){if(i&1&&(x(0,"div",7)(1,"div",8),y(2),w(3,"convertTemp"),w(4,"number"),w(5,"uppercase"),m(),x(6,"div",9),y(7),w(8,"translate"),m()()),i&2){let t=k();f(2),ne(" ",Mt(4,6,Mt(3,3,t.cpuTemperature.main,t.$settings.env.temperatureUnits),"1.0-0"),"\xB0",S(5,9,t.$settings.env.temperatureUnits)," "),f(5),T(S(8,11,"status.cpu.temp"))}}var Xl=(()=>{class i{$settings=R(zt);$ws=R(_t);widget;chart=xt(Jt);widgetBackground=xt("widgetbackground");cpu={};cpuTemperature={};currentLoad=0;refreshInterval;historyItems;lineChartType="line";lineChartData={datasets:[{data:[]}]};lineChartLabels=[];lineChartOptions={responsive:!0,elements:{point:{radius:0},line:{tension:.4,backgroundColor:"rgba(148,159,177,0.2)",borderColor:"rgba(148,159,177,0.2)",fill:"origin"}},plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{display:!1},y:{display:!1,max:100,min:0}}};io;intervalSubscription;constructor(){}ngOnInit(){this.io=this.$ws.getExistingNamespace("status");let t=getComputedStyle(this.widgetBackground().nativeElement).backgroundColor;t&&(this.lineChartOptions.elements.line.backgroundColor=t,this.lineChartOptions.elements.line.borderColor=t),this.io.connected.subscribe(()=>tt(this,null,function*(){this.getServerCpuInfo()})),this.io.socket.connected&&this.getServerCpuInfo(),this.widget.refreshInterval||(this.widget.refreshInterval=10),this.widget.historyItems||(this.widget.historyItems=60),this.refreshInterval=Math.min(60,Math.max(1,Number.parseInt(this.widget.refreshInterval,10))),this.historyItems=Math.min(60,Math.max(1,Number.parseInt(this.widget.historyItems,10))),this.intervalSubscription=Yt(this.refreshInterval*1e3).subscribe(()=>{this.io.socket.connected&&this.getServerCpuInfo()})}getServerCpuInfo(){this.io.request("get-server-cpu-info").subscribe(t=>{this.updateData(t),this.chart().update()})}updateData(t){this.cpuTemperature=t.cpuTemperature,this.currentLoad=t.currentLoad;let n=Object.keys(this.lineChartData.datasets[0].data).length;n?this.updateChartData(t,n):this.initializeChartData(t)}initializeChartData(t){let n=t.cpuLoadHistory.slice(-this.historyItems);this.lineChartData.datasets[0].data=kt({},n),this.lineChartLabels=n.map(()=>"point")}updateChartData(t,n){this.lineChartData.datasets[0].data[n]=t.currentLoad,this.lineChartLabels.push("point"),n>=this.historyItems&&this.shiftChartData()}shiftChartData(){let t={};Object.keys(this.lineChartData.datasets[0].data).forEach((n,s,o)=>{s+1<o.length&&(t[n]=this.lineChartData.datasets[0].data[o[s+1]])}),this.lineChartData.datasets[0].data=t,this.lineChartLabels=this.lineChartLabels.slice(1)}ngOnDestroy(){this.intervalSubscription.unsubscribe()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],viewQuery:function(n,s){n&1&&(bt(s.chart,Jt,5),bt(s.widgetBackground,Hf,5)),n&2&&Xt(2)},inputs:{widget:"widget"},decls:17,vars:18,consts:[["widgetbackground",""],[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-1"],[1,"drag-handler","p-2",3,"ngClass"],["baseChart","",1,"widget-chart","h-100","w-100",3,"data","labels","options","type"],[1,"hb-widget-chart-background"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","gridster-item-content","text-center"],[1,"d-flex","justify-content-around","flex-wrap","w-100"],[1,"text-center","widget-value-parent-wrap"],[1,"widget-value","mb-0"],[1,"widget-value-label","grey-text"]],template:function(n,s){n&1&&(x(0,"div",1)(1,"div",2),y(2),w(3,"translate"),m(),W(4,"canvas",3)(5,"div",4,0),x(7,"div",5)(8,"div",6)(9,"div",7)(10,"div",8),y(11),w(12,"number"),m(),x(13,"div",9),y(14),w(15,"translate"),m()(),D(16,jf,9,13,"div",7),m()()()),n&2&&(f(),z("ngClass",ot(16,Nf,s.widget.draggable)),f(),V(" ",S(3,9,"status.cpu.title_cpu")," "),f(2),z("data",s.lineChartData)("labels",s.lineChartLabels)("options",s.lineChartOptions)("type",s.lineChartType),f(7),V("",Mt(12,11,s.currentLoad,"1.0-0"),"%"),f(3),T(S(15,14,"status.cpu.load")),f(2),$(s.cpuTemperature.main>0?16:-1))},dependencies:[rt,Jt,Yi,we,Z,tn],styles:[".widget-chart[_ngcontent-%COMP%]{position:absolute;z-index:-1}"]})}return i})();var Uf=["pincode"],Yf=["qrcodecontainer"],Xf=(i,e)=>({"height.px":i,"width.px":e}),Gf=(i,e)=>({"green-text":i,"grey-text":e});function qf(i,e){if(i&1&&(x(0,"div",6),W(1,"app-qrcode",11),m()),i&2){let t=k();f(),z("data",t.setupUri)}}function Kf(i,e){i&1&&(x(0,"span"),y(1),w(2,"translate"),m()),i&2&&(f(),V(" \xB7 ",S(2,1,"status.code_scan")," "))}var Gl=(()=>{class i{$ws=R(_t);pincodeElement=xt("pincode");qrcodeContainerElement=xt("qrcodecontainer");resizeEvent;paired=!1;pin="Loading...";setupUri=null;qrCodeHeight;qrCodeWidth;io;constructor(){}ngOnInit(){this.io=this.$ws.getExistingNamespace("status"),this.resizeQrCode(),this.io.socket.on("homebridge-status",t=>{this.pin=t.pin,this.paired=t.paired,t.setupUri&&(this.setupUri=t.setupUri)}),this.io.socket.connected&&this.getPairingPin(),this.resizeEvent.subscribe({next:()=>{this.resizeQrCode()}})}resizeQrCode(){let t=this.qrcodeContainerElement().nativeElement.offsetHeight,n=this.qrcodeContainerElement().nativeElement.offsetWidth,s=this.pincodeElement().nativeElement.offsetHeight;this.qrCodeHeight=t-s,this.qrCodeWidth=n>this.qrCodeHeight?this.qrCodeHeight:n}getPairingPin(){this.io.request("get-homebridge-pairing-pin").subscribe(t=>{this.pin=t.pin,this.setupUri=t.setupUri,this.paired=t.paired})}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],viewQuery:function(n,s){n&1&&(bt(s.pincodeElement,Uf,5),bt(s.qrcodeContainerElement,Yf,5)),n&2&&Xt(2)},inputs:{resizeEvent:"resizeEvent"},decls:15,vars:14,consts:[["qrcodecontainer",""],["pincode",""],[1,"d-flex","w-100","p-2"],[1,"drag-handler","d-flex","flex-column","w-100","h-100"],[1,"w-100",3,"ngStyle"],[1,"text-center","qr-code-container","w-100","h-100","p-3"],[1,"w-100","h-100"],[1,"text-center","w-100","mt-auto","gridster-item-content"],[1,"mb-1"],[1,"grey-text","mb-1","small"],[1,"fas","fa-fw","fa-link",3,"ngClass"],[1,"mx-auto",3,"data"]],template:function(n,s){n&1&&(x(0,"div",2)(1,"div",3,0)(3,"div",4)(4,"div",5),D(5,qf,2,1,"div",6),m()(),x(6,"div",7,1)(8,"p",8),y(9),m(),x(10,"p",9),W(11,"i",10),y(12),w(13,"translate"),D(14,Kf,3,3,"span"),m()()()()),n&2&&(f(3),z("ngStyle",Bt(8,Xf,s.qrCodeHeight,s.qrCodeWidth)),f(2),$(s.setupUri?5:-1),f(4),T(s.pin),f(2),z("ngClass",Bt(11,Gf,s.paired,!s.paired)),f(),V(" ",S(13,6,s.paired?"status.widget.qr_paired":"status.widget.qr_unpaired")," "),f(2),$(s.paired?-1:14))},dependencies:[Ce,ar,Z,rt],encapsulation:2})}return i})();var Qf=["widgetcontainer"],Jf=["terminaltitle"],Zf=["logoutput"],tg=i=>({"background-color":i}),eg=(i,e)=>({color:i,"background-color":e}),ig=i=>({"widget-cursor":i}),ng=i=>({"height.px":i}),ql=(()=>{class i{$log=R(lr);$settings=R(zt);widgetContainerElement=xt("widgetcontainer");titleElement=xt("terminaltitle");termTarget=xt("logoutput");widget;resizeEvent;configureEvent;terminalHeight=200;fontSize=15;fontWeight="400";theme="dark";constructor(){}ngOnInit(){this.fontSize=this.widget.fontSize||15,this.fontWeight=this.widget.fontWeight||400,this.$settings.actualLightingMode==="dark"&&(this.widget.theme="dark"),this.theme=this.widget.theme||"dark",setTimeout(()=>{this.$log.startTerminal(this.termTarget(),{cursorBlink:!1,theme:this.theme!=="light"?{background:"#2b2b2b"}:{background:"#00000000",foreground:"#2b2b2b",cursor:"#d2d2d2",selection:"#d2d2d2"},allowTransparency:this.theme==="light",fontSize:this.fontSize,fontWeight:this.fontWeight},this.resizeEvent)}),this.resizeEvent.subscribe({next:()=>{this.terminalHeight=this.getTerminalHeight()}}),this.configureEvent.subscribe({next:()=>{let t=!1;this.widget.fontSize!==this.fontSize&&(this.fontSize=this.widget.fontSize,this.$log.term.options.fontSize=this.widget.fontSize,t=!0),this.widget.fontWeight!==this.fontWeight&&(this.fontWeight=this.widget.fontWeight,this.$log.term.options.fontWeight=this.widget.fontWeight,t=!0),this.widget.theme!==this.theme&&(this.theme=this.widget.theme,this.$log.term.options.theme=this.theme!=="light"?{background:"#2b2b2b"}:{background:"#00000000",foreground:"#2b2b2b",cursor:"#d2d2d2",selection:"#d2d2d2"},this.$log.term.options.allowTransparency=this.theme==="light",t=!0),t&&(this.resizeEvent.next(void 0),setTimeout(()=>{this.$log.term.scrollToBottom()},100))}})}getTerminalHeight(){let t=this.widgetContainerElement().nativeElement.offsetHeight,n=this.titleElement().nativeElement.offsetHeight;return t-n}ngOnDestroy(){this.$log.destroyTerminal()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],viewQuery:function(n,s){n&1&&(bt(s.widgetContainerElement,Qf,5),bt(s.titleElement,Jf,5),bt(s.termTarget,Zf,5)),n&2&&Xt(3)},inputs:{widget:"widget",resizeEvent:"resizeEvent",configureEvent:"configureEvent"},decls:9,vars:16,consts:[["widgetcontainer",""],["terminaltitle",""],["logoutput",""],[1,"flex-column","d-flex","align-items-stretch","h-100","w-100",3,"ngStyle"],[1,"drag-handler","p-2",3,"ngStyle","ngClass"],[1,"p-2",3,"ngStyle"],[1,"terminal","gridster-item-content","w-100","h-100",2,"max-height","100%"]],template:function(n,s){n&1&&(x(0,"div",3,0)(2,"div",4,1),y(4),w(5,"translate"),m(),x(6,"div",5),W(7,"div",6,2),m()()),n&2&&(z("ngStyle",ot(7,tg,s.theme==="dark"?"#2b2b2b":"")),f(2),z("ngStyle",Bt(9,eg,s.theme==="dark"?"#ffffff":"",s.theme==="dark"?"#2b2b2b":""))("ngClass",ot(12,ig,s.widget.draggable)),f(2),V(" ",S(5,5,"status.widget.homebridge_logs")," "),f(2),z("ngStyle",ot(14,ng,s.terminalHeight)))},dependencies:[rt,Ce,Z],encapsulation:2})}return i})();var sg=["widgetbackground"],og=i=>({"widget-cursor":i}),Kl=(()=>{class i{$ws=R(_t);widget;chart=xt(Jt);widgetBackground=xt("widgetbackground");totalMemory;freeMemory;refreshInterval;historyItems;lineChartType="line";lineChartData={datasets:[{data:[]}]};lineChartLabels=[];lineChartOptions={responsive:!0,elements:{point:{radius:0},line:{tension:.4,backgroundColor:"rgba(148,159,177,0.2)",borderColor:"rgba(148,159,177,0.2)",fill:"origin"}},plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{display:!1},y:{display:!1,max:100,min:0}}};io;intervalSubscription;constructor(){}ngOnInit(){this.io=this.$ws.getExistingNamespace("status");let t=getComputedStyle(this.widgetBackground().nativeElement).backgroundColor;t&&(this.lineChartOptions.elements.line.backgroundColor=t,this.lineChartOptions.elements.line.borderColor=t),this.io.connected.subscribe(()=>tt(this,null,function*(){this.getServerMemoryInfo()})),this.io.socket.connected&&this.getServerMemoryInfo(),this.widget.refreshInterval||(this.widget.refreshInterval=10),this.widget.historyItems||(this.widget.historyItems=60),this.refreshInterval=Math.min(60,Math.max(1,Number.parseInt(this.widget.refreshInterval,10))),this.historyItems=Math.min(60,Math.max(1,Number.parseInt(this.widget.historyItems,10))),this.intervalSubscription=Yt(this.refreshInterval*1e3).subscribe(()=>{this.io.socket.connected&&this.getServerMemoryInfo()})}getServerMemoryInfo(){this.io.request("get-server-memory-info").subscribe(t=>{this.updateData(t),this.chart().update()})}updateData(t){this.totalMemory=t.mem.total/1024/1024/1024,this.freeMemory=t.mem.available/1024/1024/1024;let n=Object.keys(this.lineChartData.datasets[0].data).length;n?this.updateChartData(t,n):this.initializeChartData(t)}initializeChartData(t){let n=t.memoryUsageHistory.slice(-this.historyItems);this.lineChartData.datasets[0].data=kt({},n),this.lineChartLabels=n.map(()=>"point")}updateChartData(t,n){this.lineChartData.datasets[0].data[n]=t.memoryUsageHistory.slice(-1)[0],this.lineChartLabels.push("point"),n>=this.historyItems&&this.shiftChartData()}shiftChartData(){let t={};Object.keys(this.lineChartData.datasets[0].data).forEach((n,s,o)=>{s+1<o.length&&(t[n]=this.lineChartData.datasets[0].data[o[s+1]])}),this.lineChartData.datasets[0].data=t,this.lineChartLabels=this.lineChartLabels.slice(1)}ngOnDestroy(){this.intervalSubscription.unsubscribe()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],viewQuery:function(n,s){n&1&&(bt(s.chart,Jt,5),bt(s.widgetBackground,sg,5)),n&2&&Xt(2)},inputs:{widget:"widget"},decls:23,vars:24,consts:[["widgetbackground",""],[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-1"],[1,"drag-handler","p-2",3,"ngClass"],["baseChart","",1,"widget-chart","h-100","w-100",3,"data","labels","options","type"],[1,"hb-widget-chart-background"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","gridster-item-content","text-center"],[1,"d-flex","justify-content-around","flex-wrap","w-100"],[1,"text-center","widget-value-parent-wrap"],[1,"widget-value","mb-0"],[1,"widget-value-label","grey-text"]],template:function(n,s){n&1&&(x(0,"div",1)(1,"div",2),y(2),w(3,"translate"),m(),W(4,"canvas",3)(5,"div",4,0),x(7,"div",5)(8,"div",6)(9,"div",7)(10,"div",8),y(11),w(12,"number"),m(),x(13,"div",9),y(14),w(15,"translate"),m()(),x(16,"div",7)(17,"div",8),y(18),w(19,"number"),m(),x(20,"div",9),y(21),w(22,"translate"),m()()()()()),n&2&&(f(),z("ngClass",ot(22,og,s.widget.draggable)),f(),V(" ",S(3,10,"status.memory.title_memory")," "),f(2),z("data",s.lineChartData)("labels",s.lineChartLabels)("options",s.lineChartOptions)("type",s.lineChartType),f(7),V("",Mt(12,12,s.totalMemory,"1.0-2")," GB"),f(3),T(S(15,15,"status.memory.label_total")),f(4),V("",Mt(19,17,s.freeMemory,"1.0-2")," GB"),f(3),T(S(22,20,"status.memory.label_available")))},dependencies:[rt,Jt,we,Z],styles:[".widget-chart[_ngcontent-%COMP%]{position:absolute;z-index:-1}"]})}return i})();var rg=["widgetbackground"],ag=i=>({"widget-cursor":i}),Ql=(()=>{class i{$ws=R(_t);widget;chart=xt(Jt);widgetBackground=xt("widgetbackground");interface;receivedPerSec;sentPerSec;refreshInterval;historyItems;lineChartType="line";lineChartData={datasets:[{data:[]}]};lineChartLabels=[];lineChartOptions={responsive:!0,elements:{point:{radius:0},line:{tension:.4,backgroundColor:"rgba(148,159,177,0.2)",borderColor:"rgba(148,159,177,0.2)",fill:"origin"}},plugins:{legend:{display:!1},tooltip:{enabled:!1}},scales:{x:{display:!1},y:{display:!1,min:0}}};io;intervalSubscription;constructor(){}ngOnInit(){this.io=this.$ws.getExistingNamespace("status");let t=getComputedStyle(this.widgetBackground().nativeElement).backgroundColor;t&&(this.lineChartOptions.elements.line.backgroundColor=t,this.lineChartOptions.elements.line.borderColor=t),this.io.connected.subscribe(()=>tt(this,null,function*(){this.getServerNetworkInfo()})),this.io.socket.connected&&this.getServerNetworkInfo(),this.widget.refreshInterval||(this.widget.refreshInterval=10),this.widget.historyItems||(this.widget.historyItems=60),this.refreshInterval=Math.min(60,Math.max(1,Number.parseInt(this.widget.refreshInterval,10))),this.historyItems=Math.min(60,Math.max(1,Number.parseInt(this.widget.historyItems,10))),this.intervalSubscription=Yt(this.refreshInterval*1e3).subscribe(()=>{this.io.socket.connected&&this.getServerNetworkInfo()})}getServerNetworkInfo(){this.io.request("get-server-network-info",{netInterfaces:[this.widget.networkInterface]}).subscribe(t=>{this.interface!==t.net.iface&&(this.widget.networkInterface=t.net.iface,this.interface=t.net.iface,this.lineChartData.datasets[0].data=kt({},[]),this.lineChartLabels=[],this.chart().update()),this.receivedPerSec=t.net.rx_sec/1024/1024*8,this.sentPerSec=t.net.tx_sec/1024/1024*8,t.point<1&&(t.point=0),this.updateData(t),this.chart().update()})}updateData(t){let n=Object.keys(this.lineChartData.datasets[0].data).length;n?this.updateChartData(t,n):this.initializeChartData(t)}initializeChartData(t){let n=[t.point];this.lineChartData.datasets[0].data=kt({},n),this.lineChartLabels=n.map(()=>"point")}updateChartData(t,n){this.lineChartData.datasets[0].data[n]=t.point,this.lineChartLabels.push("point"),n>=this.historyItems&&this.shiftChartData()}shiftChartData(){let t={};Object.keys(this.lineChartData.datasets[0].data).forEach((n,s,o)=>{s+1<o.length&&(t[n]=this.lineChartData.datasets[0].data[o[s+1]])}),this.lineChartData.datasets[0].data=t,this.lineChartLabels=this.lineChartLabels.slice(1)}ngOnDestroy(){this.intervalSubscription.unsubscribe()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],viewQuery:function(n,s){n&1&&(bt(s.chart,Jt,5),bt(s.widgetBackground,rg,5)),n&2&&Xt(2)},inputs:{widget:"widget"},decls:23,vars:25,consts:[["widgetbackground",""],[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-1"],[1,"drag-handler","p-2",3,"ngClass"],["baseChart","",1,"widget-chart","h-100","w-100",3,"data","labels","options","type"],[1,"hb-widget-chart-background"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","gridster-item-content","text-center"],[1,"d-flex","justify-content-around","flex-wrap","w-100"],[1,"text-center","widget-value-parent-wrap"],[1,"widget-value","mb-0"],[1,"widget-value-label","grey-text"]],template:function(n,s){n&1&&(x(0,"div",1)(1,"div",2),y(2),w(3,"translate"),m(),W(4,"canvas",3)(5,"div",4,0),x(7,"div",5)(8,"div",6)(9,"div",7)(10,"div",8),y(11),w(12,"number"),m(),x(13,"div",9),y(14),w(15,"translate"),m()(),x(16,"div",7)(17,"div",8),y(18),w(19,"number"),m(),x(20,"div",9),y(21),w(22,"translate"),m()()()()()),n&2&&(f(),z("ngClass",ot(23,ag,s.widget.draggable)),f(),ne(" ",S(3,11,"status.network.title_network")," (",s.widget.networkInterface,") "),f(2),z("data",s.lineChartData)("labels",s.lineChartLabels)("options",s.lineChartOptions)("type",s.lineChartType),f(7),V("",Mt(12,13,s.receivedPerSec,"1.0-1")," Mb/s"),f(3),T(S(15,16,"status.network.received_per_second")),f(4),V("",Mt(19,18,s.sentPerSec,"1.0-1")," Mb/s"),f(3),T(S(22,21,"status.network.sent_per_second")))},dependencies:[rt,Jt,we,Z],styles:[".widget-chart[_ngcontent-%COMP%]{position:absolute;z-index:-1}"]})}return i})();var lg=i=>({"widget-cursor":i});function cg(i,e){if(i&1&&y(0),i&2){let t=k(4);Gn(" ",t.serverInfo.os.distro," ",t.serverInfo.os.codename," (",t.serverInfo.os.release,") ")}}function dg(i,e){if(i&1&&y(0),i&2){let t=k(4);V(" ",t.serverInfo.os.distro," ")}}function hg(i,e){if(i&1){let t=j();x(0,"a",7),X("click",function(){A(t);let s=k(5);return B(s.glibcVersionModal())}),W(1,"i",8),m()}}function ug(i,e){if(i&1&&(D(0,hg,2,0,"a",6),y(1),w(2,"titlecase")),i&2){let t=k(4);$(t.nodejsInfo.showGlibcUnsupportedWarning?0:-1),f(),Gn(" ",t.serverInfo.os.distro," ",S(2,4,t.serverInfo.os.codename)," (",t.serverInfo.os.release,") ")}}function pg(i,e){if(i&1&&(x(0,"td",5),D(1,cg,1,3)(2,dg,1,1)(3,ug,3,6),m()),i&2){let t,n=k(3);f(),$((t=n.serverInfo.os.platform)==="darwin"?1:t==="win32"?2:3)}}function fg(i,e){i&1&&(x(0,"td",5),y(1,"Synology DSM"),m())}function gg(i,e){if(i&1&&(x(0,"tr")(1,"th",4),y(2),w(3,"translate"),m(),D(4,pg,4,1,"td",5),D(5,fg,2,0,"td",5),m(),x(6,"tr")(7,"th",4),y(8),w(9,"translate"),m(),x(10,"td",5),y(11),m()()),i&2){let t=k(2);f(2),T(S(3,5,"status.widget.info.os")),f(2),$(t.serverInfo.homebridgeRunningInSynologyPackage?-1:4),f(),$(t.serverInfo.homebridgeRunningInSynologyPackage?5:-1),f(3),T(S(9,7,"status.widget.info.arch")),f(3),T(t.serverInfo.os.arch)}}function mg(i,e){if(i&1&&(x(0,"tr")(1,"th",4),y(2),w(3,"translate"),m(),x(4,"td",5),y(5),m()()),i&2){let t=k(2);f(2),ne(" ",S(3,3,"status.widget.info.ipv4")," (",t.serverInfo.network.iface,") "),f(3),T(t.serverInfo.network.ip4)}}function bg(i,e){if(i&1&&(x(0,"tr")(1,"th",4),y(2),w(3,"translate"),m(),x(4,"td",5),y(5),m()()),i&2){let t=k(2);f(2),ne(" ",S(3,3,"status.widget.info.ipv6")," (",t.serverInfo.network.iface,") "),f(3),T(t.serverInfo.network.ip6)}}function xg(i,e){if(i&1&&(x(0,"tr")(1,"th",4),y(2),w(3,"translate"),m(),x(4,"td",5),y(5),m()()),i&2){let t=k(2);f(2),T(S(3,2,"status.widget.info.hostname")),f(3),T(t.serverInfo.os.hostname)}}function _g(i,e){i&1&&(x(0,"tr")(1,"th",4),y(2),w(3,"translate"),m(),x(4,"td",9),y(5),w(6,"translate"),m()()),i&2&&(f(2),T(S(3,2,"status.widget.info.docker")),f(3),T(S(6,4,"status.widget.info.yes")))}function yg(i,e){i&1&&(x(0,"tr")(1,"th",4),y(2),w(3,"translate"),m(),x(4,"td",9),y(5),w(6,"translate"),m()()),i&2&&(f(2),T(S(3,2,"status.widget.info.synology_package")),f(3),T(S(6,4,"status.widget.info.yes")))}function Cg(i,e){if(i&1&&(x(0,"div",2)(1,"table",3)(2,"tbody"),D(3,gg,12,9),D(4,mg,6,5,"tr"),D(5,bg,6,5,"tr"),D(6,xg,6,4,"tr"),x(7,"tr")(8,"th",4),y(9),w(10,"translate"),m(),x(11,"td",5),y(12),m()(),x(13,"tr")(14,"th",4),y(15),w(16,"translate"),m(),x(17,"td",5),y(18),m()(),x(19,"tr")(20,"th",4),y(21),w(22,"translate"),m(),x(23,"td",5),y(24),m()(),x(25,"tr")(26,"th",4),y(27),w(28,"translate"),m(),x(29,"td",5),y(30),m()(),x(31,"tr")(32,"th",4),y(33),w(34,"translate"),m(),x(35,"td",5),y(36),m()(),x(37,"tr")(38,"th",4),y(39),w(40,"translate"),m(),x(41,"td",5),y(42),m()(),D(43,_g,7,6,"tr"),D(44,yg,7,6,"tr"),m()()()),i&2){let t=k();f(3),$(t.serverInfo.os?3:-1),f(),$(t.serverInfo.network.ip4?4:-1),f(),$(t.serverInfo.network.ip6?5:-1),f(),$(t.serverInfo.os?6:-1),f(3),T(S(10,18,"status.widget.info.service_user")),f(3),T(t.serverInfo.serviceUser),f(3),T(S(16,20,"status.widget.info.nodejs_path")),f(3),T(t.nodejsInfo.installPath),f(3),T(S(22,22,"status.widget.info.storage_path")),f(3),T(t.serverInfo.homebridgeStoragePath),f(3),T(S(28,24,"status.widget.info.config_path")),f(3),T(t.serverInfo.homebridgeConfigJsonPath),f(3),T(S(34,26,"status.widget.info.plugin_path")),f(3),T(t.serverInfo.homebridgeCustomPluginPath||t.serverInfo.homebridgePluginPath),f(3),T(S(40,28,"status.widget.info.timezone")),f(3),T(t.serverInfo.time.timezone),f(),$(t.serverInfo.homebridgeRunningInDocker?43:-1),f(),$(t.serverInfo.homebridgeRunningInSynologyPackage?44:-1)}}var Jl=(()=>{class i{$modal=R(Xe);$translate=R(Gt);$ws=R(_t);widget;serverInfo;nodejsInfo={};io;constructor(){}ngOnInit(){this.io=this.$ws.getExistingNamespace("status"),this.io.connected.subscribe(()=>tt(this,null,function*(){this.getSystemInfo()})),this.io.socket.connected&&this.getSystemInfo()}getSystemInfo(){this.io.request("get-homebridge-server-info").subscribe(t=>{this.serverInfo=t}),this.io.request("nodejs-version-check").subscribe(t=>{this.nodejsInfo=t})}glibcVersionModal(){let t=this.$modal.open(fi,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("status.widget.info.glibc_title"),t.componentInstance.message=this.$translate.instant("status.widget.info.glibc_message"),t.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),t.componentInstance.faIconClass="fab fa-fw fa-node-js primary-text",t.componentInstance.ctaButtonLink="https://github.com/homebridge/homebridge-config-ui-x/wiki/Troubleshooting/#error---update-node---your-version-of-linux-does-not-meet-the-glibc-version"}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget"},decls:5,vars:7,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-1","overflow-auto","no-scrollbars"],[1,"drag-handler","p-2",3,"ngClass"],[1,"d-flex","flex-wrap","w-100","px-1"],[1,"table","table-sm","table-borderless","gridster-item-content"],["scope","row",1,"text-nowrap"],[1,"grey-text"],["href","javascript:void(0)",1,"system-info-link"],["href","javascript:void(0)",1,"system-info-link",3,"click"],[1,"primary-text","fas","fa-fw","fa-exclamation-circle"],[1,"text-nowrap","grey-text"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1),y(2),w(3,"translate"),m(),D(4,Cg,45,30,"div",2),m()),n&2&&(f(),z("ngClass",ot(5,lg,s.widget.draggable)),f(),V(" ",S(3,3,"status.widget.info")," "),f(2),$(s.serverInfo?4:-1))},dependencies:[rt,Ui,Z],styles:["table.table-sm[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table.table-sm[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding-top:.3rem;padding-bottom:.3rem}@media (hover: hover){.system-info-link[_ngcontent-%COMP%]:hover{text-decoration:underline}} body.dark-mode .system-info-link{color:#fff!important}"]})}return i})();var wg=["widgetcontainer"],vg=["terminaltitle"],Sg=["terminaloutput"],Ig=i=>({"background-color":i}),kg=(i,e)=>({color:i,"background-color":e}),Mg=i=>({"widget-cursor":i}),Tg=i=>({"height.px":i}),Zl=(()=>{class i{$terminal=R(cr);$settings=R(zt);widgetContainerElement=xt("widgetcontainer");titleElement=xt("terminaltitle");termTarget=xt("terminaloutput");widget;resizeEvent;configureEvent;terminalHeight=200;fontSize=15;fontWeight="400";theme="dark";constructor(){}ngOnInit(){this.fontSize=this.widget.fontSize||15,this.fontWeight=this.widget.fontWeight||400,this.$settings.actualLightingMode==="dark"&&(this.widget.theme="dark"),this.theme=this.widget.theme||"dark",setTimeout(()=>{this.$terminal.startTerminal(this.termTarget(),{cursorBlink:!1,theme:this.theme!=="light"?{background:"#2b2b2b"}:{background:"#00000000",foreground:"#2b2b2b",cursor:"#d2d2d2",selection:"#d2d2d2"},allowTransparency:this.theme==="light",fontSize:this.fontSize,fontWeight:this.fontWeight},this.resizeEvent)}),this.resizeEvent.subscribe({next:()=>{this.terminalHeight=this.getTerminalHeight()}}),this.configureEvent.subscribe({next:()=>{let t=!1;this.widget.fontSize!==this.fontSize&&(this.fontSize=this.widget.fontSize,this.$terminal.term.options.fontSize=this.widget.fontSize,t=!0),this.widget.fontWeight!==this.fontWeight&&(this.fontWeight=this.widget.fontWeight,this.$terminal.term.options.fontWeight=this.widget.fontWeight,t=!0),this.widget.theme!==this.theme&&(this.theme=this.widget.theme,this.$terminal.term.options.theme=this.theme!=="light"?{background:"#2b2b2b"}:{background:"#00000000",foreground:"#2b2b2b",cursor:"#d2d2d2",selection:"#d2d2d2"},this.$terminal.term.options.allowTransparency=this.theme==="light",t=!0),t&&(this.resizeEvent.next(void 0),setTimeout(()=>{this.$terminal.term.scrollToBottom()},100))}})}getTerminalHeight(){let t=this.widgetContainerElement().nativeElement.offsetHeight,n=this.titleElement().nativeElement.offsetHeight;return t-n}ngOnDestroy(){this.$terminal.destroyTerminal()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],viewQuery:function(n,s){n&1&&(bt(s.widgetContainerElement,wg,5),bt(s.titleElement,vg,5),bt(s.termTarget,Sg,5)),n&2&&Xt(3)},inputs:{widget:"widget",resizeEvent:"resizeEvent",configureEvent:"configureEvent"},decls:9,vars:16,consts:[["widgetcontainer",""],["terminaltitle",""],["terminaloutput",""],[1,"flex-column","d-flex","align-items-stretch","h-100","w-100",3,"ngStyle"],[1,"drag-handler","p-2",3,"ngStyle","ngClass"],[1,"p-2",3,"ngStyle"],[1,"terminal","gridster-item-content","w-100","h-100",2,"max-height","100%"]],template:function(n,s){n&1&&(x(0,"div",3,0)(2,"div",4,1),y(4),w(5,"translate"),m(),x(6,"div",5),W(7,"div",6,2),m()()),n&2&&(z("ngStyle",ot(7,Ig,s.theme==="dark"?"#2b2b2b":"")),f(2),z("ngStyle",Bt(9,kg,s.theme==="dark"?"#ffffff":"",s.theme==="dark"?"#2b2b2b":""))("ngClass",ot(12,Mg,s.widget.draggable)),f(2),V(" Homebridge ",S(5,5,"menu.docker.terminal")," "),f(2),z("ngStyle",ot(14,Tg,s.terminalHeight)))},dependencies:[rt,Ce,Z],encapsulation:2})}return i})();var Pg=i=>({"widget-cursor":i}),Eg=(i,e)=>({"green-text":i,"orange-text":e});function Dg(i,e){i&1&&W(0,"i",6)}function $g(i,e){i&1&&W(0,"i",7)}function Og(i,e){i&1&&W(0,"i",8)}function Wg(i,e){if(i&1){let t=j();x(0,"a",15),X("click",function(){A(t);let s=k(2);return B(s.readyForV2Modal())}),W(1,"i",16),m()}if(i&2){let t=k(2);f(),z("ngClass",Bt(1,Eg,t.isHbV2Ready,!t.isHbV2Ready))}}function Lg(i,e){if(i&1){let t=j();x(0,"a",13),X("click",function(){A(t);let s=k();return B(s.$plugin.installAlternateVersion(s.homebridgePkg))}),y(1,"Homebridge"),m(),D(2,Wg,2,4,"a",14)}if(i&2){let t=k();f(2),$(t.isRunningHbV2?-1:2)}}function zg(i,e){i&1&&(x(0,"span"),y(1,"Homebridge"),m())}function Rg(i,e){i&1&&(x(0,"span",10),y(1),w(2,"translate"),m()),i&2&&(f(),T(S(2,1,"status.homebridge.checking")))}function Fg(i,e){if(i&1){let t=j();y(0," \xB7 "),x(1,"a",17),X("click",function(){A(t);let s=k(2);return B(s.$plugin.upgradeHomebridge(s.homebridgePkg,s.homebridgePkg.updateTag||"latest"))}),y(2),w(3,"translate"),m()}i&2&&(f(2),V(" ",S(3,1,"plugins.button_update")," "))}function Ag(i,e){if(i&1&&(x(0,"span",10),y(1),m(),D(2,Fg,4,3)),i&2){let t=k();f(),V("v",t.$settings.env.homebridgeVersion),f(),$(t.homebridgePkg.updateAvailable?2:-1)}}function Bg(i,e){i&1&&W(0,"i",6)}function Vg(i,e){i&1&&W(0,"i",7)}function Hg(i,e){i&1&&W(0,"i",8)}function Ng(i,e){if(i&1){let t=j();x(0,"a",13),X("click",function(){A(t);let s=k();return B(s.$plugin.installAlternateVersion(s.homebridgeUiPkg))}),y(1,"Homebridge UI"),m()}}function jg(i,e){i&1&&(x(0,"span"),y(1,"Homebridge UI"),m())}function Ug(i,e){i&1&&(x(0,"span",10),y(1),w(2,"translate"),m()),i&2&&(f(),T(S(2,1,"status.homebridge.checking")))}function Yg(i,e){if(i&1){let t=j();y(0," \xB7 "),x(1,"a",17),X("click",function(){A(t);let s=k(2);return B(s.$plugin.upgradeHomebridge(s.homebridgeUiPkg,s.homebridgeUiPkg.updateTag||"latest"))}),y(2),w(3,"translate"),m()}i&2&&(f(2),V(" ",S(3,1,"plugins.button_update")," "))}function Xg(i,e){if(i&1&&(x(0,"span",10),y(1),m(),D(2,Yg,4,3)),i&2){let t=k();f(),V("v",t.$settings.env.packageVersion),f(),$(t.homebridgeUiPkg.updateAvailable?2:-1)}}function Gg(i,e){i&1&&W(0,"i",6)}function qg(i,e){i&1&&W(0,"i",8)}function Kg(i,e){i&1&&W(0,"i",7)}function Qg(i,e){i&1&&(x(0,"span",10),y(1),w(2,"translate"),m()),i&2&&(f(),T(S(2,1,"status.homebridge.checking")))}function Jg(i,e){i&1&&(x(0,"span",10),y(1),w(2,"translate"),m()),i&2&&(f(),T(S(2,1,"status.homebridge.up_to_date")))}function Zg(i,e){i&1&&(x(0,"a",18),y(1),w(2,"translate"),m()),i&2&&(f(),T(S(2,1,"plugins.button_update")))}function tm(i,e){if(i&1&&(D(0,Jg,3,3,"span",10),D(1,Zg,3,3,"a",18)),i&2){let t=k();$(t.homebridgePluginStatus.length?-1:0),f(),$(t.homebridgePluginStatus.length?1:-1)}}function em(i,e){i&1&&W(0,"i",6)}function im(i,e){i&1&&W(0,"i",19)}function nm(i,e){i&1&&W(0,"i",8)}function sm(i,e){i&1&&W(0,"i",20)}function om(i,e){i&1&&W(0,"i",7)}function rm(i,e){if(i&1&&(D(0,nm,1,0,"i",8),D(1,sm,1,0,"i",20),D(2,om,1,0,"i",7)),i&2){let t=k(2);$(t.nodejsInfo.updateAvailable?0:-1),f(),$(t.nodejsInfo.showNodeUnsupportedWarning&&!t.nodejsInfo.updateAvailable?1:-1),f(),$(!t.nodejsInfo.updateAvailable&&!t.nodejsInfo.showNodeUnsupportedWarning?2:-1)}}function am(i,e){if(i&1&&(D(0,im,1,0,"i",19),D(1,rm,3,3)),i&2){let t=k();$(t.widget.hideNodeInfo?0:-1),f(),$(t.widget.hideNodeInfo?-1:1)}}function lm(i,e){i&1&&(x(0,"span",10),y(1),w(2,"translate"),m()),i&2&&(f(),T(S(2,1,"status.homebridge.checking")))}function cm(i,e){if(i&1){let t=j();y(0," \xB7 "),x(1,"a",17),X("click",function(){A(t);let s=k(3);return B(s.nodeUpdateModal())}),y(2),w(3,"translate"),m()}i&2&&(f(2),V(" ",S(3,1,"plugins.button_update")," "))}function dm(i,e){if(i&1){let t=j();y(0," \xB7 "),x(1,"a",17),X("click",function(){A(t);let s=k(3);return B(s.nodeUnsupportedModal())}),y(2),w(3,"translate"),m()}i&2&&(f(2),V(" ",S(3,1,"status.widget.info.node_unsupp")," "))}function hm(i,e){if(i&1&&(D(0,cm,4,3),D(1,dm,4,3)),i&2){let t=k(2);$(t.nodejsInfo.updateAvailable?0:-1),f(),$(t.nodejsInfo.showNodeUnsupportedWarning&&!t.nodejsInfo.updateAvailable?1:-1)}}function um(i,e){if(i&1&&(x(0,"span",10),y(1),m(),D(2,hm,2,2)),i&2){let t=k();f(),T(t.serverInfo.nodeVersion),f(),$(t.widget.hideNodeInfo?-1:2)}}var tc=(()=>{class i{$api=R(Ge);$modal=R(Xe);$plugin=R(hr);$settings=R(zt);$toastr=R(Ji);$translate=R(Gt);$ws=R(_t);widget;homebridgePkg={};homebridgeUiPkg={};homebridgePluginStatus=[];homebridgePluginStatusDone=!1;nodejsInfo={};nodejsStatusDone=!1;serverInfo;isRunningHbV2=!1;isHbV2Ready=!1;isUiV5Ready=!1;io;constructor(){}ngOnInit(){return tt(this,null,function*(){if(this.io=this.$ws.getExistingNamespace("status"),this.io.connected.subscribe(()=>tt(this,null,function*(){yield Promise.all([this.checkHomebridgeVersion(),this.checkHomebridgeUiVersion(),this.getOutOfDatePlugins(),this.getNodeInfo()])})),this.io.socket.connected&&(yield Promise.all([this.checkHomebridgeVersion(),this.checkHomebridgeUiVersion(),this.getOutOfDatePlugins(),this.getNodeInfo()])),this.isHbV2Ready=this.homebridgeUiPkg.readyForV5.node,!this.isRunningHbV2){let n=(yield At(this.$api.get("/plugins"))).filter(s=>s.name!=="homebridge-config-ui-x").every(s=>(s.engines?.homebridge?.split("||").map(r=>r.trim())||[]).some(r=>r.startsWith("^2")||r.startsWith(">=2")));this.isHbV2Ready=this.isHbV2Ready&&n}})}checkHomebridgeVersion(){return tt(this,null,function*(){try{let t=yield At(this.io.request("homebridge-version-check"));this.homebridgePkg=t,this.homebridgePkg.displayName="Homebridge",this.$settings.env.homebridgeVersion=t.installedVersion,this.isRunningHbV2=t.installedVersion.startsWith("2.")}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}getNodeInfo(){return tt(this,null,function*(){try{this.serverInfo=yield At(this.io.request("get-homebridge-server-info")),this.nodejsInfo=yield At(this.io.request("nodejs-version-check")),this.nodejsStatusDone=!0}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}checkHomebridgeUiVersion(){return tt(this,null,function*(){try{let t=yield At(this.io.request("homebridge-ui-version-check"));this.homebridgeUiPkg=t,this.$settings.env.homebridgeUiVersion=t.installedVersion}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}getOutOfDatePlugins(){return tt(this,null,function*(){try{let t=yield At(this.io.request("get-out-of-date-plugins"));this.homebridgePluginStatus=t.filter(n=>n.name!=="homebridge-config-ui-x"&&!this.$settings.env.plugins?.hideUpdatesFor?.includes(n.name)),this.homebridgePluginStatusDone=!0}catch(t){console.error(t),this.$toastr.error(t.message,this.$translate.instant("toast.title_error"))}})}nodeUpdateModal(){let t=this.$modal.open(fi,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("status.widget.info.node_update_title"),t.componentInstance.message=this.$translate.instant("status.widget.info.node_update_message"),(this.serverInfo.homebridgeRunningInSynologyPackage||this.serverInfo.homebridgeRunningInDocker)&&(t.componentInstance.message2=this.$translate.instant("status.widget.info.node_update_message_2")),t.componentInstance.subtitle=`${this.serverInfo.nodeVersion} &rarr; ${this.nodejsInfo.latestVersion}`,t.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),t.componentInstance.faIconClass="fab fa-fw fa-node-js primary-text",t.componentInstance.ctaButtonLink="https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js"}nodeUnsupportedModal(){let t=this.$modal.open(fi,{size:"lg",backdrop:"static"});t.componentInstance.title=this.$translate.instant("status.widget.info.node_unsupp_title"),t.componentInstance.message=this.$translate.instant("status.widget.info.node_unsupp_message"),t.componentInstance.ctaButtonLabel=this.$translate.instant("form.button_more_info"),t.componentInstance.faIconClass="fab fa-fw fa-node-js primary-text",t.componentInstance.ctaButtonLink="https://github.com/homebridge/homebridge/wiki/How-To-Update-Node.js"}readyForV2Modal(){let t=this.$modal.open(dr,{size:"lg",backdrop:"static"});t.componentInstance.isUpdating=!1}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget"},decls:52,vars:32,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-2"],[1,"drag-handler","p-2",3,"ngClass"],[1,"d-flex","flex-wrap","w-100","mt-1","justify-content-start","gridster-item-content","overflow-auto","no-scrollbars","align-items-center"],[1,"hb-status-item","d-flex","flex-row","mb-1",2,"min-width","max(25%, 225px)"],[1,"d-flex","ps-3","py-1"],[1,"mb-0","d-flex","align-items-center"],[1,"fas","fa-fw","fa-lg","fa-cog","fa-spin","primary-text"],[1,"fas","fa-fw","fa-lg","fa-check-circle","green-text"],[1,"fas","fa-fw","fa-lg","fa-arrow-alt-circle-up","orange-text"],[1,"align-self-center","px-3"],[1,"grey-text","small"],["href","javascript:void(0)",1,"card-link","card-link-title"],["href","javascript:void(0)","routerLink","/plugins",1,"card-link","card-link-title"],["href","javascript:void(0)",1,"card-link","card-link-title",3,"click"],["href","javascript:void(0)","ngbTooltip","Homebridge v2 Readiness","container","body","openDelay","150","triggers","hover","placement","top","aria-label","Homebridge v2 Readiness",1,"ms-1"],["href","javascript:void(0)","ngbTooltip","Homebridge v2 Readiness","container","body","openDelay","150","triggers","hover","placement","top","aria-label","Homebridge v2 Readiness",1,"ms-1",3,"click"],[1,"fas","fa-fw","fa-info-circle",3,"ngClass"],["href","javascript:void(0)",1,"primary-text","small",3,"click"],["routerLink","/plugins",1,"primary-text","small"],[1,"fas","fa-fw","fa-lg","fa-circle","green-text"],[1,"fas","fa-fw","fa-lg","fa-exclamation-circle","orange-text"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1),y(2),w(3,"translate"),m(),x(4,"div",2)(5,"div",3)(6,"div",4)(7,"div",5),D(8,Dg,1,0,"i",6),D(9,$g,1,0,"i",7),D(10,Og,1,0,"i",8),m(),x(11,"div",9),D(12,Lg,3,1),D(13,zg,2,0,"span"),W(14,"br"),D(15,Rg,3,3,"span",10),D(16,Ag,3,2),m()()(),x(17,"div",3)(18,"div",4)(19,"div",5),D(20,Bg,1,0,"i",6),D(21,Vg,1,0,"i",7),D(22,Hg,1,0,"i",8),m(),x(23,"div",9),D(24,Ng,2,0,"a",11),D(25,jg,2,0,"span"),W(26,"br"),D(27,Ug,3,3,"span",10),D(28,Xg,3,2),m()()(),x(29,"div",3)(30,"div",4)(31,"div",5),D(32,Gg,1,0,"i",6),D(33,qg,1,0,"i",8),D(34,Kg,1,0,"i",7),m(),x(35,"div",9)(36,"a",12),y(37),w(38,"translate"),m(),W(39,"br"),D(40,Qg,3,3,"span",10),D(41,tm,2,2),m()()(),x(42,"div",3)(43,"div",4)(44,"div",5),D(45,em,1,0,"i",6),D(46,am,2,2),m(),x(47,"div",9),y(48," Node.js "),W(49,"br"),D(50,lm,3,3,"span",10),D(51,um,3,2),m()()()()()),n&2&&(f(),z("ngClass",ot(30,Pg,s.widget.draggable)),f(),V(" ",S(3,26,"status.services.updates")," "),f(6),$(s.homebridgePkg.installedVersion?-1:8),f(),$(s.homebridgePkg.installedVersion&&!s.homebridgePkg.updateAvailable?9:-1),f(),$(s.homebridgePkg.installedVersion&&s.homebridgePkg.updateAvailable?10:-1),f(2),$(s.homebridgePkg.installedVersion?12:-1),f(),$(s.homebridgePkg.installedVersion?-1:13),f(2),$(s.homebridgePkg.installedVersion?-1:15),f(),$(s.homebridgePkg.installedVersion?16:-1),f(4),$(s.homebridgeUiPkg.installedVersion?-1:20),f(),$(s.homebridgeUiPkg.installedVersion&&!s.homebridgeUiPkg.updateAvailable?21:-1),f(),$(s.homebridgeUiPkg.installedVersion&&s.homebridgeUiPkg.updateAvailable?22:-1),f(2),$(s.homebridgeUiPkg.installedVersion?24:-1),f(),$(s.homebridgeUiPkg.installedVersion?-1:25),f(2),$(s.homebridgeUiPkg.installedVersion?-1:27),f(),$(s.homebridgeUiPkg.installedVersion?28:-1),f(4),$(s.homebridgePluginStatusDone?-1:32),f(),$(s.homebridgePluginStatusDone&&s.homebridgePluginStatus.length?33:-1),f(),$(s.homebridgePluginStatusDone&&!s.homebridgePluginStatus.length?34:-1),f(3),V(" ",S(38,28,"menu.label_plugins")," "),f(3),$(s.homebridgePluginStatusDone?-1:40),f(),$(s.homebridgePluginStatusDone?41:-1),f(4),$(s.nodejsStatusDone?-1:45),f(),$(s.nodejsStatusDone?46:-1),f(4),$(s.nodejsStatusDone?-1:50),f(),$(s.nodejsStatusDone?51:-1))},dependencies:[rt,Z,tr],styles:[".hb-status-icon[_ngcontent-%COMP%]{font-size:20px}@media (max-width: 767px){.hb-status-item[_ngcontent-%COMP%]{width:100%}} body.dark-mode .card-link-title{color:#fff!important}"]})}return i})();var pm=i=>({"widget-cursor":i}),ec=(()=>{class i{$ws=R(_t);widget;serverUptime;processUptime;io;intervalSubscription;constructor(){}ngOnInit(){this.io=this.$ws.getExistingNamespace("status"),this.io.connected.subscribe(()=>tt(this,null,function*(){this.getServerUptimeInfo()})),this.io.socket.connected&&this.getServerUptimeInfo(),this.intervalSubscription=Yt(11e3).subscribe(()=>{this.io.socket.connected&&this.getServerUptimeInfo()})}getServerUptimeInfo(){this.io.request("get-server-uptime-info").subscribe(t=>{this.serverUptime=this.humaniseDuration(t.time.uptime),this.processUptime=this.humaniseDuration(t.processUptime)})}humaniseDuration(t){return t<50?"< 1m":t<3600?`${Math.round(t/60)}m`:t<86400?`${Math.round(t/60/60)}h`:`${Math.floor(t/60/60/24)}d`}ngOnDestroy(){this.intervalSubscription.unsubscribe()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget"},decls:18,vars:14,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-1"],[1,"drag-handler","p-2",3,"ngClass"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","gridster-item-content","text-center"],[1,"d-flex","justify-content-around","flex-wrap","w-100"],[1,"text-center","widget-value-parent-wrap"],[1,"widget-value","mb-0"],[1,"widget-value-label","grey-text"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1),y(2),w(3,"translate"),m(),x(4,"div",2)(5,"div",3)(6,"div",4)(7,"div",5),y(8),m(),x(9,"div",6),y(10),w(11,"translate"),m()(),x(12,"div",4)(13,"div",5),y(14),m(),x(15,"div",6),y(16),w(17,"translate"),m()()()()()),n&2&&(f(),z("ngClass",ot(12,pm,s.widget.draggable)),f(),V(" ",S(3,6,"status.uptime.title_uptime")," "),f(6),T(s.serverUptime),f(2),T(S(11,8,"status.widget.uptime.label_server")),f(4),T(s.processUptime),f(2),T(S(17,10,"status.widget.uptime.label_process")))},dependencies:[rt,Z],encapsulation:2})}return i})();var vo=rc(ac(),1);var fm=i=>({"widget-cursor":i});function gm(i,e){i&1&&(x(0,"div",2)(1,"div",4)(2,"h1"),W(3,"i",5),m(),x(4,"p",6),y(5),w(6,"translate"),m()()()),i&2&&(f(5),T(S(6,1,"status.widget.weather.label_config_required_help")))}function mm(i,e){if(i&1&&(x(0,"div",3)(1,"div",7)(2,"div",8)(3,"h1"),W(4,"i",9),m(),x(5,"h3"),y(6),w(7,"titlecase"),m(),x(8,"h2"),y(9),w(10,"convertTemp"),w(11,"number"),w(12,"uppercase"),m()()()()),i&2){let t=k();f(4),z("ngClass",t.getWeatherIconClass()),f(2),T(S(7,4,t.currentWeather.weather[0].description)),f(3),ne(" ",Mt(11,8,S(10,6,t.currentWeather.main.temp),"1.0-0"),"\xB0",S(12,11,t.$settings.env.temperatureUnits)," ")}}var ic=(()=>{class i{$http=R(qi);$translate=R(Gt);$ws=R(_t);widget;configureEvent;currentWeather;$settings=R(zt);io;intervalSubscription;constructor(){}ngOnInit(){this.io=this.$ws.getExistingNamespace("status"),this.io.connected.subscribe(()=>tt(this,null,function*(){this.getCurrentWeather()})),this.io.socket.connected&&this.getCurrentWeather(),this.configureEvent.subscribe({next:()=>{this.getCurrentWeather()}}),this.intervalSubscription=Yt(13e5).subscribe(()=>{this.getCurrentWeather()})}getCurrentWeather(){if(!(!this.widget.location||!this.widget.location.id)){try{let t=JSON.parse(localStorage.getItem(`weather-${this.widget.location.id}`));if(t&&(0,vo.default)().diff((0,vo.default)(t.timestamp),"minute")<20){this.currentWeather=t;return}}catch{}this.$http.get("https://api.openweathermap.org/data/2.5/weather",{params:new Gi({fromObject:{id:this.widget.location.id,appid:Zi.owm.appid,units:"metric",lang:this.$translate.currentLang}})}).subscribe(t=>{t.timestamp=new Date().toISOString(),this.currentWeather=t,localStorage.setItem(`weather-${this.widget.location.id}`,JSON.stringify(t))})}}getWeatherIconClass(){switch(this.currentWeather.weather[0].icon){case"01d":return"far fa-fw fa-sun";case"01n":return"far fa-fw fa-moon";case"02d":return"fas fa-fw fa-cloud-sun";case"02n":return"fas fa-fw fa-cloud-moon";case"03d":return"fas fa-fw fa-cloud-sun";case"03n":return"fas fa-fw fa-cloud-moon";case"04d":return"fas fa-fw fa-cloud-sun";case"04n":return"fas fa-fw fa-cloud-moon";case"09d":return"fas fa-fw fa-cloud-sun-rain";case"09n":return"fas fa-fw fa-cloud-moon-rain";case"10d":return"fas fa-fw fa-cloud-rain";case"10n":return"fas fa-fw fa-cloud-moon-rain";case"11d":return"fas fa-fw fa-cloud-showers-heavy";case"11n":return"fas fa-fw fa-cloud-showers-heavy";case"13d":return"fas fa-fw fa-snowflake";case"13n":return"fas fa-fw fa-snowflake";case"50d":return"fas fa-fw fa-smog";case"50n":return"fas fa-fw fa-smog"}}ngOnDestroy(){this.intervalSubscription.unsubscribe()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],inputs:{widget:"widget",configureEvent:"configureEvent"},decls:6,vars:9,consts:[[1,"flex-column","d-flex","align-items-stretch","h-100","w-100","pb-1"],[1,"drag-handler","p-2",3,"ngClass"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","gridster-item-content","text-center"],[1,"d-flex","flex-row","flex-grow-1","align-items-center","w-100","gridster-item-content","p-2"],[1,"d-flex","flex-column","w-100","pb-2"],[1,"fas","fa-fw","fa-cloud-sun"],[1,"grey-text"],[1,"d-flex","flex-column","w-100"],[1,"weather-now","d-flex","flex-column","align-items-center","text-center"],[1,"primary-text",3,"ngClass"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1),y(2),w(3,"translate"),m(),D(4,gm,7,3,"div",2),D(5,mm,13,13,"div",3),m()),n&2&&(f(),z("ngClass",ot(7,fm,s.widget.draggable)),f(),ne(" ",s.currentWeather==null?null:s.currentWeather.name," ",S(3,5,"status.widget.weather.title_weather")," "),f(2),$(!s.widget.location||!s.widget.location.id?4:-1),f(),$(s.widget.location&&s.widget.location.id&&s.currentWeather?5:-1))},dependencies:[rt,we,Ui,Z,tn,Yi],encapsulation:2})}return i})();var nc=(()=>{class i{appRef=R(Ro);componentFactoryResolver=R(Wo);el=R(he);injector=R(Oo);widget;availableWidgets={HapQrcodeWidgetComponent:Gl,HomebridgeLogsWidgetComponent:ql,TerminalWidgetComponent:Zl,CpuWidgetComponent:Xl,NetworkWidgetComponent:Ql,MemoryWidgetComponent:Kl,UptimeWidgetComponent:ec,UpdateInfoWidgetComponent:tc,SystemInfoWidgetComponent:Jl,WeatherWidgetComponent:ic,AccessoriesWidgetComponent:Mr,ClockWidgetComponent:Dr,BridgesWidgetComponent:Er};componentRef;constructor(){}ngOnInit(){Object.prototype.hasOwnProperty.call(this.availableWidgets,this.widget.component)&&this.load(this.availableWidgets[this.widget.component])}ngOnDestroy(){this.componentRef&&(this.widget.$resizeEvent.complete(),this.widget.$configureEvent.complete(),this.componentRef.destroy())}load(t){this.componentRef=this.componentFactoryResolver.resolveComponentFactory(t).create(this.injector),this.componentRef.instance.resizeEvent=this.widget.$resizeEvent,this.componentRef.instance.configureEvent=this.widget.$configureEvent,this.componentRef.instance.widget=this.widget;let n=this.componentRef.hostView.rootNodes[0];n.style.height="100%",n.style.width="100%",n.style.display="flex",this.el.nativeElement.appendChild(n),this.appRef.attachView(this.componentRef.hostView)}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["app-widgets"]],inputs:{widget:"widget"},decls:0,vars:0,template:function(n,s){},encapsulation:2})}return i})();function xm(i,e){if(i&1){let t=j();x(0,"div",3)(1,"button",13),w(2,"translate"),w(3,"translate"),X("click",function(){A(t);let s=k();return B(s.addWidget())}),W(4,"i",14),m(),x(5,"div",15)(6,"button",16),w(7,"translate"),w(8,"translate"),X("click",function(){A(t);let s=k();return B(s.unlockLayout())}),W(9,"i",17),m(),x(10,"button",18),w(11,"translate"),w(12,"translate"),X("click",function(){A(t);let s=k();return B(s.lockLayout())}),W(13,"i",19),m()()()}if(i&2){let t=k();f(),z("hidden",!t.options.draggable.enabled)("ngbTooltip",S(2,9,"status.widget.show_hide")),Ct("aria-label",S(3,11,"status.widget.show_hide")),f(5),z("disabled",t.options.draggable.enabled)("ngbTooltip",S(7,13,"form.button_unlock")),Ct("aria-label",S(8,15,"form.button_unlock")),f(4),z("disabled",!t.options.draggable.enabled)("ngbTooltip",S(11,17,"form.button_lock")),Ct("aria-label",S(12,19,"form.button_lock"))}}function _m(i,e){i&1&&W(0,"app-spinner")}function ym(i,e){if(i&1){let t=j();x(0,"i",24),X("click",function(){A(t);let s=k(2).$implicit,o=k(2);return B(o.manageWidget(s))}),m()}}function Cm(i,e){if(i&1&&(x(0,"gridster-item",20)(1,"div",21),D(2,ym,1,0,"i",22),m(),W(3,"app-widgets",23),m()),i&2){let t=k().$implicit,n=k(2);z("item",t)("id",t.component),f(2),$(n.options.draggable.enabled?2:-1),f(),z("widget",t)}}function wm(i,e){if(i&1&&D(0,Cm,4,4,"gridster-item",20),i&2){let t=e.$implicit,n=k(2);$(t.hideOnMobile&&n.page.mobile?-1:0)}}function vm(i,e){if(i&1&&(x(0,"gridster",6),wt(1,wm,1,1,null,null,Lt),m()),i&2){let t=k();z("options",t.options)("hidden",t.consoleStatus==="down"),f(),vt(t.dashboard)}}var z_=(()=>{class i{$auth=R(er);$modal=R(Xe);$notification=R(ir);$settings=R(zt);$ws=R(_t);saveWidgetsEvent=new ie;options;dashboard=[];consoleStatus="down";currentYear;page={mobile:window.innerWidth<1024};isUnlocked=!1;io;constructor(){}ngOnInit(){this.currentYear=new Date().getFullYear(),this.io=this.$ws.connectToNamespace("status"),this.options={mobileBreakpoint:1023,keepFixedHeightInMobile:!1,itemChangeCallback:this.gridChangedEvent.bind(this),itemResizeCallback:this.gridResizeEvent.bind(this),draggable:{enabled:this.isUnlocked},resizable:{enabled:this.isUnlocked},gridType:"verticalFixed",margin:8,minCols:20,maxCols:20,minRows:20,maxRows:40,fixedColWidth:36,fixedRowHeight:36,disableScrollHorizontal:!0,disableScrollVertical:!1,pushItems:!0,displayGrid:"none"},this.io.socket.connected?(this.getLayout(),this.consoleStatus="up"):(this.consoleStatus="down",this.io.connected.pipe(Po(1)).subscribe(()=>{this.getLayout()})),this.io.connected.subscribe(()=>tt(this,null,function*(){this.consoleStatus="up",this.io.socket.emit("monitor-server-status")})),this.io.socket.on("disconnect",()=>{this.consoleStatus="down"}),this.io.socket.on("homebridge-status",t=>{t.packageVersion&&t.packageVersion!==this.$settings.uiVersion&&window.location.reload()}),this.saveWidgetsEvent.subscribe({next:()=>{this.gridChangedEvent()}}),this.$settings.env.runningOnRaspberryPi&&this.io.request("get-raspberry-pi-throttled-status").subscribe(t=>{this.$notification.raspberryPiThrottled.next(t)})}getLayout(){this.io.request("get-dashboard-layout").subscribe(t=>{if(!t.length)return this.resetLayout();let n=!1;this.setLayout(t.map(s=>(s.component==="HomebridgeStatusWidgetComponent"?(s.component="UpdateInfoWidgetComponent",n=!0):s.component==="ChildBridgeWidgetComponent"&&(s.component="BridgesWidgetComponent",n=!0),s))),n&&this.gridChangedEvent()})}setLayout(t){this.dashboard=t.map(n=>(n.$resizeEvent=new ie,n.$configureEvent=new ie,n.$saveWidgetsEvent=this.saveWidgetsEvent,n.draggable=this.options.draggable.enabled,n))}resetLayout(){this.setLayout(sc()),this.gridChangedEvent()}isIos(){try{return/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform)}catch{return!1}}lockLayout(){this.options.draggable.enabled=!1,this.options.resizable.enabled=!1,this.options.api.optionsChanged(),this.isUnlocked=!1,this.setLayout(this.dashboard)}unlockLayout(){this.options.draggable.enabled=!0,this.options.resizable.enabled=!0,this.options.api.optionsChanged(),this.isUnlocked=!0,this.setLayout(this.dashboard)}gridResizeEvent(t,n){n.item.$resizeEvent.next("resize"),this.page.mobile=window.innerWidth<1024}gridChangedEvent(){return tt(this,null,function*(){this.dashboard.sort((n,s)=>n.mobileOrder<s.mobileOrder?-1:s.mobileOrder>s.mobileOrder?1:0);let t=this.dashboard.map(n=>{let s={};for(let o of Object.keys(n))o.startsWith("$")||(s[o]=n[o]);return s});try{yield At(this.io.request("set-dashboard-layout",t))}catch(n){console.error("Failed to save dashboard layout"),console.error(n)}})}addWidget(){let t=this.$modal.open(kr,{size:"lg",backdrop:"static"});t.componentInstance.dashboard=this.dashboard,t.componentInstance.resetLayout=this.resetLayout.bind(this),t.componentInstance.lockLayout=this.lockLayout.bind(this),t.componentInstance.unlockLayout=this.unlockLayout.bind(this),t.result.then(n=>{let s=this.dashboard.findIndex(r=>r.component===n.component);if(s>-1){this.dashboard.splice(s,1),this.gridChangedEvent();return}let o={x:void 0,y:void 0,component:n.component,cols:n.cols,rows:n.rows,mobileOrder:n.mobileOrder,hideOnMobile:n.hideOnMobile,$resizeEvent:new ie,$configureEvent:new ie,$saveWidgetsEvent:this.saveWidgetsEvent};this.dashboard.push(o),n.requiresConfig&&this.manageWidget(o),setTimeout(()=>{document.getElementById(n.component).scrollIntoView()},500)}).catch(()=>{})}manageWidget(t){let n=this.$modal.open(Ir,{size:"lg",backdrop:"static"});n.componentInstance.widget=t,n.result.then(()=>{this.gridChangedEvent(),t.$configureEvent.next(void 0),["CpuWidgetComponent","MemoryWidgetComponent","NetworkWidgetComponent"].includes(t.component)&&window.location.reload()}).catch(()=>{})}openCreditsModal(){this.$modal.open(Sr,{size:"lg",backdrop:"static"})}ngOnDestroy(){this.io.end(),this.saveWidgetsEvent.complete()}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=Y({type:i,selectors:[["ng-component"]],decls:22,vars:7,consts:[[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end","d-none","d-sm-block"],[1,"status-container","d-flex","flex-column","mt-0"],[1,"row","flex-column","flex-grow-1"],[1,"flex-grow-1","no-scrollbars","py-0",3,"options","hidden"],[1,"row","mb-auto"],[1,"col-md-12","text-center","px-4","pt-1","pt-lg-2","pb-3","pb-lg-2","grey-text"],["target","_blank","rel","noopener noreferrer","href","https://github.com/homebridge/homebridge",1,"grey-text"],["target","_blank","rel","noopener noreferrer","href","https://github.com/homebridge/homebridge-config-ui-x",1,"grey-text"],["href","javascript: void(0);",1,"grey-text",3,"click"],[1,"fas","fa-fw","fa-heart"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","hidden","ngbTooltip"],[1,"fas","fa-fw","fa-eye-low-vision"],["role","group",1,"btn-group"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-unlock"],["type","button","container","body","placement","bottom","openDelay","150","triggers","hover",1,"btn","btn-elegant","my-0","me-0",3,"click","disabled","ngbTooltip"],[1,"fas","fa-fw","fa-lock"],[1,"widget-item",3,"item","id"],[1,"gridster-item-content"],[1,"fas","fa-fw","fa-cog","widget-control-button","primary-text"],[1,"d-flex","h-100","w-100",3,"widget"],[1,"fas","fa-fw","fa-cog","widget-control-button","primary-text",3,"click"]],template:function(n,s){n&1&&(x(0,"div",0)(1,"div",1)(2,"h3",2),y(3),w(4,"translate"),m()(),D(5,xm,14,21,"div",3),m(),x(6,"div",4),D(7,_m,1,0,"app-spinner"),x(8,"div",5),D(9,vm,3,2,"gridster",6),m(),x(10,"div",7)(11,"div",8)(12,"small"),y(13),x(14,"a",9),y(15," Homebridge "),m(),y(16," \xB7 "),x(17,"a",10),y(18," Homebridge UI "),m(),y(19," \xB7 "),x(20,"a",11),X("click",function(){return s.openCreditsModal()}),W(21,"i",12),m()()()()()),n&2&&(f(3),T(S(4,5,"menu.label_status")),f(2),$(s.consoleStatus==="up"&&s.$auth.user.admin?5:-1),f(2),$(s.consoleStatus==="down"?7:-1),f(2),$(s.dashboard.length?9:-1),f(4),V(" \xA9 ",s.currentYear," \xB7 "))},dependencies:[Qi,nr,ss,vr,nc,Z],styles:["@media (hover: hover){ a.grey-text:hover{text-decoration:underline}}.status-container[_ngcontent-%COMP%]{min-height:calc(100% - 30px)}gridster[_ngcontent-%COMP%]{background-color:inherit}.widget-control-button[_ngcontent-%COMP%]{cursor:pointer;position:fixed;right:8px;top:10px;opacity:0;-webkit-transition:opacity .2s ease-in;-moz-transition:opacity .2s ease-in;-ms-transition:opacity .2s ease-in;-o-transition:opacity .2s ease-in;transition:opacity .2s ease-in}.widget-control-button[_ngcontent-%COMP%]:active{transform:scale(1.2)}@media (max-width: 1023px){.widget-control-button[_ngcontent-%COMP%]{display:none}}@media (hover: hover){.widget-item[_ngcontent-%COMP%]:hover .widget-control-button[_ngcontent-%COMP%], .widget-item[_ngcontent-%COMP%]:active .widget-control-button[_ngcontent-%COMP%]{opacity:1}}gridster.mobile[_ngcontent-%COMP%] #UpdateInfoWidgetComponent[_ngcontent-%COMP%], gridster.mobile[_ngcontent-%COMP%] #SystemInfoWidgetComponent[_ngcontent-%COMP%], gridster.mobile[_ngcontent-%COMP%] #WeatherWidgetComponent[_ngcontent-%COMP%], gridster.mobile[_ngcontent-%COMP%] #BridgesWidgetComponent[_ngcontent-%COMP%], gridster.mobile[_ngcontent-%COMP%] #ClockWidgetComponent[_ngcontent-%COMP%]{height:unset!important}gridster.mobile[_ngcontent-%COMP%] #CpuWidgetComponent[_ngcontent-%COMP%], gridster.mobile[_ngcontent-%COMP%] #NetworkWidgetComponent[_ngcontent-%COMP%], gridster.mobile[_ngcontent-%COMP%] #MemoryWidgetComponent[_ngcontent-%COMP%], gridster.mobile[_ngcontent-%COMP%] #UptimeWidgetComponent[_ngcontent-%COMP%]{height:unset!important;padding-bottom:10px}gridster.mobile[_ngcontent-%COMP%] #HapQrcodeWidgetComponent[_ngcontent-%COMP%]{height:360px!important}gridster.mobile[_ngcontent-%COMP%] #AccessoriesWidgetComponent[_ngcontent-%COMP%]{height:unset!important;border:none!important}"]})}return i})();export{Wm as a,Ir as b,kr as c,Mr as d,ib as e,nb as f,z_ as g};