iobroker.vis2-materialdesign 0.3.2 → 0.3.4

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 (134) hide show
  1. package/README.md +29 -20
  2. package/admin/assets/de.js +2 -2
  3. package/admin/assets/en.js +2 -2
  4. package/admin/assets/es.js +2 -2
  5. package/admin/assets/fr.js +2 -2
  6. package/admin/assets/index.js +13 -13
  7. package/admin/assets/it.js +2 -2
  8. package/admin/assets/nl.js +2 -2
  9. package/admin/assets/pl.js +2 -2
  10. package/admin/assets/pt.js +2 -2
  11. package/admin/assets/ru.js +2 -2
  12. package/admin/assets/uk.js +1 -1
  13. package/admin/assets/zh-cn.js +2 -2
  14. package/admin/i18n/de.json +3 -2
  15. package/admin/i18n/en.json +3 -2
  16. package/admin/i18n/es.json +3 -2
  17. package/admin/i18n/fr.json +3 -2
  18. package/admin/i18n/it.json +3 -2
  19. package/admin/i18n/nl.json +3 -2
  20. package/admin/i18n/pl.json +3 -2
  21. package/admin/i18n/pt.json +3 -2
  22. package/admin/i18n/ru.json +3 -2
  23. package/admin/i18n/uk.json +3 -2
  24. package/admin/i18n/zh-cn.json +3 -2
  25. package/io-package.json +73 -50
  26. package/package.json +1 -2
  27. package/widgets/vis2-materialdesign/assets/MaterialDesignAdvancedView-D23fB5BP.js +1 -0
  28. package/widgets/vis2-materialdesign/assets/{MaterialDesignAdvancedViewInWidget-D0RAvRHW.js → MaterialDesignAdvancedViewInWidget-CVKzopyP.js} +1 -1
  29. package/widgets/vis2-materialdesign/assets/{MaterialDesignAdvancedViewInWidget8-Dl5GI3qU.js → MaterialDesignAdvancedViewInWidget8-CyAkrDLh.js} +1 -1
  30. package/widgets/vis2-materialdesign/assets/MaterialDesignAlerts-t6bxP6kn.js +1 -0
  31. package/widgets/vis2-materialdesign/assets/MaterialDesignAutocomplete-BtQabTF3.js +1 -0
  32. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonAdition-CAAF3h0G.js → MaterialDesignButtonAdition--_QrNUQt.js} +1 -1
  33. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonAditionVertical-aQDkVvQh.js → MaterialDesignButtonAditionVertical-sAUs4veM.js} +1 -1
  34. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonLink-Ds6Wb-lt.js → MaterialDesignButtonLink-Up-eqUKz.js} +1 -1
  35. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonLinkVertical-awaNYLEW.js → MaterialDesignButtonLinkVertical-u9Qajgeo.js} +1 -1
  36. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonNavigation-tSQ4MEhc.js → MaterialDesignButtonNavigation-KwQPyFYj.js} +1 -1
  37. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonNavigationVertical-Dmq3Pmfh.js → MaterialDesignButtonNavigationVertical-BQHmk3sd.js} +1 -1
  38. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonState-CkqRuvf9.js → MaterialDesignButtonState-ODt9SYua.js} +1 -1
  39. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonStateMulti-CXwt4UPE.js → MaterialDesignButtonStateMulti-Bw_DfMEZ.js} +1 -1
  40. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonStateMultiVertical-CKYtJT7g.js → MaterialDesignButtonStateMultiVertical-BQUX8Ctb.js} +1 -1
  41. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonStateVertical-B-XMc00L.js → MaterialDesignButtonStateVertical-DF7loXYV.js} +1 -1
  42. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonToggle-BMeXKZ-C.js → MaterialDesignButtonToggle-B8CrFlVk.js} +1 -1
  43. package/widgets/vis2-materialdesign/assets/{MaterialDesignButtonToggleVertical-BkNt-rok.js → MaterialDesignButtonToggleVertical-C4iZeO3s.js} +1 -1
  44. package/widgets/vis2-materialdesign/assets/MaterialDesignButtons-hb9Innh5.js +1 -0
  45. package/widgets/vis2-materialdesign/assets/MaterialDesignCalendar-B1_mJcJU.js +1 -0
  46. package/widgets/vis2-materialdesign/assets/MaterialDesignCard-O2CSDyNI.js +1 -0
  47. package/widgets/vis2-materialdesign/assets/MaterialDesignChartBar-DkQucFQm.js +1 -0
  48. package/widgets/vis2-materialdesign/assets/{MaterialDesignChartCanvas-DgQSkwWC.js → MaterialDesignChartCanvas-fSoRWg6D.js} +2 -2
  49. package/widgets/vis2-materialdesign/assets/MaterialDesignChartJson-DsayVdED.js +1 -0
  50. package/widgets/vis2-materialdesign/assets/MaterialDesignChartLineHistory-BE1fL8AL.js +1 -0
  51. package/widgets/vis2-materialdesign/assets/MaterialDesignChartPie-B-JLnAEO.js +1 -0
  52. package/widgets/vis2-materialdesign/assets/MaterialDesignCheckbox-CGnN9PUZ.js +1 -0
  53. package/widgets/vis2-materialdesign/assets/MaterialDesignColorScheme-D3JEXN-u.js +1 -0
  54. package/widgets/vis2-materialdesign/assets/MaterialDesignDialog-YpZuhyAp.js +1 -0
  55. package/widgets/vis2-materialdesign/assets/{MaterialDesignDialogIFrame-CVpQat6V.js → MaterialDesignDialogIFrame-DyxPCj0X.js} +1 -1
  56. package/widgets/vis2-materialdesign/assets/{MaterialDesignDialogView-Cok864lS.js → MaterialDesignDialogView-De9eZimy.js} +1 -1
  57. package/widgets/vis2-materialdesign/assets/{MaterialDesignGridViews-Bd_TVR1F.js → MaterialDesignGridViews-CKXAIF-e.js} +1 -1
  58. package/widgets/vis2-materialdesign/assets/MaterialDesignIcon-D2f-QR7O.js +1 -0
  59. package/widgets/vis2-materialdesign/assets/{MaterialDesignIconButtonAdition-kCEUyEAk.js → MaterialDesignIconButtonAdition-BUC8DMIK.js} +1 -1
  60. package/widgets/vis2-materialdesign/assets/{MaterialDesignIconButtonLink-DKhwEs6-.js → MaterialDesignIconButtonLink-B6UNtA9z.js} +1 -1
  61. package/widgets/vis2-materialdesign/assets/{MaterialDesignIconButtonNavigation-DaAD-lOC.js → MaterialDesignIconButtonNavigation-DPPJA7r3.js} +1 -1
  62. package/widgets/vis2-materialdesign/assets/{MaterialDesignIconButtonSlider-Dn-_8cC-.js → MaterialDesignIconButtonSlider-CbD9SyCw.js} +1 -1
  63. package/widgets/vis2-materialdesign/assets/{MaterialDesignIconButtonState-BgzfhW-o.js → MaterialDesignIconButtonState-D8PAXX8v.js} +1 -1
  64. package/widgets/vis2-materialdesign/assets/{MaterialDesignIconButtonStateMulti-E8rL3yod.js → MaterialDesignIconButtonStateMulti-DsjjNh2w.js} +1 -1
  65. package/widgets/vis2-materialdesign/assets/{MaterialDesignIconButtonToggle-CDDoAED0.js → MaterialDesignIconButtonToggle-tmpcRLCi.js} +1 -1
  66. package/widgets/vis2-materialdesign/assets/MaterialDesignIconList-DQ26OoES.js +12 -0
  67. package/widgets/vis2-materialdesign/assets/MaterialDesignInput-kj5Q7mH8.js +1 -0
  68. package/widgets/vis2-materialdesign/assets/MaterialDesignInstalledVersion-quCjb-MG.js +1 -0
  69. package/widgets/vis2-materialdesign/assets/MaterialDesignList-CedH5pTZ.js +1 -0
  70. package/widgets/vis2-materialdesign/assets/{MaterialDesignMasonryViews-emsxVudR.js → MaterialDesignMasonryViews-BBZeCEfh.js} +1 -1
  71. package/widgets/vis2-materialdesign/assets/{MaterialDesignProgress-F1nGkSo8.js → MaterialDesignProgress-Bjm05b-r.js} +1 -1
  72. package/widgets/vis2-materialdesign/assets/MaterialDesignProgress-bQLN9IUl.js +1 -0
  73. package/widgets/vis2-materialdesign/assets/MaterialDesignProgressCircular-OlriIai9.js +1 -0
  74. package/widgets/vis2-materialdesign/assets/MaterialDesignRoundSlider-Ce5idsNt.js +1 -0
  75. package/widgets/vis2-materialdesign/assets/MaterialDesignSelect-DHWRyL-F.js +1 -0
  76. package/widgets/vis2-materialdesign/assets/{MaterialDesignSlider-m_TBz52s.js → MaterialDesignSlider-Cxh9ORsk.js} +2 -2
  77. package/widgets/vis2-materialdesign/assets/MaterialDesignSwitch-B17g8oSg.js +1 -0
  78. package/widgets/vis2-materialdesign/assets/MaterialDesignTable-D7Cwp_dk.js +1 -0
  79. package/widgets/vis2-materialdesign/assets/MaterialDesignToggleControls-CXCwC59w.js +1 -0
  80. package/widgets/vis2-materialdesign/assets/MaterialDesignTopAppBar-Dy3enokk.js +1 -0
  81. package/widgets/vis2-materialdesign/assets/MaterialDesignValue-uvbK9sGh.js +1 -0
  82. package/widgets/vis2-materialdesign/assets/MaterialDesignViews-4LvnX54x.js +1 -0
  83. package/widgets/vis2-materialdesign/assets/_virtual_mf-localSharedImportMap___mfe_internal__vis2Materia-fuml4po1.js +1 -0
  84. package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadS-8anIakGm.js +1 -0
  85. package/widgets/vis2-materialdesign/assets/{_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react_mf_2_dom__loadShare__.js-C1IJzTd8.js → _virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadS-BS54ZYau.js} +1 -1
  86. package/widgets/vis2-materialdesign/assets/index-DARH8MzL.js +1 -0
  87. package/widgets/vis2-materialdesign/assets/{mf-entry-bootstrap-0-267c5f7b.js → mf-entry-bootstrap-0-a95eca60.js} +1 -1
  88. package/widgets/vis2-materialdesign/assets/translations-IashQAxC.js +11 -0
  89. package/widgets/vis2-materialdesign/assets/virtualExposes-jgt15u1r.js +1 -0
  90. package/widgets/vis2-materialdesign/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-BqNHaWgp.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__vis2MaterialDesig-CVcIYu5s.js} +1 -1
  91. package/widgets/vis2-materialdesign/assets/virtual_mf-exposes-ssr___mfe_internal__vis2MaterialDesignWid-CAbEt2ob.js +2 -0
  92. package/widgets/vis2-materialdesign/assets/virtual_mf-exposes___mfe_internal__vis2MaterialDesignWidgets-BvdzeG5Q.js +2 -0
  93. package/widgets/vis2-materialdesign/assets/widgetUtils-C6ss0T08.js +1 -0
  94. package/widgets/vis2-materialdesign/customWidgets.js +1 -1
  95. package/widgets/vis2-materialdesign/customWidgets.ssr.js +1 -1
  96. package/widgets/vis2-materialdesign/mf-stats.json +1 -1
  97. package/widgets/vis2-materialdesign/assets/MaterialDesignAdvancedView-DkaiTFJN.js +0 -1
  98. package/widgets/vis2-materialdesign/assets/MaterialDesignAlerts-6uVp2_HL.js +0 -1
  99. package/widgets/vis2-materialdesign/assets/MaterialDesignAutocomplete-D228Uhpm.js +0 -1
  100. package/widgets/vis2-materialdesign/assets/MaterialDesignButtons-DasV-Vrb.js +0 -1
  101. package/widgets/vis2-materialdesign/assets/MaterialDesignCalendar-CY4vdHti.js +0 -1
  102. package/widgets/vis2-materialdesign/assets/MaterialDesignCard-CU3BQBnu.js +0 -1
  103. package/widgets/vis2-materialdesign/assets/MaterialDesignChartBar-C1Z-GS9V.js +0 -1
  104. package/widgets/vis2-materialdesign/assets/MaterialDesignChartJson-COv3doW6.js +0 -1
  105. package/widgets/vis2-materialdesign/assets/MaterialDesignChartLineHistory-Dtej3ekU.js +0 -1
  106. package/widgets/vis2-materialdesign/assets/MaterialDesignChartPie-DsWXbASR.js +0 -1
  107. package/widgets/vis2-materialdesign/assets/MaterialDesignCheckbox-ZEzODS_J.js +0 -1
  108. package/widgets/vis2-materialdesign/assets/MaterialDesignColorScheme-CemlLAB-.js +0 -1
  109. package/widgets/vis2-materialdesign/assets/MaterialDesignDialog-DCyF_DkB.js +0 -1
  110. package/widgets/vis2-materialdesign/assets/MaterialDesignIcon-CUDToP2f.js +0 -1
  111. package/widgets/vis2-materialdesign/assets/MaterialDesignIconList-C8WGCncJ.js +0 -12
  112. package/widgets/vis2-materialdesign/assets/MaterialDesignInput-BIRpsGYw.js +0 -1
  113. package/widgets/vis2-materialdesign/assets/MaterialDesignInstalledVersion-CYJV6JG5.js +0 -1
  114. package/widgets/vis2-materialdesign/assets/MaterialDesignList-Z_JdzpOZ.js +0 -1
  115. package/widgets/vis2-materialdesign/assets/MaterialDesignProgress-CYk7HBU1.js +0 -1
  116. package/widgets/vis2-materialdesign/assets/MaterialDesignProgressCircular-CshgJpib.js +0 -1
  117. package/widgets/vis2-materialdesign/assets/MaterialDesignRoundSlider-Dpms86s6.js +0 -1
  118. package/widgets/vis2-materialdesign/assets/MaterialDesignSelect-BgeM982A.js +0 -1
  119. package/widgets/vis2-materialdesign/assets/MaterialDesignSwitch-BDFdfXSE.js +0 -1
  120. package/widgets/vis2-materialdesign/assets/MaterialDesignTable-CRgEOi9t.js +0 -1
  121. package/widgets/vis2-materialdesign/assets/MaterialDesignToggleControls-BhDepGSC.js +0 -1
  122. package/widgets/vis2-materialdesign/assets/MaterialDesignTopAppBar-Cv3Yvkw4.js +0 -1
  123. package/widgets/vis2-materialdesign/assets/MaterialDesignValue-BUjiQkT8.js +0 -1
  124. package/widgets/vis2-materialdesign/assets/MaterialDesignViews-C705A8BV.js +0 -1
  125. package/widgets/vis2-materialdesign/assets/_virtual_mf-localSharedImportMap___mfe_internal__vis2MaterialDesignWidgets-CdaXi3GZ.js +0 -1
  126. package/widgets/vis2-materialdesign/assets/_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-C2s9zKDG.js +0 -1
  127. package/widgets/vis2-materialdesign/assets/defineProperty-BbfpZ9Tg.js +0 -1
  128. package/widgets/vis2-materialdesign/assets/index-TciPOjty.js +0 -1
  129. package/widgets/vis2-materialdesign/assets/translations-fTt9-Q5o.js +0 -11
  130. package/widgets/vis2-materialdesign/assets/virtualExposes-AFrVysSc.js +0 -1
  131. package/widgets/vis2-materialdesign/assets/virtual_mf-exposes-ssr___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-CIgM2CUo.js +0 -2
  132. package/widgets/vis2-materialdesign/assets/virtual_mf-exposes___mfe_internal__vis2MaterialDesignWidgets__customWidgets_js-QjuQGYq8.js +0 -2
  133. package/widgets/vis2-materialdesign/assets/widgetUtils-ByiytXuT.js +0 -1
  134. /package/widgets/vis2-materialdesign/assets/{_virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadShare__react__loadShare__.js-C4ZDHX4F.js → _virtual_mf___mfe_internal__vis2MaterialDesignWidgets__loadS-C4ZDHX4F.js} +0 -0
@@ -34,21 +34,21 @@ theme.breakpoints = createBreakpoints(theme.breakpoints || {});
34
34
  theme.transitions = createTransitions(theme.transitions || {});
35
35
 
36
36
  export default theme;`}function Mo(e={},...t){let{breakpoints:n,mixins:r={},spacing:i,palette:a={},transitions:o={},typography:s={},shape:c,...l}=e;if(e.vars&&e.generateThemeVars===void 0)throw Error(u(20));let d=fo(a),f=fr(e),p=Yt(f,{mixins:mo(f.breakpoints,r),palette:d,shadows:Co.slice(),typography:vo(d,s),transitions:Oo(o),zIndex:{...ko}});return p=Yt(p,l),p=t.reduce((e,t)=>Yt(e,t),p),p.unstable_sxConfig={...or,...l?.unstable_sxConfig},p.unstable_sx=function(e){return ur({sx:e,theme:this})},p.toRuntimeSource=jo,p}function No(e){let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Math.round(t*10)/1e3}var Po=[...Array(25)].map((e,t)=>{if(t===0)return`none`;let n=No(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function Fo(e){return{inputPlaceholder:e===`dark`?.5:.42,inputUnderline:e===`dark`?.7:.42,switchTrackDisabled:e===`dark`?.2:.12,switchTrack:e===`dark`?.3:.38}}function Io(e){return e===`dark`?Po:[]}function Lo(e){let{palette:t={mode:`light`},opacity:n,overlays:r,...i}=e,a=fo(t);return{palette:a,opacity:{...Fo(a.mode),...n},overlays:r||Io(a.mode),...i}}function Ro(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]===`palette`&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}var zo=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:``}overlays-${n}`),`--${e?`${e}-`:``}palette-AppBar-darkBg`,`--${e?`${e}-`:``}palette-AppBar-darkColor`],Bo=e=>(t,n)=>{let r=e.rootSelector||`:root`,i=e.colorSchemeSelector,a=i;if(i===`class`&&(a=`.%s`),i===`data`&&(a=`[data-%s]`),i?.startsWith(`data-`)&&!i.includes(`%s`)&&(a=`[${i}="%s"]`),e.defaultColorScheme===t){if(t===`dark`){let i={};return zo(e.cssVarPrefix).forEach(e=>{i[e]=n[e],delete n[e]}),a===`media`?{[r]:n,"@media (prefers-color-scheme: dark)":{[r]:i}}:a?{[a.replace(`%s`,t)]:i,[`${r}, ${a.replace(`%s`,t)}`]:n}:{[r]:{...n,...i}}}if(a&&a!==`media`)return`${r}, ${a.replace(`%s`,String(t))}`}else if(t){if(a===`media`)return{[`@media (prefers-color-scheme: ${String(t)})`]:{[r]:n}};if(a)return a.replace(`%s`,String(t))}return r};function Vo(e,t){t.forEach(t=>{e[t]||(e[t]={})})}function W(e,t,n){!e[t]&&n&&(e[t]=n)}function Ho(e){return typeof e!=`string`||!e.startsWith(`hsl`)?e:ei(e)}function Uo(e,t){`${t}Channel`in e||(e[`${t}Channel`]=Qr(Ho(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
37
- To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Wo(e){return typeof e==`number`?`${e}px`:typeof e==`string`||typeof e==`function`||Array.isArray(e)?e:`8px`}var Go=e=>{try{return e()}catch{}},Ko=(e=`mui`)=>va(e);function qo(e,t,n,r){if(!t)return;t=t===!0?{}:t;let i=r===`dark`?`dark`:`light`;if(!n){e[r]=Lo({...t,palette:{mode:i,...t?.palette}});return}let{palette:a,...o}=Mo({...n,palette:{mode:i,...t?.palette}});return e[r]={...t,palette:a,opacity:{...Fo(i),...t?.opacity},overlays:t?.overlays||Io(i)},o}function Jo(e={},...t){let{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:i=!1,cssVarPrefix:a=`mui`,shouldSkipGeneratingVar:o=Ro,colorSchemeSelector:s=n.light&&n.dark?`media`:void 0,rootSelector:c=`:root`,...l}=e,d=Object.keys(n)[0],f=r||(n.light&&d!==`light`?`light`:d),p=Ko(a),{[f]:m,light:h,dark:g,..._}=n,v={..._},y=m;if((f===`dark`&&!(`dark`in n)||f===`light`&&!(`light`in n))&&(y=!0),!y)throw Error(u(21,f));let b=qo(v,y,l,f);h&&!v.light&&qo(v,h,void 0,`light`),g&&!v.dark&&qo(v,g,void 0,`dark`);let x={defaultColorScheme:f,...b,cssVarPrefix:a,colorSchemeSelector:s,rootSelector:c,getCssVar:p,colorSchemes:v,font:{...po(b.typography),...b.font},spacing:Wo(l.spacing)};Object.keys(x.colorSchemes).forEach(e=>{let t=x.colorSchemes[e].palette,n=e=>{let n=e.split(`-`),r=n[1],i=n[2];return p(e,t[r][i])};if(t.mode===`light`&&(W(t.common,`background`,`#fff`),W(t.common,`onBackground`,`#000`)),t.mode===`dark`&&(W(t.common,`background`,`#000`),W(t.common,`onBackground`,`#fff`)),Vo(t,[`Alert`,`AppBar`,`Avatar`,`Button`,`Chip`,`FilledInput`,`LinearProgress`,`Skeleton`,`Slider`,`SnackbarContent`,`SpeedDialAction`,`StepConnector`,`StepContent`,`Switch`,`TableCell`,`Tooltip`]),t.mode===`light`){W(t.Alert,`errorColor`,oi(t.error.light,.6)),W(t.Alert,`infoColor`,oi(t.info.light,.6)),W(t.Alert,`successColor`,oi(t.success.light,.6)),W(t.Alert,`warningColor`,oi(t.warning.light,.6)),W(t.Alert,`errorFilledBg`,n(`palette-error-main`)),W(t.Alert,`infoFilledBg`,n(`palette-info-main`)),W(t.Alert,`successFilledBg`,n(`palette-success-main`)),W(t.Alert,`warningFilledBg`,n(`palette-warning-main`)),W(t.Alert,`errorFilledColor`,Go(()=>t.getContrastText(t.error.main))),W(t.Alert,`infoFilledColor`,Go(()=>t.getContrastText(t.info.main))),W(t.Alert,`successFilledColor`,Go(()=>t.getContrastText(t.success.main))),W(t.Alert,`warningFilledColor`,Go(()=>t.getContrastText(t.warning.main))),W(t.Alert,`errorStandardBg`,ci(t.error.light,.9)),W(t.Alert,`infoStandardBg`,ci(t.info.light,.9)),W(t.Alert,`successStandardBg`,ci(t.success.light,.9)),W(t.Alert,`warningStandardBg`,ci(t.warning.light,.9)),W(t.Alert,`errorIconColor`,n(`palette-error-main`)),W(t.Alert,`infoIconColor`,n(`palette-info-main`)),W(t.Alert,`successIconColor`,n(`palette-success-main`)),W(t.Alert,`warningIconColor`,n(`palette-warning-main`)),W(t.AppBar,`defaultBg`,n(`palette-grey-100`)),W(t.Avatar,`defaultBg`,n(`palette-grey-400`)),W(t.Button,`inheritContainedBg`,n(`palette-grey-300`)),W(t.Button,`inheritContainedHoverBg`,n(`palette-grey-A100`)),W(t.Chip,`defaultBorder`,n(`palette-grey-400`)),W(t.Chip,`defaultAvatarColor`,n(`palette-grey-700`)),W(t.Chip,`defaultIconColor`,n(`palette-grey-700`)),W(t.FilledInput,`bg`,`rgba(0, 0, 0, 0.06)`),W(t.FilledInput,`hoverBg`,`rgba(0, 0, 0, 0.09)`),W(t.FilledInput,`disabledBg`,`rgba(0, 0, 0, 0.12)`),W(t.LinearProgress,`primaryBg`,ci(t.primary.main,.62)),W(t.LinearProgress,`secondaryBg`,ci(t.secondary.main,.62)),W(t.LinearProgress,`errorBg`,ci(t.error.main,.62)),W(t.LinearProgress,`infoBg`,ci(t.info.main,.62)),W(t.LinearProgress,`successBg`,ci(t.success.main,.62)),W(t.LinearProgress,`warningBg`,ci(t.warning.main,.62)),W(t.Skeleton,`bg`,`rgba(${n(`palette-text-primaryChannel`)} / 0.11)`),W(t.Slider,`primaryTrack`,ci(t.primary.main,.62)),W(t.Slider,`secondaryTrack`,ci(t.secondary.main,.62)),W(t.Slider,`errorTrack`,ci(t.error.main,.62)),W(t.Slider,`infoTrack`,ci(t.info.main,.62)),W(t.Slider,`successTrack`,ci(t.success.main,.62)),W(t.Slider,`warningTrack`,ci(t.warning.main,.62));let e=ui(t.background.default,.8);W(t.SnackbarContent,`bg`,e),W(t.SnackbarContent,`color`,Go(()=>t.getContrastText(e))),W(t.SpeedDialAction,`fabHoverBg`,ui(t.background.paper,.15)),W(t.StepConnector,`border`,n(`palette-grey-400`)),W(t.StepContent,`border`,n(`palette-grey-400`)),W(t.Switch,`defaultColor`,n(`palette-common-white`)),W(t.Switch,`defaultDisabledColor`,n(`palette-grey-100`)),W(t.Switch,`primaryDisabledColor`,ci(t.primary.main,.62)),W(t.Switch,`secondaryDisabledColor`,ci(t.secondary.main,.62)),W(t.Switch,`errorDisabledColor`,ci(t.error.main,.62)),W(t.Switch,`infoDisabledColor`,ci(t.info.main,.62)),W(t.Switch,`successDisabledColor`,ci(t.success.main,.62)),W(t.Switch,`warningDisabledColor`,ci(t.warning.main,.62)),W(t.TableCell,`border`,ci(ii(t.divider,1),.88)),W(t.Tooltip,`bg`,ii(t.grey[700],.92))}if(t.mode===`dark`){W(t.Alert,`errorColor`,ci(t.error.light,.6)),W(t.Alert,`infoColor`,ci(t.info.light,.6)),W(t.Alert,`successColor`,ci(t.success.light,.6)),W(t.Alert,`warningColor`,ci(t.warning.light,.6)),W(t.Alert,`errorFilledBg`,n(`palette-error-dark`)),W(t.Alert,`infoFilledBg`,n(`palette-info-dark`)),W(t.Alert,`successFilledBg`,n(`palette-success-dark`)),W(t.Alert,`warningFilledBg`,n(`palette-warning-dark`)),W(t.Alert,`errorFilledColor`,Go(()=>t.getContrastText(t.error.dark))),W(t.Alert,`infoFilledColor`,Go(()=>t.getContrastText(t.info.dark))),W(t.Alert,`successFilledColor`,Go(()=>t.getContrastText(t.success.dark))),W(t.Alert,`warningFilledColor`,Go(()=>t.getContrastText(t.warning.dark))),W(t.Alert,`errorStandardBg`,oi(t.error.light,.9)),W(t.Alert,`infoStandardBg`,oi(t.info.light,.9)),W(t.Alert,`successStandardBg`,oi(t.success.light,.9)),W(t.Alert,`warningStandardBg`,oi(t.warning.light,.9)),W(t.Alert,`errorIconColor`,n(`palette-error-main`)),W(t.Alert,`infoIconColor`,n(`palette-info-main`)),W(t.Alert,`successIconColor`,n(`palette-success-main`)),W(t.Alert,`warningIconColor`,n(`palette-warning-main`)),W(t.AppBar,`defaultBg`,n(`palette-grey-900`)),W(t.AppBar,`darkBg`,n(`palette-background-paper`)),W(t.AppBar,`darkColor`,n(`palette-text-primary`)),W(t.Avatar,`defaultBg`,n(`palette-grey-600`)),W(t.Button,`inheritContainedBg`,n(`palette-grey-800`)),W(t.Button,`inheritContainedHoverBg`,n(`palette-grey-700`)),W(t.Chip,`defaultBorder`,n(`palette-grey-700`)),W(t.Chip,`defaultAvatarColor`,n(`palette-grey-300`)),W(t.Chip,`defaultIconColor`,n(`palette-grey-300`)),W(t.FilledInput,`bg`,`rgba(255, 255, 255, 0.09)`),W(t.FilledInput,`hoverBg`,`rgba(255, 255, 255, 0.13)`),W(t.FilledInput,`disabledBg`,`rgba(255, 255, 255, 0.12)`),W(t.LinearProgress,`primaryBg`,oi(t.primary.main,.5)),W(t.LinearProgress,`secondaryBg`,oi(t.secondary.main,.5)),W(t.LinearProgress,`errorBg`,oi(t.error.main,.5)),W(t.LinearProgress,`infoBg`,oi(t.info.main,.5)),W(t.LinearProgress,`successBg`,oi(t.success.main,.5)),W(t.LinearProgress,`warningBg`,oi(t.warning.main,.5)),W(t.Skeleton,`bg`,`rgba(${n(`palette-text-primaryChannel`)} / 0.13)`),W(t.Slider,`primaryTrack`,oi(t.primary.main,.5)),W(t.Slider,`secondaryTrack`,oi(t.secondary.main,.5)),W(t.Slider,`errorTrack`,oi(t.error.main,.5)),W(t.Slider,`infoTrack`,oi(t.info.main,.5)),W(t.Slider,`successTrack`,oi(t.success.main,.5)),W(t.Slider,`warningTrack`,oi(t.warning.main,.5));let e=ui(t.background.default,.98);W(t.SnackbarContent,`bg`,e),W(t.SnackbarContent,`color`,Go(()=>t.getContrastText(e))),W(t.SpeedDialAction,`fabHoverBg`,ui(t.background.paper,.15)),W(t.StepConnector,`border`,n(`palette-grey-600`)),W(t.StepContent,`border`,n(`palette-grey-600`)),W(t.Switch,`defaultColor`,n(`palette-grey-300`)),W(t.Switch,`defaultDisabledColor`,n(`palette-grey-600`)),W(t.Switch,`primaryDisabledColor`,oi(t.primary.main,.55)),W(t.Switch,`secondaryDisabledColor`,oi(t.secondary.main,.55)),W(t.Switch,`errorDisabledColor`,oi(t.error.main,.55)),W(t.Switch,`infoDisabledColor`,oi(t.info.main,.55)),W(t.Switch,`successDisabledColor`,oi(t.success.main,.55)),W(t.Switch,`warningDisabledColor`,oi(t.warning.main,.55)),W(t.TableCell,`border`,oi(ii(t.divider,1),.68)),W(t.Tooltip,`bg`,ii(t.grey[700],.92))}Uo(t.background,`default`),Uo(t.background,`paper`),Uo(t.common,`background`),Uo(t.common,`onBackground`),Uo(t,`divider`),Object.keys(t).forEach(e=>{let n=t[e];e!==`tonalOffset`&&n&&typeof n==`object`&&(n.main&&W(t[e],`mainChannel`,Qr(Ho(n.main))),n.light&&W(t[e],`lightChannel`,Qr(Ho(n.light))),n.dark&&W(t[e],`darkChannel`,Qr(Ho(n.dark))),n.contrastText&&W(t[e],`contrastTextChannel`,Qr(Ho(n.contrastText))),e===`text`&&(Uo(t[e],`primary`),Uo(t[e],`secondary`)),e===`action`&&(n.active&&Uo(t[e],`active`),n.selected&&Uo(t[e],`selected`)))})}),x=t.reduce((e,t)=>Yt(e,t),x);let S={prefix:a,disableCssColorScheme:i,shouldSkipGeneratingVar:o,getSelector:Bo(x)},{vars:C,generateThemeVars:w,generateStyleSheets:T}=Ca(x,S);return x.vars=C,Object.entries(x.colorSchemes[x.defaultColorScheme]).forEach(([e,t])=>{x[e]=t}),x.generateThemeVars=w,x.generateStyleSheets=T,x.generateSpacing=function(){return Mn(l.spacing,wn(this))},x.getColorSchemeSelector=wa(s),x.spacing=x.generateSpacing(),x.shouldSkipGeneratingVar=o,x.unstable_sxConfig={...or,...l?.unstable_sxConfig},x.unstable_sx=function(e){return ur({sx:e,theme:this})},x.toRuntimeSource=jo,x}function Yo(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:fo({...n===!0?{}:n.palette,mode:t})})}function Xo(e={},...t){let{palette:n,cssVariables:r=!1,colorSchemes:i=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...o}=e,s=a||`light`,c=i?.[s],l={...i,...n?{[s]:{...typeof c!=`boolean`&&c,palette:n}}:void 0};if(r===!1){if(!(`colorSchemes`in e))return Mo(e,...t);let r=n;`palette`in e||l[s]&&(l[s]===!0?s===`dark`&&(r={mode:`dark`}):r=l[s].palette);let i=Mo({...e,palette:r},...t);return i.defaultColorScheme=s,i.colorSchemes=l,i.palette.mode===`light`&&(i.colorSchemes.light={...l.light!==!0&&l.light,palette:i.palette},Yo(i,`dark`,l.dark)),i.palette.mode===`dark`&&(i.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:i.palette},Yo(i,`light`,l.light)),i}return!n&&!(`light`in l)&&s===`light`&&(l.light=!0),Jo({...o,colorSchemes:l,defaultColorScheme:s,...typeof r!=`boolean`&&r},...t)}var Zo=Xo();function Qo(){let e=gr(Zo);return e.$$material||e}function $o(e){return e!==`ownerState`&&e!==`theme`&&e!==`sx`&&e!==`as`}var es=e=>$o(e)&&e!==`classes`,G=Pr({themeId:d,defaultTheme:Zo,rootShouldForwardProp:es});function ts({theme:e,...t}){let n=`$$material`in e?e[d]:void 0;return(0,z.jsx)(na,{...t,themeId:n?d:void 0,theme:n||e})}var ns={attribute:`data-mui-color-scheme`,colorSchemeStorageKey:`mui-color-scheme`,defaultLightColorScheme:`light`,defaultDarkColorScheme:`dark`,modeStorageKey:`mui-mode`},{CssVarsProvider:rs,useColorScheme:is,getInitColorSchemeScript:as}=_a({themeId:d,theme:()=>Xo({cssVariables:!0}),colorSchemeStorageKey:ns.colorSchemeStorageKey,modeStorageKey:ns.modeStorageKey,defaultColorScheme:{light:ns.defaultLightColorScheme,dark:ns.defaultDarkColorScheme},resolveTheme:e=>{let t={...e,typography:vo(e.palette,e.typography)};return t.unstable_sx=function(e){return ur({sx:e,theme:this})},t}}),os=rs;function ss({theme:e,...t}){let n=R.useMemo(()=>{if(typeof e==`function`)return e;let t=`$$material`in e?e[d]:e;return`colorSchemes`in t?null:`vars`in t?e:{...e,vars:null}},[e]);return n?(0,z.jsx)(ts,{theme:n,...t}):(0,z.jsx)(os,{theme:e,...t})}var cs=11/23/100;function ls(e){let t={r:0,g:0,b:0};if(e.length===7)t.r=parseInt(e.substring(1,3),16),t.g=parseInt(e.substring(3,5),16),t.b=parseInt(e.substring(5,7),16);else if(e.length===4){let n=e[1],r=e[2],i=e[3];t.r=parseInt(n+n,16),t.g=parseInt(r+r,16),t.b=parseInt(i+i,16)}return t}function us(e){return`#${Math.round(e.r).toString(16).padStart(2,`0`)}${Math.round(e.g).toString(16).padStart(2,`0`)}${Math.round(e.b).toString(16).padStart(2,`0`)}`}function ds(e,t,n){let r=ls(e),i=ls(t);return r.r+=i.r*(.05+cs*(n-1)),r.g+=i.g*(.05+cs*(n-1)),r.b+=i.b*(.05+cs*(n-1)),us(r)}function fs(e,t){let n={};for(let r=1;r<=24;r++)n[`elevation${r}`]={backgroundColor:ds(e,t,r)};return n}function ps(e,t){let n,r;e===`dark`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#272727`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[200],"&:hover":{color:Xa[100]}}},MuiPaper:fs(`#121212`,`#fff`)},n={name:e,palette:{mode:`dark`,background:{paper:`#121212`,default:`#121212`},primary:{main:`#4dabf5`},secondary:{main:`#436a93`},expert:`#14bb00`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):e===`blue`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#3399CC`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}}},n={name:e,palette:{mode:`dark`,background:{paper:`#151d21`,default:`#151d21`},primary:{main:`#4dabf5`},secondary:{main:`#436a93`},expert:`#14bb00`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):e===`colored`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#2a3135`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[200],"&:hover":{color:Xa[100]}}},MuiPaper:fs(`#151d21`,`#fff`)},n={name:e,palette:{mode:`light`,primary:{main:`#3399CC`},secondary:{main:`#164477`},expert:`#96fc96`}}):e===`PT`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#0F99DE`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}}},n={name:e,palette:{mode:`light`,primary:{main:`#0F99DE`},secondary:{main:`#88A536`},expert:`#BD1B24`}}):e===`NW`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#272727`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}},MuiPaper:fs(`#121212`,`#fff`)},n={name:e,palette:{mode:`dark`,background:{paper:`#121212`,default:`#121212`},primary:{main:`#00af78`},secondary:{main:`#005a40`},expert:`#14bb00`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):e===`HA`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#272727`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:`#db0a33`,"&:hover":{color:`#FF0a33`}}},MuiPaper:fs(`#121212`,`#fff`)},n={name:e,palette:{mode:`dark`,background:{paper:`#121212`,default:`#121212`},primary:{main:`#970720`},secondary:{main:`#db0a33`},expert:`#db0a33`,nonAck:`#ffe96a`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):(r={MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}}},n={name:e,palette:{mode:`light`,primary:{main:`#3399CC`,dark:`#256c97`,light:`#76d0fd`},secondary:{main:`#164477`},expert:`#14bb00`}}),n.toolbar={height:48},n.saveToolbar={background:n.palette?.primary?.main,button:{borderRadius:3,height:32}},n.palette&&(n.palette.grey={main:qa[300],dark:qa[400]});let i=Xo(n),a=i.palette;return Xo(i,{...t||void 0,components:{...r,MuiButton:{variants:[{props:{variant:`contained`,color:`grey`},style:{backgroundColor:a.grey?.[300],color:a.getContrastText&&a.grey?.[300]?a.getContrastText(a.grey[300]):void 0}},{props:{variant:`outlined`,color:`grey`},style:{color:a.text?.primary,borderColor:a.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`,"&.Mui-disabled":{border:`1px solid ${a.action?.disabledBackground}`},"&:hover":{borderColor:a.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`,backgroundColor:ri(a.text?.primary||``,a.action?.hoverOpacity||.04)}}},{props:{variant:`text`,color:`grey`},style:{color:a.text?.primary,"&:hover":{backgroundColor:ri(a.text?.primary||``,a.action?.hoverOpacity||.04)}}}]},...t?.components||void 0}})}function ms(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}function hs(e){return e?.rows.map(e=>e.value).filter(e=>!!e)??[]}function gs(e){return e?.startsWith(`system.host.`)||(e=`system.host.${e}`),e}function _s(e){return new Promise(t=>{setTimeout(t,e)})}function vs(e){e=(e||``).toString();let t=e[0]===`*`,n=e[e.length-1]===`*`;return e=e.replace(/[-/\\^$+?.()|[\]{}]/g,`\\$&`).replace(/\*/g,`.*`),(t?``:`^`)+e+(n?``:`$`)}globalThis.process!==void 0&&(globalThis.location||={href:`http://localhost:8081/`,protocol:`http:`,host:`localhost:8081`,pathname:`/`,hostname:`localhost`,reload:()=>{}},globalThis.localStorage||={_keys:{},setItem:(e,t)=>{globalThis.localStorage._keys[e]=t},getItem:e=>e in globalThis.localStorage._keys?globalThis.localStorage._keys[e]:null,removeItem:e=>{e in globalThis.localStorage._keys&&delete globalThis.localStorage._keys[e]}},globalThis.sessionStorage||=globalThis.localStorage,globalThis.navigator||={language:`en`});var ys;(function(e){e[e.CONNECTING=0]=`CONNECTING`,e[e.CONNECTED=1]=`CONNECTED`,e[e.OBJECTS_LOADED=2]=`OBJECTS_LOADED`,e[e.READY=3]=`READY`})(ys||={});var bs;(function(e){e.PERMISSION_ERROR=`permissionError`,e.NOT_CONNECTED=`notConnectedError`,e.TIMEOUT=`timeout`,e.NOT_ADMIN=`Allowed only in admin`,e.NOT_SUPPORTED=`Not supported`})(bs||={}),bs.PERMISSION_ERROR,bs.NOT_CONNECTED;var xs=[`material`,`echarts`,`vis`],Ss=class e{props;connId;lastAccessToken=null;ignoreState=``;connected=!1;subscribed=!1;firstConnect=!0;waitForRestart=!1;loaded=!1;simStates={};objectViewCached;constructor(e){this.props=this.applyDefaultProps(e),this.connId=`${this.props.name?`${this.props.name}-`:``}${Math.round(Math.random()*1e6).toString().padStart(6,`0`)}`,this.waitForSocketLib().then(()=>this.startSocket()).catch(e=>{alert(`Socket connection could not be initialized: ${e}`)})}applyDefaultProps(e){return{...e,protocol:e.protocol||globalThis.location.protocol,host:e.host||globalThis.location.hostname,port:e.port||(globalThis.location.port===`3000`?8081:globalThis.location.port),ioTimeout:Math.max(e.ioTimeout||2e4,2e4),cmdTimeout:Math.max(e.cmdTimeout||5e3,5e3),admin5only:e.admin5only||!1,autoSubscribes:e.autoSubscribes??[],autoSubscribeLog:e.autoSubscribeLog??!1,doNotLoadACL:e.doNotLoadACL??!0,doNotLoadAllObjects:e.doNotLoadAllObjects??!0}}statesSubscribes={};filesSubscribes={};objectsSubscribes={};objects={};states={};acl=null;isSecure=!1;onReadyDone=!1;onConnectionHandlers=[];onLogHandlers=[];onCmdStdoutHandler;onCmdStderrHandler;onCmdExitHandler;onError(e){(this.props.onError??console.error)(e)}_socket;_waitForSocketPromise;_waitForFirstConnectionPromise=ms();_instanceSubscriptions={};_promises={};_authTimer=null;_refreshTimer=null;_systemConfig;get systemConfig(){return this._systemConfig}systemLang=`en`;static isWeb(){return globalThis.socketUrl!==void 0}waitForSocketLib(){return this._waitForSocketPromise||=new Promise(async(e,t)=>{if(this.props.connect){e();return}if(globalThis.io===void 0&&globalThis.iob===void 0)if(typeof globalThis.registerSocketOnLoad==`function`)globalThis.registerSocketOnLoad(()=>e());else{for(let t=1;t<=30;t++){if(globalThis.io||globalThis.iob)return e();await _s(100)}t(Error(`Socket library could not be loaded!`))}else e()}),this._waitForSocketPromise}async startSocket(){if(this._socket)return;let t=this.props.host,n=this.props.port,r=(this.props.protocol||globalThis.location.protocol).replace(`:`,``),i=globalThis.location.pathname;if(globalThis.location.hostname===`iobroker.net`||globalThis.location.hostname===`iobroker.pro`)i=``;else{if(globalThis.socketUrl){let e=new globalThis.URL(globalThis.socketUrl);t=e.hostname,n=e.port,r=e.protocol.replace(`:`,``)}let a=i.lastIndexOf(`/`);if(a!==-1&&(i=i.substring(0,a+1)),e.isWeb()){let e=i.split(`/`);e.length>2&&(e.pop(),e.pop(),xs.includes(e[e.length-1])&&e.pop(),i=e.join(`/`),i.endsWith(`/`)||(i+=`/`))}}let a=globalThis.socketPath||``,o=n?`${r}://${t}:${n}${a}`:`${r}://${t}${a}`,s=this.props.connect||(globalThis.io||globalThis.iob).connect;return this._socket=s(o,{path:i.endsWith(`/`)?`${i}socket.io`:`${i}/socket.io`,query:`ws=true`,name:this.props.name,timeout:this.props.ioTimeout,uuid:this.props.uuid,token:this.props.token,transports:globalThis.socketForceWebSockets?[`websocket`]:void 0}),this._socket.on(`connect`,t=>{globalThis.addEventListener?.(`storage`,this.onAccessTokenUpdated);let n=e.readTokens();if(n&&!n.owner){let e=Date.now();this.saveTokens({access_token:n.access_token,refresh_token:n.refresh_token,expires_in:Math.round((n.expires_in.getTime()-e)/1e3),refresh_token_expires_in:Math.round((n.refresh_token_expires_in.getTime()-e)/1e3),token_type:`Bearer`},n.stayLoggedIn)}this.onReadyDone=!1,t===!0?this._socket.emit(`authenticate`,(e,t)=>{this.onPreConnect(e,t)}):(this.connected=!0,setTimeout(()=>this.getVersion().then(e=>{let[t,n,r]=e.version.split(`.`);parseInt(t,10)*1e4+parseInt(n,10)*100+parseInt(r,10)<40102?(this._authTimer=null,this.onPreConnect(!1,!1)):this._socket.emit(`authenticate`,(e,t)=>this.onPreConnect(e,t))}).catch(e=>this.onError({message:e.toString(),operation:`getVersion`})),500))}),this._socket.on(`reconnect`,()=>{this.onReadyDone=!1,this.props.onProgress?.(ys.READY),this.connected=!0,this.waitForRestart?globalThis.location.reload():(this._subscribe(!0),this.onConnectionHandlers.forEach(e=>e(!0)))}),this._socket.on(`disconnect`,()=>{this.onReadyDone=!1,this.connected=!1,this.subscribed=!1,this.props.onProgress?.(ys.CONNECTING),this.onConnectionHandlers.forEach(e=>e(!1))}),this._socket.on(`reauthenticate`,()=>this.authenticate()),this._socket.on(`log`,e=>{this.props.onLog?.(e),this.onLogHandlers.forEach(t=>t(e))}),this._socket.on(`error`,e=>{let t;e==null?t=``:typeof e.toString==`function`?t=e.toString():(t=JSON.stringify(e),console.error(`Received strange error: ${t}`)),t.includes(`User not authorized`)?this.authenticate():t.includes(`websocket error`)?(console.error(`Socket Error => reload: ${e}`),globalThis.location.reload()):console.error(`Socket Error: ${e}`)}),this._socket.on(`connect_error`,e=>console.error(`Connect error: ${e}`)),this._socket.on(`permissionError`,e=>this.onError({message:`no permission`,operation:e.operation,type:e.type,id:e.id||``})),this._socket.on(`objectChange`,(e,t)=>{setTimeout(()=>this.objectChange(e,t),0)}),this._socket.on(`stateChange`,(e,t)=>{setTimeout(()=>this.stateChange(e,t),0)}),this._socket.on(`im`,(e,t,n)=>{setTimeout(()=>this.instanceMessage(e,t,n),0)}),this._socket.on(`fileChange`,(e,t,n)=>{setTimeout(()=>this.fileChange(e,t,n),0)}),this._socket.on(`cmdStdout`,(e,t)=>{this.onCmdStdoutHandler?.(e,t)}),this._socket.on(`cmdStderr`,(e,t)=>{this.onCmdStderrHandler?.(e,t)}),this._socket.on(`cmdExit`,(e,t)=>{this.onCmdExitHandler?.(e,t)}),Promise.resolve()}onPreConnect(e,t){this._authTimer&&=(clearTimeout(this._authTimer),null),this.connected=!0,this.isSecure=t,this.waitForRestart?globalThis.location.reload():(this.firstConnect?this.loadData().catch(e=>{console.error(`Cannot load data: ${e}`)}):this.props.onProgress?.(ys.READY),this._subscribe(!0),this.onConnectionHandlers.forEach(e=>e(!0)),this.checkAccessTokenExpire()),this._waitForFirstConnectionPromise.resolve()}static readTokens(){let e=globalThis.sessionStorage.getItem(`iob_tokens`),t=!e;if(e||=globalThis.localStorage.getItem(`iob_tokens`),!e)return null;let[n,r,i,a,o]=e.split(`;`),s=new Date(r);return s.getTime()<Date.now()?null:{refresh_token:n,refresh_token_expires_in:s,access_token:i,expires_in:new Date(a),owner:o,stayLoggedIn:t}}static saveTokensStatic(e,t,n){let r=`${e.refresh_token};${new Date(Date.now()+e.refresh_token_expires_in*1e3).toISOString()};${e.access_token};${new Date(Date.now()+e.expires_in*1e3).toISOString()}${n?`;${n}`:``}`;t?globalThis.localStorage.setItem(`iob_tokens`,r):globalThis.sessionStorage.setItem(`iob_tokens`,r)}saveTokens(t,n){e.saveTokensStatic(t,n,this.connId)}static deleteTokensStatic(){globalThis.localStorage.removeItem(`iob_tokens`),globalThis.sessionStorage.removeItem(`iob_tokens`)}deleteTokens(t,n){let r=e.readTokens();r&&(n?e.deleteTokensStatic():r.stayLoggedIn===t&&r.owner===this.connId&&(r.stayLoggedIn?globalThis.localStorage.removeItem(`iob_tokens`):globalThis.sessionStorage.removeItem(`iob_tokens`)))}onAccessTokenUpdated=t=>{if(t.key===`iob_tokens`){let t=e.readTokens();t&&(console.log(`Tab ${this.connId} received updated token: ${t.access_token}`),this.updateTokenExpiration(t.access_token))}};updateTokenExpiration(e){this.lastAccessToken!==e&&(this.lastAccessToken=e,this._socket.emit(`updateTokenExpiration`,e,(t,n)=>{t?(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${t}`),globalThis.location.reload()):n?console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${e}`):(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`),globalThis.location.reload())})),this.checkAccessTokenExpire()}refreshTokens(e,t){if(!e){console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`),setTimeout(()=>globalThis.location.reload(),500);return}t||!e.owner||e.owner===this.connId?(console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`),this.acquireTokenLock()?(console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`),fetch(`./oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:`grant_type=refresh_token&refresh_token=${e.refresh_token}&client_id=ioBroker&stayloggedin=${e.stayLoggedIn}`}).then(e=>{if(e.ok)return e.json();throw Error(`Cannot refresh access token`)}).then(t=>{if(t.access_token)console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${t.access_token}`),this.saveTokens(t,e.stayLoggedIn),this.releaseTokenLock(),this.updateTokenExpiration(t.access_token);else throw Error(`Cannot get access token`)}).catch(t=>{console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${t}`),this.releaseTokenLock(),this.deleteTokens(e.stayLoggedIn),console.error(t),globalThis.location.reload()})):(console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`),this.checkAccessTokenExpire())):this.lastAccessToken!==e.access_token&&this.updateTokenExpiration(e.access_token)}acquireTokenLock(){let e=Date.now(),t=globalThis.localStorage.getItem(`iob_token_semaphore`);if(t)try{if(e<JSON.parse(t).expiry)return!1}catch{}let n={connId:this.connId,expiry:e+10*1e3};return globalThis.localStorage.setItem(`iob_token_semaphore`,JSON.stringify(n)),!0}releaseTokenLock(){let e=globalThis.localStorage.getItem(`iob_token_semaphore`);if(e)try{JSON.parse(e).connId===this.connId&&globalThis.localStorage.removeItem(`iob_token_semaphore`)}catch{globalThis.localStorage.removeItem(`iob_token_semaphore`)}}checkAccessTokenExpire(){if(this._refreshTimer&&=(clearTimeout(this._refreshTimer),null),this.isSecure){let t=e.readTokens();if(t){let e=t.expires_in.getTime();if(e<Date.now()+3e4){let n=e<Date.now()+5500;console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${t.access_token}`),t.refresh_token?t.owner===this.connId||n?(t.owner===this.connId?console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`):console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`),this.props.tokenTimeoutHandler?(console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`),this.props.tokenTimeoutHandler(e).then(r=>{r?(console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`),this.refreshTokens(t,n)):(console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`),setTimeout(()=>globalThis.location.reload(),Date.now()>e?500:e-Date.now()))})):(console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`),this.refreshTokens(t,n))):this.lastAccessToken===t.access_token?(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`),this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},3e3)):(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`),this.refreshTokens(t)):(console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`),setTimeout(()=>globalThis.location.reload(),Date.now()>e?500:e-Date.now()))}else this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},e-Date.now()-3e4>12e4?12e4:e-Date.now()-3e4)}}}static isCloud(){return globalThis.location.hostname.includes(`amazonaws.com`)||globalThis.location.hostname.includes(`iobroker.in`)?!0:globalThis.socketUrl===void 0?!1:globalThis.socketUrl.includes(`iobroker.in`)||globalThis.socketUrl.includes(`amazonaws`)}isConnected(){return this.connected}waitForFirstConnection(){return this._waitForFirstConnectionPromise}async getUserPermissions(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getUserPermissions`,(n,r)=>{n?t(n):e(r||null)})}})}async loadData(){if(!this.loaded)for(let t=1;t<=10;t++){if(this.doLoadData().catch(e=>console.error(`Cannot load data: ${e}`)),this.loaded)return;await _s(e.isCloud()?5e3:1e3)}}async doLoadData(){if(!this.loaded){if(!this.props.doNotLoadACL)try{this.acl=await this.getUserPermissions()}catch(e){this.onError(`Cannot read user permissions: ${e}`);return}try{this.props.admin5only&&!e.isWeb()&&(!globalThis.vendorPrefix||globalThis.vendorPrefix===`@@vendorPrefix@@`)?this._systemConfig=await this.getCompactSystemConfig():this._systemConfig=await this.getSystemConfig()}catch(e){this.onError(`Cannot read system config: ${e}`);return}this._systemConfig&&(this.systemLang=this._systemConfig.common?.language,this.systemLang||(this.systemLang=globalThis.navigator.userLanguage||globalThis.navigator.language,/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(this.systemLang)?this.systemLang=this.systemLang.substring(0,2):/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(this.systemLang)||(this.systemLang=`en`),this._systemConfig.common.language=this.systemLang)),this.props.onLanguage?.(this.systemLang),this.loaded=!0,this.props.onProgress?.(ys.CONNECTED),this.firstConnect=!1,this.props.doNotLoadAllObjects?this.props.admin5only?this.objects={}:this.objects={"system.config":this._systemConfig}:this.objects=await this.getObjects(),this.props.onProgress?.(ys.READY),this.onReadyDone||(this.onReadyDone=!0,this.props.onReady?.(this.objects))}}authenticate(){globalThis.location.search.includes(`&href=`)?globalThis.location.href=`${globalThis.location.protocol}//${globalThis.location.host}${globalThis.location.pathname}${globalThis.location.search}`:globalThis.location.href=`${globalThis.location.protocol}//${globalThis.location.host}${globalThis.location.pathname}?login&href=${encodeURIComponent(globalThis.location.search+globalThis.location.hash)}`}async subscribeState(...t){let n,r,i;t.length===3?[n,r,i]=t:([n,i]=t,r=!1);let a;if(a=Array.isArray(n)?n:[n],typeof i!=`function`)throw Error(`The state change handler must be a function!`);let o=[];for(let e=0;e<a.length;e++){let t=a[e];this.statesSubscribes[t]?!this.statesSubscribes[t].cbs.includes(i)&&this.statesSubscribes[t].cbs.push(i):(this.statesSubscribes[t]={reg:new RegExp(vs(t)),cbs:[i]},n!==this.ignoreState&&o.push(t))}if(this.connected)if(o.length&&this._socket.emit(`subscribe`,o),r){let e;for(let t=0;t<a.length;t++){try{e=await this.getBinaryState(a[t])}catch(n){console.error(`Cannot getBinaryState "${a[t]}": ${JSON.stringify(n)}`),e=void 0}e!=null&&i(a[t],e)}}else if(a.find(e=>e.includes(`*`))){let e;for(let t=0;t<a.length;t++){try{e=await this.getForeignStates(a[t])}catch(e){console.error(`Cannot getForeignStates "${a[t]}": ${JSON.stringify(e)}`);return}if(e)for(let[t,n]of Object.entries(e)){let e=i(t,n);e instanceof Promise&&e.catch(e=>console.error(`Cannot call state change handler: ${e}`))}}}else try{let t=await(e.isWeb()?this.getStates(a):this.getForeignStates(a));if(t)for(let[e,n]of Object.entries(t)){let t=i(e,n);t instanceof Promise&&t.catch(e=>console.error(`Cannot call state change handler: ${e}`))}}catch(e){console.error(`Cannot getState "${a.join(`, `)}": ${e.message}`);return}}async subscribeStateAsync(e,t){return this.subscribeState(e,t)}unsubscribeState(e,t){let n;n=Array.isArray(e)?e:[e];let r=[];for(let e=0;e<n.length;e++){let i=n[e];if(this.statesSubscribes[i]){let e=this.statesSubscribes[i];if(t){let n=e.cbs.indexOf(t);n!==-1&&e.cbs.splice(n,1)}else e.cbs=[];e.cbs?.length||(delete this.statesSubscribes[i],i!==this.ignoreState&&r.push(i))}}this.connected&&r.length&&this._socket.emit(`unsubscribe`,n)}subscribeObject(e,t){let n;if(n=Array.isArray(e)?e:[e],typeof t!=`function`)throw Error(`The object change handler must be a function!`);let r=[];for(let e=0;e<n.length;e++){let i=n[e];this.objectsSubscribes[i]?!this.objectsSubscribes[i].cbs.includes(t)&&this.objectsSubscribes[i].cbs.push(t):(this.objectsSubscribes[i]={reg:new RegExp(vs(i)),cbs:[t]},r.push(i))}return this.connected&&r.length&&this._socket.emit(`subscribeObjects`,r),Promise.resolve()}unsubscribeObject(e,t){let n;n=Array.isArray(e)?e:[e];let r=[];for(let e=0;e<n.length;e++){let i=n[e];if(this.objectsSubscribes[i]){let e=this.objectsSubscribes[i];if(t){let n=e.cbs.indexOf(t);n!==-1&&e.cbs.splice(n,1)}else e.cbs=[];e.cbs?.length||(delete this.objectsSubscribes[i],r.push(i))}}return this.connected&&r.length&&this._socket.emit(`unsubscribeObjects`,r),Promise.resolve()}objectChange(e,t){let n;this.objects[e]&&(n={_id:e,type:this.objects[e].type});let r=!1;t?(t._rev&&this.objects[e]&&(this.objects[e]._rev=t._rev),(!this.objects[e]||JSON.stringify(this.objects[e])!==JSON.stringify(t))&&(this.objects[e]=t,r=!0)):this.objects[e]&&(delete this.objects[e],r=!0);for(let[r,i]of Object.entries(this.objectsSubscribes))(r===e||i.reg.test(e))&&i.cbs.forEach(r=>{try{let i=r(e,t,n);i instanceof Promise&&i.catch(e=>console.error(`Cannot call object change handler: ${e}`))}catch(e){console.error(`Error by callback of objectChange: ${e}`)}});if(r){let n=this.props.onObjectChange?.(e,t);n instanceof Promise&&n.catch(e=>console.error(`Cannot call object change handler: ${e}`))}}stateChange(e,t){for(let n of Object.values(this.statesSubscribes))if(n.reg.test(e))for(let r of n.cbs)try{let n=r(e,t??null);n instanceof Promise&&n.catch(e=>console.error(`Cannot call state change handler: ${e}`))}catch(e){console.error(`Error by callback of stateChanged: ${e}`)}}instanceMessage(e,t,n){this._instanceSubscriptions[t]?.forEach(r=>{if(r.messageType===e){let i=r.callback(n,t,e);i instanceof Promise&&i.catch(e=>console.error(`Cannot call instance message handler: ${e}`))}})}fileChange(e,t,n){for(let r of Object.values(this.filesSubscribes))if(r.regId.test(e)&&r.regFilePattern.test(t))for(let i of r.cbs)try{i(e,t,n)}catch(e){console.error(`Error by callback of fileChange: ${e}`)}}async subscribeFiles(e,t,n){if(typeof n!=`function`)throw Error(`The state change handler must be a function!`);let r;r=Array.isArray(t)?t:[t];let i=[];for(let t=0;t<r.length;t++){let a=r[t],o=`${e}$%$${a}`;this.filesSubscribes[o]?!this.filesSubscribes[o].cbs.includes(n)&&this.filesSubscribes[o].cbs.push(n):(this.filesSubscribes[o]={regId:new RegExp(vs(e)),regFilePattern:new RegExp(vs(a)),cbs:[n]},i.push(a))}return this.connected&&i.length&&this._socket.emit(`subscribeFiles`,e,i),Promise.resolve()}unsubscribeFiles(e,t,n){let r;r=Array.isArray(t)?t:[t];let i=[];for(let t=0;t<r.length;t++){let a=r[t],o=`${e}$%$${a}`;if(this.filesSubscribes[o]){let e=this.filesSubscribes[o];if(n){let t=e.cbs.indexOf(n);t!==-1&&e.cbs.splice(t,1)}else e.cbs=[];e.cbs?.length||(delete this.filesSubscribes[o],i.push(a))}}this.connected&&i.length&&this._socket.emit(`unsubscribeFiles`,e,i)}async request({cacheKey:t,forceUpdate:n,commandTimeout:r,onTimeout:i,requireAdmin:a,requireFeatures:o,executor:s}){if(a&&e.isWeb())return Promise.reject(Error(bs.NOT_ADMIN));if(t&&!n&&t in this._promises)return this._promises[t];if(!this.connected)return Promise.reject(Error(bs.NOT_CONNECTED));if(o?.length){for(let e of o)if(!await this.checkFeatureSupported(e))throw Error(bs.NOT_SUPPORTED)}let c=new Promise(async(e,n)=>{let a={elapsed:!1,clearTimeout:()=>{}},o;r!==!1&&(o=setTimeout(()=>{a.elapsed=!0,i?.(),t&&this._promises[t]instanceof Promise&&delete this._promises[t],n(Error(bs.TIMEOUT))},r??this.props.cmdTimeout),a.clearTimeout=()=>{clearTimeout(o)});try{await s(e,n,a)}catch(e){t&&this._promises[t]instanceof Promise&&delete this._promises[t],n(Error(e.toString()))}});return t&&(this._promises[t]=c),c}resetCache(e,t){t?Object.keys(this._promises).filter(t=>t.startsWith(e)).forEach(e=>{delete this._promises[e]}):delete this._promises[e]}getStates(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getStates`,e,(e,r)=>{this.states=r??{},e?n(e):t(this.states)})}})}getState(e){return this.request({commandTimeout:!1,executor:(t,n)=>{if(e&&e===this.ignoreState){t(this.simStates[e]||{val:null,ack:!0});return}this._socket.emit(`getState`,e,(e,r)=>{e?n(e):t(r)})}})}getBinaryState(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getBinaryState`,e,(e,r)=>{e?n(e):t(r)})}})}setBinaryState(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`setBinaryState`,e,t,e=>{e?r(e):n()})}})}setState(e,t,n){return typeof n==`boolean`&&(t={val:t,ack:n}),this.request({commandTimeout:!1,executor:(r,i)=>{if(e&&e===this.ignoreState){let i;if(i=typeof n==`boolean`||typeof t==`object`&&t.val!==void 0?t:{val:t,ack:!1,ts:Date.now(),lc:Date.now(),from:`system.adapter.vis.0`},this.simStates[e]=i,this.statesSubscribes[e])for(let t of this.statesSubscribes[e].cbs)try{let n=t(e,i);n instanceof Promise&&n.catch(e=>console.error(`Cannot call state change handler: ${e}`))}catch(e){console.error(`Error by callback of stateChanged: ${e}`)}r();return}this._socket.emit(`setState`,e,t,e=>{e?i(e):r()})}})}getObjects(t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{if(!t&&this.objects){r(this.objects);return}this._socket.emit(e.isWeb()?`getObjects`:`getAllObjects`,(e,t)=>{n||this.props.onProgress?.(ys.OBJECTS_LOADED),e?i(e):(this.objects=t??{},r(this.objects))})}})}getObjectsById(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getObjects`,e,(e,r)=>{e?n(e):t(r)})}})}_subscribe(e){if(e&&!this.subscribed){this.subscribed=!0,this.props.autoSubscribes?.length&&this._socket.emit(`subscribeObjects`,this.props.autoSubscribes);let e=Object.keys(this.objectsSubscribes);e.length&&this._socket.emit(`subscribeObjects`,e),Object.keys(this.objectsSubscribes).forEach(e=>this._socket.emit(`subscribeObjects`,e)),this.props.autoSubscribeLog&&this._socket.emit(`requireLog`,!0),Object.keys(this.statesSubscribes).forEach(e=>this._socket.emit(`subscribe`,e)),Object.keys(this.filesSubscribes).forEach(e=>{let[t,n]=e.split(`$%$`);this._socket.emit(`subscribeFiles`,t,n)})}else if(!e&&this.subscribed){this.subscribed=!1,this.props.autoSubscribes?.length&&this._socket.emit(`unsubscribeObjects`,this.props.autoSubscribes);let e=Object.keys(this.objectsSubscribes);e.length&&this._socket.emit(`unsubscribeObjects`,e),this.props.autoSubscribeLog&&this._socket.emit(`requireLog`,!1),Object.keys(this.statesSubscribes).forEach(e=>this._socket.emit(`unsubscribe`,e)),Object.keys(this.filesSubscribes).forEach(e=>{let[t,n]=e.split(`$%$`);this._socket.emit(`unsubscribeFiles`,t,n)})}}requireLog(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`requireLog`,e,e=>{e?n(e):t()})}})}delObject(e,t=!1){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`delObject`,e,{maintenance:t},e=>{e?r(e):n()})}})}delObjects(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`delObjects`,e,{maintenance:t},e=>{e?r(e):n()})}})}setObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`setObject`,e,t,e=>{e?r(e):n()})}})):Promise.reject(Error(`Null object is not allowed`))}getObject(e){return this.request({commandTimeout:!1,executor:(t,n)=>{if(e&&e===this.ignoreState){t({_id:this.ignoreState,type:`state`,common:{name:`ignored state`,type:`mixed`}});return}this._socket.emit(`getObject`,e,(e,r)=>{e?n(e):t(r)})}})}sendTo(e,t,n){return this.request({commandTimeout:!1,executor:r=>{this._socket.emit(`sendTo`,e,t,n,e=>{r(e)})}})}extendObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`extendObject`,e,t,e=>{e?r(e):n()})}})):Promise.reject(Error(`Null object is not allowed`))}registerLogHandler(e){this.onLogHandlers.includes(e)||this.onLogHandlers.push(e)}unregisterLogHandler(e){let t=this.onLogHandlers.indexOf(e);t!==-1&&this.onLogHandlers.splice(t,1)}registerConnectionHandler(e){this.onConnectionHandlers.includes(e)||this.onConnectionHandlers.push(e)}unregisterConnectionHandler(e){let t=this.onConnectionHandlers.indexOf(e);t!==-1&&this.onConnectionHandlers.splice(t,1)}registerCmdStdoutHandler(e){this.onCmdStdoutHandler=e}unregisterCmdStdoutHandler(){this.onCmdStdoutHandler=void 0}registerCmdStderrHandler(e){this.onCmdStderrHandler=e}unregisterCmdStderrHandler(){this.onCmdStderrHandler=void 0}registerCmdExitHandler(e){this.onCmdExitHandler=e}unregisterCmdExitHandler(){this.onCmdExitHandler=void 0}getEnums(e,t){return this.request({cacheKey:`enums_${e||`all`}`,forceUpdate:t,commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getObjectView`,`system`,`enum`,{startkey:`enum.${e||``}`,endkey:e?`enum.${e}.\u9999`:`enum.香`},(r,i)=>{if(r)n(r);else{let n={};if(i)for(let t=0;t<i.rows.length;t++)e&&i.rows[t].id===`enum.${e}`||(n[i.rows[t].id]=i.rows[t].value);t(n)}})}})}getObjectView(e,t,n){return this.getObjectViewCustom(`system`,n,e,t)}async getObjectViewSystem(e,t,n){let r=`${e}_${t||``}_${n||``}`,i=await this.getObjectViewCustom(`system`,e,t,n);return this.objectViewCached?.[r]&&(this.objectViewCached[r]=i),i}async getObjectViewSystemCached(e,t,n){let r=`${e}_${t||``}_${n||``}`;if(this.objectViewCached?.[r])return Promise.resolve(this.objectViewCached[r]);let i=await this.getObjectViewCustom(`system`,e,t,n);return this.objectViewCached||={},this.objectViewCached[r]=i,i}getObjectViewCustom(e,t,n,r){return this.request({commandTimeout:!1,executor:(i,a)=>{n||=``,r||=`香`,this._socket.emit(`getObjectView`,e,t,{startkey:n,endkey:r},(e,t)=>{if(e)a(e);else{let e={};if(t&&t.rows)for(let n=0;n<t.rows.length;n++)e[t.rows[n].id]=t.rows[n].value;i(e)}})}})}readMetaItems(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getObjectView`,`system`,`meta`,{startkey:``,endkey:`香`},(n,r)=>{n?t(n):e(r.rows?.map(e=>e.value).filter(e=>!!e))})}})}readDir(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`readDir`,e,t,(e,t)=>{e?r(e):n(t)})}})}readFile(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{this._socket.emit(n?`readFile64`:`readFile`,e,t,(e,t,n)=>{e?i(e):r({file:t,mimeType:n})})}})}writeFile64(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{if(typeof n==`string`)this._socket.emit(`writeFile`,e,t,n,e=>{e?i(e):r()});else{let a=btoa(new Uint8Array(n).reduce((e,t)=>e+String.fromCharCode(t),``));this._socket.emit(`writeFile64`,e,t,a,e=>{e?i(e):r()})}}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`deleteFile`,e,t,e=>{e?r(e):n()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`deleteFolder`,e,t,e=>{e?r(e):n()})}})}rename(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{this._socket.emit(`rename`,e,t,n,e=>{e?i(e):r()})}})}renameFile(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{this._socket.emit(`renameFile`,e,t,n,e=>{e?i(e):r()})}})}cmdExec(e,t,n,r,i){return this.request({commandTimeout:r,executor:(r,a,o)=>{e=gs(e);let s=e=>{o.elapsed||(o.clearTimeout(),e?a(e):r())};i?.length?this._socket.emit(`cmdExec`,e,n,t,i,s):this._socket.emit(`cmdExec`,e,n,t,s)}})}getSystemConfig(e){return this.request({cacheKey:`systemConfig`,forceUpdate:e,commandTimeout:!1,executor:async e=>{let t=await this.getObject(`system.config`);t??={},t.common??={},t.native??={},e(t)}})}getCompactSystemConfig(e){return this.request({cacheKey:`systemConfigCommon`,forceUpdate:e,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getCompactSystemConfig`,(n,r)=>{n?t(n):(r??={},r.common??={},r.native??={},e(r))})}})}getForeignStates(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getForeignStates`,e||`*`,(e,r)=>{e?n(e):t(r??{})})}})}getForeignObjects(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`getForeignObjects`,e||`*`,t,(e,t)=>{e?r(e):n(t)})}})}setSystemConfig(e){return this.setObject(`system.config`,e)}getRawSocket(){return this._socket}getHistory(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`getHistory`,e,t,(e,t)=>{e?r(e):n(t)})}})}getHistoryEx(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`getHistory`,e,t,(e,t,i,a)=>{e?r(e):n({values:t,sessionId:a,step:i})})}})}getIpAddresses(e,t){return e=gs(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async t=>{t((await this.getObject(e))?.common.address??[])}})}getVersion(e){return this.request({cacheKey:`version`,forceUpdate:e,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getVersion`,(n,r,i)=>{n&&!r&&typeof n==`string`&&n.match(/\d+\.\d+\.\d+/)?e({version:n,serverName:`socketio`}):n?t(n):e({version:r,serverName:i})})}})}getWebServerName(){return this.request({cacheKey:`webName`,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getAdapterName`,(n,r)=>{n?t(n):e(r)})}})}fileExists(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`fileExists`,e,t,(e,t)=>{e?r(e):n(!!t)})}})}getCurrentUser(){return this.request({commandTimeout:!1,executor:e=>{this._socket.emit(`authEnabled`,(t,n)=>{e(n)})}})}getUuid(){return this.request({cacheKey:`uuid`,commandTimeout:!1,executor:async e=>{e((await this.getObject(`system.meta.uuid`))?.native?.uuid)}})}checkFeatureSupported(e,t){return this.request({cacheKey:`supportedFeatures_${e}`,forceUpdate:t,commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`checkFeatureSupported`,e,(e,r)=>{e?n(e):t(r)})}})}getAdapterInstances(e,t){return typeof e==`boolean`&&(t=e,e=``),e||=``,this.request({cacheKey:`instances_${e}`,forceUpdate:t,commandTimeout:!1,executor:async t=>{let n=e?`system.adapter.${e}.`:`system.adapter.`,r=`${n}\u9999`,i=await this.getObjectViewSystem(`instance`,n,r),a=Object.values(i);t(e?a.filter(t=>t.common.name===e):a)}})}getAdapters(e,t){return typeof e==`boolean`&&(t=e,e=``),e||=``,this.request({cacheKey:`adapter_${e}`,forceUpdate:t,commandTimeout:!1,executor:async t=>{let n=await this.getObjectViewSystem(`adapter`,`system.adapter.${e||``}`,`system.adapter.${e||`香`}`),r=Object.values(n);t(e?r.filter(t=>t.common.name===e):r)}})}getGroups(e){return this.request({cacheKey:`groups`,forceUpdate:e,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getObjectView`,`system`,`group`,{startkey:`system.group.`,endkey:`system.group.香`},(n,r)=>{n?t(n):e(hs(r))})}})}logout(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`logout`,n=>{n?t(n):e(null)})}})}subscribeOnInstance(e,t,n,r){return this.request({commandTimeout:!1,executor:(i,a)=>{this._socket.emit(`clientSubscribe`,e,t,n,(n,o)=>{n?a(n):o&&(o.error?a(o.error):(e.startsWith(`system.adapter.`)||(e=`system.adapter.${e}`),this._instanceSubscriptions[e]=this._instanceSubscriptions[e]||[],this._instanceSubscriptions[e].find(e=>e.messageType===t&&e.callback===r)||this._instanceSubscriptions[e].push({messageType:t,callback:r}),i(o)))})}})}unsubscribeFromInstance(e,t,n){e.startsWith(`system.adapter.`)||(e=`system.adapter.${e}`);let r,i=[];do{r=!1;let a=this._instanceSubscriptions[e]?.findIndex(e=>(!t||e.messageType===t)&&(!n||e.callback===n));if(a!=null&&a!==-1){r=!0;let n=this._instanceSubscriptions[e][a].messageType;this._instanceSubscriptions[e].splice(a,1),this._instanceSubscriptions[e].length||delete this._instanceSubscriptions[e],this._instanceSubscriptions[e]&&this._instanceSubscriptions[e].find(e=>e.messageType===n)||i.push(this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`clientUnsubscribe`,e,t,(e,t)=>e?r(e):n(t))}}))}}while(r&&(!n||!t));return i.length?Promise.all(i).then(e=>!!e.find(e=>e)):Promise.resolve(!1)}log(e,t){return e?this.request({commandTimeout:!1,executor:n=>(this._socket.emit(`log`,e,t),n(null))}):Promise.resolve(null)}setStateToIgnore(e){this.ignoreState=e}destroy(){if(this._socket){let e=this._socket;try{typeof e.destroy==`function`?e.destroy():typeof e.close==`function`&&e.close(!0)}catch{}}globalThis.removeEventListener?.(`storage`,this.onAccessTokenUpdated),this._authTimer&&=(clearTimeout(this._authTimer),null),this._refreshTimer&&=(clearTimeout(this._refreshTimer),null),this.onConnectionHandlers.length=0,this.onLogHandlers.length=0;for(let e of Object.keys(this.statesSubscribes))delete this.statesSubscribes[e];for(let e of Object.keys(this.objectsSubscribes))delete this.objectsSubscribes[e];for(let e of Object.keys(this.filesSubscribes))delete this.filesSubscribes[e];this._instanceSubscriptions={},this.connected=!1,this.onReadyDone=!1}},Cs=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,ws=globalThis,Ts=`10.65.0`;function Es(){return Ds(ws),ws}function Ds(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.65.0`,t[Ts]=t[`10.65.0`]||{}}function Os(e,t,n=ws){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[Ts]=r[`10.65.0`]||{};return i[e]||(i[e]=t())}var ks=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],As=`Sentry Logger `,js={};function Ms(e){if(!(`console`in ws))return e();let t=ws.console,n={},r=Object.keys(js);r.forEach(e=>{let r=js[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Ns(){Bs().enabled=!0}function Ps(){Bs().enabled=!1}function Fs(){return Bs().enabled}function Is(...e){zs(`log`,...e)}function Ls(...e){zs(`warn`,...e)}function Rs(...e){zs(`error`,...e)}function zs(e,...t){Cs&&Fs()&&Ms(()=>{ws.console[e](`${As}[${e}]:`,...t)})}function Bs(){return Cs?Os(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var Vs={enable:Ns,disable:Ps,isEnabled:Fs,log:Is,warn:Ls,error:Rs},Hs=50,Us=/\(error: (.*)\)/,Ws=/captureMessage|captureException/;function Gs(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
37
+ To suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function Wo(e){return typeof e==`number`?`${e}px`:typeof e==`string`||typeof e==`function`||Array.isArray(e)?e:`8px`}var Go=e=>{try{return e()}catch{}},Ko=(e=`mui`)=>va(e);function qo(e,t,n,r){if(!t)return;t=t===!0?{}:t;let i=r===`dark`?`dark`:`light`;if(!n){e[r]=Lo({...t,palette:{mode:i,...t?.palette}});return}let{palette:a,...o}=Mo({...n,palette:{mode:i,...t?.palette}});return e[r]={...t,palette:a,opacity:{...Fo(i),...t?.opacity},overlays:t?.overlays||Io(i)},o}function Jo(e={},...t){let{colorSchemes:n={light:!0},defaultColorScheme:r,disableCssColorScheme:i=!1,cssVarPrefix:a=`mui`,shouldSkipGeneratingVar:o=Ro,colorSchemeSelector:s=n.light&&n.dark?`media`:void 0,rootSelector:c=`:root`,...l}=e,d=Object.keys(n)[0],f=r||(n.light&&d!==`light`?`light`:d),p=Ko(a),{[f]:m,light:h,dark:g,..._}=n,v={..._},y=m;if((f===`dark`&&!(`dark`in n)||f===`light`&&!(`light`in n))&&(y=!0),!y)throw Error(u(21,f));let b=qo(v,y,l,f);h&&!v.light&&qo(v,h,void 0,`light`),g&&!v.dark&&qo(v,g,void 0,`dark`);let x={defaultColorScheme:f,...b,cssVarPrefix:a,colorSchemeSelector:s,rootSelector:c,getCssVar:p,colorSchemes:v,font:{...po(b.typography),...b.font},spacing:Wo(l.spacing)};Object.keys(x.colorSchemes).forEach(e=>{let t=x.colorSchemes[e].palette,n=e=>{let n=e.split(`-`),r=n[1],i=n[2];return p(e,t[r][i])};if(t.mode===`light`&&(W(t.common,`background`,`#fff`),W(t.common,`onBackground`,`#000`)),t.mode===`dark`&&(W(t.common,`background`,`#000`),W(t.common,`onBackground`,`#fff`)),Vo(t,[`Alert`,`AppBar`,`Avatar`,`Button`,`Chip`,`FilledInput`,`LinearProgress`,`Skeleton`,`Slider`,`SnackbarContent`,`SpeedDialAction`,`StepConnector`,`StepContent`,`Switch`,`TableCell`,`Tooltip`]),t.mode===`light`){W(t.Alert,`errorColor`,oi(t.error.light,.6)),W(t.Alert,`infoColor`,oi(t.info.light,.6)),W(t.Alert,`successColor`,oi(t.success.light,.6)),W(t.Alert,`warningColor`,oi(t.warning.light,.6)),W(t.Alert,`errorFilledBg`,n(`palette-error-main`)),W(t.Alert,`infoFilledBg`,n(`palette-info-main`)),W(t.Alert,`successFilledBg`,n(`palette-success-main`)),W(t.Alert,`warningFilledBg`,n(`palette-warning-main`)),W(t.Alert,`errorFilledColor`,Go(()=>t.getContrastText(t.error.main))),W(t.Alert,`infoFilledColor`,Go(()=>t.getContrastText(t.info.main))),W(t.Alert,`successFilledColor`,Go(()=>t.getContrastText(t.success.main))),W(t.Alert,`warningFilledColor`,Go(()=>t.getContrastText(t.warning.main))),W(t.Alert,`errorStandardBg`,ci(t.error.light,.9)),W(t.Alert,`infoStandardBg`,ci(t.info.light,.9)),W(t.Alert,`successStandardBg`,ci(t.success.light,.9)),W(t.Alert,`warningStandardBg`,ci(t.warning.light,.9)),W(t.Alert,`errorIconColor`,n(`palette-error-main`)),W(t.Alert,`infoIconColor`,n(`palette-info-main`)),W(t.Alert,`successIconColor`,n(`palette-success-main`)),W(t.Alert,`warningIconColor`,n(`palette-warning-main`)),W(t.AppBar,`defaultBg`,n(`palette-grey-100`)),W(t.Avatar,`defaultBg`,n(`palette-grey-400`)),W(t.Button,`inheritContainedBg`,n(`palette-grey-300`)),W(t.Button,`inheritContainedHoverBg`,n(`palette-grey-A100`)),W(t.Chip,`defaultBorder`,n(`palette-grey-400`)),W(t.Chip,`defaultAvatarColor`,n(`palette-grey-700`)),W(t.Chip,`defaultIconColor`,n(`palette-grey-700`)),W(t.FilledInput,`bg`,`rgba(0, 0, 0, 0.06)`),W(t.FilledInput,`hoverBg`,`rgba(0, 0, 0, 0.09)`),W(t.FilledInput,`disabledBg`,`rgba(0, 0, 0, 0.12)`),W(t.LinearProgress,`primaryBg`,ci(t.primary.main,.62)),W(t.LinearProgress,`secondaryBg`,ci(t.secondary.main,.62)),W(t.LinearProgress,`errorBg`,ci(t.error.main,.62)),W(t.LinearProgress,`infoBg`,ci(t.info.main,.62)),W(t.LinearProgress,`successBg`,ci(t.success.main,.62)),W(t.LinearProgress,`warningBg`,ci(t.warning.main,.62)),W(t.Skeleton,`bg`,`rgba(${n(`palette-text-primaryChannel`)} / 0.11)`),W(t.Slider,`primaryTrack`,ci(t.primary.main,.62)),W(t.Slider,`secondaryTrack`,ci(t.secondary.main,.62)),W(t.Slider,`errorTrack`,ci(t.error.main,.62)),W(t.Slider,`infoTrack`,ci(t.info.main,.62)),W(t.Slider,`successTrack`,ci(t.success.main,.62)),W(t.Slider,`warningTrack`,ci(t.warning.main,.62));let e=ui(t.background.default,.8);W(t.SnackbarContent,`bg`,e),W(t.SnackbarContent,`color`,Go(()=>t.getContrastText(e))),W(t.SpeedDialAction,`fabHoverBg`,ui(t.background.paper,.15)),W(t.StepConnector,`border`,n(`palette-grey-400`)),W(t.StepContent,`border`,n(`palette-grey-400`)),W(t.Switch,`defaultColor`,n(`palette-common-white`)),W(t.Switch,`defaultDisabledColor`,n(`palette-grey-100`)),W(t.Switch,`primaryDisabledColor`,ci(t.primary.main,.62)),W(t.Switch,`secondaryDisabledColor`,ci(t.secondary.main,.62)),W(t.Switch,`errorDisabledColor`,ci(t.error.main,.62)),W(t.Switch,`infoDisabledColor`,ci(t.info.main,.62)),W(t.Switch,`successDisabledColor`,ci(t.success.main,.62)),W(t.Switch,`warningDisabledColor`,ci(t.warning.main,.62)),W(t.TableCell,`border`,ci(ii(t.divider,1),.88)),W(t.Tooltip,`bg`,ii(t.grey[700],.92))}if(t.mode===`dark`){W(t.Alert,`errorColor`,ci(t.error.light,.6)),W(t.Alert,`infoColor`,ci(t.info.light,.6)),W(t.Alert,`successColor`,ci(t.success.light,.6)),W(t.Alert,`warningColor`,ci(t.warning.light,.6)),W(t.Alert,`errorFilledBg`,n(`palette-error-dark`)),W(t.Alert,`infoFilledBg`,n(`palette-info-dark`)),W(t.Alert,`successFilledBg`,n(`palette-success-dark`)),W(t.Alert,`warningFilledBg`,n(`palette-warning-dark`)),W(t.Alert,`errorFilledColor`,Go(()=>t.getContrastText(t.error.dark))),W(t.Alert,`infoFilledColor`,Go(()=>t.getContrastText(t.info.dark))),W(t.Alert,`successFilledColor`,Go(()=>t.getContrastText(t.success.dark))),W(t.Alert,`warningFilledColor`,Go(()=>t.getContrastText(t.warning.dark))),W(t.Alert,`errorStandardBg`,oi(t.error.light,.9)),W(t.Alert,`infoStandardBg`,oi(t.info.light,.9)),W(t.Alert,`successStandardBg`,oi(t.success.light,.9)),W(t.Alert,`warningStandardBg`,oi(t.warning.light,.9)),W(t.Alert,`errorIconColor`,n(`palette-error-main`)),W(t.Alert,`infoIconColor`,n(`palette-info-main`)),W(t.Alert,`successIconColor`,n(`palette-success-main`)),W(t.Alert,`warningIconColor`,n(`palette-warning-main`)),W(t.AppBar,`defaultBg`,n(`palette-grey-900`)),W(t.AppBar,`darkBg`,n(`palette-background-paper`)),W(t.AppBar,`darkColor`,n(`palette-text-primary`)),W(t.Avatar,`defaultBg`,n(`palette-grey-600`)),W(t.Button,`inheritContainedBg`,n(`palette-grey-800`)),W(t.Button,`inheritContainedHoverBg`,n(`palette-grey-700`)),W(t.Chip,`defaultBorder`,n(`palette-grey-700`)),W(t.Chip,`defaultAvatarColor`,n(`palette-grey-300`)),W(t.Chip,`defaultIconColor`,n(`palette-grey-300`)),W(t.FilledInput,`bg`,`rgba(255, 255, 255, 0.09)`),W(t.FilledInput,`hoverBg`,`rgba(255, 255, 255, 0.13)`),W(t.FilledInput,`disabledBg`,`rgba(255, 255, 255, 0.12)`),W(t.LinearProgress,`primaryBg`,oi(t.primary.main,.5)),W(t.LinearProgress,`secondaryBg`,oi(t.secondary.main,.5)),W(t.LinearProgress,`errorBg`,oi(t.error.main,.5)),W(t.LinearProgress,`infoBg`,oi(t.info.main,.5)),W(t.LinearProgress,`successBg`,oi(t.success.main,.5)),W(t.LinearProgress,`warningBg`,oi(t.warning.main,.5)),W(t.Skeleton,`bg`,`rgba(${n(`palette-text-primaryChannel`)} / 0.13)`),W(t.Slider,`primaryTrack`,oi(t.primary.main,.5)),W(t.Slider,`secondaryTrack`,oi(t.secondary.main,.5)),W(t.Slider,`errorTrack`,oi(t.error.main,.5)),W(t.Slider,`infoTrack`,oi(t.info.main,.5)),W(t.Slider,`successTrack`,oi(t.success.main,.5)),W(t.Slider,`warningTrack`,oi(t.warning.main,.5));let e=ui(t.background.default,.98);W(t.SnackbarContent,`bg`,e),W(t.SnackbarContent,`color`,Go(()=>t.getContrastText(e))),W(t.SpeedDialAction,`fabHoverBg`,ui(t.background.paper,.15)),W(t.StepConnector,`border`,n(`palette-grey-600`)),W(t.StepContent,`border`,n(`palette-grey-600`)),W(t.Switch,`defaultColor`,n(`palette-grey-300`)),W(t.Switch,`defaultDisabledColor`,n(`palette-grey-600`)),W(t.Switch,`primaryDisabledColor`,oi(t.primary.main,.55)),W(t.Switch,`secondaryDisabledColor`,oi(t.secondary.main,.55)),W(t.Switch,`errorDisabledColor`,oi(t.error.main,.55)),W(t.Switch,`infoDisabledColor`,oi(t.info.main,.55)),W(t.Switch,`successDisabledColor`,oi(t.success.main,.55)),W(t.Switch,`warningDisabledColor`,oi(t.warning.main,.55)),W(t.TableCell,`border`,oi(ii(t.divider,1),.68)),W(t.Tooltip,`bg`,ii(t.grey[700],.92))}Uo(t.background,`default`),Uo(t.background,`paper`),Uo(t.common,`background`),Uo(t.common,`onBackground`),Uo(t,`divider`),Object.keys(t).forEach(e=>{let n=t[e];e!==`tonalOffset`&&n&&typeof n==`object`&&(n.main&&W(t[e],`mainChannel`,Qr(Ho(n.main))),n.light&&W(t[e],`lightChannel`,Qr(Ho(n.light))),n.dark&&W(t[e],`darkChannel`,Qr(Ho(n.dark))),n.contrastText&&W(t[e],`contrastTextChannel`,Qr(Ho(n.contrastText))),e===`text`&&(Uo(t[e],`primary`),Uo(t[e],`secondary`)),e===`action`&&(n.active&&Uo(t[e],`active`),n.selected&&Uo(t[e],`selected`)))})}),x=t.reduce((e,t)=>Yt(e,t),x);let S={prefix:a,disableCssColorScheme:i,shouldSkipGeneratingVar:o,getSelector:Bo(x)},{vars:C,generateThemeVars:w,generateStyleSheets:T}=Ca(x,S);return x.vars=C,Object.entries(x.colorSchemes[x.defaultColorScheme]).forEach(([e,t])=>{x[e]=t}),x.generateThemeVars=w,x.generateStyleSheets=T,x.generateSpacing=function(){return Mn(l.spacing,wn(this))},x.getColorSchemeSelector=wa(s),x.spacing=x.generateSpacing(),x.shouldSkipGeneratingVar=o,x.unstable_sxConfig={...or,...l?.unstable_sxConfig},x.unstable_sx=function(e){return ur({sx:e,theme:this})},x.toRuntimeSource=jo,x}function Yo(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...n!==!0&&n,palette:fo({...n===!0?{}:n.palette,mode:t})})}function Xo(e={},...t){let{palette:n,cssVariables:r=!1,colorSchemes:i=n?void 0:{light:!0},defaultColorScheme:a=n?.mode,...o}=e,s=a||`light`,c=i?.[s],l={...i,...n?{[s]:{...typeof c!=`boolean`&&c,palette:n}}:void 0};if(r===!1){if(!(`colorSchemes`in e))return Mo(e,...t);let r=n;`palette`in e||l[s]&&(l[s]===!0?s===`dark`&&(r={mode:`dark`}):r=l[s].palette);let i=Mo({...e,palette:r},...t);return i.defaultColorScheme=s,i.colorSchemes=l,i.palette.mode===`light`&&(i.colorSchemes.light={...l.light!==!0&&l.light,palette:i.palette},Yo(i,`dark`,l.dark)),i.palette.mode===`dark`&&(i.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:i.palette},Yo(i,`light`,l.light)),i}return!n&&!(`light`in l)&&s===`light`&&(l.light=!0),Jo({...o,colorSchemes:l,defaultColorScheme:s,...typeof r!=`boolean`&&r},...t)}var Zo=Xo();function Qo(){let e=gr(Zo);return e.$$material||e}function $o(e){return e!==`ownerState`&&e!==`theme`&&e!==`sx`&&e!==`as`}var es=e=>$o(e)&&e!==`classes`,G=Pr({themeId:d,defaultTheme:Zo,rootShouldForwardProp:es});function ts({theme:e,...t}){let n=`$$material`in e?e[d]:void 0;return(0,z.jsx)(na,{...t,themeId:n?d:void 0,theme:n||e})}var ns={attribute:`data-mui-color-scheme`,colorSchemeStorageKey:`mui-color-scheme`,defaultLightColorScheme:`light`,defaultDarkColorScheme:`dark`,modeStorageKey:`mui-mode`},{CssVarsProvider:rs,useColorScheme:is,getInitColorSchemeScript:as}=_a({themeId:d,theme:()=>Xo({cssVariables:!0}),colorSchemeStorageKey:ns.colorSchemeStorageKey,modeStorageKey:ns.modeStorageKey,defaultColorScheme:{light:ns.defaultLightColorScheme,dark:ns.defaultDarkColorScheme},resolveTheme:e=>{let t={...e,typography:vo(e.palette,e.typography)};return t.unstable_sx=function(e){return ur({sx:e,theme:this})},t}}),os=rs;function ss({theme:e,...t}){let n=R.useMemo(()=>{if(typeof e==`function`)return e;let t=`$$material`in e?e[d]:e;return`colorSchemes`in t?null:`vars`in t?e:{...e,vars:null}},[e]);return n?(0,z.jsx)(ts,{theme:n,...t}):(0,z.jsx)(os,{theme:e,...t})}var cs=11/23/100;function ls(e){let t={r:0,g:0,b:0};if(e.length===7)t.r=parseInt(e.substring(1,3),16),t.g=parseInt(e.substring(3,5),16),t.b=parseInt(e.substring(5,7),16);else if(e.length===4){let n=e[1],r=e[2],i=e[3];t.r=parseInt(n+n,16),t.g=parseInt(r+r,16),t.b=parseInt(i+i,16)}return t}function us(e){return`#${Math.round(e.r).toString(16).padStart(2,`0`)}${Math.round(e.g).toString(16).padStart(2,`0`)}${Math.round(e.b).toString(16).padStart(2,`0`)}`}function ds(e,t,n){let r=ls(e),i=ls(t);return r.r+=i.r*(.05+cs*(n-1)),r.g+=i.g*(.05+cs*(n-1)),r.b+=i.b*(.05+cs*(n-1)),us(r)}function fs(e,t){let n={};for(let r=1;r<=24;r++)n[`elevation${r}`]={backgroundColor:ds(e,t,r)};return n}function ps(e,t){let n,r;e===`dark`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#272727`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[200],"&:hover":{color:Xa[100]}}},MuiPaper:fs(`#121212`,`#fff`)},n={name:e,palette:{mode:`dark`,background:{paper:`#121212`,default:`#121212`},primary:{main:`#4dabf5`},secondary:{main:`#436a93`},expert:`#14bb00`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):e===`blue`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#3399CC`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}}},n={name:e,palette:{mode:`dark`,background:{paper:`#151d21`,default:`#151d21`},primary:{main:`#4dabf5`},secondary:{main:`#436a93`},expert:`#14bb00`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):e===`colored`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#2a3135`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[200],"&:hover":{color:Xa[100]}}},MuiPaper:fs(`#151d21`,`#fff`)},n={name:e,palette:{mode:`light`,primary:{main:`#3399CC`},secondary:{main:`#164477`},expert:`#96fc96`}}):e===`PT`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#0F99DE`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}}},n={name:e,palette:{mode:`light`,primary:{main:`#0F99DE`},secondary:{main:`#88A536`},expert:`#BD1B24`}}):e===`NW`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#272727`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}},MuiPaper:fs(`#121212`,`#fff`)},n={name:e,palette:{mode:`dark`,background:{paper:`#121212`,default:`#121212`},primary:{main:`#00af78`},secondary:{main:`#005a40`},expert:`#14bb00`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):e===`HA`?(r={MuiAppBar:{colorDefault:{backgroundColor:`#272727`}},MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:`#db0a33`,"&:hover":{color:`#FF0a33`}}},MuiPaper:fs(`#121212`,`#fff`)},n={name:e,palette:{mode:`dark`,background:{paper:`#121212`,default:`#121212`},primary:{main:`#970720`},secondary:{main:`#db0a33`},expert:`#db0a33`,nonAck:`#ffe96a`,text:{primary:`#ffffff`,secondary:`#ffffff`}}}):(r={MuiLink:{root:{textTransform:`uppercase`,transition:`color .3s ease`,color:Xa[400],"&:hover":{color:Xa[300]}}}},n={name:e,palette:{mode:`light`,primary:{main:`#3399CC`,dark:`#256c97`,light:`#76d0fd`},secondary:{main:`#164477`},expert:`#14bb00`}}),n.toolbar={height:48},n.saveToolbar={background:n.palette?.primary?.main,button:{borderRadius:3,height:32}},n.palette&&(n.palette.grey={main:qa[300],dark:qa[400]});let i=Xo(n),a=i.palette;return Xo(i,{...t||void 0,components:{...r,MuiButton:{variants:[{props:{variant:`contained`,color:`grey`},style:{backgroundColor:a.grey?.[300],color:a.getContrastText&&a.grey?.[300]?a.getContrastText(a.grey[300]):void 0}},{props:{variant:`outlined`,color:`grey`},style:{color:a.text?.primary,borderColor:a.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`,"&.Mui-disabled":{border:`1px solid ${a.action?.disabledBackground}`},"&:hover":{borderColor:a.mode===`light`?`rgba(0, 0, 0, 0.23)`:`rgba(255, 255, 255, 0.23)`,backgroundColor:ri(a.text?.primary||``,a.action?.hoverOpacity||.04)}}},{props:{variant:`text`,color:`grey`},style:{color:a.text?.primary,"&:hover":{backgroundColor:ri(a.text?.primary||``,a.action?.hoverOpacity||.04)}}}]},...t?.components||void 0}})}function ms(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}function hs(e){return e?.rows.map(e=>e.value).filter(e=>!!e)??[]}function gs(e){return e?.startsWith(`system.host.`)||(e=`system.host.${e}`),e}function _s(e){return new Promise(t=>{setTimeout(t,e)})}function vs(e){e=(e||``).toString();let t=e[0]===`*`,n=e[e.length-1]===`*`;return e=e.replace(/[-/\\^$+?.()|[\]{}]/g,`\\$&`).replace(/\*/g,`.*`),(t?``:`^`)+e+(n?``:`$`)}globalThis.process!==void 0&&(globalThis.location||={href:`http://localhost:8081/`,protocol:`http:`,host:`localhost:8081`,pathname:`/`,hostname:`localhost`,reload:()=>{}},globalThis.localStorage||={_keys:{},setItem:(e,t)=>{globalThis.localStorage._keys[e]=t},getItem:e=>e in globalThis.localStorage._keys?globalThis.localStorage._keys[e]:null,removeItem:e=>{e in globalThis.localStorage._keys&&delete globalThis.localStorage._keys[e]}},globalThis.sessionStorage||=globalThis.localStorage,globalThis.navigator||={language:`en`});var ys;(function(e){e[e.CONNECTING=0]=`CONNECTING`,e[e.CONNECTED=1]=`CONNECTED`,e[e.OBJECTS_LOADED=2]=`OBJECTS_LOADED`,e[e.READY=3]=`READY`})(ys||={});var bs;(function(e){e.PERMISSION_ERROR=`permissionError`,e.NOT_CONNECTED=`notConnectedError`,e.TIMEOUT=`timeout`,e.NOT_ADMIN=`Allowed only in admin`,e.NOT_SUPPORTED=`Not supported`})(bs||={}),bs.PERMISSION_ERROR,bs.NOT_CONNECTED;var xs=[`material`,`echarts`,`vis`],Ss=class e{props;connId;lastAccessToken=null;ignoreState=``;connected=!1;subscribed=!1;firstConnect=!0;waitForRestart=!1;loaded=!1;simStates={};objectViewCached;constructor(e){this.props=this.applyDefaultProps(e),this.connId=`${this.props.name?`${this.props.name}-`:``}${Math.round(Math.random()*1e6).toString().padStart(6,`0`)}`,this.waitForSocketLib().then(()=>this.startSocket()).catch(e=>{alert(`Socket connection could not be initialized: ${e}`)})}applyDefaultProps(e){return{...e,protocol:e.protocol||globalThis.location.protocol,host:e.host||globalThis.location.hostname,port:e.port||(globalThis.location.port===`3000`?8081:globalThis.location.port),ioTimeout:Math.max(e.ioTimeout||2e4,2e4),cmdTimeout:Math.max(e.cmdTimeout||5e3,5e3),admin5only:e.admin5only||!1,autoSubscribes:e.autoSubscribes??[],autoSubscribeLog:e.autoSubscribeLog??!1,doNotLoadACL:e.doNotLoadACL??!0,doNotLoadAllObjects:e.doNotLoadAllObjects??!0}}statesSubscribes={};filesSubscribes={};objectsSubscribes={};objects={};states={};acl=null;isSecure=!1;onReadyDone=!1;onConnectionHandlers=[];onLogHandlers=[];onCmdStdoutHandler;onCmdStderrHandler;onCmdExitHandler;onError(e){(this.props.onError??console.error)(e)}_socket;_waitForSocketPromise;_waitForFirstConnectionPromise=ms();_instanceSubscriptions={};_promises={};_authTimer=null;_refreshTimer=null;_systemConfig;get systemConfig(){return this._systemConfig}systemLang=`en`;static isWeb(){return globalThis.socketUrl!==void 0}waitForSocketLib(){return this._waitForSocketPromise||=new Promise(async(e,t)=>{if(this.props.connect){e();return}if(globalThis.io===void 0&&globalThis.iob===void 0)if(typeof globalThis.registerSocketOnLoad==`function`)globalThis.registerSocketOnLoad(()=>e());else{for(let t=1;t<=30;t++){if(globalThis.io||globalThis.iob)return e();await _s(100)}t(Error(`Socket library could not be loaded!`))}else e()}),this._waitForSocketPromise}async startSocket(){if(this._socket)return;let t=this.props.host,n=this.props.port,r=(this.props.protocol||globalThis.location.protocol).replace(`:`,``),i=globalThis.location.pathname;if(globalThis.location.hostname===`iobroker.net`||globalThis.location.hostname===`iobroker.pro`)i=``;else{if(globalThis.socketUrl){let e=new globalThis.URL(globalThis.socketUrl);t=e.hostname,n=e.port,r=e.protocol.replace(`:`,``)}let a=i.lastIndexOf(`/`);if(a!==-1&&(i=i.substring(0,a+1)),e.isWeb()){let e=i.split(`/`);e.length>2&&(e.pop(),e.pop(),xs.includes(e[e.length-1])&&e.pop(),i=e.join(`/`),i.endsWith(`/`)||(i+=`/`))}}let a=globalThis.socketPath||``,o=n?`${r}://${t}:${n}${a}`:`${r}://${t}${a}`,s=this.props.connect||(globalThis.io||globalThis.iob).connect;return this._socket=s(o,{path:i.endsWith(`/`)?`${i}socket.io`:`${i}/socket.io`,query:`ws=true`,name:this.props.name,timeout:this.props.ioTimeout,uuid:this.props.uuid,token:this.props.token,transports:globalThis.socketForceWebSockets?[`websocket`]:void 0}),this._socket.on(`connect`,t=>{globalThis.addEventListener?.(`storage`,this.onAccessTokenUpdated);let n=e.readTokens();if(n&&!n.owner){let e=Date.now();this.saveTokens({access_token:n.access_token,refresh_token:n.refresh_token,expires_in:Math.round((n.expires_in.getTime()-e)/1e3),refresh_token_expires_in:Math.round((n.refresh_token_expires_in.getTime()-e)/1e3),token_type:`Bearer`},n.stayLoggedIn)}this.onReadyDone=!1,t===!0?this._socket.emit(`authenticate`,(e,t)=>{this.onPreConnect(e,t)}):(this.connected=!0,setTimeout(()=>this.getVersion().then(e=>{let[t,n,r]=e.version.split(`.`);parseInt(t,10)*1e4+parseInt(n,10)*100+parseInt(r,10)<40102?(this._authTimer=null,this.onPreConnect(!1,!1)):this._socket.emit(`authenticate`,(e,t)=>this.onPreConnect(e,t))}).catch(e=>this.onError({message:e.toString(),operation:`getVersion`})),500))}),this._socket.on(`reconnect`,()=>{this.onReadyDone=!1,this.props.onProgress?.(ys.READY),this.connected=!0,this.waitForRestart?globalThis.location.reload():(this._subscribe(!0),this.onConnectionHandlers.forEach(e=>e(!0)))}),this._socket.on(`disconnect`,()=>{this.onReadyDone=!1,this.connected=!1,this.subscribed=!1,this.props.onProgress?.(ys.CONNECTING),this.onConnectionHandlers.forEach(e=>e(!1))}),this._socket.on(`reauthenticate`,()=>this.authenticate()),this._socket.on(`log`,e=>{this.props.onLog?.(e),this.onLogHandlers.forEach(t=>t(e))}),this._socket.on(`error`,e=>{let t;e==null?t=``:typeof e.toString==`function`?t=e.toString():(t=JSON.stringify(e),console.error(`Received strange error: ${t}`)),t.includes(`User not authorized`)?this.authenticate():t.includes(`websocket error`)?(console.error(`Socket Error => reload: ${e}`),globalThis.location.reload()):console.error(`Socket Error: ${e}`)}),this._socket.on(`connect_error`,e=>console.error(`Connect error: ${e}`)),this._socket.on(`permissionError`,e=>this.onError({message:`no permission`,operation:e.operation,type:e.type,id:e.id||``})),this._socket.on(`objectChange`,(e,t)=>{setTimeout(()=>this.objectChange(e,t),0)}),this._socket.on(`stateChange`,(e,t)=>{setTimeout(()=>this.stateChange(e,t),0)}),this._socket.on(`im`,(e,t,n)=>{setTimeout(()=>this.instanceMessage(e,t,n),0)}),this._socket.on(`fileChange`,(e,t,n)=>{setTimeout(()=>this.fileChange(e,t,n),0)}),this._socket.on(`cmdStdout`,(e,t)=>{this.onCmdStdoutHandler?.(e,t)}),this._socket.on(`cmdStderr`,(e,t)=>{this.onCmdStderrHandler?.(e,t)}),this._socket.on(`cmdExit`,(e,t)=>{this.onCmdExitHandler?.(e,t)}),Promise.resolve()}onPreConnect(e,t){this._authTimer&&=(clearTimeout(this._authTimer),null),this.connected=!0,this.isSecure=t,this.waitForRestart?globalThis.location.reload():(this.firstConnect?this.loadData().catch(e=>{console.error(`Cannot load data: ${e}`)}):this.props.onProgress?.(ys.READY),this._subscribe(!0),this.onConnectionHandlers.forEach(e=>e(!0)),this.checkAccessTokenExpire()),this._waitForFirstConnectionPromise.resolve()}static readTokens(){let e=globalThis.sessionStorage.getItem(`iob_tokens`),t=!e;if(e||=globalThis.localStorage.getItem(`iob_tokens`),!e)return null;let[n,r,i,a,o]=e.split(`;`),s=new Date(r);return s.getTime()<Date.now()?null:{refresh_token:n,refresh_token_expires_in:s,access_token:i,expires_in:new Date(a),owner:o,stayLoggedIn:t}}static saveTokensStatic(e,t,n){let r=`${e.refresh_token};${new Date(Date.now()+e.refresh_token_expires_in*1e3).toISOString()};${e.access_token};${new Date(Date.now()+e.expires_in*1e3).toISOString()}${n?`;${n}`:``}`;t?globalThis.localStorage.setItem(`iob_tokens`,r):globalThis.sessionStorage.setItem(`iob_tokens`,r)}saveTokens(t,n){e.saveTokensStatic(t,n,this.connId)}static deleteTokensStatic(){globalThis.localStorage.removeItem(`iob_tokens`),globalThis.sessionStorage.removeItem(`iob_tokens`)}deleteTokens(t,n){let r=e.readTokens();r&&(n?e.deleteTokensStatic():r.stayLoggedIn===t&&r.owner===this.connId&&(r.stayLoggedIn?globalThis.localStorage.removeItem(`iob_tokens`):globalThis.sessionStorage.removeItem(`iob_tokens`)))}onAccessTokenUpdated=t=>{if(t.key===`iob_tokens`){let t=e.readTokens();t&&(console.log(`Tab ${this.connId} received updated token: ${t.access_token}`),this.updateTokenExpiration(t.access_token))}};updateTokenExpiration(e){this.lastAccessToken!==e&&(this.lastAccessToken=e,this._socket.emit(`updateTokenExpiration`,e,(t,n)=>{t?(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${t}`),globalThis.location.reload()):n?console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${e}`):(console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`),globalThis.location.reload())})),this.checkAccessTokenExpire()}refreshTokens(e,t){if(!e){console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`),setTimeout(()=>globalThis.location.reload(),500);return}t||!e.owner||e.owner===this.connId?(console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`),this.acquireTokenLock()?(console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`),fetch(`./oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:`grant_type=refresh_token&refresh_token=${e.refresh_token}&client_id=ioBroker&stayloggedin=${e.stayLoggedIn}`}).then(e=>{if(e.ok)return e.json();throw Error(`Cannot refresh access token`)}).then(t=>{if(t.access_token)console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${t.access_token}`),this.saveTokens(t,e.stayLoggedIn),this.releaseTokenLock(),this.updateTokenExpiration(t.access_token);else throw Error(`Cannot get access token`)}).catch(t=>{console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${t}`),this.releaseTokenLock(),this.deleteTokens(e.stayLoggedIn),console.error(t),globalThis.location.reload()})):(console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`),this.checkAccessTokenExpire())):this.lastAccessToken!==e.access_token&&this.updateTokenExpiration(e.access_token)}acquireTokenLock(){let e=Date.now(),t=globalThis.localStorage.getItem(`iob_token_semaphore`);if(t)try{if(e<JSON.parse(t).expiry)return!1}catch{}let n={connId:this.connId,expiry:e+10*1e3};return globalThis.localStorage.setItem(`iob_token_semaphore`,JSON.stringify(n)),!0}releaseTokenLock(){let e=globalThis.localStorage.getItem(`iob_token_semaphore`);if(e)try{JSON.parse(e).connId===this.connId&&globalThis.localStorage.removeItem(`iob_token_semaphore`)}catch{globalThis.localStorage.removeItem(`iob_token_semaphore`)}}checkAccessTokenExpire(){if(this._refreshTimer&&=(clearTimeout(this._refreshTimer),null),this.isSecure){let t=e.readTokens();if(t){let e=t.expires_in.getTime();if(e<Date.now()+3e4){let n=e<Date.now()+5500;console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${t.access_token}`),t.refresh_token?t.owner===this.connId||n?(t.owner===this.connId?console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`):console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`),this.props.tokenTimeoutHandler?(console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`),this.props.tokenTimeoutHandler(e).then(r=>{r?(console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`),this.refreshTokens(t,n)):(console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`),setTimeout(()=>globalThis.location.reload(),Date.now()>e?500:e-Date.now()))})):(console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`),this.refreshTokens(t,n))):this.lastAccessToken===t.access_token?(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`),this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},3e3)):(console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`),this.refreshTokens(t)):(console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`),setTimeout(()=>globalThis.location.reload(),Date.now()>e?500:e-Date.now()))}else this._refreshTimer=setTimeout(()=>{this._refreshTimer=null,this.checkAccessTokenExpire()},e-Date.now()-3e4>12e4?12e4:e-Date.now()-3e4)}}}static isCloud(){return globalThis.location.hostname.includes(`amazonaws.com`)||globalThis.location.hostname.includes(`iobroker.in`)?!0:globalThis.socketUrl===void 0?!1:globalThis.socketUrl.includes(`iobroker.in`)||globalThis.socketUrl.includes(`amazonaws`)}isConnected(){return this.connected}waitForFirstConnection(){return this._waitForFirstConnectionPromise}async getUserPermissions(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getUserPermissions`,(n,r)=>{n?t(n):e(r||null)})}})}async loadData(){if(!this.loaded)for(let t=1;t<=10;t++){if(this.doLoadData().catch(e=>console.error(`Cannot load data: ${e}`)),this.loaded)return;await _s(e.isCloud()?5e3:1e3)}}async doLoadData(){if(!this.loaded){if(!this.props.doNotLoadACL)try{this.acl=await this.getUserPermissions()}catch(e){this.onError(`Cannot read user permissions: ${e}`);return}try{this.props.admin5only&&!e.isWeb()&&(!globalThis.vendorPrefix||globalThis.vendorPrefix===`@@vendorPrefix@@`)?this._systemConfig=await this.getCompactSystemConfig():this._systemConfig=await this.getSystemConfig()}catch(e){this.onError(`Cannot read system config: ${e}`);return}this._systemConfig&&(this.systemLang=this._systemConfig.common?.language,this.systemLang||(this.systemLang=globalThis.navigator.userLanguage||globalThis.navigator.language,/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(this.systemLang)?this.systemLang=this.systemLang.substring(0,2):/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(this.systemLang)||(this.systemLang=`en`),this._systemConfig.common.language=this.systemLang)),this.props.onLanguage?.(this.systemLang),this.loaded=!0,this.props.onProgress?.(ys.CONNECTED),this.firstConnect=!1,this.props.doNotLoadAllObjects?this.props.admin5only?this.objects={}:this.objects={"system.config":this._systemConfig}:this.objects=await this.getObjects(),this.props.onProgress?.(ys.READY),this.onReadyDone||(this.onReadyDone=!0,this.props.onReady?.(this.objects))}}authenticate(){globalThis.location.search.includes(`&href=`)?globalThis.location.href=`${globalThis.location.protocol}//${globalThis.location.host}${globalThis.location.pathname}${globalThis.location.search}`:globalThis.location.href=`${globalThis.location.protocol}//${globalThis.location.host}${globalThis.location.pathname}?login&href=${encodeURIComponent(globalThis.location.search+globalThis.location.hash)}`}async subscribeState(...t){let n,r,i;t.length===3?[n,r,i]=t:([n,i]=t,r=!1);let a;if(a=Array.isArray(n)?n:[n],typeof i!=`function`)throw Error(`The state change handler must be a function!`);let o=[];for(let e=0;e<a.length;e++){let t=a[e];this.statesSubscribes[t]?!this.statesSubscribes[t].cbs.includes(i)&&this.statesSubscribes[t].cbs.push(i):(this.statesSubscribes[t]={reg:new RegExp(vs(t)),cbs:[i]},n!==this.ignoreState&&o.push(t))}if(this.connected)if(o.length&&this._socket.emit(`subscribe`,o),r){let e;for(let t=0;t<a.length;t++){try{e=await this.getBinaryState(a[t])}catch(n){console.error(`Cannot getBinaryState "${a[t]}": ${JSON.stringify(n)}`),e=void 0}e!=null&&i(a[t],e)}}else if(a.find(e=>e.includes(`*`))){let e;for(let t=0;t<a.length;t++){try{e=await this.getForeignStates(a[t])}catch(e){console.error(`Cannot getForeignStates "${a[t]}": ${JSON.stringify(e)}`);return}if(e)for(let[t,n]of Object.entries(e)){let e=i(t,n);e instanceof Promise&&e.catch(e=>console.error(`Cannot call state change handler: ${e}`))}}}else try{let t=await(e.isWeb()?this.getStates(a):this.getForeignStates(a));if(t)for(let[e,n]of Object.entries(t)){let t=i(e,n);t instanceof Promise&&t.catch(e=>console.error(`Cannot call state change handler: ${e}`))}}catch(e){console.error(`Cannot getState "${a.join(`, `)}": ${e.message}`);return}}async subscribeStateAsync(e,t){return this.subscribeState(e,t)}unsubscribeState(e,t){let n;n=Array.isArray(e)?e:[e];let r=[];for(let e=0;e<n.length;e++){let i=n[e];if(this.statesSubscribes[i]){let e=this.statesSubscribes[i];if(t){let n=e.cbs.indexOf(t);n!==-1&&e.cbs.splice(n,1)}else e.cbs=[];e.cbs?.length||(delete this.statesSubscribes[i],i!==this.ignoreState&&r.push(i))}}this.connected&&r.length&&this._socket.emit(`unsubscribe`,n)}subscribeObject(e,t){let n;if(n=Array.isArray(e)?e:[e],typeof t!=`function`)throw Error(`The object change handler must be a function!`);let r=[];for(let e=0;e<n.length;e++){let i=n[e];this.objectsSubscribes[i]?!this.objectsSubscribes[i].cbs.includes(t)&&this.objectsSubscribes[i].cbs.push(t):(this.objectsSubscribes[i]={reg:new RegExp(vs(i)),cbs:[t]},r.push(i))}return this.connected&&r.length&&this._socket.emit(`subscribeObjects`,r),Promise.resolve()}unsubscribeObject(e,t){let n;n=Array.isArray(e)?e:[e];let r=[];for(let e=0;e<n.length;e++){let i=n[e];if(this.objectsSubscribes[i]){let e=this.objectsSubscribes[i];if(t){let n=e.cbs.indexOf(t);n!==-1&&e.cbs.splice(n,1)}else e.cbs=[];e.cbs?.length||(delete this.objectsSubscribes[i],r.push(i))}}return this.connected&&r.length&&this._socket.emit(`unsubscribeObjects`,r),Promise.resolve()}objectChange(e,t){let n;this.objects[e]&&(n={_id:e,type:this.objects[e].type});let r=!1;t?(t._rev&&this.objects[e]&&(this.objects[e]._rev=t._rev),(!this.objects[e]||JSON.stringify(this.objects[e])!==JSON.stringify(t))&&(this.objects[e]=t,r=!0)):this.objects[e]&&(delete this.objects[e],r=!0);for(let[r,i]of Object.entries(this.objectsSubscribes))(r===e||i.reg.test(e))&&i.cbs.forEach(r=>{try{let i=r(e,t,n);i instanceof Promise&&i.catch(e=>console.error(`Cannot call object change handler: ${e}`))}catch(e){console.error(`Error by callback of objectChange: ${e}`)}});if(r){let n=this.props.onObjectChange?.(e,t);n instanceof Promise&&n.catch(e=>console.error(`Cannot call object change handler: ${e}`))}}stateChange(e,t){for(let n of Object.values(this.statesSubscribes))if(n.reg.test(e))for(let r of n.cbs)try{let n=r(e,t??null);n instanceof Promise&&n.catch(e=>console.error(`Cannot call state change handler: ${e}`))}catch(e){console.error(`Error by callback of stateChanged: ${e}`)}}instanceMessage(e,t,n){this._instanceSubscriptions[t]?.forEach(r=>{if(r.messageType===e){let i=r.callback(n,t,e);i instanceof Promise&&i.catch(e=>console.error(`Cannot call instance message handler: ${e}`))}})}fileChange(e,t,n){for(let r of Object.values(this.filesSubscribes))if(r.regId.test(e)&&r.regFilePattern.test(t))for(let i of r.cbs)try{i(e,t,n)}catch(e){console.error(`Error by callback of fileChange: ${e}`)}}async subscribeFiles(e,t,n){if(typeof n!=`function`)throw Error(`The state change handler must be a function!`);let r;r=Array.isArray(t)?t:[t];let i=[];for(let t=0;t<r.length;t++){let a=r[t],o=`${e}$%$${a}`;this.filesSubscribes[o]?!this.filesSubscribes[o].cbs.includes(n)&&this.filesSubscribes[o].cbs.push(n):(this.filesSubscribes[o]={regId:new RegExp(vs(e)),regFilePattern:new RegExp(vs(a)),cbs:[n]},i.push(a))}return this.connected&&i.length&&this._socket.emit(`subscribeFiles`,e,i),Promise.resolve()}unsubscribeFiles(e,t,n){let r;r=Array.isArray(t)?t:[t];let i=[];for(let t=0;t<r.length;t++){let a=r[t],o=`${e}$%$${a}`;if(this.filesSubscribes[o]){let e=this.filesSubscribes[o];if(n){let t=e.cbs.indexOf(n);t!==-1&&e.cbs.splice(t,1)}else e.cbs=[];e.cbs?.length||(delete this.filesSubscribes[o],i.push(a))}}this.connected&&i.length&&this._socket.emit(`unsubscribeFiles`,e,i)}async request({cacheKey:t,forceUpdate:n,commandTimeout:r,onTimeout:i,requireAdmin:a,requireFeatures:o,executor:s}){if(a&&e.isWeb())return Promise.reject(Error(bs.NOT_ADMIN));if(t&&!n&&t in this._promises)return this._promises[t];if(!this.connected)return Promise.reject(Error(bs.NOT_CONNECTED));if(o?.length){for(let e of o)if(!await this.checkFeatureSupported(e))throw Error(bs.NOT_SUPPORTED)}let c=new Promise(async(e,n)=>{let a={elapsed:!1,clearTimeout:()=>{}},o;r!==!1&&(o=setTimeout(()=>{a.elapsed=!0,i?.(),t&&this._promises[t]instanceof Promise&&delete this._promises[t],n(Error(bs.TIMEOUT))},r??this.props.cmdTimeout),a.clearTimeout=()=>{clearTimeout(o)});try{await s(e,n,a)}catch(e){t&&this._promises[t]instanceof Promise&&delete this._promises[t],n(Error(e.toString()))}});return t&&(this._promises[t]=c),c}resetCache(e,t){t?Object.keys(this._promises).filter(t=>t.startsWith(e)).forEach(e=>{delete this._promises[e]}):delete this._promises[e]}getStates(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getStates`,e,(e,r)=>{this.states=r??{},e?n(e):t(this.states)})}})}getState(e){return this.request({commandTimeout:!1,executor:(t,n)=>{if(e&&e===this.ignoreState){t(this.simStates[e]||{val:null,ack:!0});return}this._socket.emit(`getState`,e,(e,r)=>{e?n(e):t(r)})}})}getBinaryState(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getBinaryState`,e,(e,r)=>{e?n(e):t(r)})}})}setBinaryState(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`setBinaryState`,e,t,e=>{e?r(e):n()})}})}setState(e,t,n){return typeof n==`boolean`&&(t={val:t,ack:n}),this.request({commandTimeout:!1,executor:(r,i)=>{if(e&&e===this.ignoreState){let i;if(i=typeof n==`boolean`||typeof t==`object`&&t.val!==void 0?t:{val:t,ack:!1,ts:Date.now(),lc:Date.now(),from:`system.adapter.vis.0`},this.simStates[e]=i,this.statesSubscribes[e])for(let t of this.statesSubscribes[e].cbs)try{let n=t(e,i);n instanceof Promise&&n.catch(e=>console.error(`Cannot call state change handler: ${e}`))}catch(e){console.error(`Error by callback of stateChanged: ${e}`)}r();return}this._socket.emit(`setState`,e,t,e=>{e?i(e):r()})}})}getObjects(t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{if(!t&&this.objects){r(this.objects);return}this._socket.emit(e.isWeb()?`getObjects`:`getAllObjects`,(e,t)=>{n||this.props.onProgress?.(ys.OBJECTS_LOADED),e?i(e):(this.objects=t??{},r(this.objects))})}})}getObjectsById(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getObjects`,e,(e,r)=>{e?n(e):t(r)})}})}_subscribe(e){if(e&&!this.subscribed){this.subscribed=!0,this.props.autoSubscribes?.length&&this._socket.emit(`subscribeObjects`,this.props.autoSubscribes);let e=Object.keys(this.objectsSubscribes);e.length&&this._socket.emit(`subscribeObjects`,e),Object.keys(this.objectsSubscribes).forEach(e=>this._socket.emit(`subscribeObjects`,e)),this.props.autoSubscribeLog&&this._socket.emit(`requireLog`,!0),Object.keys(this.statesSubscribes).forEach(e=>this._socket.emit(`subscribe`,e)),Object.keys(this.filesSubscribes).forEach(e=>{let[t,n]=e.split(`$%$`);this._socket.emit(`subscribeFiles`,t,n)})}else if(!e&&this.subscribed){this.subscribed=!1,this.props.autoSubscribes?.length&&this._socket.emit(`unsubscribeObjects`,this.props.autoSubscribes);let e=Object.keys(this.objectsSubscribes);e.length&&this._socket.emit(`unsubscribeObjects`,e),this.props.autoSubscribeLog&&this._socket.emit(`requireLog`,!1),Object.keys(this.statesSubscribes).forEach(e=>this._socket.emit(`unsubscribe`,e)),Object.keys(this.filesSubscribes).forEach(e=>{let[t,n]=e.split(`$%$`);this._socket.emit(`unsubscribeFiles`,t,n)})}}requireLog(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`requireLog`,e,e=>{e?n(e):t()})}})}delObject(e,t=!1){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`delObject`,e,{maintenance:t},e=>{e?r(e):n()})}})}delObjects(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`delObjects`,e,{maintenance:t},e=>{e?r(e):n()})}})}setObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`setObject`,e,t,e=>{e?r(e):n()})}})):Promise.reject(Error(`Null object is not allowed`))}getObject(e){return this.request({commandTimeout:!1,executor:(t,n)=>{if(e&&e===this.ignoreState){t({_id:this.ignoreState,type:`state`,common:{name:`ignored state`,type:`mixed`}});return}this._socket.emit(`getObject`,e,(e,r)=>{e?n(e):t(r)})}})}sendTo(e,t,n){return this.request({commandTimeout:!1,executor:r=>{this._socket.emit(`sendTo`,e,t,n,e=>{r(e)})}})}extendObject(e,t){return t?(t=JSON.parse(JSON.stringify(t)),delete t.from,delete t.user,delete t.ts,this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`extendObject`,e,t,e=>{e?r(e):n()})}})):Promise.reject(Error(`Null object is not allowed`))}registerLogHandler(e){this.onLogHandlers.includes(e)||this.onLogHandlers.push(e)}unregisterLogHandler(e){let t=this.onLogHandlers.indexOf(e);t!==-1&&this.onLogHandlers.splice(t,1)}registerConnectionHandler(e){this.onConnectionHandlers.includes(e)||this.onConnectionHandlers.push(e)}unregisterConnectionHandler(e){let t=this.onConnectionHandlers.indexOf(e);t!==-1&&this.onConnectionHandlers.splice(t,1)}registerCmdStdoutHandler(e){this.onCmdStdoutHandler=e}unregisterCmdStdoutHandler(){this.onCmdStdoutHandler=void 0}registerCmdStderrHandler(e){this.onCmdStderrHandler=e}unregisterCmdStderrHandler(){this.onCmdStderrHandler=void 0}registerCmdExitHandler(e){this.onCmdExitHandler=e}unregisterCmdExitHandler(){this.onCmdExitHandler=void 0}getEnums(e,t){return this.request({cacheKey:`enums_${e||`all`}`,forceUpdate:t,commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getObjectView`,`system`,`enum`,{startkey:`enum.${e||``}`,endkey:e?`enum.${e}.\u9999`:`enum.香`},(r,i)=>{if(r)n(r);else{let n={};if(i)for(let t=0;t<i.rows.length;t++)e&&i.rows[t].id===`enum.${e}`||(n[i.rows[t].id]=i.rows[t].value);t(n)}})}})}getObjectView(e,t,n){return this.getObjectViewCustom(`system`,n,e,t)}async getObjectViewSystem(e,t,n){let r=`${e}_${t||``}_${n||``}`,i=await this.getObjectViewCustom(`system`,e,t,n);return this.objectViewCached?.[r]&&(this.objectViewCached[r]=i),i}async getObjectViewSystemCached(e,t,n){let r=`${e}_${t||``}_${n||``}`;if(this.objectViewCached?.[r])return Promise.resolve(this.objectViewCached[r]);let i=await this.getObjectViewCustom(`system`,e,t,n);return this.objectViewCached||={},this.objectViewCached[r]=i,i}getObjectViewCustom(e,t,n,r){return this.request({commandTimeout:!1,executor:(i,a)=>{n||=``,r||=`香`,this._socket.emit(`getObjectView`,e,t,{startkey:n,endkey:r},(e,t)=>{if(e)a(e);else{let e={};if(t&&t.rows)for(let n=0;n<t.rows.length;n++)e[t.rows[n].id]=t.rows[n].value;i(e)}})}})}readMetaItems(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getObjectView`,`system`,`meta`,{startkey:``,endkey:`香`},(n,r)=>{n?t(n):e(r.rows?.map(e=>e.value).filter(e=>!!e))})}})}readDir(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`readDir`,e,t,(e,t)=>{e?r(e):n(t)})}})}readFile(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{this._socket.emit(n?`readFile64`:`readFile`,e,t,(e,t,n)=>{e?i(e):r({file:t,mimeType:n})})}})}writeFile64(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{if(typeof n==`string`)this._socket.emit(`writeFile`,e,t,n,e=>{e?i(e):r()});else{let a=btoa(new Uint8Array(n).reduce((e,t)=>e+String.fromCharCode(t),``));this._socket.emit(`writeFile64`,e,t,a,e=>{e?i(e):r()})}}})}deleteFile(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`deleteFile`,e,t,e=>{e?r(e):n()})}})}deleteFolder(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`deleteFolder`,e,t,e=>{e?r(e):n()})}})}rename(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{this._socket.emit(`rename`,e,t,n,e=>{e?i(e):r()})}})}renameFile(e,t,n){return this.request({commandTimeout:!1,executor:(r,i)=>{this._socket.emit(`renameFile`,e,t,n,e=>{e?i(e):r()})}})}cmdExec(e,t,n,r,i){return this.request({commandTimeout:r,executor:(r,a,o)=>{e=gs(e);let s=e=>{o.elapsed||(o.clearTimeout(),e?a(e):r())};i?.length?this._socket.emit(`cmdExec`,e,n,t,i,s):this._socket.emit(`cmdExec`,e,n,t,s)}})}getSystemConfig(e){return this.request({cacheKey:`systemConfig`,forceUpdate:e,commandTimeout:!1,executor:async e=>{let t=await this.getObject(`system.config`);t??={},t.common??={},t.native??={},e(t)}})}getCompactSystemConfig(e){return this.request({cacheKey:`systemConfigCommon`,forceUpdate:e,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getCompactSystemConfig`,(n,r)=>{n?t(n):(r??={},r.common??={},r.native??={},e(r))})}})}getForeignStates(e){return this.request({commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`getForeignStates`,e||`*`,(e,r)=>{e?n(e):t(r??{})})}})}getForeignObjects(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`getForeignObjects`,e||`*`,t,(e,t)=>{e?r(e):n(t)})}})}setSystemConfig(e){return this.setObject(`system.config`,e)}getRawSocket(){return this._socket}getHistory(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`getHistory`,e,t,(e,t)=>{e?r(e):n(t)})}})}getHistoryEx(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`getHistory`,e,t,(e,t,i,a)=>{e?r(e):n({values:t,sessionId:a,step:i})})}})}getIpAddresses(e,t){return e=gs(e),this.request({cacheKey:`IPs_${e}`,forceUpdate:t,commandTimeout:!1,executor:async t=>{t((await this.getObject(e))?.common.address??[])}})}getVersion(e){return this.request({cacheKey:`version`,forceUpdate:e,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getVersion`,(n,r,i)=>{n&&!r&&typeof n==`string`&&n.match(/\d+\.\d+\.\d+/)?e({version:n,serverName:`socketio`}):n?t(n):e({version:r,serverName:i})})}})}getWebServerName(){return this.request({cacheKey:`webName`,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getAdapterName`,(n,r)=>{n?t(n):e(r)})}})}fileExists(e,t){return this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`fileExists`,e,t,(e,t)=>{e?r(e):n(!!t)})}})}getCurrentUser(){return this.request({commandTimeout:!1,executor:e=>{this._socket.emit(`authEnabled`,(t,n)=>{e(n)})}})}getUuid(){return this.request({cacheKey:`uuid`,commandTimeout:!1,executor:async e=>{e((await this.getObject(`system.meta.uuid`))?.native?.uuid)}})}checkFeatureSupported(e,t){return this.request({cacheKey:`supportedFeatures_${e}`,forceUpdate:t,commandTimeout:!1,executor:(t,n)=>{this._socket.emit(`checkFeatureSupported`,e,(e,r)=>{e?n(e):t(r)})}})}getAdapterInstances(e,t){return typeof e==`boolean`&&(t=e,e=``),e||=``,this.request({cacheKey:`instances_${e}`,forceUpdate:t,commandTimeout:!1,executor:async t=>{let n=e?`system.adapter.${e}.`:`system.adapter.`,r=`${n}\u9999`,i=await this.getObjectViewSystem(`instance`,n,r),a=Object.values(i);t(e?a.filter(t=>t.common.name===e):a)}})}getAdapters(e,t){return typeof e==`boolean`&&(t=e,e=``),e||=``,this.request({cacheKey:`adapter_${e}`,forceUpdate:t,commandTimeout:!1,executor:async t=>{let n=await this.getObjectViewSystem(`adapter`,`system.adapter.${e||``}`,`system.adapter.${e||`香`}`),r=Object.values(n);t(e?r.filter(t=>t.common.name===e):r)}})}getGroups(e){return this.request({cacheKey:`groups`,forceUpdate:e,commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`getObjectView`,`system`,`group`,{startkey:`system.group.`,endkey:`system.group.香`},(n,r)=>{n?t(n):e(hs(r))})}})}logout(){return this.request({commandTimeout:!1,executor:(e,t)=>{this._socket.emit(`logout`,n=>{n?t(n):e(null)})}})}subscribeOnInstance(e,t,n,r){return this.request({commandTimeout:!1,executor:(i,a)=>{this._socket.emit(`clientSubscribe`,e,t,n,(n,o)=>{n?a(n):o&&(o.error?a(o.error):(e.startsWith(`system.adapter.`)||(e=`system.adapter.${e}`),this._instanceSubscriptions[e]=this._instanceSubscriptions[e]||[],this._instanceSubscriptions[e].find(e=>e.messageType===t&&e.callback===r)||this._instanceSubscriptions[e].push({messageType:t,callback:r}),i(o)))})}})}unsubscribeFromInstance(e,t,n){e.startsWith(`system.adapter.`)||(e=`system.adapter.${e}`);let r,i=[];do{r=!1;let a=this._instanceSubscriptions[e]?.findIndex(e=>(!t||e.messageType===t)&&(!n||e.callback===n));if(a!=null&&a!==-1){r=!0;let n=this._instanceSubscriptions[e][a].messageType;this._instanceSubscriptions[e].splice(a,1),this._instanceSubscriptions[e].length||delete this._instanceSubscriptions[e],this._instanceSubscriptions[e]&&this._instanceSubscriptions[e].find(e=>e.messageType===n)||i.push(this.request({commandTimeout:!1,executor:(n,r)=>{this._socket.emit(`clientUnsubscribe`,e,t,(e,t)=>e?r(e):n(t))}}))}}while(r&&(!n||!t));return i.length?Promise.all(i).then(e=>!!e.find(e=>e)):Promise.resolve(!1)}log(e,t){return e?this.request({commandTimeout:!1,executor:n=>(this._socket.emit(`log`,e,t),n(null))}):Promise.resolve(null)}setStateToIgnore(e){this.ignoreState=e}destroy(){if(this._socket){let e=this._socket;try{typeof e.destroy==`function`?e.destroy():typeof e.close==`function`&&e.close(!0)}catch{}}globalThis.removeEventListener?.(`storage`,this.onAccessTokenUpdated),this._authTimer&&=(clearTimeout(this._authTimer),null),this._refreshTimer&&=(clearTimeout(this._refreshTimer),null),this.onConnectionHandlers.length=0,this.onLogHandlers.length=0;for(let e of Object.keys(this.statesSubscribes))delete this.statesSubscribes[e];for(let e of Object.keys(this.objectsSubscribes))delete this.objectsSubscribes[e];for(let e of Object.keys(this.filesSubscribes))delete this.filesSubscribes[e];this._instanceSubscriptions={},this.connected=!1,this.onReadyDone=!1}},Cs=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,ws=globalThis,Ts=`10.67.0`;function Es(){return Ds(ws),ws}function Ds(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||`10.67.0`,t[Ts]=t[`10.67.0`]||{}}function Os(e,t,n=ws){let r=n.__SENTRY__=n.__SENTRY__||{},i=r[Ts]=r[`10.67.0`]||{};return i[e]||(i[e]=t())}var ks=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],As=`Sentry Logger `,js={};function Ms(e){if(!(`console`in ws))return e();let t=ws.console,n={},r=Object.keys(js);r.forEach(e=>{let r=js[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Ns(){Bs().enabled=!0}function Ps(){Bs().enabled=!1}function Fs(){return Bs().enabled}function Is(...e){zs(`log`,...e)}function Ls(...e){zs(`warn`,...e)}function Rs(...e){zs(`error`,...e)}function zs(e,...t){Cs&&Fs()&&Ms(()=>{ws.console[e](`${As}[${e}]:`,...t)})}function Bs(){return Cs?Os(`loggerSettings`,()=>({enabled:!1})):{enabled:!1}}var Vs={enable:Ns,disable:Ps,isEnabled:Fs,log:Is,warn:Ls,error:Rs},Hs=50,Us=/\(error: (.*)\)/,Ws=/captureMessage|captureException/;function Gs(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0,r=0)=>{let i=[],a=e.split(`
38
38
  `);for(let e=n;e<a.length;e++){let n=a[e];n.length>1024&&(n=n.slice(0,1024));let o=Us.test(n)?n.replace(Us,`$1`):n;if(!o.includes(`Error: `)){for(let e of t){let t=e(o);if(t){i.push(t);break}}if(i.length>=Hs+r)break}}return qs(i.slice(r))}}function Ks(e){return Array.isArray(e)?Gs(...e):e}function qs(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Js(t).function||``)&&t.pop(),t.reverse(),Ws.test(Js(t).function||``)&&(t.pop(),Ws.test(Js(t).function||``)&&t.pop()),t.slice(0,Hs).map(e=>({...e,filename:e.filename||Js(t).filename,function:e.function||`?`}))}function Js(e){return e[e.length-1]||{}}var Ys=`<anonymous>`;function Xs(e){try{return!e||typeof e!=`function`?Ys:e.name||Ys}catch{return Ys}}function Zs(e){let t=e.exception;if(t){let e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}var Qs={},$s={};function ec(e,t){return Qs[e]=Qs[e]||[],Qs[e].push(t),()=>{let n=Qs[e];if(n){let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}function tc(e,t){if(!$s[e]){$s[e]=!0;try{t()}catch(t){Cs&&Vs.error(`Error while instrumenting ${e}`,t)}}}function nc(e,t){let n=e&&Qs[e];if(n)for(let r of n)try{r(t)}catch(t){Cs&&Vs.error(`Error while triggering instrumentation handler.
39
39
  Type: ${e}
40
40
  Name: ${Xs(r)}
41
- Error:`,t)}}var rc=null;function ic(e){let t=`error`;ec(t,e),tc(t,ac)}function ac(){rc=ws.onerror,ws.onerror=function(e,t,n,r,i){return nc(`error`,{column:r,error:i,line:n,msg:e,url:t}),rc?rc.apply(this,arguments):!1},ws.onerror.__SENTRY_INSTRUMENTED__=!0}var oc=null;function sc(e){let t=`unhandledrejection`;ec(t,e),tc(t,cc)}function cc(){oc=ws.onunhandledrejection,ws.onunhandledrejection=function(e){return nc(`unhandledrejection`,e),!oc||oc.apply(this,arguments)},ws.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var lc=Object.prototype.toString;function uc(e){switch(lc.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Sc(e,Error)}}function dc(e,t){return lc.call(e)===`[object ${t}]`}function fc(e){return dc(e,`ErrorEvent`)}function pc(e){return dc(e,`DOMError`)}function mc(e){return dc(e,`DOMException`)}function hc(e){return dc(e,`String`)}function gc(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function K(e){return e===null||gc(e)||typeof e!=`object`&&typeof e!=`function`}function _c(e){return dc(e,`Object`)}function vc(e){return typeof e==`object`&&!!e}function yc(e){return typeof Event<`u`&&Sc(e,Event)}function bc(e){return dc(e,`RegExp`)}function xc(e){return!!(e?.then&&typeof e.then==`function`)}function Sc(e,t){try{return e instanceof t}catch{return!1}}function Cc(e){return typeof Request<`u`&&Sc(e,Request)}function wc(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Ec(i,r);try{e[t]=i}catch{Cs&&Vs.log(`Failed to replace method "${t}" in object`,e)}}function Tc(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Cs&&Vs.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Ec(e,t){try{e.prototype=t.prototype=t.prototype||{},Tc(e,`__sentry_original__`,t)}catch{}}function Dc(e){return e.__sentry_original__}function Oc(e){if(uc(e))return{message:e.message,name:e.name,stack:e.stack,...kc(e)};if(yc(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...kc(e)}}return e}function kc(e){return vc(e)?Object.fromEntries(Object.entries(e)):{}}function Ac(e){let t=Object.keys(Oc(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}var jc;function Mc(e){if(jc!==void 0)return jc?jc(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=ws;return t in n&&typeof n[t]==`function`?(jc=n[t],jc(e)):(jc=null,e())}function Nc(){return Mc(()=>Math.random())}function Pc(){return Mc(()=>Date.now())}var Fc=Symbol.for(`sentry.skipNormalization`),Ic=Symbol.for(`sentry.overrideNormalizationDepth`);function Lc(e){return!!e[Fc]}function Rc(e){let t=e[Ic];return typeof t==`number`?t:void 0}var zc;function Bc(e){zc=e}function Vc(e,t=100,n=1/0){try{return Uc(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Hc(e,t=3,n=100*1024){let r=Vc(e,t);return qc(r)>n?Hc(e,t-1,n):r}function Uc(e,t,n=1/0,r=1/0,i=Jc()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Wc(e,t);if(!s.startsWith(`[object `))return s;if(Lc(t))return t;let c=Rc(t),l=c===void 0?n:c;if(l===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let u=t;if(u&&typeof u.toJSON==`function`)try{return Uc(``,u.toJSON(),l-1,r,i)}catch{}let d=Array.isArray(t)?[]:{},f=0,p=Oc(t);for(let e in p){if(!Object.prototype.hasOwnProperty.call(p,e))continue;if(f>=r){d[e]=`[MaxProperties ~]`;break}let t=p[e];d[e]=Uc(e,t,l-1,r,i),f++}return o(t),d}function Wc(e,t){try{if(zc){let e=zc(t);if(e)return e}return typeof global<`u`&&t===global?`[Global]`:typeof t==`number`&&!Number.isFinite(t)?`[${t}]`:typeof t==`function`?`[Function: ${Xs(t)}]`:typeof t==`symbol`?`[${String(t)}]`:typeof t==`bigint`?`[BigInt: ${String(t)}]`:`[object ${Gc(t)}]`}catch(e){return`**non-serializable** (${e})`}}function Gc(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Kc(e){return~-encodeURI(e).split(/%..|./).length}function qc(e){return Kc(JSON.stringify(e))}function Jc(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function Yc(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Xc(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];K(r)?n.push(String(r)):r instanceof Error?n.push(r.message?`${r.name}: ${r.message}`:r.name):n.push(Wc(void 0,r))}return n.join(t)}function Zc(e,t,n=!1){return hc(e)?bc(t)?t.test(e):hc(t)?n?e===t:e.includes(t):typeof t==`function`&&t(e):!1}function Qc(e,t=[],n=!1){for(let r of t)if(Zc(e,r,n))return!0;return!1}function $c(){let e=ws;return e.crypto||e.msCrypto}var el;function tl(){return Nc()*16}function nl(e=$c()){try{if(e?.randomUUID)return Mc(()=>e.randomUUID()).replace(/-/g,``)}catch{}return el||=`10000000100040008000100000000000`,el.replace(/[018]/g,e=>(e^(tl()&15)>>e/4).toString(16))}function rl(e){return e.exception?.values?.[0]}function il(e){let{message:t,event_id:n}=e;if(t)return t;let r=rl(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function al(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function ol(e,t){let n=rl(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}function sl(e){if(cl(e))return!0;try{Tc(e,`__sentry_captured__`,!0)}catch{}return!1}function cl(e){try{return e.__sentry_captured__}catch{}}var ll=1e3;function ul(){return Pc()/ll}function dl(){let{performance:e}=ws;if(!e?.now||!e.timeOrigin)return ul;let t=e.timeOrigin;return()=>(t+Mc(()=>e.now()))/ll}var fl;function pl(){return(fl??=dl())()}function ml(e){let t=pl(),n={sid:nl(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>_l(n)};return e&&hl(n,e),n}function hl(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||pl(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:nl()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function gl(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),hl(e,n)}function _l(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function vl(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=vl(r[e],t[e],n-1));return r}function yl(){return nl()}function bl(){return nl().substring(16)}function xl(e){try{let t=ws.WeakRef;if(typeof t==`function`)return new t(e)}catch{}return e}function Sl(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}var Cl=`_sentrySpan`;function wl(e,t){t?Tc(e,Cl,xl(t)):delete e[Cl]}function Tl(e){return Sl(e[Cl])}var El=100,Dl=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:yl(),sampleRand:Nc()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,wl(t,Tl(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&hl(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():_c(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,wl(this,void 0),this._attachments=[],this.setPropagationContext({traceId:yl(),sampleRand:Nc()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:El;if(n<=0)return this;let r={timestamp:ul(),...e,message:e.message?Yc(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Tl(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=vl(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||nl();if(!this._client)return Cs&&Vs.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||nl();if(!this._client)return Cs&&Vs.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||nl();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Cs&&Vs.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function Ol(){return Os(`defaultCurrentScope`,()=>new Dl)}function kl(){return Os(`defaultIsolationScope`,()=>new Dl)}var Al=e=>e instanceof Promise&&!e[jl],jl=Symbol(`chained PromiseLike`),Ml=(e,t,n)=>{let r=e.then(e=>(t(e),e),e=>{throw n(e),e});return Al(r)&&Al(e)?r:Nl(e,r)},Nl=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i==`function`?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[jl]:!0}),t},Pl=class{constructor(e,t){let n;n=e||new Dl;let r;r=t||new Dl,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return xc(n)?Ml(n,()=>this._popScope(),()=>this._popScope()):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Fl(){let e=Ds(Es());return e.stack=e.stack||new Pl(Ol(),kl())}function Il(e){return Fl().withScope(e)}function Ll(e,t){let n=Fl();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Rl(e){return Fl().withScope(()=>e(Fl().getIsolationScope()))}function zl(){return{withIsolationScope:Rl,withScope:Il,withSetScope:Ll,withSetIsolationScope:(e,t)=>Rl(t),getCurrentScope:()=>Fl().getScope(),getIsolationScope:()=>Fl().getIsolationScope()}}function Bl(e){let t=Ds(e);return t.acs?t.acs:zl()}function Vl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).includes(`value`)}function Hl(e,t){let{value:n,unit:r}=Vl(e)?e:{value:e,unit:void 0},i=Wl(n),a=r&&typeof r==`string`?{unit:r}:{};if(i)return{...i,...a};if(!t||t===`skip-undefined`&&n===void 0)return;let o=``;try{o=JSON.stringify(n)??``}catch{}return{value:o,type:`string`,...a}}function Ul(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let e=Hl(i,t);e&&(n[r]=e)}return n}function Wl(e){if(Array.isArray(e))return{value:e,type:`array`};let t=typeof e==`string`?`string`:typeof e==`boolean`?`boolean`:typeof e==`number`&&!Number.isNaN(e)?Number.isInteger(e)?`integer`:`double`:null;if(t)return{value:e,type:t}}var Gl;function Kl(){return Gl?.()}function ql(){return Bl(Es()).getCurrentScope()}function Jl(){return Bl(Es()).getIsolationScope()}function Yl(){return Os(`globalScope`,()=>new Dl)}function Xl(...e){let t=Bl(Es());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Zl(){return ql().getClient()}function Ql(e){let t=Kl();if(t)return{trace_id:t.traceId,span_id:t.spanId};let{traceId:n,parentSpanId:r,propagationSpanId:i}=e.getPropagationContext(),a={trace_id:n,span_id:i||bl()};return r&&(a.parent_span_id=r),a}var $l=`sentry.op`,eu=`sentry.origin`,tu=`sentry.profile_id`,nu=`sentry.exclusive_time`,ru=`gen_ai.conversation.id`,iu=`_sentryScope`,au=`_sentryIsolationScope`;function ou(e){let t=e;return{scope:t[iu],isolationScope:Sl(t[au])}}function su(e){let t=cu(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.startsWith(`sentry-`)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function cu(e){if(!(!e||!hc(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=lu(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):lu(e)}function lu(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}var uu=/^o(\d+)\./,du=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function fu(e){return e===`http`||e===`https`}function pu(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function mu(e){let t=du.exec(e);if(!t){Ms(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return hu({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function hu(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function gu(e){if(!Cs)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(Vs.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?fu(r)?t&&isNaN(parseInt(t,10))?(Vs.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(Vs.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(Vs.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function _u(e){return e.match(uu)?.[1]}function vu(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=_u(n)),r}function yu(e){let t=typeof e==`string`?mu(e):hu(e);if(!(!t||!gu(t)))return t}function bu(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}var xu=!1;function Su(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Eu(e).parent_span_id,a=ou(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||bl():t,trace_id:n}}function Cu(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function wu(e){return typeof e==`number`?Tu(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Tu(e.getTime()):pl()}function Tu(e){return e>9999999999?e/1e3:e}function Eu(e){if(Au(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(ku(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:Du(e),start_timestamp:wu(i),timestamp:wu(o)||void 0,status:Mu(s),op:r[$l],origin:r[eu],links:Cu(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Du(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function Ou(e){return{...e,attributes:Ul(e.attributes),links:e.links?.map(e=>({...e,attributes:Ul(e.attributes)}))}}function ku(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Au(e){return typeof e.getSpanJSON==`function`}function ju(e){let{traceFlags:t}=e.spanContext();return t===1}function Mu(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}var Nu=`_sentryRootSpan`,Pu=Fu;function Fu(e){return e[Nu]||e}function Iu(){xu||=(Ms(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}function Lu(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||Zl()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Ru(e){Vs.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function zu(e,t){if(!t?.length)return!1;for(let n of t){if(Hu(n)){if(e.description&&Zc(e.description,n))return Cs&&Ru(e),!0;continue}let t=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!t)continue;let r=!n.name||e.description&&Zc(e.description,n.name),i=!n.op||e.op&&Zc(e.op,n.op),a=!n.attributes||Object.entries(n.attributes).every(([t,n])=>Bu(e.attributes?.[t],n));if(r&&i&&a)return Cs&&Ru(e),!0}return!1}function Bu(e,t){return typeof e==`string`&&(typeof t==`string`||t instanceof RegExp)?Zc(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function Vu(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function Hu(e){return typeof e==`string`||e instanceof RegExp}var Uu=Symbol.for(`sentry.nonRecordingSpan`);function Wu(e){return!!e&&e[Uu]===!0}var Gu=`production`,Ku=`_frozenDsc`;function qu(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e,org_id:vu(t)};return t.emit(`createDsc`,i),i}function Ju(e,t){let n=t.getPropagationContext();return n.dsc||qu(n.traceId,e)}function Yu(e){let t=Zl();if(!t)return{};let n=Pu(e),r=Eu(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n[Ku];if(c)return s(c);if(Wu(n)&&!Lu(t.getOptions())){let e=ou(n).scope;if(e)return s({...Ju(t,e)})}let l=a?.get(`sentry.dsc`),u=l&&su(l);if(u)return s(u);let d=qu(e.spanContext().traceId,t),f=i[`sentry.source`]??i[`sentry.span.source`],p=r.description;return f!==`url`&&p&&(d.transaction=p),Lu()&&(d.sampled=String(ju(n)),d.sample_rand=a?.get(`sentry.sample_rand`)??ou(n).scope?.getPropagationContext().sampleRand.toString()),s(d),t.emit(`createDsc`,d,n),d}function Xu(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}function Zu(e,t=[]){return[e,t]}function Qu(e,t){let[n,r]=e;return[n,[...r,t]]}function $u(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function ed(e,t){return $u(e,(e,n)=>t.includes(n))}function td(e){let t=Ds(ws);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function nd(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[td(r),e]:r.push(typeof e==`string`?td(e):e)}for(let e of n){let[t,n]=e;if(i(`
41
+ Error:`,t)}}var rc=null;function ic(e){let t=`error`;ec(t,e),tc(t,ac)}function ac(){rc=ws.onerror,ws.onerror=function(e,t,n,r,i){return nc(`error`,{column:r,error:i,line:n,msg:e,url:t}),rc?rc.apply(this,arguments):!1},ws.onerror.__SENTRY_INSTRUMENTED__=!0}var oc=null;function sc(e){let t=`unhandledrejection`;ec(t,e),tc(t,cc)}function cc(){oc=ws.onunhandledrejection,ws.onunhandledrejection=function(e){return nc(`unhandledrejection`,e),!oc||oc.apply(this,arguments)},ws.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var lc=Object.prototype.toString;function uc(e){switch(lc.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:case`[object WebAssembly.Exception]`:return!0;default:return Sc(e,Error)}}function dc(e,t){return lc.call(e)===`[object ${t}]`}function fc(e){return dc(e,`ErrorEvent`)}function pc(e){return dc(e,`DOMError`)}function mc(e){return dc(e,`DOMException`)}function hc(e){return dc(e,`String`)}function gc(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function K(e){return e===null||gc(e)||typeof e!=`object`&&typeof e!=`function`}function _c(e){return dc(e,`Object`)}function vc(e){return typeof e==`object`&&!!e}function yc(e){return typeof Event<`u`&&Sc(e,Event)}function bc(e){return dc(e,`RegExp`)}function xc(e){return!!(e?.then&&typeof e.then==`function`)}function Sc(e,t){try{return e instanceof t}catch{return!1}}function Cc(e){return typeof Request<`u`&&Sc(e,Request)}function wc(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)return;let i=n(r);typeof i==`function`&&Ec(i,r);try{e[t]=i}catch{Cs&&Vs.log(`Failed to replace method "${t}" in object`,e)}}function Tc(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Cs&&Vs.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Ec(e,t){try{e.prototype=t.prototype=t.prototype||{},Tc(e,`__sentry_original__`,t)}catch{}}function Dc(e){return e.__sentry_original__}function Oc(e){if(uc(e))return{message:e.message,name:e.name,stack:e.stack,...kc(e)};if(yc(e)){let{type:t,target:n,currentTarget:r,detail:i}=e;return{type:t,target:n,currentTarget:r,...i?{detail:i}:{},...kc(e)}}return e}function kc(e){return vc(e)?Object.fromEntries(Object.entries(e)):{}}function Ac(e){let t=Object.keys(Oc(e));return t.sort(),t[0]?t.join(`, `):`[object has no keys]`}var jc;function Mc(e){if(jc!==void 0)return jc?jc(e):e();let t=Symbol.for(`__SENTRY_SAFE_RANDOM_ID_WRAPPER__`),n=ws;return t in n&&typeof n[t]==`function`?(jc=n[t],jc(e)):(jc=null,e())}function Nc(){return Mc(()=>Math.random())}function Pc(){return Mc(()=>Date.now())}var Fc=Symbol.for(`sentry.skipNormalization`),Ic=Symbol.for(`sentry.overrideNormalizationDepth`);function Lc(e){return!!e[Fc]}function Rc(e){let t=e[Ic];return typeof t==`number`?t:void 0}var zc;function Bc(e){zc=e}function Vc(e,t=100,n=1/0){try{return Uc(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Hc(e,t=3,n=100*1024){let r=Vc(e,t);return qc(r)>n?Hc(e,t-1,n):r}function Uc(e,t,n=1/0,r=1/0,i=Jc()){let[a,o]=i;if(t==null||[`boolean`,`string`].includes(typeof t)||typeof t==`number`&&Number.isFinite(t))return t;let s=Wc(e,t);if(!s.startsWith(`[object `))return s;if(Lc(t))return t;let c=Rc(t),l=c===void 0?n:c;if(l===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let u=t;if(u&&typeof u.toJSON==`function`)try{return Uc(``,u.toJSON(),l-1,r,i)}catch{}let d=Array.isArray(t)?[]:{},f=0,p=Oc(t);for(let e in p){if(!Object.prototype.hasOwnProperty.call(p,e))continue;if(f>=r){d[e]=`[MaxProperties ~]`;break}let t=p[e];d[e]=Uc(e,t,l-1,r,i),f++}return o(t),d}function Wc(e,t){try{if(zc){let e=zc(t);if(e)return e}return typeof global<`u`&&t===global?`[Global]`:typeof t==`number`&&!Number.isFinite(t)?`[${t}]`:typeof t==`function`?`[Function: ${Xs(t)}]`:typeof t==`symbol`?`[${String(t)}]`:typeof t==`bigint`?`[BigInt: ${String(t)}]`:`[object ${Gc(t)}]`}catch(e){return`**non-serializable** (${e})`}}function Gc(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Kc(e){return~-encodeURI(e).split(/%..|./).length}function qc(e){return Kc(JSON.stringify(e))}function Jc(){let e=new WeakSet;function t(t){return e.has(t)?!0:(e.add(t),!1)}function n(t){e.delete(t)}return[t,n]}function Yc(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function Xc(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];K(r)?n.push(String(r)):r instanceof Error?n.push(r.message?`${r.name}: ${r.message}`:r.name):n.push(Wc(void 0,r))}return n.join(t)}function Zc(e,t,n=!1){return hc(e)?bc(t)?t.test(e):hc(t)?n?e===t:e.includes(t):typeof t==`function`&&t(e):!1}function Qc(e,t=[],n=!1){for(let r of t)if(Zc(e,r,n))return!0;return!1}function $c(){let e=ws;return e.crypto||e.msCrypto}var el;function tl(){return Nc()*16}function nl(e=$c()){try{if(e?.randomUUID)return Mc(()=>e.randomUUID()).replace(/-/g,``)}catch{}return el||=`10000000100040008000100000000000`,el.replace(/[018]/g,e=>(e^(tl()&15)>>e/4).toString(16))}function rl(e){return e.exception?.values?.[0]}function il(e){let{message:t,event_id:n}=e;if(t)return t;let r=rl(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function al(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function ol(e,t){let n=rl(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i?.data,...t.data};n.mechanism.data=e}}function sl(e){if(cl(e))return!0;try{Tc(e,`__sentry_captured__`,!0)}catch{}return!1}function cl(e){try{return e.__sentry_captured__}catch{}}var ll=1e3;function ul(){return Pc()/ll}function dl(){let{performance:e}=ws;if(!e?.now||!e.timeOrigin)return ul;let t=e.timeOrigin;return()=>(t+Mc(()=>e.now()))/ll}var fl;function pl(){return(fl??=dl())()}function ml(e){let t=pl(),n={sid:nl(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>_l(n)};return e&&hl(n,e),n}function hl(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||pl(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:nl()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function gl(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),hl(e,n)}function _l(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function vl(e,t,n=2){if(!t||typeof t!=`object`||n<=0)return t;if(e&&Object.keys(t).length===0)return e;let r={...e};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=vl(r[e],t[e],n-1));return r}function yl(){return nl()}function bl(){return nl().substring(16)}function xl(e){try{let t=ws.WeakRef;if(typeof t==`function`)return new t(e)}catch{}return e}function Sl(e){if(e){if(typeof e==`object`&&`deref`in e&&typeof e.deref==`function`)try{return e.deref()}catch{return}return e}}var Cl=`_sentrySpan`;function wl(e,t){t?Tc(e,Cl,xl(t)):delete e[Cl]}function Tl(e){return Sl(e[Cl])}var El=100,Dl=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:yl(),sampleRand:Nc()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,wl(t,Tl(this)),t}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&hl(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t,{tags:r,attributes:i,extra:a,user:o,contexts:s,level:c,fingerprint:l=[],propagationContext:u,conversationId:d}=(n instanceof e?n.getScopeData():_c(n)?t:void 0)||{};return this._tags={...this._tags,...r},this._attributes={...this._attributes,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),l.length&&(this._fingerprint=l),u&&(this._propagationContext=u),d&&(this._conversationId=d),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,wl(this,void 0),this._attachments=[],this.setPropagationContext({traceId:yl(),sampleRand:Nc()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:El;if(n<=0)return this;let r={timestamp:ul(),...e,message:e.message?Yc(e.message,2048):e.message};return this._breadcrumbs.push(r),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent(`buffer_overflow`,`log_item`)),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Tl(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=vl(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t?.event_id||nl();if(!this._client)return Cs&&Vs.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n?.event_id||nl();if(!this._client)return Cs&&Vs.warn(`No client configured on scope - will not capture message!`),r;let i=n?.syntheticException??Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=e.event_id||t?.event_id||nl();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(Cs&&Vs.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function Ol(){return Os(`defaultCurrentScope`,()=>new Dl)}function kl(){return Os(`defaultIsolationScope`,()=>new Dl)}var Al=e=>e instanceof Promise&&!e[jl],jl=Symbol(`chained PromiseLike`),Ml=(e,t,n)=>{let r=e.then(e=>(t(e),e),e=>{throw n(e),e});return Al(r)&&Al(e)?r:Nl(e,r)},Nl=(e,t)=>{if(!t)return e;let n=!1;for(let r in e){if(r in t)continue;n=!0;let i=e[r];typeof i==`function`?Object.defineProperty(t,r,{value:(...t)=>i.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[r]=i}return n&&Object.assign(t,{[jl]:!0}),t},Pl=class{constructor(e,t){let n;n=e||new Dl;let r;r=t||new Dl,this._stack=[{scope:n}],this._isolationScope=r}withScope(e){let t=this._pushScope(),n;try{n=e(t)}catch(e){throw this._popScope(),e}return xc(n)?Ml(n,()=>this._popScope(),()=>this._popScope()):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Fl(){let e=Ds(Es());return e.stack=e.stack||new Pl(Ol(),kl())}function Il(e){return Fl().withScope(e)}function Ll(e,t){let n=Fl();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function Rl(e){return Fl().withScope(()=>e(Fl().getIsolationScope()))}function zl(){return{withIsolationScope:Rl,withScope:Il,withSetScope:Ll,withSetIsolationScope:(e,t)=>Rl(t),getCurrentScope:()=>Fl().getScope(),getIsolationScope:()=>Fl().getIsolationScope()}}function Bl(e){let t=Ds(e);return t.acs?t.acs:zl()}function Vl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).includes(`value`)}function Hl(e,t){let{value:n,unit:r}=Vl(e)?e:{value:e,unit:void 0},i=Wl(n),a=r&&typeof r==`string`?{unit:r}:{};if(i)return{...i,...a};if(!t||t===`skip-undefined`&&n===void 0)return;let o=``;try{o=JSON.stringify(n)??``}catch{}return{value:o,type:`string`,...a}}function Ul(e,t=!1){let n={};for(let[r,i]of Object.entries(e??{})){let e=Hl(i,t);e&&(n[r]=e)}return n}function Wl(e){if(Array.isArray(e))return{value:e,type:`array`};let t=typeof e==`string`?`string`:typeof e==`boolean`?`boolean`:typeof e==`number`&&!Number.isNaN(e)?Number.isInteger(e)?`integer`:`double`:null;if(t)return{value:e,type:t}}var Gl;function Kl(){return Gl?.()}function ql(){return Bl(Es()).getCurrentScope()}function Jl(){return Bl(Es()).getIsolationScope()}function Yl(){return Os(`globalScope`,()=>new Dl)}function Xl(...e){let t=Bl(Es());if(e.length===2){let[n,r]=e;return n?t.withSetScope(n,r):t.withScope(r)}return t.withScope(e[0])}function Zl(){return ql().getClient()}function Ql(e){let t=Kl();if(t)return{trace_id:t.traceId,span_id:t.spanId};let{traceId:n,parentSpanId:r,propagationSpanId:i}=e.getPropagationContext(),a={trace_id:n,span_id:i||bl()};return r&&(a.parent_span_id=r),a}var $l=`sentry.op`,eu=`sentry.origin`,tu=`sentry.profile_id`,nu=`sentry.exclusive_time`,ru=`gen_ai.conversation.id`,iu=`_sentryScope`,au=`_sentryIsolationScope`;function ou(e){let t=e;return{scope:t[iu],isolationScope:Sl(t[au])}}function su(e){let t=cu(e);if(!t)return;let n=Object.entries(t).reduce((e,[t,n])=>{if(t.startsWith(`sentry-`)){let r=t.slice(7);e[r]=n}return e},{});if(Object.keys(n).length>0)return n}function cu(e){if(!(!e||!hc(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{let n=lu(t);return Object.entries(n).forEach(([t,n])=>{e[t]=n}),e},{}):lu(e)}function lu(e){return e.split(`,`).map(e=>{let t=e.indexOf(`=`);return t===-1?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,n])=>(t&&n&&(e[t]=n),e),{})}var uu=/^o(\d+)\./,du=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function fu(e){return e===`http`||e===`https`}function pu(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function mu(e){let t=du.exec(e);if(!t){Ms(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a=``,o=``,s=``]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return hu({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function hu(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function gu(e){if(!Cs)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(Vs.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?fu(r)?t&&isNaN(parseInt(t,10))?(Vs.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(Vs.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(Vs.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function _u(e){return e.match(uu)?.[1]}function vu(e){let t=e.getOptions(),{host:n}=e.getDsn()||{},r;return t.orgId?r=String(t.orgId):n&&(r=_u(n)),r}function yu(e){let t=typeof e==`string`?mu(e):hu(e);if(!(!t||!gu(t)))return t}function bu(e){if(typeof e==`boolean`)return Number(e);let t=typeof e==`string`?parseFloat(e):e;if(!(typeof t!=`number`||isNaN(t)||t<0||t>1))return t}var xu=!1;function Su(e){let{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:Eu(e).parent_span_id,a=ou(e).scope;return{parent_span_id:i,span_id:r?a?.getPropagationContext().propagationSpanId||bl():t,trace_id:n}}function Cu(e){if(e&&e.length>0)return e.map(({context:{spanId:e,traceId:t,traceFlags:n,...r},attributes:i})=>({span_id:e,trace_id:t,sampled:n===1,attributes:i,...r}))}function wu(e){return typeof e==`number`?Tu(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Tu(e.getTime()):pl()}function Tu(e){return e>9999999999?e/1e3:e}function Eu(e){if(Au(e))return e.getSpanJSON();let{spanId:t,traceId:n}=e.spanContext();if(ku(e)){let{attributes:r,startTime:i,name:a,endTime:o,status:s,links:c}=e;return{span_id:t,trace_id:n,data:r,description:a,parent_span_id:Du(e),start_timestamp:wu(i),timestamp:wu(o)||void 0,status:Mu(s),op:r[$l],origin:r[eu],links:Cu(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function Du(e){return`parentSpanId`in e?e.parentSpanId:`parentSpanContext`in e?e.parentSpanContext?.spanId:void 0}function Ou(e){return{...e,attributes:Ul(e.attributes),links:e.links?.map(e=>({...e,attributes:Ul(e.attributes)}))}}function ku(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Au(e){return typeof e.getSpanJSON==`function`}function ju(e){let{traceFlags:t}=e.spanContext();return t===1}function Mu(e){if(!(!e||e.code===0))return e.code===1?`ok`:e.message||`internal_error`}var Nu=`_sentryRootSpan`,Pu=Fu;function Fu(e){return e[Nu]||e}function Iu(){xu||=(Ms(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),!0)}function Lu(e){if(typeof __SENTRY_TRACING__==`boolean`&&!__SENTRY_TRACING__)return!1;let t=e||Zl()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Ru(e){Vs.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function zu(e,t){if(!t?.length)return!1;for(let n of t){if(Hu(n)){if(e.description&&Zc(e.description,n))return Cs&&Ru(e),!0;continue}let t=!!n.attributes&&Object.keys(n.attributes).length>0;if(!n.name&&!n.op&&!t)continue;let r=!n.name||e.description&&Zc(e.description,n.name),i=!n.op||e.op&&Zc(e.op,n.op),a=!n.attributes||Object.entries(n.attributes).every(([t,n])=>Bu(e.attributes?.[t],n));if(r&&i&&a)return Cs&&Ru(e),!0}return!1}function Bu(e,t){return typeof e==`string`&&(typeof t==`string`||t instanceof RegExp)?Zc(e,t):Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function Vu(e,t){let n=t.parent_span_id,r=t.span_id;if(n)for(let t of e)t.parent_span_id===r&&(t.parent_span_id=n)}function Hu(e){return typeof e==`string`||e instanceof RegExp}var Uu=Symbol.for(`sentry.nonRecordingSpan`);function Wu(e){return!!e&&e[Uu]===!0}var Gu=`production`,Ku=`_frozenDsc`;function qu(e,t){let n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||`production`,release:n.release,public_key:r,trace_id:e,org_id:vu(t)};return t.emit(`createDsc`,i),i}function Ju(e,t){let n=t.getPropagationContext();return n.dsc||qu(n.traceId,e)}function Yu(e){let t=Zl();if(!t)return{};let n=Pu(e),r=Eu(n),i=r.data,a=n.spanContext().traceState,o=a?.get(`sentry.sample_rate`)??i[`sentry.sample_rate`]??i[`sentry.previous_trace_sample_rate`];function s(e){return(typeof o==`number`||typeof o==`string`)&&(e.sample_rate=`${o}`),e}let c=n[Ku];if(c)return s(c);let l=Wu(n),u=l&&n.dropReason===`ignored`;if(l&&(!Lu(t.getOptions())||u)){let e=ou(n).scope;if(e){let n={...Ju(t,e)};return u&&(n.sampled=`false`),s(n)}}let d=a?.get(`sentry.dsc`),f=d&&su(d);if(f)return s(f);let p=qu(e.spanContext().traceId,t),m=i[`sentry.source`]??i[`sentry.segment.name.source`],h=r.description;return m!==`url`&&h&&(p.transaction=h),Lu()&&(p.sampled=String(ju(n)),p.sample_rand=a?.get(`sentry.sample_rand`)??ou(n).scope?.getPropagationContext().sampleRand.toString()),s(p),t.emit(`createDsc`,p,n),p}function Xu(e){return!!e&&typeof e==`function`&&`_streamed`in e&&!!e._streamed}function Zu(e,t=[]){return[e,t]}function Qu(e,t){let[n,r]=e;return[n,[...r,t]]}function $u(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function ed(e,t){return $u(e,(e,n)=>t.includes(n))}function td(e){let t=Ds(ws);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function nd(e){let[t,n]=e,r=JSON.stringify(t);function i(e){typeof r==`string`?r=typeof e==`string`?r+e:[td(r),e]:r.push(typeof e==`string`?td(e):e)}for(let e of n){let[t,n]=e;if(i(`
42
42
  ${JSON.stringify(t)}
43
- `),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(Vc(n))}i(e)}}return typeof r==`string`?r:rd(r)}function rd(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function id(e){let t=typeof e.data==`string`?td(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var ad={sessions:`session`,event:`error`,client_report:`internal`,user_report:`default`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,raw_security:`security`,log:`log_item`,trace_metric:`metric`};function od(e){return e in ad}function sd(e){return od(e)?ad[e]:e}function cd(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function ld(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(Pc()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:pu(r)},...i&&{trace:i}}}function ud(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function dd(e,t,n,r){let i=cd(n);return Zu({sent_at:new Date(Pc()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:pu(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function fd(e,t,n,r){let i=cd(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;ud(e,n?.sdk);let o=ld(e,i,r,t);return delete e.sdkProcessingMetadata,Zu(o,[[{type:a},e]])}function pd(e){return e.getOptions().traceLifecycle===`stream`}function md(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;vd(e,t),r&&xd(e,r),Sd(e,n),yd(e,i),bd(e,a)}function hd(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;gd(e,`extra`,n),gd(e,`tags`,r),gd(e,`attributes`,i),gd(e,`user`,a),gd(e,`contexts`,o),e.sdkProcessingMetadata=vl(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function gd(e,t,n){e[t]=vl(e[t],n,1)}function _d(e,t){let n=Yl().getScopeData();return e&&hd(n,e.getScopeData()),t&&hd(n,t.getScopeData()),n}function vd(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function yd(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function bd(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function xd(e,t){e.contexts={trace:Su(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Yu(t),...e.sdkProcessingMetadata};let n=Eu(Pu(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Sd(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function Cd(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}var wd=0,Td=1,Ed=2;function Dd(e){return new kd(t=>{t(e)})}function Od(e){return new kd((t,n)=>{n(e)})}var kd=class e{constructor(e){this._state=wd,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===wd)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===Td&&e[1](this._value),this._state===Ed&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===wd){if(xc(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(Td,e)},r=e=>{t(Ed,e)};try{e(n,r)}catch(e){r(e)}}};function Ad(e,t,n,r=0){try{let i=jd(t,n,e,r);return xc(i)?i:Dd(i)}catch(e){return Od(e)}}function jd(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return Cs&&a===null&&Vs.log(`Event processor "${i.id||`?`}" dropped event`),xc(a)?a.then(e=>jd(e,t,n,r+1)):jd(a,t,n,r+1)}var Md,Nd,Pd,Fd;function Id(e){let t=ws._sentryDebugIds,n=ws._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Fd&&r.length===Nd&&i.length===Pd)return Fd;Nd=r.length,Pd=i.length,Fd={},Md||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Md?.[r];if(i&&Fd&&t)Fd[i[0]]=t,Md&&(Md[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&Fd&&Md){Fd[i]=t,Md[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Fd}function Ld(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||nl(),timestamp:t.timestamp||ul()},l=n.integrations||e.integrations.map(e=>e.name);Rd(c,e),Vd(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&zd(c,e.stackParser);let u=Ud(r,n.captureContext);n.mechanism&&ol(c,n.mechanism);let d=i?i.getEventProcessors():[],f=_d(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),md(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Dd(c):Ad(m,c,n)).then(e=>(e&&Bd(e),typeof o==`number`&&o>0?Hd(e,o,s):e))}function Rd(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Yc(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Yc(e.value,a)})}function zd(e,t){let n=Id(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Bd(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function Vd(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Hd(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Vc(e.data,t,n)}}))},...e.user&&{user:Vc(e.user,t,n)},...e.contexts&&{contexts:Vc(e.contexts,t,n)},...e.extra&&{extra:Vc(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Vc(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Vc(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Vc(e.contexts.flags,3,n)),r}function Ud(e,t){if(!t)return e;let n=e?e.clone():new Dl;return n.update(t),n}function Wd(e){if(e)return Gd(e)||qd(e)?{captureContext:e}:e}function Gd(e){return e instanceof Dl||typeof e==`function`}var Kd=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function qd(e){return Object.keys(e).some(e=>Kd.includes(e))}function Jd(e,t){return ql().captureException(e,Wd(t))}function Yd(e,t){return ql().captureEvent(e,t)}function Xd(e){let t=Jl(),{user:n}=_d(t,ql()),{userAgent:r}=ws.navigator||{},i=ml({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&hl(a,{status:`exited`}),Zd(),t.setSession(i),i}function Zd(){let e=Jl(),t=ql().getSession()||e.getSession();t&&gl(t),Qd(),e.setSession()}function Qd(){let e=Jl(),t=Zl(),n=e.getSession();n&&t&&t.captureSession(n)}function $d(e=!1){if(e){Zd();return}Qd()}function ef(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}function tf(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function nf(e){return`${tf(e)}${e.projectId}/envelope/`}function rf(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function af(e,t,n){return t||`${nf(e)}?${rf(e,n)}`}var of=[];function sf(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function cf(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return sf(r)}function lf(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&df(e,t,n)}),n}function uf(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function df(e,t,n){if(n[t.name]){Cs&&Vs.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!of.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),of.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}[`processSpan`,`processSegmentSpan`].forEach(n=>{let r=t[n];typeof r==`function`&&e.on(n,n=>r.call(t,n,e))}),Cs&&Vs.log(`Integration installed: ${t.name}`)}function ff(e){return e}function pf(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function mf(){return`npm`}function hf(){return!pf()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function gf(){return typeof window<`u`&&(!hf()||_f())}function _f(){return ws.process?.type===`renderer`}function vf(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...gf()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function yf(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=pu(r)),Zu(a,[vf(e,i)])}function bf(e,t){let n=t??xf(e)??[];if(n.length===0)return;let r=e.getOptions(),i=yf(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Sf().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function xf(e){return Sf().get(e)}function Sf(){return Os(`clientToLogBufferMap`,()=>new WeakMap)}function Cf(e,t){let n=t?`auto`:`never`;return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{version:2,...gf()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function wf(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=pu(r)),Zu(a,[Cf(e,i)])}function Tf(e,t){let n=t??Ef(e)??[];if(n.length===0)return;let r=e.getOptions(),i=wf(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Df().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Ef(e){return Df().get(e)}function Df(){return Os(`clientToMetricBufferMap`,()=>new WeakMap)}function Of(e){return Ou({trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||``,start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status===`ok`||e.status===`cancelled`?`ok`:`error`,is_segment:!1,attributes:{...e.data},links:e.links})}function kf(e,t){if(e.type!==`transaction`||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||pd(t))return;let n=[],r=[];for(let t of e.spans)t.op?.startsWith(`gen_ai.`)?n.push(Of(t)):r.push(t);if(n.length===0)return;e.spans=r;let i=t.getDataCollectionOptions().userInfo?`auto`:`never`;return[{type:`span`,item_count:n.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...gf()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var Af=Symbol.for(`SentryBufferFullError`);function jf(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Od(Af);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Dd(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>ef(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var Mf=60*1e3;function Nf(e,t=Pc()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?Mf:r-t}function Pf(e,t){return e[t]||e.all||0}function Ff(e,t,n=Pc()){return Pf(e,t)>n}function If(e,{statusCode:t,headers:n},r=Pc()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Nf(o,r):t===429&&(i.all=r+60*1e3);return i}function Lf(e,t,n=jf(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if($u(i,(t,n)=>{let i=sd(n);Ff(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Zu(i[0],a),s=t=>{if(ed(o,[`client_report`])){Cs&&Vs.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}$u(o,(n,r)=>{e.recordDroppedEvent(t,sd(r))})};return n.add(()=>t({body:nd(o)}).then(e=>e.statusCode===413?(Cs&&Vs.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(Cs&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&Vs.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=If(r,e),e),e=>{throw s(`network_error`),Cs&&Vs.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===Af)return Cs&&Vs.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Rf(e,t,n){let r=[{type:`client_report`},{timestamp:n||ul(),discarded_events:e}];return Zu(t?{dsn:t}:{},[r])}function zf(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function Bf(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[tu],exclusive_time:o?.[nu],measurements:e.measurements,is_segment:!0}}function Vf(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}var Hf=[`forwarded`,`-ip`,`remote-`,`via`,`-user`];function Uf(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:Hf},httpHeaders:{request:{deny:Hf},response:{deny:Hf}},httpBodies:[],queryParams:{deny:Hf},genAI:{inputs:!1,outputs:!1},stackFrameVariables:!0,frameContextLines:7}}var Wf={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],queryParams:!0,genAI:{inputs:!0,outputs:!0},stackFrameVariables:!0,frameContextLines:5};function Gf(e){let t=e.dataCollection==null?Uf(e.sendDefaultPii):Wf,n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:n.httpHeaders?.request??t.httpHeaders.request,response:n.httpHeaders?.response??t.httpHeaders.response},httpBodies:n.httpBodies??t.httpBodies,queryParams:n.queryParams??t.queryParams,genAI:{inputs:n.genAI?.inputs??t.genAI.inputs,outputs:n.genAI?.outputs??t.genAI.outputs},stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}var Kf=`Not capturing exception because it's already been captured.`,qf=`Discarded session because of missing or non-string release`,Jf=Symbol.for(`SentryInternalError`),Yf=Symbol.for(`SentryDoNotSendEventError`),Xf=5e3;function Zf(e){return{message:e,[Jf]:!0}}function Qf(e){return{message:e,[Yf]:!0}}function $f(e){return vc(e)&&Jf in e}function ep(e){return vc(e)&&Yf in e}function tp(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{if(a+=r(t),a>=8e5)i(e);else if(!s){let t=e.getOptions()._flushInterval??Xf;t>0&&(s=!0,o=ef(setTimeout(()=>{i(e)},t)))}}),e.on(`flush`,()=>{i(e)})}var np=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=jf(e.transportOptions?.bufferSize??64),this._dataCollection=Gf(e),e.dsn?this._dsn=yu(e.dsn):Cs&&Vs.warn(`No DSN provided, client will not send events.`),this._dsn){let t=af(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&tp(this,`afterCaptureLog`,`flushLogs`,lp,bf),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&tp(this,`afterCaptureMetric`,`flushMetrics`,cp,Tf)}captureException(e,t,n){let r=nl();if(sl(e))return Cs&&Vs.log(Kf),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:nl(),...n},a=gc(e)?e:String(e),o=K(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=nl();if(t?.originalException&&sl(t.originalException))return Cs&&Vs.log(Kf),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=rp(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),hl(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(this.emit(`flush`),!t)return!0;let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){bf(this);let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),df(this,e,this._integrations),t||uf(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=kf(e,this),r=fd(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])r=Qu(r,id(e));n&&(r=Qu(r,n)),this.sendEnvelope(r).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Gu}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){Cs&&Vs.warn(qf);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){Cs&&Vs.warn(qf);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=dd(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;Cs&&Vs.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return Cs&&Vs.error(`Error while sending envelope:`,e),{}}return Cs&&Vs.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=lf(this,e),uf(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(hl(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=this.getIntegrationNames();return!t.integrations&&a.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Ld(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...Ql(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ju(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=ql(),r=Jl()){return Cs&&op(e)&&Vs.log(`Captured error event \`${zf(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{Cs&&(ep(e)?Vs.log(e.message):$f(e)?Vs.warn(e.message):Vs.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=sp(e),s=op(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:bu(a);if(s&&typeof l==`number`&&Nc()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Od(Qf(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=rp(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Qf("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:ip(ap(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Qf(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw ep(e)||$f(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Zf(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
44
- Reason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===Af&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){Cs&&Vs.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){Cs&&Vs.log(`No outcomes to send`);return}if(!this._dsn){Cs&&Vs.log(`No dsn provided, will not send outcomes`);return}Cs&&Vs.log(`Sending outcomes:`,e);let t=Rf(e,this._options.tunnel&&pu(this._dsn));this.sendEnvelope(t)}};function rp(e){return e===`replay_event`?`replay`:e||`error`}function ip(e,t){let n=`${t} must return \`null\` or a valid event.`;if(xc(e))return e.then(e=>{if(!_c(e)&&e!==null)throw Zf(n);return e},e=>{throw Zf(`${t} rejected with ${e}`)});if(!_c(e)&&e!==null)throw Zf(n);return e}function ap(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!Xu(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(op(c)&&i)return i(c,r);if(sp(c)){if(s||o){let t=Bf(c);if(o?.length&&zu({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){let e=s(t);e?c=vl(n,Vf(e)):Iu()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&zu({description:e.description,op:e.op,attributes:e.data},o)){Vu(n,e);continue}if(s){let n=s(e);n?t.push(n):(Iu(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function op(e){return e.type===void 0}function sp(e){return e.type===`transaction`}function cp(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+up(e.attributes)}function lp(e){let t=0;return e.message&&(t+=e.message.length*2),t+up(e.attributes)}function up(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*dp(e[0]):K(e)?t+=dp(e):t+=100}),t}function dp(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function fp(e,t){t.debug===!0&&(Cs?Vs.enable():Ms(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),ql().update(t.initialScope);let n=new e(t);return pp(n),n.init(),n}function pp(e){ql().setClient(e)}function mp(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function hp(e,t=!0){if(e.startsWith(`data:`)){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:`text/plain`,i=e.includes(`;base64,`),a=e.indexOf(`,`),o=``;if(t&&a!==-1){let t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?`,base64`:``}${o?`,${o}`:``}`}return e}function gp(e){`aggregates`in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:`{{auto}}`}):e.ipAddress===void 0&&(e.ipAddress=`{{auto}}`)}function _p(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:Ts})),i.version=Ts)}var vp=100;function yp(e,t){let n=Zl(),r=Jl();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=vp}=n.getOptions();if(a<=0)return;let o={timestamp:ul(),...e},s=i?Ms(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}var bp,xp=`FunctionToString`,Sp=new WeakMap,Cp=ff((()=>({name:xp,setupOnce(){bp=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Dc(this),n=Sp.has(Zl())&&t!==void 0?t:this;return bp.apply(n,e)}}catch{}},setup(e){Sp.set(e,!0)}}))),wp=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Tp=`EventFilters`,Ep=ff((e={})=>{let t;return{name:Tp,setup(n){t=Op(e,n.getOptions())},processEvent(n,r,i){return t||=Op(e,i.getOptions()),kp(n,t)?null:n}}}),Dp=ff(((e={})=>({...Ep(e),name:`InboundFilters`})));function Op(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:wp],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function kp(e,t){if(!e.type){if(Ap(e,t.ignoreErrors))return Cs&&Vs.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
45
- Event: ${il(e)}`),!0;if(Ip(e))return Cs&&Vs.warn(`Event dropped due to not having an error message, error type or stacktrace.
46
- Event: ${il(e)}`),!0;if(Mp(e,t.denyUrls))return Cs&&Vs.warn(`Event dropped due to being matched by \`denyUrls\` option.
43
+ `),typeof n==`string`||n instanceof Uint8Array)i(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(Vc(n))}i(e)}}return typeof r==`string`?r:rd(r)}function rd(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function id(e){let t=typeof e.data==`string`?td(e.data):e.data;return[{type:`attachment`,length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var ad={sessions:`session`,event:`error`,client_report:`internal`,user_report:`default`,profile_chunk:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,raw_security:`security`,log:`log_item`,trace_metric:`metric`};function od(e){return e in ad}function sd(e){return od(e)?ad[e]:e}function cd(e){if(!e?.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function ld(e,t,n,r){let i=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(Pc()).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:pu(r)},...i&&{trace:i}}}function ud(e,t){if(!t)return e;let n=e.sdk||{};return e.sdk={...n,name:n.name||t.name,version:n.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function dd(e,t,n,r){let i=cd(n);return Zu({sent_at:new Date(Pc()).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:pu(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function fd(e,t,n,r){let i=cd(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;ud(e,n?.sdk);let o=ld(e,i,r,t);return delete e.sdkProcessingMetadata,Zu(o,[[{type:a},e]])}function pd(e){return e.getOptions().traceLifecycle===`stream`}function md(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;vd(e,t),r&&xd(e,r),Sd(e,n),yd(e,i),bd(e,a)}function hd(e,t){let{extra:n,tags:r,attributes:i,user:a,contexts:o,level:s,sdkProcessingMetadata:c,breadcrumbs:l,fingerprint:u,eventProcessors:d,attachments:f,propagationContext:p,transactionName:m,span:h}=t;gd(e,`extra`,n),gd(e,`tags`,r),gd(e,`attributes`,i),gd(e,`user`,a),gd(e,`contexts`,o),e.sdkProcessingMetadata=vl(e.sdkProcessingMetadata,c,2),s&&(e.level=s),m&&(e.transactionName=m),h&&(e.span=h),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),d.length&&(e.eventProcessors=[...e.eventProcessors,...d]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function gd(e,t,n){e[t]=vl(e[t],n,1)}function _d(e,t){let n=Yl().getScopeData();return e&&hd(n,e.getScopeData()),t&&hd(n,t.getScopeData()),n}function vd(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t;Object.keys(n).length&&(e.extra={...n,...e.extra}),Object.keys(r).length&&(e.tags={...r,...e.tags}),Object.keys(i).length&&(e.user={...i,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&e.type!==`transaction`&&(e.transaction=s)}function yd(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function bd(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function xd(e,t){e.contexts={trace:Su(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Yu(t),...e.sdkProcessingMetadata};let n=Eu(Pu(t)).description;n&&!e.transaction&&e.type===`transaction`&&(e.transaction=n)}function Sd(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function Cd(e,t){let n=e.attributes??={};Object.entries(t).forEach(([e,t])=>{t!=null&&!(e in n)&&(n[e]=t)})}var wd=0,Td=1,Ed=2;function Dd(e){return new kd(t=>{t(e)})}function Od(e){return new kd((t,n)=>{n(e)})}var kd=class e{constructor(e){this._state=wd,this._handlers=[],this._runExecutor(e)}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}_executeHandlers(){if(this._state===wd)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===Td&&e[1](this._value),this._state===Ed&&e[2](this._value),!0)})}_runExecutor(e){let t=(e,t)=>{if(this._state===wd){if(xc(t)){t.then(n,r);return}this._state=e,this._value=t,this._executeHandlers()}},n=e=>{t(Td,e)},r=e=>{t(Ed,e)};try{e(n,r)}catch(e){r(e)}}};function Ad(e,t,n,r=0){try{let i=jd(t,n,e,r);return xc(i)?i:Dd(i)}catch(e){return Od(e)}}function jd(e,t,n,r){let i=n[r];if(!e||!i)return e;let a=i({...e},t);return Cs&&a===null&&Vs.log(`Event processor "${i.id||`?`}" dropped event`),xc(a)?a.then(e=>jd(e,t,n,r+1)):jd(a,t,n,r+1)}var Md,Nd,Pd,Fd;function Id(e){let t=ws._sentryDebugIds,n=ws._debugIds;if(!t&&!n)return{};let r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(Fd&&r.length===Nd&&i.length===Pd)return Fd;Nd=r.length,Pd=i.length,Fd={},Md||={};let a=(t,n)=>{for(let r of t){let t=n[r],i=Md?.[r];if(i&&Fd&&t)Fd[i[0]]=t,Md&&(Md[r]=[i[0],t]);else if(t){let n=e(r);for(let e=n.length-1;e>=0;e--){let i=n[e]?.filename;if(i&&Fd&&Md){Fd[i]=t,Md[r]=[i,t];break}}}}};return t&&a(r,t),n&&a(i,n),Fd}function Ld(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||nl(),timestamp:t.timestamp||ul()},l=n.integrations||e.integrations.map(e=>e.name);Rd(c,e),Vd(c,l),i&&i.emit(`applyFrameMetadata`,t),t.type===void 0&&zd(c,e.stackParser);let u=Ud(r,n.captureContext);n.mechanism&&ol(c,n.mechanism);let d=i?i.getEventProcessors():[],f=_d(a,u),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),md(c,f);let m=[...d,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?Dd(c):Ad(m,c,n)).then(e=>(e&&Bd(e),typeof o==`number`&&o>0?Hd(e,o,s):e))}function Rd(e,t){let{environment:n,release:r,dist:i,maxValueLength:a}=t;e.environment=e.environment||n||`production`,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);let o=e.request;o?.url&&a&&(o.url=Yc(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&=Yc(e.value,a)})}function zd(e,t){let n=Id(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=n[e.filename])})})}function Bd(e){let t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{n.push({type:`sourcemap`,code_file:e,debug_id:t})})}function Vd(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Hd(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:Vc(e.data,t,n)}}))},...e.user&&{user:Vc(e.user,t,n)},...e.contexts&&{contexts:Vc(e.contexts,t,n)},...e.extra&&{extra:Vc(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Vc(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>({...e,...e.data&&{data:Vc(e.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Vc(e.contexts.flags,3,n)),r}function Ud(e,t){if(!t)return e;let n=e?e.clone():new Dl;return n.update(t),n}function Wd(e){if(e)return Gd(e)||qd(e)?{captureContext:e}:e}function Gd(e){return e instanceof Dl||typeof e==`function`}var Kd=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`propagationContext`];function qd(e){return Object.keys(e).some(e=>Kd.includes(e))}function Jd(e,t){return ql().captureException(e,Wd(t))}function Yd(e,t){return ql().captureEvent(e,t)}function Xd(e){let t=Jl(),{user:n}=_d(t,ql()),{userAgent:r}=ws.navigator||{},i=ml({user:n,...r&&{userAgent:r},...e}),a=t.getSession();return a?.status===`ok`&&hl(a,{status:`exited`}),Zd(),t.setSession(i),i}function Zd(){let e=Jl(),t=ql().getSession()||e.getSession();t&&gl(t),Qd(),e.setSession()}function Qd(){let e=Jl(),t=Zl(),n=e.getSession();n&&t&&t.captureSession(n)}function $d(e=!1){if(e){Zd();return}Qd()}function ef(e){return typeof e==`object`&&typeof e.unref==`function`&&e.unref(),e}function tf(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function nf(e){return`${tf(e)}${e.projectId}/envelope/`}function rf(e,t){let n={sentry_version:`7`};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function af(e,t,n){return t||`${nf(e)}?${rf(e,n)}`}var of=[];function sf(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.values(t)}function cf(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...t,...n];else if(typeof n==`function`){let e=n(t);r=Array.isArray(e)?e:[e]}else r=t;return sf(r)}function lf(e,t){let n={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&df(e,t,n)}),n}function uf(e,t){for(let n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function df(e,t,n){if(n[t.name]){Cs&&Vs.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!of.includes(t.name)&&typeof t.setupOnce==`function`&&(t.setupOnce(),of.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}[`processSpan`,`processSegmentSpan`].forEach(n=>{let r=t[n];typeof r==`function`&&e.on(n,n=>r.call(t,n,e))}),Cs&&Vs.log(`Integration installed: ${t.name}`)}function ff(e){return e}function pf(){return typeof __SENTRY_BROWSER_BUNDLE__<`u`&&!!__SENTRY_BROWSER_BUNDLE__}function mf(){return`npm`}function hf(){return!pf()&&Object.prototype.toString.call(typeof process<`u`?process:0)===`[object process]`}function gf(){return typeof window<`u`&&(!hf()||_f())}function _f(){return ws.process?.type===`renderer`}function vf(e,t){let n=t?`auto`:`never`;return[{type:`log`,item_count:e.length,content_type:`application/vnd.sentry.items.log+json`},{version:2,...gf()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function yf(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=pu(r)),Zu(a,[vf(e,i)])}function bf(e,t){let n=t??xf(e)??[];if(n.length===0)return;let r=e.getOptions(),i=yf(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Sf().set(e,[]),e.emit(`flushLogs`),e.sendEnvelope(i)}function xf(e){return Sf().get(e)}function Sf(){return Os(`clientToLogBufferMap`,()=>new WeakMap)}function Cf(e,t){let n=t?`auto`:`never`;return[{type:`trace_metric`,item_count:e.length,content_type:`application/vnd.sentry.items.trace-metric+json`},{version:2,...gf()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:e}]}function wf(e,t,n,r,i){let a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(a.dsn=pu(r)),Zu(a,[Cf(e,i)])}function Tf(e,t){let n=t??Ef(e)??[];if(n.length===0)return;let r=e.getOptions(),i=wf(n,r._metadata,r.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);Df().set(e,[]),e.emit(`flushMetrics`),e.sendEnvelope(i)}function Ef(e){return Df().get(e)}function Df(){return Os(`clientToMetricBufferMap`,()=>new WeakMap)}function Of(e){return Ou({trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||``,start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:!e.status||e.status===`ok`||e.status===`cancelled`?`ok`:`error`,is_segment:!1,attributes:{...e.data},links:e.links})}function kf(e,t){if(e.type!==`transaction`||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||t.getOptions().streamGenAiSpans===!1||pd(t))return;let n=[],r=[];for(let t of e.spans)t.op?.startsWith(`gen_ai.`)?n.push(Of(t)):r.push(t);if(n.length===0)return;e.spans=r;let i=t.getDataCollectionOptions().userInfo?`auto`:`never`;return[{type:`span`,item_count:n.length,content_type:`application/vnd.sentry.items.span.v2+json`},{version:2,...gf()&&{ingest_settings:{infer_ip:i,infer_user_agent:i}},items:n}]}var Af=Symbol.for(`SentryBufferFullError`);function jf(e=100){let t=new Set;function n(){return t.size<e}function r(e){t.delete(e)}function i(e){if(!n())return Od(Af);let i=e();return t.add(i),i.then(()=>r(i),()=>r(i)),i}function a(e){if(!t.size)return Dd(!0);let n=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return n;let r=[n,new Promise(t=>ef(setTimeout(()=>t(!1),e)))];return Promise.race(r)}return{get $(){return Array.from(t)},add:i,drain:a}}var Mf=60*1e3;function Nf(e,t=Pc()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?Mf:r-t}function Pf(e,t){return e[t]||e.all||0}function Ff(e,t,n=Pc()){return Pf(e,t)>n}function If(e,{statusCode:t,headers:n},r=Pc()){let i={...e},a=n?.[`x-sentry-rate-limits`],o=n?.[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Nf(o,r):t===429&&(i.all=r+60*1e3);return i}function Lf(e,t,n=jf(e.bufferSize||64)){let r={},i=e=>n.drain(e);function a(i){let a=[];if($u(i,(t,n)=>{let i=sd(n);Ff(r,i)?e.recordDroppedEvent(`ratelimit_backoff`,i):a.push(t)}),a.length===0)return Promise.resolve({});let o=Zu(i[0],a),s=t=>{if(ed(o,[`client_report`])){Cs&&Vs.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`);return}$u(o,(n,r)=>{e.recordDroppedEvent(t,sd(r))})};return n.add(()=>t({body:nd(o)}).then(e=>e.statusCode===413?(Cs&&Vs.error(`Sentry responded with status code 413. Envelope was discarded due to exceeding size limits.`),s(`send_error`),e):(Cs&&e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&Vs.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=If(r,e),e),e=>{throw s(`network_error`),Cs&&Vs.error(`Encountered error running transport request:`,e),e})).then(e=>e,e=>{if(e===Af)return Cs&&Vs.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),Promise.resolve({});throw e})}return{send:a,flush:i}}function Rf(e,t,n){let r=[{type:`client_report`},{timestamp:n||ul(),discarded_events:e}];return Zu(t?{dsn:t}:{},[r])}function zf(e){let t=[];e.message&&t.push(e.message);try{let n=e.exception.values[e.exception.values.length-1];n?.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`))}catch{}return t}function Bf(e){let{trace_id:t,parent_span_id:n,span_id:r,status:i,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:n,span_id:r??``,start_timestamp:e.start_timestamp??0,status:i,timestamp:e.timestamp,trace_id:t??``,origin:a,profile_id:o?.[tu],exclusive_time:o?.[nu],measurements:e.measurements,is_segment:!0}}function Vf(e){return{type:`transaction`,timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{"sentry.profile_id":e.profile_id},...e.exclusive_time&&{"sentry.exclusive_time":e.exclusive_time}}}},measurements:e.measurements}}var Hf=[`forwarded`,`-ip`,`remote-`,`via`,`-user`];function Uf(e){return e===!0?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:Hf},httpHeaders:{request:{deny:Hf},response:{deny:Hf}},httpBodies:[],urlQueryParams:{deny:Hf},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7}}var Wf={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:[`incomingRequest`,`outgoingRequest`,`incomingResponse`,`outgoingResponse`],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:5};function Gf(e){let t=e.dataCollection==null?Uf(e.sendDefaultPii):Wf,n=e.dataCollection??{};return{userInfo:n.userInfo??t.userInfo,cookies:n.cookies??t.cookies,httpHeaders:{request:n.httpHeaders?.request??t.httpHeaders.request,response:n.httpHeaders?.response??t.httpHeaders.response},httpBodies:n.httpBodies??t.httpBodies,urlQueryParams:n.urlQueryParams??n.queryParams??t.urlQueryParams,graphQL:{document:n.graphQL?.document??t.graphQL.document,variables:n.graphQL?.variables??t.graphQL.variables},genAI:{inputs:n.genAI?.inputs??t.genAI.inputs,outputs:n.genAI?.outputs??t.genAI.outputs},databaseQueryData:n.databaseQueryData??t.databaseQueryData,stackFrameVariables:n.stackFrameVariables??t.stackFrameVariables,frameContextLines:n.frameContextLines??t.frameContextLines}}var Kf=`Not capturing exception because it's already been captured.`,qf=`Discarded session because of missing or non-string release`,Jf=Symbol.for(`SentryInternalError`),Yf=Symbol.for(`SentryDoNotSendEventError`),Xf=5e3;function Zf(e){return{message:e,[Jf]:!0}}function Qf(e){return{message:e,[Yf]:!0}}function $f(e){return vc(e)&&Jf in e}function ep(e){return vc(e)&&Yf in e}function tp(e,t,n,r,i){let a=0,o,s=!1;e.on(n,()=>{a=0,clearTimeout(o),s=!1}),e.on(t,t=>{if(a+=r(t),a>=8e5)i(e);else if(!s){let t=e.getOptions()._flushInterval??Xf;t>0&&(s=!0,o=ef(setTimeout(()=>{i(e)},t)))}}),e.on(`flush`,()=>{i(e)})}var np=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=jf(e.transportOptions?.bufferSize??64),this._dataCollection=Gf(e),e.dsn?this._dsn=yu(e.dsn):Cs&&Vs.warn(`No DSN provided, client will not send events.`),this._dsn){let t=af(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&tp(this,`afterCaptureLog`,`flushLogs`,lp,bf),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&tp(this,`afterCaptureMetric`,`flushMetrics`,cp,Tf)}captureException(e,t,n){let r=nl();if(sl(e))return Cs&&Vs.log(Kf),r;let i={event_id:r,...t};return this._process(()=>this.eventFromException(e,i).then(e=>this._captureEvent(e,i,n)).then(e=>e),`error`),i.event_id}captureMessage(e,t,n,r){let i={event_id:nl(),...n},a=gc(e)?e:String(e),o=K(e),s=o?this.eventFromMessage(a,t,i):this.eventFromException(e,i);return this._process(()=>s.then(e=>this._captureEvent(e,i,r)),o?`unknown`:`error`),i.event_id}captureEvent(e,t,n){let r=nl();if(t?.originalException&&sl(t.originalException))return Cs&&Vs.log(Kf),r;let i={event_id:r,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,c=rp(e.type);return this._process(()=>this._captureEvent(e,i,o||n,s),c),i.event_id}captureSession(e){this.sendSession(e),hl(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){let t=this._transport;if(this.emit(`flush`),!t)return!0;let n=await this._isClientDoneProcessing(e),r=await t.flush(e);return n&&r}async close(e){let t=await this.flush(e);return this.getOptions().enabled=!1,this.emit(`close`),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith(`Spotlight`)))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){let t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),df(this,e,this._integrations),t||uf(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=kf(e,this),r=fd(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])r=Qu(r,id(e));n&&(r=Qu(r,n)),this.sendEnvelope(r).then(t=>this.emit(`afterSendEvent`,e,t))}sendSession(e){let{release:t,environment:n=Gu}=this._options;if(`aggregates`in e){let r=e.attrs||{};if(!r.release&&!t){Cs&&Vs.warn(qf);return}r.release=r.release||t,r.environment=r.environment||n,e.attrs=r}else{if(!e.release&&!t){Cs&&Vs.warn(qf);return}e.release=e.release||t,e.environment=e.environment||n}this.emit(`beforeSendSession`,e);let r=dd(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(r)}recordDroppedEvent(e,t,n=1){if(this._options.sendClientReports){let r=`${e}:${t}`;Cs&&Vs.log(`Recording outcome: "${r}"${n>1?` (${n} times)`:``}`),this._outcomes[r]=(this._outcomes[r]||0)+n}}on(e,t){let n=this._hooks[e]=this._hooks[e]||new Set,r=(...e)=>t(...e);return n.add(r),()=>{n.delete(r)}}emit(e,...t){let n=this._hooks[e];n&&n.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return Cs&&Vs.error(`Error while sending envelope:`,e),{}}return Cs&&Vs.error(`Transport disabled`),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=lf(this,e),uf(this,e)}_updateSessionFromEvent(e,t){let n=t.level===`fatal`,r=!1,i=t.exception?.values;if(i){r=!0,n=!1;for(let e of i)if(e.mechanism?.handled===!1){n=!0;break}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(hl(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r){let i=this.getOptions(),a=this.getIntegrationNames();return!t.integrations&&a.length&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),e.type||r.setLastEventId(e.event_id||t.event_id),Ld(i,e,t,n,this,r).then(e=>e===null?e:(this.emit(`postprocessEvent`,e,t),e.contexts={trace:{...e.contexts?.trace,...Ql(n)},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Ju(this,n),...e.sdkProcessingMetadata},e))}_captureEvent(e,t={},n=ql(),r=Jl()){return Cs&&op(e)&&Vs.log(`Captured error event \`${zf(e)[0]||`<unknown>`}\``),this._processEvent(e,t,n,r).then(e=>e.event_id,e=>{Cs&&(ep(e)?Vs.log(e.message):$f(e)?Vs.warn(e.message):Vs.warn(e))})}_processEvent(e,t,n,r){let i=this.getOptions(),{sampleRate:a}=i,o=sp(e),s=op(e),c=`before send for type \`${e.type||`error`}\``,l=a===void 0?void 0:bu(a);if(s&&typeof l==`number`&&Nc()>l)return this.recordDroppedEvent(`sample_rate`,`error`),Od(Qf(`Discarding event because it's not included in the random sample (sampling rate = ${a})`));let u=rp(e.type);return this._prepareEvent(e,t,n,r).then(e=>{if(e===null)throw this.recordDroppedEvent(`event_processor`,u),Qf("An event processor returned `null`, will not send event.");return t.data?.__sentry__===!0?e:ip(ap(this,i,e,t),c)}).then(i=>{if(i===null){if(this.recordDroppedEvent(`before_send`,u),o){let t=1+(e.spans||[]).length;this.recordDroppedEvent(`before_send`,`span`,t)}throw Qf(`${c} returned \`null\`, will not send event.`)}let a=n.getSession()||r.getSession();if(s&&a&&this._updateSessionFromEvent(a,i),o){let e=(i.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(i.spans?i.spans.length:0);e>0&&this.recordDroppedEvent(`before_send`,`span`,e)}let l=i.transaction_info;return o&&l&&i.transaction!==e.transaction&&(i.transaction_info={...l,source:`custom`}),this.sendEvent(i,t),i}).then(null,e=>{throw ep(e)||$f(e)?e:(this.captureException(e,{mechanism:{handled:!1,type:`internal`},data:{__sentry__:!0},originalException:e}),Zf(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
44
+ Reason: ${e}`))})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===Af&&this.recordDroppedEvent(`queue_overflow`,t),e))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{let[n,r]=e.split(`:`);return{reason:n,category:r,quantity:t}})}_flushOutcomes(){Cs&&Vs.log(`Flushing outcomes...`);let e=this._clearOutcomes();if(e.length===0){Cs&&Vs.log(`No outcomes to send`);return}if(!this._dsn){Cs&&Vs.log(`No dsn provided, will not send outcomes`);return}Cs&&Vs.log(`Sending outcomes:`,e);let t=Rf(e,this._options.tunnel&&pu(this._dsn));this.sendEnvelope(t)}};function rp(e){return e===`replay_event`?`replay`:e||`error`}function ip(e,t){let n=`${t} must return \`null\` or a valid event.`;if(xc(e))return e.then(e=>{if(!_c(e)&&e!==null)throw Zf(n);return e},e=>{throw Zf(`${t} rejected with ${e}`)});if(!_c(e)&&e!==null)throw Zf(n);return e}function ap(e,t,n,r){let{beforeSend:i,beforeSendTransaction:a,ignoreSpans:o}=t,s=!Xu(t.beforeSendSpan)&&t.beforeSendSpan,c=n;if(op(c)&&i)return i(c,r);if(sp(c)){if(s||o){let t=Bf(c);if(o?.length&&zu({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){let e=s(t);e?c=vl(n,Vf(e)):Iu()}if(c.spans){let t=[],n=c.spans;for(let e of n){if(o?.length&&zu({description:e.description,op:e.op,attributes:e.data},o)){Vu(n,e);continue}if(s){let n=s(e);n?t.push(n):(Iu(),t.push(e))}else t.push(e)}let r=c.spans.length-t.length;r&&e.recordDroppedEvent(`before_send`,`span`,r),c.spans=t}}if(a){if(c.spans){let e=c.spans.length;c.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(c,r)}}return c}function op(e){return e.type===void 0}function sp(e){return e.type===`transaction`}function cp(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+up(e.attributes)}function lp(e){let t=0;return e.message&&(t+=e.message.length*2),t+up(e.attributes)}function up(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*dp(e[0]):K(e)?t+=dp(e):t+=100}),t}function dp(e){return typeof e==`string`?e.length*2:typeof e==`number`?8:typeof e==`boolean`?4:0}function fp(e,t){t.debug===!0&&(Cs?Vs.enable():Ms(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),ql().update(t.initialScope);let n=new e(t);return pp(n),n.init(),n}function pp(e){ql().setClient(e)}function mp(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}function hp(e,t=!0){if(e.startsWith(`data:`)){let n=e.match(/^data:([^;,]+)/),r=n?n[1]:`text/plain`,i=e.includes(`;base64,`),a=e.indexOf(`,`),o=``;if(t&&a!==-1){let t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${r}${i?`,base64`:``}${o?`,${o}`:``}`}return e}function gp(e){`aggregates`in e?e.attrs?.ip_address===void 0&&(e.attrs={...e.attrs,ip_address:`{{auto}}`}):e.ipAddress===void 0&&(e.ipAddress=`{{auto}}`)}function _p(e,t,n=[t],r=`npm`){let i=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};i.name||(i.name=`sentry.javascript.${t}`,i.packages=n.map(e=>({name:`${r}:@sentry/${e}`,version:Ts})),i.version=Ts)}var vp=100;function yp(e,t){let n=Zl(),r=Jl();if(!n)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=vp}=n.getOptions();if(a<=0)return;let o={timestamp:ul(),...e},s=i?Ms(()=>i(o,t)):o;s!==null&&(n.emit&&n.emit(`beforeAddBreadcrumb`,s,t),r.addBreadcrumb(s,a))}var bp=`FunctionToString`,xp=new WeakMap,Sp=ff((()=>({name:bp,setupOnce(){let e=Function.prototype.toString;try{Function.prototype.toString=new Proxy(e,{apply(e,t,n){let r=Dc(t),i=t;try{xp.has(Zl())&&r&&(i=r)}catch{}return Reflect.apply(e,i,n)}})}catch{}},setup(e){xp.set(e,!0)}}))),Cp=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],wp=`EventFilters`,Tp=ff((e={})=>{let t;return{name:wp,setup(n){t=Dp(e,n.getOptions())},processEvent(n,r,i){return t||=Dp(e,i.getOptions()),Op(n,t)?null:n}}}),Ep=ff(((e={})=>({...Tp(e),name:`InboundFilters`})));function Dp(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Cp],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function Op(e,t){if(!e.type){if(kp(e,t.ignoreErrors))return Cs&&Vs.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
45
+ Event: ${il(e)}`),!0;if(Fp(e))return Cs&&Vs.warn(`Event dropped due to not having an error message, error type or stacktrace.
46
+ Event: ${il(e)}`),!0;if(jp(e,t.denyUrls))return Cs&&Vs.warn(`Event dropped due to being matched by \`denyUrls\` option.
47
47
  Event: ${il(e)}.
48
- Url: ${Fp(e)}`),!0;if(!Np(e,t.allowUrls))return Cs&&Vs.warn(`Event dropped due to not being matched by \`allowUrls\` option.
48
+ Url: ${Pp(e)}`),!0;if(!Mp(e,t.allowUrls))return Cs&&Vs.warn(`Event dropped due to not being matched by \`allowUrls\` option.
49
49
  Event: ${il(e)}.
50
- Url: ${Fp(e)}`),!0}else if(e.type===`transaction`&&jp(e,t.ignoreTransactions))return Cs&&Vs.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
51
- Event: ${il(e)}`),!0;return!1}function Ap(e,t){return t?.length?zf(e).some(e=>Qc(e,t)):!1}function jp(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Qc(n,t):!1}function Mp(e,t){if(!t?.length)return!1;let n=Fp(e);return n?Qc(n,t):!1}function Np(e,t){if(!t?.length)return!0;let n=Fp(e);return!n||Qc(n,t)}function Pp(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function Fp(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Pp(t):null}catch{return Cs&&Vs.error(`Cannot extract url for event ${il(e)}`),null}}function Ip(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Lp(e,t,n,r,i,a){if(!i.exception?.values||!a||!Sc(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=Rp(e,t,r,a.originalException,n,i.exception.values,o,0))}function Rp(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(Sc(r[i],Error)){Bp(o,s,r);let a=e(t,r[i]),l=c.length;Vp(a,i,l,s),c=Rp(e,t,n,r[i],i,[a,...c],a,l)}return zp(r)&&r.errors.forEach((a,l)=>{if(Sc(a,Error)){Bp(o,s,r);let u=e(t,a),d=c.length;Vp(u,`errors[${l}]`,d,s),c=Rp(e,t,n,a,i,[u,...c],u,d)}}),c}function zp(e){return Array.isArray(e.errors)}function Bp(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...zp(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Vp(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}function Hp(e){return uc(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Up(e){return Hp(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}var Wp=new Set([]);function Gp(e){let t=`console`,n=ec(t,e);return tc(t,Kp),n}function Kp(){`console`in ws&&ks.forEach(function(e){e in ws.console&&wc(ws.console,e,function(t){return js[e]=t,function(...t){let n=t[0],r=js[e],i=Wp.size&&typeof n==`string`&&Qc(n,Wp);i||nc(`console`,{args:t,level:e}),(!i||Cs&&Vs.isEnabled())&&r?.apply(ws.console,t)}})})}function qp(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var Jp=`Dedupe`,Yp=ff((()=>{let e;return{name:Jp,processEvent(t){if(t.type)return t;try{if(Xp(t,e))return Cs&&Vs.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function Xp(e,t){return t?!!(Zp(e,t)||Qp(e,t)):!1}function Zp(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!em(e,t)||!$p(e,t))}function Qp(e,t){let n=tm(t),r=tm(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!em(e,t)||!$p(e,t))}function $p(e,t){let n=Zs(e),r=Zs(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function em(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join(``)===r.join(``)}catch{return!1}}function tm(e){return e.exception?.values?.[0]}var nm=`ConversationId`,rm=ff((()=>({name:nm,setup(e){e.on(`spanStart`,e=>{let t=ql().getScopeData(),n=Jl().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=Eu(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(ru,r)}})}})));function im(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}var am=ws;function om(){return`history`in am&&!!am.history}function sm(){if(!(`fetch`in am))return!1;try{return new Headers,new Request(`data:,`),new Response,!0}catch{return!1}}function cm(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function lm(){if(typeof EdgeRuntime==`string`)return!0;if(!sm())return!1;if(cm(am.fetch))return!0;let e=!1,t=am.document;if(t&&typeof t.createElement==`function`)try{let n=t.createElement(`iframe`);n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=cm(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Cs&&Vs.warn(`Could not create sandbox iframe for pure fetch check, bailing to window.fetch: `,e)}return e}function um(e,t){let n=`fetch`,r=ec(n,e);return tc(n,()=>dm(void 0,t)),r}function dm(e,t=!1){t&&!lm()||wc(ws,`fetch`,function(t){return function(...n){let r=Error(),{method:i,url:a}=mm(n),o={args:n,fetchData:{method:i,url:a},startTimestamp:pl()*1e3,virtualError:r,headers:hm(n)};return e||nc(`fetch`,{...o}),t.apply(ws,n).then(async t=>(e?e(t):nc(`fetch`,{...o,endTimestamp:pl()*1e3,response:t}),t),e=>{nc(`fetch`,{...o,endTimestamp:pl()*1e3,error:e}),uc(e)&&e.stack===void 0&&(e.stack=r.stack,Tc(e,`framesToPop`,1));let t=Zl()?.getOptions().enhanceFetchErrorMessages??`always`;if(t!==!1&&e instanceof TypeError&&(e.message===`Failed to fetch`||e.message===`Load failed`||e.message===`NetworkError when attempting to fetch resource.`))try{let n=new URL(o.fetchData.url).host;t===`always`?e.message=`${e.message} (${n})`:Tc(e,`__sentry_fetch_url_host__`,n)}catch{}throw e})}})}function fm(e,t){return vc(e)&&!!e[t]}function pm(e){return typeof e==`string`?e:e?fm(e,`url`)?e.url:e.toString?e.toString():``:``}function mm(e){if(e.length===0)return{method:`GET`,url:``};if(e.length===2){let[t,n]=e;return{url:pm(t),method:fm(n,`method`)?String(n.method).toUpperCase():Cc(t)&&fm(t,`method`)?String(t.method).toUpperCase():`GET`}}let t=e[0];return{url:pm(t),method:fm(t,`method`)?String(t.method).toUpperCase():`GET`}}function hm(e){let[t,n]=e;try{if(typeof n==`object`&&n&&`headers`in n&&n.headers)return new Headers(n.headers);if(Cc(t))return new Headers(t.headers)}catch{}}var gm=ws;function _m(){try{return gm.document.location.href}catch{return``}}function vm(e,t=5){if(!gm.HTMLElement)return null;let n=e;for(let e=0;e<t;e++){if(!n)return null;if(n instanceof HTMLElement){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}n=n.parentNode}return null}var ym=ws,bm=0;function xm(){return bm>0}function Sm(){bm++,setTimeout(()=>{bm--})}function Cm(e,t={}){function n(e){return typeof e==`function`}if(!n(e))return e;try{if(Object.prototype.hasOwnProperty.call(e,`__sentry_wrapped__`)){let t=e.__sentry_wrapped__;return typeof t==`function`?t:e}if(Dc(e))return e}catch{return e}let r=function(...n){ws._sentryWrappedDepth=(ws._sentryWrappedDepth||0)+1;try{let r=n.map(e=>Cm(e,t));return e.apply(this,r)}catch(e){throw Sm(),Xl(r=>{r.addEventProcessor(e=>(t.mechanism&&(al(e,void 0,void 0),ol(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),Jd(e)}),e}finally{ws._sentryWrappedDepth=(ws._sentryWrappedDepth||0)-1}};try{for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch{}Ec(r,e),Tc(e,`__sentry_wrapped__`,r);try{Object.getOwnPropertyDescriptor(r,`name`).configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function wm(){let e=_m(),{referrer:t}=ym.document||{},{userAgent:n}=ym.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}function Tm(e,t){let n=Om(e,t),r={type:Nm(t),value:Pm(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===``&&(r.value=`Unrecoverable error caught`),r}function Em(e,t,n,r){let i=Zl()?.getOptions().normalizeDepth,a=Vm(t),o={__serialized__:Hc(t,i)};if(a)return{exception:{values:[Tm(e,a)]},extra:o};let s={exception:{values:[{type:yc(t)?t.constructor.name:r?`UnhandledRejection`:`Error`,value:zm(t,{isUnhandledRejection:r})}]},extra:o};if(n){let t=Om(e,n);t.length&&(s.exception.values[0].stacktrace={frames:t})}return s}function Dm(e,t){return{exception:{values:[Tm(e,t)]}}}function Om(e,t){let n=t.stacktrace||t.stack||``,r=Am(t),i=jm(t);try{return e(n,r,i)}catch{}return[]}var km=/Minified React error #\d+;/i;function Am(e){return e&&km.test(e.message)?1:0}function jm(e){return typeof e.framesToPop==`number`?e.framesToPop:0}function Mm(e){return typeof WebAssembly<`u`&&WebAssembly.Exception!==void 0&&e instanceof WebAssembly.Exception}function Nm(e){let t=e?.name;return!t&&Mm(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:`WebAssembly.Exception`:t}function Pm(e){let t=e?.message;return Mm(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:`wasm exception`:t?t.error&&typeof t.error.message==`string`?Up(t.error):Up(e):`No error message`}function Fm(e,t,n,r){let i=Lm(e,t,n?.syntheticException||void 0,r);return ol(i),i.level=`error`,n?.event_id&&(i.event_id=n.event_id),Dd(i)}function Im(e,t,n=`info`,r,i){let a=Rm(e,t,r?.syntheticException||void 0,i);return a.level=n,r?.event_id&&(a.event_id=r.event_id),Dd(a)}function Lm(e,t,n,r,i){let a;if(fc(t)&&t.error)return Dm(e,t.error);if(pc(t)||mc(t)){let i=t;if(`stack`in t){a=Dm(e,t);let i=a.exception?.values?.[0];if(r&&n&&i&&!i.stacktrace){let t=Om(e,n);t.length&&(i.stacktrace={frames:t},ol(a,{synthetic:!0}))}}else{let t=i.name||(pc(i)?`DOMError`:`DOMException`),o=i.message?`${t}: ${i.message}`:t;a=Rm(e,o,n,r),al(a,o)}return`code`in i&&(a.tags={...a.tags,"DOMException.code":`${i.code}`}),a}return uc(t)?Dm(e,t):_c(t)||yc(t)?(a=Em(e,t,n,i),ol(a,{synthetic:!0}),a):(a=Rm(e,t,n,r),al(a,`${t}`,void 0),ol(a,{synthetic:!0}),a)}function Rm(e,t,n,r){let i={};if(r&&n){let r=Om(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),ol(i,{synthetic:!0})}if(gc(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function zm(e,{isUnhandledRejection:t}){let n=Ac(e),r=t?`promise rejection`:`exception`;return fc(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:yc(e)?`Event \`${Bm(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Bm(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Vm(e){return Object.values(e).find(e=>e instanceof Error)}var Hm=class extends np{constructor(e){let t=Um(e);_p(t,`browser`,[`browser`],ym.SENTRY_SDK_SOURCE||mf()),super(t);let{userInfo:n}=this.getDataCollectionOptions();t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:n?`auto`:`never`,...t._metadata.sdk.settings});let{sendClientReports:r}=this._options;ym.document&&ym.document.addEventListener(`visibilitychange`,()=>{ym.document.visibilityState===`hidden`&&(r&&this._flushOutcomes(),queueMicrotask(()=>{this.flush()}))}),n&&this.on(`beforeSendSession`,gp)}eventFromException(e,t){return Fm(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t=`info`,n){return Im(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||`javascript`,super._prepareEvent(e,t,n,r)}};function Um(e){return{release:typeof __SENTRY_RELEASE__==`string`?__SENTRY_RELEASE__:ym.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}var Wm=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Gm=ws;function Km(e,t,n){Gm.document&&Gm.addEventListener(e,t,n)}function qm(e,t,n){Gm.document&&Gm.removeEventListener(e,t,n)}var Jm=e=>{let t=!1;return()=>{t||=(e(),!0)}},Ym=e=>{let t=Gm.requestIdleCallback||Gm.setTimeout;Gm.document?.visibilityState===`hidden`?e():(e=Jm(e),Km(`visibilitychange`,e,{once:!0,capture:!0}),Km(`pagehide`,e,{once:!0,capture:!0}),t(()=>{e(),qm(`visibilitychange`,e,{capture:!0}),qm(`pagehide`,e,{capture:!0})}))},Xm=80,Zm={};try{typeof Node<`u`&&(Zm.parentNode=Object.getOwnPropertyDescriptor(Node.prototype,`parentNode`).get),typeof Element<`u`&&(Zm.tagName=Object.getOwnPropertyDescriptor(Element.prototype,`tagName`).get,Zm.id=Object.getOwnPropertyDescriptor(Element.prototype,`id`).get,Zm.className=Object.getOwnPropertyDescriptor(Element.prototype,`className`).get,Zm.getAttribute=Element.prototype.getAttribute),typeof HTMLElement<`u`&&(Zm.dataset=Object.getOwnPropertyDescriptor(HTMLElement.prototype,`dataset`).get)}catch{}function Qm(e,t,n){let r=Zm[t];if(r)try{return r.call(e,n)}catch{}let i=e[t];return typeof i==`function`?i.call(e,n):i}function $m(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||Xm;for(;n&&i++<5&&(o=eh(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=Qm(n,`parentNode`);return r.reverse().join(` > `)}catch{return`<unknown>`}}function eh(e,t){let n=[],r=Qm(e,`tagName`);if(!r)return``;if(typeof HTMLElement<`u`&&e instanceof HTMLElement){let t=Qm(e,`dataset`);if(t){if(t.sentryComponent)return t.sentryComponent;if(t.sentryElement)return t.sentryElement}}n.push(r.toLowerCase());let i=t?.length?t.filter(t=>Qm(e,`getAttribute`,t)).map(t=>[t,Qm(e,`getAttribute`,t)]):null;if(i?.length)i.forEach(e=>{n.push(`[${e[0]}="${e[1]}"]`)});else{let t=Qm(e,`id`);t&&n.push(`#${t}`);let r=Qm(e,`className`);if(r&&hc(r)){let e=r.split(/\s+/);for(let t of e)n.push(`.${t}`)}}for(let t of[`aria-label`,`type`,`name`,`title`,`alt`]){let r=Qm(e,`getAttribute`,t);r&&n.push(`[${t}="${r}"]`)}return n.join(``)}var th=1e3,nh,rh,ih;function ah(e){ec(`dom`,e),tc(`dom`,oh)}function oh(){if(!Gm.document)return;let e=nc.bind(null,`dom`),t=lh(e,!0);Gm.document.addEventListener(`click`,t,!1),Gm.document.addEventListener(`keypress`,t,!1),[`EventTarget`,`Node`].forEach(t=>{let n=Gm[t]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(wc(n,`addEventListener`,function(t){return function(n,r,i){if(n===`click`||n==`keypress`)try{let r=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},a=r[n]=r[n]||{refCount:0};if(!a.handler){let r=lh(e);a.handler=r,t.call(this,n,r,i)}a.refCount++}catch{}return t.call(this,n,r,i)}}),wc(n,`removeEventListener`,function(e){return function(t,n,r){if(t===`click`||t==`keypress`)try{let n=this.__sentry_instrumentation_handlers__||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),Object.keys(n).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function sh(e){if(e.type!==rh)return!1;try{if(!e.target||e.target._sentryId!==ih)return!1}catch{}return!0}function ch(e,t){return e===`keypress`?!t?.tagName||!(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable):!1}function lh(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;let r=uh(n);if(ch(n.type,r))return;Tc(n,`_sentryCaptured`,!0),r&&!r._sentryId&&Tc(r,`_sentryId`,nl());let i=n.type===`keypress`?`input`:n.type;sh(n)||(e({event:n,name:i,global:t}),rh=n.type,ih=r?r._sentryId:void 0),clearTimeout(nh),nh=Gm.setTimeout(()=>{ih=void 0,rh=void 0},th)}}function uh(e){try{return e.target}catch{return null}}var dh;function fh(e){let t=`history`;ec(t,e),tc(t,ph)}function ph(){if(Gm.addEventListener(`popstate`,()=>{let e=Gm.location.href,t=dh;dh=e,t!==e&&nc(`history`,{from:t,to:e})}),!om())return;function e(e){return function(...t){let n=t.length>2?t[2]:void 0;if(n){let r=dh,i=mh(String(n));if(dh=i,r===i)return e.apply(this,t);nc(`history`,{from:r,to:i})}return e.apply(this,t)}}wc(Gm.history,`pushState`,e),wc(Gm.history,`replaceState`,e)}function mh(e){try{return new URL(e,Gm.location.origin).toString()}catch{return e}}var hh={};function gh(e){let t=hh[e];if(t)return t;let n=Gm[e];if(cm(n))return hh[e]=n.bind(Gm);let r=Gm.document;if(r&&typeof r.createElement==`function`)try{let t=r.createElement(`iframe`);t.hidden=!0,r.head.appendChild(t);let i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){Wm&&Vs.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n&&(hh[e]=n.bind(Gm))}function _h(e){hh[e]=void 0}var vh=`__sentry_xhr_v3__`;function yh(e){ec(`xhr`,e),tc(`xhr`,bh)}function bh(){if(!Gm.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){let r=Error(),i=pl()*1e3,a=hc(n[0])?n[0].toUpperCase():void 0,o=xh(n[1]);if(!a||!o)return e.apply(t,n);t[vh]={method:a,url:o,request_headers:{}},a===`POST`&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);let s=()=>{let e=t[vh];if(e&&t.readyState===4){try{e.status_code=t.status}catch{}nc(`xhr`,{endTimestamp:pl()*1e3,startTimestamp:i,xhr:t,virtualError:r})}};return`onreadystatechange`in t&&typeof t.onreadystatechange==`function`?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(e,t,n){return s(),e.apply(t,n)}}):t.addEventListener(`readystatechange`,s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){let[r,i]=n,a=t[vh];return a&&hc(r)&&hc(i)&&(a.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){let r=t[vh];return r?(n[0]!==void 0&&(r.body=n[0]),nc(`xhr`,{startTimestamp:pl()*1e3,xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function xh(e){if(hc(e))return e;try{return e.toString()}catch{}}function Sh(e){if(typeof Element>`u`)return!1;try{return e instanceof Element}catch{return!1}}var Ch=40;function wh(e,t=gh(`fetch`)){let n=0,r=0;async function i(i){let a=i.body.length;n+=a,r++;let o={body:i.body,method:`POST`,referrerPolicy:`strict-origin`,headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{let n=await t(e.url,o);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get(`X-Sentry-Rate-Limits`),"retry-after":n.headers.get(`Retry-After`)}}}catch(e){throw _h(`fetch`),e}finally{n-=a,r--}}return Lf(e,i,jf(e.bufferSize||Ch))}var Th=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Eh=30,Dh=50;function Oh(e,t,n,r){let i={filename:e,function:t===`<anonymous>`?`?`:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}var kh=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ah=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,jh=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mh=/at (.+?) ?\(data:(.+?),/,Nh=[Eh,e=>{let t=e.match(Mh);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};let n=kh.exec(e);if(n){let[,e,t,r]=n;return Oh(e,`?`,+t,+r)}let r=Ah.exec(e);if(r){if(r[2]?.indexOf(`eval`)===0){let e=jh.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,t]=Lh(r[1]||`?`,r[2]);return Oh(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],Ph=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Fh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ih=Gs(Nh,[Dh,e=>{let t=Ph.exec(e);if(t){if(t[3]&&t[3].indexOf(` > eval`)>-1){let e=Fh.exec(t[3]);e&&(t[1]=t[1]||`eval`,t[3]=e[1],t[4]=e[2],t[5]=``)}let e=t[3],n=t[1]||`?`;return[n,e]=Lh(n,e),Oh(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Lh=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?`?`:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Rh=1024,zh=`Breadcrumbs`,Bh=ff(((e={})=>{let t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:zh,setup(e){t.console&&Gp(Uh(e)),t.dom&&ah(Hh(e,t.dom)),t.xhr&&yh(Wh(e)),t.fetch&&um(Gh(e)),t.history&&fh(Kh(e)),t.sentry&&e.on(`beforeSendEvent`,Vh(e))}}}));function Vh(e){return function(t){Zl()===e&&yp({category:`sentry.${t.type===`transaction`?`transaction`:`event`}`,event_id:t.event_id,level:t.level,message:il(t)},{event:t})}}function Hh(e,t){return function(n){if(Zl()!==e)return;let r,i,a=typeof t==`object`?t.serializeAttribute:void 0,o=typeof t==`object`&&typeof t.maxStringLength==`number`?t.maxStringLength:void 0;o&&o>Rh&&(Th&&Vs.warn(`\`dom.maxStringLength\` cannot exceed ${Rh}, but a value of ${o} was configured. Sentry will use ${Rh} instead.`),o=Rh),typeof a==`string`&&(a=[a]);try{let e=n.event,t=qh(e)?e.target:e;r=$m(t,{keyAttrs:a,maxStringLength:o}),i=vm(t)}catch{r=`<unknown>`}if(r.length===0)return;let s={category:`ui.${n.name}`,message:r};i&&(s.data={"ui.component_name":i}),yp(s,{event:n.event,name:n.name,global:n.global})}}function Uh(e){return function(t){if(Zl()!==e)return;let n={category:`console`,data:{arguments:t.args,logger:`console`},level:qp(t.level),message:Xc(t.args,` `)};if(t.level===`assert`)if(t.args[0]===!1)n.message=`Assertion failed: ${Xc(t.args.slice(1),` `)||`console.assert`}`,n.data.arguments=t.args.slice(1);else return;yp(n,{input:t.args,level:t.level})}}function Wh(e){return function(t){if(Zl()!==e)return;let{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[vh];if(!n||!r||!i)return;let{method:a,url:o,status_code:s,body:c}=i,l={method:a,url:o,status_code:s},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:`xhr`,data:l,type:`http`,level:im(s)};e.emit(`beforeOutgoingRequestBreadcrumb`,d,u),yp(d,u)}}function Gh(e){return function(t){if(Zl()!==e)return;let{startTimestamp:n,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method===`POST`))if(t.error){let i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},a={category:`fetch`,data:t.fetchData,level:`error`,type:`http`};e.emit(`beforeOutgoingRequestBreadcrumb`,a,i),yp(a,i)}else{let i=t.response,a={...t.fetchData,status_code:i?.status},o={input:t.args,response:i,startTimestamp:n,endTimestamp:r},s={category:`fetch`,data:a,type:`http`,level:im(a.status_code)};e.emit(`beforeOutgoingRequestBreadcrumb`,s,o),yp(s,o)}}}function Kh(e){return function(t){if(Zl()!==e)return;let n=t.from,r=t.to,i=mp(ym.location.href),a=n?mp(n):void 0,o=mp(r);a?.path||(a=i),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),i.protocol===a.protocol&&i.host===a.host&&(n=a.relative),yp({category:`navigation`,data:{from:n,to:r}})}}function qh(e){return!!e&&!!e.target}var Jh=`EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload`.split(`,`),Yh=`BrowserApiErrors`,Xh=ff(((e={})=>{let t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:Yh,setupOnce(){t.setTimeout&&wc(ym,`setTimeout`,Zh),t.setInterval&&wc(ym,`setInterval`,Zh),t.requestAnimationFrame&&wc(ym,`requestAnimationFrame`,Qh),t.XMLHttpRequest&&`XMLHttpRequest`in ym&&wc(XMLHttpRequest.prototype,`send`,$h);let e=t.eventTarget;e&&(Array.isArray(e)?e:Jh).forEach(e=>eg(e,t))}}}));function Zh(e){return function(...t){let n=t[0];return t[0]=Cm(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Xs(e)}`}}),e.apply(this,t)}}function Qh(e){return function(t){return e.apply(this,[Cm(t,{mechanism:{data:{handler:Xs(e)},handled:!1,type:`auto.browser.browserapierrors.requestAnimationFrame`}})])}}function $h(e){return function(...t){let n=this;return[`onload`,`onerror`,`onprogress`,`onreadystatechange`].forEach(e=>{e in n&&typeof n[e]==`function`&&wc(n,e,function(t){let n={mechanism:{data:{handler:Xs(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Dc(t);return r&&(n.mechanism.data.handler=Xs(r)),Cm(t,n)})}),e.apply(this,t)}}function eg(e,t){let n=ym[e]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(wc(n,`addEventListener`,function(n){return function(r,i,a){try{tg(i)&&(i.handleEvent=Cm(i.handleEvent,{mechanism:{data:{handler:Xs(i),target:e},handled:!1,type:`auto.browser.browserapierrors.handleEvent`}}))}catch{}return t.unregisterOriginalCallbacks&&ng(this,r,i),n.apply(this,[r,Cm(i,{mechanism:{data:{handler:Xs(i),target:e},handled:!1,type:`auto.browser.browserapierrors.addEventListener`}}),a])}}),wc(n,`removeEventListener`,function(e){return function(t,n,r){try{if(Object.prototype.hasOwnProperty.call(n,`__sentry_wrapped__`)){let i=n.__sentry_wrapped__;i&&e.call(this,t,i,r)}}catch{}return e.call(this,t,n,r)}}))}function tg(e){return typeof e.handleEvent==`function`}function ng(e,t,n){e&&typeof e==`object`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`&&e.removeEventListener(t,n)}var rg=ff((e={})=>{let t=e.lifecycle??`route`;return{name:`BrowserSession`,setupOnce(){if(ym.document===void 0){Th&&Vs.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Xd({ignoreDuration:!0});let e=!1;Ym(()=>{e||=($d(),!0)});let n=Jl(),r=n.getUser();n.addScopeListener(t=>{let n=t.getUser();(r?.id!==n?.id||r?.ip_address!==n?.ip_address)&&(r=n,e&&$d())}),t===`route`&&fh(({from:t,to:n})=>{t!==n&&(Xd({ignoreDuration:!0}),$d(),e=!0)})}}}),ig=`CultureContext`,ag=ff((()=>({name:ig,preprocessEvent(e){let t=og();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){let t=og();t&&Cd(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}})));function og(){try{let e=ym.Intl;if(!e)return;let t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}var sg=`GlobalHandlers`,cg=ff(((e={})=>{let t={onerror:!0,onunhandledrejection:!0,...e};return{name:sg,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(lg(e),mg(`onerror`)),t.onunhandledrejection&&(ug(e),mg(`onunhandledrejection`))}}}));function lg(e){ic(t=>{let{stackParser:n,attachStacktrace:r}=hg();if(Zl()!==e||xm())return;let{msg:i,url:a,line:o,column:s,error:c}=t,l=pg(Lm(n,c||i,void 0,r,!1),a,o,s);l.level=`error`,Yd(l,{originalException:c,mechanism:{handled:!1,type:`auto.browser.global_handlers.onerror`}})})}function ug(e){sc(t=>{let{stackParser:n,attachStacktrace:r}=hg();if(Zl()!==e||xm())return;let i=dg(t),a=K(i)?fg(i):Lm(n,i,void 0,r,!0);a.level=`error`,Yd(a,{originalException:i,mechanism:{handled:!1,type:`auto.browser.global_handlers.onunhandledrejection`}})})}function dg(e){if(K(e))return e;try{if(`reason`in e)return e.reason;if(`detail`in e&&`reason`in e.detail)return e.detail.reason}catch{}return e}function fg(e){return{exception:{values:[{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function pg(e,t,n,r){let i=e.exception=e.exception||{},a=i.values=i.values||[],o=a[0]=a[0]||{},s=o.stacktrace=o.stacktrace||{},c=s.frames=s.frames||[];return c.length===0&&c.push({colno:r,lineno:n,filename:gg(t)??_m(),function:`?`,in_app:!0}),e}function mg(e){Th&&Vs.log(`Global Handler attached: ${e}`)}function hg(){return Zl()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function gg(e){if(!(!hc(e)||e.length===0))return e.startsWith(`data:`)?`<${hp(e,!1)}>`:e}var _g=ff(()=>({name:`HttpContext`,preprocessEvent(e){if(!ym.navigator&&!ym.location&&!ym.document)return;let t=wm(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){let t=e.attributes?.[$l];if(!ym.navigator&&!ym.location&&!ym.document)return;let n=wm();Cd(e,{"url.full":t===`http.client`?void 0:n.url,"http.request.header.user_agent":n.headers[`User-Agent`],"http.request.header.referer":n.headers.Referer})}})),vg=`cause`,yg=5,bg=`LinkedErrors`,xg=ff(((e={})=>{let t=e.limit||yg,n=e.key||vg;return{name:bg,preprocessEvent(e,r,i){Lp(Tm,i.getOptions().stackParser,n,t,e,r)}}})),Sg=/^HTML(\w*)Element$/;function Cg(e){if(typeof window<`u`&&e===window)return`[Window]`;if(typeof document<`u`&&e===document)return`[Document]`;if(Sh(e)){let t=wg(e);if(Sg.test(t))return`[HTMLElement: ${$m(e)}]`}}function wg(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Tg(){return Eg()?(Th&&Ms(()=>{console.error(`[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/`)}),!0):!1}function Eg(){if(ym.window===void 0)return!1;let e=ym;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;let t=_m();return!(ym===ym.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(t))}function Dg(e){return[Dp(),Cp(),rm(),Xh(),Bh(),cg(),xg(),Yp(),_g(),ag(),rg()]}function Og(e={}){let t=!e.skipBrowserExtensionCheck&&Tg(),n=e.defaultIntegrations==null?Dg():e.defaultIntegrations,r={...e,enabled:!t&&e.enabled,stackParser:Ks(e.stackParser||Ih),integrations:cf({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||wh};return Bc(Cg),fp(Hm,r)}var q=dn;function kg(e){return(0,z.jsx)(vr,{...e,defaultTheme:Zo,themeId:d})}function Ag(e){return function(t){return(0,z.jsx)(kg,{styles:typeof e==`function`?n=>e({theme:n,...t}):e})}}function jg(){return br}var Mg=ia;function J(e){return Qi(e)}function Ng(e){return V(`MuiSvgIcon`,e)}H(`MuiSvgIcon`,[`root`,`colorPrimary`,`colorSecondary`,`colorAction`,`colorError`,`colorDisabled`,`fontSizeInherit`,`fontSizeSmall`,`fontSizeMedium`,`fontSizeLarge`]);var Pg=e=>{let{color:t,fontSize:n,classes:r}=e;return U({root:[`root`,t!==`inherit`&&`color${q(t)}`,`fontSize${q(n)}`]},Ng,r)},Fg=G(`svg`,{name:`MuiSvgIcon`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!==`inherit`&&t[`color${q(n.color)}`],t[`fontSize${q(n.fontSize)}`]]}})(Mg(({theme:e})=>({userSelect:`none`,width:`1em`,height:`1em`,display:`inline-block`,flexShrink:0,transition:e.transitions?.create?.(`fill`,{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:e=>!e.hasSvgAsChild,style:{fill:`currentColor`}},{props:{fontSize:`inherit`},style:{fontSize:`inherit`}},{props:{fontSize:`small`},style:{fontSize:e.typography?.pxToRem?.(20)||`1.25rem`}},{props:{fontSize:`medium`},style:{fontSize:e.typography?.pxToRem?.(24)||`1.5rem`}},{props:{fontSize:`large`},style:{fontSize:e.typography?.pxToRem?.(35)||`2.1875rem`}},...Object.entries((e.vars??e).palette).filter(([,e])=>e&&e.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:`action`},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:`disabled`},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:`inherit`},style:{color:void 0}}]}))),Ig=R.forwardRef(function(e,t){let n=J({props:e,name:`MuiSvgIcon`}),{children:r,className:i,color:a=`inherit`,component:o=`svg`,fontSize:s=`medium`,htmlColor:c,inheritViewBox:l=!1,titleAccess:u,viewBox:d=`0 0 24 24`,...f}=n,p=R.isValidElement(r)&&r.type===`svg`,m={...n,color:a,component:o,fontSize:s,instanceFontSize:e.fontSize,inheritViewBox:l,viewBox:d,hasSvgAsChild:p},h={};l||(h.viewBox=d);let g=Pg(m);return(0,z.jsxs)(Fg,{as:o,className:B(g.root,i),focusable:`false`,color:c,"aria-hidden":!u||void 0,role:u?`img`:void 0,ref:t,...h,...f,...p&&r.props,ownerState:m,children:[p?r.props.children:r,u?(0,z.jsx)(`title`,{children:u}):null]})});Ig.muiName=`SvgIcon`;function Y(e,t){function n(n,r){return(0,z.jsx)(Ig,{"data-testid":`${t}Icon`,ref:r,...n,children:e})}return n.muiName=Ig.muiName,R.memo(R.forwardRef(n))}var Lg=fi,Rg=pi,zg=mi,Bg=hi,Vg=Hr,Hg=bi,Ug=xi,Wg=Si,Gg=Ci;function Kg(e,t){if(!e)return t;if(typeof e==`function`||typeof t==`function`)return n=>{let r=typeof t==`function`?t(n):t,i=typeof e==`function`?e({...n,...r}):e,a=B(n?.className,r?.className,i?.className);return{...r,...i,...!!a&&{className:a},...r?.style&&i?.style&&{style:{...r.style,...i.style}},...r?.sx&&i?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(i.sx)?i.sx:[i.sx]]}}};let n=t,r=B(n?.className,e?.className);return{...t,...e,...!!r&&{className:r},...n?.style&&e?.style&&{style:{...n.style,...e.style}},...n?.sx&&e?.sx&&{sx:[...Array.isArray(n.sx)?n.sx:[n.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}function qg(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Jg(e,t){return Jg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jg(e,t)}function Yg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Jg(e,t)}var Xg=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Zg=o(((e,t)=>{t.exports=Xg()})),Qg=o((e=>{var t=m(),n=Zg();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function h(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function x(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(g(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,C=Symbol.for(`react.element`),w=Symbol.for(`react.portal`),T=Symbol.for(`react.fragment`),E=Symbol.for(`react.strict_mode`),D=Symbol.for(`react.profiler`),O=Symbol.for(`react.provider`),k=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),j=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),F=Symbol.for(`react.offscreen`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var I=Object.assign,ne;function re(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``}return`
50
+ Url: ${Pp(e)}`),!0}else if(e.type===`transaction`&&Ap(e,t.ignoreTransactions))return Cs&&Vs.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
51
+ Event: ${il(e)}`),!0;return!1}function kp(e,t){return t?.length?zf(e).some(e=>Qc(e,t)):!1}function Ap(e,t){if(!t?.length)return!1;let n=e.transaction;return n?Qc(n,t):!1}function jp(e,t){if(!t?.length)return!1;let n=Pp(e);return n?Qc(n,t):!1}function Mp(e,t){if(!t?.length)return!0;let n=Pp(e);return!n||Qc(n,t)}function Np(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function Pp(e){try{let t=[...e.exception?.values??[]].reverse().find(e=>e.mechanism?.parent_id===void 0&&e.stacktrace?.frames?.length)?.stacktrace?.frames;return t?Np(t):null}catch{return Cs&&Vs.error(`Cannot extract url for event ${il(e)}`),null}}function Fp(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&e.type!==`Error`||e.value):!1}function Ip(e,t,n,r,i,a){if(!i.exception?.values||!a||!Sc(a.originalException,Error))return;let o=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;o&&(i.exception.values=Lp(e,t,r,a.originalException,n,i.exception.values,o,0))}function Lp(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(Sc(r[i],Error)){zp(o,s,r);let a=e(t,r[i]),l=c.length;Bp(a,i,l,s),c=Lp(e,t,n,r[i],i,[a,...c],a,l)}return Rp(r)&&r.errors.forEach((a,l)=>{if(Sc(a,Error)){zp(o,s,r);let u=e(t,a),d=c.length;Bp(u,`errors[${l}]`,d,s),c=Lp(e,t,n,a,i,[u,...c],u,d)}}),c}function Rp(e){return Array.isArray(e.errors)}function zp(e,t,n){e.mechanism={handled:!0,type:`auto.core.linked_errors`,...Rp(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Bp(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}function Vp(e){return uc(e)&&`__sentry_fetch_url_host__`in e&&typeof e.__sentry_fetch_url_host__==`string`}function Hp(e){return Vp(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}var Up=new Set([]);function Wp(e){let t=`console`,n=ec(t,e);return tc(t,Kp),n}var Gp=new Set;function Kp(){`console`in ws&&ks.forEach(function(e){Gp.has(e)||!(e in ws.console)||(Gp.add(e),wc(ws.console,e,function(t){return js[e]=t,function(...t){let n=t[0],r=js[e],i=Up.size&&typeof n==`string`&&Qc(n,Up);i||nc(`console`,{args:t,level:e}),(!i||Cs&&Vs.isEnabled())&&r?.apply(ws.console,t)}}))})}function qp(e){return e===`warn`?`warning`:[`fatal`,`error`,`warning`,`log`,`info`,`debug`].includes(e)?e:`log`}var Jp=`Dedupe`,Yp=ff((()=>{let e;return{name:Jp,processEvent(t){if(t.type)return t;try{if(Xp(t,e))return Cs&&Vs.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}}));function Xp(e,t){return t?!!(Zp(e,t)||Qp(e,t)):!1}function Zp(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!em(e,t)||!$p(e,t))}function Qp(e,t){let n=tm(t),r=tm(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!em(e,t)||!$p(e,t))}function $p(e,t){let n=Zs(e),r=Zs(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function em(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join(``)===r.join(``)}catch{return!1}}function tm(e){return e.exception?.values?.[0]}var nm=`ConversationId`,rm=ff((()=>({name:nm,setup(e){e.on(`spanStart`,e=>{let t=ql().getScopeData(),n=Jl().getScopeData(),r=t.conversationId||n.conversationId;if(r){let{op:t,data:n,description:i}=Eu(e);if(!t?.startsWith(`gen_ai.`)&&!n[`ai.operationId`]&&!i?.startsWith(`ai.`))return;e.setAttribute(ru,r)}})}})));function im(e){if(e!==void 0){if(e>=400&&e<500)return`warning`;if(e>=500)return`error`}}var am=ws;function om(){return`history`in am&&!!am.history}function sm(){if(!(`fetch`in am))return!1;try{return new Headers,new Request(`data:,`),new Response,!0}catch{return!1}}function cm(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function lm(){if(typeof EdgeRuntime==`string`)return!0;if(!sm())return!1;if(cm(am.fetch))return!0;let e=!1,t=am.document;if(t&&typeof t.createElement==`function`)try{let n=t.createElement(`iframe`);n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=cm(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Cs&&Vs.warn(`Could not create sandbox iframe for pure fetch check, bailing to window.fetch: `,e)}return e}function um(e,t){let n=`fetch`,r=ec(n,e);return tc(n,()=>dm(void 0,t)),r}function dm(e,t=!1){t&&!lm()||wc(ws,`fetch`,function(t){return function(...n){let r=Error(),{method:i,url:a}=mm(n),o={args:n,fetchData:{method:i,url:a},startTimestamp:pl()*1e3,virtualError:r,headers:hm(n)};return e||nc(`fetch`,{...o}),t.apply(ws,n).then(async t=>(e?e(t):nc(`fetch`,{...o,endTimestamp:pl()*1e3,response:t}),t),e=>{nc(`fetch`,{...o,endTimestamp:pl()*1e3,error:e}),uc(e)&&e.stack===void 0&&(e.stack=r.stack,Tc(e,`framesToPop`,1));let t=Zl()?.getOptions().enhanceFetchErrorMessages??`always`;if(t!==!1&&e instanceof TypeError&&(e.message===`Failed to fetch`||e.message===`Load failed`||e.message===`NetworkError when attempting to fetch resource.`))try{let n=new URL(o.fetchData.url).host;t===`always`?e.message=`${e.message} (${n})`:Tc(e,`__sentry_fetch_url_host__`,n)}catch{}throw e})}})}function fm(e,t){return vc(e)&&!!e[t]}function pm(e){return typeof e==`string`?e:e?fm(e,`url`)?e.url:e.toString?e.toString():``:``}function mm(e){if(e.length===0)return{method:`GET`,url:``};if(e.length===2){let[t,n]=e;return{url:pm(t),method:fm(n,`method`)?String(n.method).toUpperCase():Cc(t)&&fm(t,`method`)?String(t.method).toUpperCase():`GET`}}let t=e[0];return{url:pm(t),method:fm(t,`method`)?String(t.method).toUpperCase():`GET`}}function hm(e){let[t,n]=e;try{if(typeof n==`object`&&n&&`headers`in n&&n.headers)return new Headers(n.headers);if(Cc(t))return new Headers(t.headers)}catch{}}var gm=ws;function _m(){try{return gm.document.location.href}catch{return``}}function vm(e,t=5){if(!gm.HTMLElement)return null;let n=e;for(let e=0;e<t;e++){if(!n)return null;if(n instanceof HTMLElement){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}n=n.parentNode}return null}var ym=ws,bm=0;function xm(){return bm>0}function Sm(){bm++,setTimeout(()=>{bm--})}function Cm(e,t={}){function n(e){return typeof e==`function`}if(!n(e))return e;try{if(Object.prototype.hasOwnProperty.call(e,`__sentry_wrapped__`)){let t=e.__sentry_wrapped__;return typeof t==`function`?t:e}if(Dc(e))return e}catch{return e}let r=function(...n){ws._sentryWrappedDepth=(ws._sentryWrappedDepth||0)+1;try{let r=n.map(e=>Cm(e,t));return e.apply(this,r)}catch(e){throw Sm(),Xl(r=>{r.addEventProcessor(e=>(t.mechanism&&(al(e,void 0,void 0),ol(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),Jd(e)}),e}finally{ws._sentryWrappedDepth=(ws._sentryWrappedDepth||0)-1}};try{for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch{}Ec(r,e),Tc(e,`__sentry_wrapped__`,r);try{Object.getOwnPropertyDescriptor(r,`name`).configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function wm(){let e=_m(),{referrer:t}=ym.document||{},{userAgent:n}=ym.navigator||{};return{url:e,headers:{...t&&{Referer:t},...n&&{"User-Agent":n}}}}function Tm(e,t){let n=Om(e,t),r={type:Nm(t),value:Pm(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===``&&(r.value=`Unrecoverable error caught`),r}function Em(e,t,n,r){let i=Zl()?.getOptions().normalizeDepth,a=Vm(t),o={__serialized__:Hc(t,i)};if(a)return{exception:{values:[Tm(e,a)]},extra:o};let s={exception:{values:[{type:yc(t)?t.constructor.name:r?`UnhandledRejection`:`Error`,value:zm(t,{isUnhandledRejection:r})}]},extra:o};if(n){let t=Om(e,n);t.length&&(s.exception.values[0].stacktrace={frames:t})}return s}function Dm(e,t){return{exception:{values:[Tm(e,t)]}}}function Om(e,t){let n=t.stacktrace||t.stack||``,r=Am(t),i=jm(t);try{return e(n,r,i)}catch{}return[]}var km=/Minified React error #\d+;/i;function Am(e){return e&&km.test(e.message)?1:0}function jm(e){return typeof e.framesToPop==`number`?e.framesToPop:0}function Mm(e){return typeof WebAssembly<`u`&&WebAssembly.Exception!==void 0&&e instanceof WebAssembly.Exception}function Nm(e){let t=e?.name;return!t&&Mm(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:`WebAssembly.Exception`:t}function Pm(e){let t=e?.message;return Mm(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:`wasm exception`:t?t.error&&typeof t.error.message==`string`?Hp(t.error):Hp(e):`No error message`}function Fm(e,t,n,r){let i=Lm(e,t,n?.syntheticException||void 0,r);return ol(i),i.level=`error`,n?.event_id&&(i.event_id=n.event_id),Dd(i)}function Im(e,t,n=`info`,r,i){let a=Rm(e,t,r?.syntheticException||void 0,i);return a.level=n,r?.event_id&&(a.event_id=r.event_id),Dd(a)}function Lm(e,t,n,r,i){let a;if(fc(t)&&t.error)return Dm(e,t.error);if(pc(t)||mc(t)){let i=t;if(`stack`in t){a=Dm(e,t);let i=a.exception?.values?.[0];if(r&&n&&i&&!i.stacktrace){let t=Om(e,n);t.length&&(i.stacktrace={frames:t},ol(a,{synthetic:!0}))}}else{let t=i.name||(pc(i)?`DOMError`:`DOMException`),o=i.message?`${t}: ${i.message}`:t;a=Rm(e,o,n,r),al(a,o)}return`code`in i&&(a.tags={...a.tags,"DOMException.code":`${i.code}`}),a}return uc(t)?Dm(e,t):_c(t)||yc(t)?(a=Em(e,t,n,i),ol(a,{synthetic:!0}),a):(a=Rm(e,t,n,r),al(a,`${t}`,void 0),ol(a,{synthetic:!0}),a)}function Rm(e,t,n,r){let i={};if(r&&n){let r=Om(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]}),ol(i,{synthetic:!0})}if(gc(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function zm(e,{isUnhandledRejection:t}){let n=Ac(e),r=t?`promise rejection`:`exception`;return fc(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:yc(e)?`Event \`${Bm(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Bm(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function Vm(e){return Object.values(e).find(e=>e instanceof Error)}var Hm=class extends np{constructor(e){let t=Um(e);_p(t,`browser`,[`browser`],ym.SENTRY_SDK_SOURCE||mf()),super(t);let{userInfo:n}=this.getDataCollectionOptions();t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:n?`auto`:`never`,...t._metadata.sdk.settings});let{sendClientReports:r}=this._options;ym.document&&ym.document.addEventListener(`visibilitychange`,()=>{ym.document.visibilityState===`hidden`&&(r&&this._flushOutcomes(),queueMicrotask(()=>{this.flush()}))}),n&&this.on(`beforeSendSession`,gp)}eventFromException(e,t){return Fm(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t=`info`,n){return Im(this._options.stackParser,e,t,n,this._options.attachStacktrace)}_prepareEvent(e,t,n,r){return e.platform=e.platform||`javascript`,super._prepareEvent(e,t,n,r)}};function Um(e){return{release:typeof __SENTRY_RELEASE__==`string`?__SENTRY_RELEASE__:ym.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}var Wm=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Gm=ws;function Km(e,t,n){Gm.document&&Gm.addEventListener(e,t,n)}function qm(e,t,n){Gm.document&&Gm.removeEventListener(e,t,n)}var Jm=e=>{let t=!1;return()=>{t||=(e(),!0)}},Ym=e=>{let t=Gm.requestIdleCallback||Gm.setTimeout;Gm.document?.visibilityState===`hidden`?e():(e=Jm(e),Km(`visibilitychange`,e,{once:!0,capture:!0}),Km(`pagehide`,e,{once:!0,capture:!0}),t(()=>{e(),qm(`visibilitychange`,e,{capture:!0}),qm(`pagehide`,e,{capture:!0})}))},Xm=80,Zm={};try{typeof Node<`u`&&(Zm.parentNode=Object.getOwnPropertyDescriptor(Node.prototype,`parentNode`).get),typeof Element<`u`&&(Zm.tagName=Object.getOwnPropertyDescriptor(Element.prototype,`tagName`).get,Zm.id=Object.getOwnPropertyDescriptor(Element.prototype,`id`).get,Zm.className=Object.getOwnPropertyDescriptor(Element.prototype,`className`).get,Zm.getAttribute=Element.prototype.getAttribute),typeof HTMLElement<`u`&&(Zm.dataset=Object.getOwnPropertyDescriptor(HTMLElement.prototype,`dataset`).get)}catch{}function Qm(e,t,n){let r=Zm[t];if(r)try{return r.call(e,n)}catch{}let i=e[t];return typeof i==`function`?i.call(e,n):i}function $m(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||Xm;for(;n&&i++<5&&(o=eh(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=Qm(n,`parentNode`);return r.reverse().join(` > `)}catch{return`<unknown>`}}function eh(e,t){let n=[],r=Qm(e,`tagName`);if(!r)return``;if(typeof HTMLElement<`u`&&e instanceof HTMLElement){let t=Qm(e,`dataset`);if(t){if(t.sentryComponent)return t.sentryComponent;if(t.sentryElement)return t.sentryElement}}n.push(r.toLowerCase());let i=t?.length?t.filter(t=>Qm(e,`getAttribute`,t)).map(t=>[t,Qm(e,`getAttribute`,t)]):null;if(i?.length)i.forEach(e=>{n.push(`[${e[0]}="${e[1]}"]`)});else{let t=Qm(e,`id`);t&&n.push(`#${t}`);let r=Qm(e,`className`);if(r&&hc(r)){let e=r.split(/\s+/);for(let t of e)n.push(`.${t}`)}}for(let t of[`aria-label`,`type`,`name`,`title`,`alt`]){let r=Qm(e,`getAttribute`,t);r&&n.push(`[${t}="${r}"]`)}return n.join(``)}var th=1e3,nh,rh,ih;function ah(e){ec(`dom`,e),tc(`dom`,oh)}function oh(){if(!Gm.document)return;let e=nc.bind(null,`dom`),t=lh(e,!0);Gm.document.addEventListener(`click`,t,!1),Gm.document.addEventListener(`keypress`,t,!1),[`EventTarget`,`Node`].forEach(t=>{let n=Gm[t]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(wc(n,`addEventListener`,function(t){return function(n,r,i){if(n===`click`||n==`keypress`)try{let r=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},a=r[n]=r[n]||{refCount:0};if(!a.handler){let r=lh(e);a.handler=r,t.call(this,n,r,i)}a.refCount++}catch{}return t.call(this,n,r,i)}}),wc(n,`removeEventListener`,function(e){return function(t,n,r){if(t===`click`||t==`keypress`)try{let n=this.__sentry_instrumentation_handlers__||{},i=n[t];i&&(i.refCount--,i.refCount<=0&&(e.call(this,t,i.handler,r),i.handler=void 0,delete n[t]),Object.keys(n).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function sh(e){if(e.type!==rh)return!1;try{if(!e.target||e.target._sentryId!==ih)return!1}catch{}return!0}function ch(e,t){return e===`keypress`?!t?.tagName||!(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable):!1}function lh(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;let r=uh(n);if(ch(n.type,r))return;Tc(n,`_sentryCaptured`,!0),r&&!r._sentryId&&Tc(r,`_sentryId`,nl());let i=n.type===`keypress`?`input`:n.type;sh(n)||(e({event:n,name:i,global:t}),rh=n.type,ih=r?r._sentryId:void 0),clearTimeout(nh),nh=Gm.setTimeout(()=>{ih=void 0,rh=void 0},th)}}function uh(e){try{return e.target}catch{return null}}var dh;function fh(e){let t=`history`;ec(t,e),tc(t,ph)}function ph(){if(Gm.addEventListener(`popstate`,()=>{let e=Gm.location.href,t=dh;dh=e,t!==e&&nc(`history`,{from:t,to:e})}),!om())return;function e(e){return function(...t){let n=t.length>2?t[2]:void 0;if(n){let r=dh,i=mh(String(n));if(dh=i,r===i)return e.apply(this,t);nc(`history`,{from:r,to:i})}return e.apply(this,t)}}wc(Gm.history,`pushState`,e),wc(Gm.history,`replaceState`,e)}function mh(e){try{return new URL(e,Gm.location.origin).toString()}catch{return e}}var hh={};function gh(e){let t=hh[e];if(t)return t;let n=Gm[e];if(cm(n))return hh[e]=n.bind(Gm);let r=Gm.document;if(r&&typeof r.createElement==`function`)try{let t=r.createElement(`iframe`);t.hidden=!0,r.head.appendChild(t);let i=t.contentWindow;i?.[e]&&(n=i[e]),r.head.removeChild(t)}catch(t){Wm&&Vs.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return n&&(hh[e]=n.bind(Gm))}function _h(e){hh[e]=void 0}var vh=`__sentry_xhr_v3__`;function yh(e){ec(`xhr`,e),tc(`xhr`,bh)}function bh(){if(!Gm.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,n){let r=Error(),i=pl()*1e3,a=hc(n[0])?n[0].toUpperCase():void 0,o=xh(n[1]);if(!a||!o)return e.apply(t,n);t[vh]={method:a,url:o,request_headers:{}},a===`POST`&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);let s=()=>{let e=t[vh];if(e&&t.readyState===4){try{e.status_code=t.status}catch{}nc(`xhr`,{endTimestamp:pl()*1e3,startTimestamp:i,xhr:t,virtualError:r}),t.removeEventListener(`readystatechange`,s)}};return`onreadystatechange`in t&&typeof t.onreadystatechange==`function`?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply(e,t,n){return s(),e.apply(t,n)}}):t.addEventListener(`readystatechange`,s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,n){let[r,i]=n,a=t[vh];return a&&hc(r)&&hc(i)&&(a.request_headers[r.toLowerCase()]=i),e.apply(t,n)}}),e.apply(t,n)}}),e.send=new Proxy(e.send,{apply(e,t,n){let r=t[vh];return r?(n[0]!==void 0&&(r.body=n[0]),nc(`xhr`,{startTimestamp:pl()*1e3,xhr:t}),e.apply(t,n)):e.apply(t,n)}})}function xh(e){if(hc(e))return e;try{return e.toString()}catch{}}function Sh(e){if(typeof Element>`u`)return!1;try{return e instanceof Element}catch{return!1}}var Ch=40;function wh(e,t=gh(`fetch`)){let n=0,r=0;async function i(i){let a=i.body.length;n+=a,r++;let o={body:i.body,method:`POST`,referrerPolicy:`strict-origin`,headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{let n=await t(e.url,o);return{statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get(`X-Sentry-Rate-Limits`),"retry-after":n.headers.get(`Retry-After`)}}}catch(e){throw _h(`fetch`),e}finally{n-=a,r--}}return Lf(e,i,jf(e.bufferSize||Ch))}var Th=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Eh=30,Dh=50;function Oh(e,t,n,r){let i={filename:e,function:t===`<anonymous>`?`?`:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}var kh=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ah=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,jh=/\((\S*)(?::(\d+))(?::(\d+))\)/,Mh=/at (.+?) ?\(data:(.+?),/,Nh=[Eh,e=>{let t=e.match(Mh);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};let n=kh.exec(e);if(n){let[,e,t,r]=n;return Oh(e,`?`,+t,+r)}let r=Ah.exec(e);if(r){if(r[2]?.indexOf(`eval`)===0){let e=jh.exec(r[2]);e&&(r[2]=e[1],r[3]=e[2],r[4]=e[3])}let[e,t]=Lh(r[1]||`?`,r[2]);return Oh(t,e,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}}],Ph=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Fh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ih=Gs(Nh,[Dh,e=>{let t=Ph.exec(e);if(t){if(t[3]&&t[3].indexOf(` > eval`)>-1){let e=Fh.exec(t[3]);e&&(t[1]=t[1]||`eval`,t[3]=e[1],t[4]=e[2],t[5]=``)}let e=t[3],n=t[1]||`?`;return[n,e]=Lh(n,e),Oh(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Lh=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?`?`:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Rh=1024,zh=`Breadcrumbs`,Bh=ff(((e={})=>{let t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:zh,setup(e){t.console&&Wp(Uh(e)),t.dom&&ah(Hh(e,t.dom)),t.xhr&&yh(Wh(e)),t.fetch&&um(Gh(e)),t.history&&fh(Kh(e)),t.sentry&&e.on(`beforeSendEvent`,Vh(e))}}}));function Vh(e){return function(t){Zl()===e&&yp({category:`sentry.${t.type===`transaction`?`transaction`:`event`}`,event_id:t.event_id,level:t.level,message:il(t)},{event:t})}}function Hh(e,t){return function(n){if(Zl()!==e)return;let r,i,a=typeof t==`object`?t.serializeAttribute:void 0,o=typeof t==`object`&&typeof t.maxStringLength==`number`?t.maxStringLength:void 0;o&&o>Rh&&(Th&&Vs.warn(`\`dom.maxStringLength\` cannot exceed ${Rh}, but a value of ${o} was configured. Sentry will use ${Rh} instead.`),o=Rh),typeof a==`string`&&(a=[a]);try{let e=n.event,t=qh(e)?e.target:e;r=$m(t,{keyAttrs:a,maxStringLength:o}),i=vm(t)}catch{r=`<unknown>`}if(r.length===0)return;let s={category:`ui.${n.name}`,message:r};i&&(s.data={"ui.component_name":i}),yp(s,{event:n.event,name:n.name,global:n.global})}}function Uh(e){return function(t){if(Zl()!==e)return;let n={category:`console`,data:{arguments:t.args,logger:`console`},level:qp(t.level),message:Xc(t.args,` `)};if(t.level===`assert`)if(t.args[0]===!1)n.message=`Assertion failed: ${Xc(t.args.slice(1),` `)||`console.assert`}`,n.data.arguments=t.args.slice(1);else return;yp(n,{input:t.args,level:t.level})}}function Wh(e){return function(t){if(Zl()!==e)return;let{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[vh];if(!n||!r||!i)return;let{method:a,url:o,status_code:s,body:c}=i,l={method:a,url:o,status_code:s},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r},d={category:`xhr`,data:l,type:`http`,level:im(s)};e.emit(`beforeOutgoingRequestBreadcrumb`,d,u),yp(d,u)}}function Gh(e){return function(t){if(Zl()!==e)return;let{startTimestamp:n,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method===`POST`))if(t.error){let i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r},a={category:`fetch`,data:t.fetchData,level:`error`,type:`http`};e.emit(`beforeOutgoingRequestBreadcrumb`,a,i),yp(a,i)}else{let i=t.response,a={...t.fetchData,status_code:i?.status},o={input:t.args,response:i,startTimestamp:n,endTimestamp:r},s={category:`fetch`,data:a,type:`http`,level:im(a.status_code)};e.emit(`beforeOutgoingRequestBreadcrumb`,s,o),yp(s,o)}}}function Kh(e){return function(t){if(Zl()!==e)return;let n=t.from,r=t.to,i=mp(ym.location.href),a=n?mp(n):void 0,o=mp(r);a?.path||(a=i),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),i.protocol===a.protocol&&i.host===a.host&&(n=a.relative),yp({category:`navigation`,data:{from:n,to:r}})}}function qh(e){return!!e&&!!e.target}var Jh=`EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload`.split(`,`),Yh=`BrowserApiErrors`,Xh=ff(((e={})=>{let t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:Yh,setupOnce(){t.setTimeout&&wc(ym,`setTimeout`,Zh),t.setInterval&&wc(ym,`setInterval`,Zh),t.requestAnimationFrame&&wc(ym,`requestAnimationFrame`,Qh),t.XMLHttpRequest&&`XMLHttpRequest`in ym&&wc(XMLHttpRequest.prototype,`send`,$h);let e=t.eventTarget;e&&(Array.isArray(e)?e:Jh).forEach(e=>eg(e,t))}}}));function Zh(e){return function(...t){let n=t[0];return t[0]=Cm(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${Xs(e)}`}}),e.apply(this,t)}}function Qh(e){return function(t){return e.apply(this,[Cm(t,{mechanism:{data:{handler:Xs(e)},handled:!1,type:`auto.browser.browserapierrors.requestAnimationFrame`}})])}}function $h(e){return function(...t){let n=this;return[`onload`,`onerror`,`onprogress`,`onreadystatechange`].forEach(e=>{e in n&&typeof n[e]==`function`&&wc(n,e,function(t){let n={mechanism:{data:{handler:Xs(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},r=Dc(t);return r&&(n.mechanism.data.handler=Xs(r)),Cm(t,n)})}),e.apply(this,t)}}function eg(e,t){let n=ym[e]?.prototype;n?.hasOwnProperty?.(`addEventListener`)&&(wc(n,`addEventListener`,function(n){return function(r,i,a){try{tg(i)&&(i.handleEvent=Cm(i.handleEvent,{mechanism:{data:{handler:Xs(i),target:e},handled:!1,type:`auto.browser.browserapierrors.handleEvent`}}))}catch{}return t.unregisterOriginalCallbacks&&ng(this,r,i),n.apply(this,[r,Cm(i,{mechanism:{data:{handler:Xs(i),target:e},handled:!1,type:`auto.browser.browserapierrors.addEventListener`}}),a])}}),wc(n,`removeEventListener`,function(e){return function(t,n,r){try{if(Object.prototype.hasOwnProperty.call(n,`__sentry_wrapped__`)){let i=n.__sentry_wrapped__;i&&e.call(this,t,i,r)}}catch{}return e.call(this,t,n,r)}}))}function tg(e){return typeof e.handleEvent==`function`}function ng(e,t,n){e&&typeof e==`object`&&`removeEventListener`in e&&typeof e.removeEventListener==`function`&&e.removeEventListener(t,n)}var rg=ff((e={})=>{let t=e.lifecycle??`route`;return{name:`BrowserSession`,setupOnce(){if(ym.document===void 0){Th&&Vs.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Xd({ignoreDuration:!0});let e=!1;Ym(()=>{e||=($d(),!0)});let n=Jl(),r=n.getUser();n.addScopeListener(t=>{let n=t.getUser();(r?.id!==n?.id||r?.ip_address!==n?.ip_address)&&(r=n,e&&$d())}),t===`route`&&fh(({from:t,to:n})=>{t!==n&&(Xd({ignoreDuration:!0}),$d(),e=!0)})}}}),ig=`CultureContext`,ag=ff((()=>({name:ig,preprocessEvent(e){let t=og();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){let t=og();t&&Cd(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}})));function og(){try{let e=ym.Intl;if(!e)return;let t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}var sg=`GlobalHandlers`,cg=ff(((e={})=>{let t={onerror:!0,onunhandledrejection:!0,...e};return{name:sg,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(lg(e),mg(`onerror`)),t.onunhandledrejection&&(ug(e),mg(`onunhandledrejection`))}}}));function lg(e){ic(t=>{let{stackParser:n,attachStacktrace:r}=hg();if(Zl()!==e||xm())return;let{msg:i,url:a,line:o,column:s,error:c}=t,l=pg(Lm(n,c||i,void 0,r,!1),a,o,s);l.level=`error`,Yd(l,{originalException:c,mechanism:{handled:!1,type:`auto.browser.global_handlers.onerror`}})})}function ug(e){sc(t=>{let{stackParser:n,attachStacktrace:r}=hg();if(Zl()!==e||xm())return;let i=dg(t),a=K(i)?fg(i):Lm(n,i,void 0,r,!0);a.level=`error`,Yd(a,{originalException:i,mechanism:{handled:!1,type:`auto.browser.global_handlers.onunhandledrejection`}})})}function dg(e){if(K(e))return e;try{if(`reason`in e)return e.reason;if(`detail`in e&&`reason`in e.detail)return e.detail.reason}catch{}return e}function fg(e){return{exception:{values:[{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function pg(e,t,n,r){let i=e.exception=e.exception||{},a=i.values=i.values||[],o=a[0]=a[0]||{},s=o.stacktrace=o.stacktrace||{},c=s.frames=s.frames||[];return c.length===0&&c.push({colno:r,lineno:n,filename:gg(t)??_m(),function:`?`,in_app:!0}),e}function mg(e){Th&&Vs.log(`Global Handler attached: ${e}`)}function hg(){return Zl()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function gg(e){if(!(!hc(e)||e.length===0))return e.startsWith(`data:`)?`<${hp(e,!1)}>`:e}var _g=ff(()=>({name:`HttpContext`,preprocessEvent(e){if(!ym.navigator&&!ym.location&&!ym.document)return;let t=wm(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}},processSegmentSpan(e){let t=e.attributes?.[$l];if(!ym.navigator&&!ym.location&&!ym.document)return;let n=wm();Cd(e,{"url.full":t===`http.client`?void 0:n.url,"http.request.header.user_agent":n.headers[`User-Agent`],"http.request.header.referer":n.headers.Referer})}})),vg=`cause`,yg=5,bg=`LinkedErrors`,xg=ff(((e={})=>{let t=e.limit||yg,n=e.key||vg;return{name:bg,preprocessEvent(e,r,i){Ip(Tm,i.getOptions().stackParser,n,t,e,r)}}})),Sg=/^HTML(\w*)Element$/;function Cg(e){if(typeof window<`u`&&e===window)return`[Window]`;if(typeof document<`u`&&e===document)return`[Document]`;if(Sh(e)){let t=wg(e);if(Sg.test(t))return`[HTMLElement: ${$m(e)}]`}}function wg(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:`null prototype`}function Tg(){return Eg()?(Th&&Ms(()=>{console.error(`[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/`)}),!0):!1}function Eg(){if(ym.window===void 0)return!1;let e=ym;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;let t=_m();return!(ym===ym.top&&/^(?:chrome-extension|moz-extension|ms-browser-extension|safari-web-extension):\/\//.test(t))}function Dg(e){return[Ep(),Sp(),rm(),Xh(),Bh(),cg(),xg(),Yp(),_g(),ag(),rg()]}function Og(e={}){let t=!e.skipBrowserExtensionCheck&&Tg(),n=e.defaultIntegrations==null?Dg():e.defaultIntegrations,r={...e,enabled:!t&&e.enabled,stackParser:Ks(e.stackParser||Ih),integrations:cf({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||wh};return Bc(Cg),fp(Hm,r)}var q=dn;function kg(e){return(0,z.jsx)(vr,{...e,defaultTheme:Zo,themeId:d})}function Ag(e){return function(t){return(0,z.jsx)(kg,{styles:typeof e==`function`?n=>e({theme:n,...t}):e})}}function jg(){return br}var Mg=ia;function J(e){return Qi(e)}function Ng(e){return V(`MuiSvgIcon`,e)}H(`MuiSvgIcon`,[`root`,`colorPrimary`,`colorSecondary`,`colorAction`,`colorError`,`colorDisabled`,`fontSizeInherit`,`fontSizeSmall`,`fontSizeMedium`,`fontSizeLarge`]);var Pg=e=>{let{color:t,fontSize:n,classes:r}=e;return U({root:[`root`,t!==`inherit`&&`color${q(t)}`,`fontSize${q(n)}`]},Ng,r)},Fg=G(`svg`,{name:`MuiSvgIcon`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!==`inherit`&&t[`color${q(n.color)}`],t[`fontSize${q(n.fontSize)}`]]}})(Mg(({theme:e})=>({userSelect:`none`,width:`1em`,height:`1em`,display:`inline-block`,flexShrink:0,transition:e.transitions?.create?.(`fill`,{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:e=>!e.hasSvgAsChild,style:{fill:`currentColor`}},{props:{fontSize:`inherit`},style:{fontSize:`inherit`}},{props:{fontSize:`small`},style:{fontSize:e.typography?.pxToRem?.(20)||`1.25rem`}},{props:{fontSize:`medium`},style:{fontSize:e.typography?.pxToRem?.(24)||`1.5rem`}},{props:{fontSize:`large`},style:{fontSize:e.typography?.pxToRem?.(35)||`2.1875rem`}},...Object.entries((e.vars??e).palette).filter(([,e])=>e&&e.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:`action`},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:`disabled`},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:`inherit`},style:{color:void 0}}]}))),Ig=R.forwardRef(function(e,t){let n=J({props:e,name:`MuiSvgIcon`}),{children:r,className:i,color:a=`inherit`,component:o=`svg`,fontSize:s=`medium`,htmlColor:c,inheritViewBox:l=!1,titleAccess:u,viewBox:d=`0 0 24 24`,...f}=n,p=R.isValidElement(r)&&r.type===`svg`,m={...n,color:a,component:o,fontSize:s,instanceFontSize:e.fontSize,inheritViewBox:l,viewBox:d,hasSvgAsChild:p},h={};l||(h.viewBox=d);let g=Pg(m);return(0,z.jsxs)(Fg,{as:o,className:B(g.root,i),focusable:`false`,color:c,"aria-hidden":!u||void 0,role:u?`img`:void 0,ref:t,...h,...f,...p&&r.props,ownerState:m,children:[p?r.props.children:r,u?(0,z.jsx)(`title`,{children:u}):null]})});Ig.muiName=`SvgIcon`;function Y(e,t){function n(n,r){return(0,z.jsx)(Ig,{"data-testid":`${t}Icon`,ref:r,...n,children:e})}return n.muiName=Ig.muiName,R.memo(R.forwardRef(n))}var Lg=fi,Rg=pi,zg=mi,Bg=hi,Vg=Hr,Hg=bi,Ug=xi,Wg=Si,Gg=Ci;function Kg(e,t){if(!e)return t;if(typeof e==`function`||typeof t==`function`)return n=>{let r=typeof t==`function`?t(n):t,i=typeof e==`function`?e({...n,...r}):e,a=B(n?.className,r?.className,i?.className);return{...r,...i,...!!a&&{className:a},...r?.style&&i?.style&&{style:{...r.style,...i.style}},...r?.sx&&i?.sx&&{sx:[...Array.isArray(r.sx)?r.sx:[r.sx],...Array.isArray(i.sx)?i.sx:[i.sx]]}}};let n=t,r=B(n?.className,e?.className);return{...t,...e,...!!r&&{className:r},...n?.style&&e?.style&&{style:{...n.style,...e.style}},...n?.sx&&e?.sx&&{sx:[...Array.isArray(n.sx)?n.sx:[n.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}function qg(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Jg(e,t){return Jg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jg(e,t)}function Yg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Jg(e,t)}var Xg=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Zg=o(((e,t)=>{t.exports=Xg()})),Qg=o((e=>{var t=m(),n=Zg();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function h(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function g(e,t,n,r){if(t==null||h(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){v[e]=new _(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];v[t]=new _(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){v[e]=new _(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){v[e]=new _(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){v[e]=new _(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){v[e]=new _(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){v[e]=new _(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){v[e]=new _(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){v[e]=new _(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(y,b);v[t]=new _(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new _(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){v[e]=new _(e,1,!1,e.toLowerCase(),null,!0,!0)});function x(e,t,n,r){var i=v.hasOwnProperty(t)?v[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(g(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,C=Symbol.for(`react.element`),w=Symbol.for(`react.portal`),T=Symbol.for(`react.fragment`),E=Symbol.for(`react.strict_mode`),D=Symbol.for(`react.profiler`),O=Symbol.for(`react.provider`),k=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),j=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),F=Symbol.for(`react.offscreen`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var I=Object.assign,ne;function re(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``}return`
52
52
  `+ne+e}var ie=!1;function ae(e,t){if(!e||ie)return``;ie=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
53
53
  `),a=r.stack.split(`
54
54
  `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
@@ -646,8 +646,8 @@ body {
646
646
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PH(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function FH(e){if(Array.isArray(e))return HH(e)}function IH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function LH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?IH(Object(n),!0).forEach(function(t){RH(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function RH(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zH(e,t){return WH(e)||UH(e,t)||VH(e,t)||BH()}function BH(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
647
647
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VH(e,t){if(e){if(typeof e==`string`)return HH(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return HH(e,t)}}function HH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function UH(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function WH(e){if(Array.isArray(e))return e}var GH=typeof jH.default==`function`?jH.default:jH.default.default,KH=`file-invalid-type`,qH=`file-too-large`,JH=`file-too-small`,YH=`too-many-files`,XH=function(){var e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:``).split(`,`);return{code:KH,message:`File type must be ${e.length>1?`one of ${e.join(`, `)}`:e[0]}`}},ZH=function(e){return{code:qH,message:`File is larger than ${e} ${e===1?`byte`:`bytes`}`}},QH=function(e){return{code:JH,message:`File is smaller than ${e} ${e===1?`byte`:`bytes`}`}},$H={code:YH,message:`Too many files`};function eU(e){return e.type===``&&typeof e.getAsFile==`function`}function tU(e,t){var n=e.type===`application/x-moz-file`||GH(e,t)||eU(e);return[n,n?null:XH(t)]}function nU(e,t,n){if(rU(e.size)){if(rU(t)&&rU(n)){if(e.size>n)return[!1,ZH(n)];if(e.size<t)return[!1,QH(t)]}else if(rU(t)&&e.size<t)return[!1,QH(t)];else if(rU(n)&&e.size>n)return[!1,ZH(n)]}return[!0,null]}function rU(e){return e!=null}function iU(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,a=e.multiple,o=e.maxFiles,s=e.validator;return!a&&t.length>1||a&&o>=1&&t.length>o?!1:t.every(function(e){var t=zH(tU(e,n),1)[0],a=zH(nU(e,r,i),1)[0],o=s?s(e):null;return t&&a&&!o})}function aU(e){return typeof e.isPropagationStopped==`function`?e.isPropagationStopped():e.cancelBubble!==void 0&&e.cancelBubble}function oU(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(e){return e===`Files`||e===`application/x-moz-file`}):!!e.target&&!!e.target.files}function sU(e){e.preventDefault()}function cU(e){return e.indexOf(`MSIE`)!==-1||e.indexOf(`Trident/`)!==-1}function lU(e){return e.indexOf(`Edge/`)!==-1}function uU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return cU(e)||lU(e)}function dU(){var e=[...arguments];return function(t){var n=[...arguments].slice(1);return e.some(function(e){return!aU(t)&&e&&e.apply(void 0,[t].concat(n)),aU(t)})}}function fU(){return`showOpenFilePicker`in window}function pU(e){return rU(e)?[{description:`Files`,accept:Object.entries(e).filter(function(e){var t=zH(e,2),n=t[0],r=t[1],i=!0;return _U(n)||(console.warn(`Skipped "${n}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),i=!1),(!Array.isArray(r)||!r.every(vU))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),i=!1),i}).reduce(function(e,t){var n=zH(t,2),r=n[0],i=n[1];return LH(LH({},e),{},RH({},r,i))},{})}]:e}function mU(e){if(rU(e))return Object.entries(e).reduce(function(e,t){var n=zH(t,2),r=n[0],i=n[1];return[].concat(MH(e),[r],MH(i))},[]).filter(function(e){return _U(e)||vU(e)}).join(`,`)}function hU(e){return e instanceof DOMException&&(e.name===`AbortError`||e.code===e.ABORT_ERR)}function gU(e){return e instanceof DOMException&&(e.name===`SecurityError`||e.code===e.SECURITY_ERR)}function _U(e){return e===`audio/*`||e===`video/*`||e===`image/*`||e===`text/*`||e===`application/*`||/\w+\/[-+.\w]+/g.test(e)}function vU(e){return/^.*\.[\w]+$/.test(e)}var yU=[`children`],bU=[`open`],xU=[`refKey`,`role`,`onKeyDown`,`onFocus`,`onBlur`,`onClick`,`onDragEnter`,`onDragOver`,`onDragLeave`,`onDrop`],SU=[`refKey`,`onChange`,`onClick`];function CU(e){return EU(e)||TU(e)||kU(e)||wU()}function wU(){throw TypeError(`Invalid attempt to spread non-iterable instance.
648
648
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TU(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function EU(e){if(Array.isArray(e))return AU(e)}function DU(e,t){return MU(e)||jU(e,t)||kU(e,t)||OU()}function OU(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
649
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kU(e,t){if(e){if(typeof e==`string`)return AU(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return AU(e,t)}}function AU(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function jU(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function MU(e){if(Array.isArray(e))return e}function NU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function PU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?NU(Object(n),!0).forEach(function(t){FU(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FU(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IU(e,t){if(e==null)return{};var n=LU(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function LU(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var RU=(0,R.forwardRef)(function(e,t){var n=e.children,r=VU(IU(e,yU)),i=r.open,a=IU(r,bU);return(0,R.useImperativeHandle)(t,function(){return{open:i}},[i]),R.createElement(R.Fragment,null,n(PU(PU({},a),{},{open:i})))});RU.displayName=`Dropzone`;var zU={disabled:!1,getFilesFromEvent:gH,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};RU.defaultProps=zU,RU.propTypes={children:Z.default.func,accept:Z.default.objectOf(Z.default.arrayOf(Z.default.string)),multiple:Z.default.bool,preventDropOnDocument:Z.default.bool,noClick:Z.default.bool,noKeyboard:Z.default.bool,noDrag:Z.default.bool,noDragEventsBubbling:Z.default.bool,minSize:Z.default.number,maxSize:Z.default.number,maxFiles:Z.default.number,disabled:Z.default.bool,getFilesFromEvent:Z.default.func,onFileDialogCancel:Z.default.func,onFileDialogOpen:Z.default.func,useFsAccessApi:Z.default.bool,autoFocus:Z.default.bool,onDragEnter:Z.default.func,onDragLeave:Z.default.func,onDragOver:Z.default.func,onDrop:Z.default.func,onDropAccepted:Z.default.func,onDropRejected:Z.default.func,onError:Z.default.func,validator:Z.default.func};var BU={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function VU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=PU(PU({},zU),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,c=t.maxFiles,l=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,m=t.onDropRejected,h=t.onFileDialogCancel,g=t.onFileDialogOpen,_=t.useFsAccessApi,v=t.autoFocus,y=t.preventDropOnDocument,b=t.noClick,x=t.noKeyboard,S=t.noDrag,C=t.noDragEventsBubbling,w=t.onError,T=t.validator,E=(0,R.useMemo)(function(){return mU(n)},[n]),D=(0,R.useMemo)(function(){return pU(n)},[n]),O=(0,R.useMemo)(function(){return typeof g==`function`?g:UU},[g]),k=(0,R.useMemo)(function(){return typeof h==`function`?h:UU},[h]),A=(0,R.useRef)(null),j=(0,R.useRef)(null),M=DU((0,R.useReducer)(HU,BU),2),N=M[0],P=M[1],F=N.isFocused,ee=N.isFileDialogActive,te=(0,R.useRef)(typeof window<`u`&&window.isSecureContext&&_&&fU()),I=function(){!te.current&&ee&&setTimeout(function(){j.current&&(j.current.files.length||(P({type:`closeDialog`}),k()))},300)};(0,R.useEffect)(function(){return window.addEventListener(`focus`,I,!1),function(){window.removeEventListener(`focus`,I,!1)}},[j,ee,k,te]);var ne=(0,R.useRef)([]),re=(0,R.useRef)([]),ie=function(e){A.current&&A.current.contains(e.target)||(e.preventDefault(),ne.current=[])};(0,R.useEffect)(function(){return y&&(document.addEventListener(`dragover`,sU,!1),document.addEventListener(`drop`,ie,!1)),function(){y&&(document.removeEventListener(`dragover`,sU),document.removeEventListener(`drop`,ie))}},[A,y]),(0,R.useEffect)(function(){var e=function(e){re.current=[].concat(CU(re.current),[e.target]),oU(e)&&P({isDragGlobal:!0,type:`setDragGlobal`})},t=function(e){re.current=re.current.filter(function(t){return t!==e.target&&t!==null}),!(re.current.length>0)&&P({isDragGlobal:!1,type:`setDragGlobal`})},n=function(){re.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})},r=function(){re.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),function(){document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[A]),(0,R.useEffect)(function(){return!r&&v&&A.current&&A.current.focus(),function(){}},[A,v,r]);var ae=(0,R.useCallback)(function(e){w?w(e):console.error(e)},[w]),oe=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e),ne.current=[].concat(CU(ne.current),[e.target]),oU(e)&&Promise.resolve(i(e)).then(function(t){if(!(aU(e)&&!C)){var n=t.length,r=n>0&&iU({files:t,accept:E,minSize:o,maxSize:a,multiple:s,maxFiles:c,validator:T});P({isDragAccept:r,isDragReject:n>0&&!r,isDragActive:!0,type:`setDraggedFiles`}),l&&l(e)}}).catch(function(e){return ae(e)})},[i,l,ae,C,E,o,a,s,c,T]),se=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e);var t=oU(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&d&&d(e),!1},[d,C]),ce=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e);var t=ne.current.filter(function(e){return A.current&&A.current.contains(e)}),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),ne.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1}),oU(e)&&u&&u(e))},[A,u,C]),le=(0,R.useCallback)(function(e,t){var n=[],r=[];e.forEach(function(e){var t=DU(tU(e,E),2),i=t[0],s=t[1],c=DU(nU(e,o,a),2),l=c[0],u=c[1],d=T?T(e):null;if(i&&l&&!d)n.push(e);else{var f=[s,u];d&&(f=f.concat(d)),r.push({file:e,errors:f.filter(function(e){return e})})}}),(!s&&n.length>1||s&&c>=1&&n.length>c)&&(n.forEach(function(e){r.push({file:e,errors:[$H]})}),n.splice(0)),P({acceptedFiles:n,fileRejections:r,type:`setFiles`}),f&&f(n,r,t),r.length>0&&m&&m(r,t),n.length>0&&p&&p(n,t)},[P,s,E,o,a,c,f,p,m,T]),ue=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e),ne.current=[],oU(e)&&Promise.resolve(i(e)).then(function(t){aU(e)&&!C||le(t,e)}).catch(function(e){return ae(e)}),P({type:`reset`})},[i,le,ae,C]),de=(0,R.useCallback)(function(){if(te.current){P({type:`openDialog`}),O();var e={multiple:s,types:D};window.showOpenFilePicker(e).then(function(e){return i(e)}).then(function(e){le(e,null),P({type:`closeDialog`})}).catch(function(e){hU(e)?(k(e),P({type:`closeDialog`})):gU(e)?(te.current=!1,j.current?(j.current.value=null,j.current.click()):ae(Error(`Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.`))):ae(e)});return}j.current&&(P({type:`openDialog`}),O(),j.current.value=null,j.current.click())},[P,O,k,_,le,ae,D,s]),fe=(0,R.useCallback)(function(e){!A.current||!A.current.isEqualNode(e.target)||(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),de())},[A,de]),pe=(0,R.useCallback)(function(){P({type:`focus`})},[]),me=(0,R.useCallback)(function(){P({type:`blur`})},[]),he=(0,R.useCallback)(function(){b||(uU()?setTimeout(de,0):de())},[b,de]),L=function(e){return r?null:e},ge=function(e){return x?null:L(e)},_e=function(e){return S?null:L(e)},ve=function(e){C&&e.stopPropagation()},ye=(0,R.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,i=e.role,a=e.onKeyDown,o=e.onFocus,s=e.onBlur,c=e.onClick,l=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,f=e.onDrop,p=IU(e,xU);return PU(PU(FU({onKeyDown:ge(dU(a,fe)),onFocus:ge(dU(o,pe)),onBlur:ge(dU(s,me)),onClick:L(dU(c,he)),onDragEnter:_e(dU(l,oe)),onDragOver:_e(dU(u,se)),onDragLeave:_e(dU(d,ce)),onDrop:_e(dU(f,ue)),role:typeof i==`string`&&i!==``?i:`presentation`},n,A),!r&&!x?{tabIndex:0}:{}),p)}},[A,fe,pe,me,he,oe,se,ce,ue,x,S,r]),be=(0,R.useCallback)(function(e){e.stopPropagation()},[]),xe=(0,R.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,r=e.onChange,i=e.onClick,a=IU(e,SU);return PU(PU({},FU({accept:E,multiple:s,type:`file`,style:{border:0,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`0 -1px -1px 0`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`},onChange:L(dU(r,ue)),onClick:L(dU(i,be)),tabIndex:-1},n,j)),a)}},[j,n,s,ue,r]);return PU(PU({},N),{},{isFocused:F&&!r,getRootProps:ye,getInputProps:xe,rootRef:A,inputRef:j,open:L(de)})}function HU(e,t){switch(t.type){case`focus`:return PU(PU({},e),{},{isFocused:!0});case`blur`:return PU(PU({},e),{},{isFocused:!1});case`openDialog`:return PU(PU({},BU),{},{isFileDialogActive:!0});case`closeDialog`:return PU(PU({},e),{},{isFileDialogActive:!1});case`setDraggedFiles`:return PU(PU({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case`setFiles`:return PU(PU({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case`setDragGlobal`:return PU(PU({},e),{},{isDragGlobal:t.isDragGlobal});case`reset`:return PU({},BU);default:return e}}function UU(){}function WU(){let e=Qo();return[...e.breakpoints.keys].reverse().reduce((t,n)=>{let r=cw(e.breakpoints.up(n));return!t&&r?n:t},null)||`xs`}function GU(){return e=>function(t){let n=WU();return R.createElement(e,{...t,width:n})}}function KU(e){let[t,n]=R.useState(e.input||e.value||``),[r,i]=R.useState(``);return R.createElement(rC,{open:!0,onClose:()=>e.onClose(null),"aria-labelledby":`form-dialog-title`,fullWidth:e.fullWidth!==void 0&&e.fullWidth},R.createElement(bC,{id:`form-dialog-title`},e.titleText),R.createElement(pC,null,R.createElement(_C,null,e.promptText),R.createElement(mO,{variant:`standard`,autoFocus:!0,margin:`dense`,error:!!r,helperText:r===!0||!r?``:r,value:t,label:e.labelText||``,type:e.type||`text`,onKeyUp:n=>n.code===`Enter`&&t&&e.onClose(t),onChange:t=>{let r=``;e.verify&&(r=e.verify(t.target.value)),e.rule?n(e.rule(t.target.value)):n(t.target.value),i(r)},fullWidth:!0})),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,disabled:!t||!!r,onClick:()=>e.onClose(t),color:`primary`,startIcon:R.createElement(EO,null)},e.applyText||zk.t(`ra_Ok`)),R.createElement(Vx,{color:`grey`,variant:`contained`,onClick:()=>e.onClose(null),startIcon:R.createElement(DO,null)},e.cancelText||zk.t(`ra_Cancel`))))}var qU=GU()(KU);function JU(e){return R.createElement(`svg`,{onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 486 486`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),xmlns:`http://www.w3.org/2000/svg`,className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`m414.928297,149.715165 c-2.639376,-57.222555 -35.669446,-106.505345 -83.345894,-132.039151 c-3.758948,-2.049842 -7.636885,-3.932022 -11.590542,-5.641125 c-19.303146,-8.394083 -40.607459,-13.050853 -63.004303,-13.050853 c-84.113909,0 -152.791790,65.703174 -157.718988,148.605566 l0.043268,-0.010816 v0.281245 c0,3.061243 -0.146031,16.750306 -0.146031,16.750306 l-2.352723,5.224668 h15.744315 c5.916964,-19.384275 24.078904,-32.635245 45.513024,-32.635245 c26.231510,0 47.573684,21.915481 47.573684,48.146991 c0,26.226103 -21.342174,47.146409 -47.573684,47.146409 c-25.111939,0 -45.734774,-19.735831 -47.443879,-44.658471 h-18.789334 c-0.400232,0 -0.778832,0.638209 -1.162839,0.584122 l-19.762875,55.199753 c-2.774590,7.696379 2.926030,16.214860 11.103771,16.214860 h17.020735 l-0.129805,87.899899 c0,17.356066 14.073071,31.174935 31.429136,31.174935 h56.205745 v82.648189 c0,12.877778 12.937273,22.580734 25.815051,22.580734 h144.597825 c12.877778,0 23.429877,-9.702955 23.429877,-22.580734 v-166.037352 c0,-22.645636 5.976457,-44.761234 16.561008,-64.789128 c11.055093,-20.925714 17.523731,-44.620611 18.129489,-69.792045 c0.027042,-1.260193 0.037858,-2.552839 0.037858,-3.845485 c0,-2.466302 -0.070310,-4.938014 -0.183890,-7.377273 zm-155.393308,-11.731165 h-13.456494 v13.559257 c0,4.732489 -4.267352,8.567157 -8.999842,8.567157 c-4.727079,0 -8.999842,-3.834667 -8.999842,-8.567157 v-13.559257 h-12.185483 c-4.732489,0 -8.567157,-4.267352 -8.567157,-8.999842 c0,-4.727079 3.834667,-8.999842 8.567157,-8.999842 h12.185483 v-12.077311 c0,-4.732489 4.272762,-8.567157 8.999842,-8.567157 c4.732489,0 8.999842,3.834667 8.999842,8.567157 v12.077311 h13.456494 c4.727079,0 8.567157,4.272762 8.567157,8.999842 c0,4.732489 -3.840077,8.999842 -8.567157,8.999842 zm0,0`}),R.createElement(`path`,{fill:`currentColor`,d:`m187.695312 285.875c3.9375-3.980469 6.414063-9.449219 6.414063-15.523438 0-12.128906-9.855469-21.980468-21.984375-21.980468-6.007812 0-11.472656 2.410156-15.457031 6.347656-4.023438 4.003906-6.523438 9.539062-6.523438 15.636719 0 12.125 9.855469 21.980469 21.980469 21.980469 6.078125 0 11.585938-2.476563 15.570312-6.460938zm0 0`}))}function YU(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 650 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`m524,128l-192,0l-64,-64l-160,0c-26.51,0 -48,21.49 -48,48l0,288c0,26.51 21.49,48 48,48l416,0c26.51,0 48,-21.49 48,-48l0,-224c0,-26.51 -21.49,-48 -48,-48z`}))}function XU(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 650 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`m631.75617,292.093l-72.424,124.155a63.997,63.997 0 0 1 -55.281,31.752l-399.964,0c-18.523,0 -30.064,-20.093 -20.731,-36.093l72.424,-124.155a64,64 0 0 1 55.282,-31.752l399.964,0c18.523,0 30.064,20.093 20.73,36.093zm-420.694,-68.093l328,0l0,-48c0,-26.51 -21.49,-48 -48,-48l-160,0l-64,-64l-160,0c-26.51,0 -48,21.49 -48,48l0,278.046l69.077,-118.418c17.137,-29.378 48.912,-47.628 82.923,-47.628z`}))}function ZU(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`#EE3333`,d:`M256,0C114.844,0,0,114.844,0,256s114.844,256,256,256s256-114.844,256-256S397.156,0,256,0z M256,448 c-105.865,0-192-86.135-192-192c0-40.406,12.25-78.604,35.542-111.198l267.656,267.656C334.604,435.75,296.406,448,256,448z M412.458,367.198L144.802,99.542C177.396,76.25,215.594,64,256,64c105.865,0,192,86.135,192,192 C448,296.406,435.75,334.604,412.458,367.198z`}))}var QU=`react-inlinesvg`,$U={IDLE:`idle`,LOADING:`loading`,LOADED:`loaded`,FAILED:`failed`,READY:`ready`,UNSUPPORTED:`unsupported`};function eW(e){return e[Math.floor(Math.random()*e.length)]}function tW(){return!!(typeof window<`u`&&window.document?.createElement)}function nW(){return oW()&&typeof window<`u`&&window!==null}function rW(e,...t){let n={};for(let r in e)({}).hasOwnProperty.call(e,r)&&!t.includes(r)&&(n[r]=e[r]);return n}function iW(e){let t=``;for(let n=0;n<e;n++)t+=eW(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`);return t}async function aW(e,t){let n=await fetch(e,t),[r]=(n.headers.get(`content-type`)??``).split(/ ?; ?/);if(n.status>299)throw Error(`Not found`);if(![`image/svg+xml`,`text/plain`].some(e=>r.includes(e)))throw Error(`Content type isn't valid: ${r}`);return n.text()}function oW(){if(!document)return!1;let e=document.createElement(`div`);e.innerHTML=`<svg />`;let t=e.firstChild;return!!t&&t.namespaceURI===`http://www.w3.org/2000/svg`}var sW=class{cacheApi;cacheStore;subscribers=[];isReady=!1;constructor(e={}){let{name:t=QU,persistent:n=!1}=e;this.cacheStore=new Map,n&&tW()&&`caches`in window?caches.open(t).then(e=>{this.cacheApi=e}).catch(e=>{console.error(`Failed to open cache: ${e.message}`),this.cacheApi=void 0}).finally(()=>{this.isReady=!0;let e=[...this.subscribers];this.subscribers.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`Error in CacheStore subscriber callback: ${e.message}`)}})}):this.isReady=!0}onReady(e){return this.isReady?(e(),()=>{}):(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);t>=0&&this.subscribers.splice(t,1)})}waitForReady(){return this.isReady?Promise.resolve():new Promise(e=>{this.onReady(e)})}async get(e,t){return await this.fetchAndCache(e,t),this.cacheStore.get(e)?.content??``}getContent(e){return this.cacheStore.get(e)?.content??``}set(e,t){this.cacheStore.set(e,t)}isCached(e){return this.cacheStore.get(e)?.status===$U.LOADED}async fetchAndCache(e,t){this.isReady||await this.waitForReady();let n=this.cacheStore.get(e);if(n?.status!==$U.LOADED){if(n?.status===$U.LOADING){await this.handleLoading(e,t?.signal||void 0,async()=>{this.cacheStore.set(e,{content:``,status:$U.IDLE}),await this.fetchAndCache(e,t)});let n=this.cacheStore.get(e);if(n?.status===$U.FAILED){if(n.error)throw n.error;this.cacheStore.delete(e),await this.fetchAndCache(e,t)}return}this.cacheStore.set(e,{content:``,status:$U.LOADING});try{let n=this.cacheApi?await this.fetchFromPersistentCache(e,t):await aW(e,t);this.cacheStore.set(e,{content:n,status:$U.LOADED})}catch(t){let n=t?.name===`AbortError`;throw this.cacheStore.set(e,{content:``,error:n?void 0:t,status:$U.FAILED}),t}}}async fetchFromPersistentCache(e,t){let n=await this.cacheApi?.match(e);return n?n.text():(await this.cacheApi?.add(new Request(e,t)),await(await this.cacheApi?.match(e))?.text()??``)}async handleLoading(e,t,n){for(let n=0;n<10;n++){if(t?.aborted)throw t.reason instanceof Error?t.reason:new DOMException(`The operation was aborted.`,`AbortError`);if(this.cacheStore.get(e)?.status!==$U.LOADING)return;await cW(.1)}await n()}keys(){return[...this.cacheStore.keys()]}data(){return[...this.cacheStore.entries()].map(([e,t])=>({[e]:t}))}async delete(e){this.cacheApi&&await this.cacheApi.delete(e),this.cacheStore.delete(e)}async clear(){if(this.cacheApi){let e=await this.cacheApi.keys();await Promise.allSettled(e.map(e=>this.cacheApi.delete(e)))}this.cacheStore.clear()}};function cW(e=1){return new Promise(t=>{setTimeout(t,e*1e3)})}var lW=(0,R.createContext)(null);function uW(){return(0,R.useContext)(lW)}var dW=e=>typeof e==`string`?e.split(/ ?; ?/).reduce((e,t)=>{let[n,r]=t.split(/ ?: ?/).map((e,t)=>t===0?e.replace(/\s+/g,``):e.trim());if(n&&r){let t=n.replace(/(\w)-(\w)/g,(e,t,n)=>`${t}${n.toUpperCase()}`),i=r.trim();Number.isNaN(Number(r))||(i=Number(r)),e[n.startsWith(`-`)?n:t]=i}return e},{}):{};function fW(e=6){let t=``;for(let n=e;n>0;--n)t+=`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.round(Math.random()*61)];return t}var pW=[`br`,`col`,`colgroup`,`dl`,`hr`,`iframe`,`img`,`input`,`link`,`menuitem`,`meta`,`ol`,`param`,`select`,`table`,`tbody`,`tfoot`,`thead`,`tr`,`ul`,`wbr`],mW={"accept-charset":`acceptCharset`,acceptcharset:`acceptCharset`,accesskey:`accessKey`,allowfullscreen:`allowFullScreen`,autocapitalize:`autoCapitalize`,autocomplete:`autoComplete`,autocorrect:`autoCorrect`,autofocus:`autoFocus`,autoplay:`autoPlay`,autosave:`autoSave`,cellpadding:`cellPadding`,cellspacing:`cellSpacing`,charset:`charSet`,class:`className`,classid:`classID`,classname:`className`,colspan:`colSpan`,contenteditable:`contentEditable`,contextmenu:`contextMenu`,controlslist:`controlsList`,crossorigin:`crossOrigin`,dangerouslysetinnerhtml:`dangerouslySetInnerHTML`,datetime:`dateTime`,defaultchecked:`defaultChecked`,defaultvalue:`defaultValue`,enctype:`encType`,for:`htmlFor`,formmethod:`formMethod`,formaction:`formAction`,formenctype:`formEncType`,formnovalidate:`formNoValidate`,formtarget:`formTarget`,frameborder:`frameBorder`,hreflang:`hrefLang`,htmlfor:`htmlFor`,httpequiv:`httpEquiv`,"http-equiv":`httpEquiv`,icon:`icon`,innerhtml:`innerHTML`,inputmode:`inputMode`,itemid:`itemID`,itemprop:`itemProp`,itemref:`itemRef`,itemscope:`itemScope`,itemtype:`itemType`,keyparams:`keyParams`,keytype:`keyType`,marginwidth:`marginWidth`,marginheight:`marginHeight`,maxlength:`maxLength`,mediagroup:`mediaGroup`,minlength:`minLength`,nomodule:`noModule`,novalidate:`noValidate`,playsinline:`playsInline`,radiogroup:`radioGroup`,readonly:`readOnly`,referrerpolicy:`referrerPolicy`,rowspan:`rowSpan`,spellcheck:`spellCheck`,srcdoc:`srcDoc`,srclang:`srcLang`,srcset:`srcSet`,tabindex:`tabIndex`,typemustmatch:`typeMustMatch`,usemap:`useMap`,accentheight:`accentHeight`,"accent-height":`accentHeight`,alignmentbaseline:`alignmentBaseline`,"alignment-baseline":`alignmentBaseline`,allowreorder:`allowReorder`,arabicform:`arabicForm`,"arabic-form":`arabicForm`,attributename:`attributeName`,attributetype:`attributeType`,autoreverse:`autoReverse`,basefrequency:`baseFrequency`,baselineshift:`baselineShift`,"baseline-shift":`baselineShift`,baseprofile:`baseProfile`,calcmode:`calcMode`,capheight:`capHeight`,"cap-height":`capHeight`,clippath:`clipPath`,"clip-path":`clipPath`,clippathunits:`clipPathUnits`,cliprule:`clipRule`,"clip-rule":`clipRule`,colorinterpolation:`colorInterpolation`,"color-interpolation":`colorInterpolation`,colorinterpolationfilters:`colorInterpolationFilters`,"color-interpolation-filters":`colorInterpolationFilters`,colorprofile:`colorProfile`,"color-profile":`colorProfile`,colorrendering:`colorRendering`,"color-rendering":`colorRendering`,contentscripttype:`contentScriptType`,contentstyletype:`contentStyleType`,diffuseconstant:`diffuseConstant`,dominantbaseline:`dominantBaseline`,"dominant-baseline":`dominantBaseline`,edgemode:`edgeMode`,enablebackground:`enableBackground`,"enable-background":`enableBackground`,externalresourcesrequired:`externalResourcesRequired`,fillopacity:`fillOpacity`,"fill-opacity":`fillOpacity`,fillrule:`fillRule`,"fill-rule":`fillRule`,filterres:`filterRes`,filterunits:`filterUnits`,floodopacity:`floodOpacity`,"flood-opacity":`floodOpacity`,floodcolor:`floodColor`,"flood-color":`floodColor`,fontfamily:`fontFamily`,"font-family":`fontFamily`,fontsize:`fontSize`,"font-size":`fontSize`,fontsizeadjust:`fontSizeAdjust`,"font-size-adjust":`fontSizeAdjust`,fontstretch:`fontStretch`,"font-stretch":`fontStretch`,fontstyle:`fontStyle`,"font-style":`fontStyle`,fontvariant:`fontVariant`,"font-variant":`fontVariant`,fontweight:`fontWeight`,"font-weight":`fontWeight`,glyphname:`glyphName`,"glyph-name":`glyphName`,glyphorientationhorizontal:`glyphOrientationHorizontal`,"glyph-orientation-horizontal":`glyphOrientationHorizontal`,glyphorientationvertical:`glyphOrientationVertical`,"glyph-orientation-vertical":`glyphOrientationVertical`,glyphref:`glyphRef`,gradienttransform:`gradientTransform`,gradientunits:`gradientUnits`,horizadvx:`horizAdvX`,"horiz-adv-x":`horizAdvX`,horizoriginx:`horizOriginX`,"horiz-origin-x":`horizOriginX`,imagerendering:`imageRendering`,"image-rendering":`imageRendering`,kernelmatrix:`kernelMatrix`,kernelunitlength:`kernelUnitLength`,keypoints:`keyPoints`,keysplines:`keySplines`,keytimes:`keyTimes`,lengthadjust:`lengthAdjust`,letterspacing:`letterSpacing`,"letter-spacing":`letterSpacing`,lightingcolor:`lightingColor`,"lighting-color":`lightingColor`,limitingconeangle:`limitingConeAngle`,markerend:`markerEnd`,"marker-end":`markerEnd`,markerheight:`markerHeight`,markermid:`markerMid`,"marker-mid":`markerMid`,markerstart:`markerStart`,"marker-start":`markerStart`,markerunits:`markerUnits`,markerwidth:`markerWidth`,maskcontentunits:`maskContentUnits`,maskunits:`maskUnits`,numoctaves:`numOctaves`,overlineposition:`overlinePosition`,"overline-position":`overlinePosition`,overlinethickness:`overlineThickness`,"overline-thickness":`overlineThickness`,paintorder:`paintOrder`,"paint-order":`paintOrder`,"panose-1":`panose1`,pathlength:`pathLength`,patterncontentunits:`patternContentUnits`,patterntransform:`patternTransform`,patternunits:`patternUnits`,pointerevents:`pointerEvents`,"pointer-events":`pointerEvents`,pointsatx:`pointsAtX`,pointsaty:`pointsAtY`,pointsatz:`pointsAtZ`,preservealpha:`preserveAlpha`,preserveaspectratio:`preserveAspectRatio`,primitiveunits:`primitiveUnits`,refx:`refX`,refy:`refY`,renderingintent:`renderingIntent`,"rendering-intent":`renderingIntent`,repeatcount:`repeatCount`,repeatdur:`repeatDur`,requiredextensions:`requiredExtensions`,requiredfeatures:`requiredFeatures`,shaperendering:`shapeRendering`,"shape-rendering":`shapeRendering`,specularconstant:`specularConstant`,specularexponent:`specularExponent`,spreadmethod:`spreadMethod`,startoffset:`startOffset`,stddeviation:`stdDeviation`,stitchtiles:`stitchTiles`,stopcolor:`stopColor`,"stop-color":`stopColor`,stopopacity:`stopOpacity`,"stop-opacity":`stopOpacity`,strikethroughposition:`strikethroughPosition`,"strikethrough-position":`strikethroughPosition`,strikethroughthickness:`strikethroughThickness`,"strikethrough-thickness":`strikethroughThickness`,strokedasharray:`strokeDasharray`,"stroke-dasharray":`strokeDasharray`,strokedashoffset:`strokeDashoffset`,"stroke-dashoffset":`strokeDashoffset`,strokelinecap:`strokeLinecap`,"stroke-linecap":`strokeLinecap`,strokelinejoin:`strokeLinejoin`,"stroke-linejoin":`strokeLinejoin`,strokemiterlimit:`strokeMiterlimit`,"stroke-miterlimit":`strokeMiterlimit`,strokewidth:`strokeWidth`,"stroke-width":`strokeWidth`,strokeopacity:`strokeOpacity`,"stroke-opacity":`strokeOpacity`,suppresscontenteditablewarning:`suppressContentEditableWarning`,suppresshydrationwarning:`suppressHydrationWarning`,surfacescale:`surfaceScale`,systemlanguage:`systemLanguage`,tablevalues:`tableValues`,targetx:`targetX`,targety:`targetY`,textanchor:`textAnchor`,"text-anchor":`textAnchor`,textdecoration:`textDecoration`,"text-decoration":`textDecoration`,textlength:`textLength`,textrendering:`textRendering`,"text-rendering":`textRendering`,underlineposition:`underlinePosition`,"underline-position":`underlinePosition`,underlinethickness:`underlineThickness`,"underline-thickness":`underlineThickness`,unicodebidi:`unicodeBidi`,"unicode-bidi":`unicodeBidi`,unicoderange:`unicodeRange`,"unicode-range":`unicodeRange`,unitsperem:`unitsPerEm`,"units-per-em":`unitsPerEm`,unselectable:`unselectable`,valphabetic:`vAlphabetic`,"v-alphabetic":`vAlphabetic`,vectoreffect:`vectorEffect`,"vector-effect":`vectorEffect`,vertadvy:`vertAdvY`,"vert-adv-y":`vertAdvY`,vertoriginx:`vertOriginX`,"vert-origin-x":`vertOriginX`,vertoriginy:`vertOriginY`,"vert-origin-y":`vertOriginY`,vhanging:`vHanging`,"v-hanging":`vHanging`,videographic:`vIdeographic`,"v-ideographic":`vIdeographic`,viewbox:`viewBox`,viewtarget:`viewTarget`,vmathematical:`vMathematical`,"v-mathematical":`vMathematical`,wordspacing:`wordSpacing`,"word-spacing":`wordSpacing`,writingmode:`writingMode`,"writing-mode":`writingMode`,xchannelselector:`xChannelSelector`,xheight:`xHeight`,"x-height":`xHeight`,xlinkactuate:`xlinkActuate`,"xlink:actuate":`xlinkActuate`,xlinkarcrole:`xlinkArcrole`,"xlink:arcrole":`xlinkArcrole`,xlinkhref:`xlinkHref`,"xlink:href":`xlinkHref`,xlinkrole:`xlinkRole`,"xlink:role":`xlinkRole`,xlinkshow:`xlinkShow`,"xlink:show":`xlinkShow`,xlinktitle:`xlinkTitle`,"xlink:title":`xlinkTitle`,xlinktype:`xlinkType`,"xlink:type":`xlinkType`,xmlbase:`xmlBase`,"xml:base":`xmlBase`,xmllang:`xmlLang`,"xml:lang":`xmlLang`,"xml:space":`xmlSpace`,xmlnsxlink:`xmlnsXlink`,"xmlns:xlink":`xmlnsXlink`,xmlspace:`xmlSpace`,ychannelselector:`yChannelSelector`,zoomandpan:`zoomAndPan`,onblur:`onBlur`,onchange:`onChange`,onclick:`onClick`,oncontextmenu:`onContextMenu`,ondoubleclick:`onDoubleClick`,ondrag:`onDrag`,ondragend:`onDragEnd`,ondragenter:`onDragEnter`,ondragexit:`onDragExit`,ondragleave:`onDragLeave`,ondragover:`onDragOver`,ondragstart:`onDragStart`,ondrop:`onDrop`,onerror:`onError`,onfocus:`onFocus`,oninput:`onInput`,oninvalid:`onInvalid`,onkeydown:`onKeyDown`,onkeypress:`onKeyPress`,onkeyup:`onKeyUp`,onload:`onLoad`,onmousedown:`onMouseDown`,onmouseenter:`onMouseEnter`,onmouseleave:`onMouseLeave`,onmousemove:`onMouseMove`,onmouseout:`onMouseOut`,onmouseover:`onMouseOver`,onmouseup:`onMouseUp`,onscroll:`onScroll`,onsubmit:`onSubmit`,ontouchcancel:`onTouchCancel`,ontouchend:`onTouchEnd`,ontouchmove:`onTouchMove`,ontouchstart:`onTouchStart`,onwheel:`onWheel`};function hW(e,t){let{key:n,level:r,...i}=t;switch(e.nodeType){case 1:return R.createElement(vW(e.nodeName),gW(e,n),_W(e.childNodes,r,i));case 3:{let t=e.nodeValue?.toString()??``;if(!i.allowWhiteSpaces&&/^\s+$/.test(t)&&!/[\u00A0\u202F]/.test(t))return null;if(!e.parentNode)return t;let n=e.parentNode.nodeName.toLowerCase();return pW.includes(n)?(/\S/.test(t)&&console.warn(`A textNode is not allowed inside '${n}'. Your text "${t}" will be ignored`),null):t}case 8:return null;case 11:return _W(e.childNodes,r,t);default:return null}}function gW(e,t){let n={key:t};if(e instanceof Element){let t=e.getAttribute(`class`);t&&(n.className=t),[...e.attributes].forEach(e=>{switch(e.name){case`class`:break;case`style`:n[e.name]=dW(e.value);break;case`allowfullscreen`:case`allowpaymentrequest`:case`async`:case`autofocus`:case`autoplay`:case`checked`:case`controls`:case`default`:case`defer`:case`disabled`:case`formnovalidate`:case`hidden`:case`ismap`:case`itemscope`:case`loop`:case`multiple`:case`muted`:case`nomodule`:case`novalidate`:case`open`:case`readonly`:case`required`:case`reversed`:case`selected`:case`typemustmatch`:n[mW[e.name]||e.name]=!0;break;default:n[mW[e.name]||e.name]=e.value}})}return n}function _W(e,t,n){let r=[...e].map((e,r)=>bW(e,{...n,index:r,level:t+1})).filter(Boolean);return r.length?r:null}function vW(e){return/[a-z]+[A-Z]+[a-z]+/.test(e)?e:e.toLowerCase()}function yW(e,t={}){return typeof e==`string`?xW(e,t):e instanceof Node?bW(e,t):null}function bW(e,t={}){if(!e||!(e instanceof Node))return null;let{actions:n=[],index:r=0,level:i=0,randomKey:a}=t,o=e,s=`${i}-${r}`,c=[];return a&&i===0&&(s=`${fW()}-${s}`),Array.isArray(n)&&n.forEach(t=>{t.condition(o,s,i)&&(typeof t.pre==`function`&&(o=t.pre(o,s,i),o instanceof Node||(o=e)),typeof t.post==`function`&&c.push(t.post(o,s,i)))}),c.length?c:hW(o,{key:s,level:i,...t})}function xW(e,t={}){if(!e||typeof e!=`string`)return null;let{includeAllNodes:n=!1,nodeOnly:r=!1,selector:i=`body > *`,type:a=`text/html`}=t;try{let o=new DOMParser().parseFromString(e,a);if(n){let{childNodes:e}=o.body;return r?e:[...e].map(e=>bW(e,t))}let s=o.querySelector(i)||o.body.childNodes[0];if(!(s instanceof Node))throw TypeError(`Error parsing input`);return r?s:bW(s,t)}catch{}return null}function SW(e){(0,R.useEffect)(e,[])}function CW(e){let t=(0,R.useRef)(void 0);return(0,R.useEffect)(()=>{t.current=e}),t.current}function wW(e,t,n){let r=e.matchAll(/\bid=(["'])([^"']+)\1/g),i=[...new Set([...r].map(e=>e[2]))];return i.length?(i.sort((e,t)=>t.length-e.length),e.replace(/<style[^>]*>([\S\s]*?)<\/style>/gi,(e,r)=>{let a=r;for(let e of i){let r=e.replace(/[$()*+.?[\\\]^{|}]/g,`\\$&`);a=a.replace(RegExp(`url\\((['"]?)#${r}\\1\\)`,`g`),`url($1${n}#${e}__${t}$1)`),a=a.replace(RegExp(`#${r}(?![a-zA-Z0-9_-])`,`g`),`#${e}__${t}`)}return e.replace(r,a)})):e}function TW(e){let{baseURL:t,content:n,description:r,handleError:i,hash:a,preProcessor:o,title:s,uniquifyIDs:c=!1}=e;try{let e=o?o(n):n;c&&(e=wW(e,a,t??``));let i=yW(e,{nodeOnly:!0});if(!i||!(i instanceof SVGSVGElement))throw Error(`Could not convert the src to a DOM Node`);let l=EW(i,{baseURL:t,hash:a,uniquifyIDs:c});if(r){let e=l.querySelector(`desc`);e?.parentNode&&e.parentNode.removeChild(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`desc`);t.innerHTML=r,l.prepend(t)}if(s!==void 0){let e=l.querySelector(`title`);if(e?.parentNode&&e.parentNode.removeChild(e),s){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`title`);e.innerHTML=s,l.prepend(e)}}return l}catch(e){return i(e)}}function EW(e,t){let{baseURL:n=``,hash:r,uniquifyIDs:i}=t,a=[`id`,`href`,`xlink:href`,`xlink:role`,`xlink:arcrole`],o=[`href`,`xlink:href`],s=(e,t)=>o.includes(e)&&(t?!t.includes(`#`):!1);return i&&[...e.children].forEach(e=>{if(e.attributes?.length){let t=Object.values(e.attributes).map(e=>{let t=e,i=/url\((.*?)\)/.exec(e.value);return i?.[1]&&(t.value=e.value.replace(i[0],`url(${n}${i[1]}__${r})`)),t});a.forEach(e=>{let n=t.find(t=>t.name===e);n&&!s(e,n.value)&&(n.value=`${n.value}__${r}`)})}return e.children.length?EW(e,t):e}),e}function DW(e,t){let{baseURL:n,cacheRequests:r=!0,description:i,fetchOptions:a,onError:o,onLoad:s,preProcessor:c,src:l,title:u,uniqueHash:d,uniquifyIDs:f}=e,p=(0,R.useRef)(d??iW(8)),m=(0,R.useRef)(a),h=(0,R.useRef)(o),g=(0,R.useRef)(s),_=(0,R.useRef)(c);m.current=a,h.current=o,g.current=s,_.current=c;let[v,y]=(0,R.useReducer)((e,t)=>({...e,...t}),{content:``,element:null,isCached:!1,status:$U.IDLE},n=>{if(!(r&&t.isCached(l)))return n;let i=t.getContent(l);try{let t=TW({...e,handleError:()=>{},hash:p.current,content:i});if(!t)return{...n,content:i,isCached:!0,status:$U.LOADED};let r=yW(t);if(r&&(0,R.isValidElement)(r))return{content:i,element:r,isCached:!0,status:$U.READY}}catch{}return{...n,content:i,isCached:!0,status:$U.LOADED}}),{content:b,element:x,isCached:S,status:C}=v,w=CW(e),T=CW(v),E=(0,R.useRef)(!1),D=(0,R.useRef)(!1),O=(0,R.useCallback)(e=>{E.current&&(y({status:e.message===`Browser does not support SVG`?$U.UNSUPPORTED:$U.FAILED}),h.current?.(e))},[]),k=(0,R.useCallback)(()=>{try{let e=yW(TW({baseURL:n,content:b,description:i,handleError:O,hash:p.current,preProcessor:_.current,src:l,title:u,uniquifyIDs:f}));if(!e||!(0,R.isValidElement)(e))throw Error(`Could not convert the src to a React element`);y({element:e,status:$U.READY})}catch(e){O(e)}},[n,b,i,O,l,u,f]);return SW(()=>{if(E.current=!0,!(!tW()||D.current)){try{if(C===$U.READY)g.current?.(l,S);else if(C===$U.IDLE){if(!nW())throw Error(`Browser does not support SVG`);if(!l)throw Error(`Missing src`);y({content:``,element:null,isCached:!1,status:$U.LOADING})}}catch(e){O(e)}return D.current=!0,()=>{E.current=!1}}}),(0,R.useEffect)(()=>{if(!(!tW()||!w)&&w.src!==l){if(!l){O(Error(`Missing src`));return}y({content:``,element:null,isCached:!1,status:$U.LOADING})}},[O,w,l]),(0,R.useEffect)(()=>{if(C!==$U.LOADING)return;let e=new AbortController,n=!0;return(async()=>{try{let i=/^data:image\/svg[^,]*?(;base64)?,(.*)/.exec(l),a;if(i?a=i[1]?window.atob(i[2]):decodeURIComponent(i[2]):l.includes(`<svg`)&&(a=l),a){n&&y({content:a,isCached:!1,status:$U.LOADED});return}let o={...m.current,signal:e.signal},s,c=!1;r?(c=t.isCached(l),s=await t.get(l,o)):s=await aW(l,o),n&&y({content:s,isCached:c,status:$U.LOADED})}catch(e){n&&e.name!==`AbortError`&&O(e)}})(),()=>{n=!1,e.abort()}},[r,t,O,l,C]),(0,R.useEffect)(()=>{C===$U.LOADED&&b&&k()},[b,k,C]),(0,R.useEffect)(()=>{!tW()||!w||w.src!==l||(w.title!==u||w.description!==i)&&k()},[i,k,w,l,u]),(0,R.useEffect)(()=>{T&&C===$U.READY&&T.status!==$U.READY&&g.current?.(l,S)},[S,T,l,C]),{element:x,status:C}}var OW=new sW;function kW(e){let{children:t=null,innerRef:n,loader:r=null}=e,{element:i,status:a}=DW(e,uW()??OW);return tW()?i?(0,R.cloneElement)(i,{ref:n,...rW(e,`baseURL`,`cacheRequests`,`children`,`description`,`fetchOptions`,`innerRef`,`loader`,`onError`,`onLoad`,`preProcessor`,`src`,`title`,`uniqueHash`,`uniquifyIDs`)}):[$U.UNSUPPORTED,$U.FAILED].includes(a)?t:r:r}var AW=window.location.hostname.endsWith(`iobroker.in`),jW=window.location.pathname.substring(0,window.location.pathname.lastIndexOf(`/`)+1),MW=R.forwardRef(function(e,t){if(e.src){if(typeof e.src==`string`){if(e.src.length<3)return e.sx?R.createElement(_x,{component:`span`,sx:e.sx,ref:t,title:e.title||void 0,style:{height:27,marginTop:-8,...e.styleUTF8||e.style},className:e.className?`iconOwn ${e.className}`:`iconOwn`},e.src):R.createElement(`span`,{ref:t,title:e.title||void 0,style:{height:27,marginTop:-8,...e.styleUTF8||e.style},className:e.className?`iconOwn ${e.className}`:`iconOwn`},e.src);if(e.src.startsWith(`data:image/svg`))return R.createElement(kW,{title:e.title||void 0,src:e.src,className:e.className?`iconOwn ${e.className}`:`iconOwn`,width:e.style?.width||28,height:e.style?.height||e.style?.width||28,style:e.style||void 0});if(AW&&!e.src.startsWith(`http://`)&&!e.src.startsWith(`https://`)){let n=e.src;return n.startsWith(`./`)?n=jW+n.substring(2):n.startsWith(`/`)||(n=jW+n),e.sx?R.createElement(_x,{component:`img`,sx:e.sx,title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:`https://remote-files.iobroker.in${n}`,alt:e.alt||void 0,ref:t,onError:t=>e.onError?.(t)}):R.createElement(`img`,{title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:`https://remote-files.iobroker.in${n}`,alt:e.alt||void 0,ref:t,onError:t=>e.onError?.(t)})}return e.sx?R.createElement(_x,{component:`img`,sx:e.sx,title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:e.src,alt:e.alt||void 0,ref:t,onError:e.onError}):R.createElement(`img`,{title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:e.src,alt:e.alt||void 0,ref:t,onError:e.onError})}return e.src}return null});MW.displayName=`Icon`;var NW={dialog:{height:`100%`},paper:{height:`calc(100% - 64px)`},content:{textAlign:`center`},textarea:{width:`100%`,height:`100%`},img:{width:`auto`,height:`calc(100% - 5px)`,objectFit:`contain`},dialogTitle:{justifyContent:`space-between`,display:`flex`}},PW={images:[`png`,`jpg`,`svg`,`jpeg`,`bmp`,`gif`,`apng`,`avif`,`webp`,`ico`],code:[`js`,`json`,`json5`,`md`],txt:[`log`,`txt`,`html`,`css`,`xml`,`ics`,`csv`],audio:[`mp3`,`wav`,`ogg`,`acc`],video:[`mp4`,`mov`,`avi`]};function FW(e,t){let n=``,r=new Uint8Array(e?.data||e),i=r.byteLength;for(let e=0;e<i&&(t||e<50);e++)n+=String.fromCharCode(r[e]);return window.btoa(n)}var IW=class extends R.Component{timeout=null;constructor(e){super(e);let t=X.getFileExtension(e.href);this.state={text:null,code:null,ext:t,editing:!1,editingValue:null,copyPossible:!!t&&(PW.code.includes(t)||PW.txt.includes(t)),forceUpdate:Date.now(),changed:!1,imgError:!1}}readFile(){if(this.props.href){let e=this.props.href.split(`/`);e.splice(0,2);let t=e[0],n=e.splice(1).join(`/`);this.props.socket.readFile(t,n).then(e=>{let t=``;e.file!==void 0&&(t=e.file);let r={copyPossible:this.state.copyPossible,ext:this.state.ext};if(t.type===`Buffer`)if(n.toLowerCase().endsWith(`.json5`)){r.ext=`json5`,r.copyPossible=!0;try{t=atob(FW(t,!0))}catch{console.error(`Cannot convert base64 to string`),t=``}}else{let e=X.detectMimeType(FW(t));e&&(r.ext=e,r.copyPossible=PW.code.includes(e)||PW.txt.includes(e))}r.copyPossible&&(r.ext&&PW.txt.includes(r.ext)?(r.text=t,r.editingValue=t):r.ext&&PW.code.includes(r.ext)&&(r.code=t,r.editingValue=t)),this.setState(r)}).catch(e=>window.alert(`Cannot read file: ${e}`))}}componentDidMount(){this.readFile();let e=this.props.href.split(`/`);e.splice(0,2);let t=e[0],n=e.splice(1).join(`/`);this.props.supportSubscribes&&this.props.socket.subscribeFiles(t,n,this.onFileChanged).catch(e=>window.alert(`Cannot subscribe on file: ${e}`))}componentWillUnmount(){this.timeout&&=(clearTimeout(this.timeout),null);let e=this.props.href.split(`/`);e.splice(0,2);let t=e[0],n=e.splice(1).join(`/`);this.props.supportSubscribes&&this.props.socket.unsubscribeFiles(t,n,this.onFileChanged)}onFileChanged=(e,t,n)=>{this.state.changed||(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.timeout=null,n===null?window.alert(`Show file was deleted!`):this.state.text!==null||this.state.code!==null?this.readFile():this.setState({forceUpdate:Date.now()})},300))};getEditorOrViewer(){return R.createElement(mO,{variant:`standard`,style:NW.textarea,multiline:!0,value:this.state.editingValue||this.state.code||this.state.text,slotProps:{htmlInput:{readOnly:!this.state.editing}}})}getContent(){return this.state.ext&&PW.images.includes(this.state.ext)?this.state.imgError?R.createElement(ZU,{style:{...NW.img,...this.props.getStyleBackgroundImage()}}):R.createElement(MW,{onError:e=>{e.target.onerror=null,this.setState({imgError:!0})},style:{...NW.img,...this.props.getStyleBackgroundImage()},src:`${this.props.href}?ts=${this.state.forceUpdate}`,alt:this.props.href}):this.state.ext&&PW.audio.includes(this.state.ext)?R.createElement(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`}},R.createElement(`audio`,{style:{width:`100%`},src:this.props.href,controls:!0})):this.state.ext&&PW.video.includes(this.state.ext)?R.createElement(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`}},R.createElement(`video`,{style:{width:`100%`,height:`100%`},controls:!0},R.createElement(`source`,{src:this.props.href,type:`video/${this.state.ext}`}))):this.state.code!==null||this.state.text!==null||this.state.editing?this.getEditorOrViewer():null}onSave(){}render(){return R.createElement(rC,{sx:{"&.MuiDialog-scrollPaper":NW.dialog,"& .MuiDialog-paper":NW.paper},scroll:`paper`,open:!!this.props.href,onClose:()=>this.props.onClose(),fullWidth:!0,maxWidth:`xl`,"aria-labelledby":`ar_dialog_file_view_title`},R.createElement(`div`,{style:NW.dialogTitle},R.createElement(bC,{id:`ar_dialog_file_view_title`},`${this.props.t(this.state.editing?`Edit`:`View`)}: ${this.props.href}`),this.state.ext&&PW.images.includes(this.state.ext)&&R.createElement(`div`,null,R.createElement(uv,{size:`large`,color:`inherit`,onClick:this.props.setStateBackgroundImage},R.createElement(CO,null)))),R.createElement(pC,{style:NW.content},this.getContent()),R.createElement(sC,null,this.state.copyPossible?R.createElement(Vx,{color:`grey`,onClick:e=>{e.stopPropagation(),e.preventDefault(),X.copyToClipboard(this.state.text||this.state.code||``)},startIcon:R.createElement(AO,null)},this.props.t(`Copy content`)):null,this.state.editing?R.createElement(Vx,{color:`grey`,disabled:this.state.editingValue===this.state.code||this.state.editingValue===this.state.text,variant:`contained`,onClick:()=>this.onSave(),startIcon:R.createElement(ak,null)},this.props.t(`Save`)):null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.props.onClose(),color:`primary`,startIcon:R.createElement(DO,null)},this.props.t(`Close`))))}},LW=GU()(IW),RW=32,zW=32,BW=120,VW=64,HW=`Not found`,UW={all:qO,images:GO,code:OO,txt:HO,audio:vO,video:hk},Q={root:{width:`100%`,overflow:`hidden`,height:`100%`,position:`relative`},filesDiv:{width:`calc(100% - 8px)`,overflowX:`hidden`,overflowY:`auto`,padding:8},filesDivHint:{position:`absolute`,bottom:0,left:20,opacity:.7,fontStyle:`italic`,fontSize:12},filesDivTable:{height:`calc(100% - 56px)`},filesDivTile:{height:`calc(100% - 104px)`,display:`flex`,alignContent:`flex-start`,alignItems:`stretch`,flexWrap:`wrap`,flex:`0 0 ${VW}px`},itemTile:e=>({position:`relative`,userSelect:`none`,cursor:`pointer`,height:BW,width:VW,display:`inline-block`,textAlign:`center`,opacity:.1,transition:`opacity 1s`,margin:`4px`,borderRadius:`4px`,"&:hover":{background:e.palette.secondary.light,color:X.invertColor(e.palette.secondary.main,!0)}}),itemNameFolderTile:{fontWeight:`bold`},itemNameTile:{width:`100%`,height:32,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:12,textAlign:`center`,wordBreak:`break-all`},itemFolderIconTile:e=>({width:`100%`,height:BW-32-16-8,display:`block`,pl:1,color:e.palette.secondary.main||`#fbff7d`}),itemFolderIconBack:e=>({position:`absolute`,top:22,left:18,zIndex:1,color:(e.palette.mode,`#FFF`)}),itemSizeTile:{width:`100%`,height:16,textAlign:`center`,fontSize:10},itemImageTile:{width:`calc(100% - 8px)`,height:BW-32-16-8,margin:4,display:`block`,textAlign:`center`,objectFit:`contain`},itemIconTile:{width:`100%`,height:BW-32-16-8,display:`block`,objectFit:`contain`},itemSelected:e=>({background:e.palette.primary.main,color:X.invertColor(e.palette.primary.main,!0)}),itemTable:e=>({userSelect:`none`,cursor:`pointer`,height:RW,display:`inline-flex`,lineHeight:`${RW}px`,"&:hover":{background:e.palette.secondary.light,color:X.invertColor(e.palette.secondary.main,!0)}}),itemNameTable:{display:`inline-block`,pl:`10px`,fontSize:`1rem`,verticalAlign:`top`,flexGrow:1,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,"@media screen and (max-width: 500px)":{textAlign:`end`,direction:`rtl`}},itemNameFolderTable:{fontWeight:`bold`},itemSizeTable:{display:`inline-block`,width:60,verticalAlign:`top`,textAlign:`right`,whiteSpace:`nowrap`},itemAccessTable:{verticalAlign:`top`,width:60,textAlign:`right`,paddingRight:5,display:`flex`,justifyContent:`center`},itemImageTable:{display:`inline-block`,width:30,marginTop:1,objectFit:`contain`,maxHeight:30},itemNoImageTable:{marginTop:6},itemIconTable:{display:`inline-block`,marginTop:1,width:30,height:30},itemFolderTable:{},itemFolderTemp:{opacity:.4},itemFolderIconTable:e=>({marginTop:`1px`,marginLeft:`8px`,display:`inline-block`,width:30,height:30,color:e.palette.secondary.main||`#fbff7d`}),itemDownloadButtonTable:e=>({display:`inline-block`,width:zW,height:RW,minWidth:zW,verticalAlign:`middle`,textAlign:`center`,padding:0,borderRadius:`${zW/2}px`,"&:hover":{backgroundColor:e.palette.mode===`dark`?`rgba(255, 255, 255, 0.08)`:`rgba(0, 0, 0, 0.08)`},"& span":{pt:`9px`},"& svg":{width:14,height:14,fontSize:`1rem`,mt:`-3px`,verticalAlign:`middle`,color:e.palette.mode===`dark`?`#EEE`:`#111`}}),itemDownloadEmptyTable:{display:`inline-block`,width:zW,height:RW,minWidth:zW,padding:0},itemAclButtonTable:{width:zW,height:RW,minWidth:zW,verticalAlign:`top`,padding:0,fontSize:12,display:`flex`},itemDeleteButtonTable:{display:`inline-block`,width:zW,height:RW,minWidth:zW,verticalAlign:`top`,padding:0,"& svg":{width:18,height:18,fontSize:`1.5rem`}},uploadDiv:{top:0,zIndex:1,bottom:0,left:0,right:0,position:`absolute`,opacity:.9,textAlign:`center`,background:`#FFFFFF`},uploadDivDragging:{opacity:1},uploadCenterDiv:e=>({m:`20px`,border:`3px dashed grey`,borderRadius:`30px`,width:`calc(100% - 40px)`,height:`calc(100% - 40px)`,position:`relative`,color:e.palette.mode===`dark`?`#222`:`#CCC`,display:`flex`,alignItems:`center`,justifyContent:`center`}),uploadCenterIcon:{width:`25%`,height:`25%`},uploadCenterText:{fontSize:24,fontWeight:`bold`},uploadCloseButton:{zIndex:2,position:`absolute`,top:30,right:30},uploadCenterTextAndIcon:{position:`absolute`,height:`30%`,width:`100%`,margin:`auto`,opacity:.3},menuButtonExpertActive:{color:`#c00000`},menuButtonRestrictActive:{color:`#c05000`},pathDiv:e=>({display:`flex`,width:`calc(100% - 16px)`,ml:1,mr:1,textOverflow:`clip`,overflow:`hidden`,whiteSpace:`nowrap`,backgroundColor:e.palette.secondary.main,color:e.palette.secondary.contrastText,borderRadius:`4px 4px 0 0`}),pathDivInput:{width:`100%`},pathDivBreadcrumbDir:e=>({pl:`2px`,pr:`2px`,cursor:`pointer`,color:`white`,"&:hover":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText}}),pathDivBreadcrumbSelected:{color:`#FFF`},backgroundImageLight:{background:`white`},backgroundImageDark:{background:`black`},backgroundImageColored:{background:`silver`},specialFolder:e=>({color:e.palette.mode===`dark`?`#229b0f`:`#5dd300`}),tooltip:{pointerEvents:`none`}},WW=`0_userdata.0`;function GW(e){let t=(e||``).split(`/`);return t.length&&t.pop(),t.join(`/`)}function KW(e){let t=X.getFileExtension(e);return!!(t?.toLowerCase().match(/[a-z]+/)&&t.length<5)}var qW=`Table`,JW=`Tile`;function YW(e,t){return e.folder&&t.folder?e.name>t.name?1:e.name<t.name?-1:0:e.folder?-1:t.folder||e.name>t.name?1:e.name<t.name?-1:0}var XW=class e extends R.Component{imagePrefix;levelPadding;mounted;suppressDeleteConfirm;browseList;browseListRunning;initialReadFinished;supportSubscribes;_tempTimeout;limitToObjectID=null;limitToPath=null;lastSelect=null;lastNav=null;applyingNav=!1;setOpacityTimer=null;cacheFoldersTimeout=null;foldersLoading=null;cacheFolders=null;localStorage;scrollPositions={};refFileDiv;constructor(e){super(e),this.localStorage=window._localStorage||window.localStorage;let t=this.localStorage.getItem(`files.expanded`)||`[]`;if(this.refFileDiv=R.createRef(),this.props.limitPath){let e=this.props.limitPath.split(`/`);this.limitToObjectID=e[0],this.limitToPath=e.length?e.length===1&&e[0]===``?null:e.join(`/`):null,this.limitToPath&&this.limitToPath.endsWith(`/`)&&this.limitToPath.substring(0,this.limitToPath.length-1)}let n;try{n=JSON.parse(t),this.limitToPath&&(n=n.filter(e=>e.startsWith(`${this.limitToPath}/`)||e===this.limitToPath||this.limitToPath?.startsWith(`${e}/`)))}catch{n=[]}let r;r=this.props.showViewTypeButton&&this.localStorage.getItem(`files.viewType`)||qW;let i=this.props.selected||this.localStorage.getItem(`files.selected`)||WW,a;if(e.restrictToFolder){i=e.restrictToFolder,a=e.restrictToFolder;let t=e.restrictToFolder.split(`/`);n=[];let r=``;for(let e=0;e<t.length;e++)r+=(r?`/`:``)+t[e],n.push(r)}else Array.isArray(i)&&(i=i[0]),a=KW(i)?GW(i):i;let o=this.localStorage.getItem(`files.backgroundImage`)||null;this.state={viewType:r,folders:{},filterEmpty:this.localStorage.getItem(`files.empty`)!==`false`,expanded:n,currentDir:a,expertMode:!!e.expertMode,addFolder:!1,uploadFile:!1,deleteItem:``,viewer:``,formatEditFile:``,path:i,selected:i,errorText:``,modalEditOfAccess:!1,backgroundImage:o,queueLength:0,loadAllFolders:!1,fileErrors:[],filterByType:e.filterByType||window.localStorage.getItem(`files.filterByType`)||``,showTypesMenu:null,restrictToFolder:e.restrictToFolder||``,pathFocus:!1,suppressDeleteConfirm:!1},this.imagePrefix=this.props.imagePrefix||`./files/`,this.levelPadding=this.props.levelPadding||20,this.mounted=!0,this.suppressDeleteConfirm=0,this.browseList=[],this.browseListRunning=!1,this.initialReadFinished=!1,this.supportSubscribes=null,this._tempTimeout={}}static getDerivedStateFromProps(e,t){return e.expertMode!==void 0&&e.expertMode!==t.expertMode?{expertMode:e.expertMode,loadAllFolders:!0}:null}async loadFolders(){this.initialReadFinished=!1;let e=await this.browseFolder(`/`);this.state.viewType===qW?e=await this.browseFolders([...this.state.expanded],e):this.state.currentDir&&this.state.currentDir!==`/`&&(!this.limitToObjectID||this.state.currentDir.startsWith(this.limitToObjectID))&&(e=await this.browseFolder(this.state.currentDir,e)),this.setState({folders:e},()=>{if(this.state.viewType===qW&&!this.findItem(this.state.selected)){let e=this.state.selected.split(`/`);for(;e.length&&!this.findItem(e.join(`/`));)e.pop();let t;t=e.length?e.join(`/`):WW,this.setState({selected:t,path:t,pathFocus:!1},()=>this.scrollToSelected())}else this.scrollToSelected();this.initialReadFinished=!0})}scrollToSelected(){this.mounted&&document.getElementById(this.state.selected)?.scrollIntoView()}async componentDidMount(){this.mounted=!0,this.loadFolders().then(()=>this.applyInitialNavigateTo()).catch(e=>console.error(`Cannot load folders: ${e}`)),this.browseList=[],this.browseListRunning=!1,this.supportSubscribes=await this.props.socket.checkFeatureSupported(`BINARY_STATE_EVENT`),this.supportSubscribes&&await this.props.socket.subscribeFiles(`*`,`*`,this.onFileChange)}componentWillUnmount(){this.supportSubscribes&&this.props.socket.unsubscribeFiles(`*`,`*`,this.onFileChange),this.mounted=!1,this.browseList=null,this.browseListRunning=!1,Object.values(this._tempTimeout).forEach(e=>{e&&clearTimeout(e)}),this._tempTimeout={}}browseFoldersCb(e,t,n){if(!e?.length)n(t);else{let r=e.shift();r?this.browseFolder(r,t).catch(e=>console.error(`Cannot read folder ${r}: ${e.message}`)).then(()=>{setTimeout(()=>this.browseFoldersCb(e,t,n),0)}):setTimeout(()=>this.browseFoldersCb(e,t,n),0)}}browseFolders(e,t){let n;return t?n=t:(n={},Object.keys(this.state.folders).forEach(e=>n[e]=this.state.folders[e])),e?.length?new Promise(t=>{this.browseFoldersCb(e,n,t)}):Promise.resolve(n)}readDirSerial(e,t){return new Promise((n,r)=>{this.browseList&&(this.browseList.push({resolve:n,reject:r,adapter:e,relPath:t}),this.browseListRunning||this.processBrowseList())})}processBrowseList(e=0){!this.browseListRunning&&this.browseList&&this.browseList.length&&(this.browseListRunning=!0,this.browseList.length>10&&this.browseList.length%10||this.setState({queueLength:this.browseList.length}),this.browseList[0].processing=!0,this.props.socket.readDir(this.browseList[0].adapter,this.browseList[0].relPath||``).then(t=>{if(this.browseList){let n=this.browseList.shift();if(n){let r=n.resolve;n.resolve=null,n.reject=null,n.adapter=null,n.relPath=null,r&&r(t),this.browseListRunning=!1,this.browseList.length?e<5?this.processBrowseList(e+1):setTimeout(()=>this.processBrowseList(0),0):this.setState({queueLength:0})}else this.setState({queueLength:0})}}).catch(t=>{if(this.browseList){let n=this.browseList.shift();if(n){let r=n.reject;n.resolve=null,n.reject=null,n.adapter=null,n.relPath=null,r&&r(t),this.browseListRunning=!1,this.browseList.length?e<5?this.processBrowseList(e+1):setTimeout(()=>this.processBrowseList(0),0):this.setState({queueLength:0})}else this.setState({queueLength:0})}}))}async browseFolder(e,t,n,r){let i;if(t?i=t:(i={},Object.keys(this.state.folders).forEach(e=>{i[e]=this.state.folders[e]})),i[e]&&!r)return n?Promise.resolve(i):new Promise((t,n)=>{Promise.all(i[e].filter(e=>e.folder).map(e=>this.browseFolder(e.id,i,!0).catch(()=>void 0))).then(()=>t(i)).catch(e=>n(Error(e)))});if(!e||e===`/`){try{let t=await this.props.socket.readMetaItems(),r=[],a=null;if(this.state.restrictToFolder){let e=this.state.restrictToFolder.split(`/`)[0];t=t.filter(t=>t._id===e)}else this.state.expertMode||(t=t.filter(e=>!e._id.endsWith(`.admin`)));let o=t.findIndex(e=>e._id===`system.meta.uuid`);if(o!==-1&&t.splice(o,1),t.forEach(e=>{if(this.limitToObjectID&&this.limitToObjectID!==e._id)return;let t={id:e._id,name:e._id,title:e.common&&e.common.name||e._id,meta:!0,from:e.from,ts:e.ts,color:e.common&&e.common.color,icon:e.common&&e.common.icon,folder:!0,acl:e.acl,level:0};t.id===WW?a=t:r.push(t)}),r.sort((e,t)=>e.id>t.id?1:e.id<t.id?-1:0),(!this.limitToObjectID||this.limitToObjectID===WW)&&a&&r.unshift(a),i[e||`/`]=r,!n)return Promise.all(r.filter(e=>e.folder).map(e=>this.browseFolder(e.id,i,!0).catch(()=>void 0))).then(()=>i)}catch(t){let n=t;this.initialReadFinished&&window.alert(`Cannot read meta items: ${n.message}`),i[e||`/`]=[]}return i}let a=e.split(`/`),o=a.length,s=a.shift(),c=a.join(`/`),l;try{l=await this.readDirSerial(s||``,c)}catch(e){if(e===`Not exists`&&s===`0_userdata.0`)l=[];else throw e}try{let t=[];if(l.forEach(n=>{let r={id:`${e}/${n.file}`,ext:X.getFileExtension(n.file),folder:n.isDir,name:n.file,size:n.stats?.size,modified:n.modifiedAt,acl:n.acl,level:o};this.state.restrictToFolder?(r.folder&&(r.id.startsWith(`${this.state.restrictToFolder}/`)||r.id===this.state.restrictToFolder||this.state.restrictToFolder.startsWith(`${r.id}/`))||r.id.startsWith(`${this.state.restrictToFolder}/`))&&t.push(r):this.limitToPath?(r.folder&&(r.id.startsWith(`${this.limitToPath}/`)||r.id===this.limitToPath||this.limitToPath.startsWith(`${r.id}/`))||r.id.startsWith(`${this.limitToPath}/`))&&t.push(r):t.push(r)}),t.sort(YW),i[e]=t,!n)return Promise.all(t.filter(e=>e.folder).map(e=>this.browseFolder(e.id,i,!0))).then(()=>i)}catch(t){let n=t;this.initialReadFinished&&window.alert(`Cannot read ${s}${c?`/${c}`:``}: ${n?.message}`),i[e]=[]}return i}toggleFolder(e,t){t?.stopPropagation();let n=[...this.state.expanded],r=n.indexOf(e.id);r===-1?(n.push(e.id),n.sort(),this.localStorage.setItem(`files.expanded`,JSON.stringify(n)),e.temp?this.setState({expanded:n}):this.browseFolder(e.id).then(e=>this.setState({expanded:n,folders:e})).catch(t=>window.alert(t===HW?this.props.t(`ra_Cannot find "%s"`,e.id):this.props.t(`ra_Cannot read "%s"`,e.id)))):(n.splice(r,1),this.localStorage.setItem(`files.expanded`,JSON.stringify(n)),this.setState({expanded:n}))}onFileChange=(e,t,n)=>{let r=`${e}/${t}`,i=r.lastIndexOf(`/`),a=r.substring(0,i);console.log(`File changed ${r}[${n}]`),this.state.folders[a]&&(this._tempTimeout[a]&&clearTimeout(this._tempTimeout[a]),this._tempTimeout[a]=setTimeout(()=>{delete this._tempTimeout[a],this.browseFolder(a,null,!1,!0).then(e=>this.setState({folders:e})).catch(e=>console.error(`Cannot read folder: ${e.message}`))},300))};changeFolder(e,t){e?.stopPropagation(),this.lastSelect=Date.now();let n=t||GW(this.state.currentDir);if(n===`/`&&(n=``),this.state.viewType===`Tile`&&this.refFileDiv.current?.scrollTop&&(this.scrollPositions[this.state.currentDir]=this.refFileDiv.current.scrollTop),this.localStorage.setItem(`files.currentDir`,n),t&&e&&(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){this.setState({selected:n});return}if(n&&!this.state.folders[n]){this.browseFolder(n).then(e=>this.setState({folders:e,path:n,currentDir:n,selected:n,pathFocus:!1},()=>this.props.onSelect&&this.props.onSelect(``))).catch(e=>console.error(`Cannot read folder: ${e.message}`));return}this.setState({currentDir:n,selected:n,path:n,pathFocus:!1},()=>{if(this.props.onSelect&&this.props.onSelect(``),this.state.viewType===`Tile`&&this.scrollPositions[this.state.currentDir]){let e=this.scrollPositions[this.state.currentDir];delete this.scrollPositions[this.state.currentDir],this.refFileDiv.current&&(this.refFileDiv.current.scrollTop=e)}})}select(e,t,n){t&&t.stopPropagation(),this.lastSelect=Date.now(),this.localStorage.setItem(`files.selected`,e),this.setState({selected:e,path:e,pathFocus:!1},()=>{if(this.props.onSelect){let t=X.getFileExtension(e);(!this.props.filterFiles||t&&this.props.filterFiles.includes(t))&&(!this.state.filterByType||t&&PW[this.state.filterByType].includes(t))?this.props.onSelect(e,!1,!!this.state.folders[e]):this.props.onSelect(``)}n&&n()})}getText(e){if(e)return typeof e==`object`?e[this.props.lang]||e.en||void 0:e}renderFolder(e,t){if(this.state.filterEmpty&&!this.state.folders[e.id]?.length&&e.id!==WW&&!e.temp)return null;let n=t?XU:YU,r=this.state.viewType===qW?e.level*this.levelPadding:0,i=e.name===WW,a=i||e.name===`vis.0`||e.name===`vis-2.0`,o=X.getStyle(this.props.theme,Q[`itemFolderIcon${this.state.viewType}`],a&&Q.specialFolder);return R.createElement(_x,{component:`div`,key:e.id,id:e.id,style:this.state.viewType===qW?{marginLeft:r,width:`calc(100% - ${r}px)`}:void 0,onClick:t=>this.state.viewType===qW?this.select(e.id,t):this.changeFolder(t,e.id),onDoubleClick:t=>this.state.viewType===qW&&this.toggleFolder(e,t),title:this.getText(e.title),className:`browserItem`,sx:X.getStyle(this.props.theme,Q[`item${this.state.viewType}`],Q[`itemFolder${this.state.viewType}`],this.state.selected===e.id?Q.itemSelected:{},e.temp?Q.itemFolderTemp:{})},R.createElement(n,{style:o,onClick:this.state.viewType===qW?t=>this.toggleFolder(e,t):void 0}),R.createElement(_x,{component:`div`,sx:X.getStyle(this.props.theme,Q[`itemName${this.state.viewType}`],Q[`itemNameFolder${this.state.viewType}`])},i?this.props.t(`ra_User files`):e.name),R.createElement(_x,{component:`div`,style:Q[`itemSize${this.state.viewType}`],sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.state.folders[e.id]?this.state.folders[e.id].length:``),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.props.expertMode?this.formatAcl(e.acl):null),this.state.viewType===qW&&this.props.expertMode?R.createElement(_x,{component:`div`,sx:{...Q.itemDeleteButtonTable,display:{md:`inline-block`,sm:`none`}}}):null,this.state.viewType===qW&&this.props.allowDownload?R.createElement(`div`,{style:Q[`itemDownloadEmpty${this.state.viewType}`]}):null,this.state.viewType===qW&&this.props.allowDelete&&this.state.folders[e.id]&&this.state.folders[e.id].length?R.createElement(uv,{"aria-label":`delete`,onClick:t=>{t.stopPropagation(),this.suppressDeleteConfirm>Date.now()?this.deleteItem(e.id):this.setState({deleteItem:e.id})},sx:Q[`itemDeleteButton${this.state.viewType}`],size:`large`},R.createElement(PO,{fontSize:`small`})):this.state.viewType===qW&&this.props.allowDelete?R.createElement(_x,{component:`div`,sx:Q[`itemDeleteButton${this.state.viewType}`]}):null)}renderBackFolder(){return R.createElement(_x,{component:`div`,key:this.state.currentDir,id:this.state.currentDir,onClick:e=>this.changeFolder(e),title:this.props.t(`ra_Back to %s`,GW(this.state.currentDir)),className:`browserItem`,sx:X.getStyle(this.props.theme,Q[`item${this.state.viewType}`],Q[`itemFolder${this.state.viewType}`])},R.createElement(YU,{style:X.getStyle(this.props.theme,Q[`itemFolderIcon${this.state.viewType}`])}),R.createElement(gO,{sx:Q.itemFolderIconBack}),R.createElement(_x,{component:`div`,sx:X.getStyle(this.props.theme,Q[`itemName${this.state.viewType}`],Q[`itemNameFolder${this.state.viewType}`])},`..`))}formatSize(e){return R.createElement(`div`,{style:Q[`itemSize${this.state.viewType}`]},e||e===0?X.formatBytes(e):``)}formatAcl(e){let t=e?e.permissions||e.file:0,n;return n=t?t.toString(16).padStart(3,`0`):``,R.createElement(`div`,{style:Q[`itemAccess${this.state.viewType}`]},this.props.modalEditOfAccessControl?R.createElement(uv,{size:`large`,onClick:()=>this.setState({modalEditOfAccess:!0}),sx:Q[`itemAclButton${this.state.viewType}`]},n||`---`):n||`---`)}getFileIcon(e){switch(e){case`json`:case`json5`:return R.createElement(bO,{style:Q[`itemIcon${this.state.viewType}`]});case`css`:return R.createElement(xO,{style:Q[`itemIcon${this.state.viewType}`]});case`js`:case`ts`:return R.createElement(OO,{style:Q[`itemIcon${this.state.viewType}`]});case`html`:case`md`:return R.createElement(FO,{style:Q[`itemIcon${this.state.viewType}`]});case`mp3`:case`ogg`:case`wav`:case`m4a`:case`mp4`:case`flac`:return R.createElement($O,{style:Q[`itemIcon${this.state.viewType}`]});default:return R.createElement(qO,{style:Q[`itemIcon${this.state.viewType}`]})}}static getEditFile(e){switch(e){case`json`:case`json5`:case`js`:case`html`:case`txt`:case`css`:case`log`:case`csv`:return!0;default:return!1}}setStateBackgroundImage=()=>{let e=[`light`,`dark`,`colored`,`delete`];this.setState(({backgroundImage:t})=>t&&e.indexOf(t)!==-1&&e.length-1!==e.indexOf(t)?(this.localStorage.setItem(`files.backgroundImage`,e[e.indexOf(t)+1]),{backgroundImage:e[e.indexOf(t)+1]}):(this.localStorage.setItem(`files.backgroundImage`,e[0]),{backgroundImage:e[0]}))};getStyleBackgroundImage=()=>{switch(this.state.backgroundImage){case`light`:return Q.backgroundImageLight;case`dark`:return Q.backgroundImageDark;case`colored`:return Q.backgroundImageColored;case`delete`:return null;default:return null}};renderFile(t){let n=this.state.viewType===qW?t.level*this.levelPadding:0,r=X.getFileExtension(t.name);return R.createElement(_x,{component:`div`,key:t.id,id:t.id,onDoubleClick:e=>{e.stopPropagation(),this.props.onSelect?(!this.props.filterFiles||t.ext&&this.props.filterFiles.includes(t.ext))&&(!this.state.filterByType||t.ext&&PW[this.state.filterByType].includes(t.ext))&&this.props.onSelect(t.id,!0,!!this.state.folders[t.id]):this.setState({viewer:this.imagePrefix+t.id,formatEditFile:r})},onClick:e=>this.select(t.id,e),style:this.state.viewType===qW?{marginLeft:n,width:`calc(100% - ${n}px)`}:void 0,className:`browserItem`,sx:X.getStyle(this.props.theme,Q[`item${this.state.viewType}`],Q[`itemFile${this.state.viewType}`],this.state.selected===t.id?Q.itemSelected:void 0)},r&&PW.images.includes(r)?this.state.fileErrors.includes(t.id)?R.createElement(ZU,{style:{...Q[`itemImage${this.state.viewType}`],...this.getStyleBackgroundImage(),...Q[`itemNoImage${this.state.viewType}`]}}):R.createElement(MW,{onError:e=>{e.target.onerror=null;let n=[...this.state.fileErrors];n.includes(t.id)||(n.push(t.id),this.setState({fileErrors:n}))},style:{...Q[`itemImage${this.state.viewType}`],...this.getStyleBackgroundImage()},src:this.imagePrefix+t.id,alt:t.name}):this.getFileIcon(r),R.createElement(_x,{component:`div`,sx:Q[`itemName${this.state.viewType}`]},t.name),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.formatSize(t.size)),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.props.expertMode?this.formatAcl(t.acl):null),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.props.expertMode&&e.getEditFile(r)?R.createElement(uv,{"aria-label":`edit`,onClick:e=>{e.stopPropagation(),this.props.onSelect?(!this.props.filterFiles||t.ext&&this.props.filterFiles.includes(t.ext))&&(!this.state.filterByType||t.ext&&PW[this.state.filterByType].includes(t.ext))&&this.props.onSelect(t.id,!0,!!this.state.folders[t.id]):this.setState({viewer:this.imagePrefix+t.id,formatEditFile:r})},sx:Q.itemDeleteButtonTable,size:`large`},R.createElement(LO,{fontSize:`small`})):R.createElement(_x,{component:`div`,sx:Q[`itemDeleteButton${this.state.viewType}`]})),this.state.viewType===qW&&this.props.allowDownload?R.createElement(_x,{component:`a`,className:`MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeLarge`,sx:Q.itemDownloadButtonTable,tabIndex:0,download:t.id,href:this.imagePrefix+t.id,onClick:e=>e.stopPropagation()},R.createElement(ok,null)):null,this.state.viewType===qW&&this.props.allowDelete&&t.id!==`vis.0/`&&t.id!==`vis-2.0/`&&t.id!==WW?R.createElement(uv,{"aria-label":`delete`,onClick:e=>{e.stopPropagation(),this.suppressDeleteConfirm>Date.now()?this.deleteItem(t.id):this.setState({deleteItem:t.id})},sx:Q[`itemDeleteButton${this.state.viewType}`],size:`large`},R.createElement(PO,{fontSize:`small`})):this.state.viewType===qW&&this.props.allowDelete?R.createElement(_x,{component:`div`,sx:Q[`itemDeleteButton${this.state.viewType}`]}):null)}renderItems(e){if(this.state.folders?.[e]){if(this.state.viewType===JW){let t=[];return e&&e!==`/`&&t.push(this.renderBackFolder()),this.state.folders[e].forEach(e=>{e.folder?t.push(this.renderFolder(e)):(!this.props.filterFiles||e.ext&&this.props.filterFiles.includes(e.ext))&&(!this.state.filterByType||e.ext&&PW[this.state.filterByType].includes(e.ext))&&t.push(this.renderFile(e))}),t}let t=[];return this.state.folders[e].forEach(e=>{if(e.folder){let n=this.state.expanded.includes(e.id),r=this.renderFolder(e,n);if(Array.isArray(r)?r.forEach(e=>t.push(e)):t.push(r),this.state.folders[e.id]&&n){let n=this.renderItems(e.id);Array.isArray(n)?n.forEach(e=>t.push(e)):t.push(n)}}else(!this.props.filterFiles||e.ext&&this.props.filterFiles.includes(e.ext))&&(!this.state.filterByType||e.ext&&PW[this.state.filterByType].includes(e.ext))&&t.push(this.renderFile(e))}),t}return R.createElement(`div`,{style:{position:`relative`}},R.createElement(iv,{key:e,color:`secondary`,size:24}),R.createElement(`div`,{style:{position:`absolute`,zIndex:2,top:4,width:24,textAlign:`center`}},this.state.queueLength))}renderToolbar(){let e=this.props.showTypeSelector?UW[this.state.filterByType||`all`]||UW.all:null,t=this.findFirstFolder(this.state.selected);return R.createElement(ND,{key:`toolbar`,variant:`dense`},this.props.allowNonRestricted&&this.props.restrictToFolder?R.createElement(uv,{edge:`start`,title:this.state.restrictToFolder?this.props.t(`ra_Show all folders`):this.props.t(`ra_Restrict to folder`),style:{...Q.menuButton,...this.state.restrictToFolder?Q.menuButtonRestrictActive:void 0},"aria-label":`restricted to folder`,onClick:()=>this.setState({restrictToFolder:(this.state.restrictToFolder?``:this.props.restrictToFolder)||``,loadAllFolders:!0}),size:`small`},R.createElement(VO,{fontSize:`small`})):null,this.props.showExpertButton?R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Toggle expert mode`),style:{...Q.menuButton,...this.state.expertMode?Q.menuButtonExpertActive:void 0},"aria-label":`expert mode`,onClick:()=>this.setState({expertMode:!this.state.expertMode}),size:`small`},R.createElement(JU,null)):null,this.props.showViewTypeButton?R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Toggle view mode`),style:Q.menuButton,"aria-label":`view mode`,onClick:()=>{let e=this.state.viewType===qW?JW:qW;this.localStorage.setItem(`files.viewType`,e);let t=this.state.selected;KW(t)&&(t=GW(t)),this.setState({viewType:e,currentDir:t},()=>{this.state.viewType===qW&&this.scrollToSelected()})},size:`small`},this.state.viewType===qW?R.createElement(_k,{fontSize:`small`}):R.createElement(XO,{fontSize:`small`})):null,R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Hide empty folders`),style:Q.menuButton,color:this.state.filterEmpty?`secondary`:`inherit`,"aria-label":`filter empty`,onClick:()=>{this.localStorage.setItem(`file.empty`,this.state.filterEmpty?`false`:`true`),this.setState({filterEmpty:!this.state.filterEmpty})},size:`small`},R.createElement(BO,{fontSize:`small`})),R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Reload files`),style:Q.menuButton,color:`inherit`,"aria-label":`reload files`,onClick:()=>this.setState({folders:{}},()=>this.loadFolders()),size:`small`},R.createElement(rk,{fontSize:`small`})),this.props.allowCreateFolder?R.createElement(uv,{edge:`start`,disabled:!this.state.selected||!t||!!this.limitToPath&&!this.state.selected.startsWith(`${this.limitToPath}/`)&&this.limitToPath!==this.state.selected,title:this.props.t(`ra_Create folder`),style:Q.menuButton,color:`inherit`,"aria-label":`add folder`,onClick:()=>this.setState({addFolder:!0}),size:`small`},R.createElement(MO,{fontSize:`small`})):null,this.props.allowUpload?R.createElement(uv,{edge:`start`,disabled:!this.state.selected||!t||!!this.limitToPath&&!this.state.selected.startsWith(`${this.limitToPath}/`)&&this.limitToPath!==this.state.selected,title:this.props.t(`ra_Upload file`),style:Q.menuButton,color:`inherit`,"aria-label":`upload file`,onClick:()=>this.setState({uploadFile:!0}),size:`small`},R.createElement(nk,{fontSize:`small`})):null,this.props.showTypeSelector&&e?R.createElement(HE,{title:this.props.t(`ra_Filter files`),slotProps:{popper:{sx:Q.tooltip}}},R.createElement(uv,{size:`small`,onClick:e=>this.setState({showTypesMenu:e.target})},R.createElement(e,{fontSize:`small`}))):null,this.state.showTypesMenu?R.createElement(jT,{open:!0,anchorEl:this.state.showTypesMenu,onClose:()=>this.setState({showTypesMenu:null})},Object.keys(UW).map(e=>{let t=UW[e];return R.createElement(LT,{key:e,selected:this.state.filterByType===e,onClick:()=>{e===`all`?(this.localStorage.removeItem(`files.filterByType`),this.setState({filterByType:``,showTypesMenu:null})):(this.localStorage.setItem(`files.filterByType`,e),this.setState({filterByType:e,showTypesMenu:null}))}},R.createElement(rT,null,R.createElement(t,{fontSize:`small`})),R.createElement(cT,null,this.props.t(`ra_fileType_${e}`)))})):null,R.createElement(HE,{title:this.props.t(`ra_Background image`),slotProps:{popper:{sx:Q.tooltip}}},R.createElement(uv,{color:`inherit`,edge:`start`,style:Q.menuButton,onClick:this.setStateBackgroundImage,size:`small`},R.createElement(CO,{fontSize:`small`}))),this.state.viewType!==qW&&this.props.allowDelete?R.createElement(HE,{title:this.props.t(`ra_Delete`),slotProps:{popper:{sx:Q.tooltip}}},R.createElement(`span`,null,R.createElement(uv,{"aria-label":`delete`,disabled:!this.state.selected||this.state.selected===`vis.0/`||this.state.selected===`vis-2.0/`||this.state.selected===WW,color:`inherit`,edge:`start`,style:Q.menuButton,onClick:e=>{e.stopPropagation(),this.suppressDeleteConfirm>Date.now()?this.deleteItem(this.state.selected):this.setState({deleteItem:this.state.selected})},size:`small`},R.createElement(PO,{fontSize:`small`})))):null)}findItem(e,t){if(t||=this.state.folders,!t)return null;let n=e.split(`/`);n.pop();let r=n.join(`/`)||`/`;return t[r]&&t[r].find(t=>t.id===e)||null}renderInputDialog(){if(this.state.addFolder){let e=this.findFirstFolder(this.state.selected);return e?R.createElement(qU,{key:`inputDialog`,applyText:this.props.t(`ra_Create`),cancelText:this.props.t(`ra_Cancel`),titleText:this.props.t(`ra_Create new folder in %s`,this.state.selected),promptText:this.props.t(`ra_If no file will be created in the folder, it will disappear after the browser closed`),labelText:this.props.t(`ra_Folder name`),verify:t=>this.state.folders[e].find(e=>e.name===t)?this.props.t(`ra_Duplicate name`):``,onClose:t=>{if(t){let n={};Object.keys(this.state.folders).forEach(e=>n[e]=this.state.folders[e]);let r=this.findItem(e),i=`${e}/${t}`;n[e].push({id:i,level:(r?.level||0)+1,name:t,folder:!0,temp:!0}),n[e].sort(YW),n[i]=[];let a=[...this.state.expanded];a.includes(e)||(a.push(e),a.sort()),this.localStorage.setItem(`files.expanded`,JSON.stringify(a)),this.setState({addFolder:!1,folders:n,expanded:a},()=>this.select(i))}else this.setState({addFolder:!1})},replace:e=>e.replace(/[^-_\w]/,`_`)}):(window.alert(this.props.t(`ra_Invalid parent folder!`)),null)}return null}viewerToId(e){return e.startsWith(this.imagePrefix)?e.substring(this.imagePrefix.length):e}getStateNav(){return this.state.viewer?{mode:`view`,id:this.viewerToId(this.state.viewer)}:this.state.selected?{mode:`select`,id:this.state.selected}:null}static navEqual(e,t){return!e||!t?!e&&!t:e.mode===t.mode&&e.id===t.id}applyNavigateTo(e){this.applyingNav=!0;let t=()=>{this.applyingNav=!1};if(!e?.id){this.setState({viewer:``,formatEditFile:``},t);return}let{id:n}=e;this.select(n,null,()=>{this.scrollToSelected(),e.mode===`view`?this.setState({viewer:this.imagePrefix+n,formatEditFile:X.getFileExtension(n)},t):this.setState({viewer:``,formatEditFile:``},t)})}applyInitialNavigateTo(){let e=this.props.navigateTo??null;e?.id?(this.lastNav=e,this.applyNavigateTo(e)):this.lastNav=this.getStateNav()}reconcileNavigation(t){if(this.props.navigateTo===void 0&&!this.props.onNavigateTo||this.applyingNav)return;let n=this.props.navigateTo??null,r=this.getStateNav();if(e.navEqual(n,r)){this.lastNav=r;return}e.navEqual(n,t.navigateTo??null)?e.navEqual(r,this.lastNav)||(this.lastNav=r,this.props.onNavigateTo?.(r)):(this.lastNav=n,this.applyNavigateTo(n))}componentDidUpdate(e){this.setOpacityTimer&&clearTimeout(this.setOpacityTimer),this.setOpacityTimer=setTimeout(()=>{this.setOpacityTimer=null;let e=window.document.getElementsByClassName(`browserItem`);for(let t=0;t<e.length;t++)e[t].style.opacity=`1`},100),this.reconcileNavigation(e)}findFirstFolder(e){let t=e,n=this.findItem(t);if(n&&!n.folder){let e=t.split(`/`);for(e.pop(),t=``;e.length;){if(this.findItem(e.join(`/`))?.folder){t=e.join(`/`);break}e.pop()}if(!e.length)return null}return t}async uploadFile(e,t){let n=e.split(`/`),r=n.shift();try{await this.props.socket.writeFile64(r||``,n.join(`/`),t)}catch(e){let t=e;window.alert(`Cannot write file: ${t?.message}`)}}renderUpload(){return this.state.uploadFile?[R.createElement(EC,{key:`close`,color:`primary`,"aria-label":`close`,style:Q.uploadCloseButton,onClick:()=>this.setState({uploadFile:!1})},R.createElement(DO,null)),R.createElement(RU,{key:`dropzone`,onDragEnter:()=>this.setState({uploadFile:`dragging`}),onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:e=>{let t=e.length;e.forEach(e=>{let n=new FileReader;n.onabort=()=>console.log(`file reading was aborted`),n.onerror=()=>console.log(`file reading has failed`),n.onload=()=>{let r=this.findFirstFolder(this.state.selected);if(!r)window.alert(this.props.t(`ra_Invalid parent folder!`));else{let i=`${r}/${e.name}`;this.uploadFile(i,n.result).then(()=>{--t||this.setState({uploadFile:!1},()=>{if(this.supportSubscribes){let e=[...this.state.expanded];e.includes(r)||(e.push(r),e.sort(),this.localStorage.setItem(`files.expanded`,JSON.stringify(e))),this.setState({expanded:e},()=>this.select(i))}else setTimeout(()=>this.browseFolder(r,null,!1,!0).then(e=>{let t=[...this.state.expanded];t.includes(r)||(t.push(r),t.sort(),this.localStorage.setItem(`files.expanded`,JSON.stringify(t))),this.setState({folders:e,expanded:t},()=>this.select(i))}),500)})})}},n.readAsArrayBuffer(e)})}},({getRootProps:e,getInputProps:t})=>R.createElement(`div`,{style:{...Q.uploadDiv,...this.state.uploadFile===`dragging`?Q.uploadDivDragging:void 0},...e()},R.createElement(`input`,{...t()}),R.createElement(_x,{component:`div`,sx:Q.uploadCenterDiv},R.createElement(`div`,{style:Q.uploadCenterTextAndIcon},R.createElement(nk,{style:Q.uploadCenterIcon}),R.createElement(`div`,{style:Q.uploadCenterText},this.state.uploadFile===`dragging`?this.props.t(`ra_Drop file here`):this.props.t(`ra_Place your files here or click here to open the browse dialog`))))))]:null}deleteRecursive(e){let t=this.findItem(e);if(t?.folder)return(this.state.folders[e]?Promise.all(this.state.folders[e].map(e=>this.deleteRecursive(e.id))):Promise.resolve()).then(()=>{if(t.level>=1){let n=e.split(`/`),r=n.shift();this.props.socket.deleteFolder(r||``,n.join(`/`)).then(()=>{let e=JSON.parse(JSON.stringify(this.state.folders));delete e[t.id];let n=GW(t.id),r=e[n];if(r){let i=r.findIndex(e=>e.id===t.id);i!==-1&&r.splice(i,1),this.select(n,null,()=>this.setState({folders:e}))}})}});let n=e.split(`/`),r=n.shift();return n.length?this.props.socket.deleteFile(r||``,n.join(`/`)).catch(e=>window.alert(`Cannot delete file: ${e}`)):Promise.resolve()}deleteItem(e){e||=this.state.deleteItem,this.state.suppressDeleteConfirm&&(this.suppressDeleteConfirm=Date.now()+6e4*5),this.setState({deleteItem:``,suppressDeleteConfirm:!1},()=>this.deleteRecursive(e).then(()=>{let t={},n=this.state.expanded.indexOf(e);if(n!==-1){let e=[...this.state.expanded];e.splice(n,1),this.localStorage.setItem(`files.expanded`,JSON.stringify(e)),t.expanded=e}if(this.state.selected===e){let e=this.state.selected.split(`/`);e.pop(),t.selected=e.join(`/`)}if(this.supportSubscribes)this.setState(t);else{let n=this.findFirstFolder(e),r={};Object.keys(this.state.folders).forEach(e=>{e!==n&&!e.startsWith(`${n}/`)&&(r[e]=this.state.folders[e])}),t.folders=r,this.setState(t,()=>setTimeout(()=>{this.browseFolders([...this.state.expanded],r).then(e=>this.setState({folders:e})).catch(e=>console.error(e))},200))}}))}renderDeleteDialog(){return this.state.deleteItem?R.createElement(rC,{key:`deleteDialog`,open:!0,onClose:()=>this.setState({deleteItem:``}),"aria-labelledby":`ar_dialog_file_delete_title`},R.createElement(bC,{id:`ar_dialog_file_delete_title`},this.props.t(`ra_Confirm deletion of %s`,this.state.deleteItem.split(`/`).pop()||``)),R.createElement(pC,null,R.createElement(_C,null,this.props.t(`ra_Are you sure?`)),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.suppressDeleteConfirm,onChange:()=>{this.setState({suppressDeleteConfirm:!this.state.suppressDeleteConfirm})}}),label:this.props.t(`ra_no confirm for 5 mins`)})),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.deleteItem(``),color:`primary`,autoFocus:!0},this.props.t(`ra_Delete`)),R.createElement(Vx,{variant:`contained`,onClick:()=>this.setState({deleteItem:``}),color:`grey`},this.props.t(`ra_Cancel`)))):null}renderViewDialog(){let e=this.props.FileViewer||LW;return this.state.viewer?R.createElement(e,{supportSubscribes:this.supportSubscribes||void 0,key:this.state.viewer,href:this.state.viewer,formatEditFile:this.state.formatEditFile||void 0,themeType:this.props.themeType||`light`,setStateBackgroundImage:this.setStateBackgroundImage,getStyleBackgroundImage:this.getStyleBackgroundImage,t:this.props.t,socket:this.props.socket,onClose:()=>this.setState({viewer:``,formatEditFile:``})}):null}renderError(){return this.state.errorText?R.createElement(Yk,{key:`errorDialog`,text:this.state.errorText,onClose:()=>this.setState({errorText:``})}):null}updateItemsAcl(e){this.cacheFolders||=JSON.parse(JSON.stringify(this.state.folders));let t;e.forEach(e=>{let n=this.findItem(e.id,this.cacheFolders);n&&JSON.stringify(n.acl)!==JSON.stringify(e.acl)&&(n.acl=e.acl,t=!0)}),t&&(this.cacheFoldersTimeout&&clearTimeout(this.cacheFoldersTimeout),this.cacheFoldersTimeout=setTimeout(()=>{this.cacheFoldersTimeout=null;let e=this.cacheFolders||{};this.cacheFolders=null,this.setState({folders:e})},200))}changeToPath(){setTimeout(()=>{if(this.state.path!==this.state.selected&&(!this.lastSelect||Date.now()-this.lastSelect>100)){let e=this.state.path;KW(this.state.path)&&(e=GW(this.state.path)),new Promise(t=>{this.state.folders[e]?t(!0):this.browseFolder(e).then(e=>this.setState({folders:e},()=>t(!0))).catch(t=>this.setState({errorText:t===HW?this.props.t(`ra_Cannot find "%s"`,e):this.props.t(`ra_Cannot read "%s"`,e)}))}).then(t=>t&&this.setState({selected:this.state.path,currentDir:e,pathFocus:!1})).catch(e=>console.error(e))}else(!this.lastSelect||Date.now()-this.lastSelect>100)&&this.setState({pathFocus:!1})},100)}renderBreadcrumb(){let e=this.state.currentDir.startsWith(`/`)?this.state.currentDir.split(`/`):`/${this.state.currentDir}`.split(`/`),t=[];return R.createElement(kx,{style:{paddingLeft:8,color:`#FFF`}},e.map((n,r)=>{n&&t.push(n);let i=t.join(`/`);return r<e.length-1?R.createElement(_x,{component:`div`,key:`${this.state.selected}_${r}`,sx:Q.pathDivBreadcrumbDir,onClick:e=>this.changeFolder(e,i||`/`)},n||this.props.t(`ra_Root`)):R.createElement(`div`,{style:Q.pathDivBreadcrumbSelected,key:`${this.state.selected}_${r}`,onClick:()=>this.setState({pathFocus:!0})},n)}))}renderPath(){return R.createElement(_x,{component:`div`,key:`path`,sx:Q.pathDiv},this.state.pathFocus?R.createElement(fw,{value:this.state.path,onKeyDown:e=>{e.key===`Enter`?this.changeToPath():e.key===`Escape`&&this.setState({pathFocus:!1})},endAdornment:R.createElement(uv,{size:`small`,onClick:()=>this.changeToPath()},R.createElement(JO,null)),onBlur:()=>this.changeToPath(),onChange:e=>this.setState({path:e.target.value}),style:Q.pathDivInput}):this.renderBreadcrumb())}render(){return this.props.ready?(this.state.loadAllFolders&&!this.foldersLoading&&(this.foldersLoading=!0,setTimeout(()=>{this.setState({loadAllFolders:!1,folders:{}},()=>{this.foldersLoading=!1,this.loadFolders().catch(e=>console.error(`Cannot load folders: ${e}`))})},300)),R.createElement(`div`,{style:{...Q.root,...this.props.style},className:this.props.className},this.props.showToolbar?this.renderToolbar():null,this.state.viewType===JW?this.renderPath():null,R.createElement(`div`,{style:{...Q.filesDiv,...Q[`filesDiv${this.state.viewType}`]},onClick:e=>{this.state.viewType!==qW&&(this.state.selected===(this.state.currentDir||`/`)?e.stopPropagation():this.changeFolder(e,this.state.currentDir||`/`))},id:`dev`,ref:this.refFileDiv},this.state.viewType===qW?this.renderItems(`/`):this.renderItems(this.state.currentDir||`/`),this.state.viewType===qW?null:R.createElement(`div`,{style:Q.filesDivHint},this.props.t(`ra_select_folder_hint`))),this.props.allowUpload?this.renderInputDialog():null,this.props.allowUpload?this.renderUpload():null,this.props.allowDelete?this.renderDeleteDialog():null,this.props.allowView?this.renderViewDialog():null,this.state.modalEditOfAccess&&this.props.modalEditOfAccessControl?this.props.modalEditOfAccessControl(this):null,this.renderError())):R.createElement(jw,null)}};GU()(XW);function ZW(e){let t=document.createElement(`div`);t.innerHTML=e;let n=t.firstElementChild;return n?.remove?n.remove():n&&t.removeChild(n),t.remove(),n}function QW(e){let t={};if(!e)return t;for(let n,r=0;r<e.length;r++){let i=e[r].name;n=i===`class`?`className`:i.startsWith(`data-`)?i:i.replace(/[-|:]([a-z])/g,e=>e[1].toUpperCase()),t[n]=e[r].value}return t}(class e extends R.Component{svg;static REMOTE_SERVER=window.location.hostname.includes(`iobroker.in`);static REMOTE_PREFIX=window.location.pathname.substring(0,window.location.pathname.lastIndexOf(`/`)+1);constructor(e){super(e),this.state={svg:!!this.props.src?.startsWith(`data:`),created:!0,color:this.props.color||``,src:this.props.src||``,imgError:!1,showError:!!this.props.showError},this.svg=this.state.svg&&this.state.src?this.getSvgFromData(this.state.src):null}static getDerivedStateFromProps(e,t){let n={},r=!1;return e&&t&&e.src!==t.src&&(n.src=e.src,n.svg=e.src?.startsWith(`data:`),n.created=!1,r=!0),e&&t&&e.color!==t.color&&(n.color=e.color,n.created=!1,r=!0),e&&t&&e.showError!==t.showError&&(n.showError=e.showError,r=!0),r?n:null}getSvgFromData(e){if(!e.startsWith(`data:image/svg+xml;base64,`))return null;e=e.substring(26);try{e=atob(e);let t=ZW(e),n,r;return t&&(n=t.innerHTML,r=QW(t.attributes),t.remove()),R.createElement(_x,{component:`svg`,sx:this.props.sx,className:this.props.className,style:this.state.color?{color:this.state.color}:void 0,...r,dangerouslySetInnerHTML:{__html:n||``}})}catch{}return null}render(){if(this.state.svg)return this.state.created||setTimeout(()=>{this.svg=this.state.src?this.getSvgFromData(this.state.src):null,this.setState({created:!0})},50),this.svg;if(this.state.src){if(this.state.imgError||!this.state.src)return R.createElement(ZU,{className:this.props.className});if(e.REMOTE_SERVER&&!this.state.src.startsWith(`http://`)&&!this.state.src.startsWith(`https://`)){let t=(this.props.imagePrefix||``)+this.state.src;return t.startsWith(`./`)?t=e.REMOTE_PREFIX+t.substring(2):t.startsWith(`/`)||(t=e.REMOTE_PREFIX+t),R.createElement(_x,{component:`img`,sx:this.props.sx,className:this.props.className,src:`https://remote-files.iobroker.in${t}`,alt:``,onError:()=>this.props.showError?this.setState({imgError:!0}):this.setState({src:``})})}return R.createElement(_x,{component:`img`,sx:this.props.sx,className:this.props.className,src:(this.props.imagePrefix||``)+this.state.src,alt:``,onError:()=>this.props.showError?this.setState({imgError:!0}):this.setState({src:``})})}return null}});var $W=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StateType=e.Types=void 0;var t;(function(e){e.unknown=`unknown`,e.airCondition=`airCondition`,e.blind=`blind`,e.blindButtons=`blindButtons`,e.button=`button`,e.buttonSensor=`buttonSensor`,e.camera=`camera`,e.chart=`chart`,e.cie=`cie`,e.ct=`ct`,e.dimmer=`dimmer`,e.door=`door`,e.fireAlarm=`fireAlarm`,e.floodAlarm=`floodAlarm`,e.gate=`gate`,e.hue=`hue`,e.humidity=`humidity`,e.illuminance=`illuminance`,e.image=`image`,e.info=`info`,e.instance=`instance`,e.light=`light`,e.location=`location`,e.locationOne=`locationOne`,e.lock=`lock`,e.media=`media`,e.motion=`motion`,e.percentage=`percentage`,e.rgb=`rgb`,e.rgbSingle=`rgbSingle`,e.rgbwSingle=`rgbwSingle`,e.slider=`slider`,e.socket=`socket`,e.temperature=`temperature`,e.fillLevel=`fillLevel`,e.thermostat=`thermostat`,e.vacuumCleaner=`vacuumCleaner`,e.volume=`volume`,e.volumeGroup=`volumeGroup`,e.warning=`warning`,e.weatherCurrent=`weatherCurrent`,e.weatherForecast=`weatherForecast`,e.window=`window`,e.windowTilt=`windowTilt`})(t||(e.Types=t={}));var n;(function(e){e.Number=`number`,e.String=`string`,e.Boolean=`boolean`})(n||(e.StateType=n={}))})),eG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkEnum=t,e.roleOrEnum=n,e.roleOrEnumLight=a,e.roleOrEnumBlind=c,e.roleOrEnumGate=d,e.roleOrEnumWindow=p,e.roleOrEnumDoor=g,e.getEnums=_,e.getAllStatesInChannel=v,e.getAllStatesInDevice=y,e.getObjectsBelowId=b,e.getFunctionEnums=x,e.getParentId=S;function t(e,t){let n=!1;return e&&e.forEach(e=>{let r=e.lastIndexOf(`.`);r!==-1&&(e=e.substring(r+1));for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&t[r].find(t=>t.test(e)))return n=!0,!1}),n}function n(e,n,r,i){return e.common.role&&r?.includes(e.common.role)?!0:t(n,i)}var r={en:[/lights?/i,/lamps?/i,/ceilings?/i],de:[/licht(er)?/i,/lampen?/i,/beleuchtung(en)?/i],ru:[/свет/i,/ламп[аы]/i,/торшеры?/,/подсветк[аи]/i,/лампочк[аи]/i,/светильники?/i]},i=[`switch.light`,`dimmer`,`value.dimmer`,`level.dimmer`,`sensor.light`,`state.light`];function a(e,t){return n(e,t,i,r)}var o={en:[/blinds?/i,/windows?/i,/shutters?/i],de:[/rollladen?/i,/fenstern?/i,/beschattung(en)?/i,/jalousien?/i],ru:[/ставни/i,/рольставни/i,/окна|окно/,/жалюзи/i]},s=[`blind`,`level.blind`,`value.blind`,`action.stop`,`button.stop`,`button.stop.blind`,`button.open.blind`,`button.close.blind`,`level.tilt`,`value.tilt`,`button.tilt.open`,`button.tilt.close`,`button.tilt.stop`];function c(e,t){return n(e,t,s,o)}var l={en:[/gates?/i],de:[/^toren$/i,/^tor$/i],ru:[/ворота/i]},u=[`gate`,`value.gate`,`switch.gate`,`action.stop`,`button.stop`];function d(e,t){return n(e,t,u,l)}var f=[`window`,`state.window`,`sensor.window`,`value.window`];function p(e,t){return n(e,t,f,o)}var m={en:[/doors?/i,/gates?/i,/wickets?/i,/entry|entries/i],de:[/^türe?/i,/^tuere?/i,/^tore?$/i,/einfahrt(en)?/i,/pforten?/i],ru:[/двери|дверь/i,/ворота/i,/калитка|калитки/,/въезды?/i,/входы?/i]},h=[`door`,`state.door`,`sensor.door`];function g(e,t){return n(e,t,h,m)}function _(){return{door:{roles:h,words:m},window:{roles:f,words:o},blind:{roles:s,words:o},gate:{roles:u,words:l},light:{roles:i,words:r}}}function v(e,t){let n=[],r=RegExp(`^${t.replace(/([$^.)([\]{}])/g,`\\$1`)}\\.[^.]+$`);return e.forEach(e=>r.test(e)&&n.push(e)),n}function y(e,t){let n=[],r=RegExp(`^${t.replace(/([$^.)([\]{}])/g,`\\$1`)}\\.[^.]+\\.[^.]+$`);return e.forEach(e=>r.test(e)&&n.push(e)),n}function b(e,t){let n=[];t+=`.`;let r=0,i=e.length-1,a=-1;for(;r<=i;){let n=Math.floor((r+i)/2);e[n]<t?r=n+1:(a=n,i=n-1)}if(a===-1||a>=e.length)return n;for(let r=a;r<e.length;r++){let i=e[r];if(i===t||i.startsWith(t))n.push(i);else break}return n}function x(e,t){let n=[],r=/^enum\.functions\./,i=b(t,`enum`);for(let t of i)Object.prototype.hasOwnProperty.call(e,t)&&r.test(t)&&e[t]?.type===`enum`&&e[t].common?.members?.length&&n.push(t);return n}function S(e){let t=e.lastIndexOf(`.`);return t===-1?e:e.substring(0,t)}})),tG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.patterns=void 0;var t=$W(),n=eG(),r=/^[^.]+\.setting\./,i={working:{role:/^indicator\.working$/,indicator:!0,notSingle:!0,name:`WORKING`,required:!1,defaultRole:`indicator.working`,defaultType:t.StateType.Boolean},unreach:{role:/^indicator(\.maintenance)?\.unreach$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`UNREACH`,required:!1,defaultRole:`indicator.maintenance.unreach`},lowbat:{role:/^indicator(\.maintenance)?\.(lowbat|battery)$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`LOWBAT`,required:!1,defaultRole:`indicator.maintenance.lowbat`},maintain:{role:/^indicator\.maintenance$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`MAINTAIN`,required:!1,defaultRole:`indicator.maintenance`},error:{role:/^indicator\.error$/,indicator:!0,notSingle:!0,name:`ERROR`,required:!1,defaultRole:`indicator.error`,defaultType:t.StateType.String},direction:{role:/^indicator\.direction$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`DIRECTION`,required:!1,defaultRole:`indicator.direction`},direction_enum:{role:/^(indicator|value)\.direction$/,type:t.StateType.Number,notSingle:!0,name:`DIRECTION`,required:!1,defaultStates:{0:`None`,1:`Up/Open`,2:`Down/Close`,3:`Unknown`},defaultRole:`value.direction`},reachable:{role:/^indicator\.reachable$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`CONNECTED`,required:!1,defaultRole:`indicator.reachable`,inverted:!0},battery:{role:/^value\.battery$/,indicator:!1,type:t.StateType.Number,write:!1,name:`BATTERY`,required:!1,defaultRole:`value.battery`,defaultUnit:`%`}},a={power:{role:/^value\.power$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ELECTRIC_POWER`,required:!1,defaultRole:`value.power`,defaultUnit:`W`},current:{role:/^value\.current$/,indicator:!1,type:t.StateType.Number,write:!1,name:`CURRENT`,required:!1,defaultRole:`value.current`,defaultUnit:`mA`},voltage:{role:/^value\.voltage$/,indicator:!1,type:t.StateType.Number,write:!1,name:`VOLTAGE`,required:!1,defaultRole:`value.voltage`,defaultUnit:`V`},consumption:{role:/^value\.power\.consumption$/,indicator:!1,type:t.StateType.Number,write:!1,name:`CONSUMPTION`,required:!1,defaultRole:`value.power.consumption`,defaultUnit:`Wh`},frequency:{role:/^value\.frequency$/,indicator:!1,type:t.StateType.Number,write:!1,name:`FREQUENCY`,required:!1,defaultRole:`value.frequency`,defaultUnit:`Hz`}};e.patterns={chart:{states:[{objectType:`chart`,name:`CHART`}],type:t.Types.chart},mediaPlayer:{states:[{role:/^media\.state(\..*)?$/,indicator:!1,type:[t.StateType.Boolean,t.StateType.Number],name:`STATE`,required:!0,defaultRole:`media.state`},{role:/^(button|action)\.play(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`PLAY`,required:!1,noSubscribe:!0,defaultRole:`button.play`},{role:/^(button|action)\.pause(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`PAUSE`,required:!1,noSubscribe:!0,defaultRole:`button.pause`},{role:/^(button|action)\.stop(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop`},{role:/^(button|action)\.next(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`NEXT`,required:!1,noSubscribe:!0,defaultRole:`button.next`},{role:/^(button|action)\.prev(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`PREV`,required:!1,noSubscribe:!0,defaultRole:`button.prev`},{role:/^media\.mode\.shuffle(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`SHUFFLE`,required:!1,defaultRole:`media.mode.shuffle`},{role:/^media\.mode\.repeat(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`REPEAT`,required:!1,defaultRole:`media.mode.repeat`},{role:/^media\.artist(\..*)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`ARTIST`,required:!1,defaultRole:`media.artist`},{role:/^media\.album(\..*)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`ALBUM`,required:!1,defaultRole:`media.album`},{role:/^media\.title(\..*)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`TITLE`,required:!1,defaultRole:`media.title`},{role:/^media\.cover(\.big)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`COVER`,required:!1,notSingle:!0,defaultRole:`media.cover`},{role:/^media\.cover(\..*)$/,indicator:!1,write:!1,type:t.StateType.String,name:`COVER`,required:!1,notSingle:!0},{role:/^media\.duration(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,name:`DURATION`,required:!1,defaultRole:`media.duration`,defaultUnit:`sec`},{role:/^media\.elapsed(\..*)?$/,indicator:!1,type:t.StateType.Number,name:`ELAPSED`,required:!1,defaultRole:`media.elapsed`,defaultUnit:`sec`},{role:/^media\.seek(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SEEK`,required:!1,defaultRole:`media.seek`},{role:/^media\.track(\..*)?$/,indicator:!1,type:t.StateType.String,name:`TRACK`,required:!1,defaultRole:`media.track`},{role:/^media\.episode(\..*)?$/,indicator:!1,type:t.StateType.String,name:`EPISODE`,required:!1,defaultRole:`media.episode`},{role:/^media\.season(\..*)?$/,indicator:!1,type:t.StateType.String,name:`SEASON`,required:!1,defaultRole:`media.season`},{role:/^level(\.volume)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`VOLUME`,required:!1,notSingle:!0,defaultRole:`level.volume`,defaultUnit:`%`},{role:/^value(\.volume)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`VOLUME_ACTUAL`,required:!1,notSingle:!0,defaultRole:`value.volume`,defaultUnit:`%`},{role:/^media(\.mute)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`MUTE`,required:!1,notSingle:!0,defaultRole:`media.mute`},{role:/^media\.player\.name$/,indicator:!1,type:t.StateType.String,name:`PLAYER_NAME`,required:!1,notSingle:!0,defaultRole:`media.player.name`},{role:/^media\.player\.type/,indicator:!1,type:t.StateType.String,write:!1,name:`PLAYER_TYPE`,required:!1,notSingle:!0,defaultRole:`media.player.type`},{stateName:/\.(paused|playerState)$/,indicator:!1,name:`IGNORE`,required:!1,multiple:!0,noSubscribe:!0},i.reachable,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.media},weatherForecast:{states:[{role:/^weather\.icon(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`ICON`,required:!0,defaultRole:`weather.icon.forecast.0`},{role:/^value\.temperature\.min\.forecast\.0$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MIN`,required:!0,defaultRole:`value.temperature.min.forecast.0`},{role:/^value\.temperature\.max\.forecast\.0$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MAX`,required:!0,defaultRole:`value.temperature.max.forecast.0`},{role:/^value\.precipitation(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION_CHANCE`,unit:`%`,required:!1,defaultRole:`value.precipitation.forecast.0`},{role:/^value\.precipitation(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION`,unit:`mm`,required:!1,defaultRole:`value.precipitation.forecast.0`},{role:/^date(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`DATE`,required:!1,defaultRole:`date.forecast.0`},{role:/^dayofweek(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`DOW`,required:!1,defaultRole:`dayofweek.forecast.0`},{role:/^weather\.state(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`STATE`,required:!1,defaultRole:`weather.state.forecast.0`},{role:/^value\.temperature(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`TEMP`,required:!1,defaultRole:`value.temperature.forecast.0`},{role:/^value\.pressure(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`PRESSURE`,required:!1,defaultRole:`value.pressure.forecast.0`},{role:/^value\.humidity(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY`,required:!1,defaultRole:`value.humidity.forecast.0`},{role:/^(?:date|time)\.sunrise(?:\.forecast\.0)?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNRISE`,required:!1,defaultRole:`date.sunrise`},{role:/^(?:date|time)\.sunset(?:\.forecast\.0)?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNSET`,required:!1,defaultRole:`date.sunset`},{role:/^value\.temperature\.windchill(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`WIND_CHILL`,required:!1,defaultRole:`value.temperature.windchill.forecast.0`},{role:/^value\.temperature\.feelslike(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`FEELS_LIKE`,required:!1,defaultRole:`value.temperature.feelslike.forecast.0`},{role:/^value\.speed\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`WIND_SPEED`,required:!1,defaultRole:`value.speed.wind.forecast.0`},{role:/^value\.direction\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`WIND_DIRECTION`,required:!1,defaultRole:`value.direction.wind.forecast.0`},{role:/^weather\.direction\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`WIND_DIRECTION_STR`,required:!1,defaultRole:`weather.direction.wind.forecast.0`},{role:/^weather\.icon\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`WIND_ICON`,required:!1,defaultRole:`weather.icon.wind.forecast.0`},{role:/^weather\.chart\.url$/,indicator:!1,type:t.StateType.String,name:`HISTORY_CHART`,required:!1,noSubscribe:!0,defaultRole:`weather.chart.url`},{role:/^weather\.chart\.url\.forecast$/,indicator:!1,type:t.StateType.String,name:`FORECAST_CHART`,required:!1,noSubscribe:!0,defaultRole:`weather.chart.url.forecast`},{role:/^location$/,indicator:!1,type:t.StateType.String,name:`LOCATION`,required:!1,defaultRole:`location`},{role:/^weather\.icon\.forecast.(\d+)$/,indicator:!1,type:t.StateType.String,name:`ICON%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0,notSingle:!0},{role:/^value\.temperature\.min\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MIN%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.temperature\.max\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MAX%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^date\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`DATE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^dayofweek\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`DOW%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^weather\.state\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`STATE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.temperature\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`TEMP%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.pressure\.forecast\.(\d+)?$/,indicator:!1,type:t.StateType.Number,name:`PRESSURE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.humidity\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.humidity\.max\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY_MAX%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.precipitation\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,unit:`%`,name:`PRECIPITATION_CHANCE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.precipitation\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,unit:`mm`,name:`PRECIPITATION%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.speed\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`WIND_SPEED%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.direction\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`WIND_DIRECTION%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^weather\.direction\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`WIND_DIRECTION_STR%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^weather\.icon\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`WIND_ICON%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^(?:date|time)\.sunrise(?:\.forecast\.(\d+))?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNRISE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^(?:date|time)\.sunset(?:\.forecast\.(\d+))?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNSET%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0}],type:t.Types.weatherForecast},rgb:{states:[{role:/^level\.color\.red$/,indicator:!1,type:t.StateType.Number,write:!0,name:`RED`,required:!0,defaultRole:`level.color.red`},{role:/^level\.color\.green$/,indicator:!1,type:t.StateType.Number,write:!0,name:`GREEN`,required:!0,defaultRole:`level.color.green`},{role:/^level\.color\.blue$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BLUE`,required:!0,defaultRole:`level.color.blue`},{role:/^level\.color\.white$/,indicator:!1,type:t.StateType.Number,write:!0,name:`WHITE`,required:!1,defaultRole:`level.color.white`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$|^state$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.rgb},rgbwSingle:{states:[{role:/^level\.color\.rgbw$/,indicator:!1,type:t.StateType.String,write:!0,name:`RGBW`,required:!0,defaultRole:`level.color.rgbw`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.rgbwSingle},rgbSingle:{states:[{role:/^level\.color\.rgb$/,indicator:!1,type:t.StateType.String,write:!0,name:`RGB`,required:!0,defaultRole:`level.color.rgb`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.rgbSingle},cie:{states:[{role:/^level\.color\.cie$/,indicator:!1,type:t.StateType.String,write:!0,name:`CIE`,required:!0,defaultRole:`level.color.cie`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.cie},hue:{states:[{role:/^level\.color\.hue$/,indicator:!1,type:t.StateType.Number,write:!0,name:`HUE`,required:!0,defaultRole:`level.color.hue`,defaultUnit:`°`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,searchInParent:!0,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1},{role:/^level\.color\.saturation$/,indicator:!1,type:t.StateType.Number,write:!0,name:`SATURATION`,required:!1,defaultRole:`level.color.saturation`,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.hue},ct:{states:[{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!0,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.ct},warning:{states:[{role:/^value\.warning$/,indicator:!1,name:`LEVEL`,required:!0,defaultRole:`value.warning`},{role:/^weather\.title\.short$/,indicator:!1,type:t.StateType.String,name:`TITLE`,required:!1,defaultRole:`weather.title.short`},{role:/^weather\.title$/,indicator:!1,type:t.StateType.String,name:`INFO`,required:!1,defaultRole:`weather.title`},{role:/^date\.start$/,indicator:!1,type:t.StateType.String,name:`START`,required:!1,defaultRole:`date.start`},{role:/^date\.end$/,indicator:!1,type:t.StateType.String,name:`END`,required:!1,defaultRole:`date.end`},{role:/^date$/,indicator:!1,type:t.StateType.String,name:`START`,required:!1},{role:/^weather\.chart\.url/,indicator:!1,type:t.StateType.String,name:`ICON`,required:!1,defaultRole:`weather.chart.url`},{role:/^weather\.state$/,indicator:!1,type:t.StateType.String,name:`DESC`,required:!1,noSubscribe:!0,defaultRole:`weather.state`}],type:t.Types.warning},airCondition:{states:[{role:/temperature(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SET`,required:!0,defaultRole:`level.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/(level\.mode\.)?airconditioner$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`MODE`,required:!0,defaultRole:`level.mode.airconditioner`,defaultStates:{0:`AUTO`,3:`COOL`,4:`DRY`,5:`ECO`,6:`FAN_ONLY`,7:`HEAT`,8:`OFF`},ignoreRole:r},{role:/(speed|mode)\.fan$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SPEED`,required:!1,defaultRole:`level.mode.fan`,defaultStates:{0:`AUTO`,1:`HIGH`,2:`LOW`,3:`MEDIUM`,4:`QUIET`,5:`TURBO`},ignoreRole:r},{role:/^switch(\.power)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`POWER`,required:!1,defaultRole:`switch.power`},{role:/temperature(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`ACTUAL`,required:!1,defaultRole:`value.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/humidity(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`HUMIDITY`,required:!1,defaultRole:`value.humidity`,defaultUnit:`%`,ignoreRole:r},{role:/^switch\.boost(\..*)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`BOOST`,required:!1,defaultRole:`switch.boost`},{role:/swing$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`SWING`,required:!1,defaultRole:`level.mode.swing`,defaultStates:{0:`AUTO`,1:`HORIZONTAL`,2:`STATIONARY`,3:`VERTICAL`},ignoreRole:r},{role:/swing$/,indicator:!1,write:!0,type:t.StateType.Boolean,searchInParent:!0,name:`SWING`,required:!1,defaultRole:`switch.mode.swing`,ignoreRole:r},...Object.values(a),i.unreach,i.maintain,i.error],type:t.Types.airCondition},thermostat:{states:[{role:/temperature(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SET`,required:!0,defaultRole:`level.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/temperature(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`ACTUAL`,required:!1,defaultRole:`value.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/humidity(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`HUMIDITY`,required:!1,defaultRole:`value.humidity`,defaultUnit:`%`,ignoreRole:r},{role:/^switch(\.mode)?\.boost(\..*)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`BOOST`,required:!1,defaultRole:`switch.mode.boost`},{role:/^switch(\.power)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`POWER`,required:!1,defaultRole:`switch.power`},{role:/^switch(\.mode)?\.party$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`PARTY`,required:!1,defaultRole:`switch.mode.party`},{role:/^level(\.mode)?\.thermostat$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`MODE`,required:!1,defaultRole:`level.mode.thermostat`,defaultStates:{0:`AUTO`,1:`MANUAL`}},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.thermostat},vacuumCleaner:{states:[{role:/^switch\.power$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`POWER`,required:!0,defaultRole:`switch.power`},{role:/mode\.cleanup$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`MODE`,required:!0,defaultRole:`level.mode.cleanup`,defaultStates:{0:`AUTO`,1:`NORMAL`,2:`QUIET`,3:`ECO`,4:`EXPRESS`},ignoreRole:r},{role:/vacuum\.map\.base64$/,indicator:!1,write:!1,type:t.StateType.String,searchInParent:!0,name:`MAP_BASE64`,required:!1,defaultRole:`vacuum.map.base64`,ignoreRole:r},{role:/vacuum\.map\.url$/,indicator:!1,write:!1,type:t.StateType.String,searchInParent:!0,name:`MAP_URL`,required:!1,ignoreRole:r},{role:/mode\.work$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`WORK_MODE`,required:!1,defaultRole:`level.mode.work`,defaultStates:{0:`AUTO`,1:`FAST`,2:`MEDIUM`,3:`SLOW`,4:`TURBO`},ignoreRole:r},{role:/^value\.water$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,unit:`%`,name:`WATER`,required:!1,defaultRole:`value.water`,defaultUnit:`%`},{role:/^value\.waste$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,unit:`%`,name:`WASTE`,required:!1,defaultRole:`value.waste`,defaultUnit:`%`},{role:/^value\.battery$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,unit:`%`,name:`BATTERY`,required:!1,defaultRole:`value.battery`,defaultUnit:`%`},{role:/^value\.state$/,indicator:!1,write:!1,type:[t.StateType.Number,t.StateType.String],searchInParent:!0,name:`STATE`,required:!1,defaultRole:`value.state`},{role:/^switch\.pause$/,indicator:!1,write:!0,type:t.StateType.Boolean,searchInParent:!0,name:`PAUSE`,required:!1,defaultRole:`switch.pause`},{role:/^indicator(\.maintenance)?\.waste$|^indicator(\.alarm)?\.waste/,indicator:!0,type:t.StateType.Boolean,searchInParent:!0,name:`WASTE_ALARM`,required:!1,defaultRole:`indicator.maintenance.waste`},{role:/^indicator(\.maintenance)?\.water$|^indicator(\.alarm)?\.water/,indicator:!0,type:t.StateType.Boolean,searchInParent:!0,name:`WATER_ALARM`,required:!1,defaultRole:`indicator.maintenance.water`},{role:/^value(\.usage)?\.filter/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`FILTER`,required:!1,defaultRole:`value.usage.filter`,defaultUnit:`%`},{role:/^value(\.usage)?\.brush/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`BRUSH`,required:!1,defaultRole:`value.usage.brush`,defaultUnit:`%`},{role:/^value(\.usage)?\.sensors/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`SENSORS`,required:!1,defaultRole:`value.usage.sensors`,defaultUnit:`%`},{role:/^value(\.usage)?\.brush\.side/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`SIDE_BRUSH`,required:!1,defaultRole:`value.usage.brush.side`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.vacuumCleaner},blinds:{states:[{role:/^level(\.blind)?$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumBlind,name:`SET`,required:!0,defaultRole:`level.blind`,defaultUnit:`%`},{role:/^value(\.blind)?$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumBlind,name:`ACTUAL`,required:!1,defaultRole:`value.blind`,defaultUnit:`%`},{role:/^(button|action)\.stop(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop.blind`},{role:/^(button|action)\.open(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`OPEN`,required:!1,noSubscribe:!0,defaultRole:`button.open.blind`},{role:/^(button|action)\.close(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`CLOSE`,required:!1,noSubscribe:!0,defaultRole:`button.close.blind`},{role:/^level(\.open)?\.tilt$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumBlind,name:`TILT_SET`,required:!1,defaultRole:`level.tilt`},{role:/^value(\.open)?\.tilt$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumBlind,name:`TILT_ACTUAL`,required:!1,defaultRole:`value.tilt`},{role:/^(button|action)\.stop\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop.tilt`},{role:/^(button|action)\.open\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_OPEN`,required:!1,noSubscribe:!0,defaultRole:`button.open.tilt`},{role:/^(button|action)\.close\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_CLOSE`,required:!1,noSubscribe:!0,defaultRole:`button.close.tilt`},i.direction,i.direction_enum,i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.blind},blindButtons:{states:[{role:/^(button|action)\.stop(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`STOP`,required:!0,noSubscribe:!0,defaultRole:`button.stop.blind`},{role:/^(button|action)\.open(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`OPEN`,required:!0,noSubscribe:!0,defaultRole:`button.open.blind`},{role:/^(button|action)\.close(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`CLOSE`,required:!0,noSubscribe:!0,defaultRole:`button.close.blind`},{role:/^level\.tilt$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumBlind,name:`TILT_SET`,required:!1,defaultRole:`level.tilt`},{role:/^value\.tilt$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumBlind,name:`TILT_ACTUAL`,required:!1,defaultRole:`value.tilt`},{role:/^(button|action)\.stop\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop.tilt`},{role:/^(button|action)\.open\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_OPEN`,required:!1,noSubscribe:!0,defaultRole:`button.open.tilt`},{role:/^(button|action)\.close\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_CLOSE`,required:!1,noSubscribe:!0,defaultRole:`button.close.tilt`},i.direction,i.direction_enum,i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.blindButtons},gate:{states:[{role:/^switch(\.gate)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumGate,name:`SET`,required:!0,defaultRole:`switch.gate`},{role:/^value(\.(position|gate))?$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumGate,name:`ACTUAL`,required:!1,defaultRole:`value.blind`,defaultUnit:`%`,ignoreRole:r},{role:/^(button|action)\.stop$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumGate,name:`STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop`},i.direction,i.direction_enum,i.working,i.unreach,i.maintain,i.error],type:t.Types.gate},weatherCurrent:{states:[{role:/^value(\.temperature)?$/,indicator:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.temperature`,defaultUnit:`°C`},{role:/^weather\.icon$/,indicator:!1,name:`ICON`,required:!0,defaultRole:`weather.icon`},{role:/^value\.precipitation\.chance$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION_CHANCE`,defaultRole:`value.precipitation.chance`,defaultUnit:`%`},{role:/^value\.precipitation\.type$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION_TYPE`,defaultRole:`value.precipitation.type`,defaultStates:{0:`NO`,1:`RAIN`,2:`SNOW`,3:`HAIL`}},{role:/^value\.pressure$/,indicator:!1,type:t.StateType.Number,name:`PRESSURE`,defaultRole:`value.pressure`,defaultUnit:`mbar`},{role:/^value\.pressure\.tendency$/,indicator:!1,type:t.StateType.String,name:`PRESSURE_TENDENCY`,defaultRole:`value.pressure.tendency`},{role:/^value\.temperature\.windchill$/,indicator:!1,type:t.StateType.Number,name:`REAL_FEEL_TEMPERATURE`,defaultRole:`value.temperature.windchill`,defaultUnit:`°C`},{role:/^value\.humidity$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY`,defaultRole:`value.humidity`,defaultUnit:`%`},{role:/^value\.uv$/,indicator:!1,type:t.StateType.Number,name:`UV`,defaultRole:`value.uv`},{role:/^weather\.state$/,indicator:!1,type:t.StateType.String,name:`WEATHER`,defaultRole:`weather.state`},{role:/^value\.direction\.wind$/,indicator:!1,type:t.StateType.String,name:`WIND_DIRECTION`,defaultRole:`value.direction.wind`,defaultUnit:`°`},{role:/^value\.speed\.wind\.gust$/,indicator:!1,type:t.StateType.Number,name:`WIND_GUST`,defaultRole:`value.speed.wind.gust`,defaultUnit:`km/h`},{role:/^value\.speed\.wind$/,indicator:!1,type:t.StateType.Number,name:`WIND_SPEED`,defaultRole:`value.speed.wind$`,defaultUnit:`km/h`},i.lowbat,i.unreach,i.maintain,i.error,i.battery],type:t.Types.weatherCurrent},camera:{states:[{role:/^link\.camera(\.\w+)?$/,indicator:!1,type:t.StateType.String,name:`URL`,required:!0,defaultRole:`link.camera`},{role:/^switch(\.camera)?\.autofocus$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`AUTOFOCUS`,required:!1,defaultRole:`switch.camera.autofocus`},{role:/^switch(\.camera)?\.autowhitebalance$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`AUTOWHITEBALANCE`,required:!1,defaultRole:`switch.camera.autowhitebalance`},{role:/^switch(\.camera)?\.brightness$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`BRIGHTNESS`,required:!1,defaultRole:`switch.camera.brightness`},{role:/^switch(\.camera)?\.nightmode$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`NIGHTMODE`,required:!1,defaultRole:`switch.camera.nightmode`},{role:/^level(\.camera)?\.position$|^level(\.camera)?(\.ptz)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`PTZ`,required:!1,defaultRole:`level.camera.position`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.camera,enumRequired:!1},lock:{states:[{role:/^switch\.lock$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`SET`,required:!0,defaultRole:`switch.lock`},{role:/^state$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ACTUAL`,required:!1,defaultRole:`state`},{indicator:!1,type:t.StateType.Boolean,write:!0,read:!1,name:`OPEN`,required:!1,noSubscribe:!0,defaultRole:`button`,ignoreRole:r},{role:/^(state|sensor)(\.door)?$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`DOOR_STATE`,required:!1,defaultRole:`sensor.door`,ignoreRole:r},i.direction,i.direction_enum,i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.lock},motion:{states:[{role:/^(state\.)?motion$|^sensor\.motion$/,indicator:!1,type:t.StateType.Boolean,name:`ACTUAL`,required:!0,defaultRole:`sensor.motion`,ignoreRole:r},{role:/brightness$/,indicator:!1,type:t.StateType.Number,name:`SECOND`,required:!1,defaultRole:`value.brightness`,defaultUnit:`lux`,ignoreRole:r},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.motion},window:{states:[{role:/^(state|sensor)(\.window)?/,indicator:!1,type:t.StateType.Boolean,enums:n.roleOrEnumWindow,write:!1,name:`ACTUAL`,required:!0,defaultRole:`sensor.window`,ignoreRole:r},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.window},windowTilt:{states:[{role:/^state$|^value(\.window)?$/,indicator:!1,type:t.StateType.Number,write:!1,enums:n.roleOrEnumWindow,name:`ACTUAL`,required:!0,defaultRole:`value.window`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.windowTilt},fireAlarm:{states:[{role:/^(state|sensor|indicator)(\.alarm)?\.fire$/,indicator:!1,type:t.StateType.Boolean,name:`ACTUAL`,required:!0,defaultRole:`sensor.alarm.fire`,defaultChannelRole:`sensor.alarm.fire`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.fireAlarm,enumRequired:!1},floodAlarm:{states:[{role:/^(state|sensor|indicator)(\.alarm)?\.flood$/,indicator:!1,type:t.StateType.Boolean,name:`ACTUAL`,required:!0,defaultRole:`sensor.alarm.flood`,defaultChannelRole:`sensor.alarm.flood`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.floodAlarm},door:{states:[{role:/^(state|sensor)(\.door)?/,indicator:!1,type:t.StateType.Boolean,write:!1,enums:n.roleOrEnumDoor,name:`ACTUAL`,required:!0,defaultRole:`sensor.door`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.door},dimmer:{states:[{role:/^level(\.dimmer)?$|^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumLight,name:`SET`,required:!0,defaultRole:`level.dimmer`,ignoreRole:/^level\.dimspeed$/,defaultUnit:`%`},{role:/^value(\.dimmer)?$/,indicator:!1,type:t.StateType.Number,write:!1,enums:n.roleOrEnumLight,name:`ACTUAL`,required:!1,defaultRole:`value.dimmer`,defaultUnit:`%`},{role:/^switch(\.light)?$|^state$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumLight,name:`ON_SET`,required:!1,defaultRole:`switch.light`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,enums:n.roleOrEnumLight,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumLight,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.dimmer},light:{states:[{role:/^switch(\.light)?$|^state$/,enums:n.roleOrEnumLight,indicator:!1,type:t.StateType.Boolean,write:!0,name:`SET`,required:!0,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,enums:n.roleOrEnumLight,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.light},volume:{states:[{role:/^level\.volume$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`SET`,required:!0,defaultRole:`level.volume`,defaultUnit:`%`},{role:/^value\.volume$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value.volume`,defaultUnit:`%`},{role:/^media\.mute$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`MUTE`,required:!1,defaultRole:`media.mute`},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.volume},locationOne:{states:[{role:/^value\.gps$/,indicator:!1,type:t.StateType.String,write:!1,name:`GPS`,required:!0,defaultRole:`value.gps`},{role:/^value\.gps\.elevation$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ELEVATION`,required:!1,defaultRole:`value.gps.elevation`},{role:/^value(\.gps)?\.radius$/,indicator:!1,type:t.StateType.Number,write:!1,name:`RADIUS`,required:!1,defaultRole:`value.gps.radius`},{role:/^value(\.gps)?\.accuracy$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ACCURACY`,required:!1,defaultRole:`value.gps.accuracy`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.locationOne},location:{states:[{role:/^value(\.gps)?\.longitude$/,indicator:!1,type:t.StateType.Number,write:!1,name:`LONGITUDE`,required:!0,defaultRole:`value.gps.longitude`,defaultUnit:`°`},{role:/^value(\.gps)?\.latitude$/,indicator:!1,type:t.StateType.Number,write:!1,name:`LATITUDE`,required:!0,defaultRole:`value.gps.latitude`,defaultUnit:`°`},{role:/^value(\.gps)?\.elevation$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ELEVATION`,required:!1,defaultRole:`value.gps.elevation`},{role:/^value(\.gps)?\.radius$/,indicator:!1,type:t.StateType.Number,write:!1,name:`RADIUS`,required:!1,defaultRole:`value.gps.radius`},{role:/^value(\.gps)?\.accuracy$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ACCURACY`,required:!1,defaultRole:`value.gps.accuracy`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.location},volumeGroup:{states:[{role:/^level\.volume\.group?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`SET`,required:!0,defaultRole:`level.volume.group`,defaultUnit:`%`},{role:/^value\.volume\.group$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value.volume.group`,defaultUnit:`%`},{role:/^media\.mute\.group$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`MUTE`,required:!1,defaultRole:`media.mute.group`},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.volumeGroup},percentage:{states:[{role:/^level(\..*)?$/,indicator:!1,type:t.StateType.Number,write:!0,unit:`%`,name:`SET`,required:!0,defaultRole:`level`,defaultUnit:`%`,ignoreRole:r},{role:/^value(\..*)?$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value`,defaultUnit:`%`,ignoreRole:r},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.percentage},levelSlider:{states:[{role:/^level(\..*)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`SET`,required:!0,defaultRole:`level`,defaultUnit:`%`,ignoreRole:r},{role:/^value(\..*)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value`,defaultUnit:`%`,ignoreRole:r},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.slider},socket:{states:[{role:/^switch(\.active)?$|^state$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`SET`,required:!0,defaultRole:`switch`},{role:/^state(\.active)?$|^sensor.switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ACTUAL`,required:!1,defaultRole:`sensor.switch`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error],type:t.Types.socket},button:{states:[{role:/^(button|action)(\.[.\w]+)?$/,indicator:!1,type:t.StateType.Boolean,read:!1,write:!0,name:`SET`,required:!0,noSubscribe:!0,defaultRole:`button`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.button},buttonSensor:{states:[{role:/^button(\.[.\w]+)?$/,indicator:!1,type:t.StateType.Boolean,read:!0,write:!1,name:`PRESS`,required:!0,defaultRole:`button.press`},{role:/^button\.long/,indicator:!1,type:t.StateType.Boolean,read:!0,write:!1,name:`PRESS_LONG`,required:!1,defaultRole:`button.long`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.buttonSensor},temperature:{states:[{role:/\.temperature$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.temperature`,defaultUnit:`°C`},{role:/\.humidity$/,indicator:!1,write:!1,type:t.StateType.Number,name:`SECOND`,required:!1,defaultRole:`value.humidity`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.temperature},humidity:{states:[{role:/\.humidity$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.humidity`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.humidity},illuminance:{states:[{role:/\.brightness$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.brightness`,defaultUnit:`lux`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.illuminance},fillLevel:{states:[{role:/^value\.fill(\.[-.\w]+)?$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.fill`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.fillLevel},image:{states:[{role:/\.icon$|^icon$|^icon\.|\.icon\.|\.chart\.url\.|\.chart\.url$|^url.icon$/,indicator:!1,write:!1,type:t.StateType.String,name:`URL`,defaultRole:`icon`,required:!0,ignoreRole:r},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.image},info:{states:[{indicator:!1,name:`ACTUAL`,required:!0,multiple:!0,noDeviceDetection:!0,ignoreRole:/\.inhibit$/,defaultRole:`state`},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.info}}})),nG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ChannelDetector=void 0;var t=$W(),n=eG(),r=tG(),i=class e{constructor(){this.enums=null,this.cache={}}_applyPattern(e,r,i,a,o){if(e[r]?.common){let s=null;if(i.role&&(s=i.role.test(e[r].common.role||``),s&&i.channelRole)){let t=(0,n.getParentId)(r),a=e[t]?.common.role||``;s=a&&(e[t].type===`channel`||e[t].type===`device`)?i.channelRole.test(a):!1}if(s===!1)return!1;if(i.type){if(typeof i.type==`string`){if(i.type!==e[r].common.type)return!1}else if(Array.isArray(i.type)){let t=!1;for(let n=0;n<i.type.length;n++)if(i.type[n]===e[r].common.type){t=!0;break}if(!t)return!1}}if(i.objectType&&e[r].type!==i.objectType||i.stateName&&!i.stateName.test(r)||i.unit&&i.unit!==e[r].common.unit)return!1;if(i.ignoreRole){let t=e[r].common.role||``;if(t&&i.ignoreRole.test(t))return!1}if(i.indicator===!1&&(e[r].common.role||``).match(/^indicator(\.[.\w]+)?$/))return!1;if(i.state){let e=r.split(`.`).pop()||``;if(e&&!i.state.test(e))return!1}let c=i.defaultRole&&e[r].common.role===i.defaultRole,l=i.defaultUnit?e[r].common.unit===i.defaultUnit:!1;if(i.min===t.StateType.Number&&typeof e[r].common.min!==t.StateType.Number&&(!l||e[r].common.unit!==`%`)||i.max===t.StateType.Number&&typeof e[r].common.max!==t.StateType.Number&&(!l||e[r].common.unit!==`%`)||i.statesDefined===!0&&typeof e[r].common.states!=`object`)return!1;if(!c){if(i.write!==void 0&&i.write!==!!e[r].common.write||i.read!==void 0&&i.read!==(e[r].common.read===void 0||e[r].common.read))return!1;if(typeof i.enums==`function`){let t=this._getEnumsForId(e,r,o);if(!a&&!i.enums(e[r],t||[]))return!1}}return!0}return!1}_getEnumsForId(e,t,r){this.enums||=(0,n.getFunctionEnums)(e,r);let i=[];if(this.enums.forEach(n=>{e[n].common.members.includes(t)&&i.push(n)}),!i.length&&e[t]?.type===`state`){let r=(0,n.getParentId)(t);e[r]&&(e[r].type===`channel`||e[r].type===`device`)&&this.enums.forEach(t=>{e[t].common.members.includes(r)&&i.push(t)})}return i.length?i:null}static copyState(e,t){let n=t||JSON.parse(JSON.stringify(e));return n.original=e.original||e,`enums`in e&&e.enums&&(n.enums=e.enums),`role`in e&&e.role&&(n.role=e.role),`channelRole`in e&&e.channelRole&&(n.channelRole=e.channelRole),n}_testOneState(t){let n=t.objects,i=t.pattern,a=t.state,o=t.channelStates,s=t.usedIds,c=t.usedInCurrentDevice,l=t.ignoreIndicators,u=t.ignoreEnums,d=t.sortedKeys,f=t.result,p=!1;for(let m of o)if(!(a.name===`COVER`&&f?.states.find(e=>e.id&&e.name===`COVER`))){if(a.indicator&&l){let e=m.split(`.`).pop()||``;if(e&&l.includes(e))continue}if(!a.indicator&&(c.includes(m)||!a.notSingle&&!t.detectAllPossibleDevices&&s.includes(m)))continue;if(this._applyPattern(n,m,a,u,d)){if(f||(f=JSON.parse(JSON.stringify(r.patterns[i])),t.result=f,f?.states.forEach((t,n)=>e.copyState(r.patterns[i].states[n],t))),f.states.find(({id:e})=>e===m))p=!0;else for(let e of f.states)if(e.name===a.name){if(e.id){let r;t.favorId&&(m===t.favorId?r=!0:e.id===t.favorId&&(r=!1));let i=n[e.id]?.common?.role??``,a=n[m]?.common?.role??``,o=e.defaultRole;if(o&&r===void 0&&(a===o?r=!0:i===o&&(r=!1)),r===void 0){let e=a.split(`.`),t=e.length,n=i.split(`.`),o=n.length;r=a===``||e[0]===`state`&&n[0]!==`state`?!1:e[0]!==`state`&&n[0]===`state`||t>o?!0:t<o?!1:e[0]!==`state`}if(!r)break}e.id=m,p=!0;break}if(p&&(a.indicator||c.push(m),a.multiple&&o.length>1)){for(let t of o)if(t!==m&&(a.indicator||!c.includes(t)&&(a.notSingle||!s.includes(t)))&&this._applyPattern(n,t,a,u,d))if(a.indicator||c.push(t),Array.isArray(a)){let n=e.copyState(a[0]);n.id=t,f.states.push(n)}else{let n=e.copyState(a);n.id=t,f.states.push(n)}}}}return p}static findParentChannelOrDevice(e,t,n){if(!e[t])return;let r=t.split(`.`),i=t;if(e[t].type===`state`&&(r.pop(),t=r.join(`.`)),r.length<=2)return t;let a=e[t];if(a?.type===`device`||n&&a?.type===`channel`)return t;if(n)return;r.pop();let o=r.join(`.`),s=e[o];if(!s)return a?t:i;if(s.type===`device`||r.length<=2)return o;if(a?.type===`channel`)return t;r.pop();let c=r.join(`.`),l=e[c];return!l||l.type!==`device`&&l.type!==`channel`?o:c}static getChannelOrDeviceStates(t,r,i,a=!1,o=!1){let s=t[r]?.type;switch(s){case void 0:return[...(0,n.getObjectsBelowId)(i,r)];case`state`:case`channel`:case`device`:case`folder`:if(a&&s!==`device`){let a=e.findParentChannelOrDevice(t,r);return a&&a!==r?[...(0,n.getObjectsBelowId)(i,a)]:[r]}if(s!==`state`)return[...(0,n.getObjectsBelowId)(i,r)];if(o){let a=e.findParentChannelOrDevice(t,r,!0);return a&&a!==r?[...(0,n.getObjectsBelowId)(i,a)]:[r]}return[r];default:return[r]}}static patternIsAllowed(e,t,n){if(!e)return!1;if(Array.isArray(e.type)){for(let r=0;r<e.type.length;r++)if(t&&!t.includes(e.type[r])||n&&n.includes(e.type[r]))return!1;return!0}return t&&!t.includes(e.type)?!1:!n||!n.includes(e.type)}static allRequiredStatesFound(e){if(!e.result)return!1;let t=e.result.states;for(let e=0;e<t.length;e++)if(t[e].required&&!t[e].id)return!1;return!0}static cleanState(e,t){let n=t[e.id]?.common?.role||``;if(e.name.includes(`%d`)&&e.role&&e.id&&n){let t=e.role.exec(n);t&&(e.name=e.name.replace(`%d`,t[1]))}e.role&&delete e.role,e.enums&&delete e.enums,e.original&&delete e.original}sortTypes(e,t){return t.forEach(([t,n])=>{let r=e.indexOf(t),i=e.indexOf(n);if(r===-1||i===-1)return;let a=e.splice(r,1);e.splice(i,0,...a)}),e}_detectNext(t){let{objects:i,id:a,_usedIdsOptional:o=[],ignoreIndicators:s,prioritizedTypes:c,detectParent:l,detectOnlyChannel:u,allowedTypes:d,excludedTypes:f,_keysOptional:p,detectAllPossibleDevices:m}=t,{_patternList:h}=t;t._usedIdsOptional=o;let g=e.getChannelOrDeviceStates(i,a,p||[],l,u);if(!i[a]?.common&&!g.length)return null;if(t._checkedPatterns??=[],!h){let n=Object.keys(r.patterns).filter(t=>e.patternIsAllowed(r.patterns[t],d,f));h=c?this.sortTypes(n,c):n,t._patternList=h}let _={objects:i,channelStates:g,usedIds:o,ignoreIndicators:s||[],pattern:`unknown`,usedInCurrentDevice:[],state:{},ignoreEnums:!!t.ignoreEnums,sortedKeys:p,favorId:t.detectParent?void 0:a,detectAllPossibleDevices:m},v=i[a]?.type;for(let s of h){if(t._checkedPatterns.includes(s))continue;t._checkedPatterns.push(s),delete _.result,_.pattern=s,_.usedInCurrentDevice=[];for(let e of r.patterns[s].states){let t=!1;if(_.state=e,this._testOneState(_)&&(t=!0),e.required&&!t){delete _.result;break}}if(!e.allRequiredStatesFound(_))continue;_.usedInCurrentDevice.forEach(e=>o.push(e));let c;if(v!==`device`){let r=e.findParentChannelOrDevice(i,a)??a;if(i[r]&&(i[r].type===`channel`||i[r].type===`device`)){c=(0,n.getObjectsBelowId)(p,r);for(let e of c)_.result.states.forEach((n,r)=>{!n.id&&(n.indicator||n.searchInParent)&&!n.noDeviceDetection&&this._applyPattern(i,e,n.original,!!t.ignoreEnums,_.sortedKeys)&&_.result&&(_.result.states[r].id=e)})}}if(_.result.states.forEach(t=>e.cleanState(t,_.objects)),t.limitTypesToOneOf){for(let e of t.limitTypesToOneOf)if(e.includes(s))for(let n of e)n===s||t._checkedPatterns.includes(n)||t._checkedPatterns.push(n)}return _.result}return null}detect(e){let{objects:n,id:r,ignoreCache:i,detectAllPossibleDevices:a}=e,{_keysOptional:o,_usedIdsOptional:s}=e;if(!i&&this.cache[r]){let{allowedTypes:t=[],excludedTypes:n=[]}=e;if(!t.length&&!n.length)return this.cache[r];let i=this.cache[r].filter(({type:e})=>t.includes(e)&&!n.includes(e));if(i.length)return i}o?e._keysOptionalSorted||o.sort():(o=Object.keys(n),o.sort(),e._keysOptional=o),s&&!e.detectParent&&(s=[],e._usedIdsOptional=s),e.ignoreEnums===void 0&&e.allowedTypes?.length===1&&(e.ignoreEnums=!0),a&&(e.excludedTypes||=[],e.excludedTypes.includes(t.Types.info)||e.excludedTypes.push(t.Types.info)),e._checkedPatterns=[];let c=[],l;for(;l=this._detectNext(e);)c.push(l),e.detectAllPossibleDevices&&(e._usedIdsOptional=[]);return c.sort((e,n)=>{if(e.type===t.Types.info&&n.type!==t.Types.info)return 1;if(n.type===t.Types.info&&e.type!==t.Types.info)return-1;let i=+!!e.states.find(e=>e.id===r&&e.required),a=+!!n.states.find(e=>e.id===r&&e.required);if(i!==a)return a-i;if(!i){let t=+!!e.states.find(e=>e.id===r),i=+!!n.states.find(e=>e.id===r);if(t!==i)return i-t}let o=e.states.filter(e=>e.id).length;return n.states.filter(e=>e.id).length-o}),this.cache[r]=c.length?c:null,this.cache[r]}static getPatterns(){let e={};return Object.keys(r.patterns).forEach(t=>{let n=JSON.parse(JSON.stringify(r.patterns[t]));n.states.forEach((e,i)=>{let a=r.patterns[t].states[i];a.role&&(n.states[i].role=a.role.toString()),a.enums&&(n.states[i].enums=!0)}),e[t]=n}),e}};e.ChannelDetector=i,i.getEnums=n.getEnums})),rG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StateType=e.Types=e.roleOrEnumGate=e.roleOrEnumDoor=e.roleOrEnumWindow=e.roleOrEnumBlind=e.roleOrEnumLight=void 0;var t=nG(),n=eG();Object.defineProperty(e,"roleOrEnumLight",{enumerable:!0,get:function(){return n.roleOrEnumLight}}),Object.defineProperty(e,"roleOrEnumBlind",{enumerable:!0,get:function(){return n.roleOrEnumBlind}}),Object.defineProperty(e,"roleOrEnumWindow",{enumerable:!0,get:function(){return n.roleOrEnumWindow}}),Object.defineProperty(e,"roleOrEnumDoor",{enumerable:!0,get:function(){return n.roleOrEnumDoor}}),Object.defineProperty(e,"roleOrEnumGate",{enumerable:!0,get:function(){return n.roleOrEnumGate}}),e.default=t.ChannelDetector;var r=$W();Object.defineProperty(e,"Types",{enumerable:!0,get:function(){return r.Types}}),Object.defineProperty(e,"StateType",{enumerable:!0,get:function(){return r.StateType}})}));R.createContext;function iG(){return iG=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iG.apply(null,arguments)}function aG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oG(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?aG(Object(n),!0).forEach(function(t){sG(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sG(e,t,n){return(t=cG(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cG(e){var t=lG(e,`string`);return typeof t==`symbol`?t:t+``}function lG(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function uG(e){return e&&e.map((e,t)=>R.createElement(e.tag,oG({key:t},e.attr),uG(e.child)))}var dG=rG();dG.Types.airCondition,dG.Types.blind,dG.Types.blindButtons,dG.Types.button,dG.Types.buttonSensor,dG.Types.camera,dG.Types.chart,dG.Types.image,dG.Types.dimmer,dG.Types.door,dG.Types.fireAlarm,dG.Types.floodAlarm,dG.Types.gate,dG.Types.humidity,dG.Types.illuminance,dG.Types.info,dG.Types.light,dG.Types.lock,dG.Types.location,dG.Types.locationOne,dG.Types.media,dG.Types.motion,dG.Types.ct,dG.Types.percentage,dG.Types.rgb,dG.Types.rgbSingle,dG.Types.rgbwSingle,dG.Types.hue,dG.Types.cie,dG.Types.slider,dG.Types.socket,dG.Types.temperature,dG.Types.thermostat,dG.Types.vacuumCleaner,dG.Types.volume,dG.Types.volumeGroup,dG.Types.window,dG.Types.windowTilt,dG.Types.weatherCurrent,dG.Types.weatherForecast,dG.Types.warning,dG.Types.unknown,dG.Types.instance;var fG=class e extends R.Component{static generateFile(e,t){let n=window.document.createElement(`a`);n.setAttribute(`href`,`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(t,null,2))}`),n.setAttribute(`download`,e),n.style.display=`none`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}handleFileSelect=e=>{let t=e.target?.files;if(!t||!t.length){console.error(`No files found. Please report to developers`);return}let n=t[0];if(n){let e=new window.FileReader;e.onload=()=>{let t=e.result?.toString()||``;try{let e=JSON.parse(t);e.native&&e.common?e.common.name===this.props.common.name?this.props.onLoad&&this.props.onLoad(e.native):this.props.onError&&this.props.onError(zk.t(`ra_otherConfig`,e.common.name)):this.props.onError&&this.props.onError(zk.t(`ra_invalidConfig`))}catch(e){this.props.onError&&this.props.onError(e?.toString())}},e.readAsText(n)}else alert(`Failed to open JSON File`)};download(){let t={_id:`system.adapter.${this.props.common.name}.${this.props.instance}`,common:JSON.parse(JSON.stringify(this.props.common)),native:this.props.native};t.common.news&&delete t.common.news,t.common.titleLang&&delete t.common.titleLang,t.common.desc&&delete t.common.desc,e.generateFile(`${t._id}.json`,t)}upload(){let e=window.document.createElement(`input`);e.setAttribute(`type`,`file`),e.setAttribute(`id`,`files`),e.setAttribute(`opacity`,`0`),e.addEventListener(`change`,this.handleFileSelect,!1),e.click()}render(){return R.createElement(`div`,{className:this.props.className,style:this.props.style},this.props.common.icon?R.createElement(MW,{src:this.props.common.icon,style:{padding:8,width:64},alt:`logo`}):null,this.props.common.readme?R.createElement(EC,{size:`small`,color:`primary`,"aria-label":`Help`,style:{marginRight:5,marginTop:5,float:`right`},onClick:()=>{window.open(this.props.common.readme,`_blank`)?.focus()}},R.createElement(WO,null)):null,R.createElement(EC,{size:`small`,color:`primary`,"aria-label":`Load config`,style:{marginRight:5,marginTop:5,float:`right`},title:zk.t(`ra_Load configuration from file`),onClick:()=>this.upload()},R.createElement(mk,null)),R.createElement(EC,{size:`small`,color:`primary`,"aria-label":`Save config`,style:{marginRight:5,marginTop:5,float:`right`},title:zk.t(`ra_Save configuration to file`),onClick:()=>this.download()},R.createElement(pk,null)))}};function pG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z`}))}function mG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 320 320`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`g`,{fill:`currentColor`},R.createElement(`rect`,{rx:`32`,height:`272`,width:`267`,y:`25`,x:`25`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`248`,cx:`160`,fill:`none`,strokeWidth:`15`}),R.createElement(`line`,{y2:`201.94531`,x2:`159.5`,y1:`46.94531`,x1:`159.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`79.7979`,x:`133.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`})))}function hG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z`}))}function gG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 320 320`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`g`,{fill:`currentColor`},R.createElement(`rect`,{rx:`32`,height:`272`,width:`267`,y:`25`,x:`25`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`252`,cx:`160`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,fill:`#fff`}),R.createElement(`line`,{y2:`201.94531`,x2:`159.5`,y1:`46.94531`,x1:`159.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`140.83068`,x:`133.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`251`,cx:`241`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,fill:`#fff`}),R.createElement(`line`,{y2:`200.94531`,x2:`240.5`,y1:`45.94531`,x1:`240.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`78.7979`,x:`214.5`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`252`,cx:`84`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,fill:`#fff`}),R.createElement(`line`,{y2:`201.94531`,x2:`83.5`,y1:`46.94531`,x1:`83.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`79.7979`,x:`57.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`})))}function _G(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,onClick:t=>e.onClick&&e.onClick(t),width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z`}))}function vG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z`}),R.createElement(`path`,{fill:`currentColor`,stroke:`null`,d:`m261,270l-12,0l0,-24c0,-33.12 -26.88,-60 -60,-60s-60,26.88 -60,60l0,24l-12,0c-13.2,0 -24,10.8 -24,24l0,120c0,13.2 10.8,24 24,24l144,0c13.2,0 24,-10.8 24,-24l0,-120c0,-13.2 -10.8,-24 -24,-24zm-72,108c-13.2,0 -24,-10.8 -24,-24s10.8,-24 24,-24s24,10.8 24,24s-10.8,24 -24,24zm37.2,-108l-74.4,0l0,-24c0,-20.52 16.68,-37.2 37.2,-37.2c20.52,0 37.2,16.68 37.2,37.2l0,24z`}))}function yG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z`}))}function bG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 320 320`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`rect`,{fill:`none`,rx:`32`,height:`272`,width:`267`,y:`25`,x:`25`,strokeWidth:`15`,stroke:`currentColor`}),R.createElement(`ellipse`,{fill:`none`,ry:`54`,rx:`54`,cy:`160`,cx:`160`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`}))}function xG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 24 24`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,stroke:`currentColor`,d:`M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39A.998.998 0 0 0 18.95 4H5.04c-.83 0-1.3.95-.79 1.61z`}))}var SG={root:{width:`100%`,height:`100%`},overflowHidden:{overflow:`hidden`},container:{height:`100%`}};function CG(e){return R.createElement(T_,{elevation:Number.isNaN(e.elevation)?1:e.elevation,style:{...SG.root,...e.styles?.root||void 0,...e.overflow===`visible`?void 0:SG.overflowHidden},onKeyDown:e.onKeyDown,tabIndex:e.tabIndex},R.createElement(rw,{container:!0,direction:`column`,wrap:`nowrap`,sx:SG.container},e.children))}var wG={root:{height:`100%`,overflow:`hidden`},overflowAuto:{overflow:`auto`}},TG=R.forwardRef(function(e,t){return R.createElement(rw,{sx:{...wG.root,...e?.style||void 0,...e.overflow===`auto`?wG.overflowAuto:void 0},ref:t},e.children)});function EG(e){return R.createElement(rw,{container:!0,alignItems:`center`},e.children)}var DG=e=>e===`dark`?`#62ff25`:`#37c400`,OG=e=>e===`dark`?`#ee56ff`:`#a204b4`,kG=e=>e===`dark`?`#fff46e`:`#b89101`,AG=e=>`#ff6d69`,jG=e=>`#5773ff`,MG=[`0_userdata.0.`,`alias.0.`],NG={headerCellInput:{width:`calc(100% - 5px)`,height:32,pt:0,"& .itemIcon":{verticalAlign:`middle`,width:24,height:24,display:`inline-block`}},headerCellSelectItem:{"& .itemIcon":{width:24,height:24,mr:`5px`,display:`inline-block`}},selectNone:{opacity:.5},selectClearButton:{position:`absolute`,top:0,right:0,borderRadius:5,backgroundColor:`background.default`},cellIdTooltipLink:{color:`#7ec2fd`,"&:hover":{color:`#7ec2fd`},"&:visited":{color:`#7ec2fd`}},cellIdTooltip:{fontSize:14}};function PG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 436 436`,style:e?.style,width:`24`,height:`24`,className:`admin-button`},R.createElement(`g`,{fill:`currentColor`},R.createElement(`path`,{d:`m195.23077,24.30769c-36,3 -67,12 -96,26c-49,24 -82,61 -93,104l-3,11l-1,50c0,46 0,49 2,59l5,20c21,58 84,103 165,116c16,3 53,4 70,2c60,-6 111,-28 147,-64c21,-21 36,-49 40,-74a866,866 0 0 0 1,-104c-3,-18 -6,-28 -13,-43c-26,-52 -87,-90 -162,-101c-16,-2 -48,-3 -63,-2l1,0zm60,23c36,5 70,18 95,35c31,20 51,47 59,77c2,7 2,11 2,25c1,15 0,18 -2,26c-19,69 -104,117 -200,114c-47,-2 -90,-15 -124,-38c-31,-20 -51,-47 -59,-77c-3,-11 -4,-32 -2,-43c8,-42 41,-78 91,-101a260,260 0 0 1 140,-19l0,1zm-221,222c21,26 57,49 95,62c81,27 174,14 239,-32c14,-10 31,-27 41,-41c2,-2 2,-2 2,7c-1,23 -16,50 -38,72c-78,74 -233,74 -311,-1a121,121 0 0 1 -39,-76l0,-6l3,4l8,11z`}),R.createElement(`path`,{d:`m201.23077,47.30769c-40,3 -79,19 -104,44c-55,55 -38,133 37,171c52,26 122,24 172,-5c30,-17 51,-42 58,-71c3,-11 3,-34 0,-45c-6,-23 -21,-44 -40,-60l-27,-16a184,184 0 0 0 -96,-18zm30,21c56,5 100,35 112,75c4,11 4,30 0,41c-8,25 -26,45 -54,59a166,166 0 0 1 -160,-8a98,98 0 0 1 -41,-53c-5,-18 -2,-39 8,-57c23,-39 79,-62 135,-57z`})))}function FG(e){e=(e||``).toString();let t=e[0]===`*`,n=e[e.length-1]===`*`;return e=e.replace(/[-/\\^$+?.()|[\]{}]/g,`\\$&`).replace(/\*/g,`.*`),(t?``:`^`)+e+(n?``:`$`)}function IG(e,t){let n=[];for(let r=0;r<e.length;r++)t(n,e[r],r);return n}function LG(e,t){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(n,e[r],r);return n}function RG(e,t,n){return Array.isArray(e)?IG(e,(e,r,i)=>{if(r==null)return;let a=typeof r==`object`;if(n&&a&&typeof r.en==`string`&&typeof r.de==`string`){e[i]=r.en;return}e[i]=a?RG(r,t,n):r}):LG(e,(e,r,i)=>{if(r==null||t.includes(i))return;let a=typeof r==`object`;if(n&&a&&typeof r.en==`string`&&typeof r.de==`string`){e[i]=r.en;return}e[i]=a?RG(r,t,n):r})}function zG(e,t,n){let r=document.createElement(`a`),i=[];n.excludeSystemRepositories&&i.push(`system.repositories`);let a=i.length>0||n.excludeTranslations?RG(t,i,n.excludeTranslations):t,o=n.beautify?JSON.stringify(a,null,2):JSON.stringify(a);r.setAttribute(`href`,`data:application/json;charset=utf-8,${encodeURIComponent(o)}`),r.setAttribute(`download`,e),r.style.display=`none`,document.body.appendChild(r),r.click(),document.body.removeChild(r)}var BG=class extends R.Component{hasIcons;timer=null;constructor(e){super(e),this.state={value:e.initialValue||[]},this.hasIcons=!!e.values?.find(e=>e.icon)}componentWillUnmount(){this.timer&&clearTimeout(this.timer)}render(){return R.createElement(`div`,{style:{position:`relative`}},R.createElement(yE,{variant:`standard`,key:this.props.name,sx:NG.headerCellInput,className:`no-underline`,multiple:!0,renderValue:e=>e?.length?e.map(e=>{let t=this.props.values.find(t=>typeof t==`object`?t.value===e:t===e),n,r,i;return typeof t==`object`?(n=t.value,r=t.name,i=t.icon):(n=t,r=t),R.createElement(_x,{component:`span`,sx:NG.headerCellSelectItem,key:n},i||(this.hasIcons?R.createElement(`div`,{className:`itemIcon`}):null),r)}):this.props.name===`custom`?this.props.texts.showAll:this.props.texts[`filter_${this.props.name}`],value:this.state.value,onChange:e=>{let t=e.target.value;if(this.state.value[0]===`_`&&t.includes(`_`)&&t.length>1){let e=t.indexOf(`_`);e!==-1&&t.splice(e,1)}else this.state.value[0]!==`_`&&t.includes(`_`)&&(t=[`_`]);t.includes(``)&&(t=[]),this.setState({value:t},()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.props.onChange(this.props.name,t)},400)})},onClose:()=>{this.timer&&(clearTimeout(this.timer),this.timer=null,this.props.onChange(this.props.name,this.state.value))},inputProps:{name:this.props.name,id:this.props.name},displayEmpty:!0},R.createElement(LT,{key:`empty`,value:``},R.createElement(`span`,{style:NG.selectNone},this.props.name===`custom`?this.props.texts.showAll:this.props.texts[`filter_${this.props.name}`])),this.props.values?.map(e=>{let t,n,r;return typeof e==`object`?(t=e.value,n=e.name,r=e.icon):(t=e,n=e),R.createElement(LT,{sx:NG.headerCellSelectItem,key:t,value:t},r||(this.hasIcons?R.createElement(`div`,{className:`itemIcon`}):null),n)})),this.state.value.length?R.createElement(_x,{component:`div`,sx:NG.selectClearButton},R.createElement(uv,{size:`small`,onClick:()=>{this.timer&&=(clearTimeout(this.timer),null),this.setState({value:[]},()=>this.props.onChange(this.props.name,void 0))}},R.createElement(DO,null))):null)}},VG=class extends R.Component{timer=null;constructor(e){super(e),this.state={value:e.initialValue||``}}componentWillUnmount(){this.timer&&clearTimeout(this.timer)}render(){return R.createElement(PC,{sx:this.props.styles,key:this.props.name,title:this.props.t(`ra_You can use * as wildcard`),margin:`dense`},R.createElement(fw,{classes:{underline:`no-underline`},id:this.props.name,placeholder:this.props.texts[`filter_${this.props.name}`],value:this.state.value,onChange:e=>{let t=e.target.value;this.setState({value:t},()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.props.onChange(this.props.name,t)},400)})},onBlur:()=>{this.timer&&(clearTimeout(this.timer),this.timer=null,this.props.onChange(this.props.name,this.state.value))},autoComplete:`off`}),this.state.value?R.createElement(`div`,{style:{position:`absolute`,right:0}},R.createElement(uv,{size:`small`,onClick:()=>{this.timer&&=(clearTimeout(this.timer),null),this.setState({value:``},()=>this.props.onChange(this.props.name,void 0))}},R.createElement(DO,null))):null)}};function HG(e,t,n,r){if(n||=0,r===void 0&&(r=e.length-1,!r))return e[0]===t;let i=Math.floor((n+r)/2);return t===e[i]?!0:r-1===n?e[n]===t||e[r]===t:t>e[i]?HG(e,t,i,r):t<e[i]&&HG(e,t,n,i)}function UG(e,t){return typeof e==`object`?e?(e[t]||e.en||``).toString():``:e?e.toString():``}function WG(e,t,n,r){r||=`.`;let i=``,a=`system.adapter.${t}`,o=t&&e[a]?.common?.icon;if(o)if(o.startsWith(`data:image/`))i=o.startsWith(`data:image/svg`)?R.createElement(kW,{className:`iconOwn`,src:o,width:28,height:28}):o;else if(o.includes(`.`)){let t=e[a].common.name;i=typeof t==`object`?`${r}/adapter/${t[n]||t.en}/${o}`:`${r}/adapter/${t}/${o}`}else if(o&&o.length<3)return o;else return null;else{let a=e[t]?.common;if(a){let s=a.icon;if(s)if(s.startsWith(`data:image/`))i=s.startsWith(`data:image/svg`)?R.createElement(kW,{className:`iconOwn`,src:s,width:28,height:28}):s;else if(s.includes(`.`)){let o;e[t].type===`instance`||e[t].type===`adapter`?i=typeof a.name==`object`?`${r}/adapter/${a.name[n]||a.name.en}/${s}`:`${r}/adapter/${a.name}/${s}`:t&&t.startsWith(`system.adapter.`)?(o=t.split(`.`,3),s[0]===`/`?o[2]+=s:o[2]+=`/${s}`,i=`${r}/adapter/${o[2]}`):(o=t.split(`.`,2),s[0]===`/`?o[0]+=s:o[0]+=`/${s}`,i=`${r}/adapter/${o[0]}`)}else if(o&&o.length<3)return o;else return null}}return i||null}function GG(e,t,n,r,i,a,o,s,c){c||=0;let l=!1;if(!i){if(i={},t.id){let e=t.id.toLowerCase();e.includes(`*`)?i.idRx=new RegExp(FG(t.id),`i`):i.id=e}if(t.name){let e=t.name.toLowerCase();e.includes(`*`)?i.nameRx=new RegExp(FG(e),`i`):i.name=e}t.type?.length&&(i.type=t.type.map(e=>e.toLowerCase())),t.custom?.length&&(i.custom=t.custom.map(e=>e.toLowerCase())),t.role?.length&&(i.role=t.role.map(e=>e.toLowerCase())),t.room?.length&&(i.room=[],t.room.forEach(e=>{i.room=i.room.concat(r[e]?.common?.members||[])})),t.func?.length&&(i.func=[],t.func.forEach(e=>{i.func=i.func.concat(r[e]?.common?.members||[])}))}let u=e.data;if(u?.id){let e=u.obj?.common;if(o){if(o.type&&(typeof o.type==`string`?(!u.obj||o.type!==u.obj.type)&&(l=!0):Array.isArray(o.type)&&(!u.obj||!o.type.includes(u.obj.type))&&(l=!0)),!l&&o.common?.type&&(e?.type?typeof o.common.type==`string`?o.common.type!==e.type&&(l=!0):Array.isArray(o.common.type)&&(o.common.type.includes(e.type)||(l=!0)):l=!0),!l&&o.common?.role&&(e?.role?typeof o.common.role==`string`?e.role.startsWith(o.common.role)&&(l=!0):Array.isArray(o.common.role)&&(o.common.role.find(t=>e.role.startsWith(t))||(l=!0)):l=!0),!l&&o.common?.custom===`_`&&e?.custom)l=!0;else if(!l&&o.common?.custom&&o.common?.custom!==`_`){let t=o.common.custom;if(!e?.custom)l=!0;else if(t===`_dataSources`)Object.keys(e.custom).find(e=>e.startsWith(`history.`)||e.startsWith(`sql.`)||e.startsWith(`influxdb.`))||(l=!0);else if(Array.isArray(t)){let n=Object.keys(e.custom);t.find(e=>n.find(t=>t.startsWith(e)))&&(l=!0)}else t!==!0&&!Object.keys(e.custom).find(e=>e.startsWith(t))&&(l=!0)}}!l&&!t.expertMode&&(l=u.id===`system`||u.id===`enum`||u.id.startsWith(`system.`)||u.id.startsWith(`enum.`)||u.id.startsWith(`_design/`)||u.id.endsWith(`.admin`)||!!e?.expert),!l&&i.id&&(u.fID===void 0&&(u.fID=u.id.toLowerCase()),l=!u.fID.includes(i.id)),!l&&i.idRx&&(l=!i.idRx.test(u.id)),!l&&i.name&&(e?(u.fName===void 0&&(u.fName=UG(e.name,n)||``,u.fName=u.fName.toLowerCase()),l=!u.fName.includes(i.name)):l=!0),!l&&i.nameRx&&e&&(u.fName===void 0&&(u.fName=UG(e.name,n)||``,u.fName=u.fName.toLowerCase()),l=!i.nameRx.test(u.fName)),!l&&t.role?.length&&e&&i.role?.length&&(l=!(typeof e.role==`string`&&i.role.find(t=>e.role.startsWith(t)))),!l&&i.room?.length&&(l=!i.room.find(e=>e===u.id||u.id.startsWith(`${e}.`))),!l&&i.func?.length&&(l=!i.func.find(e=>e===u.id||u.id.startsWith(`${e}.`))),!l&&i.type?.length&&(l=!(u.obj?.type&&i.type.includes(u.obj.type))),!l&&s&&(l=!(u.obj?.type&&s.includes(u.obj.type))),!l&&i.custom?.length&&(l=e?i.custom[0]===`_`?!!e.custom:!e.custom||!i.custom.find(t=>e.custom[t]):i.custom[0]!==`_`)}return u.visible=!l,u.hasVisibleChildren=!1,e.children&&c<20&&e.children.forEach(e=>{GG(e,t,n,r,i,a,o,s,c+1)&&(u.hasVisibleChildren=!0)}),u.sumVisibility=u.visible||u.hasVisibleChildren,a&&u.sumVisibility&&a.count++,u.id&&u.sumVisibility&&e.children&&e.children.forEach(e=>e.data.hasVisibleParent=!0),u.visible||u.hasVisibleChildren}function KG(e,t,n,r){r||=[];let i=e.data;return i.sumVisibility&&(i.id&&n[i.id]&&(!t||n[i.id].type===t)&&r.push(i.id),e.children?.forEach(e=>KG(e,t,n,r))),r}function qG(e,t,n,r,i,a){let o;return t===`alias`||t===`alias.0`?o=R.createElement(YO,{className:`iconOwn`,style:{color:OG(r)}}):t===`0_userdata`||t===`0_userdata.0`?o=R.createElement(NO,{className:`iconOwn`,style:{color:DG(r)}}):t.startsWith(`_design/`)||t===`system`?o=R.createElement(ck,{className:`iconOwn`,style:{color:AG(r)}}):t===`system.adapter`?o=R.createElement(ck,{className:`iconOwn`,style:{color:jG(r)}}):t===`system.group`?o=R.createElement(uk,{className:`iconOwn`}):t===`system.user`?o=R.createElement(tk,{className:`iconOwn`}):t===`system.host`?o=R.createElement(ik,{className:`iconOwn`}):t.endsWith(`.connection`)||t.endsWith(`.connected`)?o=R.createElement(vk,{className:`iconOwn`}):t.endsWith(`.info`)?o=R.createElement(KO,{className:`iconOwn`}):e[t]&&e[t].type===`meta`?o=R.createElement(FO,{className:`iconOwn`}):n<2&&e[`system.adapter.${t}`]&&(o=WG(e,`system.adapter.${t}`,i,a)),o||null}function JG(e,t){return e?.obj?.common?.desc&&UG(e.obj.common.desc,t)||null}function YG(e,t){let n=JG(e,t);return n?.startsWith(`http`)?R.createElement(_x,{component:`a`,sx:NG.cellIdTooltipLink,href:n,target:`_blank`,rel:`noreferrer`},n):R.createElement(`span`,{style:NG.cellIdTooltip},n||e.id||``)}function XG(e,t){let n=t.imagePrefix||`.`,r=Object.keys(e);r.sort((e,t)=>e===t?0:(e=e.replace(/\./g,`!!!`),t=t.replace(/\./g,`!!!`),e>t?1:-1)),t.root&&(r=r.filter(e=>e===t.root||e.startsWith(`${t.root}.`)));let i=[],a=``,o=0,s={data:{name:``,id:``},children:[]},c={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:e,customs:[`_`],enums:[],hasSomeCustoms:!1,aliasesMap:{}},l=s;for(let u=0;u<r.length;u++){let d=r[u];if(!d)continue;let f=e[d],p=d.split(`.`);if(f.type&&!c.types.includes(f.type)&&c.types.push(f.type),f){let e=f.common,t=e?.role;if(t&&!c.roles.find(e=>e.role===t)?typeof t==`string`?c.roles.push({role:t,type:e.type}):console.warn(`Invalid role type "${typeof t}" in "${f._id}"`):d.startsWith(`enum.rooms.`)?(c.roomEnums.push(d),c.enums.push(d)):d.startsWith(`enum.functions.`)?(c.funcEnums.push(d),c.enums.push(d)):f.type===`enum`?c.enums.push(d):f.type===`instance`&&e&&(e.supportCustoms||e.adminUI?.custom)&&(c.hasSomeCustoms=!0,c.customs.push(d.substring(15))),d.startsWith(`alias.`)&&f.common.alias?.id)if(typeof f.common.alias.id==`string`){let e=f.common.alias.id;c.aliasesMap[e]?c.aliasesMap[e].includes(d)||c.aliasesMap[e].push(d):c.aliasesMap[e]=[d]}else{let e=f.common.alias.id.read;e&&(c.aliasesMap[e]?c.aliasesMap[e].includes(d)||c.aliasesMap[e].push(d):c.aliasesMap[e]=[d]);let t=f.common.alias.id.write;t&&(c.aliasesMap[t]?c.aliasesMap[t].includes(d)||c.aliasesMap[t].push(d):c.aliasesMap[t]=[d])}}c.ids.push(d);let m;do if(m=!1,!a||d.startsWith(`${a}.`)){if(p.length-o>1){let r=a;for(let i=o;i<p.length-1;i++)if(r+=(r?`.`:``)+p[i],!HG(c.ids,r)){let a={data:{name:p[i],parent:l,id:r,obj:e[r],level:i,icon:qG(e,r,i,t.themeType,t.lang,n),generated:!0}};l.children||=[],l.children.push(a),l=a,c.ids.push(r)}else if(l.children&&(l=l.children.find(e=>e.data.name===p[i]),!l))throw Error(`Cannot find root in children!`)}let r={data:{name:p[p.length-1],title:UG(f?.common?.name,t.lang),obj:f,parent:l,icon:WG(e,d,t.lang,n)||qG(e,d,0,t.themeType,t.lang,n),id:d,hasCustoms:!!(f.common?.custom&&Object.keys(f.common.custom).length),level:p.length-1,generated:!1,button:f.type===`state`&&!!f.common?.role&&typeof f.common.role==`string`&&f.common.role.startsWith(`button`)&&f.common?.write!==!1,switch:f.type===`state`&&f.common?.type===`boolean`&&f.common?.write!==!1&&f.common?.read!==!1,url:!!f.common?.role&&typeof f.common.role==`string`&&f.common.role.startsWith(`url`)}};l.children||=[],l.children.push(r),l=r,o=p.length,i=p,a=d}else{let e=0;for(;i[e]===p[e];)e++;if(e>0){let t=i.length;for(i=i.splice(0,e),o=e,a=i.join(`.`);t>e;)l.data.parent?l=l.data.parent:console.error(`Parent is null for ${d} ${a} ${i.join(`.`)}`),t--}else l=s,i=[],a=``,o=0;m=!0}while(m)}return c.roomEnums.sort((n,r)=>{let i=UG(e[n]?.common?.name,t.lang)||n.split(`.`).pop()||``,a=UG(e[r]?.common?.name,t.lang)||r.split(`.`).pop()||``;return i>a?1:i<a?-1:0}),c.funcEnums.sort((n,r)=>{let i=UG(e[n]?.common?.name,t.lang)||n.split(`.`).pop()||``,a=UG(e[r]?.common?.name,t.lang)||r.split(`.`).pop()||``;return i>a?1:i<a?-1:0}),c.roles.sort((e,t)=>e.role.localeCompare(t.role)),c.types.sort(),{info:c,root:s}}function ZG(e,t,n,r,i){if(e.data.id===t)return e;if(n||(n=t.split(`.`),i=0,r=n[i]),!e.children&&e.data.id!==t)return null;let a;if(e.children)for(let t=0;t<e.children.length;t++){let n=e.children[t].data.id;if(n===r){a=e.children[t];break}else if(n>(r||``))break}return a?(i||=0,ZG(a,t,n,`${r}.${n[i+1]}`,i+1)):null}function QG(e,t,n,r){if(!t)return{rooms:[],per:!1};r||=[];for(let i of e.roomEnums){let a=e.objects[i]?.common;if(!a)continue;let o=UG(a.name,n);a.members?.includes(t)&&!r.includes(o)&&r.push(o)}let i,a=t.split(`.`);return a.pop(),t=a.join(`.`),e.objects[t]&&(i=r.length,QG(e,t,n,r)),{rooms:r,per:!i}}function $G(e,t,n,r){if(!t)return[];r||=[];for(let i=0;i<e[n].length;i++)(e.objects[e[n][i]]?.common)?.members?.includes(t)&&!r.includes(e[n][i])&&r.push(e[n][i]);return r.sort(),r}function eK(e,t,n,r){if(!t)return{funcs:[],pef:!1};r||=[];for(let i=0;i<e.funcEnums.length;i++){let a=e.objects[e.funcEnums[i]]?.common;if(!a)continue;let o=UG(a.name,n);a.members?.includes(t)&&!r.includes(o)&&r.push(o)}let i,a=t.split(`.`);return a.pop(),t=a.join(`.`),e.objects[t]&&(i=r.length,eK(e,t,n,r)),{funcs:r,pef:!i}}function tK(e){let{dateFormat:t,state:n,isFloatComma:r,texts:i,obj:a}=e,o=X.getStates(a),s=a.common,c,l=s?.type===`file`?`[file]`:!n||n.val===null?`(null)`:n.val===void 0?`[undef]`:n.val,u=typeof l;if(s?.role&&typeof s.role==`string`&&s.role.match(/^value\.time|^date/))if(l&&typeof l==`string`)if(X.isStringInteger(l))l=new Date(parseInt(l,10)).toString();else try{let e=new Date(l);X.isValidDate(e)&&(l=e.toString())}catch{}else l>946681200&&l<9466812e5&&(l*=1e3),l&&=new Date(l).toString();else if(s?.role&&typeof s.role==`string`&&s.role.match(/^value\.duration/)){if(typeof l==`number`&&l>=0){let e=Math.floor(l/3600),t=Math.floor(l%3600/60),n=Math.floor(l%60);l=`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}else if(typeof l==`string`&&X.isStringInteger(l)){let e=parseInt(l,10);if(e>=0){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);l=`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}}}else u===`number`?Number.isInteger(l)||(l=Math.round(l*1e8)/1e8,r&&(l=l.toString().replace(`.`,`,`))):u===`object`?l=JSON.stringify(l):u===`string`?l.startsWith(`data:image/`)&&(c=`image`):l=l.toString(),typeof l!=`string`&&(l=l.toString());let d={v:l};o&&o[l]!==void 0&&l!==o[l]&&(d.s=l,l=o[l],d.v=l),d.v?.length>40&&(d.c=d.v,d.v=`${d.v.substring(0,40)}...`),s?.unit&&(d.u=s.unit);let f;if(e.full&&(f=typeof l==`string`&&l.length>100?[{t:i.value,v:`${l.substring(0,100)}...`}]:[{t:i.value,v:l}],n)){if(n.ack!==void 0&&n.ack!==null&&f.push({t:i.ack,v:n.ack.toString()}),n.ts&&f.push({t:i.ts,v:n.ts?X.formatDate(new Date(n.ts),t):``}),n.lc&&f.push({t:i.lc,v:n.lc?X.formatDate(new Date(n.lc),t):``}),n.from){let e=n.from.toString();e.startsWith(`system.adapter.`)&&(e=e.substring(15)),f.push({t:i.from,v:e})}if(n.user){let e=n.user.toString();e.startsWith(`system.user.`)&&(e=e.substring(12)),f.push({t:i.user,v:e})}n.c&&f.push({t:i.c,v:n.c}),f.push({t:i.quality,v:X.quality2text(n.q||0).join(`, `),nbr:!0})}return{valText:d,valFull:f,fileViewer:c}}function nK(e){let{state:t}=e;return{color:t?.ack?t.q?`#ffa500`:``:e.nonAckColor||`#ff2222c9`}}function rK(e,t){let n=t,r=1,i=[];for(;r<e.length&&n<t+25*36e5;){for(;e[r-1].ts<n&&n<=e[r].ts&&r<e.length;)r++;if(r===1&&e[r-1].ts>=n)i.push(0);else if(r<e.length)if(typeof e[r].val==`boolean`||typeof e[r-1].val==`boolean`)i.push(+!!e[r].val);else{e[r-1].val||=0,e[r].val||=0;let t=e[r-1].val,a=t+(e[r].val-t)*(n-e[r-1].ts)/(e[r].ts-e[r-1].ts);i.push(a)}n+=36e5}return i}function iK(e,t){if(e?._id?.startsWith(`${t.adapter}.`)&&t.path.length>1){let n=t.path,r,i=e;if(i[n[0]]&&typeof i[n[0]]==`object`)return n.length===2?r=i[n[0]][n[1]]:n.length===3?r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`?i[n[0]][n[1]][n[2]]:null:n.length===4?r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`&&i[n[0]][n[1]][n[2]]?i[n[0]][n[1]][n[2]][n[3]]:null:n.length===5?r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`&&i[n[0]][n[1]][n[2]]&&i[n[0]][n[1]][n[2]][n[3]]?i[n[0]][n[1]][n[2]][n[3]][n[4]]:null:n.length===6&&(r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`&&i[n[0]][n[1]][n[2]]&&i[n[0]][n[1]][n[2]][n[3]]&&i[n[0]][n[1]][n[2]][n[3]][n[4]]?i[n[0]][n[1]][n[2]][n[3]][n[4]][n[5]]:null),r??null}return null}function aK(e,t,n){if(e?._id?.startsWith(`${t.adapter}.`)&&t.path.length>1){let r=t.path,i=e;if(i[r[0]]&&typeof i[r[0]]==`object`){if(r.length===2)return i[r[0]][r[1]]=n,!0;if(r.length===3){if(i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`)return i[r[0]][r[1]][r[2]]=n,!0}else if(r.length===4){if(i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`&&i[r[0]][r[1]][r[2]]&&typeof i[r[0]][r[1]][r[2]]==`object`)return i[r[0]][r[1]][r[2]][r[3]]=n,!0}else if(r.length===5){if(i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`&&i[r[0]][r[1]][r[2]]&&typeof i[r[0]][r[1]][r[2]]==`object`&&i[r[0]][r[1]][r[2]][r[3]]&&typeof i[r[0]][r[1]][r[2]][r[3]]==`object`)return i[r[0]][r[1]][r[2]][r[3]][r[4]]=n,!0}else if(r.length===6&&i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`&&i[r[0]][r[1]][r[2]]&&typeof i[r[0]][r[1]][r[2]]==`object`&&i[r[0]][r[1]][r[2]][r[3]]&&typeof i[r[0]][r[1]][r[2]][r[3]]==`object`&&i[r[0]][r[1]][r[2]][r[3]][r[4]]&&typeof i[r[0]][r[1]][r[2]][r[3]][r[4]]==`object`)return i[r[0]][r[1]][r[2]][r[3]][r[4]][r[5]]=n,!0}}return!1}function oK(e){return!!MG.find(t=>e.startsWith(t))}var sK=16,cK=20,lK=`#ff413c`,uK=`#86211f`,dK=`#57ff45`,fK=`#098c04`,pK=`#f3ad11`,mK=`#6c5008`,hK=`YYYY.MM.DD`,$={toolbar:{minHeight:38},toolbarButtons:{padding:4,marginLeft:4},switchColumnAuto:{marginLeft:16},dialogColumns:{transition:`opacity 1s`},dialogColumnsLabel:{fontSize:12,paddingTop:8},columnCustom:{width:`100%`,display:`inline-block`},columnCustomEditable:{cursor:`text`},columnCustom_center:{textAlign:`center`},columnCustom_left:{textAlign:`left`},columnCustom_right:{textAlign:`right`},width100:{width:`100%`},transparent_10:{opacity:.1},transparent_20:{opacity:.2},transparent_30:{opacity:.3},transparent_40:{opacity:.4},transparent_50:{opacity:.5},transparent_60:{opacity:.6},transparent_70:{opacity:.7},transparent_80:{opacity:.8},transparent_90:{opacity:.9},transparent_100:{opacity:1},headerRow:{paddingLeft:8,height:38,whiteSpace:`nowrap`,userSelect:`none`},buttonClearFilter:{position:`relative`,float:`right`,padding:0},buttonClearFilterIcon:{zIndex:2,position:`absolute`,top:0,left:0,color:`#FF0000`,opacity:.7},tableDiv:{paddingTop:0,paddingLeft:0,width:`calc(100% - 8px)`,height:`calc(100% - 38px)`,overflow:`auto`},tableRow:e=>({pl:1,height:32,lineHeight:`32px`,verticalAlign:`top`,userSelect:`none`,position:`relative`,width:`100%`,"&:hover":{background:`${e.palette.mode===`dark`?e.palette.primary.dark:e.palette.primary.light} !important`,color:X.invertColor(e.palette.primary.main,!0)},whiteSpace:`nowrap`,flexWrap:`nowrap`}),tableRowLines:e=>({borderBottom:`1px solid ${e.palette.mode,`#8888882e`}`,"& > div":{borderRight:`1px solid ${e.palette.mode,`#8888882e`}`}}),tableRowNoDragging:{cursor:`pointer`},tableRowAlias:{height:42},tableRowAliasReadWrite:{height:54},tableRowFocused:e=>({"&:after":{content:`""`,position:`absolute`,top:1,left:1,right:1,bottom:1,border:e.palette.mode?`1px dotted #000`:`1px dotted #FFF`}}),checkBox:{padding:0},cellId:{position:`relative`,fontSize:`1rem`,overflow:`hidden`,textOverflow:`ellipsis`,"& .copyButton":{display:`none`},"&:hover .copyButton":{display:`block`},"& .iconOwn":{display:`block`,width:28,height:28,mt:`2px`,float:`right`},"&:hover .iconOwn":{display:`none`},"& *":{width:`initial`}},cellIdSpan:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},cellIdIconFolder:e=>({marginRight:8,width:28,height:28,cursor:`pointer`,color:e.palette.secondary.main||`#fbff7d`,verticalAlign:`top`}),cellIdIconDocument:{verticalAlign:`middle`,marginLeft:(32-cK)/2,marginRight:8,width:cK,height:cK},cellIdIconOwn:{},cellCopyButton:{width:cK,height:cK,top:(32-cK)/2,opacity:.8,position:`absolute`,right:3},cellCopyButtonInDetails:{width:cK,height:cK,top:(32-cK)/2,opacity:.8},cellEditButton:{width:cK,height:cK,color:`white`,position:`absolute`,top:(32-cK)/2,right:23,opacity:.7,"&:hover":{opacity:1}},cellName:{display:`inline-block`,verticalAlign:`top`,fontSize:14,ml:`5px`,overflow:`hidden`,textOverflow:`ellipsis`,position:`relative`,"& .copyButton":{display:`none`},"&:hover .copyButton":{display:`block`}},cellNameWithDesc:{lineHeight:`normal`},cellNameDivDiv:{},cellDescription:{fontSize:10,opacity:.5,fontStyle:`italic`},cellIdAlias:e=>({fontStyle:`italic`,fontSize:12,opacity:.7,"&:hover":{color:e.palette.mode===`dark`?`#009900`:`#007700`}}),cellIdAliasReadWriteDiv:{height:24,marginTop:-5},cellIdAliasAlone:{lineHeight:0},cellIdAliasReadWrite:{lineHeight:`12px`},cellType:{display:`inline-block`,verticalAlign:`top`,"& .itemIcon":{verticalAlign:`middle`,width:24,height:24,display:`inline-block`},"& .itemIconFolder":{marginLeft:3}},cellRole:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellRoom:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellEnumParent:{opacity:.4},cellFunc:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellValue:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellValueButton:{marginTop:5},cellValueButtonFalse:{opacity:.3},cellAdapter:{display:`inline-block`,verticalAlign:`top`},cellValueTooltip:{fontSize:12},cellValueText:{width:`100%`,height:32,fontSize:16,display:`flex`,overflow:`hidden`,textOverflow:`ellipsis`,position:`relative`,verticalAlign:`top`,"& .copyButton":{display:`none`},"&:hover .copyButton":{display:`block`}},cellValueFile:{color:`#2837b9`},cellValueTooltipTitle:{fontStyle:`italic`,width:100,display:`inline-block`},cellValueTooltipValue:{width:120,display:`inline-block`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},cellValueTooltipImage:{width:100,height:`auto`},cellValueTooltipBoth:{width:220,display:`inline-block`,whiteSpace:`nowrap`},cellValueTooltipBox:{width:250,overflow:`hidden`,pointerEvents:`none`},tooltip:{pointerEvents:`none`},cellValueTextUnit:{marginLeft:4,opacity:.8,display:`inline-block`},cellValueTextState:{opacity:.7},cellValueTooltipCopy:{position:`absolute`,bottom:3,right:3},cellValueTooltipEdit:{position:`absolute`,bottom:3,right:15},cellButtons:{display:`inline-block`,verticalAlign:`top`},cellButtonsButton:{display:`inline-block`,opacity:.5,width:24,height:24,"&:hover":{opacity:1},p:0,mt:`-2px`},cellButtonsEmptyButton:{fontSize:12},cellButtonMinWidth:{minWidth:40},cellButtonsButtonAlone:{ml:`26px`,pt:0,mt:`-2px`},cellButtonsButtonWithCustoms:e=>({color:e.palette.mode===`dark`?e.palette.primary.main:e.palette.secondary.main}),cellButtonsButtonWithoutCustoms:{opacity:.2},cellButtonsValueButton:e=>({position:`absolute`,top:cK/2-2,opacity:.7,width:cK-2,height:cK-2,color:e.palette.action.active,"&:hover":{opacity:1}}),cellButtonsValueButtonCopy:{right:8,cursor:`pointer`},cellButtonsValueButtonEdit:{right:26},cellDetailsLine:{display:`flex`,alignItems:`center`,width:`100%`,height:32,fontSize:16},cellDetailsName:{fontWeight:`bold`,marginRight:8,minWidth:80},filteredOut:{opacity:.5},filteredParentOut:{opacity:.3},filterInput:{mt:0,mb:0},selectIcon:{width:24,height:24,marginRight:4},itemSelected:e=>({background:`${e.palette.primary.main} !important`,color:`${X.invertColor(e.palette.primary.main,!0)} !important`}),header:{width:`100%`},headerCell:{display:`inline-block`,verticalAlign:`top`},headerCellValue:{paddingTop:4,fontSize:16},visibleButtons:{color:`#2196f3`,opacity:.7},grow:{flexGrow:1},enumIconDiv:{marginRight:8,width:32,height:32,borderRadius:8,background:`#FFFFFF`},enumIcon:{marginTop:4,marginLeft:4,width:24,height:24},enumDialog:{overflow:`hidden`},enumList:{minWidth:250,height:`calc(100% - 50px)`,overflow:`auto`},enumCheckbox:{minWidth:0},buttonDiv:{display:`flex`,height:`100%`,alignItems:`center`},aclText:{fontSize:13,marginTop:6},rightsObject:{color:`#55ff55`,paddingLeft:3},rightsState:{color:`#86b6ff`,paddingLeft:3},textCenter:{padding:12,textAlign:`center`},tooltipAccessControl:{display:`flex`,flexDirection:`column`},fontSizeTitle:{"@media screen and (max-width: 465px)":{"& *":{fontSize:12}}},draggable:{cursor:`copy`},nonDraggable:{cursor:`no-drop`},iconDeviceConnected:e=>({color:e.palette.mode===`dark`?dK:fK,opacity:.8,position:`absolute`,top:4,right:32,width:20}),iconDeviceDisconnected:e=>({color:e.palette.mode===`dark`?pK:mK,opacity:.8,position:`absolute`,top:4,right:32,width:20}),iconDeviceError:e=>({color:e.palette.mode===`dark`?lK:uK,opacity:.8,position:`absolute`,top:4,right:50,width:20}),resizeHandle:{display:`block`,position:`absolute`,cursor:`col-resize`,width:7,top:2,bottom:2,zIndex:1},resizeHandleRight:{right:3,borderRight:`2px dotted #888`,"&:hover":{borderColor:`#ccc`,borderRightStyle:`solid`},"&.active":{borderColor:`#517ea5`,borderRightStyle:`solid`}},invertedBackground:e=>({backgroundColor:e.palette.mode===`dark`?`#9a9a9a`:`#565656`,padding:`0 3px`,borderRadius:`2px 0 0 2px`}),invertedBackgroundFlex:e=>({backgroundColor:e.palette.mode===`dark`?`#9a9a9a`:`#565656`,borderRadius:`0 2px 2px 0`}),contextMenuEdit:e=>({color:e.palette.mode===`dark`?`#ffee48`:`#cbb801`}),contextMenuEditValue:e=>({color:e.palette.mode===`dark`?`#5dff45`:`#1cd301`}),contextMenuView:e=>({color:e.palette.mode===`dark`?`#FFF`:`#000`}),contextMenuCustom:e=>({color:e.palette.mode===`dark`?`#42eaff`:`#01bbc2`}),contextMenuACL:e=>({color:e.palette.mode===`dark`?`#e079ff`:`#500070`}),contextMenuRoom:e=>({color:e.palette.mode===`dark`?`#ff9a33`:`#642a00`}),contextMenuRole:e=>({color:e.palette.mode===`dark`?`#ffdb43`:`#562d00`}),contextMenuDelete:e=>({color:e.palette.mode===`dark`?`#ff4f4f`:`#cf0000`}),contextMenuKeys:{marginLeft:8,opacity:.7,fontSize:`smaller`},contextMenuWithSubMenu:{display:`flex`},...NG},gK={state:R.createElement(bG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),channel:R.createElement(mG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),device:R.createElement(gG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),adapter:R.createElement(pG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),meta:R.createElement(FO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),instance:R.createElement(yG,{className:`itemIcon`,style:{color:`#7da7ff`,verticalAlign:`middle`}}),enum:R.createElement(ZO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),chart:R.createElement(lk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),config:R.createElement(sk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),group:R.createElement(uk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),user:R.createElement(tk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),host:R.createElement(ik,{className:`itemIcon`,style:{verticalAlign:`middle`}}),schedule:R.createElement(TO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),script:R.createElement(OO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),folder:R.createElement(YU,{className:`itemIcon itemIconFolder`,style:{verticalAlign:`middle`}})},_K={xs:{idWidth:`100%`,fields:[],widths:{}},sm:{idWidth:300,fields:[`room`,`val`],widths:{room:100,val:200}},md:{idWidth:300,fields:[`room`,`func`,`val`,`buttons`],widths:{name:200,room:150,func:150,val:120,buttons:120}},lg:{idWidth:300,fields:[`name`,`type`,`role`,`room`,`func`,`val`,`buttons`,`changedFrom`,`qualityCode`,`timestamp`,`lastChange`],widths:{name:300,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:165,lastChange:165}},xl:{idWidth:550,fields:[`name`,`type`,`role`,`room`,`func`,`val`,`buttons`,`changedFrom`,`qualityCode`,`timestamp`,`lastChange`],widths:{name:400,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:170,lastChange:170}}},vK=!1,yK={id:``,name:``,room:[],func:[],role:[],type:[],custom:[],expertMode:!1},bK=class e extends R.Component{info={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:{},customs:[],enums:[],hasSomeCustoms:!1,aliasesMap:{}};localStorage=window._localStorage||window.localStorage;tableRef;pausedSubscribes=!1;selectFirst;lastNav=null;applyingNav=!1;root=null;states={};subscribes=[];unsubscribeTimer=null;statesUpdateTimer=null;objectsUpdateTimer=null;visibleCols;texts;possibleCols;imagePrefix;adapterColumns=[];styleTheme=``;edit={id:``,val:``,q:0,ack:!1};levelPadding;customWidth=!1;resizeTimeout=null;resizerNextName=null;resizerActiveName=null;resizerCurrentWidths={};resizeLeft=!1;resizerOldWidth=0;resizerMin=0;resizerNextMin=0;resizerOldWidthNext=0;resizerPosition=0;resizerActiveDiv=null;resizerNextDiv=null;storedWidths=null;systemConfig=null;objects;defaultHistory=``;ctrlPressed=!1;columnsVisibility={};changedIds=null;contextMenu=null;recordStates=[];styles={};expertMode=!1;customColumnDialog=null;constructor(e){super(e);let t=this.localStorage.getItem(`${e.dialogName||`App`}.objectSelected`)||``;if(this.selectFirst=``,this.expertMode=!!this.props.expertMode,t.startsWith(`[`))try{let e=JSON.parse(t);this.selectFirst=e[0]||``}catch{}else this.selectFirst=t;let n,r=this.localStorage.getItem(`${e.dialogName||`App`}.objectExpanded`)||`[]`;try{n=JSON.parse(r)}catch{n=[]}let i,a=e.defaultFilters?``:this.localStorage.getItem(`${e.dialogName||`App`}.objectFilter`)||``;if(a)try{i=JSON.parse(a)}catch{i={...yK}}else i=e.defaultFilters&&typeof e.defaultFilters==`object`?{...e.defaultFilters}:{...yK};if(typeof i.room==`string`&&i.room&&(i.room=[i.room].filter(e=>e),i.room.length||delete i.room),typeof i.func==`string`&&i.func&&(i.func=[i.func].filter(e=>e),i.func.length||delete i.func),typeof i.role==`string`&&i.role&&(i.role=[i.role].filter(e=>e),i.role.length||delete i.role),typeof i.type==`string`&&(i.type=[i.type].filter(e=>e),i.type.length||delete i.type),typeof i.custom==`string`&&(i.custom=[i.custom].filter(e=>e),i.custom.length||delete i.custom),i.expertMode=e.expertMode===void 0?(window._sessionStorage||window.sessionStorage).getItem(`App.expertMode`)===`true`:e.expertMode,this.tableRef=(0,R.createRef)(),this.visibleCols=e.columns||_K[e.width||`lg`].fields,e.types&&e.types.length===1){let e=this.visibleCols.indexOf(`type`);e!==-1&&this.visibleCols.splice(e,1)}this.possibleCols=_K.xl.fields;let o=null;if(e.router){let t=e.router.getLocation();t.id&&t.dialog===`customs`&&(o=[t.id],this.pauseSubscribe(!0))}let s;s=Array.isArray(e.selected)?e.selected:[e.selected||``],s=s.map(e=>e.replace(/["']/g,``)).filter(e=>e),this.selectFirst=s.length&&s[0]?s[0]:this.selectFirst;let c=this.localStorage.getItem(`${e.dialogName||`App`}.columns`),l;try{l=c?JSON.parse(c):null}catch{l=null}let u=null;try{u=u?JSON.parse(u):{}}catch{u={}}this.imagePrefix=e.imagePrefix||`.`;let d,f=this.localStorage.getItem(`${e.dialogName||`App`}.foldersFirst`);d=f===`false`?!1:f===`true`||e.foldersFirst===void 0||e.foldersFirst;let p=!1;try{p=this.props.objectStatesView&&JSON.parse(this.localStorage.getItem(`${e.dialogName||`App`}.objectStatesView`)||``)||!1}catch{}this.state={aliasMenu:``,beautifyJsonExport:!0,columns:l,columnsAuto:this.localStorage.getItem(`${e.dialogName||`App`}.columnsAuto`)!==`false`,columnsDialogTransparent:100,columnsEditCustomDialog:null,columnsForAdmin:null,columnsSelectorShow:!1,columnsWidths:u,customColumnDialogValueChanged:!1,customDialog:o,depth:0,editObjectAlias:!1,editObjectDialog:``,enumDialog:null,excludeSystemRepositoriesFromExport:!0,excludeTranslations:!1,expandAllVisible:!1,expanded:n,filter:i,filterKey:0,focused:this.localStorage.getItem(`${e.dialogName||`App`}.focused`)||``,foldersFirst:d,linesEnabled:this.localStorage.getItem(`${e.dialogName||`App`}.lines`)===`true`,loaded:!1,noStatesByExportImport:!1,roleDialog:null,scrollBarWidth:16,selected:s,selectedNonObject:this.localStorage.getItem(`${e.dialogName||`App`}.selectedNonObject`)||``,showAliasEditor:``,showAllExportOptions:!1,showContextMenu:null,showDescription:this.localStorage.getItem(`${e.dialogName||`App`}.desc`)!==`false`,showExportDialog:!1,showImportDialog:!1,showImportMenu:null,showRenameDialog:null,statesView:p,toast:``,tooltipInfo:null,viewFileDialog:``},this.texts={name:e.t(`ra_Name`),categories:e.t(`ra_Categories`),value:e.t(`ra_tooltip_value`),ack:e.t(`ra_tooltip_ack`),ts:e.t(`ra_tooltip_ts`),lc:e.t(`ra_tooltip_lc`),from:e.t(`ra_tooltip_from`),user:e.t(`ra_tooltip_user`),c:e.t(`ra_tooltip_comment`),quality:e.t(`ra_tooltip_quality`),editObject:e.t(`ra_tooltip_editObject`),deleteObject:e.t(`ra_tooltip_deleteObject`),customConfig:e.t(`ra_tooltip_customConfig`),copyState:e.t(`ra_tooltip_copyState`),editState:e.t(`ra_tooltip_editState`),ctrlForLink:e.t(`ra_tooltip_ctrlForLink`),close:e.t(`ra_Close`),filter_id:e.t(`ra_filter_id`),filter_name:e.t(`ra_filter_name`),filter_type:e.t(`ra_filter_type`),filter_role:e.t(`ra_filter_role`),filter_room:e.t(`ra_filter_room`),filter_func:e.t(`ra_filter_func`),filter_custom:e.t(`ra_filter_customs`),filterCustomsWithout:e.t(`ra_filter_customs_without`),objectChangedByUser:e.t(`ra_object_changed_by_user`),objectChangedBy:e.t(`ra_object_changed_by`),objectChangedFrom:e.t(`ra_state_changed_from`),stateChangedBy:e.t(`ra_state_changed_by`),stateChangedFrom:e.t(`ra_state_changed_from`),ownerGroup:e.t(`ra_Owner group`),ownerUser:e.t(`ra_Owner user`),showAll:e.t(`ra_show_all`),deviceError:e.t(`ra_Error`),deviceDisconnected:e.t(`ra_Disconnected`),deviceConnected:e.t(`ra_Connected`),aclOwner_read_object:e.t(`ra_aclOwner_read_object`),aclOwner_read_state:e.t(`ra_aclOwner_read_state`),aclOwner_write_object:e.t(`ra_aclOwner_write_object`),aclOwner_write_state:e.t(`ra_aclOwner_write_state`),aclGroup_read_object:e.t(`ra_aclGroup_read_object`),aclGroup_read_state:e.t(`ra_aclGroup_read_state`),aclGroup_write_object:e.t(`ra_aclGroup_write_object`),aclGroup_write_state:e.t(`ra_aclGroup_write_state`),aclEveryone_read_object:e.t(`ra_aclEveryone_read_object`),aclEveryone_read_state:e.t(`ra_aclEveryone_read_state`),aclEveryone_write_object:e.t(`ra_aclEveryone_write_object`),aclEveryone_write_state:e.t(`ra_aclEveryone_write_state`),create:e.t(`ra_Create`),createBooleanState:e.t(`ra_create_boolean_state`),createNumberState:e.t(`ra_create_number_state`),createStringState:e.t(`ra_create_string_state`),createState:e.t(`ra_create_state`),createChannel:e.t(`ra_create_channel`),createDevice:e.t(`ra_create_device`),createFolder:e.t(`ra_Create folder`)},this.levelPadding=e.levelPadding||sK;let m=this.localStorage.getItem(`${this.props.dialogName||`App`}.table`);if(m)try{let e=JSON.parse(m),t=this.props.width||`lg`;this.storedWidths=JSON.parse(JSON.stringify(_K[t])),Object.keys(e).forEach(n=>{n===`id`?_K[t].idWidth=e.id:n===`nameHeader`?_K[t].widths.name=e[n]:_K[t].widths[n]!==void 0&&(_K[t].widths[n]=e[n])}),this.customWidth=!0}catch{}this.calculateColumnsVisibility()}async loadAllObjects(e){let t=this.props;try{await new Promise(e=>{this.setState({updating:!0},()=>e())});let n=(t.objectsWorker?await t.objectsWorker.getObjects(e):await t.socket.getObjects(e,!0))||{};if(t.types&&Ss.isWeb())for(let e=0;e<t.types.length;e++){if(t.types[e]===`state`||t.types[e]===`channel`||t.types[e]===`device`||t.types[e]===`enum`)continue;let r=await t.socket.getObjectViewSystem(t.types[e]);Object.assign(n||{},r)}if(this.systemConfig||=n?.[`system.config`]||await t.socket.getObject(`system.config`),this.systemConfig.common||={},this.systemConfig.common.defaultNewAcl||={object:0,state:0,file:0,owner:`system.user.admin`,ownerGroup:`system.group.administrator`},this.systemConfig.common.defaultNewAcl.owner||=`system.user.admin`,this.systemConfig.common.defaultNewAcl.ownerGroup||=`system.group.administrator`,typeof this.systemConfig.common.defaultNewAcl.state!=`number`&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof this.systemConfig.common.defaultNewAcl.object!=`number`&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof t.filterFunc==`function`){this.objects={};let e=t.filterFunc;Object.keys(n).forEach(t=>{try{if(e(n[t]))this.objects[t]=n[t];else{let e=n[t]&&n[t].type;e&&(e===`channel`||e===`device`||e===`folder`||e===`adapter`||e===`instance`)&&(this.objects[t]=n[t])}}catch(e){console.log(`Error by filtering of "${t}": ${e}`)}})}else if(t.types){this.objects={};let e=t.types;Object.keys(n).forEach(t=>{let r=n[t]?.type;r&&(r===`channel`||r===`device`||r===`enum`||r===`folder`||r===`adapter`||r===`instance`||e.includes(r))&&(this.objects[t]=n[t])})}else this.objects=n;t.setObjectsReference&&t.setObjectsReference(this.objects),this.defaultHistory=this.systemConfig.common.defaultHistory,this.defaultHistory&&t.socket.getState(`system.adapter.${this.defaultHistory}.alive`).then(e=>{e?.val||(this.defaultHistory=``)}).catch(e=>window.alert(`Cannot get state: ${e}`));let r=await this.getAdditionalColumns();this.calculateColumnsVisibility(null,null,r);let{info:i,root:a}=XG(this.objects,{imagePrefix:t.imagePrefix,root:t.root,lang:t.lang,themeType:t.themeType});this.root=a,this.info=i;let o=this.state.selected?.length&&ZG(this.root,this.state.selected[0]);o&&!GG(o,this.state.filter,t.lang,this.objects,void 0,void 0,t.customFilter,t.types)?this.setState({filter:{...yK},columnsForAdmin:r},()=>{this.doFilter(),this.setState({loaded:!0,updating:!1},()=>this.expandAllSelected(()=>{this.onAfterSelect(),this.applyInitialNavigateTo()}))}):(this.doFilter(),this.setState({loaded:!0,updating:!1,columnsForAdmin:r},()=>this.expandAllSelected(()=>{this.onAfterSelect(),this.applyInitialNavigateTo()})))}catch(e){this.showError(e)}}expandAllSelected(e){let t=[...this.state.expanded],n=!1;this.state.selected.forEach(e=>{let r=e.split(`.`),i=[];for(let e=0;e<r.length-1;e++)i.push(r[e]),t.includes(i.join(`.`))||(t.push(i.join(`.`)),n=!0)}),n?(t.sort(),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t},e)):e&&e()}onAfterSelect(e){if(this.state.selected?.length&&this.state.selected[0]){this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,this.state.selected[0]),this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=``);let t=this.findItem(this.state.selected[0]);if(t?.data&&!t.data.visible&&!t.data.hasVisibleChildren&&this.clearFilter(),this.state.selected.length===1&&this.objects[this.state.selected[0]]){let t=X.getObjectName(this.objects,this.state.selected[0],null,{language:this.props.lang});this.props.onSelect?.(this.state.selected,t,e)}else(this.state.selected.length===1&&this.props.allowNonObjects||!this.props.allowNonObjects||!this.state.selected.find(e=>!this.objects[e]))&&this.props.onSelect?.(this.state.selected,null,e)}else this.localStorage.removeItem(`${this.props.dialogName||`App`}.objectSelected`),this.state.selected.length?this.setState({selected:[]},()=>{this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=``),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],``))}):this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=``),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],``))}static getDerivedStateFromProps(e,t){let n={},r=!1;return e.expertMode!==void 0&&e.expertMode!==t.filter.expertMode&&(r=!0,n.filter={...t.filter},n.filter.expertMode=e.expertMode),r?n:null}async componentDidMount(){await this.loadAllObjects(!vK),this.props.objectsWorker?this.props.objectsWorker.registerHandler(this.onObjectChangeFromWorker):await this.props.socket.subscribeObject(`*`,this.onObjectChange),vK=!0,window.addEventListener(`contextmenu`,this.onContextMenu,!0),window.addEventListener(`keydown`,this.onKeyPress,!0),window.addEventListener(`keyup`,this.onKeyPress,!0),this.props.onAllLoaded&&setTimeout(()=>{this.props.onAllLoaded?.()},100)}onKeyPress=e=>{e.type===`keydown`&&e.ctrlKey&&!this.ctrlPressed?(this.ctrlPressed=!0,this.tableRef.current&&(this.tableRef.current.className=`highlight-link`)):e.type===`keyup`&&!e.ctrlKey&&this.ctrlPressed&&(this.ctrlPressed=!1,this.tableRef.current&&(this.tableRef.current.className=``))};componentWillUnmount(){window.removeEventListener(`contextmenu`,this.onContextMenu,!0),window.removeEventListener(`keydown`,this.onKeyPress,!0),window.removeEventListener(`keyup`,this.onKeyPress,!0),this.props.objectsWorker?this.props.objectsWorker.unregisterHandler(this.onObjectChangeFromWorker,!0):this.props.socket.unsubscribeObject(`*`,this.onObjectChange).catch(e=>console.error(`Cannot unsubscribe *: ${e}`)),this.subscribes.forEach(e=>{this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.objects={}}showDeleteDialog(e){let{id:t,obj:n,item:r}=e,i=Object.keys(this.objects);i.sort();let a=0,o=`${t}.`;for(let e=0;e<i.length;e++)if(i[e].startsWith(o))a++;else if(i[e]>o)break;this.props.onObjectDelete?.(t,!!r.children?.length,!n.common?.dontDelete,a+1)}onContextMenu=e=>{this.contextMenu&&Date.now()-this.contextMenu.ts<2e3?(e.preventDefault(),this.setState({showContextMenu:{item:this.contextMenu.item,position:{left:e.clientX+2,top:e.clientY-6}}})):this.state.showContextMenu&&(e.preventDefault(),this.setState({showContextMenu:null})),this.contextMenu=null};refreshComponent(){this.subscribes.forEach(e=>{this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.loadAllObjects(!0).then(()=>console.log(`updated!`)).catch(e=>this.showError(e))}renderErrorDialog(){return this.state.error?R.createElement(rC,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.setState({error:``}),"aria-labelledby":`error-dialog-title`,"aria-describedby":`error-dialog-description`},R.createElement(bC,{id:`alert-dialog-title`},this.props.t(`ra_Error`)),R.createElement(pC,null,R.createElement(_C,{id:`alert-dialog-description`},this.state.error)),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.setState({error:``}),color:`primary`,autoFocus:!0,startIcon:R.createElement(EO,null)},this.props.t(`ra_Ok`)))):null}showError(e){this.setState({error:typeof e==`object`?e&&typeof e.toString==`function`?e.toString():JSON.stringify(e):e})}onSelect(e,t,n){if(this.localStorage.setItem(`${this.props.dialogName||`App`}.focused`,e),!this.props.multiSelect)this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))?(this.localStorage.removeItem(`${this.props.dialogName||`App`}.selectedNonObject`),this.state.selected[0]===e?t&&this.props.onSelect&&this.onAfterSelect(t):this.setState({selected:[e],selectedNonObject:``,focused:e},()=>{this.onAfterSelect(t),n&&n()})):(this.localStorage.setItem(`${this.props.dialogName||`App`}.selectedNonObject`,e),this.setState({selected:[],selectedNonObject:e,focused:e},()=>{this.onAfterSelect(),n&&n()}));else if(this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))){this.localStorage.removeItem(`${this.props.dialogName||`App`}.selectedNonObject`);let r=[...this.state.selected],i=r.indexOf(e);i===-1?(r.push(e),r.sort()):t||r.splice(i,1),this.setState({selected:r,selectedNonObject:``,focused:e},()=>{this.onAfterSelect(t),n&&n()})}}_renderDefinedList(e){let t=[...this.possibleCols];if(t.unshift(`id`),this.props.columns&&!this.props.columns.includes(`buttons`)){let e=t.indexOf(`buttons`);e!==-1&&t.splice(e,1)}return t.filter(t=>e&&(t===`val`||t===`buttons`)||!e&&t!==`val`&&t!==`buttons`).map(e=>R.createElement(Uw,{onClick:()=>{if(!this.state.columnsAuto&&e!==`id`){let t=[...this.state.columns||[]],n=t.indexOf(e);n===-1?(t.push(e),t.sort()):t.splice(n,1),this.localStorage.setItem(`${this.props.dialogName||`App`}.columns`,JSON.stringify(t)),this.calculateColumnsVisibility(null,t),this.setState({columns:t})}},key:e},R.createElement(dS,{edge:`start`,disabled:e===`id`||this.state.columnsAuto,checked:e===`id`||!!(this.state.columnsAuto?this.visibleCols.includes(e):this.state.columns?.includes(e)),disableRipple:!0}),R.createElement(cT,{primary:this.texts[`filter_${e}`]||this.props.t(`ra_${e}`)})))}renderColumnsSelectorDialog(){return this.state.columnsSelectorShow?R.createElement(rC,{onClose:()=>this.setState({columnsSelectorShow:!1}),open:!0,sx:{"& .MuiPaper-root":X.getStyle(this.props.theme,$.dialogColumns,$[`transparent_${this.state.columnsDialogTransparent}`])}},R.createElement(bC,{sx:$.fontSizeTitle},this.props.t(`ra_Configure`)),R.createElement(pC,{sx:$.fontSizeTitle},R.createElement(BC,{style:$.switchColumnAuto,control:R.createElement(XE,{checked:this.state.foldersFirst,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.foldersFirst`,this.state.foldersFirst?`false`:`true`),this.setState({foldersFirst:!this.state.foldersFirst})}}),label:this.props.t(`ra_Folders always first`)}),R.createElement(BC,{style:$.switchColumnAuto,control:R.createElement(XE,{checked:this.state.linesEnabled,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.lines`,this.state.linesEnabled?`false`:`true`),this.setState({linesEnabled:!this.state.linesEnabled})}}),label:this.props.t(`ra_Show lines between rows`)}),R.createElement(BC,{style:$.switchColumnAuto,control:R.createElement(XE,{checked:this.state.columnsAuto,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.columnsAuto`,this.state.columnsAuto?`false`:`true`),this.state.columnsAuto?this.state.columns?(this.calculateColumnsVisibility(!1),this.setState({columnsAuto:!1})):(this.calculateColumnsVisibility(!1,[...this.visibleCols]),this.setState({columnsAuto:!1,columns:[...this.visibleCols]})):(this.calculateColumnsVisibility(!0),this.setState({columnsAuto:!0}))}}),label:this.props.t(`ra_Auto (no custom columns)`)}),R.createElement(Iw,null,this._renderDefinedList(!1),this.state.columnsForAdmin&&Object.keys(this.state.columnsForAdmin).sort().map(e=>this.state.columnsForAdmin?.[e].map(t=>R.createElement(Uw,{onClick:()=>{if(!this.state.columnsAuto){let n=[...this.state.columns||[]],r=`_${e}_${t.path}`,i=n.indexOf(r);i===-1?(n.push(r),n.sort()):n.splice(i,1),this.calculateColumnsVisibility(null,n),this.localStorage.setItem(`${this.props.dialogName||`App`}.columns`,JSON.stringify(n)),this.setState({columns:n})}},key:`${e}_${t.name}`},R.createElement(rT,null,R.createElement(dS,{disabled:this.state.columnsAuto,edge:`start`,checked:!this.state.columnsAuto&&this.state.columns?.includes(`_${e}_${t.path}`),disableRipple:!0})),R.createElement(cT,{primary:`${t.name} (${e})`})))),this._renderDefinedList(!0))),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.setState({columnsSelectorShow:!1}),color:`primary`,startIcon:R.createElement(DO,null)},this.texts.close))):null}async getAdditionalColumns(){try{let e=await this.props.socket.getAdapters(),t=null;return e.forEach(e=>t=this.parseObjectForAdmins(t,e)),t}catch(e){return console.error(`Cannot get adapters: ${e}`),null}}checkUnsubscribes(){for(let e=this.subscribes.length-1;e>=0;e--)this.recordStates.includes(this.subscribes[e])||this.unsubscribe(this.subscribes[e]);this.recordStates=[]}findItem(e,t,n,r){if(t||=e.split(`.`),n||=this.root,!n||!t.length)return null;if(r=(r?`${r}.`:``)+t.shift(),n.children){let i=n.children.find(e=>e.data.id===r);if(i){if(i.data.id===e)return i;if(t.length)return this.findItem(e,t,i,r)}else return null}return null}onStateChange=(e,t)=>{if(this.states[e]){let t=this.findItem(e);t?.data.state&&(t.data.state=void 0)}t?this.states[e]=t:delete this.states[e],this.pausedSubscribes?this.statesUpdateTimer&&=(clearTimeout(this.statesUpdateTimer),null):this.statesUpdateTimer||=setTimeout(()=>{this.statesUpdateTimer=null,this.forceUpdate()},300)};parseObjectForAdmins(e,t){if(t.common?.adminColumns&&t.common.name){let n=t.common.adminColumns,r;n&&typeof n!=`object`?r=[n]:n&&(r=n);let i;i=n?r?.map(e=>{if(typeof e!=`object`)return{path:e,name:e.split(`.`).pop()};let n=e;return n.objTypes&&typeof n.objTypes!=`object`?n.objTypes=[n.objTypes]:n.objTypes||=void 0,!n.name&&n.path?{path:n.path,name:n.path.split(`.`).pop(),width:n.width,edit:!!n.edit,type:n.type,objTypes:n.objTypes}:n.path?{path:n.path,name:UG(n.name||``,this.props.lang),width:n.width,edit:!!n.edit,type:n.type,objTypes:n.objTypes}:(console.warn(`Admin columns for ${t._id} ignored, because path not found`),null)}).filter(e=>e):null,i&&i.length&&(e||={},e[t.common.name]=i.sort((e,t)=>e.path>t.path?-1:+(e.path<t.path)))}else t.common&&t.common.name&&e&&e[t.common.name]&&delete e[t.common.name];return e}onObjectChangeFromWorker=e=>{if(Array.isArray(e)){let t=null;e.forEach(e=>{let{newInnerState:n,filtered:r}=this.processOnObjectChangeElement(e.id,e.obj);r||(n&&t?Object.assign(t,n):t=n)}),t&&this.setState(t),this.afterObjectUpdated()}};onObjectChange=(e,t)=>{let{newInnerState:n,filtered:r}=this.processOnObjectChangeElement(e,t);r||(n&&this.setState(n),this.afterObjectUpdated())};afterObjectUpdated(){!this.objectsUpdateTimer&&this.objects&&(this.objectsUpdateTimer=setTimeout(()=>{this.objectsUpdateTimer=null;let{info:e,root:t}=XG(this.objects,{imagePrefix:this.props.imagePrefix,root:this.props.root,lang:this.props.lang,themeType:this.props.themeType});this.root=t,this.info=e,this.pausedSubscribes||this.doFilter()},500))}updateAliases(e){if(!this.objects||!this.info?.aliasesMap||!e?.startsWith(`alias.`))return;let t=Object.keys(this.objects).filter(e=>e.startsWith(`alias.0`));this.info.aliasesMap={};for(let e of t){let t=this.objects[e];if(t?.common?.alias?.id)if(typeof t.common.alias.id==`string`){let n=t.common.alias.id;this.info.aliasesMap[n]?this.info.aliasesMap[n].includes(e)||this.info.aliasesMap[n].push(e):this.info.aliasesMap[n]=[e]}else{let n=t.common.alias.id.read;n&&(this.info.aliasesMap[n]?this.info.aliasesMap[n].includes(e)||this.info.aliasesMap[n].push(e):this.info.aliasesMap[n]=[e]);let r=t.common.alias.id.write;r&&(this.info.aliasesMap[r]?this.info.aliasesMap[r].includes(e)||this.info.aliasesMap[r].push(e):this.info.aliasesMap[r]=[e])}}}processOnObjectChangeElement(e,t){let n=t?.type;if(t&&typeof this.props.filterFunc==`function`&&!this.props.filterFunc(t)&&n!==`channel`&&n!==`device`&&n!==`folder`&&n!==`adapter`&&n!==`instance`)return{newInnerState:null,filtered:!0};let r=null;if(e.startsWith(`system.adapter.`)&&t?.type===`adapter`){let e=JSON.parse(JSON.stringify(this.state.columnsForAdmin));this.parseObjectForAdmins(e,t),JSON.stringify(this.state.columnsForAdmin)!==JSON.stringify(e)&&(r={columnsForAdmin:e})}return this.objects||={},t?this.objects[e]=t:this.objects[e]&&delete this.objects[e],this.updateAliases(e),{newInnerState:r,filtered:!1}}subscribe(e){this.subscribes.includes(e)||(this.subscribes.push(e),this.pausedSubscribes||this.props.socket.subscribeState(e,this.onStateChange).catch(t=>console.error(`Cannot subscribe on state ${e}: ${t}`)))}unsubscribe(e){let t=this.subscribes.indexOf(e);t!==-1&&(this.subscribes.splice(t,1),this.states[e]&&delete this.states[e],this.props.socket.unsubscribeState(e,this.onStateChange),this.pausedSubscribes&&console.warn(`Unsubscribe during pause?`))}pauseSubscribe(e){!this.pausedSubscribes&&e?(this.pausedSubscribes=!0,this.subscribes.forEach(e=>this.props.socket.unsubscribeState(e,this.onStateChange))):this.pausedSubscribes&&!e&&(this.pausedSubscribes=!1,this.subscribes.forEach(e=>this.props.socket.subscribeState(e,this.onStateChange)))}clearFilter(){JSON.stringify(this.state.filter)!==JSON.stringify(yK)&&this.setState({filter:{...yK},filterKey:this.state.filterKey+1},()=>{this.doFilter(),this.props.onFilterChanged?.({...yK})})}isFilterEmpty(){return!!this.state.filter.id||!!this.state.filter.name||!!this.state.filter.room?.length||!!this.state.filter.func?.length||!!this.state.filter.role?.length||!!this.state.filter.type?.length||!!this.state.filter.custom?.length}getFilterInput(e){return R.createElement(VG,{key:`${e}_${this.state.filterKey}`,styles:this.styles.filterInput,name:e,texts:this.texts,t:this.props.t,initialValue:this.state.filter[e],onChange:(e,t)=>{let n={...this.state.filter};t===void 0?delete n[e]:n[e]=t,this.setState({filter:n},()=>{this.doFilter(),this.props.onFilterChanged?.(n)})}})}getFilterSelect(e,t){return R.createElement(BG,{key:`${e}_${this.state.filterKey}`,name:e,texts:this.texts,initialValue:this.state.filter[e]||[],values:t||[],onChange:(e,t)=>{let n={...this.state.filter};t===void 0?delete n[e]:n[e]=t,this.setState({filter:n},()=>{this.doFilter(),this.props.onFilterChanged?.(n)})}})}getFilterSelectRole(){return this.getFilterSelect(`role`,this.info.roles.map(e=>e.role))}getFilterSelectRoom(){let e=this.info.roomEnums.map(e=>({name:UG(this.objects[e]?.common?.name,this.props.lang)||e.split(`.`).pop(),value:e,icon:R.createElement(MW,{src:this.objects[e]?.common?.icon||``,style:$.selectIcon})}));return this.getFilterSelect(`room`,e)}getFilterSelectFunction(){let e=this.info.funcEnums.map(e=>({name:UG(this.objects[e]?.common?.name,this.props.lang)||e.split(`.`).pop(),value:e,icon:R.createElement(MW,{src:this.objects[e]?.common?.icon||``,style:$.selectIcon})}));return this.getFilterSelect(`func`,e)}getFilterSelectType(){let e=this.info.types.map(e=>({name:e,value:e,icon:gK[e]||null}));return this.getFilterSelect(`type`,e)}getFilterSelectCustoms(){if(this.info.customs.length>1){let e=this.info.customs.map(e=>({name:e===`_`?this.texts.filterCustomsWithout:e,value:e,icon:e===`_`?null:R.createElement(MW,{src:WG(this.objects,e,this.props.lang,this.imagePrefix)||``,style:$.selectIcon})}));return this.getFilterSelect(`custom`,e)}return null}onExpandAll(e,t){let n=e||this.root;t||=[],n?.children?.forEach(e=>{e.data.sumVisibility&&(t.push(e.data.id),this.onExpandAll(e,t))}),n===this.root&&(t.sort(),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t}))}onCollapseAll(){this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify([])),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,`[]`),this.setState({expanded:[],depth:0,selected:[]},()=>this.onAfterSelect())}expandDepth(e,t,n){if(!this.root)throw Error(`No root`);e||=this.root,t>0&&e.children?.forEach(e=>{e.data.sumVisibility&&(HG(n,e.data.id)||(n.push(e.data.id),n.sort()),t-1>0&&this.expandDepth(e,t-1,n))})}static collapseDepth(e,t){return t.filter(t=>t.split(`.`).length<=e)}onExpandVisible(){if(this.state.depth<9){let e=this.state.depth+1,t=[...this.state.expanded];this.root&&this.expandDepth(this.root,e,t),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({depth:e,expanded:t})}}onStatesViewVisible(){let e=!this.state.statesView;this.localStorage.setItem(`${this.props.dialogName||`App`}.objectStatesView`,JSON.stringify(e)),this.setState({statesView:e})}onCollapseVisible(){if(this.state.depth>0){let t=this.state.depth-1,n=e.collapseDepth(t,this.state.expanded);this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(n)),this.setState({depth:t,expanded:n})}}getEnumsForId=e=>{let t=[];return this.info.enums.forEach(n=>{if(this.objects[n]?.common?.members?.includes(e)){let e={_id:this.objects[n]._id,common:JSON.parse(JSON.stringify(this.objects[n].common)),native:this.objects[n].native,type:`enum`};e.common&&(delete e.common.members,delete e.common.custom,delete e.common.mobile),t.push(e)}}),t.length?t:void 0};_createAllEnums=async(e,t)=>{for(let n=0;n<e.length;n++){let r=e[n],i,a;typeof r==`object`?(a=r,i=a._id):i=r;let o=this.objects[i];o?o.common?.members?.includes(t)||(o.common||={},o.type=`enum`,o.common.members||=[],o.common.members.push(t),o.common.members.sort(),await this.props.socket.setObject(i,o)):(o=a||{_id:i,common:{name:i.split(`.`).pop(),members:[]},native:{},type:`enum`},o.common||={},o.common.members=[t],o.type=`enum`,await this.props.socket.setObject(i,o))}};async loadObjects(e){if(e)for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!e[t])continue;let n=e[t],r=null,i,a;n?.common?.enums?(r=n.common.enums,delete n.common.enums):r=null,(n.val||n.val===0)&&(i=n.val,delete n.val),n.ack!==void 0&&(a=n.ack,delete n.ack);try{if(await this.props.socket.setObject(t,n),r&&await this._createAllEnums(r,n._id),n.type===`state`)if(i!=null)try{await this.props.socket.setState(n._id,i,a===void 0||a)}catch(e){window.alert(`Cannot set state "${n._id} with ${i}": ${e}`)}else try{let e=await this.props.socket.getState(n._id);if(!e||e.val===null)try{await this.props.socket.setState(n._id,!n.common||n.common.def===void 0?null:n.common.def,!0)}catch(e){window.alert(`Cannot set state "${n._id}": ${e}`)}}catch(e){window.alert(`Cannot read state "${n._id}": ${e}`)}}catch(e){window.alert(e)}}}_getSelectedIdsForExport(){if(this.state.selected.length||this.state.selectedNonObject){let e=[],t=Object.keys(this.objects);t.sort();let n=this.state.selected[0]||this.state.selectedNonObject,r=`${n}.`,i=r.length;for(let a=0;a<t.length;a++){let o=t[a];if((n===o||o.startsWith(r))&&e.push(o),o.substring(0,i)>r)break}return e}return[]}async _exportObjects(e){if(e.isAll){zG(`allObjects.json`,this.objects,e);return}if(!(this.state.selected.length||this.state.selectedNonObject)){window.alert(this.props.t(`ra_Save of objects-tree is not possible`));return}let t={},n=this.state.selected[0]||this.state.selectedNonObject,r=this._getSelectedIdsForExport();for(let n of r){if(t[n]=JSON.parse(JSON.stringify(this.objects[n])),t[n]?.type===`state`&&!e.noStatesByExportImport){let e=await this.props.socket.getState(n);e&&(t[n].val=e.val,t[n].ack=e.ack)}if(t[n].common){let e=this.getEnumsForId(n);e&&(t[n].common.enums=e)}}zG(`${n}.json`,t,e)}renderExportDialog(){return this.state.showExportDialog===!1?null:R.createElement(rC,{open:!0,maxWidth:`lg`},R.createElement(bC,null,this.props.t(`ra_Select type of export`)),R.createElement(pC,null,R.createElement(_C,null,this.state.filter.expertMode||this.state.showAllExportOptions?R.createElement(R.Fragment,null,this.props.t(`ra_You can export all objects or just the selected branch.`),R.createElement(`br`,null),this.props.t(`ra_Selected %s object(s)`,this.state.showExportDialog),R.createElement(`br`,null),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.noStatesByExportImport,onChange:e=>this.setState({noStatesByExportImport:e.target.checked})}),label:this.props.t(`ra_Do not export values of states`)}),R.createElement(`br`,null),this.props.t(`These options can reduce the size of the export file:`),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.beautifyJsonExport,onChange:e=>this.setState({beautifyJsonExport:e.target.checked})}),label:this.props.t(`Beautify JSON output`)}),R.createElement(`br`,null),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.excludeSystemRepositoriesFromExport,onChange:e=>this.setState({excludeSystemRepositoriesFromExport:e.target.checked})}),label:this.props.t(`Exclude system repositories from export JSON`)}),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.excludeTranslations,onChange:e=>this.setState({excludeTranslations:e.target.checked})}),label:this.props.t(`Exclude translations (except english) from export JSON`)})):null)),R.createElement(sC,null,this.state.filter.expertMode||this.state.showAllExportOptions?R.createElement(Vx,{color:`grey`,variant:`outlined`,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!0,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},R.createElement(`span`,{style:{marginRight:8}},this.props.t(`ra_All objects`)),`(`,Object.keys(this.objects).length,`)`):R.createElement(Vx,{color:`grey`,variant:`outlined`,startIcon:R.createElement(JU,null),onClick:()=>this.setState({showAllExportOptions:!0})},this.props.t(`ra_Advanced options`)),R.createElement(Vx,{color:`primary`,variant:`contained`,autoFocus:!0,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!1,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},R.createElement(`span`,{style:{marginRight:8}},this.props.t(`ra_Only selected`)),`(`,this.state.showExportDialog,`)`),R.createElement(Vx,{color:`grey`,variant:`contained`,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1}),startIcon:R.createElement(DO,null)},this.props.t(`ra_Cancel`))))}renderRenameDialog(){if(!this.state.showRenameDialog)return null;let e=this.props.objectMoveRenameDialog;return R.createElement(e,{expertMode:!!this.props.expertMode,onClose:()=>this.setState({showRenameDialog:null}),id:this.state.showRenameDialog.id,childrenIds:this.state.showRenameDialog.childrenIds,theme:this.props.theme,socket:this.props.socket,t:this.props.t,objectType:this.objects[this.state.showRenameDialog.id]?.type})}async parseJsonFile(e){try{let t=JSON.parse(e),n=Object.keys(t).length,r=t._id;if(r===void 0&&n)await this.loadObjects(t),window.alert(this.props.t(`ra_%s object(s) processed`,n));else{if(!r)return window.alert(this.props.t(`ra_Invalid structure`));try{let e,n,r;if(t.common.enums&&(e=t.common.enums,delete t.common.enums),t.val&&(n=t.val,delete t.val),t.ack!==void 0&&(r=t.ack,delete t.ack),await this.props.socket.setObject(t._id,t),t.type===`state`)if(n!=null)await this.props.socket.setState(t._id,n,r===void 0||r);else{let e=await this.props.socket.getState(t._id);(!e||e.val===null||e.val===void 0)&&await this.props.socket.setState(t._id,t.common.def===void 0?null:t.common.def,!0)}e&&await this._createAllEnums(e,t._id),window.alert(this.props.t(`ra_%s was imported`,t._id))}catch(e){window.alert(e)}}}catch(e){window.alert(e)}}handleJsonUpload(e){let t=e.target,n=t.files?.length&&t.files[0];if(n){let e=new FileReader;e.onload=e=>{this.parseJsonFile(e.target?.result).catch(e=>console.log(`Cannot parse file: ${e}`))},e.readAsText(n)}else window.alert(this.props.t(`ra_Failed to open JSON File`))}toolTipObjectCreating=()=>{let{t:e}=this.props,t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:2},e(`ra_Folder → State`)),R.createElement(`div`,{key:3},e(`ra_Folder → Channel → State`)),R.createElement(`div`,{key:4},e(`ra_Folder → Device → Channel → State`)),R.createElement(`div`,{key:5},e(`ra_Device → Channel → State`)),R.createElement(`div`,{key:6},e(`ra_Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];if(this.state.selected.length||this.state.selectedNonObject){let n=this.state.selected[0]||this.state.selectedNonObject;if(!(n.split(`.`).length<2||this.objects[n]&&this.objects[n]?.type===`state`))if(this.state.filter.expertMode)switch(this.objects[n]?.type){case`device`:t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:5},e(`ra_Device → Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];break;case`folder`:t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:2},e(`ra_Folder → State`)),R.createElement(`div`,{key:3},e(`ra_Folder → Channel → State`)),R.createElement(`div`,{key:4},e(`ra_Folder → Device → Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];break;case`channel`:t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:1},e(`ra_Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];break;default:break}else(n.startsWith(`alias.0`)||n.startsWith(`0_userdata`))&&(t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:2},e(`ra_Folder → State`)),R.createElement(`div`,{key:3},e(`ra_Folder → Channel → State`)),R.createElement(`div`,{key:4},e(`ra_Folder → Device → Channel → State`)),R.createElement(`div`,{key:5},e(`ra_Device → Channel → State`)),R.createElement(`div`,{key:6},e(`ra_Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:7},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:8},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))])}return t.length?t:e(`ra_Add new child object to selected parent`)};onOpenFile(){let e=document.createElement(`input`);e.setAttribute(`type`,`file`),e.setAttribute(`id`,`files`),e.setAttribute(`opacity`,`0`),e.addEventListener(`change`,e=>this.handleJsonUpload(e),!1),e.click()}renderInputJsonDialog(){if(!this.state.showImportDialog)return null;let e=this.props.objectBrowserInsertJsonObjects;return R.createElement(e,{onClose:e=>{this.setState({showImportDialog:!1}),e&&this.parseJsonFile(e)},themeName:this.props.themeName,themeType:this.props.themeType,t:this.props.t})}getToolbar(){let e=!1;if(this.state.selected.length||this.state.selectedNonObject){let t=this.state.selected[0]||this.state.selectedNonObject;t.split(`.`).length<2||this.objects[t]&&this.objects[t].type===`state`?e=!1:(this.state.filter.expertMode||t.startsWith(`alias.0`)||t.startsWith(`0_userdata`))&&(e=!0)}return R.createElement(`div`,{style:{display:`flex`,width:`100%`,alignItems:`center`,overflowX:`auto`}},R.createElement(`div`,{style:{display:`flex`,width:`100%`,alignItems:`center`}},R.createElement(HE,{title:this.props.t(`ra_Refresh tree`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(`div`,null,R.createElement(uv,{onClick:()=>this.refreshComponent(),disabled:this.state.updating,size:`large`},R.createElement(rk,null)))),this.props.showExpertButton&&!this.props.expertMode&&R.createElement(HE,{title:this.props.t(`ra_expertMode`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`expertMode`,color:this.state.filter.expertMode?`secondary`:`default`,onClick:()=>{let e={...this.state.filter};e.expertMode=!e.expertMode,this.localStorage.setItem(`${this.props.dialogName||`App`}.objectFilter`,JSON.stringify(e)),this.setState({filter:e})},size:`large`},R.createElement(JU,null))),!this.props.disableColumnSelector&&this.props.width!==`xs`&&R.createElement(HE,{title:this.props.t(`ra_Configure`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`columnSelector`,color:this.state.columnsAuto?`primary`:`default`,onClick:()=>this.setState({columnsSelectorShow:!0}),size:`large`},R.createElement(gk,null))),this.props.width!==`xs`&&this.state.expandAllVisible&&R.createElement(HE,{title:this.props.t(`ra_Expand all nodes`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`expandAll`,onClick:()=>this.onExpandAll(),size:`large`},R.createElement(XU,null))),R.createElement(HE,{title:this.props.t(`ra_Collapse all nodes`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`collapseAll`,onClick:()=>this.onCollapseAll(),size:`large`},R.createElement(YU,null))),this.props.width!==`xs`&&R.createElement(HE,{title:this.props.t(`ra_Expand one step node`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`expandVisible`,color:`primary`,onClick:()=>this.onExpandVisible(),size:`large`},R.createElement(hx,{badgeContent:this.state.depth,color:`secondary`,sx:e=>({badge:{right:3,top:3,border:`2px solid ${e.palette.background.paper}`,padding:`0 4px`}})},R.createElement(XU,null)))),this.props.width!==`xs`&&R.createElement(HE,{title:this.props.t(`ra_Collapse one step node`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`collapseVisible`,color:`primary`,onClick:()=>this.onCollapseVisible(),size:`large`},R.createElement(hx,{sx:e=>({badge:{right:3,top:3,border:`2px solid ${e.palette.background.paper}`,padding:`0 4px`}}),badgeContent:this.state.depth,color:`secondary`},R.createElement(YU,null)))),this.props.objectStatesView&&R.createElement(HE,{title:this.props.t(`ra_Toggle the states view`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>this.onStatesViewVisible(),size:`large`},R.createElement(QO,{color:this.state.statesView?`primary`:`inherit`}))),R.createElement(HE,{title:this.props.t(`ra_Show/Hide object descriptions`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.desc`,this.state.showDescription?`false`:`true`),this.setState({showDescription:!this.state.showDescription})},size:`large`},R.createElement(dk,{color:this.state.showDescription?`primary`:`inherit`}))),this.props.objectAddBoolean?R.createElement(HE,{title:this.toolTipObjectCreating(),slotProps:{popper:{sx:$.tooltip}}},R.createElement(`div`,null,R.createElement(uv,{disabled:!e,onClick:()=>this.setState({modalNewObj:{id:this.state.selected[0]||this.state.selectedNonObject}}),size:`large`},R.createElement(hO,null)))):null,this.props.objectImportExport&&R.createElement(HE,{title:this.props.t(`ra_Add objects tree from JSON file`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:e=>{this.props.objectBrowserInsertJsonObjects?this.setState({showImportMenu:e.currentTarget}):this.onOpenFile()},size:`large`},R.createElement(nk,null))),this.props.objectBrowserInsertJsonObjects?R.createElement(jT,{anchorEl:this.state.showImportMenu,open:!!this.state.showImportMenu,onClose:()=>this.setState({showImportMenu:null})},R.createElement(LT,{onClick:()=>this.setState({showImportMenu:null},()=>this.onOpenFile())},R.createElement(rT,null,R.createElement(fk,null)),R.createElement(cT,null,this.props.t(`ra_From file`))),R.createElement(LT,{onClick:()=>this.setState({showImportMenu:null,showImportDialog:!0})},R.createElement(rT,null,R.createElement(jO,null)),R.createElement(cT,null,this.props.t(`ra_From text`)))):null,this.props.objectImportExport&&(!!this.state.selected.length||this.state.selectedNonObject)&&R.createElement(HE,{title:this.props.t(`ra_Save objects tree as JSON file`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>this.setState({showExportDialog:this._getSelectedIdsForExport().length}),size:`large`},R.createElement(nk,{style:{transform:`rotate(180deg)`}})))),!!this.props.objectBrowserEditObject&&this.props.width!==`xs`&&R.createElement(`div`,{style:{display:`flex`,whiteSpace:`nowrap`}},`${this.props.t(`ra_Objects`)}: ${Object.keys(this.info.objects).length}, ${this.props.t(`ra_States`)}: ${Object.keys(this.info.objects).filter(e=>this.info.objects[e].type===`state`).length}`),this.props.objectEditBoolean&&R.createElement(HE,{title:this.props.t(`ra_Edit custom config`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>{let e=this.root?KG(this.root,`state`,this.objects):[];e.length?(this.pauseSubscribe(!0),e.length===1&&(this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,this.state.selected[0]),this.props.router?.doNavigate(null,`custom`,this.state.selected[0])),this.setState({customDialog:e,customDialogAll:!0})):this.setState({toast:this.props.t(`ra_please select object`)})},size:`large`},R.createElement(wO,null))))}toggleExpanded(e){let t=JSON.parse(JSON.stringify(this.state.expanded)),n=t.indexOf(e);n===-1?(t.push(e),t.sort()):t.splice(n,1),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t})}onCopy(e,t){e.stopPropagation(),e.preventDefault(),t&&(X.copyToClipboard(t),t.length<50?this.setState({toast:this.props.t(`ra_Copied %s`,t)}):this.setState({toast:this.props.t(`ra_Copied`)}))}renderTooltipAccessControl=e=>{if(!e)return null;let t=[{value:`0x400`,valueNum:1024,title:`read`,group:`Owner`},{value:`0x200`,valueNum:512,title:`write`,group:`Owner`},{value:`0x40`,valueNum:64,title:`read`,group:`Group`},{value:`0x20`,valueNum:32,title:`write`,group:`Group`},{value:`0x4`,valueNum:4,title:`read`,group:`Everyone`},{value:`0x2`,valueNum:2,title:`write`,group:`Everyone`}],n=[],r=r=>{let i=e[r];t.forEach((e,t)=>{i&e.valueNum&&n.push(R.createElement(`span`,{key:r+t},this.texts[`acl${e.group}_${e.title}_${r}`],`,`,R.createElement(`span`,{style:r===`object`?$.rightsObject:$.rightsState},e.value)))})};return n.push(R.createElement(`span`,{key:`group`},`${this.texts.ownerGroup}: ${(e.ownerGroup||``).replace(`system.group.`,``)}`)),n.push(R.createElement(`span`,{key:`owner`},`${this.texts.ownerUser}: ${(e.owner||``).replace(`system.user.`,``)}`)),r(`object`),e.state&&r(`state`),n.length?R.createElement(`span`,{style:$.tooltipAccessControl},n.map(e=>e)):null};renderColumnButtons(e,t){if(!t.data.obj)return this.props.onObjectDelete||this.props.objectEditOfAccessControl?R.createElement(`div`,{style:$.buttonDiv},this.state.filter.expertMode&&this.props.objectEditOfAccessControl?R.createElement(uv,{sx:{...$.cellButtonsButton,...$.cellButtonsEmptyButton,...$.cellButtonMinWidth},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:`large`},R.createElement(`div`,{style:{height:15}},`---`)):null,this.props.onObjectDelete&&t.children?.length?R.createElement(uv,{sx:{...$.cellButtonsButton,...$.cellButtonsButtonAlone},size:`small`,"aria-label":`delete`,title:this.texts.deleteObject,onClick:()=>{let n=Object.keys(this.objects);n.sort();let r=0,i=`${e}.`;for(let e=0;e<n.length;e++)if(n[e].startsWith(i))r++;else if(n[e]>i)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!t.children?.length,!1,r+1)}},R.createElement(PO,{style:$.cellButtonsButtonIcon})):null):null;t.data.aclTooltip=t.data.aclTooltip||this.renderTooltipAccessControl(t.data.obj.acl);let n=t.data.obj.acl?t.data.obj.type===`state`?t.data.obj.acl.state:t.data.obj.acl.object:0,r=t.data.obj.acl&&(t.data.obj.type===`state`?this.systemConfig?.common.defaultNewAcl.state:this.systemConfig?.common.defaultNewAcl.object),i=this.state.filter.expertMode||oK(t.data.id);return[this.state.filter.expertMode&&this.props.objectEditOfAccessControl?R.createElement(HE,{key:`acl`,title:t.data.aclTooltip,slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{sx:{...$.cellButtonsButton,...$.cellButtonMinWidth,opacity:1},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:`large`},R.createElement(`div`,{style:$.aclText},Number.isNaN(Number(n))?Number(r).toString(16):Number(n).toString(16)))):R.createElement(`div`,{key:`aclEmpty`,style:$.cellButtonMinWidth}),i?R.createElement(uv,{key:`edit`,sx:{marginRight:`2px`,...$.cellButtonsButton},size:`small`,"aria-label":`edit`,title:this.texts.editObject,onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,e),this.setState({editObjectDialog:e,editObjectAlias:!1})}},R.createElement(LO,{style:$.cellButtonsButtonIcon})):R.createElement(_x,{component:`div`,key:`editDisabled`,sx:$.cellButtonsButton}),this.props.onObjectDelete&&(t.children?.length||!t.data.obj.common?.dontDelete)?R.createElement(uv,{key:`delete`,sx:$.cellButtonsButton,size:`small`,"aria-label":`delete`,onClick:()=>{let n=Object.keys(this.objects);n.sort();let r=0,i=`${e}.`;for(let e=0;e<n.length;e++)if(n[e].startsWith(i))r++;else if(n[e]>i)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!t.children?.length,!t.data.obj?.common?.dontDelete,r)},title:this.texts.deleteObject},R.createElement(PO,{style:$.cellButtonsButtonIcon})):null,this.props.objectCustomDialog&&this.info.hasSomeCustoms&&t.data.obj.type===`state`&&t.data.obj.common?.type!==`file`?R.createElement(uv,{sx:{...$.cellButtonsButton,...t.data.hasCustoms?this.styles.cellButtonsButtonWithCustoms:$.cellButtonsButtonWithoutCustoms},key:`custom`,size:`small`,"aria-label":`config`,title:this.texts.customConfig,onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,e),this.pauseSubscribe(!0),this.props.router?.doNavigate(null,`customs`,e),this.setState({customDialog:[e],customDialogAll:!1})}},R.createElement(sk,{style:$.cellButtonsButtonIcon})):null]}readHistory(e){if(window.sparkline&&this.defaultHistory&&this.objects[e]?.common?.custom&&this.objects[e].common.custom[this.defaultHistory]){let t=new Date;t.setHours(t.getHours()-24),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0);let n=t.getTime();this.props.socket.getHistory(e,{instance:this.defaultHistory,start:n,end:Date.now(),step:36e5,from:!1,ack:!1,q:!1,addId:!1,aggregate:`minmax`}).then(t=>{let r=window.document.getElementsByClassName(`sparkline`);for(let i=0;i<r.length;i++)if(r[i].dataset.id===e){let e=rK(t,n);window.sparkline.sparkline(r[i],e);break}}).catch(e=>console.warn(`Cannot read history: ${e}`))}}getTooltipInfo(e,t){let n=this.objects[e],r=this.states[e],{valFull:i,fileViewer:a}=tK({state:r,obj:n,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,full:!0}),o=[];i?.forEach(e=>{e.t===this.texts.quality&&r.q?(o.push(R.createElement(`div`,{style:$.cellValueTooltipBoth,key:e.t},e.t,`:\xA0`,e.v)),e.nbr||o.push(R.createElement(`br`,{key:`${e.t}_br`}))):(o.push(R.createElement(`div`,{style:$.cellValueTooltipTitle,key:e.t},e.t,`:\xA0`)),o.push(R.createElement(`div`,{style:$.cellValueTooltipValue,key:`${e.t}_v`},e.v)),e.nbr||o.push(R.createElement(`br`,{key:`${e.t}_br`})))});let s=n?.common?.role||``;a===`image`?o.push(R.createElement(`img`,{style:$.cellValueTooltipImage,src:r.val,alt:e})):s===`url`||n.common.role===`url.self`||n.common.role===`url.blank`?o.unshift(R.createElement(`div`,{key:`ctrl`,style:{textDecoration:`underline`,fontWeight:`bold`}},this.texts.ctrlForLink)):this.defaultHistory&&n?.common?.custom?.[this.defaultHistory]&&o.push(R.createElement(`svg`,{key:`sparkline`,className:`sparkline`,"data-id":e,style:{fill:`#3d85de`},width:`200`,height:`30`,strokeWidth:`3`})),this.setState({tooltipInfo:{el:o,id:e}},()=>t&&t())}renderColumnValue(e,t,n){let r=t.data.obj;if(!r||!this.states)return null;if(r.common?.type===`file`)return R.createElement(_x,{component:`div`,sx:{...$.cellValueText,...$.cellValueFile}},`[file]`);if(!this.states[e])return r.type===`state`&&(this.recordStates.includes(e)||this.recordStates.push(e),this.states[e]={val:null},this.subscribe(e)),null;this.recordStates.includes(e)||this.recordStates.push(e);let i=this.states[e],a=t.data.state;if(!a){let{valText:e}=tK({state:i,obj:r,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma}),o=[];if(t.data.state={valTextRx:o},o.push(R.createElement(`span`,{className:`newValueBrowser-${this.props.themeType||`light`}`,key:`${e.v.toString()}valText`,style:{whiteSpace:`nowrap`,display:`inline-block`,overflow:`hidden`,textOverflow:`ellipsis`}},e.v.toString())),e.u&&o.push(R.createElement(`span`,{className:`newValueBrowser-${this.props.themeType||`light`}`,style:$.cellValueTextUnit,key:`${e.v.toString()}unit`},e.u)),e.s!==void 0&&o.push(R.createElement(`span`,{style:$.cellValueTextState,className:`newValueBrowser-${this.props.themeType||`light`}`,key:`${e.v.toString()}states`},`(`,e.s,`)`)),!n){let t=e.c===void 0?e.v||``:e.c;o.push(R.createElement(hG,{className:`copyButton`,style:this.styles.iconCopy,onClick:e=>this.onCopy(e,t),key:`cc`}))}a=t.data.state}a.style=nK({state:i,isExpertMode:this.state.filter.expertMode,isButton:t.data.button,nonAckColor:this.props.theme.palette.nonAck});let o=a.valTextRx;return this.state.filter.expertMode||(t.data.button?o=[R.createElement(PG,{key:`button`,style:{color:a.style.color,...$.cellValueButton}})]:t.data.switch&&(o=[R.createElement(XE,{key:`switch`,sx:{"& .MuiSwitch-thumb":{color:a.style.color},"& .MuiSwitch-track":{backgroundColor:this.states[e].val&&this.state.selected.includes(e)?this.props.themeType===`dark`?`#FFF !important`:`#111 !important`:void 0}},checked:!!this.states[e].val})])),R.createElement(HE,{key:`value`,title:this.state.tooltipInfo?.el,slotProps:{popper:{sx:$.cellValueTooltipBox},tooltip:{sx:$.cellValueTooltip}},onOpen:()=>this.getTooltipInfo(e,()=>this.readHistory(e)),onClose:()=>this.state.tooltipInfo?.id===e&&this.setState({tooltipInfo:null})},R.createElement(_x,{component:`div`,style:a.style,className:t.data.url?`iob-link`:void 0,sx:{...$.cellValueText,height:n?void 0:32,"& .admin-button:active":{transform:`translate(0, 2px)`}}},o))}_syncEnum(e,t,n,r){if(!t?.length){r&&r();return}let i=t.pop()||``,a=[];if(this.info.objects[i]?.common){if(this.info.objects[i].common.members?.length){let t=this.info.objects[i].common.members.indexOf(e);if(t!==-1&&!n.includes(i)){let e=JSON.parse(JSON.stringify(this.info.objects[i]));e.common.members.splice(t,1),a.push(this.props.socket.setObject(i,e).then(()=>this.info.objects[i]=e).catch(e=>this.showError(e)))}}if(n.includes(i)&&!this.info.objects[i].common.members?.includes(e)){let t=JSON.parse(JSON.stringify(this.info.objects[i]));t.common.members||=[],t.common.members.push(e),t.common.members.sort(),a.push(this.props.socket.setObject(i,t).then(()=>this.info.objects[i]=t).catch(e=>this.showError(e)))}}Promise.all(a).then(()=>{setTimeout(()=>this._syncEnum(e,t,n,r),0)})}syncEnum(e,t,n){let r=[...this.info[t===`func`?`funcEnums`:`roomEnums`]];return new Promise(t=>{this._syncEnum(e,r,n,()=>{t()})})}renderEnumDialog(){if(!this.state.enumDialog)return null;let e=this.state.enumDialog.type,t=this.state.enumDialog.item,n=this.state.enumDialogEnums,r=this.state.enumDialog.enumsOriginal,i=(e===`room`?this.info.roomEnums:this.info.funcEnums).map(e=>({name:UG(this.objects[e]?.common?.name||e.split(`.`).pop()||``,this.props.lang),value:e,icon:WG(this.objects,e,this.props.lang,this.imagePrefix)})).sort((e,t)=>e.name>t.name?1:-1);return i.forEach(e=>{e.icon&&typeof e.icon==`string`&&(e.icon=R.createElement(_x,{style:$.enumIconDiv},R.createElement(`img`,{src:e.icon,style:$.enumIcon,alt:e.name})))}),R.createElement(rC,{sx:{"& .MuiPaper-root":$.enumDialog},onClose:()=>this.setState({enumDialog:null}),"aria-labelledby":`enum-dialog-title`,open:!0},R.createElement(bC,{id:`enum-dialog-title`,style:{display:`flex`,justifyContent:`space-between`,width:`100%`,flexWrap:`nowrap`,gap:8,paddingRight:12}},e===`func`?this.props.t(`ra_Define functions`):this.props.t(`ra_Define rooms`),R.createElement(EC,{color:`primary`,disabled:r===JSON.stringify(n),size:`small`,onClick:()=>this.syncEnum(t.data.id,e,n).then(()=>this.setState({enumDialog:null,enumDialogEnums:null}))},R.createElement(EO,null))),R.createElement(Iw,{sx:{"&.MuiList-root":$.enumList}},i.map(e=>{let t,r,i;typeof e==`object`?(t=e.value,r=e.name,i=e.icon):(t=e,r=e);let a=`checkbox-list-label-${t}`;return R.createElement(Qw,{sx:$.headerCellSelectItem,key:t,onClick:()=>{let e=n.indexOf(t),r=JSON.parse(JSON.stringify(this.state.enumDialogEnums));e===-1?(r.push(t),r.sort()):r.splice(e,1),this.setState({enumDialogEnums:r})},secondaryAction:i},R.createElement(rT,{sx:{"&.MuiListItemIcon-root":$.enumCheckbox}},R.createElement(dS,{edge:`start`,checked:n.includes(t),tabIndex:-1,disableRipple:!0,slotProps:{input:{"aria-labelledby":a}}})),R.createElement(cT,{id:a},r))})))}renderEditRoleDialog(){if(!this.state.roleDialog||!this.props.objectBrowserEditRole)return null;if(this.state.roleDialog&&this.props.objectBrowserEditRole){let e=this.props.objectBrowserEditRole;return R.createElement(e,{key:`objectBrowserEditRole`,id:this.state.roleDialog,socket:this.props.socket,t:this.props.t,roleArray:this.info.roles,commonType:this.info.objects[this.state.roleDialog]?.common?.type,onClose:e=>{e&&this.state.roleDialog&&(this.info.objects[this.state.roleDialog]=e),this.setState({roleDialog:null})}})}return null}onColumnsEditCustomDialogClose(e){let t=this.customColumnDialog;if(e){let e=t.value;t.type===`boolean`?e=e===`true`||e===!0:t.type===`number`&&(e=parseFloat(e)),this.customColumnDialog=null,this.props.socket.getObject(this.state.columnsEditCustomDialog?.obj?._id||``).then(t=>{if(t&&aK(t,this.state.columnsEditCustomDialog?.it,e))return this.props.socket.setObject(t._id,t);throw Error(this.props.t(`ra_Cannot update attribute, because not found in the object`))}).then(()=>this.setState({columnsEditCustomDialog:null})).catch(e=>this.showError(e))}else this.customColumnDialog=null,this.setState({columnsEditCustomDialog:null})}renderColumnsEditCustomDialog(){if(!this.state.columnsEditCustomDialog)return null;if(!this.customColumnDialog){let e=iK(this.state.columnsEditCustomDialog.obj,this.state.columnsEditCustomDialog.it);this.customColumnDialog={type:this.state.columnsEditCustomDialog.it.type||typeof e,initValue:(e??``).toString(),value:(e??``).toString()}}return R.createElement(rC,{onClose:()=>this.setState({columnsEditCustomDialog:null}),maxWidth:`md`,"aria-labelledby":`custom-dialog-title`,open:!0},R.createElement(bC,{id:`custom-dialog-title`},`${this.props.t(`ra_Edit object field`)}: ${this.state.columnsEditCustomDialog.obj._id}`),R.createElement(pC,null,R.createElement(_C,{id:`alert-dialog-description`},this.customColumnDialog.type===`boolean`?R.createElement(BC,{control:R.createElement(dS,{onKeyUp:e=>e.key===`Enter`&&this.onColumnsEditCustomDialogClose(!0),defaultChecked:this.customColumnDialog.value===`true`,onChange:e=>{let t=this.customColumnDialog;t.value=e.target.checked.toString();let n=t.value!==t.initValue;n===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:n})}}),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`}):R.createElement(mO,{variant:`standard`,defaultValue:this.customColumnDialog.value,fullWidth:!0,onKeyUp:e=>e.key===`Enter`&&this.onColumnsEditCustomDialogClose(!0),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`,onChange:e=>{let t=this.customColumnDialog;t.value=e.target.value;let n=t.value!==t.initValue;n===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:n})},autoFocus:!0}))),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.onColumnsEditCustomDialogClose(!0),disabled:!this.state.customColumnDialogValueChanged,color:`primary`,startIcon:R.createElement(EO,null)},this.props.t(`ra_Update`)),R.createElement(Vx,{color:`grey`,variant:`contained`,onClick:()=>this.onColumnsEditCustomDialogClose(),startIcon:R.createElement(DO,null)},this.props.t(`ra_Cancel`))))}renderCustomValue(e,t,n){let r=iK(e,t);return r==null?null:t.edit&&!this.props.notEditable&&(!t.objTypes||t.objTypes.includes(e.type))?R.createElement(_x,{component:`div`,style:{...$.columnCustom,...$.columnCustomEditable,...$[`columnCustom_${t.align}`]},onClick:()=>this.setState({columnsEditCustomDialog:{item:n,it:t,obj:e},customColumnDialogValueChanged:!1})},r):R.createElement(_x,{component:`div`,style:{...$.columnCustom,...$[`columnCustom_${t.align}`]}},r)}renderAliasLink(e,t,n){let r=t||0,i=this.objects[this.info.aliasesMap[e][r]].common.alias.id;return i?R.createElement(_x,{component:`div`,onClick:t=>{t.stopPropagation(),t.preventDefault();let n=this.info.aliasesMap[e][r];this.info.aliasesMap[e].length>1&&this.setState({aliasMenu:``}),this.onSelect(n),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(n)),100)},sx:n||this.styles.aliasAlone},R.createElement(`span`,{className:`admin-browser-arrow`},typeof i==`string`||i.read===e&&i.write===e?`↔`:i.read===e?`→`:`←`),this.info.aliasesMap[e][r]):null}renderLeaf(e,t,n){let r=e.data.id;n.count++,t=t===void 0?this.state.expanded.includes(r):t;let i,a=e.data.obj,o=a?.type;i=e.children||o===`folder`||o===`device`||o===`channel`||o===`meta`?t?R.createElement(XU,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):R.createElement(YU,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):a&&a.common&&a.common.write===!1&&a.type===`state`?R.createElement(vG,{style:this.styles.cellIdIconDocument}):R.createElement(_G,{style:this.styles.cellIdIconDocument});let s=null;e.data.icon&&(s=typeof e.data.icon==`string`?e.data.icon.length<3?R.createElement(`span`,{className:`iconOwn`,style:$.cellIdIconOwn},e.data.icon):R.createElement(MW,{style:$.cellIdIconOwn,className:`iconOwn`,src:e.data.icon,alt:``}):e.data.icon);let c=a?.common,l=a?.type&&gK[a.type]||R.createElement(`div`,{className:`itemIcon`}),u=this.levelPadding*(e.data.level||0);if(e.data.lang!==this.props.lang){let{rooms:t,per:n}=QG(this.info,r,this.props.lang);e.data.rooms=t.join(`, `),e.data.per=n;let{funcs:i,pef:a}=eK(this.info,r,this.props.lang);e.data.funcs=i.join(`, `),e.data.pef=a,e.data.lang=this.props.lang}let d=this.props.multiSelect&&this.objects[r]&&(!this.props.types||this.props.types.includes(this.objects[r].type))?R.createElement(dS,{style:$.checkBox,checked:this.state.selected.includes(r)}):null,f=!this.props.notEditable&&o===`state`&&(this.state.filter.expertMode||c?.write!==!1);this.props.objectBrowserViewFile&&c?.type===`file`&&(f=!0);let p=!this.props.notEditable&&this.objects[r]&&(this.state.filter.expertMode||o===`state`||o===`channel`||o===`device`),m=this.state.statesView&&(o===`state`||o===`channel`||o===`device`),h=``,g=[];if(m&&(h=this.states[r]?.from,h===void 0?h=`&nbsp;`:(h=h?h.replace(/^system\.adapter\.|^system\./,``):``,g.push(`${this.texts.stateChangedFrom} ${h}`)),a?.user)){let e=a.user.replace(`system.user.`,``);h+=`/${e}`,g.push(`${this.texts.stateChangedBy} ${e}`)}a&&(a.from&&g.push(`${this.texts.objectChangedFrom} ${a.from.replace(/^system\.adapter\.|^system\./,``)}`),a.user&&g.push(`${this.texts.objectChangedBy} ${a.user.replace(/^system\.user\./,``)}`),a.ts&&g.push(`${this.texts.objectChangedByUser} ${X.formatDate(new Date(a.ts),this.props.dateFormat||this.systemConfig?.common.dateFormat||hK)}`));let _=!1,v=null;r.startsWith(`alias.`)&&c?.alias?.id?(_=typeof c.alias.id==`object`,v=_?R.createElement(`div`,{style:$.cellIdAliasReadWriteDiv},c.alias.id.read?R.createElement(_x,{component:`div`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.onSelect(c.alias.id.read),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(c.alias.id.read)),100)},sx:this.styles.aliasReadWrite},`←`,c.alias.id.read):null,c.alias.id.write?R.createElement(_x,{component:`div`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.onSelect(c.alias.id.write),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(c.alias.id.write)),100)},sx:this.styles.aliasReadWrite},`→`,c.alias.id.write):null):R.createElement(_x,{component:`div`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.onSelect(c.alias.id),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(c.alias.id)),100)},sx:this.styles.aliasAlone},`→`,c.alias.id)):this.info.aliasesMap[r]&&(v=this.info.aliasesMap[r].length>1?R.createElement(_x,{component:`div`,id:`alias_${r}`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.setState({aliasMenu:r})},sx:this.styles.aliasAlone},this.props.t(`ra_%s links from aliases`,this.info.aliasesMap[r].length)):this.renderAliasLink(r,0));let y=c?.color,b;if(y&&!this.state.selected.includes(r)){let e=this.props.themeName===`dark`?`#1f1f1f`:this.props.themeName===`blue`?`#222a2e`:`#FFFFFF`;X.colorDistance(y,e)<1e3&&(b=this.props.themeType===`dark`?`#9a9a9a`:`#565656`)}let x=!1;r===`0_userdata`?(y=DG(this.props.themeType),x=!0,b=!1):r===`alias`?(y=OG(this.props.themeType),x=!0,b=!1):r===`javascript`?(y=kG(this.props.themeType),x=!0,b=!1):r===`system`?(y=AG(this.props.themeType),x=!0,b=!1):r===`system.adapter`?(y=jG(this.props.themeType),b=!1):(!y||this.state.selected.includes(r))&&(y=`inherit`,b=!1);let S=[];if(c?.statusStates){let e={};Object.keys(c.statusStates).forEach(t=>{let n=c.statusStates[t];n.split(`.`).length<3&&(n=`${r}.${n}`),e[t]=n,this.states[n]?this.recordStates.includes(n)||this.recordStates.push(n):this.objects[n]?.type===`state`&&(this.recordStates.includes(n)||this.recordStates.push(n),this.states[n]={val:null},this.subscribe(n))});let t=!1;c.statusStates.errorId&&this.states[e.errorId]&&this.states[e.errorId].val&&(y=this.props.themeType===`dark`?lK:uK,b=!1,t=!0,S.push(R.createElement(RO,{key:`error`,style:this.styles.iconDeviceError}))),e.onlineId&&this.states[e.onlineId]?t?this.states[e.onlineId].val?S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected})):S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected})):this.states[e.onlineId].val?(y=this.props.themeType===`dark`?dK:fK,b=!1,S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected}))):(y=this.props.themeType===`dark`?pK:mK,b=!1,S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected}))):e.offlineId&&this.states[e.offlineId]&&(t?this.states[e.offlineId].val?S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected})):S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected})):this.states[e.offlineId].val?(y=this.props.themeType===`dark`?pK:mK,b=!1,S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected}))):(y=this.props.themeType===`dark`?dK:fK,b=!1,S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected}))))}let C=m?X.quality2text(this.states[r]?.q||0).join(`, `):null,w=e.data?.title||``,T=!1;if(this.state.showDescription){let t=JG(e.data,this.props.lang);t&&(w=[R.createElement(`div`,{key:`name`,style:$.cellNameDivDiv},w),R.createElement(`div`,{key:`desc`,style:$.cellDescription},t)],T=!!t)}let E=this.props.width===`xs`&&this.state.focused===r,D=R.createElement(rw,{container:!0,wrap:`nowrap`,direction:`row`,sx:$.cellId,style:{width:this.columnsVisibility.id,paddingLeft:u}},R.createElement(rw,{container:!0,alignItems:`center`},d,i),R.createElement(rw,{style:{...$.cellIdSpan,...b?this.styles.invertedBackground:void 0,color:y,fontWeight:x?`bold`:void 0}},R.createElement(HE,{title:YG(e.data,this.props.lang),slotProps:{popper:{sx:$.tooltip}}},R.createElement(`div`,null,e.data.name)),v,S),R.createElement(`div`,{style:{...$.grow,...b?this.styles.invertedBackgroundFlex:{}}}),R.createElement(rw,{container:!0,alignItems:`center`},s),this.props.width===`xs`?null:R.createElement(`div`,null,R.createElement(hG,{className:E?``:`copyButton`,style:$.cellCopyButton,onClick:e=>this.onCopy(e,r)}))),O=E&&w||this.columnsVisibility.name?R.createElement(_x,{component:`div`,sx:{...$.cellName,...T?$.cellNameWithDesc:void 0,width:this.props.width===`xs`?void 0:this.columnsVisibility.name,ml:E?0:`5px`}},w,!E&&e.data?.title?R.createElement(_x,{style:{color:y}},R.createElement(hG,{className:`copyButton`,style:$.cellCopyButton,onClick:t=>this.onCopy(t,e.data?.title)})):null):null,k;k=this.state.statesView?[E&&m&&this.states[r]?.from||this.columnsVisibility.changedFrom?{el:R.createElement(`div`,{key:`from`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.changedFrom},title:g.join(`
650
- `)},m&&this.states[r]?.from?h:null),type:`from`}:null,E&&C||this.columnsVisibility.qualityCode?{el:R.createElement(`div`,{key:`q`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.qualityCode},title:C||``},C),type:`quality`}:null,E&&m&&this.states[r]?.ts||this.columnsVisibility.timestamp?{el:R.createElement(`div`,{key:`ts`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.timestamp}},m&&this.states[r]?.ts?X.formatDate(new Date(this.states[r].ts),this.props.dateFormat||this.systemConfig?.common.dateFormat||hK):null),type:`ts`}:null,E&&m&&this.states[r]?.lc||this.columnsVisibility.lastChange?{el:R.createElement(`div`,{key:`lc`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.lastChange}},m&&this.states[r]?.lc?X.formatDate(new Date(this.states[r].lc),this.props.dateFormat||this.systemConfig?.common.dateFormat||hK):null),type:`lc`}:null]:[E&&a?.type||this.columnsVisibility.type?{el:R.createElement(`div`,{key:`type`,style:{...$.cellType,width:this.props.width===`xs`?void 0:this.columnsVisibility.type}},l,`\xA0`,a?.type),type:`filter_type`}:null,E&&c||this.columnsVisibility.role?{el:R.createElement(`div`,{key:`role`,style:{...$.cellRole,width:this.props.width===`xs`?`100%`:this.columnsVisibility.role,cursor:this.state.filter.expertMode&&p&&this.props.objectBrowserEditRole?`text`:`default`},onClick:!E&&this.state.filter.expertMode&&p&&this.props.objectBrowserEditRole?()=>this.setState({roleDialog:e.data.id}):void 0},c?.role),type:`filter_role`,onClick:E&&this.state.filter.expertMode&&p&&this.props.objectBrowserEditRole?()=>this.setState({roleDialog:e.data.id}):void 0}:null,E&&c||this.columnsVisibility.room?{el:R.createElement(`div`,{key:`room`,style:{...$.cellRoom,...e.data.per?$.cellEnumParent:{},width:this.props.width===`xs`?`100%`:this.columnsVisibility.room,cursor:p?`text`:`default`},onClick:!E&&p?()=>{let t=$G(this.info,e.data.id,`roomEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`room`,enumsOriginal:JSON.stringify(t)}})}:void 0},e.data.rooms),type:`filter_room`,onClick:E&&p?()=>{let t=$G(this.info,e.data.id,`roomEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`room`,enumsOriginal:JSON.stringify(t)}})}:void 0}:null,E&&c||this.columnsVisibility.func?{el:R.createElement(`div`,{key:`func`,style:{...$.cellFunc,...e.data.pef?$.cellEnumParent:{},width:this.props.width===`xs`?`100%`:this.columnsVisibility.func,cursor:p?`text`:`default`},onClick:!E&&p?()=>{let t=$G(this.info,e.data.id,`funcEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`func`,enumsOriginal:JSON.stringify(t)}})}:void 0},e.data.funcs),type:`filter_func`,onClick:E&&p?()=>{let t=$G(this.info,e.data.id,`funcEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`func`,enumsOriginal:JSON.stringify(t)}})}:void 0}:null];let A=this.adapterColumns?.map(t=>R.createElement(`div`,{style:{...$.cellAdapter,width:this.props.width===`xs`?void 0:this.columnsVisibility[t.id]},key:t.id,title:`${t.adapter} => ${t.pathText}`},a?this.renderCustomValue(a,t,e):null))||null,j=E||this.columnsVisibility.val?this.renderColumnValue(r,e,E):null,M=E&&j||this.columnsVisibility.val?R.createElement(`div`,{style:{...$.cellValue,width:this.props.width===`xs`?`calc(100% - 100px)`:this.columnsVisibility.val,cursor:f?c?.type===`file`?`zoom-in`:e.data.button?`grab`:`text`:`default`},onClick:t=>{f?!a||!this.states||(c?.type===`file`?this.setState({viewFileDialog:r}):e.data.url&&t.ctrlKey?this.states[r]?.val&&typeof this.states[r].val==`string`&&(c?.role===`url.self`?window.location.href=this.states[r].val:window.open(this.states[r].val,`_blank`)?.focus()):!this.state.filter.expertMode&&e.data.button?this.props.socket.setState(r,!0).catch(e=>window.alert(`Cannot write state "${r}": ${e}`)):!this.state.filter.expertMode&&e.data.switch?this.props.socket.setState(r,!this.states[r].val).catch(e=>window.alert(`Cannot write state "${r}": ${e}`)):(this.edit={val:this.states[r]?this.states[r].val:``,q:this.states[r]&&this.states[r].q||0,ack:!1,id:r},this.setState({updateOpened:!0}))):c?.role===`url`||c?.role===`url.blank`&&t.ctrlKey?this.states[r]?.val&&typeof this.states[r].val==`string`&&window.open(this.states[r].val,`_blank`):c?.role===`url.self`&&t.ctrlKey&&this.states[r]?.val&&typeof this.states[r].val==`string`&&(window.location.href=this.states[r].val)}},j):null,N=E||this.columnsVisibility.buttons?R.createElement(`div`,{style:{...$.cellButtons,width:this.props.width===`xs`?void 0:this.columnsVisibility.buttons}},this.renderColumnButtons(r,e)):null,P=null;if(this.props.width===`xs`&&this.state.focused===r){k=k.filter(e=>e);let t;t=k.length?k.map(e=>e?R.createElement(`div`,{key:e.type,style:$.cellDetailsLine},R.createElement(`span`,{style:$.cellDetailsName},this.texts[e.type],`:`),e.el,R.createElement(`div`,{style:{flexGrow:1}}),e.onClick?R.createElement(LO,{style:$.cellCopyButtonInDetails,onClick:()=>{e?.onClick&&e.onClick()}}):null):null):null,A.length||(A=null),P=R.createElement(T_,{style:{width:`100%`,display:`flex`,flexDirection:`column`,padding:10,backgroundColor:this.props.theme.palette.mode===`dark`?`#333`:`#ccc`}},R.createElement(`div`,{style:$.cellDetailsLine},R.createElement(`div`,{style:{flexGrow:1}}),R.createElement(hG,{style:$.cellCopyButtonInDetails,onClick:e=>this.onCopy(e,r)})),O&&R.createElement(`div`,{style:$.cellDetailsLine},R.createElement(`span`,{style:$.cellDetailsName},this.texts.name,`:`),O,R.createElement(`div`,{style:{flexGrow:1}}),e.data?.title?R.createElement(hG,{className:`copyButton`,style:$.cellCopyButtonInDetails,onClick:t=>this.onCopy(t,e.data?.title)}):null),t,A&&R.createElement(`div`,{style:$.cellDetailsLine},A),this.objects[r]?.type===`state`&&R.createElement(`div`,{style:$.cellDetailsLine},R.createElement(`span`,{style:$.cellDetailsName},this.texts.value,`:`),M,R.createElement(`div`,{style:{flexGrow:1}}),R.createElement(hG,{className:`copyButton`,style:$.cellCopyButtonInDetails,onClick:e=>{let{valText:t}=tK({state:this.states[r],obj:this.objects[r],texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma});this.onCopy(e,t.c===void 0?t.v.toString():t.c)},key:`cc`})),N&&R.createElement(`div`,{style:{...$.cellDetailsLine,justifyContent:`right`}},N)),O=null,k=null,A=null,M=null,N=null}return{row:R.createElement(rw,{container:!0,direction:`row`,wrap:`nowrap`,sx:X.getStyle(this.props.theme,$.tableRow,this.state.linesEnabled&&$.tableRowLines,!this.props.dragEnabled&&$.tableRowNoDragging,v&&$.tableRowAlias,_&&$.tableRowAliasReadWrite,this.state.focused===r&&this.props.multiSelect&&$.tableRowFocused,!e.data.visible&&$.filteredOut,e.data.hasVisibleParent&&!e.data.visible&&!e.data.hasVisibleChildren&&$.filteredParentOut,this.state.selected.includes(r)&&$.itemSelected,this.state.selectedNonObject===r&&$.itemSelected),key:r,id:r,onMouseDown:t=>{this.onSelect(r);let n;`which`in t?n=t.which===3:`button`in t&&(n=t.button===2),n?this.contextMenu={item:e,ts:Date.now()}:this.contextMenu=null},onDoubleClick:()=>{e.children?this.toggleExpanded(r):this.onSelect(r,!0)}},D,O,k?.map(e=>e?.el),A,M,N),details:P}}renderItem(e,t,n){let r=[];n||={count:0};let i=this.renderLeaf(e,t,n),a,o=this.props.DragWrapper;return a=this.props.dragEnabled&&o?e.data.sumVisibility?R.createElement(o,{key:e.data.id,item:e,style:$.draggable},i.row):R.createElement(`div`,{key:e.data.id,style:$.nonDraggable},i.row):i.row,e.data.id&&a&&r.push(a),i.details&&r.push(i.details),t=t===void 0?HG(this.state.expanded,e.data.id):t,(!e.data.id||t)&&(this.state.foldersFirst?e.children&&(r.push(e.children.map(e=>e.children&&(!this.state.columnsSelectorShow||n.count<15)&&e.data.sumVisibility?this.renderItem(e,void 0,n):null)),r.push(e.children.map(e=>!e.children&&(!this.state.columnsSelectorShow||n.count<15)&&e.data.sumVisibility?this.renderItem(e,void 0,n):null))):e.children&&r.push(e.children.map(e=>(!this.state.columnsSelectorShow||n.count<15)&&e.data.sumVisibility?this.renderItem(e,void 0,n):null))),r}calculateColumnsVisibility(e,t,n,r){let i=r||this.state.columnsWidths,a=n||this.state.columnsForAdmin,o=t||this.state.columns||[],s=typeof e==`boolean`?e:this.state.columnsAuto;i=JSON.parse(JSON.stringify(i)),Object.keys(i).forEach(e=>{i[e]&&(i[e]=parseInt(i[e],10)||0)}),this.adapterColumns=[];let c=_K[this.props.width||`lg`].widths;if(s){if(this.columnsVisibility={id:_K[this.props.width||`lg`].idWidth,name:this.visibleCols.includes(`name`)&&c.name||0,nameHeader:this.visibleCols.includes(`name`)&&c.name||0,type:this.visibleCols.includes(`type`)&&c.type||0,role:this.visibleCols.includes(`role`)&&c.role||0,room:this.visibleCols.includes(`room`)&&c.room||0,func:this.visibleCols.includes(`func`)&&c.func||0,changedFrom:this.visibleCols.includes(`changedFrom`)&&c.changedFrom||0,qualityCode:this.visibleCols.includes(`qualityCode`)&&c.qualityCode||0,timestamp:this.visibleCols.includes(`timestamp`)&&c.timestamp||0,lastChange:this.visibleCols.includes(`lastChange`)&&c.lastChange||0,val:this.visibleCols.includes(`val`)&&c.val||0,buttons:this.visibleCols.includes(`buttons`)&&c.buttons||0},this.columnsVisibility.name&&!this.customWidth){let e=this.columnsVisibility.id||0;this.state.statesView?(e+=this.columnsVisibility.changedFrom||0,e+=this.columnsVisibility.qualityCode||0,e+=this.columnsVisibility.timestamp||0,e+=this.columnsVisibility.lastChange||0):(e+=this.columnsVisibility.type||0,e+=this.columnsVisibility.role||0,e+=this.columnsVisibility.room||0,e+=this.columnsVisibility.func||0),e+=this.columnsVisibility.val||0,e+=this.columnsVisibility.buttons||0,this.columnsVisibility.name=`calc(100% - ${e+5}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${e+5+this.state.scrollBarWidth}px)`}else if(!this.customWidth){let e=0;this.state.statesView?(e+=this.columnsVisibility.changedFrom||0,e+=this.columnsVisibility.qualityCode||0,e+=this.columnsVisibility.timestamp||0,e+=this.columnsVisibility.lastChange||0):(e+=this.columnsVisibility.type||0,e+=this.columnsVisibility.role||0,e+=this.columnsVisibility.room||0,e+=this.columnsVisibility.func||0),e+=this.columnsVisibility.val||0,e+=this.columnsVisibility.buttons||0,this.columnsVisibility.id=`calc(100% - ${e+5}px)`}}else{let e=this.props.width||`lg`;this.columnsVisibility={id:i.id||_K[e].idWidth,name:o.includes(`name`)&&(i.name||c.name||_K[e].widths.name)||0,type:o.includes(`type`)&&(i.type||c.type||_K[e].widths.type)||0,role:o.includes(`role`)&&(i.role||c.role||_K[e].widths.role)||0,room:o.includes(`room`)&&(i.room||c.room||_K[e].widths.room)||0,func:o.includes(`func`)&&(i.func||c.func||_K[e].widths.func)||0};let t=this.columnsVisibility.id;if(this.columnsVisibility.name&&(t+=this.columnsVisibility.type||0,t+=this.columnsVisibility.role||0,t+=this.columnsVisibility.room||0,t+=this.columnsVisibility.func||0),a&&o&&Object.keys(a).sort().forEach(n=>a[n].forEach(r=>{let a=`_${n}_${r.path}`;if(o.includes(a)){let o={adapter:n,id:`_${n}_${r.path}`,name:r.name,path:r.path.split(`.`),pathText:r.path};r.edit&&(o.edit=!0,r.type&&(o.type=r.type),r.objTypes&&(o.objTypes=r.objTypes)),this.adapterColumns.push(o),this.columnsVisibility[a]=i[o.id]||r.width||_K[e].widths.func||_K.xl.widths.func||0,t+=this.columnsVisibility[a]}else this.columnsVisibility[a]=0})),this.adapterColumns.sort((e,t)=>e.id>t.id?-1:+(e.id<t.id)),this.columnsVisibility.val=o.includes(`val`)?i.val||c.val||_K.xl.widths.val:0,(!this.props.columns||this.props.columns.includes(`buttons`))&&(this.columnsVisibility.buttons=o.includes(`buttons`)?i.buttons||c.buttons||_K.xl.widths.buttons:0,t+=this.columnsVisibility.buttons||0),this.columnsVisibility.name&&!i.name)t+=this.columnsVisibility.val||0,this.columnsVisibility.name=`calc(100% - ${t}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${t+5+this.state.scrollBarWidth}px)`;else{let e=Object.keys(this.columnsVisibility).reduce((e,t)=>t===`id`||typeof this.columnsVisibility[t]==`string`||!this.columnsVisibility[t]?e:e+this.columnsVisibility[t],0);this.columnsVisibility.id=`calc(100% - ${e}px)`}}}resizerMouseMove=e=>{if(this.resizerActiveDiv){let t,n;this.resizeLeft?(t=this.resizerOldWidth-e.clientX+this.resizerPosition,n=this.resizerOldWidthNext+e.clientX-this.resizerPosition):(t=this.resizerOldWidth+e.clientX-this.resizerPosition,n=this.resizerOldWidthNext-e.clientX+this.resizerPosition),this.resizerActiveName&&this.resizerNextName&&(!this.resizerMin||t>this.resizerMin)&&(!this.resizerNextMin||n>this.resizerNextMin)&&(this.resizerCurrentWidths[this.resizerActiveName]=t,this.resizerCurrentWidths[this.resizerNextName]=n,this.resizerActiveDiv.style.width=`${t}px`,this.resizerNextDiv&&(this.resizerNextDiv.style.width=`${n}px`),this.columnsVisibility[this.resizerActiveName]=t,this.columnsVisibility[this.resizerNextName]=n,this.resizerNextName===`nameHeader`?(this.columnsVisibility.name=n-this.state.scrollBarWidth,this.resizerCurrentWidths.name=n-this.state.scrollBarWidth):this.resizerActiveName===`nameHeader`&&(this.columnsVisibility.name=t-this.state.scrollBarWidth,this.resizerCurrentWidths.name=t-this.state.scrollBarWidth),this.customWidth=!0,this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=null,this.forceUpdate()},200))}};resizerMouseUp=()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerActiveName=null,this.resizerNextName=null,this.resizerActiveDiv=null,this.resizerNextDiv=null,window.removeEventListener(`mousemove`,this.resizerMouseMove),window.removeEventListener(`mouseup`,this.resizerMouseUp)};resizerMouseDown=e=>{if(this.storedWidths||=JSON.parse(JSON.stringify(_K[this.props.width||`lg`])),this.resizerCurrentWidths||={},this.resizerActiveDiv=e.target.parentNode,this.resizerActiveName=this.resizerActiveDiv.dataset.name||null,this.resizerActiveName){let t=0;if(e.target.dataset.left===`true`){this.resizeLeft=!0,this.resizerNextDiv=this.resizerActiveDiv.previousElementSibling;let e=this.resizerNextDiv.querySelector(`.iob-ob-resize-handler`);for(;this.resizerNextDiv&&!e&&t<10;)this.resizerNextDiv=this.resizerNextDiv.previousElementSibling,e=this.resizerNextDiv.querySelector(`.iob-ob-resize-handler`),t++;e?.dataset.left!==`true`&&(this.resizerNextDiv=this.resizerNextDiv.nextElementSibling)}else this.resizeLeft=!1,this.resizerNextDiv=this.resizerActiveDiv.nextElementSibling;this.resizerNextName=this.resizerNextDiv.dataset.name||null,this.resizerMin=parseInt(this.resizerActiveDiv.dataset.min,10)||0,this.resizerNextMin=parseInt(this.resizerNextDiv.dataset.min,10)||0,this.resizerPosition=e.clientX,this.resizerCurrentWidths[this.resizerActiveName]=this.resizerActiveDiv.offsetWidth,this.resizerOldWidth=this.resizerCurrentWidths[this.resizerActiveName],this.resizerNextName&&(this.resizerCurrentWidths[this.resizerNextName]=this.resizerNextDiv.offsetWidth,this.resizerOldWidthNext=this.resizerCurrentWidths[this.resizerNextName]),window.addEventListener(`mousemove`,this.resizerMouseMove),window.addEventListener(`mouseup`,this.resizerMouseUp)}};navigateKeyPress(t){let n=this.state.selectedNonObject||this.state.selected[0];if(n){if(t.code===`ArrowUp`||t.code===`ArrowDown`){t.preventDefault();let e=[];this.tableRef.current?.childNodes.forEach(t=>e.push(t.id));let r=e.indexOf(n),i=e[t.code===`ArrowDown`?r+1:r-1]||n;this.onSelect(i),this.scrollToItem(i)}if((t.code===`ArrowRight`||t.code===`ArrowLeft`)&&this.toggleExpanded(n),t.code===`Delete`&&this.root&&n){let t=e.getItemFromRoot(this.root,n);if(t){let{obj:e}=t.data;e&&!e.common?.dontDelete&&this.showDeleteDialog({id:n,obj:e,item:t})}}}}static getItemFromRoot(e,t){let n=t.split(`.`),r=``,i=e;for(let e=0;e<n.length;e++){let t=n[e];r=r?`${r}.${t}`:t;let a=!1;if(i.children){for(let e=0;e<i.children.length;e++)if(i.children[e].data.id===r){i=i.children[e],a=!0;break}}if(!a)return null}return i||null}resizerReset=()=>{this.customWidth=!1,_K[this.props.width||`lg`]=JSON.parse(JSON.stringify(this.storedWidths)),this.calculateColumnsVisibility(),this.localStorage.removeItem(`${this.props.dialogName||`App`}.table`),this.forceUpdate()};renderHandleRight(){return R.createElement(_x,{component:`div`,className:`iob-ob-resize-handler`,sx:{...$.resizeHandle,...$.resizeHandleRight},onMouseDown:this.resizerMouseDown,onDoubleClick:this.resizerReset,title:this.props.t(`ra_Double click to reset table layout`)})}renderHeader(){let e=null;return!this.columnsVisibility.buttons&&!this.isFilterEmpty()&&(e=R.createElement(uv,{onClick:()=>this.clearFilter(),style:$.buttonClearFilter,title:this.props.t(`ra_Clear filter`),size:`large`},R.createElement(xG,null),R.createElement(DO,{style:$.buttonClearFilterIcon}))),this.props.width===`xs`?R.createElement(`div`,{style:$.headerRow},R.createElement(`div`,{style:{...$.headerCell,width:`100%`}},this.getFilterInput(`id`))):R.createElement(`div`,{style:$.headerRow},R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.id,position:`relative`},"data-min":240,"data-name":`id`},this.getFilterInput(`id`),this.renderHandleRight()),this.columnsVisibility.name?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.nameHeader,position:`relative`},"data-min":100,"data-name":`nameHeader`},this.getFilterInput(`name`),this.renderHandleRight()):null,!this.state.statesView&&R.createElement(R.Fragment,null,this.columnsVisibility.type?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.type,position:`relative`},"data-min":100,"data-name":`type`},this.getFilterSelectType(),this.renderHandleRight()):null,this.columnsVisibility.role?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.role,position:`relative`},"data-min":100,"data-name":`role`},this.getFilterSelectRole(),this.renderHandleRight()):null,this.columnsVisibility.room?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.room,position:`relative`},"data-min":100,"data-name":`room`},this.getFilterSelectRoom(),this.renderHandleRight()):null,this.columnsVisibility.func?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.func,position:`relative`},"data-min":100,"data-name":`func`},this.getFilterSelectFunction(),this.renderHandleRight()):null),this.state.statesView&&R.createElement(R.Fragment,null,R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.changedFrom,position:`relative`},"data-min":100,"data-name":`changedFrom`},this.props.t(`ra_Changed from`),this.renderHandleRight()),R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.qualityCode,position:`relative`},"data-min":100,"data-name":`qualityCode`},this.props.t(`ra_Quality code`),this.renderHandleRight()),R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.timestamp,position:`relative`},"data-min":100,"data-name":`timestamp`},this.props.t(`ra_Timestamp`),this.renderHandleRight()),R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.lastChange,position:`relative`},"data-min":100,"data-name":`lastChange`},this.props.t(`ra_Last change`),this.renderHandleRight())),this.adapterColumns.map(e=>R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility[e.id]},title:e.adapter,key:e.id,"data-min":100,"data-name":e.id},e.name)),this.columnsVisibility.val?R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.val,position:`relative`},"data-min":120,"data-name":`val`},this.props.t(`ra_Value`),e):null,this.columnsVisibility.buttons?R.createElement(`div`,{title:this.texts.filter_custom,style:{...$.headerCell,width:this.columnsVisibility.buttons}},` `,this.getFilterSelectCustoms()):null)}renderToast(){return R.createElement(AE,{open:!!this.state.toast,autoHideDuration:3e3,onClick:()=>this.setState({toast:``}),onClose:()=>this.setState({toast:``}),message:this.state.toast,action:R.createElement(uv,{size:`small`,"aria-label":`close`,color:`inherit`,onClick:()=>this.setState({toast:``})},R.createElement(DO,{fontSize:`small`}))})}getStateNav(){return this.state.editObjectDialog?{mode:`edit`,id:this.state.editObjectDialog}:this.state.customDialog&&this.state.customDialog.length===1&&!this.state.customDialogAll?{mode:`settings`,id:this.state.customDialog[0]}:this.state.viewFileDialog?{mode:`viewFile`,id:this.state.viewFileDialog}:this.state.selected.length===1&&this.state.selected[0]?{mode:`select`,id:this.state.selected[0]}:null}static navEqual(e,t){return!e||!t?!e&&!t:e.mode===t.mode&&e.id===t.id}applyNavigateTo(e){this.applyingNav=!0;let t=()=>{this.applyingNav=!1};if(!e?.id){this.setState({editObjectDialog:``,customDialog:null,viewFileDialog:``},t);return}let{id:n}=e,r=()=>{e.mode===`edit`?this.setState({editObjectDialog:n,editObjectAlias:!1,customDialog:null,viewFileDialog:``},t):e.mode===`settings`?this.setState({customDialog:[n],customDialogAll:!1,editObjectDialog:``,viewFileDialog:``},t):e.mode===`viewFile`?this.setState({viewFileDialog:n,editObjectDialog:``,customDialog:null},t):this.setState({editObjectDialog:``,customDialog:null,viewFileDialog:``},t)};this.state.selected.length===1&&this.state.selected[0]===n?r():this.onSelect(n,!1,()=>this.expandAllSelected(()=>{this.scrollToItem(n),r()}))}applyInitialNavigateTo(){let e=this.props.navigateTo??null;e?.id?(this.lastNav=e,this.applyNavigateTo(e)):this.lastNav=this.getStateNav()}reconcileNavigation(t){if(this.props.navigateTo===void 0&&!this.props.onNavigateTo||this.applyingNav)return;let n=this.props.navigateTo??null,r=this.getStateNav();if(e.navEqual(n,r)){this.lastNav=r;return}e.navEqual(n,t.navigateTo??null)?e.navEqual(r,this.lastNav)||(this.lastNav=r,this.props.onNavigateTo?.(r)):(this.lastNav=n,this.applyNavigateTo(n))}componentDidUpdate(e){if(this.tableRef.current){let e=this.tableRef.current.offsetWidth-this.tableRef.current.clientWidth;this.state.scrollBarWidth===e?this.selectFirst&&this.scrollToItem(this.selectFirst):setTimeout(()=>this.setState({scrollBarWidth:e}),100)}this.reconcileNavigation(e)}scrollToItem(e){this.selectFirst=``,window.document.getElementById(e)?.scrollIntoView({behavior:`auto`,block:`center`,inline:`center`})}renderCustomDialog(){if(this.state.customDialog&&this.props.objectCustomDialog&&this.systemConfig){let e=this.props.objectCustomDialog;return R.createElement(e,{reportChangedIds:e=>this.changedIds=[...e],objectIDs:this.state.customDialog,allVisibleObjects:!!this.state.customDialogAll,expertMode:this.state.filter.expertMode,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,t:this.props.t,lang:this.props.lang,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,objects:this.objects,customsInstances:this.info.customs,onClose:()=>{this.pauseSubscribe(!1),this.setState({customDialog:null}),this.changedIds&&(this.changedIds=null,this.forceUpdate()),this.props.router?.doNavigate(`tab-objects`)},systemConfig:this.systemConfig})}return null}onUpdate(e){this.props.socket.setState(this.edit.id,{val:e.val,ack:e.ack,q:e.q||0,expire:e.expire||void 0}).catch(e=>this.showError(`Cannot write value: ${e}`))}renderEditObjectDialog(){if(!this.state.editObjectDialog||!this.props.objectBrowserEditObject)return null;let e=this.props.objectBrowserEditObject;return R.createElement(e,{key:this.state.editObjectDialog,obj:this.objects[this.state.editObjectDialog],roleArray:this.info.roles,objects:this.objects,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,themeType:this.props.themeType,theme:this.props.theme,socket:this.props.socket,dialogName:this.props.dialogName,aliasTab:this.state.editObjectAlias,t:this.props.t,expertMode:!!this.state.filter.expertMode,onNewObject:e=>this.props.socket.setObject(e._id,e).then(()=>this.setState({editObjectDialog:e._id,editObjectAlias:!1},()=>this.onSelect(e._id))).catch(e=>this.showError(`Cannot write object: ${e}`)),onClose:e=>{if(e){let t;this.state.editObjectDialog.startsWith(`alias.`)&&JSON.stringify(this.objects[this.state.editObjectDialog].common?.alias)!==JSON.stringify(e.common?.alias)&&(t=this.state.editObjectDialog),this.props.socket.setObject(e._id,e).then(()=>{t&&this.subscribes.includes(t)&&(this.unsubscribe(t),setTimeout(()=>this.subscribe(t),100))}).catch(e=>this.showError(`Cannot write object: ${e}`))}this.setState({editObjectDialog:``,editObjectAlias:!1})},width:this.props.width})}renderViewObjectFileDialog(){if(!this.state.viewFileDialog||!this.props.objectBrowserViewFile)return null;let e=this.props.objectBrowserViewFile;return R.createElement(e,{key:`viewFile`,obj:this.objects[this.state.viewFileDialog],socket:this.props.socket,t:this.props.t,onClose:()=>this.setState({viewFileDialog:``})})}renderAliasEditorDialog(){if(!this.props.objectBrowserAliasEditor||!this.state.showAliasEditor)return null;let e=this.props.objectBrowserAliasEditor;return R.createElement(e,{key:`editAlias`,obj:this.objects[this.state.showAliasEditor],roleArray:this.info.roles,objects:this.objects,socket:this.props.socket,t:this.props.t,onClose:()=>this.setState({showAliasEditor:``}),onRedirect:(e,t)=>setTimeout(()=>this.onSelect(e,!1,()=>this.expandAllSelected(()=>{this.scrollToItem(e),setTimeout(()=>this.setState({editObjectDialog:e,showAliasEditor:``,editObjectAlias:!0}),300)})),t||0)})}showAddDataPointDialog(e,t,n){this.setState({showContextMenu:null,modalNewObj:{id:e,initialType:t,initialStateType:n}})}renderAliasMenu(){return this.state.aliasMenu?R.createElement(jT,{key:`aliasmenu`,open:!0,anchorEl:window.document.getElementById(`alias_${this.state.aliasMenu}`),onClose:()=>this.setState({aliasMenu:``})},this.info.aliasesMap[this.state.aliasMenu].map((e,t)=>R.createElement(LT,{key:e,onClick:()=>this.onSelect(e)},R.createElement(cT,null,this.renderAliasLink(this.state.aliasMenu,t,{"& .admin-browser-arrow":{mr:`8px`}}))))):null}renderContextMenu(){if(!this.state.showContextMenu)return null;let e=this.state.showContextMenu.item,t=e.data.id,n=[],r=e.data.obj,i=``;if(this.props.objectEditOfAccessControl&&this.state.filter.expertMode)if(!r)i=`---`;else{let e=r.acl?r.type===`state`?r.acl.state:r.acl.object:0,t=r.acl&&(r.type===`state`?this.systemConfig?.common.defaultNewAcl.state:this.systemConfig?.common.defaultNewAcl.object);i=Number.isNaN(Number(e))?Number(t).toString(16):Number(e).toString(16)}let a=!this.props.notEditable&&r&&(this.state.filter.expertMode||r.type===`state`||r.type===`channel`||r.type===`device`),o=!e.data.obj||e.data.obj.type===`folder`||e.data.obj.type===`channel`||e.data.obj.type===`device`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,s=!e.data.obj||e.data.obj.type===`folder`||e.data.obj.type===`device`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,c=!e.data.obj||e.data.obj.type===`folder`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,l=!e.data.obj||e.data.obj.type===`folder`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,u={EDIT:{key:`0`,visibility:!!(this.props.objectBrowserEditObject&&r&&(this.state.filter.expertMode||oK(t))),icon:R.createElement(LO,{fontSize:`small`,style:this.styles.contextMenuEdit}),label:this.texts.editObject,onClick:()=>this.setState({editObjectDialog:e.data.id,showContextMenu:null,editObjectAlias:!1})},EDIT_VALUE:{key:`1`,visibility:!!(this.states&&!this.props.notEditable&&r&&r.type===`state`&&r.common?.type!==`file`&&(this.state.filter.expertMode||r.common.write!==!1)),icon:R.createElement(UO,{fontSize:`small`,style:this.styles.contextMenuEditValue}),label:this.props.t(`ra_Edit value`),onClick:()=>{this.edit={val:this.states[t]?this.states[t].val:``,q:this.states[t]?.q||0,ack:!1,id:t},this.setState({updateOpened:!0,showContextMenu:null})}},VIEW:{visibility:!!this.props.objectBrowserViewFile&&r?.type===`state`&&r.common?.type===`file`,icon:R.createElement(zO,{fontSize:`small`,style:this.styles.contextMenuView}),label:this.props.t(`ra_View file`),onClick:()=>this.setState({viewFileDialog:r?._id||``,showContextMenu:null})},CUSTOM:{key:`2`,visibility:!(this.props.objectCustomDialog&&this.info.hasSomeCustoms&&r&&r.type===`state`&&r.common?.type!==`file`),icon:R.createElement(sk,{fontSize:`small`,style:e.data.hasCustoms?this.styles.cellButtonsButtonWithCustoms:$.cellButtonsButtonWithoutCustoms}),style:this.styles.contextMenuCustom,label:this.texts.customConfig,onClick:()=>{this.pauseSubscribe(!0),this.props.router?.doNavigate(null,`customs`,t),this.setState({customDialog:[t],showContextMenu:null})}},ACL:{key:`3`,visibility:!!i,icon:i,iconStyle:{fontSize:`smaller`},listItemIconStyle:this.styles.contextMenuACL,style:this.styles.contextMenuACL,label:this.props.t(`ra_Edit ACL`),onClick:()=>this.setState({showContextMenu:null,modalEditOfAccess:!0,modalEditOfAccessObjData:e.data})},ROLE:{key:`4`,visibility:!!(this.state.filter.expertMode&&a&&this.props.objectBrowserEditRole),icon:R.createElement(SO,{fontSize:`small`,style:this.styles.contextMenuRole}),label:this.props.t(`ra_Edit role`),onClick:()=>this.setState({roleDialog:e.data.id,showContextMenu:null})},FUNCTION:{key:`5`,visibility:!!a,icon:R.createElement(yO,{fontSize:`small`,style:this.styles.contextMenuRole}),label:this.props.t(`ra_Edit function`),onClick:()=>{let t=$G(this.info,e.data.id,`funcEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`func`,enumsOriginal:JSON.stringify(t)},showContextMenu:null})}},ROOM:{key:`6`,visibility:!!a,icon:R.createElement(kO,{fontSize:`small`,style:this.styles.contextMenuRoom}),label:this.props.t(`ra_Edit room`),onClick:()=>{let t=$G(this.info,e.data.id,`roomEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`room`,enumsOriginal:JSON.stringify(t)},showContextMenu:null})}},ALIAS:{key:`7`,visibility:!!(!this.props.notEditable&&this.props.objectBrowserAliasEditor&&this.props.objectBrowserEditObject&&r?.type===`state`&&r.common?.type!==`file`),icon:R.createElement(YO,{style:r?.common?.alias?this.styles.cellButtonsButtonWithCustoms:$.cellButtonsButtonWithoutCustoms}),label:this.info.aliasesMap[e.data.id]||e.data.id.startsWith(`alias.0.`)?this.props.t(`ra_Edit alias`):this.props.t(`ra_Create alias`),onClick:()=>{r?.common?.alias?this.setState({showContextMenu:null,editObjectDialog:e.data.id,editObjectAlias:!0}):this.setState({showContextMenu:null,showAliasEditor:e.data.id})}},CREATE:{key:`+`,visibility:(e.data.id.startsWith(`0_userdata.0`)||e.data.id.startsWith(`javascript.`))&&(o||s||c||l),icon:R.createElement(hO,{fontSize:`small`,style:this.styles.cellButtonsButtonWithCustoms}),style:$.contextMenuWithSubMenu,label:this.texts.create,subMenu:[{label:this.texts.createBooleanState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`,`boolean`)},{label:this.texts.createNumberState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`,`number`)},{label:this.texts.createStringState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`,`string`)},{label:this.texts.createState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`)},{label:this.texts.createChannel,visibility:s,icon:R.createElement(mG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`channel`)},{label:this.texts.createDevice,visibility:c,icon:R.createElement(gG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`device`)},{label:this.texts.createFolder,icon:R.createElement(MO,{fontSize:`small`}),visibility:l,onClick:()=>this.showAddDataPointDialog(e.data.id,`folder`)}]},RENAME:{key:`8`,visibility:!!(!this.props.notEditable&&this.props.objectMoveRenameDialog&&!e.data.id.startsWith(`system.`)&&e.data.id.split(`.`).length>2&&(this.props.expertMode||e.data.id.startsWith(`javascript.0.`)||e.data.id.startsWith(`0_userdata.0.`))),icon:R.createElement(IO,null),label:this.props.t(`ra_Rename_Move_Copy`),onClick:()=>{let t=Object.keys(this.objects),n=`${e.data.id}.`;this.setState({showContextMenu:null,showRenameDialog:{id:e.data.id,childrenIds:t.filter(e=>e.startsWith(n))}})}},DELETE:{key:`Delete`,visibility:!!(this.props.onObjectDelete&&(e.children?.length||r&&!r.common?.dontDelete)),icon:R.createElement(PO,{fontSize:`small`,style:this.styles.contextMenuDelete}),style:this.styles.contextMenuDelete,label:this.texts.deleteObject,onClick:()=>this.setState({showContextMenu:null},()=>this.showDeleteDialog({id:t,obj:r||{},item:e}))}};return Object.keys(u).forEach(e=>{u[e].visibility&&(u[e].subMenu?(n.push(R.createElement(LT,{key:e,href:``,onClick:t=>this.state.showContextMenu&&this.setState({showContextMenu:{item:this.state.showContextMenu.item,position:this.state.showContextMenu.position,subItem:e,subAnchor:t.target}}),style:u[e].style},R.createElement(rT,{style:{...u[e].iconStyle,...u[e].listItemIconStyle}},u[e].icon),R.createElement(cT,null,u[e].label,`...`),R.createElement(`div`,{style:{...$.contextMenuKeys,opacity:1}},R.createElement(_O,null)))),this.state.showContextMenu?.subItem===e&&n.push(R.createElement(jT,{key:`subContextMenu`,open:!0,anchorEl:this.state.showContextMenu.subAnchor,onClose:()=>{this.state.showContextMenu&&this.setState({showContextMenu:{item:this.state.showContextMenu.item,position:this.state.showContextMenu.position}}),this.contextMenu=null}},u[e].subMenu?.map(e=>e.visibility?R.createElement(LT,{key:e.label,onClick:e.onClick,style:e.style},R.createElement(rT,{style:{...e.iconStyle,...e.listItemIconStyle||void 0}},e.icon),R.createElement(cT,null,e.label)):null)))):n.push(R.createElement(LT,{key:e,onClick:u[e].onClick,sx:u[e].style},R.createElement(rT,{style:{...u[e].iconStyle,...u[e].listItemIconStyle}},u[e].icon),R.createElement(cT,null,u[e].label),u[e].key?R.createElement(`div`,{style:$.contextMenuKeys},`Alt+${u[e].key===`Delete`?this.props.t(`ra_Del`):u[e].key}`):null)))}),n.length?R.createElement(jT,{key:`contextMenu`,open:!0,onKeyUp:e=>{e.preventDefault(),e.altKey&&Object.keys(u).forEach(t=>{e.key===u[t].key&&u[t].onClick&&u[t].onClick()})},anchorReference:`anchorPosition`,anchorPosition:this.state.showContextMenu.position,onClose:()=>{this.setState({showContextMenu:null}),this.contextMenu=null}},n):(setTimeout(()=>this.setState({showContextMenu:null}),100),null)}renderEditValueDialog(){if(!this.state.updateOpened||!this.props.objectBrowserValue)return null;if(!this.edit.id)return console.error(`Invalid ID for edit: ${JSON.stringify(this.edit)}`),null;if(!this.objects[this.edit.id])return console.error(`Something went wrong. Possibly the object ${this.edit.id} was deleted.`),null;let e=this.objects[this.edit.id].common?.type?this.objects[this.edit.id].common.type:typeof this.edit.val,t=this.objects[this.edit.id].common.role,n=this.props.objectBrowserValue;return R.createElement(n,{t:this.props.t,lang:this.props.lang,type:e,role:t||``,states:X.getStates(this.objects[this.edit.id]),themeType:this.props.themeType,theme:this.props.theme,expertMode:!!this.state.filter.expertMode,value:this.edit.val,socket:this.props.socket,object:this.objects[this.edit.id],defaultHistory:this.defaultHistory,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,onClose:e=>{this.setState({updateOpened:!1}),e&&this.onUpdate(e)},width:this.props.width})}doFilter(e){if(!this.objects||!this.root)return;e||this.localStorage.setItem(`${this.props.dialogName||`App`}.objectFilter`,JSON.stringify(this.state.filter));let t={count:0};GG(this.root,this.state.filter,this.props.lang,this.objects,void 0,t,this.props.customFilter,this.props.types),t.count<500&&!this.state.expandAllVisible?setTimeout(()=>this.setState({expandAllVisible:!0})):t.count>=500&&this.state.expandAllVisible?setTimeout(()=>this.setState({expandAllVisible:!1})):this.forceUpdate()}render(){if(this.recordStates=[],this.unsubscribeTimer&&clearTimeout(this.unsubscribeTimer),this.styleTheme!==this.props.themeType&&(this.styles={cellIdIconFolder:X.getStyle(this.props.theme,$.cellIdIconFolder),cellIdIconDocument:X.getStyle(this.props.theme,$.cellIdIconDocument),iconDeviceError:X.getStyle(this.props.theme,$.iconDeviceError),iconDeviceConnected:X.getStyle(this.props.theme,$.iconDeviceConnected),iconDeviceDisconnected:X.getStyle(this.props.theme,$.iconDeviceDisconnected),cellButtonsButtonWithCustoms:X.getStyle(this.props.theme,$.cellButtonsButtonWithCustoms),invertedBackground:X.getStyle(this.props.theme,$.invertedBackground),invertedBackgroundFlex:X.getStyle(this.props.theme,$.invertedBackgroundFlex),contextMenuEdit:X.getStyle(this.props.theme,$.contextMenuEdit),contextMenuEditValue:X.getStyle(this.props.theme,$.contextMenuEditValue),contextMenuView:X.getStyle(this.props.theme,$.contextMenuView),contextMenuCustom:X.getStyle(this.props.theme,$.contextMenuCustom),contextMenuACL:X.getStyle(this.props.theme,$.contextMenuACL),contextMenuRoom:X.getStyle(this.props.theme,$.contextMenuRoom),contextMenuRole:X.getStyle(this.props.theme,$.contextMenuRole),contextMenuDelete:X.getStyle(this.props.theme,$.contextMenuDelete),filterInput:X.getStyle(this.props.theme,$.headerCellInput,$.filterInput),iconCopy:X.getStyle(this.props.theme,$.cellButtonsValueButton,$.cellButtonsValueButtonCopy),aliasReadWrite:X.getStyle(this.props.theme,$.cellIdAlias,$.cellIdAliasReadWrite),aliasAlone:X.getStyle(this.props.theme,$.cellIdAlias,$.cellIdAliasAlone)},this.styleTheme=this.props.themeType),this.unsubscribeTimer=setTimeout(()=>{this.unsubscribeTimer=null,this.checkUnsubscribes()},200),this.expertMode!==!!this.state.filter.expertMode&&(this.expertMode=!!this.state.filter.expertMode,this.doFilter(!0)),!this.state.loaded)return R.createElement(iv,{key:`${this.props.dialogName}_c`});let e=this.root?this.renderItem(this.root,void 0):null;return R.createElement(CG,{key:this.props.dialogName},R.createElement(`style`,null,`
649
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kU(e,t){if(e){if(typeof e==`string`)return AU(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return AU(e,t)}}function AU(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function jU(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function MU(e){if(Array.isArray(e))return e}function NU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function PU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?NU(Object(n),!0).forEach(function(t){FU(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FU(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IU(e,t){if(e==null)return{};var n=LU(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function LU(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var RU=(0,R.forwardRef)(function(e,t){var n=e.children,r=VU(IU(e,yU)),i=r.open,a=IU(r,bU);return(0,R.useImperativeHandle)(t,function(){return{open:i}},[i]),R.createElement(R.Fragment,null,n(PU(PU({},a),{},{open:i})))});RU.displayName=`Dropzone`;var zU={disabled:!1,getFilesFromEvent:gH,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};RU.defaultProps=zU,RU.propTypes={children:Z.default.func,accept:Z.default.objectOf(Z.default.arrayOf(Z.default.string)),multiple:Z.default.bool,preventDropOnDocument:Z.default.bool,noClick:Z.default.bool,noKeyboard:Z.default.bool,noDrag:Z.default.bool,noDragEventsBubbling:Z.default.bool,minSize:Z.default.number,maxSize:Z.default.number,maxFiles:Z.default.number,disabled:Z.default.bool,getFilesFromEvent:Z.default.func,onFileDialogCancel:Z.default.func,onFileDialogOpen:Z.default.func,useFsAccessApi:Z.default.bool,autoFocus:Z.default.bool,onDragEnter:Z.default.func,onDragLeave:Z.default.func,onDragOver:Z.default.func,onDrop:Z.default.func,onDropAccepted:Z.default.func,onDropRejected:Z.default.func,onError:Z.default.func,validator:Z.default.func};var BU={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function VU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=PU(PU({},zU),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,c=t.maxFiles,l=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,m=t.onDropRejected,h=t.onFileDialogCancel,g=t.onFileDialogOpen,_=t.useFsAccessApi,v=t.autoFocus,y=t.preventDropOnDocument,b=t.noClick,x=t.noKeyboard,S=t.noDrag,C=t.noDragEventsBubbling,w=t.onError,T=t.validator,E=(0,R.useMemo)(function(){return mU(n)},[n]),D=(0,R.useMemo)(function(){return pU(n)},[n]),O=(0,R.useMemo)(function(){return typeof g==`function`?g:UU},[g]),k=(0,R.useMemo)(function(){return typeof h==`function`?h:UU},[h]),A=(0,R.useRef)(null),j=(0,R.useRef)(null),M=DU((0,R.useReducer)(HU,BU),2),N=M[0],P=M[1],F=N.isFocused,ee=N.isFileDialogActive,te=(0,R.useRef)(typeof window<`u`&&window.isSecureContext&&_&&fU()),I=function(){!te.current&&ee&&setTimeout(function(){j.current&&(j.current.files.length||(P({type:`closeDialog`}),k()))},300)};(0,R.useEffect)(function(){return window.addEventListener(`focus`,I,!1),function(){window.removeEventListener(`focus`,I,!1)}},[j,ee,k,te]);var ne=(0,R.useRef)([]),re=(0,R.useRef)([]),ie=function(e){A.current&&A.current.contains(e.target)||(e.preventDefault(),ne.current=[])};(0,R.useEffect)(function(){return y&&(document.addEventListener(`dragover`,sU,!1),document.addEventListener(`drop`,ie,!1)),function(){y&&(document.removeEventListener(`dragover`,sU),document.removeEventListener(`drop`,ie))}},[A,y]),(0,R.useEffect)(function(){var e=function(e){re.current=[].concat(CU(re.current),[e.target]),oU(e)&&P({isDragGlobal:!0,type:`setDragGlobal`})},t=function(e){re.current=re.current.filter(function(t){return t!==e.target&&t!==null}),!(re.current.length>0)&&P({isDragGlobal:!1,type:`setDragGlobal`})},n=function(){re.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})},r=function(){re.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),function(){document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[A]),(0,R.useEffect)(function(){return!r&&v&&A.current&&A.current.focus(),function(){}},[A,v,r]);var ae=(0,R.useCallback)(function(e){w?w(e):console.error(e)},[w]),oe=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e),ne.current=[].concat(CU(ne.current),[e.target]),oU(e)&&Promise.resolve(i(e)).then(function(t){if(!(aU(e)&&!C)){var n=t.length,r=n>0&&iU({files:t,accept:E,minSize:o,maxSize:a,multiple:s,maxFiles:c,validator:T});P({isDragAccept:r,isDragReject:n>0&&!r,isDragActive:!0,type:`setDraggedFiles`}),l&&l(e)}}).catch(function(e){return ae(e)})},[i,l,ae,C,E,o,a,s,c,T]),se=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e);var t=oU(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&d&&d(e),!1},[d,C]),ce=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e);var t=ne.current.filter(function(e){return A.current&&A.current.contains(e)}),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),ne.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1}),oU(e)&&u&&u(e))},[A,u,C]),le=(0,R.useCallback)(function(e,t){var n=[],r=[];e.forEach(function(e){var t=DU(tU(e,E),2),i=t[0],s=t[1],c=DU(nU(e,o,a),2),l=c[0],u=c[1],d=T?T(e):null;if(i&&l&&!d)n.push(e);else{var f=[s,u];d&&(f=f.concat(d)),r.push({file:e,errors:f.filter(function(e){return e})})}}),(!s&&n.length>1||s&&c>=1&&n.length>c)&&(n.forEach(function(e){r.push({file:e,errors:[$H]})}),n.splice(0)),P({acceptedFiles:n,fileRejections:r,type:`setFiles`}),f&&f(n,r,t),r.length>0&&m&&m(r,t),n.length>0&&p&&p(n,t)},[P,s,E,o,a,c,f,p,m,T]),ue=(0,R.useCallback)(function(e){e.preventDefault(),e.persist(),ve(e),ne.current=[],oU(e)&&Promise.resolve(i(e)).then(function(t){aU(e)&&!C||le(t,e)}).catch(function(e){return ae(e)}),P({type:`reset`})},[i,le,ae,C]),de=(0,R.useCallback)(function(){if(te.current){P({type:`openDialog`}),O();var e={multiple:s,types:D};window.showOpenFilePicker(e).then(function(e){return i(e)}).then(function(e){le(e,null),P({type:`closeDialog`})}).catch(function(e){hU(e)?(k(e),P({type:`closeDialog`})):gU(e)?(te.current=!1,j.current?(j.current.value=null,j.current.click()):ae(Error(`Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided.`))):ae(e)});return}j.current&&(P({type:`openDialog`}),O(),j.current.value=null,j.current.click())},[P,O,k,_,le,ae,D,s]),fe=(0,R.useCallback)(function(e){!A.current||!A.current.isEqualNode(e.target)||(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),de())},[A,de]),pe=(0,R.useCallback)(function(){P({type:`focus`})},[]),me=(0,R.useCallback)(function(){P({type:`blur`})},[]),he=(0,R.useCallback)(function(){b||(uU()?setTimeout(de,0):de())},[b,de]),L=function(e){return r?null:e},ge=function(e){return x?null:L(e)},_e=function(e){return S?null:L(e)},ve=function(e){C&&e.stopPropagation()},ye=(0,R.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,i=e.role,a=e.onKeyDown,o=e.onFocus,s=e.onBlur,c=e.onClick,l=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,f=e.onDrop,p=IU(e,xU);return PU(PU(FU({onKeyDown:ge(dU(a,fe)),onFocus:ge(dU(o,pe)),onBlur:ge(dU(s,me)),onClick:L(dU(c,he)),onDragEnter:_e(dU(l,oe)),onDragOver:_e(dU(u,se)),onDragLeave:_e(dU(d,ce)),onDrop:_e(dU(f,ue)),role:typeof i==`string`&&i!==``?i:`presentation`},n,A),!r&&!x?{tabIndex:0}:{}),p)}},[A,fe,pe,me,he,oe,se,ce,ue,x,S,r]),be=(0,R.useCallback)(function(e){e.stopPropagation()},[]),xe=(0,R.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,r=e.onChange,i=e.onClick,a=IU(e,SU);return PU(PU({},FU({accept:E,multiple:s,type:`file`,style:{border:0,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`0 -1px -1px 0`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`},onChange:L(dU(r,ue)),onClick:L(dU(i,be)),tabIndex:-1},n,j)),a)}},[j,n,s,ue,r]);return PU(PU({},N),{},{isFocused:F&&!r,getRootProps:ye,getInputProps:xe,rootRef:A,inputRef:j,open:L(de)})}function HU(e,t){switch(t.type){case`focus`:return PU(PU({},e),{},{isFocused:!0});case`blur`:return PU(PU({},e),{},{isFocused:!1});case`openDialog`:return PU(PU({},BU),{},{isFileDialogActive:!0});case`closeDialog`:return PU(PU({},e),{},{isFileDialogActive:!1});case`setDraggedFiles`:return PU(PU({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case`setFiles`:return PU(PU({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case`setDragGlobal`:return PU(PU({},e),{},{isDragGlobal:t.isDragGlobal});case`reset`:return PU({},BU);default:return e}}function UU(){}function WU(){let e=Qo();return[...e.breakpoints.keys].reverse().reduce((t,n)=>{let r=cw(e.breakpoints.up(n));return!t&&r?n:t},null)||`xs`}function GU(){return e=>function(t){let n=WU();return R.createElement(e,{...t,width:n})}}function KU(e){let[t,n]=R.useState(e.input||e.value||``),[r,i]=R.useState(``);return R.createElement(rC,{open:!0,onClose:()=>e.onClose(null),"aria-labelledby":`form-dialog-title`,fullWidth:e.fullWidth!==void 0&&e.fullWidth},R.createElement(bC,{id:`form-dialog-title`},e.titleText),R.createElement(pC,null,R.createElement(_C,null,e.promptText),R.createElement(mO,{variant:`standard`,autoFocus:!0,margin:`dense`,error:!!r,helperText:r===!0||!r?``:r,value:t,label:e.labelText||``,type:e.type||`text`,onKeyUp:n=>n.code===`Enter`&&t&&e.onClose(t),onChange:t=>{let r=``;e.verify&&(r=e.verify(t.target.value)),e.rule?n(e.rule(t.target.value)):n(t.target.value),i(r)},fullWidth:!0})),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,disabled:!t||!!r,onClick:()=>e.onClose(t),color:`primary`,startIcon:R.createElement(EO,null)},e.applyText||zk.t(`ra_Ok`)),R.createElement(Vx,{color:`grey`,variant:`contained`,onClick:()=>e.onClose(null),startIcon:R.createElement(DO,null)},e.cancelText||zk.t(`ra_Cancel`))))}var qU=GU()(KU);function JU(e){return R.createElement(`svg`,{onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 486 486`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),xmlns:`http://www.w3.org/2000/svg`,className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`m414.928297,149.715165 c-2.639376,-57.222555 -35.669446,-106.505345 -83.345894,-132.039151 c-3.758948,-2.049842 -7.636885,-3.932022 -11.590542,-5.641125 c-19.303146,-8.394083 -40.607459,-13.050853 -63.004303,-13.050853 c-84.113909,0 -152.791790,65.703174 -157.718988,148.605566 l0.043268,-0.010816 v0.281245 c0,3.061243 -0.146031,16.750306 -0.146031,16.750306 l-2.352723,5.224668 h15.744315 c5.916964,-19.384275 24.078904,-32.635245 45.513024,-32.635245 c26.231510,0 47.573684,21.915481 47.573684,48.146991 c0,26.226103 -21.342174,47.146409 -47.573684,47.146409 c-25.111939,0 -45.734774,-19.735831 -47.443879,-44.658471 h-18.789334 c-0.400232,0 -0.778832,0.638209 -1.162839,0.584122 l-19.762875,55.199753 c-2.774590,7.696379 2.926030,16.214860 11.103771,16.214860 h17.020735 l-0.129805,87.899899 c0,17.356066 14.073071,31.174935 31.429136,31.174935 h56.205745 v82.648189 c0,12.877778 12.937273,22.580734 25.815051,22.580734 h144.597825 c12.877778,0 23.429877,-9.702955 23.429877,-22.580734 v-166.037352 c0,-22.645636 5.976457,-44.761234 16.561008,-64.789128 c11.055093,-20.925714 17.523731,-44.620611 18.129489,-69.792045 c0.027042,-1.260193 0.037858,-2.552839 0.037858,-3.845485 c0,-2.466302 -0.070310,-4.938014 -0.183890,-7.377273 zm-155.393308,-11.731165 h-13.456494 v13.559257 c0,4.732489 -4.267352,8.567157 -8.999842,8.567157 c-4.727079,0 -8.999842,-3.834667 -8.999842,-8.567157 v-13.559257 h-12.185483 c-4.732489,0 -8.567157,-4.267352 -8.567157,-8.999842 c0,-4.727079 3.834667,-8.999842 8.567157,-8.999842 h12.185483 v-12.077311 c0,-4.732489 4.272762,-8.567157 8.999842,-8.567157 c4.732489,0 8.999842,3.834667 8.999842,8.567157 v12.077311 h13.456494 c4.727079,0 8.567157,4.272762 8.567157,8.999842 c0,4.732489 -3.840077,8.999842 -8.567157,8.999842 zm0,0`}),R.createElement(`path`,{fill:`currentColor`,d:`m187.695312 285.875c3.9375-3.980469 6.414063-9.449219 6.414063-15.523438 0-12.128906-9.855469-21.980468-21.984375-21.980468-6.007812 0-11.472656 2.410156-15.457031 6.347656-4.023438 4.003906-6.523438 9.539062-6.523438 15.636719 0 12.125 9.855469 21.980469 21.980469 21.980469 6.078125 0 11.585938-2.476563 15.570312-6.460938zm0 0`}))}function YU(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 650 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`m524,128l-192,0l-64,-64l-160,0c-26.51,0 -48,21.49 -48,48l0,288c0,26.51 21.49,48 48,48l416,0c26.51,0 48,-21.49 48,-48l0,-224c0,-26.51 -21.49,-48 -48,-48z`}))}function XU(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 650 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`m631.75617,292.093l-72.424,124.155a63.997,63.997 0 0 1 -55.281,31.752l-399.964,0c-18.523,0 -30.064,-20.093 -20.731,-36.093l72.424,-124.155a64,64 0 0 1 55.282,-31.752l399.964,0c18.523,0 30.064,20.093 20.73,36.093zm-420.694,-68.093l328,0l0,-48c0,-26.51 -21.49,-48 -48,-48l-160,0l-64,-64l-160,0c-26.51,0 -48,21.49 -48,48l0,278.046l69.077,-118.418c17.137,-29.378 48.912,-47.628 82.923,-47.628z`}))}function ZU(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`#EE3333`,d:`M256,0C114.844,0,0,114.844,0,256s114.844,256,256,256s256-114.844,256-256S397.156,0,256,0z M256,448 c-105.865,0-192-86.135-192-192c0-40.406,12.25-78.604,35.542-111.198l267.656,267.656C334.604,435.75,296.406,448,256,448z M412.458,367.198L144.802,99.542C177.396,76.25,215.594,64,256,64c105.865,0,192,86.135,192,192 C448,296.406,435.75,334.604,412.458,367.198z`}))}var QU=`react-inlinesvg`,$U={IDLE:`idle`,LOADING:`loading`,LOADED:`loaded`,FAILED:`failed`,READY:`ready`,UNSUPPORTED:`unsupported`};function eW(e){return e[Math.floor(Math.random()*e.length)]}function tW(){return!!(typeof window<`u`&&window.document?.createElement)}function nW(){return oW()&&typeof window<`u`&&window!==null}function rW(e,...t){let n={};for(let r in e)({}).hasOwnProperty.call(e,r)&&!t.includes(r)&&(n[r]=e[r]);return n}function iW(e){let t=``;for(let n=0;n<e;n++)t+=eW(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890`);return t}async function aW(e,t){let n=await fetch(e,t),[r]=(n.headers.get(`content-type`)??``).split(/ ?; ?/);if(n.status>299)throw Error(`Not found`);if(![`image/svg+xml`,`text/plain`].some(e=>r.includes(e)))throw Error(`Content type isn't valid: ${r}`);return n.text()}function oW(){if(!document)return!1;let e=document.createElement(`div`);e.innerHTML=`<svg />`;let t=e.firstChild;return!!t&&t.namespaceURI===`http://www.w3.org/2000/svg`}var sW=class{cacheApi;cacheStore;subscribers=[];isReady=!1;constructor(e={}){let{name:t=QU,persistent:n=!1}=e;this.cacheStore=new Map,n&&tW()&&`caches`in window?caches.open(t).then(e=>{this.cacheApi=e}).catch(e=>{console.error(`Failed to open cache: ${e.message}`),this.cacheApi=void 0}).finally(()=>{this.isReady=!0;let e=[...this.subscribers];this.subscribers.length=0,e.forEach(e=>{try{e()}catch(e){console.error(`Error in CacheStore subscriber callback: ${e.message}`)}})}):this.isReady=!0}onReady(e){return this.isReady?(e(),()=>{}):(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);t>=0&&this.subscribers.splice(t,1)})}waitForReady(){return this.isReady?Promise.resolve():new Promise(e=>{this.onReady(e)})}async get(e,t){return await this.fetchAndCache(e,t),this.cacheStore.get(e)?.content??``}getContent(e){return this.cacheStore.get(e)?.content??``}set(e,t){this.cacheStore.set(e,t)}isCached(e){return this.cacheStore.get(e)?.status===$U.LOADED}async fetchAndCache(e,t){this.isReady||await this.waitForReady();let n=this.cacheStore.get(e);if(n?.status!==$U.LOADED){if(n?.status===$U.LOADING){await this.handleLoading(e,t?.signal||void 0,async()=>{this.cacheStore.set(e,{content:``,status:$U.IDLE}),await this.fetchAndCache(e,t)});let n=this.cacheStore.get(e);if(n?.status===$U.FAILED){if(n.error)throw n.error;this.cacheStore.delete(e),await this.fetchAndCache(e,t)}return}this.cacheStore.set(e,{content:``,status:$U.LOADING});try{let n=this.cacheApi?await this.fetchFromPersistentCache(e,t):await aW(e,t);this.cacheStore.set(e,{content:n,status:$U.LOADED})}catch(t){let n=t?.name===`AbortError`;throw this.cacheStore.set(e,{content:``,error:n?void 0:t,status:$U.FAILED}),t}}}async fetchFromPersistentCache(e,t){let n=await this.cacheApi?.match(e);return n?n.text():(await this.cacheApi?.add(new Request(e,t)),await(await this.cacheApi?.match(e))?.text()??``)}async handleLoading(e,t,n){for(let n=0;n<10;n++){if(t?.aborted)throw t.reason instanceof Error?t.reason:new DOMException(`The operation was aborted.`,`AbortError`);if(this.cacheStore.get(e)?.status!==$U.LOADING)return;await cW(.1)}await n()}keys(){return[...this.cacheStore.keys()]}data(){return[...this.cacheStore.entries()].map(([e,t])=>({[e]:t}))}async delete(e){this.cacheApi&&await this.cacheApi.delete(e),this.cacheStore.delete(e)}async clear(){if(this.cacheApi){let e=await this.cacheApi.keys();await Promise.allSettled(e.map(e=>this.cacheApi.delete(e)))}this.cacheStore.clear()}};function cW(e=1){return new Promise(t=>{setTimeout(t,e*1e3)})}var lW=(0,R.createContext)(null);function uW(){return(0,R.useContext)(lW)}var dW=e=>typeof e==`string`?e.split(/ ?; ?/).reduce((e,t)=>{let[n,r]=t.split(/ ?: ?/).map((e,t)=>t===0?e.replace(/\s+/g,``):e.trim());if(n&&r){let t=n.replace(/(\w)-(\w)/g,(e,t,n)=>`${t}${n.toUpperCase()}`),i=r.trim();Number.isNaN(Number(r))||(i=Number(r)),e[n.startsWith(`-`)?n:t]=i}return e},{}):{};function fW(e=6){let t=``;for(let n=e;n>0;--n)t+=`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`[Math.round(Math.random()*61)];return t}var pW=[`br`,`col`,`colgroup`,`dl`,`hr`,`iframe`,`img`,`input`,`link`,`menuitem`,`meta`,`ol`,`param`,`select`,`table`,`tbody`,`tfoot`,`thead`,`tr`,`ul`,`wbr`],mW={"accept-charset":`acceptCharset`,acceptcharset:`acceptCharset`,accesskey:`accessKey`,allowfullscreen:`allowFullScreen`,autocapitalize:`autoCapitalize`,autocomplete:`autoComplete`,autocorrect:`autoCorrect`,autofocus:`autoFocus`,autoplay:`autoPlay`,autosave:`autoSave`,cellpadding:`cellPadding`,cellspacing:`cellSpacing`,charset:`charSet`,class:`className`,classid:`classID`,classname:`className`,colspan:`colSpan`,contenteditable:`contentEditable`,contextmenu:`contextMenu`,controlslist:`controlsList`,crossorigin:`crossOrigin`,dangerouslysetinnerhtml:`dangerouslySetInnerHTML`,datetime:`dateTime`,defaultchecked:`defaultChecked`,defaultvalue:`defaultValue`,enctype:`encType`,for:`htmlFor`,formmethod:`formMethod`,formaction:`formAction`,formenctype:`formEncType`,formnovalidate:`formNoValidate`,formtarget:`formTarget`,frameborder:`frameBorder`,hreflang:`hrefLang`,htmlfor:`htmlFor`,httpequiv:`httpEquiv`,"http-equiv":`httpEquiv`,icon:`icon`,innerhtml:`innerHTML`,inputmode:`inputMode`,itemid:`itemID`,itemprop:`itemProp`,itemref:`itemRef`,itemscope:`itemScope`,itemtype:`itemType`,keyparams:`keyParams`,keytype:`keyType`,marginwidth:`marginWidth`,marginheight:`marginHeight`,maxlength:`maxLength`,mediagroup:`mediaGroup`,minlength:`minLength`,nomodule:`noModule`,novalidate:`noValidate`,playsinline:`playsInline`,radiogroup:`radioGroup`,readonly:`readOnly`,referrerpolicy:`referrerPolicy`,rowspan:`rowSpan`,spellcheck:`spellCheck`,srcdoc:`srcDoc`,srclang:`srcLang`,srcset:`srcSet`,tabindex:`tabIndex`,typemustmatch:`typeMustMatch`,usemap:`useMap`,accentheight:`accentHeight`,"accent-height":`accentHeight`,alignmentbaseline:`alignmentBaseline`,"alignment-baseline":`alignmentBaseline`,allowreorder:`allowReorder`,arabicform:`arabicForm`,"arabic-form":`arabicForm`,attributename:`attributeName`,attributetype:`attributeType`,autoreverse:`autoReverse`,basefrequency:`baseFrequency`,baselineshift:`baselineShift`,"baseline-shift":`baselineShift`,baseprofile:`baseProfile`,calcmode:`calcMode`,capheight:`capHeight`,"cap-height":`capHeight`,clippath:`clipPath`,"clip-path":`clipPath`,clippathunits:`clipPathUnits`,cliprule:`clipRule`,"clip-rule":`clipRule`,colorinterpolation:`colorInterpolation`,"color-interpolation":`colorInterpolation`,colorinterpolationfilters:`colorInterpolationFilters`,"color-interpolation-filters":`colorInterpolationFilters`,colorprofile:`colorProfile`,"color-profile":`colorProfile`,colorrendering:`colorRendering`,"color-rendering":`colorRendering`,contentscripttype:`contentScriptType`,contentstyletype:`contentStyleType`,diffuseconstant:`diffuseConstant`,dominantbaseline:`dominantBaseline`,"dominant-baseline":`dominantBaseline`,edgemode:`edgeMode`,enablebackground:`enableBackground`,"enable-background":`enableBackground`,externalresourcesrequired:`externalResourcesRequired`,fillopacity:`fillOpacity`,"fill-opacity":`fillOpacity`,fillrule:`fillRule`,"fill-rule":`fillRule`,filterres:`filterRes`,filterunits:`filterUnits`,floodopacity:`floodOpacity`,"flood-opacity":`floodOpacity`,floodcolor:`floodColor`,"flood-color":`floodColor`,fontfamily:`fontFamily`,"font-family":`fontFamily`,fontsize:`fontSize`,"font-size":`fontSize`,fontsizeadjust:`fontSizeAdjust`,"font-size-adjust":`fontSizeAdjust`,fontstretch:`fontStretch`,"font-stretch":`fontStretch`,fontstyle:`fontStyle`,"font-style":`fontStyle`,fontvariant:`fontVariant`,"font-variant":`fontVariant`,fontweight:`fontWeight`,"font-weight":`fontWeight`,glyphname:`glyphName`,"glyph-name":`glyphName`,glyphorientationhorizontal:`glyphOrientationHorizontal`,"glyph-orientation-horizontal":`glyphOrientationHorizontal`,glyphorientationvertical:`glyphOrientationVertical`,"glyph-orientation-vertical":`glyphOrientationVertical`,glyphref:`glyphRef`,gradienttransform:`gradientTransform`,gradientunits:`gradientUnits`,horizadvx:`horizAdvX`,"horiz-adv-x":`horizAdvX`,horizoriginx:`horizOriginX`,"horiz-origin-x":`horizOriginX`,imagerendering:`imageRendering`,"image-rendering":`imageRendering`,kernelmatrix:`kernelMatrix`,kernelunitlength:`kernelUnitLength`,keypoints:`keyPoints`,keysplines:`keySplines`,keytimes:`keyTimes`,lengthadjust:`lengthAdjust`,letterspacing:`letterSpacing`,"letter-spacing":`letterSpacing`,lightingcolor:`lightingColor`,"lighting-color":`lightingColor`,limitingconeangle:`limitingConeAngle`,markerend:`markerEnd`,"marker-end":`markerEnd`,markerheight:`markerHeight`,markermid:`markerMid`,"marker-mid":`markerMid`,markerstart:`markerStart`,"marker-start":`markerStart`,markerunits:`markerUnits`,markerwidth:`markerWidth`,maskcontentunits:`maskContentUnits`,maskunits:`maskUnits`,numoctaves:`numOctaves`,overlineposition:`overlinePosition`,"overline-position":`overlinePosition`,overlinethickness:`overlineThickness`,"overline-thickness":`overlineThickness`,paintorder:`paintOrder`,"paint-order":`paintOrder`,"panose-1":`panose1`,pathlength:`pathLength`,patterncontentunits:`patternContentUnits`,patterntransform:`patternTransform`,patternunits:`patternUnits`,pointerevents:`pointerEvents`,"pointer-events":`pointerEvents`,pointsatx:`pointsAtX`,pointsaty:`pointsAtY`,pointsatz:`pointsAtZ`,preservealpha:`preserveAlpha`,preserveaspectratio:`preserveAspectRatio`,primitiveunits:`primitiveUnits`,refx:`refX`,refy:`refY`,renderingintent:`renderingIntent`,"rendering-intent":`renderingIntent`,repeatcount:`repeatCount`,repeatdur:`repeatDur`,requiredextensions:`requiredExtensions`,requiredfeatures:`requiredFeatures`,shaperendering:`shapeRendering`,"shape-rendering":`shapeRendering`,specularconstant:`specularConstant`,specularexponent:`specularExponent`,spreadmethod:`spreadMethod`,startoffset:`startOffset`,stddeviation:`stdDeviation`,stitchtiles:`stitchTiles`,stopcolor:`stopColor`,"stop-color":`stopColor`,stopopacity:`stopOpacity`,"stop-opacity":`stopOpacity`,strikethroughposition:`strikethroughPosition`,"strikethrough-position":`strikethroughPosition`,strikethroughthickness:`strikethroughThickness`,"strikethrough-thickness":`strikethroughThickness`,strokedasharray:`strokeDasharray`,"stroke-dasharray":`strokeDasharray`,strokedashoffset:`strokeDashoffset`,"stroke-dashoffset":`strokeDashoffset`,strokelinecap:`strokeLinecap`,"stroke-linecap":`strokeLinecap`,strokelinejoin:`strokeLinejoin`,"stroke-linejoin":`strokeLinejoin`,strokemiterlimit:`strokeMiterlimit`,"stroke-miterlimit":`strokeMiterlimit`,strokewidth:`strokeWidth`,"stroke-width":`strokeWidth`,strokeopacity:`strokeOpacity`,"stroke-opacity":`strokeOpacity`,suppresscontenteditablewarning:`suppressContentEditableWarning`,suppresshydrationwarning:`suppressHydrationWarning`,surfacescale:`surfaceScale`,systemlanguage:`systemLanguage`,tablevalues:`tableValues`,targetx:`targetX`,targety:`targetY`,textanchor:`textAnchor`,"text-anchor":`textAnchor`,textdecoration:`textDecoration`,"text-decoration":`textDecoration`,textlength:`textLength`,textrendering:`textRendering`,"text-rendering":`textRendering`,underlineposition:`underlinePosition`,"underline-position":`underlinePosition`,underlinethickness:`underlineThickness`,"underline-thickness":`underlineThickness`,unicodebidi:`unicodeBidi`,"unicode-bidi":`unicodeBidi`,unicoderange:`unicodeRange`,"unicode-range":`unicodeRange`,unitsperem:`unitsPerEm`,"units-per-em":`unitsPerEm`,unselectable:`unselectable`,valphabetic:`vAlphabetic`,"v-alphabetic":`vAlphabetic`,vectoreffect:`vectorEffect`,"vector-effect":`vectorEffect`,vertadvy:`vertAdvY`,"vert-adv-y":`vertAdvY`,vertoriginx:`vertOriginX`,"vert-origin-x":`vertOriginX`,vertoriginy:`vertOriginY`,"vert-origin-y":`vertOriginY`,vhanging:`vHanging`,"v-hanging":`vHanging`,videographic:`vIdeographic`,"v-ideographic":`vIdeographic`,viewbox:`viewBox`,viewtarget:`viewTarget`,vmathematical:`vMathematical`,"v-mathematical":`vMathematical`,wordspacing:`wordSpacing`,"word-spacing":`wordSpacing`,writingmode:`writingMode`,"writing-mode":`writingMode`,xchannelselector:`xChannelSelector`,xheight:`xHeight`,"x-height":`xHeight`,xlinkactuate:`xlinkActuate`,"xlink:actuate":`xlinkActuate`,xlinkarcrole:`xlinkArcrole`,"xlink:arcrole":`xlinkArcrole`,xlinkhref:`xlinkHref`,"xlink:href":`xlinkHref`,xlinkrole:`xlinkRole`,"xlink:role":`xlinkRole`,xlinkshow:`xlinkShow`,"xlink:show":`xlinkShow`,xlinktitle:`xlinkTitle`,"xlink:title":`xlinkTitle`,xlinktype:`xlinkType`,"xlink:type":`xlinkType`,xmlbase:`xmlBase`,"xml:base":`xmlBase`,xmllang:`xmlLang`,"xml:lang":`xmlLang`,"xml:space":`xmlSpace`,xmlnsxlink:`xmlnsXlink`,"xmlns:xlink":`xmlnsXlink`,xmlspace:`xmlSpace`,ychannelselector:`yChannelSelector`,zoomandpan:`zoomAndPan`,onblur:`onBlur`,onchange:`onChange`,onclick:`onClick`,oncontextmenu:`onContextMenu`,ondoubleclick:`onDoubleClick`,ondrag:`onDrag`,ondragend:`onDragEnd`,ondragenter:`onDragEnter`,ondragexit:`onDragExit`,ondragleave:`onDragLeave`,ondragover:`onDragOver`,ondragstart:`onDragStart`,ondrop:`onDrop`,onerror:`onError`,onfocus:`onFocus`,oninput:`onInput`,oninvalid:`onInvalid`,onkeydown:`onKeyDown`,onkeypress:`onKeyPress`,onkeyup:`onKeyUp`,onload:`onLoad`,onmousedown:`onMouseDown`,onmouseenter:`onMouseEnter`,onmouseleave:`onMouseLeave`,onmousemove:`onMouseMove`,onmouseout:`onMouseOut`,onmouseover:`onMouseOver`,onmouseup:`onMouseUp`,onscroll:`onScroll`,onsubmit:`onSubmit`,ontouchcancel:`onTouchCancel`,ontouchend:`onTouchEnd`,ontouchmove:`onTouchMove`,ontouchstart:`onTouchStart`,onwheel:`onWheel`};function hW(e,t){let{key:n,level:r,...i}=t;switch(e.nodeType){case 1:return R.createElement(vW(e.nodeName),gW(e,n),_W(e.childNodes,r,i));case 3:{let t=e.nodeValue?.toString()??``;if(!i.allowWhiteSpaces&&/^\s+$/.test(t)&&!/[\u00A0\u202F]/.test(t))return null;if(!e.parentNode)return t;let n=e.parentNode.nodeName.toLowerCase();return pW.includes(n)?(/\S/.test(t)&&console.warn(`A textNode is not allowed inside '${n}'. Your text "${t}" will be ignored`),null):t}case 8:return null;case 11:return _W(e.childNodes,r,t);default:return null}}function gW(e,t){let n={key:t};if(e instanceof Element){let t=e.getAttribute(`class`);t&&(n.className=t),[...e.attributes].forEach(e=>{switch(e.name){case`class`:break;case`style`:n[e.name]=dW(e.value);break;case`allowfullscreen`:case`allowpaymentrequest`:case`async`:case`autofocus`:case`autoplay`:case`checked`:case`controls`:case`default`:case`defer`:case`disabled`:case`formnovalidate`:case`hidden`:case`ismap`:case`itemscope`:case`loop`:case`multiple`:case`muted`:case`nomodule`:case`novalidate`:case`open`:case`readonly`:case`required`:case`reversed`:case`selected`:case`typemustmatch`:n[mW[e.name]||e.name]=!0;break;default:n[mW[e.name]||e.name]=e.value}})}return n}function _W(e,t,n){let r=[...e].map((e,r)=>bW(e,{...n,index:r,level:t+1})).filter(Boolean);return r.length?r:null}function vW(e){return/[a-z]+[A-Z]+[a-z]+/.test(e)?e:e.toLowerCase()}function yW(e,t={}){return typeof e==`string`?xW(e,t):e instanceof Node?bW(e,t):null}function bW(e,t={}){if(!e||!(e instanceof Node))return null;let{actions:n=[],index:r=0,level:i=0,randomKey:a}=t,o=e,s=`${i}-${r}`,c=[];return a&&i===0&&(s=`${fW()}-${s}`),Array.isArray(n)&&n.forEach(t=>{t.condition(o,s,i)&&(typeof t.pre==`function`&&(o=t.pre(o,s,i),o instanceof Node||(o=e)),typeof t.post==`function`&&c.push(t.post(o,s,i)))}),c.length?c:hW(o,{key:s,level:i,...t})}function xW(e,t={}){if(!e||typeof e!=`string`)return null;let{includeAllNodes:n=!1,nodeOnly:r=!1,selector:i=`body > *`,type:a=`text/html`}=t;try{let o=new DOMParser().parseFromString(e,a);if(n){let{childNodes:e}=o.body;return r?e:[...e].map(e=>bW(e,t))}let s=o.querySelector(i)||o.body.childNodes[0];if(!(s instanceof Node))throw TypeError(`Error parsing input`);return r?s:bW(s,t)}catch{}return null}function SW(e){(0,R.useEffect)(e,[])}function CW(e){let t=(0,R.useRef)(void 0);return(0,R.useEffect)(()=>{t.current=e}),t.current}function wW(e,t,n){let r=e.matchAll(/\bid=(["'])([^"']+)\1/g),i=[...new Set([...r].map(e=>e[2]))];return i.length?(i.sort((e,t)=>t.length-e.length),e.replace(/<style[^>]*>([\S\s]*?)<\/style>/gi,(e,r)=>{let a=r;for(let e of i){let r=e.replace(/[$()*+.?[\\\]^{|}]/g,`\\$&`);a=a.replace(RegExp(`url\\((['"]?)#${r}\\1\\)`,`g`),`url($1${n}#${e}__${t}$1)`),a=a.replace(RegExp(`#${r}(?![a-zA-Z0-9_-])`,`g`),`#${e}__${t}`)}return e.replace(r,a)})):e}function TW(e){let{baseURL:t,content:n,description:r,handleError:i,hash:a,preProcessor:o,title:s,uniquifyIDs:c=!1}=e;try{let e=o?o(n):n;c&&(e=wW(e,a,t??``));let i=yW(e,{nodeOnly:!0});if(!i||!(i instanceof SVGSVGElement))throw Error(`Could not convert the src to a DOM Node`);let l=EW(i,{baseURL:t,hash:a,uniquifyIDs:c});if(r){let e=l.querySelector(`desc`);e?.parentNode&&e.parentNode.removeChild(e);let t=document.createElementNS(`http://www.w3.org/2000/svg`,`desc`);t.innerHTML=r,l.prepend(t)}if(s!==void 0){let e=l.querySelector(`title`);if(e?.parentNode&&e.parentNode.removeChild(e),s){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`title`);e.innerHTML=s,l.prepend(e)}}return l}catch(e){return i(e)}}function EW(e,t){let{baseURL:n=``,hash:r,uniquifyIDs:i}=t,a=[`id`,`href`,`xlink:href`,`xlink:role`,`xlink:arcrole`],o=[`href`,`xlink:href`],s=(e,t)=>o.includes(e)&&(t?!t.includes(`#`):!1);return i&&[...e.children].forEach(e=>{if(e.attributes?.length){let t=Object.values(e.attributes).map(e=>{let t=e,i=/url\((.*?)\)/.exec(e.value);return i?.[1]&&(t.value=e.value.replace(i[0],`url(${n}${i[1]}__${r})`)),t});a.forEach(e=>{let n=t.find(t=>t.name===e);n&&!s(e,n.value)&&(n.value=`${n.value}__${r}`)})}return e.children.length?EW(e,t):e}),e}function DW(e,t){let{baseURL:n,cacheRequests:r=!0,description:i,fetchOptions:a,onError:o,onLoad:s,preProcessor:c,src:l,title:u,uniqueHash:d,uniquifyIDs:f}=e,p=(0,R.useRef)(d??iW(8)),m=(0,R.useRef)(a),h=(0,R.useRef)(o),g=(0,R.useRef)(s),_=(0,R.useRef)(c);m.current=a,h.current=o,g.current=s,_.current=c;let[v,y]=(0,R.useReducer)((e,t)=>({...e,...t}),{content:``,element:null,isCached:!1,status:$U.IDLE},n=>{if(!(r&&t.isCached(l)))return n;let i=t.getContent(l);try{let t=TW({...e,handleError:()=>{},hash:p.current,content:i});if(!t)return{...n,content:i,isCached:!0,status:$U.LOADED};let r=yW(t);if(r&&(0,R.isValidElement)(r))return{content:i,element:r,isCached:!0,status:$U.READY}}catch{}return{...n,content:i,isCached:!0,status:$U.LOADED}}),{content:b,element:x,isCached:S,status:C}=v,w=CW(e),T=CW(v),E=(0,R.useRef)(!1),D=(0,R.useRef)(!1),O=(0,R.useCallback)(e=>{E.current&&(y({status:e.message===`Browser does not support SVG`?$U.UNSUPPORTED:$U.FAILED}),h.current?.(e))},[]),k=(0,R.useCallback)(()=>{try{let e=yW(TW({baseURL:n,content:b,description:i,handleError:O,hash:p.current,preProcessor:_.current,src:l,title:u,uniquifyIDs:f}));if(!e||!(0,R.isValidElement)(e))throw Error(`Could not convert the src to a React element`);y({element:e,status:$U.READY})}catch(e){O(e)}},[n,b,i,O,l,u,f]);return SW(()=>{if(E.current=!0,!(!tW()||D.current)){try{if(C===$U.READY)g.current?.(l,S);else if(C===$U.IDLE){if(!nW())throw Error(`Browser does not support SVG`);if(!l)throw Error(`Missing src`);y({content:``,element:null,isCached:!1,status:$U.LOADING})}}catch(e){O(e)}return D.current=!0,()=>{E.current=!1}}}),(0,R.useEffect)(()=>{if(!(!tW()||!w)&&w.src!==l){if(!l){O(Error(`Missing src`));return}y({content:``,element:null,isCached:!1,status:$U.LOADING})}},[O,w,l]),(0,R.useEffect)(()=>{if(C!==$U.LOADING)return;let e=new AbortController,n=!0;return(async()=>{try{let i=/^data:image\/svg[^,]*?(;base64)?,(.*)/.exec(l),a;if(i?a=i[1]?window.atob(i[2]):decodeURIComponent(i[2]):l.includes(`<svg`)&&(a=l),a){n&&y({content:a,isCached:!1,status:$U.LOADED});return}let o={...m.current,signal:e.signal},s,c=!1;r?(c=t.isCached(l),s=await t.get(l,o)):s=await aW(l,o),n&&y({content:s,isCached:c,status:$U.LOADED})}catch(e){n&&e.name!==`AbortError`&&O(e)}})(),()=>{n=!1,e.abort()}},[r,t,O,l,C]),(0,R.useEffect)(()=>{C===$U.LOADED&&b&&k()},[b,k,C]),(0,R.useEffect)(()=>{!tW()||!w||w.src!==l||(w.title!==u||w.description!==i)&&k()},[i,k,w,l,u]),(0,R.useEffect)(()=>{T&&C===$U.READY&&T.status!==$U.READY&&g.current?.(l,S)},[S,T,l,C]),{element:x,status:C}}var OW=new sW;function kW(e){let{children:t=null,innerRef:n,loader:r=null}=e,{element:i,status:a}=DW(e,uW()??OW);return tW()?i?(0,R.cloneElement)(i,{ref:n,...rW(e,`baseURL`,`cacheRequests`,`children`,`description`,`fetchOptions`,`innerRef`,`loader`,`onError`,`onLoad`,`preProcessor`,`src`,`title`,`uniqueHash`,`uniquifyIDs`)}):[$U.UNSUPPORTED,$U.FAILED].includes(a)?t:r:r}var AW=window.location.hostname.endsWith(`iobroker.in`),jW=window.location.pathname.substring(0,window.location.pathname.lastIndexOf(`/`)+1),MW=R.forwardRef(function(e,t){if(e.src){if(typeof e.src==`string`){if(e.src.length<3)return e.sx?R.createElement(_x,{component:`span`,sx:e.sx,ref:t,title:e.title||void 0,style:{height:27,marginTop:-8,...e.styleUTF8||e.style},className:e.className?`iconOwn ${e.className}`:`iconOwn`},e.src):R.createElement(`span`,{ref:t,title:e.title||void 0,style:{height:27,marginTop:-8,...e.styleUTF8||e.style},className:e.className?`iconOwn ${e.className}`:`iconOwn`},e.src);if(e.src.startsWith(`data:image/svg`))return R.createElement(kW,{title:e.title||void 0,src:e.src,className:e.className?`iconOwn ${e.className}`:`iconOwn`,width:e.style?.width||28,height:e.style?.height||e.style?.width||28,style:e.style||void 0});if(AW&&!e.src.startsWith(`http://`)&&!e.src.startsWith(`https://`)){let n=e.src;return n.startsWith(`./`)?n=jW+n.substring(2):n.startsWith(`/`)||(n=jW+n),e.sx?R.createElement(_x,{component:`img`,sx:e.sx,title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:`https://remote-files.iobroker.in${n}`,alt:e.alt||void 0,ref:t,onError:t=>e.onError?.(t)}):R.createElement(`img`,{title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:`https://remote-files.iobroker.in${n}`,alt:e.alt||void 0,ref:t,onError:t=>e.onError?.(t)})}return e.sx?R.createElement(_x,{component:`img`,sx:e.sx,title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:e.src,alt:e.alt||void 0,ref:t,onError:e.onError}):R.createElement(`img`,{title:e.title||void 0,style:e.style||void 0,className:e.className?`iconOwn ${e.className}`:`iconOwn`,src:e.src,alt:e.alt||void 0,ref:t,onError:e.onError})}return e.src}return null});MW.displayName=`Icon`;var NW={dialog:{height:`100%`},paper:{height:`calc(100% - 64px)`},content:{textAlign:`center`},textarea:{width:`100%`,height:`100%`},img:{width:`auto`,height:`calc(100% - 5px)`,objectFit:`contain`},dialogTitle:{justifyContent:`space-between`,display:`flex`}},PW={images:[`png`,`jpg`,`svg`,`jpeg`,`bmp`,`gif`,`apng`,`avif`,`webp`,`ico`],code:[`js`,`json`,`json5`,`md`],txt:[`log`,`txt`,`html`,`css`,`xml`,`ics`,`csv`],audio:[`mp3`,`wav`,`ogg`,`acc`],video:[`mp4`,`mov`,`avi`]};function FW(e,t){let n=``,r=new Uint8Array(e?.data||e),i=r.byteLength;for(let e=0;e<i&&(t||e<50);e++)n+=String.fromCharCode(r[e]);return window.btoa(n)}var IW=class extends R.Component{timeout=null;constructor(e){super(e);let t=X.getFileExtension(e.href);this.state={text:null,code:null,ext:t,editing:!1,editingValue:null,copyPossible:!!t&&(PW.code.includes(t)||PW.txt.includes(t)),forceUpdate:Date.now(),changed:!1,imgError:!1}}readFile(){if(this.props.href){let e=this.props.href.split(`/`);e.splice(0,2);let t=e[0],n=e.splice(1).join(`/`);this.props.socket.readFile(t,n).then(e=>{let t=``;e.file!==void 0&&(t=e.file);let r={copyPossible:this.state.copyPossible,ext:this.state.ext};if(t.type===`Buffer`)if(n.toLowerCase().endsWith(`.json5`)){r.ext=`json5`,r.copyPossible=!0;try{t=atob(FW(t,!0))}catch{console.error(`Cannot convert base64 to string`),t=``}}else{let e=X.detectMimeType(FW(t));e&&(r.ext=e,r.copyPossible=PW.code.includes(e)||PW.txt.includes(e))}r.copyPossible&&(r.ext&&PW.txt.includes(r.ext)?(r.text=t,r.editingValue=t):r.ext&&PW.code.includes(r.ext)&&(r.code=t,r.editingValue=t)),this.setState(r)}).catch(e=>window.alert(`Cannot read file: ${e}`))}}componentDidMount(){this.readFile();let e=this.props.href.split(`/`);e.splice(0,2);let t=e[0],n=e.splice(1).join(`/`);this.props.supportSubscribes&&this.props.socket.subscribeFiles(t,n,this.onFileChanged).catch(e=>window.alert(`Cannot subscribe on file: ${e}`))}componentWillUnmount(){this.timeout&&=(clearTimeout(this.timeout),null);let e=this.props.href.split(`/`);e.splice(0,2);let t=e[0],n=e.splice(1).join(`/`);this.props.supportSubscribes&&this.props.socket.unsubscribeFiles(t,n,this.onFileChanged)}onFileChanged=(e,t,n)=>{this.state.changed||(this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(()=>{this.timeout=null,n===null?window.alert(`Show file was deleted!`):this.state.text!==null||this.state.code!==null?this.readFile():this.setState({forceUpdate:Date.now()})},300))};getEditorOrViewer(){return R.createElement(mO,{variant:`standard`,style:NW.textarea,multiline:!0,value:this.state.editingValue||this.state.code||this.state.text,slotProps:{htmlInput:{readOnly:!this.state.editing}}})}getContent(){return this.state.ext&&PW.images.includes(this.state.ext)?this.state.imgError?R.createElement(ZU,{style:{...NW.img,...this.props.getStyleBackgroundImage()}}):R.createElement(MW,{onError:e=>{e.target.onerror=null,this.setState({imgError:!0})},style:{...NW.img,...this.props.getStyleBackgroundImage()},src:`${this.props.href}?ts=${this.state.forceUpdate}`,alt:this.props.href}):this.state.ext&&PW.audio.includes(this.state.ext)?R.createElement(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`}},R.createElement(`audio`,{style:{width:`100%`},src:this.props.href,controls:!0})):this.state.ext&&PW.video.includes(this.state.ext)?R.createElement(`div`,{style:{width:`100%`,height:`100%`,display:`flex`,justifyContent:`center`,alignItems:`center`}},R.createElement(`video`,{style:{width:`100%`,height:`100%`},controls:!0},R.createElement(`source`,{src:this.props.href,type:`video/${this.state.ext}`}))):this.state.code!==null||this.state.text!==null||this.state.editing?this.getEditorOrViewer():null}onSave(){}render(){return R.createElement(rC,{sx:{"&.MuiDialog-scrollPaper":NW.dialog,"& .MuiDialog-paper":NW.paper},scroll:`paper`,open:!!this.props.href,onClose:()=>this.props.onClose(),fullWidth:!0,maxWidth:`xl`,"aria-labelledby":`ar_dialog_file_view_title`},R.createElement(`div`,{style:NW.dialogTitle},R.createElement(bC,{id:`ar_dialog_file_view_title`},`${this.props.t(this.state.editing?`Edit`:`View`)}: ${this.props.href}`),this.state.ext&&PW.images.includes(this.state.ext)&&R.createElement(`div`,null,R.createElement(uv,{size:`large`,color:`inherit`,onClick:this.props.setStateBackgroundImage},R.createElement(CO,null)))),R.createElement(pC,{style:NW.content},this.getContent()),R.createElement(sC,null,this.state.copyPossible?R.createElement(Vx,{color:`grey`,onClick:e=>{e.stopPropagation(),e.preventDefault(),X.copyToClipboard(this.state.text||this.state.code||``)},startIcon:R.createElement(AO,null)},this.props.t(`Copy content`)):null,this.state.editing?R.createElement(Vx,{color:`grey`,disabled:this.state.editingValue===this.state.code||this.state.editingValue===this.state.text,variant:`contained`,onClick:()=>this.onSave(),startIcon:R.createElement(ak,null)},this.props.t(`Save`)):null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.props.onClose(),color:`primary`,startIcon:R.createElement(DO,null)},this.props.t(`Close`))))}},LW=GU()(IW),RW=32,zW=32,BW=120,VW=64,HW=`Not found`,UW={all:qO,images:GO,code:OO,txt:HO,audio:vO,video:hk},Q={root:{width:`100%`,overflow:`hidden`,height:`100%`,position:`relative`},filesDiv:{width:`calc(100% - 8px)`,overflowX:`hidden`,overflowY:`auto`,padding:8},filesDivHint:{position:`absolute`,bottom:0,left:20,opacity:.7,fontStyle:`italic`,fontSize:12},filesDivTable:{height:`calc(100% - 56px)`},filesDivTile:{height:`calc(100% - 104px)`,display:`flex`,alignContent:`flex-start`,alignItems:`stretch`,flexWrap:`wrap`,flex:`0 0 ${VW}px`},itemTile:e=>({position:`relative`,userSelect:`none`,cursor:`pointer`,height:BW,width:VW,display:`inline-block`,textAlign:`center`,opacity:.1,transition:`opacity 1s`,margin:`4px`,borderRadius:`4px`,"&:hover":{background:e.palette.secondary.light,color:X.invertColor(e.palette.secondary.main,!0)}}),itemNameFolderTile:{fontWeight:`bold`},itemNameTile:{width:`100%`,height:32,overflow:`hidden`,textOverflow:`ellipsis`,fontSize:12,textAlign:`center`,wordBreak:`break-all`},itemFolderIconTile:e=>({width:`100%`,height:BW-32-16-8,display:`block`,pl:1,color:e.palette.secondary.main||`#fbff7d`}),itemFolderIconBack:e=>({position:`absolute`,top:22,left:18,zIndex:1,color:(e.palette.mode,`#FFF`)}),itemSizeTile:{width:`100%`,height:16,textAlign:`center`,fontSize:10},itemImageTile:{width:`calc(100% - 8px)`,height:BW-32-16-8,margin:4,display:`block`,textAlign:`center`,objectFit:`contain`},itemIconTile:{width:`100%`,height:BW-32-16-8,display:`block`,objectFit:`contain`},itemSelected:e=>({background:e.palette.primary.main,color:X.invertColor(e.palette.primary.main,!0)}),itemTable:e=>({userSelect:`none`,cursor:`pointer`,height:RW,display:`inline-flex`,lineHeight:`${RW}px`,"&:hover":{background:e.palette.secondary.light,color:X.invertColor(e.palette.secondary.main,!0)}}),itemNameTable:{display:`inline-block`,pl:`10px`,fontSize:`1rem`,verticalAlign:`top`,flexGrow:1,textOverflow:`ellipsis`,whiteSpace:`nowrap`,overflow:`hidden`,"@media screen and (max-width: 500px)":{textAlign:`end`,direction:`rtl`}},itemNameFolderTable:{fontWeight:`bold`},itemSizeTable:{display:`inline-block`,width:60,verticalAlign:`top`,textAlign:`right`,whiteSpace:`nowrap`},itemAccessTable:{verticalAlign:`top`,width:60,textAlign:`right`,paddingRight:5,display:`flex`,justifyContent:`center`},itemImageTable:{display:`inline-block`,width:30,marginTop:1,objectFit:`contain`,maxHeight:30},itemNoImageTable:{marginTop:6},itemIconTable:{display:`inline-block`,marginTop:1,width:30,height:30},itemFolderTable:{},itemFolderTemp:{opacity:.4},itemFolderIconTable:e=>({marginTop:`1px`,marginLeft:`8px`,display:`inline-block`,width:30,height:30,color:e.palette.secondary.main||`#fbff7d`}),itemDownloadButtonTable:e=>({display:`inline-block`,width:zW,height:RW,minWidth:zW,verticalAlign:`middle`,textAlign:`center`,padding:0,borderRadius:`${zW/2}px`,"&:hover":{backgroundColor:e.palette.mode===`dark`?`rgba(255, 255, 255, 0.08)`:`rgba(0, 0, 0, 0.08)`},"& span":{pt:`9px`},"& svg":{width:14,height:14,fontSize:`1rem`,mt:`-3px`,verticalAlign:`middle`,color:e.palette.mode===`dark`?`#EEE`:`#111`}}),itemDownloadEmptyTable:{display:`inline-block`,width:zW,height:RW,minWidth:zW,padding:0},itemAclButtonTable:{width:zW,height:RW,minWidth:zW,verticalAlign:`top`,padding:0,fontSize:12,display:`flex`},itemDeleteButtonTable:{display:`inline-block`,width:zW,height:RW,minWidth:zW,verticalAlign:`top`,padding:0,"& svg":{width:18,height:18,fontSize:`1.5rem`}},uploadDiv:{top:0,zIndex:1,bottom:0,left:0,right:0,position:`absolute`,opacity:.9,textAlign:`center`,background:`#FFFFFF`},uploadDivDragging:{opacity:1},uploadCenterDiv:e=>({m:`20px`,border:`3px dashed grey`,borderRadius:`30px`,width:`calc(100% - 40px)`,height:`calc(100% - 40px)`,position:`relative`,color:e.palette.mode===`dark`?`#222`:`#CCC`,display:`flex`,alignItems:`center`,justifyContent:`center`}),uploadCenterIcon:{width:`25%`,height:`25%`},uploadCenterText:{fontSize:24,fontWeight:`bold`},uploadCloseButton:{zIndex:2,position:`absolute`,top:30,right:30},uploadCenterTextAndIcon:{position:`absolute`,height:`30%`,width:`100%`,margin:`auto`,opacity:.3},menuButtonExpertActive:{color:`#c00000`},menuButtonRestrictActive:{color:`#c05000`},pathDiv:e=>({display:`flex`,width:`calc(100% - 16px)`,ml:1,mr:1,textOverflow:`clip`,overflow:`hidden`,whiteSpace:`nowrap`,backgroundColor:e.palette.secondary.main,color:e.palette.secondary.contrastText,borderRadius:`4px 4px 0 0`}),pathDivInput:{width:`100%`},pathDivBreadcrumbDir:e=>({pl:`2px`,pr:`2px`,cursor:`pointer`,color:`white`,"&:hover":{backgroundColor:e.palette.primary.main,color:e.palette.primary.contrastText}}),pathDivBreadcrumbSelected:{color:`#FFF`},backgroundImageLight:{background:`white`},backgroundImageDark:{background:`black`},backgroundImageColored:{background:`silver`},specialFolder:e=>({color:e.palette.mode===`dark`?`#229b0f`:`#5dd300`}),tooltip:{pointerEvents:`none`}},WW=`0_userdata.0`;function GW(e){let t=(e||``).split(`/`);return t.length&&t.pop(),t.join(`/`)}function KW(e){let t=X.getFileExtension(e);return!!(t?.toLowerCase().match(/[a-z]+/)&&t.length<5)}var qW=`Table`,JW=`Tile`;function YW(e,t){return e.folder&&t.folder?e.name>t.name?1:e.name<t.name?-1:0:e.folder?-1:t.folder||e.name>t.name?1:e.name<t.name?-1:0}var XW=class e extends R.Component{imagePrefix;levelPadding;mounted;suppressDeleteConfirm;browseList;browseListRunning;initialReadFinished;supportSubscribes;_tempTimeout;limitToObjectID=null;limitToPath=null;lastSelect=null;lastNav=null;applyingNav=!1;setOpacityTimer=null;cacheFoldersTimeout=null;foldersLoading=null;cacheFolders=null;localStorage;scrollPositions={};refFileDiv;constructor(e){super(e),this.localStorage=window._localStorage||window.localStorage;let t=this.localStorage.getItem(`files.expanded`)||`[]`;if(this.refFileDiv=R.createRef(),this.props.limitPath){let e=this.props.limitPath.split(`/`);this.limitToObjectID=e[0],this.limitToPath=e.length?e.length===1&&e[0]===``?null:e.join(`/`):null,this.limitToPath&&this.limitToPath.endsWith(`/`)&&this.limitToPath.substring(0,this.limitToPath.length-1)}let n;try{n=JSON.parse(t),this.limitToPath&&(n=n.filter(e=>e.startsWith(`${this.limitToPath}/`)||e===this.limitToPath||this.limitToPath?.startsWith(`${e}/`)))}catch{n=[]}let r;r=this.props.showViewTypeButton&&this.localStorage.getItem(`files.viewType`)||qW;let i=this.props.selected||this.localStorage.getItem(`files.selected`)||WW,a;if(e.restrictToFolder){i=e.restrictToFolder,a=e.restrictToFolder;let t=e.restrictToFolder.split(`/`);n=[];let r=``;for(let e=0;e<t.length;e++)r+=(r?`/`:``)+t[e],n.push(r)}else Array.isArray(i)&&(i=i[0]),a=KW(i)?GW(i):i;let o=this.localStorage.getItem(`files.backgroundImage`)||null;this.state={viewType:r,folders:{},filterEmpty:this.localStorage.getItem(`files.empty`)!==`false`,expanded:n,currentDir:a,expertMode:!!e.expertMode,addFolder:!1,uploadFile:!1,deleteItem:``,viewer:``,formatEditFile:``,path:i,selected:i,errorText:``,modalEditOfAccess:!1,backgroundImage:o,queueLength:0,loadAllFolders:!1,fileErrors:[],filterByType:e.filterByType||window.localStorage.getItem(`files.filterByType`)||``,showTypesMenu:null,restrictToFolder:e.restrictToFolder||``,pathFocus:!1,suppressDeleteConfirm:!1},this.imagePrefix=this.props.imagePrefix||`./files/`,this.levelPadding=this.props.levelPadding||20,this.mounted=!0,this.suppressDeleteConfirm=0,this.browseList=[],this.browseListRunning=!1,this.initialReadFinished=!1,this.supportSubscribes=null,this._tempTimeout={}}static getDerivedStateFromProps(e,t){return e.expertMode!==void 0&&e.expertMode!==t.expertMode?{expertMode:e.expertMode,loadAllFolders:!0}:null}async loadFolders(){this.initialReadFinished=!1;let e=await this.browseFolder(`/`);this.state.viewType===qW?e=await this.browseFolders([...this.state.expanded],e):this.state.currentDir&&this.state.currentDir!==`/`&&(!this.limitToObjectID||this.state.currentDir.startsWith(this.limitToObjectID))&&(e=await this.browseFolder(this.state.currentDir,e)),this.setState({folders:e},()=>{if(this.state.viewType===qW&&!this.findItem(this.state.selected)){let e=this.state.selected.split(`/`);for(;e.length&&!this.findItem(e.join(`/`));)e.pop();let t;t=e.length?e.join(`/`):WW,this.setState({selected:t,path:t,pathFocus:!1},()=>this.scrollToSelected())}else this.scrollToSelected();this.initialReadFinished=!0})}scrollToSelected(){this.mounted&&document.getElementById(this.state.selected)?.scrollIntoView()}async componentDidMount(){this.mounted=!0,this.loadFolders().then(()=>this.applyInitialNavigateTo()).catch(e=>console.error(`Cannot load folders: ${e}`)),this.browseList=[],this.browseListRunning=!1,this.supportSubscribes=await this.props.socket.checkFeatureSupported(`BINARY_STATE_EVENT`),this.supportSubscribes&&await this.props.socket.subscribeFiles(`*`,`*`,this.onFileChange)}componentWillUnmount(){this.supportSubscribes&&this.props.socket.unsubscribeFiles(`*`,`*`,this.onFileChange),this.mounted=!1,this.browseList=null,this.browseListRunning=!1,Object.values(this._tempTimeout).forEach(e=>{e&&clearTimeout(e)}),this._tempTimeout={}}browseFoldersCb(e,t,n){if(!e?.length)n(t);else{let r=e.shift();r?this.browseFolder(r,t).catch(e=>console.error(`Cannot read folder ${r}: ${e.message}`)).then(()=>{setTimeout(()=>this.browseFoldersCb(e,t,n),0)}):setTimeout(()=>this.browseFoldersCb(e,t,n),0)}}browseFolders(e,t){let n;return t?n=t:(n={},Object.keys(this.state.folders).forEach(e=>n[e]=this.state.folders[e])),e?.length?new Promise(t=>{this.browseFoldersCb(e,n,t)}):Promise.resolve(n)}readDirSerial(e,t){return new Promise((n,r)=>{this.browseList&&(this.browseList.push({resolve:n,reject:r,adapter:e,relPath:t}),this.browseListRunning||this.processBrowseList())})}processBrowseList(e=0){!this.browseListRunning&&this.browseList&&this.browseList.length&&(this.browseListRunning=!0,this.browseList.length>10&&this.browseList.length%10||this.setState({queueLength:this.browseList.length}),this.browseList[0].processing=!0,this.props.socket.readDir(this.browseList[0].adapter,this.browseList[0].relPath||``).then(t=>{if(this.browseList){let n=this.browseList.shift();if(n){let r=n.resolve;n.resolve=null,n.reject=null,n.adapter=null,n.relPath=null,r&&r(t),this.browseListRunning=!1,this.browseList.length?e<5?this.processBrowseList(e+1):setTimeout(()=>this.processBrowseList(0),0):this.setState({queueLength:0})}else this.setState({queueLength:0})}}).catch(t=>{if(this.browseList){let n=this.browseList.shift();if(n){let r=n.reject;n.resolve=null,n.reject=null,n.adapter=null,n.relPath=null,r&&r(t),this.browseListRunning=!1,this.browseList.length?e<5?this.processBrowseList(e+1):setTimeout(()=>this.processBrowseList(0),0):this.setState({queueLength:0})}else this.setState({queueLength:0})}}))}async browseFolder(e,t,n,r){let i;if(t?i=t:(i={},Object.keys(this.state.folders).forEach(e=>{i[e]=this.state.folders[e]})),i[e]&&!r)return n?Promise.resolve(i):new Promise((t,n)=>{Promise.all(i[e].filter(e=>e.folder).map(e=>this.browseFolder(e.id,i,!0).catch(()=>void 0))).then(()=>t(i)).catch(e=>n(Error(e)))});if(!e||e===`/`){try{let t=await this.props.socket.readMetaItems(),r=[],a=null;if(this.state.restrictToFolder){let e=this.state.restrictToFolder.split(`/`)[0];t=t.filter(t=>t._id===e)}else this.state.expertMode||(t=t.filter(e=>!e._id.endsWith(`.admin`)));let o=t.findIndex(e=>e._id===`system.meta.uuid`);if(o!==-1&&t.splice(o,1),t.forEach(e=>{if(this.limitToObjectID&&this.limitToObjectID!==e._id)return;let t={id:e._id,name:e._id,title:e.common&&e.common.name||e._id,meta:!0,from:e.from,ts:e.ts,color:e.common&&e.common.color,icon:e.common&&e.common.icon,folder:!0,acl:e.acl,level:0};t.id===WW?a=t:r.push(t)}),r.sort((e,t)=>e.id>t.id?1:e.id<t.id?-1:0),(!this.limitToObjectID||this.limitToObjectID===WW)&&a&&r.unshift(a),i[e||`/`]=r,!n)return Promise.all(r.filter(e=>e.folder).map(e=>this.browseFolder(e.id,i,!0).catch(()=>void 0))).then(()=>i)}catch(t){let n=t;this.initialReadFinished&&window.alert(`Cannot read meta items: ${n.message}`),i[e||`/`]=[]}return i}let a=e.split(`/`),o=a.length,s=a.shift(),c=a.join(`/`),l;try{l=await this.readDirSerial(s||``,c)}catch(e){if(e===`Not exists`&&s===`0_userdata.0`)l=[];else throw e}try{let t=[];if(l.forEach(n=>{let r={id:`${e}/${n.file}`,ext:X.getFileExtension(n.file),folder:n.isDir,name:n.file,size:n.stats?.size,modified:n.modifiedAt,acl:n.acl,level:o};this.state.restrictToFolder?(r.folder&&(r.id.startsWith(`${this.state.restrictToFolder}/`)||r.id===this.state.restrictToFolder||this.state.restrictToFolder.startsWith(`${r.id}/`))||r.id.startsWith(`${this.state.restrictToFolder}/`))&&t.push(r):this.limitToPath?(r.folder&&(r.id.startsWith(`${this.limitToPath}/`)||r.id===this.limitToPath||this.limitToPath.startsWith(`${r.id}/`))||r.id.startsWith(`${this.limitToPath}/`))&&t.push(r):t.push(r)}),t.sort(YW),i[e]=t,!n)return Promise.all(t.filter(e=>e.folder).map(e=>this.browseFolder(e.id,i,!0))).then(()=>i)}catch(t){let n=t;this.initialReadFinished&&window.alert(`Cannot read ${s}${c?`/${c}`:``}: ${n?.message}`),i[e]=[]}return i}toggleFolder(e,t){t?.stopPropagation();let n=[...this.state.expanded],r=n.indexOf(e.id);r===-1?(n.push(e.id),n.sort(),this.localStorage.setItem(`files.expanded`,JSON.stringify(n)),e.temp?this.setState({expanded:n}):this.browseFolder(e.id).then(e=>this.setState({expanded:n,folders:e})).catch(t=>window.alert(t===HW?this.props.t(`ra_Cannot find "%s"`,e.id):this.props.t(`ra_Cannot read "%s"`,e.id)))):(n.splice(r,1),this.localStorage.setItem(`files.expanded`,JSON.stringify(n)),this.setState({expanded:n}))}onFileChange=(e,t,n)=>{let r=`${e}/${t}`,i=r.lastIndexOf(`/`),a=r.substring(0,i);console.log(`File changed ${r}[${n}]`),this.state.folders[a]&&(this._tempTimeout[a]&&clearTimeout(this._tempTimeout[a]),this._tempTimeout[a]=setTimeout(()=>{delete this._tempTimeout[a],this.browseFolder(a,null,!1,!0).then(e=>this.setState({folders:e})).catch(e=>console.error(`Cannot read folder: ${e.message}`))},300))};changeFolder(e,t){e?.stopPropagation(),this.lastSelect=Date.now();let n=t||GW(this.state.currentDir);if(n===`/`&&(n=``),this.state.viewType===`Tile`&&this.refFileDiv.current?.scrollTop&&(this.scrollPositions[this.state.currentDir]=this.refFileDiv.current.scrollTop),this.localStorage.setItem(`files.currentDir`,n),t&&e&&(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)){this.setState({selected:n});return}if(n&&!this.state.folders[n]){this.browseFolder(n).then(e=>this.setState({folders:e,path:n,currentDir:n,selected:n,pathFocus:!1},()=>this.props.onSelect&&this.props.onSelect(``))).catch(e=>console.error(`Cannot read folder: ${e.message}`));return}this.setState({currentDir:n,selected:n,path:n,pathFocus:!1},()=>{if(this.props.onSelect&&this.props.onSelect(``),this.state.viewType===`Tile`&&this.scrollPositions[this.state.currentDir]){let e=this.scrollPositions[this.state.currentDir];delete this.scrollPositions[this.state.currentDir],this.refFileDiv.current&&(this.refFileDiv.current.scrollTop=e)}})}select(e,t,n){t&&t.stopPropagation(),this.lastSelect=Date.now(),this.localStorage.setItem(`files.selected`,e),this.setState({selected:e,path:e,pathFocus:!1},()=>{if(this.props.onSelect){let t=X.getFileExtension(e);(!this.props.filterFiles||t&&this.props.filterFiles.includes(t))&&(!this.state.filterByType||t&&PW[this.state.filterByType].includes(t))?this.props.onSelect(e,!1,!!this.state.folders[e]):this.props.onSelect(``)}n&&n()})}getText(e){if(e)return typeof e==`object`?e[this.props.lang]||e.en||void 0:e}renderFolder(e,t){if(this.state.filterEmpty&&!this.state.folders[e.id]?.length&&e.id!==WW&&!e.temp)return null;let n=t?XU:YU,r=this.state.viewType===qW?e.level*this.levelPadding:0,i=e.name===WW,a=i||e.name===`vis.0`||e.name===`vis-2.0`,o=X.getStyle(this.props.theme,Q[`itemFolderIcon${this.state.viewType}`],a&&Q.specialFolder);return R.createElement(_x,{component:`div`,key:e.id,id:e.id,style:this.state.viewType===qW?{marginLeft:r,width:`calc(100% - ${r}px)`}:void 0,onClick:t=>this.state.viewType===qW?this.select(e.id,t):this.changeFolder(t,e.id),onDoubleClick:t=>this.state.viewType===qW&&this.toggleFolder(e,t),title:this.getText(e.title),className:`browserItem`,sx:X.getStyle(this.props.theme,Q[`item${this.state.viewType}`],Q[`itemFolder${this.state.viewType}`],this.state.selected===e.id?Q.itemSelected:{},e.temp?Q.itemFolderTemp:{})},R.createElement(n,{style:o,onClick:this.state.viewType===qW?t=>this.toggleFolder(e,t):void 0}),R.createElement(_x,{component:`div`,sx:X.getStyle(this.props.theme,Q[`itemName${this.state.viewType}`],Q[`itemNameFolder${this.state.viewType}`])},i?this.props.t(`ra_User files`):e.name),R.createElement(_x,{component:`div`,style:Q[`itemSize${this.state.viewType}`],sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.state.folders[e.id]?this.state.folders[e.id].length:``),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.props.expertMode?this.formatAcl(e.acl):null),this.state.viewType===qW&&this.props.expertMode?R.createElement(_x,{component:`div`,sx:{...Q.itemDeleteButtonTable,display:{md:`inline-block`,sm:`none`}}}):null,this.state.viewType===qW&&this.props.allowDownload?R.createElement(`div`,{style:Q[`itemDownloadEmpty${this.state.viewType}`]}):null,this.state.viewType===qW&&this.props.allowDelete&&this.state.folders[e.id]&&this.state.folders[e.id].length?R.createElement(uv,{"aria-label":`delete`,onClick:t=>{t.stopPropagation(),this.suppressDeleteConfirm>Date.now()?this.deleteItem(e.id):this.setState({deleteItem:e.id})},sx:Q[`itemDeleteButton${this.state.viewType}`],size:`large`},R.createElement(PO,{fontSize:`small`})):this.state.viewType===qW&&this.props.allowDelete?R.createElement(_x,{component:`div`,sx:Q[`itemDeleteButton${this.state.viewType}`]}):null)}renderBackFolder(){return R.createElement(_x,{component:`div`,key:this.state.currentDir,id:this.state.currentDir,onClick:e=>this.changeFolder(e),title:this.props.t(`ra_Back to %s`,GW(this.state.currentDir)),className:`browserItem`,sx:X.getStyle(this.props.theme,Q[`item${this.state.viewType}`],Q[`itemFolder${this.state.viewType}`])},R.createElement(YU,{style:X.getStyle(this.props.theme,Q[`itemFolderIcon${this.state.viewType}`])}),R.createElement(gO,{sx:Q.itemFolderIconBack}),R.createElement(_x,{component:`div`,sx:X.getStyle(this.props.theme,Q[`itemName${this.state.viewType}`],Q[`itemNameFolder${this.state.viewType}`])},`..`))}formatSize(e){return R.createElement(`div`,{style:Q[`itemSize${this.state.viewType}`]},e||e===0?X.formatBytes(e):``)}formatAcl(e){let t=e?e.permissions||e.file:0,n;return n=t?t.toString(16).padStart(3,`0`):``,R.createElement(`div`,{style:Q[`itemAccess${this.state.viewType}`]},this.props.modalEditOfAccessControl?R.createElement(uv,{size:`large`,onClick:()=>this.setState({modalEditOfAccess:!0}),sx:Q[`itemAclButton${this.state.viewType}`]},n||`---`):n||`---`)}getFileIcon(e){switch(e){case`json`:case`json5`:return R.createElement(bO,{style:Q[`itemIcon${this.state.viewType}`]});case`css`:return R.createElement(xO,{style:Q[`itemIcon${this.state.viewType}`]});case`js`:case`ts`:return R.createElement(OO,{style:Q[`itemIcon${this.state.viewType}`]});case`html`:case`md`:return R.createElement(FO,{style:Q[`itemIcon${this.state.viewType}`]});case`mp3`:case`ogg`:case`wav`:case`m4a`:case`mp4`:case`flac`:return R.createElement($O,{style:Q[`itemIcon${this.state.viewType}`]});default:return R.createElement(qO,{style:Q[`itemIcon${this.state.viewType}`]})}}static getEditFile(e){switch(e){case`json`:case`json5`:case`js`:case`html`:case`txt`:case`css`:case`log`:case`csv`:return!0;default:return!1}}setStateBackgroundImage=()=>{let e=[`light`,`dark`,`colored`,`delete`];this.setState(({backgroundImage:t})=>t&&e.indexOf(t)!==-1&&e.length-1!==e.indexOf(t)?(this.localStorage.setItem(`files.backgroundImage`,e[e.indexOf(t)+1]),{backgroundImage:e[e.indexOf(t)+1]}):(this.localStorage.setItem(`files.backgroundImage`,e[0]),{backgroundImage:e[0]}))};getStyleBackgroundImage=()=>{switch(this.state.backgroundImage){case`light`:return Q.backgroundImageLight;case`dark`:return Q.backgroundImageDark;case`colored`:return Q.backgroundImageColored;case`delete`:return null;default:return null}};renderFile(t){let n=this.state.viewType===qW?t.level*this.levelPadding:0,r=X.getFileExtension(t.name);return R.createElement(_x,{component:`div`,key:t.id,id:t.id,onDoubleClick:e=>{e.stopPropagation(),this.props.onSelect?(!this.props.filterFiles||t.ext&&this.props.filterFiles.includes(t.ext))&&(!this.state.filterByType||t.ext&&PW[this.state.filterByType].includes(t.ext))&&this.props.onSelect(t.id,!0,!!this.state.folders[t.id]):this.setState({viewer:this.imagePrefix+t.id,formatEditFile:r})},onClick:e=>this.select(t.id,e),style:this.state.viewType===qW?{marginLeft:n,width:`calc(100% - ${n}px)`}:void 0,className:`browserItem`,sx:X.getStyle(this.props.theme,Q[`item${this.state.viewType}`],Q[`itemFile${this.state.viewType}`],this.state.selected===t.id?Q.itemSelected:void 0)},r&&PW.images.includes(r)?this.state.fileErrors.includes(t.id)?R.createElement(ZU,{style:{...Q[`itemImage${this.state.viewType}`],...this.getStyleBackgroundImage(),...Q[`itemNoImage${this.state.viewType}`]}}):R.createElement(MW,{onError:e=>{e.target.onerror=null;let n=[...this.state.fileErrors];n.includes(t.id)||(n.push(t.id),this.setState({fileErrors:n}))},style:{...Q[`itemImage${this.state.viewType}`],...this.getStyleBackgroundImage()},src:this.imagePrefix+t.id,alt:t.name}):this.getFileIcon(r),R.createElement(_x,{component:`div`,sx:Q[`itemName${this.state.viewType}`]},t.name),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.formatSize(t.size)),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.props.expertMode?this.formatAcl(t.acl):null),R.createElement(_x,{component:`div`,sx:{display:{md:`inline-block`,sm:`none`}}},this.state.viewType===qW&&this.props.expertMode&&e.getEditFile(r)?R.createElement(uv,{"aria-label":`edit`,onClick:e=>{e.stopPropagation(),this.props.onSelect?(!this.props.filterFiles||t.ext&&this.props.filterFiles.includes(t.ext))&&(!this.state.filterByType||t.ext&&PW[this.state.filterByType].includes(t.ext))&&this.props.onSelect(t.id,!0,!!this.state.folders[t.id]):this.setState({viewer:this.imagePrefix+t.id,formatEditFile:r})},sx:Q.itemDeleteButtonTable,size:`large`},R.createElement(LO,{fontSize:`small`})):R.createElement(_x,{component:`div`,sx:Q[`itemDeleteButton${this.state.viewType}`]})),this.state.viewType===qW&&this.props.allowDownload?R.createElement(_x,{component:`a`,className:`MuiButtonBase-root MuiIconButton-root MuiIconButton-sizeLarge`,sx:Q.itemDownloadButtonTable,tabIndex:0,download:t.id,href:this.imagePrefix+t.id,onClick:e=>e.stopPropagation()},R.createElement(ok,null)):null,this.state.viewType===qW&&this.props.allowDelete&&t.id!==`vis.0/`&&t.id!==`vis-2.0/`&&t.id!==WW?R.createElement(uv,{"aria-label":`delete`,onClick:e=>{e.stopPropagation(),this.suppressDeleteConfirm>Date.now()?this.deleteItem(t.id):this.setState({deleteItem:t.id})},sx:Q[`itemDeleteButton${this.state.viewType}`],size:`large`},R.createElement(PO,{fontSize:`small`})):this.state.viewType===qW&&this.props.allowDelete?R.createElement(_x,{component:`div`,sx:Q[`itemDeleteButton${this.state.viewType}`]}):null)}renderItems(e){if(this.state.folders?.[e]){if(this.state.viewType===JW){let t=[];return e&&e!==`/`&&t.push(this.renderBackFolder()),this.state.folders[e].forEach(e=>{e.folder?t.push(this.renderFolder(e)):(!this.props.filterFiles||e.ext&&this.props.filterFiles.includes(e.ext))&&(!this.state.filterByType||e.ext&&PW[this.state.filterByType].includes(e.ext))&&t.push(this.renderFile(e))}),t}let t=[];return this.state.folders[e].forEach(e=>{if(e.folder){let n=this.state.expanded.includes(e.id),r=this.renderFolder(e,n);if(Array.isArray(r)?r.forEach(e=>t.push(e)):t.push(r),this.state.folders[e.id]&&n){let n=this.renderItems(e.id);Array.isArray(n)?n.forEach(e=>t.push(e)):t.push(n)}}else(!this.props.filterFiles||e.ext&&this.props.filterFiles.includes(e.ext))&&(!this.state.filterByType||e.ext&&PW[this.state.filterByType].includes(e.ext))&&t.push(this.renderFile(e))}),t}return R.createElement(`div`,{style:{position:`relative`}},R.createElement(iv,{key:e,color:`secondary`,size:24}),R.createElement(`div`,{style:{position:`absolute`,zIndex:2,top:4,width:24,textAlign:`center`}},this.state.queueLength))}renderToolbar(){let e=this.props.showTypeSelector?UW[this.state.filterByType||`all`]||UW.all:null,t=this.findFirstFolder(this.state.selected);return R.createElement(ND,{key:`toolbar`,variant:`dense`},this.props.allowNonRestricted&&this.props.restrictToFolder?R.createElement(uv,{edge:`start`,title:this.state.restrictToFolder?this.props.t(`ra_Show all folders`):this.props.t(`ra_Restrict to folder`),style:{...Q.menuButton,...this.state.restrictToFolder?Q.menuButtonRestrictActive:void 0},"aria-label":`restricted to folder`,onClick:()=>this.setState({restrictToFolder:(this.state.restrictToFolder?``:this.props.restrictToFolder)||``,loadAllFolders:!0}),size:`small`},R.createElement(VO,{fontSize:`small`})):null,this.props.showExpertButton?R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Toggle expert mode`),style:{...Q.menuButton,...this.state.expertMode?Q.menuButtonExpertActive:void 0},"aria-label":`expert mode`,onClick:()=>this.setState({expertMode:!this.state.expertMode}),size:`small`},R.createElement(JU,null)):null,this.props.showViewTypeButton?R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Toggle view mode`),style:Q.menuButton,"aria-label":`view mode`,onClick:()=>{let e=this.state.viewType===qW?JW:qW;this.localStorage.setItem(`files.viewType`,e);let t=this.state.selected;KW(t)&&(t=GW(t)),this.setState({viewType:e,currentDir:t},()=>{this.state.viewType===qW&&this.scrollToSelected()})},size:`small`},this.state.viewType===qW?R.createElement(_k,{fontSize:`small`}):R.createElement(XO,{fontSize:`small`})):null,R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Hide empty folders`),style:Q.menuButton,color:this.state.filterEmpty?`secondary`:`inherit`,"aria-label":`filter empty`,onClick:()=>{this.localStorage.setItem(`file.empty`,this.state.filterEmpty?`false`:`true`),this.setState({filterEmpty:!this.state.filterEmpty})},size:`small`},R.createElement(BO,{fontSize:`small`})),R.createElement(uv,{edge:`start`,title:this.props.t(`ra_Reload files`),style:Q.menuButton,color:`inherit`,"aria-label":`reload files`,onClick:()=>this.setState({folders:{}},()=>this.loadFolders()),size:`small`},R.createElement(rk,{fontSize:`small`})),this.props.allowCreateFolder?R.createElement(uv,{edge:`start`,disabled:!this.state.selected||!t||!!this.limitToPath&&!this.state.selected.startsWith(`${this.limitToPath}/`)&&this.limitToPath!==this.state.selected,title:this.props.t(`ra_Create folder`),style:Q.menuButton,color:`inherit`,"aria-label":`add folder`,onClick:()=>this.setState({addFolder:!0}),size:`small`},R.createElement(MO,{fontSize:`small`})):null,this.props.allowUpload?R.createElement(uv,{edge:`start`,disabled:!this.state.selected||!t||!!this.limitToPath&&!this.state.selected.startsWith(`${this.limitToPath}/`)&&this.limitToPath!==this.state.selected,title:this.props.t(`ra_Upload file`),style:Q.menuButton,color:`inherit`,"aria-label":`upload file`,onClick:()=>this.setState({uploadFile:!0}),size:`small`},R.createElement(nk,{fontSize:`small`})):null,this.props.showTypeSelector&&e?R.createElement(HE,{title:this.props.t(`ra_Filter files`),slotProps:{popper:{sx:Q.tooltip}}},R.createElement(uv,{size:`small`,onClick:e=>this.setState({showTypesMenu:e.target})},R.createElement(e,{fontSize:`small`}))):null,this.state.showTypesMenu?R.createElement(jT,{open:!0,anchorEl:this.state.showTypesMenu,onClose:()=>this.setState({showTypesMenu:null})},Object.keys(UW).map(e=>{let t=UW[e];return R.createElement(LT,{key:e,selected:this.state.filterByType===e,onClick:()=>{e===`all`?(this.localStorage.removeItem(`files.filterByType`),this.setState({filterByType:``,showTypesMenu:null})):(this.localStorage.setItem(`files.filterByType`,e),this.setState({filterByType:e,showTypesMenu:null}))}},R.createElement(rT,null,R.createElement(t,{fontSize:`small`})),R.createElement(cT,null,this.props.t(`ra_fileType_${e}`)))})):null,R.createElement(HE,{title:this.props.t(`ra_Background image`),slotProps:{popper:{sx:Q.tooltip}}},R.createElement(uv,{color:`inherit`,edge:`start`,style:Q.menuButton,onClick:this.setStateBackgroundImage,size:`small`},R.createElement(CO,{fontSize:`small`}))),this.state.viewType!==qW&&this.props.allowDelete?R.createElement(HE,{title:this.props.t(`ra_Delete`),slotProps:{popper:{sx:Q.tooltip}}},R.createElement(`span`,null,R.createElement(uv,{"aria-label":`delete`,disabled:!this.state.selected||this.state.selected===`vis.0/`||this.state.selected===`vis-2.0/`||this.state.selected===WW,color:`inherit`,edge:`start`,style:Q.menuButton,onClick:e=>{e.stopPropagation(),this.suppressDeleteConfirm>Date.now()?this.deleteItem(this.state.selected):this.setState({deleteItem:this.state.selected})},size:`small`},R.createElement(PO,{fontSize:`small`})))):null)}findItem(e,t){if(t||=this.state.folders,!t)return null;let n=e.split(`/`);n.pop();let r=n.join(`/`)||`/`;return t[r]&&t[r].find(t=>t.id===e)||null}renderInputDialog(){if(this.state.addFolder){let e=this.findFirstFolder(this.state.selected);return e?R.createElement(qU,{key:`inputDialog`,applyText:this.props.t(`ra_Create`),cancelText:this.props.t(`ra_Cancel`),titleText:this.props.t(`ra_Create new folder in %s`,this.state.selected),promptText:this.props.t(`ra_If no file will be created in the folder, it will disappear after the browser closed`),labelText:this.props.t(`ra_Folder name`),verify:t=>this.state.folders[e].find(e=>e.name===t)?this.props.t(`ra_Duplicate name`):``,onClose:t=>{if(t){let n={};Object.keys(this.state.folders).forEach(e=>n[e]=this.state.folders[e]);let r=this.findItem(e),i=`${e}/${t}`;n[e].push({id:i,level:(r?.level||0)+1,name:t,folder:!0,temp:!0}),n[e].sort(YW),n[i]=[];let a=[...this.state.expanded];a.includes(e)||(a.push(e),a.sort()),this.localStorage.setItem(`files.expanded`,JSON.stringify(a)),this.setState({addFolder:!1,folders:n,expanded:a},()=>this.select(i))}else this.setState({addFolder:!1})},replace:e=>e.replace(/[^-_\w]/,`_`)}):(window.alert(this.props.t(`ra_Invalid parent folder!`)),null)}return null}viewerToId(e){return e.startsWith(this.imagePrefix)?e.substring(this.imagePrefix.length):e}getStateNav(){return this.state.viewer?{mode:`view`,id:this.viewerToId(this.state.viewer)}:this.state.selected?{mode:`select`,id:this.state.selected}:null}static navEqual(e,t){return!e||!t?!e&&!t:e.mode===t.mode&&e.id===t.id}applyNavigateTo(e){this.applyingNav=!0;let t=()=>{this.applyingNav=!1};if(!e?.id){this.setState({viewer:``,formatEditFile:``},t);return}let{id:n}=e;this.select(n,null,()=>{this.scrollToSelected(),e.mode===`view`?this.setState({viewer:this.imagePrefix+n,formatEditFile:X.getFileExtension(n)},t):this.setState({viewer:``,formatEditFile:``},t)})}applyInitialNavigateTo(){let e=this.props.navigateTo??null;e?.id?(this.lastNav=e,this.applyNavigateTo(e)):this.lastNav=this.getStateNav()}reconcileNavigation(t){if(this.props.navigateTo===void 0&&!this.props.onNavigateTo||this.applyingNav)return;let n=this.props.navigateTo??null,r=this.getStateNav();if(e.navEqual(n,r)){this.lastNav=r;return}e.navEqual(n,t.navigateTo??null)?e.navEqual(r,this.lastNav)||(this.lastNav=r,this.props.onNavigateTo?.(r)):(this.lastNav=n,this.applyNavigateTo(n))}componentDidUpdate(e){this.setOpacityTimer&&clearTimeout(this.setOpacityTimer),this.setOpacityTimer=setTimeout(()=>{this.setOpacityTimer=null;let e=window.document.getElementsByClassName(`browserItem`);for(let t=0;t<e.length;t++)e[t].style.opacity=`1`},100),this.reconcileNavigation(e)}findFirstFolder(e){let t=e,n=this.findItem(t);if(n&&!n.folder){let e=t.split(`/`);for(e.pop(),t=``;e.length;){if(this.findItem(e.join(`/`))?.folder){t=e.join(`/`);break}e.pop()}if(!e.length)return null}return t}async uploadFile(e,t){let n=e.split(`/`),r=n.shift();try{await this.props.socket.writeFile64(r||``,n.join(`/`),t)}catch(e){let t=e;window.alert(`Cannot write file: ${t?.message}`)}}renderUpload(){return this.state.uploadFile?[R.createElement(EC,{key:`close`,color:`primary`,"aria-label":`close`,style:Q.uploadCloseButton,onClick:()=>this.setState({uploadFile:!1})},R.createElement(DO,null)),R.createElement(RU,{key:`dropzone`,onDragEnter:()=>this.setState({uploadFile:`dragging`}),onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:e=>{let t=e.length;e.forEach(e=>{let n=new FileReader;n.onabort=()=>console.log(`file reading was aborted`),n.onerror=()=>console.log(`file reading has failed`),n.onload=()=>{let r=this.findFirstFolder(this.state.selected);if(!r)window.alert(this.props.t(`ra_Invalid parent folder!`));else{let i=`${r}/${e.name}`;this.uploadFile(i,n.result).then(()=>{--t||this.setState({uploadFile:!1},()=>{if(this.supportSubscribes){let e=[...this.state.expanded];e.includes(r)||(e.push(r),e.sort(),this.localStorage.setItem(`files.expanded`,JSON.stringify(e))),this.setState({expanded:e},()=>this.select(i))}else setTimeout(()=>this.browseFolder(r,null,!1,!0).then(e=>{let t=[...this.state.expanded];t.includes(r)||(t.push(r),t.sort(),this.localStorage.setItem(`files.expanded`,JSON.stringify(t))),this.setState({folders:e,expanded:t},()=>this.select(i))}),500)})})}},n.readAsArrayBuffer(e)})}},({getRootProps:e,getInputProps:t})=>R.createElement(`div`,{style:{...Q.uploadDiv,...this.state.uploadFile===`dragging`?Q.uploadDivDragging:void 0},...e()},R.createElement(`input`,{...t()}),R.createElement(_x,{component:`div`,sx:Q.uploadCenterDiv},R.createElement(`div`,{style:Q.uploadCenterTextAndIcon},R.createElement(nk,{style:Q.uploadCenterIcon}),R.createElement(`div`,{style:Q.uploadCenterText},this.state.uploadFile===`dragging`?this.props.t(`ra_Drop file here`):this.props.t(`ra_Place your files here or click here to open the browse dialog`))))))]:null}deleteRecursive(e){let t=this.findItem(e);if(t?.folder)return(this.state.folders[e]?Promise.all(this.state.folders[e].map(e=>this.deleteRecursive(e.id))):Promise.resolve()).then(()=>{if(t.level>=1){let n=e.split(`/`),r=n.shift();this.props.socket.deleteFolder(r||``,n.join(`/`)).then(()=>{let e=JSON.parse(JSON.stringify(this.state.folders));delete e[t.id];let n=GW(t.id),r=e[n];if(r){let i=r.findIndex(e=>e.id===t.id);i!==-1&&r.splice(i,1),this.select(n,null,()=>this.setState({folders:e}))}})}});let n=e.split(`/`),r=n.shift();return n.length?this.props.socket.deleteFile(r||``,n.join(`/`)).catch(e=>window.alert(`Cannot delete file: ${e}`)):Promise.resolve()}deleteItem(e){e||=this.state.deleteItem,this.state.suppressDeleteConfirm&&(this.suppressDeleteConfirm=Date.now()+6e4*5),this.setState({deleteItem:``,suppressDeleteConfirm:!1},()=>this.deleteRecursive(e).then(()=>{let t={},n=this.state.expanded.indexOf(e);if(n!==-1){let e=[...this.state.expanded];e.splice(n,1),this.localStorage.setItem(`files.expanded`,JSON.stringify(e)),t.expanded=e}if(this.state.selected===e){let e=this.state.selected.split(`/`);e.pop(),t.selected=e.join(`/`)}if(this.supportSubscribes)this.setState(t);else{let n=this.findFirstFolder(e),r={};Object.keys(this.state.folders).forEach(e=>{e!==n&&!e.startsWith(`${n}/`)&&(r[e]=this.state.folders[e])}),t.folders=r,this.setState(t,()=>setTimeout(()=>{this.browseFolders([...this.state.expanded],r).then(e=>this.setState({folders:e})).catch(e=>console.error(e))},200))}}))}renderDeleteDialog(){return this.state.deleteItem?R.createElement(rC,{key:`deleteDialog`,open:!0,onClose:()=>this.setState({deleteItem:``}),"aria-labelledby":`ar_dialog_file_delete_title`},R.createElement(bC,{id:`ar_dialog_file_delete_title`},this.props.t(`ra_Confirm deletion of %s`,this.state.deleteItem.split(`/`).pop()||``)),R.createElement(pC,null,R.createElement(_C,null,this.props.t(`ra_Are you sure?`)),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.suppressDeleteConfirm,onChange:()=>{this.setState({suppressDeleteConfirm:!this.state.suppressDeleteConfirm})}}),label:this.props.t(`ra_no confirm for 5 mins`)})),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.deleteItem(``),color:`primary`,autoFocus:!0},this.props.t(`ra_Delete`)),R.createElement(Vx,{variant:`contained`,onClick:()=>this.setState({deleteItem:``}),color:`grey`},this.props.t(`ra_Cancel`)))):null}renderViewDialog(){let e=this.props.FileViewer||LW;return this.state.viewer?R.createElement(e,{supportSubscribes:this.supportSubscribes||void 0,key:this.state.viewer,href:this.state.viewer,formatEditFile:this.state.formatEditFile||void 0,themeType:this.props.themeType||`light`,setStateBackgroundImage:this.setStateBackgroundImage,getStyleBackgroundImage:this.getStyleBackgroundImage,t:this.props.t,socket:this.props.socket,onClose:()=>this.setState({viewer:``,formatEditFile:``})}):null}renderError(){return this.state.errorText?R.createElement(Yk,{key:`errorDialog`,text:this.state.errorText,onClose:()=>this.setState({errorText:``})}):null}updateItemsAcl(e){this.cacheFolders||=JSON.parse(JSON.stringify(this.state.folders));let t;e.forEach(e=>{let n=this.findItem(e.id,this.cacheFolders);n&&JSON.stringify(n.acl)!==JSON.stringify(e.acl)&&(n.acl=e.acl,t=!0)}),t&&(this.cacheFoldersTimeout&&clearTimeout(this.cacheFoldersTimeout),this.cacheFoldersTimeout=setTimeout(()=>{this.cacheFoldersTimeout=null;let e=this.cacheFolders||{};this.cacheFolders=null,this.setState({folders:e})},200))}changeToPath(){setTimeout(()=>{if(this.state.path!==this.state.selected&&(!this.lastSelect||Date.now()-this.lastSelect>100)){let e=this.state.path;KW(this.state.path)&&(e=GW(this.state.path)),new Promise(t=>{this.state.folders[e]?t(!0):this.browseFolder(e).then(e=>this.setState({folders:e},()=>t(!0))).catch(t=>this.setState({errorText:t===HW?this.props.t(`ra_Cannot find "%s"`,e):this.props.t(`ra_Cannot read "%s"`,e)}))}).then(t=>t&&this.setState({selected:this.state.path,currentDir:e,pathFocus:!1})).catch(e=>console.error(e))}else(!this.lastSelect||Date.now()-this.lastSelect>100)&&this.setState({pathFocus:!1})},100)}renderBreadcrumb(){let e=this.state.currentDir.startsWith(`/`)?this.state.currentDir.split(`/`):`/${this.state.currentDir}`.split(`/`),t=[];return R.createElement(kx,{style:{paddingLeft:8,color:`#FFF`}},e.map((n,r)=>{n&&t.push(n);let i=t.join(`/`);return r<e.length-1?R.createElement(_x,{component:`div`,key:`${this.state.selected}_${r}`,sx:Q.pathDivBreadcrumbDir,onClick:e=>this.changeFolder(e,i||`/`)},n||this.props.t(`ra_Root`)):R.createElement(`div`,{style:Q.pathDivBreadcrumbSelected,key:`${this.state.selected}_${r}`,onClick:()=>this.setState({pathFocus:!0})},n)}))}renderPath(){return R.createElement(_x,{component:`div`,key:`path`,sx:Q.pathDiv},this.state.pathFocus?R.createElement(fw,{value:this.state.path,onKeyDown:e=>{e.key===`Enter`?this.changeToPath():e.key===`Escape`&&this.setState({pathFocus:!1})},endAdornment:R.createElement(uv,{size:`small`,onClick:()=>this.changeToPath()},R.createElement(JO,null)),onBlur:()=>this.changeToPath(),onChange:e=>this.setState({path:e.target.value}),style:Q.pathDivInput}):this.renderBreadcrumb())}render(){return this.props.ready?(this.state.loadAllFolders&&!this.foldersLoading&&(this.foldersLoading=!0,setTimeout(()=>{this.setState({loadAllFolders:!1,folders:{}},()=>{this.foldersLoading=!1,this.loadFolders().catch(e=>console.error(`Cannot load folders: ${e}`))})},300)),R.createElement(`div`,{style:{...Q.root,...this.props.style},className:this.props.className},this.props.showToolbar?this.renderToolbar():null,this.state.viewType===JW?this.renderPath():null,R.createElement(`div`,{style:{...Q.filesDiv,...Q[`filesDiv${this.state.viewType}`]},onClick:e=>{this.state.viewType!==qW&&(this.state.selected===(this.state.currentDir||`/`)?e.stopPropagation():this.changeFolder(e,this.state.currentDir||`/`))},id:`dev`,ref:this.refFileDiv},this.state.viewType===qW?this.renderItems(`/`):this.renderItems(this.state.currentDir||`/`),this.state.viewType===qW?null:R.createElement(`div`,{style:Q.filesDivHint},this.props.t(`ra_select_folder_hint`))),this.props.allowUpload?this.renderInputDialog():null,this.props.allowUpload?this.renderUpload():null,this.props.allowDelete?this.renderDeleteDialog():null,this.props.allowView?this.renderViewDialog():null,this.state.modalEditOfAccess&&this.props.modalEditOfAccessControl?this.props.modalEditOfAccessControl(this):null,this.renderError())):R.createElement(jw,null)}};GU()(XW);function ZW(e){let t=document.createElement(`div`);t.innerHTML=e;let n=t.firstElementChild;return n?.remove?n.remove():n&&t.removeChild(n),t.remove(),n}function QW(e){let t={};if(!e)return t;for(let n,r=0;r<e.length;r++){let i=e[r].name;n=i===`class`?`className`:i.startsWith(`data-`)?i:i.replace(/[-|:]([a-z])/g,e=>e[1].toUpperCase()),t[n]=e[r].value}return t}(class e extends R.Component{svg;static REMOTE_SERVER=window.location.hostname.includes(`iobroker.in`);static REMOTE_PREFIX=window.location.pathname.substring(0,window.location.pathname.lastIndexOf(`/`)+1);constructor(e){super(e),this.state={svg:!!this.props.src?.startsWith(`data:`),created:!0,color:this.props.color||``,src:this.props.src||``,imgError:!1,showError:!!this.props.showError},this.svg=this.state.svg&&this.state.src?this.getSvgFromData(this.state.src):null}static getDerivedStateFromProps(e,t){let n={},r=!1;return e&&t&&e.src!==t.src&&(n.src=e.src,n.svg=e.src?.startsWith(`data:`),n.created=!1,r=!0),e&&t&&e.color!==t.color&&(n.color=e.color,n.created=!1,r=!0),e&&t&&e.showError!==t.showError&&(n.showError=e.showError,r=!0),r?n:null}getSvgFromData(e){if(!e.startsWith(`data:image/svg+xml;base64,`))return null;e=e.substring(26);try{e=atob(e);let t=ZW(e),n,r;return t&&(n=t.innerHTML,r=QW(t.attributes),t.remove()),R.createElement(_x,{component:`svg`,sx:this.props.sx,className:this.props.className,style:this.state.color?{color:this.state.color}:void 0,...r,dangerouslySetInnerHTML:{__html:n||``}})}catch{}return null}render(){if(this.state.svg)return this.state.created||setTimeout(()=>{this.svg=this.state.src?this.getSvgFromData(this.state.src):null,this.setState({created:!0})},50),this.svg;if(this.state.src){if(this.state.imgError||!this.state.src)return R.createElement(ZU,{className:this.props.className});if(e.REMOTE_SERVER&&!this.state.src.startsWith(`http://`)&&!this.state.src.startsWith(`https://`)){let t=(this.props.imagePrefix||``)+this.state.src;return t.startsWith(`./`)?t=e.REMOTE_PREFIX+t.substring(2):t.startsWith(`/`)||(t=e.REMOTE_PREFIX+t),R.createElement(_x,{component:`img`,sx:this.props.sx,className:this.props.className,src:`https://remote-files.iobroker.in${t}`,alt:``,onError:()=>this.props.showError?this.setState({imgError:!0}):this.setState({src:``})})}return R.createElement(_x,{component:`img`,sx:this.props.sx,className:this.props.className,src:(this.props.imagePrefix||``)+this.state.src,alt:``,onError:()=>this.props.showError?this.setState({imgError:!0}):this.setState({src:``})})}return null}});var $W=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StateType=e.Types=void 0;var t;(function(e){e.unknown=`unknown`,e.airCondition=`airCondition`,e.blind=`blind`,e.blindButtons=`blindButtons`,e.button=`button`,e.buttonSensor=`buttonSensor`,e.camera=`camera`,e.chart=`chart`,e.cie=`cie`,e.ct=`ct`,e.dimmer=`dimmer`,e.door=`door`,e.fireAlarm=`fireAlarm`,e.floodAlarm=`floodAlarm`,e.gate=`gate`,e.hue=`hue`,e.humidity=`humidity`,e.illuminance=`illuminance`,e.image=`image`,e.info=`info`,e.instance=`instance`,e.light=`light`,e.location=`location`,e.locationOne=`locationOne`,e.lock=`lock`,e.media=`media`,e.motion=`motion`,e.percentage=`percentage`,e.rgb=`rgb`,e.rgbSingle=`rgbSingle`,e.rgbwSingle=`rgbwSingle`,e.slider=`slider`,e.socket=`socket`,e.temperature=`temperature`,e.fillLevel=`fillLevel`,e.thermostat=`thermostat`,e.vacuumCleaner=`vacuumCleaner`,e.volume=`volume`,e.volumeGroup=`volumeGroup`,e.warning=`warning`,e.weatherCurrent=`weatherCurrent`,e.weatherForecast=`weatherForecast`,e.window=`window`,e.windowTilt=`windowTilt`})(t||(e.Types=t={}));var n;(function(e){e.Number=`number`,e.String=`string`,e.Boolean=`boolean`})(n||(e.StateType=n={}))})),eG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkEnum=t,e.roleOrEnum=n,e.roleOrEnumLight=a,e.roleOrEnumBlind=c,e.roleOrEnumGate=d,e.roleOrEnumWindow=p,e.roleOrEnumDoor=g,e.getEnums=_,e.getAllStatesInChannel=v,e.getAllStatesInDevice=y,e.getObjectsBelowId=b,e.getFunctionEnums=x,e.getParentId=S;function t(e,t){let n=!1;return e&&e.forEach(e=>{let r=e.lastIndexOf(`.`);r!==-1&&(e=e.substring(r+1));for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&t[r].find(t=>t.test(e)))return n=!0,!1}),n}function n(e,n,r,i){return e.common.role&&r?.includes(e.common.role)?!0:t(n,i)}var r={en:[/lights?/i,/lamps?/i,/ceilings?/i],de:[/licht(er)?/i,/lampen?/i,/beleuchtung(en)?/i],ru:[/свет/i,/ламп[аы]/i,/торшеры?/,/подсветк[аи]/i,/лампочк[аи]/i,/светильники?/i]},i=[`switch.light`,`dimmer`,`value.dimmer`,`level.dimmer`,`sensor.light`,`state.light`];function a(e,t){return n(e,t,i,r)}var o={en:[/blinds?/i,/windows?/i,/shutters?/i],de:[/rollladen?/i,/fenstern?/i,/beschattung(en)?/i,/jalousien?/i],ru:[/ставни/i,/рольставни/i,/окна|окно/,/жалюзи/i]},s=[`blind`,`level.blind`,`value.blind`,`action.stop`,`button.stop`,`button.stop.blind`,`button.open.blind`,`button.close.blind`,`level.tilt`,`value.tilt`,`button.tilt.open`,`button.tilt.close`,`button.tilt.stop`];function c(e,t){return n(e,t,s,o)}var l={en:[/gates?/i],de:[/^toren$/i,/^tor$/i],ru:[/ворота/i]},u=[`gate`,`value.gate`,`switch.gate`,`action.stop`,`button.stop`];function d(e,t){return n(e,t,u,l)}var f=[`window`,`state.window`,`sensor.window`,`value.window`];function p(e,t){return n(e,t,f,o)}var m={en:[/doors?/i,/gates?/i,/wickets?/i,/entry|entries/i],de:[/^türe?/i,/^tuere?/i,/^tore?$/i,/einfahrt(en)?/i,/pforten?/i],ru:[/двери|дверь/i,/ворота/i,/калитка|калитки/,/въезды?/i,/входы?/i]},h=[`door`,`state.door`,`sensor.door`];function g(e,t){return n(e,t,h,m)}function _(){return{door:{roles:h,words:m},window:{roles:f,words:o},blind:{roles:s,words:o},gate:{roles:u,words:l},light:{roles:i,words:r}}}function v(e,t){let n=[],r=RegExp(`^${t.replace(/([$^.)([\]{}])/g,`\\$1`)}\\.[^.]+$`);return e.forEach(e=>r.test(e)&&n.push(e)),n}function y(e,t){let n=[],r=RegExp(`^${t.replace(/([$^.)([\]{}])/g,`\\$1`)}\\.[^.]+\\.[^.]+$`);return e.forEach(e=>r.test(e)&&n.push(e)),n}function b(e,t){let n=[];t+=`.`;let r=0,i=e.length-1,a=-1;for(;r<=i;){let n=Math.floor((r+i)/2);e[n]<t?r=n+1:(a=n,i=n-1)}if(a===-1||a>=e.length)return n;for(let r=a;r<e.length;r++){let i=e[r];if(i===t||i.startsWith(t))n.push(i);else break}return n}function x(e,t){let n=[],r=/^enum\.functions\./,i=b(t,`enum`);for(let t of i)Object.prototype.hasOwnProperty.call(e,t)&&r.test(t)&&e[t]?.type===`enum`&&e[t].common?.members?.length&&n.push(t);return n}function S(e){let t=e.lastIndexOf(`.`);return t===-1?e:e.substring(0,t)}})),tG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.patterns=void 0;var t=$W(),n=eG(),r=/^[^.]+\.setting\./,i={working:{role:/^indicator\.working$/,indicator:!0,notSingle:!0,name:`WORKING`,required:!1,defaultRole:`indicator.working`,defaultType:t.StateType.Boolean},unreach:{role:/^indicator(\.maintenance)?\.unreach$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`UNREACH`,required:!1,defaultRole:`indicator.maintenance.unreach`},lowbat:{role:/^indicator(\.maintenance)?\.(lowbat|battery)$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`LOWBAT`,required:!1,defaultRole:`indicator.maintenance.lowbat`},maintain:{role:/^indicator\.maintenance$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`MAINTAIN`,required:!1,defaultRole:`indicator.maintenance`},error:{role:/^indicator\.error$/,indicator:!0,notSingle:!0,name:`ERROR`,required:!1,defaultRole:`indicator.error`,defaultType:t.StateType.String},direction:{role:/^indicator\.direction$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`DIRECTION`,required:!1,defaultRole:`indicator.direction`},direction_enum:{role:/^(indicator|value)\.direction$/,type:t.StateType.Number,notSingle:!0,name:`DIRECTION`,required:!1,defaultStates:{0:`None`,1:`Up/Open`,2:`Down/Close`,3:`Unknown`},defaultRole:`value.direction`},reachable:{role:/^indicator\.reachable$/,indicator:!0,type:t.StateType.Boolean,notSingle:!0,name:`CONNECTED`,required:!1,defaultRole:`indicator.reachable`,inverted:!0},battery:{role:/^value\.battery$/,indicator:!1,type:t.StateType.Number,write:!1,name:`BATTERY`,required:!1,defaultRole:`value.battery`,defaultUnit:`%`}},a={power:{role:/^value\.power$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ELECTRIC_POWER`,required:!1,defaultRole:`value.power`,defaultUnit:`W`},current:{role:/^value\.current$/,indicator:!1,type:t.StateType.Number,write:!1,name:`CURRENT`,required:!1,defaultRole:`value.current`,defaultUnit:`mA`},voltage:{role:/^value\.voltage$/,indicator:!1,type:t.StateType.Number,write:!1,name:`VOLTAGE`,required:!1,defaultRole:`value.voltage`,defaultUnit:`V`},consumption:{role:/^value\.power\.consumption$/,indicator:!1,type:t.StateType.Number,write:!1,name:`CONSUMPTION`,required:!1,defaultRole:`value.power.consumption`,defaultUnit:`Wh`},frequency:{role:/^value\.frequency$/,indicator:!1,type:t.StateType.Number,write:!1,name:`FREQUENCY`,required:!1,defaultRole:`value.frequency`,defaultUnit:`Hz`}};e.patterns={chart:{states:[{objectType:`chart`,name:`CHART`}],type:t.Types.chart},mediaPlayer:{states:[{role:/^media\.state(\..*)?$/,indicator:!1,type:[t.StateType.Boolean,t.StateType.Number],name:`STATE`,required:!0,defaultRole:`media.state`},{role:/^(button|action)\.play(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`PLAY`,required:!1,noSubscribe:!0,defaultRole:`button.play`},{role:/^(button|action)\.pause(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`PAUSE`,required:!1,noSubscribe:!0,defaultRole:`button.pause`},{role:/^(button|action)\.stop(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop`},{role:/^(button|action)\.next(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`NEXT`,required:!1,noSubscribe:!0,defaultRole:`button.next`},{role:/^(button|action)\.prev(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`PREV`,required:!1,noSubscribe:!0,defaultRole:`button.prev`},{role:/^media\.mode\.shuffle(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Boolean,name:`SHUFFLE`,required:!1,defaultRole:`media.mode.shuffle`},{role:/^media\.mode\.repeat(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`REPEAT`,required:!1,defaultRole:`media.mode.repeat`},{role:/^media\.artist(\..*)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`ARTIST`,required:!1,defaultRole:`media.artist`},{role:/^media\.album(\..*)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`ALBUM`,required:!1,defaultRole:`media.album`},{role:/^media\.title(\..*)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`TITLE`,required:!1,defaultRole:`media.title`},{role:/^media\.cover(\.big)?$/,indicator:!1,write:!1,type:t.StateType.String,name:`COVER`,required:!1,notSingle:!0,defaultRole:`media.cover`},{role:/^media\.cover(\..*)$/,indicator:!1,write:!1,type:t.StateType.String,name:`COVER`,required:!1,notSingle:!0},{role:/^media\.duration(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,name:`DURATION`,required:!1,defaultRole:`media.duration`,defaultUnit:`sec`},{role:/^media\.elapsed(\..*)?$/,indicator:!1,type:t.StateType.Number,name:`ELAPSED`,required:!1,defaultRole:`media.elapsed`,defaultUnit:`sec`},{role:/^media\.seek(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SEEK`,required:!1,defaultRole:`media.seek`},{role:/^media\.track(\..*)?$/,indicator:!1,type:t.StateType.String,name:`TRACK`,required:!1,defaultRole:`media.track`},{role:/^media\.episode(\..*)?$/,indicator:!1,type:t.StateType.String,name:`EPISODE`,required:!1,defaultRole:`media.episode`},{role:/^media\.season(\..*)?$/,indicator:!1,type:t.StateType.String,name:`SEASON`,required:!1,defaultRole:`media.season`},{role:/^level(\.volume)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`VOLUME`,required:!1,notSingle:!0,defaultRole:`level.volume`,defaultUnit:`%`},{role:/^value(\.volume)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`VOLUME_ACTUAL`,required:!1,notSingle:!0,defaultRole:`value.volume`,defaultUnit:`%`},{role:/^media(\.mute)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`MUTE`,required:!1,notSingle:!0,defaultRole:`media.mute`},{role:/^media\.player\.name$/,indicator:!1,type:t.StateType.String,name:`PLAYER_NAME`,required:!1,notSingle:!0,defaultRole:`media.player.name`},{role:/^media\.player\.type/,indicator:!1,type:t.StateType.String,write:!1,name:`PLAYER_TYPE`,required:!1,notSingle:!0,defaultRole:`media.player.type`},{stateName:/\.(paused|playerState)$/,indicator:!1,name:`IGNORE`,required:!1,multiple:!0,noSubscribe:!0},i.reachable,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.media},weatherForecast:{states:[{role:/^weather\.icon(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`ICON`,required:!0,defaultRole:`weather.icon.forecast.0`},{role:/^value\.temperature\.min\.forecast\.0$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MIN`,required:!0,defaultRole:`value.temperature.min.forecast.0`},{role:/^value\.temperature\.max\.forecast\.0$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MAX`,required:!0,defaultRole:`value.temperature.max.forecast.0`},{role:/^value\.precipitation(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION_CHANCE`,unit:`%`,required:!1,defaultRole:`value.precipitation.forecast.0`},{role:/^value\.precipitation(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION`,unit:`mm`,required:!1,defaultRole:`value.precipitation.forecast.0`},{role:/^date(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`DATE`,required:!1,defaultRole:`date.forecast.0`},{role:/^dayofweek(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`DOW`,required:!1,defaultRole:`dayofweek.forecast.0`},{role:/^weather\.state(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`STATE`,required:!1,defaultRole:`weather.state.forecast.0`},{role:/^value\.temperature(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`TEMP`,required:!1,defaultRole:`value.temperature.forecast.0`},{role:/^value\.pressure(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`PRESSURE`,required:!1,defaultRole:`value.pressure.forecast.0`},{role:/^value\.humidity(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY`,required:!1,defaultRole:`value.humidity.forecast.0`},{role:/^(?:date|time)\.sunrise(?:\.forecast\.0)?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNRISE`,required:!1,defaultRole:`date.sunrise`},{role:/^(?:date|time)\.sunset(?:\.forecast\.0)?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNSET`,required:!1,defaultRole:`date.sunset`},{role:/^value\.temperature\.windchill(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`WIND_CHILL`,required:!1,defaultRole:`value.temperature.windchill.forecast.0`},{role:/^value\.temperature\.feelslike(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`FEELS_LIKE`,required:!1,defaultRole:`value.temperature.feelslike.forecast.0`},{role:/^value\.speed\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`WIND_SPEED`,required:!1,defaultRole:`value.speed.wind.forecast.0`},{role:/^value\.direction\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.Number,name:`WIND_DIRECTION`,required:!1,defaultRole:`value.direction.wind.forecast.0`},{role:/^weather\.direction\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`WIND_DIRECTION_STR`,required:!1,defaultRole:`weather.direction.wind.forecast.0`},{role:/^weather\.icon\.wind(\.forecast\.0)?$/,indicator:!1,type:t.StateType.String,name:`WIND_ICON`,required:!1,defaultRole:`weather.icon.wind.forecast.0`},{role:/^weather\.chart\.url$/,indicator:!1,type:t.StateType.String,name:`HISTORY_CHART`,required:!1,noSubscribe:!0,defaultRole:`weather.chart.url`},{role:/^weather\.chart\.url\.forecast$/,indicator:!1,type:t.StateType.String,name:`FORECAST_CHART`,required:!1,noSubscribe:!0,defaultRole:`weather.chart.url.forecast`},{role:/^location$/,indicator:!1,type:t.StateType.String,name:`LOCATION`,required:!1,defaultRole:`location`},{role:/^weather\.icon\.forecast.(\d+)$/,indicator:!1,type:t.StateType.String,name:`ICON%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0,notSingle:!0},{role:/^value\.temperature\.min\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MIN%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.temperature\.max\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`TEMP_MAX%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^date\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`DATE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^dayofweek\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`DOW%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^weather\.state\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`STATE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.temperature\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`TEMP%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.pressure\.forecast\.(\d+)?$/,indicator:!1,type:t.StateType.Number,name:`PRESSURE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.humidity\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.humidity\.max\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY_MAX%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.precipitation\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,unit:`%`,name:`PRECIPITATION_CHANCE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.precipitation\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,unit:`mm`,name:`PRECIPITATION%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.speed\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`WIND_SPEED%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^value\.direction\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.Number,name:`WIND_DIRECTION%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^weather\.direction\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`WIND_DIRECTION_STR%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^weather\.icon\.wind\.forecast\.(\d+)$/,indicator:!1,type:t.StateType.String,name:`WIND_ICON%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^(?:date|time)\.sunrise(?:\.forecast\.(\d+))?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNRISE%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0},{role:/^(?:date|time)\.sunset(?:\.forecast\.(\d+))?$/,indicator:!1,type:[t.StateType.String,t.StateType.Number],name:`TIME_SUNSET%d`,required:!1,searchInParent:!0,multiple:!0,noSubscribe:!0}],type:t.Types.weatherForecast},rgb:{states:[{role:/^level\.color\.red$/,indicator:!1,type:t.StateType.Number,write:!0,name:`RED`,required:!0,defaultRole:`level.color.red`},{role:/^level\.color\.green$/,indicator:!1,type:t.StateType.Number,write:!0,name:`GREEN`,required:!0,defaultRole:`level.color.green`},{role:/^level\.color\.blue$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BLUE`,required:!0,defaultRole:`level.color.blue`},{role:/^level\.color\.white$/,indicator:!1,type:t.StateType.Number,write:!0,name:`WHITE`,required:!1,defaultRole:`level.color.white`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$|^state$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.rgb},rgbwSingle:{states:[{role:/^level\.color\.rgbw$/,indicator:!1,type:t.StateType.String,write:!0,name:`RGBW`,required:!0,defaultRole:`level.color.rgbw`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.rgbwSingle},rgbSingle:{states:[{role:/^level\.color\.rgb$/,indicator:!1,type:t.StateType.String,write:!0,name:`RGB`,required:!0,defaultRole:`level.color.rgb`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.rgbSingle},cie:{states:[{role:/^level\.color\.cie$/,indicator:!1,type:t.StateType.String,write:!0,name:`CIE`,required:!0,defaultRole:`level.color.cie`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.cie},hue:{states:[{role:/^level\.color\.hue$/,indicator:!1,type:t.StateType.Number,write:!0,name:`HUE`,required:!0,defaultRole:`level.color.hue`,defaultUnit:`°`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,searchInParent:!0,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1},{role:/^level\.color\.saturation$/,indicator:!1,type:t.StateType.Number,write:!0,name:`SATURATION`,required:!1,defaultRole:`level.color.saturation`,defaultUnit:`%`},{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!1,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.hue},ct:{states:[{role:/^level\.color\.temperature$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TEMPERATURE`,required:!0,defaultRole:`level.color.temperature`,defaultUnit:`°K`},{role:/^level\.dimmer$/,indicator:!1,type:t.StateType.Number,write:!0,name:`DIMMER`,required:!1,defaultRole:`level.dimmer`,defaultUnit:`%`},{role:/^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,name:`BRIGHTNESS`,required:!1},{role:/^switch(\.light)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`ON`,required:!1,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.ct},warning:{states:[{role:/^value\.warning$/,indicator:!1,name:`LEVEL`,required:!0,defaultRole:`value.warning`},{role:/^weather\.title\.short$/,indicator:!1,type:t.StateType.String,name:`TITLE`,required:!1,defaultRole:`weather.title.short`},{role:/^weather\.title$/,indicator:!1,type:t.StateType.String,name:`INFO`,required:!1,defaultRole:`weather.title`},{role:/^date\.start$/,indicator:!1,type:t.StateType.String,name:`START`,required:!1,defaultRole:`date.start`},{role:/^date\.end$/,indicator:!1,type:t.StateType.String,name:`END`,required:!1,defaultRole:`date.end`},{role:/^date$/,indicator:!1,type:t.StateType.String,name:`START`,required:!1},{role:/^weather\.chart\.url/,indicator:!1,type:t.StateType.String,name:`ICON`,required:!1,defaultRole:`weather.chart.url`},{role:/^weather\.state$/,indicator:!1,type:t.StateType.String,name:`DESC`,required:!1,noSubscribe:!0,defaultRole:`weather.state`}],type:t.Types.warning},airCondition:{states:[{role:/temperature(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SET`,required:!0,defaultRole:`level.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/(level\.mode\.)?airconditioner$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`MODE`,required:!0,defaultRole:`level.mode.airconditioner`,defaultStates:{0:`AUTO`,3:`COOL`,4:`DRY`,5:`ECO`,6:`FAN_ONLY`,7:`HEAT`,8:`OFF`},ignoreRole:r},{role:/(speed|mode)\.fan$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SPEED`,required:!1,defaultRole:`level.mode.fan`,defaultStates:{0:`AUTO`,1:`HIGH`,2:`LOW`,3:`MEDIUM`,4:`QUIET`,5:`TURBO`},ignoreRole:r},{role:/^switch(\.power)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`POWER`,required:!1,defaultRole:`switch.power`},{role:/temperature(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`ACTUAL`,required:!1,defaultRole:`value.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/humidity(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`HUMIDITY`,required:!1,defaultRole:`value.humidity`,defaultUnit:`%`,ignoreRole:r},{role:/^switch\.boost(\..*)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`BOOST`,required:!1,defaultRole:`switch.boost`},{role:/swing$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`SWING`,required:!1,defaultRole:`level.mode.swing`,defaultStates:{0:`AUTO`,1:`HORIZONTAL`,2:`STATIONARY`,3:`VERTICAL`},ignoreRole:r},{role:/swing$/,indicator:!1,write:!0,type:t.StateType.Boolean,searchInParent:!0,name:`SWING`,required:!1,defaultRole:`switch.mode.swing`,ignoreRole:r},...Object.values(a),i.unreach,i.maintain,i.error],type:t.Types.airCondition},thermostat:{states:[{role:/temperature(\..*)?$/,indicator:!1,write:!0,type:t.StateType.Number,name:`SET`,required:!0,defaultRole:`level.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/temperature(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`ACTUAL`,required:!1,defaultRole:`value.temperature`,defaultUnit:`°C`,ignoreRole:r},{role:/humidity(\..*)?$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,name:`HUMIDITY`,required:!1,defaultRole:`value.humidity`,defaultUnit:`%`,ignoreRole:r},{role:/^switch(\.mode)?\.boost(\..*)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`BOOST`,required:!1,defaultRole:`switch.mode.boost`},{role:/^switch(\.power)?$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`POWER`,required:!1,defaultRole:`switch.power`},{role:/^switch(\.mode)?\.party$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`PARTY`,required:!1,defaultRole:`switch.mode.party`},{role:/^level(\.mode)?\.thermostat$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`MODE`,required:!1,defaultRole:`level.mode.thermostat`,defaultStates:{0:`AUTO`,1:`MANUAL`}},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.thermostat},vacuumCleaner:{states:[{role:/^switch\.power$/,indicator:!1,write:!0,type:[t.StateType.Boolean,t.StateType.Number],searchInParent:!0,name:`POWER`,required:!0,defaultRole:`switch.power`},{role:/mode\.cleanup$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`MODE`,required:!0,defaultRole:`level.mode.cleanup`,defaultStates:{0:`AUTO`,1:`NORMAL`,2:`QUIET`,3:`ECO`,4:`EXPRESS`},ignoreRole:r},{role:/vacuum\.map\.base64$/,indicator:!1,write:!1,type:t.StateType.String,searchInParent:!0,name:`MAP_BASE64`,required:!1,defaultRole:`vacuum.map.base64`,ignoreRole:r},{role:/vacuum\.map\.url$/,indicator:!1,write:!1,type:t.StateType.String,searchInParent:!0,name:`MAP_URL`,required:!1,ignoreRole:r},{role:/mode\.work$/,indicator:!1,write:!0,type:t.StateType.Number,searchInParent:!0,name:`WORK_MODE`,required:!1,defaultRole:`level.mode.work`,defaultStates:{0:`AUTO`,1:`FAST`,2:`MEDIUM`,3:`SLOW`,4:`TURBO`},ignoreRole:r},{role:/^value\.water$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,unit:`%`,name:`WATER`,required:!1,defaultRole:`value.water`,defaultUnit:`%`},{role:/^value\.waste$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,unit:`%`,name:`WASTE`,required:!1,defaultRole:`value.waste`,defaultUnit:`%`},{role:/^value\.battery$/,indicator:!1,write:!1,type:t.StateType.Number,searchInParent:!0,unit:`%`,name:`BATTERY`,required:!1,defaultRole:`value.battery`,defaultUnit:`%`},{role:/^value\.state$/,indicator:!1,write:!1,type:[t.StateType.Number,t.StateType.String],searchInParent:!0,name:`STATE`,required:!1,defaultRole:`value.state`},{role:/^switch\.pause$/,indicator:!1,write:!0,type:t.StateType.Boolean,searchInParent:!0,name:`PAUSE`,required:!1,defaultRole:`switch.pause`},{role:/^indicator(\.maintenance)?\.waste$|^indicator(\.alarm)?\.waste/,indicator:!0,type:t.StateType.Boolean,searchInParent:!0,name:`WASTE_ALARM`,required:!1,defaultRole:`indicator.maintenance.waste`},{role:/^indicator(\.maintenance)?\.water$|^indicator(\.alarm)?\.water/,indicator:!0,type:t.StateType.Boolean,searchInParent:!0,name:`WATER_ALARM`,required:!1,defaultRole:`indicator.maintenance.water`},{role:/^value(\.usage)?\.filter/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`FILTER`,required:!1,defaultRole:`value.usage.filter`,defaultUnit:`%`},{role:/^value(\.usage)?\.brush/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`BRUSH`,required:!1,defaultRole:`value.usage.brush`,defaultUnit:`%`},{role:/^value(\.usage)?\.sensors/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`SENSORS`,required:!1,defaultRole:`value.usage.sensors`,defaultUnit:`%`},{role:/^value(\.usage)?\.brush\.side/,indicator:!0,type:t.StateType.Number,searchInParent:!0,name:`SIDE_BRUSH`,required:!1,defaultRole:`value.usage.brush.side`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.vacuumCleaner},blinds:{states:[{role:/^level(\.blind)?$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumBlind,name:`SET`,required:!0,defaultRole:`level.blind`,defaultUnit:`%`},{role:/^value(\.blind)?$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumBlind,name:`ACTUAL`,required:!1,defaultRole:`value.blind`,defaultUnit:`%`},{role:/^(button|action)\.stop(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop.blind`},{role:/^(button|action)\.open(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`OPEN`,required:!1,noSubscribe:!0,defaultRole:`button.open.blind`},{role:/^(button|action)\.close(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`CLOSE`,required:!1,noSubscribe:!0,defaultRole:`button.close.blind`},{role:/^level(\.open)?\.tilt$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumBlind,name:`TILT_SET`,required:!1,defaultRole:`level.tilt`},{role:/^value(\.open)?\.tilt$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumBlind,name:`TILT_ACTUAL`,required:!1,defaultRole:`value.tilt`},{role:/^(button|action)\.stop\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop.tilt`},{role:/^(button|action)\.open\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_OPEN`,required:!1,noSubscribe:!0,defaultRole:`button.open.tilt`},{role:/^(button|action)\.close\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_CLOSE`,required:!1,noSubscribe:!0,defaultRole:`button.close.tilt`},i.direction,i.direction_enum,i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.blind},blindButtons:{states:[{role:/^(button|action)\.stop(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`STOP`,required:!0,noSubscribe:!0,defaultRole:`button.stop.blind`},{role:/^(button|action)\.open(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`OPEN`,required:!0,noSubscribe:!0,defaultRole:`button.open.blind`},{role:/^(button|action)\.close(\.blind)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`CLOSE`,required:!0,noSubscribe:!0,defaultRole:`button.close.blind`},{role:/^level\.tilt$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumBlind,name:`TILT_SET`,required:!1,defaultRole:`level.tilt`},{role:/^value\.tilt$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumBlind,name:`TILT_ACTUAL`,required:!1,defaultRole:`value.tilt`},{role:/^(button|action)\.stop\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop.tilt`},{role:/^(button|action)\.open\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_OPEN`,required:!1,noSubscribe:!0,defaultRole:`button.open.tilt`},{role:/^(button|action)\.close\.tilt$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumBlind,name:`TILT_CLOSE`,required:!1,noSubscribe:!0,defaultRole:`button.close.tilt`},i.direction,i.direction_enum,i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.blindButtons},gate:{states:[{role:/^switch(\.gate)?$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumGate,name:`SET`,required:!0,defaultRole:`switch.gate`},{role:/^value(\.(position|gate))?$/,indicator:!1,type:t.StateType.Number,enums:n.roleOrEnumGate,name:`ACTUAL`,required:!1,defaultRole:`value.blind`,defaultUnit:`%`,ignoreRole:r},{role:/^(button|action)\.stop$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumGate,name:`STOP`,required:!1,noSubscribe:!0,defaultRole:`button.stop`},i.direction,i.direction_enum,i.working,i.unreach,i.maintain,i.error],type:t.Types.gate},weatherCurrent:{states:[{role:/^value(\.temperature)?$/,indicator:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.temperature`,defaultUnit:`°C`},{role:/^weather\.icon$/,indicator:!1,name:`ICON`,required:!0,defaultRole:`weather.icon`},{role:/^value\.precipitation\.chance$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION_CHANCE`,defaultRole:`value.precipitation.chance`,defaultUnit:`%`},{role:/^value\.precipitation\.type$/,indicator:!1,type:t.StateType.Number,name:`PRECIPITATION_TYPE`,defaultRole:`value.precipitation.type`,defaultStates:{0:`NO`,1:`RAIN`,2:`SNOW`,3:`HAIL`}},{role:/^value\.pressure$/,indicator:!1,type:t.StateType.Number,name:`PRESSURE`,defaultRole:`value.pressure`,defaultUnit:`mbar`},{role:/^value\.pressure\.tendency$/,indicator:!1,type:t.StateType.String,name:`PRESSURE_TENDENCY`,defaultRole:`value.pressure.tendency`},{role:/^value\.temperature\.windchill$/,indicator:!1,type:t.StateType.Number,name:`REAL_FEEL_TEMPERATURE`,defaultRole:`value.temperature.windchill`,defaultUnit:`°C`},{role:/^value\.humidity$/,indicator:!1,type:t.StateType.Number,name:`HUMIDITY`,defaultRole:`value.humidity`,defaultUnit:`%`},{role:/^value\.uv$/,indicator:!1,type:t.StateType.Number,name:`UV`,defaultRole:`value.uv`},{role:/^weather\.state$/,indicator:!1,type:t.StateType.String,name:`WEATHER`,defaultRole:`weather.state`},{role:/^value\.direction\.wind$/,indicator:!1,type:t.StateType.String,name:`WIND_DIRECTION`,defaultRole:`value.direction.wind`,defaultUnit:`°`},{role:/^value\.speed\.wind\.gust$/,indicator:!1,type:t.StateType.Number,name:`WIND_GUST`,defaultRole:`value.speed.wind.gust`,defaultUnit:`km/h`},{role:/^value\.speed\.wind$/,indicator:!1,type:t.StateType.Number,name:`WIND_SPEED`,defaultRole:`value.speed.wind$`,defaultUnit:`km/h`},i.lowbat,i.unreach,i.maintain,i.error,i.battery],type:t.Types.weatherCurrent},camera:{states:[{role:/^link\.camera(\.\w+)?$/,indicator:!1,type:t.StateType.String,name:`URL`,required:!0,defaultRole:`link.camera`},{role:/^switch(\.camera)?\.autofocus$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`AUTOFOCUS`,required:!1,defaultRole:`switch.camera.autofocus`},{role:/^switch(\.camera)?\.autowhitebalance$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`AUTOWHITEBALANCE`,required:!1,defaultRole:`switch.camera.autowhitebalance`},{role:/^switch(\.camera)?\.brightness$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`BRIGHTNESS`,required:!1,defaultRole:`switch.camera.brightness`},{role:/^switch(\.camera)?\.nightmode$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`NIGHTMODE`,required:!1,defaultRole:`switch.camera.nightmode`},{role:/^level(\.camera)?\.position$|^level(\.camera)?(\.ptz)$/,indicator:!1,type:t.StateType.Number,write:!0,name:`PTZ`,required:!1,defaultRole:`level.camera.position`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.camera,enumRequired:!1},lock:{states:[{role:/^switch\.lock$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`SET`,required:!0,defaultRole:`switch.lock`},{role:/^state$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ACTUAL`,required:!1,defaultRole:`state`},{indicator:!1,type:t.StateType.Boolean,write:!0,read:!1,name:`OPEN`,required:!1,noSubscribe:!0,defaultRole:`button`,ignoreRole:r},{role:/^(state|sensor)(\.door)?$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`DOOR_STATE`,required:!1,defaultRole:`sensor.door`,ignoreRole:r},i.direction,i.direction_enum,i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.lock},motion:{states:[{role:/^(state\.)?motion$|^sensor\.motion$/,indicator:!1,type:t.StateType.Boolean,name:`ACTUAL`,required:!0,defaultRole:`sensor.motion`,ignoreRole:r},{role:/brightness$/,indicator:!1,type:t.StateType.Number,name:`SECOND`,required:!1,defaultRole:`value.brightness`,defaultUnit:`lux`,ignoreRole:r},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.motion},window:{states:[{role:/^(state|sensor)(\.window)?/,indicator:!1,type:t.StateType.Boolean,enums:n.roleOrEnumWindow,write:!1,name:`ACTUAL`,required:!0,defaultRole:`sensor.window`,ignoreRole:r},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.window},windowTilt:{states:[{role:/^state$|^value(\.window)?$/,indicator:!1,type:t.StateType.Number,write:!1,enums:n.roleOrEnumWindow,name:`ACTUAL`,required:!0,defaultRole:`value.window`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.windowTilt},fireAlarm:{states:[{role:/^(state|sensor|indicator)(\.alarm)?\.fire$/,indicator:!1,type:t.StateType.Boolean,name:`ACTUAL`,required:!0,defaultRole:`sensor.alarm.fire`,defaultChannelRole:`sensor.alarm.fire`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.fireAlarm,enumRequired:!1},floodAlarm:{states:[{role:/^(state|sensor|indicator)(\.alarm)?\.flood$/,indicator:!1,type:t.StateType.Boolean,name:`ACTUAL`,required:!0,defaultRole:`sensor.alarm.flood`,defaultChannelRole:`sensor.alarm.flood`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.floodAlarm},door:{states:[{role:/^(state|sensor)(\.door)?/,indicator:!1,type:t.StateType.Boolean,write:!1,enums:n.roleOrEnumDoor,name:`ACTUAL`,required:!0,defaultRole:`sensor.door`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.door},dimmer:{states:[{role:/^level(\.dimmer)?$|^level\.brightness$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumLight,name:`SET`,required:!0,defaultRole:`level.dimmer`,ignoreRole:/^level\.dimspeed$/,defaultUnit:`%`},{role:/^value(\.dimmer)?$/,indicator:!1,type:t.StateType.Number,write:!1,enums:n.roleOrEnumLight,name:`ACTUAL`,required:!1,defaultRole:`value.dimmer`,defaultUnit:`%`},{role:/^switch(\.light)?$|^state$/,indicator:!1,type:t.StateType.Boolean,write:!0,enums:n.roleOrEnumLight,name:`ON_SET`,required:!1,defaultRole:`switch.light`},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,enums:n.roleOrEnumLight,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^time\.(span|interval)$/,indicator:!1,type:t.StateType.Number,write:!0,enums:n.roleOrEnumLight,name:`TRANSITION_TIME`,required:!1,defaultRole:`time.span`,defaultUnit:`ms`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.dimmer},light:{states:[{role:/^switch(\.light)?$|^state$/,enums:n.roleOrEnumLight,indicator:!1,type:t.StateType.Boolean,write:!0,name:`SET`,required:!0,defaultRole:`switch.light`},{role:/^(state|switch|sensor)\.light|switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,enums:n.roleOrEnumLight,name:`ON_ACTUAL`,required:!1,defaultRole:`sensor.light`,ignoreRole:r},{role:/^level\.effect$/,indicator:!1,type:[t.StateType.Number,t.StateType.String],write:!0,statesDefined:!0,name:`EFFECT`,required:!1,defaultRole:`level.effect`,defaultStates:{0:`None`}},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.light},volume:{states:[{role:/^level\.volume$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`SET`,required:!0,defaultRole:`level.volume`,defaultUnit:`%`},{role:/^value\.volume$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value.volume`,defaultUnit:`%`},{role:/^media\.mute$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`MUTE`,required:!1,defaultRole:`media.mute`},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.volume},locationOne:{states:[{role:/^value\.gps$/,indicator:!1,type:t.StateType.String,write:!1,name:`GPS`,required:!0,defaultRole:`value.gps`},{role:/^value\.gps\.elevation$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ELEVATION`,required:!1,defaultRole:`value.gps.elevation`},{role:/^value(\.gps)?\.radius$/,indicator:!1,type:t.StateType.Number,write:!1,name:`RADIUS`,required:!1,defaultRole:`value.gps.radius`},{role:/^value(\.gps)?\.accuracy$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ACCURACY`,required:!1,defaultRole:`value.gps.accuracy`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.locationOne},location:{states:[{role:/^value(\.gps)?\.longitude$/,indicator:!1,type:t.StateType.Number,write:!1,name:`LONGITUDE`,required:!0,defaultRole:`value.gps.longitude`,defaultUnit:`°`},{role:/^value(\.gps)?\.latitude$/,indicator:!1,type:t.StateType.Number,write:!1,name:`LATITUDE`,required:!0,defaultRole:`value.gps.latitude`,defaultUnit:`°`},{role:/^value(\.gps)?\.elevation$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ELEVATION`,required:!1,defaultRole:`value.gps.elevation`},{role:/^value(\.gps)?\.radius$/,indicator:!1,type:t.StateType.Number,write:!1,name:`RADIUS`,required:!1,defaultRole:`value.gps.radius`},{role:/^value(\.gps)?\.accuracy$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ACCURACY`,required:!1,defaultRole:`value.gps.accuracy`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.location},volumeGroup:{states:[{role:/^level\.volume\.group?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`SET`,required:!0,defaultRole:`level.volume.group`,defaultUnit:`%`},{role:/^value\.volume\.group$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value.volume.group`,defaultUnit:`%`},{role:/^media\.mute\.group$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`MUTE`,required:!1,defaultRole:`media.mute.group`},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.volumeGroup},percentage:{states:[{role:/^level(\..*)?$/,indicator:!1,type:t.StateType.Number,write:!0,unit:`%`,name:`SET`,required:!0,defaultRole:`level`,defaultUnit:`%`,ignoreRole:r},{role:/^value(\..*)?$/,indicator:!1,type:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value`,defaultUnit:`%`,ignoreRole:r},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.percentage},levelSlider:{states:[{role:/^level(\..*)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!0,name:`SET`,required:!0,defaultRole:`level`,defaultUnit:`%`,ignoreRole:r},{role:/^value(\..*)?$/,indicator:!1,type:t.StateType.Number,min:t.StateType.Number,max:t.StateType.Number,write:!1,name:`ACTUAL`,required:!1,defaultRole:`value`,defaultUnit:`%`,ignoreRole:r},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.slider},socket:{states:[{role:/^switch(\.active)?$|^state$/,indicator:!1,type:t.StateType.Boolean,write:!0,name:`SET`,required:!0,defaultRole:`switch`},{role:/^state(\.active)?$|^sensor.switch$/,indicator:!1,type:t.StateType.Boolean,write:!1,name:`ACTUAL`,required:!1,defaultRole:`sensor.switch`},...Object.values(a),i.working,i.unreach,i.lowbat,i.maintain,i.error],type:t.Types.socket},button:{states:[{role:/^(button|action)(\.[.\w]+)?$/,indicator:!1,type:t.StateType.Boolean,read:!1,write:!0,name:`SET`,required:!0,noSubscribe:!0,defaultRole:`button`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.button},buttonSensor:{states:[{role:/^button(\.[.\w]+)?$/,indicator:!1,type:t.StateType.Boolean,read:!0,write:!1,name:`PRESS`,required:!0,defaultRole:`button.press`},{role:/^button\.long/,indicator:!1,type:t.StateType.Boolean,read:!0,write:!1,name:`PRESS_LONG`,required:!1,defaultRole:`button.long`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.buttonSensor},temperature:{states:[{role:/\.temperature$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.temperature`,defaultUnit:`°C`},{role:/\.humidity$/,indicator:!1,write:!1,type:t.StateType.Number,name:`SECOND`,required:!1,defaultRole:`value.humidity`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.temperature},humidity:{states:[{role:/\.humidity$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.humidity`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.humidity},illuminance:{states:[{role:/\.brightness$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.brightness`,defaultUnit:`lux`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.illuminance},fillLevel:{states:[{role:/^value\.fill(\.[-.\w]+)?$/,indicator:!1,write:!1,type:t.StateType.Number,name:`ACTUAL`,required:!0,defaultRole:`value.fill`,defaultUnit:`%`},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.fillLevel},image:{states:[{role:/\.icon$|^icon$|^icon\.|\.icon\.|\.chart\.url\.|\.chart\.url$|^url.icon$/,indicator:!1,write:!1,type:t.StateType.String,name:`URL`,defaultRole:`icon`,required:!0,ignoreRole:r},i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.image},info:{states:[{indicator:!1,name:`ACTUAL`,required:!0,multiple:!0,noDeviceDetection:!0,ignoreRole:/\.inhibit$/,defaultRole:`state`},i.working,i.unreach,i.lowbat,i.maintain,i.error,i.battery],type:t.Types.info}}})),nG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ChannelDetector=void 0;var t=$W(),n=eG(),r=tG(),i=class e{constructor(){this.enums=null,this.cache={}}_applyPattern(e,r,i,a,o){if(e[r]?.common){let s=null;if(i.role&&(s=i.role.test(e[r].common.role||``),s&&i.channelRole)){let t=(0,n.getParentId)(r),a=e[t]?.common.role||``;s=a&&(e[t].type===`channel`||e[t].type===`device`)?i.channelRole.test(a):!1}if(s===!1)return!1;if(i.type){if(typeof i.type==`string`){if(i.type!==e[r].common.type)return!1}else if(Array.isArray(i.type)){let t=!1;for(let n=0;n<i.type.length;n++)if(i.type[n]===e[r].common.type){t=!0;break}if(!t)return!1}}if(i.objectType&&e[r].type!==i.objectType||i.stateName&&!i.stateName.test(r)||i.unit&&i.unit!==e[r].common.unit)return!1;if(i.ignoreRole){let t=e[r].common.role||``;if(t&&i.ignoreRole.test(t))return!1}if(i.indicator===!1&&(e[r].common.role||``).match(/^indicator(\.[.\w]+)?$/))return!1;if(i.state){let e=r.split(`.`).pop()||``;if(e&&!i.state.test(e))return!1}let c=i.defaultRole&&e[r].common.role===i.defaultRole,l=i.defaultUnit?e[r].common.unit===i.defaultUnit:!1;if(i.min===t.StateType.Number&&typeof e[r].common.min!==t.StateType.Number&&(!l||e[r].common.unit!==`%`)||i.max===t.StateType.Number&&typeof e[r].common.max!==t.StateType.Number&&(!l||e[r].common.unit!==`%`)||i.statesDefined===!0&&typeof e[r].common.states!=`object`)return!1;if(!c){if(i.write!==void 0&&i.write!==!!e[r].common.write||i.read!==void 0&&i.read!==(e[r].common.read===void 0||e[r].common.read))return!1;if(typeof i.enums==`function`){let t=this._getEnumsForId(e,r,o);if(!a&&!i.enums(e[r],t||[]))return!1}}return!0}return!1}_getEnumsForId(e,t,r){this.enums||=(0,n.getFunctionEnums)(e,r);let i=[];if(this.enums.forEach(n=>{e[n].common.members.includes(t)&&i.push(n)}),!i.length&&e[t]?.type===`state`){let r=(0,n.getParentId)(t);e[r]&&(e[r].type===`channel`||e[r].type===`device`)&&this.enums.forEach(t=>{e[t].common.members.includes(r)&&i.push(t)})}return i.length?i:null}static copyState(e,t){let n=t||JSON.parse(JSON.stringify(e));return n.original=e.original||e,`enums`in e&&e.enums&&(n.enums=e.enums),`role`in e&&e.role&&(n.role=e.role),`channelRole`in e&&e.channelRole&&(n.channelRole=e.channelRole),n}_testOneState(t){let n=t.objects,i=t.pattern,a=t.state,o=t.channelStates,s=t.usedIds,c=t.usedInCurrentDevice,l=t.ignoreIndicators,u=t.ignoreEnums,d=t.sortedKeys,f=t.result,p=!1;for(let m of o)if(!(a.name===`COVER`&&f?.states.find(e=>e.id&&e.name===`COVER`))){if(a.indicator&&l){let e=m.split(`.`).pop()||``;if(e&&l.includes(e))continue}if(!a.indicator&&(c.includes(m)||!a.notSingle&&!t.detectAllPossibleDevices&&s.includes(m)))continue;if(this._applyPattern(n,m,a,u,d)){if(f||(f=JSON.parse(JSON.stringify(r.patterns[i])),t.result=f,f?.states.forEach((t,n)=>e.copyState(r.patterns[i].states[n],t))),f.states.find(({id:e})=>e===m))p=!0;else for(let e of f.states)if(e.name===a.name){if(e.id){let r;t.favorId&&(m===t.favorId?r=!0:e.id===t.favorId&&(r=!1));let i=n[e.id]?.common?.role??``,a=n[m]?.common?.role??``,o=e.defaultRole;if(o&&r===void 0&&(a===o?r=!0:i===o&&(r=!1)),r===void 0){let e=a.split(`.`),t=e.length,n=i.split(`.`),o=n.length;r=a===``||e[0]===`state`&&n[0]!==`state`?!1:e[0]!==`state`&&n[0]===`state`||t>o?!0:t<o?!1:e[0]!==`state`}if(!r)break}e.id=m,p=!0;break}if(p&&(a.indicator||c.push(m),a.multiple&&o.length>1)){for(let t of o)if(t!==m&&(a.indicator||!c.includes(t)&&(a.notSingle||!s.includes(t)))&&this._applyPattern(n,t,a,u,d))if(a.indicator||c.push(t),Array.isArray(a)){let n=e.copyState(a[0]);n.id=t,f.states.push(n)}else{let n=e.copyState(a);n.id=t,f.states.push(n)}}}}return p}static findParentChannelOrDevice(e,t,n){if(!e[t])return;let r=t.split(`.`),i=t;if(e[t].type===`state`&&(r.pop(),t=r.join(`.`)),r.length<=2)return t;let a=e[t];if(a?.type===`device`||n&&a?.type===`channel`)return t;if(n)return;r.pop();let o=r.join(`.`),s=e[o];if(!s)return a?t:i;if(s.type===`device`||r.length<=2)return o;if(a?.type===`channel`)return t;r.pop();let c=r.join(`.`),l=e[c];return!l||l.type!==`device`&&l.type!==`channel`?o:c}static getChannelOrDeviceStates(t,r,i,a=!1,o=!1){let s=t[r]?.type;switch(s){case void 0:return[...(0,n.getObjectsBelowId)(i,r)];case`state`:case`channel`:case`device`:case`folder`:if(a&&s!==`device`){let a=e.findParentChannelOrDevice(t,r);return a&&a!==r?[...(0,n.getObjectsBelowId)(i,a)]:[r]}if(s!==`state`)return[...(0,n.getObjectsBelowId)(i,r)];if(o){let a=e.findParentChannelOrDevice(t,r,!0);return a&&a!==r?[...(0,n.getObjectsBelowId)(i,a)]:[r]}return[r];default:return[r]}}static patternIsAllowed(e,t,n){if(!e)return!1;if(Array.isArray(e.type)){for(let r=0;r<e.type.length;r++)if(t&&!t.includes(e.type[r])||n&&n.includes(e.type[r]))return!1;return!0}return t&&!t.includes(e.type)?!1:!n||!n.includes(e.type)}static allRequiredStatesFound(e){if(!e.result)return!1;let t=e.result.states;for(let e=0;e<t.length;e++)if(t[e].required&&!t[e].id)return!1;return!0}static cleanState(e,t){let n=t[e.id]?.common?.role||``;if(e.name.includes(`%d`)&&e.role&&e.id&&n){let t=e.role.exec(n);t&&(e.name=e.name.replace(`%d`,t[1]))}e.role&&delete e.role,e.enums&&delete e.enums,e.original&&delete e.original}sortTypes(e,t){return t.forEach(([t,n])=>{let r=e.indexOf(t),i=e.indexOf(n);if(r===-1||i===-1)return;let a=e.splice(r,1);e.splice(i,0,...a)}),e}_detectNext(t){let{objects:i,id:a,_usedIdsOptional:o=[],ignoreIndicators:s,prioritizedTypes:c,detectParent:l,detectOnlyChannel:u,allowedTypes:d,excludedTypes:f,_keysOptional:p,detectAllPossibleDevices:m}=t,{_patternList:h}=t;t._usedIdsOptional=o;let g=e.getChannelOrDeviceStates(i,a,p||[],l,u);if(!i[a]?.common&&!g.length)return null;if(t._checkedPatterns??=[],!h){let n=Object.keys(r.patterns).filter(t=>e.patternIsAllowed(r.patterns[t],d,f));h=c?this.sortTypes(n,c):n,t._patternList=h}let _={objects:i,channelStates:g,usedIds:o,ignoreIndicators:s||[],pattern:`unknown`,usedInCurrentDevice:[],state:{},ignoreEnums:!!t.ignoreEnums,sortedKeys:p,favorId:t.detectParent?void 0:a,detectAllPossibleDevices:m},v=i[a]?.type;for(let s of h){if(t._checkedPatterns.includes(s))continue;t._checkedPatterns.push(s),delete _.result,_.pattern=s,_.usedInCurrentDevice=[];for(let e of r.patterns[s].states){let t=!1;if(_.state=e,this._testOneState(_)&&(t=!0),e.required&&!t){delete _.result;break}}if(!e.allRequiredStatesFound(_))continue;_.usedInCurrentDevice.forEach(e=>o.push(e));let c;if(v!==`device`){let r=e.findParentChannelOrDevice(i,a)??a;if(i[r]&&(i[r].type===`channel`||i[r].type===`device`)){c=(0,n.getObjectsBelowId)(p,r);for(let e of c)_.result.states.forEach((n,r)=>{!n.id&&(n.indicator||n.searchInParent)&&!n.noDeviceDetection&&this._applyPattern(i,e,n.original,!!t.ignoreEnums,_.sortedKeys)&&_.result&&(_.result.states[r].id=e)})}}if(_.result.states.forEach(t=>e.cleanState(t,_.objects)),t.limitTypesToOneOf){for(let e of t.limitTypesToOneOf)if(e.includes(s))for(let n of e)n===s||t._checkedPatterns.includes(n)||t._checkedPatterns.push(n)}return _.result}return null}detect(e){let{objects:n,id:r,ignoreCache:i,detectAllPossibleDevices:a}=e,{_keysOptional:o,_usedIdsOptional:s}=e;if(!i&&this.cache[r]){let{allowedTypes:t=[],excludedTypes:n=[]}=e;if(!t.length&&!n.length)return this.cache[r];let i=this.cache[r].filter(({type:e})=>t.includes(e)&&!n.includes(e));if(i.length)return i}o?e._keysOptionalSorted||o.sort():(o=Object.keys(n),o.sort(),e._keysOptional=o),s&&!e.detectParent&&(s=[],e._usedIdsOptional=s),e.ignoreEnums===void 0&&e.allowedTypes?.length===1&&(e.ignoreEnums=!0),a&&(e.excludedTypes||=[],e.excludedTypes.includes(t.Types.info)||e.excludedTypes.push(t.Types.info)),e._checkedPatterns=[];let c=[],l;for(;l=this._detectNext(e);)c.push(l),e.detectAllPossibleDevices&&(e._usedIdsOptional=[]);return c.sort((e,n)=>{if(e.type===t.Types.info&&n.type!==t.Types.info)return 1;if(n.type===t.Types.info&&e.type!==t.Types.info)return-1;let i=+!!e.states.find(e=>e.id===r&&e.required),a=+!!n.states.find(e=>e.id===r&&e.required);if(i!==a)return a-i;if(!i){let t=+!!e.states.find(e=>e.id===r),i=+!!n.states.find(e=>e.id===r);if(t!==i)return i-t}let o=e.states.filter(e=>e.id).length;return n.states.filter(e=>e.id).length-o}),this.cache[r]=c.length?c:null,this.cache[r]}static getPatterns(){let e={};return Object.keys(r.patterns).forEach(t=>{let n=JSON.parse(JSON.stringify(r.patterns[t]));n.states.forEach((e,i)=>{let a=r.patterns[t].states[i];a.role&&(n.states[i].role=a.role.toString()),a.enums&&(n.states[i].enums=!0)}),e[t]=n}),e}};e.ChannelDetector=i,i.getEnums=n.getEnums})),rG=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StateType=e.Types=e.roleOrEnumGate=e.roleOrEnumDoor=e.roleOrEnumWindow=e.roleOrEnumBlind=e.roleOrEnumLight=void 0;var t=nG(),n=eG();Object.defineProperty(e,"roleOrEnumLight",{enumerable:!0,get:function(){return n.roleOrEnumLight}}),Object.defineProperty(e,"roleOrEnumBlind",{enumerable:!0,get:function(){return n.roleOrEnumBlind}}),Object.defineProperty(e,"roleOrEnumWindow",{enumerable:!0,get:function(){return n.roleOrEnumWindow}}),Object.defineProperty(e,"roleOrEnumDoor",{enumerable:!0,get:function(){return n.roleOrEnumDoor}}),Object.defineProperty(e,"roleOrEnumGate",{enumerable:!0,get:function(){return n.roleOrEnumGate}}),e.default=t.ChannelDetector;var r=$W();Object.defineProperty(e,"Types",{enumerable:!0,get:function(){return r.Types}}),Object.defineProperty(e,"StateType",{enumerable:!0,get:function(){return r.StateType}})}));R.createContext;function iG(){return iG=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},iG.apply(null,arguments)}function aG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function oG(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?aG(Object(n),!0).forEach(function(t){sG(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aG(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function sG(e,t,n){return(t=cG(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cG(e){var t=lG(e,`string`);return typeof t==`symbol`?t:t+``}function lG(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function uG(e){return e&&e.map((e,t)=>R.createElement(e.tag,oG({key:t},e.attr),uG(e.child)))}var dG=rG();dG.Types.airCondition,dG.Types.blind,dG.Types.blindButtons,dG.Types.button,dG.Types.buttonSensor,dG.Types.camera,dG.Types.chart,dG.Types.image,dG.Types.dimmer,dG.Types.door,dG.Types.fireAlarm,dG.Types.floodAlarm,dG.Types.gate,dG.Types.humidity,dG.Types.illuminance,dG.Types.info,dG.Types.light,dG.Types.lock,dG.Types.location,dG.Types.locationOne,dG.Types.media,dG.Types.motion,dG.Types.ct,dG.Types.percentage,dG.Types.rgb,dG.Types.rgbSingle,dG.Types.rgbwSingle,dG.Types.hue,dG.Types.cie,dG.Types.slider,dG.Types.socket,dG.Types.temperature,dG.Types.thermostat,dG.Types.vacuumCleaner,dG.Types.volume,dG.Types.volumeGroup,dG.Types.window,dG.Types.windowTilt,dG.Types.weatherCurrent,dG.Types.weatherForecast,dG.Types.warning,dG.Types.unknown,dG.Types.instance;var fG=class e extends R.Component{static generateFile(e,t){let n=window.document.createElement(`a`);n.setAttribute(`href`,`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(t,null,2))}`),n.setAttribute(`download`,e),n.style.display=`none`,window.document.body.appendChild(n),n.click(),window.document.body.removeChild(n)}handleFileSelect=e=>{let t=e.target?.files;if(!t||!t.length){console.error(`No files found. Please report to developers`);return}let n=t[0];if(n){let e=new window.FileReader;e.onload=()=>{let t=e.result?.toString()||``;try{let e=JSON.parse(t);e.native&&e.common?e.common.name===this.props.common.name?this.props.onLoad&&this.props.onLoad(e.native):this.props.onError&&this.props.onError(zk.t(`ra_otherConfig`,e.common.name)):this.props.onError&&this.props.onError(zk.t(`ra_invalidConfig`))}catch(e){this.props.onError&&this.props.onError(e?.toString())}},e.readAsText(n)}else alert(`Failed to open JSON File`)};download(){let t={_id:`system.adapter.${this.props.common.name}.${this.props.instance}`,common:JSON.parse(JSON.stringify(this.props.common)),native:this.props.native};t.common.news&&delete t.common.news,t.common.titleLang&&delete t.common.titleLang,t.common.desc&&delete t.common.desc,e.generateFile(`${t._id}.json`,t)}upload(){let e=window.document.createElement(`input`);e.setAttribute(`type`,`file`),e.setAttribute(`id`,`files`),e.setAttribute(`opacity`,`0`),e.addEventListener(`change`,this.handleFileSelect,!1),e.click()}render(){return R.createElement(`div`,{className:this.props.className,style:this.props.style},this.props.common.icon?R.createElement(MW,{src:this.props.common.icon,style:{padding:8,width:64},alt:`logo`}):null,this.props.common.readme?R.createElement(EC,{size:`small`,color:`primary`,"aria-label":`Help`,style:{marginRight:5,marginTop:5,float:`right`},onClick:()=>{window.open(this.props.common.readme,`_blank`)?.focus()}},R.createElement(WO,null)):null,R.createElement(EC,{size:`small`,color:`primary`,"aria-label":`Load config`,style:{marginRight:5,marginTop:5,float:`right`},title:zk.t(`ra_Load configuration from file`),onClick:()=>this.upload()},R.createElement(mk,null)),R.createElement(EC,{size:`small`,color:`primary`,"aria-label":`Save config`,style:{marginRight:5,marginTop:5,float:`right`},title:zk.t(`ra_Save configuration to file`),onClick:()=>this.download()},R.createElement(pk,null)))}};function pG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z`}))}function mG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 320 320`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`g`,{fill:`currentColor`},R.createElement(`rect`,{rx:`32`,height:`272`,width:`267`,y:`25`,x:`25`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`248`,cx:`160`,fill:`none`,strokeWidth:`15`}),R.createElement(`line`,{y2:`201.94531`,x2:`159.5`,y1:`46.94531`,x1:`159.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`79.7979`,x:`133.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`})))}function hG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z`}))}function gG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 320 320`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`g`,{fill:`currentColor`},R.createElement(`rect`,{rx:`32`,height:`272`,width:`267`,y:`25`,x:`25`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`252`,cx:`160`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,fill:`#fff`}),R.createElement(`line`,{y2:`201.94531`,x2:`159.5`,y1:`46.94531`,x1:`159.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`140.83068`,x:`133.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`251`,cx:`241`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,fill:`#fff`}),R.createElement(`line`,{y2:`200.94531`,x2:`240.5`,y1:`45.94531`,x1:`240.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`78.7979`,x:`214.5`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`}),R.createElement(`ellipse`,{stroke:`currentColor`,ry:`26`,rx:`26`,cy:`252`,cx:`84`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,fill:`#fff`}),R.createElement(`line`,{y2:`201.94531`,x2:`83.5`,y1:`46.94531`,x1:`83.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`none`}),R.createElement(`rect`,{height:`27`,width:`50`,y:`79.7979`,x:`57.5`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`,fill:`#fff`})))}function _G(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`,onClick:t=>e.onClick&&e.onClick(t),width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z`}))}function vG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48z`}),R.createElement(`path`,{fill:`currentColor`,stroke:`null`,d:`m261,270l-12,0l0,-24c0,-33.12 -26.88,-60 -60,-60s-60,26.88 -60,60l0,24l-12,0c-13.2,0 -24,10.8 -24,24l0,120c0,13.2 10.8,24 24,24l144,0c13.2,0 24,-10.8 24,-24l0,-120c0,-13.2 -10.8,-24 -24,-24zm-72,108c-13.2,0 -24,-10.8 -24,-24s10.8,-24 24,-24s24,10.8 24,24s-10.8,24 -24,24zm37.2,-108l-74.4,0l0,-24c0,-20.52 16.68,-37.2 37.2,-37.2c20.52,0 37.2,16.68 37.2,37.2l0,24z`}))}function yG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 512 512`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,d:`M448 0L320 96v62.06l-83.03 83.03c6.79 4.25 13.27 9.06 19.07 14.87 5.8 5.8 10.62 12.28 14.87 19.07L353.94 192H416l96-128-64-64zM128 278.59L10.92 395.67c-14.55 14.55-14.55 38.15 0 52.71l52.7 52.7c14.56 14.56 38.15 14.56 52.71 0L233.41 384c29.11-29.11 29.11-76.3 0-105.41s-76.3-29.11-105.41 0z`}))}function bG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 320 320`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`rect`,{fill:`none`,rx:`32`,height:`272`,width:`267`,y:`25`,x:`25`,strokeWidth:`15`,stroke:`currentColor`}),R.createElement(`ellipse`,{fill:`none`,ry:`54`,rx:`54`,cy:`160`,cx:`160`,fillOpacity:`null`,strokeOpacity:`null`,strokeWidth:`15`,stroke:`currentColor`}))}function xG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,onClick:t=>e.onClick&&e.onClick(t),viewBox:`0 0 24 24`,width:e.width||(e.fontSize===`small`?16:20),height:e.height||e.width||(e.fontSize===`small`?16:20),className:e.className,style:e.style},R.createElement(`path`,{fill:`currentColor`,stroke:`currentColor`,d:`M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39A.998.998 0 0 0 18.95 4H5.04c-.83 0-1.3.95-.79 1.61z`}))}var SG={root:{width:`100%`,height:`100%`},overflowHidden:{overflow:`hidden`},container:{height:`100%`}};function CG(e){return R.createElement(T_,{elevation:Number.isNaN(e.elevation)?1:e.elevation,style:{...SG.root,...e.styles?.root||void 0,...e.overflow===`visible`?void 0:SG.overflowHidden},onKeyDown:e.onKeyDown,tabIndex:e.tabIndex},R.createElement(rw,{container:!0,direction:`column`,wrap:`nowrap`,sx:SG.container},e.children))}var wG={root:{height:`100%`,overflow:`hidden`},overflowAuto:{overflow:`auto`}},TG=R.forwardRef(function(e,t){return R.createElement(rw,{sx:{...wG.root,...e?.style||void 0,...e.overflow===`auto`?wG.overflowAuto:void 0},ref:t},e.children)});function EG(e){return R.createElement(rw,{container:!0,alignItems:`center`},e.children)}var DG=e=>e===`dark`?`#62ff25`:`#37c400`,OG=e=>e===`dark`?`#ee56ff`:`#a204b4`,kG=e=>e===`dark`?`#fff46e`:`#b89101`,AG=e=>`#ff6d69`,jG=e=>`#5773ff`,MG=[`0_userdata.0.`,`alias.0.`],NG={headerCellInput:{width:`calc(100% - 5px)`,height:32,pt:0,"& .itemIcon":{verticalAlign:`middle`,width:24,height:24,display:`inline-block`}},headerCellSelectItem:{"& .itemIcon":{width:24,height:24,mr:`5px`,display:`inline-block`}},selectNone:{opacity:.5},selectClearButton:{position:`absolute`,top:0,right:0,borderRadius:5,backgroundColor:`background.default`},cellIdTooltipLink:{color:`#7ec2fd`,"&:hover":{color:`#7ec2fd`},"&:visited":{color:`#7ec2fd`}},cellIdTooltip:{fontSize:14}};function PG(e){return R.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 436 436`,style:e?.style,width:`24`,height:`24`,className:`admin-button`},R.createElement(`g`,{fill:`currentColor`},R.createElement(`path`,{d:`m195.23077,24.30769c-36,3 -67,12 -96,26c-49,24 -82,61 -93,104l-3,11l-1,50c0,46 0,49 2,59l5,20c21,58 84,103 165,116c16,3 53,4 70,2c60,-6 111,-28 147,-64c21,-21 36,-49 40,-74a866,866 0 0 0 1,-104c-3,-18 -6,-28 -13,-43c-26,-52 -87,-90 -162,-101c-16,-2 -48,-3 -63,-2l1,0zm60,23c36,5 70,18 95,35c31,20 51,47 59,77c2,7 2,11 2,25c1,15 0,18 -2,26c-19,69 -104,117 -200,114c-47,-2 -90,-15 -124,-38c-31,-20 -51,-47 -59,-77c-3,-11 -4,-32 -2,-43c8,-42 41,-78 91,-101a260,260 0 0 1 140,-19l0,1zm-221,222c21,26 57,49 95,62c81,27 174,14 239,-32c14,-10 31,-27 41,-41c2,-2 2,-2 2,7c-1,23 -16,50 -38,72c-78,74 -233,74 -311,-1a121,121 0 0 1 -39,-76l0,-6l3,4l8,11z`}),R.createElement(`path`,{d:`m201.23077,47.30769c-40,3 -79,19 -104,44c-55,55 -38,133 37,171c52,26 122,24 172,-5c30,-17 51,-42 58,-71c3,-11 3,-34 0,-45c-6,-23 -21,-44 -40,-60l-27,-16a184,184 0 0 0 -96,-18zm30,21c56,5 100,35 112,75c4,11 4,30 0,41c-8,25 -26,45 -54,59a166,166 0 0 1 -160,-8a98,98 0 0 1 -41,-53c-5,-18 -2,-39 8,-57c23,-39 79,-62 135,-57z`})))}function FG(e){e=(e||``).toString();let t=e[0]===`*`,n=e[e.length-1]===`*`;return e=e.replace(/[-/\\^$+?.()|[\]{}]/g,`\\$&`).replace(/\*/g,`.*`),(t?``:`^`)+e+(n?``:`$`)}function IG(e,t){let n=[];for(let r=0;r<e.length;r++)t(n,e[r],r);return n}function LG(e,t){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(n,e[r],r);return n}function RG(e,t,n){return Array.isArray(e)?IG(e,(e,r,i)=>{if(r==null)return;let a=typeof r==`object`;if(n&&a&&typeof r.en==`string`&&typeof r.de==`string`){e[i]=r.en;return}e[i]=a?RG(r,t,n):r}):LG(e,(e,r,i)=>{if(r==null||t.includes(i))return;let a=typeof r==`object`;if(n&&a&&typeof r.en==`string`&&typeof r.de==`string`){e[i]=r.en;return}e[i]=a?RG(r,t,n):r})}function zG(e,t,n){let r=document.createElement(`a`),i=[];n.excludeSystemRepositories&&i.push(`system.repositories`);let a=i.length>0||n.excludeTranslations?RG(t,i,n.excludeTranslations):t,o=n.beautify?JSON.stringify(a,null,2):JSON.stringify(a);r.setAttribute(`href`,`data:application/json;charset=utf-8,${encodeURIComponent(o)}`),r.setAttribute(`download`,e),r.style.display=`none`,document.body.appendChild(r),r.click(),document.body.removeChild(r)}var BG=class extends R.Component{hasIcons;timer=null;constructor(e){super(e),this.state={value:e.initialValue||[]},this.hasIcons=!!e.values?.find(e=>e.icon)}componentWillUnmount(){this.timer&&clearTimeout(this.timer)}render(){return R.createElement(`div`,{style:{position:`relative`}},R.createElement(yE,{variant:`standard`,key:this.props.name,sx:NG.headerCellInput,className:`no-underline`,multiple:!0,renderValue:e=>e?.length?e.map(e=>{let t=this.props.values.find(t=>typeof t==`object`?t.value===e:t===e),n,r,i;return typeof t==`object`?(n=t.value,r=t.name,i=t.icon):(n=t,r=t),R.createElement(_x,{component:`span`,sx:NG.headerCellSelectItem,key:n},i||(this.hasIcons?R.createElement(`div`,{className:`itemIcon`}):null),r)}):this.props.name===`custom`?this.props.texts.showAll:this.props.texts[`filter_${this.props.name}`],value:this.state.value,onChange:e=>{let t=e.target.value;if(this.state.value[0]===`_`&&t.includes(`_`)&&t.length>1){let e=t.indexOf(`_`);e!==-1&&t.splice(e,1)}else this.state.value[0]!==`_`&&t.includes(`_`)&&(t=[`_`]);t.includes(``)&&(t=[]),this.setState({value:t},()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.props.onChange(this.props.name,t)},400)})},onClose:()=>{this.timer&&(clearTimeout(this.timer),this.timer=null,this.props.onChange(this.props.name,this.state.value))},inputProps:{name:this.props.name,id:this.props.name},displayEmpty:!0},R.createElement(LT,{key:`empty`,value:``},R.createElement(`span`,{style:NG.selectNone},this.props.name===`custom`?this.props.texts.showAll:this.props.texts[`filter_${this.props.name}`])),this.props.values?.map(e=>{let t,n,r;return typeof e==`object`?(t=e.value,n=e.name,r=e.icon):(t=e,n=e),R.createElement(LT,{sx:NG.headerCellSelectItem,key:t,value:t},r||(this.hasIcons?R.createElement(`div`,{className:`itemIcon`}):null),n)})),this.state.value.length?R.createElement(_x,{component:`div`,sx:NG.selectClearButton},R.createElement(uv,{size:`small`,onClick:()=>{this.timer&&=(clearTimeout(this.timer),null),this.setState({value:[]},()=>this.props.onChange(this.props.name,void 0))}},R.createElement(DO,null))):null)}},VG=class extends R.Component{timer=null;constructor(e){super(e),this.state={value:e.initialValue||``}}componentWillUnmount(){this.timer&&clearTimeout(this.timer)}render(){return R.createElement(PC,{sx:this.props.styles,key:this.props.name,title:this.props.t(`ra_You can use * as wildcard`),margin:`dense`},R.createElement(fw,{classes:{underline:`no-underline`},id:this.props.name,placeholder:this.props.texts[`filter_${this.props.name}`],value:this.state.value,onChange:e=>{let t=e.target.value;this.setState({value:t},()=>{this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.props.onChange(this.props.name,t)},400)})},onBlur:()=>{this.timer&&(clearTimeout(this.timer),this.timer=null,this.props.onChange(this.props.name,this.state.value))},autoComplete:`off`}),this.state.value?R.createElement(`div`,{style:{position:`absolute`,right:0}},R.createElement(uv,{size:`small`,onClick:()=>{this.timer&&=(clearTimeout(this.timer),null),this.setState({value:``},()=>this.props.onChange(this.props.name,void 0))}},R.createElement(DO,null))):null)}};function HG(e,t,n,r){if(n||=0,r===void 0&&(r=e.length-1,!r))return e[0]===t;let i=Math.floor((n+r)/2);return t===e[i]?!0:r-1===n?e[n]===t||e[r]===t:t>e[i]?HG(e,t,i,r):t<e[i]&&HG(e,t,n,i)}function UG(e,t){return typeof e==`object`?e?(e[t]||e.en||``).toString():``:e?e.toString():``}function WG(e,t,n,r){r||=`.`;let i=``,a=`system.adapter.${t}`,o=t&&e[a]?.common?.icon;if(o)if(o.startsWith(`data:image/`))i=o.startsWith(`data:image/svg`)?R.createElement(kW,{className:`iconOwn`,src:o,width:28,height:28}):o;else if(o.includes(`.`)){let t=e[a].common.name;i=typeof t==`object`?`${r}/adapter/${t[n]||t.en}/${o}`:`${r}/adapter/${t}/${o}`}else if(o&&o.length<3)return o;else return null;else{let a=e[t]?.common;if(a){let s=a.icon;if(s)if(s.startsWith(`data:image/`))i=s.startsWith(`data:image/svg`)?R.createElement(kW,{className:`iconOwn`,src:s,width:28,height:28}):s;else if(s.includes(`.`)){let o;e[t].type===`instance`||e[t].type===`adapter`?i=typeof a.name==`object`?`${r}/adapter/${a.name[n]||a.name.en}/${s}`:`${r}/adapter/${a.name}/${s}`:t&&t.startsWith(`system.adapter.`)?(o=t.split(`.`,3),s[0]===`/`?o[2]+=s:o[2]+=`/${s}`,i=`${r}/adapter/${o[2]}`):(o=t.split(`.`,2),s[0]===`/`?o[0]+=s:o[0]+=`/${s}`,i=`${r}/adapter/${o[0]}`)}else if(o&&o.length<3)return o;else return null}}return i||null}function GG(e,t,n,r,i,a,o,s,c){c||=0;let l=!1;if(!i){if(i={},t.id){let e=t.id.toLowerCase();e.includes(`*`)?i.idRx=new RegExp(FG(t.id),`i`):i.id=e}if(t.name){let e=t.name.toLowerCase();e.includes(`*`)?i.nameRx=new RegExp(FG(e),`i`):i.name=e}t.type?.length&&(i.type=t.type.map(e=>e.toLowerCase())),t.custom?.length&&(i.custom=t.custom.map(e=>e.toLowerCase())),t.role?.length&&(i.role=t.role.map(e=>e.toLowerCase())),t.room?.length&&(i.room=[],t.room.forEach(e=>{i.room=i.room.concat(r[e]?.common?.members||[])})),t.func?.length&&(i.func=[],t.func.forEach(e=>{i.func=i.func.concat(r[e]?.common?.members||[])}))}let u=e.data;if(u?.id){let e=u.obj?.common;if(o){if(o.type&&(typeof o.type==`string`?(!u.obj||o.type!==u.obj.type)&&(l=!0):Array.isArray(o.type)&&(!u.obj||!o.type.includes(u.obj.type))&&(l=!0)),!l&&o.common?.type&&(e?.type?typeof o.common.type==`string`?o.common.type!==e.type&&(l=!0):Array.isArray(o.common.type)&&(o.common.type.includes(e.type)||(l=!0)):l=!0),!l&&o.common?.role&&(e?.role?typeof o.common.role==`string`?e.role.startsWith(o.common.role)&&(l=!0):Array.isArray(o.common.role)&&(o.common.role.find(t=>e.role.startsWith(t))||(l=!0)):l=!0),!l&&o.common?.custom===`_`&&e?.custom)l=!0;else if(!l&&o.common?.custom&&o.common?.custom!==`_`){let t=o.common.custom;if(!e?.custom)l=!0;else if(t===`_dataSources`)Object.keys(e.custom).find(e=>e.startsWith(`history.`)||e.startsWith(`sql.`)||e.startsWith(`influxdb.`))||(l=!0);else if(Array.isArray(t)){let n=Object.keys(e.custom);t.find(e=>n.find(t=>t.startsWith(e)))&&(l=!0)}else t!==!0&&!Object.keys(e.custom).find(e=>e.startsWith(t))&&(l=!0)}}!l&&!t.expertMode&&(l=u.id===`system`||u.id===`enum`||u.id.startsWith(`system.`)||u.id.startsWith(`enum.`)||u.id.startsWith(`_design/`)||u.id.endsWith(`.admin`)||!!e?.expert),!l&&i.id&&(u.fID===void 0&&(u.fID=u.id.toLowerCase()),l=!u.fID.includes(i.id)),!l&&i.idRx&&(l=!i.idRx.test(u.id)),!l&&i.name&&(e?(u.fName===void 0&&(u.fName=UG(e.name,n)||``,u.fName=u.fName.toLowerCase()),l=!u.fName.includes(i.name)):l=!0),!l&&i.nameRx&&e&&(u.fName===void 0&&(u.fName=UG(e.name,n)||``,u.fName=u.fName.toLowerCase()),l=!i.nameRx.test(u.fName)),!l&&t.role?.length&&e&&i.role?.length&&(l=!(typeof e.role==`string`&&i.role.find(t=>e.role.startsWith(t)))),!l&&i.room?.length&&(l=!i.room.find(e=>e===u.id||u.id.startsWith(`${e}.`))),!l&&i.func?.length&&(l=!i.func.find(e=>e===u.id||u.id.startsWith(`${e}.`))),!l&&i.type?.length&&(l=!(u.obj?.type&&i.type.includes(u.obj.type))),!l&&s&&(l=!(u.obj?.type&&s.includes(u.obj.type))),!l&&i.custom?.length&&(l=e?i.custom[0]===`_`?!!e.custom:!e.custom||!i.custom.find(t=>e.custom[t]):i.custom[0]!==`_`)}return u.visible=!l,u.hasVisibleChildren=!1,e.children&&c<20&&e.children.forEach(e=>{GG(e,t,n,r,i,a,o,s,c+1)&&(u.hasVisibleChildren=!0)}),u.sumVisibility=u.visible||u.hasVisibleChildren,a&&u.sumVisibility&&a.count++,u.id&&u.sumVisibility&&e.children&&e.children.forEach(e=>e.data.hasVisibleParent=!0),u.visible||u.hasVisibleChildren}function KG(e,t,n,r){r||=[];let i=e.data;return i.sumVisibility&&(i.id&&n[i.id]&&(!t||n[i.id].type===t)&&r.push(i.id),e.children?.forEach(e=>KG(e,t,n,r))),r}function qG(e,t,n,r,i,a){let o;return t===`alias`||t===`alias.0`?o=R.createElement(YO,{className:`iconOwn`,style:{color:OG(r)}}):t===`0_userdata`||t===`0_userdata.0`?o=R.createElement(NO,{className:`iconOwn`,style:{color:DG(r)}}):t.startsWith(`_design/`)||t===`system`?o=R.createElement(ck,{className:`iconOwn`,style:{color:AG(r)}}):t===`system.adapter`?o=R.createElement(ck,{className:`iconOwn`,style:{color:jG(r)}}):t===`system.group`?o=R.createElement(uk,{className:`iconOwn`}):t===`system.user`?o=R.createElement(tk,{className:`iconOwn`}):t===`system.host`?o=R.createElement(ik,{className:`iconOwn`}):t.endsWith(`.connection`)||t.endsWith(`.connected`)?o=R.createElement(vk,{className:`iconOwn`}):t.endsWith(`.info`)?o=R.createElement(KO,{className:`iconOwn`}):e[t]&&e[t].type===`meta`?o=R.createElement(FO,{className:`iconOwn`}):n<2&&e[`system.adapter.${t}`]&&(o=WG(e,`system.adapter.${t}`,i,a)),o||null}function JG(e,t){return e?.obj?.common?.desc&&UG(e.obj.common.desc,t)||null}function YG(e,t){let n=JG(e,t);return n?.startsWith(`http`)?R.createElement(_x,{component:`a`,sx:NG.cellIdTooltipLink,href:n,target:`_blank`,rel:`noreferrer`},n):R.createElement(`span`,{style:NG.cellIdTooltip},n||e.id||``)}function XG(e,t){let n=t.imagePrefix||`.`,r=Object.keys(e);r.sort((e,t)=>e===t?0:(e=e.replace(/\./g,`!!!`),t=t.replace(/\./g,`!!!`),e>t?1:-1)),t.root&&(r=r.filter(e=>e===t.root||e.startsWith(`${t.root}.`)));let i=[],a=``,o=0,s={data:{name:``,id:``},children:[]},c={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:e,customs:[`_`],enums:[],hasSomeCustoms:!1,aliasesMap:{}},l=s;for(let u=0;u<r.length;u++){let d=r[u];if(!d)continue;let f=e[d],p=d.split(`.`);if(f.type&&!c.types.includes(f.type)&&c.types.push(f.type),f){let e=f.common,t=e?.role;if(t&&!c.roles.find(e=>e.role===t)?typeof t==`string`?c.roles.push({role:t,type:e.type}):console.warn(`Invalid role type "${typeof t}" in "${f._id}"`):d.startsWith(`enum.rooms.`)?(c.roomEnums.push(d),c.enums.push(d)):d.startsWith(`enum.functions.`)?(c.funcEnums.push(d),c.enums.push(d)):f.type===`enum`?c.enums.push(d):f.type===`instance`&&e&&(e.supportCustoms||e.adminUI?.custom)&&(c.hasSomeCustoms=!0,c.customs.push(d.substring(15))),d.startsWith(`alias.`)&&f.common.alias?.id)if(typeof f.common.alias.id==`string`){let e=f.common.alias.id;c.aliasesMap[e]?c.aliasesMap[e].includes(d)||c.aliasesMap[e].push(d):c.aliasesMap[e]=[d]}else{let e=f.common.alias.id.read;e&&(c.aliasesMap[e]?c.aliasesMap[e].includes(d)||c.aliasesMap[e].push(d):c.aliasesMap[e]=[d]);let t=f.common.alias.id.write;t&&(c.aliasesMap[t]?c.aliasesMap[t].includes(d)||c.aliasesMap[t].push(d):c.aliasesMap[t]=[d])}}c.ids.push(d);let m;do if(m=!1,!a||d.startsWith(`${a}.`)){if(p.length-o>1){let r=a;for(let i=o;i<p.length-1;i++)if(r+=(r?`.`:``)+p[i],!HG(c.ids,r)){let a={data:{name:p[i],parent:l,id:r,obj:e[r],level:i,icon:qG(e,r,i,t.themeType,t.lang,n),generated:!0}};l.children||=[],l.children.push(a),l=a,c.ids.push(r)}else if(l.children&&(l=l.children.find(e=>e.data.name===p[i]),!l))throw Error(`Cannot find root in children!`)}let r={data:{name:p[p.length-1],title:UG(f?.common?.name,t.lang),obj:f,parent:l,icon:WG(e,d,t.lang,n)||qG(e,d,0,t.themeType,t.lang,n),id:d,hasCustoms:!!(f.common?.custom&&Object.keys(f.common.custom).length),level:p.length-1,generated:!1,button:f.type===`state`&&!!f.common?.role&&typeof f.common.role==`string`&&f.common.role.startsWith(`button`)&&f.common?.write!==!1,switch:f.type===`state`&&f.common?.type===`boolean`&&f.common?.write!==!1&&f.common?.read!==!1,url:!!f.common?.role&&typeof f.common.role==`string`&&f.common.role.startsWith(`url`)}};l.children||=[],l.children.push(r),l=r,o=p.length,i=p,a=d}else{let e=0;for(;i[e]===p[e];)e++;if(e>0){let t=i.length;for(i=i.splice(0,e),o=e,a=i.join(`.`);t>e;)l.data.parent?l=l.data.parent:console.error(`Parent is null for ${d} ${a} ${i.join(`.`)}`),t--}else l=s,i=[],a=``,o=0;m=!0}while(m)}return c.roomEnums.sort((n,r)=>{let i=UG(e[n]?.common?.name,t.lang)||n.split(`.`).pop()||``,a=UG(e[r]?.common?.name,t.lang)||r.split(`.`).pop()||``;return i>a?1:i<a?-1:0}),c.funcEnums.sort((n,r)=>{let i=UG(e[n]?.common?.name,t.lang)||n.split(`.`).pop()||``,a=UG(e[r]?.common?.name,t.lang)||r.split(`.`).pop()||``;return i>a?1:i<a?-1:0}),c.roles.sort((e,t)=>e.role.localeCompare(t.role)),c.types.sort(),{info:c,root:s}}function ZG(e,t,n,r,i){if(e.data.id===t)return e;if(n||(n=t.split(`.`),i=0,r=n[i]),!e.children&&e.data.id!==t)return null;let a;if(e.children)for(let t=0;t<e.children.length;t++){let n=e.children[t].data.id;if(n===r){a=e.children[t];break}else if(n>(r||``))break}return a?(i||=0,ZG(a,t,n,`${r}.${n[i+1]}`,i+1)):null}function QG(e,t,n,r){if(!t)return{rooms:[],per:!1};r||=[];for(let i of e.roomEnums){let a=e.objects[i]?.common;if(!a)continue;let o=UG(a.name,n);a.members?.includes(t)&&!r.includes(o)&&r.push(o)}let i,a=t.split(`.`);return a.pop(),t=a.join(`.`),e.objects[t]&&(i=r.length,QG(e,t,n,r)),{rooms:r,per:!i}}function $G(e,t,n,r){if(!t)return[];r||=[];for(let i=0;i<e[n].length;i++)(e.objects[e[n][i]]?.common)?.members?.includes(t)&&!r.includes(e[n][i])&&r.push(e[n][i]);return r.sort(),r}function eK(e,t,n,r){if(!t)return{funcs:[],pef:!1};r||=[];for(let i=0;i<e.funcEnums.length;i++){let a=e.objects[e.funcEnums[i]]?.common;if(!a)continue;let o=UG(a.name,n);a.members?.includes(t)&&!r.includes(o)&&r.push(o)}let i,a=t.split(`.`);return a.pop(),t=a.join(`.`),e.objects[t]&&(i=r.length,eK(e,t,n,r)),{funcs:r,pef:!i}}function tK(e){let{dateFormat:t,state:n,isFloatComma:r,texts:i,obj:a}=e,o=X.getStates(a),s=a.common,c,l=s?.type===`file`?`[file]`:!n||n.val===null?`(null)`:n.val===void 0?`[undef]`:n.val,u=typeof l;if(s?.role&&typeof s.role==`string`&&s.role.match(/^value\.time|^date/))if(l&&typeof l==`string`)if(X.isStringInteger(l))l=new Date(parseInt(l,10)).toString();else try{let e=new Date(l);X.isValidDate(e)&&(l=e.toString())}catch{}else l>946681200&&l<9466812e5&&(l*=1e3),l&&=new Date(l).toString();else if(s?.role&&typeof s.role==`string`&&s.role.match(/^value\.duration/)){if(typeof l==`number`&&l>=0){let e=Math.floor(l/3600),t=Math.floor(l%3600/60),n=Math.floor(l%60);l=`${e.toString().padStart(2,`0`)}:${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}else if(typeof l==`string`&&X.isStringInteger(l)){let e=parseInt(l,10);if(e>=0){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);l=`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}}}else u===`number`?Number.isInteger(l)||(l=Math.round(l*1e8)/1e8,r&&(l=l.toString().replace(`.`,`,`))):u===`object`?l=JSON.stringify(l):u===`string`?l.startsWith(`data:image/`)&&(c=`image`):l=l.toString(),typeof l!=`string`&&(l=l.toString());let d={v:l};o&&o[l]!==void 0&&l!==o[l]&&(d.s=l,l=o[l],d.v=l),d.v?.length>40&&(d.c=d.v,d.v=`${d.v.substring(0,40)}...`),s?.unit&&(d.u=s.unit);let f;if(e.full&&(f=typeof l==`string`&&l.length>100?[{t:i.value,v:`${l.substring(0,100)}...`}]:[{t:i.value,v:l}],n)){if(n.ack!==void 0&&n.ack!==null&&f.push({t:i.ack,v:n.ack.toString()}),n.ts&&f.push({t:i.ts,v:n.ts?X.formatDate(new Date(n.ts),t):``}),n.lc&&f.push({t:i.lc,v:n.lc?X.formatDate(new Date(n.lc),t):``}),n.from){let e=n.from.toString();e.startsWith(`system.adapter.`)&&(e=e.substring(15)),f.push({t:i.from,v:e})}if(n.user){let e=n.user.toString();e.startsWith(`system.user.`)&&(e=e.substring(12)),f.push({t:i.user,v:e})}n.c&&f.push({t:i.c,v:n.c}),f.push({t:i.quality,v:X.quality2text(n.q||0).join(`, `),nbr:!0})}return{valText:d,valFull:f,fileViewer:c}}function nK(e){let{state:t}=e;return{color:t?.ack?t.q?`#ffa500`:``:e.nonAckColor||`#ff2222c9`}}function rK(e,t){let n=t,r=1,i=[];for(;r<e.length&&n<t+25*36e5;){for(;e[r-1].ts<n&&n<=e[r].ts&&r<e.length;)r++;if(r===1&&e[r-1].ts>=n)i.push(0);else if(r<e.length)if(typeof e[r].val==`boolean`||typeof e[r-1].val==`boolean`)i.push(+!!e[r].val);else{e[r-1].val||=0,e[r].val||=0;let t=e[r-1].val,a=t+(e[r].val-t)*(n-e[r-1].ts)/(e[r].ts-e[r-1].ts);i.push(a)}n+=36e5}return i}function iK(e,t){if(e?._id?.startsWith(`${t.adapter}.`)&&t.path.length>1){let n=t.path,r,i=e;if(i[n[0]]&&typeof i[n[0]]==`object`)return n.length===2?r=i[n[0]][n[1]]:n.length===3?r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`?i[n[0]][n[1]][n[2]]:null:n.length===4?r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`&&i[n[0]][n[1]][n[2]]?i[n[0]][n[1]][n[2]][n[3]]:null:n.length===5?r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`&&i[n[0]][n[1]][n[2]]&&i[n[0]][n[1]][n[2]][n[3]]?i[n[0]][n[1]][n[2]][n[3]][n[4]]:null:n.length===6&&(r=i[n[0]][n[1]]&&typeof i[n[0]][n[1]]==`object`&&i[n[0]][n[1]][n[2]]&&i[n[0]][n[1]][n[2]][n[3]]&&i[n[0]][n[1]][n[2]][n[3]][n[4]]?i[n[0]][n[1]][n[2]][n[3]][n[4]][n[5]]:null),r??null}return null}function aK(e,t,n){if(e?._id?.startsWith(`${t.adapter}.`)&&t.path.length>1){let r=t.path,i=e;if(i[r[0]]&&typeof i[r[0]]==`object`){if(r.length===2)return i[r[0]][r[1]]=n,!0;if(r.length===3){if(i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`)return i[r[0]][r[1]][r[2]]=n,!0}else if(r.length===4){if(i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`&&i[r[0]][r[1]][r[2]]&&typeof i[r[0]][r[1]][r[2]]==`object`)return i[r[0]][r[1]][r[2]][r[3]]=n,!0}else if(r.length===5){if(i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`&&i[r[0]][r[1]][r[2]]&&typeof i[r[0]][r[1]][r[2]]==`object`&&i[r[0]][r[1]][r[2]][r[3]]&&typeof i[r[0]][r[1]][r[2]][r[3]]==`object`)return i[r[0]][r[1]][r[2]][r[3]][r[4]]=n,!0}else if(r.length===6&&i[r[0]][r[1]]&&typeof i[r[0]][r[1]]==`object`&&i[r[0]][r[1]][r[2]]&&typeof i[r[0]][r[1]][r[2]]==`object`&&i[r[0]][r[1]][r[2]][r[3]]&&typeof i[r[0]][r[1]][r[2]][r[3]]==`object`&&i[r[0]][r[1]][r[2]][r[3]][r[4]]&&typeof i[r[0]][r[1]][r[2]][r[3]][r[4]]==`object`)return i[r[0]][r[1]][r[2]][r[3]][r[4]][r[5]]=n,!0}}return!1}function oK(e){return!!MG.find(t=>e.startsWith(t))}var sK=16,cK=20,lK=`#ff413c`,uK=`#86211f`,dK=`#57ff45`,fK=`#098c04`,pK=`#f3ad11`,mK=`#6c5008`,hK=`YYYY.MM.DD`,$={toolbar:{minHeight:38},toolbarButtons:{padding:4,marginLeft:4},switchColumnAuto:{marginLeft:16},dialogColumns:{transition:`opacity 1s`},dialogColumnsLabel:{fontSize:12,paddingTop:8},columnCustom:{width:`100%`,display:`inline-block`},columnCustomEditable:{cursor:`text`},columnCustom_center:{textAlign:`center`},columnCustom_left:{textAlign:`left`},columnCustom_right:{textAlign:`right`},width100:{width:`100%`},transparent_10:{opacity:.1},transparent_20:{opacity:.2},transparent_30:{opacity:.3},transparent_40:{opacity:.4},transparent_50:{opacity:.5},transparent_60:{opacity:.6},transparent_70:{opacity:.7},transparent_80:{opacity:.8},transparent_90:{opacity:.9},transparent_100:{opacity:1},headerRow:{paddingLeft:8,height:38,whiteSpace:`nowrap`,userSelect:`none`},buttonClearFilter:{position:`relative`,float:`right`,padding:0},buttonClearFilterIcon:{zIndex:2,position:`absolute`,top:0,left:0,color:`#FF0000`,opacity:.7},tableDiv:{paddingTop:0,paddingLeft:0,width:`calc(100% - 8px)`,height:`calc(100% - 38px)`,overflow:`auto`},tableRow:e=>({pl:1,height:32,lineHeight:`32px`,verticalAlign:`top`,userSelect:`none`,position:`relative`,width:`100%`,"&:hover":{background:`${e.palette.mode===`dark`?e.palette.primary.dark:e.palette.primary.light} !important`,color:X.invertColor(e.palette.primary.main,!0)},whiteSpace:`nowrap`,flexWrap:`nowrap`}),tableRowLines:e=>({borderBottom:`1px solid ${e.palette.mode,`#8888882e`}`,"& > div":{borderRight:`1px solid ${e.palette.mode,`#8888882e`}`}}),tableRowNoDragging:{cursor:`pointer`},tableRowAlias:{height:42},tableRowAliasReadWrite:{height:54},tableRowFocused:e=>({"&:after":{content:`""`,position:`absolute`,top:1,left:1,right:1,bottom:1,border:e.palette.mode?`1px dotted #000`:`1px dotted #FFF`}}),checkBox:{padding:0},cellId:{position:`relative`,fontSize:`1rem`,overflow:`hidden`,textOverflow:`ellipsis`,"& .copyButton":{display:`none`},"&:hover .copyButton":{display:`block`},"& .iconOwn":{display:`block`,width:28,height:28,mt:`2px`,float:`right`},"&:hover .iconOwn":{display:`none`},"& *":{width:`initial`}},cellIdSpan:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},cellIdIconFolder:e=>({marginRight:8,width:28,height:28,cursor:`pointer`,color:e.palette.secondary.main||`#fbff7d`,verticalAlign:`top`}),cellIdIconDocument:{verticalAlign:`middle`,marginLeft:(32-cK)/2,marginRight:8,width:cK,height:cK},cellIdIconOwn:{},cellCopyButton:{width:cK,height:cK,top:(32-cK)/2,opacity:.8,position:`absolute`,right:3},cellCopyButtonInDetails:{width:cK,height:cK,top:(32-cK)/2,opacity:.8},cellEditButton:{width:cK,height:cK,color:`white`,position:`absolute`,top:(32-cK)/2,right:23,opacity:.7,"&:hover":{opacity:1}},cellName:{display:`inline-block`,verticalAlign:`top`,fontSize:14,ml:`5px`,overflow:`hidden`,textOverflow:`ellipsis`,position:`relative`,"& .copyButton":{display:`none`},"&:hover .copyButton":{display:`block`}},cellNameWithDesc:{lineHeight:`normal`},cellNameDivDiv:{},cellDescription:{fontSize:10,opacity:.5,fontStyle:`italic`},cellIdAlias:e=>({fontStyle:`italic`,fontSize:12,opacity:.7,"&:hover":{color:e.palette.mode===`dark`?`#009900`:`#007700`}}),cellIdAliasReadWriteDiv:{height:24,marginTop:-5},cellIdAliasAlone:{lineHeight:0},cellIdAliasReadWrite:{lineHeight:`12px`},cellType:{display:`inline-block`,verticalAlign:`top`,"& .itemIcon":{verticalAlign:`middle`,width:24,height:24,display:`inline-block`},"& .itemIconFolder":{marginLeft:3}},cellRole:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellRoom:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellEnumParent:{opacity:.4},cellFunc:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellValue:{display:`inline-block`,verticalAlign:`top`,textOverflow:`ellipsis`,overflow:`hidden`},cellValueButton:{marginTop:5},cellValueButtonFalse:{opacity:.3},cellAdapter:{display:`inline-block`,verticalAlign:`top`},cellValueTooltip:{fontSize:12},cellValueText:{width:`100%`,height:32,fontSize:16,display:`flex`,overflow:`hidden`,textOverflow:`ellipsis`,position:`relative`,verticalAlign:`top`,"& .copyButton":{display:`none`},"&:hover .copyButton":{display:`block`}},cellValueFile:{color:`#2837b9`},cellValueTooltipTitle:{fontStyle:`italic`,width:100,display:`inline-block`},cellValueTooltipValue:{width:120,display:`inline-block`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},cellValueTooltipImage:{width:100,height:`auto`},cellValueTooltipBoth:{width:220,display:`inline-block`,whiteSpace:`nowrap`},cellValueTooltipBox:{width:250,overflow:`hidden`,pointerEvents:`none`},tooltip:{pointerEvents:`none`},cellValueTextUnit:{marginLeft:4,opacity:.8,display:`inline-block`},cellValueTextState:{opacity:.7},cellValueTooltipCopy:{position:`absolute`,bottom:3,right:3},cellValueTooltipEdit:{position:`absolute`,bottom:3,right:15},cellButtons:{display:`inline-block`,verticalAlign:`top`},cellButtonsButton:{display:`inline-block`,opacity:.5,width:24,height:24,"&:hover":{opacity:1},p:0,mt:`-2px`},cellButtonsEmptyButton:{fontSize:12},cellButtonMinWidth:{minWidth:40},cellButtonsButtonAlone:{ml:`26px`,pt:0,mt:`-2px`},cellButtonsButtonWithCustoms:e=>({color:e.palette.mode===`dark`?e.palette.primary.main:e.palette.secondary.main}),cellButtonsButtonWithoutCustoms:{opacity:.2},cellButtonsValueButton:e=>({position:`absolute`,top:cK/2-2,opacity:.7,width:cK-2,height:cK-2,color:e.palette.action.active,"&:hover":{opacity:1}}),cellButtonsValueButtonCopy:{right:8,cursor:`pointer`},cellButtonsValueButtonEdit:{right:26},cellDetailsLine:{display:`flex`,alignItems:`center`,width:`100%`,height:32,fontSize:16},cellDetailsName:{fontWeight:`bold`,marginRight:8,minWidth:80},filteredOut:{opacity:.5},filteredParentOut:{opacity:.3},filterInput:{mt:0,mb:0},selectIcon:{width:24,height:24,marginRight:4},itemSelected:e=>({background:`${e.palette.primary.main} !important`,color:`${X.invertColor(e.palette.primary.main,!0)} !important`}),header:{width:`100%`},headerCell:{display:`inline-block`,verticalAlign:`top`},headerCellValue:{paddingTop:4,fontSize:16},visibleButtons:{color:`#2196f3`,opacity:.7},grow:{flexGrow:1},enumIconDiv:{marginRight:8,width:32,height:32,borderRadius:8,background:`#FFFFFF`},enumIcon:{marginTop:4,marginLeft:4,width:24,height:24},enumDialog:{overflow:`hidden`},enumList:{minWidth:250,height:`calc(100% - 50px)`,overflow:`auto`},enumCheckbox:{minWidth:0},buttonDiv:{display:`flex`,height:`100%`,alignItems:`center`},aclText:{fontSize:13,marginTop:6},rightsObject:{color:`#55ff55`,paddingLeft:3},rightsState:{color:`#86b6ff`,paddingLeft:3},textCenter:{padding:12,textAlign:`center`},tooltipAccessControl:{display:`flex`,flexDirection:`column`},fontSizeTitle:{"@media screen and (max-width: 465px)":{"& *":{fontSize:12}}},draggable:{cursor:`copy`},nonDraggable:{cursor:`no-drop`},iconDeviceConnected:e=>({color:e.palette.mode===`dark`?dK:fK,opacity:.8,position:`absolute`,top:4,right:32,width:20}),iconDeviceDisconnected:e=>({color:e.palette.mode===`dark`?pK:mK,opacity:.8,position:`absolute`,top:4,right:32,width:20}),iconDeviceError:e=>({color:e.palette.mode===`dark`?lK:uK,opacity:.8,position:`absolute`,top:4,right:50,width:20}),resizeHandle:{display:`block`,position:`absolute`,cursor:`col-resize`,width:7,top:2,bottom:2,zIndex:1},resizeHandleRight:{right:3,borderRight:`2px dotted #888`,"&:hover":{borderColor:`#ccc`,borderRightStyle:`solid`},"&.active":{borderColor:`#517ea5`,borderRightStyle:`solid`}},invertedBackground:e=>({backgroundColor:e.palette.mode===`dark`?`#9a9a9a`:`#565656`,padding:`0 3px`,borderRadius:`2px 0 0 2px`}),invertedBackgroundFlex:e=>({backgroundColor:e.palette.mode===`dark`?`#9a9a9a`:`#565656`,borderRadius:`0 2px 2px 0`}),contextMenuEdit:e=>({color:e.palette.mode===`dark`?`#ffee48`:`#cbb801`}),contextMenuEditValue:e=>({color:e.palette.mode===`dark`?`#5dff45`:`#1cd301`}),contextMenuView:e=>({color:e.palette.mode===`dark`?`#FFF`:`#000`}),contextMenuCustom:e=>({color:e.palette.mode===`dark`?`#42eaff`:`#01bbc2`}),contextMenuACL:e=>({color:e.palette.mode===`dark`?`#e079ff`:`#500070`}),contextMenuRoom:e=>({color:e.palette.mode===`dark`?`#ff9a33`:`#642a00`}),contextMenuRole:e=>({color:e.palette.mode===`dark`?`#ffdb43`:`#562d00`}),contextMenuDelete:e=>({color:e.palette.mode===`dark`?`#ff4f4f`:`#cf0000`}),contextMenuKeys:{marginLeft:8,opacity:.7,fontSize:`smaller`},contextMenuWithSubMenu:{display:`flex`},...NG},gK={state:R.createElement(bG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),channel:R.createElement(mG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),device:R.createElement(gG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),adapter:R.createElement(pG,{className:`itemIcon`,style:{verticalAlign:`middle`}}),meta:R.createElement(FO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),instance:R.createElement(yG,{className:`itemIcon`,style:{color:`#7da7ff`,verticalAlign:`middle`}}),enum:R.createElement(ZO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),chart:R.createElement(lk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),config:R.createElement(sk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),group:R.createElement(uk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),user:R.createElement(tk,{className:`itemIcon`,style:{verticalAlign:`middle`}}),host:R.createElement(ik,{className:`itemIcon`,style:{verticalAlign:`middle`}}),schedule:R.createElement(TO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),script:R.createElement(OO,{className:`itemIcon`,style:{verticalAlign:`middle`}}),folder:R.createElement(YU,{className:`itemIcon itemIconFolder`,style:{verticalAlign:`middle`}})},_K={xs:{idWidth:`100%`,fields:[],widths:{}},sm:{idWidth:300,fields:[`room`,`val`],widths:{room:100,val:200}},md:{idWidth:300,fields:[`room`,`func`,`val`,`buttons`],widths:{name:200,room:150,func:150,val:120,buttons:120}},lg:{idWidth:300,fields:[`name`,`type`,`role`,`room`,`func`,`val`,`buttons`,`changedFrom`,`qualityCode`,`timestamp`,`lastChange`],widths:{name:300,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:165,lastChange:165}},xl:{idWidth:550,fields:[`name`,`type`,`role`,`room`,`func`,`val`,`buttons`,`changedFrom`,`qualityCode`,`timestamp`,`lastChange`],widths:{name:400,type:80,role:120,room:180,func:180,val:140,buttons:120,changedFrom:120,qualityCode:100,timestamp:170,lastChange:170}}},vK=!1,yK={id:``,name:``,room:[],func:[],role:[],type:[],custom:[],expertMode:!1},bK=class e extends R.Component{info={funcEnums:[],roomEnums:[],roles:[],ids:[],types:[],objects:{},customs:[],enums:[],hasSomeCustoms:!1,aliasesMap:{}};localStorage=window._localStorage||window.localStorage;tableRef;pausedSubscribes=!1;selectFirst;lastNav=null;applyingNav=!1;root=null;states={};subscribes=[];unsubscribeTimer=null;statesUpdateTimer=null;objectsUpdateTimer=null;visibleCols;texts;possibleCols;imagePrefix;adapterColumns=[];styleTheme=``;edit={id:``,val:``,q:0,ack:!1};levelPadding;customWidth=!1;resizeTimeout=null;resizerNextName=null;resizerActiveName=null;resizerCurrentWidths={};resizeLeft=!1;resizerOldWidth=0;resizerMin=0;resizerNextMin=0;resizerOldWidthNext=0;resizerPosition=0;resizerActiveDiv=null;resizerNextDiv=null;storedWidths=null;systemConfig=null;objects;defaultHistory=``;ctrlPressed=!1;columnsVisibility={};changedIds=null;contextMenu=null;recordStates=[];styles={};expertMode=!1;customColumnDialog=null;constructor(e){super(e);let t=this.localStorage.getItem(`${e.dialogName||`App`}.objectSelected`)||``;if(this.selectFirst=``,this.expertMode=!!this.props.expertMode,t.startsWith(`[`))try{let e=JSON.parse(t);this.selectFirst=e[0]||``}catch{}else this.selectFirst=t;let n,r=this.localStorage.getItem(`${e.dialogName||`App`}.objectExpanded`)||`[]`;try{n=JSON.parse(r)}catch{n=[]}let i,a=e.defaultFilters?``:this.localStorage.getItem(`${e.dialogName||`App`}.objectFilter`)||``;if(a)try{i=JSON.parse(a)}catch{i={...yK}}else i=e.defaultFilters&&typeof e.defaultFilters==`object`?{...e.defaultFilters}:{...yK};if(typeof i.room==`string`&&i.room&&(i.room=[i.room].filter(e=>e),i.room.length||delete i.room),typeof i.func==`string`&&i.func&&(i.func=[i.func].filter(e=>e),i.func.length||delete i.func),typeof i.role==`string`&&i.role&&(i.role=[i.role].filter(e=>e),i.role.length||delete i.role),typeof i.type==`string`&&(i.type=[i.type].filter(e=>e),i.type.length||delete i.type),typeof i.custom==`string`&&(i.custom=[i.custom].filter(e=>e),i.custom.length||delete i.custom),i.expertMode=e.expertMode===void 0?(window._sessionStorage||window.sessionStorage).getItem(`App.expertMode`)===`true`:e.expertMode,this.tableRef=(0,R.createRef)(),this.visibleCols=e.columns||_K[e.width||`lg`].fields,e.types&&e.types.length===1){let e=this.visibleCols.indexOf(`type`);e!==-1&&this.visibleCols.splice(e,1)}this.possibleCols=_K.xl.fields;let o=null;if(e.router){let t=e.router.getLocation();t.id&&t.dialog===`customs`&&(o=[t.id],this.pauseSubscribe(!0))}let s;s=Array.isArray(e.selected)?e.selected:[e.selected||``],s=s.map(e=>e.replace(/["']/g,``)).filter(e=>e),this.selectFirst=s.length&&s[0]?s[0]:this.selectFirst;let c=this.localStorage.getItem(`${e.dialogName||`App`}.columns`),l;try{l=c?JSON.parse(c):null}catch{l=null}let u=null;try{u=u?JSON.parse(u):{}}catch{u={}}this.imagePrefix=e.imagePrefix||`.`;let d,f=this.localStorage.getItem(`${e.dialogName||`App`}.foldersFirst`);d=f===`false`?!1:f===`true`||e.foldersFirst===void 0||e.foldersFirst;let p=!1;try{p=this.props.objectStatesView&&JSON.parse(this.localStorage.getItem(`${e.dialogName||`App`}.objectStatesView`)||``)||!1}catch{}this.state={aliasMenu:``,beautifyJsonExport:!0,columns:l,columnsAuto:this.localStorage.getItem(`${e.dialogName||`App`}.columnsAuto`)!==`false`,columnsDialogTransparent:100,columnsEditCustomDialog:null,columnsForAdmin:null,columnsSelectorShow:!1,columnsWidths:u,customColumnDialogValueChanged:!1,customDialog:o,depth:0,editObjectAlias:!1,editObjectDialog:``,enumDialog:null,excludeSystemRepositoriesFromExport:!0,excludeTranslations:!1,expandAllVisible:!1,expanded:n,filter:i,filterKey:0,focused:this.localStorage.getItem(`${e.dialogName||`App`}.focused`)||``,foldersFirst:d,linesEnabled:this.localStorage.getItem(`${e.dialogName||`App`}.lines`)===`true`,loaded:!1,noStatesByExportImport:!1,roleDialog:null,scrollBarWidth:16,selected:s,selectedNonObject:this.localStorage.getItem(`${e.dialogName||`App`}.selectedNonObject`)||``,showAliasEditor:``,showAllExportOptions:!1,showContextMenu:null,showDescription:this.localStorage.getItem(`${e.dialogName||`App`}.desc`)!==`false`,showExportDialog:!1,showImportDialog:!1,showImportMenu:null,showRenameDialog:null,statesView:p,toast:``,tooltipInfo:null,viewFileDialog:``},this.texts={name:e.t(`ra_Name`),categories:e.t(`ra_Categories`),value:e.t(`ra_tooltip_value`),ack:e.t(`ra_tooltip_ack`),ts:e.t(`ra_tooltip_ts`),lc:e.t(`ra_tooltip_lc`),from:e.t(`ra_tooltip_from`),user:e.t(`ra_tooltip_user`),c:e.t(`ra_tooltip_comment`),quality:e.t(`ra_tooltip_quality`),editObject:e.t(`ra_tooltip_editObject`),deleteObject:e.t(`ra_tooltip_deleteObject`),customConfig:e.t(`ra_tooltip_customConfig`),copyState:e.t(`ra_tooltip_copyState`),editState:e.t(`ra_tooltip_editState`),ctrlForLink:e.t(`ra_tooltip_ctrlForLink`),close:e.t(`ra_Close`),filter_id:e.t(`ra_filter_id`),filter_name:e.t(`ra_filter_name`),filter_type:e.t(`ra_filter_type`),filter_role:e.t(`ra_filter_role`),filter_room:e.t(`ra_filter_room`),filter_func:e.t(`ra_filter_func`),filter_custom:e.t(`ra_filter_customs`),filterCustomsWithout:e.t(`ra_filter_customs_without`),objectChangedByUser:e.t(`ra_object_changed_by_user`),objectChangedBy:e.t(`ra_object_changed_by`),objectChangedFrom:e.t(`ra_state_changed_from`),stateChangedBy:e.t(`ra_state_changed_by`),stateChangedFrom:e.t(`ra_state_changed_from`),ownerGroup:e.t(`ra_Owner group`),ownerUser:e.t(`ra_Owner user`),showAll:e.t(`ra_show_all`),deviceError:e.t(`ra_Error`),deviceDisconnected:e.t(`ra_Disconnected`),deviceConnected:e.t(`ra_Connected`),aclOwner_read_object:e.t(`ra_aclOwner_read_object`),aclOwner_read_state:e.t(`ra_aclOwner_read_state`),aclOwner_write_object:e.t(`ra_aclOwner_write_object`),aclOwner_write_state:e.t(`ra_aclOwner_write_state`),aclGroup_read_object:e.t(`ra_aclGroup_read_object`),aclGroup_read_state:e.t(`ra_aclGroup_read_state`),aclGroup_write_object:e.t(`ra_aclGroup_write_object`),aclGroup_write_state:e.t(`ra_aclGroup_write_state`),aclEveryone_read_object:e.t(`ra_aclEveryone_read_object`),aclEveryone_read_state:e.t(`ra_aclEveryone_read_state`),aclEveryone_write_object:e.t(`ra_aclEveryone_write_object`),aclEveryone_write_state:e.t(`ra_aclEveryone_write_state`),create:e.t(`ra_Create`),createBooleanState:e.t(`ra_create_boolean_state`),createNumberState:e.t(`ra_create_number_state`),createStringState:e.t(`ra_create_string_state`),createState:e.t(`ra_create_state`),createChannel:e.t(`ra_create_channel`),createDevice:e.t(`ra_create_device`),createFolder:e.t(`ra_Create folder`)},this.levelPadding=e.levelPadding||sK;let m=this.localStorage.getItem(`${this.props.dialogName||`App`}.table`);if(m)try{let e=JSON.parse(m),t=this.props.width||`lg`;this.storedWidths=JSON.parse(JSON.stringify(_K[t])),Object.keys(e).forEach(n=>{n===`id`?_K[t].idWidth=e.id:n===`nameHeader`?_K[t].widths.name=e[n]:_K[t].widths[n]!==void 0&&(_K[t].widths[n]=e[n])}),this.customWidth=!0}catch{}this.calculateColumnsVisibility()}async loadAllObjects(e){let t=this.props;try{await new Promise(e=>{this.setState({updating:!0},()=>e())});let n=(t.objectsWorker?await t.objectsWorker.getObjects(e):await t.socket.getObjects(e,!0))||{};if(t.types&&Ss.isWeb())for(let e=0;e<t.types.length;e++){if(t.types[e]===`state`||t.types[e]===`channel`||t.types[e]===`device`||t.types[e]===`enum`)continue;let r=await t.socket.getObjectViewSystem(t.types[e]);Object.assign(n||{},r)}if(this.systemConfig||=n?.[`system.config`]||await t.socket.getObject(`system.config`),this.systemConfig.common||={},this.systemConfig.common.defaultNewAcl||={object:0,state:0,file:0,owner:`system.user.admin`,ownerGroup:`system.group.administrator`},this.systemConfig.common.defaultNewAcl.owner||=`system.user.admin`,this.systemConfig.common.defaultNewAcl.ownerGroup||=`system.group.administrator`,typeof this.systemConfig.common.defaultNewAcl.state!=`number`&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof this.systemConfig.common.defaultNewAcl.object!=`number`&&(this.systemConfig.common.defaultNewAcl.state=1636),typeof t.filterFunc==`function`){this.objects={};let e=t.filterFunc;Object.keys(n).forEach(t=>{try{if(e(n[t]))this.objects[t]=n[t];else{let e=n[t]&&n[t].type;e&&(e===`channel`||e===`device`||e===`folder`||e===`adapter`||e===`instance`)&&(this.objects[t]=n[t])}}catch(e){console.log(`Error by filtering of "${t}": ${e}`)}})}else if(t.types){this.objects={};let e=t.types;Object.keys(n).forEach(t=>{let r=n[t]?.type;r&&(r===`channel`||r===`device`||r===`enum`||r===`folder`||r===`adapter`||r===`instance`||e.includes(r))&&(this.objects[t]=n[t])})}else this.objects=n;t.setObjectsReference&&t.setObjectsReference(this.objects),this.defaultHistory=this.systemConfig.common.defaultHistory,this.defaultHistory&&t.socket.getState(`system.adapter.${this.defaultHistory}.alive`).then(e=>{e?.val||(this.defaultHistory=``)}).catch(e=>window.alert(`Cannot get state: ${e}`));let r=await this.getAdditionalColumns();this.calculateColumnsVisibility(null,null,r);let{info:i,root:a}=XG(this.objects,{imagePrefix:t.imagePrefix,root:t.root,lang:t.lang,themeType:t.themeType});this.root=a,this.info=i;let o=this.state.selected?.length&&ZG(this.root,this.state.selected[0]);o&&!GG(o,this.state.filter,t.lang,this.objects,void 0,void 0,t.customFilter,t.types)?this.setState({filter:{...yK},columnsForAdmin:r},()=>{this.doFilter(),this.setState({loaded:!0,updating:!1},()=>this.expandAllSelected(()=>{this.onAfterSelect(),this.applyInitialNavigateTo()}))}):(this.doFilter(),this.setState({loaded:!0,updating:!1,columnsForAdmin:r},()=>this.expandAllSelected(()=>{this.onAfterSelect(),this.applyInitialNavigateTo()})))}catch(e){this.showError(e)}}expandAllSelected(e){let t=[...this.state.expanded],n=!1;this.state.selected.forEach(e=>{let r=e.split(`.`),i=[];for(let e=0;e<r.length-1;e++)i.push(r[e]),t.includes(i.join(`.`))||(t.push(i.join(`.`)),n=!0)}),n?(t.sort(),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t},e)):e&&e()}onAfterSelect(e){if(this.state.selected?.length&&this.state.selected[0]){this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,this.state.selected[0]),this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=``);let t=this.findItem(this.state.selected[0]);if(t?.data&&!t.data.visible&&!t.data.hasVisibleChildren&&this.clearFilter(),this.state.selected.length===1&&this.objects[this.state.selected[0]]){let t=X.getObjectName(this.objects,this.state.selected[0],null,{language:this.props.lang});this.props.onSelect?.(this.state.selected,t,e)}else(this.state.selected.length===1&&this.props.allowNonObjects||!this.props.allowNonObjects||!this.state.selected.find(e=>!this.objects[e]))&&this.props.onSelect?.(this.state.selected,null,e)}else this.localStorage.removeItem(`${this.props.dialogName||`App`}.objectSelected`),this.state.selected.length?this.setState({selected:[]},()=>{this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=``),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],``))}):this.props.onSelect&&(this.state.focused&&this.props.allowNonObjects?(this.selectFirst&&this.selectFirst!==this.state.selected[0]&&(this.selectFirst=``),this.props.onSelect([this.state.focused],null,e)):this.props.onSelect([],``))}static getDerivedStateFromProps(e,t){let n={},r=!1;return e.expertMode!==void 0&&e.expertMode!==t.filter.expertMode&&(r=!0,n.filter={...t.filter},n.filter.expertMode=e.expertMode),r?n:null}async componentDidMount(){await this.loadAllObjects(!vK),this.props.objectsWorker?this.props.objectsWorker.registerHandler(this.onObjectChangeFromWorker):await this.props.socket.subscribeObject(`*`,this.onObjectChange),vK=!0,window.addEventListener(`contextmenu`,this.onContextMenu,!0),window.addEventListener(`keydown`,this.onKeyPress,!0),window.addEventListener(`keyup`,this.onKeyPress,!0),this.props.onAllLoaded&&setTimeout(()=>{this.props.onAllLoaded?.()},100)}onKeyPress=e=>{e.type===`keydown`&&e.ctrlKey&&!this.ctrlPressed?(this.ctrlPressed=!0,this.tableRef.current&&(this.tableRef.current.className=`highlight-link`)):e.type===`keyup`&&!e.ctrlKey&&this.ctrlPressed&&(this.ctrlPressed=!1,this.tableRef.current&&(this.tableRef.current.className=``))};componentWillUnmount(){window.removeEventListener(`contextmenu`,this.onContextMenu,!0),window.removeEventListener(`keydown`,this.onKeyPress,!0),window.removeEventListener(`keyup`,this.onKeyPress,!0),this.props.objectsWorker?this.props.objectsWorker.unregisterHandler(this.onObjectChangeFromWorker,!0):this.props.socket.unsubscribeObject(`*`,this.onObjectChange).catch(e=>console.error(`Cannot unsubscribe *: ${e}`)),this.subscribes.forEach(e=>{this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.objects={}}showDeleteDialog(e){let{id:t,obj:n,item:r}=e,i=Object.keys(this.objects);i.sort();let a=0,o=`${t}.`;for(let e=0;e<i.length;e++)if(i[e].startsWith(o))a++;else if(i[e]>o)break;this.props.onObjectDelete?.(t,!!r.children?.length,!n.common?.dontDelete,a+1)}onContextMenu=e=>{this.contextMenu&&Date.now()-this.contextMenu.ts<2e3?(e.preventDefault(),this.setState({showContextMenu:{item:this.contextMenu.item,position:{left:e.clientX+2,top:e.clientY-6}}})):this.state.showContextMenu&&(e.preventDefault(),this.setState({showContextMenu:null})),this.contextMenu=null};refreshComponent(){this.subscribes.forEach(e=>{this.props.socket.unsubscribeState(e,this.onStateChange)}),this.subscribes=[],this.loadAllObjects(!0).then(()=>console.log(`updated!`)).catch(e=>this.showError(e))}renderErrorDialog(){return this.state.error?R.createElement(rC,{open:!0,maxWidth:`sm`,fullWidth:!0,onClose:()=>this.setState({error:``}),"aria-labelledby":`error-dialog-title`,"aria-describedby":`error-dialog-description`},R.createElement(bC,{id:`alert-dialog-title`},this.props.t(`ra_Error`)),R.createElement(pC,null,R.createElement(_C,{id:`alert-dialog-description`},this.state.error)),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.setState({error:``}),color:`primary`,autoFocus:!0,startIcon:R.createElement(EO,null)},this.props.t(`ra_Ok`)))):null}showError(e){this.setState({error:typeof e==`object`?e&&typeof e.toString==`function`?e.toString():JSON.stringify(e):e})}onSelect(e,t,n){if(this.localStorage.setItem(`${this.props.dialogName||`App`}.focused`,e),!this.props.multiSelect)this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))?(this.localStorage.removeItem(`${this.props.dialogName||`App`}.selectedNonObject`),this.state.selected[0]===e?t&&this.props.onSelect&&this.onAfterSelect(t):this.setState({selected:[e],selectedNonObject:``,focused:e},()=>{this.onAfterSelect(t),n&&n()})):(this.localStorage.setItem(`${this.props.dialogName||`App`}.selectedNonObject`,e),this.setState({selected:[],selectedNonObject:e,focused:e},()=>{this.onAfterSelect(),n&&n()}));else if(this.objects[e]&&(!this.props.types||this.props.types.includes(this.objects[e].type))){this.localStorage.removeItem(`${this.props.dialogName||`App`}.selectedNonObject`);let r=[...this.state.selected],i=r.indexOf(e);i===-1?(r.push(e),r.sort()):t||r.splice(i,1),this.setState({selected:r,selectedNonObject:``,focused:e},()=>{this.onAfterSelect(t),n&&n()})}}_renderDefinedList(e){let t=[...this.possibleCols];if(t.unshift(`id`),this.props.columns&&!this.props.columns.includes(`buttons`)){let e=t.indexOf(`buttons`);e!==-1&&t.splice(e,1)}return t.filter(t=>e&&(t===`val`||t===`buttons`)||!e&&t!==`val`&&t!==`buttons`).map(e=>R.createElement(Uw,{onClick:()=>{if(!this.state.columnsAuto&&e!==`id`){let t=[...this.state.columns||[]],n=t.indexOf(e);n===-1?(t.push(e),t.sort()):t.splice(n,1),this.localStorage.setItem(`${this.props.dialogName||`App`}.columns`,JSON.stringify(t)),this.calculateColumnsVisibility(null,t),this.setState({columns:t})}},key:e},R.createElement(dS,{edge:`start`,disabled:e===`id`||this.state.columnsAuto,checked:e===`id`||!!(this.state.columnsAuto?this.visibleCols.includes(e):this.state.columns?.includes(e)),disableRipple:!0}),R.createElement(cT,{primary:this.texts[`filter_${e}`]||this.props.t(`ra_${e}`)})))}renderColumnsSelectorDialog(){return this.state.columnsSelectorShow?R.createElement(rC,{onClose:()=>this.setState({columnsSelectorShow:!1}),open:!0,sx:{"& .MuiPaper-root":X.getStyle(this.props.theme,$.dialogColumns,$[`transparent_${this.state.columnsDialogTransparent}`])}},R.createElement(bC,{sx:$.fontSizeTitle},this.props.t(`ra_Configure`)),R.createElement(pC,{sx:$.fontSizeTitle},R.createElement(BC,{style:$.switchColumnAuto,control:R.createElement(XE,{checked:this.state.foldersFirst,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.foldersFirst`,this.state.foldersFirst?`false`:`true`),this.setState({foldersFirst:!this.state.foldersFirst})}}),label:this.props.t(`ra_Folders always first`)}),R.createElement(BC,{style:$.switchColumnAuto,control:R.createElement(XE,{checked:this.state.linesEnabled,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.lines`,this.state.linesEnabled?`false`:`true`),this.setState({linesEnabled:!this.state.linesEnabled})}}),label:this.props.t(`ra_Show lines between rows`)}),R.createElement(BC,{style:$.switchColumnAuto,control:R.createElement(XE,{checked:this.state.columnsAuto,onChange:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.columnsAuto`,this.state.columnsAuto?`false`:`true`),this.state.columnsAuto?this.state.columns?(this.calculateColumnsVisibility(!1),this.setState({columnsAuto:!1})):(this.calculateColumnsVisibility(!1,[...this.visibleCols]),this.setState({columnsAuto:!1,columns:[...this.visibleCols]})):(this.calculateColumnsVisibility(!0),this.setState({columnsAuto:!0}))}}),label:this.props.t(`ra_Auto (no custom columns)`)}),R.createElement(Iw,null,this._renderDefinedList(!1),this.state.columnsForAdmin&&Object.keys(this.state.columnsForAdmin).sort().map(e=>this.state.columnsForAdmin?.[e].map(t=>R.createElement(Uw,{onClick:()=>{if(!this.state.columnsAuto){let n=[...this.state.columns||[]],r=`_${e}_${t.path}`,i=n.indexOf(r);i===-1?(n.push(r),n.sort()):n.splice(i,1),this.calculateColumnsVisibility(null,n),this.localStorage.setItem(`${this.props.dialogName||`App`}.columns`,JSON.stringify(n)),this.setState({columns:n})}},key:`${e}_${t.name}`},R.createElement(rT,null,R.createElement(dS,{disabled:this.state.columnsAuto,edge:`start`,checked:!this.state.columnsAuto&&this.state.columns?.includes(`_${e}_${t.path}`),disableRipple:!0})),R.createElement(cT,{primary:`${t.name} (${e})`})))),this._renderDefinedList(!0))),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.setState({columnsSelectorShow:!1}),color:`primary`,startIcon:R.createElement(DO,null)},this.texts.close))):null}async getAdditionalColumns(){try{let e=await this.props.socket.getAdapters(),t=null;return e.forEach(e=>t=this.parseObjectForAdmins(t,e)),t}catch(e){return console.error(`Cannot get adapters: ${e}`),null}}checkUnsubscribes(){for(let e=this.subscribes.length-1;e>=0;e--)this.recordStates.includes(this.subscribes[e])||this.unsubscribe(this.subscribes[e]);this.recordStates=[]}findItem(e,t,n,r){if(t||=e.split(`.`),n||=this.root,!n||!t.length)return null;if(r=(r?`${r}.`:``)+t.shift(),n.children){let i=n.children.find(e=>e.data.id===r);if(i){if(i.data.id===e)return i;if(t.length)return this.findItem(e,t,i,r)}else return null}return null}onStateChange=(e,t)=>{if(this.states[e]){let t=this.findItem(e);t?.data.state&&(t.data.state=void 0)}t?this.states[e]=t:delete this.states[e],this.pausedSubscribes?this.statesUpdateTimer&&=(clearTimeout(this.statesUpdateTimer),null):this.statesUpdateTimer||=setTimeout(()=>{this.statesUpdateTimer=null,this.forceUpdate()},300)};parseObjectForAdmins(e,t){if(t.common?.adminColumns&&t.common.name){let n=t.common.adminColumns,r;n&&typeof n!=`object`?r=[n]:n&&(r=n);let i;i=n?r?.map(e=>{if(typeof e!=`object`)return{path:e,name:e.split(`.`).pop()};let n=e;return n.objTypes&&typeof n.objTypes!=`object`?n.objTypes=[n.objTypes]:n.objTypes||=void 0,!n.name&&n.path?{path:n.path,name:n.path.split(`.`).pop(),width:n.width,edit:!!n.edit,type:n.type,objTypes:n.objTypes}:n.path?{path:n.path,name:UG(n.name||``,this.props.lang),width:n.width,edit:!!n.edit,type:n.type,objTypes:n.objTypes}:(console.warn(`Admin columns for ${t._id} ignored, because path not found`),null)}).filter(e=>e):null,i&&i.length&&(e||={},e[t.common.name]=i.sort((e,t)=>e.path>t.path?-1:+(e.path<t.path)))}else t.common&&t.common.name&&e&&e[t.common.name]&&delete e[t.common.name];return e}onObjectChangeFromWorker=e=>{if(Array.isArray(e)){let t=null;e.forEach(e=>{let{newInnerState:n,filtered:r}=this.processOnObjectChangeElement(e.id,e.obj);r||(n&&t?Object.assign(t,n):t=n)}),t&&this.setState(t),this.afterObjectUpdated()}};onObjectChange=(e,t)=>{let{newInnerState:n,filtered:r}=this.processOnObjectChangeElement(e,t);r||(n&&this.setState(n),this.afterObjectUpdated())};afterObjectUpdated(){!this.objectsUpdateTimer&&this.objects&&(this.objectsUpdateTimer=setTimeout(()=>{this.objectsUpdateTimer=null;let{info:e,root:t}=XG(this.objects,{imagePrefix:this.props.imagePrefix,root:this.props.root,lang:this.props.lang,themeType:this.props.themeType});this.root=t,this.info=e,this.pausedSubscribes||this.doFilter()},500))}updateAliases(e){if(!this.objects||!this.info?.aliasesMap||!e?.startsWith(`alias.`))return;let t=Object.keys(this.objects).filter(e=>e.startsWith(`alias.0`));this.info.aliasesMap={};for(let e of t){let t=this.objects[e];if(t?.common?.alias?.id)if(typeof t.common.alias.id==`string`){let n=t.common.alias.id;this.info.aliasesMap[n]?this.info.aliasesMap[n].includes(e)||this.info.aliasesMap[n].push(e):this.info.aliasesMap[n]=[e]}else{let n=t.common.alias.id.read;n&&(this.info.aliasesMap[n]?this.info.aliasesMap[n].includes(e)||this.info.aliasesMap[n].push(e):this.info.aliasesMap[n]=[e]);let r=t.common.alias.id.write;r&&(this.info.aliasesMap[r]?this.info.aliasesMap[r].includes(e)||this.info.aliasesMap[r].push(e):this.info.aliasesMap[r]=[e])}}}processOnObjectChangeElement(e,t){let n=t?.type;if(t&&typeof this.props.filterFunc==`function`&&!this.props.filterFunc(t)&&n!==`channel`&&n!==`device`&&n!==`folder`&&n!==`adapter`&&n!==`instance`)return{newInnerState:null,filtered:!0};let r=null;if(e.startsWith(`system.adapter.`)&&t?.type===`adapter`){let e=JSON.parse(JSON.stringify(this.state.columnsForAdmin));this.parseObjectForAdmins(e,t),JSON.stringify(this.state.columnsForAdmin)!==JSON.stringify(e)&&(r={columnsForAdmin:e})}return this.objects||={},t?this.objects[e]=t:this.objects[e]&&delete this.objects[e],this.updateAliases(e),{newInnerState:r,filtered:!1}}subscribe(e){this.subscribes.includes(e)||(this.subscribes.push(e),this.pausedSubscribes||this.props.socket.subscribeState(e,this.onStateChange).catch(t=>console.error(`Cannot subscribe on state ${e}: ${t}`)))}unsubscribe(e){let t=this.subscribes.indexOf(e);t!==-1&&(this.subscribes.splice(t,1),this.states[e]&&delete this.states[e],this.props.socket.unsubscribeState(e,this.onStateChange),this.pausedSubscribes&&console.warn(`Unsubscribe during pause?`))}pauseSubscribe(e){!this.pausedSubscribes&&e?(this.pausedSubscribes=!0,this.subscribes.forEach(e=>this.props.socket.unsubscribeState(e,this.onStateChange))):this.pausedSubscribes&&!e&&(this.pausedSubscribes=!1,this.subscribes.forEach(e=>this.props.socket.subscribeState(e,this.onStateChange)))}clearFilter(){JSON.stringify(this.state.filter)!==JSON.stringify(yK)&&this.setState({filter:{...yK},filterKey:this.state.filterKey+1},()=>{this.doFilter(),this.props.onFilterChanged?.({...yK})})}isFilterEmpty(){return!!this.state.filter.id||!!this.state.filter.name||!!this.state.filter.room?.length||!!this.state.filter.func?.length||!!this.state.filter.role?.length||!!this.state.filter.type?.length||!!this.state.filter.custom?.length}getFilterInput(e){return R.createElement(VG,{key:`${e}_${this.state.filterKey}`,styles:this.styles.filterInput,name:e,texts:this.texts,t:this.props.t,initialValue:this.state.filter[e],onChange:(e,t)=>{let n={...this.state.filter};t===void 0?delete n[e]:n[e]=t,this.setState({filter:n},()=>{this.doFilter(),this.props.onFilterChanged?.(n)})}})}getFilterSelect(e,t){return R.createElement(BG,{key:`${e}_${this.state.filterKey}`,name:e,texts:this.texts,initialValue:this.state.filter[e]||[],values:t||[],onChange:(e,t)=>{let n={...this.state.filter};t===void 0?delete n[e]:n[e]=t,this.setState({filter:n},()=>{this.doFilter(),this.props.onFilterChanged?.(n)})}})}getFilterSelectRole(){return this.getFilterSelect(`role`,this.info.roles.map(e=>e.role))}getFilterSelectRoom(){let e=this.info.roomEnums.map(e=>({name:UG(this.objects[e]?.common?.name,this.props.lang)||e.split(`.`).pop(),value:e,icon:R.createElement(MW,{src:this.objects[e]?.common?.icon||``,style:$.selectIcon})}));return this.getFilterSelect(`room`,e)}getFilterSelectFunction(){let e=this.info.funcEnums.map(e=>({name:UG(this.objects[e]?.common?.name,this.props.lang)||e.split(`.`).pop(),value:e,icon:R.createElement(MW,{src:this.objects[e]?.common?.icon||``,style:$.selectIcon})}));return this.getFilterSelect(`func`,e)}getFilterSelectType(){let e=this.info.types.map(e=>({name:e,value:e,icon:gK[e]||null}));return this.getFilterSelect(`type`,e)}getFilterSelectCustoms(){if(this.info.customs.length>1){let e=this.info.customs.map(e=>({name:e===`_`?this.texts.filterCustomsWithout:e,value:e,icon:e===`_`?null:R.createElement(MW,{src:WG(this.objects,e,this.props.lang,this.imagePrefix)||``,style:$.selectIcon})}));return this.getFilterSelect(`custom`,e)}return null}onExpandAll(e,t){let n=e||this.root;t||=[],n?.children?.forEach(e=>{e.data.sumVisibility&&(t.push(e.data.id),this.onExpandAll(e,t))}),n===this.root&&(t.sort(),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t}))}onCollapseAll(){this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify([])),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,`[]`),this.setState({expanded:[],depth:0,selected:[]},()=>this.onAfterSelect())}expandDepth(e,t,n){if(!this.root)throw Error(`No root`);e||=this.root,t>0&&e.children?.forEach(e=>{e.data.sumVisibility&&(HG(n,e.data.id)||(n.push(e.data.id),n.sort()),t-1>0&&this.expandDepth(e,t-1,n))})}static collapseDepth(e,t){return t.filter(t=>t.split(`.`).length<=e)}onExpandVisible(){if(this.state.depth<9){let e=this.state.depth+1,t=[...this.state.expanded];this.root&&this.expandDepth(this.root,e,t),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({depth:e,expanded:t})}}onStatesViewVisible(){let e=!this.state.statesView;this.localStorage.setItem(`${this.props.dialogName||`App`}.objectStatesView`,JSON.stringify(e)),this.setState({statesView:e})}onCollapseVisible(){if(this.state.depth>0){let t=this.state.depth-1,n=e.collapseDepth(t,this.state.expanded);this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(n)),this.setState({depth:t,expanded:n})}}getEnumsForId=e=>{let t=[];return this.info.enums.forEach(n=>{if(this.objects[n]?.common?.members?.includes(e)){let e={_id:this.objects[n]._id,common:JSON.parse(JSON.stringify(this.objects[n].common)),native:this.objects[n].native,type:`enum`};e.common&&(delete e.common.members,delete e.common.custom,delete e.common.mobile),t.push(e)}}),t.length?t:void 0};_createAllEnums=async(e,t)=>{for(let n=0;n<e.length;n++){let r=e[n],i,a;typeof r==`object`?(a=r,i=a._id):i=r;let o=this.objects[i];o?o.common?.members?.includes(t)||(o.common||={},o.type=`enum`,o.common.members||=[],o.common.members.push(t),o.common.members.sort(),await this.props.socket.setObject(i,o)):(o=a||{_id:i,common:{name:i.split(`.`).pop(),members:[]},native:{},type:`enum`},o.common||={},o.common.members=[t],o.type=`enum`,await this.props.socket.setObject(i,o))}};async loadObjects(e){if(e)for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!e[t])continue;let n=e[t],r=null,i,a;n?.common?.enums?(r=n.common.enums,delete n.common.enums):r=null,(n.val||n.val===0)&&(i=n.val,delete n.val),n.ack!==void 0&&(a=n.ack,delete n.ack);try{if(await this.props.socket.setObject(t,n),r&&await this._createAllEnums(r,n._id),n.type===`state`)if(i!=null)try{await this.props.socket.setState(n._id,i,a===void 0||a)}catch(e){window.alert(`Cannot set state "${n._id} with ${i}": ${e}`)}else try{let e=await this.props.socket.getState(n._id);if(!e||e.val===null)try{await this.props.socket.setState(n._id,!n.common||n.common.def===void 0?null:n.common.def,!0)}catch(e){window.alert(`Cannot set state "${n._id}": ${e}`)}}catch(e){window.alert(`Cannot read state "${n._id}": ${e}`)}}catch(e){window.alert(e)}}}_getSelectedIdsForExport(){if(this.state.selected.length||this.state.selectedNonObject){let e=[],t=Object.keys(this.objects);t.sort();let n=this.state.selected[0]||this.state.selectedNonObject,r=`${n}.`,i=r.length;for(let a=0;a<t.length;a++){let o=t[a];if((n===o||o.startsWith(r))&&e.push(o),o.substring(0,i)>r)break}return e}return[]}async _exportObjects(e){if(e.isAll){zG(`allObjects.json`,this.objects,e);return}if(!(this.state.selected.length||this.state.selectedNonObject)){window.alert(this.props.t(`ra_Save of objects-tree is not possible`));return}let t={},n=this.state.selected[0]||this.state.selectedNonObject,r=this._getSelectedIdsForExport();for(let n of r){if(t[n]=JSON.parse(JSON.stringify(this.objects[n])),t[n]?.type===`state`&&!e.noStatesByExportImport){let e=await this.props.socket.getState(n);e&&(t[n].val=e.val,t[n].ack=e.ack)}if(t[n].common){let e=this.getEnumsForId(n);e&&(t[n].common.enums=e)}}zG(`${n}.json`,t,e)}renderExportDialog(){return this.state.showExportDialog===!1?null:R.createElement(rC,{open:!0,maxWidth:`lg`},R.createElement(bC,null,this.props.t(`ra_Select type of export`)),R.createElement(pC,null,R.createElement(_C,null,this.state.filter.expertMode||this.state.showAllExportOptions?R.createElement(R.Fragment,null,this.props.t(`ra_You can export all objects or just the selected branch.`),R.createElement(`br`,null),this.props.t(`ra_Selected %s object(s)`,this.state.showExportDialog),R.createElement(`br`,null),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.noStatesByExportImport,onChange:e=>this.setState({noStatesByExportImport:e.target.checked})}),label:this.props.t(`ra_Do not export values of states`)}),R.createElement(`br`,null),this.props.t(`These options can reduce the size of the export file:`),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.beautifyJsonExport,onChange:e=>this.setState({beautifyJsonExport:e.target.checked})}),label:this.props.t(`Beautify JSON output`)}),R.createElement(`br`,null),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.excludeSystemRepositoriesFromExport,onChange:e=>this.setState({excludeSystemRepositoriesFromExport:e.target.checked})}),label:this.props.t(`Exclude system repositories from export JSON`)}),R.createElement(BC,{control:R.createElement(dS,{checked:this.state.excludeTranslations,onChange:e=>this.setState({excludeTranslations:e.target.checked})}),label:this.props.t(`Exclude translations (except english) from export JSON`)})):null)),R.createElement(sC,null,this.state.filter.expertMode||this.state.showAllExportOptions?R.createElement(Vx,{color:`grey`,variant:`outlined`,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!0,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},R.createElement(`span`,{style:{marginRight:8}},this.props.t(`ra_All objects`)),`(`,Object.keys(this.objects).length,`)`):R.createElement(Vx,{color:`grey`,variant:`outlined`,startIcon:R.createElement(JU,null),onClick:()=>this.setState({showAllExportOptions:!0})},this.props.t(`ra_Advanced options`)),R.createElement(Vx,{color:`primary`,variant:`contained`,autoFocus:!0,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1},()=>this._exportObjects({isAll:!1,noStatesByExportImport:this.state.noStatesByExportImport,beautify:this.state.beautifyJsonExport,excludeSystemRepositories:this.state.excludeSystemRepositoriesFromExport,excludeTranslations:this.state.excludeTranslations}))},R.createElement(`span`,{style:{marginRight:8}},this.props.t(`ra_Only selected`)),`(`,this.state.showExportDialog,`)`),R.createElement(Vx,{color:`grey`,variant:`contained`,onClick:()=>this.setState({showExportDialog:!1,showAllExportOptions:!1}),startIcon:R.createElement(DO,null)},this.props.t(`ra_Cancel`))))}renderRenameDialog(){if(!this.state.showRenameDialog)return null;let e=this.props.objectMoveRenameDialog;return R.createElement(e,{expertMode:!!this.props.expertMode,onClose:()=>this.setState({showRenameDialog:null}),id:this.state.showRenameDialog.id,childrenIds:this.state.showRenameDialog.childrenIds,theme:this.props.theme,socket:this.props.socket,t:this.props.t,objectType:this.objects[this.state.showRenameDialog.id]?.type})}async parseJsonFile(e){try{let t=JSON.parse(e),n=Object.keys(t).length,r=t._id;if(r===void 0&&n)await this.loadObjects(t),window.alert(this.props.t(`ra_%s object(s) processed`,n));else{if(!r)return window.alert(this.props.t(`ra_Invalid structure`));try{let e,n,r;if(t.common.enums&&(e=t.common.enums,delete t.common.enums),t.val&&(n=t.val,delete t.val),t.ack!==void 0&&(r=t.ack,delete t.ack),await this.props.socket.setObject(t._id,t),t.type===`state`)if(n!=null)await this.props.socket.setState(t._id,n,r===void 0||r);else{let e=await this.props.socket.getState(t._id);(!e||e.val===null||e.val===void 0)&&await this.props.socket.setState(t._id,t.common.def===void 0?null:t.common.def,!0)}e&&await this._createAllEnums(e,t._id),window.alert(this.props.t(`ra_%s was imported`,t._id))}catch(e){window.alert(e)}}}catch(e){window.alert(e)}}handleJsonUpload(e){let t=e.target,n=t.files?.length&&t.files[0];if(n){let e=new FileReader;e.onload=e=>{this.parseJsonFile(e.target?.result).catch(e=>console.log(`Cannot parse file: ${e}`))},e.readAsText(n)}else window.alert(this.props.t(`ra_Failed to open JSON File`))}toolTipObjectCreating=()=>{let{t:e}=this.props,t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:2},e(`ra_Folder → State`)),R.createElement(`div`,{key:3},e(`ra_Folder → Channel → State`)),R.createElement(`div`,{key:4},e(`ra_Folder → Device → Channel → State`)),R.createElement(`div`,{key:5},e(`ra_Device → Channel → State`)),R.createElement(`div`,{key:6},e(`ra_Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];if(this.state.selected.length||this.state.selectedNonObject){let n=this.state.selected[0]||this.state.selectedNonObject;if(!(n.split(`.`).length<2||this.objects[n]&&this.objects[n]?.type===`state`))if(this.state.filter.expertMode)switch(this.objects[n]?.type){case`device`:t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:5},e(`ra_Device → Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];break;case`folder`:t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:2},e(`ra_Folder → State`)),R.createElement(`div`,{key:3},e(`ra_Folder → Channel → State`)),R.createElement(`div`,{key:4},e(`ra_Folder → Device → Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];break;case`channel`:t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:1},e(`ra_Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:8},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:9},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))];break;default:break}else(n.startsWith(`alias.0`)||n.startsWith(`0_userdata`))&&(t=[R.createElement(`div`,{key:1},e(`ra_Only following structures of objects are available:`)),R.createElement(`div`,{key:2},e(`ra_Folder → State`)),R.createElement(`div`,{key:3},e(`ra_Folder → Channel → State`)),R.createElement(`div`,{key:4},e(`ra_Folder → Device → Channel → State`)),R.createElement(`div`,{key:5},e(`ra_Device → Channel → State`)),R.createElement(`div`,{key:6},e(`ra_Channel → State`)),R.createElement(`div`,{key:7,style:{height:10}}),R.createElement(`div`,{key:7},e(`ra_Non-experts may create new objects only in "0_userdata.0" or "alias.0".`)),R.createElement(`div`,{key:8},e(`ra_The experts may create objects everywhere but from second level (e.g. "vis.0" or "javascript.0").`))])}return t.length?t:e(`ra_Add new child object to selected parent`)};onOpenFile(){let e=document.createElement(`input`);e.setAttribute(`type`,`file`),e.setAttribute(`id`,`files`),e.setAttribute(`opacity`,`0`),e.addEventListener(`change`,e=>this.handleJsonUpload(e),!1),e.click()}renderInputJsonDialog(){if(!this.state.showImportDialog)return null;let e=this.props.objectBrowserInsertJsonObjects;return R.createElement(e,{onClose:e=>{this.setState({showImportDialog:!1}),e&&this.parseJsonFile(e)},themeName:this.props.themeName,themeType:this.props.themeType,t:this.props.t})}getToolbar(){let e=!1;if(this.state.selected.length||this.state.selectedNonObject){let t=this.state.selected[0]||this.state.selectedNonObject;t.split(`.`).length<2||this.objects[t]&&this.objects[t].type===`state`?e=!1:(this.state.filter.expertMode||t.startsWith(`alias.0`)||t.startsWith(`0_userdata`))&&(e=!0)}return R.createElement(`div`,{style:{display:`flex`,width:`100%`,alignItems:`center`,overflowX:`auto`}},R.createElement(`div`,{style:{display:`flex`,width:`100%`,alignItems:`center`}},R.createElement(HE,{title:this.props.t(`ra_Refresh tree`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(`div`,null,R.createElement(uv,{onClick:()=>this.refreshComponent(),disabled:this.state.updating,size:`large`},R.createElement(rk,null)))),this.props.showExpertButton&&!this.props.expertMode&&R.createElement(HE,{title:this.props.t(`ra_expertMode`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`expertMode`,color:this.state.filter.expertMode?`secondary`:`default`,onClick:()=>{let e={...this.state.filter};e.expertMode=!e.expertMode,this.localStorage.setItem(`${this.props.dialogName||`App`}.objectFilter`,JSON.stringify(e)),this.setState({filter:e})},size:`large`},R.createElement(JU,null))),!this.props.disableColumnSelector&&this.props.width!==`xs`&&R.createElement(HE,{title:this.props.t(`ra_Configure`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`columnSelector`,color:this.state.columnsAuto?`primary`:`default`,onClick:()=>this.setState({columnsSelectorShow:!0}),size:`large`},R.createElement(gk,null))),this.props.width!==`xs`&&this.state.expandAllVisible&&R.createElement(HE,{title:this.props.t(`ra_Expand all nodes`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`expandAll`,onClick:()=>this.onExpandAll(),size:`large`},R.createElement(XU,null))),R.createElement(HE,{title:this.props.t(`ra_Collapse all nodes`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`collapseAll`,onClick:()=>this.onCollapseAll(),size:`large`},R.createElement(YU,null))),this.props.width!==`xs`&&R.createElement(HE,{title:this.props.t(`ra_Expand one step node`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`expandVisible`,color:`primary`,onClick:()=>this.onExpandVisible(),size:`large`},R.createElement(hx,{badgeContent:this.state.depth,color:`secondary`,sx:e=>({badge:{right:3,top:3,border:`2px solid ${e.palette.background.paper}`,padding:`0 4px`}})},R.createElement(XU,null)))),this.props.width!==`xs`&&R.createElement(HE,{title:this.props.t(`ra_Collapse one step node`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{key:`collapseVisible`,color:`primary`,onClick:()=>this.onCollapseVisible(),size:`large`},R.createElement(hx,{sx:e=>({badge:{right:3,top:3,border:`2px solid ${e.palette.background.paper}`,padding:`0 4px`}}),badgeContent:this.state.depth,color:`secondary`},R.createElement(YU,null)))),this.props.objectStatesView&&R.createElement(HE,{title:this.props.t(`ra_Toggle the states view`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>this.onStatesViewVisible(),size:`large`},R.createElement(QO,{color:this.state.statesView?`primary`:`inherit`}))),R.createElement(HE,{title:this.props.t(`ra_Show/Hide object descriptions`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.desc`,this.state.showDescription?`false`:`true`),this.setState({showDescription:!this.state.showDescription})},size:`large`},R.createElement(dk,{color:this.state.showDescription?`primary`:`inherit`}))),this.props.objectAddBoolean?R.createElement(HE,{title:this.toolTipObjectCreating(),slotProps:{popper:{sx:$.tooltip}}},R.createElement(`div`,null,R.createElement(uv,{disabled:!e,onClick:()=>this.setState({modalNewObj:{id:this.state.selected[0]||this.state.selectedNonObject}}),size:`large`},R.createElement(hO,null)))):null,this.props.objectImportExport&&R.createElement(HE,{title:this.props.t(`ra_Add objects tree from JSON file`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:e=>{this.props.objectBrowserInsertJsonObjects?this.setState({showImportMenu:e.currentTarget}):this.onOpenFile()},size:`large`},R.createElement(nk,null))),this.props.objectBrowserInsertJsonObjects?R.createElement(jT,{anchorEl:this.state.showImportMenu,open:!!this.state.showImportMenu,onClose:()=>this.setState({showImportMenu:null})},R.createElement(LT,{onClick:()=>this.setState({showImportMenu:null},()=>this.onOpenFile())},R.createElement(rT,null,R.createElement(fk,null)),R.createElement(cT,null,this.props.t(`ra_From file`))),R.createElement(LT,{onClick:()=>this.setState({showImportMenu:null,showImportDialog:!0})},R.createElement(rT,null,R.createElement(jO,null)),R.createElement(cT,null,this.props.t(`ra_From text`)))):null,this.props.objectImportExport&&(!!this.state.selected.length||this.state.selectedNonObject)&&R.createElement(HE,{title:this.props.t(`ra_Save objects tree as JSON file`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>this.setState({showExportDialog:this._getSelectedIdsForExport().length}),size:`large`},R.createElement(nk,{style:{transform:`rotate(180deg)`}})))),!!this.props.objectBrowserEditObject&&this.props.width!==`xs`&&R.createElement(`div`,{style:{display:`flex`,whiteSpace:`nowrap`}},`${this.props.t(`ra_Objects`)}: ${Object.keys(this.info.objects).length}, ${this.props.t(`ra_States`)}: ${Object.keys(this.info.objects).filter(e=>this.info.objects[e].type===`state`).length}`),this.props.objectEditBoolean&&R.createElement(HE,{title:this.props.t(`ra_Edit custom config`),slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{onClick:()=>{let e=this.root?KG(this.root,`state`,this.objects):[];e.length?(this.pauseSubscribe(!0),e.length===1&&(this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,this.state.selected[0]),this.props.router?.doNavigate(null,`custom`,this.state.selected[0])),this.setState({customDialog:e,customDialogAll:!0})):this.setState({toast:this.props.t(`ra_please select object`)})},size:`large`},R.createElement(wO,null))))}toggleExpanded(e){let t=JSON.parse(JSON.stringify(this.state.expanded)),n=t.indexOf(e);n===-1?(t.push(e),t.sort()):t.splice(n,1),this.localStorage.setItem(`${this.props.dialogName||`App`}.objectExpanded`,JSON.stringify(t)),this.setState({expanded:t})}onCopy(e,t){e.stopPropagation(),e.preventDefault(),t&&(X.copyToClipboard(t),t.length<50?this.setState({toast:this.props.t(`ra_Copied %s`,t)}):this.setState({toast:this.props.t(`ra_Copied`)}))}renderTooltipAccessControl=e=>{if(!e)return null;let t=[{value:`0x400`,valueNum:1024,title:`read`,group:`Owner`},{value:`0x200`,valueNum:512,title:`write`,group:`Owner`},{value:`0x40`,valueNum:64,title:`read`,group:`Group`},{value:`0x20`,valueNum:32,title:`write`,group:`Group`},{value:`0x4`,valueNum:4,title:`read`,group:`Everyone`},{value:`0x2`,valueNum:2,title:`write`,group:`Everyone`}],n=[],r=r=>{let i=e[r];t.forEach((e,t)=>{i&e.valueNum&&n.push(R.createElement(`span`,{key:r+t},this.texts[`acl${e.group}_${e.title}_${r}`],`,`,R.createElement(`span`,{style:r===`object`?$.rightsObject:$.rightsState},e.value)))})};return n.push(R.createElement(`span`,{key:`group`},`${this.texts.ownerGroup}: ${(e.ownerGroup||``).replace(`system.group.`,``)}`)),n.push(R.createElement(`span`,{key:`owner`},`${this.texts.ownerUser}: ${(e.owner||``).replace(`system.user.`,``)}`)),r(`object`),e.state&&r(`state`),n.length?R.createElement(`span`,{style:$.tooltipAccessControl},n.map(e=>e)):null};renderColumnButtons(e,t){if(!t.data.obj)return this.props.onObjectDelete||this.props.objectEditOfAccessControl?R.createElement(`div`,{style:$.buttonDiv},this.state.filter.expertMode&&this.props.objectEditOfAccessControl?R.createElement(uv,{sx:{...$.cellButtonsButton,...$.cellButtonsEmptyButton,...$.cellButtonMinWidth},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:`large`},R.createElement(`div`,{style:{height:15}},`---`)):null,this.props.onObjectDelete&&t.children?.length?R.createElement(uv,{sx:{...$.cellButtonsButton,...$.cellButtonsButtonAlone},size:`small`,"aria-label":`delete`,title:this.texts.deleteObject,onClick:()=>{let n=Object.keys(this.objects);n.sort();let r=0,i=`${e}.`;for(let e=0;e<n.length;e++)if(n[e].startsWith(i))r++;else if(n[e]>i)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!t.children?.length,!1,r+1)}},R.createElement(PO,{style:$.cellButtonsButtonIcon})):null):null;t.data.aclTooltip=t.data.aclTooltip||this.renderTooltipAccessControl(t.data.obj.acl);let n=t.data.obj.acl?t.data.obj.type===`state`?t.data.obj.acl.state:t.data.obj.acl.object:0,r=t.data.obj.acl&&(t.data.obj.type===`state`?this.systemConfig?.common.defaultNewAcl.state:this.systemConfig?.common.defaultNewAcl.object),i=!!t.data.obj&&(this.state.filter.expertMode||oK(t.data.id));return[this.state.filter.expertMode&&this.props.objectEditOfAccessControl?R.createElement(HE,{key:`acl`,title:t.data.aclTooltip,slotProps:{popper:{sx:$.tooltip}}},R.createElement(uv,{sx:{...$.cellButtonsButton,...$.cellButtonMinWidth,opacity:1},onClick:()=>this.setState({modalEditOfAccess:!0,modalEditOfAccessObjData:t.data}),size:`large`},R.createElement(`div`,{style:$.aclText},Number.isNaN(Number(n))?Number(r).toString(16):Number(n).toString(16)))):R.createElement(`div`,{key:`aclEmpty`,style:$.cellButtonMinWidth}),i?R.createElement(uv,{key:`edit`,sx:{marginRight:`2px`,...$.cellButtonsButton},size:`small`,"aria-label":`edit`,title:this.texts.editObject,onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,e),this.setState({editObjectDialog:e,editObjectAlias:!1})}},R.createElement(LO,{style:$.cellButtonsButtonIcon})):R.createElement(_x,{component:`div`,key:`editDisabled`,sx:$.cellButtonsButton}),this.props.onObjectDelete&&(t.children?.length||!t.data.obj.common?.dontDelete)?R.createElement(uv,{key:`delete`,sx:$.cellButtonsButton,size:`small`,"aria-label":`delete`,onClick:()=>{let n=Object.keys(this.objects);n.sort();let r=0,i=`${e}.`;for(let e=0;e<n.length;e++)if(n[e].startsWith(i))r++;else if(n[e]>i)break;this.props.onObjectDelete&&this.props.onObjectDelete(e,!!t.children?.length,!t.data.obj?.common?.dontDelete,r)},title:this.texts.deleteObject},R.createElement(PO,{style:$.cellButtonsButtonIcon})):null,this.props.objectCustomDialog&&this.info.hasSomeCustoms&&t.data.obj.type===`state`&&t.data.obj.common?.type!==`file`?R.createElement(uv,{sx:{...$.cellButtonsButton,...t.data.hasCustoms?this.styles.cellButtonsButtonWithCustoms:$.cellButtonsButtonWithoutCustoms},key:`custom`,size:`small`,"aria-label":`config`,title:this.texts.customConfig,onClick:()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.objectSelected`,e),this.pauseSubscribe(!0),this.props.router?.doNavigate(null,`customs`,e),this.setState({customDialog:[e],customDialogAll:!1})}},R.createElement(sk,{style:$.cellButtonsButtonIcon})):null]}readHistory(e){if(window.sparkline&&this.defaultHistory&&this.objects[e]?.common?.custom&&this.objects[e].common.custom[this.defaultHistory]){let t=new Date;t.setHours(t.getHours()-24),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0);let n=t.getTime();this.props.socket.getHistory(e,{instance:this.defaultHistory,start:n,end:Date.now(),step:36e5,from:!1,ack:!1,q:!1,addId:!1,aggregate:`minmax`}).then(t=>{let r=window.document.getElementsByClassName(`sparkline`);for(let i=0;i<r.length;i++)if(r[i].dataset.id===e){let e=rK(t,n);window.sparkline.sparkline(r[i],e);break}}).catch(e=>console.warn(`Cannot read history: ${e}`))}}getTooltipInfo(e,t){let n=this.objects[e],r=this.states[e],{valFull:i,fileViewer:a}=tK({state:r,obj:n,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,full:!0}),o=[];i?.forEach(e=>{e.t===this.texts.quality&&r.q?(o.push(R.createElement(`div`,{style:$.cellValueTooltipBoth,key:e.t},e.t,`:\xA0`,e.v)),e.nbr||o.push(R.createElement(`br`,{key:`${e.t}_br`}))):(o.push(R.createElement(`div`,{style:$.cellValueTooltipTitle,key:e.t},e.t,`:\xA0`)),o.push(R.createElement(`div`,{style:$.cellValueTooltipValue,key:`${e.t}_v`},e.v)),e.nbr||o.push(R.createElement(`br`,{key:`${e.t}_br`})))});let s=n?.common?.role||``;a===`image`?o.push(R.createElement(`img`,{style:$.cellValueTooltipImage,src:r.val,alt:e})):s===`url`||s===`url.self`||s===`url.blank`?o.unshift(R.createElement(`div`,{key:`ctrl`,style:{textDecoration:`underline`,fontWeight:`bold`}},this.texts.ctrlForLink)):this.defaultHistory&&n?.common?.custom?.[this.defaultHistory]&&o.push(R.createElement(`svg`,{key:`sparkline`,className:`sparkline`,"data-id":e,style:{fill:`#3d85de`},width:`200`,height:`30`,strokeWidth:`3`})),this.setState({tooltipInfo:{el:o,id:e}},()=>t&&t())}renderColumnValue(e,t,n){let r=t.data.obj;if(!r||!this.states)return null;if(r.common?.type===`file`)return R.createElement(_x,{component:`div`,sx:{...$.cellValueText,...$.cellValueFile}},`[file]`);if(!this.states[e])return r.type===`state`&&(this.recordStates.includes(e)||this.recordStates.push(e),this.states[e]={val:null},this.subscribe(e)),null;this.recordStates.includes(e)||this.recordStates.push(e);let i=this.states[e],a=t.data.state;if(!a){let{valText:e}=tK({state:i,obj:r,texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma}),o=[];if(t.data.state={valTextRx:o},o.push(R.createElement(`span`,{className:`newValueBrowser-${this.props.themeType||`light`}`,key:`${e.v.toString()}valText`,style:{whiteSpace:`nowrap`,display:`inline-block`,overflow:`hidden`,textOverflow:`ellipsis`}},e.v.toString())),e.u&&o.push(R.createElement(`span`,{className:`newValueBrowser-${this.props.themeType||`light`}`,style:$.cellValueTextUnit,key:`${e.v.toString()}unit`},e.u)),e.s!==void 0&&o.push(R.createElement(`span`,{style:$.cellValueTextState,className:`newValueBrowser-${this.props.themeType||`light`}`,key:`${e.v.toString()}states`},`(`,e.s,`)`)),!n){let t=e.c===void 0?e.v||``:e.c;o.push(R.createElement(hG,{className:`copyButton`,style:this.styles.iconCopy,onClick:e=>this.onCopy(e,t),key:`cc`}))}a=t.data.state}a.style=nK({state:i,isExpertMode:this.state.filter.expertMode,isButton:t.data.button,nonAckColor:this.props.theme.palette.nonAck});let o=a.valTextRx;return this.state.filter.expertMode||(t.data.button?o=[R.createElement(PG,{key:`button`,style:{color:a.style.color,...$.cellValueButton}})]:t.data.switch&&(o=[R.createElement(XE,{key:`switch`,sx:{"& .MuiSwitch-thumb":{color:a.style.color},"& .MuiSwitch-track":{backgroundColor:this.states[e].val&&this.state.selected.includes(e)?this.props.themeType===`dark`?`#FFF !important`:`#111 !important`:void 0}},checked:!!this.states[e].val})])),R.createElement(HE,{key:`value`,title:this.state.tooltipInfo?.el,slotProps:{popper:{sx:$.cellValueTooltipBox},tooltip:{sx:$.cellValueTooltip}},onOpen:()=>this.getTooltipInfo(e,()=>this.readHistory(e)),onClose:()=>this.state.tooltipInfo?.id===e&&this.setState({tooltipInfo:null})},R.createElement(_x,{component:`div`,style:a.style,className:t.data.url?`iob-link`:void 0,sx:{...$.cellValueText,height:n?void 0:32,"& .admin-button:active":{transform:`translate(0, 2px)`}}},o))}_syncEnum(e,t,n,r){if(!t?.length){r&&r();return}let i=t.pop()||``,a=[];if(this.info.objects[i]?.common){if(this.info.objects[i].common.members?.length){let t=this.info.objects[i].common.members.indexOf(e);if(t!==-1&&!n.includes(i)){let e=JSON.parse(JSON.stringify(this.info.objects[i]));e.common.members.splice(t,1),a.push(this.props.socket.setObject(i,e).then(()=>this.info.objects[i]=e).catch(e=>this.showError(e)))}}if(n.includes(i)&&!this.info.objects[i].common.members?.includes(e)){let t=JSON.parse(JSON.stringify(this.info.objects[i]));t.common.members||=[],t.common.members.push(e),t.common.members.sort(),a.push(this.props.socket.setObject(i,t).then(()=>this.info.objects[i]=t).catch(e=>this.showError(e)))}}Promise.all(a).then(()=>{setTimeout(()=>this._syncEnum(e,t,n,r),0)})}syncEnum(e,t,n){let r=[...this.info[t===`func`?`funcEnums`:`roomEnums`]];return new Promise(t=>{this._syncEnum(e,r,n,()=>{t()})})}renderEnumDialog(){if(!this.state.enumDialog)return null;let e=this.state.enumDialog.type,t=this.state.enumDialog.item,n=this.state.enumDialogEnums,r=this.state.enumDialog.enumsOriginal,i=(e===`room`?this.info.roomEnums:this.info.funcEnums).map(e=>({name:UG(this.objects[e]?.common?.name||e.split(`.`).pop()||``,this.props.lang),value:e,icon:WG(this.objects,e,this.props.lang,this.imagePrefix)})).sort((e,t)=>e.name>t.name?1:-1);return i.forEach(e=>{e.icon&&typeof e.icon==`string`&&(e.icon=R.createElement(_x,{style:$.enumIconDiv},R.createElement(`img`,{src:e.icon,style:$.enumIcon,alt:e.name})))}),R.createElement(rC,{sx:{"& .MuiPaper-root":$.enumDialog},onClose:()=>this.setState({enumDialog:null}),"aria-labelledby":`enum-dialog-title`,open:!0},R.createElement(bC,{id:`enum-dialog-title`,style:{display:`flex`,justifyContent:`space-between`,width:`100%`,flexWrap:`nowrap`,gap:8,paddingRight:12}},e===`func`?this.props.t(`ra_Define functions`):this.props.t(`ra_Define rooms`),R.createElement(EC,{color:`primary`,disabled:r===JSON.stringify(n),size:`small`,onClick:()=>this.syncEnum(t.data.id,e,n).then(()=>this.setState({enumDialog:null,enumDialogEnums:null}))},R.createElement(EO,null))),R.createElement(Iw,{sx:{"&.MuiList-root":$.enumList}},i.map(e=>{let t,r,i;typeof e==`object`?(t=e.value,r=e.name,i=e.icon):(t=e,r=e);let a=`checkbox-list-label-${t}`;return R.createElement(Qw,{sx:$.headerCellSelectItem,key:t,onClick:()=>{let e=n.indexOf(t),r=JSON.parse(JSON.stringify(this.state.enumDialogEnums));e===-1?(r.push(t),r.sort()):r.splice(e,1),this.setState({enumDialogEnums:r})},secondaryAction:i},R.createElement(rT,{sx:{"&.MuiListItemIcon-root":$.enumCheckbox}},R.createElement(dS,{edge:`start`,checked:n.includes(t),tabIndex:-1,disableRipple:!0,slotProps:{input:{"aria-labelledby":a}}})),R.createElement(cT,{id:a},r))})))}renderEditRoleDialog(){if(!this.state.roleDialog||!this.props.objectBrowserEditRole)return null;if(this.state.roleDialog&&this.props.objectBrowserEditRole){let e=this.props.objectBrowserEditRole;return R.createElement(e,{key:`objectBrowserEditRole`,id:this.state.roleDialog,socket:this.props.socket,t:this.props.t,roleArray:this.info.roles,commonType:this.info.objects[this.state.roleDialog]?.common?.type,onClose:e=>{e&&this.state.roleDialog&&(this.info.objects[this.state.roleDialog]=e),this.setState({roleDialog:null})}})}return null}onColumnsEditCustomDialogClose(e){let t=this.customColumnDialog;if(e){let e=t.value;t.type===`boolean`?e=e===`true`||e===!0:t.type===`number`&&(e=parseFloat(e)),this.customColumnDialog=null,this.props.socket.getObject(this.state.columnsEditCustomDialog?.obj?._id||``).then(t=>{if(t&&aK(t,this.state.columnsEditCustomDialog?.it,e))return this.props.socket.setObject(t._id,t);throw Error(this.props.t(`ra_Cannot update attribute, because not found in the object`))}).then(()=>this.setState({columnsEditCustomDialog:null})).catch(e=>this.showError(e))}else this.customColumnDialog=null,this.setState({columnsEditCustomDialog:null})}renderColumnsEditCustomDialog(){if(!this.state.columnsEditCustomDialog)return null;if(!this.customColumnDialog){let e=iK(this.state.columnsEditCustomDialog.obj,this.state.columnsEditCustomDialog.it);this.customColumnDialog={type:this.state.columnsEditCustomDialog.it.type||typeof e,initValue:(e??``).toString(),value:(e??``).toString()}}return R.createElement(rC,{onClose:()=>this.setState({columnsEditCustomDialog:null}),maxWidth:`md`,"aria-labelledby":`custom-dialog-title`,open:!0},R.createElement(bC,{id:`custom-dialog-title`},`${this.props.t(`ra_Edit object field`)}: ${this.state.columnsEditCustomDialog.obj._id}`),R.createElement(pC,null,R.createElement(_C,{id:`alert-dialog-description`},this.customColumnDialog.type===`boolean`?R.createElement(BC,{control:R.createElement(dS,{onKeyUp:e=>e.key===`Enter`&&this.onColumnsEditCustomDialogClose(!0),defaultChecked:this.customColumnDialog.value===`true`,onChange:e=>{let t=this.customColumnDialog;t.value=e.target.checked.toString();let n=t.value!==t.initValue;n===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:n})}}),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`}):R.createElement(mO,{variant:`standard`,defaultValue:this.customColumnDialog.value,fullWidth:!0,onKeyUp:e=>e.key===`Enter`&&this.onColumnsEditCustomDialogClose(!0),label:`${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`,onChange:e=>{let t=this.customColumnDialog;t.value=e.target.value;let n=t.value!==t.initValue;n===!this.state.customColumnDialogValueChanged&&this.setState({customColumnDialogValueChanged:n})},autoFocus:!0}))),R.createElement(sC,null,R.createElement(Vx,{variant:`contained`,onClick:()=>this.onColumnsEditCustomDialogClose(!0),disabled:!this.state.customColumnDialogValueChanged,color:`primary`,startIcon:R.createElement(EO,null)},this.props.t(`ra_Update`)),R.createElement(Vx,{color:`grey`,variant:`contained`,onClick:()=>this.onColumnsEditCustomDialogClose(),startIcon:R.createElement(DO,null)},this.props.t(`ra_Cancel`))))}renderCustomValue(e,t,n){let r=iK(e,t);return r==null?null:t.edit&&!this.props.notEditable&&(!t.objTypes||t.objTypes.includes(e.type))?R.createElement(_x,{component:`div`,style:{...$.columnCustom,...$.columnCustomEditable,...$[`columnCustom_${t.align}`]},onClick:()=>this.setState({columnsEditCustomDialog:{item:n,it:t,obj:e},customColumnDialogValueChanged:!1})},r):R.createElement(_x,{component:`div`,style:{...$.columnCustom,...$[`columnCustom_${t.align}`]}},r)}renderAliasLink(e,t,n){let r=t||0,i=this.objects[this.info.aliasesMap[e][r]].common.alias.id;return i?R.createElement(_x,{component:`div`,onClick:t=>{t.stopPropagation(),t.preventDefault();let n=this.info.aliasesMap[e][r];this.info.aliasesMap[e].length>1&&this.setState({aliasMenu:``}),this.onSelect(n),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(n)),100)},sx:n||this.styles.aliasAlone},R.createElement(`span`,{className:`admin-browser-arrow`},typeof i==`string`||i.read===e&&i.write===e?`↔`:i.read===e?`→`:`←`),this.info.aliasesMap[e][r]):null}renderLeaf(e,t,n){let r=e.data.id;n.count++,t=t===void 0?this.state.expanded.includes(r):t;let i,a=e.data.obj,o=a?.type;i=e.children||o===`folder`||o===`device`||o===`channel`||o===`meta`?t?R.createElement(XU,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):R.createElement(YU,{style:this.styles.cellIdIconFolder,onClick:()=>this.toggleExpanded(r)}):a&&a.common&&a.common.write===!1&&a.type===`state`?R.createElement(vG,{style:this.styles.cellIdIconDocument}):R.createElement(_G,{style:this.styles.cellIdIconDocument});let s=null;e.data.icon&&(s=typeof e.data.icon==`string`?e.data.icon.length<3?R.createElement(`span`,{className:`iconOwn`,style:$.cellIdIconOwn},e.data.icon):R.createElement(MW,{style:$.cellIdIconOwn,className:`iconOwn`,src:e.data.icon,alt:``}):e.data.icon);let c=a?.common,l=a?.type&&gK[a.type]||R.createElement(`div`,{className:`itemIcon`}),u=this.levelPadding*(e.data.level||0);if(e.data.lang!==this.props.lang){let{rooms:t,per:n}=QG(this.info,r,this.props.lang);e.data.rooms=t.join(`, `),e.data.per=n;let{funcs:i,pef:a}=eK(this.info,r,this.props.lang);e.data.funcs=i.join(`, `),e.data.pef=a,e.data.lang=this.props.lang}let d=this.props.multiSelect&&this.objects[r]&&(!this.props.types||this.props.types.includes(this.objects[r].type))?R.createElement(dS,{style:$.checkBox,checked:this.state.selected.includes(r)}):null,f=!this.props.notEditable&&o===`state`&&(this.state.filter.expertMode||c?.write!==!1);this.props.objectBrowserViewFile&&c?.type===`file`&&(f=!0);let p=!this.props.notEditable&&this.objects[r]&&(this.state.filter.expertMode||o===`state`||o===`channel`||o===`device`),m=this.state.statesView&&(o===`state`||o===`channel`||o===`device`),h=``,g=[];if(m&&(h=this.states[r]?.from,h===void 0?h=`&nbsp;`:(h=h?h.replace(/^system\.adapter\.|^system\./,``):``,g.push(`${this.texts.stateChangedFrom} ${h}`)),a?.user)){let e=a.user.replace(`system.user.`,``);h+=`/${e}`,g.push(`${this.texts.stateChangedBy} ${e}`)}a&&(a.from&&g.push(`${this.texts.objectChangedFrom} ${a.from.replace(/^system\.adapter\.|^system\./,``)}`),a.user&&g.push(`${this.texts.objectChangedBy} ${a.user.replace(/^system\.user\./,``)}`),a.ts&&g.push(`${this.texts.objectChangedByUser} ${X.formatDate(new Date(a.ts),this.props.dateFormat||this.systemConfig?.common.dateFormat||hK)}`));let _=!1,v=null;r.startsWith(`alias.`)&&c?.alias?.id?(_=typeof c.alias.id==`object`,v=_?R.createElement(`div`,{style:$.cellIdAliasReadWriteDiv},c.alias.id.read?R.createElement(_x,{component:`div`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.onSelect(c.alias.id.read),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(c.alias.id.read)),100)},sx:this.styles.aliasReadWrite},`←`,c.alias.id.read):null,c.alias.id.write?R.createElement(_x,{component:`div`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.onSelect(c.alias.id.write),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(c.alias.id.write)),100)},sx:this.styles.aliasReadWrite},`→`,c.alias.id.write):null):R.createElement(_x,{component:`div`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.onSelect(c.alias.id),setTimeout(()=>this.expandAllSelected(()=>this.scrollToItem(c.alias.id)),100)},sx:this.styles.aliasAlone},`→`,c.alias.id)):this.info.aliasesMap[r]&&(v=this.info.aliasesMap[r].length>1?R.createElement(_x,{component:`div`,id:`alias_${r}`,onClick:e=>{e.stopPropagation(),e.preventDefault(),this.setState({aliasMenu:r})},sx:this.styles.aliasAlone},this.props.t(`ra_%s links from aliases`,this.info.aliasesMap[r].length)):this.renderAliasLink(r,0));let y=c?.color,b;if(y&&!this.state.selected.includes(r)){let e=this.props.themeName===`dark`?`#1f1f1f`:this.props.themeName===`blue`?`#222a2e`:`#FFFFFF`;X.colorDistance(y,e)<1e3&&(b=this.props.themeType===`dark`?`#9a9a9a`:`#565656`)}let x=!1;r===`0_userdata`?(y=DG(this.props.themeType),x=!0,b=!1):r===`alias`?(y=OG(this.props.themeType),x=!0,b=!1):r===`javascript`?(y=kG(this.props.themeType),x=!0,b=!1):r===`system`?(y=AG(this.props.themeType),x=!0,b=!1):r===`system.adapter`?(y=jG(this.props.themeType),b=!1):(!y||this.state.selected.includes(r))&&(y=`inherit`,b=!1);let S=[];if(c?.statusStates){let e={};Object.keys(c.statusStates).forEach(t=>{let n=c.statusStates[t];n.split(`.`).length<3&&(n=`${r}.${n}`),e[t]=n,this.states[n]?this.recordStates.includes(n)||this.recordStates.push(n):this.objects[n]?.type===`state`&&(this.recordStates.includes(n)||this.recordStates.push(n),this.states[n]={val:null},this.subscribe(n))});let t=!1;c.statusStates.errorId&&this.states[e.errorId]&&this.states[e.errorId].val&&(y=this.props.themeType===`dark`?lK:uK,b=!1,t=!0,S.push(R.createElement(RO,{key:`error`,style:this.styles.iconDeviceError}))),e.onlineId&&this.states[e.onlineId]?t?this.states[e.onlineId].val?S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected})):S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected})):this.states[e.onlineId].val?(y=this.props.themeType===`dark`?dK:fK,b=!1,S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected}))):(y=this.props.themeType===`dark`?pK:mK,b=!1,S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected}))):e.offlineId&&this.states[e.offlineId]&&(t?this.states[e.offlineId].val?S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected})):S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected})):this.states[e.offlineId].val?(y=this.props.themeType===`dark`?pK:mK,b=!1,S.push(R.createElement(yk,{key:`disc`,style:this.styles.iconDeviceDisconnected}))):(y=this.props.themeType===`dark`?dK:fK,b=!1,S.push(R.createElement(vk,{key:`conn`,style:this.styles.iconDeviceConnected}))))}let C=m?X.quality2text(this.states[r]?.q||0).join(`, `):null,w=e.data?.title||``,T=!1;if(this.state.showDescription){let t=JG(e.data,this.props.lang);t&&(w=[R.createElement(`div`,{key:`name`,style:$.cellNameDivDiv},w),R.createElement(`div`,{key:`desc`,style:$.cellDescription},t)],T=!!t)}let E=this.props.width===`xs`&&this.state.focused===r,D=R.createElement(rw,{container:!0,wrap:`nowrap`,direction:`row`,sx:$.cellId,style:{width:this.columnsVisibility.id,paddingLeft:u}},R.createElement(rw,{container:!0,alignItems:`center`},d,i),R.createElement(rw,{style:{...$.cellIdSpan,...b?this.styles.invertedBackground:void 0,color:y,fontWeight:x?`bold`:void 0}},R.createElement(HE,{title:YG(e.data,this.props.lang),slotProps:{popper:{sx:$.tooltip}}},R.createElement(`div`,null,e.data.name)),v,S),R.createElement(`div`,{style:{...$.grow,...b?this.styles.invertedBackgroundFlex:{}}}),R.createElement(rw,{container:!0,alignItems:`center`},s),this.props.width===`xs`?null:R.createElement(`div`,null,R.createElement(hG,{className:E?``:`copyButton`,style:$.cellCopyButton,onClick:e=>this.onCopy(e,r)}))),O=E&&w||this.columnsVisibility.name?R.createElement(_x,{component:`div`,sx:{...$.cellName,...T?$.cellNameWithDesc:void 0,width:this.props.width===`xs`?void 0:this.columnsVisibility.name,ml:E?0:`5px`}},w,!E&&e.data?.title?R.createElement(_x,{style:{color:y}},R.createElement(hG,{className:`copyButton`,style:$.cellCopyButton,onClick:t=>this.onCopy(t,e.data?.title)})):null):null,k;k=this.state.statesView?[E&&m&&this.states[r]?.from||this.columnsVisibility.changedFrom?{el:R.createElement(`div`,{key:`from`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.changedFrom},title:g.join(`
650
+ `)},m&&this.states[r]?.from?h:null),type:`from`}:null,E&&C||this.columnsVisibility.qualityCode?{el:R.createElement(`div`,{key:`q`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.qualityCode},title:C||``},C),type:`quality`}:null,E&&m&&this.states[r]?.ts||this.columnsVisibility.timestamp?{el:R.createElement(`div`,{key:`ts`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.timestamp}},m&&this.states[r]?.ts?X.formatDate(new Date(this.states[r].ts),this.props.dateFormat||this.systemConfig?.common.dateFormat||hK):null),type:`ts`}:null,E&&m&&this.states[r]?.lc||this.columnsVisibility.lastChange?{el:R.createElement(`div`,{key:`lc`,style:{...$.cellRole,width:this.props.width===`xs`?void 0:this.columnsVisibility.lastChange}},m&&this.states[r]?.lc?X.formatDate(new Date(this.states[r].lc),this.props.dateFormat||this.systemConfig?.common.dateFormat||hK):null),type:`lc`}:null]:[E&&a?.type||this.columnsVisibility.type?{el:R.createElement(`div`,{key:`type`,style:{...$.cellType,width:this.props.width===`xs`?void 0:this.columnsVisibility.type}},l,`\xA0`,a?.type),type:`filter_type`}:null,E&&c||this.columnsVisibility.role?{el:R.createElement(`div`,{key:`role`,style:{...$.cellRole,width:this.props.width===`xs`?`100%`:this.columnsVisibility.role,cursor:this.state.filter.expertMode&&p&&this.props.objectBrowserEditRole?`text`:`default`},onClick:!E&&this.state.filter.expertMode&&p&&this.props.objectBrowserEditRole?()=>this.setState({roleDialog:e.data.id}):void 0},c?.role),type:`filter_role`,onClick:E&&this.state.filter.expertMode&&p&&this.props.objectBrowserEditRole?()=>this.setState({roleDialog:e.data.id}):void 0}:null,E&&c||this.columnsVisibility.room?{el:R.createElement(`div`,{key:`room`,style:{...$.cellRoom,...e.data.per?$.cellEnumParent:{},width:this.props.width===`xs`?`100%`:this.columnsVisibility.room,cursor:p?`text`:`default`},onClick:!E&&p?()=>{let t=$G(this.info,e.data.id,`roomEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`room`,enumsOriginal:JSON.stringify(t)}})}:void 0},e.data.rooms),type:`filter_room`,onClick:E&&p?()=>{let t=$G(this.info,e.data.id,`roomEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`room`,enumsOriginal:JSON.stringify(t)}})}:void 0}:null,E&&c||this.columnsVisibility.func?{el:R.createElement(`div`,{key:`func`,style:{...$.cellFunc,...e.data.pef?$.cellEnumParent:{},width:this.props.width===`xs`?`100%`:this.columnsVisibility.func,cursor:p?`text`:`default`},onClick:!E&&p?()=>{let t=$G(this.info,e.data.id,`funcEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`func`,enumsOriginal:JSON.stringify(t)}})}:void 0},e.data.funcs),type:`filter_func`,onClick:E&&p?()=>{let t=$G(this.info,e.data.id,`funcEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`func`,enumsOriginal:JSON.stringify(t)}})}:void 0}:null];let A=this.adapterColumns?.map(t=>R.createElement(`div`,{style:{...$.cellAdapter,width:this.props.width===`xs`?void 0:this.columnsVisibility[t.id]},key:t.id,title:`${t.adapter} => ${t.pathText}`},a?this.renderCustomValue(a,t,e):null))||null,j=E||this.columnsVisibility.val?this.renderColumnValue(r,e,E):null,M=E&&j||this.columnsVisibility.val?R.createElement(`div`,{style:{...$.cellValue,width:this.props.width===`xs`?`calc(100% - 100px)`:this.columnsVisibility.val,cursor:f?c?.type===`file`?`zoom-in`:e.data.button?`grab`:`text`:`default`},onClick:t=>{f?!a||!this.states||(c?.type===`file`?this.setState({viewFileDialog:r}):e.data.url&&t.ctrlKey?this.states[r]?.val&&typeof this.states[r].val==`string`&&(c?.role===`url.self`?window.location.href=this.states[r].val:window.open(this.states[r].val,`_blank`)?.focus()):!this.state.filter.expertMode&&e.data.button?this.props.socket.setState(r,!0).catch(e=>window.alert(`Cannot write state "${r}": ${e}`)):!this.state.filter.expertMode&&e.data.switch?this.props.socket.setState(r,!this.states[r].val).catch(e=>window.alert(`Cannot write state "${r}": ${e}`)):(this.edit={val:this.states[r]?this.states[r].val:``,q:this.states[r]&&this.states[r].q||0,ack:!1,id:r},this.setState({updateOpened:!0}))):c?.role===`url`||c?.role===`url.blank`&&t.ctrlKey?this.states[r]?.val&&typeof this.states[r].val==`string`&&window.open(this.states[r].val,`_blank`):c?.role===`url.self`&&t.ctrlKey&&this.states[r]?.val&&typeof this.states[r].val==`string`&&(window.location.href=this.states[r].val)}},j):null,N=E||this.columnsVisibility.buttons?R.createElement(`div`,{style:{...$.cellButtons,width:this.props.width===`xs`?void 0:this.columnsVisibility.buttons}},this.renderColumnButtons(r,e)):null,P=null;if(this.props.width===`xs`&&this.state.focused===r){k=k.filter(e=>e);let t;t=k.length?k.map(e=>e?R.createElement(`div`,{key:e.type,style:$.cellDetailsLine},R.createElement(`span`,{style:$.cellDetailsName},this.texts[e.type],`:`),e.el,R.createElement(`div`,{style:{flexGrow:1}}),e.onClick?R.createElement(LO,{style:$.cellCopyButtonInDetails,onClick:()=>{e?.onClick&&e.onClick()}}):null):null):null,A.length||(A=null),P=R.createElement(T_,{style:{width:`100%`,display:`flex`,flexDirection:`column`,padding:10,backgroundColor:this.props.theme.palette.mode===`dark`?`#333`:`#ccc`}},R.createElement(`div`,{style:$.cellDetailsLine},R.createElement(`div`,{style:{flexGrow:1}}),R.createElement(hG,{style:$.cellCopyButtonInDetails,onClick:e=>this.onCopy(e,r)})),O&&R.createElement(`div`,{style:$.cellDetailsLine},R.createElement(`span`,{style:$.cellDetailsName},this.texts.name,`:`),O,R.createElement(`div`,{style:{flexGrow:1}}),e.data?.title?R.createElement(hG,{className:`copyButton`,style:$.cellCopyButtonInDetails,onClick:t=>this.onCopy(t,e.data?.title)}):null),t,A&&R.createElement(`div`,{style:$.cellDetailsLine},A),this.objects[r]?.type===`state`&&R.createElement(`div`,{style:$.cellDetailsLine},R.createElement(`span`,{style:$.cellDetailsName},this.texts.value,`:`),M,R.createElement(`div`,{style:{flexGrow:1}}),R.createElement(hG,{className:`copyButton`,style:$.cellCopyButtonInDetails,onClick:e=>{let{valText:t}=tK({state:this.states[r],obj:this.objects[r],texts:this.texts,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma});this.onCopy(e,t.c===void 0?t.v.toString():t.c)},key:`cc`})),N&&R.createElement(`div`,{style:{...$.cellDetailsLine,justifyContent:`right`}},N)),O=null,k=null,A=null,M=null,N=null}return{row:R.createElement(rw,{container:!0,direction:`row`,wrap:`nowrap`,sx:X.getStyle(this.props.theme,$.tableRow,this.state.linesEnabled&&$.tableRowLines,!this.props.dragEnabled&&$.tableRowNoDragging,v&&$.tableRowAlias,_&&$.tableRowAliasReadWrite,this.state.focused===r&&this.props.multiSelect&&$.tableRowFocused,!e.data.visible&&$.filteredOut,e.data.hasVisibleParent&&!e.data.visible&&!e.data.hasVisibleChildren&&$.filteredParentOut,this.state.selected.includes(r)&&$.itemSelected,this.state.selectedNonObject===r&&$.itemSelected),key:r,id:r,onMouseDown:t=>{this.onSelect(r);let n;`which`in t?n=t.which===3:`button`in t&&(n=t.button===2),n?this.contextMenu={item:e,ts:Date.now()}:this.contextMenu=null},onDoubleClick:()=>{e.children?this.toggleExpanded(r):this.onSelect(r,!0)}},D,O,k?.map(e=>e?.el),A,M,N),details:P}}renderItem(e,t,n){let r=[];n||={count:0};let i=this.renderLeaf(e,t,n),a,o=this.props.DragWrapper;return a=this.props.dragEnabled&&o?e.data.sumVisibility?R.createElement(o,{key:e.data.id,item:e,style:$.draggable},i.row):R.createElement(`div`,{key:e.data.id,style:$.nonDraggable},i.row):i.row,e.data.id&&a&&r.push(a),i.details&&r.push(i.details),t=t===void 0?HG(this.state.expanded,e.data.id):t,(!e.data.id||t)&&(this.state.foldersFirst?e.children&&(r.push(e.children.map(e=>e.children&&(!this.state.columnsSelectorShow||n.count<15)&&e.data.sumVisibility?this.renderItem(e,void 0,n):null)),r.push(e.children.map(e=>!e.children&&(!this.state.columnsSelectorShow||n.count<15)&&e.data.sumVisibility?this.renderItem(e,void 0,n):null))):e.children&&r.push(e.children.map(e=>(!this.state.columnsSelectorShow||n.count<15)&&e.data.sumVisibility?this.renderItem(e,void 0,n):null))),r}calculateColumnsVisibility(e,t,n,r){let i=r||this.state.columnsWidths,a=n||this.state.columnsForAdmin,o=t||this.state.columns||[],s=typeof e==`boolean`?e:this.state.columnsAuto;i=JSON.parse(JSON.stringify(i)),Object.keys(i).forEach(e=>{i[e]&&(i[e]=parseInt(i[e],10)||0)}),this.adapterColumns=[];let c=_K[this.props.width||`lg`].widths;if(s){if(this.columnsVisibility={id:_K[this.props.width||`lg`].idWidth,name:this.visibleCols.includes(`name`)&&c.name||0,nameHeader:this.visibleCols.includes(`name`)&&c.name||0,type:this.visibleCols.includes(`type`)&&c.type||0,role:this.visibleCols.includes(`role`)&&c.role||0,room:this.visibleCols.includes(`room`)&&c.room||0,func:this.visibleCols.includes(`func`)&&c.func||0,changedFrom:this.visibleCols.includes(`changedFrom`)&&c.changedFrom||0,qualityCode:this.visibleCols.includes(`qualityCode`)&&c.qualityCode||0,timestamp:this.visibleCols.includes(`timestamp`)&&c.timestamp||0,lastChange:this.visibleCols.includes(`lastChange`)&&c.lastChange||0,val:this.visibleCols.includes(`val`)&&c.val||0,buttons:this.visibleCols.includes(`buttons`)&&c.buttons||0},this.columnsVisibility.name&&!this.customWidth){let e=this.columnsVisibility.id||0;this.state.statesView?(e+=this.columnsVisibility.changedFrom||0,e+=this.columnsVisibility.qualityCode||0,e+=this.columnsVisibility.timestamp||0,e+=this.columnsVisibility.lastChange||0):(e+=this.columnsVisibility.type||0,e+=this.columnsVisibility.role||0,e+=this.columnsVisibility.room||0,e+=this.columnsVisibility.func||0),e+=this.columnsVisibility.val||0,e+=this.columnsVisibility.buttons||0,this.columnsVisibility.name=`calc(100% - ${e+5}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${e+5+this.state.scrollBarWidth}px)`}else if(!this.customWidth){let e=0;this.state.statesView?(e+=this.columnsVisibility.changedFrom||0,e+=this.columnsVisibility.qualityCode||0,e+=this.columnsVisibility.timestamp||0,e+=this.columnsVisibility.lastChange||0):(e+=this.columnsVisibility.type||0,e+=this.columnsVisibility.role||0,e+=this.columnsVisibility.room||0,e+=this.columnsVisibility.func||0),e+=this.columnsVisibility.val||0,e+=this.columnsVisibility.buttons||0,this.columnsVisibility.id=`calc(100% - ${e+5}px)`}}else{let e=this.props.width||`lg`;this.columnsVisibility={id:i.id||_K[e].idWidth,name:o.includes(`name`)&&(i.name||c.name||_K[e].widths.name)||0,type:o.includes(`type`)&&(i.type||c.type||_K[e].widths.type)||0,role:o.includes(`role`)&&(i.role||c.role||_K[e].widths.role)||0,room:o.includes(`room`)&&(i.room||c.room||_K[e].widths.room)||0,func:o.includes(`func`)&&(i.func||c.func||_K[e].widths.func)||0};let t=this.columnsVisibility.id;if(this.columnsVisibility.name&&(t+=this.columnsVisibility.type||0,t+=this.columnsVisibility.role||0,t+=this.columnsVisibility.room||0,t+=this.columnsVisibility.func||0),a&&o&&Object.keys(a).sort().forEach(n=>a[n].forEach(r=>{let a=`_${n}_${r.path}`;if(o.includes(a)){let o={adapter:n,id:`_${n}_${r.path}`,name:r.name,path:r.path.split(`.`),pathText:r.path};r.edit&&(o.edit=!0,r.type&&(o.type=r.type),r.objTypes&&(o.objTypes=r.objTypes)),this.adapterColumns.push(o),this.columnsVisibility[a]=i[o.id]||r.width||_K[e].widths.func||_K.xl.widths.func||0,t+=this.columnsVisibility[a]}else this.columnsVisibility[a]=0})),this.adapterColumns.sort((e,t)=>e.id>t.id?-1:+(e.id<t.id)),this.columnsVisibility.val=o.includes(`val`)?i.val||c.val||_K.xl.widths.val:0,(!this.props.columns||this.props.columns.includes(`buttons`))&&(this.columnsVisibility.buttons=o.includes(`buttons`)?i.buttons||c.buttons||_K.xl.widths.buttons:0,t+=this.columnsVisibility.buttons||0),this.columnsVisibility.name&&!i.name)t+=this.columnsVisibility.val||0,this.columnsVisibility.name=`calc(100% - ${t}px)`,this.columnsVisibility.nameHeader=`calc(100% - ${t+5+this.state.scrollBarWidth}px)`;else{let e=Object.keys(this.columnsVisibility).reduce((e,t)=>t===`id`||typeof this.columnsVisibility[t]==`string`||!this.columnsVisibility[t]?e:e+this.columnsVisibility[t],0);this.columnsVisibility.id=`calc(100% - ${e}px)`}}}resizerMouseMove=e=>{if(this.resizerActiveDiv){let t,n;this.resizeLeft?(t=this.resizerOldWidth-e.clientX+this.resizerPosition,n=this.resizerOldWidthNext+e.clientX-this.resizerPosition):(t=this.resizerOldWidth+e.clientX-this.resizerPosition,n=this.resizerOldWidthNext-e.clientX+this.resizerPosition),this.resizerActiveName&&this.resizerNextName&&(!this.resizerMin||t>this.resizerMin)&&(!this.resizerNextMin||n>this.resizerNextMin)&&(this.resizerCurrentWidths[this.resizerActiveName]=t,this.resizerCurrentWidths[this.resizerNextName]=n,this.resizerActiveDiv.style.width=`${t}px`,this.resizerNextDiv&&(this.resizerNextDiv.style.width=`${n}px`),this.columnsVisibility[this.resizerActiveName]=t,this.columnsVisibility[this.resizerNextName]=n,this.resizerNextName===`nameHeader`?(this.columnsVisibility.name=n-this.state.scrollBarWidth,this.resizerCurrentWidths.name=n-this.state.scrollBarWidth):this.resizerActiveName===`nameHeader`&&(this.columnsVisibility.name=t-this.state.scrollBarWidth,this.resizerCurrentWidths.name=t-this.state.scrollBarWidth),this.customWidth=!0,this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=null,this.forceUpdate()},200))}};resizerMouseUp=()=>{this.localStorage.setItem(`${this.props.dialogName||`App`}.table`,JSON.stringify(this.resizerCurrentWidths)),this.resizerActiveName=null,this.resizerNextName=null,this.resizerActiveDiv=null,this.resizerNextDiv=null,window.removeEventListener(`mousemove`,this.resizerMouseMove),window.removeEventListener(`mouseup`,this.resizerMouseUp)};resizerMouseDown=e=>{if(this.storedWidths||=JSON.parse(JSON.stringify(_K[this.props.width||`lg`])),this.resizerCurrentWidths||={},this.resizerActiveDiv=e.target.parentNode,this.resizerActiveName=this.resizerActiveDiv.dataset.name||null,this.resizerActiveName){let t=0;if(e.target.dataset.left===`true`){this.resizeLeft=!0,this.resizerNextDiv=this.resizerActiveDiv.previousElementSibling;let e=this.resizerNextDiv.querySelector(`.iob-ob-resize-handler`);for(;this.resizerNextDiv&&!e&&t<10;)this.resizerNextDiv=this.resizerNextDiv.previousElementSibling,e=this.resizerNextDiv.querySelector(`.iob-ob-resize-handler`),t++;e?.dataset.left!==`true`&&(this.resizerNextDiv=this.resizerNextDiv.nextElementSibling)}else this.resizeLeft=!1,this.resizerNextDiv=this.resizerActiveDiv.nextElementSibling;this.resizerNextName=this.resizerNextDiv.dataset.name||null,this.resizerMin=parseInt(this.resizerActiveDiv.dataset.min,10)||0,this.resizerNextMin=parseInt(this.resizerNextDiv.dataset.min,10)||0,this.resizerPosition=e.clientX,this.resizerCurrentWidths[this.resizerActiveName]=this.resizerActiveDiv.offsetWidth,this.resizerOldWidth=this.resizerCurrentWidths[this.resizerActiveName],this.resizerNextName&&(this.resizerCurrentWidths[this.resizerNextName]=this.resizerNextDiv.offsetWidth,this.resizerOldWidthNext=this.resizerCurrentWidths[this.resizerNextName]),window.addEventListener(`mousemove`,this.resizerMouseMove),window.addEventListener(`mouseup`,this.resizerMouseUp)}};navigateKeyPress(t){let n=this.state.selectedNonObject||this.state.selected[0];if(n){if(t.code===`ArrowUp`||t.code===`ArrowDown`){t.preventDefault();let e=[];this.tableRef.current?.childNodes.forEach(t=>e.push(t.id));let r=e.indexOf(n),i=e[t.code===`ArrowDown`?r+1:r-1]||n;this.onSelect(i),this.scrollToItem(i)}if((t.code===`ArrowRight`||t.code===`ArrowLeft`)&&this.toggleExpanded(n),t.code===`Delete`&&this.root&&n){let t=e.getItemFromRoot(this.root,n);if(t){let{obj:e}=t.data;e&&!e.common?.dontDelete&&this.showDeleteDialog({id:n,obj:e,item:t})}}}}static getItemFromRoot(e,t){let n=t.split(`.`),r=``,i=e;for(let e=0;e<n.length;e++){let t=n[e];r=r?`${r}.${t}`:t;let a=!1;if(i.children){for(let e=0;e<i.children.length;e++)if(i.children[e].data.id===r){i=i.children[e],a=!0;break}}if(!a)return null}return i||null}resizerReset=()=>{this.customWidth=!1,_K[this.props.width||`lg`]=JSON.parse(JSON.stringify(this.storedWidths)),this.calculateColumnsVisibility(),this.localStorage.removeItem(`${this.props.dialogName||`App`}.table`),this.forceUpdate()};renderHandleRight(){return R.createElement(_x,{component:`div`,className:`iob-ob-resize-handler`,sx:{...$.resizeHandle,...$.resizeHandleRight},onMouseDown:this.resizerMouseDown,onDoubleClick:this.resizerReset,title:this.props.t(`ra_Double click to reset table layout`)})}renderHeader(){let e=null;return!this.columnsVisibility.buttons&&!this.isFilterEmpty()&&(e=R.createElement(uv,{onClick:()=>this.clearFilter(),style:$.buttonClearFilter,title:this.props.t(`ra_Clear filter`),size:`large`},R.createElement(xG,null),R.createElement(DO,{style:$.buttonClearFilterIcon}))),this.props.width===`xs`?R.createElement(`div`,{style:$.headerRow},R.createElement(`div`,{style:{...$.headerCell,width:`100%`}},this.getFilterInput(`id`))):R.createElement(`div`,{style:$.headerRow},R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.id,position:`relative`},"data-min":240,"data-name":`id`},this.getFilterInput(`id`),this.renderHandleRight()),this.columnsVisibility.name?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.nameHeader,position:`relative`},"data-min":100,"data-name":`nameHeader`},this.getFilterInput(`name`),this.renderHandleRight()):null,!this.state.statesView&&R.createElement(R.Fragment,null,this.columnsVisibility.type?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.type,position:`relative`},"data-min":100,"data-name":`type`},this.getFilterSelectType(),this.renderHandleRight()):null,this.columnsVisibility.role?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.role,position:`relative`},"data-min":100,"data-name":`role`},this.getFilterSelectRole(),this.renderHandleRight()):null,this.columnsVisibility.room?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.room,position:`relative`},"data-min":100,"data-name":`room`},this.getFilterSelectRoom(),this.renderHandleRight()):null,this.columnsVisibility.func?R.createElement(`div`,{style:{...$.headerCell,width:this.columnsVisibility.func,position:`relative`},"data-min":100,"data-name":`func`},this.getFilterSelectFunction(),this.renderHandleRight()):null),this.state.statesView&&R.createElement(R.Fragment,null,R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.changedFrom,position:`relative`},"data-min":100,"data-name":`changedFrom`},this.props.t(`ra_Changed from`),this.renderHandleRight()),R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.qualityCode,position:`relative`},"data-min":100,"data-name":`qualityCode`},this.props.t(`ra_Quality code`),this.renderHandleRight()),R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.timestamp,position:`relative`},"data-min":100,"data-name":`timestamp`},this.props.t(`ra_Timestamp`),this.renderHandleRight()),R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.lastChange,position:`relative`},"data-min":100,"data-name":`lastChange`},this.props.t(`ra_Last change`),this.renderHandleRight())),this.adapterColumns.map(e=>R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility[e.id]},title:e.adapter,key:e.id,"data-min":100,"data-name":e.id},e.name)),this.columnsVisibility.val?R.createElement(`div`,{style:{...$.headerCell,...$.headerCellValue,width:this.columnsVisibility.val,position:`relative`},"data-min":120,"data-name":`val`},this.props.t(`ra_Value`),e):null,this.columnsVisibility.buttons?R.createElement(`div`,{title:this.texts.filter_custom,style:{...$.headerCell,width:this.columnsVisibility.buttons}},` `,this.getFilterSelectCustoms()):null)}renderToast(){return R.createElement(AE,{open:!!this.state.toast,autoHideDuration:3e3,onClick:()=>this.setState({toast:``}),onClose:()=>this.setState({toast:``}),message:this.state.toast,action:R.createElement(uv,{size:`small`,"aria-label":`close`,color:`inherit`,onClick:()=>this.setState({toast:``})},R.createElement(DO,{fontSize:`small`}))})}getStateNav(){return this.state.editObjectDialog?{mode:`edit`,id:this.state.editObjectDialog}:this.state.customDialog&&this.state.customDialog.length===1&&!this.state.customDialogAll?{mode:`settings`,id:this.state.customDialog[0]}:this.state.viewFileDialog?{mode:`viewFile`,id:this.state.viewFileDialog}:this.state.selected.length===1&&this.state.selected[0]?{mode:`select`,id:this.state.selected[0]}:null}static navEqual(e,t){return!e||!t?!e&&!t:e.mode===t.mode&&e.id===t.id}applyNavigateTo(e){this.applyingNav=!0;let t=()=>{this.applyingNav=!1};if(!e?.id){this.setState({editObjectDialog:``,customDialog:null,viewFileDialog:``},t);return}let{id:n}=e,r=()=>{e.mode===`edit`?this.setState({editObjectDialog:n,editObjectAlias:!1,customDialog:null,viewFileDialog:``},t):e.mode===`settings`?this.setState({customDialog:[n],customDialogAll:!1,editObjectDialog:``,viewFileDialog:``},t):e.mode===`viewFile`?this.setState({viewFileDialog:n,editObjectDialog:``,customDialog:null},t):this.setState({editObjectDialog:``,customDialog:null,viewFileDialog:``},t)};this.state.selected.length===1&&this.state.selected[0]===n?r():this.onSelect(n,!1,()=>this.expandAllSelected(()=>{this.scrollToItem(n),r()}))}applyInitialNavigateTo(){let e=this.props.navigateTo??null;e?.id?(this.lastNav=e,this.applyNavigateTo(e)):this.lastNav=this.getStateNav()}reconcileNavigation(t){if(this.props.navigateTo===void 0&&!this.props.onNavigateTo||this.applyingNav)return;let n=this.props.navigateTo??null,r=this.getStateNav();if(e.navEqual(n,r)){this.lastNav=r;return}e.navEqual(n,t.navigateTo??null)?e.navEqual(r,this.lastNav)||(this.lastNav=r,this.props.onNavigateTo?.(r)):(this.lastNav=n,this.applyNavigateTo(n))}componentDidUpdate(e){if(this.tableRef.current){let e=this.tableRef.current.offsetWidth-this.tableRef.current.clientWidth;this.state.scrollBarWidth===e?this.selectFirst&&this.scrollToItem(this.selectFirst):setTimeout(()=>this.setState({scrollBarWidth:e}),100)}this.reconcileNavigation(e)}scrollToItem(e){this.selectFirst=``,window.document.getElementById(e)?.scrollIntoView({behavior:`auto`,block:`center`,inline:`center`})}renderCustomDialog(){if(this.state.customDialog&&this.props.objectCustomDialog&&this.systemConfig){let e=this.props.objectCustomDialog;return R.createElement(e,{reportChangedIds:e=>this.changedIds=[...e],objectIDs:this.state.customDialog,allVisibleObjects:!!this.state.customDialogAll,expertMode:this.state.filter.expertMode,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,t:this.props.t,lang:this.props.lang,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,theme:this.props.theme,objects:this.objects,customsInstances:this.info.customs,onClose:()=>{this.pauseSubscribe(!1),this.setState({customDialog:null}),this.changedIds&&(this.changedIds=null,this.forceUpdate()),this.props.router?.doNavigate(`tab-objects`)},systemConfig:this.systemConfig})}return null}onUpdate(e){this.props.socket.setState(this.edit.id,{val:e.val,ack:e.ack,q:e.q||0,expire:e.expire||void 0}).catch(e=>this.showError(`Cannot write value: ${e}`))}renderEditObjectDialog(){if(!this.state.editObjectDialog||!this.props.objectBrowserEditObject||!this.objects[this.state.editObjectDialog])return null;let e=this.props.objectBrowserEditObject;return R.createElement(e,{key:this.state.editObjectDialog,obj:this.objects[this.state.editObjectDialog],roleArray:this.info.roles,objects:this.objects,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,themeType:this.props.themeType,theme:this.props.theme,socket:this.props.socket,dialogName:this.props.dialogName,aliasTab:this.state.editObjectAlias,t:this.props.t,expertMode:!!this.state.filter.expertMode,onNewObject:e=>this.props.socket.setObject(e._id,e).then(()=>this.setState({editObjectDialog:e._id,editObjectAlias:!1},()=>this.onSelect(e._id))).catch(e=>this.showError(`Cannot write object: ${e}`)),onClose:e=>{if(e){let t;this.state.editObjectDialog.startsWith(`alias.`)&&JSON.stringify(this.objects[this.state.editObjectDialog].common?.alias)!==JSON.stringify(e.common?.alias)&&(t=this.state.editObjectDialog),this.props.socket.setObject(e._id,e).then(()=>{t&&this.subscribes.includes(t)&&(this.unsubscribe(t),setTimeout(()=>this.subscribe(t),100))}).catch(e=>this.showError(`Cannot write object: ${e}`))}this.setState({editObjectDialog:``,editObjectAlias:!1})},width:this.props.width})}renderViewObjectFileDialog(){if(!this.state.viewFileDialog||!this.props.objectBrowserViewFile)return null;let e=this.props.objectBrowserViewFile;return R.createElement(e,{key:`viewFile`,obj:this.objects[this.state.viewFileDialog],socket:this.props.socket,t:this.props.t,onClose:()=>this.setState({viewFileDialog:``})})}renderAliasEditorDialog(){if(!this.props.objectBrowserAliasEditor||!this.state.showAliasEditor)return null;let e=this.props.objectBrowserAliasEditor;return R.createElement(e,{key:`editAlias`,obj:this.objects[this.state.showAliasEditor],roleArray:this.info.roles,objects:this.objects,socket:this.props.socket,t:this.props.t,onClose:()=>this.setState({showAliasEditor:``}),onRedirect:(e,t)=>setTimeout(()=>this.onSelect(e,!1,()=>this.expandAllSelected(()=>{this.scrollToItem(e),setTimeout(()=>this.setState({editObjectDialog:e,showAliasEditor:``,editObjectAlias:!0}),300)})),t||0)})}showAddDataPointDialog(e,t,n){this.setState({showContextMenu:null,modalNewObj:{id:e,initialType:t,initialStateType:n}})}renderAliasMenu(){return this.state.aliasMenu?R.createElement(jT,{key:`aliasmenu`,open:!0,anchorEl:window.document.getElementById(`alias_${this.state.aliasMenu}`),onClose:()=>this.setState({aliasMenu:``})},this.info.aliasesMap[this.state.aliasMenu].map((e,t)=>R.createElement(LT,{key:e,onClick:()=>this.onSelect(e)},R.createElement(cT,null,this.renderAliasLink(this.state.aliasMenu,t,{"& .admin-browser-arrow":{mr:`8px`}}))))):null}renderContextMenu(){if(!this.state.showContextMenu)return null;let e=this.state.showContextMenu.item,t=e.data.id,n=[],r=e.data.obj,i=``;if(this.props.objectEditOfAccessControl&&this.state.filter.expertMode)if(!r)i=`---`;else{let e=r.acl?r.type===`state`?r.acl.state:r.acl.object:0,t=r.acl&&(r.type===`state`?this.systemConfig?.common.defaultNewAcl.state:this.systemConfig?.common.defaultNewAcl.object);i=Number.isNaN(Number(e))?Number(t).toString(16):Number(e).toString(16)}let a=!this.props.notEditable&&r&&(this.state.filter.expertMode||r.type===`state`||r.type===`channel`||r.type===`device`),o=!e.data.obj||e.data.obj.type===`folder`||e.data.obj.type===`channel`||e.data.obj.type===`device`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,s=!e.data.obj||e.data.obj.type===`folder`||e.data.obj.type===`device`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,c=!e.data.obj||e.data.obj.type===`folder`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,l=!e.data.obj||e.data.obj.type===`folder`||e.data.id===`0_userdata.0`||e.data.obj.type===`meta`,u={EDIT:{key:`0`,visibility:!!(this.props.objectBrowserEditObject&&r&&(this.state.filter.expertMode||oK(t))),icon:R.createElement(LO,{fontSize:`small`,style:this.styles.contextMenuEdit}),label:this.texts.editObject,onClick:()=>this.setState({editObjectDialog:e.data.id,showContextMenu:null,editObjectAlias:!1})},EDIT_VALUE:{key:`1`,visibility:!!(this.states&&!this.props.notEditable&&r&&r.type===`state`&&r.common?.type!==`file`&&(this.state.filter.expertMode||r.common.write!==!1)),icon:R.createElement(UO,{fontSize:`small`,style:this.styles.contextMenuEditValue}),label:this.props.t(`ra_Edit value`),onClick:()=>{this.edit={val:this.states[t]?this.states[t].val:``,q:this.states[t]?.q||0,ack:!1,id:t},this.setState({updateOpened:!0,showContextMenu:null})}},VIEW:{visibility:!!this.props.objectBrowserViewFile&&r?.type===`state`&&r.common?.type===`file`,icon:R.createElement(zO,{fontSize:`small`,style:this.styles.contextMenuView}),label:this.props.t(`ra_View file`),onClick:()=>this.setState({viewFileDialog:r?._id||``,showContextMenu:null})},CUSTOM:{key:`2`,visibility:!(this.props.objectCustomDialog&&this.info.hasSomeCustoms&&r&&r.type===`state`&&r.common?.type!==`file`),icon:R.createElement(sk,{fontSize:`small`,style:e.data.hasCustoms?this.styles.cellButtonsButtonWithCustoms:$.cellButtonsButtonWithoutCustoms}),style:this.styles.contextMenuCustom,label:this.texts.customConfig,onClick:()=>{this.pauseSubscribe(!0),this.props.router?.doNavigate(null,`customs`,t),this.setState({customDialog:[t],showContextMenu:null})}},ACL:{key:`3`,visibility:!!i,icon:i,iconStyle:{fontSize:`smaller`},listItemIconStyle:this.styles.contextMenuACL,style:this.styles.contextMenuACL,label:this.props.t(`ra_Edit ACL`),onClick:()=>this.setState({showContextMenu:null,modalEditOfAccess:!0,modalEditOfAccessObjData:e.data})},ROLE:{key:`4`,visibility:!!(this.state.filter.expertMode&&a&&this.props.objectBrowserEditRole),icon:R.createElement(SO,{fontSize:`small`,style:this.styles.contextMenuRole}),label:this.props.t(`ra_Edit role`),onClick:()=>this.setState({roleDialog:e.data.id,showContextMenu:null})},FUNCTION:{key:`5`,visibility:!!a,icon:R.createElement(yO,{fontSize:`small`,style:this.styles.contextMenuRole}),label:this.props.t(`ra_Edit function`),onClick:()=>{let t=$G(this.info,e.data.id,`funcEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`func`,enumsOriginal:JSON.stringify(t)},showContextMenu:null})}},ROOM:{key:`6`,visibility:!!a,icon:R.createElement(kO,{fontSize:`small`,style:this.styles.contextMenuRoom}),label:this.props.t(`ra_Edit room`),onClick:()=>{let t=$G(this.info,e.data.id,`roomEnums`);this.setState({enumDialogEnums:t,enumDialog:{item:e,type:`room`,enumsOriginal:JSON.stringify(t)},showContextMenu:null})}},ALIAS:{key:`7`,visibility:!!(!this.props.notEditable&&this.props.objectBrowserAliasEditor&&this.props.objectBrowserEditObject&&r?.type===`state`&&r.common?.type!==`file`),icon:R.createElement(YO,{style:r?.common?.alias?this.styles.cellButtonsButtonWithCustoms:$.cellButtonsButtonWithoutCustoms}),label:this.info.aliasesMap[e.data.id]||e.data.id.startsWith(`alias.0.`)?this.props.t(`ra_Edit alias`):this.props.t(`ra_Create alias`),onClick:()=>{r?.common?.alias?this.setState({showContextMenu:null,editObjectDialog:e.data.id,editObjectAlias:!0}):this.setState({showContextMenu:null,showAliasEditor:e.data.id})}},CREATE:{key:`+`,visibility:(e.data.id.startsWith(`0_userdata.0`)||e.data.id.startsWith(`javascript.`))&&(o||s||c||l),icon:R.createElement(hO,{fontSize:`small`,style:this.styles.cellButtonsButtonWithCustoms}),style:$.contextMenuWithSubMenu,label:this.texts.create,subMenu:[{label:this.texts.createBooleanState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`,`boolean`)},{label:this.texts.createNumberState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`,`number`)},{label:this.texts.createStringState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`,`string`)},{label:this.texts.createState,visibility:o,icon:R.createElement(bG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`state`)},{label:this.texts.createChannel,visibility:s,icon:R.createElement(mG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`channel`)},{label:this.texts.createDevice,visibility:c,icon:R.createElement(gG,{fontSize:`small`}),onClick:()=>this.showAddDataPointDialog(e.data.id,`device`)},{label:this.texts.createFolder,icon:R.createElement(MO,{fontSize:`small`}),visibility:l,onClick:()=>this.showAddDataPointDialog(e.data.id,`folder`)}]},RENAME:{key:`8`,visibility:!!(!this.props.notEditable&&this.props.objectMoveRenameDialog&&!e.data.id.startsWith(`system.`)&&e.data.id.split(`.`).length>2&&(this.props.expertMode||e.data.id.startsWith(`javascript.0.`)||e.data.id.startsWith(`0_userdata.0.`))),icon:R.createElement(IO,null),label:this.props.t(`ra_Rename_Move_Copy`),onClick:()=>{let t=Object.keys(this.objects),n=`${e.data.id}.`;this.setState({showContextMenu:null,showRenameDialog:{id:e.data.id,childrenIds:t.filter(e=>e.startsWith(n))}})}},DELETE:{key:`Delete`,visibility:!!(this.props.onObjectDelete&&(e.children?.length||r&&!r.common?.dontDelete)),icon:R.createElement(PO,{fontSize:`small`,style:this.styles.contextMenuDelete}),style:this.styles.contextMenuDelete,label:this.texts.deleteObject,onClick:()=>this.setState({showContextMenu:null},()=>this.showDeleteDialog({id:t,obj:r||{},item:e}))}};return Object.keys(u).forEach(e=>{u[e].visibility&&(u[e].subMenu?(n.push(R.createElement(LT,{key:e,href:``,onClick:t=>this.state.showContextMenu&&this.setState({showContextMenu:{item:this.state.showContextMenu.item,position:this.state.showContextMenu.position,subItem:e,subAnchor:t.target}}),style:u[e].style},R.createElement(rT,{style:{...u[e].iconStyle,...u[e].listItemIconStyle}},u[e].icon),R.createElement(cT,null,u[e].label,`...`),R.createElement(`div`,{style:{...$.contextMenuKeys,opacity:1}},R.createElement(_O,null)))),this.state.showContextMenu?.subItem===e&&n.push(R.createElement(jT,{key:`subContextMenu`,open:!0,anchorEl:this.state.showContextMenu.subAnchor,onClose:()=>{this.state.showContextMenu&&this.setState({showContextMenu:{item:this.state.showContextMenu.item,position:this.state.showContextMenu.position}}),this.contextMenu=null}},u[e].subMenu?.map(e=>e.visibility?R.createElement(LT,{key:e.label,onClick:e.onClick,style:e.style},R.createElement(rT,{style:{...e.iconStyle,...e.listItemIconStyle||void 0}},e.icon),R.createElement(cT,null,e.label)):null)))):n.push(R.createElement(LT,{key:e,onClick:u[e].onClick,sx:u[e].style},R.createElement(rT,{style:{...u[e].iconStyle,...u[e].listItemIconStyle}},u[e].icon),R.createElement(cT,null,u[e].label),u[e].key?R.createElement(`div`,{style:$.contextMenuKeys},`Alt+${u[e].key===`Delete`?this.props.t(`ra_Del`):u[e].key}`):null)))}),n.length?R.createElement(jT,{key:`contextMenu`,open:!0,onKeyUp:e=>{e.preventDefault(),e.altKey&&Object.keys(u).forEach(t=>{e.key===u[t].key&&u[t].onClick&&u[t].onClick()})},anchorReference:`anchorPosition`,anchorPosition:this.state.showContextMenu.position,onClose:()=>{this.setState({showContextMenu:null}),this.contextMenu=null}},n):(setTimeout(()=>this.setState({showContextMenu:null}),100),null)}renderEditValueDialog(){if(!this.state.updateOpened||!this.props.objectBrowserValue)return null;if(!this.edit.id)return console.error(`Invalid ID for edit: ${JSON.stringify(this.edit)}`),null;if(!this.objects[this.edit.id])return console.error(`Something went wrong. Possibly the object ${this.edit.id} was deleted.`),null;let e=this.objects[this.edit.id].common?.type?this.objects[this.edit.id].common.type:typeof this.edit.val,t=this.objects[this.edit.id].common.role,n=this.props.objectBrowserValue;return R.createElement(n,{t:this.props.t,lang:this.props.lang,type:e,role:t||``,states:X.getStates(this.objects[this.edit.id]),themeType:this.props.themeType,theme:this.props.theme,expertMode:!!this.state.filter.expertMode,value:this.edit.val,socket:this.props.socket,object:this.objects[this.edit.id],defaultHistory:this.defaultHistory,dateFormat:this.props.dateFormat||this.systemConfig?.common.dateFormat||hK,isFloatComma:this.props.isFloatComma===void 0?this.systemConfig?.common.isFloatComma??!0:this.props.isFloatComma,onClose:e=>{this.setState({updateOpened:!1}),e&&this.onUpdate(e)},width:this.props.width})}doFilter(e){if(!this.objects||!this.root)return;e||this.localStorage.setItem(`${this.props.dialogName||`App`}.objectFilter`,JSON.stringify(this.state.filter));let t={count:0};GG(this.root,this.state.filter,this.props.lang,this.objects,void 0,t,this.props.customFilter,this.props.types),t.count<500&&!this.state.expandAllVisible?setTimeout(()=>this.setState({expandAllVisible:!0})):t.count>=500&&this.state.expandAllVisible?setTimeout(()=>this.setState({expandAllVisible:!1})):this.forceUpdate()}render(){if(this.recordStates=[],this.unsubscribeTimer&&clearTimeout(this.unsubscribeTimer),this.styleTheme!==this.props.themeType&&(this.styles={cellIdIconFolder:X.getStyle(this.props.theme,$.cellIdIconFolder),cellIdIconDocument:X.getStyle(this.props.theme,$.cellIdIconDocument),iconDeviceError:X.getStyle(this.props.theme,$.iconDeviceError),iconDeviceConnected:X.getStyle(this.props.theme,$.iconDeviceConnected),iconDeviceDisconnected:X.getStyle(this.props.theme,$.iconDeviceDisconnected),cellButtonsButtonWithCustoms:X.getStyle(this.props.theme,$.cellButtonsButtonWithCustoms),invertedBackground:X.getStyle(this.props.theme,$.invertedBackground),invertedBackgroundFlex:X.getStyle(this.props.theme,$.invertedBackgroundFlex),contextMenuEdit:X.getStyle(this.props.theme,$.contextMenuEdit),contextMenuEditValue:X.getStyle(this.props.theme,$.contextMenuEditValue),contextMenuView:X.getStyle(this.props.theme,$.contextMenuView),contextMenuCustom:X.getStyle(this.props.theme,$.contextMenuCustom),contextMenuACL:X.getStyle(this.props.theme,$.contextMenuACL),contextMenuRoom:X.getStyle(this.props.theme,$.contextMenuRoom),contextMenuRole:X.getStyle(this.props.theme,$.contextMenuRole),contextMenuDelete:X.getStyle(this.props.theme,$.contextMenuDelete),filterInput:X.getStyle(this.props.theme,$.headerCellInput,$.filterInput),iconCopy:X.getStyle(this.props.theme,$.cellButtonsValueButton,$.cellButtonsValueButtonCopy),aliasReadWrite:X.getStyle(this.props.theme,$.cellIdAlias,$.cellIdAliasReadWrite),aliasAlone:X.getStyle(this.props.theme,$.cellIdAlias,$.cellIdAliasAlone)},this.styleTheme=this.props.themeType),this.unsubscribeTimer=setTimeout(()=>{this.unsubscribeTimer=null,this.checkUnsubscribes()},200),this.expertMode!==!!this.state.filter.expertMode&&(this.expertMode=!!this.state.filter.expertMode,this.doFilter(!0)),!this.state.loaded)return R.createElement(iv,{key:`${this.props.dialogName}_c`});let e=this.root?this.renderItem(this.root,void 0):null;return R.createElement(CG,{key:this.props.dialogName},R.createElement(`style`,null,`
651
651
  @keyframes newValueAnimation-light {
652
652
  0% {
653
653
  color: #00f900;
@@ -681,5 +681,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
681
681
  cursor: pointer;
682
682
  }
683
683
  `),R.createElement(EG,null,this.getToolbar()),R.createElement(TG,null,this.renderHeader(),R.createElement(_x,{style:$.tableDiv,ref:this.tableRef,onKeyDown:e=>this.navigateKeyPress(e)},e)),this.renderContextMenu(),this.renderAliasMenu(),this.renderToast(),this.renderColumnsEditCustomDialog(),this.renderColumnsSelectorDialog(),this.renderCustomDialog(),this.renderEditValueDialog(),this.renderEditObjectDialog(),this.renderViewObjectFileDialog(),this.renderAliasEditorDialog(),this.renderEditRoleDialog(),this.renderEnumDialog(),this.renderErrorDialog(),this.renderExportDialog(),this.renderRenameDialog(),this.renderInputJsonDialog(),this.state.modalNewObj&&this.props.modalNewObject&&this.props.modalNewObject(this),this.state.modalEditOfAccess&&this.state.modalEditOfAccessObjData&&this.props.modalEditOfAccessControl&&this.props.modalEditOfAccessControl(this,this.state.modalEditOfAccessObjData))}};GU()(bK),R.Component,R.Component;var xK=c(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.Cropper=r())})(e,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=arguments[n]==null?{}:arguments[n];n%2?e(Object(r),!0).forEach(function(e){c(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function n(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function r(e){var t=n(e,`string`);return typeof t==`symbol`?t:t+``}function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,`value`in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t=r(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return u(e)||d(e)||f(e)||m()}function u(e){if(Array.isArray(e))return p(e)}function d(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function f(e,t){if(e){if(typeof e==`string`)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}function p(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(){throw TypeError(`Invalid attempt to spread non-iterable instance.
684
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var h=typeof window<`u`&&window.document!==void 0,g=h?window:{},_=h&&g.document.documentElement?`ontouchstart`in g.document.documentElement:!1,v=h?`PointerEvent`in g:!1,y=`cropper`,b=`all`,x=`crop`,S=`move`,C=`zoom`,w=`e`,T=`w`,E=`s`,D=`n`,O=`ne`,k=`nw`,A=`se`,j=`sw`,M=`${y}-crop`,N=`${y}-disabled`,P=`${y}-hidden`,F=`${y}-hide`,ee=`${y}-invisible`,te=`${y}-modal`,I=`${y}-move`,ne=`${y}Action`,re=`${y}Preview`,ie=`crop`,ae=`move`,oe=`none`,se=`crop`,ce=`cropend`,le=`cropmove`,ue=`cropstart`,de=`dblclick`,fe=_?`touchstart`:`mousedown`,pe=_?`touchmove`:`mousemove`,me=_?`touchend touchcancel`:`mouseup`,he=v?`pointerdown`:fe,L=v?`pointermove`:pe,ge=v?`pointerup pointercancel`:me,_e=`ready`,ve=`resize`,ye=`wheel`,be=`zoom`,xe=`image/jpeg`,Se=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Ce=/^data:/,we=/^data:image\/jpeg;base64,/,Te=/^img|canvas$/i,Ee=200,De=100,Oe={viewMode:0,dragMode:ie,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:``,responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:Ee,minContainerHeight:De,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ke=`<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>`,Ae=Number.isNaN||g.isNaN;function je(e){return typeof e==`number`&&!Ae(e)}var Me=function(e){return e>0&&e<1/0};function Ne(e){return e===void 0}function Pe(e){return i(e)===`object`&&e!==null}var Fe=Object.prototype.hasOwnProperty;function Ie(e){if(!Pe(e))return!1;try{var t=e.constructor,n=t.prototype;return t&&n&&Fe.call(n,`isPrototypeOf`)}catch{return!1}}function Le(e){return typeof e==`function`}var Re=Array.prototype.slice;function ze(e){return Array.from?Array.from(e):Re.call(e)}function Be(e,t){return e&&Le(t)&&(Array.isArray(e)||je(e.length)?ze(e).forEach(function(n,r){t.call(e,n,r,e)}):Pe(e)&&Object.keys(e).forEach(function(n){t.call(e,e[n],n,e)})),e}var Ve=Object.assign||function(e){var t=[...arguments].slice(1);return Pe(e)&&t.length>0&&t.forEach(function(t){Pe(t)&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e},He=/\.\d*(?:0|9){12}\d*$/;function Ue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return He.test(e)?Math.round(e*t)/t:e}var We=/^width|height|left|top|marginLeft|marginTop$/;function Ge(e,t){var n=e.style;Be(t,function(e,t){We.test(t)&&je(e)&&(e=`${e}px`),n[t]=e})}function Ke(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function qe(e,t){if(t){if(je(e.length)){Be(e,function(e){qe(e,t)});return}if(e.classList){e.classList.add(t);return}var n=e.className.trim();n?n.indexOf(t)<0&&(e.className=`${n} ${t}`):e.className=t}}function Je(e,t){if(t){if(je(e.length)){Be(e,function(e){Je(e,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,``))}}function Ye(e,t,n){if(t){if(je(e.length)){Be(e,function(e){Ye(e,t,n)});return}n?qe(e,t):Je(e,t)}}var Xe=/([a-z\d])([A-Z])/g;function Ze(e){return e.replace(Xe,`$1-$2`).toLowerCase()}function Qe(e,t){return Pe(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute(`data-${Ze(t)}`)}function $e(e,t,n){Pe(n)?e[t]=n:e.dataset?e.dataset[t]=n:e.setAttribute(`data-${Ze(t)}`,n)}function et(e,t){if(Pe(e[t]))try{delete e[t]}catch{e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch{e.dataset[t]=void 0}else e.removeAttribute(`data-${Ze(t)}`)}var tt=/\s\s*/,nt=function(){var e=!1;if(h){var t=!1,n=function(){},r=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(e){t=e}});g.addEventListener(`test`,n,r),g.removeEventListener(`test`,n,r)}return e}();function rt(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=n;t.trim().split(tt).forEach(function(t){if(!nt){var a=e.listeners;a&&a[t]&&a[t][n]&&(i=a[t][n],delete a[t][n],Object.keys(a[t]).length===0&&delete a[t],Object.keys(a).length===0&&delete e.listeners)}e.removeEventListener(t,i,r)})}function it(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=n;t.trim().split(tt).forEach(function(t){if(r.once&&!nt){var a=e.listeners,o=a===void 0?{}:a;i=function(){delete o[t][n],e.removeEventListener(t,i,r);var a=[...arguments];n.apply(e,a)},o[t]||(o[t]={}),o[t][n]&&e.removeEventListener(t,o[t][n],r),o[t][n]=i,e.listeners=o}e.addEventListener(t,i,r)})}function at(e,t,n){var r;return Le(Event)&&Le(CustomEvent)?r=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0}):(r=document.createEvent(`CustomEvent`),r.initCustomEvent(t,!0,!0,n)),e.dispatchEvent(r)}function ot(e){var t=e.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var st=g.location,ct=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function lt(e){var t=e.match(ct);return t!==null&&(t[1]!==st.protocol||t[2]!==st.hostname||t[3]!==st.port)}function R(e){var t=`timestamp=${new Date().getTime()}`;return e+(e.indexOf(`?`)===-1?`?`:`&`)+t}function ut(e){var t=e.rotate,n=e.scaleX,r=e.scaleY,i=e.translateX,a=e.translateY,o=[];je(i)&&i!==0&&o.push(`translateX(${i}px)`),je(a)&&a!==0&&o.push(`translateY(${a}px)`),je(t)&&t!==0&&o.push(`rotate(${t}deg)`),je(n)&&n!==1&&o.push(`scaleX(${n})`),je(r)&&r!==1&&o.push(`scaleY(${r})`);var s=o.length?o.join(` `):`none`;return{WebkitTransform:s,msTransform:s,transform:s}}function dt(e){var n=t({},e),r=0;return Be(e,function(e,t){delete n[t],Be(n,function(t){var n=Math.abs(e.startX-t.startX),i=Math.abs(e.startY-t.startY),a=Math.abs(e.endX-t.endX),o=Math.abs(e.endY-t.endY),s=Math.sqrt(n*n+i*i),c=(Math.sqrt(a*a+o*o)-s)/s;Math.abs(c)>Math.abs(r)&&(r=c)})}),r}function ft(e,n){var r=e.pageX,i=e.pageY,a={endX:r,endY:i};return n?a:t({startX:r,startY:i},a)}function pt(e){var t=0,n=0,r=0;return Be(e,function(e){var i=e.startX,a=e.startY;t+=i,n+=a,r+=1}),t/=r,n/=r,{pageX:t,pageY:n}}function mt(e){var t=e.aspectRatio,n=e.height,r=e.width,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`contain`,a=Me(r),o=Me(n);if(a&&o){var s=n*t;i===`contain`&&s>r||i===`cover`&&s<r?n=r/t:r=n*t}else a?n=r/t:o&&(r=n*t);return{width:r,height:n}}function ht(e){var t=e.width,n=e.height,r=e.degree;if(r=Math.abs(r)%180,r===90)return{width:n,height:t};var i=r%90*Math.PI/180,a=Math.sin(i),o=Math.cos(i),s=t*o+n*a,c=t*a+n*o;return r>90?{width:c,height:s}:{width:s,height:c}}function gt(e,t,n,r){var i=t.aspectRatio,a=t.naturalWidth,o=t.naturalHeight,s=t.rotate,c=s===void 0?0:s,u=t.scaleX,d=u===void 0?1:u,f=t.scaleY,p=f===void 0?1:f,m=n.aspectRatio,h=n.naturalWidth,g=n.naturalHeight,_=r.fillColor,v=_===void 0?`transparent`:_,y=r.imageSmoothingEnabled,b=y===void 0||y,x=r.imageSmoothingQuality,S=x===void 0?`low`:x,C=r.maxWidth,w=C===void 0?1/0:C,T=r.maxHeight,E=T===void 0?1/0:T,D=r.minWidth,O=D===void 0?0:D,k=r.minHeight,A=k===void 0?0:k,j=document.createElement(`canvas`),M=j.getContext(`2d`),N=mt({aspectRatio:m,width:w,height:E}),P=mt({aspectRatio:m,width:O,height:A},`cover`),F=Math.min(N.width,Math.max(P.width,h)),ee=Math.min(N.height,Math.max(P.height,g)),te=mt({aspectRatio:i,width:w,height:E}),I=mt({aspectRatio:i,width:O,height:A},`cover`),ne=Math.min(te.width,Math.max(I.width,a)),re=Math.min(te.height,Math.max(I.height,o)),ie=[-ne/2,-re/2,ne,re];return j.width=Ue(F),j.height=Ue(ee),M.fillStyle=v,M.fillRect(0,0,F,ee),M.save(),M.translate(F/2,ee/2),M.rotate(c*Math.PI/180),M.scale(d,p),M.imageSmoothingEnabled=b,M.imageSmoothingQuality=S,M.drawImage.apply(M,[e].concat(l(ie.map(function(e){return Math.floor(Ue(e))})))),M.restore(),j}var _t=String.fromCharCode;function vt(e,t,n){var r=``;n+=t;for(var i=t;i<n;i+=1)r+=_t(e.getUint8(i));return r}var yt=/^data:.*,/;function bt(e){var t=e.replace(yt,``),n=atob(t),r=new ArrayBuffer(n.length),i=new Uint8Array(r);return Be(i,function(e,t){i[t]=n.charCodeAt(t)}),r}function xt(e,t){for(var n=[],r=8192,i=new Uint8Array(e);i.length>0;)n.push(_t.apply(null,ze(i.subarray(0,r)))),i=i.subarray(r);return`data:${t};base64,${btoa(n.join(``))}`}function St(e){var t=new DataView(e),n;try{var r,i,a;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var o=t.byteLength,s=2;s+1<o;){if(t.getUint8(s)===255&&t.getUint8(s+1)===225){i=s;break}s+=1}if(i){var c=i+4,l=i+10;if(vt(t,c,4)===`Exif`){var u=t.getUint16(l);if(r=u===18761,(r||u===19789)&&t.getUint16(l+2,r)===42){var d=t.getUint32(l+4,r);d>=8&&(a=l+d)}}}if(a){var f=t.getUint16(a,r),p,m;for(m=0;m<f;m+=1)if(p=a+m*12+2,t.getUint16(p,r)===274){p+=8,n=t.getUint16(p,r),t.setUint16(p,1,r);break}}}catch{n=1}return n}function Ct(e){var t=0,n=1,r=1;switch(e){case 2:n=-1;break;case 3:t=-180;break;case 4:r=-1;break;case 5:t=90,r=-1;break;case 6:t=90;break;case 7:t=90,n=-1;break;case 8:t=-90;break}return{rotate:t,scaleX:n,scaleY:r}}var wt={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,n=this.container,r=this.cropper,i=Number(t.minContainerWidth),a=Number(t.minContainerHeight);qe(r,P),Je(e,P);var o={width:Math.max(n.offsetWidth,i>=0?i:Ee),height:Math.max(n.offsetHeight,a>=0?a:De)};this.containerData=o,Ge(r,{width:o.width,height:o.height}),qe(e,P),Je(r,P)},initCanvas:function(){var e=this.containerData,t=this.imageData,n=this.options.viewMode,r=Math.abs(t.rotate)%180==90,i=r?t.naturalHeight:t.naturalWidth,a=r?t.naturalWidth:t.naturalHeight,o=i/a,s=e.width,c=e.height;e.height*o>e.width?n===3?s=e.height*o:c=e.width/o:n===3?c=e.width/o:s=e.height*o;var l={aspectRatio:o,naturalWidth:i,naturalHeight:a,width:s,height:c};this.canvasData=l,this.limited=n===1||n===2,this.limitCanvas(!0,!0),l.width=Math.min(Math.max(l.width,l.minWidth),l.maxWidth),l.height=Math.min(Math.max(l.height,l.minHeight),l.maxHeight),l.left=(e.width-l.width)/2,l.top=(e.height-l.height)/2,l.oldLeft=l.left,l.oldTop=l.top,this.initialCanvasData=Ve({},l)},limitCanvas:function(e,t){var n=this.options,r=this.containerData,i=this.canvasData,a=this.cropBoxData,o=n.viewMode,s=i.aspectRatio,c=this.cropped&&a;if(e){var l=Number(n.minCanvasWidth)||0,u=Number(n.minCanvasHeight)||0;o>1?(l=Math.max(l,r.width),u=Math.max(u,r.height),o===3&&(u*s>l?l=u*s:u=l/s)):o>0&&(l?l=Math.max(l,c?a.width:0):u?u=Math.max(u,c?a.height:0):c&&(l=a.width,u=a.height,u*s>l?l=u*s:u=l/s));var d=mt({aspectRatio:s,width:l,height:u});l=d.width,u=d.height,i.minWidth=l,i.minHeight=u,i.maxWidth=1/0,i.maxHeight=1/0}if(t)if(o>+!c){var f=r.width-i.width,p=r.height-i.height;i.minLeft=Math.min(0,f),i.minTop=Math.min(0,p),i.maxLeft=Math.max(0,f),i.maxTop=Math.max(0,p),c&&this.limited&&(i.minLeft=Math.min(a.left,a.left+(a.width-i.width)),i.minTop=Math.min(a.top,a.top+(a.height-i.height)),i.maxLeft=a.left,i.maxTop=a.top,o===2&&(i.width>=r.width&&(i.minLeft=Math.min(0,f),i.maxLeft=Math.max(0,f)),i.height>=r.height&&(i.minTop=Math.min(0,p),i.maxTop=Math.max(0,p))))}else i.minLeft=-i.width,i.minTop=-i.height,i.maxLeft=r.width,i.maxTop=r.height},renderCanvas:function(e,t){var n=this.canvasData,r=this.imageData;if(t){var i=ht({width:r.naturalWidth*Math.abs(r.scaleX||1),height:r.naturalHeight*Math.abs(r.scaleY||1),degree:r.rotate||0}),a=i.width,o=i.height,s=n.width*(a/n.naturalWidth),c=n.height*(o/n.naturalHeight);n.left-=(s-n.width)/2,n.top-=(c-n.height)/2,n.width=s,n.height=c,n.aspectRatio=a/o,n.naturalWidth=a,n.naturalHeight=o,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCanvas(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,Ge(this.canvas,Ve({width:n.width,height:n.height},ut({translateX:n.left,translateY:n.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,n=this.imageData,r=n.naturalWidth*(t.width/t.naturalWidth),i=n.naturalHeight*(t.height/t.naturalHeight);Ve(n,{width:r,height:i,left:(t.width-r)/2,top:(t.height-i)/2}),Ge(this.image,Ve({width:n.width,height:n.height},ut(Ve({translateX:n.left,translateY:n.top},n)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,n=e.aspectRatio||e.initialAspectRatio,r=Number(e.autoCropArea)||.8,i={width:t.width,height:t.height};n&&(t.height*n>t.width?i.height=i.width/n:i.width=i.height*n),this.cropBoxData=i,this.limitCropBox(!0,!0),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),i.width=Math.max(i.minWidth,i.width*r),i.height=Math.max(i.minHeight,i.height*r),i.left=t.left+(t.width-i.width)/2,i.top=t.top+(t.height-i.height)/2,i.oldLeft=i.left,i.oldTop=i.top,this.initialCropBoxData=Ve({},i)},limitCropBox:function(e,t){var n=this.options,r=this.containerData,i=this.canvasData,a=this.cropBoxData,o=this.limited,s=n.aspectRatio;if(e){var c=Number(n.minCropBoxWidth)||0,l=Number(n.minCropBoxHeight)||0,u=o?Math.min(r.width,i.width,i.width+i.left,r.width-i.left):r.width,d=o?Math.min(r.height,i.height,i.height+i.top,r.height-i.top):r.height;c=Math.min(c,r.width),l=Math.min(l,r.height),s&&(c&&l?l*s>c?l=c/s:c=l*s:c?l=c/s:l&&(c=l*s),d*s>u?d=u/s:u=d*s),a.minWidth=Math.min(c,u),a.minHeight=Math.min(l,d),a.maxWidth=u,a.maxHeight=d}t&&(o?(a.minLeft=Math.max(0,i.left),a.minTop=Math.max(0,i.top),a.maxLeft=Math.min(r.width,i.left+i.width)-a.width,a.maxTop=Math.min(r.height,i.top+i.height)-a.height):(a.minLeft=0,a.minTop=0,a.maxLeft=r.width-a.width,a.maxTop=r.height-a.height))},renderCropBox:function(){var e=this.options,t=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCropBox(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,e.movable&&e.cropBoxMovable&&$e(this.face,ne,n.width>=t.width&&n.height>=t.height?S:b),Ge(this.cropBox,Ve({width:n.width,height:n.height},ut({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),at(this.element,se,this.getData())}},Tt={initPreview:function(){var e=this.element,t=this.crossOrigin,n=this.options.preview,r=t?this.crossOriginUrl:this.url,i=e.alt||`The image to preview`,a=document.createElement(`img`);if(t&&(a.crossOrigin=t),a.src=r,a.alt=i,this.viewBox.appendChild(a),this.viewBoxImage=a,n){var o=n;typeof n==`string`?o=e.ownerDocument.querySelectorAll(n):n.querySelector&&(o=[n]),this.previews=o,Be(o,function(e){var n=document.createElement(`img`);$e(e,re,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(n.crossOrigin=t),n.src=r,n.alt=i,n.style.cssText=`display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"`,e.innerHTML=``,e.appendChild(n)})}},resetPreview:function(){Be(this.previews,function(e){var t=Qe(e,re);Ge(e,{width:t.width,height:t.height}),e.innerHTML=t.html,et(e,re)})},preview:function(){var e=this.imageData,t=this.canvasData,n=this.cropBoxData,r=n.width,i=n.height,a=e.width,o=e.height,s=n.left-t.left-e.left,c=n.top-t.top-e.top;!this.cropped||this.disabled||(Ge(this.viewBoxImage,Ve({width:a,height:o},ut(Ve({translateX:-s,translateY:-c},e)))),Be(this.previews,function(t){var n=Qe(t,re),l=n.width,u=n.height,d=l,f=u,p=1;r&&(p=l/r,f=i*p),i&&f>u&&(p=u/i,d=r*p,f=u),Ge(t,{width:d,height:f}),Ge(t.getElementsByTagName(`img`)[0],Ve({width:a*p,height:o*p},ut(Ve({translateX:-s*p,translateY:-c*p},e))))}))}},Et={bind:function(){var e=this.element,t=this.options,n=this.cropper;Le(t.cropstart)&&it(e,ue,t.cropstart),Le(t.cropmove)&&it(e,le,t.cropmove),Le(t.cropend)&&it(e,ce,t.cropend),Le(t.crop)&&it(e,se,t.crop),Le(t.zoom)&&it(e,be,t.zoom),it(n,he,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&it(n,ye,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&it(n,de,this.onDblclick=this.dblclick.bind(this)),it(e.ownerDocument,L,this.onCropMove=this.cropMove.bind(this)),it(e.ownerDocument,ge,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&it(window,ve,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,n=this.cropper;Le(t.cropstart)&&rt(e,ue,t.cropstart),Le(t.cropmove)&&rt(e,le,t.cropmove),Le(t.cropend)&&rt(e,ce,t.cropend),Le(t.crop)&&rt(e,se,t.crop),Le(t.zoom)&&rt(e,be,t.zoom),rt(n,he,this.onCropStart),t.zoomable&&t.zoomOnWheel&&rt(n,ye,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&rt(n,de,this.onDblclick),rt(e.ownerDocument,L,this.onCropMove),rt(e.ownerDocument,ge,this.onCropEnd),t.responsive&&rt(window,ve,this.onResize)}},Dt={resize:function(){if(!this.disabled){var e=this.options,t=this.container,n=this.containerData,r=t.offsetWidth/n.width,i=t.offsetHeight/n.height,a=Math.abs(r-1)>Math.abs(i-1)?r:i;if(a!==1){var o,s;e.restore&&(o=this.getCanvasData(),s=this.getCropBoxData()),this.render(),e.restore&&(this.setCanvasData(Be(o,function(e,t){o[t]=e*a})),this.setCropBoxData(Be(s,function(e,t){s[t]=e*a})))}}},dblclick:function(){this.disabled||this.options.dragMode===oe||this.setDragMode(Ke(this.dragBox,M)?ae:ie)},wheel:function(e){var t=this,n=Number(this.options.wheelZoomRatio)||.1,r=1;this.disabled||(e.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),e.deltaY?r=e.deltaY>0?1:-1:e.wheelDelta?r=-e.wheelDelta/120:e.detail&&(r=e.detail>0?1:-1),this.zoom(-r*n,e)))},cropStart:function(e){var t=e.buttons,n=e.button;if(!(this.disabled||(e.type===`mousedown`||e.type===`pointerdown`&&e.pointerType===`mouse`)&&(je(t)&&t!==1||je(n)&&n!==0||e.ctrlKey))){var r=this.options,i=this.pointers,a;e.changedTouches?Be(e.changedTouches,function(e){i[e.identifier]=ft(e)}):i[e.pointerId||0]=ft(e),a=Object.keys(i).length>1&&r.zoomable&&r.zoomOnTouch?C:Qe(e.target,ne),Se.test(a)&&at(this.element,ue,{originalEvent:e,action:a})!==!1&&(e.preventDefault(),this.action=a,this.cropping=!1,a===x&&(this.cropping=!0,qe(this.dragBox,te)))}},cropMove:function(e){var t=this.action;if(!(this.disabled||!t)){var n=this.pointers;e.preventDefault(),at(this.element,le,{originalEvent:e,action:t})!==!1&&(e.changedTouches?Be(e.changedTouches,function(e){Ve(n[e.identifier]||{},ft(e,!0))}):Ve(n[e.pointerId||0]||{},ft(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,n=this.pointers;e.changedTouches?Be(e.changedTouches,function(e){delete n[e.identifier]}):delete n[e.pointerId||0],t&&(e.preventDefault(),Object.keys(n).length||(this.action=``),this.cropping&&(this.cropping=!1,Ye(this.dragBox,te,this.cropped&&this.options.modal)),at(this.element,ce,{originalEvent:e,action:t}))}}},Ot={change:function(e){var t=this.options,n=this.canvasData,r=this.containerData,i=this.cropBoxData,a=this.pointers,o=this.action,s=t.aspectRatio,c=i.left,l=i.top,u=i.width,d=i.height,f=c+u,p=l+d,m=0,h=0,g=r.width,_=r.height,v=!0,y;!s&&e.shiftKey&&(s=u&&d?u/d:1),this.limited&&(m=i.minLeft,h=i.minTop,g=m+Math.min(r.width,n.width,n.left+n.width),_=h+Math.min(r.height,n.height,n.top+n.height));var M=a[Object.keys(a)[0]],N={x:M.endX-M.startX,y:M.endY-M.startY},F=function(e){switch(e){case w:f+N.x>g&&(N.x=g-f);break;case T:c+N.x<m&&(N.x=m-c);break;case D:l+N.y<h&&(N.y=h-l);break;case E:p+N.y>_&&(N.y=_-p);break}};switch(o){case b:c+=N.x,l+=N.y;break;case w:if(N.x>=0&&(f>=g||s&&(l<=h||p>=_))){v=!1;break}F(w),u+=N.x,u<0&&(o=T,u=-u,c-=u),s&&(d=u/s,l+=(i.height-d)/2);break;case D:if(N.y<=0&&(l<=h||s&&(c<=m||f>=g))){v=!1;break}F(D),d-=N.y,l+=N.y,d<0&&(o=E,d=-d,l-=d),s&&(u=d*s,c+=(i.width-u)/2);break;case T:if(N.x<=0&&(c<=m||s&&(l<=h||p>=_))){v=!1;break}F(T),u-=N.x,c+=N.x,u<0&&(o=w,u=-u,c-=u),s&&(d=u/s,l+=(i.height-d)/2);break;case E:if(N.y>=0&&(p>=_||s&&(c<=m||f>=g))){v=!1;break}F(E),d+=N.y,d<0&&(o=D,d=-d,l-=d),s&&(u=d*s,c+=(i.width-u)/2);break;case O:if(s){if(N.y<=0&&(l<=h||f>=g)){v=!1;break}F(D),d-=N.y,l+=N.y,u=d*s}else F(D),F(w),N.x>=0?f<g?u+=N.x:N.y<=0&&l<=h&&(v=!1):u+=N.x,N.y<=0?l>h&&(d-=N.y,l+=N.y):(d-=N.y,l+=N.y);u<0&&d<0?(o=j,d=-d,u=-u,l-=d,c-=u):u<0?(o=k,u=-u,c-=u):d<0&&(o=A,d=-d,l-=d);break;case k:if(s){if(N.y<=0&&(l<=h||c<=m)){v=!1;break}F(D),d-=N.y,l+=N.y,u=d*s,c+=i.width-u}else F(D),F(T),N.x<=0?c>m?(u-=N.x,c+=N.x):N.y<=0&&l<=h&&(v=!1):(u-=N.x,c+=N.x),N.y<=0?l>h&&(d-=N.y,l+=N.y):(d-=N.y,l+=N.y);u<0&&d<0?(o=A,d=-d,u=-u,l-=d,c-=u):u<0?(o=O,u=-u,c-=u):d<0&&(o=j,d=-d,l-=d);break;case j:if(s){if(N.x<=0&&(c<=m||p>=_)){v=!1;break}F(T),u-=N.x,c+=N.x,d=u/s}else F(E),F(T),N.x<=0?c>m?(u-=N.x,c+=N.x):N.y>=0&&p>=_&&(v=!1):(u-=N.x,c+=N.x),N.y>=0?p<_&&(d+=N.y):d+=N.y;u<0&&d<0?(o=O,d=-d,u=-u,l-=d,c-=u):u<0?(o=A,u=-u,c-=u):d<0&&(o=k,d=-d,l-=d);break;case A:if(s){if(N.x>=0&&(f>=g||p>=_)){v=!1;break}F(w),u+=N.x,d=u/s}else F(E),F(w),N.x>=0?f<g?u+=N.x:N.y>=0&&p>=_&&(v=!1):u+=N.x,N.y>=0?p<_&&(d+=N.y):d+=N.y;u<0&&d<0?(o=k,d=-d,u=-u,l-=d,c-=u):u<0?(o=j,u=-u,c-=u):d<0&&(o=O,d=-d,l-=d);break;case S:this.move(N.x,N.y),v=!1;break;case C:this.zoom(dt(a),e),v=!1;break;case x:if(!N.x||!N.y){v=!1;break}y=ot(this.cropper),c=M.startX-y.left,l=M.startY-y.top,u=i.minWidth,d=i.minHeight,N.x>0?o=N.y>0?A:O:N.x<0&&(c-=u,o=N.y>0?j:k),N.y<0&&(l-=d),this.cropped||(Je(this.cropBox,P),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}v&&(i.width=u,i.height=d,i.left=c,i.top=l,this.action=o,this.renderCropBox()),Be(a,function(e){e.startX=e.endX,e.startY=e.endY})}},kt={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&qe(this.dragBox,te),Je(this.cropBox,P),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ve({},this.initialImageData),this.canvasData=Ve({},this.initialCanvasData),this.cropBoxData=Ve({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ve(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Je(this.dragBox,te),qe(this.cropBox,P)),this},replace:function(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,Be(this.previews,function(t){t.getElementsByTagName(`img`)[0].src=e}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Je(this.cropper,N)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,qe(this.cropper,N)),this},destroy:function(){var e=this.element;return e[y]?(e[y]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,r=n.left,i=n.top;return this.moveTo(Ne(e)?e:r+Number(e),Ne(t)?t:i+Number(t))},moveTo:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,r=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(je(e)&&(n.left=e,r=!0),je(t)&&(n.top=t,r=!0),r&&this.renderCanvas(!0)),this},zoom:function(e,t){var n=this.canvasData;return e=Number(e),e=e<0?1/(1-e):1+e,this.zoomTo(n.width*e/n.naturalWidth,null,t)},zoomTo:function(e,t,n){var r=this.options,i=this.canvasData,a=i.width,o=i.height,s=i.naturalWidth,c=i.naturalHeight;if(e=Number(e),e>=0&&this.ready&&!this.disabled&&r.zoomable){var l=s*e,u=c*e;if(at(this.element,be,{ratio:e,oldRatio:a/s,originalEvent:n})===!1)return this;if(n){var d=this.pointers,f=ot(this.cropper),p=d&&Object.keys(d).length?pt(d):{pageX:n.pageX,pageY:n.pageY};i.left-=(l-a)*((p.pageX-f.left-i.left)/a),i.top-=(u-o)*((p.pageY-f.top-i.top)/o)}else Ie(t)&&je(t.x)&&je(t.y)?(i.left-=(l-a)*((t.x-i.left)/a),i.top-=(u-o)*((t.y-i.top)/o)):(i.left-=(l-a)/2,i.top-=(u-o)/2);i.width=l,i.height=u,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return e=Number(e),je(e)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,je(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(je(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.imageData,r=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(je(e)&&(n.scaleX=e,r=!0),je(t)&&(n.scaleY=t,r=!0),r&&this.renderCanvas(!0,!0)),this},getData:function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.options,n=this.imageData,r=this.canvasData,i=this.cropBoxData,a;if(this.ready&&this.cropped){a={x:i.left-r.left,y:i.top-r.top,width:i.width,height:i.height};var o=n.width/n.naturalWidth;if(Be(a,function(e,t){a[t]=e/o}),e){var s=Math.round(a.y+a.height),c=Math.round(a.x+a.width);a.x=Math.round(a.x),a.y=Math.round(a.y),a.width=c-a.x,a.height=s-a.y}}else a={x:0,y:0,width:0,height:0};return t.rotatable&&(a.rotate=n.rotate||0),t.scalable&&(a.scaleX=n.scaleX||1,a.scaleY=n.scaleY||1),a},setData:function(e){var t=this.options,n=this.imageData,r=this.canvasData,i={};if(this.ready&&!this.disabled&&Ie(e)){var a=!1;t.rotatable&&je(e.rotate)&&e.rotate!==n.rotate&&(n.rotate=e.rotate,a=!0),t.scalable&&(je(e.scaleX)&&e.scaleX!==n.scaleX&&(n.scaleX=e.scaleX,a=!0),je(e.scaleY)&&e.scaleY!==n.scaleY&&(n.scaleY=e.scaleY,a=!0)),a&&this.renderCanvas(!0,!0);var o=n.width/n.naturalWidth;je(e.x)&&(i.left=e.x*o+r.left),je(e.y)&&(i.top=e.y*o+r.top),je(e.width)&&(i.width=e.width*o),je(e.height)&&(i.height=e.height*o),this.setCropBoxData(i)}return this},getContainerData:function(){return this.ready?Ve({},this.containerData):{}},getImageData:function(){return this.sized?Ve({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&Be([`left`,`top`,`width`,`height`,`naturalWidth`,`naturalHeight`],function(n){t[n]=e[n]}),t},setCanvasData:function(e){var t=this.canvasData,n=t.aspectRatio;return this.ready&&!this.disabled&&Ie(e)&&(je(e.left)&&(t.left=e.left),je(e.top)&&(t.top=e.top),je(e.width)?(t.width=e.width,t.height=e.width/n):je(e.height)&&(t.height=e.height,t.width=e.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var e=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(e){var t=this.cropBoxData,n=this.options.aspectRatio,r,i;return this.ready&&this.cropped&&!this.disabled&&Ie(e)&&(je(e.left)&&(t.left=e.left),je(e.top)&&(t.top=e.top),je(e.width)&&e.width!==t.width&&(r=!0,t.width=e.width),je(e.height)&&e.height!==t.height&&(i=!0,t.height=e.height),n&&(r?t.height=t.width/n:i&&(t.width=t.height*n)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,n=gt(this.image,this.imageData,t,e);if(!this.cropped)return n;var r=this.getData(e.rounded),i=r.x,a=r.y,o=r.width,s=r.height,c=n.width/Math.floor(t.naturalWidth);c!==1&&(i*=c,a*=c,o*=c,s*=c);var u=o/s,d=mt({aspectRatio:u,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),f=mt({aspectRatio:u,width:e.minWidth||0,height:e.minHeight||0},`cover`),p=mt({aspectRatio:u,width:e.width||(c===1?o:n.width),height:e.height||(c===1?s:n.height)}),m=p.width,h=p.height;m=Math.min(d.width,Math.max(f.width,m)),h=Math.min(d.height,Math.max(f.height,h));var g=document.createElement(`canvas`),_=g.getContext(`2d`);g.width=Ue(m),g.height=Ue(h),_.fillStyle=e.fillColor||`transparent`,_.fillRect(0,0,m,h);var v=e.imageSmoothingEnabled,y=v===void 0||v,b=e.imageSmoothingQuality;_.imageSmoothingEnabled=y,b&&(_.imageSmoothingQuality=b);var x=n.width,S=n.height,C=i,w=a,T,E,D,O,k,A;C<=-o||C>x?(C=0,T=0,D=0,k=0):C<=0?(D=-C,C=0,T=Math.min(x,o+C),k=T):C<=x&&(D=0,T=Math.min(o,x-C),k=T),T<=0||w<=-s||w>S?(w=0,E=0,O=0,A=0):w<=0?(O=-w,w=0,E=Math.min(S,s+w),A=E):w<=S&&(O=0,E=Math.min(s,S-w),A=E);var j=[C,w,T,E];if(k>0&&A>0){var M=m/o;j.push(D*M,O*M,k*M,A*M)}return _.drawImage.apply(_,[n].concat(l(j.map(function(e){return Math.floor(Ue(e))})))),g},setAspectRatio:function(e){var t=this.options;return!this.disabled&&!Ne(e)&&(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,n=this.dragBox,r=this.face;if(this.ready&&!this.disabled){var i=e===ie,a=t.movable&&e===ae;e=i||a?e:oe,t.dragMode=e,$e(n,ne,e),Ye(n,M,i),Ye(n,I,a),t.cropBoxMovable||($e(r,ne,e),Ye(r,M,i),Ye(r,I,a))}return this}},At=g.Cropper,jt=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a(this,e),!t||!Te.test(t.tagName))throw Error(`The first argument is required and must be an <img> or <canvas> element.`);this.element=t,this.options=Ve({},Oe,Ie(n)&&n),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return s(e,[{key:`init`,value:function(){var e=this.element,t=e.tagName.toLowerCase(),n;if(!e[y]){if(e[y]=this,t===`img`){if(this.isImg=!0,n=e.getAttribute(`src`)||``,this.originalUrl=n,!n)return;n=e.src}else t===`canvas`&&window.HTMLCanvasElement&&(n=e.toDataURL());this.load(n)}}},{key:`load`,value:function(e){var t=this;if(e){this.url=e,this.imageData={};var n=this.element,r=this.options;if(!r.rotatable&&!r.scalable&&(r.checkOrientation=!1),!r.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Ce.test(e)){we.test(e)?this.read(bt(e)):this.clone();return}var i=new XMLHttpRequest,a=this.clone.bind(this);this.reloading=!0,this.xhr=i,i.onabort=a,i.onerror=a,i.ontimeout=a,i.onprogress=function(){i.getResponseHeader(`content-type`)!==xe&&i.abort()},i.onload=function(){t.read(i.response)},i.onloadend=function(){t.reloading=!1,t.xhr=null},r.checkCrossOrigin&&lt(e)&&n.crossOrigin&&(e=R(e)),i.open(`GET`,e,!0),i.responseType=`arraybuffer`,i.withCredentials=n.crossOrigin===`use-credentials`,i.send()}}},{key:`read`,value:function(e){var t=this.options,n=this.imageData,r=St(e),i=0,a=1,o=1;if(r>1){this.url=xt(e,xe);var s=Ct(r);i=s.rotate,a=s.scaleX,o=s.scaleY}t.rotatable&&(n.rotate=i),t.scalable&&(n.scaleX=a,n.scaleY=o),this.clone()}},{key:`clone`,value:function(){var e=this.element,t=this.url,n=e.crossOrigin,r=t;this.options.checkCrossOrigin&&lt(t)&&(n||=`anonymous`,r=R(t)),this.crossOrigin=n,this.crossOriginUrl=r;var i=document.createElement(`img`);n&&(i.crossOrigin=n),i.src=r||t,i.alt=e.alt||`The image to crop`,this.image=i,i.onload=this.start.bind(this),i.onerror=this.stop.bind(this),qe(i,F),e.parentNode.insertBefore(i,e.nextSibling)}},{key:`start`,value:function(){var e=this,t=this.image;t.onload=null,t.onerror=null,this.sizing=!0;var n=g.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(g.navigator.userAgent),r=function(t,n){Ve(e.imageData,{naturalWidth:t,naturalHeight:n,aspectRatio:t/n}),e.initialImageData=Ve({},e.imageData),e.sizing=!1,e.sized=!0,e.build()};if(t.naturalWidth&&!n){r(t.naturalWidth,t.naturalHeight);return}var i=document.createElement(`img`),a=document.body||document.documentElement;this.sizingImage=i,i.onload=function(){r(i.width,i.height),n||a.removeChild(i)},i.src=t.src,n||(i.style.cssText=`left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;`,a.appendChild(i))}},{key:`stop`,value:function(){var e=this.image;e.onload=null,e.onerror=null,e.parentNode.removeChild(e),this.image=null}},{key:`build`,value:function(){if(!(!this.sized||this.ready)){var e=this.element,t=this.options,n=this.image,r=e.parentNode,i=document.createElement(`div`);i.innerHTML=ke;var a=i.querySelector(`.${y}-container`),o=a.querySelector(`.${y}-canvas`),s=a.querySelector(`.${y}-drag-box`),c=a.querySelector(`.${y}-crop-box`),l=c.querySelector(`.${y}-face`);this.container=r,this.cropper=a,this.canvas=o,this.dragBox=s,this.cropBox=c,this.viewBox=a.querySelector(`.${y}-view-box`),this.face=l,o.appendChild(n),qe(e,P),r.insertBefore(a,e.nextSibling),Je(n,F),this.initPreview(),this.bind(),t.initialAspectRatio=Math.max(0,t.initialAspectRatio)||NaN,t.aspectRatio=Math.max(0,t.aspectRatio)||NaN,t.viewMode=Math.max(0,Math.min(3,Math.round(t.viewMode)))||0,qe(c,P),t.guides||qe(c.getElementsByClassName(`${y}-dashed`),P),t.center||qe(c.getElementsByClassName(`${y}-center`),P),t.background&&qe(a,`${y}-bg`),t.highlight||qe(l,ee),t.cropBoxMovable&&(qe(l,I),$e(l,ne,b)),t.cropBoxResizable||(qe(c.getElementsByClassName(`${y}-line`),P),qe(c.getElementsByClassName(`${y}-point`),P)),this.render(),this.ready=!0,this.setDragMode(t.dragMode),t.autoCrop&&this.crop(),this.setData(t.data),Le(t.ready)&&it(e,_e,t.ready,{once:!0}),at(e,_e)}}},{key:`unbuild`,value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var e=this.cropper.parentNode;e&&e.removeChild(this.cropper),Je(this.element,P)}}},{key:`uncreate`,value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:`noConflict`,value:function(){return window.Cropper=At,e}},{key:`setDefaults`,value:function(e){Ve(Oe,Ie(e)&&e)}}])}();return Ve(jt.prototype,wt,Tt,Et,Dt,Ot,kt),jt}))}))()),SK=function(){return SK=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},SK.apply(this,arguments)};function CK(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}var wK=`aspectRatio.autoCrop.autoCropArea.background.center.checkCrossOrigin.checkOrientation.cropBoxMovable.cropBoxResizable.data.dragMode.guides.highlight.initialAspectRatio.minCanvasHeight.minCanvasWidth.minContainerHeight.minContainerWidth.minCropBoxHeight.minCropBoxWidth.modal.movable.preview.responsive.restore.rotatable.scalable.toggleDragModeOnDblclick.viewMode.wheelZoomRatio.zoomOnTouch.zoomOnWheel.zoomable.cropstart.cropmove.cropend.crop.zoom.ready`.split(`.`),TK={opacity:0,maxWidth:`100%`};R.forwardRef((function(e,t){var n=CK(e,[]),r=n.dragMode,i=r===void 0?`crop`:r,a=n.src,o=n.style,s=n.className,c=n.crossOrigin,l=n.scaleX,u=n.scaleY,d=n.enable,f=n.zoomTo,p=n.rotateTo,m=n.alt,h=m===void 0?`picture`:m,g=n.ready,_=n.onInitialized,v=CK(n,[`dragMode`,`src`,`style`,`className`,`crossOrigin`,`scaleX`,`scaleY`,`enable`,`zoomTo`,`rotateTo`,`alt`,`ready`,`onInitialized`]),y={scaleY:u,scaleX:l,enable:d,zoomTo:f,rotateTo:p},b=function(){var e=[...arguments],t=(0,R.useRef)(null);return R.useEffect((function(){e.forEach((function(e){e&&(typeof e==`function`?e(t.current):e.current=t.current)}))}),[e]),t}(t,(0,R.useRef)(null));(0,R.useEffect)((function(){var e;(e=b.current)!=null&&e.cropper&&typeof f==`number`&&b.current.cropper.zoomTo(f)}),[n.zoomTo]),(0,R.useEffect)((function(){var e;(e=b.current)!=null&&e.cropper&&a!==void 0&&b.current.cropper.reset().clear().replace(a)}),[a]),(0,R.useEffect)((function(){if(b.current!==null){var e=new xK.default(b.current,SK(SK({dragMode:i},v),{ready:function(e){e.currentTarget!==null&&function(e,t){t===void 0&&(t={});var n=t.enable,r=n===void 0||n,i=t.scaleX,a=i===void 0?1:i,o=t.scaleY,s=o===void 0?1:o,c=t.zoomTo,l=c===void 0?0:c,u=t.rotateTo;r?e.enable():e.disable(),e.scaleX(a),e.scaleY(s),u!==void 0&&e.rotateTo(u),l>0&&e.zoomTo(l)}(e.currentTarget.cropper,y),g&&g(e)}}));_&&_(e)}return function(){var e;(e=b.current?.cropper)==null||e.destroy()}}),[b]);var x=function(e){return wK.reduce((function(e,t){var n=e,r=t;return n[r],CK(n,[typeof r==`symbol`?r:r+``])}),e)}(SK(SK({},v),{crossOrigin:c,src:a,alt:h}));return R.createElement(`div`,{style:o,className:s},R.createElement(`img`,SK({},x,{style:TK,ref:b})))})),{seconds:`seconds`,minutes:`minutes`}.minutes,R.Component,R.Component,R.Component,R.Component,R.Component;var EK=o((e=>{var t=$g();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),DK=JSON.parse(`[{"id":"light.alerts.close_icon","desc":"closeIconColor","defaultValue":0,"widget":"Alerts"},{"id":"light.alerts.close_icon_hover","desc":"closeIconPressColor","defaultValue":0,"widget":"Alerts"},{"id":"light.button.default.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"light.button.default.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"light.button.vertical.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"light.button.vertical.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"light.button.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Button State vertical, Button State Multi vertical, Button Toggle vertical, Button State, Button State Multi, Button Toggle"},{"id":"light.calendar.border","desc":"calendarBorderColor","defaultValue":4,"widget":"Calendar"},{"id":"light.calendar.background_day","desc":"calendarDayBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.background_other_month","desc":"calendarDayBackgroundOutsideColor","value":"#f7f7f7","widget":"Calendar"},{"id":"light.calendar.button_background","desc":"calendarDayButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.button_background_today","desc":"calendarDayButtonTodayColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.button_hover","desc":"calendarDayButtonRippleEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.button_text","desc":"calendarDayButtonFontColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.button_text_today","desc":"calendarDayButtonTodayFontColor","defaultValue":5,"widget":"Calendar"},{"id":"light.calendar.control_panel_background","desc":"controlButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.control_panel_hover","desc":"controlButtonRippelEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.control_panel_icon","desc":"controlIconColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.control_panel_text","desc":"controlTextColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.header_background","desc":"calendarHeaderBackground","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.header_text","desc":"calendarDayLabelFontColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.header_text_today","desc":"calendarDayLabelTodayFontColor","defaultValue":2,"widget":"Calendar"},{"id":"light.calendar.header_text_past","desc":"calendarDayLabelPreviousFontColor","value":"rgba(0, 0, 0, 0.38)","widget":"Calendar"},{"id":"light.calendar.weeks_background","desc":"calendarWeeksNumbersBackground","value":"#f7f7f7","widget":"Calendar"},{"id":"light.calendar.weeks_text","desc":"calendarWeeksNumbersFontColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.time_axis_background","desc":"calendarTimeAxisBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.time_axis_background_header","desc":"calendarTimeAxisHeaderBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.time_axis_text","desc":"calendarTimeAxisFontColor","defaultValue":2,"widget":"Calendar"},{"id":"light.charts.background","desc":"backgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.background_chart","desc":"chartAreaBackgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.global","desc":"globalColor","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.value","desc":"valuesFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_title","desc":"yAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_values","desc":"yAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_gridlines","desc":"yAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_zeroline","desc":"yAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_title","desc":"xAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_values","desc":"xAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_gridlines","desc":"xAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_zeroline","desc":"xAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.legend","desc":"legendFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.tooltip_background","desc":"tooltipBackgroundColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.tooltip_title","desc":"tooltipTitleFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.tooltip_text","desc":"tooltipBodyFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.bar.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"light.charts.bar.hover_border","desc":"hoverBorderColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"light.charts.pie.value","desc":"valuesFontColor","defaultValue":5,"widget":"Pie Chart"},{"id":"light.charts.pie.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Pie Chart"},{"id":"light.charts.pie.border","desc":"borderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"light.charts.pie.border_hover","desc":"hoverBorderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"light.card.background","desc":"colorBackground","defaultValue":5,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.background_title","desc":"colorTitleSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.background_body","desc":"colorTextSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.title","desc":"colorTitle","defaultValue":2,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.subTitle","desc":"colorSubtitle","defaultValue":1,"widget":"HTML Card"},{"id":"light.card.text","desc":"colorBody","defaultValue":2,"widget":"HTML Card"},{"id":"light.checkbox.on","desc":"colorCheckBox","defaultValue":0,"widget":"Checkbox, List"},{"id":"light.checkbox.border","desc":"colorCheckBoxBorder","defaultValue":3,"widget":"Checkbox"},{"id":"light.checkbox.hover","desc":"colorCheckBoxHover","defaultValue":0,"widget":"Checkbox"},{"id":"light.checkbox.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Checkbox"},{"id":"light.checkbox.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Checkbox"},{"id":"light.checkbox.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Checkbox"},{"id":"light.dialog.button_icon","desc":"imageColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.background","desc":"backgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.header_background","desc":"headerBackgroundColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.header_text","desc":"titleColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.footer_background","desc":"footerBackgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_text","desc":"buttonFontColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_press","desc":"pressColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_icon","desc":"fullscreenCloseIconColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_fullscreen_press","desc":"fullscreenCloseIconPressColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.divider","desc":"dividerColor","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.overlay","desc":"overlayColor","defaultValue":6,"widget":"Dialog, Dialog iFrame"},{"id":"light.button.icon.background_off","desc":"colorBgFalse","defaultValue":7,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"light.button.icon.background_on","desc":"colorBgTrue","defaultValue":7,"widget":"Icon Button Toggle"},{"id":"light.button.icon.pressed","desc":"colorPress","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"light.button.icon.icon_off","desc":"imageColor","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"light.button.icon.icon_on","desc":"imageTrueColor","defaultValue":0,"widget":"Icon Button Toggle"},{"id":"light.button.icon.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"light.button.icon.lock_icon_background","desc":"lockIconBackground","defaultValue":7,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"light.icon_list.header","desc":"headerTextColor","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.background","desc":"containerBackgroundColor","defaultValue":7,"widget":"Icon List"},{"id":"light.icon_list.background_items","desc":"itemBackgroundColor","defaultValue":5,"widget":"Icon List"},{"id":"light.icon_list.text","desc":"labelFontColor","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.text_selected","desc":"labelFontColorSelected","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.subText","desc":"subLabelFontColor","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.subText_selected","desc":"subLabelFontColorSelected","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.value_text","desc":"valueFontColor","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.icon","desc":"listImageColor","defaultValue":0,"widget":"Icon List"},{"id":"light.icon_list.button","desc":"buttonBgColor","defaultValue":7,"widget":"Icon List"},{"id":"light.icon_list.button_hover","desc":"buttonColorPress","defaultValue":0,"widget":"Icon List"},{"id":"light.icon_list.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon List"},{"id":"light.input.text","desc":"inputTextColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.label","desc":"inputLabelColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.label_selected","desc":"inputLabelColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.appendix","desc":"inputAppendixColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.message","desc":"inputMessageColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.counter","desc":"inputCounterColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.border","desc":"inputLayoutBorderColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.border_hover","desc":"inputLayoutBorderColorHover","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.border_selected","desc":"inputLayoutBorderColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.icon_clear","desc":"clearIconColor","defaultValue":0,"widget":"Input, Select, Autocomplete"},{"id":"light.input.icon_collapse","desc":"collapseIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"light.input.menu.background","desc":"listItemBackgroundColor","defaultValue":5,"widget":"Select, Autocomplete"},{"id":"light.input.menu.hover","desc":"listItemBackgroundHoverColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"light.input.menu.selected","desc":"listItemBackgroundSelectedColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"light.input.menu.effect","desc":"listItemRippleEffectColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"light.input.menu.icon","desc":"listIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"light.input.menu.text","desc":"listItemFontColor","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"light.input.menu.subText","desc":"listItemSubFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"light.input.menu.value","desc":"listItemValueFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"light.material_design_icon.color","desc":"mdwIconColor","defaultValue":0,"widget":"Material Design Icon"},{"id":"light.list.background","desc":"listBackground","defaultValue":5,"widget":"List"},{"id":"light.list.header_main","desc":"headerTextColor","defaultValue":2,"widget":"List"},{"id":"light.list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"List"},{"id":"light.list.background_off","desc":"listItemBackground","defaultValue":7,"widget":"List"},{"id":"light.list.background_on","desc":"listItemBackgroundActive","defaultValue":7,"widget":"List"},{"id":"light.list.hover","desc":"colorListItemHover","defaultValue":6,"widget":"List"},{"id":"light.list.selected","desc":"colorListItemSelected","defaultValue":6,"widget":"List"},{"id":"light.list.text","desc":"colorListItemText","defaultValue":2,"widget":"List"},{"id":"light.list.subText","desc":"colorListItemTextSecondary","defaultValue":1,"widget":"List"},{"id":"light.list.text_right","desc":"colorListItemTextRight","defaultValue":2,"widget":"List"},{"id":"light.list.subText_right","desc":"colorListItemTextSecondaryRight","defaultValue":1,"widget":"List"},{"id":"light.list.header","desc":"colorListItemHeaders","defaultValue":1,"widget":"List"},{"id":"light.list.divider","desc":"colorListItemDivider","defaultValue":4,"widget":"List"},{"id":"light.list.icon_off","desc":"listImageColor","defaultValue":0,"widget":"List"},{"id":"light.list.icon_on","desc":"listImageActiveColor","defaultValue":0,"widget":"List"},{"id":"light.progress.track_background","desc":"colorProgressBackground","defaultValue":4,"widget":"Progress, Progress Circular"},{"id":"light.progress.track","desc":"colorProgress","defaultValue":0,"widget":"Progress, Progress Circular"},{"id":"light.progress.text","desc":"textColor","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"light.progress.track_condition1","desc":"colorOne","defaultValue":9,"widget":"Progress, Progress Circular"},{"id":"light.progress.track_condition2","desc":"colorTwo","defaultValue":10,"widget":"Progress, Progress Circular"},{"id":"light.progress.circular_background","desc":"innerColor","defaultValue":7,"widget":"Progress Circular"},{"id":"light.slider.background","desc":"colorSliderBg","defaultValue":7,"widget":"Slider, Slider Round"},{"id":"light.slider.control","desc":"colorThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"light.slider.control_before","desc":"colorBeforeThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"light.slider.control_behind","desc":"colorAfterThumb","defaultValue":4,"widget":"Slider, Slider Round"},{"id":"light.slider.text","desc":"valueLabelColor","defaultValue":2,"widget":"Slider, Slider Round"},{"id":"light.slider.text_prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Slider"},{"id":"light.slider.tick","desc":"tickTextColor","defaultValue":1,"widget":"Slider"},{"id":"light.slider.tick_before","desc":"tickColorBefore","defaultValue":0,"widget":"Slider"},{"id":"light.slider.tick_after","desc":"tickColorAfter","defaultValue":0,"widget":"Slider"},{"id":"light.slider.control_background","desc":"thumbBackgroundColor","defaultValue":0,"widget":"Slider"},{"id":"light.slider.control_text","desc":"thumbFontColor","defaultValue":5,"widget":"Slider"},{"id":"light.switch.on","desc":"colorSwitchTrue","defaultValue":0,"widget":"Switch, List"},{"id":"light.switch.on_hover","desc":"colorSwitchHoverTrue","defaultValue":0,"widget":"Switch, List"},{"id":"light.switch.off","desc":"colorSwitchThumb","defaultValue":5,"widget":"Switch, List"},{"id":"light.switch.off_hover","desc":"colorSwitchHover","defaultValue":0,"widget":"Switch, List"},{"id":"light.switch.track","desc":"colorSwitchTrack","defaultValue":6,"widget":"Switch, List"},{"id":"light.switch.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Switch"},{"id":"light.switch.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Switch"},{"id":"light.switch.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Switch"},{"id":"light.table.background","desc":"colorBackground","defaultValue":5,"widget":"Table"},{"id":"light.table.row_header_background","desc":"colorHeaderRowBackground","defaultValue":5,"widget":"Table"},{"id":"light.table.row_header_text","desc":"colorHeaderRowText","defaultValue":2,"widget":"Table"},{"id":"light.table.row_background","desc":"colorRowBackground","defaultValue":7,"widget":"Table"},{"id":"light.table.row_hover","desc":"colorRowBackgroundHover","defaultValue":4,"widget":"Table"},{"id":"light.table.row_text","desc":"colorRowText","defaultValue":2,"widget":"Table"},{"id":"light.table.border","desc":"borderColor","defaultValue":4,"widget":"Table"},{"id":"light.table.dividers","desc":"dividers","defaultValue":4,"widget":"Table"},{"id":"light.top_app_bar.background","desc":"colorTopAppBarBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.icon","desc":"topAppBarIconColor","value":"#FFFFFF","widget":"Top App Bar"},{"id":"light.top_app_bar.title","desc":"colorTopAppBarTitle","defaultValue":5,"widget":"Top App Bar"},{"id":"light.top_app_bar.menu_background","desc":"colorDrawerBackground","defaultValue":5,"widget":"Top App Bar"},{"id":"light.top_app_bar.header_background","desc":"colorDrawerHeaderBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.header_text","desc":"colorListItemHeaders","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_background","desc":"colorDrawerItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_hover","desc":"colorListItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_selected","desc":"colorListItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_text","desc":"colorListItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon","desc":"iconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon_selected","desc":"iconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_icon","desc":"subIconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_icon_selected","desc":"subIconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_text_selected","desc":"colorListItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_text_disabled","desc":"colorListItemTextDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon_disabled","desc":"colorListItemIconDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"light.top_app_bar.item_divider","desc":"colorListItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon_toggle","desc":"colorSubItemToggleIcon","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_backdrop_background_text_off","desc":"colorDrawerbackdropLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"light.top_app_bar.item_backdrop_background_text_on","desc":"colorDrawerbackdropLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_background_all","desc":"colorDrawerSubBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_background","desc":"colorDrawerSubItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_hover","desc":"colorListSubItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_selected","desc":"colorListSubItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_text","desc":"colorListSubItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_text_selected","desc":"colorListSubItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_divider","desc":"colorListSubItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_backdrop_background_text_off","desc":"colorDrawerbackdropSubLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_backdrop_background_text_on","desc":"colorDrawerbackdropSubLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"light.value.text","desc":"valuesFontColor","defaultValue":2,"widget":"Value"},{"id":"light.value.prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Value"},{"id":"light.value.append","desc":"appendTextColor","defaultValue":2,"widget":"Value"},{"id":"light.value.icon","desc":"imageColor","defaultValue":0,"widget":"Value"},{"id":"light.scripts.adapterStatus.title","desc":"title color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.subTitle","desc":"instance color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.datapoints.desc","desc":"description color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.datapoints.value","desc":"value color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.datapoints.icon","desc":"icon color","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.active","desc":"statusbar: adapter is active","defaultValue":8,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.notActive","desc":"statusbar: adapter is not active","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.notConnected","desc":"statusbar: adapter is notConnected","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.deactivated","desc":"statusbar: adapter is deactivated","value":"#A9A9A9","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.schedule","desc":"statusbar: adapter is from type schedule","value":"#90EE90","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.extension","desc":"statusbar: adapter is from type extension","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.once","desc":"statusbar: adapter is from type once","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.icons.upgradeable","desc":"icon upgradeable","value":"#ec0909","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.icons.logParser.warn","desc":"logParser warn icon","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.icons.logParser.error","desc":"logParser error icon","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.background","desc":"Select: background","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.border","desc":"Select: border","value":"#a1a1a1","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.border_hover","desc":"Select: border hover","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.border_selected","desc":"Select: border selected","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.text","desc":"Select: text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.label","desc":"Select: label text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.icon","desc":"Select: icons","defaultValue":5,"widget":"AdapterStatus [Script]"}]`),OK=JSON.parse(`[{"id":"dark.alerts.close_icon","desc":"closeIconColor","defaultValue":0,"widget":"Alerts"},{"id":"dark.alerts.close_icon_hover","desc":"closeIconPressColor","defaultValue":0,"widget":"Alerts"},{"id":"dark.button.default.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"dark.button.default.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"dark.button.vertical.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"dark.button.vertical.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"dark.button.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Button State vertical, Button State Multi vertical, Button Toggle vertical, Button State, Button State Multi, Button Toggle"},{"id":"dark.calendar.border","desc":"calendarBorderColor","defaultValue":4,"widget":"Calendar"},{"id":"dark.calendar.background_day","desc":"calendarDayBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.background_other_month","desc":"calendarDayBackgroundOutsideColor","value":"#202020","widget":"Calendar"},{"id":"dark.calendar.button_background","desc":"calendarDayButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.button_background_today","desc":"calendarDayButtonTodayColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.button_hover","desc":"calendarDayButtonRippleEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.button_text","desc":"calendarDayButtonFontColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.button_text_today","desc":"calendarDayButtonTodayFontColor","defaultValue":5,"widget":"Calendar"},{"id":"dark.calendar.control_panel_background","desc":"controlButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.control_panel_hover","desc":"controlButtonRippelEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.control_panel_icon","desc":"controlIconColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.control_panel_text","desc":"controlTextColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.header_background","desc":"calendarHeaderBackground","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.header_text","desc":"calendarDayLabelFontColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.header_text_today","desc":"calendarDayLabelTodayFontColor","defaultValue":2,"widget":"Calendar"},{"id":"dark.calendar.header_text_past","desc":"calendarDayLabelPreviousFontColor","value":"rgba(0, 0, 0, 0.38)","widget":"Calendar"},{"id":"dark.calendar.weeks_background","desc":"calendarWeeksNumbersBackground","value":"#202020","widget":"Calendar"},{"id":"dark.calendar.weeks_text","desc":"calendarWeeksNumbersFontColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.time_axis_background","desc":"calendarTimeAxisBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.time_axis_background_header","desc":"calendarTimeAxisHeaderBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.time_axis_text","desc":"calendarTimeAxisFontColor","defaultValue":2,"widget":"Calendar"},{"id":"dark.charts.background","desc":"backgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.background_chart","desc":"chartAreaBackgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.global","desc":"globalColor","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.value","desc":"valuesFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_title","desc":"yAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_values","desc":"yAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_gridlines","desc":"yAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_zeroline","desc":"yAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_title","desc":"xAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_values","desc":"xAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_gridlines","desc":"xAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_zeroline","desc":"xAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.legend","desc":"legendFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.tooltip_background","desc":"tooltipBackgroundColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.tooltip_title","desc":"tooltipTitleFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.tooltip_text","desc":"tooltipBodyFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.bar.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"dark.charts.bar.hover_border","desc":"hoverBorderColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"dark.charts.pie.value","desc":"valuesFontColor","defaultValue":5,"widget":"Pie Chart"},{"id":"dark.charts.pie.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Pie Chart"},{"id":"dark.charts.pie.border","desc":"borderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"dark.charts.pie.border_hover","desc":"hoverBorderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"dark.card.background","desc":"colorBackground","defaultValue":5,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.background_title","desc":"colorTitleSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.background_body","desc":"colorTextSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.title","desc":"colorTitle","defaultValue":2,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.subTitle","desc":"colorSubtitle","defaultValue":1,"widget":"HTML Card"},{"id":"dark.card.text","desc":"colorBody","defaultValue":2,"widget":"HTML Card"},{"id":"dark.checkbox.on","desc":"colorCheckBox","defaultValue":0,"widget":"Checkbox, List"},{"id":"dark.checkbox.border","desc":"colorCheckBoxBorder","defaultValue":3,"widget":"Checkbox"},{"id":"dark.checkbox.hover","desc":"colorCheckBoxHover","defaultValue":0,"widget":"Checkbox"},{"id":"dark.checkbox.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Checkbox"},{"id":"dark.checkbox.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Checkbox"},{"id":"dark.checkbox.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Checkbox"},{"id":"dark.dialog.button_icon","desc":"imageColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.background","desc":"backgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.header_background","desc":"headerBackgroundColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.header_text","desc":"titleColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.footer_background","desc":"footerBackgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_text","desc":"buttonFontColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_press","desc":"pressColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_icon","desc":"fullscreenCloseIconColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_fullscreen_press","desc":"fullscreenCloseIconPressColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.divider","desc":"dividerColor","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.overlay","desc":"overlayColor","defaultValue":3,"widget":"Dialog, Dialog iFrame"},{"id":"dark.button.icon.background_off","desc":"colorBgFalse","defaultValue":7,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"dark.button.icon.background_on","desc":"colorBgTrue","defaultValue":7,"widget":"Icon Button Toggle"},{"id":"dark.button.icon.pressed","desc":"colorPress","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"dark.button.icon.icon_off","desc":"imageColor","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"dark.button.icon.icon_on","desc":"imageTrueColor","defaultValue":0,"widget":"Icon Button Toggle"},{"id":"dark.button.icon.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"dark.button.icon.lock_icon_background","desc":"lockIconBackground","defaultValue":7,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"dark.icon_list.header","desc":"headerTextColor","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.background","desc":"containerBackgroundColor","defaultValue":7,"widget":"Icon List"},{"id":"dark.icon_list.background_items","desc":"itemBackgroundColor","defaultValue":5,"widget":"Icon List"},{"id":"dark.icon_list.text","desc":"labelFontColor","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.text_selected","desc":"labelFontColorSelected","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.subText","desc":"subLabelFontColor","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.subText_selected","desc":"subLabelFontColorSelected","defaultValue":1,"widget":"Icon List"},{"id":"dark.icon_list.value_text","desc":"valueFontColor","defaultValue":1,"widget":"Icon List"},{"id":"dark.icon_list.icon","desc":"listImageColor","defaultValue":0,"widget":"Icon List"},{"id":"dark.icon_list.button","desc":"buttonBgColor","defaultValue":7,"widget":"Icon List"},{"id":"dark.icon_list.button_hover","desc":"buttonColorPress","defaultValue":0,"widget":"Icon List"},{"id":"dark.icon_list.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon List"},{"id":"dark.input.text","desc":"inputTextColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.label","desc":"inputLabelColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.label_selected","desc":"inputLabelColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.appendix","desc":"inputAppendixColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.message","desc":"inputMessageColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.counter","desc":"inputCounterColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.border","desc":"inputLayoutBorderColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.border_hover","desc":"inputLayoutBorderColorHover","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.border_selected","desc":"inputLayoutBorderColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.icon_clear","desc":"clearIconColor","defaultValue":0,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.icon_collapse","desc":"collapseIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.background","desc":"listItemBackgroundColor","defaultValue":5,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.hover","desc":"listItemBackgroundHoverColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.selected","desc":"listItemBackgroundSelectedColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.effect","desc":"listItemRippleEffectColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.icon","desc":"listIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.text","desc":"listItemFontColor","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.subText","desc":"listItemSubFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.value","desc":"listItemValueFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"dark.material_design_icon.color","desc":"mdwIconColor","defaultValue":0,"widget":"Material Design Icon"},{"id":"dark.list.background","desc":"listBackground","defaultValue":5,"widget":"List"},{"id":"dark.list.header_main","desc":"headerTextColor","defaultValue":2,"widget":"List"},{"id":"dark.list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"List"},{"id":"dark.list.background_off","desc":"listItemBackground","defaultValue":7,"widget":"List"},{"id":"dark.list.background_on","desc":"listItemBackgroundActive","defaultValue":7,"widget":"List"},{"id":"dark.list.hover","desc":"colorListItemHover","defaultValue":6,"widget":"List"},{"id":"dark.list.selected","desc":"colorListItemSelected","defaultValue":6,"widget":"List"},{"id":"dark.list.text","desc":"colorListItemText","defaultValue":2,"widget":"List"},{"id":"dark.list.subText","desc":"colorListItemTextSecondary","defaultValue":1,"widget":"List"},{"id":"dark.list.text_right","desc":"colorListItemTextRight","defaultValue":2,"widget":"List"},{"id":"dark.list.subText_right","desc":"colorListItemTextSecondaryRight","defaultValue":1,"widget":"List"},{"id":"dark.list.header","desc":"colorListItemHeaders","defaultValue":1,"widget":"List"},{"id":"dark.list.divider","desc":"colorListItemDivider","defaultValue":4,"widget":"List"},{"id":"dark.list.icon_off","desc":"listImageColor","defaultValue":0,"widget":"List"},{"id":"dark.list.icon_on","desc":"listImageActiveColor","defaultValue":0,"widget":"List"},{"id":"dark.progress.track_background","desc":"colorProgressBackground","defaultValue":4,"widget":"Progress, Progress Circular"},{"id":"dark.progress.track","desc":"colorProgress","defaultValue":0,"widget":"Progress, Progress Circular"},{"id":"dark.progress.text","desc":"textColor","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"dark.progress.track_condition1","desc":"colorOne","defaultValue":9,"widget":"Progress, Progress Circular"},{"id":"dark.progress.track_condition2","desc":"colorTwo","defaultValue":10,"widget":"Progress, Progress Circular"},{"id":"dark.progress.circular_background","desc":"innerColor","defaultValue":7,"widget":"Progress Circular"},{"id":"dark.slider.background","desc":"colorSliderBg","defaultValue":7,"widget":"Slider, Slider Round"},{"id":"dark.slider.control","desc":"colorThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"dark.slider.control_before","desc":"colorBeforeThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"dark.slider.control_behind","desc":"colorAfterThumb","defaultValue":4,"widget":"Slider, Slider Round"},{"id":"dark.slider.text","desc":"valueLabelColor","defaultValue":2,"widget":"Slider, Slider Round"},{"id":"dark.slider.text_prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Slider"},{"id":"dark.slider.tick","desc":"tickTextColor","defaultValue":1,"widget":"Slider"},{"id":"dark.slider.tick_before","desc":"tickColorBefore","defaultValue":0,"widget":"Slider"},{"id":"dark.slider.tick_after","desc":"tickColorAfter","defaultValue":0,"widget":"Slider"},{"id":"dark.slider.control_background","desc":"thumbBackgroundColor","defaultValue":0,"widget":"Slider"},{"id":"dark.slider.control_text","desc":"thumbFontColor","defaultValue":5,"widget":"Slider"},{"id":"dark.switch.on","desc":"colorSwitchTrue","defaultValue":0,"widget":"Switch, List"},{"id":"dark.switch.on_hover","desc":"colorSwitchHoverTrue","defaultValue":0,"widget":"Switch, List"},{"id":"dark.switch.off","desc":"colorSwitchThumb","defaultValue":5,"widget":"Switch, List"},{"id":"dark.switch.off_hover","desc":"colorSwitchHover","defaultValue":0,"widget":"Switch, List"},{"id":"dark.switch.track","desc":"colorSwitchTrack","defaultValue":6,"widget":"Switch, List"},{"id":"dark.switch.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Switch"},{"id":"dark.switch.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Switch"},{"id":"dark.switch.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Switch"},{"id":"dark.table.background","desc":"colorBackground","defaultValue":5,"widget":"Table"},{"id":"dark.table.row_header_background","desc":"colorHeaderRowBackground","defaultValue":5,"widget":"Table"},{"id":"dark.table.row_header_text","desc":"colorHeaderRowText","defaultValue":2,"widget":"Table"},{"id":"dark.table.row_background","desc":"colorRowBackground","defaultValue":7,"widget":"Table"},{"id":"dark.table.row_hover","desc":"colorRowBackgroundHover","defaultValue":4,"widget":"Table"},{"id":"dark.table.row_text","desc":"colorRowText","defaultValue":2,"widget":"Table"},{"id":"dark.table.border","desc":"borderColor","defaultValue":4,"widget":"Table"},{"id":"dark.table.dividers","desc":"dividers","defaultValue":4,"widget":"Table"},{"id":"dark.top_app_bar.background","desc":"colorTopAppBarBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.icon","desc":"topAppBarIconColor","value":"#FFFFFF","widget":"Top App Bar"},{"id":"dark.top_app_bar.title","desc":"colorTopAppBarTitle","defaultValue":5,"widget":"Top App Bar"},{"id":"dark.top_app_bar.menu_background","desc":"colorDrawerBackground","defaultValue":5,"widget":"Top App Bar"},{"id":"dark.top_app_bar.header_background","desc":"colorDrawerHeaderBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.header_text","desc":"colorListItemHeaders","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_background","desc":"colorDrawerItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_hover","desc":"colorListItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_selected","desc":"colorListItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_text","desc":"colorListItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon","desc":"iconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon_selected","desc":"iconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_icon","desc":"subIconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_icon_selected","desc":"subIconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_text_selected","desc":"colorListItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_text_disabled","desc":"colorListItemTextDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon_disabled","desc":"colorListItemIconDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"dark.top_app_bar.item_divider","desc":"colorListItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon_toggle","desc":"colorSubItemToggleIcon","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_backdrop_background_text_off","desc":"colorDrawerbackdropLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"dark.top_app_bar.item_backdrop_background_text_on","desc":"colorDrawerbackdropLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_background_all","desc":"colorDrawerSubBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_background","desc":"colorDrawerSubItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_hover","desc":"colorListSubItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_selected","desc":"colorListSubItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_text","desc":"colorListSubItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_text_selected","desc":"colorListSubItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_divider","desc":"colorListSubItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_backdrop_background_text_off","desc":"colorDrawerbackdropSubLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_backdrop_background_text_on","desc":"colorDrawerbackdropSubLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"dark.value.text","desc":"valuesFontColor","defaultValue":2,"widget":"Value"},{"id":"dark.value.prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Value"},{"id":"dark.value.append","desc":"appendTextColor","defaultValue":2,"widget":"Value"},{"id":"dark.value.icon","desc":"imageColor","defaultValue":0,"widget":"Value"},{"id":"dark.scripts.adapterStatus.title","desc":"title color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.subTitle","desc":"instance color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.datapoints.desc","desc":"description color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.datapoints.value","desc":"value color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.datapoints.icon","desc":"icon color","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.active","desc":"statusbar: adapter is active","defaultValue":8,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.notActive","desc":"statusbar: adapter is not active","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.notConnected","desc":"statusbar: adapter is notConnected","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.deactivated","desc":"statusbar: adapter is deactivated","value":"#A9A9A9","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.schedule","desc":"statusbar: adapter is from type schedule","value":"#90EE90","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.extension","desc":"statusbar: adapter is from type extension","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.once","desc":"statusbar: adapter is from type once","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.icons.upgradeable","desc":"icon upgradeable","value":"#ec0909","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.icons.logParser.warn","desc":"logParser warn icon","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.icons.logParser.error","desc":"logParser error icon","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.background","desc":"Select: background","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.border","desc":"Select: border","value":"#a1a1a1","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.border_hover","desc":"Select: border hover","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.border_selected","desc":"Select: border selected","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.text","desc":"Select: text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.label","desc":"Select: label text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.icon","desc":"Select: icons","defaultValue":5,"widget":"AdapterStatus [Script]"}]`),kK=[`#44739e`,`#808080`,`#44739e`,`rgba(0, 0, 0, 0.54)`,`rgba(161, 161, 161, 0.26)`,`#FFFFFF`,`#000000`,`rgba(0, 0, 0, 0)`,`#008000`,`#FFD700`,`#B22222`,`#FFA500`,`#303030`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`],AK=[`#44739e`,`#FFFFFF9C`,`#FFFFFF`,`rgba(0, 0, 0, 0.54)`,`#9E9E9E`,`#303030`,`#BDBDBD`,`rgba(0, 0, 0, 0)`,`#008000`,`#FFD700`,`#B22222`,`#FFA500`,`#303030`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`],jK=[10,12,14,16,20,22,24,30,32,36,40,60],MK=[`RobotoCondensed-Regular`,`RobotoCondensed-Italic`,`RobotoCondensed-Light`,`RobotoCondensed-LightItalic`,`RobotoCondensed-Bold`,`RobotoCondensed-BoldItalic`,`Arial`,`Verdana`,`Times New Roman`,`Jura-Regular`,`Jura-Medium`,`Jura-Light`],NK=JSON.parse(`[{"id":"alerts.text","desc":"alertFontSize","defaultValue":3,"widget":"Alerts"},{"id":"button.default.text","desc":"textFontSize","defaultValue":2,"widget":"Buttons, Dialog, Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog iFrame"},{"id":"button.vertical.text","desc":"textFontSize","defaultValue":3,"widget":"Buttons, Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"calendar.control","desc":"controlTextSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.header","desc":"calendarDayLabelFontSize","defaultValue":1,"widget":"Calendar"},{"id":"calendar.today","desc":"calendarDayLabelTodayFontSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.weeks","desc":"calendarWeeksNumbersFontSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.button","desc":"calendarDayButtonFontSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.button_today","desc":"calendarDayButtonTodayFontSize","defaultValue":3,"widget":"Calendar"},{"id":"calendar.event","desc":"calendarEventFontSize","defaultValue":1,"widget":"Calendar"},{"id":"calendar.time_axis","desc":"calendarTimeAxisFontSize","defaultValue":2,"widget":"Calendar"},{"id":"charts.value","desc":"valuesFontSize","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_title","desc":"yAxisTitleFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_values","desc":"yAxisValueFontSize","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_title","desc":"xAxisTitleFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_values","desc":"xAxisValueFontSize","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.legend","desc":"legendFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_title","desc":"tooltipTitleFontSize","defaultValue":4,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_text","desc":"tooltipBodyFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.title","desc":"titleLayout","defaultValue":6,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.subTitle","desc":"subtitleLayout","defaultValue":2,"widget":"HTML Card"},{"id":"card.text","desc":"textFontSize","defaultValue":3,"widget":"HTML Card"},{"id":"checkbox.value","desc":"valueFontSize","defaultValue":3,"widget":"Checkbox"},{"id":"dialog.title","desc":"titleFontSize","defaultValue":7,"widget":"Dialog, Dialog iFrame"},{"id":"dialog.button","desc":"buttonFontSize","defaultValue":3,"widget":"Dialog, Dialog iFrame"},{"id":"icon_list.header","desc":"headerTextSize","defaultValue":4,"widget":"Icon List"},{"id":"icon_list.text","desc":"labelFontSize","defaultValue":3,"widget":"Icon List"},{"id":"icon_list.subText","desc":"subLabelFontSize","defaultValue":2,"widget":"Icon List"},{"id":"icon_list.value","desc":"valueFontSize","defaultValue":1,"widget":"Icon List"},{"id":"input.text","desc":"inputTextFontSize","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.label","desc":"inputLabelFontSize","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.appendix","desc":"inputAppendixFontSize","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.message","desc":"inputMessageFontSize","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.counter","desc":"inputCounterFontSize","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.dropdown.text","desc":"listItemFontSize","defaultValue":3,"widget":"Select, Autocomplete"},{"id":"input.dropdown.subText","desc":"listItemSubFontSize","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"input.dropdown.value","desc":"listItemValueFontSize","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"list.header_main","desc":"headerTextSize","defaultValue":4,"widget":"List"},{"id":"list.header","desc":"listItemHeaderTextSize","defaultValue":4,"widget":"List"},{"id":"list.text","desc":"listItemTextSize","defaultValue":3,"widget":"List"},{"id":"list.subText","desc":"listItemSubTextSize","defaultValue":2,"widget":"List"},{"id":"list.text_right","desc":"listItemTextRightSize","defaultValue":3,"widget":"List"},{"id":"list.subText_right","desc":"listItemSubTextRightSize","defaultValue":2,"widget":"List"},{"id":"progress.text","desc":"textFontSize","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"slider.prepand","desc":"prepandTextFontSize","defaultValue":3,"widget":"Slider"},{"id":"slider.control","desc":"thumbFontSize","defaultValue":2,"widget":"Slider"},{"id":"slider.value","desc":"valueFontSize","defaultValue":3,"widget":"Slider, Slider Round"},{"id":"slider.ticks","desc":"tickFontSize","defaultValue":2,"widget":"Slider"},{"id":"switch.value","desc":"valueFontSize","defaultValue":3,"widget":"Switch"},{"id":"table.header","desc":"headerTextSize","defaultValue":4,"widget":"Table"},{"id":"table.row","desc":"colTextSize","defaultValue":3,"widget":"Table"},{"id":"top_app_bar.title","desc":"titleFontSize","defaultValue":4,"widget":"Top App Bar"},{"id":"top_app_bar.header","desc":"listItemHeaderTextSize","defaultValue":2,"widget":"Top App Bar"},{"id":"top_app_bar.item","desc":"listItemTextSize","defaultValue":2,"widget":"Top App Bar"},{"id":"top_app_bar.subItem","desc":"listSubItemTextSize","defaultValue":2,"widget":"Top App Bar"},{"id":"value.text","desc":"valuesFontSize","defaultValue":2,"widget":"Value"},{"id":"value.prepand","desc":"prepandTextFontSize","defaultValue":2,"widget":"Value"},{"id":"value.append","desc":"appendTextFontSize","defaultValue":2,"widget":"Value"},{"id":"scripts.adapterStatus.title","desc":"title text size","defaultValue":4,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.subTitle","desc":"instance text size","defaultValue":3,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.desc","desc":"description text size","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.value","desc":"value text size","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.icons.upgradeable","desc":"upgradeable icon size","defaultValue":7,"widget":"AdapterStatus [Script]"}]`),PK=JSON.parse(`[{"id":"alerts.text","desc":"alertFontFamily","defaultValue":0,"widget":"Alerts"},{"id":"button.default.text","desc":"textFontFamily","defaultValue":0,"widget":"Buttons, Dialog, Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog iFrame"},{"id":"button.vertical.text","desc":"textFontFamily","defaultValue":0,"widget":"Buttons, Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"calendar.control","desc":"controlTextFont","defaultValue":0,"widget":"Calendar"},{"id":"calendar.header","desc":"calendarDayLabelFontFamily","defaultValue":0,"widget":"Calendar"},{"id":"calendar.today","desc":"calendarDayLabelTodayFontFamily","defaultValue":4,"widget":"Calendar"},{"id":"calendar.weeks","desc":"calendarWeeksNumbersFont","defaultValue":3,"widget":"Calendar"},{"id":"calendar.button","desc":"calendarDayButtonFontFamily","defaultValue":2,"widget":"Calendar"},{"id":"calendar.button_today","desc":"calendarDayButtonTodayFontFamily","defaultValue":4,"widget":"Calendar"},{"id":"calendar.event","desc":"calendarEventFont","defaultValue":2,"widget":"Calendar"},{"id":"calendar.time_axis","desc":"calendarTimeAxisFont","defaultValue":3,"widget":"Calendar"},{"id":"charts.value","desc":"valuesFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_title","desc":"yAxisTitleFontFamily","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_values","desc":"yAxisValueFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_title","desc":"xAxisTitleFontFamily","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_values","desc":"xAxisValueFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.legend","desc":"legendFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_title","desc":"tooltipTitleFontFamily","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_text","desc":"tooltipBodyFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.title","desc":"titleFontFamily","defaultValue":0,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.subTitle","desc":"subTitleFontFamily","defaultValue":3,"widget":"HTML Card"},{"id":"card.text","desc":"textFontFamily","defaultValue":0,"widget":"HTML Card"},{"id":"checkbox.value","desc":"valueFontFamily","defaultValue":0,"widget":"Checkbox"},{"id":"dialog.title","desc":"titleFont","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"dialog.button","desc":"buttonFont","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"icon_list.header","desc":"headerFontFamily","defaultValue":9,"widget":"Icon List"},{"id":"icon_list.text","desc":"labelFontFamily","defaultValue":0,"widget":"Icon List"},{"id":"icon_list.subText","desc":"subLabelFontFamily","defaultValue":2,"widget":"Icon List"},{"id":"icon_list.value","desc":"valueFontFamily","defaultValue":3,"widget":"Icon List"},{"id":"input.text","desc":"inputTextFontFamily","defaultValue":0,"widget":"Input, Select, Autocomplete"},{"id":"input.label","desc":"inputLabelFontFamily","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.appendix","desc":"inputAppendixFontFamily","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.message","desc":"inputMessageFontFamily","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.counter","desc":"inputCounterFontFamily","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.dropdown.text","desc":"listItemFont","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"input.dropdown.subText","desc":"listItemSubFont","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"input.dropdown.value","desc":"listItemValueFont","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"list.header_main","desc":"headerFontFamily","defaultValue":9,"widget":"List"},{"id":"list.header","desc":"headerFontFamily","defaultValue":0,"widget":"List"},{"id":"list.text","desc":"listItemFont","defaultValue":0,"widget":"List"},{"id":"list.subText","desc":"listItemSubFont","defaultValue":3,"widget":"List"},{"id":"list.text_right","desc":"listItemRightFont","defaultValue":2,"widget":"List"},{"id":"list.subText_right","desc":"listItemSubRightFont","defaultValue":3,"widget":"List"},{"id":"progress.text","desc":"textFontFamily","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"slider.prepand","desc":"prepandTextFontFamily","defaultValue":0,"widget":"Slider"},{"id":"slider.control","desc":"thumbFontFamily","defaultValue":2,"widget":"Slider"},{"id":"slider.value","desc":"valueFontFamily","defaultValue":2,"widget":"Slider, Slider Round"},{"id":"slider.ticks","desc":"tickFontFamily","defaultValue":3,"widget":"Slider"},{"id":"switch.value","desc":"valueFontFamily","defaultValue":0,"widget":"Switch"},{"id":"table.header","desc":"headerFontFamily","defaultValue":0,"widget":"Table"},{"id":"table.row","desc":"fontFamily","defaultValue":0,"widget":"Table"},{"id":"top_app_bar.title","desc":"titleFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.header","desc":"listItemHeaderFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.item","desc":"listItemTextFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.item_disabled","desc":"listItemTextFontDisabled","defaultValue":3,"widget":"Top App Bar"},{"id":"top_app_bar.subItem","desc":"listItemSubTextFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.subItem_disabled","desc":"listItemSubTextFontDisabled","defaultValue":3,"widget":"Top App Bar"},{"id":"value.text","desc":"valuesFontFamily","defaultValue":0,"widget":"Value"},{"id":"value.prepand","desc":"prepandTextFontFamily","defaultValue":0,"widget":"Value"},{"id":"value.append","desc":"appendTextFontFamily","defaultValue":0,"widget":"Value"},{"id":"scripts.adapterStatus.title","desc":"title text font","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.subTitle","desc":"instance text font","defaultValue":3,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.desc","desc":"description text font","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.value","desc":"value text font","defaultValue":2,"widget":"AdapterStatus [Script]"}]`),FK=`modulepreload`,IK=function(e,t){return new URL(e,t).href},LK={},RK=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=IK(t,n),t=s(t),t in LK)return;LK[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:FK,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},zK=[`de`,`en`,`es`,`fr`,`it`,`nl`,`pl`,`pt`,`ru`,`uk`,`zh-cn`],BK={};async function VK(e){let t=zK.includes(e)?e:`en`;if(!BK[t])try{let e=await l(Object.assign({"../../admin/i18n/de.json":()=>RK(()=>import(`./de.js`),[],import.meta.url),"../../admin/i18n/en.json":()=>RK(()=>import(`./en.js`),[],import.meta.url),"../../admin/i18n/es.json":()=>RK(()=>import(`./es.js`),[],import.meta.url),"../../admin/i18n/fr.json":()=>RK(()=>import(`./fr.js`),[],import.meta.url),"../../admin/i18n/it.json":()=>RK(()=>import(`./it.js`),[],import.meta.url),"../../admin/i18n/nl.json":()=>RK(()=>import(`./nl.js`),[],import.meta.url),"../../admin/i18n/pl.json":()=>RK(()=>import(`./pl.js`),[],import.meta.url),"../../admin/i18n/pt.json":()=>RK(()=>import(`./pt.js`),[],import.meta.url),"../../admin/i18n/ru.json":()=>RK(()=>import(`./ru.js`),[],import.meta.url),"../../admin/i18n/uk.json":()=>RK(()=>import(`./uk.js`),[],import.meta.url),"../../admin/i18n/zh-cn.json":()=>RK(()=>import(`./zh-cn.js`),[],import.meta.url)}),`../../admin/i18n/${t}.json`,5);BK[t]=e.default??e}catch{}}var HK={colors:{entries:DK,defaults:kK,title:`default light colors`,widgetTitle:`Widget colors`},colorsDark:{entries:OK,defaults:AK,title:`default dark colors`,widgetTitle:`Widget colors`},fonts:{entries:PK,defaults:MK,title:`config_fonts`,widgetTitle:`Widget fonts`},fontSizes:{entries:NK,defaults:jK,title:`config_fontSizes`,widgetTitle:`Widget font sizes`}},UK=e=>zk.t(e);function WK(e){return`default${e}`}function GK(e,t){let n=HK[t].defaults,r=e[WK(t)];return Array.isArray(r)?n.map((e,t)=>r[t]??e):[...n]}function KK(e,t,n){let r=Array.isArray(e[t])?e[t]:[];return HK[t].entries.map(e=>{let t=r.find(t=>t.id===e.id),i=t?.defaultValue,a=i===``?NaN:Number(i),o=Number.isInteger(a)&&a>=0&&a<n.length?a:t?void 0:e.defaultValue;return{...e,...t,defaultValue:o,value:t?.value??e.value??n[o??0]}})}function qK(e){let[t,n]=(0,R.useState)(0),[r,i]=(0,R.useState)(``),a=[`colors`,`colorsDark`,`fonts`,`fontSizes`][t],o=HK[a],s=GK(e.config,a),c=KK(e.config,a,s),l=(0,R.useMemo)(()=>c.filter(e=>e.widget.toLowerCase().includes(r.toLowerCase())),[c,r]),u=t=>e.update(WK(a),t),d=t=>e.update(a,t);return(0,z.jsxs)(_x,{sx:{p:1,py:2},children:[(0,z.jsxs)(lO,{value:t,onChange:(e,t)=>{n(t),i(``)},sx:{borderBottom:1,borderColor:`divider`},variant:`scrollable`,scrollButtons:`auto`,children:[(0,z.jsx)(tD,{label:UK(`config_colors`)}),(0,z.jsx)(tD,{label:UK(`config_colorsDark`)}),(0,z.jsx)(tD,{label:UK(`config_fonts`)}),(0,z.jsx)(tD,{label:UK(`config_fontSizes`)})]}),(0,z.jsx)(Gx,{sx:{mt:2},children:(0,z.jsxs)(Yx,{children:[(0,z.jsxs)(_x,{sx:{display:`flex`,alignItems:`center`,gap:2,mb:2},children:[(0,z.jsx)(vv,{variant:`h6`,children:UK(o.title)}),(0,z.jsx)(Vx,{sx:{ml:`auto`},onClick:()=>{u([...o.defaults]),d(KK({[a]:[]},a,[...o.defaults]))},children:UK(`reset`)})]}),(0,z.jsx)(_x,{sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(210px, 1fr))`,gap:2},children:s.map((e,t)=>(0,z.jsxs)(_x,{sx:{alignItems:`center`,display:`flex`,gap:1},children:[a.startsWith(`colors`)&&(0,z.jsx)(_x,{"aria-label":String(e),sx:{backgroundColor:String(e),border:1,borderColor:`divider`,borderRadius:.5,flex:`0 0 auto`,height:28,width:28}}),a===`fonts`&&(0,z.jsx)(vv,{sx:{flex:`0 0 auto`,fontFamily:String(e),fontSize:22,minWidth:32},children:`Aa`}),a===`fontSizes`&&(0,z.jsx)(vv,{sx:{flex:`0 0 auto`,fontSize:`${Number(e)||14}px`,minWidth:32},children:`Aa`}),(0,z.jsx)(mO,{fullWidth:!0,label:`${UK(`${a}Default`)} ${t}`,type:a===`fontSizes`?`number`:`text`,value:e,variant:`standard`,onChange:e=>{let n=[...s];n[t]=a===`fontSizes`?Number(e.target.value):e.target.value,u(n)}})]},t))})]})}),(0,z.jsx)(Gx,{sx:{mt:2},children:(0,z.jsxs)(Yx,{children:[(0,z.jsxs)(_x,{sx:{display:`flex`,gap:2,alignItems:`center`,mb:2,flexWrap:`wrap`},children:[(0,z.jsx)(vv,{variant:`h6`,children:UK(o.widgetTitle)}),(0,z.jsx)(mO,{label:UK(`Filter Widgets`),value:r,onChange:e=>i(e.target.value),variant:`standard`,sx:{ml:`auto`,minWidth:220}})]}),(0,z.jsx)(CD,{component:T_,variant:`outlined`,children:(0,z.jsxs)(sD,{size:`small`,children:[(0,z.jsx)(kD,{children:(0,z.jsxs)(VD,{children:[(0,z.jsx)(yD,{children:UK(`Widget`)}),(0,z.jsx)(yD,{children:UK(`description`)}),(0,z.jsx)(yD,{children:UK(`${a}_table`)}),(0,z.jsx)(yD,{children:UK(`${a}Default`)})]})}),(0,z.jsx)(mD,{children:l.map(e=>(0,z.jsxs)(VD,{children:[(0,z.jsx)(yD,{children:e.widget}),(0,z.jsx)(yD,{children:UK(e.desc)}),(0,z.jsx)(yD,{children:(0,z.jsxs)(_x,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[a.startsWith(`colors`)&&(0,z.jsx)(_x,{"aria-label":String(e.value??``),sx:{backgroundColor:String(e.value??`transparent`),border:1,borderColor:`divider`,borderRadius:.5,flex:`0 0 auto`,height:24,width:24}}),(0,z.jsx)(mO,{fullWidth:!0,type:a===`fontSizes`?`number`:`text`,value:e.value??``,variant:`standard`,onChange:t=>d(c.map(n=>n.id===e.id?{...n,value:a===`fontSizes`?Number(t.target.value):t.target.value,defaultValue:void 0}:n))})]})}),(0,z.jsx)(yD,{children:(0,z.jsx)(_x,{sx:{display:`flex`,gap:.5,flexWrap:`wrap`},children:s.map((t,n)=>(0,z.jsx)(Vx,{size:`small`,variant:e.defaultValue===n?`contained`:`outlined`,onClick:()=>d(c.map(t=>t.id===e.id?{...t,defaultValue:n,value:s[n]}:t)),children:n},n))})})]},e.id))})]})})]})})]})}function JK(e){let[t,n]=(0,R.useState)(0);return(0,z.jsxs)(_x,{component:`main`,sx:{height:{xs:`calc(100% - 56px)`,sm:`calc(100% - 64px)`},overflowY:`auto`},children:[(0,z.jsxs)(_x,{sx:{minHeight:72,position:`relative`,px:1,py:1},children:[(0,z.jsx)(fG,{common:e.common,instance:e.instance,native:e.config,onError:e.onError,onLoad:e.onLoad}),(0,z.jsx)(vv,{component:`h1`,variant:`h6`,sx:{fontWeight:700,position:`absolute`,top:18,left:84},children:`Material Design Widgets`})]}),(0,z.jsxs)(lO,{value:t,onChange:(e,t)=>n(t),sx:{borderBottom:1,borderColor:`divider`},children:[(0,z.jsx)(tD,{icon:(0,z.jsx)(sk,{}),iconPosition:`start`,label:UK(`config_general`)}),(0,z.jsx)(tD,{icon:(0,z.jsx)(ek,{}),iconPosition:`start`,label:UK(`Theme Editor for your Widgets`)})]}),t===0?(0,z.jsxs)(_x,{sx:{p:1,py:2,display:`grid`,gap:2},children:[(0,z.jsx)(Gx,{children:(0,z.jsxs)(Yx,{children:[(0,z.jsx)(vv,{variant:`h6`,gutterBottom:!0,children:UK(`Generate global script`)}),(0,z.jsx)(mO,{fullWidth:!0,label:UK(`script name`),value:String(e.config.scriptName??`Theme`),variant:`standard`,onChange:t=>e.update(`scriptName`,t.target.value)}),(0,z.jsx)(mO,{fullWidth:!0,label:UK(`name of the variable`),value:String(e.config.variableName??`myMdwTheme`),sx:{mt:2},variant:`standard`,onChange:t=>e.update(`variableName`,t.target.value)}),(0,z.jsx)(mO,{fullWidth:!0,label:UK(`SelectJavascriptInstance`),value:String(e.config.javascriptInstance??``),sx:{mt:2},variant:`standard`,onChange:t=>e.update(`javascriptInstance`,t.target.value)}),(0,z.jsx)(Vx,{variant:`contained`,sx:{mt:2},onClick:e.onGenerate,children:UK(`generate script`)})]})}),(0,z.jsx)(Gx,{children:(0,z.jsxs)(Yx,{children:[(0,z.jsx)(vv,{variant:`h6`,children:UK(`Sentry - automatic error reporting`)}),(0,z.jsxs)(WC,{sx:{pt:1},children:[(0,z.jsx)(BC,{control:(0,z.jsx)(dS,{checked:e.config.sentryReport===!0,onChange:t=>e.update(`sentryReport`,t.target.checked)}),label:UK(`send Widget error reports`)}),(0,z.jsx)(XC,{sx:{ml:4,mt:-.5},children:UK(`sentryInfo`)})]})]})})]}):(0,z.jsx)(qK,{config:e.config,update:e.update})]})}var YK=class extends $k{constructor(e){super(e,{adapterName:`vis2-materialdesign`,bottomButtons:!0,translations:BK})}onPrepareLoad(e){super.onPrepareLoad(e),[`colors`,`colorsDark`,`fonts`,`fontSizes`].forEach(t=>{let n=GK(e,t);e[WK(t)]=n,e[t]=KK(e,t,n)})}async setThemeState(e,t,n){let r=typeof n==`number`?`number`:`string`,i=await this.socket.getObject(e);i?i.common.name!==t&&await this.socket.setObject(e,{...i,common:{...i.common,name:t,desc:t}}):await this.socket.setObject(e,{type:`state`,common:{name:t,desc:t,type:r,read:!0,write:!1,role:`value`},native:{}}),await this.socket.setState(e,n,!0)}async syncRuntimeStates(){let e=this.state.native,t=`${this.adapterName}.${this.instance}`;await this.socket.setState(`${t}.sentry`,e.sentryReport===!0,!0);for(let n of[`colors`,`colorsDark`,`fonts`,`fontSizes`]){let r=GK(e,n),i=KK(e,n,r);for(let[e,i]of r.entries()){let r=n===`colors`?`${t}.colors.light.default_${e}`:n===`colorsDark`?`${t}.colors.dark.default_${e}`:`${t}.${n}.default_${e}`;await this.setThemeState(r,`${UK(`${n}Default`)} ${e}`,i)}for(let e of i){let r=n.startsWith(`colors`)?`${t}.colors.${e.id}`:`${t}.${n}.${e.id}`;await this.setThemeState(r,UK(e.desc),e.value??``)}}await this.socket.setState(`${t}.lastchange`,Date.now(),!0)}async generateGlobalScript(){let e=this.state.native,t=String(e.javascriptInstance??``),n=String(e.variableName??`myMdwTheme`);if(!t||!/^[A-Za-z_$][\w$]*$/.test(n)){this.showAlert(UK(`SelectJavascriptInstance`),`warning`);return}let r=`${this.adapterName}.${this.instance}`,i=await this.socket.getObjectView(`${r}.`,`${r}.\u9999`,`state`),a=[`var ${n} = {};`],o=new Set;Object.keys(i).filter(e=>e!==`${r}.colors.darkTheme`).sort().forEach(e=>{let t=n;e.substring(r.length+1).split(`.`).forEach(e=>{t+=`.${e}`,o.has(t)||(a.push(`${t} = {};`),o.add(t))}),a.push(`${t}.getId = function () { return "${e}"; };`),a.push(`${t}.getValue = function () { return getState("${e}").val; };`)});let s=`script.js.global.MaterialDesignWidgets.${r.replace(`.`,``)}`;await this.socket.setObject(s,{type:`script`,common:{name:String(e.scriptName??`Theme`),expert:!0,engineType:`Javascript/js`,engine:`system.adapter.${t}`,source:a.join(`
685
- `),debug:!1,verbose:!1,enabled:!0}}),this.showAlert(UK(`generate script`),`success`)}onSave(e){super.onSave(e),this.syncRuntimeStates().catch(e=>this.showAlert(String(e),`error`))}async onConnectionReady(){let e=this.socket.systemLang;e&&!BK[e]&&(await VK(e),BK[e]&&(zk.extendTranslations(BK[e],e),this.forceUpdate()))}render(){return this.state.loaded?(0,z.jsxs)(ss,{theme:this.state.theme,children:[(0,z.jsx)(SS,{}),(0,z.jsx)(JK,{common:this.common,config:this.state.native,instance:this.instance,onError:this.showError,onLoad:e=>this.setState({native:e}),update:(e,t)=>this.updateNativeValue(e,t),onGenerate:()=>void this.generateGlobalScript().catch(e=>this.showAlert(String(e),`error`))}),this.renderHelperDialogs()]}):(0,z.jsx)(Mk,{})}};async function XK(){let e=window.sysLang||navigator.language?.split(`-`)[0]||`en`;await Promise.all([VK(`en`),VK(e)]),(0,EK.createRoot)(document.getElementById(`root`)).render((0,z.jsx)(YK,{}))}XK();
684
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var h=typeof window<`u`&&window.document!==void 0,g=h?window:{},_=h&&g.document.documentElement?`ontouchstart`in g.document.documentElement:!1,v=h?`PointerEvent`in g:!1,y=`cropper`,b=`all`,x=`crop`,S=`move`,C=`zoom`,w=`e`,T=`w`,E=`s`,D=`n`,O=`ne`,k=`nw`,A=`se`,j=`sw`,M=`${y}-crop`,N=`${y}-disabled`,P=`${y}-hidden`,F=`${y}-hide`,ee=`${y}-invisible`,te=`${y}-modal`,I=`${y}-move`,ne=`${y}Action`,re=`${y}Preview`,ie=`crop`,ae=`move`,oe=`none`,se=`crop`,ce=`cropend`,le=`cropmove`,ue=`cropstart`,de=`dblclick`,fe=_?`touchstart`:`mousedown`,pe=_?`touchmove`:`mousemove`,me=_?`touchend touchcancel`:`mouseup`,he=v?`pointerdown`:fe,L=v?`pointermove`:pe,ge=v?`pointerup pointercancel`:me,_e=`ready`,ve=`resize`,ye=`wheel`,be=`zoom`,xe=`image/jpeg`,Se=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Ce=/^data:/,we=/^data:image\/jpeg;base64,/,Te=/^img|canvas$/i,Ee=200,De=100,Oe={viewMode:0,dragMode:ie,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:``,responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:Ee,minContainerHeight:De,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ke=`<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>`,Ae=Number.isNaN||g.isNaN;function je(e){return typeof e==`number`&&!Ae(e)}var Me=function(e){return e>0&&e<1/0};function Ne(e){return e===void 0}function Pe(e){return i(e)===`object`&&e!==null}var Fe=Object.prototype.hasOwnProperty;function Ie(e){if(!Pe(e))return!1;try{var t=e.constructor,n=t.prototype;return t&&n&&Fe.call(n,`isPrototypeOf`)}catch{return!1}}function Le(e){return typeof e==`function`}var Re=Array.prototype.slice;function ze(e){return Array.from?Array.from(e):Re.call(e)}function Be(e,t){return e&&Le(t)&&(Array.isArray(e)||je(e.length)?ze(e).forEach(function(n,r){t.call(e,n,r,e)}):Pe(e)&&Object.keys(e).forEach(function(n){t.call(e,e[n],n,e)})),e}var Ve=Object.assign||function(e){var t=[...arguments].slice(1);return Pe(e)&&t.length>0&&t.forEach(function(t){Pe(t)&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e},He=/\.\d*(?:0|9){12}\d*$/;function Ue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return He.test(e)?Math.round(e*t)/t:e}var We=/^width|height|left|top|marginLeft|marginTop$/;function Ge(e,t){var n=e.style;Be(t,function(e,t){We.test(t)&&je(e)&&(e=`${e}px`),n[t]=e})}function Ke(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function qe(e,t){if(t){if(je(e.length)){Be(e,function(e){qe(e,t)});return}if(e.classList){e.classList.add(t);return}var n=e.className.trim();n?n.indexOf(t)<0&&(e.className=`${n} ${t}`):e.className=t}}function Je(e,t){if(t){if(je(e.length)){Be(e,function(e){Je(e,t)});return}if(e.classList){e.classList.remove(t);return}e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,``))}}function Ye(e,t,n){if(t){if(je(e.length)){Be(e,function(e){Ye(e,t,n)});return}n?qe(e,t):Je(e,t)}}var Xe=/([a-z\d])([A-Z])/g;function Ze(e){return e.replace(Xe,`$1-$2`).toLowerCase()}function Qe(e,t){return Pe(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute(`data-${Ze(t)}`)}function $e(e,t,n){Pe(n)?e[t]=n:e.dataset?e.dataset[t]=n:e.setAttribute(`data-${Ze(t)}`,n)}function et(e,t){if(Pe(e[t]))try{delete e[t]}catch{e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch{e.dataset[t]=void 0}else e.removeAttribute(`data-${Ze(t)}`)}var tt=/\s\s*/,nt=function(){var e=!1;if(h){var t=!1,n=function(){},r=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(e){t=e}});g.addEventListener(`test`,n,r),g.removeEventListener(`test`,n,r)}return e}();function rt(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=n;t.trim().split(tt).forEach(function(t){if(!nt){var a=e.listeners;a&&a[t]&&a[t][n]&&(i=a[t][n],delete a[t][n],Object.keys(a[t]).length===0&&delete a[t],Object.keys(a).length===0&&delete e.listeners)}e.removeEventListener(t,i,r)})}function it(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=n;t.trim().split(tt).forEach(function(t){if(r.once&&!nt){var a=e.listeners,o=a===void 0?{}:a;i=function(){delete o[t][n],e.removeEventListener(t,i,r);var a=[...arguments];n.apply(e,a)},o[t]||(o[t]={}),o[t][n]&&e.removeEventListener(t,o[t][n],r),o[t][n]=i,e.listeners=o}e.addEventListener(t,i,r)})}function at(e,t,n){var r;return Le(Event)&&Le(CustomEvent)?r=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0}):(r=document.createEvent(`CustomEvent`),r.initCustomEvent(t,!0,!0,n)),e.dispatchEvent(r)}function ot(e){var t=e.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var st=g.location,ct=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function lt(e){var t=e.match(ct);return t!==null&&(t[1]!==st.protocol||t[2]!==st.hostname||t[3]!==st.port)}function R(e){var t=`timestamp=${new Date().getTime()}`;return e+(e.indexOf(`?`)===-1?`?`:`&`)+t}function ut(e){var t=e.rotate,n=e.scaleX,r=e.scaleY,i=e.translateX,a=e.translateY,o=[];je(i)&&i!==0&&o.push(`translateX(${i}px)`),je(a)&&a!==0&&o.push(`translateY(${a}px)`),je(t)&&t!==0&&o.push(`rotate(${t}deg)`),je(n)&&n!==1&&o.push(`scaleX(${n})`),je(r)&&r!==1&&o.push(`scaleY(${r})`);var s=o.length?o.join(` `):`none`;return{WebkitTransform:s,msTransform:s,transform:s}}function dt(e){var n=t({},e),r=0;return Be(e,function(e,t){delete n[t],Be(n,function(t){var n=Math.abs(e.startX-t.startX),i=Math.abs(e.startY-t.startY),a=Math.abs(e.endX-t.endX),o=Math.abs(e.endY-t.endY),s=Math.sqrt(n*n+i*i),c=(Math.sqrt(a*a+o*o)-s)/s;Math.abs(c)>Math.abs(r)&&(r=c)})}),r}function ft(e,n){var r=e.pageX,i=e.pageY,a={endX:r,endY:i};return n?a:t({startX:r,startY:i},a)}function pt(e){var t=0,n=0,r=0;return Be(e,function(e){var i=e.startX,a=e.startY;t+=i,n+=a,r+=1}),t/=r,n/=r,{pageX:t,pageY:n}}function mt(e){var t=e.aspectRatio,n=e.height,r=e.width,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`contain`,a=Me(r),o=Me(n);if(a&&o){var s=n*t;i===`contain`&&s>r||i===`cover`&&s<r?n=r/t:r=n*t}else a?n=r/t:o&&(r=n*t);return{width:r,height:n}}function ht(e){var t=e.width,n=e.height,r=e.degree;if(r=Math.abs(r)%180,r===90)return{width:n,height:t};var i=r%90*Math.PI/180,a=Math.sin(i),o=Math.cos(i),s=t*o+n*a,c=t*a+n*o;return r>90?{width:c,height:s}:{width:s,height:c}}function gt(e,t,n,r){var i=t.aspectRatio,a=t.naturalWidth,o=t.naturalHeight,s=t.rotate,c=s===void 0?0:s,u=t.scaleX,d=u===void 0?1:u,f=t.scaleY,p=f===void 0?1:f,m=n.aspectRatio,h=n.naturalWidth,g=n.naturalHeight,_=r.fillColor,v=_===void 0?`transparent`:_,y=r.imageSmoothingEnabled,b=y===void 0||y,x=r.imageSmoothingQuality,S=x===void 0?`low`:x,C=r.maxWidth,w=C===void 0?1/0:C,T=r.maxHeight,E=T===void 0?1/0:T,D=r.minWidth,O=D===void 0?0:D,k=r.minHeight,A=k===void 0?0:k,j=document.createElement(`canvas`),M=j.getContext(`2d`),N=mt({aspectRatio:m,width:w,height:E}),P=mt({aspectRatio:m,width:O,height:A},`cover`),F=Math.min(N.width,Math.max(P.width,h)),ee=Math.min(N.height,Math.max(P.height,g)),te=mt({aspectRatio:i,width:w,height:E}),I=mt({aspectRatio:i,width:O,height:A},`cover`),ne=Math.min(te.width,Math.max(I.width,a)),re=Math.min(te.height,Math.max(I.height,o)),ie=[-ne/2,-re/2,ne,re];return j.width=Ue(F),j.height=Ue(ee),M.fillStyle=v,M.fillRect(0,0,F,ee),M.save(),M.translate(F/2,ee/2),M.rotate(c*Math.PI/180),M.scale(d,p),M.imageSmoothingEnabled=b,M.imageSmoothingQuality=S,M.drawImage.apply(M,[e].concat(l(ie.map(function(e){return Math.floor(Ue(e))})))),M.restore(),j}var _t=String.fromCharCode;function vt(e,t,n){var r=``;n+=t;for(var i=t;i<n;i+=1)r+=_t(e.getUint8(i));return r}var yt=/^data:.*,/;function bt(e){var t=e.replace(yt,``),n=atob(t),r=new ArrayBuffer(n.length),i=new Uint8Array(r);return Be(i,function(e,t){i[t]=n.charCodeAt(t)}),r}function xt(e,t){for(var n=[],r=8192,i=new Uint8Array(e);i.length>0;)n.push(_t.apply(null,ze(i.subarray(0,r)))),i=i.subarray(r);return`data:${t};base64,${btoa(n.join(``))}`}function St(e){var t=new DataView(e),n;try{var r,i,a;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var o=t.byteLength,s=2;s+1<o;){if(t.getUint8(s)===255&&t.getUint8(s+1)===225){i=s;break}s+=1}if(i){var c=i+4,l=i+10;if(vt(t,c,4)===`Exif`){var u=t.getUint16(l);if(r=u===18761,(r||u===19789)&&t.getUint16(l+2,r)===42){var d=t.getUint32(l+4,r);d>=8&&(a=l+d)}}}if(a){var f=t.getUint16(a,r),p,m;for(m=0;m<f;m+=1)if(p=a+m*12+2,t.getUint16(p,r)===274){p+=8,n=t.getUint16(p,r),t.setUint16(p,1,r);break}}}catch{n=1}return n}function Ct(e){var t=0,n=1,r=1;switch(e){case 2:n=-1;break;case 3:t=-180;break;case 4:r=-1;break;case 5:t=90,r=-1;break;case 6:t=90;break;case 7:t=90,n=-1;break;case 8:t=-90;break}return{rotate:t,scaleX:n,scaleY:r}}var wt={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,n=this.container,r=this.cropper,i=Number(t.minContainerWidth),a=Number(t.minContainerHeight);qe(r,P),Je(e,P);var o={width:Math.max(n.offsetWidth,i>=0?i:Ee),height:Math.max(n.offsetHeight,a>=0?a:De)};this.containerData=o,Ge(r,{width:o.width,height:o.height}),qe(e,P),Je(r,P)},initCanvas:function(){var e=this.containerData,t=this.imageData,n=this.options.viewMode,r=Math.abs(t.rotate)%180==90,i=r?t.naturalHeight:t.naturalWidth,a=r?t.naturalWidth:t.naturalHeight,o=i/a,s=e.width,c=e.height;e.height*o>e.width?n===3?s=e.height*o:c=e.width/o:n===3?c=e.width/o:s=e.height*o;var l={aspectRatio:o,naturalWidth:i,naturalHeight:a,width:s,height:c};this.canvasData=l,this.limited=n===1||n===2,this.limitCanvas(!0,!0),l.width=Math.min(Math.max(l.width,l.minWidth),l.maxWidth),l.height=Math.min(Math.max(l.height,l.minHeight),l.maxHeight),l.left=(e.width-l.width)/2,l.top=(e.height-l.height)/2,l.oldLeft=l.left,l.oldTop=l.top,this.initialCanvasData=Ve({},l)},limitCanvas:function(e,t){var n=this.options,r=this.containerData,i=this.canvasData,a=this.cropBoxData,o=n.viewMode,s=i.aspectRatio,c=this.cropped&&a;if(e){var l=Number(n.minCanvasWidth)||0,u=Number(n.minCanvasHeight)||0;o>1?(l=Math.max(l,r.width),u=Math.max(u,r.height),o===3&&(u*s>l?l=u*s:u=l/s)):o>0&&(l?l=Math.max(l,c?a.width:0):u?u=Math.max(u,c?a.height:0):c&&(l=a.width,u=a.height,u*s>l?l=u*s:u=l/s));var d=mt({aspectRatio:s,width:l,height:u});l=d.width,u=d.height,i.minWidth=l,i.minHeight=u,i.maxWidth=1/0,i.maxHeight=1/0}if(t)if(o>+!c){var f=r.width-i.width,p=r.height-i.height;i.minLeft=Math.min(0,f),i.minTop=Math.min(0,p),i.maxLeft=Math.max(0,f),i.maxTop=Math.max(0,p),c&&this.limited&&(i.minLeft=Math.min(a.left,a.left+(a.width-i.width)),i.minTop=Math.min(a.top,a.top+(a.height-i.height)),i.maxLeft=a.left,i.maxTop=a.top,o===2&&(i.width>=r.width&&(i.minLeft=Math.min(0,f),i.maxLeft=Math.max(0,f)),i.height>=r.height&&(i.minTop=Math.min(0,p),i.maxTop=Math.max(0,p))))}else i.minLeft=-i.width,i.minTop=-i.height,i.maxLeft=r.width,i.maxTop=r.height},renderCanvas:function(e,t){var n=this.canvasData,r=this.imageData;if(t){var i=ht({width:r.naturalWidth*Math.abs(r.scaleX||1),height:r.naturalHeight*Math.abs(r.scaleY||1),degree:r.rotate||0}),a=i.width,o=i.height,s=n.width*(a/n.naturalWidth),c=n.height*(o/n.naturalHeight);n.left-=(s-n.width)/2,n.top-=(c-n.height)/2,n.width=s,n.height=c,n.aspectRatio=a/o,n.naturalWidth=a,n.naturalHeight=o,this.limitCanvas(!0,!1)}(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCanvas(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,Ge(this.canvas,Ve({width:n.width,height:n.height},ut({translateX:n.left,translateY:n.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,n=this.imageData,r=n.naturalWidth*(t.width/t.naturalWidth),i=n.naturalHeight*(t.height/t.naturalHeight);Ve(n,{width:r,height:i,left:(t.width-r)/2,top:(t.height-i)/2}),Ge(this.image,Ve({width:n.width,height:n.height},ut(Ve({translateX:n.left,translateY:n.top},n)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,n=e.aspectRatio||e.initialAspectRatio,r=Number(e.autoCropArea)||.8,i={width:t.width,height:t.height};n&&(t.height*n>t.width?i.height=i.width/n:i.width=i.height*n),this.cropBoxData=i,this.limitCropBox(!0,!0),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),i.width=Math.max(i.minWidth,i.width*r),i.height=Math.max(i.minHeight,i.height*r),i.left=t.left+(t.width-i.width)/2,i.top=t.top+(t.height-i.height)/2,i.oldLeft=i.left,i.oldTop=i.top,this.initialCropBoxData=Ve({},i)},limitCropBox:function(e,t){var n=this.options,r=this.containerData,i=this.canvasData,a=this.cropBoxData,o=this.limited,s=n.aspectRatio;if(e){var c=Number(n.minCropBoxWidth)||0,l=Number(n.minCropBoxHeight)||0,u=o?Math.min(r.width,i.width,i.width+i.left,r.width-i.left):r.width,d=o?Math.min(r.height,i.height,i.height+i.top,r.height-i.top):r.height;c=Math.min(c,r.width),l=Math.min(l,r.height),s&&(c&&l?l*s>c?l=c/s:c=l*s:c?l=c/s:l&&(c=l*s),d*s>u?d=u/s:u=d*s),a.minWidth=Math.min(c,u),a.minHeight=Math.min(l,d),a.maxWidth=u,a.maxHeight=d}t&&(o?(a.minLeft=Math.max(0,i.left),a.minTop=Math.max(0,i.top),a.maxLeft=Math.min(r.width,i.left+i.width)-a.width,a.maxTop=Math.min(r.height,i.top+i.height)-a.height):(a.minLeft=0,a.minTop=0,a.maxLeft=r.width-a.width,a.maxTop=r.height-a.height))},renderCropBox:function(){var e=this.options,t=this.containerData,n=this.cropBoxData;(n.width>n.maxWidth||n.width<n.minWidth)&&(n.left=n.oldLeft),(n.height>n.maxHeight||n.height<n.minHeight)&&(n.top=n.oldTop),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),this.limitCropBox(!1,!0),n.left=Math.min(Math.max(n.left,n.minLeft),n.maxLeft),n.top=Math.min(Math.max(n.top,n.minTop),n.maxTop),n.oldLeft=n.left,n.oldTop=n.top,e.movable&&e.cropBoxMovable&&$e(this.face,ne,n.width>=t.width&&n.height>=t.height?S:b),Ge(this.cropBox,Ve({width:n.width,height:n.height},ut({translateX:n.left,translateY:n.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),at(this.element,se,this.getData())}},Tt={initPreview:function(){var e=this.element,t=this.crossOrigin,n=this.options.preview,r=t?this.crossOriginUrl:this.url,i=e.alt||`The image to preview`,a=document.createElement(`img`);if(t&&(a.crossOrigin=t),a.src=r,a.alt=i,this.viewBox.appendChild(a),this.viewBoxImage=a,n){var o=n;typeof n==`string`?o=e.ownerDocument.querySelectorAll(n):n.querySelector&&(o=[n]),this.previews=o,Be(o,function(e){var n=document.createElement(`img`);$e(e,re,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(n.crossOrigin=t),n.src=r,n.alt=i,n.style.cssText=`display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"`,e.innerHTML=``,e.appendChild(n)})}},resetPreview:function(){Be(this.previews,function(e){var t=Qe(e,re);Ge(e,{width:t.width,height:t.height}),e.innerHTML=t.html,et(e,re)})},preview:function(){var e=this.imageData,t=this.canvasData,n=this.cropBoxData,r=n.width,i=n.height,a=e.width,o=e.height,s=n.left-t.left-e.left,c=n.top-t.top-e.top;!this.cropped||this.disabled||(Ge(this.viewBoxImage,Ve({width:a,height:o},ut(Ve({translateX:-s,translateY:-c},e)))),Be(this.previews,function(t){var n=Qe(t,re),l=n.width,u=n.height,d=l,f=u,p=1;r&&(p=l/r,f=i*p),i&&f>u&&(p=u/i,d=r*p,f=u),Ge(t,{width:d,height:f}),Ge(t.getElementsByTagName(`img`)[0],Ve({width:a*p,height:o*p},ut(Ve({translateX:-s*p,translateY:-c*p},e))))}))}},Et={bind:function(){var e=this.element,t=this.options,n=this.cropper;Le(t.cropstart)&&it(e,ue,t.cropstart),Le(t.cropmove)&&it(e,le,t.cropmove),Le(t.cropend)&&it(e,ce,t.cropend),Le(t.crop)&&it(e,se,t.crop),Le(t.zoom)&&it(e,be,t.zoom),it(n,he,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&it(n,ye,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&it(n,de,this.onDblclick=this.dblclick.bind(this)),it(e.ownerDocument,L,this.onCropMove=this.cropMove.bind(this)),it(e.ownerDocument,ge,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&it(window,ve,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,n=this.cropper;Le(t.cropstart)&&rt(e,ue,t.cropstart),Le(t.cropmove)&&rt(e,le,t.cropmove),Le(t.cropend)&&rt(e,ce,t.cropend),Le(t.crop)&&rt(e,se,t.crop),Le(t.zoom)&&rt(e,be,t.zoom),rt(n,he,this.onCropStart),t.zoomable&&t.zoomOnWheel&&rt(n,ye,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&rt(n,de,this.onDblclick),rt(e.ownerDocument,L,this.onCropMove),rt(e.ownerDocument,ge,this.onCropEnd),t.responsive&&rt(window,ve,this.onResize)}},Dt={resize:function(){if(!this.disabled){var e=this.options,t=this.container,n=this.containerData,r=t.offsetWidth/n.width,i=t.offsetHeight/n.height,a=Math.abs(r-1)>Math.abs(i-1)?r:i;if(a!==1){var o,s;e.restore&&(o=this.getCanvasData(),s=this.getCropBoxData()),this.render(),e.restore&&(this.setCanvasData(Be(o,function(e,t){o[t]=e*a})),this.setCropBoxData(Be(s,function(e,t){s[t]=e*a})))}}},dblclick:function(){this.disabled||this.options.dragMode===oe||this.setDragMode(Ke(this.dragBox,M)?ae:ie)},wheel:function(e){var t=this,n=Number(this.options.wheelZoomRatio)||.1,r=1;this.disabled||(e.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){t.wheeling=!1},50),e.deltaY?r=e.deltaY>0?1:-1:e.wheelDelta?r=-e.wheelDelta/120:e.detail&&(r=e.detail>0?1:-1),this.zoom(-r*n,e)))},cropStart:function(e){var t=e.buttons,n=e.button;if(!(this.disabled||(e.type===`mousedown`||e.type===`pointerdown`&&e.pointerType===`mouse`)&&(je(t)&&t!==1||je(n)&&n!==0||e.ctrlKey))){var r=this.options,i=this.pointers,a;e.changedTouches?Be(e.changedTouches,function(e){i[e.identifier]=ft(e)}):i[e.pointerId||0]=ft(e),a=Object.keys(i).length>1&&r.zoomable&&r.zoomOnTouch?C:Qe(e.target,ne),Se.test(a)&&at(this.element,ue,{originalEvent:e,action:a})!==!1&&(e.preventDefault(),this.action=a,this.cropping=!1,a===x&&(this.cropping=!0,qe(this.dragBox,te)))}},cropMove:function(e){var t=this.action;if(!(this.disabled||!t)){var n=this.pointers;e.preventDefault(),at(this.element,le,{originalEvent:e,action:t})!==!1&&(e.changedTouches?Be(e.changedTouches,function(e){Ve(n[e.identifier]||{},ft(e,!0))}):Ve(n[e.pointerId||0]||{},ft(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,n=this.pointers;e.changedTouches?Be(e.changedTouches,function(e){delete n[e.identifier]}):delete n[e.pointerId||0],t&&(e.preventDefault(),Object.keys(n).length||(this.action=``),this.cropping&&(this.cropping=!1,Ye(this.dragBox,te,this.cropped&&this.options.modal)),at(this.element,ce,{originalEvent:e,action:t}))}}},Ot={change:function(e){var t=this.options,n=this.canvasData,r=this.containerData,i=this.cropBoxData,a=this.pointers,o=this.action,s=t.aspectRatio,c=i.left,l=i.top,u=i.width,d=i.height,f=c+u,p=l+d,m=0,h=0,g=r.width,_=r.height,v=!0,y;!s&&e.shiftKey&&(s=u&&d?u/d:1),this.limited&&(m=i.minLeft,h=i.minTop,g=m+Math.min(r.width,n.width,n.left+n.width),_=h+Math.min(r.height,n.height,n.top+n.height));var M=a[Object.keys(a)[0]],N={x:M.endX-M.startX,y:M.endY-M.startY},F=function(e){switch(e){case w:f+N.x>g&&(N.x=g-f);break;case T:c+N.x<m&&(N.x=m-c);break;case D:l+N.y<h&&(N.y=h-l);break;case E:p+N.y>_&&(N.y=_-p);break}};switch(o){case b:c+=N.x,l+=N.y;break;case w:if(N.x>=0&&(f>=g||s&&(l<=h||p>=_))){v=!1;break}F(w),u+=N.x,u<0&&(o=T,u=-u,c-=u),s&&(d=u/s,l+=(i.height-d)/2);break;case D:if(N.y<=0&&(l<=h||s&&(c<=m||f>=g))){v=!1;break}F(D),d-=N.y,l+=N.y,d<0&&(o=E,d=-d,l-=d),s&&(u=d*s,c+=(i.width-u)/2);break;case T:if(N.x<=0&&(c<=m||s&&(l<=h||p>=_))){v=!1;break}F(T),u-=N.x,c+=N.x,u<0&&(o=w,u=-u,c-=u),s&&(d=u/s,l+=(i.height-d)/2);break;case E:if(N.y>=0&&(p>=_||s&&(c<=m||f>=g))){v=!1;break}F(E),d+=N.y,d<0&&(o=D,d=-d,l-=d),s&&(u=d*s,c+=(i.width-u)/2);break;case O:if(s){if(N.y<=0&&(l<=h||f>=g)){v=!1;break}F(D),d-=N.y,l+=N.y,u=d*s}else F(D),F(w),N.x>=0?f<g?u+=N.x:N.y<=0&&l<=h&&(v=!1):u+=N.x,N.y<=0?l>h&&(d-=N.y,l+=N.y):(d-=N.y,l+=N.y);u<0&&d<0?(o=j,d=-d,u=-u,l-=d,c-=u):u<0?(o=k,u=-u,c-=u):d<0&&(o=A,d=-d,l-=d);break;case k:if(s){if(N.y<=0&&(l<=h||c<=m)){v=!1;break}F(D),d-=N.y,l+=N.y,u=d*s,c+=i.width-u}else F(D),F(T),N.x<=0?c>m?(u-=N.x,c+=N.x):N.y<=0&&l<=h&&(v=!1):(u-=N.x,c+=N.x),N.y<=0?l>h&&(d-=N.y,l+=N.y):(d-=N.y,l+=N.y);u<0&&d<0?(o=A,d=-d,u=-u,l-=d,c-=u):u<0?(o=O,u=-u,c-=u):d<0&&(o=j,d=-d,l-=d);break;case j:if(s){if(N.x<=0&&(c<=m||p>=_)){v=!1;break}F(T),u-=N.x,c+=N.x,d=u/s}else F(E),F(T),N.x<=0?c>m?(u-=N.x,c+=N.x):N.y>=0&&p>=_&&(v=!1):(u-=N.x,c+=N.x),N.y>=0?p<_&&(d+=N.y):d+=N.y;u<0&&d<0?(o=O,d=-d,u=-u,l-=d,c-=u):u<0?(o=A,u=-u,c-=u):d<0&&(o=k,d=-d,l-=d);break;case A:if(s){if(N.x>=0&&(f>=g||p>=_)){v=!1;break}F(w),u+=N.x,d=u/s}else F(E),F(w),N.x>=0?f<g?u+=N.x:N.y>=0&&p>=_&&(v=!1):u+=N.x,N.y>=0?p<_&&(d+=N.y):d+=N.y;u<0&&d<0?(o=k,d=-d,u=-u,l-=d,c-=u):u<0?(o=j,u=-u,c-=u):d<0&&(o=O,d=-d,l-=d);break;case S:this.move(N.x,N.y),v=!1;break;case C:this.zoom(dt(a),e),v=!1;break;case x:if(!N.x||!N.y){v=!1;break}y=ot(this.cropper),c=M.startX-y.left,l=M.startY-y.top,u=i.minWidth,d=i.minHeight,N.x>0?o=N.y>0?A:O:N.x<0&&(c-=u,o=N.y>0?j:k),N.y<0&&(l-=d),this.cropped||(Je(this.cropBox,P),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}v&&(i.width=u,i.height=d,i.left=c,i.top=l,this.action=o,this.renderCropBox()),Be(a,function(e){e.startX=e.endX,e.startY=e.endY})}},kt={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&qe(this.dragBox,te),Je(this.cropBox,P),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ve({},this.initialImageData),this.canvasData=Ve({},this.initialCanvasData),this.cropBoxData=Ve({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ve(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Je(this.dragBox,te),qe(this.cropBox,P)),this},replace:function(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,Be(this.previews,function(t){t.getElementsByTagName(`img`)[0].src=e}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Je(this.cropper,N)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,qe(this.cropper,N)),this},destroy:function(){var e=this.element;return e[y]?(e[y]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,r=n.left,i=n.top;return this.moveTo(Ne(e)?e:r+Number(e),Ne(t)?t:i+Number(t))},moveTo:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.canvasData,r=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(je(e)&&(n.left=e,r=!0),je(t)&&(n.top=t,r=!0),r&&this.renderCanvas(!0)),this},zoom:function(e,t){var n=this.canvasData;return e=Number(e),e=e<0?1/(1-e):1+e,this.zoomTo(n.width*e/n.naturalWidth,null,t)},zoomTo:function(e,t,n){var r=this.options,i=this.canvasData,a=i.width,o=i.height,s=i.naturalWidth,c=i.naturalHeight;if(e=Number(e),e>=0&&this.ready&&!this.disabled&&r.zoomable){var l=s*e,u=c*e;if(at(this.element,be,{ratio:e,oldRatio:a/s,originalEvent:n})===!1)return this;if(n){var d=this.pointers,f=ot(this.cropper),p=d&&Object.keys(d).length?pt(d):{pageX:n.pageX,pageY:n.pageY};i.left-=(l-a)*((p.pageX-f.left-i.left)/a),i.top-=(u-o)*((p.pageY-f.top-i.top)/o)}else Ie(t)&&je(t.x)&&je(t.y)?(i.left-=(l-a)*((t.x-i.left)/a),i.top-=(u-o)*((t.y-i.top)/o)):(i.left-=(l-a)/2,i.top-=(u-o)/2);i.width=l,i.height=u,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return e=Number(e),je(e)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,je(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(je(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e,n=this.imageData,r=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(je(e)&&(n.scaleX=e,r=!0),je(t)&&(n.scaleY=t,r=!0),r&&this.renderCanvas(!0,!0)),this},getData:function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=this.options,n=this.imageData,r=this.canvasData,i=this.cropBoxData,a;if(this.ready&&this.cropped){a={x:i.left-r.left,y:i.top-r.top,width:i.width,height:i.height};var o=n.width/n.naturalWidth;if(Be(a,function(e,t){a[t]=e/o}),e){var s=Math.round(a.y+a.height),c=Math.round(a.x+a.width);a.x=Math.round(a.x),a.y=Math.round(a.y),a.width=c-a.x,a.height=s-a.y}}else a={x:0,y:0,width:0,height:0};return t.rotatable&&(a.rotate=n.rotate||0),t.scalable&&(a.scaleX=n.scaleX||1,a.scaleY=n.scaleY||1),a},setData:function(e){var t=this.options,n=this.imageData,r=this.canvasData,i={};if(this.ready&&!this.disabled&&Ie(e)){var a=!1;t.rotatable&&je(e.rotate)&&e.rotate!==n.rotate&&(n.rotate=e.rotate,a=!0),t.scalable&&(je(e.scaleX)&&e.scaleX!==n.scaleX&&(n.scaleX=e.scaleX,a=!0),je(e.scaleY)&&e.scaleY!==n.scaleY&&(n.scaleY=e.scaleY,a=!0)),a&&this.renderCanvas(!0,!0);var o=n.width/n.naturalWidth;je(e.x)&&(i.left=e.x*o+r.left),je(e.y)&&(i.top=e.y*o+r.top),je(e.width)&&(i.width=e.width*o),je(e.height)&&(i.height=e.height*o),this.setCropBoxData(i)}return this},getContainerData:function(){return this.ready?Ve({},this.containerData):{}},getImageData:function(){return this.sized?Ve({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&Be([`left`,`top`,`width`,`height`,`naturalWidth`,`naturalHeight`],function(n){t[n]=e[n]}),t},setCanvasData:function(e){var t=this.canvasData,n=t.aspectRatio;return this.ready&&!this.disabled&&Ie(e)&&(je(e.left)&&(t.left=e.left),je(e.top)&&(t.top=e.top),je(e.width)?(t.width=e.width,t.height=e.width/n):je(e.height)&&(t.height=e.height,t.width=e.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var e=this.cropBoxData,t;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(e){var t=this.cropBoxData,n=this.options.aspectRatio,r,i;return this.ready&&this.cropped&&!this.disabled&&Ie(e)&&(je(e.left)&&(t.left=e.left),je(e.top)&&(t.top=e.top),je(e.width)&&e.width!==t.width&&(r=!0,t.width=e.width),je(e.height)&&e.height!==t.height&&(i=!0,t.height=e.height),n&&(r?t.height=t.width/n:i&&(t.width=t.height*n)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,n=gt(this.image,this.imageData,t,e);if(!this.cropped)return n;var r=this.getData(e.rounded),i=r.x,a=r.y,o=r.width,s=r.height,c=n.width/Math.floor(t.naturalWidth);c!==1&&(i*=c,a*=c,o*=c,s*=c);var u=o/s,d=mt({aspectRatio:u,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),f=mt({aspectRatio:u,width:e.minWidth||0,height:e.minHeight||0},`cover`),p=mt({aspectRatio:u,width:e.width||(c===1?o:n.width),height:e.height||(c===1?s:n.height)}),m=p.width,h=p.height;m=Math.min(d.width,Math.max(f.width,m)),h=Math.min(d.height,Math.max(f.height,h));var g=document.createElement(`canvas`),_=g.getContext(`2d`);g.width=Ue(m),g.height=Ue(h),_.fillStyle=e.fillColor||`transparent`,_.fillRect(0,0,m,h);var v=e.imageSmoothingEnabled,y=v===void 0||v,b=e.imageSmoothingQuality;_.imageSmoothingEnabled=y,b&&(_.imageSmoothingQuality=b);var x=n.width,S=n.height,C=i,w=a,T,E,D,O,k,A;C<=-o||C>x?(C=0,T=0,D=0,k=0):C<=0?(D=-C,C=0,T=Math.min(x,o+C),k=T):C<=x&&(D=0,T=Math.min(o,x-C),k=T),T<=0||w<=-s||w>S?(w=0,E=0,O=0,A=0):w<=0?(O=-w,w=0,E=Math.min(S,s+w),A=E):w<=S&&(O=0,E=Math.min(s,S-w),A=E);var j=[C,w,T,E];if(k>0&&A>0){var M=m/o;j.push(D*M,O*M,k*M,A*M)}return _.drawImage.apply(_,[n].concat(l(j.map(function(e){return Math.floor(Ue(e))})))),g},setAspectRatio:function(e){var t=this.options;return!this.disabled&&!Ne(e)&&(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,n=this.dragBox,r=this.face;if(this.ready&&!this.disabled){var i=e===ie,a=t.movable&&e===ae;e=i||a?e:oe,t.dragMode=e,$e(n,ne,e),Ye(n,M,i),Ye(n,I,a),t.cropBoxMovable||($e(r,ne,e),Ye(r,M,i),Ye(r,I,a))}return this}},At=g.Cropper,jt=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(a(this,e),!t||!Te.test(t.tagName))throw Error(`The first argument is required and must be an <img> or <canvas> element.`);this.element=t,this.options=Ve({},Oe,Ie(n)&&n),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return s(e,[{key:`init`,value:function(){var e=this.element,t=e.tagName.toLowerCase(),n;if(!e[y]){if(e[y]=this,t===`img`){if(this.isImg=!0,n=e.getAttribute(`src`)||``,this.originalUrl=n,!n)return;n=e.src}else t===`canvas`&&window.HTMLCanvasElement&&(n=e.toDataURL());this.load(n)}}},{key:`load`,value:function(e){var t=this;if(e){this.url=e,this.imageData={};var n=this.element,r=this.options;if(!r.rotatable&&!r.scalable&&(r.checkOrientation=!1),!r.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Ce.test(e)){we.test(e)?this.read(bt(e)):this.clone();return}var i=new XMLHttpRequest,a=this.clone.bind(this);this.reloading=!0,this.xhr=i,i.onabort=a,i.onerror=a,i.ontimeout=a,i.onprogress=function(){i.getResponseHeader(`content-type`)!==xe&&i.abort()},i.onload=function(){t.read(i.response)},i.onloadend=function(){t.reloading=!1,t.xhr=null},r.checkCrossOrigin&&lt(e)&&n.crossOrigin&&(e=R(e)),i.open(`GET`,e,!0),i.responseType=`arraybuffer`,i.withCredentials=n.crossOrigin===`use-credentials`,i.send()}}},{key:`read`,value:function(e){var t=this.options,n=this.imageData,r=St(e),i=0,a=1,o=1;if(r>1){this.url=xt(e,xe);var s=Ct(r);i=s.rotate,a=s.scaleX,o=s.scaleY}t.rotatable&&(n.rotate=i),t.scalable&&(n.scaleX=a,n.scaleY=o),this.clone()}},{key:`clone`,value:function(){var e=this.element,t=this.url,n=e.crossOrigin,r=t;this.options.checkCrossOrigin&&lt(t)&&(n||=`anonymous`,r=R(t)),this.crossOrigin=n,this.crossOriginUrl=r;var i=document.createElement(`img`);n&&(i.crossOrigin=n),i.src=r||t,i.alt=e.alt||`The image to crop`,this.image=i,i.onload=this.start.bind(this),i.onerror=this.stop.bind(this),qe(i,F),e.parentNode.insertBefore(i,e.nextSibling)}},{key:`start`,value:function(){var e=this,t=this.image;t.onload=null,t.onerror=null,this.sizing=!0;var n=g.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(g.navigator.userAgent),r=function(t,n){Ve(e.imageData,{naturalWidth:t,naturalHeight:n,aspectRatio:t/n}),e.initialImageData=Ve({},e.imageData),e.sizing=!1,e.sized=!0,e.build()};if(t.naturalWidth&&!n){r(t.naturalWidth,t.naturalHeight);return}var i=document.createElement(`img`),a=document.body||document.documentElement;this.sizingImage=i,i.onload=function(){r(i.width,i.height),n||a.removeChild(i)},i.src=t.src,n||(i.style.cssText=`left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;`,a.appendChild(i))}},{key:`stop`,value:function(){var e=this.image;e.onload=null,e.onerror=null,e.parentNode.removeChild(e),this.image=null}},{key:`build`,value:function(){if(!(!this.sized||this.ready)){var e=this.element,t=this.options,n=this.image,r=e.parentNode,i=document.createElement(`div`);i.innerHTML=ke;var a=i.querySelector(`.${y}-container`),o=a.querySelector(`.${y}-canvas`),s=a.querySelector(`.${y}-drag-box`),c=a.querySelector(`.${y}-crop-box`),l=c.querySelector(`.${y}-face`);this.container=r,this.cropper=a,this.canvas=o,this.dragBox=s,this.cropBox=c,this.viewBox=a.querySelector(`.${y}-view-box`),this.face=l,o.appendChild(n),qe(e,P),r.insertBefore(a,e.nextSibling),Je(n,F),this.initPreview(),this.bind(),t.initialAspectRatio=Math.max(0,t.initialAspectRatio)||NaN,t.aspectRatio=Math.max(0,t.aspectRatio)||NaN,t.viewMode=Math.max(0,Math.min(3,Math.round(t.viewMode)))||0,qe(c,P),t.guides||qe(c.getElementsByClassName(`${y}-dashed`),P),t.center||qe(c.getElementsByClassName(`${y}-center`),P),t.background&&qe(a,`${y}-bg`),t.highlight||qe(l,ee),t.cropBoxMovable&&(qe(l,I),$e(l,ne,b)),t.cropBoxResizable||(qe(c.getElementsByClassName(`${y}-line`),P),qe(c.getElementsByClassName(`${y}-point`),P)),this.render(),this.ready=!0,this.setDragMode(t.dragMode),t.autoCrop&&this.crop(),this.setData(t.data),Le(t.ready)&&it(e,_e,t.ready,{once:!0}),at(e,_e)}}},{key:`unbuild`,value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var e=this.cropper.parentNode;e&&e.removeChild(this.cropper),Je(this.element,P)}}},{key:`uncreate`,value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:`noConflict`,value:function(){return window.Cropper=At,e}},{key:`setDefaults`,value:function(e){Ve(Oe,Ie(e)&&e)}}])}();return Ve(jt.prototype,wt,Tt,Et,Dt,Ot,kt),jt}))}))()),SK=function(){return SK=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},SK.apply(this,arguments)};function CK(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}var wK=`aspectRatio.autoCrop.autoCropArea.background.center.checkCrossOrigin.checkOrientation.cropBoxMovable.cropBoxResizable.data.dragMode.guides.highlight.initialAspectRatio.minCanvasHeight.minCanvasWidth.minContainerHeight.minContainerWidth.minCropBoxHeight.minCropBoxWidth.modal.movable.preview.responsive.restore.rotatable.scalable.toggleDragModeOnDblclick.viewMode.wheelZoomRatio.zoomOnTouch.zoomOnWheel.zoomable.cropstart.cropmove.cropend.crop.zoom.ready`.split(`.`),TK={opacity:0,maxWidth:`100%`};R.forwardRef((function(e,t){var n=CK(e,[]),r=n.dragMode,i=r===void 0?`crop`:r,a=n.src,o=n.style,s=n.className,c=n.crossOrigin,l=n.scaleX,u=n.scaleY,d=n.enable,f=n.zoomTo,p=n.rotateTo,m=n.alt,h=m===void 0?`picture`:m,g=n.ready,_=n.onInitialized,v=CK(n,[`dragMode`,`src`,`style`,`className`,`crossOrigin`,`scaleX`,`scaleY`,`enable`,`zoomTo`,`rotateTo`,`alt`,`ready`,`onInitialized`]),y={scaleY:u,scaleX:l,enable:d,zoomTo:f,rotateTo:p},b=function(){var e=[...arguments],t=(0,R.useRef)(null);return R.useEffect((function(){e.forEach((function(e){e&&(typeof e==`function`?e(t.current):e.current=t.current)}))}),[e]),t}(t,(0,R.useRef)(null));(0,R.useEffect)((function(){var e;(e=b.current)!=null&&e.cropper&&typeof f==`number`&&b.current.cropper.zoomTo(f)}),[n.zoomTo]),(0,R.useEffect)((function(){var e;(e=b.current)!=null&&e.cropper&&a!==void 0&&b.current.cropper.reset().clear().replace(a)}),[a]),(0,R.useEffect)((function(){if(b.current!==null){var e=new xK.default(b.current,SK(SK({dragMode:i},v),{ready:function(e){e.currentTarget!==null&&function(e,t){t===void 0&&(t={});var n=t.enable,r=n===void 0||n,i=t.scaleX,a=i===void 0?1:i,o=t.scaleY,s=o===void 0?1:o,c=t.zoomTo,l=c===void 0?0:c,u=t.rotateTo;r?e.enable():e.disable(),e.scaleX(a),e.scaleY(s),u!==void 0&&e.rotateTo(u),l>0&&e.zoomTo(l)}(e.currentTarget.cropper,y),g&&g(e)}}));_&&_(e)}return function(){var e;(e=b.current?.cropper)==null||e.destroy()}}),[b]);var x=function(e){return wK.reduce((function(e,t){var n=e,r=t;return n[r],CK(n,[typeof r==`symbol`?r:r+``])}),e)}(SK(SK({},v),{crossOrigin:c,src:a,alt:h}));return R.createElement(`div`,{style:o,className:s},R.createElement(`img`,SK({},x,{style:TK,ref:b})))})),{seconds:`seconds`,minutes:`minutes`}.minutes,R.Component,R.Component,R.Component,R.Component,R.Component;var EK=o((e=>{var t=$g();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),DK=JSON.parse(`[{"id":"light.alerts.close_icon","desc":"closeIconColor","defaultValue":0,"widget":"Alerts"},{"id":"light.alerts.close_icon_hover","desc":"closeIconPressColor","defaultValue":0,"widget":"Alerts"},{"id":"light.button.default.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"light.button.default.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"light.button.vertical.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"light.button.vertical.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"light.button.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Button State vertical, Button State Multi vertical, Button Toggle vertical, Button State, Button State Multi, Button Toggle"},{"id":"light.calendar.border","desc":"calendarBorderColor","defaultValue":4,"widget":"Calendar"},{"id":"light.calendar.background_day","desc":"calendarDayBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.background_other_month","desc":"calendarDayBackgroundOutsideColor","value":"#f7f7f7","widget":"Calendar"},{"id":"light.calendar.button_background","desc":"calendarDayButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.button_background_today","desc":"calendarDayButtonTodayColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.button_hover","desc":"calendarDayButtonRippleEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.button_text","desc":"calendarDayButtonFontColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.button_text_today","desc":"calendarDayButtonTodayFontColor","defaultValue":5,"widget":"Calendar"},{"id":"light.calendar.control_panel_background","desc":"controlButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.control_panel_hover","desc":"controlButtonRippelEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.control_panel_icon","desc":"controlIconColor","defaultValue":0,"widget":"Calendar"},{"id":"light.calendar.control_panel_text","desc":"controlTextColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.header_background","desc":"calendarHeaderBackground","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.header_text","desc":"calendarDayLabelFontColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.header_text_today","desc":"calendarDayLabelTodayFontColor","defaultValue":2,"widget":"Calendar"},{"id":"light.calendar.header_text_past","desc":"calendarDayLabelPreviousFontColor","value":"rgba(0, 0, 0, 0.38)","widget":"Calendar"},{"id":"light.calendar.weeks_background","desc":"calendarWeeksNumbersBackground","value":"#f7f7f7","widget":"Calendar"},{"id":"light.calendar.weeks_text","desc":"calendarWeeksNumbersFontColor","defaultValue":6,"widget":"Calendar"},{"id":"light.calendar.time_axis_background","desc":"calendarTimeAxisBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.time_axis_background_header","desc":"calendarTimeAxisHeaderBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"light.calendar.time_axis_text","desc":"calendarTimeAxisFontColor","defaultValue":2,"widget":"Calendar"},{"id":"light.charts.background","desc":"backgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.background_chart","desc":"chartAreaBackgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.global","desc":"globalColor","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.value","desc":"valuesFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_title","desc":"yAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_values","desc":"yAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_gridlines","desc":"yAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.y_axis_zeroline","desc":"yAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_title","desc":"xAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_values","desc":"xAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_gridlines","desc":"xAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.x_axis_zeroline","desc":"xAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.legend","desc":"legendFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.tooltip_background","desc":"tooltipBackgroundColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.tooltip_title","desc":"tooltipTitleFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.tooltip_text","desc":"tooltipBodyFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.charts.bar.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"light.charts.bar.hover_border","desc":"hoverBorderColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"light.charts.pie.value","desc":"valuesFontColor","defaultValue":5,"widget":"Pie Chart"},{"id":"light.charts.pie.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Pie Chart"},{"id":"light.charts.pie.border","desc":"borderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"light.charts.pie.border_hover","desc":"hoverBorderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"light.card.background","desc":"colorBackground","defaultValue":5,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.background_title","desc":"colorTitleSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.background_body","desc":"colorTextSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.title","desc":"colorTitle","defaultValue":2,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"light.card.subTitle","desc":"colorSubtitle","defaultValue":1,"widget":"HTML Card"},{"id":"light.card.text","desc":"colorBody","defaultValue":2,"widget":"HTML Card"},{"id":"light.checkbox.on","desc":"colorCheckBox","defaultValue":0,"widget":"Checkbox, List"},{"id":"light.checkbox.border","desc":"colorCheckBoxBorder","defaultValue":3,"widget":"Checkbox"},{"id":"light.checkbox.hover","desc":"colorCheckBoxHover","defaultValue":0,"widget":"Checkbox"},{"id":"light.checkbox.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Checkbox"},{"id":"light.checkbox.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Checkbox"},{"id":"light.checkbox.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Checkbox"},{"id":"light.dialog.button_icon","desc":"imageColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.background","desc":"backgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.header_background","desc":"headerBackgroundColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.header_text","desc":"titleColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.footer_background","desc":"footerBackgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_text","desc":"buttonFontColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_press","desc":"pressColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_icon","desc":"fullscreenCloseIconColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.close_button_fullscreen_press","desc":"fullscreenCloseIconPressColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.divider","desc":"dividerColor","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"light.dialog.overlay","desc":"overlayColor","defaultValue":6,"widget":"Dialog, Dialog iFrame"},{"id":"light.button.icon.background_off","desc":"colorBgFalse","defaultValue":7,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"light.button.icon.background_on","desc":"colorBgTrue","defaultValue":7,"widget":"Icon Button Toggle"},{"id":"light.button.icon.pressed","desc":"colorPress","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"light.button.icon.icon_off","desc":"imageColor","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"light.button.icon.icon_on","desc":"imageTrueColor","defaultValue":0,"widget":"Icon Button Toggle"},{"id":"light.button.icon.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"light.button.icon.lock_icon_background","desc":"lockIconBackground","defaultValue":7,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"light.icon_list.header","desc":"headerTextColor","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.background","desc":"containerBackgroundColor","defaultValue":7,"widget":"Icon List"},{"id":"light.icon_list.background_items","desc":"itemBackgroundColor","defaultValue":5,"widget":"Icon List"},{"id":"light.icon_list.text","desc":"labelFontColor","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.text_selected","desc":"labelFontColorSelected","defaultValue":2,"widget":"Icon List"},{"id":"light.icon_list.subText","desc":"subLabelFontColor","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.subText_selected","desc":"subLabelFontColorSelected","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.value_text","desc":"valueFontColor","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.icon","desc":"listImageColor","defaultValue":0,"widget":"Icon List"},{"id":"light.icon_list.button","desc":"buttonBgColor","defaultValue":7,"widget":"Icon List"},{"id":"light.icon_list.button_hover","desc":"buttonColorPress","defaultValue":0,"widget":"Icon List"},{"id":"light.icon_list.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon List"},{"id":"light.input.text","desc":"inputTextColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.label","desc":"inputLabelColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.label_selected","desc":"inputLabelColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.appendix","desc":"inputAppendixColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.message","desc":"inputMessageColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.counter","desc":"inputCounterColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.border","desc":"inputLayoutBorderColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"light.input.border_hover","desc":"inputLayoutBorderColorHover","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.border_selected","desc":"inputLayoutBorderColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"light.input.icon_clear","desc":"clearIconColor","defaultValue":0,"widget":"Input, Select, Autocomplete"},{"id":"light.input.icon_collapse","desc":"collapseIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"light.input.menu.background","desc":"listItemBackgroundColor","defaultValue":5,"widget":"Select, Autocomplete"},{"id":"light.input.menu.hover","desc":"listItemBackgroundHoverColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"light.input.menu.selected","desc":"listItemBackgroundSelectedColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"light.input.menu.effect","desc":"listItemRippleEffectColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"light.input.menu.icon","desc":"listIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"light.input.menu.text","desc":"listItemFontColor","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"light.input.menu.subText","desc":"listItemSubFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"light.input.menu.value","desc":"listItemValueFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"light.material_design_icon.color","desc":"mdwIconColor","defaultValue":0,"widget":"Material Design Icon"},{"id":"light.list.background","desc":"listBackground","defaultValue":5,"widget":"List"},{"id":"light.list.header_main","desc":"headerTextColor","defaultValue":2,"widget":"List"},{"id":"light.list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"List"},{"id":"light.list.background_off","desc":"listItemBackground","defaultValue":7,"widget":"List"},{"id":"light.list.background_on","desc":"listItemBackgroundActive","defaultValue":7,"widget":"List"},{"id":"light.list.hover","desc":"colorListItemHover","defaultValue":6,"widget":"List"},{"id":"light.list.selected","desc":"colorListItemSelected","defaultValue":6,"widget":"List"},{"id":"light.list.text","desc":"colorListItemText","defaultValue":2,"widget":"List"},{"id":"light.list.subText","desc":"colorListItemTextSecondary","defaultValue":1,"widget":"List"},{"id":"light.list.text_right","desc":"colorListItemTextRight","defaultValue":2,"widget":"List"},{"id":"light.list.subText_right","desc":"colorListItemTextSecondaryRight","defaultValue":1,"widget":"List"},{"id":"light.list.header","desc":"colorListItemHeaders","defaultValue":1,"widget":"List"},{"id":"light.list.divider","desc":"colorListItemDivider","defaultValue":4,"widget":"List"},{"id":"light.list.icon_off","desc":"listImageColor","defaultValue":0,"widget":"List"},{"id":"light.list.icon_on","desc":"listImageActiveColor","defaultValue":0,"widget":"List"},{"id":"light.progress.track_background","desc":"colorProgressBackground","defaultValue":4,"widget":"Progress, Progress Circular"},{"id":"light.progress.track","desc":"colorProgress","defaultValue":0,"widget":"Progress, Progress Circular"},{"id":"light.progress.text","desc":"textColor","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"light.progress.track_condition1","desc":"colorOne","defaultValue":9,"widget":"Progress, Progress Circular"},{"id":"light.progress.track_condition2","desc":"colorTwo","defaultValue":10,"widget":"Progress, Progress Circular"},{"id":"light.progress.circular_background","desc":"innerColor","defaultValue":7,"widget":"Progress Circular"},{"id":"light.slider.background","desc":"colorSliderBg","defaultValue":7,"widget":"Slider, Slider Round"},{"id":"light.slider.control","desc":"colorThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"light.slider.control_before","desc":"colorBeforeThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"light.slider.control_behind","desc":"colorAfterThumb","defaultValue":4,"widget":"Slider, Slider Round"},{"id":"light.slider.text","desc":"valueLabelColor","defaultValue":2,"widget":"Slider, Slider Round"},{"id":"light.slider.text_prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Slider"},{"id":"light.slider.tick","desc":"tickTextColor","defaultValue":1,"widget":"Slider"},{"id":"light.slider.tick_before","desc":"tickColorBefore","defaultValue":0,"widget":"Slider"},{"id":"light.slider.tick_after","desc":"tickColorAfter","defaultValue":0,"widget":"Slider"},{"id":"light.slider.control_background","desc":"thumbBackgroundColor","defaultValue":0,"widget":"Slider"},{"id":"light.slider.control_text","desc":"thumbFontColor","defaultValue":5,"widget":"Slider"},{"id":"light.switch.on","desc":"colorSwitchTrue","defaultValue":0,"widget":"Switch, List"},{"id":"light.switch.on_hover","desc":"colorSwitchHoverTrue","defaultValue":0,"widget":"Switch, List"},{"id":"light.switch.off","desc":"colorSwitchThumb","defaultValue":5,"widget":"Switch, List"},{"id":"light.switch.off_hover","desc":"colorSwitchHover","defaultValue":0,"widget":"Switch, List"},{"id":"light.switch.track","desc":"colorSwitchTrack","defaultValue":6,"widget":"Switch, List"},{"id":"light.switch.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Switch"},{"id":"light.switch.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Switch"},{"id":"light.switch.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Switch"},{"id":"light.table.background","desc":"colorBackground","defaultValue":5,"widget":"Table"},{"id":"light.table.row_header_background","desc":"colorHeaderRowBackground","defaultValue":5,"widget":"Table"},{"id":"light.table.row_header_text","desc":"colorHeaderRowText","defaultValue":2,"widget":"Table"},{"id":"light.table.row_background","desc":"colorRowBackground","defaultValue":7,"widget":"Table"},{"id":"light.table.row_hover","desc":"colorRowBackgroundHover","defaultValue":4,"widget":"Table"},{"id":"light.table.row_text","desc":"colorRowText","defaultValue":2,"widget":"Table"},{"id":"light.table.border","desc":"borderColor","defaultValue":4,"widget":"Table"},{"id":"light.table.dividers","desc":"dividers","defaultValue":4,"widget":"Table"},{"id":"light.top_app_bar.background","desc":"colorTopAppBarBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.icon","desc":"topAppBarIconColor","value":"#FFFFFF","widget":"Top App Bar"},{"id":"light.top_app_bar.title","desc":"colorTopAppBarTitle","defaultValue":5,"widget":"Top App Bar"},{"id":"light.top_app_bar.menu_background","desc":"colorDrawerBackground","defaultValue":5,"widget":"Top App Bar"},{"id":"light.top_app_bar.header_background","desc":"colorDrawerHeaderBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.header_text","desc":"colorListItemHeaders","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_background","desc":"colorDrawerItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_hover","desc":"colorListItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_selected","desc":"colorListItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_text","desc":"colorListItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon","desc":"iconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon_selected","desc":"iconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_icon","desc":"subIconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_icon_selected","desc":"subIconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_text_selected","desc":"colorListItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_text_disabled","desc":"colorListItemTextDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon_disabled","desc":"colorListItemIconDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"light.top_app_bar.item_divider","desc":"colorListItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_icon_toggle","desc":"colorSubItemToggleIcon","defaultValue":0,"widget":"Top App Bar"},{"id":"light.top_app_bar.item_backdrop_background_text_off","desc":"colorDrawerbackdropLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"light.top_app_bar.item_backdrop_background_text_on","desc":"colorDrawerbackdropLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_background_all","desc":"colorDrawerSubBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_background","desc":"colorDrawerSubItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_hover","desc":"colorListSubItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_selected","desc":"colorListSubItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_text","desc":"colorListSubItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_text_selected","desc":"colorListSubItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_divider","desc":"colorListSubItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_backdrop_background_text_off","desc":"colorDrawerbackdropSubLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"light.top_app_bar.subItem_backdrop_background_text_on","desc":"colorDrawerbackdropSubLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"light.value.text","desc":"valuesFontColor","defaultValue":2,"widget":"Value"},{"id":"light.value.prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Value"},{"id":"light.value.append","desc":"appendTextColor","defaultValue":2,"widget":"Value"},{"id":"light.value.icon","desc":"imageColor","defaultValue":0,"widget":"Value"},{"id":"light.scripts.adapterStatus.title","desc":"title color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.subTitle","desc":"instance color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.datapoints.desc","desc":"description color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.datapoints.value","desc":"value color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.datapoints.icon","desc":"icon color","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.active","desc":"statusbar: adapter is active","defaultValue":8,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.notActive","desc":"statusbar: adapter is not active","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.notConnected","desc":"statusbar: adapter is notConnected","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.deactivated","desc":"statusbar: adapter is deactivated","value":"#A9A9A9","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.schedule","desc":"statusbar: adapter is from type schedule","value":"#90EE90","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.extension","desc":"statusbar: adapter is from type extension","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.statusBar.once","desc":"statusbar: adapter is from type once","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.icons.upgradeable","desc":"icon upgradeable","value":"#ec0909","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.icons.logParser.warn","desc":"logParser warn icon","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.icons.logParser.error","desc":"logParser error icon","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.background","desc":"Select: background","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.border","desc":"Select: border","value":"#a1a1a1","widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.border_hover","desc":"Select: border hover","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.border_selected","desc":"Select: border selected","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.text","desc":"Select: text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.label","desc":"Select: label text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"light.scripts.adapterStatus.select.icon","desc":"Select: icons","defaultValue":5,"widget":"AdapterStatus [Script]"}]`),OK=JSON.parse(`[{"id":"dark.alerts.close_icon","desc":"closeIconColor","defaultValue":0,"widget":"Alerts"},{"id":"dark.alerts.close_icon_hover","desc":"closeIconPressColor","defaultValue":0,"widget":"Alerts"},{"id":"dark.button.default.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"dark.button.default.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog, Dialog iFrame"},{"id":"dark.button.vertical.primary","desc":"mdwButtonPrimaryColor","defaultValue":0,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"dark.button.vertical.secondary","desc":"mdwButtonSecondaryColor","defaultValue":5,"widget":"Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"dark.button.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Button State vertical, Button State Multi vertical, Button Toggle vertical, Button State, Button State Multi, Button Toggle"},{"id":"dark.calendar.border","desc":"calendarBorderColor","defaultValue":4,"widget":"Calendar"},{"id":"dark.calendar.background_day","desc":"calendarDayBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.background_other_month","desc":"calendarDayBackgroundOutsideColor","value":"#202020","widget":"Calendar"},{"id":"dark.calendar.button_background","desc":"calendarDayButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.button_background_today","desc":"calendarDayButtonTodayColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.button_hover","desc":"calendarDayButtonRippleEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.button_text","desc":"calendarDayButtonFontColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.button_text_today","desc":"calendarDayButtonTodayFontColor","defaultValue":5,"widget":"Calendar"},{"id":"dark.calendar.control_panel_background","desc":"controlButtonColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.control_panel_hover","desc":"controlButtonRippelEffectColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.control_panel_icon","desc":"controlIconColor","defaultValue":0,"widget":"Calendar"},{"id":"dark.calendar.control_panel_text","desc":"controlTextColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.header_background","desc":"calendarHeaderBackground","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.header_text","desc":"calendarDayLabelFontColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.header_text_today","desc":"calendarDayLabelTodayFontColor","defaultValue":2,"widget":"Calendar"},{"id":"dark.calendar.header_text_past","desc":"calendarDayLabelPreviousFontColor","value":"rgba(0, 0, 0, 0.38)","widget":"Calendar"},{"id":"dark.calendar.weeks_background","desc":"calendarWeeksNumbersBackground","value":"#202020","widget":"Calendar"},{"id":"dark.calendar.weeks_text","desc":"calendarWeeksNumbersFontColor","defaultValue":6,"widget":"Calendar"},{"id":"dark.calendar.time_axis_background","desc":"calendarTimeAxisBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.time_axis_background_header","desc":"calendarTimeAxisHeaderBackgroundColor","defaultValue":7,"widget":"Calendar"},{"id":"dark.calendar.time_axis_text","desc":"calendarTimeAxisFontColor","defaultValue":2,"widget":"Calendar"},{"id":"dark.charts.background","desc":"backgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.background_chart","desc":"chartAreaBackgroundColor","defaultValue":7,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.global","desc":"globalColor","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.value","desc":"valuesFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_title","desc":"yAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_values","desc":"yAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_gridlines","desc":"yAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.y_axis_zeroline","desc":"yAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_title","desc":"xAxisTitleColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_values","desc":"xAxisValueLabelColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_gridlines","desc":"xAxisGridLinesColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.x_axis_zeroline","desc":"xAxisZeroLineColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.legend","desc":"legendFontColor","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.tooltip_background","desc":"tooltipBackgroundColor","defaultValue":6,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.tooltip_title","desc":"tooltipTitleFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.tooltip_text","desc":"tooltipBodyFontColor","defaultValue":5,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.charts.bar.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"dark.charts.bar.hover_border","desc":"hoverBorderColor","value":"rgba(68, 115, 158, 0.8)","widget":"Bar Chart"},{"id":"dark.charts.pie.value","desc":"valuesFontColor","defaultValue":5,"widget":"Pie Chart"},{"id":"dark.charts.pie.hover","desc":"hoverColor","value":"rgba(68, 115, 158, 0.8)","widget":"Pie Chart"},{"id":"dark.charts.pie.border","desc":"borderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"dark.charts.pie.border_hover","desc":"hoverBorderColor","defaultValue":5,"widget":"Pie Chart"},{"id":"dark.card.background","desc":"colorBackground","defaultValue":5,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.background_title","desc":"colorTitleSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.background_body","desc":"colorTextSectionBackground","defaultValue":7,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.title","desc":"colorTitle","defaultValue":2,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"dark.card.subTitle","desc":"colorSubtitle","defaultValue":1,"widget":"HTML Card"},{"id":"dark.card.text","desc":"colorBody","defaultValue":2,"widget":"HTML Card"},{"id":"dark.checkbox.on","desc":"colorCheckBox","defaultValue":0,"widget":"Checkbox, List"},{"id":"dark.checkbox.border","desc":"colorCheckBoxBorder","defaultValue":3,"widget":"Checkbox"},{"id":"dark.checkbox.hover","desc":"colorCheckBoxHover","defaultValue":0,"widget":"Checkbox"},{"id":"dark.checkbox.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Checkbox"},{"id":"dark.checkbox.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Checkbox"},{"id":"dark.checkbox.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Checkbox"},{"id":"dark.dialog.button_icon","desc":"imageColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.background","desc":"backgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.header_background","desc":"headerBackgroundColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.header_text","desc":"titleColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.footer_background","desc":"footerBackgroundColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_text","desc":"buttonFontColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_press","desc":"pressColor","defaultValue":2,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_icon","desc":"fullscreenCloseIconColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.close_button_fullscreen_press","desc":"fullscreenCloseIconPressColor","defaultValue":5,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.divider","desc":"dividerColor","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"dark.dialog.overlay","desc":"overlayColor","defaultValue":3,"widget":"Dialog, Dialog iFrame"},{"id":"dark.button.icon.background_off","desc":"colorBgFalse","defaultValue":7,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"dark.button.icon.background_on","desc":"colorBgTrue","defaultValue":7,"widget":"Icon Button Toggle"},{"id":"dark.button.icon.pressed","desc":"colorPress","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"dark.button.icon.icon_off","desc":"imageColor","defaultValue":0,"widget":"Icon Button Navigation, Icon Button Link, Icon Button State, Icon Button State Multi, Icon Button Addition, Icon Button Toggle"},{"id":"dark.button.icon.icon_on","desc":"imageTrueColor","defaultValue":0,"widget":"Icon Button Toggle"},{"id":"dark.button.icon.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"dark.button.icon.lock_icon_background","desc":"lockIconBackground","defaultValue":7,"widget":"Icon Button State, Icon Button State Multi, Icon Button Toggle"},{"id":"dark.icon_list.header","desc":"headerTextColor","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.background","desc":"containerBackgroundColor","defaultValue":7,"widget":"Icon List"},{"id":"dark.icon_list.background_items","desc":"itemBackgroundColor","defaultValue":5,"widget":"Icon List"},{"id":"dark.icon_list.text","desc":"labelFontColor","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.text_selected","desc":"labelFontColorSelected","defaultValue":2,"widget":"Icon List"},{"id":"dark.icon_list.subText","desc":"subLabelFontColor","defaultValue":1,"widget":"Icon List"},{"id":"light.icon_list.subText_selected","desc":"subLabelFontColorSelected","defaultValue":1,"widget":"Icon List"},{"id":"dark.icon_list.value_text","desc":"valueFontColor","defaultValue":1,"widget":"Icon List"},{"id":"dark.icon_list.icon","desc":"listImageColor","defaultValue":0,"widget":"Icon List"},{"id":"dark.icon_list.button","desc":"buttonBgColor","defaultValue":7,"widget":"Icon List"},{"id":"dark.icon_list.button_hover","desc":"buttonColorPress","defaultValue":0,"widget":"Icon List"},{"id":"dark.icon_list.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Icon List"},{"id":"dark.input.text","desc":"inputTextColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.label","desc":"inputLabelColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.label_selected","desc":"inputLabelColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.appendix","desc":"inputAppendixColor","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.message","desc":"inputMessageColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.counter","desc":"inputCounterColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.border","desc":"inputLayoutBorderColor","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.border_hover","desc":"inputLayoutBorderColorHover","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.border_selected","desc":"inputLayoutBorderColorSelected","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.icon_clear","desc":"clearIconColor","defaultValue":0,"widget":"Input, Select, Autocomplete"},{"id":"dark.input.icon_collapse","desc":"collapseIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.background","desc":"listItemBackgroundColor","defaultValue":5,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.hover","desc":"listItemBackgroundHoverColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.selected","desc":"listItemBackgroundSelectedColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.effect","desc":"listItemRippleEffectColor","defaultValue":6,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.icon","desc":"listIconColor","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.text","desc":"listItemFontColor","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.subText","desc":"listItemSubFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"dark.input.menu.value","desc":"listItemValueFontColor","defaultValue":1,"widget":"Select, Autocomplete"},{"id":"dark.material_design_icon.color","desc":"mdwIconColor","defaultValue":0,"widget":"Material Design Icon"},{"id":"dark.list.background","desc":"listBackground","defaultValue":5,"widget":"List"},{"id":"dark.list.header_main","desc":"headerTextColor","defaultValue":2,"widget":"List"},{"id":"dark.list.header_icon","desc":"headerImageColor","defaultValue":2,"widget":"List"},{"id":"dark.list.background_off","desc":"listItemBackground","defaultValue":7,"widget":"List"},{"id":"dark.list.background_on","desc":"listItemBackgroundActive","defaultValue":7,"widget":"List"},{"id":"dark.list.hover","desc":"colorListItemHover","defaultValue":6,"widget":"List"},{"id":"dark.list.selected","desc":"colorListItemSelected","defaultValue":6,"widget":"List"},{"id":"dark.list.text","desc":"colorListItemText","defaultValue":2,"widget":"List"},{"id":"dark.list.subText","desc":"colorListItemTextSecondary","defaultValue":1,"widget":"List"},{"id":"dark.list.text_right","desc":"colorListItemTextRight","defaultValue":2,"widget":"List"},{"id":"dark.list.subText_right","desc":"colorListItemTextSecondaryRight","defaultValue":1,"widget":"List"},{"id":"dark.list.header","desc":"colorListItemHeaders","defaultValue":1,"widget":"List"},{"id":"dark.list.divider","desc":"colorListItemDivider","defaultValue":4,"widget":"List"},{"id":"dark.list.icon_off","desc":"listImageColor","defaultValue":0,"widget":"List"},{"id":"dark.list.icon_on","desc":"listImageActiveColor","defaultValue":0,"widget":"List"},{"id":"dark.progress.track_background","desc":"colorProgressBackground","defaultValue":4,"widget":"Progress, Progress Circular"},{"id":"dark.progress.track","desc":"colorProgress","defaultValue":0,"widget":"Progress, Progress Circular"},{"id":"dark.progress.text","desc":"textColor","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"dark.progress.track_condition1","desc":"colorOne","defaultValue":9,"widget":"Progress, Progress Circular"},{"id":"dark.progress.track_condition2","desc":"colorTwo","defaultValue":10,"widget":"Progress, Progress Circular"},{"id":"dark.progress.circular_background","desc":"innerColor","defaultValue":7,"widget":"Progress Circular"},{"id":"dark.slider.background","desc":"colorSliderBg","defaultValue":7,"widget":"Slider, Slider Round"},{"id":"dark.slider.control","desc":"colorThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"dark.slider.control_before","desc":"colorBeforeThumb","defaultValue":0,"widget":"Slider, Slider Round"},{"id":"dark.slider.control_behind","desc":"colorAfterThumb","defaultValue":4,"widget":"Slider, Slider Round"},{"id":"dark.slider.text","desc":"valueLabelColor","defaultValue":2,"widget":"Slider, Slider Round"},{"id":"dark.slider.text_prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Slider"},{"id":"dark.slider.tick","desc":"tickTextColor","defaultValue":1,"widget":"Slider"},{"id":"dark.slider.tick_before","desc":"tickColorBefore","defaultValue":0,"widget":"Slider"},{"id":"dark.slider.tick_after","desc":"tickColorAfter","defaultValue":0,"widget":"Slider"},{"id":"dark.slider.control_background","desc":"thumbBackgroundColor","defaultValue":0,"widget":"Slider"},{"id":"dark.slider.control_text","desc":"thumbFontColor","defaultValue":5,"widget":"Slider"},{"id":"dark.switch.on","desc":"colorSwitchTrue","defaultValue":0,"widget":"Switch, List"},{"id":"dark.switch.on_hover","desc":"colorSwitchHoverTrue","defaultValue":0,"widget":"Switch, List"},{"id":"dark.switch.off","desc":"colorSwitchThumb","defaultValue":5,"widget":"Switch, List"},{"id":"dark.switch.off_hover","desc":"colorSwitchHover","defaultValue":0,"widget":"Switch, List"},{"id":"dark.switch.track","desc":"colorSwitchTrack","defaultValue":6,"widget":"Switch, List"},{"id":"dark.switch.text_off","desc":"labelColorFalse","defaultValue":2,"widget":"Switch"},{"id":"dark.switch.text_on","desc":"labelColorTrue","defaultValue":2,"widget":"Switch"},{"id":"dark.switch.lock_icon","desc":"lockIconColor","defaultValue":10,"widget":"Switch"},{"id":"dark.table.background","desc":"colorBackground","defaultValue":5,"widget":"Table"},{"id":"dark.table.row_header_background","desc":"colorHeaderRowBackground","defaultValue":5,"widget":"Table"},{"id":"dark.table.row_header_text","desc":"colorHeaderRowText","defaultValue":2,"widget":"Table"},{"id":"dark.table.row_background","desc":"colorRowBackground","defaultValue":7,"widget":"Table"},{"id":"dark.table.row_hover","desc":"colorRowBackgroundHover","defaultValue":4,"widget":"Table"},{"id":"dark.table.row_text","desc":"colorRowText","defaultValue":2,"widget":"Table"},{"id":"dark.table.border","desc":"borderColor","defaultValue":4,"widget":"Table"},{"id":"dark.table.dividers","desc":"dividers","defaultValue":4,"widget":"Table"},{"id":"dark.top_app_bar.background","desc":"colorTopAppBarBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.icon","desc":"topAppBarIconColor","value":"#FFFFFF","widget":"Top App Bar"},{"id":"dark.top_app_bar.title","desc":"colorTopAppBarTitle","defaultValue":5,"widget":"Top App Bar"},{"id":"dark.top_app_bar.menu_background","desc":"colorDrawerBackground","defaultValue":5,"widget":"Top App Bar"},{"id":"dark.top_app_bar.header_background","desc":"colorDrawerHeaderBackground","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.header_text","desc":"colorListItemHeaders","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_background","desc":"colorDrawerItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_hover","desc":"colorListItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_selected","desc":"colorListItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_text","desc":"colorListItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon","desc":"iconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon_selected","desc":"iconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_icon","desc":"subIconDrawerColor","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_icon_selected","desc":"subIconDrawerColorSelected","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_text_selected","desc":"colorListItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_text_disabled","desc":"colorListItemTextDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon_disabled","desc":"colorListItemIconDisabled","value":"rgba(0, 0, 0, 0.38)","widget":"Top App Bar"},{"id":"dark.top_app_bar.item_divider","desc":"colorListItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_icon_toggle","desc":"colorSubItemToggleIcon","defaultValue":0,"widget":"Top App Bar"},{"id":"dark.top_app_bar.item_backdrop_background_text_off","desc":"colorDrawerbackdropLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"dark.top_app_bar.item_backdrop_background_text_on","desc":"colorDrawerbackdropLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_background_all","desc":"colorDrawerSubBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_background","desc":"colorDrawerSubItemBackground","defaultValue":7,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_hover","desc":"colorListSubItemHover","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_selected","desc":"colorListSubItemSelected","defaultValue":6,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_text","desc":"colorListSubItemText","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_text_selected","desc":"colorListSubItemTextSelected","defaultValue":2,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_divider","desc":"colorListSubItemDivider","defaultValue":4,"widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_backdrop_background_text_off","desc":"colorDrawerbackdropSubLabelBackground","value":"rgba(0,0,0,0.5)","widget":"Top App Bar"},{"id":"dark.top_app_bar.subItem_backdrop_background_text_on","desc":"colorDrawerbackdropSubLabelBackgroundActive","value":"#1e88e566","widget":"Top App Bar"},{"id":"dark.value.text","desc":"valuesFontColor","defaultValue":2,"widget":"Value"},{"id":"dark.value.prepand","desc":"prepandTextColor","defaultValue":2,"widget":"Value"},{"id":"dark.value.append","desc":"appendTextColor","defaultValue":2,"widget":"Value"},{"id":"dark.value.icon","desc":"imageColor","defaultValue":0,"widget":"Value"},{"id":"dark.scripts.adapterStatus.title","desc":"title color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.subTitle","desc":"instance color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.datapoints.desc","desc":"description color","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.datapoints.value","desc":"value color","defaultValue":1,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.datapoints.icon","desc":"icon color","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.active","desc":"statusbar: adapter is active","defaultValue":8,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.notActive","desc":"statusbar: adapter is not active","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.notConnected","desc":"statusbar: adapter is notConnected","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.deactivated","desc":"statusbar: adapter is deactivated","value":"#A9A9A9","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.schedule","desc":"statusbar: adapter is from type schedule","value":"#90EE90","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.extension","desc":"statusbar: adapter is from type extension","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.statusBar.once","desc":"statusbar: adapter is from type once","value":"#44739e","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.icons.upgradeable","desc":"icon upgradeable","value":"#ec0909","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.icons.logParser.warn","desc":"logParser warn icon","defaultValue":9,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.icons.logParser.error","desc":"logParser error icon","defaultValue":10,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.background","desc":"Select: background","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.border","desc":"Select: border","value":"#a1a1a1","widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.border_hover","desc":"Select: border hover","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.border_selected","desc":"Select: border selected","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.text","desc":"Select: text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.label","desc":"Select: label text","defaultValue":5,"widget":"AdapterStatus [Script]"},{"id":"dark.scripts.adapterStatus.select.icon","desc":"Select: icons","defaultValue":5,"widget":"AdapterStatus [Script]"}]`),kK=[`#44739e`,`#808080`,`#44739e`,`rgba(0, 0, 0, 0.54)`,`rgba(161, 161, 161, 0.26)`,`#FFFFFF`,`#000000`,`rgba(0, 0, 0, 0)`,`#008000`,`#FFD700`,`#B22222`,`#FFA500`,`#303030`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`],AK=[`#44739e`,`#FFFFFF9C`,`#FFFFFF`,`rgba(0, 0, 0, 0.54)`,`#9E9E9E`,`#303030`,`#BDBDBD`,`rgba(0, 0, 0, 0)`,`#008000`,`#FFD700`,`#B22222`,`#FFA500`,`#303030`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`,`#FFFFFF`],jK=[10,12,14,16,20,22,24,30,32,36,40,60],MK=[`RobotoCondensed-Regular`,`RobotoCondensed-Italic`,`RobotoCondensed-Light`,`RobotoCondensed-LightItalic`,`RobotoCondensed-Bold`,`RobotoCondensed-BoldItalic`,`Arial`,`Verdana`,`Times New Roman`,`Jura-Regular`,`Jura-Medium`,`Jura-Light`],NK=JSON.parse(`[{"id":"alerts.text","desc":"alertFontSize","defaultValue":3,"widget":"Alerts"},{"id":"button.default.text","desc":"textFontSize","defaultValue":2,"widget":"Buttons, Dialog, Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog iFrame"},{"id":"button.vertical.text","desc":"textFontSize","defaultValue":3,"widget":"Buttons, Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"calendar.control","desc":"controlTextSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.header","desc":"calendarDayLabelFontSize","defaultValue":1,"widget":"Calendar"},{"id":"calendar.today","desc":"calendarDayLabelTodayFontSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.weeks","desc":"calendarWeeksNumbersFontSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.button","desc":"calendarDayButtonFontSize","defaultValue":2,"widget":"Calendar"},{"id":"calendar.button_today","desc":"calendarDayButtonTodayFontSize","defaultValue":3,"widget":"Calendar"},{"id":"calendar.event","desc":"calendarEventFontSize","defaultValue":1,"widget":"Calendar"},{"id":"calendar.time_axis","desc":"calendarTimeAxisFontSize","defaultValue":2,"widget":"Calendar"},{"id":"charts.value","desc":"valuesFontSize","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_title","desc":"yAxisTitleFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_values","desc":"yAxisValueFontSize","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_title","desc":"xAxisTitleFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_values","desc":"xAxisValueFontSize","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.legend","desc":"legendFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_title","desc":"tooltipTitleFontSize","defaultValue":4,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_text","desc":"tooltipBodyFontSize","defaultValue":3,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.title","desc":"titleLayout","defaultValue":6,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.subTitle","desc":"subtitleLayout","defaultValue":2,"widget":"HTML Card"},{"id":"card.text","desc":"textFontSize","defaultValue":3,"widget":"HTML Card"},{"id":"checkbox.value","desc":"valueFontSize","defaultValue":3,"widget":"Checkbox"},{"id":"dialog.title","desc":"titleFontSize","defaultValue":7,"widget":"Dialog, Dialog iFrame"},{"id":"dialog.button","desc":"buttonFontSize","defaultValue":3,"widget":"Dialog, Dialog iFrame"},{"id":"icon_list.header","desc":"headerTextSize","defaultValue":4,"widget":"Icon List"},{"id":"icon_list.text","desc":"labelFontSize","defaultValue":3,"widget":"Icon List"},{"id":"icon_list.subText","desc":"subLabelFontSize","defaultValue":2,"widget":"Icon List"},{"id":"icon_list.value","desc":"valueFontSize","defaultValue":1,"widget":"Icon List"},{"id":"input.text","desc":"inputTextFontSize","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.label","desc":"inputLabelFontSize","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.appendix","desc":"inputAppendixFontSize","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.message","desc":"inputMessageFontSize","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.counter","desc":"inputCounterFontSize","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.dropdown.text","desc":"listItemFontSize","defaultValue":3,"widget":"Select, Autocomplete"},{"id":"input.dropdown.subText","desc":"listItemSubFontSize","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"input.dropdown.value","desc":"listItemValueFontSize","defaultValue":2,"widget":"Select, Autocomplete"},{"id":"list.header_main","desc":"headerTextSize","defaultValue":4,"widget":"List"},{"id":"list.header","desc":"listItemHeaderTextSize","defaultValue":4,"widget":"List"},{"id":"list.text","desc":"listItemTextSize","defaultValue":3,"widget":"List"},{"id":"list.subText","desc":"listItemSubTextSize","defaultValue":2,"widget":"List"},{"id":"list.text_right","desc":"listItemTextRightSize","defaultValue":3,"widget":"List"},{"id":"list.subText_right","desc":"listItemSubTextRightSize","defaultValue":2,"widget":"List"},{"id":"progress.text","desc":"textFontSize","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"slider.prepand","desc":"prepandTextFontSize","defaultValue":3,"widget":"Slider"},{"id":"slider.control","desc":"thumbFontSize","defaultValue":2,"widget":"Slider"},{"id":"slider.value","desc":"valueFontSize","defaultValue":3,"widget":"Slider, Slider Round"},{"id":"slider.ticks","desc":"tickFontSize","defaultValue":2,"widget":"Slider"},{"id":"switch.value","desc":"valueFontSize","defaultValue":3,"widget":"Switch"},{"id":"table.header","desc":"headerTextSize","defaultValue":4,"widget":"Table"},{"id":"table.row","desc":"colTextSize","defaultValue":3,"widget":"Table"},{"id":"top_app_bar.title","desc":"titleFontSize","defaultValue":4,"widget":"Top App Bar"},{"id":"top_app_bar.header","desc":"listItemHeaderTextSize","defaultValue":2,"widget":"Top App Bar"},{"id":"top_app_bar.item","desc":"listItemTextSize","defaultValue":2,"widget":"Top App Bar"},{"id":"top_app_bar.subItem","desc":"listSubItemTextSize","defaultValue":2,"widget":"Top App Bar"},{"id":"value.text","desc":"valuesFontSize","defaultValue":2,"widget":"Value"},{"id":"value.prepand","desc":"prepandTextFontSize","defaultValue":2,"widget":"Value"},{"id":"value.append","desc":"appendTextFontSize","defaultValue":2,"widget":"Value"},{"id":"scripts.adapterStatus.title","desc":"title text size","defaultValue":4,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.subTitle","desc":"instance text size","defaultValue":3,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.desc","desc":"description text size","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.value","desc":"value text size","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.icons.upgradeable","desc":"upgradeable icon size","defaultValue":7,"widget":"AdapterStatus [Script]"}]`),PK=JSON.parse(`[{"id":"alerts.text","desc":"alertFontFamily","defaultValue":0,"widget":"Alerts"},{"id":"button.default.text","desc":"textFontFamily","defaultValue":0,"widget":"Buttons, Dialog, Button Navigation, Button Link, Button State, Button State Multi, Button Addition, Button Toggle, Dialog iFrame"},{"id":"button.vertical.text","desc":"textFontFamily","defaultValue":0,"widget":"Buttons, Button Navigation vertical, Button Link vertical, Button State vertical, Button State Multi vertical, Button Addition vertical, Button Toggle vertical"},{"id":"calendar.control","desc":"controlTextFont","defaultValue":0,"widget":"Calendar"},{"id":"calendar.header","desc":"calendarDayLabelFontFamily","defaultValue":0,"widget":"Calendar"},{"id":"calendar.today","desc":"calendarDayLabelTodayFontFamily","defaultValue":4,"widget":"Calendar"},{"id":"calendar.weeks","desc":"calendarWeeksNumbersFont","defaultValue":3,"widget":"Calendar"},{"id":"calendar.button","desc":"calendarDayButtonFontFamily","defaultValue":2,"widget":"Calendar"},{"id":"calendar.button_today","desc":"calendarDayButtonTodayFontFamily","defaultValue":4,"widget":"Calendar"},{"id":"calendar.event","desc":"calendarEventFont","defaultValue":2,"widget":"Calendar"},{"id":"calendar.time_axis","desc":"calendarTimeAxisFont","defaultValue":3,"widget":"Calendar"},{"id":"charts.value","desc":"valuesFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_title","desc":"yAxisTitleFontFamily","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.y_axis_values","desc":"yAxisValueFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_title","desc":"xAxisTitleFontFamily","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.x_axis_values","desc":"xAxisValueFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.legend","desc":"legendFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_title","desc":"tooltipTitleFontFamily","defaultValue":0,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"charts.tooltip_text","desc":"tooltipBodyFontFamily","defaultValue":2,"widget":"Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.title","desc":"titleFontFamily","defaultValue":0,"widget":"HTML Card, Icon List, Bar Chart, Pie Chart, Line History Chart, JSON Chart"},{"id":"card.subTitle","desc":"subTitleFontFamily","defaultValue":3,"widget":"HTML Card"},{"id":"card.text","desc":"textFontFamily","defaultValue":0,"widget":"HTML Card"},{"id":"checkbox.value","desc":"valueFontFamily","defaultValue":0,"widget":"Checkbox"},{"id":"dialog.title","desc":"titleFont","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"dialog.button","desc":"buttonFont","defaultValue":0,"widget":"Dialog, Dialog iFrame"},{"id":"icon_list.header","desc":"headerFontFamily","defaultValue":9,"widget":"Icon List"},{"id":"icon_list.text","desc":"labelFontFamily","defaultValue":0,"widget":"Icon List"},{"id":"icon_list.subText","desc":"subLabelFontFamily","defaultValue":2,"widget":"Icon List"},{"id":"icon_list.value","desc":"valueFontFamily","defaultValue":3,"widget":"Icon List"},{"id":"input.text","desc":"inputTextFontFamily","defaultValue":0,"widget":"Input, Select, Autocomplete"},{"id":"input.label","desc":"inputLabelFontFamily","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.appendix","desc":"inputAppendixFontFamily","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.message","desc":"inputMessageFontFamily","defaultValue":3,"widget":"Input, Select, Autocomplete"},{"id":"input.counter","desc":"inputCounterFontFamily","defaultValue":2,"widget":"Input, Select, Autocomplete"},{"id":"input.dropdown.text","desc":"listItemFont","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"input.dropdown.subText","desc":"listItemSubFont","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"input.dropdown.value","desc":"listItemValueFont","defaultValue":0,"widget":"Select, Autocomplete"},{"id":"list.header_main","desc":"headerFontFamily","defaultValue":9,"widget":"List"},{"id":"list.header","desc":"headerFontFamily","defaultValue":0,"widget":"List"},{"id":"list.text","desc":"listItemFont","defaultValue":0,"widget":"List"},{"id":"list.subText","desc":"listItemSubFont","defaultValue":3,"widget":"List"},{"id":"list.text_right","desc":"listItemRightFont","defaultValue":2,"widget":"List"},{"id":"list.subText_right","desc":"listItemSubRightFont","defaultValue":3,"widget":"List"},{"id":"progress.text","desc":"textFontFamily","defaultValue":2,"widget":"Progress, Progress Circular"},{"id":"slider.prepand","desc":"prepandTextFontFamily","defaultValue":0,"widget":"Slider"},{"id":"slider.control","desc":"thumbFontFamily","defaultValue":2,"widget":"Slider"},{"id":"slider.value","desc":"valueFontFamily","defaultValue":2,"widget":"Slider, Slider Round"},{"id":"slider.ticks","desc":"tickFontFamily","defaultValue":3,"widget":"Slider"},{"id":"switch.value","desc":"valueFontFamily","defaultValue":0,"widget":"Switch"},{"id":"table.header","desc":"headerFontFamily","defaultValue":0,"widget":"Table"},{"id":"table.row","desc":"fontFamily","defaultValue":0,"widget":"Table"},{"id":"top_app_bar.title","desc":"titleFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.header","desc":"listItemHeaderFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.item","desc":"listItemTextFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.item_disabled","desc":"listItemTextFontDisabled","defaultValue":3,"widget":"Top App Bar"},{"id":"top_app_bar.subItem","desc":"listItemSubTextFont","defaultValue":0,"widget":"Top App Bar"},{"id":"top_app_bar.subItem_disabled","desc":"listItemSubTextFontDisabled","defaultValue":3,"widget":"Top App Bar"},{"id":"value.text","desc":"valuesFontFamily","defaultValue":0,"widget":"Value"},{"id":"value.prepand","desc":"prepandTextFontFamily","defaultValue":0,"widget":"Value"},{"id":"value.append","desc":"appendTextFontFamily","defaultValue":0,"widget":"Value"},{"id":"scripts.adapterStatus.title","desc":"title text font","defaultValue":0,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.subTitle","desc":"instance text font","defaultValue":3,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.desc","desc":"description text font","defaultValue":2,"widget":"AdapterStatus [Script]"},{"id":"scripts.adapterStatus.datapoints.value","desc":"value text font","defaultValue":2,"widget":"AdapterStatus [Script]"}]`),FK=`modulepreload`,IK=function(e,t){return new URL(e,t).href},LK={},RK=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=IK(t,n),t=s(t),t in LK)return;LK[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:FK,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},zK=[`de`,`en`,`es`,`fr`,`it`,`nl`,`pl`,`pt`,`ru`,`uk`,`zh-cn`],BK={};async function VK(e){let t=zK.includes(e)?e:`en`;if(!BK[t])try{let e=await l(Object.assign({"../../admin/i18n/de.json":()=>RK(()=>import(`./de.js`),[],import.meta.url),"../../admin/i18n/en.json":()=>RK(()=>import(`./en.js`),[],import.meta.url),"../../admin/i18n/es.json":()=>RK(()=>import(`./es.js`),[],import.meta.url),"../../admin/i18n/fr.json":()=>RK(()=>import(`./fr.js`),[],import.meta.url),"../../admin/i18n/it.json":()=>RK(()=>import(`./it.js`),[],import.meta.url),"../../admin/i18n/nl.json":()=>RK(()=>import(`./nl.js`),[],import.meta.url),"../../admin/i18n/pl.json":()=>RK(()=>import(`./pl.js`),[],import.meta.url),"../../admin/i18n/pt.json":()=>RK(()=>import(`./pt.js`),[],import.meta.url),"../../admin/i18n/ru.json":()=>RK(()=>import(`./ru.js`),[],import.meta.url),"../../admin/i18n/uk.json":()=>RK(()=>import(`./uk.js`),[],import.meta.url),"../../admin/i18n/zh-cn.json":()=>RK(()=>import(`./zh-cn.js`),[],import.meta.url)}),`../../admin/i18n/${t}.json`,5);BK[t]=e.default??e}catch{}}var HK={colors:{entries:DK,defaults:kK,title:`default light colors`,widgetTitle:`Widget colors`},colorsDark:{entries:OK,defaults:AK,title:`default dark colors`,widgetTitle:`Widget colors`},fonts:{entries:PK,defaults:MK,title:`config_fonts`,widgetTitle:`Widget fonts`},fontSizes:{entries:NK,defaults:jK,title:`config_fontSizes`,widgetTitle:`Widget font sizes`}},UK=e=>zk.t(e);function WK(e){return`default${e}`}function GK(e,t){let n=HK[t].defaults,r=e[WK(t)],i=Array.isArray(r)?n.map((e,t)=>r[t]??e):[...n];return t===`fontSizes`?i.map(e=>Number(e)):i}function KK(e,t,n){let r=Array.isArray(e[t])?e[t]:[];return HK[t].entries.map(e=>{let i=r.find(t=>t.id===e.id),a=i?.defaultValue,o=a===``?NaN:Number(a),s=Number.isInteger(o)&&o>=0&&o<n.length?o:i?void 0:e.defaultValue,c=i?.value??e.value??n[s??0];return{...e,...i,defaultValue:s,value:t===`fontSizes`?Number(c):c}})}function qK(e){let[t,n]=(0,R.useState)(0),[r,i]=(0,R.useState)(``),a=[`colors`,`colorsDark`,`fonts`,`fontSizes`][t],o=HK[a],s=GK(e.config,a),c=KK(e.config,a,s),l=(0,R.useMemo)(()=>c.filter(e=>e.widget.toLowerCase().includes(r.toLowerCase())),[c,r]),u=t=>e.update(WK(a),t),d=t=>e.update(a,t);return(0,z.jsxs)(_x,{sx:{p:1,py:2},children:[(0,z.jsxs)(lO,{value:t,onChange:(e,t)=>{n(t),i(``)},sx:{borderBottom:1,borderColor:`divider`},variant:`scrollable`,scrollButtons:`auto`,children:[(0,z.jsx)(tD,{label:UK(`config_colors`)}),(0,z.jsx)(tD,{label:UK(`config_colorsDark`)}),(0,z.jsx)(tD,{label:UK(`config_fonts`)}),(0,z.jsx)(tD,{label:UK(`config_fontSizes`)})]}),(0,z.jsx)(Gx,{sx:{mt:2},children:(0,z.jsxs)(Yx,{children:[(0,z.jsxs)(_x,{sx:{display:`flex`,alignItems:`center`,gap:2,mb:2},children:[(0,z.jsx)(vv,{variant:`h6`,children:UK(o.title)}),(0,z.jsx)(Vx,{sx:{ml:`auto`},onClick:()=>{u([...o.defaults]),d(KK({[a]:[]},a,[...o.defaults]))},children:UK(`reset`)})]}),(0,z.jsx)(_x,{sx:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(210px, 1fr))`,gap:2},children:s.map((e,t)=>(0,z.jsxs)(_x,{sx:{alignItems:`center`,display:`flex`,gap:1},children:[a.startsWith(`colors`)&&(0,z.jsx)(_x,{"aria-label":String(e),sx:{backgroundColor:String(e),border:1,borderColor:`divider`,borderRadius:.5,flex:`0 0 auto`,height:28,width:28}}),a===`fonts`&&(0,z.jsx)(vv,{sx:{flex:`0 0 auto`,fontFamily:String(e),fontSize:22,minWidth:32},children:`Aa`}),a===`fontSizes`&&(0,z.jsx)(vv,{sx:{flex:`0 0 auto`,fontSize:`${Number(e)||14}px`,minWidth:32},children:`Aa`}),(0,z.jsx)(mO,{fullWidth:!0,label:`${UK(`${a}Default`)} ${t}`,type:a===`fontSizes`?`number`:`text`,value:e,variant:`standard`,onChange:e=>{let n=[...s];n[t]=a===`fontSizes`?Number(e.target.value):e.target.value,u(n)}})]},t))})]})}),(0,z.jsx)(Gx,{sx:{mt:2},children:(0,z.jsxs)(Yx,{children:[(0,z.jsxs)(_x,{sx:{display:`flex`,gap:2,alignItems:`center`,mb:2,flexWrap:`wrap`},children:[(0,z.jsx)(vv,{variant:`h6`,children:UK(o.widgetTitle)}),(0,z.jsx)(mO,{label:UK(`Filter Widgets`),value:r,onChange:e=>i(e.target.value),variant:`standard`,sx:{ml:`auto`,minWidth:220}})]}),(0,z.jsx)(CD,{component:T_,variant:`outlined`,children:(0,z.jsxs)(sD,{size:`small`,children:[(0,z.jsx)(kD,{children:(0,z.jsxs)(VD,{children:[(0,z.jsx)(yD,{children:UK(`Widget`)}),(0,z.jsx)(yD,{children:UK(`description`)}),(0,z.jsx)(yD,{children:UK(`${a}_table`)}),(0,z.jsx)(yD,{children:UK(`${a}Default`)})]})}),(0,z.jsx)(mD,{children:l.map(e=>(0,z.jsxs)(VD,{children:[(0,z.jsx)(yD,{children:e.widget}),(0,z.jsx)(yD,{children:UK(e.desc)}),(0,z.jsx)(yD,{children:(0,z.jsxs)(_x,{sx:{display:`flex`,alignItems:`center`,gap:1},children:[a.startsWith(`colors`)&&(0,z.jsx)(_x,{"aria-label":String(e.value??``),sx:{backgroundColor:String(e.value??`transparent`),border:1,borderColor:`divider`,borderRadius:.5,flex:`0 0 auto`,height:24,width:24}}),(0,z.jsx)(mO,{fullWidth:!0,type:a===`fontSizes`?`number`:`text`,value:e.value??``,variant:`standard`,onChange:t=>d(c.map(n=>n.id===e.id?{...n,value:a===`fontSizes`?Number(t.target.value):t.target.value,defaultValue:void 0}:n))})]})}),(0,z.jsx)(yD,{children:(0,z.jsx)(_x,{sx:{display:`flex`,gap:.5,flexWrap:`wrap`},children:s.map((t,n)=>(0,z.jsx)(Vx,{size:`small`,variant:e.defaultValue===n?`contained`:`outlined`,onClick:()=>d(c.map(t=>t.id===e.id?{...t,defaultValue:n,value:s[n]}:t)),children:n},n))})})]},e.id))})]})})]})})]})}function JK(e){let[t,n]=(0,R.useState)(0);return(0,z.jsxs)(_x,{component:`main`,sx:{height:{xs:`calc(100% - 56px)`,sm:`calc(100% - 64px)`},overflowY:`auto`},children:[(0,z.jsxs)(_x,{sx:{minHeight:72,position:`relative`,px:1,py:1},children:[(0,z.jsx)(fG,{common:e.common,instance:e.instance,native:e.config,onError:e.onError,onLoad:e.onLoad}),(0,z.jsx)(vv,{component:`h1`,variant:`h6`,sx:{fontWeight:700,position:`absolute`,top:18,left:84},children:`Material Design Widgets`})]}),(0,z.jsxs)(lO,{value:t,onChange:(e,t)=>n(t),sx:{borderBottom:1,borderColor:`divider`},children:[(0,z.jsx)(tD,{icon:(0,z.jsx)(sk,{}),iconPosition:`start`,label:UK(`config_general`)}),(0,z.jsx)(tD,{icon:(0,z.jsx)(ek,{}),iconPosition:`start`,label:UK(`Theme Editor for your Widgets`)})]}),t===0?(0,z.jsxs)(_x,{sx:{p:1,py:2,display:`grid`,gap:2},children:[(0,z.jsx)(Gx,{children:(0,z.jsxs)(Yx,{children:[(0,z.jsx)(vv,{variant:`h6`,gutterBottom:!0,children:UK(`Generate global script`)}),(0,z.jsx)(mO,{fullWidth:!0,label:UK(`script name`),value:String(e.config.scriptName??`Theme`),variant:`standard`,onChange:t=>e.update(`scriptName`,t.target.value)}),(0,z.jsx)(mO,{fullWidth:!0,label:UK(`name of the variable`),value:String(e.config.variableName??`myMdwTheme`),sx:{mt:2},variant:`standard`,onChange:t=>e.update(`variableName`,t.target.value)}),(0,z.jsx)(mO,{fullWidth:!0,label:UK(`SelectJavascriptInstance`),value:String(e.config.javascriptInstance??``),sx:{mt:2},variant:`standard`,onChange:t=>e.update(`javascriptInstance`,t.target.value)}),(0,z.jsx)(Vx,{variant:`contained`,sx:{mt:2},onClick:e.onGenerate,children:UK(`generate script`)})]})}),(0,z.jsx)(Gx,{children:(0,z.jsxs)(Yx,{children:[(0,z.jsx)(vv,{variant:`h6`,children:UK(`Sentry - automatic error reporting`)}),(0,z.jsxs)(WC,{sx:{pt:1},children:[(0,z.jsx)(BC,{control:(0,z.jsx)(dS,{checked:e.config.sentryReport===!0,onChange:t=>e.update(`sentryReport`,t.target.checked)}),label:UK(`send Widget error reports`)}),(0,z.jsx)(XC,{sx:{ml:4,mt:-.5},children:UK(`sentryInfo`)})]})]})})]}):(0,z.jsx)(qK,{config:e.config,update:e.update})]})}var YK=class extends $k{constructor(e){super(e,{adapterName:`vis2-materialdesign`,bottomButtons:!0,translations:BK})}onPrepareLoad(e){super.onPrepareLoad(e),[`colors`,`colorsDark`,`fonts`,`fontSizes`].forEach(t=>{let n=GK(e,t);e[WK(t)]=n,e[t]=KK(e,t,n)})}async ensureAncestorChannels(e,t,n){let r=e.substring(t.length+1).split(`.`);r.pop();let i=t;for(let e of r)i=`${i}.${e}`,!n.has(i)&&(n.add(i),await this.socket.getObject(i)||await this.socket.setObject(i,{type:`channel`,common:{name:e},native:{}}))}async setThemeState(e,t,n){let r=typeof n==`number`?`number`:`string`,i=r===`number`?`value`:`text`,a=await this.socket.getObject(e);a?(a.common.name!==t||a.common.type!==r||a.common.role!==i)&&await this.socket.setObject(e,{...a,common:{...a.common,name:t,desc:t,type:r,role:i}}):await this.socket.setObject(e,{type:`state`,common:{name:t,desc:t,type:r,read:!0,write:!1,role:i},native:{}}),await this.socket.setState(e,n,!0)}async syncRuntimeStates(){let e=this.state.native,t=`${this.adapterName}.${this.instance}`,n=new Set;await this.socket.setState(`${t}.sentry`,e.sentryReport===!0,!0);for(let r of[`colors`,`colorsDark`,`fonts`,`fontSizes`]){let i=GK(e,r),a=KK(e,r,i);for(let[e,a]of i.entries()){let i=r===`colors`?`${t}.colors.light.default_${e}`:r===`colorsDark`?`${t}.colors.dark.default_${e}`:`${t}.${r}.default_${e}`;await this.ensureAncestorChannels(i,t,n),await this.setThemeState(i,`${UK(`${r}Default`)} ${e}`,a)}for(let e of a){let i=r.startsWith(`colors`)?`${t}.colors.${e.id}`:`${t}.${r}.${e.id}`;await this.ensureAncestorChannels(i,t,n),await this.setThemeState(i,UK(e.desc),e.value??``)}}await this.socket.setState(`${t}.lastchange`,Date.now(),!0)}async generateGlobalScript(){let e=this.state.native,t=String(e.javascriptInstance??``),n=String(e.variableName??`myMdwTheme`);if(!t||!/^[A-Za-z_$][\w$]*$/.test(n)){this.showAlert(UK(`SelectJavascriptInstance`),`warning`);return}let r=`${this.adapterName}.${this.instance}`,i=await this.socket.getObjectView(`${r}.`,`${r}.\u9999`,`state`),a=[`var ${n} = {};`],o=new Set;Object.keys(i).filter(e=>e!==`${r}.colors.darkTheme`).sort().forEach(e=>{let t=n;e.substring(r.length+1).split(`.`).forEach(e=>{t+=`.${e}`,o.has(t)||(a.push(`${t} = {};`),o.add(t))}),a.push(`${t}.getId = function () { return "${e}"; };`),a.push(`${t}.getValue = function () { return getState("${e}").val; };`)});let s=`script.js.global.MaterialDesignWidgets.${r.replace(`.`,``)}`;await this.socket.setObject(s,{type:`script`,common:{name:String(e.scriptName??`Theme`),expert:!0,engineType:`Javascript/js`,engine:`system.adapter.${t}`,source:a.join(`
685
+ `),debug:!1,verbose:!1,enabled:!0}}),this.showAlert(UK(`generate script`),`success`)}onSave(e){super.onSave(!1),this.syncRuntimeStates().then(()=>{e||this.showAlert(UK(`theme states synced`),`success`)}).catch(e=>this.showAlert(String(e),`error`)).finally(()=>{e&&$k.onClose()})}async onConnectionReady(){let e=this.socket.systemLang;e&&!BK[e]&&(await VK(e),BK[e]&&(zk.extendTranslations(BK[e],e),this.forceUpdate()))}render(){return this.state.loaded?(0,z.jsxs)(ss,{theme:this.state.theme,children:[(0,z.jsx)(SS,{}),(0,z.jsx)(JK,{common:this.common,config:this.state.native,instance:this.instance,onError:this.showError,onLoad:e=>this.setState({native:e}),update:(e,t)=>this.updateNativeValue(e,t),onGenerate:()=>void this.generateGlobalScript().catch(e=>this.showAlert(String(e),`error`))}),this.renderHelperDialogs()]}):(0,z.jsx)(Mk,{})}};async function XK(){let e=window.sysLang||navigator.language?.split(`-`)[0]||`en`;await Promise.all([VK(`en`),VK(e)]),(0,EK.createRoot)(document.getElementById(`root`)).render((0,z.jsx)(YK,{}))}XK();